[Closed] I need a max script
Hi,
forgive me for my insolence , but I badly need your`s assistance, because is the only way to do this – my knowledge is very poor in this domain.
I need a 3ds max script with which export parametric values in EXCEL .I attach a short movie to explain exact what i want. Pls download the file.
If u think u can do this , please , please help me !
10Q
simply exports the height, width, length properties of all selected objects to a cvs file (a text file). you can then open the cvs in excel.
UPDATED 19/09/2006
-------------------------------------------
-- ExportAsCVS.ms
-- exports the currently selected models
-- height, width, length (in that order)
--
-- Version: 0.1
-- Tested using 3ds max v8.0
--
-------------------------------------------
global theFileStream
-------------------------------------------
-- START
-------------------------------------------
fn exportAs fileName = (
-- create file
theFileStream = createFile fileName;
if theFileStream != undefined then (
-- file ok to write
selection = getCurrentSelection()
if selection.count > 0 then (
-- write header
printToFile ("x, y, z, Pieces, Name")
-- write data
for obj in selection do (
_name = obj.name
_height = floorToNDecimals(obj.height) as string
_width = floorToNDecimals(obj.width) as string
_length = floorToNDecimals(obj.length) as string
-- assuming pieces is always 1
_pieces = "1"
-- write to file
printToFile (_length+","+_width+","+_height+","+_pieces+","+_name)
)
) else (
-- error
printToFile ("Error: Nothing Selected!")
)
)
-- close
close theFileStream;
)
fn printToFile theString t:0 = (
-- auto tab (empty string)
tabString = " ";
tabString = substring tabString 1 (t*4);
-- print
format "%%
" tabString theString to:theFileStream;
)
fn floorToNDecimals theNumber N:2 = (
return floor( ((pow 10 N) * theNumber) ) / (pow 10 N)
)
-------------------------------------------
-- RUN
-------------------------------------------
exportAs("Test2.csv");
-------------------------------------------
-- END
-------------------------------------------
i recive this errorwhen i execute the script: ” Unable to convert : undefinited to type: Array “
don’t know how you got that error. i’ve updated the script (in the original post).
customise the script to do what you need. the basics are there. open the maxscript reference and get crackin’.
Man, u have a heart of gold !!! This thing work !!! 10 Q ! 10 Q !
you think is possible to order value in excel like this?
ok dude. i’ve quickly updated the script that it outputs 5 columns: x, y, z, pieces, name. i have assumed pieces is always 1.
with a cvs file you can only export the raw data in rows/columns – it is not possible to format the result. i guess it would be possible using office 2007 with its more transparent xml file structure.
thanks the private message. i hadn’t forgotten your post – i just had other to work to do.
the convert 1 to string error is due to the line
_pieces = 1
and should be either
_pieces = 1 as string
or
_pieces = “1”
[color=White]both is correct / [/color]_pieces = 1 as string
or
_pieces = “1”
[b][color=White]
[ works fine ] 10 Q !!![/b][b] the rezult is this !
My question is : Can i eliminate this thing? in want to remain only like this !
Importent is to have in the first column the big values !!!
[/b][/color]