The Global Archicad Community

Stay informed. Get help. Share your knowledge.

Topics specific to the scripting and development of Library Parts and Libraries using Param-O or the Geometric Description Language – GDL. (Example: How do you use “REQUEST” GDL commands?)

Moderators: Karl Ottenstein, LaszloNagy, ejrolon, Barry Kelly, Gordana Radonic, nbalogh, mnguyen, gkmethy, rmasaki, Akos Somorjai, Csilla Mai, Peter Baksa

User avatar
By Mats_Knutsson
#320484
Hi,
I have 2D-symbols controlled by renovation status but I seem not able to do the same in 3D!?

This is my MASTERSCRIPT:
Code: Select all
renoStatus = ""
_r = APPLICATION_QUERY ("OwnCustomParameters", "GetParameter(Renovation.RenovationStatus)", renoStatus)
pen 1

This is my 2D (just an example):
if renoStatus = "Existing" then RECT2 0,0,10,10 
if renoStatus = "New" then CIRCLE2 0,0,10
if renoStatus = "To Be Demolished" then LINE2 0,0,10,10

I tried various if-then-gosubs etc in 3D but didn't get it to work at all:
if renoStatus = "Existing" gosub 100:
if renoStatus = "New" gosub 200: 
if renoStatus = "To Be Demolished" gosub 300:
END
100:
BLOCK 100,100,100
RETURN
200:
CYLIND 100,20
RETURN
300:
SPHERE 50
RETURN
Any clever clue?
Cheers,
Mats
By A. Smith
#320489
Mats_Knutsson wrote: Mon Dec 21, 2020 4:04 pm
Code: Select all
renoStatus = ""
_r = APPLICATION_QUERY ("OwnCustomParameters", "GetParameter(Renovation.RenovationStatus)", renoStatus)
pen 1

This is my 2D (just an example):
if renoStatus = "Existing" then RECT2 0,0,10,10 
if renoStatus = "New" then CIRCLE2 0,0,10
if renoStatus = "To Be Demolished" then LINE2 0,0,10,10

I tried various if-then-gosubs etc in 3D but didn't get it to work at all:
if renoStatus = "Existing" [color=#FF0000]THEN[/color] gosub 100: !you don't need that colon here, unless you want to add code in a same row
if renoStatus = "New" [color=#FF0000]THEN[/color] gosub 200: 
if renoStatus = "To Be Demolished" [color=#FF0000]THEN[/color] gosub 300:
END
100:
BLOCK 100,100,100
RETURN
200:
CYLIND 100,20
RETURN
300:
SPHERE 50
RETURN

i didn't try if it works, but i see you're missing then....
User avatar
By Peter Baksa
#320742
This query doesn't work in 3D, we will update the manual.

As a habit, always check the return value of REQUEST, LIBRARYGLOBAL, APPLICATION_QUERY commands, there might be more complex situations where a piece of information can't be read.
User avatar
By Mats_Knutsson
#320750
Peter Baksa wrote: Tue Jan 05, 2021 9:57 am This query doesn't work in 3D, we will update the manual.

As a habit, always check the return value of REQUEST, LIBRARYGLOBAL, APPLICATION_QUERY commands, there might be more complex situations where a piece of information can't be read.
Hi Peter,
Doesn't work as in impossible? Can I solve this another way? Like creating a dummy variable getting its values from the 2D-enabled query? Thing is our landscaping department is growing like crazy and if they are going to use Archicad more in the future we need some basic things like this... existing tree, to be demolisherdtree, new tree etc. It would be nice to use Renovation filters for this.
Br,
Mats
User avatar
By runxel
#320752
Peter Baksa wrote: Tue Jan 05, 2021 9:57 am This query doesn't work in 3D, we will update the manual.
:|
Mh excuse me?

How about rather updating your software and make things work? GDL has become a nightmare and inconsistent mess. :evil:
User avatar
By Peter Baksa
#320777
Sorry, my communication was lazy. I notified product managment about this wish. The problem isn't renovation-specific, the "OwnCustomParameters"/"ParentCustomParameters" queries don't work in 3D, which we can't fix in the next release, so a note will be added to the manual.
The availability of REQUEST and APPLICATION_QUERY results are beyond GDL, often an optimization/speed/teamwork issue is involved when something isn't available. I understand it would be nice if GDL objects could modify their model based on the renovation status, but that would go against the filter concept.

What are you trying to do in 3D that is renovation status-specific?

There is no other way currently to get the renovation status in GDL, but there may be a workaround.
Labels placed on sections/elevations are executed as 2D, they can access the labelled element's renovation status with "ParentCustomParameters". Labels can draw too, but their positioning is not done by AC. If you want to draw at the position where the label was placed, the user has to turn off the pointer (this can't be done by GDL). At the beginning of the script, use this transformation to move the origin to the place of the click:
Code: Select all
add2 LABEL_POSITION[2][1] + LABEL_POSITION[3][1],
     LABEL_POSITION[2][2] + LABEL_POSITION[3][2]