I'm trying to figure out how to access the filled regions created when an object is cut in plan or section.
My aim is to write a tool that duplicates these regions in order to quickly create dual hatches in a view. I'm unsure at the moment whether these regions are associated with the family instance itself, or the view, or the work plane, etc.I've poured through Revit Lookup but can't locate it.
There is some information here about creating new filled regions through:
FilledRegion.Create(...)
But I'm more interested in accessing the ones already created in a view.
Any suggestions would be much appreciated.
Hi,
the geometry you get is view depending, and as far as I know, the areas you are searching for are in fact represented by PlanarFaces.
So you would have to iterate over those PlanarFaces and compare their properties with the View's ones.
Consider that ViewPlans and ViewSections have a certain view depth, so the candidate PlanarFace's plane does not match the View's plane in each case.
So first check if a PlanarFace's FaceNormal is equal to View's ViewDirection, using a tolerance value.
Then you could calculate the distances of their Origins to the View's plane, allowing you to eliminate the too far ones.
Once got your desired PlanarFaces, just project their boundaries to the view plane.
Those projected curves will be the input for your new FilledRegions.
Revitalizer
Hi Revitalizer
Thanks very much for your reply. I've been looking into this but am still unsure how to proceed.
I'm trying to use a FilteredElementCollector based on the Active View like so:
FilteredElementCollector collector = new FilteredElementCollector(doc, uiApp.ActiveUIDocument.ActiveView.Id).OfClass(typeof(FilledRegion));
But I get "Input type(Autodesk.Revit.DB.PlanarFace) is not a recognized Revit API type" from Revit. So seeing as I'm unsure how to access them I removed the OfClass section to just get all elements in the view.
FilteredElementCollector collector = new FilteredElementCollector(doc, uiApp.ActiveUIDocument.ActiveView.Id);
This returns three elements (see image below). 0 is named "3d", 1 is "ExtentElem" 2 is the family being cut.
What's the best way to retrieve these PlanarFaces?
Hi,
to get the PlanarFaces, you have to browse your FamilyInstance's geometry.
PlanarFaces are not Elements, so they cannot be adressed by a FilteredElementCollector.
Your code samples can be misunderstood since you filter by "FilledRegion" but the error message deals with "PlanarFace".
Revitalizer
Sorry you're right looks like I pasted the wrong line of code.
OK thanks for the information, I thought they must be associated with the Family Instance. Can you elaborate on how to access them? I've searched through all of the properties I can on the Family Instance (through inspecting in Visual Studio and through Revit Lookup.
Thanks again for your help.
Hi,
if you have examined the FamilyInstance's properties using RevitLookup, you will have noticed the Geometry node.
As mentioned above, the geometric representation is view depending.
http://thebuildingcoder.typepad.com/blog/2011/08/section-view-geometry.html
As you can see in the TBC posting, you have to specify the Option's view.
(The Option object that you use in the familyInstance.get_Geometry() method.)
If there is no geometry to get at all: may it be that your FamilyInstance's Family consists of void objects, entirely ?
Revitalizer
Can't find what you're looking for? Ask the community or share your knowledge.