Select by material

I need a help, I tried a few ways ... As you select an object by material "Select by material" is there a code?

Comments

Comment viewing options

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

Or if you want to have same

Or if you want to have same wirecolor but different from others objects
then use next code

for m in scenematerials do
(
	(refs.dependentNodes m).wirecolor = random black white
)

bga

kimarotta's picture

Simple and efficient... Very

Simple and efficient...

Very very Thanks..

But what's the "refs.dependentNodes" ?

kimarotta.com.br
3d Artist  

barigazy's picture

For more infos you can find

More infos about *Dependencies* you can find on this page

http://docs.autodesk.com/3DSMAX/15/ENU/MAXScript-Help/index.html?url=fil...

bga

kimarotta's picture

Thank you again

Thank you again

kimarotta.com.br
3d Artist  

barigazy's picture

I understand that you want to

I understand that you want to change wirecolor to the objects that
share same materijal. If i'm wright then use this

for m in scenematerials do
(
	local objArr = refs.dependentNodes m
	for o in objArr do o.wirecolor = random black white
)

bga

barigazy's picture

smart select by material

Try to modify this because i plan to use it in the next update of
Select Objects By BitmapTex script.

fn getGrandParent obj = (while obj.parent != undefined do obj = obj.parent)
if selection.count == 0 then (messageBox "You must select at least one object!" title:"Warning" beep:false) else
(
	local obj = selection[1]
	if obj.material == undefined then (messageBox "This object don't have assigned material!" title:"Warning" beep:false) else
	(
		local mat = obj.material
		local objArr = refs.dependentNodes mat
		if objArr.count == 1 then (messageBox "Material of this object is unique!" title:"Warning" beep:false)  else
		(
			for itm in objArr do  
			(
				if (isGroupMember itm  == true and isOpenGroupMember itm == false) do
				(
					local grandParent = getGrandParent itm
					try (setGroupOpen (getGrandParentName itm) true) catch()
				)
			) ; select objArr
		)
	)
)

bga

kimarotta's picture

Hey Barigazy, thanks for the

Hey Barigazy, thanks for the help, but could not get in my need, see if you can help me ...

I am writing a tool and want to put color in random objects in the scene by the material objects with the same material have the same color ... see if I'm in a right way... lol

fn matWire =
(
matObj = #()

for obj in objects do (
m = obj.material
appendIfUnique matObj m
)

for obj in objects do(
for x = 1 to matObj.count do(
if matObj[x] == obj.material then(
obj.wirecolor = random black white
)
)
)
)

Thanks

kimarotta.com.br
3d Artist  

barigazy's picture

Use tags < code>your code

Use tags < code>your code here .. < /code> when you post next time.
It's easyer to read, like this

fn matWire =
(
	local matObj = #()
	for obj in objects do 
	(
		m = obj.material
		appendIfUnique matObj m
	)
	for obj in objects do
	(
		for x = 1 to matObj.count do
		(
			if matObj[x] == obj.material then
			(
				obj.wirecolor = random black white
			)
		)
	)
)

bga

Comment viewing options

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