Hi oompa,

I made a file called "coordinates.txt" which contained some comma-
separated numbers (3 per line). I then put the path to this file (C:
\Users\David\Desktop\coordinates.txt) into a PostIt panel and fed it
into a VB component. I called the input parameter "path" and set the
hint to String.

The following code will examine all lines in the file and create a
list of points:

Sub RunScript(ByVal path As String)
  If (Not IO.File.Exists(path)) Then Return False

  Dim lines As String() = IO.File.ReadAllLines(path)
  If (lines Is Nothing) Then Return False

  Dim pts As New List(Of On3dPoint)
  For Each line As String In lines
    Dim parts As String() = line.Split(",".ToCharArray())

    Dim x As Double = Convert.ToDouble(parts(0))
    Dim y As Double = Convert.ToDouble(parts(1))
    Dim z As Double = Convert.ToDouble(parts(2))

    pts.Add(New On3dPoint(x, y, z))
  Next

  A = pts
End Sub

--
David Rutten
[email protected]
Robert McNeel & Associates



On Feb 8, 2:09 am, oompa_l <[email protected]> wrote:
> Hi
>
> I am in the process of trying to understand the import of data into GH
> from excel, but I don't think I even need to get that fancy since my
> data is actually coming from a CSV text file. Does anyone know of any
> sample files that illustrate how to take a list of points in this
> format and produce GH geometry from it?
>
> thanks in advance
> o

Reply via email to