Please log in to write a message.

17. waterpolo (May 02, 2012 23.39):
I changed the code and it works!
Thank you so much!
Option Explicit
'draw two curves connected with loft
Sub Main()
Dim Curve1
Dim Curve2
Dim controlpoints1(6)
Dim controlpoints2(6)
controlpoints1(0)=Array(5,0,0)
controlpoints1(1)=Array(10,5,0)
controlpoints1(2)=Array(5,8,2)
controlpoints1(3)=Array(25,3,0)
controlpoints1(4)=Array(35,7,1)
controlpoints1(5)=Array(40,9,0)
controlpoints1(6)=Array(50,0,0)
Curve1=Rhino.addCurve(controlpoints1)
controlpoints2(0)=Array(0,0,0)
controlpoints2(1)=Array(10,10,1)
controlpoints2(2)=Array(5,8,4)
controlpoints2(3)=Array(25,6,0)
controlpoints2(4)=Array(35,10,3)
controlpoints2(5)=Array(40,5,1)
controlpoints2(6)=Array(50,0,0)
Curve2=Rhino.addCurve(controlpoints2)
Const rhObjectCurve=4
Dim arrCurves
arrCurves= Array(Curve1,Curve2)
Rhino.AddLoftSrf(arrCurves)
End Sub

16. waterpolo (May 02, 2012 23.22):
so i have todeclare the variables in a Main sub?

15. Hanno (May 02, 2012 23.11):
Your variables Curve1 and Curve2 are declared locally and therefore only valid within the respective Subroutine. DrawLoftSrf cannot access them.
You have to declare the variables globally (outside of your sub statements).
Take a look at our link section, there are great resources for learning the basics of VB programming (RhinoScript 101 is a good start).
Hanno

14. waterpolo (May 02, 2012 22.54):
This is my script right now:
again with error
Option Explicit
'draw two curves connected with loft
'
Sub Curve1()
'Draw curve with controlpoints
Dim controlpoints(6)
Dim Curve1
controlpoints(0)=Array(5,0,0)
controlpoints(1)=Array(10,5,0)
controlpoints(2)=Array(5,8,2)
controlpoints(3)=Array(25,3,0)
controlpoints(4)=Array(35,7,1)
controlpoints(5)=Array(40,9,0)
controlpoints(6)=Array(50,0,0)
Curve1=Rhino.addCurve(controlpoints)
End Sub
'
Sub DrawCurve2()
'Draw curve with controlpoints
Dim controlpoints(6)
Dim Curve2
controlpoints(0)=Array(0,0,0)
controlpoints(1)=Array(10,10,1)
controlpoints(2)=Array(5,8,4)
controlpoints(3)=Array(25,6,0)
controlpoints(4)=Array(35,10,3)
controlpoints(5)=Array(40,5,1)
controlpoints(6)=Array(50,0,0)
Curve2=Rhino.addCurve(controlpoints)
End Sub
'
Sub DrawLoftSrf()
Const rhObjectCurve=4
Dim arrCurves
arrCurves= Array(Curve1,Curve2)
Rhino.AddLoftSrf(arrCurves)
End Sub
what do i wrong?

13. waterpolo (May 02, 2012 22.51):
yes you're right but when i do it without arr, i get the same error

12. Hanno (May 02, 2012 22.50):
Again you posted while I wrote :)
The problem is exactly the one with the variable names.
Tip: Insert "Option Explicit" as first line of your script, then the interpreter will only let you use variables that you dim first.

11. Hanno (May 02, 2012 22.48):
Ah, sorry, did not see your latest post. My comment is still valid, though.
And be careful with your variable names, e.g. you dim "Curve1" and then use "arrCurve1" (where "arr" does not make sense, since it is a hint that the variable contains an array) etc.
Hanno

10. waterpolo (May 02, 2012 22.47):
thanks for you're help!
i have now this:
Sub DrawLoftSrf()
Const rhObjectCurve=4
Dim arrCurves
arrCurves= Array(Curve1,Curve2)
Rhino.AddLoftSrf(arrCurves)
End Sub
when i run the scripti get an error: mismatch curve1

9. Hanno (May 02, 2012 22.41):
GetObjects is only for interactive selection.
Maybe your problem is that AddLoftSrf needs an array as parameter (because there can be any number of curves):
arrCurves = array(curve1, curve2)
Call Rhino.AddLoftSrf(arrCurves)

8. waterpolo (May 02, 2012 22.39):
This is the code:
Option Explicit
'draw two curves connected with loft
'
Sub Curve1()
'Draw curve with controlpoints
Dim controlpoints(6)
Dim Curve1
controlpoints(0)=Array(5,0,0)
controlpoints(1)=Array(10,5,0)
controlpoints(2)=Array(5,8,2)
controlpoints(3)=Array(25,3,0)
controlpoints(4)=Array(35,7,1)
controlpoints(5)=Array(40,9,0)
controlpoints(6)=Array(50,0,0)
arrCurve1=Rhino.addCurve(controlpoints)
End Sub
'
Sub DrawCurve2()
'Draw curve with controlpoints
Dim controlpoints(6)
Dim Curve2
controlpoints(0)=Array(0,0,0)
controlpoints(1)=Array(10,10,1)
controlpoints(2)=Array(5,8,4)
controlpoints(3)=Array(25,6,0)
controlpoints(4)=Array(35,10,3)
controlpoints(5)=Array(40,5,1)
controlpoints(6)=Array(50,0,0)
arrCurve2=Rhino.addCurve(controlpoints)
End Sub
'
Sub DrawLoftSrf()
Const rhObjectCurve=4
Dim arrObjects
arrCurves= Rhino.GetObjects(arrCurve1,arrCurve2,4)
Rhino.AddLoftSrf(arrCurves)
End Sub

7. waterpolo (May 02, 2012 22.31):
yes, i found that code, but how do you select the curves.
I created curve1 and curve2.
But when i (curve1,curve2,4)
it won't work.

6. Hanno (May 02, 2012 22.26):
The most simple example would be something like:
arrCurves = Rhino.GetObjects("Select curves", 4) ' 4 = only curves
Call Rhino.AddLoftSrf(arrCurves)

5. waterpolo (May 02, 2012 12.33):
Hi
Yeah i am still working on it.
I found the lofting function, but it won't work, :(
I scripted 2 curves and tried to loft between them but it does not work unfortunately.
Do you have an example script for lofting?
Mari

4. Hanno (May 02, 2012 09.37):
Hi Mari,
do you still need help on this one? If so: Lofting is the keyword. You can use Rhino.AddLoftSrf to create a surface between your curves.
Hanno

3. waterpolo (Apr 26, 2012 00.42):
Hi Hanno
Thanks for the reply!
I tried it with DrawCurve with a lot of controlpoints.
It looks good!
But with nurbs you have to work with weights and knots, i do not understand that entirely.
Now that i have the curves or nurbs, i want to draw a couple of curves/nurbs with a loop. That is succeeded.
My question is now, how can i create a smooth surface between two curves or nurbs?
Mari
Ps: i attached an image of the result

2. Hanno (Apr 26, 2012 00.04):
Hi Mari,
NURBS = Nonrational uniform B Spline
Trust me, if you want to create curves with Rhino, you want NURBS curves.
Hanno

1. waterpolo (Apr 25, 2012 16.08):
Hi!
I am an architecture Student and just started working with Rhinoscript.
I can work with vbscript for autocad.
For a project with generative design i want to make different splines which insinuates motions, and then create smooth surfaces between the splines.
The problem is that i don't know how to create a spline with rhinoscript.
I looked at several help services but i couldnt find anything about splines.
The only thing i can script is nurbs.
My question is does anyone have the script for a spline or can help me create a spline?
Hope someone can help me!
Thanks!
Mari