hello there is a problem with parametric codes, especially for 3d toolpaths with high resolution
code shared by mcode at post #8 is a linear type : performs the best
2nd code shared at post #12 is a parametric type : allows fast code iterations, but may lead to downtime, depending on how the controller handles the calculations inside the loop + how the code is written
the downtime is lower than 0.1seconds ( perhaps even 0.01 ), but it simply sums up at each loop, and in the end, the cycle time may be signifiant longer
this post is about downtime elimination for parametric codes, so to make them perform as fast as linear codes : goal is to keep the parametric advantage without cycle downtime
this will allow rendering fast different toolpaths near the machine, and this is faster than going at the pc and changing the CAM parameters + sending the code to the cnc
after a few trials with the parametric code, there should be a nice operation output; now, when the operation looks nice, the parametric code should be run again including a data-output soubroutine
data output can be done in ( at least ) 2 ways :
... coordinate output : x_value y_value z_value
... G-code output : ... G01 X = x_value Y = y_value Z = z_value
about the codes that will be shared in this post :
... 1st one is a parametric code that outputs data : coordinates ( ODD1 ) and G-code ( ODD2 )
... 2nd one reads the coordinates, outputed by ODD1 , and generates the movement into the cnc
... 3rd one is edited : inside it is pasted the code outputed by ODD2
attached file " coords-odd1.txt " was created by ODD1 soubroutine
attached file " coords-odd2.txt " was created by ODD1 soubroutine
about execution times :
... parametric without data output : 37286ms
... parametric with data output : 39883ms ( a bit longer, of course )
... 2nd program : 40937ms ( it is even longer, because is harder to read data than to write it )
... 3rd program : 37280ms ( same as the parametric without data outputs )
if possible, is preferable to write a parametric code that performs as fast as a G-code
Code:
OS10
NGHOST G305
IF [ VRSTT NE 0 ] NEND
NOEX V1 = 2233 ( n )
NOEX V2 = 3*0.025 ( f )
NOEX V3 = 75 ( cilinder )
NOEX V4 = 29 ( hole )
NOEX V5 = 1 ( scale factor )
NOEX V6 = 100 ( resolution )
( * )
NOEX V4 = V4 / 2
( CALL OCHK? LV01=LINK LV02=-50 LV03=0.5 LV04=? LV05=0.5 )
G304
CALL ODYNX LPOS=V3+3 LCTR=2 LDS=0
SB=V1 M13 M08 G00 X+V3+3 Z[V4-5]*V5 C0 M63 F+V2 G95
G00 X+V3 M147
CLOSE C ( close olog ) (* 1/4)
FWRITC coords.txt;A (* 2/4)
NOEX V12 = VDIN [ 1000 ]
G01 Z+V4 * V5
G138
NOEX V07 = 0
NAGAIN NOEX V07 = V07 + 1
NOEX V08 = MOD [ 360 * V7 / V6 , 360 ]
NOEX V09 = DROUND [ V04 * COS [ V08 ] ] * V05
NOEX V10 = DROUND [ V04 * SIN [ V08 ] ] * V05
NOEX V11 = DROUND [ SQRT [ V3 * V3 / 4 - V10 * V10 ] ]
X + V11 Y + V10 Z + V09
CALL ODD2 (* 3/4)
IF [ V07 LT V06 ] NAGAIN
G136
G01 Z[V4-5]* V5
G00 X+V3+3
NOEX V12 = VDIN [ 1000 ] - V12
CLOSE C (* 4/4)
M12 M146
M0
NEND NOEX
RTS ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )
ODD1 ( data dump v1 )
NOEX PUT V11
NOEX PUT ' '
NOEX PUT V10
NOEX PUT ' '
NOEX PUT V09
WRITE C
RTS ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )
ODD2 ( data dump v2 )
NOEX PUT 'X'
NOEX PUT V11
NOEX PUT 'Y'
NOEX PUT V10
NOEX PUT 'Z'
NOEX PUT V09
WRITE C
RTS ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )
Code:
OS11
NGHOST G305
IF [ VRSTT NE 0 ] NEND
NOEX V1 = 2233 ( n )
NOEX V2 = 3*0.025 ( f )
NOEX V3 = 75 ( cilinder )
NOEX V4 = 29 ( hole )
NOEX V5 = 1 ( scale factor )
NOEX V6 = 100 ( resolution )
( * )
NOEX V4 = V4 / 2
( CALL OCHK? LV01=LINK LV02=-50 LV03=0.5 LV04=? LV05=0.5 )
G304
CALL ODYNX LPOS=V3+3 LCTR=2 LDS=0
SB=V1 M13 M08 G00 X+V3+3 Z[V4-5]*V5 C0 M63 F+V2 G95
G00 X+V3 M147
( CLOSE C ) ( close olog )
FOPENA coords-odd1.txt;A
NOEX V12 = VDIN [ 1000 ]
G01 Z+V4 * V5
G138
NOEX V07 = 0
NAGAIN NOEX V07 = V07 + 1
READ A
NOEX GET V11 , 10
NOEX GET , 01
NOEX GET V10 , 10
NOEX GET , 01
NOEX GET V09 , 10
NOEX V09 = V09 * V05
NOEX V10 = V10 * V05
X + V11 Y + V10 Z + V09
IF [ V07 LT V06 ] NAGAIN
G136
G01 Z[V4-5]* V5
G00 X+V3+3
NOEX V12 = VDIN [ 1000 ] - V12
CLOSE A
M12 M146
M0
NEND NOEX
RTS ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )
Code:
OS12
NGHOST G305
IF [ VRSTT NE 0 ] NEND
NOEX V1 = 2233 ( n )
NOEX V2 = 3*0.025 ( f )
NOEX V3 = 75 ( cilinder )
NOEX V4 = 29 ( hole )
NOEX V5 = 1 ( scale factor )
( NOEX V6 = 100 ) ( resolution )
( * )
NOEX V4 = V4 / 2
( CALL OCHK? LV01=LINK LV02=-50 LV03=0.5 LV04=? LV05=0.5 )
G304
CALL ODYNX LPOS=V3+3 LCTR=2 LDS=0
SB=V1 M13 M08 G00 X+V3+3 Z[V4-5]*V5 C0 M63 F+V2 G95
G00 X+V3 M147
NOEX V12 = VDIN [ 1000 ]
G01 Z+V4 * V5
G138
CALL OQ12
G136
G01 Z[V4-5]* V5
G00 X+V3+3
NOEX V12 = VDIN [ 1000 ] - V12
M12 M146
M0
NEND NOEX
RTS ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )
OQ12
X 37.489Y 0.91Z 14.471
X 37.456Y 1.817Z 14.386
X 37.401Y 2.717Z 14.243
X 37.326Y 3.606Z 14.044
X 37.231Y 4.481Z 13.79
X 37.118Y 5.338Z 13.482
X 36.988Y 6.174Z 13.12
X 36.844Y 6.985Z 12.706
X 36.686Y 7.769Z 12.243
X 36.519Y 8.523Z 11.731
X 36.343Y 9.243Z 11.172
X 36.162Y 9.926Z 10.57
X 35.98Y 10.57Z 9.926
X 35.797Y 11.172Z 9.243
X 35.618Y 11.731Z 8.523
X 35.445Y 12.243Z 7.769
X 35.282Y 12.706Z 6.985
X 35.13Y 13.12Z 6.174
X 34.993Y 13.482Z 5.338
X 34.872Y 13.79Z 4.481
X 34.771Y 14.044Z 3.606
X 34.69Y 14.243Z 2.717
X 34.631Y 14.386Z 1.817
X 34.595Y 14.471Z 0.91
X 34.583Y 14.5Z 0
X 34.595Y 14.471Z -0.91
X 34.631Y 14.386Z -1.817
X 34.69Y 14.243Z -2.717
X 34.771Y 14.044Z -3.606
X 34.872Y 13.79Z -4.481
X 34.993Y 13.482Z -5.338
X 35.13Y 13.12Z -6.174
X 35.282Y 12.706Z -6.985
X 35.445Y 12.243Z -7.769
X 35.618Y 11.731Z -8.523
X 35.797Y 11.172Z -9.243
X 35.98Y 10.57Z -9.926
X 36.162Y 9.926Z -10.57
X 36.343Y 9.243Z -11.172
X 36.519Y 8.523Z -11.731
X 36.686Y 7.769Z -12.243
X 36.844Y 6.985Z -12.706
X 36.988Y 6.174Z -13.12
X 37.118Y 5.338Z -13.482
X 37.231Y 4.481Z -13.79
X 37.326Y 3.606Z -14.044
X 37.401Y 2.717Z -14.243
X 37.456Y 1.817Z -14.386
X 37.489Y 0.91Z -14.471
X 37.5Y 0Z -14.5
X 37.489Y -0.91Z -14.471
X 37.456Y -1.817Z -14.386
X 37.401Y -2.717Z -14.243
X 37.326Y -3.606Z -14.044
X 37.231Y -4.481Z -13.79
X 37.118Y -5.338Z -13.482
X 36.988Y -6.174Z -13.12
X 36.844Y -6.985Z -12.706
X 36.686Y -7.769Z -12.243
X 36.519Y -8.523Z -11.731
X 36.343Y -9.243Z -11.172
X 36.162Y -9.926Z -10.57
X 35.98Y -10.57Z -9.926
X 35.797Y -11.172Z -9.243
X 35.618Y -11.731Z -8.523
X 35.445Y -12.243Z -7.769
X 35.282Y -12.706Z -6.985
X 35.13Y -13.12Z -6.174
X 34.993Y -13.482Z -5.338
X 34.872Y -13.79Z -4.481
X 34.771Y -14.044Z -3.606
X 34.69Y -14.243Z -2.717
X 34.631Y -14.386Z -1.817
X 34.595Y -14.471Z -0.91
X 34.583Y -14.5Z 0
X 34.595Y -14.471Z 0.91
X 34.631Y -14.386Z 1.817
X 34.69Y -14.243Z 2.717
X 34.771Y -14.044Z 3.606
X 34.872Y -13.79Z 4.481
X 34.993Y -13.482Z 5.338
X 35.13Y -13.12Z 6.174
X 35.282Y -12.706Z 6.985
X 35.445Y -12.243Z 7.769
X 35.618Y -11.731Z 8.523
X 35.797Y -11.172Z 9.243
X 35.98Y -10.57Z 9.926
X 36.162Y -9.926Z 10.57
X 36.343Y -9.243Z 11.172
X 36.519Y -8.523Z 11.731
X 36.686Y -7.769Z 12.243
X 36.844Y -6.985Z 12.706
X 36.988Y -6.174Z 13.12
X 37.118Y -5.338Z 13.482
X 37.231Y -4.481Z 13.79
X 37.326Y -3.606Z 14.044
X 37.401Y -2.717Z 14.243
X 37.456Y -1.817Z 14.386
X 37.489Y -0.91Z 14.471
X 37.5Y 0Z 14.5
RTS ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )