Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Get CurveLoop Center point

Ali.sadeghi.h1994
Enthusiast

Get CurveLoop Center point

Ali.sadeghi.h1994
Enthusiast
Enthusiast

Hi everyone.

Does someone know how to get center point of a CurveLoop?

I have a list consists of all openings  Curveloop on a floor and I want to put an instance exactly on center of Curveloop.

0 Likes
Reply
Accepted solutions (1)
704 Views
6 Replies
Replies (6)

AGGilliam
Collaborator
Collaborator
Accepted solution
Not sure of any direct methods, but what I've done is loop through the curves to add up all of the points, then divide by the number of points. For example, ((0,0) + (0,2) + (2,0) + (2,2)) / 4 = (1,1).

jeremy_tammik
Autodesk
Autodesk

Use an algorithm to find the centre of a polygon:

  

https://duckduckgo.com/?q=center+polygon

  

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

Ali.sadeghi.h1994
Enthusiast
Enthusiast
Thank you. That's a good idea and I have used that and it works well. But There is still an exception in my code that is existing of a curveloop with circle shape in my Revit model. If you have an idea to solve this exception, I will be happy to let me know.
0 Likes

Ali.sadeghi.h1994
Enthusiast
Enthusiast
Thanks for all of your guides and I'm glad that you answered my question.
The exception is existing an opening on floor with circular shape and the algorithm won't give the centroid. I need center point of all openings in any form on floors. If you know other ways to get that, I will be happy to know.

AGGilliam
Collaborator
Collaborator
Ah, in that case, when you loop through the curves in the curveloop you can check for Arcs or Ellipses and use the Center property to get it.
0 Likes

Ali.sadeghi.h1994
Enthusiast
Enthusiast

Thanks for your solutions.

I will try that.

0 Likes