Placing families (structural columns on a line with a specific distance )using C#

Placing families (structural columns on a line with a specific distance )using C#

ahmadkhalaf7892
Advocate Advocate
423 Views
4 Replies
Message 1 of 5

Placing families (structural columns on a line with a specific distance )using C#

ahmadkhalaf7892
Advocate
Advocate

Distance.PNG

3D.PNG


hi guys I wanted to ask how can I place a family on a model curve with a specific distance in C# (like the photo above ) I have done before using Dynamo , but my company thinks that it would be better to place them via C#. I just need some help because I have only started using C# two month ago. 
I would love to hear how it is done, or if I can get the method to place families, or load them according to the shapes above. 
Thanks

Accepted solutions (1)
424 Views
4 Replies
Replies (4)
Message 2 of 5

jeremy_tammik
Alumni
Alumni

Well, placing the instances is not a problem:

  

  

Determining equidistant points along a straight line is trivial.

 

The more complex problem of determining equidistant points along a curve is harder and has been discussed here many times. Here are some hits searching for 'equidistant':

  

  

Some of those have the exact same goal as you describe.

    

So, searching can help.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 5

ahmadkhalaf7892
Advocate
Advocate
Hi Jeremy,
thanks a lot for the sources. They helped me understand how to divide a line/curve in Revit API. However I was unable to know the method for placing a family in a specific location/point.
May I ask what method is used for such a thing ?
thanks
Message 4 of 5

jeremy_tammik
Alumni
Alumni
Accepted solution

Hmm. That question is answered quite a (large) number of times by the articles in The Building Coder topic group on family instance placement that I pointed out in my previous answer above:

  

https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.25.2

  

For an even shorter answer: NewFamilyInstance Method:

  

https://www.revitapidocs.com/2023/451ee414-cea0-e9bd-227b-c73bc93507dd.htm

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 5 of 5

ahmadkhalaf7892
Advocate
Advocate
Thank you very much