Path: misc bugfixes + restored node markers

This commit is contained in:
Yorik van Havre
2016-01-21 14:02:56 -02:00
parent 5033983c64
commit 2ed8e5dd99
6 changed files with 68 additions and 43 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ class ObjectArray:
def __init__(self,obj):
obj.addProperty("App::PropertyLink","Base","Path","The path to array")
obj.addProperty("App::PropertyVector","Offset","Path","The spacing between the array copies")
obj.addProperty("App::PropertyVectorDistance","Offset","Path","The spacing between the array copies")
obj.addProperty("App::PropertyInteger","Copies","Path","The number of copies")
obj.Proxy = self
+15 -6
View File
@@ -45,6 +45,8 @@ class ObjectFacePocket:
obj.addProperty("App::PropertyDistance","Offset","Path","The distance between the face and the path")
obj.addProperty("App::PropertyInteger","StartVertex","Path","The vertex index to start the path from")
obj.addProperty("App::PropertyEnumeration","FirstMove","Path","The type of the first move")
obj.addProperty("App::PropertyDistance","RetractHeight","Path","The height to travel at between loops")
obj.addProperty("App::PropertyBool","Fill","Path","Perform only one loop or fill the whole shape")
obj.FirstMove = ["G0","G1"]
obj.Proxy = self
@@ -55,7 +57,7 @@ class ObjectFacePocket:
return None
def execute(self,obj):
if obj.Base and obj.Offset:
if obj.Base and obj.Offset.Value:
import Part, DraftGeomUtils
if "Face" in obj.Base[1][0]:
shape = getattr(obj.Base[0].Shape,obj.Base[1][0])
@@ -68,15 +70,18 @@ class ObjectFacePocket:
# build offsets
offsets = []
nextradius = obj.Offset
nextradius = obj.Offset.Value
result = DraftGeomUtils.pocket2d(shape,nextradius)
while result:
offsets.extend(result)
nextradius += obj.Offset
result = DraftGeomUtils.pocket2d(shape,nextradius)
if obj.Fill:
nextradius += obj.Offset.Value
result = DraftGeomUtils.pocket2d(shape,nextradius)
else:
result = []
# first move will be rapid, subsequent will be at feed rate
first = True
point = None
# revert the list so we start with the outer wires
offsets.reverse()
@@ -94,6 +99,10 @@ class ObjectFacePocket:
output += obj.FirstMove
first = False
else:
if obj.RetractHeight.Value and point:
output += "G0 X" + str("%f" % point.x) + " Y" + str("%f" % point.y) + " Z" + str("%f" % obj.RetractHeight.Value) + "\n"
last = edge.Vertexes[0].Point
output += "G0 X" + str("%f" % last.x) + " Y" + str("%f" % last.y) + " Z" + str("%f" % obj.RetractHeight.Value) + "\n"
output += "G1"
last = edge.Vertexes[0].Point
output += " X" + str("%f" % last.x) + " Y" + str("%f" % last.y) + " Z" + str("%f" % last.z) + "\n"
@@ -105,7 +114,7 @@ class ObjectFacePocket:
relcenter = center.sub(last)
v1 = last.sub(center)
v2 = point.sub(center)
if v1.cross(v2).z < 0:
if edge.Curve.Axis.z < 0:
output += "G2"
else:
output += "G3"
+13 -9
View File
@@ -66,7 +66,11 @@ class ObjectPathProject:
cmds = []
for child in obj.Group:
if child.isDerivedFrom("Path::Feature"):
cmds.extend(child.Path.Commands)
if obj.UsePlacements:
for c in child.Path.Commands:
cmds.append(c.transform(child.Placement))
else:
cmds.extend(child.Path.Commands)
if cmds:
path = Path.Path(cmds)
obj.Path = path
@@ -76,16 +80,16 @@ class ViewProviderProject:
def __init__(self,vobj):
vobj.Proxy = self
mode = 2
vobj.setEditorMode('LineWidth',mode)
vobj.setEditorMode('MarkerColor',mode)
vobj.setEditorMode('NormalColor',mode)
# vobj.setEditorMode('LineWidth',mode)
# vobj.setEditorMode('MarkerColor',mode)
# vobj.setEditorMode('NormalColor',mode)
# vobj.setEditorMode('ShowFirstRapid',mode)
vobj.setEditorMode('BoundingBox',mode)
vobj.setEditorMode('DisplayMode',mode)
vobj.setEditorMode('Selectable',mode)
vobj.setEditorMode('ShapeColor',mode)
vobj.setEditorMode('Transparency',mode)
vobj.setEditorMode('Visibility',mode)
# vobj.setEditorMode('Visibility',mode)
def __getstate__(self): #mandatory
return None
@@ -98,16 +102,16 @@ class ViewProviderProject:
def onChanged(self,vobj,prop):
mode = 2
vobj.setEditorMode('LineWidth',mode)
vobj.setEditorMode('MarkerColor',mode)
vobj.setEditorMode('NormalColor',mode)
# vobj.setEditorMode('LineWidth',mode)
# vobj.setEditorMode('MarkerColor',mode)
# vobj.setEditorMode('NormalColor',mode)
# vobj.setEditorMode('ShowFirstRapid',mode)
vobj.setEditorMode('BoundingBox',mode)
vobj.setEditorMode('DisplayMode',mode)
vobj.setEditorMode('Selectable',mode)
vobj.setEditorMode('ShapeColor',mode)
vobj.setEditorMode('Transparency',mode)
vobj.setEditorMode('Visibility',mode)
# vobj.setEditorMode('Visibility',mode)
class CommandProject: