Notifications
Clear all

[Closed] renaming autocad layers

Wouldn’t a case expression be a tad cleaner instead of that many if expressions?

Hi,
What you are looking for is the matchpattern function. Look it up the maxscript help

if matchpattern o.name pattern:"*LP*" do (...something...)
 em3

That’s it!!

Thanks for all your help guys (and gals?)

final script:


(
Objs = for o in objects collect o
 
for o in Objs do
(
if matchpattern o.name pattern:"*LP*" do
( 
o.material = meditMaterials[1]
ConvertTo o Editable_Poly
)
if matchpattern o.name pattern:"*HP*" do
( 
o.material = meditMaterials[2]
ConvertTo o Editable_Poly
)
)
)

Page 2 / 2