Grasshopper

algorithmic modeling for Rhino

Hi there!

I am a bit struggling for a simple exercise of creating some meshes from their correspondent grids to be transmitted to Excel.

I am quite stuck to which methodology I should use and  by using VB scripting as below is shown is not working...  ;((   

 

Private Sub RunScript(ByVal Pts As List(Of Integer), ByVal GS As List(Of System.Object), ByRef nsrf As Object)


    Function CreateNS(ByVal cvpoints As ArrayList,
    ByVal GS As Integer) As OnNurbsSurface
    Const Degree As Integer = 3

    'Make the surface
    Dim orderU As Integer = Degree + 1
    Dim orderV As Integer = Degree + 1

    Dim ns New OnNurbsSurface
    ns.Create(3, False, orderU, orderV, GS, GS)

    'Add cv points
    Dim i As Integer
    Dim j As Integer
    Dim pt As On3dPoint
    For i = 0 To GS - 1
      For j = 0 To GS - 1
        pt = cvpoints(i)(j)
        ns.SetCV(i, j, pt)
      Next
    Next

    'Set knots for open surface
    ns.MakeClampedUniformknotvector(0)
    ns.MakeClampedUniformknotvector(1)

    CreateNS = ns
  End Function

 

Considering more than this example got from a book, is there any other better way to get a simple AREA from control points  by  GH?

THAAAAAAAAAAAAANX

Francesco

 

Views: 1775

Attachments:

Replies to This Discussion

Ciao Francesco!

 

That script won't work because you seem to have pasted a function inside a subroutine - try modifying it to something like this:

 

Private Sub RunScript(ByVal Pts As List(Of Integer), ByVal GS As List(Of System.Object), ByRef nsrf As Object)


    Const Degree As Integer = 3

    'Make the surface
    Dim orderU As Integer = Degree + 1
    Dim orderV As Integer = Degree + 1

    Dim ns New OnNurbsSurface
    ns.Create(3, False, orderU, orderV, GS, GS)

    'Add cv points
    Dim i As Integer
    Dim j As Integer
    Dim pt As On3dPoint
    For i = 0 To GS - 1
      For j = 0 To GS - 1
        pt = Pts(i)(j)
        ns.SetCV(i, j, pt)
      Next
    Next

    'Set knots for open surface
    ns.MakeClampedUniformknotvector(0)
    ns.MakeClampedUniformknotvector(1)

    nsrf = ns 

 

End Sub

 

(I've underlined the bits I've changed)  That might work, although it looks like it will create a surface and not a mesh, which may not be what you want, and also I think will only do the same thing as the built-in SrfGrid (Surface From Points) component, which you may prefer to use. 

 

Paul

Ciao Paul, good to hear of you!  I tried to replace it but seems it doenst really want to digest the changes!

(by just doing a copy/paste)

Unless some config has to be changed, such as flatten, list (y(GS)type hint, generally no hint or OpenNURBS types?). I have: Series (Cross Refs), Pt (ditto), VB (ditto)

I am wondering Paul if to create a simple surface from grid I might use some other tricky way.

Ehi thanks a lot. fRA

Ehi Paul, I got it by using of FromPointstoMesh! ;) Piece of cake by chance.

 

FORM FINDING DESIGN VILLAS / APARTMENTS LAYOUTS

BY MANIPULATING PARAMETRIC MULTIDIRECTIONAL AREAS-GRIDS

 

Dear Francesco, 

could I ask you in which library you got FromPointstoMesh?

Did you succeded in creating a nurbs from its control points?

Thanks!

Cesare

Hello, sorry for delaying the answer. You might download pretty easily from internet. 5.0 is strongly suggested so far. Best, F

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