Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

Issue with APPLICATION_QUERY()

MetalFingerz
Advocate

Hello,

 

First of all, the new forum layout is terrible 🤢

 

Anyway, I'm having an issue with APPLICATION_QUERY() and I tried and tried solutions but to no avail so I come here for help. I have a MEP library part with two connections for water supply. I want to retrieve some info (pens, fills, surfaces) from the Systems list so I can have the piping coming out of it to look as it should.

 

As I do not know the index of the system, I need to retrieve it and then gets some of its info. Here's what I do :

 

DIM SYSTEM_2[][]
S1 = 0
S2 = 0

n1 = APPLICATION_QUERY ("MEPSYSTEM", "GetMEPSystems(2)", SYSTEM_2)

FOR i = 1 TO VARDIM2(SYSTEM_2)
	IF SYSTEM_2[1][i] = ConSystem_1 THEN S1 = SYSTEM_2[1][i-1]
	IF SYSTEM_2[1][i] = ConSystem_2 THEN S2 = SYSTEM_2[1][i-1]
NEXT i

n2 = APPLICATION_QUERY ("MEPSYSTEM", "GetSystemMaterial(S1)", MEPmaterial_1)
n3 = APPLICATION_QUERY ("MEPSYSTEM", "GetSystemMaterial(S2)", MEPmaterial_2)

 

(For this example, I do not check if the n are > 0)

So first query, I get all the piping systems ok. Second and third queries, I can't retrieve the SystemMaterial

 

For info, the GDL reference guide defines it that way : APPLICATION_QUERY (extension_name, parameter_string, variable1, variable2, ...) and it seems that I can't achieve what I want because the second argument of APPLICATION_QUERY() has to be a string so it is read literally and it cannot have a variable but then what's the point ? I can never know for sure the index of the System the user will be inputing so I cannot hardcode the index for GetSystemMaterial(). I tried to have the second argument without quotes but the whole query breaks then.

 

Any workaround ? It seems to be the only solution to retrieve this info 😭. Thanks.

 

Using AC24 on MacOS

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
kuvbur
Enthusiast

 

n2 = APPLICATION_QUERY ("MEPSYSTEM", "GetSystemMaterial(" + str("%.0", s1) + ")", MEPmaterial_1)

or

n2 = APPLICATION_QUERY ("MEPSYSTEM", "GetSystemMaterial(" + s1 + ")", MEPmaterial_1)

 

Structural engineer, developer of free addon for sync GDL param and properties

View solution in original post

2 REPLIES 2
Solution
kuvbur
Enthusiast

 

n2 = APPLICATION_QUERY ("MEPSYSTEM", "GetSystemMaterial(" + str("%.0", s1) + ")", MEPmaterial_1)

or

n2 = APPLICATION_QUERY ("MEPSYSTEM", "GetSystemMaterial(" + s1 + ")", MEPmaterial_1)

 

Structural engineer, developer of free addon for sync GDL param and properties

Hello @kuvbur ,

 

Thanks, I didn't think of concatenate it 😓