Add configurable X/Y offset parameters for plotter positioning
- Added offset-x and offset-y parameters to plotter-lod.inx (default: X=180, Y=0) - Updated plotter-lod.py to apply offsets to all G-code coordinates - Modified footer to use dynamic offset values - Allows users to adjust plotter start position through GUI without code changes
This commit is contained in:
@@ -134,6 +134,7 @@ G0 Z0
|
||||
'footer': """G1 X0 Y0
|
||||
|
||||
"""
|
||||
# Note: footer will be dynamically updated with offset values in check_dir()
|
||||
}
|
||||
|
||||
intersection_recursion_depth = 10
|
||||
@@ -642,6 +643,12 @@ class LaserGcode(inkex.Effect):
|
||||
{"name": "--plotter-off-delay", "type": str, "dest": "plotter_off_delay",
|
||||
"default": "0", "help": "Laser power-on delay (ms},"},
|
||||
|
||||
{"name": "--offset-x", "type": float, "dest": "offset_x",
|
||||
"default": 180.0, "help": "X axis offset (mm or in)"},
|
||||
|
||||
{"name": "--offset-y", "type": float, "dest": "offset_y",
|
||||
"default": 0.0, "help": "Y axis offset (mm or in)"},
|
||||
|
||||
{"name": "--suppress-all-messages", "type": inkex.Boolean,
|
||||
"dest": "suppress_all_messages", "default": True,
|
||||
"help": "Hide messages during g-code generation"},
|
||||
@@ -825,6 +832,9 @@ class LaserGcode(inkex.Effect):
|
||||
f.close()
|
||||
else:
|
||||
self.footer = defaults['footer']
|
||||
|
||||
# Always apply dynamic offset values to footer
|
||||
self.footer = "G1 X%s Y%s\n\n" % (self.options.offset_x, self.options.offset_y)
|
||||
|
||||
if self.options.unit == "G21 (All units in mm)":
|
||||
self.header += "G21\n"
|
||||
@@ -878,6 +888,11 @@ class LaserGcode(inkex.Effect):
|
||||
def c(c):
|
||||
c = [c[i] if i < len(c) else None for i in range(6)]
|
||||
if c[5] == 0: c[5] = None
|
||||
# Apply plotter offset from options
|
||||
if c[0] != None:
|
||||
c[0] = c[0] + self.options.offset_x
|
||||
if c[1] != None:
|
||||
c[1] = c[1] + self.options.offset_y
|
||||
s = [" X", " Y", " Z", " I", " J", " K"]
|
||||
r = ''
|
||||
for i in range(6):
|
||||
|
||||
Reference in New Issue
Block a user