05-15-2023, 03:26 PM
Zum Scannen werden die folgende Befehle benutzt:
* L47 Spline-Parameter P0..P5 = SX, SY, EX, EY, NX, NY
* L48 Spline-Daten setzen I,J=Index X/Y, Z=Wert
* L49 Spline-Interpolation aktivieren (Wrap) K=1
Damit wird eine Datei geschrieben, die alle Meßpunkte enthält. Die daraus entstandene Oberfläche wird orange transparent angezeigt.
Die Z-Achse wird damit automatisch korrigiert.
Hier mal ein Beispiel eine Scanprogrammes:
Scan a grid of XY points with Z touch probe
for engraving on uneven surface (wrapping)
#800 = progress indicator (0=start, 1=endpoint, 2=scanning)
#801=0 (Start X)
#802=0 (Start Y)
#803=Z (Start Z at current position)
#804=100 (End X)
#805=100 (End Y)
#806=#977-#902 (End Z)
#807=10 (grid pitch X)
#808=10 (grid pitch Y)
#809=0 (current X index)
#810=0 (current Y index)
%
L49 K=0 (disable wrapping)
IF #800=1 THEN
SKIP O1
ENDIF
IF #800=2 THEN
#800=0
ASKBOOL "Continue scanning? (Cancel to set new parameters)" I=1
#800=2
SKIP O2
ENDIF
#801=X
#802=Y
#803=Z
ASKBOOL "Current position was saved as starting point" I=0
ASKBOOL "Move to end position and restart macro\n(or cancel to start over)" I=1
#800=1
M30
O1:
#804=X
#805=Y
#806=#977-#902
#800=0
IF (#804<=#801)|(#805<=#802) THEN
ASKBOOL "Endpoint must be in X+ and Y+ direction\nrelative to starting point" I=0
M30
ENDIF
ASKBOOL "Current position was saved as end point" I=0
ASKFLT "Please enter grid pitch for X direction" I=0.1 J=1000
#807=#0
ASKFLT "Please enter grid pitch for Y direction" I=0.1 J=1000
#808=#0
IF (#807>#804-#801+0.001)|(#808>#805-#802+0.001) THEN
ASKBOOL "Surface must contain at least two probe\npoints in each direction" I=0
M30
ENDIF
#1=(#804-#801)/#807
#2=(#805-#802)/#808
IF #1>200/#2 THEN
ASKBOOL "Warning: Scanning will take very long\n(more than 200 probe points)" I=1
ENDIF
ASKBOOL "Ready to start scanning?\n(cancel to abort)" I=1
#800=2
(L47 startX startY endX endY numPX numPY)
L47 P0=#801 P1=#802 P2=#801+#1*#807 P3=#802+#2*#808 P4=#1+1.001 P5=#2+1.001
#809=0
#810=0
SKIP O2
O2:
#1=(#804-#801)/#807+1.001 (no. of points X)
#2=(#805-#802)/#808+1.001 (no. of points Y)
REPEAT=#2-#810 (row loop)
M98 P3
#809=0
#810=#810+1
NEXT
#800=0
#810=0
L49 K=1 (enable wrapping)
M30
O3:
REPEAT=#1-#809 (column loop)
G0 X=#801+#809*#807 Y=#802+#810*#808
G1 Z=#806 UNTIL #I9=1 F=#952
G1 Z=#803 UNTIL #I9=0 F=#952/10
PRINT "point= X";X;" Y";Y;" Z";Z
L48 I=#809 J=#810
G0 Z=#803
#809=#809+1
NEXT
M99
* L47 Spline-Parameter P0..P5 = SX, SY, EX, EY, NX, NY
* L48 Spline-Daten setzen I,J=Index X/Y, Z=Wert
* L49 Spline-Interpolation aktivieren (Wrap) K=1
Damit wird eine Datei geschrieben, die alle Meßpunkte enthält. Die daraus entstandene Oberfläche wird orange transparent angezeigt.
Die Z-Achse wird damit automatisch korrigiert.
Hier mal ein Beispiel eine Scanprogrammes:
Scan a grid of XY points with Z touch probe
for engraving on uneven surface (wrapping)
#800 = progress indicator (0=start, 1=endpoint, 2=scanning)
#801=0 (Start X)
#802=0 (Start Y)
#803=Z (Start Z at current position)
#804=100 (End X)
#805=100 (End Y)
#806=#977-#902 (End Z)
#807=10 (grid pitch X)
#808=10 (grid pitch Y)
#809=0 (current X index)
#810=0 (current Y index)
%
L49 K=0 (disable wrapping)
IF #800=1 THEN
SKIP O1
ENDIF
IF #800=2 THEN
#800=0
ASKBOOL "Continue scanning? (Cancel to set new parameters)" I=1
#800=2
SKIP O2
ENDIF
#801=X
#802=Y
#803=Z
ASKBOOL "Current position was saved as starting point" I=0
ASKBOOL "Move to end position and restart macro\n(or cancel to start over)" I=1
#800=1
M30
O1:
#804=X
#805=Y
#806=#977-#902
#800=0
IF (#804<=#801)|(#805<=#802) THEN
ASKBOOL "Endpoint must be in X+ and Y+ direction\nrelative to starting point" I=0
M30
ENDIF
ASKBOOL "Current position was saved as end point" I=0
ASKFLT "Please enter grid pitch for X direction" I=0.1 J=1000
#807=#0
ASKFLT "Please enter grid pitch for Y direction" I=0.1 J=1000
#808=#0
IF (#807>#804-#801+0.001)|(#808>#805-#802+0.001) THEN
ASKBOOL "Surface must contain at least two probe\npoints in each direction" I=0
M30
ENDIF
#1=(#804-#801)/#807
#2=(#805-#802)/#808
IF #1>200/#2 THEN
ASKBOOL "Warning: Scanning will take very long\n(more than 200 probe points)" I=1
ENDIF
ASKBOOL "Ready to start scanning?\n(cancel to abort)" I=1
#800=2
(L47 startX startY endX endY numPX numPY)
L47 P0=#801 P1=#802 P2=#801+#1*#807 P3=#802+#2*#808 P4=#1+1.001 P5=#2+1.001
#809=0
#810=0
SKIP O2
O2:
#1=(#804-#801)/#807+1.001 (no. of points X)
#2=(#805-#802)/#808+1.001 (no. of points Y)
REPEAT=#2-#810 (row loop)
M98 P3
#809=0
#810=#810+1
NEXT
#800=0
#810=0
L49 K=1 (enable wrapping)
M30
O3:
REPEAT=#1-#809 (column loop)
G0 X=#801+#809*#807 Y=#802+#810*#808
G1 Z=#806 UNTIL #I9=1 F=#952
G1 Z=#803 UNTIL #I9=0 F=#952/10
PRINT "point= X";X;" Y";Y;" Z";Z
L48 I=#809 J=#810
G0 Z=#803
#809=#809+1
NEXT
M99