Knowlton School of Architecture (2005-2009) (Evan)

  • anchor

    Seeking Grasshopper/VBscript Master....

    Evan Chakroff Feb 20 '09 3

    so, following out midreview (which went very well for me), i've been looking into ways of introducing apertures into the surfaces of my project. our critics suggested "gills" as a method, so i've been hacking away at grasshopper and rhinoscript in an attempt to make it work...

    so far, i've got a decent rhinoscript that does what i want it to:

    it takes two curves with an equal number of control points, and draws a new curve with most of the points from curve1, substituting every Nth point from curve2.

    which is great, and with a little elbow grease i can get something like this:

    so, that's all well and good, but i wish i could control it parametrically, and i'm intrigued by Grasshopper's new support of VB script... which, unfortunately, i know nothing about.

    so, i've posted to the google grasshopper group in hopes of getting this figured out, but i wonder if anyone here has a little more experience in this....

    my main issue is translating my working rhinoscript into a working VB component in GH....

    here's the rhinoscript that generated the images above... if anyone has any ideas how to get this working in VB please let me know, or join the discussion on the GH google group....



    Option Explicit

    Call NewCurveFrom2
    Sub NewCurveFrom2()
    Dim strCrv1 : strCrv1 = Rhino.GetObject("Pick Curve 1", 4, True)
    If IsNull(strCrv1) Then Exit Sub
    If Rhino.IsCurveClosed(strCrv1) Then Exit Sub

    Dim strCrv2 : strCrv2 = Rhino.GetObject("Pick Curve 2", 4, True)
    If IsNull(strCrv2) Then Exit Sub
    If Rhino.IsCurveClosed(strCrv2) Then Exit Sub

    Dim strCrv3 : strCrv3 = DrawCurve3(strCrv1, strCrv2)

    End Sub

    Function DrawCurve3(ByVal strCrv1, ByVal strCrv2)

    Dim arrCrv1pts : arrCrv1pts = Rhino.CurvePoints(strCrv1)
    Dim arrCrv2pts : arrCrv2pts = Rhino.CurvePoints(strCrv2)

    Dim arrCrv3pts : arrCrv3pts = arrCrv1pts

    Dim N : N=5

    Dim i
    For i = 1 To UBound(arrCrv2pts) - 1

    Dim iOverN : iOverN = (i/n)
    Dim intiOverN : intiOverN = Int(iOverN)

    If intiOverN = iOverN Then
    arrCrv3pts(i) = arrCrv2pts(i)
    arrCrv3pts(i) = arrCrv1pts(i)
    End If

    Dim strCrv3
    strCrv3 = Rhino.AddCurve (arrCrv3pts, 2)

    End Function


  • ×Search in:

About this Blog

Thoughts on the M.Arch I program at the Ohio State University, 2005-2009, plus additional work with OSU as a critic and lecturer.

Affiliated with:

Authored by:

Other blogs affiliated with The Ohio State University:

Recent Entries

Please wait... loading
Please wait... loading