Rhinoscript addLoft surface with EndPoint

Dear all,

I would like to draw, using script, an open Loft surface based on 3 closed curve and an End point.

I tried to use this function:
Rhino.AddLoftSrf (arrObjects [, arrStartPt [, arrEndPt[, intType [, intStyle [, nValue [, blnClosed]]]]]])

I have already drawn the 3 curve and the end point.
I can use the basic funcion correcttly:

Dim arrObjects
arrObjects = Rhino.ObjectsByType(4)
Rhino.AddLoftSrf arrObjects

But when I try to improve the function setting the other option I can’t get anything.
The option that I want to include are this:

Dim arrCurve
arrCurve = Rhino.ObjectsByType(4)

Dim arrStartPt
arrStartPt = none

Dim arrEndPt
arrEndPt = Rhino.ObjectsByType(1)

Dim intType
inType = 0 'normal surfaced

Dim intStyle
intStyle = 0 'not simplify

Dim nValue
nValue = none 'as I choose Style = 0

Dim blnClosed
blnClosed = False 'open surface

PLEASE, SOMEONE CAN HELP ME TO WRITE CORRECTLY THE FUNCTION???
It’s very hard to me, every attempt has failed, probably I am doing something wrong in the syntax or in setting the variables.
THANKS A LOT IN ADVANCE FOR ANY HELP

Laura Micoli

I suspect this isn’t helping. Usually the variable you set should be the variable you Dim. :wink:

Hi,
this help for sure, but I really don’t know ho o write the full instuction.

Rhino.AddLoftSrf arrObjects 'how I have to write the other option here, after this??? I tried in many way but it never work… :frowning:

Hi @laura.micoli,

Here is a simple example of using Rhino.AddLoftSrf:

Sub TestAddLoftSrf()
	
	' Declare local variables
	Dim strLine0, strLine1, strLine2
	Dim arrLines, arrEnd
	
	' Create some lines to loft
	strLine0 = Rhino.AddLine(Array(0, 0, 0), Array(10, 0, 0))
	strLine1 = Rhino.AddLine(Array(0, 5, 5), Array(10, 5, 5))
	strLine2 = Rhino.AddLine(Array(0, 10, 0), Array(10, 10, 0))
	
	' Array the lines
	arrLines = Array(strLine0, strLine1, strLine2)
	
	' Define end point
	arrEnd = Array(5, 15, 5)
	
	' Loft away
	Call Rhino.AddLoftSrf(arrLines, , arrEnd)
	
	' Delete the construction geometry
	Call Rhino.DeleteObjects(arrLines)

End Sub

– Dale

Dear Dale,

thanks a lot for your help.
I’ll try and I let you know how it works!

Have a nice day :slight_smile:
Laura

Dear Dale,

I tried your script coping and running it in my edit script panel.
Unfortunately, seams it doesn’t work.
:frowning:
Laura

Hi @laura.micoli,

Seems to work here:

– Dale

Dale,
I came across this QandA when searching for help with RhinoScript. I must admit I’m having difficulty navigating all the various documents that have been produced over the years and making only little headway. I’m trying to generate geometry through the VB script component in Grasshopper. I’m using this:

as my rule book but finding that the members don’t quite match the current libraries in the VB grasshopper component. After two days I’ve managed to draw a line and a closed polyline but failing with circles, planes, simple surfaces and extruding or lofting. Is there any further documentation anywhere?

Steve Carney

Hi @steve14,

RhinoScript, which is based on Microsoft VBScript, it not the same as Microsoft Visual Basic (.NET), which is the language behind the VB scripting component in Grasshopper. Legacy RhinoScript cannot be used in the VB scripting compnent.

Most users of Grasshopper, who are adding scripting components to their solutions, are using either Python or C# which both access Rhino’s RhinoCommon API. I’d suggest using one of these languages, as you’ll find most samples written with these.

– Dale

Thanks, Dale, Python it is then! It wouldn’t be new to me but needs a bit of study to get to the same level as the VB.

So, it is not possible to get access to the geometry libraries through the VB script component?

Steve Carney

To the best of my knowledge, Visual Basic is still one of the .NET languages supported by (and included with) Microsoft’s Visual Studio, so you should be able to accomplish the same things as C# or Python. As Dale points out though, most of the examples you might use for inspiration and guidance are in C# or Python so you would need to be able to translate the syntax and structure into VB equivalents.

I’ve just bit the bullet and went for Python. It looks a lot easier and accessible, so time to move up.