From 97f4681c503238f18fbbe5fef33e3ed45e7b0aa2 Mon Sep 17 00:00:00 2001 From: sliptonic Date: Tue, 13 Jun 2023 15:41:51 -0500 Subject: [PATCH 1/4] fix submitted by Zibibbo84 --- .../Path/Path/Post/scripts/heidenhain_post.py | 155 +++++++++--------- 1 file changed, 79 insertions(+), 76 deletions(-) diff --git a/src/Mod/Path/Path/Post/scripts/heidenhain_post.py b/src/Mod/Path/Path/Post/scripts/heidenhain_post.py index 66e3f55ffb..5fd582164e 100644 --- a/src/Mod/Path/Path/Post/scripts/heidenhain_post.py +++ b/src/Mod/Path/Path/Post/scripts/heidenhain_post.py @@ -344,88 +344,91 @@ def export(objectslist, filename, argstring): Cmd_Count = 0 # command line number LBLIZE_STAUS = False - # useful to get idea of object kind - if isinstance(obj.Proxy, Path.Tool.Controller.ToolController): - Object_Kind = "TOOL" - # like we go to change tool position - MACHINE_LAST_POSITION["X"] = 99999 - MACHINE_LAST_POSITION["Y"] = 99999 - MACHINE_LAST_POSITION["Z"] = 99999 - elif isinstance(obj.Proxy, Path.Op.ProfileEdges.ObjectProfile): - Object_Kind = "PROFILE" - if LBLIZE_ACTIVE: - LBLIZE_STAUS = True - elif isinstance(obj.Proxy, Path.Op.MillFace.ObjectFace): - Object_Kind = "FACE" - if LBLIZE_ACTIVE: - LBLIZE_STAUS = True - elif isinstance(obj.Proxy, Path.Op.Helix.ObjectHelix): - Object_Kind = "HELIX" + if hasattr(obj, "Proxy"): + # useful to get idea of object kind + if isinstance(obj.Proxy, Path.Tool.Controller.ToolController): + Object_Kind = "TOOL" + # like we go to change tool position + MACHINE_LAST_POSITION["X"] = 99999 + MACHINE_LAST_POSITION["Y"] = 99999 + MACHINE_LAST_POSITION["Z"] = 99999 + elif isinstance(obj.Proxy, Path.Op.ProfileEdges.ObjectProfile): + Object_Kind = "PROFILE" + if LBLIZE_ACTIVE: + LBLIZE_STAUS = True + elif isinstance(obj.Proxy, Path.Op.MillFace.ObjectFace): + Object_Kind = "FACE" + if LBLIZE_ACTIVE: + LBLIZE_STAUS = True + elif isinstance(obj.Proxy, Path.Op.Helix.ObjectHelix): + Object_Kind = "HELIX" - commands = PathUtils.getPathWithPlacement(obj).Commands + commands = PathUtils.getPathWithPlacement(obj).Commands - # If used compensated path, store, recompute and diff when asked - if hasattr(obj, "UseComp") and SOLVE_COMPENSATION_ACTIVE: - if obj.UseComp: - if hasattr(obj.Path, "Commands") and Object_Kind == "PROFILE": - # Take a copy of compensated path - STORED_COMPENSATED_OBJ = commands - # Find mill compensation - if hasattr(obj, "Side") and hasattr(obj, "Direction"): - if obj.Side == "Outside" and obj.Direction == "CW": - Compensation = "L" - elif obj.Side == "Outside" and obj.Direction == "CCW": - Compensation = "R" - elif obj.Side != "Outside" and obj.Direction == "CW": - Compensation = "R" - else: - Compensation = "L" - # set obj.UseComp to false and recompute() to get uncompensated path - obj.UseComp = False - obj.recompute() - commands = PathUtils.getPathWithPlacement(obj).Commands - # small edges could be skipped and movements joints can add edges - NameStr = "" - if hasattr(obj, "Label"): - NameStr = str(obj.Label) - if len(commands) != len(STORED_COMPENSATED_OBJ): - # not same number of edges - obj.UseComp = True + # If used compensated path, store, recompute and diff when asked + if hasattr(obj, "UseComp") and SOLVE_COMPENSATION_ACTIVE: + if obj.UseComp: + if hasattr(obj.Path, "Commands") and Object_Kind == "PROFILE": + # Take a copy of compensated path + STORED_COMPENSATED_OBJ = commands + # Find mill compensation + if hasattr(obj, "Side") and hasattr(obj, "Direction"): + if obj.Side == "Outside" and obj.Direction == "CW": + Compensation = "L" + elif obj.Side == "Outside" and obj.Direction == "CCW": + Compensation = "R" + elif obj.Side != "Outside" and obj.Direction == "CW": + Compensation = "R" + else: + Compensation = "L" + # set obj.UseComp to false and recompute() to get uncompensated path + obj.UseComp = False obj.recompute() commands = PathUtils.getPathWithPlacement(obj).Commands - POSTGCODE.append("; MISSING EDGES UNABLE TO GET COMPENSATION") - if not SKIP_WARNS: - ( - PostUtils.editor( - "--solve-comp command ACTIVE\n\n" - + "UNABLE to solve " - + NameStr - + " compensation\n\n" - + "Some edges are missing\n" - + "try to change Join Type to Miter or Square\n" - + "try to use a smaller Tool Diameter\n" - + "Internal Path could have too small corners\n\n" - + "use --no-warns to not prompt this message" - ) + # small edges could be skipped and movements joints can add edges + NameStr = "" + if hasattr(obj, "Label"): + NameStr = str(obj.Label) + if len(commands) != len(STORED_COMPENSATED_OBJ): + # not same number of edges + obj.UseComp = True + obj.recompute() + commands = PathUtils.getPathWithPlacement(obj).Commands + POSTGCODE.append( + "; MISSING EDGES UNABLE TO GET COMPENSATION" ) - else: - if not SKIP_WARNS: - ( - PostUtils.editor( - "--solve-comp command ACTIVE\n\n" - + "BE CAREFUL with solved " - + NameStr - + " compensation\n\n" - + "USE AT YOUR OWN RISK\n" - + "Simulate it before use\n" - + "Offset Extra ignored use DR+ on TOOL CALL\n" - + "Path could be different and/or give tool radius errors\n\n" - + "use --no-warns to not prompt this message" + if not SKIP_WARNS: + ( + PostUtils.editor( + "--solve-comp command ACTIVE\n\n" + + "UNABLE to solve " + + NameStr + + " compensation\n\n" + + "Some edges are missing\n" + + "try to change Join Type to Miter or Square\n" + + "try to use a smaller Tool Diameter\n" + + "Internal Path could have too small corners\n\n" + + "use --no-warns to not prompt this message" + ) ) - ) - # we can try to solve compensation - POSTGCODE.append("; COMPENSATION ACTIVE") - COMPENSATION_DIFF_STATUS[0] = True + else: + if not SKIP_WARNS: + ( + PostUtils.editor( + "--solve-comp command ACTIVE\n\n" + + "BE CAREFUL with solved " + + NameStr + + " compensation\n\n" + + "USE AT YOUR OWN RISK\n" + + "Simulate it before use\n" + + "Offset Extra ignored use DR+ on TOOL CALL\n" + + "Path could be different and/or give tool radius errors\n\n" + + "use --no-warns to not prompt this message" + ) + ) + # we can try to solve compensation + POSTGCODE.append("; COMPENSATION ACTIVE") + COMPENSATION_DIFF_STATUS[0] = True for c in commands: Cmd_Count += 1 From 8e580e53ef702c58ba7c11540788037f7fc1f7b9 Mon Sep 17 00:00:00 2001 From: sliptonic Date: Mon, 19 Jun 2023 08:52:53 -0500 Subject: [PATCH 2/4] Update src/Mod/Path/Path/Post/scripts/heidenhain_post.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benjamin Bræstrup Sayoc --- src/Mod/Path/Path/Post/scripts/heidenhain_post.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Mod/Path/Path/Post/scripts/heidenhain_post.py b/src/Mod/Path/Path/Post/scripts/heidenhain_post.py index 5fd582164e..b43f4ba3a5 100644 --- a/src/Mod/Path/Path/Post/scripts/heidenhain_post.py +++ b/src/Mod/Path/Path/Post/scripts/heidenhain_post.py @@ -367,7 +367,8 @@ def export(objectslist, filename, argstring): # If used compensated path, store, recompute and diff when asked if hasattr(obj, "UseComp") and SOLVE_COMPENSATION_ACTIVE: - if obj.UseComp: + if not obj.UseComp: + continue if hasattr(obj.Path, "Commands") and Object_Kind == "PROFILE": # Take a copy of compensated path STORED_COMPENSATED_OBJ = commands From 0f3ea60ba86ade561b7ff0e801ec359cba9dac07 Mon Sep 17 00:00:00 2001 From: sliptonic Date: Mon, 19 Jun 2023 08:53:06 -0500 Subject: [PATCH 3/4] Update src/Mod/Path/Path/Post/scripts/heidenhain_post.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benjamin Bræstrup Sayoc --- src/Mod/Path/Path/Post/scripts/heidenhain_post.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Mod/Path/Path/Post/scripts/heidenhain_post.py b/src/Mod/Path/Path/Post/scripts/heidenhain_post.py index b43f4ba3a5..8ab52795e8 100644 --- a/src/Mod/Path/Path/Post/scripts/heidenhain_post.py +++ b/src/Mod/Path/Path/Post/scripts/heidenhain_post.py @@ -366,7 +366,8 @@ def export(objectslist, filename, argstring): commands = PathUtils.getPathWithPlacement(obj).Commands # If used compensated path, store, recompute and diff when asked - if hasattr(obj, "UseComp") and SOLVE_COMPENSATION_ACTIVE: + if not hasattr(obj, "UseComp") or not SOLVE_COMPENSATION_ACTIVE: + continue if not obj.UseComp: continue if hasattr(obj.Path, "Commands") and Object_Kind == "PROFILE": From 0d1e64e74ad61284aa0da36308e77ed0052dbcf3 Mon Sep 17 00:00:00 2001 From: sliptonic Date: Mon, 19 Jun 2023 08:53:18 -0500 Subject: [PATCH 4/4] Update src/Mod/Path/Path/Post/scripts/heidenhain_post.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benjamin Bræstrup Sayoc --- .../Path/Path/Post/scripts/heidenhain_post.py | 171 +++++++++--------- 1 file changed, 86 insertions(+), 85 deletions(-) diff --git a/src/Mod/Path/Path/Post/scripts/heidenhain_post.py b/src/Mod/Path/Path/Post/scripts/heidenhain_post.py index 8ab52795e8..e8523e4e4a 100644 --- a/src/Mod/Path/Path/Post/scripts/heidenhain_post.py +++ b/src/Mod/Path/Path/Post/scripts/heidenhain_post.py @@ -344,93 +344,94 @@ def export(objectslist, filename, argstring): Cmd_Count = 0 # command line number LBLIZE_STAUS = False - if hasattr(obj, "Proxy"): - # useful to get idea of object kind - if isinstance(obj.Proxy, Path.Tool.Controller.ToolController): - Object_Kind = "TOOL" - # like we go to change tool position - MACHINE_LAST_POSITION["X"] = 99999 - MACHINE_LAST_POSITION["Y"] = 99999 - MACHINE_LAST_POSITION["Z"] = 99999 - elif isinstance(obj.Proxy, Path.Op.ProfileEdges.ObjectProfile): - Object_Kind = "PROFILE" - if LBLIZE_ACTIVE: - LBLIZE_STAUS = True - elif isinstance(obj.Proxy, Path.Op.MillFace.ObjectFace): - Object_Kind = "FACE" - if LBLIZE_ACTIVE: - LBLIZE_STAUS = True - elif isinstance(obj.Proxy, Path.Op.Helix.ObjectHelix): - Object_Kind = "HELIX" + if not hasattr(obj, "Proxy"): + continue + # useful to get idea of object kind + if isinstance(obj.Proxy, Path.Tool.Controller.ToolController): + Object_Kind = "TOOL" + # like we go to change tool position + MACHINE_LAST_POSITION["X"] = 99999 + MACHINE_LAST_POSITION["Y"] = 99999 + MACHINE_LAST_POSITION["Z"] = 99999 + elif isinstance(obj.Proxy, Path.Op.ProfileEdges.ObjectProfile): + Object_Kind = "PROFILE" + if LBLIZE_ACTIVE: + LBLIZE_STAUS = True + elif isinstance(obj.Proxy, Path.Op.MillFace.ObjectFace): + Object_Kind = "FACE" + if LBLIZE_ACTIVE: + LBLIZE_STAUS = True + elif isinstance(obj.Proxy, Path.Op.Helix.ObjectHelix): + Object_Kind = "HELIX" + commands = PathUtils.getPathWithPlacement(obj).Commands + + # If used compensated path, store, recompute and diff when asked + if not hasattr(obj, "UseComp") or not SOLVE_COMPENSATION_ACTIVE: + continue + + if not obj.UseComp: + continue + + if hasattr(obj.Path, "Commands") and Object_Kind == "PROFILE": + # Take a copy of compensated path + STORED_COMPENSATED_OBJ = commands + # Find mill compensation + if hasattr(obj, "Side") and hasattr(obj, "Direction"): + if obj.Side == "Outside" and obj.Direction == "CW": + Compensation = "L" + elif obj.Side == "Outside" and obj.Direction == "CCW": + Compensation = "R" + elif obj.Side != "Outside" and obj.Direction == "CW": + Compensation = "R" + else: + Compensation = "L" + # set obj.UseComp to false and recompute() to get uncompensated path + obj.UseComp = False + obj.recompute() commands = PathUtils.getPathWithPlacement(obj).Commands - - # If used compensated path, store, recompute and diff when asked - if not hasattr(obj, "UseComp") or not SOLVE_COMPENSATION_ACTIVE: - continue - if not obj.UseComp: - continue - if hasattr(obj.Path, "Commands") and Object_Kind == "PROFILE": - # Take a copy of compensated path - STORED_COMPENSATED_OBJ = commands - # Find mill compensation - if hasattr(obj, "Side") and hasattr(obj, "Direction"): - if obj.Side == "Outside" and obj.Direction == "CW": - Compensation = "L" - elif obj.Side == "Outside" and obj.Direction == "CCW": - Compensation = "R" - elif obj.Side != "Outside" and obj.Direction == "CW": - Compensation = "R" - else: - Compensation = "L" - # set obj.UseComp to false and recompute() to get uncompensated path - obj.UseComp = False - obj.recompute() - commands = PathUtils.getPathWithPlacement(obj).Commands - # small edges could be skipped and movements joints can add edges - NameStr = "" - if hasattr(obj, "Label"): - NameStr = str(obj.Label) - if len(commands) != len(STORED_COMPENSATED_OBJ): - # not same number of edges - obj.UseComp = True - obj.recompute() - commands = PathUtils.getPathWithPlacement(obj).Commands - POSTGCODE.append( - "; MISSING EDGES UNABLE TO GET COMPENSATION" - ) - if not SKIP_WARNS: - ( - PostUtils.editor( - "--solve-comp command ACTIVE\n\n" - + "UNABLE to solve " - + NameStr - + " compensation\n\n" - + "Some edges are missing\n" - + "try to change Join Type to Miter or Square\n" - + "try to use a smaller Tool Diameter\n" - + "Internal Path could have too small corners\n\n" - + "use --no-warns to not prompt this message" - ) - ) - else: - if not SKIP_WARNS: - ( - PostUtils.editor( - "--solve-comp command ACTIVE\n\n" - + "BE CAREFUL with solved " - + NameStr - + " compensation\n\n" - + "USE AT YOUR OWN RISK\n" - + "Simulate it before use\n" - + "Offset Extra ignored use DR+ on TOOL CALL\n" - + "Path could be different and/or give tool radius errors\n\n" - + "use --no-warns to not prompt this message" - ) - ) - # we can try to solve compensation - POSTGCODE.append("; COMPENSATION ACTIVE") - COMPENSATION_DIFF_STATUS[0] = True + # small edges could be skipped and movements joints can add edges + NameStr = "" + if hasattr(obj, "Label"): + NameStr = str(obj.Label) + if len(commands) != len(STORED_COMPENSATED_OBJ): + # not same number of edges + obj.UseComp = True + obj.recompute() + commands = PathUtils.getPathWithPlacement(obj).Commands + POSTGCODE.append("; MISSING EDGES UNABLE TO GET COMPENSATION") + if not SKIP_WARNS: + ( + PostUtils.editor( + "--solve-comp command ACTIVE\n\n" + + "UNABLE to solve " + + NameStr + + " compensation\n\n" + + "Some edges are missing\n" + + "try to change Join Type to Miter or Square\n" + + "try to use a smaller Tool Diameter\n" + + "Internal Path could have too small corners\n\n" + + "use --no-warns to not prompt this message" + ) + ) + else: + if not SKIP_WARNS: + ( + PostUtils.editor( + "--solve-comp command ACTIVE\n\n" + + "BE CAREFUL with solved " + + NameStr + + " compensation\n\n" + + "USE AT YOUR OWN RISK\n" + + "Simulate it before use\n" + + "Offset Extra ignored use DR+ on TOOL CALL\n" + + "Path could be different and/or give tool radius errors\n\n" + + "use --no-warns to not prompt this message" + ) + ) + # we can try to solve compensation + POSTGCODE.append("; COMPENSATION ACTIVE") + COMPENSATION_DIFF_STATUS[0] = True for c in commands: Cmd_Count += 1