The reason is fairly clear: The code responsible for placing clones detects translations (via CenterOfMass) and rotations by MappingTarget (anybody acutally understands this code?), but doesn't take into account rotations by IfcLocalPlacement:
Code: Select all
if hasattr(s1,"CenterOfMass") and hasattr(s2,"CenterOfMass"):
v = s1.CenterOfMass.sub(s2.CenterOfMass)
if product.Representation:
r = importIFCHelper.getRotation(product.Representation.Representations[0].Items[0].MappingTarget)
if not r.isNull():
v = v.add(s2.CenterOfMass)
v = v.add(r.multVec(s2.CenterOfMass.negative()))
obj.Placement.Rotation = r
obj.Placement.move(v)
1) I think fixing this while using world coordinates is not possible without actually analysing the shape itself as suggested in https://forum.freecadweb.org/viewtopic.php?f=39&t=47508 - which seems unpopular.
2) Using local coordinates for dealing with clones shouldn't be too difficult to do, but requires some refactoring of the code. Actually while at it, we might switch to local coordinates altogether and probably better support the IFC hierarchy.
3) While looking into this I noticed, that MappingTarget supports transformations (scaling, mirroring), that we can't do with clones at all. So, while clones can neatly get exported as MappedItems, the reverse is not true. I guess we need to either improve what clones can do, invent a new type of object or create copies for each scaled variant in the importer.
(3) Is not urgent for me. I'd start playing around with (2), but I'd like to have your input first.