Community
3ds Max Programming
Welcome to Autodeskā€™s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 

Assign material from one object to another

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
wasea.pinkov
558 Views, 2 Replies

Assign material from one object to another

Hi, I' trying to assign a material from one box to another 

My code looks like this:

global Wall
global WallMaterial
 
for s in selection do
 (
 
	if s.name == 'WallObject' do
	(
		Wall = s
	)
    
    if s.name == 'WallObject' do
    (
        WallMaterial = s.mat
    )
   
)
Wall.mat = WallMaterial    

 And on execution it throw me an error: 

-- Unknown property: "mat" in Wall
-- MAXScript callstack:
-- thread data: threadID:16784
-- ------------------------------------------------------
-- [stack level: 0]
-- In top-level

 

Can someone help me please

 

Labels (1)
2 REPLIES 2
Message 3 of 3
miauuuu
in reply to: wasea.pinkov

Maybe something like this:

 

(
	local WallObj = undefined
	local WallMaterial = undefined
	 
	selObjsArr = selection as array
	for s in selObjsArr where s.name == "WallObject" do WallMaterial = s.material
	
	for s in selObjsArr where s.name != "WallObject" do s.material = WallMaterial
	
)
https://miauu-maxscript.com/

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report