Small subset of family-instance subcomponents out of place with custom exporter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm wrapping up a custom exporter. It's my first deep dive into using the API. Overall, it was very nice. Now I'm working through a few, final loose ends.
It was all working great, but an issue popped up when I added instancing to the exporter. Specifically, I did away with this line in OnPolymesh:
pts = pts.Select( p => t.OfPoint( p ) ).ToList();
Instead I kept the raw pts vector and add the transform to the export in OnInstanceEnd. This works in almost all cases. For example, it seems all but the canopy ribs in the Snowden example work. I'm trying to fix the exceptions but am getting stumped.
I reduced the issue down to a basic case: a default wall and a default window. Here's the export in Blender:
As you can see, the "with Sill" type is transformed incorrectly. I examined various FamilyInstance properties such as HandFlipped, HandOrientation, FacingFlipped,and FacingOrientation. I don't see anything special about "with Sill." This is the code I currently have:
Autodesk.Revit.DB.Transform transform = transformStack.Pop();
double rx = transform.BasisX.X;
double ry = transform.BasisY.X;
double rz = transform.BasisZ.X;
double ux = transform.BasisX.Y;
double uy = transform.BasisY.Y;
double uz = transform.BasisZ.Y;
double lx = transform.BasisX.Z;
double ly = transform.BasisY.Z;
double lz = transform.BasisZ.Z;
double px = transform.Origin.X;
double py = transform.Origin.Y;
double pz = transform.Origin.Z;
currentNode.Matrix = new List<double>
{
rx, ry, rz, 0,
ux, uy, uz, 0,
lx, ly, lz, 0,
px, py, pz, 1.0
};
Thinking that I needed to account for FacingFlipped and HandFlipped, I tried the solution from here: https://thebuildingcoder.typepad.com/blog/2012/05/family-instance-element-coordinate-system.html However, the results are the same.
To simplify things, no elements were parented to any other element except for the root node (with no transformation). There shouldn't be any issues of nested transformations.
Does anyone have insights into what transformation "with Sill" is using?
Asking the question "How exactly is Transform.OfPoint?" working might be an equivalent question. It doesn't seem to be straight matrix multiplication.