2024-08-21 02:41 PM - last edited on 2024-08-26 12:50 AM by Laszlo Nagy
Hi gdl wizards.
Can anybody help create (Parameter) script that will adjust the values in a way that if parameter "xx" changes then parameter "f1" will change accordingly - and then if paramter "f1" changes parameter "xx" will update accordingly.
I know how to do this:
f1=ATN(xx)
PARAMETERS f1=f1
xx=TAN(f1)
PARAMETERS xx=xx
But in this case "f1" becomes locked!
I need both parameters to be able to control the other one, at any given time!
Hope the information is sufficient enough
Cheers
Thomas
Solved! Go to Solution.
2024-08-22 03:21 AM
Yes GLOB_MODPAR_NAME is your friend here.
I would not use ...
if GLOB_MODPAR_NAME = "xx" then
f1 = xx * 2
parameters f1 = f1
else
xx = f1 / 2
parameters xx = xx
endif
That will work but means if 'xx' is modified,' f1' will update, but if any other parameter is changed 'xx' will be updated.
If you don't want that and only want 'xx' to update when 'f1' is changed then just use separate routines ...
if GLOB_MODPAR_NAME = "xx" then
f1 = xx * 2
parameters f1 = f1
endif
if GLOB_MODPAR_NAME = "f1" then
xx = f1 / 2
parameters xx = xx
endif
Barry.
2024-08-21 03:26 PM
If you look at the section titled "Connections between parameters" on this page it should explain how to do it.
https://gdl.graphisoft.com/gdl-basics/parameter-logic
I've not tried it myself, but it looks as though you check the value of GLOB_MODPAR_NAME to see which parameter is being changed and act accordingly. This prevents it getting into a circular loop.
2024-08-22 03:20 AM - edited 2024-08-22 03:22 AM
IF GLOB_MODPAR_NAME = "A" then
B = xA
PARAMETERS B = B
endIF
IF GLOB_MODPAR_NAME = "B" then
A = B/x
PARAMETERS A = A
endIF
AC22-23 AUS 7000 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win10 | R5 2600 | 16GB | GTX1660 |
2024-08-22 03:21 AM
Yes GLOB_MODPAR_NAME is your friend here.
I would not use ...
if GLOB_MODPAR_NAME = "xx" then
f1 = xx * 2
parameters f1 = f1
else
xx = f1 / 2
parameters xx = xx
endif
That will work but means if 'xx' is modified,' f1' will update, but if any other parameter is changed 'xx' will be updated.
If you don't want that and only want 'xx' to update when 'f1' is changed then just use separate routines ...
if GLOB_MODPAR_NAME = "xx" then
f1 = xx * 2
parameters f1 = f1
endif
if GLOB_MODPAR_NAME = "f1" then
xx = f1 / 2
parameters xx = xx
endif
Barry.
2024-08-27 08:26 AM
Thanks Barry.
That did the trick. Much appreciated 🙂
2024-08-27 08:27 AM
Thanks for that fast reply Lingwisyer. 🙂