Export Dimensions to .txt

I'm fairly new to 3DS Max and have little to no experience in scripting. What I'm looking for is a script to export the dimensions of an object, along with the name to a .txt / excel file.

For example, if i'm selecting a 1220mm x 1220mm Chamfer Box and I execute the script, the script would create an .txt/excel file with a separate columns for the dimensions.

However, I would like this to work for all selected objects in a scene, just like "Summary Info". For example, if I'm selecting all the objects in a scene, execute the script, it would create a file with all the names of the objects selected and their matching dimensions.

Ideally, Summary Info would show the dimensions of each object, but since that's not the case I'm requesting a script that does a similar thing.

The thing i'm looking for is basically a minimal BOM script, so if anyone has a BOM script available it would be very useful.

Either a script, or a guide, or even a few words of advice would be very helpful, if you have anything to contribute it would be greatly appreciated. I am happy to learn, meaning that if someone wrote a short guide for the script, I would be more than happy to do it myself.

On a different note, there is another question that I have. When exporting Summary Info, I noticed that groups don't overwrite individual shapes. For example, If I had a group with a Chamfer Box and a Cylinder, could I just show "Group001" instead of each individual object of the group?

Thanks in advance for any help.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Michele71's picture

Try this script. It exports

Try this script.

It exports the result of the Pivot (xyz) and BoundingBox (xyz)of selected object/s into a new File. If you have the obj Group in the scene, each individual object will be measured. You can save the the result as ".text" or ".cvs"(Excel). If you do not choose the path where to save the file, will not be shown any results. I can not open an excel file, so do not know his result...

/*
Credit:
--
For the function "openGroupsAll objs toggle" see:
http://www.scriptspot.com/3ds-max/scripts/openclose-allselected-groups
and
 http://www.scriptspot.com/forums/3ds-max/general-scripting/open-all-grou...
*/
(
try (destroyDialog ::mno) catch()
 
	fn openGroupsAll objs toggle= ( 
		group_arr = for o in objs where isValidNode o AND isGroupHead o collect o
 
		with redraw off (
			for o in group_arr do (
				setGroupOpen o toggle
				-- ungroup o
			) -- end for
		)-- end redraw
	) -- end fn
 
 
rollout mno "Check Measure BBox Objects" width:232 height:104
(
Global Dir, new_file
 
	groupBox grp1 "Select - Save - Check measure BBox" pos:[8,8] width:216 height:88
	button sel_obj "Select Object/s" pos:[16,32] width:104 height:24
	button choose_directory "Save file as..." pos:[128,32] width:89 height:24
	button bt_bounding "Check measure BB Objects" pos:[16,64] width:200 height:24
 
 
	on sel_obj pressed do max tool hlist -- open list select object
 
	on choose_directory pressed do
	(
	  Dir = getSaveFileName caption:"Save Measure as BBox..." \
	types:"Text (*.txt)|*.txt|Excel(*.csv)|*.csv|All Files (*.*)|*.*" \
		historyCategory: "Previus Path Save file..."
	)
 
	on bt_bounding pressed do
	(
 
	openGroupsAll selection true
	new_file = createfile Dir
 
	for i in selection do with undo off 
	(
	---- create bounding box for each object in the scene and store object name
	snap_sel = snapshot i
	snap_sel.transform = matrix3 1
	print (snap_sel.name as string) to:new_file
	dum = dummy boxsize:(snap_sel.max - snap_sel.min)
	delete snap_sel
	dum.transform = i.transform
	dum.pos = i.center
	dum.name = "Dummy_Box"
	format "Pivot X = %\n" (i.center.x as string) to:new_file
	format "Pivot Y = %\n" (i.center.y as string) to:new_file
	format "Pivot Z = %\n" (i.center.z as string) to:new_file
	---- end create bounding box for each object in the scene and store object name
	---
	---- create measure for each object selected
	bbmin = dum.min
	bbmax = dum.max
	print_measure_bb = bbmax - bbmin
	format "X = %\n" (print_measure_bb.x as string) to:new_file
	format "Y = %\n" (print_measure_bb.y as string) to:new_file
	format "Z = %\n" (print_measure_bb.z as string) to:new_file
	--- end create measure for each object selected
 
	)
	openGroupsAll selection false
	select $Dummy_Box*
	delete $Dummy_Box*
)
)
createdialog mno style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)
)

I hope that others users can complete the script.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.