4th axis rotation

This forum is for general discussion about Aspire
jvcc
Posts: 17
Joined: Sat Feb 25, 2023 11:40 pm
Model of CNC Machine: nextwave shark hd520

4th axis rotation

Post by jvcc »

Ok, i have a simple question and hopefully a simple answer. Why is it so difficult to find the G or M codes to edit my .tap file to repeat a toolpath? Ive searched message boards, forums, etc etc for the proper gcodes to no avail. I've run test cuts using M99, 98 and 97 commands to no avail. I want to cut a pocket, turn the 4th axis 90 degrees, cut the same program, rotate, cut, rotate and cut using the same .tap file. Not that difficult! All these different cncs, gcode variatons, etc and the gcode seems pretty standard, no line numbers or anything complicated but i cant find a code or codes my nextwave shark PP will recognize. Help!

User avatar
Mogal
Vectric Craftsman
Posts: 238
Joined: Wed Oct 13, 2010 5:28 pm
Model of CNC Machine: DIY CNC
Location: Victoria, BC
Contact:

Re: 4th axis rotation

Post by Mogal »

Sorry, I do not know, but would also be interested in the answer.
Just got the 4th axis spinning for the first time today.

User avatar
adze_cnc
Vectric Wizard
Posts: 4327
Joined: Sat Jul 27, 2013 10:08 pm
Model of CNC Machine: AXYZ 4008
Location: Vancouver, BC, Canada

Re: 4th axis rotation

Post by adze_cnc »

jvcc wrote:
Sun Apr 09, 2023 2:52 am
Why is it so difficult to find the G or M codes to edit my .tap file to repeat a toolpath?
To strictly answer this question: your shark’s controlling software may not allow such an operation and thus anything you have found might not work so finding such a solution might be difficult.

Your post actually has two questions although the second is hidden.
jvcc wrote:
Sun Apr 09, 2023 2:52 am
I want to cut a pocket, turn the 4th axis 90 degrees, cut the same program, rotate, cut, rotate and cut using the same .tap file.
Replace “I want to” with “How do I” and you’ll get the real question that you want answered. To that I’d ask is your 4th axis setup capable of indexing and locking in place at 90 degrees increments?

jvcc
Posts: 17
Joined: Sat Feb 25, 2023 11:40 pm
Model of CNC Machine: nextwave shark hd520

Re: 4th axis rotation

Post by jvcc »

Yes, Thanks, I am getting the 4th axis to turn any degree I want to and stop using the A command, in this case by inserting A90 right after the safe Z line. My problem is getting the program to repeat 3 more times after Ive turned the axis 90 degrees

randyr
Posts: 46
Joined: Thu Jan 23, 2014 4:36 am
Model of CNC Machine: Speedline (Carl Bruce)
Location: Boring, OR USA
Contact:

Re: 4th axis rotation

Post by randyr »

I don't think that what you want to do is possible in Aspire as shipped. But...you can write a custom post processor to do it. Make a copy of the PP you use and change the name. Then add the appropriate code to convert the main G-code into a subroutine, then at the beginning, add the code for generating a loop that calls that subroutine 4 times, each time advancing the A axis by 90 degrees. Or get more fancy by making the loop count a variable and then advancing 360/variable degrees.

randy

jvcc
Posts: 17
Joined: Sat Feb 25, 2023 11:40 pm
Model of CNC Machine: nextwave shark hd520

Re: 4th axis rotation

Post by jvcc »

thanks, i will work on figuring out how to do that and see if it works, im not sure how to make a copy of the PP for starters :) :D

4DThinker
Vectric Wizard
Posts: 1701
Joined: Sun Sep 23, 2012 12:14 pm
Model of CNC Machine: CNC Shark Pro, Probotix Meteor 25" x 50"

Re: 4th axis rotation

Post by 4DThinker »

If you can issue G-code commands then don't use the rotary job setup. I've done this several times for student projects by creating a normal X/Y/Z toolpath. Run it once, rotate to 90 degrees and run again. Rotate to 180 and run it again. Rotate to 270 and run it again.
It would nice to have an A axis indexing post processor that would run a file, rotate A 90, and repeat, etc..
4D

User avatar
martin54
Vectric Archimage
Posts: 7339
Joined: Fri Nov 09, 2012 2:12 pm
Model of CNC Machine: Gerber 48, Triac PC, Isel fixed gantry
Location: Kirkcaldy, Scotland

Re: 4th axis rotation

Post by martin54 »

If you can rotate the material 90 degrees & hold it locked in position then don't think of it as a rotary project, think of the rotary axis as just a vice or jig that is holding the workpiece for you & it becomes a 4 sided job. Just do do as 4D Thinker has said set up a normal single-sided job & run the same job 4 times rotating 90 degrees in between :lol: :lol:

User avatar
mrmfwilson
Vectric Craftsman
Posts: 239
Joined: Thu May 31, 2012 6:49 pm
Model of CNC Machine: Legacy Arty 36
Location: Georgetown, TX

Re: 4th axis rotation

Post by mrmfwilson »

After Looking at the postprocessor documentation it looks like you could add the A90 Gcode command into the "NEW_SEGMENT" Section.

This is that section from the Mach2/3 Arcs(inch)(.txt) PP

+---------------------------------------------------
+ Commands output for a new segment - toolpath
+ with same toolnumber but maybe different feedrates
+---------------------------------------------------

begin NEW_SEGMENT

"[N][S]M03"
"([TOOLPATH_NAME])"
"([TOOLPATH_NOTES])"

This sets the spindle speed to the next toolpath settings
______________________________________________

Here is the section from the Vectric PP documentation:

NEW_SEGMENT
+---------------------------------------------------
+ Commands output for a new segment ( new toolpath with current toolnumber)
+---------------------------------------------------

begin NEW_SEGMENT

"Commands"

For an example of a NEW_SEGMENT section, see the file: Mach2_3_ATC_Arcs_inch.pp

Commands that are output when a new toolpath uses the currently selected tool, but perhaps a different spindle speed is required or the machine requires additional instructions.

Any commands that are used in the NEW_SEGMENT section should not need to be included within the TOOLCHANGE section as a tool-change will also automatically call the instructions in the NEW_SEGMENT section.

Variables that are commonly used include.

Spindle Speed = [S] R.P.M.
M3 M Code often used to turn spindle on (Clockwise rotation).
M5 M Code often used to turn spindle off.

So the section to rotate the material when it encounters a new toolpath might look like:
--------------------------------------------------------------------------------------------
begin NEW_SEGMENT

"[N]G00[ZH]" - Moves the spindle to home Z position
"[N]M05" - Turn off spindle
"[N]A90" - Rotate material 90 degrees
"[N][S]M03" - Turn spindle on at the speed set in the toolpath setup
"([TOOLPATH_NAME])" - For information only
------------------------------------------------------------------------------------------

[N] is the line number variable
[ZH] is the Z_HOME variable
[S] is the SPINDLE_SPEED variable from the toolpath setup


I haven't tested this an I'm not a PP expert. Maybe someone that is more familiar with PP development can verify if what I have is correct.
You would have to create 4 different toolpaths with the same information for this to work like you want. This might rotate the material before the first tool path. But that wouldn't matter.
I'll test it later and see what the Gcode looks like.
Mr. Wilson
CenterLine Designs
Facebook - Centerline Designs

User avatar
mrmfwilson
Vectric Craftsman
Posts: 239
Joined: Thu May 31, 2012 6:49 pm
Model of CNC Machine: Legacy Arty 36
Location: Georgetown, TX

Re: 4th axis rotation

Post by mrmfwilson »

Looks like it should work. Here is the output from the Gcode for a square profile.
I'm visiting my Daughter in Bristol so I can't run the code so some else has to try it. I don't know how to put it in the database. The file is marked with a pencil when you move it to edit the file. It shows the pencil when you search for it.

( New )
( File created: Sunday April 23 2023 - 10:16 AM)
( for Mach2/3 from Vectric )
( Material Size)
( X= 3.000, Y= 10.000, Z= 0.750)
()
(Toolpaths used in this file:)
(Profile 1)
(Profile 2)
(Profile 3)
(Profile 4)
(Tools used in this file: )
(1 = End Mill {0.25"})
N130G00G20G17G90G40G49G80
N140G70G91.1
N150T1M06
N160 (Tool: End Mill {0.25"})
N170G00G43Z1.7500H1
N180S16000M03
N190(Toolpath:- Profile 1) - No rotation
N200()
N210G94
N220X-4.0000Y4.0000F100.0
N230G00X-0.5000Y-0.5000Z1.0000
N240G1X-0.5000Y-0.5000Z0.6667F50.0
N250G1X-0.5000Y0.5000Z0.6667F100.0
N260G1X0.5000Y0.5000Z0.6667
N270G1X0.5000Y-0.5000Z0.6667
N280G1X-0.5000Y-0.5000Z0.6667
N290G1X-0.5000Y-0.5000Z0.5833F50.0
N300G1X-0.5000Y0.5000Z0.5833F100.0
N310G1X0.5000Y0.5000Z0.5833
N320G1X0.5000Y-0.5000Z0.5833
N330G1X-0.5000Y-0.5000Z0.5833
N340G1X-0.5000Y-0.5000Z0.5000F50.0
N350G1X-0.5000Y0.5000Z0.5000F100.0
N360G1X0.5000Y0.5000Z0.5000
N370G1X0.5000Y-0.5000Z0.5000
N380G1X-0.5000Y-0.5000Z0.5000
N390G00X-0.5000Y-0.5000Z1.0000
N400G00Z1.7500 - Z Home
N410M05 - Turn off spindle
N420A90 - Rotate part
N430S16000M03 - Start Spindle
(Profile 2)

N450G00X-0.5000Y-0.5000Z1.0000
N460G1X-0.5000Y-0.5000Z0.6667F50.0
N470G1X-0.5000Y0.5000Z0.6667F100.0
N480G1X0.5000Y0.5000Z0.6667
N490G1X0.5000Y-0.5000Z0.6667
N500G1X-0.5000Y-0.5000Z0.6667
N510G1X-0.5000Y-0.5000Z0.5833F50.0
N520G1X-0.5000Y0.5000Z0.5833F100.0
N530G1X0.5000Y0.5000Z0.5833
N540G1X0.5000Y-0.5000Z0.5833
N550G1X-0.5000Y-0.5000Z0.5833
N560G1X-0.5000Y-0.5000Z0.5000F50.0
N570G1X-0.5000Y0.5000Z0.5000F100.0
N580G1X0.5000Y0.5000Z0.5000
N590G1X0.5000Y-0.5000Z0.5000
N600G1X-0.5000Y-0.5000Z0.5000
N610G00X-0.5000Y-0.5000Z1.0000
N620G00Z1.7500 - Z Home
N630M05 - Stop spindle
N640A90 - Rotate part
N650S16000M03 - Start Spindle
(Profile 3)

N670G00X-0.5000Y-0.5000Z1.0000
N680G1X-0.5000Y-0.5000Z0.6667F50.0
N690G1X-0.5000Y0.5000Z0.6667F100.0
N700G1X0.5000Y0.5000Z0.6667
N710G1X0.5000Y-0.5000Z0.6667
N720G1X-0.5000Y-0.5000Z0.6667
N730G1X-0.5000Y-0.5000Z0.5833F50.0
N740G1X-0.5000Y0.5000Z0.5833F100.0
N750G1X0.5000Y0.5000Z0.5833
N760G1X0.5000Y-0.5000Z0.5833
N770G1X-0.5000Y-0.5000Z0.5833
N780G1X-0.5000Y-0.5000Z0.5000F50.0
N790G1X-0.5000Y0.5000Z0.5000F100.0
N800G1X0.5000Y0.5000Z0.5000
N810G1X0.5000Y-0.5000Z0.5000
N820G1X-0.5000Y-0.5000Z0.5000
N830G00X-0.5000Y-0.5000Z1.0000
N620G00Z1.7500 - Z Home
N630M05 - Stop spindle
N640A90 - Rotate part
N650S16000M03 - Start Spindle
(Profile 4)

N890G00X-0.5000Y-0.5000Z1.0000
N900G1X-0.5000Y-0.5000Z0.6667F50.0
N910G1X-0.5000Y0.5000Z0.6667F100.0
N920G1X0.5000Y0.5000Z0.6667
N930G1X0.5000Y-0.5000Z0.6667
N940G1X-0.5000Y-0.5000Z0.6667
N950G1X-0.5000Y-0.5000Z0.5833F50.0
N960G1X-0.5000Y0.5000Z0.5833F100.0
N970G1X0.5000Y0.5000Z0.5833
N980G1X0.5000Y-0.5000Z0.5833
N990G1X-0.5000Y-0.5000Z0.5833
N1000G1X-0.5000Y-0.5000Z0.5000F50.0
N1010G1X-0.5000Y0.5000Z0.5000F100.0
N1020G1X0.5000Y0.5000Z0.5000
N1030G1X0.5000Y-0.5000Z0.5000
N1040G1X-0.5000Y-0.5000Z0.5000
N1050G00X-0.5000Y-0.5000Z1.0000
N1060G00Z1.7500
N1070G00X-4.0000Y4.0000
N1080M09
N1090M30
%
Mr. Wilson
CenterLine Designs
Facebook - Centerline Designs

User avatar
adze_cnc
Vectric Wizard
Posts: 4327
Joined: Sat Jul 27, 2013 10:08 pm
Model of CNC Machine: AXYZ 4008
Location: Vancouver, BC, Canada

Re: 4th axis rotation

Post by adze_cnc »

I presume that when the 1st toolpath starts angle 0 degrees is defined as being aligned with the z-axis. At the end of that toolpath there’s no guarantee that the angle aligned with the z-axis is 0 degrees. It might be 17 degrees. After the A90 it will be 117 degrees. Would the 2nd toolpath run thinking that the z-axis is aligned with 90 degrees on the z-axis? If that’s so then the result of the 2nd toolpath will be 17 degrees off…

In other words: is A90 a relative rotation (add 90 degrees to where I am now giving 117 degrees from the start) or an absolute rotation (I’m at 17 degrees rotate 73 degrees to get to 90).

User avatar
mrmfwilson
Vectric Craftsman
Posts: 239
Joined: Thu May 31, 2012 6:49 pm
Model of CNC Machine: Legacy Arty 36
Location: Georgetown, TX

Re: 4th axis rotation

Post by mrmfwilson »

How would the stock angle change? On my machine it stays perpendicular with every rotation. If you were working with square stock the first position would need to be perpendicular to the bit. I do this all the time. I use a magnetic level to assure the bit is perpendicular to the stock if it is square. If the stock is round the position wouldn't matter unless you want to have the holes in a certain place on the stock. This is a single purpose application. It repeats the toolpath at 90 degrees. It really wouldn't need to be the same toolpath. But in this case that is what he asked for. If the stock moves from the original angle position, then something is wrong. If your machine isn't accurate enough to rotate 90 degrees every time then you need to adjust the rotation steps. If the case is your machine isn't accurate enough to rotate 90 degrees every time then doing it manually using the A90 command wouldn't work either.. Better than rotating it manually or editing the file. I think its pretty cool to be able to do it in the software. I've been wondering how to do this for a long time. I will definitely be using this from now on. One thing that I didn't consider is that you would need to use the incremental mode to rotate the part. So I guess you would need to add an incremental G91 command in front of the A90 command and add the absolute G90 after the A90 command. I'll fix that.

It should look like:

begin NEW_SEGMENT

"[N]G00[ZH]" + - Moves the spindle to home Z position
"[N]M05" + - Turn off spindle
"[N]G91" + - Set incremental mode
"[N]A90" +- Rotate material 90 degrees
"[N]G90" +- Set absolute mode
"[N][S]M03" +- Turn spindle on at the speed set in the toolpath setup
"([TOOLPATH_NAME])" +- For information only

You will need to remove the comments
Mr. Wilson
CenterLine Designs
Facebook - Centerline Designs

User avatar
mrmfwilson
Vectric Craftsman
Posts: 239
Joined: Thu May 31, 2012 6:49 pm
Model of CNC Machine: Legacy Arty 36
Location: Georgetown, TX

Re: 4th axis rotation

Post by mrmfwilson »

jvcc wrote:
Sun Apr 09, 2023 2:52 am
Ok, i have a simple question and hopefully a simple answer. Why is it so difficult to find the G or M codes to edit my .tap file to repeat a toolpath? Ive searched message boards, forums, etc etc for the proper gcodes to no avail. I've run test cuts using M99, 98 and 97 commands to no avail. I want to cut a pocket, turn the 4th axis 90 degrees, cut the same program, rotate, cut, rotate and cut using the same .tap file. Not that difficult! All these different cncs, gcode variatons, etc and the gcode seems pretty standard, no line numbers or anything complicated but i cant find a code or codes my nextwave shark PP will recognize. Help!
Here is a Nextwave inch PP that will rotate the a-axis 90 degrees between toolpaths. The first path has to be perpendicular to the bit. Try it without the bit first as I haven't been able to test it on a machine. You should also send it some A90 commands set in incremental mode (G91) manually to check that the A90 command actually is 90 degrees on your machine.
Attachments
Next Wave CNC Rotate 90(inch) (!.tap).pp
(6.76 KiB) Downloaded 14 times
Mr. Wilson
CenterLine Designs
Facebook - Centerline Designs

User avatar
Rcnewcomb
Vectric Archimage
Posts: 5887
Joined: Fri Nov 04, 2005 5:54 am
Model of CNC Machine: 24x36 GCnC/WinCNC with ATC
Location: San Jose, California, USA
Contact:

Re: 4th axis rotation

Post by Rcnewcomb »

is A90 a relative rotation
Depends on the mode the machine controller is in.

G90
G90 mode is called absolute mode. In G90 mode values specify positions. If the X position is 20 and G0 X8 is specified the machine
would move -12 units of measure in X to X8.

G91
G91 mode is called relative or incremental mode. In G91 mode values specify distances. For instance if the X position is currently 20
and G0 X8 is specified the machine would move +8 units of measure in X to X28.
- Randall Newcomb
10 fingers in, 10 fingers out, another good day in the shop

User avatar
adze_cnc
Vectric Wizard
Posts: 4327
Joined: Sat Jul 27, 2013 10:08 pm
Model of CNC Machine: AXYZ 4008
Location: Vancouver, BC, Canada

Re: 4th axis rotation

Post by adze_cnc »

So, if the ending point of one toolpath is not in the same angular orientation as the start of that toolpath then executing:

Code: Select all

"[N]G91"
"[N]A90"
"[N]G90"
will not guarantee that the start of the next toolpath is 90 degrees to the start of the previous toolpath?

Would the post processor then need to execute both a G00[ZH] and the equivalent going to the, for lack of better term, “A” home before executing the G91A90G90 commands?

Post Reply