I'm Trying to code geometry data to .txt file. For 1 mesh my script working but for 2 or more i have an error. "-- Unknown property: "name" in $selection"
"$.name" doesn't know what to do because you're not specifying what objects name to get. You need to loop through the objects and get all their names, like such:
out_name = ((GetDir #export)+"/test.txt")
out_file = createfile out_name
for curObj in (selection as array) do (format "Name:% \n" curObj.name to:out_file)
Still I have no idea how maxscript can save it to desktop, Im trying to add /text.txt to end of line but still get error
out_name = (getDirectories ((systemTools.getEnvVariable("USERPROFILE"))+"/Desktop/text.txt")) out_file = createfile out_name for curObj in (selection as array) do (format "Name:% \n" curObj.name to:out_file) close out_file
Replies
out_name = (getDirectories ((systemTools.getEnvVariable("USERPROFILE"))+"/Desktop"))[1]
out_file = createfile out_name
for curObj in (selection as array) do (format "Name:% \n" curObj.name to:out_file)
close out_file
out_name = (getDirectories ((systemTools.getEnvVariable("USERPROFILE"))+"/Desktop"))[1] + "test.txt"
out_file = createfile out_name
for curObj in (selection as array) do (format "% \n X:%" curObj.name curObj.pos.controller[1].value to:out_file)
close out_file
Also, when getting the x axis position, besides getting it from the controller you can simply do curObj.pos.x or curObj.pos[1]