cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

GDL
About building parametric objects with GDL.
SOLVED!

Interconnected Parameters a=b and b=a

Thomas Nymann
Enthusiast

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

ASUS ROG I9 12900H 🙂 - RTX 3080ti (16GB) - 32 GB RAM - Ryzen 7 1700X 3,8GHz. - GTX 1080ti 11 GB- 16GB RAM
AC 13 +
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Barry Kelly
Moderator

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.

One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

View solution in original post

5 REPLIES 5
neilmcallister
Booster

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.

Archicad 26 / Windows 11
Lingwisyer
Guru
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 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660
Solution
Barry Kelly
Moderator

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.

One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Thomas Nymann
Enthusiast

Thanks Barry.

 

That did the trick. Much appreciated 🙂

ASUS ROG I9 12900H 🙂 - RTX 3080ti (16GB) - 32 GB RAM - Ryzen 7 1700X 3,8GHz. - GTX 1080ti 11 GB- 16GB RAM
AC 13 +

Thanks for that fast reply Lingwisyer. 🙂

ASUS ROG I9 12900H 🙂 - RTX 3080ti (16GB) - 32 GB RAM - Ryzen 7 1700X 3,8GHz. - GTX 1080ti 11 GB- 16GB RAM
AC 13 +