ScriptSpot

Forum topic · Scripts Wanted

Box info Exporter

By DarkShallFall · 2011-06-03

Description

Would it be possible for someone to make a script that will export info for all the boxes in a scene to a textfile.

In the format of:
Name
Length
Width
Height
X(translation)
Y(translation)
Z(translation)
X(rotation)
Y(rotation)
Z(rotation)

Example:

Box01
48.713
22.97
-8.234
-7.262
-7.581
7.632
90.0
-0.0
-0.0

Box02
58.713
32.97
-3.234
-6.262
-9.581
7.632
90.0
-0.0
-0.0

Comments (2)

This may help

othoap · 2011-06-08

do a search for SOP : Spit Out Props+!

there you go ( txtFile =

br0t · 2011-06-03

there you go


(
	txtFile = "C:\Users\YourName\Desktop\boxInfo.txt"

	if doesFileExist txtFile then
		theFile = openFile txtFile mode:"at"
	else 
		theFile = createFile txtFile

	fn print_data_to_file obj=
	(	 
		format "\n\n%\n%\n%\n%\n%\n%\n%\n%\n%\n%\n" obj.name obj.length obj.width obj.height obj.position.x obj.position.y obj.position.z \
		(obj.rotation as EulerAngles).x (obj.rotation as EulerAngles).y (obj.rotation as EulerAngles).z to:theFile
	)--end fn

	for theBox in $Box* do print_data_to_file theBox
	close theFile
)

If you run this multiple times without changing the file name, it will just add everything inside the file. If you want to delete the old info inside the file when running the script, change the mode from "at" to "wt"