Grasshopper

algorithmic modeling for Rhino

Hello fellow GH and VB scripters, I'm not a newbie to GH, but to VB very much so.
I have programmed before, but for VB I'm missing especially the syntaxes of simple GH components like:
* Circle (CNR)
* List Length
* List Item
* Intersect Curve/Curve (CCX)

The script should basically just run from one end of the given curve and draw circles with a given radius at the intersections to create a list of points on the curve that have the same distances from one point to the next.

I attached the GH definition file.
The GH definition shows a "mockup" of the script made of components to better understand how it is supposed to work.

If someone could point me out, where to find a list of VB syntaxes for GH components. That would help me big time already.

So far my script obviously doesn't work because I just used phantasy names for the functions of which I don't know the right syntax.

If you have any further questions, please ask.

Thanks!

FlashBytes

Views: 1591

Attachments:

Replies to This Discussion

There already is a DivideDistance component which does this (except it uses spheres instead of circles, so it works in 3D).

Some thoughts:

1) Intersecting a planar curve with a circle may yield many intersection points, some of which may be "behind" you. Trying to make this function work both forwards and backwards (reverse = true) means adding a lot of additional logic. I'd suggest you only make it work forwards. Although of course you can flip the curve before you start.


2) There's no need to write "If SomethingOrOther = True Then". SomethingOrOther is already a boolean value so you can use it directly:

If (SomethingOrOther) Then
-and-
If (Not SomethingOrOther) Then


3) Intersecting a curve with a circle only works if they are both in the same plane.


I'll post some code later.

--
David Rutten
david@mcneel.com
Seattle, WA
Attached source-code. I cannot post a ghx file since I wrote it using an internal version of Grasshopper which is not forward compatible.

You need to make a VB component with 3 inputs:

1) Crv As OnCurve
2) dist As Double
3) reverse As Boolean

--
David Rutten
david@mcneel.com
Seattle, WA
Attachments:
Very cool, it works like a charm. Thank you bunches!
Later I'll go through it and try to understand what it does ;) But for now it helps me big time. I still have lots to do.

One day (when my current project is finished) I'll drop a link here, so you can see what I needed this for :)

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