Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to receive Intersection of Section and FamilyInstance

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
Hacklberg
757 Views, 11 Replies

How to receive Intersection of Section and FamilyInstance

Hello, 

 

i try to get the Intersection of Section and FamilyInstance.

The GeometryElement of the Family returns all Faces, even if they`re outside of the Section.

Is there any predefined function to receive the Solid/BoundingBox inside the Section? 

 

Regards

Tags (1)
11 REPLIES 11
Message 2 of 12
jeremytammik
in reply to: Hacklberg

Message 3 of 12
Hacklberg
in reply to: jeremytammik

Hi,

 

thanks for the link, this will work for me.

I expect to get those Edges with the option.View = viewSection and the GetInstanceGeometry, but this is not the case.

Options option = new Options();
option.ComputeReferences = true;
option.View = viewSection;
 
GeometryElement geometryElement = familyInstance.get_Geometry(option);
GeometryInstance? gInst = geometryElement.First() as GeometryInstance;
GeometryElement gSymbol = gInst.GetInstanceGeometry();

Best regards

 

Message 4 of 12
jeremytammik
in reply to: Hacklberg

Thank you for your answer and confirming that you solved the task and achieved your goal.

 

What is the crucial point, please?

 

Is it the fact that you need to specify the section view in the options, and set computeReferences to true?

 

Does it also work with computeReferences set to false?

 

Thank you!

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 12
Hacklberg
in reply to: jeremytammik

Hi,

 

for me the crucial point was the VIEWER_BOUND_FAR_CLIPPING - Parameter, it was was set to 2 (Clip without line).

I changed it to 1 (Clip with line), now it works as expected.

viewSection.get_Parameter(BuiltInParameter.VIEWER_BOUND_FAR_CLIPPING).Set(1);
viewSection.DetailLevel = ViewDetailLevel.Fine

To set the sectionView in the options.View is necessary.

geomOptions.ComputeReferences = false;
geomOptions.IncludeNonVisibleObjects = false;
geomOptions.View = viewSection

It works great with ComputeReference set to false too.

 

Kind regards

Message 6 of 12
jeremytammik
in reply to: Hacklberg

Thank you for the details.

 

I tried to implement a sample demonstrating its use live and have had no success so far.

 

In my model, the section view is cutting two walls, a door and a window.

 

Accordingly, I am retrieving four solids (actually, four null and four non-null solids).

 

I thought I would be getting some curves or something for the cut geometry. Is that incorrect?

 

I created a repository to show what I tried so far, including my test model:

 

https://github.com/jeremytammik/SectionCutGeo

 

Could you check it out and possibly see what I am doing wrong?

 

Maybe I just need to dig deeper into those four solids?

 

Thank you!

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 7 of 12
jeremytammik
in reply to: Hacklberg

I updated the repository, checking solid edges and fixing the sketch plane to raw model curves for them, and now I see some of the cut elements: the edges for the walls. I do not see any results for the door and window family instances, however. Do you? Am I still doing something wrong? I updated the repository with the fixes... Thank you!

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 8 of 12
jeremytammik
in reply to: Hacklberg

Sorry, don't worry... just realised I probably need to check the geometry instances as well as top-level solids...

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 9 of 12
jeremytammik
in reply to: Hacklberg

Now I am completely happy with it.

  

Here are some images from a sample run:

  

Sample model 3D view:

section_cut_geo_3d.png

Plan view showing section location:section_cut_geo_plan.png

Cut geometry in section view:section_cut_geo_cut.png

Model lines representing the cut geometry of the window family instance produced by the add-in in section view:section_cut_geo_cut_geo_window.png

  

Model lines representing the cut geometry of walls, door and window isolated in 3D view:section_cut_geo_cut_geo_3d.png

  

The current source code and Visual Studio solution is in the SectionCutGeo GitHub repository:

 

https://github.com/jeremytammik/SectionCutGeo

 

I'll write a blog post with more details anon  🙂

  

Cheers,

  

Jeremy

  



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 10 of 12
jeremytammik
in reply to: Hacklberg

Blog post with the full description is live now:

 

https://thebuildingcoder.typepad.com/blog/2019/05/retrieving-section-view-intersection-cut-geometry....

 

Thank you for prompting this little exploration.

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 11 of 12
alex_pendray
in reply to: jeremytammik

Hi Jeremy,

 

I came across your blog post first which directed me here.  This looks like a very handy tool, although admittedly, all of the API coding in the article above goes straight over my head.  I am looking for a plugin/dynamo script that can take the outlines of things cut in section to help make a filled region.  I am currently using Revit 2023/2024. Do you have any advice on installing this addin to work for 2023/2024? I downloaded it from Github but there's no instructions for installing it once I have it. Any advice you could share would be greatly appreciated.

Message 12 of 12

Dear Blob,

 

Sorry, I can't help very much further here. Glad you like it. I do too! I would love to have the time to take this utility myself and create a handy end-user tool from it, or, alternatively, integrate it into RevitLookup or somewhere similar. However, as it stands, it is just sample source code. So, the only advice I can give you on this is: keep on programming! You'll get there, if you presevere, and then you can do the job yourself. God luck and have fun!

  

Cheers

  

Jeremy

  

Jeremy Tammik, Developer Advocacy and Support, The Building Coder, Autodesk Developer Network, ADN Open

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community