assembly: sync label between Element and ElementLink

This commit is contained in:
Zheng, Lei 2018-09-07 17:48:43 +08:00
parent 5b2f28c38b
commit ed4b92ad23

View File

@ -1009,8 +1009,14 @@ class AsmElementLink(AsmBase):
def canLinkProperties(self,_obj): def canLinkProperties(self,_obj):
return False return False
def execute(self,_obj): def allowDuplicateLabel(self,_obj):
return True
def execute(self,obj):
info = self.getInfo(True) info = self.getInfo(True)
linked = obj.getLinkedObject(False)
if linked and linked.Label != linked.Name:
obj.Label = linked.Label
relationGroup = self.getAssembly().getRelationGroup() relationGroup = self.getAssembly().getRelationGroup()
if relationGroup and (not self.part or self.part!=info.Part): if relationGroup and (not self.part or self.part!=info.Part):
oldPart = self.part oldPart = self.part
@ -1040,6 +1046,14 @@ class AsmElementLink(AsmBase):
if prop == 'Offset': if prop == 'Offset':
self.getInfo(True) self.getInfo(True)
return return
if prop == 'Label':
linked = obj.getLinkedObject(False)
if linked and linked.Label != obj.Label:
linked.Label = obj.Label
# in case there is label duplication, AsmElement will auto
# re-lable it.
obj.Label = linked.Label
return
if prop not in self._MyIgnoredProperties and \ if prop not in self._MyIgnoredProperties and \
not Constraint.isDisabled(self.parent.Object): not Constraint.isDisabled(self.parent.Object):
Assembly.autoSolve(obj,prop) Assembly.autoSolve(obj,prop)