GDL
About building parametric objects with GDL.
SOLVED!

Using returned request parameters in IF statements

Anonymous
Not applicable
Hi

I am currently trying to develop an door and window marker to display a particular manufacturers code dependent on size, window type and transom location. I have successfully managed to return the information and display it via a text box however I cant manage to utilize the information to set my own predefined parameters.

In the below the text2 command shows the correct boolean response however I cant use it to define the "T_Widotrans_Code" text parameter

I am also trying a similar process to call the name of the window and define a code with similar levels of success

Is there something I'm missing.... its driving me Bonkers

!!!! MASTER SCRIPT !!!!

val_TSOM=0

!!!! 2D SCRIPT !!!!

t=REQUEST("ASSOCLP_PARVALUE","gs_LTrans",trans_name,type_T,flag_T,dim1,dim2,val_TSOM)
TEXT2 0,0,val_TSOM

!!!! PARAMTER SCRIPT !!!!

IF val_TSOM=0 THEN PARAMETERS T_Widotrans_Code = "" ELSE: PARAMETERS T_Widotrans_Code = "T" :ENDIF
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Nader Belal
Mentor
@MICHAEL ISERIEF

Using requests or any of their versions, and I quote from ArchiCAD's 23 GDL Reference Guide
Compatibility up to ARCHICAD 19: The use of most requests in parameter scripts (or master scripts run as parameter script) could result in unreliable returned values.


copied from REQUEST OPTIONS > Request Parameter Script Compatibility > Page 481

ie: it means, that using request in Parameter Script or in Master Script were it's part of the script is being interpreted as Parameter Script will cause trouble

Which I see that you have managed to avoid ...

1. Read the manual's GDL styling ... and start by adding spaces for god's sake, you're not saving bytes on your storage device worth considering and you're making reading the script a lot harder on everybody including yourself.

2. I would have solved this in another way ... starting in the Master Script:
delete val_TSOM = 0

The reason is that Master Script although is the first script to run, you can not detect successfully if it would run again after the the execution of Parameter Script or the UI Script, so it will be as if you have set "val_TSOM = 0" as preferential value.

3. "2D Script", I would have added the following line in blue:
t = REQUEST ("ASSOCLP_PARVALUE", "gs_LTrans", trans_name, type_T, flag_T, dim1, dim2, val_TSOM)

val_TSOM = val_TSOM

TEXT2 0,0,val_TSOM

That way, you have consolidated "val_TSOM" variable value in memory.

4. Modify the parameter script to Graphisoft's styling and leave it as it is.

Try it out and comment
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.

View solution in original post

6 REPLIES 6
Anonymous
Not applicable
Did you try to put the REQUEST on the Master Script? Or even in the Parameter Script?
Hope this helps.
Solution
Nader Belal
Mentor
@MICHAEL ISERIEF

Using requests or any of their versions, and I quote from ArchiCAD's 23 GDL Reference Guide
Compatibility up to ARCHICAD 19: The use of most requests in parameter scripts (or master scripts run as parameter script) could result in unreliable returned values.


copied from REQUEST OPTIONS > Request Parameter Script Compatibility > Page 481

ie: it means, that using request in Parameter Script or in Master Script were it's part of the script is being interpreted as Parameter Script will cause trouble

Which I see that you have managed to avoid ...

1. Read the manual's GDL styling ... and start by adding spaces for god's sake, you're not saving bytes on your storage device worth considering and you're making reading the script a lot harder on everybody including yourself.

2. I would have solved this in another way ... starting in the Master Script:
delete val_TSOM = 0

The reason is that Master Script although is the first script to run, you can not detect successfully if it would run again after the the execution of Parameter Script or the UI Script, so it will be as if you have set "val_TSOM = 0" as preferential value.

3. "2D Script", I would have added the following line in blue:
t = REQUEST ("ASSOCLP_PARVALUE", "gs_LTrans", trans_name, type_T, flag_T, dim1, dim2, val_TSOM)

val_TSOM = val_TSOM

TEXT2 0,0,val_TSOM

That way, you have consolidated "val_TSOM" variable value in memory.

4. Modify the parameter script to Graphisoft's styling and leave it as it is.

Try it out and comment
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.
Peter Baksa
Graphisoft
Graphisoft
Why do you need to change the marker's parameters? Could they be variables instead?

PS. Regarding Moonlight's recommendations I think val_TSOM = 0 is perfect in the master script, the master script isn't executed after any script, only before. It needs to be initialized before the request, for the case the request fails.
Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest
Anonymous
Not applicable
1. Read the manual's GDL styling ... and start by adding spaces for god's sake, you're not saving bytes on your storage device worth considering and you're making reading the script a lot harder on everybody including yourself.
Yeah, sorry about that, I'm a bit of a novice regarding this and I'm usually the only one reading these scripts. Let me know if the below is a bit easier to read.

t=REQUEST("ASSOCLP_PARVALUE","gs_LTrans",trans_name,type_T,flag_T,dim1,dim2,bTsom)

bTsom = bTsom

IF bTsom=0 THEN
stTransCode = ""
ELSE
stTransCode = "T"
ENDIF

TEXT2 0,0,bTsom
TEXT2 0,-.5,stTransCode
PS. Regarding Moonlight's recommendations I think val_TSOM = 0 is perfect in the master script, the master script isn't executed after any script, only before. It needs to be initialized before the request, for the case the request fails.
Thanks Peter, you were certainly correct about the val_TSOM (now bTsom per moonlights comments) I was getting an uninitialized variable warning without it.

Also the using variables instead of parameters was a lot easier (I was still having issues using the string parameter I had set up for some reason)

The script works "perfectly" now (as far as I will ever know anyway lol).
Anonymous
Not applicable
Braza wrote:
Did you try to put the REQUEST on the Master Script? Or even in the Parameter Script?
Moonlight wrote:
copied from REQUEST OPTIONS > Request Parameter Script Compatibility > Page 481
ie: it means, that using request in Parameter Script or in Master Script were it's part of the script is being interpreted as Parameter Script will cause trouble
My bad.
Perhaps my GDL kung fu is kind of "freestyle".
Thanks guys for the info.
Moonlight wrote:
@MICHAEL ISERIEF

Using requests or any of their versions, and I quote from ArchiCAD's 23 GDL Reference Guide
Compatibility up to ARCHICAD 19: The use of most requests in parameter scripts (or master scripts run as parameter script) could result in unreliable returned values.


copied from REQUEST OPTIONS > Request Parameter Script Compatibility > Page 481

ie: it means, that using request in Parameter Script or in Master Script were it's part of the script is being interpreted as Parameter Script will cause trouble


ASSOCLP_PARVALUE is ok to use in the parameter and master script, check page 482.
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