Fixed bug #584 in Draft Downgrade
This commit is contained in:
parent
23ddc2d30f
commit
13153b6260
|
@ -204,6 +204,20 @@ def shapify(obj):
|
||||||
if not (obj.isDerivedFrom("Part::Feature")): return None
|
if not (obj.isDerivedFrom("Part::Feature")): return None
|
||||||
if not "Shape" in obj.PropertiesList: return None
|
if not "Shape" in obj.PropertiesList: return None
|
||||||
shape = obj.Shape
|
shape = obj.Shape
|
||||||
|
if len(shape.Faces) == 1:
|
||||||
|
name = "Face"
|
||||||
|
elif len(shape.Solids) > 0:
|
||||||
|
name = "Solid"
|
||||||
|
elif len(shape.Faces) > 1:
|
||||||
|
name = "Shell"
|
||||||
|
elif len(shape.Wires) == 1:
|
||||||
|
name = "Wire"
|
||||||
|
elif len(shape.Edges) == 1:
|
||||||
|
if isinstance(shape.Edges[0].Curve,Part.Line):
|
||||||
|
name = "Line"
|
||||||
|
else:
|
||||||
|
name = "Circle"
|
||||||
|
else:
|
||||||
name = getRealName(obj.Name)
|
name = getRealName(obj.Name)
|
||||||
FreeCAD.ActiveDocument.removeObject(obj.Name)
|
FreeCAD.ActiveDocument.removeObject(obj.Name)
|
||||||
newobj = FreeCAD.ActiveDocument.addObject("Part::Feature",name)
|
newobj = FreeCAD.ActiveDocument.addObject("Part::Feature",name)
|
||||||
|
|
|
@ -2297,7 +2297,7 @@ class Upgrade(Modifier):
|
||||||
newob = Draft.fuse(self.sel[0],self.sel[1])
|
newob = Draft.fuse(self.sel[0],self.sel[1])
|
||||||
self.nodelete = True
|
self.nodelete = True
|
||||||
|
|
||||||
elif (len(self.sel) > 2) and (len(faces) > 10):
|
elif (len(self.sel) > 2) and (len(faces) > 6):
|
||||||
# we have many separate faces: we try to make a shell
|
# we have many separate faces: we try to make a shell
|
||||||
sh = Part.makeShell(faces)
|
sh = Part.makeShell(faces)
|
||||||
newob = self.doc.addObject("Part::Feature","Shell")
|
newob = self.doc.addObject("Part::Feature","Shell")
|
||||||
|
@ -2316,6 +2316,7 @@ class Upgrade(Modifier):
|
||||||
f = True
|
f = True
|
||||||
u = fcgeo.concatenate(u)
|
u = fcgeo.concatenate(u)
|
||||||
if not curves:
|
if not curves:
|
||||||
|
# several coplanar and non-curved faces: they can becoem a Draft wire
|
||||||
msg(translate("draft", "Found several objects or faces: making a parametric face\n"))
|
msg(translate("draft", "Found several objects or faces: making a parametric face\n"))
|
||||||
newob = Draft.makeWire(u.Wires[0],closed=True,face=f)
|
newob = Draft.makeWire(u.Wires[0],closed=True,face=f)
|
||||||
Draft.formatObject(newob,lastob)
|
Draft.formatObject(newob,lastob)
|
||||||
|
@ -2340,6 +2341,8 @@ class Upgrade(Modifier):
|
||||||
if (not curves) and (Draft.getType(self.sel[0]) == "Part"):
|
if (not curves) and (Draft.getType(self.sel[0]) == "Part"):
|
||||||
msg(translate("draft", "Found 1 non-parametric objects: draftifying it\n"))
|
msg(translate("draft", "Found 1 non-parametric objects: draftifying it\n"))
|
||||||
Draft.draftify(self.sel[0])
|
Draft.draftify(self.sel[0])
|
||||||
|
else:
|
||||||
|
msg(translate("draft", "Couldn't upgrade these objects\n"))
|
||||||
|
|
||||||
elif wires and (not faces) and (not openwires):
|
elif wires and (not faces) and (not openwires):
|
||||||
# we have only wires, no faces
|
# we have only wires, no faces
|
||||||
|
@ -2473,7 +2476,7 @@ class Downgrade(Modifier):
|
||||||
self.doc.openTransaction("Downgrade")
|
self.doc.openTransaction("Downgrade")
|
||||||
|
|
||||||
if (len(self.sel) == 1) and (Draft.getType(self.sel[0]) == "Block"):
|
if (len(self.sel) == 1) and (Draft.getType(self.sel[0]) == "Block"):
|
||||||
# a block, we explode it
|
# we have a block, we explode it
|
||||||
pl = self.sel[0].Placement
|
pl = self.sel[0].Placement
|
||||||
newob = []
|
newob = []
|
||||||
for ob in self.sel[0].Components:
|
for ob in self.sel[0].Components:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user