Arch: Allow Arch Components to be clone of any other Arch type

This commit is contained in:
Yorik van Havre
2016-12-28 20:27:46 -02:00
parent c084af8473
commit f252f54573
2 changed files with 8 additions and 5 deletions

View File

@@ -2699,11 +2699,12 @@ def makeShapeString(String,FontFile,Size = 100,Tracking = 0):
FreeCAD.ActiveDocument.recompute()
return obj
def clone(obj,delta=None):
'''clone(obj,[delta]): makes a clone of the given object(s). The clone is an exact,
def clone(obj,delta=None,forcedraft=False):
'''clone(obj,[delta,forcedraft]): makes a clone of the given object(s). The clone is an exact,
linked copy of the given object. If the original object changes, the final object
changes too. Optionally, you can give a delta Vector to move the clone from the
original position.'''
original position. If forcedraft is True, the resulting object is a Draft clone
even if the input object is an Arch object.'''
prefix = getParam("ClonePrefix","")
if prefix:
prefix = prefix.strip()+" "
@@ -2712,7 +2713,7 @@ def clone(obj,delta=None):
if (len(obj) == 1) and obj[0].isDerivedFrom("Part::Part2DObject"):
cl = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython","Clone2D")
cl.Label = prefix + obj[0].Label + " (2D)"
elif (len(obj) == 1) and hasattr(obj[0],"CloneOf"):
elif (len(obj) == 1) and hasattr(obj[0],"CloneOf") and (not forcedraft):
# arch objects can be clones
import Arch
cl = getattr(Arch,"make"+obj[0].Proxy.Type)()