add a material allowance property

This commit is contained in:
sliptonic
2022-01-20 17:38:52 -06:00
parent 6bdb86fcef
commit 5be4570d12
2 changed files with 59 additions and 19 deletions

View File

@@ -14,6 +14,19 @@
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="frameShape">
@@ -81,14 +94,14 @@
</item>
</widget>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Direction</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QComboBox" name="direction">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The direction for the helix, clockwise or counter clockwise.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@@ -105,14 +118,14 @@
</item>
</widget>
</item>
<item row="2" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Step over percent</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="4" column="1">
<widget class="QSpinBox" name="stepOverPercent">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Specify the percent of the tool diameter each helix will be offset to the previous one.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;A step over of 100% means no overlap of the individual cuts.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@@ -131,24 +144,32 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Extra Offset</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="Gui::InputField" name="extraOffset">
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Gui::InputField</class>
<extends>QLineEdit</extends>
<header>Gui/InputField.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -134,6 +134,15 @@ class ObjectHelix(PathCircularHoleBase.ObjectOp):
"Helix Drill",
QT_TRANSLATE_NOOP("App::Property", "Starting Radius"),
)
obj.addProperty(
"App::PropertyDistance",
"OffsetExtra",
"Helix Drill",
QT_TRANSLATE_NOOP(
"App::Property",
"Extra value to stay away from final profile- good for roughing toolpath",
),
)
ENUMS = self.helixOpPropertyEnumerations()
for n in ENUMS:
@@ -148,6 +157,16 @@ class ObjectHelix(PathCircularHoleBase.ObjectOp):
QT_TRANSLATE_NOOP("App::Property", "Starting Radius"),
)
if not hasattr(obj, "OffsetExtra"):
obj.addProperty(
"App::PropertyDistance",
"OffsetExtra",
"Helix Drill",
QT_TRANSLATE_NOOP(
"App::Property",
"Extra value to stay away from final profile- good for roughing toolpath",
),
)
def circularHoleExecute(self, obj, holes):
"""circularHoleExecute(obj, holes) ... generate helix commands for each hole in holes"""
PathLog.track()
@@ -177,13 +196,13 @@ class ObjectHelix(PathCircularHoleBase.ObjectOp):
"step_down": obj.StepDown.Value,
"step_over": obj.StepOver / 100,
"tool_diameter": tooldiamter,
"inner_radius": obj.StartRadius.Value,
"inner_radius": obj.StartRadius.Value + obj.OffsetExtra.Value,
"direction": obj.Direction,
"startAt": obj.StartSide,
}
for hole in holes:
args["hole_radius"] = hole["r"] / 2
args["hole_radius"] = (hole["r"] / 2) - (obj.OffsetExtra.Value)
startPoint = FreeCAD.Vector(hole["x"], hole["y"], obj.StartDepth.Value)
endPoint = FreeCAD.Vector(hole["x"], hole["y"], obj.FinalDepth.Value)
args["edge"] = Part.makeLine(startPoint, endPoint)