Draft: Clones are now 2D if made from a 2D object
This commit is contained in:
parent
f2cb5394e1
commit
6a212b32f6
|
@ -2174,6 +2174,10 @@ def clone(obj,delta=None):
|
||||||
original position.'''
|
original position.'''
|
||||||
if not isinstance(obj,list):
|
if not isinstance(obj,list):
|
||||||
obj = [obj]
|
obj = [obj]
|
||||||
|
if (len(obj) == 1) and obj[0].isDerivedFrom("Part::Part2DObject"):
|
||||||
|
cl = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython","Clone2D")
|
||||||
|
cl.Label = "Clone of " + obj[0].Label + " (2D)"
|
||||||
|
else:
|
||||||
cl = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Clone")
|
cl = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Clone")
|
||||||
cl.Label = "Clone of " + obj[0].Label
|
cl.Label = "Clone of " + obj[0].Label
|
||||||
_Clone(cl)
|
_Clone(cl)
|
||||||
|
@ -4672,6 +4676,12 @@ class _Clone(_DraftObject):
|
||||||
import Part, DraftGeomUtils
|
import Part, DraftGeomUtils
|
||||||
pl = obj.Placement
|
pl = obj.Placement
|
||||||
shapes = []
|
shapes = []
|
||||||
|
if obj.isDerivedFrom("Part::Part2DObject"):
|
||||||
|
# if our clone is 2D, make sure all its linked geometry is 2D too
|
||||||
|
for o in obj.Objects:
|
||||||
|
if not o.isDerivedFrom("Part::Part2DObject"):
|
||||||
|
FreeCAD.Console.PrintWarning("Warning 2D Clone "+obj.Name+" contains 3D geometry")
|
||||||
|
return
|
||||||
for o in obj.Objects:
|
for o in obj.Objects:
|
||||||
if o.isDerivedFrom("Part::Feature"):
|
if o.isDerivedFrom("Part::Feature"):
|
||||||
if o.Shape.isNull():
|
if o.Shape.isNull():
|
||||||
|
|
Loading…
Reference in New Issue
Block a user