PDA

View Full Version : Turning of modifier all at once


pika
02-22-2004, 08:38 AM
Hello,

I've been unsuccessfull writing a Maxscript to turn off symmetry modifier on all the selected objects.

I tried something like this

$.symmetry.enabled = false

It works for just one obeject, but it does not work for all the
objects at once if each object has symmetry applied individually.

Thanks

Asgaard
02-22-2004, 02:37 PM
You have to loop through a specified set of Objects. (Selection, the whole scene, Geometry Class, etc.)

If you want to execute a action to all the selected Objects for example you would do this:

for obj in selection do
(
$.symmetry.enabled = false
)

Its a very simple example and lacks of a few things (error handling, check if the modifier is applied , etc...)

this one is a bit better:

for obj in geometry do
(
try
(
if obj.modifiers[#symmetry] != undefined then obj.modifiers[#symmetry].enabled = false
)
catch()
)

It loops through all your geometry objects and checks if a symmetry Modifiers i applied. If so, then it gets disabled. If an error occurs it will be catched and the next Object gets tested.

so long...

-Asgaard

pika
02-22-2004, 02:57 PM
That is great!;)

I am going to try that and see how it works.

Thanks

Bobo
02-22-2004, 06:06 PM
Originally posted by Asgaard


for obj in selection do
(
$.symmetry.enabled = false
)



-Asgaard

I am sure you meant something like

for obj in selection do
(
try(obj.symmetry.enabled = false)catch()
)

If any of the selected objects does not have symmetry applied, you would get an error you need to catch.

Asgaard
02-22-2004, 07:55 PM
Its a very simple example and lacks of a few things (error handling, check if the modifier is applied , etc...)

:)

pika
02-23-2004, 03:27 PM
for obj in selection do
(
try(obj.symmetry.enabled = false)catch()
)

Hello, I tried the scripts, but got the error below.

I used it in listener and also saved as .ms, then
ran it from the file, getting the same error.

am I supposed to declare some kind of function or
some sort before the scripts?

Thank you very much for your help.


-- Syntax error: at ), expected <factor>
-- In line: )

Asgaard
02-23-2004, 06:01 PM
Try [Max Script] --> "New Script" --> Paste the code and execute it (CTRL + E)

so long...

CGTalk Moderation
01-17-2006, 01:00 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.