tldr: What I’d really like to do is use Area objects as inputs in a Python script, then get their trimmed surface/ region representation within the Python code
The best method I’ve found for reliably getting a Revit Area as a “region” is to pass the area into a surface param component. This is able to accurately represent the Area including any cut-outs. If I get the Area Boundaries instead, it sometimes results in multiple edge loops or open curves (Revit closes small gaps, but I do not see a property to obtain this “gap closed” representation of the Area).
I am currently using a python component to search through Area objects and find one that contains a point3d. Specifically, I am casting the Area to a surface outside of the python component, then type-hinting that surface as a Brep on the Python input (the type-hinting seems to be required or else the output surface becomes untrimmed).
What I’d really like to do is use the Area objects as inputs in the Python script, then get their trimmed surface representation within the Python code, so when the correct area is found, I can return the Area object itself (for further use downstream). Is there a way to do so?
The RIR Geometry Encoder/ Decoder does not have a method for Areas, and the Revit class does not seem to have a property for the Area’s “gap closed” representation.
I see in the Area component on Github, it is listed as being castable to surface, but I’m not sure how to activate that casting. Rhino Inside Github
I may be missing something obvious as I’m still learning Python…
One quick solution to have both the Area an the Surface in the Python component may be add an additional parameter of type Brep in parallel with the areas input.
This method gives you a collection of segments that need to be converted to Rhino.Geometry.Curve then joined using Curve.JoinCurves once you have the curves joined in closed loops you can use Brep.CreatePlanarBreps to create the resulting Brep.
Not sure if NodeInCode is able to run parameters, but I don’t think it would work because your Area is already an Autodesk.Revit.DB.Area in Python and is no more a GH type.
I did some changes in v1.13 that may help with the error message you showed on ‘Query Areas’.
Awesome, thanks @kike
Playing with it a little more, adding the parameters through the ZUI, if “Enclosed” is True then I get the memory error again…
Is there any chance an “Area Scheme(s)” filter could be part of the Query Areas component as well?
Just to wrap up my original question for posterity, it seems like passing parallel lists (Area object + area surface representation) through the python node has some drawbacks. The Revit objects (or their GH wrappers) get a little mutilated and the Areas need to be re-acquired from Revit in order to get “fixed”.
Next v1.13 has a ‘Query Area Schemes’ component and the additional input you requested.
I also added some changes to try to address the problem you mentioned previously when using the enclosed input.
If it is not fixed do you mind testing on a simpler file and see.
Maybe there is a wild Area in your file that is ill formed, unplaced or not properly enclosed that is causing this.