From edd913b358ed9a82d0010b4670400d2468a01f09 Mon Sep 17 00:00:00 2001 From: Pigi_102 Date: Tue, 28 Nov 2023 21:58:56 +0000 Subject: [PATCH] Fix for ideaMaker EXCLUDE_OBJECT_DEFINE position in gcode --- preprocess_cancellation.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/preprocess_cancellation.py b/preprocess_cancellation.py index 4e1c2d1..f84d105 100644 --- a/preprocess_cancellation.py +++ b/preprocess_cancellation.py @@ -363,6 +363,8 @@ def preprocess_ideamaker(infile): current_hull: HullTracker = None for line in infile: + if line.startswith(";TOTAL_NUM:"): + total_num = int(line.split(":")[1].strip()) if line.startswith(";PRINTING:"): name = line.split(":")[1].strip() id_line = next(infile) @@ -388,17 +390,21 @@ def preprocess_ideamaker(infile): for line in infile: yield line - if line.startswith(";TOTAL_NUM:"): - total_num = int(line.split(":")[1].strip()) - assert total_num == len(known_objects) - yield from header(total_num) - for id, (name, hull) in known_objects.items(): - yield from define_object( - name, - center=hull.center(), - polygon=hull.exterior(), - ) + if line.strip() and not line.startswith(";"): + break + assert total_num == len(known_objects) + yield from header(total_num) + for id, (name, hull) in known_objects.items(): + yield from define_object( + name, + center=hull.center(), + polygon=hull.exterior(), + ) + yield "\n\n" + + for line in infile: + yield line if line.startswith(";PRINTING_ID:"): printing_id = line.split(":")[1].strip() if current_object: