Grasshopper

generative modeling for Rhino

# spliting an ellipse using a line in grasshopper

hi everybody

i want to split an ellipse using a line or curve in grasshopper C# script. i want everything to be purely in Code , without using grasshpper component .

i already know how to draw primitives using rhino geometry in C# but i dont know how to use something like split function of Rhino

Views: 258

### Replies to This Discussion

Maybe you can try Intersection.CurveCurve method in Rhino.Geometry.intersect namespace.

Indeed, there is no dedicated Ellipse|Line intersector in Rhino, so you'll need to convert your ellipse and your line into actual Curves, then use the Intersection.CurveCurve method.

--

David Rutten

david@mcneel.com

ok , but i think intersection.curvecurve just returns points , so how i split the ellipse using those points?

in fact i need to have a quarter of the ellipse

i wrote this code , and it doesn't work

//ellipse

Plane pl = Plane.WorldXY;
Ellipse el = new Ellipse(pl, 5, 10);

//line
Point3d pn1 = new Point3d(-5, -5, 0);
Point3d pn2 = new Point3d(5, 5, 0);
Line ln = new Line(pn1, pn2);

//intersection

Point3d[] pntList = Rhino.Geometry.Intersect.Intersection.CurveCurve(el.ToNurbsCurve(), ln.ToNurbsCurve());

it says "No overload for method CurveCurve takes 2 arguments"

as far as i can understand ,CurveCurve should be a method on Ellipse or line object and should take the another one as argument, but when there is nothing .

whats wrong ?

You need to give 2 more arguments to CurveCurve (tolerance and overlap tolerance), then you get an intersection object, by example: