From 4e6741a0271fb47edd5641af65081a25bf16425d Mon Sep 17 00:00:00 2001 From: Russell Johnson <47639332+Russ4262@users.noreply.github.com> Date: Thu, 1 Oct 2020 22:49:48 -0500 Subject: [PATCH 1/3] Path: Add debug feedback and comment --- src/Mod/Path/PathScripts/PathProfile.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Mod/Path/PathScripts/PathProfile.py b/src/Mod/Path/PathScripts/PathProfile.py index 595a3fb0a1..dc5e17d611 100644 --- a/src/Mod/Path/PathScripts/PathProfile.py +++ b/src/Mod/Path/PathScripts/PathProfile.py @@ -482,7 +482,7 @@ class ObjectProfile(PathAreaOp.ObjectOp): for shape in faces: finalDep = obj.FinalDepth.Value custDepthparams = self.depthparams - + self._addDebugObject('Rotation_Indiv_Shp', shape) if obj.Side == 'Inside': if finalDep < shape.BoundBox.ZMin: # Recalculate depthparams @@ -557,13 +557,16 @@ class ObjectProfile(PathAreaOp.ObjectOp): (norm, surf) = self.getFaceNormAndSurf(shape) (rtn, angle, axis, praInfo) = self.faceRotationAnalysis(obj, norm, surf) # pylint: disable=unused-variable PathLog.debug("initial faceRotationAnalysis: {}".format(praInfo)) + if rtn is True: + # Rotational alignment is suggested from analysis (clnBase, angle, clnStock, tag) = self.applyRotationalAnalysis(obj, base, angle, axis, subCount) # Verify faces are correctly oriented - InverseAngle might be necessary faceIA = getattr(clnBase.Shape, sub) (norm, surf) = self.getFaceNormAndSurf(faceIA) (rtn, praAngle, praAxis, praInfo2) = self.faceRotationAnalysis(obj, norm, surf) # pylint: disable=unused-variable PathLog.debug("follow-up faceRotationAnalysis: {}".format(praInfo2)) + PathLog.debug("praAngle: {}".format(praAngle)) if abs(praAngle) == 180.0: rtn = False From d2981fb09a42cc54d2c23e77446c3ff5711f7493 Mon Sep 17 00:00:00 2001 From: Russell Johnson <47639332+Russ4262@users.noreply.github.com> Date: Thu, 1 Oct 2020 22:51:33 -0500 Subject: [PATCH 2/3] Path: Remove FinalDepth limitation for internal profile operation Requested in forum at https://forum.freecadweb.org/viewtopic.php?f=15&t=50341 --- src/Mod/Path/PathScripts/PathProfile.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathProfile.py b/src/Mod/Path/PathScripts/PathProfile.py index dc5e17d611..da76f71dda 100644 --- a/src/Mod/Path/PathScripts/PathProfile.py +++ b/src/Mod/Path/PathScripts/PathProfile.py @@ -483,11 +483,6 @@ class ObjectProfile(PathAreaOp.ObjectOp): finalDep = obj.FinalDepth.Value custDepthparams = self.depthparams self._addDebugObject('Rotation_Indiv_Shp', shape) - if obj.Side == 'Inside': - if finalDep < shape.BoundBox.ZMin: - # Recalculate depthparams - finalDep = shape.BoundBox.ZMin - custDepthparams = self._customDepthParams(obj, strDep + 0.5, finalDep) if self.expandProfile: shapeEnv = self._getExpandedProfileEnvelope(obj, shape, False, obj.StartDepth.Value, finalDep) From 5eb5434c6a5a243c4ccf5225355cd3e71ba1a89e Mon Sep 17 00:00:00 2001 From: Russell Johnson <47639332+Russ4262@users.noreply.github.com> Date: Sat, 3 Oct 2020 13:56:23 -0500 Subject: [PATCH 3/3] Path: Fix rotational error for certain situations Error discovered during recent troubleshooting of Pocket_Shape with rotation. Initial application of new operation yields path, but subsequent changes and applications failed due to `if ...` statement removed here for the fix. --- src/Mod/Path/PathScripts/PathProfile.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathProfile.py b/src/Mod/Path/PathScripts/PathProfile.py index da76f71dda..02e10b3fc2 100644 --- a/src/Mod/Path/PathScripts/PathProfile.py +++ b/src/Mod/Path/PathScripts/PathProfile.py @@ -570,9 +570,13 @@ class ObjectProfile(PathAreaOp.ObjectOp): angle -= 180.0 if rtn is True: - PathLog.debug(translate("Path", "Face appears misaligned after initial rotation.")) - if obj.InverseAngle is False: - if obj.AttemptInverseAngle is True: + PathLog.debug(translate("Path", "Face appears misaligned after initial rotation.")) + if obj.AttemptInverseAngle is True: + PathLog.debug(translate("Path", "Applying inverse angle automatically.")) + (clnBase, clnStock, angle) = self.applyInverseAngle(obj, clnBase, clnStock, axis, angle) + else: + if obj.InverseAngle: + PathLog.debug(translate("Path", "Applying inverse angle manually.")) (clnBase, clnStock, angle) = self.applyInverseAngle(obj, clnBase, clnStock, axis, angle) else: msg = translate("Path", "Consider toggling the 'InverseAngle' property and recomputing.")