ScriptSpot

Script

Read data from csv txt

By pixamoon · Credited author: Pixamoon · 2015-02-06

Version
0.1
Date updated
2015-02-06
Votes
5
Description

Just simple script / code to read data from csv files exported from Excel and then create objects - (here: spheres)

How CSV should look:
Every planet in single line. Every value separated with "|" character.

for eg: (name|radius|x|y|z|sphere segments)

Sun|20|0|0|0|12
Earth|2|100|100|0|12

And so on.

If you need apply specific colors then add extra 3 numbers controlling rgb (egz |0|10|200)

Before run change file location in code or copy "SolarSystem.txt" file to C:\

Cheers,

Attachments

Tags: csv txt excel read data value object create sphere

Comments (19)

太棒了!

liuzc188 · 2019-04-01

非常感谢!

retrieve data of 3d max in excel.

amitgautam84ster · 2018-12-19

Hi All,

Is there any one who can help me to get data of 3dmax in excel/note pad.

`

pixamoon · 2018-12-19

Hi, can you explain bit more ?

solved?

liuzc188 · 2019-04-01

have you solve your problems? I want to do the same thing, but I don not know how to do, could you
help me?

`

pixamoon · 2019-04-03

Sorry, I'm not sure what problems to solve do you mean ?

retrieve data of 3d max in excel.

amitgautam84ster · 2018-12-19

Hi All,

Is there any one who can help me to get data of 3dmax in excel/note pad.

cool

pathToWorld · 2015-03-30

very cool
+1

csv load

robmyers67 · 2015-04-01

First impressions are this works a treat and I am totally impressed. Is there anything I can do on the forum to raise your score? praise you?

Really happy with this.
You mentioned that the pylons can be strung as well is that right?

One happy person!

Rob

:)

pixamoon · 2015-04-01

great :)

yeah, if you add some point helpers on the end of insulators with some proper naming. Then new script can connect them (by number order) with spline + add middle lower point. If this make sense ? :p

Sure for score :) you can try my other scripts and add +1 or comment / review if you like them or the idea (here or turbosquid).

pathToWorld · 2015-03-30

cool!!

load data from ,csv

robmyers67 · 2015-03-30

Hi I noticed this post and was wondering would it be possible to load meshes using this script and Have them placed in the scene. This will save time manually placing my objects. Cheers Rob

`

pixamoon · 2015-03-30

oki oki,
yes sure, but what kind of meshes? Can you post some screenshot ?
Do you want to impost them form other file and place them to location from csv file ?
Or do you want to import meshes from csv too ?

import .csv

robmyers67 · 2015-03-30

Its basically pylons of various shapes and sizes which need to be loaded along a co-ordinate system. There are various pylon type which need to be loaded. Not precious as to how they are loaded whether from an external MAX file or whether we all the pylon types in the same model. The pylons have the frame as a mesh and the insulators are linked to the main mesh. We can group them if needs be. We basically need to drop the required pylon in a location with the correct rotation.
Hope this makes sense.

Cheers

Rob

Attachments

csv

pixamoon · 2015-03-30

ah, oki,
I think the easiest way will be to have them in the project already. And just use script co copy/instance them with position and rotation from csv file.
File will have base names each pylon to be copied, then position and rotation.
file eg:
Pylon_A|100|10|0|90
Pylon_A|200|10|0|90
Pylon_B|100|100|0|90
etc
Pytlon_A|x|y|z|rotation

It is possible to place it also on surface (z position - if you have some landscaping already)
What you think?

Load csv

robmyers67 · 2015-03-30

That sounds awesome. can it handle the pylon as a group just thinking about the insulators which are attached. Once the pylons are in place we then align the insulators to the following pylon then use splines to represent the cables. but just getting them into position is a great step forward

csv

pixamoon · 2015-03-30

yes, they can be in groups
There is of course the way to connect wires between insulators with the script too. But this is other topic :)

Ok, I'll upload soon script to instance objects with positions from csv file.

So x,y,z plus Z axis rotation is enough, right ? Or you want to read z (height) from landscape ?
And how about new object naming - just base name + unique number ?

csv load

robmyers67 · 2015-03-30

The reading from base landscape on the z would be great and as far as naming that is fine too.

Sweet

`

pixamoon · 2015-03-30

ok, cool, I'll change this one to instance pylons

pixamoon · 2015-03-30

oki, try this one

csv file structure:
name|x|y|rotation

x,y are in system unit scale (inches or centimeters)
rotation is just in degrees

You need to open it and change path to csvfile or just place csv/txt file on C drive with the same name as sample

Then select ground and run script.

Hope it helps :)

Attachments