2022-12-14 07:00 AM - edited 2022-12-14 11:56 AM
This is only a simplified example.
I need modify a second parameter if a first parameter changes.
I used this code:
IF GLOB_MODPAR_NAME = "k" THEN PARAMETERS a = a*2 ENDIF
to create a simple rectangle
The problem comes when I make changes on multiple objects.
The Parameter "A" of the last object selected will be applied to all the objects.
I checked "Run the parameter script only once"
I'd like to have the parameter "A" modified independently.
Attached the example object.
Solved! Go to Solution.
2022-12-14 07:52 AM
Firstly you should probably script it like this.
IF GLOB_MODPAR_NAME = "k" THEN a = a*2 PARAMETERS a = a ENDIF
a = a*2 will change the value of 'a' used in the scripts.
PARAMETERS a = a*2 will change the value of the parameter in the parameter list, but not necessarily the value of 'a' in the scripts, until the scripts are run again and they get the new value from the parameter list.
I don't quite understand it all but it is a good practice to follow.
The scripts are all run multiple times and setting the parameter script to run only once will have no impact on this.
Not that it will make a difference to what you want to do.
As you have multiple objects selected, even with different 'a' values, your script is telling it to change the 'a' parameter by doubling it.
Because they are all selected together, they will all change to the same 'a' value as the object settings that you are changing - as if you typed in the value for 'a' yourself.
This works fine when you have only one object selected.
But when you have multiple, you are effectively re-setting them all to the same 'a' value.
I am not quite sure how you would get around this.
2022-12-14 08:15 AM
Given that you are not using an IF statement after, would this not end up inconsistant as even if you select the parameter, then use the same input, it will double...?
|AC22-23 AUS 7000||Help Those Help You - Add a Signature|
|Self-taught, bend it till it breaks||Creating a Thread|
|Win10 | R5 2600 | 16GB | GTX1660|
2022-12-14 10:51 AM - edited 2022-12-14 12:23 PM
The logic is quite simple. A or any other parameter cannot be independently set in each object in a multiple selection. Changing a Parameter either directly or by script will be set to the same value across all selected objects.
2023-01-02 09:44 AM
Thank you @DGSketcher
I understood the logic of these behavior.
I solved creating independent parameters.