Fixed broken final depth calculation for rotational axis in pocket, profile and drill; Added EnableRotation to GUI; Fix some weird gcode generation
This commit is contained in:
@@ -131,6 +131,12 @@
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Pattern the tool bit is moved in to clear the material.</p></body></html></string>
|
||||
</property>
|
||||
<property name="locale">
|
||||
<locale language="English" country="Germany"/>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string notr="true">ZigZag</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ZigZag</string>
|
||||
@@ -138,7 +144,7 @@
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Offset</string>
|
||||
<string notr="true">Offset</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@@ -222,6 +228,37 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Enable Rotation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="enableRotation">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Off</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>A(x)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>B(y)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>A & B</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -56,6 +56,9 @@
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="locale">
|
||||
<locale language="English" country="Germany"/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="cutSideLabel">
|
||||
@@ -125,6 +128,37 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Enable Rotation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="enableRotation">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Off</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>A(x)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>B(y)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>A & B</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -482,14 +482,15 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
axisOfRot = 'C'
|
||||
else:
|
||||
axisOfRot = 'A'
|
||||
|
||||
# Rotate Model to correct angle
|
||||
ppCmds.insert(0, Path.Command('G1', {axisOfRot: angle, 'F': self.axialFeed}))
|
||||
ppCmds.insert(0, Path.Command('N100', {}))
|
||||
ppCmds.insert(0, Path.Command('G0', {axisOfRot: angle, 'F': self.axialFeed}))
|
||||
#ppCmds.insert(0, Path.Command('N100', {}))
|
||||
|
||||
# Raise cutter to safe depth and return index to starting position
|
||||
ppCmds.append(Path.Command('N200', {}))
|
||||
#ppCmds.append(Path.Command('N200', {}))
|
||||
ppCmds.append(Path.Command('G0', {'Z': obj.SafeHeight.Value, 'F': self.vertRapid}))
|
||||
if axis != nextAxis:
|
||||
if 'L' != nextAxis:
|
||||
ppCmds.append(Path.Command('G0', {axisOfRot: 0.0, 'F': self.axialRapid}))
|
||||
# Eif
|
||||
|
||||
|
||||
@@ -333,6 +333,7 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
msg = translate("Path", "Final Depth setting is below the hole bottom for {}.".format(sub)) + ' '
|
||||
msg += translate("Path", "{} depth is calculated at {} mm".format(sub, round(holeBtm, 4)))
|
||||
PathLog.warning(msg)
|
||||
finDep = holeBtm
|
||||
|
||||
holes.append({'x': pos.x, 'y': pos.y, 'r': self.holeDiameter(obj, base, sub),
|
||||
'angle': angle, 'axis': axis, 'trgtDep': finDep,
|
||||
@@ -440,7 +441,7 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
zlim = 0.0
|
||||
xRotRad = 0.01
|
||||
yRotRad = 0.01
|
||||
xRotRad = 0.01
|
||||
#xRotRad = 0.01
|
||||
|
||||
# Determine boundbox radius based upon xzy limits data
|
||||
if math.fabs(self.stockBB.ZMin) > math.fabs(self.stockBB.ZMax):
|
||||
|
||||
@@ -129,6 +129,7 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
|
||||
params.update(cmdParams)
|
||||
if obj.EnableRotation != 'Off':
|
||||
angle = p['angle']
|
||||
print("X: {}, Y: {}, Z: {}, Angle: {}".format(p['x'], p['y'], p['trgtDep'], angle))
|
||||
axis = p['axis']
|
||||
# Rotate model to index for hole
|
||||
if axis == 'X':
|
||||
@@ -160,8 +161,10 @@ class ObjectDrilling(PathCircularHoleBase.ObjectOp):
|
||||
self.commandlist.append(Path.Command('G0', {'X': p['x'], 'Y': p['y'], 'F': self.horizRapid}))
|
||||
self.commandlist.append(Path.Command('G1', {'Z': p['stkTop'], 'F': self.vertFeed}))
|
||||
|
||||
# Perform and cancel canned drilling cycle
|
||||
# Perform canned drilling cycle
|
||||
self.commandlist.append(Path.Command(cmd, params))
|
||||
|
||||
# cancel canned drilling cycle
|
||||
self.commandlist.append(Path.Command('G80'))
|
||||
self.commandlist.append(Path.Command('G0', {'Z': obj.SafeHeight.Value}))
|
||||
|
||||
|
||||
@@ -103,6 +103,8 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
|
||||
obj.StepOver = self.form.stepOverPercent.value()
|
||||
if obj.OffsetPattern != str(self.form.offsetPattern.currentText()):
|
||||
obj.OffsetPattern = str(self.form.offsetPattern.currentText())
|
||||
if obj.EnableRotation != str(self.form.enableRotation.currentText()):
|
||||
obj.EnableRotation = str(self.form.enableRotation.currentText())
|
||||
|
||||
PathGui.updateInputField(obj, 'ExtraOffset', self.form.extraOffset)
|
||||
self.updateToolController(obj, self.form.toolController)
|
||||
@@ -140,6 +142,7 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
|
||||
self.selectInComboBox(obj.CutMode, self.form.cutMode)
|
||||
self.setupToolController(obj, self.form.toolController)
|
||||
self.setupCoolant(obj, self.form.coolantController)
|
||||
self.selectInComboBox(obj.EnableRotation, self.form.enableRotation)
|
||||
|
||||
if FeatureFacing & self.pocketFeatures():
|
||||
self.selectInComboBox(obj.BoundaryShape, self.form.boundaryShape)
|
||||
@@ -158,6 +161,7 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
|
||||
signals.append(self.form.useOutline.clicked)
|
||||
signals.append(self.form.minTravel.clicked)
|
||||
signals.append(self.form.coolantController.currentIndexChanged)
|
||||
signals.append(self.form.enableRotation.currentIndexChanged)
|
||||
|
||||
if FeatureFacing & self.pocketFeatures():
|
||||
signals.append(self.form.boundaryShape.currentIndexChanged)
|
||||
|
||||
@@ -43,7 +43,7 @@ __created__ = "2017"
|
||||
__scriptVersion__ = "2i"
|
||||
__lastModified__ = "2020-02-13 17:01 CST"
|
||||
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
# PathLog.trackModule(PathLog.thisModule())
|
||||
|
||||
|
||||
@@ -513,6 +513,7 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
if len(self.vert) > 0:
|
||||
vFinDep = self.vert[0].BoundBox.ZMin
|
||||
for vFace in self.vert:
|
||||
print("vFinDep: {}".format(vFinDep))
|
||||
if vFace.BoundBox.ZMin > vFinDep:
|
||||
vFinDep = vFace.BoundBox.ZMin
|
||||
# Determine if vertical faces for a loop: Extract planar loop wire as new horizontal face.
|
||||
@@ -546,9 +547,16 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
|
||||
# move all horizontal faces to FinalDepth
|
||||
for f in self.horiz:
|
||||
finDep = obj.FinalDepth.Value # max(obj.FinalDepth.Value, f.BoundBox.ZMin)
|
||||
f.translate(FreeCAD.Vector(0, 0, finDep - f.BoundBox.ZMin))
|
||||
|
||||
if obj.EnableRotation == 'Off':
|
||||
finDep = obj.FinalDepth.Value # max(obj.FinalDepth.Value, f.BoundBox.ZMin)
|
||||
print("NO_ROT: ObjDep: {}, FinDep: {}, BBmin: {}".format(obj.FinalDepth.Value, finDep, f.BoundBox.ZMin))
|
||||
f.translate(FreeCAD.Vector(0, 0, finDep-f.BoundBox.ZMin))
|
||||
else:
|
||||
finDep = max(obj.FinalDepth.Value, f.BoundBox.ZMin)
|
||||
print("ROT: ObjDep: {}, FinDep: {}, BBmin: {}".format(obj.FinalDepth.Value, finDep, f.BoundBox.ZMin))
|
||||
f.translate(FreeCAD.Vector(0, 0, finDep))
|
||||
obj.FinalDepth.Value = finDep
|
||||
|
||||
# check all faces and see if they are touching/overlapping and combine those into a compound
|
||||
self.horizontal = [] # pylint: disable=attribute-defined-outside-init
|
||||
for shape in PathGeom.combineConnectedShapes(self.horiz):
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2017 sliptonic <shopinthewoods@gmail.com> *
|
||||
# * Copyright (c) 2020 Schildkroet *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
@@ -28,7 +29,7 @@ import PathScripts.PathLog as PathLog
|
||||
from PySide import QtCore
|
||||
|
||||
__title__ = "Base Path Profile Operation"
|
||||
__author__ = "sliptonic (Brad Collette)"
|
||||
__author__ = "sliptonic (Brad Collette), Schildkroet"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
__doc__ = "Base class and implementation for Path profile operations."
|
||||
|
||||
|
||||
@@ -78,6 +78,8 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
|
||||
obj.UseStartPoint = self.form.useStartPoint.isChecked()
|
||||
if obj.Direction != str(self.form.direction.currentText()):
|
||||
obj.Direction = str(self.form.direction.currentText())
|
||||
if obj.EnableRotation != str(self.form.enableRotation.currentText()):
|
||||
obj.EnableRotation = str(self.form.enableRotation.currentText())
|
||||
|
||||
self.updateToolController(obj, self.form.toolController)
|
||||
self.updateCoolant(obj, self.form.coolantController)
|
||||
@@ -103,6 +105,7 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
|
||||
self.selectInComboBox(obj.Direction, self.form.direction)
|
||||
self.setupToolController(obj, self.form.toolController)
|
||||
self.setupCoolant(obj, self.form.coolantController)
|
||||
self.selectInComboBox(obj.EnableRotation, self.form.enableRotation)
|
||||
|
||||
if FeatureSide & self.profileFeatures():
|
||||
self.selectInComboBox(obj.Side, self.form.cutSide)
|
||||
@@ -121,6 +124,7 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
|
||||
signals.append(self.form.extraOffset.editingFinished)
|
||||
signals.append(self.form.toolController.currentIndexChanged)
|
||||
signals.append(self.form.coolantController.currentIndexChanged)
|
||||
signals.append(self.form.enableRotation.currentIndexChanged)
|
||||
|
||||
if FeatureSide & self.profileFeatures():
|
||||
signals.append(self.form.cutSide.currentIndexChanged)
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2014 Yorik van Havre <yorik@uncreated.net> *
|
||||
# * Copyright (c) 2019 russ4262 (Russell Johnson, russ4262@gmail.com) *
|
||||
# * Copyright (c) 2020 Schildkroet *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
@@ -35,13 +37,9 @@ import numpy
|
||||
from PySide import QtCore
|
||||
|
||||
__title__ = "Path Profile Faces Operation"
|
||||
__author__ = "sliptonic (Brad Collette)"
|
||||
__author__ = "sliptonic (Brad Collette), russ4262, Schildkroet"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
__doc__ = "Path Profile operation based on faces."
|
||||
__contributors__ = "russ4262 (Russell Johnson, russ4262@gmail.com)"
|
||||
__created__ = "2014"
|
||||
__scriptVersion__ = "2j usable"
|
||||
__lastModified__ = "2019-07-25 14:48 CST"
|
||||
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
|
||||
@@ -183,6 +181,8 @@ class ObjectProfile(PathProfileBase.ObjectProfile):
|
||||
|
||||
# Raise FinalDepth to lowest face in list on Inside profile ops
|
||||
finDep = obj.FinalDepth.Value
|
||||
if obj.EnableRotation != 'Off':
|
||||
finDep = faceDepths[0]
|
||||
|
||||
strDep = obj.StartDepth.Value
|
||||
if strDep > stock.Shape.BoundBox.ZMax:
|
||||
|
||||
Reference in New Issue
Block a user