130

« **on:** January 08, 2011, 07:16:55 PM »
Maybe someone can take a look at this code...

`Sub Main()`

'(CNC A axis Plasma TUBE Coping routine)

'(Math derivative by Dan Hopper Copyright 2006)

'WIZARD BY WES TREIHAFT

CutTubeD = GetOEMDRO (1006)

UncutTubeD = GetOEMDRO (1016)

TubeThickness = GetOEMDRO (1012)

JointANGLE = GetOEMDRO (1017)

ASTEPDEG = GetOEMDRO (1018)

RO = CutTubeD / 2

RU = UncutTubeD / 2

RI = RO - TubeThickness

AF = JointANGLE

ID = CutTubeD - TubeThickness * 2

ASTEPDEG = 2

SetTicker 20, ""

OpenTeachFile "PIPENOTCHER.tap"

Code "%"

Code "G0 G40 G54 G90 G49 G17 G50 G64 G91.1 G94"

Code "G0 A0.000 x0.000 Z1.000 F500"

Code "Z0.0"

Code "M98 P01 L180"

Code "G0 A0.0 X0.0 Z1.0"

Code "M30"

Code "o01"

Code "G1 A" & ASTEPDEG & " X" & (Sqr (RU * 2 - ((RI * Sin (ID)) *2)) / Sin(AF) - Tan (90-AF) * RI * Cos(ID))

ID =(ID+2)

ASTEPDEG =(ASTEPDEG +2)

Code "M99"

Code "%"

CloseTeachFile

Call LoadTeachFile()

End Sub

Main

Here is what I am converting...

`(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

%

I don't understand the "**"

I am getting :cannot divide by zero when it comes to the line with the math.