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.
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?
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:
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) 200901-DirectShape_HELP.gh (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.
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…