Added explicit deburr start values; Fixed direction detection for deburr operation
This commit is contained in:
@@ -76,6 +76,8 @@ class ObjectDeburr(PathEngraveBase.ObjectOp):
|
||||
obj.setEditorMode('Join', 2) # hide for now
|
||||
obj.addProperty('App::PropertyEnumeration', 'Direction', 'Deburr', QtCore.QT_TRANSLATE_NOOP('PathDeburr', 'Direction of Operation'))
|
||||
obj.Direction = ['CW', 'CCW']
|
||||
obj.addProperty('App::PropertyEnumeration', 'Side', 'Deburr', QtCore.QT_TRANSLATE_NOOP('PathDeburr', 'Side of Operation'))
|
||||
obj.Side = ['Outside', 'Inside']
|
||||
|
||||
def opOnDocumentRestored(self, obj):
|
||||
obj.setEditorMode('Join', 2) # hide for now
|
||||
@@ -104,12 +106,16 @@ class ObjectDeburr(PathEngraveBase.ObjectOp):
|
||||
basewires.append(Part.Wire(edgelist))
|
||||
|
||||
self.basewires.extend(basewires)
|
||||
|
||||
|
||||
side = ["Outside"]
|
||||
for w in basewires:
|
||||
self.adjusted_basewires.append(w)
|
||||
wire = PathOpTools.offsetWire(w, base.Shape, offset, True)
|
||||
wire = PathOpTools.offsetWire(w, base.Shape, offset, True, side)
|
||||
if wire:
|
||||
wires.append(wire)
|
||||
|
||||
# Outside or Inside
|
||||
obj.Side = side[0]
|
||||
|
||||
forward = True
|
||||
if obj.Direction == 'CCW':
|
||||
@@ -143,6 +149,7 @@ class ObjectDeburr(PathEngraveBase.ObjectOp):
|
||||
obj.setExpression('StepDown', '0 mm')
|
||||
obj.StepDown = '0 mm'
|
||||
obj.Direction = 'CW'
|
||||
obj.Side = "Outside"
|
||||
|
||||
|
||||
def SetupProperties():
|
||||
|
||||
@@ -132,11 +132,13 @@ class ObjectDressup:
|
||||
horizFeed = tc.HorizFeed.Value
|
||||
vertFeed = tc.VertFeed.Value
|
||||
toolnummer = tc.ToolNumber
|
||||
|
||||
# set the correct twist command
|
||||
if self.getDirectionOfPath(obj) == 'left':
|
||||
arcdir = "G3"
|
||||
else:
|
||||
arcdir = "G2"
|
||||
|
||||
R = obj.Length.Value # Radius of roll or length
|
||||
if queue[1].Name == "G1": # line
|
||||
p0 = queue[0].Placement.Base
|
||||
@@ -148,6 +150,7 @@ class ObjectDressup:
|
||||
p1 = queue[1].Placement.Base
|
||||
# PathLog.notice(" CURRENT_IN ARC : P0 X:{} Y:{} P1 X:{} Y:{} ".format(p0.x,p0.y,p1.x,p1.y))
|
||||
v = self.normalize(p1.sub(p0))
|
||||
|
||||
if self.getDirectionOfPath(obj) == 'right':
|
||||
off_v = FreeCAD.Vector(v.y*R, -v.x*R, 0.0)
|
||||
else:
|
||||
@@ -157,6 +160,7 @@ class ObjectDressup:
|
||||
leadstart = (p0.add(off_v)).sub(offsetvector) # Rmode
|
||||
else:
|
||||
leadstart = p0.add(off_v) # Dmode
|
||||
|
||||
if action == 'start':
|
||||
extendcommand = Path.Command('G0', {"X": 0.0, "Y": 0.0, "Z": op.ClearanceHeight.Value})
|
||||
results.append(extendcommand)
|
||||
|
||||
@@ -86,7 +86,7 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
self.commandlist.append(Path.Command('G0', {'Z': obj.ClearanceHeight.Value, 'F': self.vertRapid}))
|
||||
self.commandlist.append(Path.Command('G0', {'X': last.x, 'Y': last.y, 'F': self.horizRapid}))
|
||||
self.commandlist.append(Path.Command('G0', {'Z': obj.SafeHeight.Value, 'F': self.vertRapid}))
|
||||
self.appendCommand(Path.Command('G1', {'Z': last.z}), z, relZ, self.vertFeed)
|
||||
self.appendCommand(Path.Command('G1', {'X': last.x, 'Y': last.y, 'Z': last.z}), z, relZ, self.vertFeed)
|
||||
first = False
|
||||
|
||||
if PathGeom.pointsCoincide(last, edge.Vertexes[0].Point):
|
||||
|
||||
@@ -141,7 +141,7 @@ def orientWire(w, forward=True):
|
||||
PathLog.track('orientWire - ok')
|
||||
return wire
|
||||
|
||||
def offsetWire(wire, base, offset, forward):
|
||||
def offsetWire(wire, base, offset, forward, Side = None):
|
||||
'''offsetWire(wire, base, offset, forward) ... offsets the wire away from base and orients the wire accordingly.
|
||||
The function tries to avoid most of the pitfalls of Part.makeOffset2D which is possible because all offsetting
|
||||
happens in the XY plane.
|
||||
@@ -195,8 +195,12 @@ def offsetWire(wire, base, offset, forward):
|
||||
if wire.isClosed():
|
||||
if not base.isInside(owire.Edges[0].Vertexes[0].Point, offset/2, True):
|
||||
PathLog.track('closed - outside')
|
||||
if Side:
|
||||
Side[0] = "Outside"
|
||||
return orientWire(owire, forward)
|
||||
PathLog.track('closed - inside')
|
||||
if Side:
|
||||
Side[0] = "Inside"
|
||||
try:
|
||||
owire = wire.makeOffset2D(-offset)
|
||||
except Exception: # pylint: disable=broad-except
|
||||
|
||||
Reference in New Issue
Block a user