one button drilling machine development

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

one button drilling machine development

Postby Battwell » Fri Apr 14, 2023 3:55 pm

something fun i have worked on for a couple of mornings. can i do this? hold my coffee. lol
my friend has "created a monster drilling machine with no idea how to make it work" he just wants to press one button and the machine does the magic for him. (great brief).
i added some funny messages for him too.
works so far- but he hasnt told me exactly what he wants at each point- so for now its just a peck drill example which he was amazed by.
i will make a simple screen for him so he doesnt get confused!
ive dropped the code below so you can see how you can funk around to get the job done.

if you want to see it in uccnc save it as m20000 in your macros folder and type m20000 enter in mdi.

here it is working on screen. (forgot to video it on the machine) https://www.youtube.com/watch?v=zOdETaYVLVA

Code: Select all
// MERCURY CNC.    www.cncrouter.uk
 int holesnum=5;
double width=38;
double barstop=100;  //width of centre stop
int maxhole=600; // maximum hole distance
int end=150;  //end distance
double zstart=5; // z drill peck backoff
double zdepth=0; //  z  final depth
int drillfeed=250;  // feed speed drill cycle
double ztravel=40; // z rapid height

int position=0;

double length = exec.Question("RAIL LENGTH ??");


switch (MessageBox.Show(exec.mainform,"CORRECT SIZE ?  " + length, "CELTIC JEFFS AMAZING CREATION", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
        {
 
            case DialogResult.No:
                //Action if No
            exec.AddStatusmessage(" WRONG SIZE !   TYPE IT PROPERLY IDIOT");
                return;
            
            case DialogResult.Yes:
             //Action if yes
            {}
                //Application.Exit();
                break;
       
         if(exec.Ismacrostopped())
   { 
  MessageBox.Show(exec.mainform,"WRONG SIZE START AGAIN");
 
exec.StopWithDeccel();
return;
   } 
   }

/// calculations ///

double divlength=((length-(2*end))/holesnum);
if (divlength>maxhole)
{holesnum=(holesnum+1);divlength=((length-(2*end))/holesnum);}
exec.AddStatusmessage(holesnum+" holes"+"  spacing "+divlength);

// set vars to use in codelist.
exec.Setvar(length,10); //length
exec.Setvar((width/2),11); //width/2
exec.Setvar(barstop,12); //  centre stop width
exec.Setvar(end,13); //  end distance
exec.Setvar(divlength,14); //  gap distance
exec.Setvar(zstart,15); //  z backoff
exec.Setvar(zdepth,16); //  z drill final depth
exec.Setvar(drillfeed,17); //  z drill feed speed
exec.Setvar(ztravel,18); //  z rapid height

exec.Code("G90");
exec.Code("#18");

//first position
position=(position+1);
List<string> codelist = new List<string>(); //Create a new List of strings.

codelist.Add("G0 x#13 y#11"); //Add g-code lines to the List.//first position /// this is the code that runs at each position.
codelist.Add("M3 s15000");
codelist.Add("z#18");
codelist.Add("G73 X#13 Y#11 z#16 r#15 Q1 F#17");  // simple peck drill example

exec.Codelist(codelist); //Execute the List of g-codes.




for (int i = 1; i <= (holesnum-1); i++)
{
position=(position+1);
exec.AddStatusmessage(" Position "+(position));
exec.Code("#13=#13+#14");
exec.Code("G0 x#13 y#11");


exec.Codelist(codelist);
}
position=(position+1);
exec.Code("#11=#11+#11+#12"); //second row move
exec.AddStatusmessage(" Position " +position +"     ROW 2");
exec.Code("G0 x#13 y#11"); //first position

exec.Codelist(codelist);

for (int i = 1; i <= (holesnum-1); i++)
{
position=(position+1);
exec.AddStatusmessage(" Position "+(position));
exec.Code("#13=#13-#14");
exec.Code("G0 x#13 y#11");
exec.Codelist(codelist);
}


exec.Code("m5");
exec.Code("m200");
exec.AddStatusmessage(" BRENDON IS THE BEST PROGRAMMER !");
exec.Code("m30");
Uc300eth on router and mill.
UK uccnc powered machine sales. https://cncrouter.uk/atc-cnc-routers.htm
Automateanything/duzzit cnc/mercury cnc
Battwell
 
Posts: 867
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk

Re: one button drilling machine development

Postby Battwell » Fri Apr 14, 2023 9:15 pm

[img]
[/img]
Attachments
08A5A4BF-0A98-4485-916E-B40E37E6E473.jpeg
Uc300eth on router and mill.
UK uccnc powered machine sales. https://cncrouter.uk/atc-cnc-routers.htm
Automateanything/duzzit cnc/mercury cnc
Battwell
 
Posts: 867
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk


Return to Macros

Who is online

Users browsing this forum: No registered users and 12 guests