ScriptSpot

Forum topic · General Scripting

Creating XYZ Points from Excel file (Newbie Question)

By eliscio · 2009-12-26

Description

Hello All,

I have an application where I am importing XYZ coordinates and wish to do them all at once in a script so that I create points for each XYZ location.

I was thinking that the helper points would be sufficient, but could someone generate this simple repeating script?

thanks,

Eugene

Comments (2)

Anubis · 2009-12-26

If your CSV file formated: X, Y, Z

theFilename = getOpenFileName types:"Comma Separated Values (*.CSV)|*.CSV|All Files (*.*)|*.*"
if theFilename != undefined do ( --if a valid filename picked
    local theFile = openFile theFilename --open the file
    while not eof theFile do ( --loop until the end of file
        Point pos:(Point3 (readValue theFile) (readValue theFile) (readValue theFile))
    )
)

eliscio · 2009-12-26

Just a bit more on this subject...

After some bashing around with the MaxScript Listener, I was able to create a point by entering something like this:

$Point_Helper:Point01 @ [2.100000,0.000000,3.833000]

However, I have a long list of points and have to do this several times over. I have all the points in Excel and can add the necessary code there so I can simply cut and paste into Notepad to create the script.

When I pasted the whole list in the Listener it only created the point for the last line.

Thanks again!