0

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.

enter image description here

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.

wil
  • 31
  • 5

2 Answers2

0

The code snippet below would return Elements of all the FilledRegions of the current Document (doc) in a specified View (v). I hope that gets you going in the right direction.

FilteredElementCollector collector = FilteredElementCollector(doc,v.Id).OfClass(typeof(FilledRegion));
  • Thanks very much for your help. It appears that the Filled Regions that are generated by the view cutting an object (as in the image above) aren't associated directly with the view. This method returns Filled Regions that are manually added to the view as separate objects fine, but won't return the ones automatically cut by the view. – wil Dec 01 '15 at 13:56
0

Sorry, I misunderstood what you were looking for. You can get the CutPatternId of a Material, which would return the pattern you see when an element is cut. I don't have a code snippet for you, but, what you'd want is:

  1. User selects the Element
  2. API gets all the Materials of that Element
  3. API returns all the CutPatternIds of those Materials (FillPatternElement)
  4. API returns all the FilledRegionType(s) with the same FillPatternId (creating them is necessary)
  5. API generates the FilledRegion using the correct FilledRegionType.

Item 5 is the trickiest part because I'm not sure how you could determine the boundary it's supposed to draw. @jeremy-tammik is super smart, and he's the author of the blog you referenced. Maybe he could fill in the gap on this part. Maybe there is something you could return from an "Intersect" method?