Multiple Boolean MAXScript


This script creates a set of nested single Boolean operations on any number of objects selected. The resulting encapsulated collection of Boolean operations can then be easily converted into a Poly object all at once.

Use it by selecting any number of objects you'd like to combine for a union and run the script from the MAXScript Menu.
The conventional method of using a ProBoolean Union of picked objects results in a different per-object Multi/Sub-Object Material that mistreats similar sides of objects during the picking process.

As the comparing images below show, this short MultiBoolean script creates a Multi/Sub-Object combination, which offers the possibility of selecting single-materials for each side of the combined shapes. This enables the user to select or define ID, Name and Sub-Material for every single side afterwards, no matter how detailed the resulting union gets.

Download


20111125-MultiBoolean_MAXScript.ms (423 Bytes)


Images (Click to view details)


MultiBooleanProBoolean
MultiBooleanProBoolean


Sourcecode


if selection.count < 2
then messageBox ("Please select at least 2 Objects. Thanks.")
else (
	objectCount = 1
	objectAll = selection.count
 
	while objectCount < objectAll do (
		objectCount = objectCount + 1
		boolObj.createBooleanObject selection[2]
		boolObj.setBoolOp selection[2] 1
		boolObj.SetOperandB selection[2] selection[1] 4 3	
	)
	messageBox ("Done. Objects processed: " + (objectAll as String))
)