Parametric detach by Smoothing Group or Material ID

Hello
I'm very into parametric modeling in 3dsmax and use Smoothing Groups or material IDs to create set of reference object which easy to modify through the source object.
Need to automate this routine.

For example we have object with several different Smothing Groups assigned:

- run script
- number of Reference Clones are created with Volume Select + Delete Mesh + PolySelect modifiers
- number of Clones is equal to number of SG (or MatID).
- Volume Select with Face / Invert / by Sm Group (or MaterialID) paremeters
- keep source object with Display as Box parameter

hope it will be useful not only for me
Viktor

Comments

Comment viewing options

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

great, thank you!

can you please also share MaterialID version of the tool
Thank you!

Sanislov's picture

Hello, Something like this?

Hello, Something like this?

setCommandPanelTaskMode #create
 
SGlist = #()
 
fn getSmoothGroups _obj =
	(
			local SGgroups = #()
			for i = 1 to (_obj.EditablePoly.GetNumFaces()) where (polyop.getFaceSmoothGroup _obj i) != 0 do
				(
					appendIfUnique SGgroups (polyop.getFaceSmoothGroup _obj i)
				)
				return  SGgroups;
	)
 
fn getVMod =( return VSmod = (vol__select  level:2 invert:true method:0 volume:6) )
 
 
if selection[1] == undefined then (messagebox "Need to select an object!")
	else(
	Source = copy selection[1]
	convertTo Source Editable_Poly
	SGs = getSmoothGroups Source	
	delete Source
	for j = 1 to SGs.count do
				(
					for c = 1 to 32 do
						(
							if bit.get SGs[j] c then  (appendIfUnique SGlist c)
						)
				)	
 
	sort SGlist
	for i = 1 to SGlist.count do
	(
		Nname = stringStream ""
		obj = reference selection[1]
		format "sg_%" SGlist[i] to:Nname
		obj.name = Nname
		move obj [80*i,0,0]
		addmodifier obj (getVMod())
		obj.vol__select.smgroup = SGlist[i]
		addmodifier obj (deletemesh())	
	)
)

Comment viewing options

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