Get extrusion solid geometry and transform

Get extrusion solid geometry and transform

Anonymous
Not applicable
1,581 Views
1 Reply
Message 1 of 2

Get extrusion solid geometry and transform

Anonymous
Not applicable

Hi everyone,

I'm working on a geometry exporter. I want to make exports as light as possible so I'm using the couple SymbolGeometry => Transforms a lot. I thought this will work for almost every geometry, but I find out that many geometries are not considered as instance of a Symbol. 

As an example, you can take Dining Chair (3).rfa which is part of the built-in samples of (at least) Revit 2016. The file is attached. As you can see the chair is composed of 6 parts:

  • The back.
  • The bed.
  • The 4 legs. This is the same geometry: same number of vertices and faces.

When I export instances of this chair, my algorithm considers the legs as 4 different geometries. 

Is Revit not storing a couple geometry => transforms? It looks like it has integrated the matrix inside the geometry and it is bound together forever :'(
Is there any way to get a "main geometry" and matrices? 
Thanks !

Ps : the recursive algorithm I'm using :

public void FindFinalReference (GeometryInstance instance, double exportRatio, Transform transform)
{
    if (instance.SymbolGeometry != null)
    {
        foreach (GeometryObject go in instance.SymbolGeometry)
        {
            if (go is Solid solid)
            {
                AddSolid(solid, exportRatio, transform);
            }
            else if (go is Mesh mesh)
            {
                AddMesh(ref mesh, transform);
            }
            else if (go is GeometryInstance instanceNext)
            {
                Transform mergeTr = transform.Multiply(instanceNext.Transform);
                FindFinalReference(instanceNext, exportRatio, mergeTr);
            }
        }
    }
}
0 Likes
Accepted solutions (1)
1,582 Views
1 Reply
Reply (1)
Message 2 of 2

jeremytammik
Autodesk
Autodesk
Accepted solution

I think this depends partly on how the family content creator designed his family definition internally.

 

When I worked with IFC STEP exporters decades ago, I found that the best and most effective DIY approach to create compact lightweight exports was to implement my own dictionaries of all recurring items and reference those.

 

For instance, some very low-level items are the XYZ origin, X, Y and Z point/vectors.

 

Another dictionary might contain lines.

 

Another one might contain solids.

 

This obviously requires a very careful definition of dictionary keys to identify a these recurring objects, that might grow to be pretty complex.

 

Here are some musings on creating your own key:

 

http://thebuildingcoder.typepad.com/blog/2012/03/great-ocean-road-and-creating-your-own-key.html#2

 

Ihth.

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder