Geometry Operations

This is because of my limited dealing with geometric operations with Revit elements using Revit API - but I was wondering if anybody had thoughts as to how I could get the highlighted points for a structural column in the plan - also the active view is in a rotated orientation with scopebox assigned?
image

any all help is appreciated :slight_smile:

Thanks
Aniket

Ok so what you need to do to get this is a bit complex and I can’t spell it out really, so I suggest you get a close relationship with google for answers, as well as something like chatgpt to explain some answers. Though be warned, chatgpt sucks at writing revit api code, so don’t bother :wink:

Right, what you need I’m guessing is the points of the ‘sectioned’ geometry.

For clarity, revit distinguished between projection (looked at) and section (cut through) geometry. You need to know which one you’re looking for. I take it I’m looking at a view that sections the columns, so I think we’re looking for one of the points of the section geometry

This is a rough step-by-step of how you would approach that

  1. Get the element you wish to investigate
  2. Get the element’s geometry (using element.get_Geometry).
  3. Iterate over this geometry’s Solids
  4. Iterate over the Faces in the Solids
  5. Find the faces who’s normal aligns with the viewdirection of your view
  6. Find the face that has its vertexes on the same plane as your view’s viewplane ( defined by View.Origin , View.Right, View.Up I believe
  7. You’re now left with the faces that make up your ‘cut’ geometry, all that is left is figuring out which points you want

If you need to be able to add a tag or dimension to that point, you can provide get_Geometry with an options object that allows you to set ComputeReferences, which allows you to get a Reference to your faces and edges, which in turn can be used to create dimensions.

Potential issues:

The location of the gotten geometry is centered around the project origin instead of where it shows up in your model
Something really strange about get_geometry in Revit is that for whatever reason this can give you the 'family’s geometry… This only happens for FamilyInstance classes, and specifcially, FamilyInstances that have never been joined to other geometry. This is kind of weird and has given me plenty of headaches. I’m not going to go into detail on how to get the actual geometry, but know that it’s not that straight forward. Also consider that a column in your project is proooobably be joined, so it might not be an issue for your script. Just… keep it in mind.

What’s this about View Plane? What is it?
Ask chatgpt or google :D, anyway you can construct that plane using the view origin, view right, and view up vectors.
Does this work with projection geometry?
You’ll need to change a few things but the general principle of finding the correct geometry should work.