Skip to content

Instantly share code, notes, and snippets.

@rmu75
Created January 17, 2025 09:44
Show Gist options
  • Save rmu75/03a677b80debdeee49cc8476c2894fc4 to your computer and use it in GitHub Desktop.
Save rmu75/03a677b80debdeee49cc8476c2894fc4 to your computer and use it in GitHub Desktop.
patch to reintroduce "Use Machine CRC"
diff --git a/src/Mod/CAM/Gui/Resources/panels/DressUpLeadInOutEdit.ui b/src/Mod/CAM/Gui/Resources/panels/DressUpLeadInOutEdit.ui
index 5edf0b83fa..3229815d12 100644
--- a/src/Mod/CAM/Gui/Resources/panels/DressUpLeadInOutEdit.ui
+++ b/src/Mod/CAM/Gui/Resources/panels/DressUpLeadInOutEdit.ui
@@ -221,6 +221,13 @@
</property>
</spacer>
</item>
+ <item>
+ <widget class="QCheckBox" name="chkUseCRC">
+ <property name="text">
+ <string>Use Machine CRC</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<customwidgets>
diff --git a/src/Mod/CAM/Path/Dressup/Gui/LeadInOut.py b/src/Mod/CAM/Path/Dressup/Gui/LeadInOut.py
index 3411cc3a2d..ab5fb8aaf2 100644
--- a/src/Mod/CAM/Path/Dressup/Gui/LeadInOut.py
+++ b/src/Mod/CAM/Path/Dressup/Gui/LeadInOut.py
@@ -78,6 +78,15 @@ class ObjectDressup:
"Path",
QT_TRANSLATE_NOOP("App::Property", "Keep the Tool Down in toolpath"),
)
+ obj.addProperty(
+ "App::PropertyBool",
+ "UseMachineCRC",
+ "Path",
+ QT_TRANSLATE_NOOP(
+ "App::Property",
+ "Use Machine Cutter Radius Compensation /Tool Path Offset G41/G42",
+ ),
+ )
obj.addProperty(
"App::PropertyDistance",
"Length",
@@ -137,6 +146,8 @@ class ObjectDressup:
return None
def loads(self, state):
+ if not "UseMachineCRC" in self.__dict__:
+ self.UseMachineCRC = false
return None
def setup(self, obj):
@@ -145,6 +156,7 @@ class ObjectDressup:
obj.LeadIn = True
obj.LeadOut = True
obj.KeepToolDown = False
+ obj.UseMachineCRC = False
obj.StyleOn = "Arc"
obj.StyleOff = "Arc"
obj.ExtendLeadIn = 0
@@ -192,6 +204,7 @@ class ObjectDressup:
def getTravelStart(self, obj, pos, first):
op = PathDressup.baseOp(obj.Base)
vertfeed = PathDressup.toolController(obj.Base).VertFeed.Value
+ toolnumber = PathDressup.toolController(obj.Base).ToolNumber
travel = []
# begin positions for travel and plunge moves are not used anywhere,
@@ -212,12 +225,21 @@ class ObjectDressup:
travel.append(PathLanguage.MoveStraight(None, "G0", {"Z": op.SafeHeight.Value}))
travel.append(PathLanguage.MoveStraight(None, "G1", {"Z": pos.z, "F": vertfeed}))
+ if obj.UseMachineCRC:
+ if self.getDirectionOfPath(obj) == "right":
+ travel.append(PathLanguage.Instruction(None, "G42", {"D": toolnumber}))
+ else:
+ travel.append(PathLanguage.Instruction(None, "G41", {"D": toolnumber}))
+
return travel
def getTravelEnd(self, obj, pos, last):
op = PathDressup.baseOp(obj.Base)
travel = []
+ if obj.UseMachineCRC:
+ travel.append(PathLanguage.Instruction(None, "G40", {}))
+
# move to clearance height
if last or not obj.KeepToolDown:
travel.append(PathLanguage.MoveStraight(None, "G0", {"Z": op.ClearanceHeight.Value}))
@@ -393,6 +415,7 @@ class TaskDressupLeadInOut(SimpleEditPanel):
self.connectWidget("RapidPlunge", self.form.chkRapidPlunge)
self.connectWidget("IncludeLayers", self.form.chkLayers)
self.connectWidget("KeepToolDown", self.form.chkKeepToolDown)
+ self.connectWidget("UseMachineCRC", self.form.chkUseCRC)
self.setFields()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment