Option Explicit

‘excel import to rhinoscript , che-wei wang 4.8.2008
‘excel cell numbers begin with 1,1 (not 0,0)

Call Main()
Sub Main()
Dim FileName, file, excel
FileName = Rhino.OpenFileName(“Select Excel File”,”Excel Files (*.xls)|*.xls||”)
If isNull(FileName) Then Exit Sub

Set excel = CreateObject(“Excel.Application”)
excel.Visible = True

Set file = excel.ActiveSheet
Dim i
Dim value(2)
Dim arrPoints(99) ’array is zero based
For i = 1 To 100
value(0) = file.Cells(i,1).Value ’excel file is not zero based
value(1) = file.Cells(i,2).Value
value(2) = file.Cells(i,3).Value
arrPoints(i-1) = rhino.addPoint (value)

Dim arrPoint1, arrPoint2, arrPoint3
Dim strPoint1, strPoint2
For Each strPoint1 In arrPoints
arrPoint1 = rhino.PointCoordinates(strPoint1)
For Each strPoint2 In arrPoints
arrPoint2 = rhino.PointCoordinates(strPoint2)
arrPoint3 = array(arrPoint1, arrPoint2)
rhino.AddCurve arrPoint3

excel.UserControl = True
End Sub


2 Responses

  1. I like this script. Thanks.
    A little explanation would be good.

  2. Still working on adding images and description for each script. This site will be undergoing an update with a more coherent interface in the near future.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: