How to Bridge between various Functions in Rhino Script?


#1

Hello,
My question regarding Rhino Script is …
What if we would define several "Sub"s in order to use their outputs in a new function?
Here is the Example:
Thanks :slight_smile:

Call c()

Sub a()
Dim strcr,ext,cp
strcr = Rhino.getobject("pick 1st")
ext = Rhino.ExtrudeCurveStraight(strcr, Array(0, 0, 0), Array(0, 0, 10))
cp = Rhino.CapPlanarHoles(ext)
End Sub

Sub b()
Dim strcr,ext,cp2
strcr = Rhino.getobject("pick 2nd")
ext = Rhino.ExtrudeCurveStraight(strcr, Array(0, 0, 0), Array(0, 0, 10))
cp2 = Rhino.CapPlanarHoles(ext)

End Sub

Sub c()
Rhino.BooleanDifference cp, cp2
End Sub

(Dale Fugier) #2

You might want to review this:

The other Fundamental articles can be helpful too.

– Dale


#3

Use Function to return values in vbscript

Call c()

Function a()
Dim strcr,ext,cp
strcr = Rhino.getobject("pick 1st")
ext = Rhino.ExtrudeCurveStraight(strcr, Array(0, 0, 0), Array(0, 0, 10))
cp = Rhino.CapPlanarHoles(ext)
a = cp 'your function name
End Function

Function b()
Dim strcr,ext,cp2
strcr = Rhino.getobject("pick 2nd")
ext = Rhino.ExtrudeCurveStraight(strcr, Array(0, 0, 0), Array(0, 0, 10))
cp2 = Rhino.CapPlanarHoles(ext)
b = cp2
End Function

Sub c()
Dim resultA,resultB
resultA = a()
resultB = b()
Call Rhino.BooleanDifference(resultA, resultB)
End Sub

http://www.devguru.com/content/technologies/vbscript/home.html


#4

@Tom_Thanks buddy, It still says Array Required instead of resultA and resultB


#5

@dale
Thanks,
Noted