I am trying to transform and rotate a series of OnCurves in order to create an Array. My outputted list returns one valid curve but then a list of invalid curves. I thought this may have to do with the OnNurbsCurve.transform function. In the Rhino SDK it says that this function returns a boolean. "Public Function Transform(ByRef xform As IOnXform) As bool" How do I get this method to return a new transformed OnNurbsCurve? Or is the error have something to do with the protected Ionxform class? I have attached the Function which is causing the problem. The full script is also attached below. FYI The objective is to mirror the helix segment and arc and then array the 4 curves in order to create the framework for parametric spiral staircase. . . .
Function move_rotate(ByVal dblZ_amount As Double, ByVal dblRotationAngle As Double, ByVal_ ObjectToMove As OnNurbsCurve, ByVal pntCenter As On3dpoint)As OnNurbsCurve
'declares function specific variables
Dim ObjectToMoveCopy As New OnNurbsCurve()
'duplicates the inputted object
ObjectToMoveCopy = ObjectToMove.duplicate
'prepares the Xform objects to rotate the object dblRotationAngle degrees and moves it
'dblZ_amount amount in the z direction
Dim move_xform As New OnXform
move_xform.Translation(0, 0, dblZ_amount)
Dim vertZ_axis As New On3dVector(0, 0, 1)
Dim rotate_xform As New OnXform
rotate_xform.Rotation(dblRotationAngle, vertZ_axis, pntCENTER)
'performs the transformations on the object
ObjectToMove.Transform(move_xform)
ObjectToMove.Transform(rotate_xform)
'returns the new objects
ObjectToMovecopy = objectToMove
Return ObjectToMoveCopy
End Function
Full Script:
Private Sub RunScript(ByVal InputObjectToMove1 As List(Of OnCurve), ByVal InputObjectToMove2 As OnCurve, ByVal z_amount As Double, ByVal pntCENTER As Object, ByVal dblReps As Integer, ByRef OutputList1 As Object, ByRef OutputList2 As Object)
'decalres the variables
Dim i As Integer
Dim ObjectToMoveCopy As New OnNurbsCurve
'converts the OnCurve list from Grasshopper to OnNurbs Object
Dim objectToMove1 As New OnNurbsCurve()
InputObjectToMove1(0).getnurbform(objectToMove1)
'converts the OnArc list from Grasshopper to OnArc Object
Dim objectToMove2 As New OnNurbsCurve()
InputObjectToMove2.getnurbform(objectToMove2)
'creates two lists and adds the original objects to that list
Dim list1 As New list(Of OnNurbsCurve)
Dim list2 As New list(Of OnNurbsCurve)
list1.add(objectToMove1)
list2.add(objecttomove2)
'Rotate and move the first two object 1x z_amount
'dblRotationAngle = 3.141593 is 180 degrees in radians
Call move_rotate(z_amount, 3.141593, list1(0), pntCenter)
list1.add(ObjectToMoveCopy)
Call move_rotate(z_amount, 3.141593, list2(0), pntCenter)
list2.add(ObjectToMoveCopy)
'array the rotated object dblReps amount of times
For i = 1 To dblReps
Call move_rotate(z_amount * 2, 0, list1(i), pntCenter)
list1.add(ObjectToMoveCopy)
Next
For i = 1 To dblReps
Call move_rotate(z_amount * 2, 0, list2(i), pntCenter)
list2.add(ObjectToMoveCopy)
Next
'array the original object dblReps amount of times
'inset move-rotate function for non rotated objects
'set the lists to the grasshopper output variables
OutputList1 = list1
OutputList2 = list2