Arch: Allow Arch Components to be clone of any other Arch type
This commit is contained in:
parent
c084af8473
commit
f252f54573
|
@ -333,6 +333,8 @@ class Component:
|
|||
obj.setEditorMode("PerimeterLength",1)
|
||||
|
||||
def execute(self,obj):
|
||||
if self.clone(obj):
|
||||
return
|
||||
if obj.Base:
|
||||
obj.Shape = obj.Base.Shape
|
||||
|
||||
|
@ -350,7 +352,7 @@ class Component:
|
|||
"if this object is a clone, sets the shape. Returns True if this is the case"
|
||||
if hasattr(obj,"CloneOf"):
|
||||
if obj.CloneOf:
|
||||
if Draft.getType(obj.CloneOf) == Draft.getType(obj):
|
||||
if (Draft.getType(obj.CloneOf) == Draft.getType(obj)) or (Draft.getType(obj) == "Component"):
|
||||
pl = obj.Placement
|
||||
obj.Shape = obj.CloneOf.Shape.copy()
|
||||
obj.Placement = pl
|
||||
|
|
|
@ -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)()
|
||||
|
|
Loading…
Reference in New Issue
Block a user