Generating 2 Polylines from several NurbsCurves

Hi guys.

I hope I can pose the question clear enough.

I have extracted some nurbscurves from an external source, Although, there are two distinctive lines, they are made of several nurbscurve in a very random order. Therefore, I have to somehow generate a code (if needed, that is) to identify the several nurbscurves that make up that one line. This data is also likely to change, so I am trying to avoid a one-off solution.

So I have attempted to write a DesignScript, but i am hitting a mindblock at this moment. Here’s what I attempted to do;

  • Count the list. (So, in this particular example… there are 6 individual nurbscurves between the two distinctive lines).
  • Each of these lists start with a start points as (0,0), (1,0), (2,0) and so on, meanwhile the last item on each list represents the end point such as (0,4), (1,5) and so on.
  • Therefore, if I create another list, and reverse the list… the new list will have the last item first.
  • Create a for loop, iterating from 0 to 6 from the list, I have counted. And with an if statement compare my first item in the original list, against the last item of the reversed list.
  • Once a match is found…. Join the lists with a successful match.
  • However, I have to also accommodate for 2nd polyline to be in separate or 2nd list, within this code.

Is this achievable, or is there maybe an easier way, i haven’t explored yet?

Cheers guys!! :slight_smile:

Something like this might work …

1 Like

Thank you for replying @Vikram_Subbaiah. I am getting an error when attempting this. Please see image below.

1 Like

Hi @faris.mahder,

You missed to set lacing to “Longest” for “Curve.ApproximateWithArcandLineSegments”.

Cheers @kulkul & @Vikram_Subbaiah. I didn’t notice the little icon on each block signifies the lacing. Another thing, I have learnt. :slight_smile: Thanks again!

1 Like