ScriptSpot

Forum topic · General Scripting

Problem script addModifier

By Mwa · 2012-04-01

Description

Hello Everyone! I'm encountering a problem with maxscript. Here it is:

for o in objects do for m in o.modifiers where classof m == Bend addModifier o (Squeeze())

As you can see this isn't a hard one but it doesn't work and something it makes 3ds max quit. It is because some of the objects don't have a bend modifier, so I have to use try()catch() but this fails as well.

All I want is to add the squeeze modifier on the selected objects that already has a bend modifier. Can you tell me where am I supposed to put the try/catch expression? The manual has too difficult examples that I don't get it. 😢

 

Thank you very much!

Comments (1)

barigazy · 2012-04-23

First you forgot "do" between "Bend" "addModifier".
Second your code is not correct. Better try this:
for o in objects where o.modifiers.count != 0 do
(
if (for m in o.modifiers where (classof m == Bend) collect m).count != 0 do addModifier o (Squeeze())
)