Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Recommended Posts

The most common use I can think of is when engraving serial numbers on parts..

 

You pass in the number, determine what each value is.. then add them to a known base value so you call the proper sub program to engrave the number you desire.

 

By doing this you can create 10 incremental sub programs 0-9 which allow you to engrave any number you need without having to create multiple programs in a cam system.

 

Oh cool. Yeah, that makes perfect sense. I've been thinking about serializing some of the parts I am working on. Using that method I could simply increment a part counter and the engraving would take care of itself. Awesome.

Link to comment
Share on other sites

ALEX, can you please let me know if the macro works or not. I would really like to know.

Hello Cncchipmaker ! I tried the program on the machine, but the tool path is wrong, it can be seen in the photo

post-58015-0-93642000-1433010259_thumb.jpg

the transition to the next depth, it comes on the z and then follows retract and end

 

and i find 1 error

#120=#106
#IF[#120LT#110]THEN#120=#110  :left:   
WHILE[#101GT0]DO1
Link to comment
Share on other sites

 

Hello Cncchipmaker ! I tried the program on the machine, but the tool path is wrong, it can be seen in the photo

attachicon.gif37475.jpg

the transition to the next depth, it comes on the z and then follows retract and end

 

and i find 1 error

#120=#106
#IF[#120LT#110]THEN#120=#110  :left:   
WHILE[#101GT0]DO1

 

I am sorry that it did not work the 1st time, sometimes the macros take a while to debug. I will continue to look at it for you. Without being in front of a machine it might take me a little more while to figure it out. Yes we need to remove the # sign just before the IF, good catch. I will update it.

Link to comment
Share on other sites
Guest MTB Technical Services

OK, I think I found the error. Please try this updated macro and let me know if it works:

 

O3334(ROUGH POCKET)

(ABSOLUTE MACRO)

(MUST HAVE START HOLE IN CENTER)

(UNPROVEN)

(FORMAT G65/G66 XYQSTRZEF)

(X = #24 - X DIMENSION)

(Y = #25 - Y DIMENSION)

(Q = #17 - STEPOVER IN Z/ DOC)

(S = #19 - STEPOVER IN XY/ PERCENTAGE)

(T = #20 - TOOL DIAMETER)

(R = #18 - R PLANE)

(Z = #26 - Z START/ TOP OF STOCK)

(E = #8 - END OF POCKET IN Z)

(F = #9 - FEEDRATE)

(*********************************)

IF[[#24*#25*#17*#19*#20*#18*#26*#8*#9]EQ0]GOTO1000

(CALCULATE DOC IN Z)

#100=ABS[#26]-ABS[#8]

#100=ABS[#100]

IF[[#26*#8]GE0]GOTO1

#100=ABS[#26]+ABS[#8]

N1#101=ROUND[#100/#17]

#102=#100/#101

IF[#102GT[#100/2.]]THEN#102=#100

(CALCULATE DOC IN X)

#103=[#19*.01]*#20

#104=[#24/2.]-[#20/2.]

#105=ROUND[#104/#103]

#106=#104/#105

IF[#106GT[#104/2.]]THEN#106=#104

(CALCULATE DOC IN Y)

#107=[#19*.01]*#20

#108=[#25/2.]-[#20/2.]

#109=ROUND[#108/#107]

#110=#108/#109

IF[#110GT[#108/2.]]THEN#110=#108

(STORE POSTIONS AND GO TO Z START)

#111=#5001

#112=#5002

#114=#112

#115=#111

#116=#112

#117=#111

G0G90X#111Y#112

Z[#26+.1]

G1Z#26F#9

#113=#5003-#102

#120=#106

IF[#120LT#110]THEN#120=#110

WHILE[#101GE1.]DO1

IF[#101EQ0]GOTO10

#101=#101-1.

G90G1Z#113F#9

WHILE[#120GT0]DO2

IF[#120LT0]GOTO100

#120=#120-1.

(CALCULATE TOOL PATH)

IF[#109EQ0]GOTO20

#114=#114+#110

N20

IF[#105EQ0]GOTO30

#115=#115-#106

N30

IF[#109EQ0]GOTO40

#116=#116-#110

N40

IF[#105EQ0]GOTO50

#117=#117+#106

N50

(CUT POCKET)

G1G90Y#114F#9

X#115

Y#116

X#117

X#111

(DOWN COUNT)

#105=#105-1.

#109=#109-1.

END2

N100

X#111Y#112

#113=#113-#102

END1

N10

X#111Y#112

Z#18

M99

N1000=(DATA LACKING)

 

You've got multiple errors in this Macro.

Your N1000 Line is a big no-no.

 

Get a copy of NCPlot and try it.

You'll be able to tell where it's wrong.

Link to comment
Share on other sites

Sorry, It's obvious I rushed through this. It's a work in progress. I will try to get a copy of NCPlot. I have never used it and am used to just proving out macros I write at the machines.

 

 

O3334(ROUGH POCKET)
(ABSOLUTE MACRO)
(MUST HAVE START HOLE IN CENTER)
(UNPROVEN)

(FORMAT G65/G66 XYQSTRZEF)
(X = #24 - X DIMENSION)
(Y = #25 - Y DIMENSION)
(Q = #17 - STEPOVER IN Z/ DOC)
(S = #19 - STEPOVER IN XY/ PERCENTAGE)
(T = #20 - TOOL DIAMETER)
(R = #18 - R PLANE)
(Z = #26 - Z START/ TOP OF STOCK)
(E = #8 - END OF POCKET IN Z)
(F = #9 - FEEDRATE)
(*********************************)

IF[[#24*#25*#17*#19*#20*#18*#26*#8*#9]EQ0]GOTO1000
(CALCULATE DOC IN Z)
#100=ABS[#26]-ABS[#8]
#100=ABS[#100]
IF[[#26*#8]GE0]GOTO1
#100=ABS[#26]+ABS[#8]
N1#101=ROUND[#100/#17]
#102=#100/#101
IF[#102GT[#100/2.]]THEN#102=#100
(CALCULATE DOC IN X)
#103=[#19*.01]*#20
#104=[#24/2.]-[#20/2.]
#105=ROUND[#104/#103]
#106=#104/#105
IF[#106GT[#104/2.]]THEN#106=#104
(CALCULATE DOC IN Y)
#107=[#19*.01]*#20
#108=[#25/2.]-[#20/2.]
#109=ROUND[#108/#107]
#110=#108/#109
IF[#110GT[#108/2.]]THEN#110=#108
(STORE POSTIONS AND GO TO Z START)
#111=#5001
#112=#5002
#114=#112
#115=#111
#116=#112
#117=#111
G0G90X#111Y#112
Z[#26+.1]
G1Z#26F#9
#113=#5003-#102
#120=#106
IF[#120LT#110]THEN#120=#110
WHILE[#101GE1.]DO1
IF[#101EQ0]GOTO10
#101=#101-1.
G90G1Z#113F#9
WHILE[#120GT0]DO2
IF[#120LT0]GOTO100
#120=#120-1.
(CALCULATE TOOL PATH)
IF[#109EQ0]GOTO20
#114=#114+#110
N20
IF[#105EQ0]GOTO30
#115=#115-#106
N30
IF[#109EQ0]GOTO40
#116=#116-#110
N40
IF[#105EQ0]GOTO50
#117=#117+#106
N50
(CUT POCKET)
G1G90Y#114F#9
X#115
Y#116
X#117
X#111
(DOWN COUNT)
#105=#105-1.
#109=#109-1.
END2
N100
X#111Y#112
#113=#113-#102
END1
N10
X#111Y#112
Z#18
M99
N1000
M00(DATA LACKING)

Link to comment
Share on other sites
Guest MTB Technical Services

Sorry, It's obvious I rushed through this. It's a work in progress. I will try to get a copy of NCPlot. I have never used it and am used to just proving out macros I write at the machines.

 

 

O3334(ROUGH POCKET)

(ABSOLUTE MACRO)

(MUST HAVE START HOLE IN CENTER)

(UNPROVEN)

(FORMAT G65/G66 XYQSTRZEF)

(X = #24 - X DIMENSION)

(Y = #25 - Y DIMENSION)

(Q = #17 - STEPOVER IN Z/ DOC)

(S = #19 - STEPOVER IN XY/ PERCENTAGE)

(T = #20 - TOOL DIAMETER)

(R = #18 - R PLANE)

(Z = #26 - Z START/ TOP OF STOCK)

(E = #8 - END OF POCKET IN Z)

(F = #9 - FEEDRATE)

(*********************************)

IF[[#24*#25*#17*#19*#20*#18*#26*#8*#9]EQ0]GOTO1000

(CALCULATE DOC IN Z)

#100=ABS[#26]-ABS[#8]

#100=ABS[#100]

IF[[#26*#8]GE0]GOTO1

#100=ABS[#26]+ABS[#8]

N1#101=ROUND[#100/#17]

#102=#100/#101

IF[#102GT[#100/2.]]THEN#102=#100

(CALCULATE DOC IN X)

#103=[#19*.01]*#20

#104=[#24/2.]-[#20/2.]

#105=ROUND[#104/#103]

#106=#104/#105

IF[#106GT[#104/2.]]THEN#106=#104

(CALCULATE DOC IN Y)

#107=[#19*.01]*#20

#108=[#25/2.]-[#20/2.]

#109=ROUND[#108/#107]

#110=#108/#109

IF[#110GT[#108/2.]]THEN#110=#108

(STORE POSTIONS AND GO TO Z START)

#111=#5001

#112=#5002

#114=#112

#115=#111

#116=#112

#117=#111

G0G90X#111Y#112

Z[#26+.1]

G1Z#26F#9

#113=#5003-#102

#120=#106

IF[#120LT#110]THEN#120=#110

WHILE[#101GE1.]DO1

IF[#101EQ0]GOTO10

#101=#101-1.

G90G1Z#113F#9

WHILE[#120GT0]DO2

IF[#120LT0]GOTO100

#120=#120-1.

(CALCULATE TOOL PATH)

IF[#109EQ0]GOTO20

#114=#114+#110

N20

IF[#105EQ0]GOTO30

#115=#115-#106

N30

IF[#109EQ0]GOTO40

#116=#116-#110

N40

IF[#105EQ0]GOTO50

#117=#117+#106

N50

(CUT POCKET)

G1G90Y#114F#9

X#115

Y#116

X#117

X#111

(DOWN COUNT)

#105=#105-1.

#109=#109-1.

END2

N100

X#111Y#112

#113=#113-#102

END1

N10

X#111Y#112

Z#18

M99

N1000

M00(DATA LACKING)

 

 

Your logic for the Z top of stock position is flawed.

It doesn't permit Z0.

 

You still have conditional branching issues.

 

 

Why don't you use #3000 for actual alarm messages?

Link to comment
Share on other sites

Your logic for the Z top of stock position is flawed.

It doesn't permit Z0.

 

You still have conditional branching issues.

 

 

Why don't you use #3000 for actual alarm messages?

Look, I'm giving this my best shot at what I have available. If anyone can make it better please do and repost. I am just trying to help a guy out and I know I am not perfect. I did not cut anything at Z0 because you would be just cutting air or very small amount of material so the first Z cut is below Z0 by the Q amount. I did not use #3000 because I am not sure if it would work for his particular control and wanted a message that could be seen by any control.

Link to comment
Share on other sites
Guest MTB Technical Services

Look, I'm giving this my best shot at what I have available. If anyone can make it better please do and repost. I am just trying to help a guy out and I know I am not perfect. I did not cut anything at Z0 because you would be just cutting air or very small amount of material so the first Z cut is below Z0 by the Q amount. I did not use #3000 because I am not sure if it would work for his particular control and wanted a message that could be seen by any control.

 

Not criticizing, just asking a question and trying to help you out.

Don't worry. Won't do that again.

It's all yours.

Link to comment
Share on other sites

Not criticizing, just asking a question and trying to help you out.

Don't worry. Won't do that again.

It's all yours.

Sorry, I did not mean to get so defensive. I appreciate any criticism or new ideas and I appologize for being "snippy". I would just like to see people fix the problem if they know that there is one or come up with a new solution. I mean we are all here to help each other out, or at least that is my opinion.

Link to comment
Share on other sites

Sorry, I did not mean to get so defensive. I appreciate any criticism or new ideas and I appologize for being "snippy". I would just like to see people fix the problem if they know that there is one or come up with a new solution. I mean we are all here to help each other out, or at least that is my opinion.

 

You have been doing a great job and Tim means well he just comes across very bluntly sometimes. Keep plugging away and I am sure you will get it all sorted out.

 

FYI all of Mazak's conversational programming is Macro based. I use to have a copy of all their Macro's, but over the last couple decades have lost them. I might have them some some 5-1/4 floppy's somewhere, but then have no way to read them anymore.

Link to comment
Share on other sites

Sorry, It's obvious I rushed through this. It's a work in progress. I will try to get a copy of NCPlot. I have never used it and am used to just proving out macros I write at the machines.

 

 

O3334(ROUGH POCKET)

(ABSOLUTE MACRO)

(MUST HAVE START HOLE IN CENTER)

(UNPROVEN)

(FORMAT G65/G66 XYQSTRZEF)

(X = #24 - X DIMENSION)

(Y = #25 - Y DIMENSION)

(Q = #17 - STEPOVER IN Z/ DOC)

(S = #19 - STEPOVER IN XY/ PERCENTAGE)

(T = #20 - TOOL DIAMETER)

(R = #18 - R PLANE)

(Z = #26 - Z START/ TOP OF STOCK)

(E = #8 - END OF POCKET IN Z)

(F = #9 - FEEDRATE)

(*********************************)

IF[[#24*#25*#17*#19*#20*#18*#26*#8*#9]EQ0]GOTO1000

(CALCULATE DOC IN Z)

#100=ABS[#26]-ABS[#8]

#100=ABS[#100]

IF[[#26*#8]GE0]GOTO1

#100=ABS[#26]+ABS[#8]

N1#101=ROUND[#100/#17]

#102=#100/#101

IF[#102GT[#100/2.]]THEN#102=#100

(CALCULATE DOC IN X)

#103=[#19*.01]*#20

#104=[#24/2.]-[#20/2.]

#105=ROUND[#104/#103]

#106=#104/#105

IF[#106GT[#104/2.]]THEN#106=#104

(CALCULATE DOC IN Y)

#107=[#19*.01]*#20

#108=[#25/2.]-[#20/2.]

#109=ROUND[#108/#107]

#110=#108/#109

IF[#110GT[#108/2.]]THEN#110=#108

(STORE POSTIONS AND GO TO Z START)

#111=#5001

#112=#5002

#114=#112

#115=#111

#116=#112

#117=#111

G0G90X#111Y#112

Z[#26+.1]

G1Z#26F#9

#113=#5003-#102

#120=#106

IF[#120LT#110]THEN#120=#110

WHILE[#101GE1.]DO1

IF[#101EQ0]GOTO10

#101=#101-1.

G90G1Z#113F#9

WHILE[#120GT0]DO2

IF[#120LT0]GOTO100

#120=#120-1.

(CALCULATE TOOL PATH)

IF[#109EQ0]GOTO20

#114=#114+#110

N20

IF[#105EQ0]GOTO30

#115=#115-#106

N30

IF[#109EQ0]GOTO40

#116=#116-#110

N40

IF[#105EQ0]GOTO50

#117=#117+#106

N50

(CUT POCKET)

G1G90Y#114F#9

X#115

Y#116

X#117

X#111

(DOWN COUNT)

#105=#105-1.

#109=#109-1.

END2

N100

X#111Y#112

#113=#113-#102

END1

N10

X#111Y#112

Z#18

M99

N1000

M00(DATA LACKING)

I tried your new program, motion takes place in the first depth, after  do one step  by X and Y  one step, and then goes to the next depth, and the program ends
Link to comment
Share on other sites

 

I tried your new program, motion takes place in the first depth, after  do one step  by X and Y  one step, and then goes to the next depth, and the program ends

 

I promise the next thing I post will be a proven program, I just need more time. James.

Link to comment
Share on other sites

Just wrote one of these (M119 spindle orient at angle)over the last few days for a FANUC 31i with some help from a customer. It was a little tricky at first because the machine wanted L52 and not L50 as was shown in the books. After that it came together a bit faster. Ended up hard coding the base value to a MACRO variable and resetting it to that base amount in the tool change MACRO in case it accidentally got left in that state.

 

We also found that the spindle wanted to be run before orienting after it was set back to the original tool change orientation.

 

HTH

Link to comment
Share on other sites

OK, it was driving me crazy not being able to figure this out on my own so I downloaded the trial version of NC PLOT and I have to say it's awesome. I have been writing these macros the hard way for many years. With this tool It only took me about 15 min to find out where most of my errors were. I still have I think only one bug to work out. I just wanted to apologize if my programs have caused any unwanted frustration to those of you who are trying to use them. It is only my intent to make certain machining applications easier through the use of macros for you guys. Thanks, James.

  • Like 2
Link to comment
Share on other sites

Ain't it nice?  Did this a few years ago; no way I could have done it without NCPlot.  Load it up and check it out:

%
O1234
(SERIAL NUMBER MACRO)
(MATT HAJICEK)
T1M6

(G65 Variable Useage:)
(#543 = 1st number set to engrave)
(#548 = 2nd number set to engrave)
(#538 = 3rd number set to engrave, will be incremented if not reset.)
(E = Number set to engrave: 1., 2., or 3.)
(D = # of digits to engrave)
(Example: "N123D5" results in "00123")
(I = 1. = Dash, 0. = No Dash)
(X = X position of center of arc)
(Y = Y position of center of arc)
(Z = Z depth to cut)
(B = Radius of arc)
(A = Angular position on arc)
(U = X position of center of cylinder)
(V = Y position of center of cylinder)
(W = Z position of center of cylinder)
(Q = Radius of cylinder)
(C = Orientation of cylinder)
(T = Text size)
(F = Feed rate <-- REMOVED)
(R = Rapid / Retract plane)
(S = Spindle Speed)
(H = Tool length offset number)

F10.

#543=12345 (FIVE DIGIT WORK ORDER NUMBER)
G65P8500E1.D5I1.X0Y0Z-.01A112.T.5R.1B6.S8000.H1.U2.V5.W-4.C0.Q4.

#548=0708  (FOUR DIGIT DATE NUMBER)
G65P8500E2.D4I1.X0Y0Z-.01A83.T.5R.1B6.S8000.H1.U2.V5.W-4.C0.Q4.

(COMMENT OUT NEXT LINE TO INCREMENT)
#538=1234  (FOUR DIGIT SERIAL NUMBER)
G65P8500E3.D4I0X0Y0Z-.01A60.T.5R.1B6.S8000.H1.U2.V5.W-4.C0.Q4.

G65P8500E1.D5I1.X-1.5Y0Z-.01A45.T1.R.1B0.S8000.H1.U0V0.W-4.C90.Q4.

M30

O8500(SERIAL# DEFINITION)
(11-18-08)(MDH)

(#140 MACHINE ARC TANGENT SUPPORT)
(0 = NO ARC TANGENT FUNCTION)
(1 = ATN)
(2 = ATAN)
#140=0

(NUMBER DEFINITION)
(NOTE: UP TO FIVE DIGITS SUPPORTED)
#114=#8

N1
IF[#114NE1.]GOTO2
(#543, FIVE DIGIT WORK ORDER NUMBER)
#121=#543  (NUMBER)
GOTO4

N2
IF[#114NE2.]GOTO3
(#548, FOUR DIGIT DATE NUMBER)
#121=#548  (NUMBER)
GOTO4

N3
(#538, FOUR DIGIT SERIAL NUMBER)
#121=#538  (NUMBER)

N4
#122=#7    (NUMBER OF DIGITS)
#123=#4    (1 = DASH, 0 = NO DASH)

(ARC DEFINITION)
#107=#24   (X POSITION)
#108=#25   (Y POSITION)
#109=#2    (RADIUS, OR 0 FOR STRAIGHT)
#110=#1*-1 (ANGLE)
#112=#20   (DIGIT SIZE Y IN INCHES)
#111=#112  (DIGIT SIZE X IN INCHES)
#113=#112*.1 (SPACE BETWEEN DIGITS)

(CUT PARAMETERS)
#115=#18   (RETRACT HEIGHT)
#116=#26   (CUT DEPTH)
#117=#9    (FEED RATE)
#118=#19   (SPINDLE SPEED)
#120=#11   (H NUMBER)

(CYLINDER PROJECTION PARAMETERS)
#129=#21   (X COORDINANT OF THROUGH POINT)
#130=#22   (Y COORDINANT OF THROUGH POINT)
#131=#23   (Z COORDINANT OF THROUGH POINT)
#132=#3    (XY PLANE ANGLE OF CYLINDER, 0 OR 90)(90 BROKE SO FAR)
#133=0     (RESERVED FOR ELEVATION ANGLE OF CYLINDER)
#134=#17   (RADIUS OF CYLINDER, OR 0 FOR FLAT)
(CONDITION CYLINDER VARIABLES)
WHILE[#132 LT 0] DO1
#132=#132+180
END1
WHILE[#132 GE 180] DO1
#132=#132-180
END1
WHILE[#133 LT 0] DO1
#133=#133+90
END1
WHILE[#133 GE 90] DO1
#133=#133-90
END1
IF[#134 GE 0] GOTO 10
#3000=99(CYLINDER RADIUS < 0)
N10

M98P8501

IF[#114NE2.]GOTO5
#538=#538+1

N5
M99

O8501(SERIAL# CUTTING)

(BREAK IT DOWN)
#101=FIX[#121/10000]
#102=FIX[#121/1000]-[#101*10]
#103=FIX[#121/100]-[#101*100]-[#102*10]
#104=FIX[#121/10]-[#101*1000]-[#102*100]-[#103*10]
#105=FIX[#121]-[#101*10000]-[#102*1000]-[#103*100]-[#104*10]

(FIND STRING LENGTH)

#106 = #111/-2

(REMOVE NEXT LINE TO CENTER TEXT)
GOTO 100

#106=[#111*[#122-1]]+[#113*[#122-1]]

IF[#123EQ0.]GOTO 100
#106=#106+#111+#113 (ADD ANOTHER CHARACTER AND SPACE FOR DASH)

N100
#126=#106*[-.5]

(ARC CALCULATIONS)
#127=#109*2*3.14159 (CIRCUMFERENCE = RADIUS * 2 * PI)

IF[#122EQ0]GOTO 106
IF[#122EQ1]GOTO 105
IF[#122EQ2]GOTO 104
IF[#122EQ3]GOTO 103
IF[#122EQ4]GOTO 102
IF[#122EQ5]GOTO 101
#3000=99(# OF DIGITS ERROR)

N101
(CUT 1ST DIGIT)
IF[#101EQ0]GOTO 10 
IF[#101EQ1.]GOTO 11 
IF[#101EQ2.]GOTO 12 
IF[#101EQ3.]GOTO 13 
IF[#101EQ4.]GOTO 14 
IF[#101EQ5.]GOTO 15 
IF[#101EQ6.]GOTO 16 
IF[#101EQ7.]GOTO 17 
IF[#101EQ8.]GOTO 18 
IF[#101EQ9.]GOTO 19 
#3000=99(1ST DIGIT ERROR)
M00 
N10M98P8510 
GOTO 102 
N11M98P8511 
GOTO 102 
N12M98P8512 
GOTO 102 
N13M98P8513 
GOTO 102 
N14M98P8514 
GOTO 102 
N15M98P8515 
GOTO 102 
N16M98P8516 
GOTO 102 
N17M98P8517 
GOTO 102 
N18M98P8518 
GOTO 102 
N19M98P8519 
GOTO 102

N102
(CUT 2ND DIGIT)
IF[#102EQ0]GOTO 20 
IF[#102EQ1.]GOTO 21 
IF[#102EQ2.]GOTO 22 
IF[#102EQ3.]GOTO 23 
IF[#102EQ4.]GOTO 24 
IF[#102EQ5.]GOTO 25 
IF[#102EQ6.]GOTO 26 
IF[#102EQ7.]GOTO 27 
IF[#102EQ8.]GOTO 28 
IF[#102EQ9.]GOTO 29 
#3000=99(2ND DIGIT ERROR)
M00 
N20M98P8510
GOTO 103
N21M98P8511 
GOTO 103 
N22M98P8512 
GOTO 103 
N23M98P8513 
GOTO 103 
N24M98P8514 
GOTO 103 
N25M98P8515 
GOTO 103 
N26M98P8516 
GOTO 103 
N27M98P8517 
GOTO 103 
N28M98P8518 
GOTO 103 
N29M98P8519 
GOTO 103 

N103
(CUT 3RD DIGIT)
IF[#103EQ0]GOTO 30 
IF[#103EQ1.]GOTO 31 
IF[#103EQ2.]GOTO 32 
IF[#103EQ3.]GOTO 33 
IF[#103EQ4.]GOTO 34 
IF[#103EQ5.]GOTO 35 
IF[#103EQ6.]GOTO 36 
IF[#103EQ7.]GOTO 37 
IF[#103EQ8.]GOTO 38 
IF[#103EQ9.]GOTO 39 
#3000=99(3RD DIGIT ERROR)
M00 
N30M98P8510
GOTO 104
N31M98P8511 
GOTO 104 
N32M98P8512 
GOTO 104 
N33M98P8513 
GOTO 104 
N34M98P8514 
GOTO 104 
N35M98P8515 
GOTO 104 
N36M98P8516 
GOTO 104 
N37M98P8517 
GOTO 104 
N38M98P8518 
GOTO 104 
N39M98P8519 
GOTO 104 

N104
(CUT 4TH DIGIT)
IF[#104EQ0]GOTO 40 
IF[#104EQ1.]GOTO 41 
IF[#104EQ2.]GOTO 42 
IF[#104EQ3.]GOTO 43 
IF[#104EQ4.]GOTO 44 
IF[#104EQ5.]GOTO 45 
IF[#104EQ6.]GOTO 46 
IF[#104EQ7.]GOTO 47 
IF[#104EQ8.]GOTO 48 
IF[#104EQ9.]GOTO 49 
#3000=99(4TH DIGIT ERROR)
M00 
N40M98P8510
GOTO 105
N41M98P8511 
GOTO 105 
N42M98P8512 
GOTO 105 
N43M98P8513 
GOTO 105 
N44M98P8514 
GOTO 105 
N45M98P8515 
GOTO 105 
N46M98P8516 
GOTO 105 
N47M98P8517 
GOTO 105 
N48M98P8518 
GOTO 105 
N49M98P8519 
GOTO 105 

N105
(CUT 5TH DIGIT)
IF[#105EQ0]GOTO 40 
IF[#105EQ1.]GOTO 41 
IF[#105EQ2.]GOTO 42 
IF[#105EQ3.]GOTO 43 
IF[#105EQ4.]GOTO 44 
IF[#105EQ5.]GOTO 45 
IF[#105EQ6.]GOTO 46 
IF[#105EQ7.]GOTO 47 
IF[#105EQ8.]GOTO 48 
IF[#105EQ9.]GOTO 49 
#3000=99(5TH DIGIT ERROR)
M00 
N40M98P8510
GOTO 106
N41M98P8511 
GOTO 106 
N42M98P8512 
GOTO 106 
N43M98P8513 
GOTO 106 
N44M98P8514 
GOTO 106 
N45M98P8515 
GOTO 106 
N46M98P8516 
GOTO 106 
N47M98P8517 
GOTO 106 
N48M98P8518 
GOTO 106 
N49M98P8519 
GOTO 106 

N106
(CUT DASH)
IF[#123EQ0]GOTO 107
N49M98P8520
GOTO 107 

N107
M99

O8510(NUMBER ZERO)
G90G0
G65P8521X.2335Y0.1631
G43H#120Z#115
G1Z#116S#118
G65P8521X.2779Y0.329
G65P8521X.2929Y0.5
G65P8521X.2779Y0.671
G65P8521X.2335Y0.8369
G65P8521X.1907Y0.9121
G65P8521X.1246Y0.9681
G65P8521X.0433Y0.9978
G65P8521X-.0433Y0.9978
G65P8521X-.1246Y0.9681
G65P8521X-.1907Y0.9121
G65P8521X-.2335Y0.8369
G65P8521X-.2779Y0.671
G65P8521X-.2929Y0.5
G65P8521X-.2779Y0.329
G65P8521X-.2335Y0.1631
G65P8521X-.1907Y0.0879
G65P8521X-.1246Y0.0319
G65P8521X-.0433Y0.0022
G65P8521X.0433Y0.0022
G65P8521X.1246Y0.0319
G65P8521X.1907Y0.0879
G65P8521X.2335Y0.1631
G0Z#115
#126=#126+#111+#113 (ADD SHIFT FOR NEXT DIGIT)
M99

O8511(NUMBER ONE)
G90G0
#138=0
G65P8521X0.Y0.0
G43H#120Z#115
G1Z#116S#118
#138=1
G65P8521X0.Y1.0
G65P8521X-.1429Y0.8571
G0Z#115
#126=#126+#111+#113 (ADD SHIFT FOR NEXT DIGIT)
M99

O8512(NUMBER TWO)
G90G0
#138=0
G65P8521X-.2774Y0.8571
G43H#120Z#115
G1Z#116S#118
#138=1
G65P8521X-.2774Y0.8571
G65P8521X-.232Y0.9163
G65P8521X-.1728Y0.9617
G65P8521X-.1039Y0.9902
G65P8521X-.03Y1.0
G65P8521X-.0078Y1.0
G65P8521X.078Y0.9868
G65P8521X.156Y0.9484
G65P8521X.2187Y0.8884
G65P8521X.2606Y0.8123
G65P8521X.2776Y0.7271
G65P8521X.2671Y0.6622
G65P8521X.242Y0.6014
G65P8521X.2037Y0.548
G65P8521X.0785Y0.4478
G65P8521X-.0531Y0.3563
G65P8521X-.1443Y0.2913
G65P8521X-.2182Y0.2072
G65P8521X-.2706Y0.1083
G65P8521X-.2989Y0.0
G65P8521X.299Y0.0
G0Z#115
#126=#126+#111+#113 (ADD SHIFT FOR NEXT DIGIT)
M99

O8513(NUMBER THREE)
G90G0
#138=0
G65P8521X-.2857Y0.8571
G43H#120Z#115
G1Z#116S#118
#138=1
G65P8521X-.2857Y0.8571
G65P8521X-.2398Y0.9163
G65P8521X-.1803Y0.9617
G65P8521X-.1111Y0.9902
G65P8521X-.0368Y1.0
G65P8521X0.Y1.0
G65P8521X.0748Y0.991
G65P8521X.1454Y0.9645
G65P8521X.2077Y0.922
G65P8521X.2499Y0.8729
G65P8521X.2766Y0.814
G65P8521X.2857Y0.75
G65P8521X.2757Y0.6797
G65P8521X.2465Y0.615
G65P8521X.2004Y0.561
G65P8521X.1411Y0.5219
G65P8521X.0733Y0.501
G65P8521X.0019Y0.5009
G65P8521X.0733Y0.5009
G65P8521X.1449Y0.4828
G65P8521X.2082Y0.4446
G65P8521X.2577Y0.3898
G65P8521X.2892Y0.3231
G65P8521X.3Y0.25
G65P8521X.2908Y0.186
G65P8521X.2641Y0.1271
G65P8521X.222Y0.078
G65P8521X.1597Y0.0355
G65P8521X.0892Y0.009
G65P8521X.0143Y0.0
G65P8521X-.0511Y0.0
G65P8521X-.1254Y0.0097
G65P8521X-.1946Y0.0383
G65P8521X-.2542Y0.0837
G65P8521X-.3Y0.1429
G0Z#115
#126=#126+#111+#113 (ADD SHIFT FOR NEXT DIGIT)
M99

O8514(NUMBER FOUR)
G90G0
#138=0
G65P8521X.1857Y0.0
G43H#120Z#115
G1Z#116S#118
#138=1
G65P8521X.1857Y0.0
G65P8521X.1857Y1.0
G65P8521X-.3321Y0.2357
G65P8521X.3322Y0.2357
G0Z#115
#126=#126+#111+#113 (ADD SHIFT FOR NEXT DIGIT)
M99

O8515(NUMBER FIVE)
G90G0
#138=0
G65P8521X-.3126Y0.1424
G43H#120Z#115
G1Z#116S#118
#138=1
G65P8521X-.3126Y0.1424
G65P8521X-.2867Y0.1084
G65P8521X-.2566Y0.0782
G65P8521X-.1938Y0.0353
G65P8521X-.1225Y0.0086
G65P8521X-.047Y-0.0005
G65P8521X-.0019Y-0.0005
G65P8521X.0797Y0.0103
G65P8521X.1556Y0.0419
G65P8521X.2208Y0.0922
G65P8521X.2706Y0.1577
G65P8521X.304Y0.2413
G65P8521X.3134Y0.3308
G65P8521X.2979Y0.4194
G65P8521X.2588Y0.5005
G65P8521X.2072Y0.5596
G65P8521X.1422Y0.6034
G65P8521X.06Y0.6332
G65P8521X-.0269Y0.6433
G65P8521X-.1277Y0.6361
G65P8521X-.2245Y0.6071
G65P8521X-.3126Y0.5576
G65P8521X-.3126Y1.0005
G65P8521X.292Y1.0005
G0Z#115
#126=#126+#111+#113 (ADD SHIFT FOR NEXT DIGIT)
M99

O8516(NUMBER SIX)
G90G0
#138=0
G65P8521X-.2739Y0.2245
G43H#120Z#115
G1Z#116S#118
#138=1
G65P8521X-.2739Y0.2245
G65P8521X-.281Y0.3235
G65P8521X-.2552Y0.4192
G65P8521X-.1992Y0.5012
G65P8521X-.1194Y0.5601
G65P8521X-.0246Y0.5895
G65P8521X.0745Y0.586
G65P8521X.167Y0.5501
G65P8521X.2425Y0.4857
G65P8521X.2926Y0.4001
G65P8521X.3117Y0.3027
G65P8521X.2977Y0.2045
G65P8521X.254Y0.1193
G65P8521X.1855Y0.0524
G65P8521X.0993Y0.0108
G65P8521X.0043Y-0.0013
G65P8521X-.0896Y0.0174
G65P8521X-.1727Y0.065
G65P8521X-.2363Y0.1365
G65P8521X-.274Y0.2245
G65P8521X-.3042Y0.3666
G65P8521X-.311Y0.5117
G65P8521X-.2941Y0.656
G65P8521X-.254Y0.7956
G65P8521X-.2089Y0.8826
G65P8521X-.138Y0.9502
G65P8521X-.0489Y0.9911
G65P8521X.0486Y1.0009
G65P8521X.144Y0.9784
G65P8521X.2269Y0.9261
G65P8521X.2883Y0.8497
G0Z#115
#126=#126+#111+#113 (ADD SHIFT FOR NEXT DIGIT)
M99

O8517(NUMBER SEVEN)
G90G0
#138=0
G65P8521X-.3Y1.0
G43H#120Z#115
G1Z#116S#118
#138=1
G65P8521X-.3Y1.0
G65P8521X.3Y1.0
G65P8521X.194Y0.8168
G65P8521X.11Y0.6225
G65P8521X.0492Y0.4198
G65P8521X.0123Y0.2113
G65P8521X0.Y0.
G0Z#115
#126=#126+#111+#113 (ADD SHIFT FOR NEXT DIGIT)
M99

O8518(NUMBER EIGHT)
G90G0
#138=0
G65P8521X-.0324Y0.5357
G43H#120Z#115
G1Z#116S#118
#138=1
G65P8521X-.0324Y0.5357
G65P8521X-.1185Y0.5523
G65P8521X-.1924Y0.5996
G65P8521X-.2434Y0.671
G65P8521X-.2643Y0.7562
G65P8521X-.2521Y0.8431
G65P8521X-.2085Y0.9192
G65P8521X-.1398Y0.9738
G65P8521X-.0877Y0.9934
G65P8521X-.0324Y1.0
G65P8521X.0319Y1.0
G65P8521X.1036Y0.9886
G65P8521X.1683Y0.9557
G65P8521X.2197Y0.9043
G65P8521X.2526Y0.8396
G65P8521X.264Y0.7679
G65P8521X.2526Y0.6962
G65P8521X.2197Y0.6315
G65P8521X.1683Y0.5801
G65P8521X.1036Y0.5472
G65P8521X.0319Y0.5358
G65P8521X-.0324Y0.5357
G65P8521X-.1143Y0.5229
G65P8521X-.1884Y0.4856
G65P8521X-.2475Y0.4274
G65P8521X-.286Y0.3539
G65P8521X-.3002Y0.2722
G65P8521X-.2886Y0.1901
G65P8521X-.2526Y0.1154
G65P8521X-.1931Y0.0536
G65P8521X-.1171Y0.0138
G65P8521X-.0324Y0.0
G65P8521X.0319Y0.0
G65P8521X.1147Y0.0131
G65P8521X.1894Y0.0512
G65P8521X.2486Y0.1104
G65P8521X.2867Y0.1851
G65P8521X.2998Y0.2679
G65P8521X.2867Y0.3507
G65P8521X.2486Y0.4254
G65P8521X.1894Y0.4846
G65P8521X.1147Y0.5227
G65P8521X.0319Y0.5358
G65P8521Y0.5357
G0Z#115
#126=#126+#111+#113 (ADD SHIFT FOR NEXT DIGIT)
M99

O8519(NUMBER NINE)
G90G0
#138=0
G65P8521X-.2883Y0.1503
G43H#120Z#115
G1Z#116S#118
#138=1
G65P8521X-.2883Y0.1503
G65P8521X-.2269Y0.0739
G65P8521X-.144Y0.0216
G65P8521X-.0486Y-0.0008
G65P8521X.0489Y0.0089
G65P8521X.138Y0.0498
G65P8521X.2089Y0.1175
G65P8521X.254Y0.2045
G65P8521X.2941Y0.3441
G65P8521X.311Y0.4884
G65P8521X.3042Y0.6335
G65P8521X.2739Y0.7756
G65P8521X.2362Y0.8636
G65P8521X.1726Y0.935
G65P8521X.0895Y0.9826
G65P8521X-.0044Y1.0012
G65P8521X-.0993Y0.9891
G65P8521X-.1855Y0.9475
G65P8521X-.2539Y0.8806
G65P8521X-.2976Y0.7955
G65P8521X-.3117Y0.6973
G65P8521X-.2926Y0.5999
G65P8521X-.2425Y0.5142
G65P8521X-.167Y0.4499
G65P8521X-.0745Y0.414
G65P8521X.0247Y0.4105
G65P8521X.1195Y0.4399
G65P8521X.1993Y0.4989
G65P8521X.2552Y0.5808
G65P8521X.2811Y0.6766
G65P8521X.2739Y0.7756
G0Z#115
#126=#126+#111+#113 (ADD SHIFT FOR NEXT DIGIT)
M99

O8520(DASH)
G90G0
#138=0
G65P8521X-.3321Y0.5
G43H#120Z#115
G1Z#116S#118
#138=1
G65P8521X-.3321Y0.5
G65P8521X.3321Y0.5
G0Z#115
M99

O8521(POSITION)
#124=#24 (PULL X POSITION FROM MACHINE)
#125=#25 (PULL Y POSITION FROM MACHINE)

#124=#124*#111 (SCALE X)
#125=#125*#112 (SCALE Y)

#124=#124+#126 (SHIFT X BY DIGIT SPACING)

IF[#109 EQ 0] GOTO 1001 (FLAT LINE)
(ARC CALCULATIONS)
#125=#125+#109 (SHIFT Y BY RADIUS)

#128=[[#124/#127]*[-360]]-#110 (ANGLE FROM ARC CENTER)

#124=COS[#128]*#125
#125=SIN[#128]*#125

GOTO 1011
N1001
(FLAT LINE TILT)

IF[#110 EQ 0] GOTO 1011 (NO TILT)

IF[#124 NE 0] GOTO 1013
IF[#125 NE 0] GOTO 1013

N1012
#128 = 0
GOTO 1014

N1013
(#140 MACHINE ARC TANGENT SUPPORT)
(0 = NO ARC TANGENT FUNCTION)
(1 = ATN)
(2 = ATAN)

IF[#140 EQ 0] GOTO 1016

IF[#140 EQ 1] GOTO 1017

(ELSE-)
(ARC TANGENT BY "ATAN")
#128=ATAN[#125]/[#124]
GOTO 1014

N1017
(ARC TANGENT BY "ATN")
#128=ATN[#125]/[#124]
GOTO 1014

N1016
(ARC-TANGENT THE HARD WAY,)
(FOR WHEN "ATAN" NOT AVAILABLE)
(SLIGHTLY LESS ACCURATE)
#139=[#125]/[#124](ANGLE FROM ARC CENTER)

(ATAN APPROXIMATION FORMULA ONLY ACCURATE FROM -45 TO +45 DEGREES)
(SO MIRROR ABOUT 45 DEGREE LINE, CALCULATE, AND MIRROR BACK)
(WHEN APPROPRIATE)

IF[ABS[#139] LE 1.] GOTO 1015
(FOR RANGE 45 TO 90 DEGREES)
#139=[#124]/[#125]
#128=[[#139] + [0.43157974*[#139]*[#139]*[#139]]]/[1 + [0.76443945*[#139]*[#139]] + [0.05831938*[#139]*[#139]*[#139]*[#139]]]
#128=#128*57.2957795(CONVERT RADIANS TO DEGREES)
#128=[[#128-45.]*-1.]+45.
GOTO 1014

N1015
(FOR RANGE TO 45 DEGREES)
#128=[[#139] + [0.43157974*[#139]*[#139]*[#139]]]/[1 + [0.76443945*[#139]*[#139]] + [0.05831938*[#139]*[#139]*[#139]*[#139]]]
#128=#128*57.2957795(CONVERT RADIANS TO DEGREES)

N1014
#128=#128-#110 (ROTATE)
#119=SQRT[[#124*#124]+[#125*#125]] (DISTANCE FROM ARC CENTER)
#124=[COS[#128]]*#119
#125=[SIN[#128]]*#119

N1011

#124=#124+#107 (SHIFT X BY ARC CENTER)
#125=#125+#108 (SHIFT Y BY ARC CENTER)

(ARC CALCULATIONS COMPLETE)

#137=#116
IF[#134EQ0] GOTO 1100 (NO PROJECTION)

(BEGIN PROJECTION ON CYLINDER)

IF[#132NE0] GOTO 1003
(SPECIAL CASE #1: XY PLANE ANGLE = 0)
#135=ABS[#130-#125] (DISTANCE IN Y TO CYL. AXIS)
IF[#135LT#134] GOTO 1002
#137=#131+#116 (BEYOND CYLINDER, CUT AT CENTER PLANE)
GOTO 1100

N1002
#136=SQRT[ABS[[#134*#134]-[#135*#135]]]+#131
#137=#136+#116
GOTO 1100

N1003
IF[#132NE90] GOTO 1005
(SPECIAL CASE #2: XY PLANE ANGLE = 90)
#135=ABS[#129-#124] (DISTANCE IN X TO CYL. AXIS)
IF[#135LT#134] GOTO 1004
#137=#131+#116 (BEYOND CYLINDER, CUT AT CENTER PLANE)
GOTO 1100

N1004
#136=SQRT[ABS[[#134*#134]-[#135*#135]]]+#131
#137=#136+#116
GOTO 1100

N1005
#3000=99(ANGLES OTHER THAN 0 AND 90 NOT YET SUPPORTED)

N1100
IF[#138EQ0] GOTO 1101
X[#124]Y[#125]Z[#137] (OUTPUT WITH Z)
GOTO 1102

N1101
X[#124]Y[#125] (OUTPUT WITHOUT Z)

N1102
(DONE WITH POINT)
M99

%

  • Like 2
Link to comment
Share on other sites
OK, I think I got it. Please give me any feedback that you can.

 

O3334(ROUGH POCKET)

(ABSOLUTE MACRO)

(MUST HAVE START HOLE IN CENTER)

(PROVEN ON NC PLOT ONLY)

(FORMAT G65/G66 XYQSTRZEF)

(X = #24 - X DIMENSION)

(Y = #25 - Y DIMENSION)

(Q = #17 - STEPOVER IN Z/ DOC)

(S = #19 - STEPOVER IN XY/ PERCENTAGE)

(T = #20 - TOOL DIAMETER)

(R = #18 - CLEARANCE PLANE)

(Z = #26 - Z START/ TOP OF STOCK)

(E = #8 - END OF POCKET IN Z)

(F = #9 - FEEDRATE)

(*********************************)

IF[[#24*#25*#17*#19*#20*#8*#9]EQ0]GOTO1000

(CALCULATE DOC IN Z)

#100=ABS[#26]-ABS[#8]

#100=ABS[#100]

IF[[#26*#8]GE0]GOTO1

#100=ABS[#26]+ABS[#8]

N1#101=ROUND[#100/#17]

#102=#100/#101

IF[#102GT[#100/2.]]THEN#102=#100

(CALCULATE DOC IN X)

#103=[#19*.01]*#20

#104=[#24/2.]-[#20/2.]

#105=ROUND[#104/#103]

#106=#104/#105

IF[#106GT[#104/2.]]THEN#106=#104

(CALCULATE DOC IN Y)

#107=[#19*.01]*#20

#108=[#25/2.]-[#20/2.]

#109=ROUND[#108/#107]

#110=#108/#109

IF[#110GT[#108/2.]]THEN#110=#108

(STORE POSTIONS AND GO TO Z START)

#111=#5001

#112=#5002

#114=#112

#115=#111

#116=#112

#117=#111

G0G90X#111Y#112

Z[#26+.1]

G1Z#26F#9

#113=#5003-#102

#120=#105

IF[#120LT#109]THEN#120=#109

#125=#105

#129=#109

#130=#120

WHILE[#101GE1.]DO1

IF[#101EQ0]GOTO10

#101=#101-1.

G90G1Z#113F#9

WHILE[#120GE1.]DO2

IF[#120EQ0]GOTO100

(CALCULATE TOOL PATH)

IF[#109LE0]GOTO20

#114=#114+#110

N20

IF[#105LE0]GOTO30

#115=#115-#106

N30

IF[#109LE0]GOTO40

#116=#116-#110

N40

IF[#105LE0]GOTO50

#117=#117+#106

N50

(CUT POCKET)

G1G90G41Y#114F#9

X#115

Y#116

X#117

Y#114

X#111

(DOWN COUNT)

#105=#105-1.

#109=#109-1.

#120=#120-1.

END2

N100

#105=#125

#109=#129

#114=#112

#115=#111

#116=#112

#117=#111

#120=#130

X#111Y#112G40

#113=#113-#102

END1

N10

X#111Y#112

Z#18

M99

N1000

#3000=1(DATA LACKING!)

  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...