Hello,

I would like to bring in a .txt file full of XYZ points as circles of size 2.

Example:

1234.23,3533.34,5547.23

1223.24,4364.32,5667.54

3524.35,3254.54,3246.54

...

I have tried the script functions but cant seem to get it to work out.

Any help would be great!

Thanks,

Views: 204

Replies to This Discussion

Hi Corey- for a comma delimited file, this will work as a simple example (mind the line wrapping):

Call Main()
Sub Main()
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 sText
Dim plane: plane = Rhino.WorldXYPlane()
Rhino.EnableRedraw False
For Each stext In aText
plane(0) = Rhino.Str2Pt(stext)
Rhino.AddCircle plane, 2
Next
Rhino.EnableRedraw True
End Sub

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.

See also- 

http://v5.rhino3d.com/group/rhinoscript

http://www.rhino3d.com/resources/?id=601

-Pascal

pascal@mcneel.com

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
1,2,3
2,2,3
3,2,3
4,2,3

John Brock
Tech Support
Rhinoceros
Seattle
USA

Thanks,

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?

Thanks,

Corey

If you are using the Rhino Script example I posted, change Rhino.AddCircle to Rhino.AddSphere. They both use the same inputs.

-Pascal

pascal@mcneel.com

RSS

Translate

© 2014   Created by McNeel Admin.

Badges  |  Report an Issue  |  Terms of Service