Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: enytned1 on August 23, 2007, 05:10:28 AM

Title: Quick conversion of code from linear to angular movement
Post by: enytned1 on August 23, 2007, 05:10:28 AM
Hi all,
Wow, it's looking as if Mach3 is becoming the Fanuc of the small to medium machine control market.  Amazing product by the way!!!

I'm looking for a way to quickly convert the value of one of my axis, Y or X,  from linear movement to angular movement for a rotary axis.  Is there a function in Mach3 that can perform this code change quickly?  I know how to mathematicaly calculate this, but as you can imagine converting hundreds of lines of code is time consuming to say the least.  The CAM software I have does not have rotary axis capabilities.

Your help is greatly appreciated.

Alex
     
Title: Re: Quick conversion of code from linear to angular movement
Post by: vmax549 on August 23, 2007, 09:18:16 AM
You could use the swapaxis function in mach to swap out the y to a axis that way it would run with standard code and the a would act as the y. You would need to setup the A axis for dia so that Mach would know the size of the Y/a axis envelope

Should work. (;-) TP
Title: Re: Quick conversion of code from linear to angular movement
Post by: enytned1 on August 23, 2007, 09:55:58 AM
Am i correct to assume that if I set this up the way you mentioned, it will convert for example 3" linear movement to the equivalent angular move, dependent on the radius of the part being machined?

Thank you,
Alex
Title: Re: Quick conversion of code from linear to angular movement
Post by: Whacko on August 23, 2007, 01:18:25 PM
You'll need to run a macro most propably in the macropump doing a cos/tan conversions of the XY DRO's

Whacko for real
Title: Re: Quick conversion of code from linear to angular movement
Post by: vmax549 on August 23, 2007, 01:40:14 PM
That is the way it is suppose to work, I have not tried it personally. Art gave us that ability a while back just have not had time to try it. Now might be a good time(;-) TP
Title: Re: Quick conversion of code from linear to angular movement
Post by: vmax549 on August 23, 2007, 01:48:14 PM
Why would you need to convert the y axis with cos/tan????? If you set up the y axis on the centerline of the cylinder and set the limits of the movement to the circumference of the circle it should run it as a flat axis if it thinks it is y.??? Instead of y moving back and forth it just moves around and back. Now you do have to setup on the exact centerline of A to be accurate with z.  And you will have to limit the overlapping of the cuts depending on the diameter of the piece.

(;-) TP
Title: Re: Quick conversion of code from linear to angular movement
Post by: Whacko on August 23, 2007, 02:15:40 PM
I might be on the wrong track as to what Alex wants, but if you have a knife for instance to follow the angular travel as a third rotating axis, the diameter is not relevant. You need to resolve the angle of travel in the xy plane and convert it to radians to align the knife.

Don't mind me if I'm on the wrong track, I do that often.

Whacko
Title: Re: Quick conversion of code from linear to angular movement
Post by: enytned1 on August 23, 2007, 03:39:04 PM
Ok,

linear move: G01 X0. Y10. Z0.

Diameter of part is 4"



1.)Circumference of circle = Diameter(4") x Pi(3.14)
                                = 12.5663"
2.)12.5663" = 360 degrees

3.)Original move 10"/circumference(12.5663")=.7975(Percentage)

4.)Percentage(.7975) x 360=286.48degrees


Answer:

Angular move to replace Y10.
G01 X0. A286.48   Z.0

------------------------------------------

Now I need to do this thousands of times over or with some sort of conversion macro or software.
Title: Re: Quick conversion of code from linear to angular movement
Post by: vmax549 on August 23, 2007, 04:46:15 PM
Thats one way, the way I was discribing was to calculate the circumference of the cylinder, that would be the linear distance for the swapped axis. If you are looking for the angular displacement then please disregard, I might have Misunderstood  what was needed. (;-) Using the a axis as a flat plane axis was the lazy way to engrave a cylinder(;-) You just don't get the ortho corrections

(;-) TP
Title: Re: Quick conversion of code from linear to angular movement
Post by: Whacko on August 23, 2007, 06:29:56 PM
Alex, I don't quite get it. Do you want to move 10" in the Y axis, and then do the angular movement on the A axis to cut a circle of 4" diameter?
What is your application? I can help you with the VB code etc. but I'm not sure what you want to do.

Whacko
Title: Re: Quick conversion of code from linear to angular movement
Post by: enytned1 on August 23, 2007, 07:22:06 PM
Whako,

No, I just want to change all the Y moves to angular moves for my rotary axis.  I post my code from a CAM software containing let say some ones name.  The codes is all linear moves.  Now I want to replace all my Y movements in this program with A and change the value based on the previous formula to angular values.  I know that there is a similar function in the Maxnc control software, I was certain that Mach would have a similar type of converter.  I also remember coming across some software years back that would convert linear moves to angular moves. 
Title: Re: Quick conversion of code from linear to angular movement
Post by: Chaoticone on August 23, 2007, 09:26:50 PM
Hey Alex,
    This may not be the best way, but would trick Mach into doing it. It would require you to change your steps per in motor tuning everytime you changed the diameter of the part. Just do the math once though and your code, if it reads y, that would be ok too. Your a axis would be wired as the y.

Brett
Title: Re: Quick conversion of code from linear to angular movement
Post by: jimpinder on August 24, 2007, 04:16:44 AM
The answer is, of course, a computer program to read the code and convert it - which you could easily do if you had the necessary program - say one of the Basics in you machine.

I may be way off the mark here, but looking at the tutorials and writing script, could you do something similar here and write one of your own  M codes which has a script underlying it.

The equation for your A move is  A=360 M / Pi D, where M is the move to make and D is the diameter of your piece.

Instead of calling G1, call  M *** whatever. The script takes in the code to move M*** X0 Y10 Z0 and rewrites this as G1 X0 A??? Z0. You have no other input because the script takes values from what is already in Mach3. You would need to go through your code to alter the necessary lines from G1 to M*** but other than that you do not have to do anything.

You can also write in little checks such as what happens if the diamemetr is too small to accomodate the move.

Once the script is posted, it should do for anything else you want to write.
Title: Re: Quick conversion of code from linear to angular movement
Post by: Whacko on August 24, 2007, 05:01:05 AM
OK, I get it, it is really simple what you want to do. The guys at www.torchmate.com do something similar with their software/hardware. You could implement it in hardware with your work clamped in the rotary axis, by switching a selector switch you could switch the step pulses from the y axis to the rotary axis, or by implementing a third axis in Mach3. This will mean that your cad must take care of the post to the particular axis. You do not want to convert your code to angular, it will be the normal xy code. The Lazer manufacturers like Biostronic did the same as a pipe cutting attachment. They just transfer the one axis to a rotary axis. Now depending on how your rotary axis is configured and driven, you might have to change the steps per unit setting as Chaoticone (Is he really chaotic  :D) said. But if you have a closed loop system with servo's and encoders, your encoder could roll on the top of the tube. Similar to the decoiler sheetmetal cutting equipment.

Whacko
Title: Re: Quick conversion of code from linear to angular movement
Post by: Chaoticone on August 24, 2007, 06:24:47 AM
Quote
(Is he really chaotic :D)

Yup. If you don't belive it, ask my wife.  ;D

Brett
Title: Re: Quick conversion of code from linear to angular movement
Post by: Whacko on August 24, 2007, 10:13:10 AM
Hehe! That makes two of us! Is my avatar visible? Or does your firewall block the image?

Whacko
Title: Re: Quick conversion of code from linear to angular movement
Post by: vmax549 on August 24, 2007, 10:29:26 AM
You don't need a switch, Mach has a "swapaxis" software function like I said in the beginning,

(;-) TP
Title: Re: Quick conversion of code from linear to angular movement
Post by: Whacko on August 24, 2007, 01:21:53 PM
You are right, but if need be it can be "hotwired"! That's my forte and downfall! Hacking can be fun!

Whacko
Title: Re: Quick conversion of code from linear to angular movement
Post by: enytned1 on August 24, 2007, 06:30:45 PM
vmax549,
Please describe where to find this "swapaxis" software function.  Step by step please.

Thank you,
Alex
Title: Re: Quick conversion of code from linear to angular movement
Post by: enytned1 on August 24, 2007, 11:48:39 PM
I managed to find my old Maxnc disk with an exe application for converting Y movements to A angular moves.  Converted my linear code in a split second.  It would be nice to have a similar application in mach3.   If anyone is interested it's called Ncto4ax.exe.  It first asks for file name, then diameter and it's done.

Thank you for all your inputs and amazing support,
Alex
Title: Re: Quick conversion of code from linear to angular movement
Post by: Chaoticone on August 24, 2007, 11:57:42 PM
Good for you Alex.  :)

Yes Whacko, I see your avatar. The first time I saw it, was out of the corner of my eye. Thought, what the h*&(. LOL, funny.

Brett
Title: Re: Quick conversion of code from linear to angular movement
Post by: rceebuilder on October 06, 2007, 05:43:57 PM
You don't need a switch, Mach has a "swapaxis" software function like I said in the beginning,

(;-) TP
   I try to  engrave text  on a  tube too . Can you give more information about swapaxis ? Can Mach3  convert  Y linear movements into angular ?

Murat.
Title: Re: Quick conversion of code from linear to angular movement
Post by: enytned1 on October 07, 2007, 07:26:09 AM
Not to my knowledge.  I use a small conversion program from the MaxNC software I have from my old Maxnc mill. 
Title: Re: Quick conversion of code from linear to angular movement
Post by: rceebuilder on October 07, 2007, 07:06:40 PM
I have created a relief and I would like to engrave it on outer edge of ring like seen below. Can you please convert this g-code to rotary g-code? I have tried to replace all Y letter with A but my rotary head always turns in Cw so it deforms the relief. I guess (-) is needed  before the A value to ensure CCW rotation.

Murat..