generative modeling for Rhino
hi everybody
i'm new at grasshoppe, can anyone tell me how to draw a circle from scratch, purely in C#
without using circle component of grasshopper
Tags:

You need to create a new Rhino.Geometry.Circle, it has several constructors and also several properties and methods that would allow you to modify/transform the circle. Can you be more specific about how exactly you want to make these circles.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Permalink Reply by raminbp on November 7, 2011 at 10:06am i need to see a piece of code to construct a circle using an origin point and a radius
Permalink Reply by M Niqui on November 7, 2011 at 11:44am Hi,
Take a look at this, it uses the circle constructor with central point and radius.
file attached...
Permalink Reply by raminbp on November 7, 2011 at 12:36pm can you tell me whats wrong with this code?
private void RunScript(object x, object y, ref object A)
{
//your code here…
Grasshopper.Kernel.Geometry.Circle2 cr;
cr.O.x = 0;
cr.O.y = 0;
cr.R = 1;
A = cr;
}
output says that Error:use of unassigned local variable 'cr'
whats wrong?

There is no Circle2 type.
Also be careful with properties that expose data like Points and Planes. These are structs, not classes.
To make a circle like this I'd use something like:
Circle cr = new Circle(Point3d.Origin, 1.0);
A = cr;
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Permalink Reply by raminbp on November 7, 2011 at 3:06pm there is no name space for Circle, can't recognize it. it doesn't work

Forget Circle2 and the entire Grasshopper.Kernel.Geometry namespace, it's not of use to you. You want to create Rhino circles. Which means you either need to look in the Rhino.Geometry namespace (which is already imported) when using the new SDK or the RMA.OpenNurbs namespace if you're using the old (legacy) SDK.
So, according to the new SDK the type you're after is Rhino.Geometry.Circle (or just Circle since Rhino.Geometry is already imported via a using statement).
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Permalink Reply by raminbp on November 7, 2011 at 4:59pm ok, thanks , something else, what if i want to create a list of this circle .

You want a list containing a single Circle?
Well, either way, you'll need to do something like this:
Dim circles As New List(Of Circle)
For i As Integer = 1 To 100
circles.Add(New Circle(Point3d.Origin, i))
Next
A = circles
--
David Rutten
david@mcneel.com
Poprad, Slovakia
© 2013 Created by Scott Davidson.
Powered by