Grasshopper

algorithmic 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

 

 

Views: 3418

Replies to This Discussion

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

i need to see a piece of code to construct a circle using an origin point and a radius

 

Hi all,
It'is possible create à customer primitive in GH ?

I would like create à primitive by an équation and définition !

Hi,

Take a look at this, it uses the circle constructor with central point and radius.

file attached...

 

 

 

 

Attachments:

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

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

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

 

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service