Macro help , GOTO zero and zero all.

Post anything you want to discuss with others about the software.

Macro help , GOTO zero and zero all.

Postby CNCChris » Tue Jun 25, 2024 2:26 am

Hi

1. How do I adjust the GOTO zero button to only GOTO XY, im working from cnc bed not material top so I don't want z to slam Into the material.

2. How do I adjust the Zero all button to only Zero XY? Because I am working from the bed up it's set and I don't need to change it again.

3. And with the 2 macro adjustments above, how do I adjust the buttons to suit?

Thanks
Chris
CNCChris
 
Posts: 27
Joined: Fri May 17, 2019 8:20 am

Re: Macro help , GOTO zero and zero all.

Postby cncdrive » Tue Jun 25, 2024 4:28 pm

Edit the M216 macro in the UCCNC/Profiles/Macro folder and change the code to suit your needs, the code is commented, so basically you jsut have to remove the Z movements from the code.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: Macro help , GOTO zero and zero all.

Postby CNCChris » Tue Jul 02, 2024 5:35 am

Thanks, and which button is this for? I asked about 2 different buttons.
CNCChris
 
Posts: 27
Joined: Fri May 17, 2019 8:20 am

Re: Macro help , GOTO zero and zero all.

Postby Battwell » Fri Jul 05, 2024 6:54 pm

goto zero without z down move.
replace M204 with this version
( M216 that was pointed out is goto safe Z :-) )

// Go to Zero with safeZ

if (exec.GetXpos() == 0 && exec.GetYpos() == 0 && exec.GetZpos() == 0 && exec.GetApos() == 0 && exec.GetBpos() == 0 && exec.GetCpos() == 0)
{
return; // if all position DROs are already zero then return
}

exec.Getactualoffset();

double safeZ = exec.mainform.UCsetup.UCset.Generalsettings.SafeZ;
double Softlimitsrelative = exec.mainform.UCsetup.UCset.Axis[2].UC100axis.SoftLimitP - exec.ofc.Wzval - exec.ofc.TOZval - exec.ofc.G92zval;

if (exec.mainform.UCsetup.UCset.Generalsettings.Enablesoftlimits)
{
if (safeZ > Softlimitsrelative)
{
safeZ = Softlimitsrelative;
if (exec.GetXpos() != 0 || exec.GetYpos() != 0 || exec.GetApos() != 0 || exec.GetBpos() != 0 || exec.GetCpos() != 0)
{
DialogResult result = MessageBox.Show(exec.mainform.MSG.Message[45], "Confirmation", MessageBoxButtons.YesNo);
if (result == DialogResult.No)
{
return;
}
}
}
}

while (exec.IsMoving()) { }
int originaldistancemode = exec.actualdistmode; // remember the distance mode
int originalmodalmode = exec.actualmodal; // remember the modal mode
exec.Code("G90"); // Set system to absolute distance mode
exec.Wait(100);

if (exec.GetXpos() != 0 || exec.GetYpos() != 0 || exec.GetApos() != 0 || exec.GetBpos() != 0 || exec.GetCpos() != 0)
{
if ((exec.GetZpos() * exec.GetZscale()) < safeZ) //Move Z only if the Z coordinate is lower than the safeZ
{
exec.Code("G00 Z" + (safeZ / exec.GetZscale())); // Move Z up to safeZ defined by user, above the zero plane
while (exec.IsMoving()) { }
}
exec.Code("G00 X0 Y0 A0 B0 C0"); // Move XYABC to Zero
while (exec.IsMoving()) { }

//exec.Code("G00 Z0"); // Move Z to 0
//while (exec.IsMoving()) { }
}
else
{
//exec.Code("G00 Z0"); // Move Z to 0
while (exec.IsMoving()) { }
}

exec.Code("G" + originaldistancemode); // Set system back to the original distance mode
exec.Code("G" + originalmodalmode); // Set system back to the original modal mode
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 General discussion about the UCCNC software

Who is online

Users browsing this forum: No registered users and 37 guests