Running a Mach3 Macro with UCCNC

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

Running a Mach3 Macro with UCCNC

Postby krsykes23 » Tue May 10, 2022 8:26 pm

I'm not great with macros and need some advice. I've switched over to UCCNC from using Mach3 for quite a few years. My question is, can I run an existing macro created for Mach3?

The attached file is unedited, just as it was when I used it in Mach3. It ran perfectly with the 8 position linear tool-rack and ATC, which I still have the same machine, just UCCNC and an AXBB-E.

There are variables in the file which I can change to 'hard text', as they got data from DROs in Mach3. The DROs had the positions for the 8 tools in the rack. I guess UCCNC can do this...but I don't know how to do it, unless someone can help with this.
Attachments
M6Start - Copy.txt
(4.95 KiB) Downloaded 336 times
krsykes23
 
Posts: 43
Joined: Wed Apr 27, 2022 9:29 am

Re: Running a Mach3 Macro with UCCNC

Postby eabrust » Wed May 11, 2022 1:30 am

Hi krsykes,

UCCNC is more fully capable at macro programming than Mach3. And you also get to choose between using C# or VB as your language.

It might seem daunting at first, but it won't be hard to convert your existing macro for use w/ UCCNC.

As a starting point, I can offer you to take a look at this lathe tool-changer macro here: http://www.forum.cncdrive.com/viewtopic.php?f=20&t=3299#p24264. It should give you a rough starting point and some of the differences in code calls.

To require the least amount of work, since Mach3 macros are 'VB', I recommend you to keep it in VB. To do so, the first line of your macro should be

Code: Select all
#VB


From there, if you look at the example, where ever you see code(" gcode here") from your mach3 macro, you'll replace it w/ the UCCNC version of call:
Code: Select all
exec.code("gcode here")


Mach3's 'while ismoving' becomes 'while exec.ismoving' in UCCNC, etc (you'll start to see a pattern of calling 'exec.' in front of most calls that directly transfer from Mach3, or are close to it.

You will need to handle pulling DRO values (and putting DRO values in) differently, both the DRO numbers are far different, and the calls are different. Take a look in the UCCNC help files for the DRO,button, LED number lists.

Also look at the signature line of the user 'Robertspark' on the forum, he's put together an excellent 'macro guide' that has most anything you need to know.

Start reading some of the reference materials, and making some mods to your macro, and we'll help as we can.

regards
Eric
CraftyCNC: Plugins for UCCNC (and other neat stuff): http://www.craftycnc.com/plugins-for-uccnc/
eabrust
 
Posts: 357
Joined: Fri Sep 16, 2016 2:32 am
Location: Near Shirland IL, USA

Re: Running a Mach3 Macro with UCCNC

Postby krsykes23 » Wed May 11, 2022 4:45 am

Hi Eric,

Many thanks for the reply, much appreciated.

I'll take a look at "Robertspark's" guide and see if I can understand the basics. The macro was actually sent to me by another Mach3 user a few years ago, as he had a similar machine to mine. He helped me to add the various DROs in it was perfect for the application. I'll also make a start today on editing the example M6 with the basic changes you mentioned and see if I can get it to work.

For the last few days I've been making a custom screenset for UCCNC, based on my existing (old) Mach3 setup. As I have had UCCNC for only a couple of weeks, the switch to this new software was a bit daunting but I'm getting there.....slowly, with a bit of help from this forum.

I'll let you know how I get on and hope that you can offer some more help if I need it.

Many thanks and regards,

Keith
krsykes23
 
Posts: 43
Joined: Wed Apr 27, 2022 9:29 am

Re: Running a Mach3 Macro with UCCNC

Postby krsykes23 » Wed May 11, 2022 5:45 pm

Unfortunately, I'm not getting anywhere with this! I spent all day trying to figure out and modify the macro but with no success.

However, I did manage to modify the Goto Park1 Position macro (M200) and set a button on the new screenset. But I'm really struggling with understanding the Toolchange in UCCNC.

With Mach3, I had 8 buttons on the screen, labelled T1 to T8. Each button had code assigned to them....code "M6 T1", code "M6 T2", code "M6 T3" etc. With a button press, it put the current tool back in the rack, moved to the requested tool and picked it up. I assume the (Mach3) M6 macro called for another 'sub' macro....as when I enter M6 T_ in the MDI, it just changes the tool number in the field (2652).

Excuse my ignorance but if anyone can assist me, I'd be grateful.

Thanks.

Keith
krsykes23
 
Posts: 43
Joined: Wed Apr 27, 2022 9:29 am

Re: Running a Mach3 Macro with UCCNC

Postby ger21 » Wed May 11, 2022 9:59 pm

Your M6 macro in Mach3 contains all the code to change your tools. That's the macro you need to convert.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: Running a Mach3 Macro with UCCNC

Postby krsykes23 » Thu May 12, 2022 9:35 am

I'm reaching out for some much-needed help!!

I have switched over to UCCNC from Mach3, after ten years or so with no problems. The main reason for changing was the out-dated parallel port and some PC issues. I built a new electronics controller cabinet, purchased an AXBB-E and UCCNC. The CNC is unchanged, apart from new wiring and suchlike. Having configured UCCNC to the AXBB-E, everything works fine. I have movement on all three axis, limit switches, ATC drawbar, E-Stop, probe and UCR201 pendant.

Is there anyone willing to create/modify the macro for the 8 tools? I don't have the necessary skills to do it myself from scratch. I am however, OK to copy/modify and possibly create new macros, once I have a working example.

I would be willing to pay for this service, as I have a (previously working) machine that I can't continue to configure.

Just to finish of this message, having tried again last night and this morning, I noticed in the Errors, it said "Cannot find M99998.txt". I searched the hard drive of the old Mach3 setup and that macro didn't even exist!!!

If anyone is interested in helping, I'd be happy to do it by e-mail.

Thanks

Keith
krsykes23
 
Posts: 43
Joined: Wed Apr 27, 2022 9:29 am

Re: Running a Mach3 Macro with UCCNC

Postby krsykes23 » Thu May 12, 2022 9:58 am

OK....I'm a complete IDIOT!!

I had "Ignore Tool Change (M6)" checked in Configs. I now have some movement when I run M6 T? from the MDI.

However, the Z axis went the wrong way. Later today, I'll check what the issue is and see if it's a setting that I have made in error.
krsykes23
 
Posts: 43
Joined: Wed Apr 27, 2022 9:29 am

Re: Running a Mach3 Macro with UCCNC

Postby eabrust » Thu May 12, 2022 11:05 am

For the pocket positioning, it looks like your old Mach3 code relied on DROs 120X to define the pocket locations (x/y/z).

Unless you want to recreate all those DROs, you can just hard code the positions into the macro in the same spots as where it was trying to pull the DRO value.

This attached M6 is mostly converted for the syntax of UCCNC, but I left the whole sub routine where the pocket locations get values set as commented out. Right now if you run it, you'll only get a pop up message box indicating the 'old' and 'new' tools that will be set. Also items related to the air and clamp outputs are commented out, as it will need to be setup depending on what output pins you used, so come back to it later and work the macro in small chunks

You'll also need to ensure your machine homes and sets machine coordinates the same as what Mach3 did. That could be a reason you're Z is going down instead of up, etc, or the reason could be because the pocket locations weren't defined.

good luck
Eric
Attachments
M6-test.txt
(5.71 KiB) Downloaded 330 times
CraftyCNC: Plugins for UCCNC (and other neat stuff): http://www.craftycnc.com/plugins-for-uccnc/
eabrust
 
Posts: 357
Joined: Fri Sep 16, 2016 2:32 am
Location: Near Shirland IL, USA

Re: Running a Mach3 Macro with UCCNC

Postby krsykes23 » Fri May 13, 2022 7:20 am

Hi Eric,

Again, thanks for the reply. When I tried the tool change, I was literally on my way out to pick my daughter up, so I just shut the system down and left. But was pleased that it was at least doing something, as well as feeling a fool!

I've decided to revert back to using (and hopefully further editing) the UCCNC M6 macro, the "Example Linear Toolchanger", as this now pretty much works. I've set the correct X, Y and Z coordinates for the 8 tool positions in the rack, including the Ztoolrelease and Ztoolpickup.

However, there's an error with the Drawbar, which I can't understand. When I run the M6 Tx from MDI, the machine moves to the correct position to place the current tool back, BUT...the Drawbar doesn't open. Then, Z moves up to SafeZ (correct), moves to the New Tool position (correct), Z lowers to pick up the new tool (correct)....and here's where the problem is....the drawbar then opens (and stays open)!

The code looks correct, "exec.Setoutpin(Chuckopenport, Chuckopenpin); // Open the chuck with pneumatic valve" is in the correct.

The bit that I don't understand is that the correct Pin and Port for the Drawbar are correct (as it works)...and...I can open/close the Drawbar from a button on the screenset.

Any idea why the Drawbar is not opening when releasing the current tool?
Attachments
M6.txt
(3.7 KiB) Downloaded 297 times
krsykes23
 
Posts: 43
Joined: Wed Apr 27, 2022 9:29 am

Re: Running a Mach3 Macro with UCCNC

Postby ger21 » Fri May 13, 2022 10:56 am

Is your active low setting backwards?
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Next

Return to General discussion about the UCCNC software

Who is online

Users browsing this forum: Google [Bot] and 15 guests