Vb script unroll

unhandled

(Cshea) #1

I am trying to unroll in vbscript grasshopper so that I can control degree of tolerance
I can see in rhino.geometry there is a unroll class but can’t get my code to work
All I am trying to do is to script so that unrolling of my surfaces works in grasshopper like in the rhino interface with option to not explode and to control the tolerances…
please help!!!


(Laurent Delrieu) #2

There are many script here on this forum


If you want help it is also better to post files.


(Cshea) #3

thank you for your reply
i have looked at a lot of the post but still struggling a lot
i would like to use the performUnrolMethod(list(Brep)), not the performunrollMethod(Curve,Point3d,TextDot) method as I do not need any curves, points etc
i am trying to work with vbscript
here is portion of my code-

Private Sub RunScript(ByVal arrSrf As List(Of Surface), Byref A as object)

Dim arrAllUnrolledSrf As New list (Of Surface)

Dim rolledSrf As Surface
rolledSrf = arrSrf(0)
Dim unroll As New Rhino.Geometry.Unroller(surface)
unroll.ExplodeOutput = False
unroll.RelativeTolerance = 0.1
arrAllUnrolledSrf = unroll.PerformUnroll(arrSrf)
A= arrAllUnrolledSrf
End Sub
this doesn’t work but I can’t work out how to put it right - as I said, i just to unroll a list of surface without it exploding and want to control the tolerance… please tell me what I have done wrong…!!!
thanks so much


(qythium) #4

You are calling the PerformUnroll method with the wrong arguments… it has to be 3 “out” parameters which you can assign to dummy variables.
http://developer.rhino3d.com/5/api/RhinoCommonWin/html/M_Rhino_Geometry_Unroller_PerformUnroll.htm

Also, you may be confused about the difference between VB.Net in Grasshopper and VBscript in Rhino, they are two completely different languages.

Maybe have a look at the rhinoscriptsyntax module in Python, there is a UnrollSurface function you can call directly.
http://developer.rhino3d.com/api/RhinoScriptSyntax/#collapse-UnrollSurface

You’ll have to upload a .gh file with the specific problem if you want any more help, read this:


(Cshea) #5

thanks for this
yes, i have confused vb.net with vbscript… i am using vb.net in grasshopper
as i said, i would “like to use the performUnrolMethod(list(Brep)), not the performunrollMethod(Curve,Point3d,TextDot) method as I do not need any curves, points etc” see below there is a method to do this:
http://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Unroller_PerformUnroll_1.htm
i just want to unroll a list of surface without it exploding and want to control the tolerance, all in vbnet for grasshoppper so that all the surfaces can plug back into grasshopper seamlessly
thanks
laurent delrieu has suggested there is a bug in the unroller method - is this resolved?


(Laurent Delrieu) #6

It will be simplier with a script !!! :thinking:.
I run my script and now it works with the 2 methods. So the bug was corrected
Look at the help,PerformUnroll output int and you need to feed a list of Brep not surface …
As you use just the first element of list I suppressed the list in VB component, GH will handle that as a list automatically?.
unroller_VB.gh (10.6 KB)
Are you sure you just want Surface … It is quite limited. Brep is more general.


(qythium) #7

Ah okay, my mistake - I was referring to the older documentation which did not have the overloaded method, and thought that you were unfamiliar with the VB.Net syntax for out parameters.

Btw, the python equivalent with rhinoscriptsyntax is just 2 lines long and you don’t have to care about types…

unroller_python.gh (7.7 KB)

import rhinoscriptsyntax as rs
a = rs.UnrollSurface(srf, explode=False, relative_tolerance = tol)

(Cshea) #8

Hi Laurent
Really thanks for this
I downloaded your gh file… the VBnet script is still not working for me
unroll_gh_out_lauren_derieu

this was what i was getting when I tried various script syntax -it seems to always refer to the method with the parameters of curve, point, and textdots
i note I may not have the most current GH version - could this have anything to do with it?


(Laurent Delrieu) #9

Hello
It is not easy to help you because you give just part of the information…

My others script are working so yes it must be a version problem. If you read the documentation of unroll you will see that the one you want to use is for rhino 6.2. The othe for rhino 5.1. So at the end you have no choice use the other method and don’t use the curve point … output.
Auto completion could also help you when you write script.


(Cshea) #10

thanks
i will upgrade to Rhino 6 this week and hopefully the problem goes away!!!
yes, I will send more information with my query next time…i just thought I had some fundamental issues understanding the Rhino SDK
thanks again