assembly: fix 'Flip element' for multiplied constraining element
This commit is contained in:
parent
b590b57793
commit
b9c7af40fd
|
@ -1947,8 +1947,7 @@ class AsmElementLink(AsmBase):
|
||||||
info = self.info
|
info = self.info
|
||||||
|
|
||||||
if obj.Offset.isIdentity():
|
if obj.Offset.isIdentity():
|
||||||
if not obj.Placement.isIdentity():
|
pla = FreeCAD.Placement()
|
||||||
obj.Placement = FreeCAD.Placement()
|
|
||||||
else:
|
else:
|
||||||
# obj.Offset is in the element shape's coordinate system, we need to
|
# obj.Offset is in the element shape's coordinate system, we need to
|
||||||
# transform it to the assembly coordinate system
|
# transform it to the assembly coordinate system
|
||||||
|
@ -1956,8 +1955,6 @@ class AsmElementLink(AsmBase):
|
||||||
mOffset = obj.Offset.toMatrix()
|
mOffset = obj.Offset.toMatrix()
|
||||||
mat = info.Placement.toMatrix()*mShape
|
mat = info.Placement.toMatrix()*mShape
|
||||||
pla = FreeCAD.Placement(mat*mOffset*mat.inverse())
|
pla = FreeCAD.Placement(mat*mOffset*mat.inverse())
|
||||||
if not utils.isSamePlacement(obj.Placement,pla):
|
|
||||||
obj.Placement = pla
|
|
||||||
info.Shape.transformShape(mShape*mOffset*mShape.inverse())
|
info.Shape.transformShape(mShape*mOffset*mShape.inverse())
|
||||||
|
|
||||||
info = ElementInfo(Parent = info.Parent,
|
info = ElementInfo(Parent = info.Parent,
|
||||||
|
@ -1973,6 +1970,9 @@ class AsmElementLink(AsmBase):
|
||||||
|
|
||||||
parent = self.parent.Object
|
parent = self.parent.Object
|
||||||
if not Constraint.canMultiply(parent):
|
if not Constraint.canMultiply(parent):
|
||||||
|
# adjust placement calculated based on obj.Offset
|
||||||
|
if not utils.isSamePlacement(obj.Placement,pla):
|
||||||
|
obj.Placement = pla
|
||||||
self.multiply = False
|
self.multiply = False
|
||||||
self.infos.append(info)
|
self.infos.append(info)
|
||||||
return self.infos if expand else self.info
|
return self.infos if expand else self.info
|
||||||
|
@ -1984,8 +1984,18 @@ class AsmElementLink(AsmBase):
|
||||||
self.infos.append(info)
|
self.infos.append(info)
|
||||||
return self.infos if expand else self.info
|
return self.infos if expand else self.info
|
||||||
infos = []
|
infos = []
|
||||||
offset = info.Placement.inverse()
|
|
||||||
plaList = []
|
plaList = []
|
||||||
|
|
||||||
|
# We change this AsmElementLink into a LinkArray to visually display
|
||||||
|
# the multipled element (i.e. the first element in the parent
|
||||||
|
# constraint). Because of this, we shall encode the
|
||||||
|
# AsmElementLink.Offset of the element into each individual
|
||||||
|
# placement in AsmElementLink.PlacementList. So reset
|
||||||
|
# AsmElementLink.Placement here first, and then add the extra offset
|
||||||
|
# 'pla'.
|
||||||
|
obj.Placement = FreeCAD.Placement()
|
||||||
|
offset = info.Placement.inverse() * pla
|
||||||
|
|
||||||
for i in range(obj.Count):
|
for i in range(obj.Count):
|
||||||
part = info.Part
|
part = info.Part
|
||||||
if part[3]:
|
if part[3]:
|
||||||
|
@ -1996,7 +2006,9 @@ class AsmElementLink(AsmBase):
|
||||||
pla = sobj.Placement
|
pla = sobj.Placement
|
||||||
part = (part[0],i,sobj,part[3])
|
part = (part[0],i,sobj,part[3])
|
||||||
pla = part[0].Placement.multiply(pla)
|
pla = part[0].Placement.multiply(pla)
|
||||||
|
|
||||||
plaList.append(pla.multiply(offset))
|
plaList.append(pla.multiply(offset))
|
||||||
|
|
||||||
infos.append(ElementInfo(
|
infos.append(ElementInfo(
|
||||||
Parent = info.Parent,
|
Parent = info.Parent,
|
||||||
SubnameRef = info.SubnameRef,
|
SubnameRef = info.SubnameRef,
|
||||||
|
@ -2010,6 +2022,10 @@ class AsmElementLink(AsmBase):
|
||||||
self.infos = infos
|
self.infos = infos
|
||||||
return infos if expand else info
|
return infos if expand else info
|
||||||
|
|
||||||
|
# adjust placement calculated based on obj.Offset
|
||||||
|
if not utils.isSamePlacement(obj.Placement,pla):
|
||||||
|
obj.Placement = pla
|
||||||
|
|
||||||
for i,edge in enumerate(info.Shape.Edges):
|
for i,edge in enumerate(info.Shape.Edges):
|
||||||
self.infos.append(ElementInfo(
|
self.infos.append(ElementInfo(
|
||||||
Parent = info.Parent,
|
Parent = info.Parent,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user