2020-12-10 11:20 AM - last edited on 2021-09-15 09:26 AM by Noemi Balogh
Solved! Go to Solution.
2020-12-10 11:16 PM
parameters b = a*ratioif 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:
if glob_modpar_name = "a" then parameters b = a*(1/aRatio) endif if glob_modpar_name = "b" then parameters a = b*aRatio endifActually, 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 endifCoding like this will make the object respond without having to refresh the parameters.
2020-12-10 11:40 AM
2020-12-10 12:58 PM
DGSketcher wrote: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.
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.
2020-12-10 11:16 PM
parameters b = a*ratioif 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:
if glob_modpar_name = "a" then parameters b = a*(1/aRatio) endif if glob_modpar_name = "b" then parameters a = b*aRatio endifActually, 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 endifCoding like this will make the object respond without having to refresh the parameters.
2020-12-11 05:17 PM
Kristian wrote: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...
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*ratioif 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 endifActually, 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 endifCoding like this will make the object respond without having to refresh the parameters.
2020-12-13 11:16 PM
2020-12-14 08:14 AM
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.