CauldronDevelopmentLLC / CAMotics

Open-Source Simulation & Computer Aided Machining - A 3-axis CNC GCode simulator
Other
602 stars 138 forks source link

G52, M98, M99, O support #418

Open dining-philosopher opened 3 months ago

dining-philosopher commented 3 months ago

Hello!

I am producing multiple parts at once using G52 and subroutines. Notepad++ with ncneticnpp shows it perfectly, but it does not work under linux, and camotics does not support none of these. Can you please add support for aforementioned codes?

Thanks in advance.

Example g code:

(2drill3_big_7mm)
(Material Size) (X=180.000, Y=180.000, Z=18.000)
(Tool Number:1) (3.000 mm dia. slot drill)
G017 G21 G49 G80 G90 G91.1
G0Z33.7919
M3 S9000

(https://www.cnccookbook.com/g54-g92-g52-work-offsets-cnc-g-code/)
(G52 - coordinate offset, M98 P*- subroutine call, O - subroutine definition, M99 - subroutine end)

G52 X0Y0
M98 P23
G52 X0Y110
M98 P23
G52 X0Y220
M98 P23
G52 X0Y330
M98 P23
G52 X0Y440
M98 P23
G52 X0Y550
M98 P23
G52 X0Y660
M98 P23
G52 X0Y770
M98 P23

G52 X0Y0
G0X0.0000Y0.0000
M5
M30

%

O23
G52 X0
M98 P42
G52 X81
M98 P42
G52 X175
M98 P42
G52 X256
M98 P42
M99

O42
G0Z33.7919
M3 S9000
G0 X32.7650 Y29.0291 Z33.7910
  Z20.0000
G1   Z11.0000 F1500
G0   Z18.0000
  Z13.0000
G1   Z4.0000 F1500
G0   Z18.0000
  Z6.0000
G1   Z-1.0000 F1500
G0   Z18.0000
G0   Z33.7910
G0 X54.2635 Y29.0289 
  Z20.0000
G1   Z11.0000 F1500
G0   Z18.0000
  Z13.0000
G1   Z4.0000 F1500
G0   Z18.0000
  Z6.0000
G1   Z-1.0000 F1500
G0   Z18.0000
G0   Z33.7910
G0 X52.5143 Y90.9981 
  Z20.0000
G1   Z11.0000 F1500
G0   Z18.0000
  Z13.0000
G1   Z4.0000 F1500
G0   Z18.0000
  Z6.0000
G1   Z-1.0000 F1500
G0   Z18.0000
G0   Z33.7910
G0 X34.5158 Y90.9945 
  Z20.0000
G1   Z11.0000 F1500
G0   Z18.0000
  Z13.0000
G1   Z4.0000 F1500
G0   Z18.0000
  Z6.0000
G1   Z-1.0000 F1500
G0   Z18.0000
G0   Z33.7910
;G0 X0.0000 Y0.0000 Z33.7919
G0Z33.7919
;G0X0.0000Y0.0000
M99