Element Parts Geometry // Part Ordering

We have a script where we select specific parts from within a wall. The issue is the ‘Element Parts Geometry’ does not order the Breps (wall layers in this case) using any discernible pattern and cannot figure out how to get the lists to match up. Has anyone seen this issue / solved it yet?

I also attempted to try and build a RIR GHPython script but generating the parts without creating them in Revit is not within my wheelhouse as of yet.

@eirannejad any insight on this? We are hoping to be able to find a way to sort Element Parts Geometry to align with the Compoundstructure.Getlayers.

@eirannejad my hypothesis is that the issue has to do with this note in the Revit API: ‘The id of the layer - note that this may be different from the index in the array of layers in a CompoundStructure.

Here is a debug files I made to highlight the issue.

Unfortunately you can not relay on the order.

Look at this example.

There is no one to one relationship between layers and resulting parts.
The selected part is from the same layer as the grey face above it.
At the right of the door there are two more grey parts that come from the same layer.

And even more, the user can Divide Parts into more parts.

Maybe there is some API to know witch layer each part comes from, but I didn’t found it.