PDA

View Full Version : a litle help for everyone- Architecture visualization


bernieLomax
07-09-2006, 10:53 PM
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

Dmaxer
07-11-2006, 01:48 AM
Thanks bernieLomax, its simple but I would find this very usefull . but it seems not to work here ?.
Im running Max 8

gag35
07-11-2006, 03:54 PM
I'm running max8 to,and it works perfectly !!
very simple and useful, thank you

bernieLomax
07-12-2006, 11:56 PM
dmaxer, sorry but you have to select some objects for it to work....
can you post your error....
hugs bern

Bobo
07-13-2006, 04:28 AM
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

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.

arquiteck09
07-13-2006, 05:57 AM
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.

bernieLomax
07-13-2006, 03:23 PM
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

Bobo
07-13-2006, 03:37 PM
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

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.

bernieLomax
07-13-2006, 08:39 PM
yes bobo "keep it simple and useful" thatīs my model. i keep on forgetting about macroscripts...
thanks alot....
hugs bern

arquiteck09
07-13-2006, 08:45 PM
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.

Bobo
07-13-2006, 09:15 PM
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.

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

arquiteck09
07-13-2006, 10:01 PM
many thanks Bobo, it works really well.
maybe iīll learn more about Maxscript, it is really helpful. :thumbsup:

j-man
07-14-2006, 10:45 AM
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.

bernieLomax
07-14-2006, 09:04 PM
yeah...
thanks j
but for the values of the random color all you have to do is change them to a smaller (than 255) value and all the colors will be a lighter


hugs bern

CGTalk Moderation
07-14-2006, 09:04 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.