Copy constraint properties when multiply and expand
This commit is contained in:
parent
234df236b4
commit
58a6ad6752
|
@ -1666,7 +1666,10 @@ class AsmConstraint(AsmGroup):
|
|||
Assembly = assembly,
|
||||
Constraint = None,
|
||||
Elements = info)
|
||||
AsmConstraint.make(typeid,sel,undo=False)
|
||||
newCstr = AsmConstraint.make(typeid,sel,undo=False)
|
||||
Constraint.copy(cstr,newCstr)
|
||||
for element,target in zip(elements,newCstr.Group):
|
||||
target.Offset = element.Offset
|
||||
cstr.Document.removeObject(cstr.Name)
|
||||
FreeCAD.closeActiveTransaction()
|
||||
return True
|
||||
|
|
|
@ -471,6 +471,10 @@ class Constraint(ProxyType):
|
|||
def canMultiply(mcs,obj):
|
||||
return getattr(obj,mcs.propMultiply(),None)
|
||||
|
||||
@classmethod
|
||||
def copy(mcs,obj,target):
|
||||
mcs.getProxy(obj).__class__.copyProperties(obj,target)
|
||||
|
||||
@classmethod
|
||||
def setDisable(mcs,obj):
|
||||
return setattr(obj,mcs._disabled,True)
|
||||
|
|
7
proxy.py
7
proxy.py
|
@ -246,6 +246,13 @@ class ProxyType(type):
|
|||
def getPropertyInfoList(cls):
|
||||
return []
|
||||
|
||||
def copyProperties(cls,obj,target):
|
||||
mcs = cls.__class__
|
||||
for key in cls.getPropertyInfoList():
|
||||
prop = mcs.getPropertyInfo(key)
|
||||
if not prop.Internal:
|
||||
setattr(target,prop.Name,prop.get(obj))
|
||||
|
||||
def getName(cls):
|
||||
return cls.__name__
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user