How to Bridge between various Functions in Rhino Script?

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

You might want to review this:

The other Fundamental articles can be helpful too.

– Dale

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

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

@dale
Thanks,
Noted