I would like to bring in a .txt file full of XYZ points as circles of size 2.
I have tried the script functions but cant seem to get it to work out.
Any help would be great!
Hi Corey- for a comma delimited file, this will work as a simple example (mind the line wrapping):
Dim sFile: sFile = Rhino.OpenFileName("Select file", "text Files(*.txt)|*.txt|", Rhino.WorkingFolder(),, ".txt")
If isNull(sFile) Then Exit Sub
Dim aText: aText = Rhino.ReadTextFile(sFile, True, True)
If Not isArray(aText) Then Exit Sub
Dim plane: plane = Rhino.WorldXYPlane()
For Each stext In aText
plane(0) = Rhino.Str2Pt(stext)
Rhino.AddCircle plane, 2
You can make it fancier so you can input the radius and remember the last used etc. but something like the above should get you started.
Edit your text file to look like this:
circle 1234.23,3533.34,5547.23 2
circle 1223.24,4364.32,5667.54 2
circle 3524.35,3254.54,3246.54 2
Then use the ReadCommandFile command and select your text file.
Another way would be to draw one original circle, then use the copy command in your command file so you had less editing to do in the file.
That would look something like this:
!_circle 0,0 r 2
copy SelLast enter 0,0
Now, if I want a size 2 renderable sphere, what would you recommend?
Also, I notice the locations are different in XYZ space, do I have to re arrange my coordinates for this type of import?
If you are using the Rhino Script example I posted, change Rhino.AddCircle to Rhino.AddSphere. They both use the same inputs.