The sequence of lines does not work

Hello
I have a problem with enabling and disabling the same operation using Railclone's example.
Using the example of this code, it is necessary for the geometry to be displayed in the viewport, but the auto update checkbox was disabled.
Example:

viewArr=(for obj in objects where classof obj.baseObject==RailClone_Pro and not obj.isHiddenInVpt collect obj)
for i in viewArr as array do
(
	i.autoUpdate=on
	i.disabled=off
)
for i in viewArr as array do
(
	i.autoUpdate=off
)

When adding code to an interface, the operation is not complete. Geometry is not displayed in the viewport.
Example:

on btn_1 pressed do
(
	viewArr=(for obj in objects where classof obj.baseObject==RailClone_Pro and not obj.isHiddenInVpt collect obj)
	for i in viewArr as array do
	(
		i.autoUpdate=on
		i.disabled=off
	)
	for i in viewArr as array do
	(
		i.autoUpdate=off
	)
)

The sequence of lines does not work:

i.autoUpdate=on
i.autoUpdate=off

What could be the problem?
Any help appreciated.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Igryl9l's picture

A similar problem

It looks like the problem occurs when enabling/disabling the same operation in one action.
Here is an example of vertical alignment of the camera:

$.lens_tilt_auto = on
$.lens_tilt_auto = off

When we need to enable/disable "Auto guess vert tilt" in one action and get as a result the generation of numbers for "Vertical tilt"
In this code, the last line will be executed, the first will be skipped.

Any ideas how to get around this?

miauu's picture

.

Why do you use two for loops?
I don't have railClone, but try this:

(
	max modify mode
	for i in viewArr as array do
	(
		select i
		i.autoUpdate=on
		i.disabled=off
		i.autoUpdate=off
	)
)
Igryl9l's picture

Does not work

With a single loop, geometry generation in the viewport is skipped.
Also in my scene there is a large number of RailClone and to choose each one does not suit me.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.