Rotation in IfcAxis2Placement3D

Hello!

Please help me figure out how to set the rotation of an object when creating of IFC in IfcAxis2Placement3D.

I have a quaternion and I can get the Euler angles or the rotation matrix but i can’t quite figure out how to use them in IfcAxis2Placement3D.

Welcome OzKitsune,
to get a value for `IfcAxis2Placement3D.Axis`, you can simply apply the given rotation to vector (0,0,1) or (0,0,z) with any real value z (any other not-normalized z-axis vector). Likewise, to get a value for `IfcAxis2Placement3D.RefDirection`, apply the given rotation to vector (1,0,0) or (x,0,0) with any real value x (any other x-axis vector) . You could also use any other vector in the xz-plane as `Refdirection`, but one that is orthogonal to the z-axis is just fine. It is just meant to fix the rotation about the z axis once you have the z-axis itself fixed via the `Axis` attribute.
Hope that helps,
Helga

Thanks for the help!

I still have one more question (a little off topic, but not to create a new one): how can I set the scale of individual objects? Or is it usually not done in IFC?

You may use `IfcMappedItem` and can then specify geometric any transformation consisting of translation, rotation and isotropic scaling.

Scaling is risky… Because it may impact many other things. Are you expecting the scaling to also impact dependent objects (parts)? Are quantities for that object recalculated based on scaled geometry? Are any dimension parameters scaled as well?

So I would be really, really careful before introducing scaling and if you can avoid it (e.g. by parametrically controlled size/dimension), than you don’t need scaling at all.