CreatePipeConnector from ReferencePlane

CreatePipeConnector from ReferencePlane

Anonymous
956 Views
6 Replies
Message 1 of 7

CreatePipeConnector from ReferencePlane

Anonymous
Not applicable

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.

0 Likes
Accepted solutions (1)
957 Views
6 Replies
Replies (6)
Message 2 of 7

jeremytammik
Autodesk
Autodesk

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

Anonymous
Not applicable

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.

0 Likes
Message 4 of 7

jeremytammik
Autodesk
Autodesk

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

0 Likes
Message 5 of 7

Anonymous
Not applicable

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.

0 Likes
Message 6 of 7

jeremytammik
Autodesk
Autodesk
Accepted solution

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

Anonymous
Not applicable

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

0 Likes