Hello to the round,
thank you very much for the hints. I have now set up the macro as follows:
Code:
o<messen_eng> sub
o100 if [#<_task> EQ 0]
(msg, Task is zero)
o<messen_eng> return
o100 endif
M64P10
#1700=1200 (Tool change X position)
#1701=0 (Tool change Y position)
#1702=-1 (Tool change Z position)
#1800=-100 (position sicheres Z)
#1801=1279.125 (position probe X)
#1802=2498 (position probe Y)
#1900=#<_coord_system> (Store coordinate system only G54 till G59)
o500 if [#<_current_tool> EQ #<_selected_tool>]
;(debug, Tool already in spindle)
o500 else
M5
G54
G90 G0
G53 Z#1702 (Go to tool change Z position)
G53 X#1700 Y#1701 (Go to tool change XY position)
M6 T#<_selected_tool>
#4999=#5400
G43.1 Z0 (TLO reset)
G53 X#1801 Y#1802 (Go to probe position)
G53 Z#1800 (Go to save Z position)
G91
G38.2 Z-197.5 F850 (probing fast)
G1 Z2.0 F150 (go up a bit)
G38.2 Z-2.25 F25 (probing slow)
#2000=[#5063+#5223] (Switching point+zero Offset)
#2001=[#2000-#2002+#2003](new - diff + old)
#2002=[#2000] (Save old switch point)
#2003=[#2001] (Save old offset)
G1 Z5.0 F500 (go up away from sensor)
G90 G0
G43.1 Z#2001 (TLO set)
G53 Z#1800 (Go to save Z position)
G53 Z#1702 (Go to tool change Z position)
#1803=1 (State tool already measured)
(debug, Differenz ist: #2001)
(Restore old zero - only G54 to G59)
o200 if[#1900 EQ 540]
G54
o200 endif
o201 if[#1900 EQ 550]
G55
o201 endif
o202 if[#1900 EQ 560]
G56
o202 endif
o203 if[#1900 EQ 570]
G57
o203 endif
o204 if[#1900 EQ 580]
G58
o204 endif
o500 endif
M65P10
o<messen_eng> endsub
M2
Unfortunately the preview still doesn't work like this, although the If loop works (if I include a syntax error in the code below the If loop Linuxcnc doesn't complain).
I just tried the following for debugging:
- I measured the tool via the MDI: M6 T9
- Up to this point, no error is displayed in the preview.
- If I now set the Z zero point again (somewhere in the machine workspace) the error is displayed.
- If I now delete Z0 in the MDI via G43.1 Z0 and set the Z Origin somwhere in the workspace the error disappears.
- Even if I set the offset to G43.1 Z100 as a test, the error disappears after setting the Z zero point again.
- Also a reduction of the remapping code as follows:
o<measure_eng> sub
o<measure_eng> endsub
M2
Does not have an affect on the error message.
To make this a bit more understandable I made a short screencast video to the above.
(watch on 720p, otherwise you wont be able to see it clear)
The problem is as far as I understand the value of the determined G43.1 offset. This is about -247 mm for the cutter used in the video. Does anyone have an explanation for this?
Best regards
Jan