Turning of modifier all at once


#1

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


#2

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


#3

That is great!:wink:

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

Thanks


#4

Originally posted by Asgaard
[B]


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



-Asgaard [/B]

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.


#5

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

:slight_smile:


#6

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: )


#7

Try [Max Script] --> “New Script” --> Paste the code and execute it (CTRL + E)

so long…


#8

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.