
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm running into a frustrating problem when trying to get a solid for an element that lives in a linked file. Right now I'm using the custom exporter to get all the elements in a 3d view and then using Revit's get_Geometry method on certain ones in order to do a type of overlap detection.
Solid solid = element.get_Geometry(opts).FirstOrDefault() as Solid;
This seems to work fine for anything in the current file, and it seems to work fine for most elements in linked files. But if the linked element happens to share an id with an element in the active file, then doing the above returns the solid information for the element in the active file instead. This is the case, even though the element is clearly the correct element.
In a sample file, I have a linked file with a wall that has the same id as a window in the active file. When I debug the code at the line above, even without getting the firstordefault or converting it to a solid, I can clearly see the element is a wall but the solid the method returns is for the window. It seems that Revit's method is just using the id alone.
I've tried changing the View value in the Options object fed into the method, but I don't have an active view for the linked document and no other view I could find made sense. I've also tried changing the ComputeReference value, just to try. It changed nothing.
I've gone looking online and in the forums for other ways to get at the solid information for a linked document. This link (https://forums.autodesk.com/t5/revit-api-forum/linked-file-element-intersection-solid-geometry/m-p/7...) suggests there is a method with the line in the accepted answer:
Open the linked project Q and retrieve the solid Sb of B.
Sadly, I can find no more information about how to do that. Can anyone point me to a way to do that, or find some other way to work around the bug in get_Geometry?
Solved! Go to Solution.