Macros not working in mdi or gcode, but work in editor


Results 1 to 14 of 14

Thread: Macros not working in mdi or gcode, but work in editor

  1. #1
    Member QuinnSjoblom's Avatar
    Join Date
    Nov 2017
    Location
    bigfork
    Posts
    591
    Downloads
    0
    Uploads
    0

    Default Macros not working in mdi or gcode, but work in editor

    Messing around with some swap axis macros and stuff. I'm getting it to do what i want when running it in the editor, but when calling the m code in mdi or adding to g code, it won't work. I've tried adding while wend loops before and after, also a sleep, tried saving as multiple m codes, not sure why it won't run. My A axis ref home works fine in all cases, in editor, in mdi, in code. My swap axis only works in editor. It is written as
    SwapAxis(6,3) it swaps the A axis and spindle pin out. Like I said, works in editor, not in code or mdi. What am I doing wrong?

    Similar Threads:


  2. #2
    Member ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Township
    Posts
    35538
    Downloads
    1
    Uploads
    0

    Default Re: Macros not working in mdi or gcode, but work in editor

    Is there an error message? Or does nothing happen at all? Any chance you are calling the wrong macros?

    Gerry

    UCCNC 2017 Screenset
    [URL]http://www.thecncwoodworker.com/2017.html[/URL]

    Mach3 2010 Screenset
    [URL]http://www.thecncwoodworker.com/2010.html[/URL]

    JointCAM - CNC Dovetails & Box Joints
    [URL]http://www.g-forcecnc.com/jointcam.html[/URL]

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  3. #3
    Member QuinnSjoblom's Avatar
    Join Date
    Nov 2017
    Location
    bigfork
    Posts
    591
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by ger21 View Post
    Is there an error message? Or does nothing happen at all? Any chance you are calling the wrong macros?
    No error message, nothing at all. I'm sure I'm calling the right ones. Saved them as m1200 for ref A, which works fine, m1201 for swap, m1202 for unswap. Both work in editor, neither work when calling



  4. #4
    Member QuinnSjoblom's Avatar
    Join Date
    Nov 2017
    Location
    bigfork
    Posts
    591
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by ger21 View Post
    Is there an error message? Or does nothing happen at all? Any chance you are calling the wrong macros?
    I figured it out. I'm using a clone xml for playing with these macros in case I screw something up. When opening the vb editor in clone profile, writing a macro, saving as an m code, for some reason it's saving it into my other standard xml macro file, which means it doesn't exist in the clone profile. Not sure why it's doing that, but after copying the macro from the standard macro file to the clone macro file, it works. I guess I probably need to look at where it's saving it to when saving a macro



  5. #5
    Member ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Township
    Posts
    35538
    Downloads
    1
    Uploads
    0

    Default Re: Macros not working in mdi or gcode, but work in editor

    That's what I meant by calling the right macro. I should have been more clear.

    Gerry

    UCCNC 2017 Screenset
    [URL]http://www.thecncwoodworker.com/2017.html[/URL]

    Mach3 2010 Screenset
    [URL]http://www.thecncwoodworker.com/2010.html[/URL]

    JointCAM - CNC Dovetails & Box Joints
    [URL]http://www.g-forcecnc.com/jointcam.html[/URL]

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  6. #6
    Member QuinnSjoblom's Avatar
    Join Date
    Nov 2017
    Location
    bigfork
    Posts
    591
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by ger21 View Post
    That's what I meant by calling the right macro. I should have been more clear.
    Ah ok, that makes sense. Yeah it was just defaulting to mach3 mill xml when saving them. Needed to change the save location to the correct xml.
    Now that that's sorted, things are working great. Not as difficult as I thought it would be to make this happen. That was the easy part though. Still need to do the x z swap, which should be just as simple once i parrallel my 2 x stepper drivers to same step/dir pin to eliminate the need for the whole slave mess. Hard part for me is gonna be putting these in the tool change macro to be activated based on tool number. Less than 100, no swap, greater than 100, swap. Im assuming it should happen in the m6 end half of it so the tool change has already happened, then it can get the tool number dro and run through the greater than or less than 100 logic. I've also read that it isn't such a great idea to call a macro from a macro so I'll probably delete these and do the swaps directly in the m6.

    I read something in the programmers manual that I hope doesn't mean what I think it does. It says:
    "It is
    illegal to perform two consecutive swaps, without first executing a ResetAxisSwap().
    Doing so will likely result in incorrect operation."

    What exactly does this mean? Does it just mean you shouldnt re swap the same 2 axis to undo the swap? Or does it literally mean I also can't do 2 separate swap axis at the same time? If that's the case, not sure how I'll make this work since I need 2 swaps. One for A-spindle, one for x-z. Both need to be active together for my lathe mode to work.

    Last edited by QuinnSjoblom; 03-17-2019 at 09:46 AM.


  7. #7
    Member ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Township
    Posts
    35538
    Downloads
    1
    Uploads
    0

    Default Re: Macros not working in mdi or gcode, but work in editor

    The simple answer is to setup two or more profiles.
    One for regular milling, and one for 4 axis.

    Doing so will likely result in incorrect operation
    You'll need to do some testing, but it sounds like it won't work, or there's a bug that prevents it from working properly.

    Does it just mean you shouldn't re swap the same 2 axis to undo the swap?
    ResetSwapAxis() undoes the swap.

    Gerry

    UCCNC 2017 Screenset
    [URL]http://www.thecncwoodworker.com/2017.html[/URL]

    Mach3 2010 Screenset
    [URL]http://www.thecncwoodworker.com/2010.html[/URL]

    JointCAM - CNC Dovetails & Box Joints
    [URL]http://www.g-forcecnc.com/jointcam.html[/URL]

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  8. #8
    Member QuinnSjoblom's Avatar
    Join Date
    Nov 2017
    Location
    bigfork
    Posts
    591
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by ger21 View Post
    The simple answer is to setup two or more profiles.
    One for regular milling, and one for 4 axis.


    You'll need to do some testing, but it sounds like it won't work, or there's a bug that prevents it from working properly.


    ResetSwapAxis() undoes the swap.
    Yep, I understand reset swap axis unswaps them, I was just hoping they were referring to a scenario of not being allowed to just swap twice to unswap, but it sounds like they are saying you can't even do 2 separate swaps which is bad news for me. I'll test it and make sure.

    2 separate profiles would definitely be easiest. No swapping or macros required at all, but I'm hoping to make this work so I can run a single program to finish a part with both turning and milling. If the 2 swaps aren't allowed, I have an idea for a workaround. My machine can be set up in a way so in it's regular state, it's already half swapped. For example, z will normally be vertical and 4th axis will normally be selected as spindle. In this state it will not be useful for either machining mode. When I want lathe mode (selected by tool 100-199) it will call the x-z swap only, when I want 4 axis mode (selected by tool 1-99) it will call the spindle-A swap only. Does that make sense? The default set up of the machine start out as half swapped already and not useful for anything and only a single swap is needed to be functional in one mode or the other



  9. #9
    Member ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Township
    Posts
    35538
    Downloads
    1
    Uploads
    0

    Default Re: Macros not working in mdi or gcode, but work in editor

    but it sounds like they are saying you can't even do 2 separate swaps which is bad news for me. I'll test it and make sure.
    The way I read it is that the behavior may not be consistent, which means buggy?

    Have you considered moving away from Mach3 to something that's actively being developed?

    Gerry

    UCCNC 2017 Screenset
    [URL]http://www.thecncwoodworker.com/2017.html[/URL]

    Mach3 2010 Screenset
    [URL]http://www.thecncwoodworker.com/2010.html[/URL]

    JointCAM - CNC Dovetails & Box Joints
    [URL]http://www.g-forcecnc.com/jointcam.html[/URL]

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  10. #10
    Member QuinnSjoblom's Avatar
    Join Date
    Nov 2017
    Location
    bigfork
    Posts
    591
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by ger21 View Post
    The way I read it is that the behavior may not be consistent, which means buggy?

    Have you considered moving away from Mach3 to something that's actively being developed?
    Yes, I've definitely considered it. Any recommendations? You're a fan of uccnc right? Is it a bit more friendly with this type of stuff? I've also considered mach4



  11. #11
    Member ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Township
    Posts
    35538
    Downloads
    1
    Uploads
    0

    Default Re: Macros not working in mdi or gcode, but work in editor

    Yes, I like UCCNC.
    It's somewhat based on Mach3, so has similar swap axis functionality (this was a major requirement for me, as I have two Z axis I need to swap).
    The manual says you can perform as many swaps as you want, but there's only one reset to reset them all.

    Function: void Swapaxis(int axis1, int axis2)

    Description: This function swaps the step and direction pin numbers and pin negate settings of one axis with another axis. The axis swapping may be done any times, the software saves the swapping sequences.

    The axis number parameter can be in the range of 0 to 5 for the axis X to C axis in order.
    Be careful with saving the axis settings when the swapaxis function is in use. If the settings are saved without pressing the Apply settings button first then the swapped pins will be saved for the axis!

    Example: exec.Swapaxis(0,1); //Swaps the X-axis with Y-axis.


    Function: void Resetswapaxis()
    Description: This function resets the swap axis sequence with rolling back all the previously called axis swapping sequences.
    Example: exec.Resetswapaxis();
    Most things in UCCNC are very similar to Mach3, but some things are considerably easier to do.

    Want to add external buttons to control things. Simple. Just add the port and pin number, and select the function from a list. You can add up to 96 buttons like this.
    Want to add pots for FRO and spindle override. With a UC300ETH or AXBB controller, you just wire them up, and your done.

    They have a really good deal right now with their new AXBB controller. For a limited time, you get a free UCCNC license. It will also work with Mach3 and Mach4.
    https://cnc4pc.com/axbb-e-ethernet-m...troller-b.html

    I don't know Lua, that Mach4 uses, so I can't tell you how it is to program. Imo, it's probably more powerful, but more complex.

    Gerry

    UCCNC 2017 Screenset
    [URL]http://www.thecncwoodworker.com/2017.html[/URL]

    Mach3 2010 Screenset
    [URL]http://www.thecncwoodworker.com/2010.html[/URL]

    JointCAM - CNC Dovetails & Box Joints
    [URL]http://www.g-forcecnc.com/jointcam.html[/URL]

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  12. #12
    Member QuinnSjoblom's Avatar
    Join Date
    Nov 2017
    Location
    bigfork
    Posts
    591
    Downloads
    0
    Uploads
    0

    Default Re: Macros not working in mdi or gcode, but work in editor

    I'll look into uccnc for sure. One thing I noticed in what you quoted from the manual though, swap axis integers are 0-5 for xyzabc. What about spindle? In mach3 it's 0-6 which adds the spindle as a swappable axis. Is this allowed in uccnc?



  13. #13
    Member ger21's Avatar
    Join Date
    Mar 2003
    Location
    Shelby Township
    Posts
    35538
    Downloads
    1
    Uploads
    0

    Default Re: Macros not working in mdi or gcode, but work in editor

    Maybe not. I didn't think about that. You'll need to ask them, but it doesn't look like it.

    You have your spindle setup for step/dir?

    Gerry

    UCCNC 2017 Screenset
    [URL]http://www.thecncwoodworker.com/2017.html[/URL]

    Mach3 2010 Screenset
    [URL]http://www.thecncwoodworker.com/2010.html[/URL]

    JointCAM - CNC Dovetails & Box Joints
    [URL]http://www.g-forcecnc.com/jointcam.html[/URL]

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)


  14. #14
    Member QuinnSjoblom's Avatar
    Join Date
    Nov 2017
    Location
    bigfork
    Posts
    591
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by ger21 View Post
    Maybe not. I didn't think about that. You'll need to ask them, but it doesn't look like it.

    You have your spindle setup for step/dir?
    It's a bit complicated, but when A-spindle swap happens, spindle control is set to the 4th axis/lathe spindle and it's a step/dir controlled servo. The main milling spindle is vfd controlled by rs485 with a plugin. The way my A-spindle swap works now, it works properly by controlling the lathe spindle with sxxx m3 code, but the main spindle still runs at the same time since it's plug-in controlled, but that's not really an issue for me. Before the swap, the lathe spindle is 4th axis controlled by A inputs. Long story short, I do need the A-spindle swap and it is working how I need it to, but once I add in the x-z swap, it might cause problems with mach3 unless I go with the defaulted "half swapped" method i mentioned earlier so only one of 2 swaps is needed to choose one mode or the other

    There is one other approach and that's an external swap like Simpson did with the inturn. Pretty much a circuit board with 4 inputs and 4 outputs. It's controlled by a single output from mach3 to swap the 2 sets of step/dir wires.

    Last edited by QuinnSjoblom; 03-18-2019 at 12:14 PM.


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Macros not working in mdi or gcode, but work in editor

Macros not working in mdi or gcode, but work in editor