Probing at an angle

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

Probing at an angle

Postby neodd70 » Fri Mar 03, 2023 12:58 pm

I am trying to write a macro that will probe in both X and Y at the same time however I am having trouble figuring out how to stop the movement once it is executed. I'm trying to tell my machine to move to a specific XY position which will be slight further then the edge of the stock then when the probe touches the stock...stop so I can record the machines position. I have tried a number of combinations but not sure why its not working.

One way I did get it to work was to have this code in a macro loop
Code: Select all
if(AS3.GetLED(37))
{
exec.Stop();
}


I really want it all in one macro and thought this would work.
Code: Select all
exec.Code("G01 X10 Y10 F20");
while(exec.IsMoving())
{
if(AS3.GetLED(37))
{
exec.Stop();
}
}


but once the movement has started it won't stop unless I hit the cycle stop button. Can anyone tell me what I'm doing wrong?
neodd70
 
Posts: 5
Joined: Fri Sep 30, 2022 3:51 pm

Re: Probing at an angle

Postby ger21 » Fri Mar 03, 2023 2:57 pm

I think if you enable Probe Safe Mode, it'll stop when the probe is triggered.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2679
Joined: Sat Sep 03, 2016 2:17 am

Re: Probing at an angle

Postby Battwell » Sat Mar 04, 2023 10:24 am

it wont stop because you have the while(exec.ismoving())
this stops anything from being done while its in motion.
remove that line.
Uc300eth on router and mill.
UK uccnc powered machine sales. https://cncrouter.uk/atc-cnc-routers.htm
Automateanything/duzzit cnc/mercury cnc
Battwell
 
Posts: 832
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk

Re: Probing at an angle

Postby neodd70 » Sun Mar 05, 2023 10:44 am

ger21 wrote:I think if you enable Probe Safe Mode, it'll stop when the probe is triggered.


I haven't tried that yet....I'll give it a shot and see if it works.

Battwell wrote:it wont stop because you have the while(exec.ismoving())
this stops anything from being done while its in motion.
remove that line.


I tried removing that but that didn't solve it either. Also correct me if I'm wrong but since that's a while loop which basically just keeps the rest of the macro from running until the machine goes idle so whatever you put in the while loop will run over and over until the condition is no longer true then it will exit the while so it should see when the probe is triggered because its inside that while loop.
neodd70
 
Posts: 5
Joined: Fri Sep 30, 2022 3:51 pm


Return to Macros

Who is online

Users browsing this forum: No registered users and 4 guests