Notifications
Clear all

[Closed] a litle help for everyone- Architecture visualization

well here is a new script just a simple one:
for assigning a new material (standard) with the name of the objects, wich a thing that i had to do by hand for a long time…
but here it is, and go take a coffe… and charge your boss for the extra hours…

for i in selection do
(
i.material = standard ()
i.material.name = i.name
i.material.diffuse = color (random 0 255) (random 0 255) (random 0 255)
)

hugs bernilomax

13 Replies
1 Reply
(@bobo)
Joined: 10 months ago

Posts: 0

Just a note that you can replace the random color code with

 i.material.diffuse = random black white

to make it slightly shorter. The result will be the same.

Thanks bernieLomax, its simple but I would find this very usefull . but it seems not to work here ?.
Im running Max 8

I’m running max8 to,and it works perfectly !!
very simple and useful, thank you

dmaxer, sorry but you have to select some objects for it to work…
can you post your error…
hugs bern

i do ArchViz as well, but i´m not to expert in MaxScript, actually nothing at all, so can you explain a little further how can i make it to work ??? it really seams helpful. thanks.

thanks bobo…
well it is quite simple actually, it creates a loop that gathers the object name creates a new material with that name.
to make it work you have to name your objects the way you wnat them to be and select them. run the script and thats it…
hugs bern

1 Reply
(@bobo)
Joined: 10 months ago

Posts: 0

You could make it a macroScript so people do not have to Execute it each time…


 macroScript RandomMatSel category:"bernieLomax" 
 tooltip:"Assign unique materials to selected objects"
 (
  for i in selection do (
   i.material = standard ()
   i.material.name = i.name
   i.material.diffuse = random black white
  )--end i loop
 )--end script

Copy this into a new MAXScript editor, press Ctrl+E to evalute, then go to Customize > Customize UI… and drag the script from the “bernieLomax” category to a toolbar, menu, quad, or assign to a shortcut.

yes bobo “keep it simple and useful” that´s my model. i keep on forgetting about macroscripts…
thanks alot…
hugs bern

Thank you very much both of you, and many thanks Bobo for the macroscript, finally make it to work, just one more question, if i don´t want to put a random color, maybe a gray (128,128,128) replace as follows? :

i.material.diffuse = random black white ——>to this one:—–>

i.material.diffuse = color (128) (128) (128).

Thanks for the help and sorry for my english.

1 Reply
(@bobo)
Joined: 10 months ago

Posts: 0

That would work, although you don’t need the brackets:

 i.material.diffuse = color 128 128 128

Or you could write it shorter as

 i.material.diffuse = white/2

which is in fact color 127.5 127.5 127.5

many thanks Bobo, it works really well.
maybe i´ll learn more about Maxscript, it is really helpful.

while we’re talking about random colours, I use a script that ensures that the colours generated are not dark


 --------------------------------------------------------------------------------
 --	Random color
 --	version 1.0
 --	max version 6, 7, 8
 --	written by Joshua Newman
 --	josh@joshuanewman.net
 --	www.joshuanewman.net
 --	last updated 24/11/03
 --	copyright 2003
 --------------------------------------------------------------------------------
 -- creates a random wire colour that is never dark!
 fn gencolor=
 (
 	r=(random 0 255)
 	b=(random 0 255)
 	g=255-((r+b)/2)
 	return (color r g b)
 )
 

J.

Page 1 / 2