151
MACH TOOL BOX / TUBE COPING program
« on: November 04, 2010, 11:43:48 AM »
Enclosed is an X/A axis Tube/Pipe coping program. There are 2 code examples included, one is a standard program that you manually modify the variables before start and then begin.
The other has a programable front end macro that ASKs the question and you fill in the blanks. You will need to copy the macro code into a macro and move to YOUR macro directory before it will work.
There is NO Zaxis startup code such as Spindle speed or start or Zhom and plasma start etc. This just provides the motion code for you.
There are 4 variables that HAVE to be input for correct operation.On the Programable Front End version it is NORMAL on file load to get a divide by ZERO error. That is because the Variable values have NOT been load yet by the macro. JUST say OK and hit rewind to continue. AS sonn as the macro runs and you have filled in the values the screen will reload and you will see the correct cut profile displayed.
#100 = CutTube Diameter
#101 = Uncut Tube Diameter
#103 = Cut Tube wall Thickness
#104 = Joint ANGLE
##### Program Code #####################################################
(CNC A axis Plasma TUBE Coping routine)
(Math derivative by Dan Hopper Copyright 2006)
#100= 1.250 (CutTube Diameter)
#101= 1.250 (Uncut Tube Diameter)
#103= .095 ( Tube Thickness )
#104= 45 (Joint ANGLE)
#200 = [#100 / 2] (RO)
#201 = [#101 / 2] (RU)
#202 = [#200 - #103] (RI)
#203 = #104 (AF)
#204 = 0 (ID)
#300= 2 (A step in deg)
G0 G40 G54 G90 G49 G17 G50 G64 G91.1 G94
G0 A0.000 x0.000 Z1.000 F500
Z0.000
M98 P01 L180
G0 A0.000 X0.000 Z1.000
M30
o01
G1 A#300 X [sqrt [#201 **2 - [ [#202 * sin [#204]] **2]] / sin[#203] - tan [90-#203] * #202 * cos[#204]]
#204=[#204+2]
#300=[#300+2]
m99
%
*****Programable Front End VERSION************************
'M1222 Macro to program Tube Coping Gcode Program
SetVar(100, Question (" P1 Cut Tube Diameter ?"))
SetVar(101, Question (" P2 Uncut Tube Diameter ?"))
SetVar(103, Question (" P1 Tube Thickness ?"))
SetVar(104, Question (" P2 Tube JOINT ANGLE ?"))
DoOemButton(160)
end
******************************************************
(CNC A axis Plasma TUBE Coping routine)
(Programable Front End)
(Divide By Zero ERROR is normal on startup)
(Caused By EMPTY variable values at this point)
(Hit REWIND and continue)
(Math derivative by Dan Hopper Copyright 2006)
G0 G40 G54 G90 G49 G17 G50 G64 G91.1 G94
M1222
#200 = [#100 / 2] (RO)
#201 = [#101 / 2] (RU)
#202 = [#200 - #103] (RI)
#203 = #104 (AF)
#204 = 0 (ID)
#300= 2 (A step in deg)
(Verify Start Point and Press CYCLE START to Begin)
G0 A0.000 x0.000 Z1.000 F500
Z0.000
M98 P01 L180
G0 A0.000 X0.000 Z1.000
M30
o01
G1 A#300 X [sqrt [#201 **2 - [ [#202 * sin [#204]] **2]] / sin[#203] - tan [90-#203] * #202 * cos[#204]]
#204=[#204+2]
#300=[#300+2]
m99
%
The other has a programable front end macro that ASKs the question and you fill in the blanks. You will need to copy the macro code into a macro and move to YOUR macro directory before it will work.
There is NO Zaxis startup code such as Spindle speed or start or Zhom and plasma start etc. This just provides the motion code for you.
There are 4 variables that HAVE to be input for correct operation.On the Programable Front End version it is NORMAL on file load to get a divide by ZERO error. That is because the Variable values have NOT been load yet by the macro. JUST say OK and hit rewind to continue. AS sonn as the macro runs and you have filled in the values the screen will reload and you will see the correct cut profile displayed.
#100 = CutTube Diameter
#101 = Uncut Tube Diameter
#103 = Cut Tube wall Thickness
#104 = Joint ANGLE
##### Program Code #####################################################
(CNC A axis Plasma TUBE Coping routine)
(Math derivative by Dan Hopper Copyright 2006)
#100= 1.250 (CutTube Diameter)
#101= 1.250 (Uncut Tube Diameter)
#103= .095 ( Tube Thickness )
#104= 45 (Joint ANGLE)
#200 = [#100 / 2] (RO)
#201 = [#101 / 2] (RU)
#202 = [#200 - #103] (RI)
#203 = #104 (AF)
#204 = 0 (ID)
#300= 2 (A step in deg)
G0 G40 G54 G90 G49 G17 G50 G64 G91.1 G94
G0 A0.000 x0.000 Z1.000 F500
Z0.000
M98 P01 L180
G0 A0.000 X0.000 Z1.000
M30
o01
G1 A#300 X [sqrt [#201 **2 - [ [#202 * sin [#204]] **2]] / sin[#203] - tan [90-#203] * #202 * cos[#204]]
#204=[#204+2]
#300=[#300+2]
m99
%
*****Programable Front End VERSION************************
'M1222 Macro to program Tube Coping Gcode Program
SetVar(100, Question (" P1 Cut Tube Diameter ?"))
SetVar(101, Question (" P2 Uncut Tube Diameter ?"))
SetVar(103, Question (" P1 Tube Thickness ?"))
SetVar(104, Question (" P2 Tube JOINT ANGLE ?"))
DoOemButton(160)
end
******************************************************
(CNC A axis Plasma TUBE Coping routine)
(Programable Front End)
(Divide By Zero ERROR is normal on startup)
(Caused By EMPTY variable values at this point)
(Hit REWIND and continue)
(Math derivative by Dan Hopper Copyright 2006)
G0 G40 G54 G90 G49 G17 G50 G64 G91.1 G94
M1222
#200 = [#100 / 2] (RO)
#201 = [#101 / 2] (RU)
#202 = [#200 - #103] (RI)
#203 = #104 (AF)
#204 = 0 (ID)
#300= 2 (A step in deg)
(Verify Start Point and Press CYCLE START to Begin)
G0 A0.000 x0.000 Z1.000 F500
Z0.000
M98 P01 L180
G0 A0.000 X0.000 Z1.000
M30
o01
G1 A#300 X [sqrt [#201 **2 - [ [#202 * sin [#204]] **2]] / sin[#203] - tan [90-#203] * #202 * cos[#204]]
#204=[#204+2]
#300=[#300+2]
m99
%