Grasshopper

algorithmic modeling for Rhino

i am new to the vb.net in grasshopper ,since i start to learn it.and i am trying study it from this example:http://issuu.com/pabloherrera/docs/vb-workshop-harvard-gsd-woojsung... .but i met an error and have no idea what happen.coule somebody help me!!!

Views: 246

Attachments:

Replies to This Discussion

You need to do some null checking to make sure that your variables actually exist.

I'd also recommend getting the casing of your types and method names right. VB is not case-sensitive, but other languages are so it makes translating code between languages a lot more hassle:

If (basesrf Is Nothing) Then Return
If (Not input_pt.IsValid) Then Return

Dim u, v As Double
basesrf.ClosestPoint(input_pt, u, v)

Dim normal As Vector3d
normal = basesrf.NormalAt(u, v)

Dim drain As vector3d = Vector3d.CrossProduct(normal, Vector3d.ZAxis)
If (Not drain.IsValid) Then Return
If (drain.IsZero) Then Return

drain.Unitize()
drain.Transform(Transform.Rotation(Math.PI * 0.5, normal, input_pt))

Dim moved_pt As Point3d = input_pt + distance * drain
basesrf.ClosestPoint(moved_pt, u, v)

Dim output_pt As Point3d = basesrf.PointAt(u, v)
A = output_pt

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2025   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service