From 6a212b32f61eee1c792fa21f6fdf2d0ccda96503 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Mon, 2 Jun 2014 11:23:39 -0300 Subject: [PATCH] Draft: Clones are now 2D if made from a 2D object --- src/Mod/Draft/Draft.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index b2d57ac73..d3d608b63 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -2174,8 +2174,12 @@ def clone(obj,delta=None): original position.''' if not isinstance(obj,list): obj = [obj] - cl = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Clone") - cl.Label = "Clone of " + obj[0].Label + 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.Label = "Clone of " + obj[0].Label _Clone(cl) if gui: _ViewProviderClone(cl.ViewObject) @@ -4672,6 +4676,12 @@ class _Clone(_DraftObject): import Part, DraftGeomUtils pl = obj.Placement 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: if o.isDerivedFrom("Part::Feature"): if o.Shape.isNull():