Visual data - importing txt
here is another script counting a number of elements (txt) in one column
and puting around the circle
Option Explicit
‘Script written by <Monika Szawiola>
‘Script copyrighted by <insert company name>
‘Script version 20 kwietnia 2008 16:58:41
Call Main()
Sub Main()
Dim arrPlane
Dim R, i, punkty
Const xlDown = -4121 ‘xlScope
Dim strFileName, dblX, dblY, dblZ
Dim xlApp, xlSheet, nRow, nRowCount
Dim aPoints()
Dim cnt
Dim tekst(), txt
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(”b1″, xlSheet.Range(”b1″).End(xlDown)).Rows.Count
Rhino.Print “Importing data…”
‘Rhino.EnableRedraw(False)
For nRow = 1 To nRowCount
ReDim Preserve tekst(nRow-1)
dblX = xlSheet.Cells(nRow, 2).Value
dblY = xlSheet.Cells(nRow, 3).Value
If IsNull(dblX) Then
xlApp.Quit
Set xlSheet = Nothing
Set xlApp = Nothing
Rhino.Print “Non data found in row ” & CStr(nRow) & “.”
‘ Rhino.EnableRedraw(True)
Exit Sub
Else
rhino.Print dblX
tekst(nrow-1) = array(CStr(dblX),CInt(dblY))
End If
Next
‘Rhino.EnableRedraw(True)
arrPlane = Rhino.WorldXYPlane
strCurve = Rhino.AddCircle (arrPlane, ubound(tekst))
starting = Rhino.CurveStartPoint (strCurve)
punkty = Rhino.DivideCurve (strCurve, ubound(tekst)+1, True)
For i = 0 To ubound(tekst)
txt = Rhino.AddText (tekst(i)(0), punkty(i), 3)
Rhino.RotateObject txt, punkty(i), 360/ubound(tekst)*i
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.


Leave a Reply