Grasshopper

algorithmic modeling for Rhino

Hi guys,

This useful script which splits a srf using a crv works fine using the legacy script but not with the new VB component.

Would anyone know why this is happening ?

Any chance that the split surface using curve becomes a GH component?
It'd be amazing.

Many thanks,

Arthur

 

 

 

Views: 1021

Replies to This Discussion

as of version 8 (and I think earlier?), it already is.... intersect: physical: surface split
Thanks Andrew you are right...
Sorry about that.

Just by curiousity, would you know why the script does not work on the new VB component?

cheers
Thats because there's no RhUtil class in the RhinoCommon SDK. It used to be a part of the old SDK (legacy). The code that you would need to use with the new SDK is:

Private Sub RunScript(ByVal B As Brep, ByVal C As List(Of Curve), ByRef A As Object)
Dim bf As BrepFace = B.Faces.Item(0)
A = bf.Split(C, 0.01)
End Sub

You can't pass the entire brep in one go. You're better off making a For loop to iterate through each face of the brep, doing the split and adding the result of the split to a list.
Hi Suryamsh,

can you maybe upload the definition, because I am having the same problem and I dont know how to fix it.

Thanks
Private Sub RunScript(ByVal B As Brep, ByVal C As List(Of Curve), ByRef A As Object)
Dim pieces as New List(Of Brep)
For i as int32 = 0 To B.Faces.Count - 1
Dim bf As BrepFace = B.Faces.Item(i)
pieces.AddRange(bf.Split(C, 0.01))
Next
A = pieces
End Sub
Hi Suryansh,
Thanks a lot for your answer.
If there is no Rhutil class, how do you know which method to use to split surface or expressions such as B.Faces.Count ?
Still a bit confused about the new RhinoCommon...
cheers,
Arthur
We tried to put methods inside the classes on which these methods operate. Sometimes we break this rule though (like with all intersection functions).

If you're looking to do something that involves meshes and polylines, you should have a look inside the Mesh class and then the polyline class to see if the method is available there. If that fails, you may have to search the documentation.

--
David Rutten
david@mcneel.com
Seattle, WA
Over time, I have become reasonably familiar with my way around the classes methods in the new SDK, but every now and then, I come across a new class, or a bunch of new functions and I do a face palm thinking "I have always been wanting this.. and I never found this". But even now, just as in my early days of getting familiar with the SDK, most of the discoveries happened by spending ages digging through the intellisense of the classes that I was dealing with.

The process of learning scripting is akin to learning any new software, just a little bit harder. Even when you start using GH/Rhino, you start with very little idea of what exists where, what commands/components are available, and even after several years of using a platform, you still keep making discoveries -- especially if the platform also keeps evolving fairly rapidly.

Unfortunately, there's no singular objective answer to 'finding the right function'. It only comes with intensive wandering about within the SDK and functions, and a lot of googling about. Needless to say, this forum also goes a long way in helping you get along.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service