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: 

CreatePipeConnector from ReferencePlane

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
edouard.vnuk
622 Views, 6 Replies

CreatePipeConnector from ReferencePlane

I would like to create a connector from a reference plane. CreatePipeConnector function requires a PlanarFace. Is there another function or how can I transform a ReferencePlan into PlanarFace?
Thank you.

6 REPLIES 6
Message 2 of 7
jeremytammik
in reply to: edouard.vnuk

The ReferencePlane documentation sample code shows how to call GetPlane to retrieve the DB Plane:

 

https://www.revitapidocs.com/2020/e7003ec7-1dbe-50a2-fb3d-a83a5a3b5b9f.htm

 

More to the point, the the CreateAirHandler SDK sample to how to use the CreatePipeConnector method.

 

When in doubt about how to call a Revit API method, one of the first places to always consult is the collection of Revit SDK samples. That step often helps and may save time and effort for you and others.

  



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

Message 3 of 7
edouard.vnuk
in reply to: jeremytammik

Hi Jeremy. Thank you for your response.
I try several codes without success.

  • 1st code
    Autodesk.Revit.DB.Plane plane = Reference_plane.GetPlane();
    ConnectorElement connector = ConnectorElement.CreatePipeConnector(family_document, PipeSystemType.Global, plane);
    => I can't compile this code because the parameter must be a reference of planar face and i don't know how to get it from the plane.
  • 2nd code
    ConnectorElement connector = ConnectorElement.CreatePipeConnector(family_document, PipeSystemType.Global, Reference_plane.GetReference());
    => I have an error during the execution : The reference is not a planar face. Parameter name: planarFace

I would just like to do these with the API :

Menu_1.jpgMenu_2.jpgMenu_3.jpgMenu_4.jpg

 



 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Thank you again for your help.

Message 4 of 7
jeremytammik
in reply to: edouard.vnuk

Have you looked at the approached used by the CreateAirHandler SDK sample?

 



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

Message 5 of 7
edouard.vnuk
in reply to: jeremytammik

I looked the CreateAirHandler SDK sample example. But, if I understood correctly, it created the connectors from an extruded volume. So there are planar faces available.

Message 6 of 7
jeremytammik
in reply to: edouard.vnuk

Good. I see your point. Such situations arise regularly. You do have a real existing surface somewhere in the model that you can mount your connector on, don't you? Otherwise, you are modelling something that cannot be built. The existing surface is part of some BIM element geometry. You can identify the appropriate element and retrieve its geometry from the document by calling its Geometry property and providing an Options object with ComputeReferences set to true. Then, iterate through all its surfaces to identify the one you need. Et voila, that surface is equipped with a reference that you can use to create the connector.

 

I hope this helps.

 

Best regards,

 

Jeremy

 



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

Message 7 of 7
edouard.vnuk
in reply to: jeremytammik

Hello. I was a bit long, but what you told me inspired me to think about it. I am creating a converter. And so I create automaticly families from basic geometric shapes. To add, my connectors that do not rest on one face, I artificially added a cylinder that I masked where I wanted a connector. Here's what I get :

Famille.jpgDocument.jpg

Thank you so much.

 

Best regards,

 

Edouard

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