Boring to depth subroutine for adjustment

More
02 Feb 2015 23:26 #55587 by fabworx
Ok I'm trying to set up a subroutine in my post processor in onecnc. I'd like bore to depth, dwell, then stop coolant and spindle, then orientate spindle so I can move boring bar away from work, then do a rapid out, then move the bar out of the way so I can measure the bore, then adjust the bar to the correct dimension, then return to the hole and repeat.

Im curious if im on the right track or not? It seems to not want to repeat from M0.

M3 (SPINDLE CLOCKWISE)
M7 G4 P2.5 (COOLANT ON DWELL FOR 2.5 SEC)
G90 G81 X Y Z F R L (ABSOLUTE START POINT OF HOLE FEED RATE AND RETURN PLANE, REPEAT)
M5 M9 (STOP SPINDLE AND COOLANT)
M19 R0 Q2.5 P1 (ORIENTATE SPINDLE)
G91 X-0.001 Z0.001 (MOVE BAR UP AND AWAY FROM MATERIAL)
G90 G0 Z (RAPID MOVE TO Z RETRACT PLAIN SET BY CAM)
G91 X-2 Y-2 (MOVE TOOL OUT OF WAY TO MEASURE BORE AND SET TOOL)
M0 (PAUSE)

G80 (CANCEL SUBROUTINE)

Please Log in or Create an account to join the conversation.

More
03 Feb 2015 01:49 #55593 by fabworx
I guess thats not a subroutine but a mod to a canned cycle which isn't working as I'd like. So if I were to write a subroutine to do as i want how would the finished product look? I'm not familiar at all with subroutines.

Please Log in or Create an account to join the conversation.

More
03 Feb 2015 02:34 #55594 by andypugh

So if I were to write a subroutine to do as i want how would the finished product look?


Something like the following in a file called orientbore.ngc
O <orientbore> SUB
M3
M7
G4 P2.5
G95 F0.1
G0 Z#1
G1 Z#2
M5 M9
M19 R0
...
O <orientbore> ENDSUB

Then you could call that with O<orientbore> CALL [1] [-15]
and #1 would take the value 1 and #2 would take the value -15 inside the sub.

www.linuxcnc.org/docs/html/gcode/o-code.html#sec:subroutines

For extra elegance you could then use the subroutine as a remapped G-code and pass the parameters in as R Q and P (for example)
www.linuxcnc.org/docs/html/remap/structure.html
The following user(s) said Thank You: fabworx

Please Log in or Create an account to join the conversation.

More
03 Feb 2015 03:03 #55595 by fabworx
I like that Andy. Thank you.

Please Log in or Create an account to join the conversation.

More
03 Feb 2015 03:13 #55596 by fabworx
this is what i came up with prior to your responce

N16 O100 REPEAT [3] (the number is input from cam)
N17 M3
N18 M7 G4 P2.5
N19 G0 G90 G98 X0. Y0. Z 0.625 (x,y,and z are input from cam)
N20 G1 Z0.05 F12.0 (z and feed are all input from cam)
N21 M5 M9
N22 M19 R0 Q2.5 P1(this is written so as to not change these parameters)
N23 G91 X-0.001 Z0.001( also hard written in the post processor)
N24 G90 G0 Z0.625 (from cam)
N25 G91 X-2 Y-2(hard written)
N26 M0
N27 O100 ENDREPEAT

Without a way to test this just yet as my machine is a 2 hours drive away. I'm curious if this will behave as expected? Does a pause in the middle of a subroutine have any effect on its function?

Please Log in or Create an account to join the conversation.

More
03 Feb 2015 03:31 #55597 by andypugh

Without a way to test this just yet as my machine is a 2 hours drive away.


I run simulated machines in virtual machines (ie, LinuxCNC installs in VMWare instances on my Mac) to try things out.
If you are 2 hours from your machine I suggest doing the same thing.
The following user(s) said Thank You: fabworx

Please Log in or Create an account to join the conversation.

More
03 Feb 2015 04:24 #55603 by fabworx
I'm going to have to try that. Thanks Andy. Next time at the mill I'll grab the hal and ini files so I can simulate my machine here at home. I wonder where I can get that software for xp?

Please Log in or Create an account to join the conversation.

More
03 Feb 2015 04:27 #55604 by andypugh

I wonder where I can get that software for xp?


No guarantees that it will work with the LiveCD, but try: www.howtogeek.com/79840/add-a-virtual-pc-to-xp-part-1/
The following user(s) said Thank You: fabworx

Please Log in or Create an account to join the conversation.

Time to create page: 0.072 seconds
Powered by Kunena Forum