Forgot password?

Create an account!

Forum

« back

RhinoScript – Curve creation from Excel

Messages

Please log in to write a message.

  • 1. darthurs (Oct 02, 2016 14.50):

    Trying to automate the creation of curves/lines/arcs in Rhino FROM Excel using VBA. Most of it so far has been successful, managed to create a 3D line, a 3 point arc and read the vertexes of a curve. I've hit a problem with creating a curve using the code below. Note this is vba code for Excel not rvb.

    Sub RhinoCreateCurve()
        Dim Rh As Object
        Dim RhScr As Object
        Dim NumPoints As Integer
        Dim CurPoint() As Variant
        Dim XYZ(3) As Variant
        Dim temp As Variant
       
        Set Rh = CreateObject("Rhino5.Interface")
        Set RhScr = Rh.GetScriptObject()
       
        NumPoints = Sheets("Sheet1").Cells(1, 5).Value
       
        ReDim CurPoint(NumPoints)
       
       
        For i = 1 To NumPoints
            XYZ(0) = Sheets("Sheet1").Cells(i, 6).Value
            XYZ(1) = Sheets("Sheet1").Cells(i, 7).Value
            XYZ(2) = Sheets("Sheet1").Cells(i, 8).Value
            CurPoint(i - 1) = XYZ
        Next i
         
        RhScr.AddCurve CurPoint
    End Sub

    When I get to addcurve I get a run-time error "10". This array is fixed or temporarily locked. I don't think it is fixed as it has been dynamically redimmed to the required length (in my example data I have 257 XYZ co-ordinates)

    I am doing it this way as my spreadsheet is used for analysis of the curve data and is therefore the "master document"

Recommend

Why are these buttons gray?