generative modeling for Rhino
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
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.
i need to see a piece of code to construct a circle using an origin point and a radius
Take a look at this, it uses the circle constructor with central point and radius.
can you tell me whats wrong with this code?
private void RunScript(object x, object y, ref object A)
//your code here…
cr.O.x = 0;
cr.O.y = 0;
cr.R = 1;
A = cr;
output says that Error:use of unassigned local variable 'cr'
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;
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).
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))
A = circles