Grasshopper

algorithmic modeling for Rhino

Is there an equivalent for JoinCurves with the PolyCurve class for c#?

Views: 474

Replies to This Discussion

Curve.JoinCurves()

It takes an enumeration of curves, be they polycurves or not. If you already have a polycurve, you can use PolyCurve.Append().

--

David Rutten

david@mcneel.com

Thanks David,

This makes sense - I thought the following code would work but it is producing cast errors.

PolyCurve[] temp = Curve.JoinCurve(brepFaces[i].DuplicateEdgeCurves(true));

Is there a method to cast Curves to PolyCurves so that they can be joined?

Alternatively if there was an explode method for Curve I could use that and not need to touch the PolyCurve class.

You cannot cast curves to polycurves because they might not be polycurves. Casting isn't the same as converting. You cast data when you know it is of a specific type but the variable it's currently stored under is of a different (but not conflicting) type.

Curve.JoinCurves() returns an array of curves, not an array of polycurves. So if you use:

Curve[] temp = Curve.JoinCurve(brepFaces[i].DuplicateEdgeCurves(true));

It will work.

Why do you need polycurves specifically?

--

David Rutten

david@mcneel.com

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service