BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
GDL
About building parametric objects with GDL.
SOLVED!

Lock or constraint A/B defaults?

Mats_Knutsson
Advisor
Hi,
LOCK ALL under paramters lock everything.
Say I want to lock only A size or constrint A/B size. Whaddoido?
AC 25 SWE Full

HP Zbook Fury 15,6 G8. 32 GB RAM. Nvidia RTX A3000.
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Hi Mats,

Is one of the values (a, b) the determining factor or do you want them both to be editable. If so do this:

parameters b = a*ratio
if you want them both to be determining factors then you need to use the glob_modpar_name to determine which parameter is being edited, like this:
lets first assume the ratio of a:b is 5:3 therefore
aRatio = 5/3
bRatio = 3/5 or 1/aRatio

if glob_modpar_name = "a" then
        parameters b = a*(1/aRatio)
endif
if glob_modpar_name = "b" then
        parameters a = b*aRatio
endif
Actually, to make sure the response is instantaneous you should establish the value in a local value before sending it to the actual parameter. So the script should read:

if glob_modpar_name = "a" then
        b = a*(1/aRatio)
        parameters b = b
endif
if glob_modpar_name = "b" then
        a = b*aRatio
        parameters a = a
endif
Coding like this will make the object respond without having to refresh the parameters.
Creator of Cadswift's parametric GDL libraries
Creator of Infinite Openings and Component Catalogues
Push the envelope & watch it bend
website: https://cadswift.com.au/
YouTube: https://www.youtube.com/user/CADSwift/playlists

View solution in original post

6 REPLIES 6
DGSketcher
Legend
Does Lock "Parameter Name" not work for you?

http://gdl.graphisoft.com/reference-guide/the-parameter-script#LOCK_gdlcommand

You can also Hide the parameters so users can't enter different values.
Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)
Mats_Knutsson
Advisor
DGSketcher wrote:
Does Lock "Parameter Name" not work for you?

http://gdl.graphisoft.com/reference-guide/the-parameter-script#LOCK_gdlcommand

You can also Hide the parameters so users can't enter different values.
Haha...I'm so daft. I figured the quotation marks was just for "put your name here" since ALL was written without quotation marks. Then all isa fine but locking the A/B ratio...i e I want to be able to resize but not distort.
AC 25 SWE Full

HP Zbook Fury 15,6 G8. 32 GB RAM. Nvidia RTX A3000.
Solution
Hi Mats,

Is one of the values (a, b) the determining factor or do you want them both to be editable. If so do this:

parameters b = a*ratio
if you want them both to be determining factors then you need to use the glob_modpar_name to determine which parameter is being edited, like this:
lets first assume the ratio of a:b is 5:3 therefore
aRatio = 5/3
bRatio = 3/5 or 1/aRatio

if glob_modpar_name = "a" then
        parameters b = a*(1/aRatio)
endif
if glob_modpar_name = "b" then
        parameters a = b*aRatio
endif
Actually, to make sure the response is instantaneous you should establish the value in a local value before sending it to the actual parameter. So the script should read:

if glob_modpar_name = "a" then
        b = a*(1/aRatio)
        parameters b = b
endif
if glob_modpar_name = "b" then
        a = b*aRatio
        parameters a = a
endif
Coding like this will make the object respond without having to refresh the parameters.
Creator of Cadswift's parametric GDL libraries
Creator of Infinite Openings and Component Catalogues
Push the envelope & watch it bend
website: https://cadswift.com.au/
YouTube: https://www.youtube.com/user/CADSwift/playlists
Mats_Knutsson
Advisor
Kristian wrote:
Hi Mats,

Is one of the values (a, b) the determining factor or do you want them both to be editable. If so do this:

parameters b = a*ratio
if you want them both to be determining factors then you need to use the glob_modpar_name to determine which parameter is being edited, like this:
lets first assume the ratio of a:b is 5:3 therefore
aRatio = 5/3
bRatio = 3/5 or 1/aRatio

if glob_modpar_name = "a" then
        parameters b = a*(1/aRatio)
endif
if glob_modpar_name = "b" then
        parameters a = b*aRatio
endif
Actually, to make sure the response is instantaneous you should establish the value in a local value before sending it to the actual parameter. So the script should read:

if glob_modpar_name = "a" then
        b = a*(1/aRatio)
        parameters b = b
endif
if glob_modpar_name = "b" then
        a = b*aRatio
        parameters a = a
endif
Coding like this will make the object respond without having to refresh the parameters.
Hi Kristian and thanks! I'll put that in my code. I should buy some hours of GDL-training from you. I dabble with softer stuff like a 2D (yeah...) like: a 2D-tree symbol made only to look nice. I'm working on a 3D-tree and I will try to implement this 2D together with renovation filter control as well...
AC 25 SWE Full

HP Zbook Fury 15,6 G8. 32 GB RAM. Nvidia RTX A3000.
That is a really nice looking 2D tree symbol.
I'd be more than happy to give you some GDL training if there are specific things you want to learn. However, if you just have simple questions, like this topic, I am always happy to answer them free of charge.
Creator of Cadswift's parametric GDL libraries
Creator of Infinite Openings and Component Catalogues
Push the envelope & watch it bend
website: https://cadswift.com.au/
YouTube: https://www.youtube.com/user/CADSwift/playlists
Mats_Knutsson
Advisor
Kristian wrote:
That is a really nice looking 2D tree symbol.
I'd be more than happy to give you some GDL training if there are specific things you want to learn. However, if you just have simple questions, like this topic, I am always happy to answer them free of charge.
AC 25 SWE Full

HP Zbook Fury 15,6 G8. 32 GB RAM. Nvidia RTX A3000.
Learn and get certified!

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!