I spent last weekend in Sweden for my 35 year school anniversary, having graduated from the German school in Stockholm in May 1977.
The day after our reunion I visited a friend's summer house on the little lake Kvarnsjön in Huddinge:
Back to the Revit API, after having taken a second look at connector orientation, here is another MEP coordinate system topic that can bear updating and coincidentally also has a connection to Scandinavia, since Progman Oy and Olli are Finnish.
I recently presented the discussion with Olli Kattelus of MagiCAD at Progman Oy on defining an ECS or element coordinate system for MEP ducts and pipes.
This is required for exporting them to IFC. Their geometry is specified in ECS there so that the same element definition can be reused consistently for all of its occurrences.
That took care of ducts and pipes, but the issue of family instances was not completely resolved, especially how to handle their potentially 'flipped' geometry.
Now Olli reports an easy solution for that as well, which is actually easier and more obviously canonical than the duct and pipe one, since a family instance already has a transform that we can base our ECS on:
I managed to solve problems with those flipped objects.
I changed the style how I constructed the transform a little bit.
With fittings, I use the hand/facing orientation & location point of the family instance instead of the connector direction & location:
Transform ^tf = Transform::Identity; // Create correct vectors, // taking flipping into account XYZ ^ho = famInstance->HandFlipped ? famInstance->HandOrientation->Negate() : famInstance->HandOrientation; XYZ ^fo = famInstance->FacingFlipped ? famInstance->FacingOrientation->Negate() : famInstance->FacingOrientation; ho = ho->Normalize(); fo = fo->Normalize(); tf->BasisX = ho; tf->BasisY = fo; tf->BasisZ = ho->CrossProduct(fo); tf->Origin = famInstance->Location->Point; tf = tf->Inverse;
You may be wondering why we need this, since fittings are family instances whose geometry is already defined the way we need it for the IFC export.
However, a fitting may also have an insulation added to it. The InsulationLiningBase class representing the insulation is inherited from MEPCurve, so we have the same issues for defining an ECS as we did for the duct and curve.
Thus only fittings with insulation need this transform treatment, in order to export their insulation geometry, not the fitting's own one.
Many thanks to Olli for this simple and elegant solution!