How explode a curve into segment and find the length of them

rhinocommon
grasshopper

#1

Hi !

I’m trying to create a new component for grasshopper. To do it, I use Visual Studio community 2017 and C#.

I’m looking for a solution to explode a curve into multiple segment and then find the length of these segments.

Someone know how to do it ? I can’t find the right syntax…

Thanks a lot.

Mathis


(David Rutten) #2

Explode how? You want individual spans, or split the curve at discontinuities? Or explode a polycurve into subcurves?

ps. You can measure the length of the sub-domain of a curve, there’s no need to explode the curve into new curves just to measure lengths.


#3

My final goal is to measure the lengths of segments of a polygon. If you think there is no need to explode the polygon it’s perfect!
What syntax should be applied to achieve this ?


#4

Is it for learning?
Why not use the built in explode component + curve length?
Or am I misunderstanding the question?


(David Rutten) #5

Polygons are fairly easy because they are polylines, and polylines are made up of line segments, and those have a Length property. It’s also easy to figure out how many segments a polyline consists of: polygoncomponent.cs (2.1 KB)


#6

It’s to add a new component to a plugin. So I can’t use grasshopper component. I have to use C# and visual studio.
Sorry my english is not really good…


#7

Thank you very much David !