Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5786

Creating curve from vba

$
0
0

@David_Arthurs wrote:

I have an excel spreadsheet which I am trying to create wireframe using VBA. Lines and arcs I have successfully done, as well as reading the ordinates of a curve into the spreadsheet. This spreadsheet does a lot of analysis for us so this is the preferred method, rather than having the automation as a rhino script. Below is the vba code I have written to create the curve, but when it does the addcurve call I get a run-time error 10 about an array being fixed or temporarily locked. Any ideas anybody?

Sub RhinoCreateCurve()
    Dim Rh As Object
    Dim RhScr As Object
    Dim SelObject As Variant
    Dim NumPoints As Integer
    Dim CurPoint() As Variant
    Dim XYZ() As Variant

    Set Rh = CreateObject("Rhino5.Interface")
    Set RhScr = Rh.GetScriptObject()

    NumPoints = Sheets("Sheet1").Cells(1, 5).Value

    ReDim CurPoint(NumPoints - 1)
    ReDim CurPoint(NumPoints)
    ReDim XYZ(2)


    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

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5786

Trending Articles