Grasshopper

algorithmic modeling for Rhino

Hi there,

I'm stuck on a C# issue:

 

1. I've got a bunch of curves stored in a list which I want to join with the Curve.JoinCurves() method

2. Now, the following works: A = Curve.JoinCurves(crvBits);

3. But I don't get to store the newly created polyline in an array of polylines

 

Any help? Cheers.

 

r

Views: 6858

Replies to This Discussion

To be a little bit more specific, the following code:

 

private void RunScript(List<Curve> x, ref object A)

{    

     Polyline poly = new Polyline();
     poly = Curve.JoinCurves(x);
     A = poly;

}

 

returns the cast error: Cannot implicitly convert type 'Rhino.Geometry.Curve[]' to 'Rhino.Geometry.Polyline'

 

How do I workaround this?

Hi Riccardo,

 

JoinCurves returns a curve array:

 

Curve[] polys = Curve.JoinCurves(x);

 

- Giulio
___________________

giulio@mcneel.com

McNeel Europe, Barcelona

Thanks Giulio, this makes definitely much more sense. And it does make even more sense to use data trees with those bits of curves, something I hadn't absolutely thought about.

 

Cheers!

 

r

Hi Giulio !

I have another question !

Why the return type should be " a curve array " ?

After joining curves at the rhino, only "one curve" is created. 

please let me know ~ Thanks in advance :D

You may have four curves that join to two. Rhino needs to accommodate for that. So in general it returns a list of joined curves. If all input curves join into one, this list will have only one item.

Thanks Hannes :D So helpful !

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service