Visual Data

 That’s my first script showing the data in a visuwal. In this example

is used to show different TEU in major ports in the world. Can be also

a representation of different density, population etc.

datadoscriptu.jpg

1tabela.jpg

Option Explicit
‘Script written by <Monika Szawiola>
‘Script copyrighted by <insert company name>
‘Script version 27 kwietnia 2008 14:31:03

Call xlIn2()

Sub xlIn2()

Const xlDown = -4121 ‘xlScope
Dim strFileName, dblX, dblY, dblZ, arr2, point, points
Dim xlApp, xlSheet, nRow, nRowCount
Dim aPoints()
Dim cnt

Dim odl, line

odl = 10
strFileName = Rhino.OpenFileName(”Select File”,”Excel Files (*.xls)|*.xls||”)
If IsNull(strFileName) Then Exit Sub
Set xlApp = CreateObject(”Excel.Application”) ‘
xlApp.Workbooks.Open(strFileName)
Set xlSheet = xlApp.ActiveSheet
nRowCount = xlSheet.Range(”d1″, xlSheet.Range(”d1″).End(xlDown)).Rows.Count
Rhino.Print “Importing data…”

If (nRowCount = 0 ) Then

Rhino.Print “No data range found in file.”

Exit Sub

End If

ReDim aPoints(nRowCount-1)

For nRow = 1 To 40

dblY = xlSheet.Cells(nRow, 3).Value

If IsNumeric(dblY) Then

line = Rhino.Addline (array(0,odl,0),array(0,odl+dblY/1000,0))
Rhino.RotateObject line, array(0,0,0), 360/40*(nRow-1)

Else

xlApp.Quit

Set xlSheet = Nothing

Set xlApp = Nothing

Rhino.Print “Non-numeric data found in row ” & CStr(nRow) & “.”

Rhino.EnableRedraw(True)

Exit Sub

End If

Next

End Sub


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

One Response to “Visual Data”

  1. Nice post monika, thanks for sharing your progress!

Leave a Reply