Tool Zero does not zero

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

Tool Zero does not zero

Postby Bluebell » Tue Sep 29, 2020 2:17 am

I have switched fro Mach3 to UCCNC. The process has been relatively painless and I find UCCNC easier to use than MACH3.

But I am having trouble with the tool zero macro. My Mac3 macro worked fine,. But, in its original form, M31 did not seem to zero Z work coordinates, and it is much more complicated with its tool offsets and so on than I need for my simple 6040.

So after much research I came up with this macro:

exe.code(G31 Z-10 F100")
while(exec.IsMoving()){};

exec.Setvar(0,228); //Set Z DRO to zero
AS3.Validatefield(228);

But, this did not set the Z axis DRO, which seems to be field 228 , to zero It sets it to 1mm above zero.

I then deleted the last two lines so the probe stops on contact , and I then manually zero the Z DRO

.
While this works, it is a bit clumsy.

Can anyone suggest why the above macro sets Z to 1mm above the work surface, and what the macro should be to properly set the tool Z to zero?
Bluebell
 
Posts: 8
Joined: Thu Sep 10, 2020 7:30 am

Re: Tool Zero does not zero

Postby ger21 » Tue Sep 29, 2020 10:56 am

Code: Select all
AS3.Setfield(0, 228); // Set Z axis DRO to new zeroed position
AS3.Validatefield(228);
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: Tool Zero does not zero

Postby Bluebell » Tue Sep 29, 2020 11:20 pm

Thanks Ger.

Reading only Pidgin C++ and writing even less of the C# dialect, in my hours of attempted self teaching i missed the Setfield instruction

Now I can cut my PCBs with less pain, I shall now retire to the relative comfort of PicBasic and Pic micro controllers.
Bluebell
 
Posts: 8
Joined: Thu Sep 10, 2020 7:30 am

Re: Tool Zero does not zero

Postby cncdrive » Wed Sep 30, 2020 12:01 am

You can write macros in Visual Basic too if Basic programming language is more comfortable for you.
You just have to put the #VB to the very first line of the macro and then the software will use the Visual Basic compiler instead of C#.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: Tool Zero does not zero

Postby Smokie555 » Sat Jun 08, 2024 10:33 am

Funny I'm in the same position Bluebell (Mach on a 6040 and now onto UCCNC on an Interact). Could you please post your new working Micro so I can see where to insert these new lines, or maybe this is the intire mircro? Many thanks
Smokie555
 
Posts: 5
Joined: Sun Feb 04, 2024 9:46 pm


Return to Macros

Who is online

Users browsing this forum: No registered users and 14 guests