Creating DirectShapes while Skipping Problematic Geometry

Hi everyone,

I’m attempting to create thousands of DirectShapes using the AddDirectShape.ByGeometry node and I’m running into an issue. The geometry that I’m trying to import is rather complex, think twisted/curving frames, and for mysterious reasons, Revit sometimes fails to create some of the geometry. Currently, when grasshopper gets to geometry it cannot create, it throws the error
1. Object reference not set to an instance of an object.
and it gives up there. Often only one-tenth of the way through all of the geometry.

Here is a file for reference. (1.2 MB)

I tried to modify the sample GhPython files to circumvent this issue (using try: and expect: to skip geometry it cannot create) but I am not using the Transaction manager correctly and I’m only able to create one DirectShape with my python script.

Is there a way for the GH component to skip geometry it cannot create? I haven’t found a way to consistently identify geometry that will be problematic before trying to create a directshape so I don’t know what to do here.
Or, can someone help on the GhPython script to add directshapes to the Revit document, skipping and logging the index of the geometry it could not create?

Thank you so much for your help!

everything went through here, only thing i did was remove the name.

1 Like

That looks promising! Can you explain what you mean by removing the name? I’m consistently failing to create all the geometry in Revit 2019 :confused:

i did that in 2019.2 as well. I do know that they (RiR) did update some of the brep conversion recently, might want to make sure you have the latest and greatest.

Thanks! I’ll update to the latest and report back.

Woah - like magic, updating worked!

I’m still curious how one would go about creating the geometry with GHPython if anyone can help - I think it would give me a better grasp on the transaction manager and ‘Node to Code’ going forward :slight_smile:

i’m trying to learn python a bit too, seems like you need reference the current doc and enclose your code in a named transaction.

1 Like

How large are the components supposed to be? For instance how large are the frame thicknesses?

I notice the model is a ways away from 0,0,0 and want to determine if units are correct?

I extracted the geometry, scaled it to something resonable (panel width 11 feet) and moved it closer to the 0,0,0. Then I was able to get 19 breps in and 19 directshapes. No meshes, just good solids in Revit in the Structural Beam Category with the Blue, Solid Material.

Once BREP solids are being passed around there is a tolerance limit of both the size and distance from origin that can play a part in this.

But understanding better the units and placement of these in the larger project might help us work through something that might work for you.

For me it works great in Revit 2019 and in Revit 2021


Thank you Scott for the explanation! The scale of the elements in the file I shared should be that each frame is around 9 feet by 9 feet. I tested moving frames closer to the origin and that does help - thank you for the tip.

I’m having some trouble with some additional geometry though even when it is close to the origin. You can see in the below, I have 3 frames (each frame is around 9 feet x 9 feet) at the intended size and then the same 3 frames scaled up x10. As you can see in the screenshot once imported, the large frames are missing a face in the below:

and the small frames have all the faces but more are triangulated:

I’ve attached the files for reference. The screenshots are taken with Revit 2019.2 and Rhino WIP 7.0.20238.17095, 08/25/2020
I would have guessed that the scaled up frame would perform better than the smaller frame if there were tolerance issues at fault but I’m surprised that a face is missing. Do you have ideas as to why this might be?
200901_MH_HELP.3dm (649.0 KB) (298.7 KB)

Additionally, it would be great if there was some way to identify which frames had issues (missing faces, triangulated faces, etc) so that I could easily identify the elements in GH after they are created and not have to search manually pan around the Revit model looking through the thousands of frames.

We will need to take a look at this one. We continue to find and try to tune up the transfer tools. There are a lot of geometries that Revit is not accepting of.

I would think a tools that looks for the meshes after the translation would be the best way to find them. I wonder if that is possible thru the Revit API?

No need for the API, the Direct Shape Element Geometry will tell you right away, giving lots of potential workflows.



We could create a scraper here that collects the geometry that does not come across onto a specific layer in Rhino. Perhaps we can find some patterns?

1 Like

So something like this can identify the elements and bake them back into Rhino:

Find failing (12.9 KB)


Thank you both! This is perfect :slight_smile: And a clever way to determine the geometry that had trouble.

1 Like

Hi everyone,

I had a problem that I think is related to the matter of passing geometry directly to Revit.

Both using the Add Brep DirectShape component as well as the Add Geometry Direct shape.

The geometries are all closed solid polysurfaces, however, when passed to Revit, it generates different types of geometries, Open Brep, Untrimed Surface, Trimed surface, Invalid Brep, Closed Brep and Mesh…

Is there a way to fix this?

Breps to (9.3 MB)

I finally got a chance to look at this. There is a problem we have to look at. It has been reported here:

I can tell part of the problem may be scale and how far the object is from 0,0,0. But even after that is still fails in places.

Thank you very much,

I will be attentive to the advances in this regard.

Best regards,

I am having the exact same issue with very simple extruded geometry, right on top of the origin.
Is there an option to roll back to the previous WIP build? It worked fine before.

Can you post a file with a few of the troubling objects and the Grasshopper def? I think @kike will need to look at it.

We have made changes, but they were supposed to help.