Skip to content

Commit

Permalink
Merge pull request #31 from jniebuhr/patch-1
Browse files Browse the repository at this point in the history
Fixes #29, inject define_object before first instruction
  • Loading branch information
kageurufu authored Jan 31, 2024
2 parents 8f717dc + 95f0687 commit 44bb938
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions preprocess_cancellation.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,18 +274,18 @@ def preprocess_cura(infile):

infile.seek(0)
for line in infile:
yield line
if line.strip() and not line.startswith(";"):
# Inject custom marker
yield from header(len(known_objects))
for mesh_id, hull in known_objects.values():
yield from define_object(
mesh_id,
center=hull.center(),
polygon=hull.exterior(),
)
yield line
break

# Inject custom marker
yield from header(len(known_objects))
for mesh_id, hull in known_objects.values():
yield from define_object(
mesh_id,
center=hull.center(),
polygon=hull.exterior(),
)
yield line

current_object = None
for line in infile:
Expand Down Expand Up @@ -329,19 +329,21 @@ def preprocess_slicer(infile):
y = float(params["Y"])
current_hull.add_point(Point(x, y))


infile.seek(0)
for line in infile:
yield line
if line.strip() and not line.startswith(";"):
# Inject custom marker
yield from header(len(known_objects))
for object_id, hull in known_objects.values():
yield from define_object(
object_id,
center=hull.center(),
polygon=hull.exterior(),
)
yield line
break

yield from header(len(known_objects))
for object_id, hull in known_objects.values():
yield from define_object(
object_id,
center=hull.center(),
polygon=hull.exterior(),
)
yield line

for line in infile:
yield line
Expand Down

0 comments on commit 44bb938

Please sign in to comment.