Grasshopper

algorithmic modeling for Rhino

Hi all,

 

I have been playing around with VB.net these day for my thesis project. Basically I am stuck at the point where I need to make polygons (hexagons) in VBscripting, i.e using corner points or using plane and radius. However, there doesn't seem to be a built-in function for creating polygon, like that one in GH.

 

Anyone has a better idea?

 

Thanks a lot!!

Views: 987

Replies to This Discussion

one additional question. Has anyone tried the tutorials of VBscripting from GH primer_2nd edition on the lastest version of GH? There are many functions in the tutorial not found in the GH i am using. Anyone knows why?

 

Here's highlight from the tutorial and the error msg I've got in my code

 

 

Hello Fan,

The vb component you are using runs a version of RhinoCommon.  This is the new software development kit (SDK) for Rhino.  The primer's scripting examples are for Rhino_DotNet, the old sdk.  If you want to use the examples from the primer, you should use the other vb/c# components that look a bit rasterized and say something like DotNet(LEGACY).  I would recommend reading up on RhinoCommon.  I find it much friendlier than DotNet.  

Hi Luis, thanks for your reply.

 

The RhinoCommon vb component you are referring to, is it for making hexagons or making planes?

 

I actually found the solution to the createfromnormal problem.

Basically, instead of typing

 

Plane.createfromnormal

 

we can just make it when creating the plane as:

 

dim plane as Plane(origin, x axis, y axis)

Hi Fan,

 

I divide a circle and connect the points to make regular polygons. Is this what you are looking for? So when you have n=6 you will get a regular hexagon.

 

Private Sub RunScript(ByVal n As Integer, ByVal radius As Double, ByRef A As Object)

    Dim crc As New Circle(Point3d.Origin, radius)

    Dim pts As New List(Of Point3d)

    For i As Int32 = 0 To n

      pts.Add(crc.PointAt(2.0 * Math.PI * (i / n)))

    Next

    Dim ngon As New Polyline(pts)

    A = ngon

 

Maybe you can alter the circle creation method to make polygons aligned to a plane.

Attachments:
Thanks Caglar, I will definitely give this a try!

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service