Wishes
Post your wishes about Graphisoft products: Archicad, BIMx, BIMcloud, and DDScad.

Request if Object/Macro exists

runxel
Legend
We can already do "APPLICATION_QUERY"s, but for images only.
I think we need also a way to check if an object exists. If it's not there, scripters could do a sensible replacement and prevent the whole object from failing.
Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»
13 REPLIES 13
Anonymous
Not applicable
I recall dealing with this a long time ago...
If I remember well, I managed to do this with requesting folder names in the loaded library and file I/O operations.
Hope this helps.
runxel
Legend
Braza wrote:
I recall dealing with this a long time ago...
If I remember well, I managed to do this with requesting folder names in the loaded library and file I/O operations.
Hope this helps.
Good hint, Braza!
How do you request the loaded folder names?
The FileMan I/O addon as far as I can tell only works with "physical" places – not with the embedded library e.g.

But in the end I think this wish is still valid. GDL consists of more workarounds then productivity features – Nobody can reasonably explain why something works, but only for a certain type?...
It's always the same: consistency is key.
Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»
Anonymous
Not applicable
You are welcome runxel

I did a check the GDL reference manual (page 254) and actually there has been some new great improvements since my hard days of GDL coding... Its a new command called FILE_DEPENDENCE. Here it is:
EXTERNAL FILE DEPENDENCE
FILE_DEPENDENCE
FILE_DEPENDENCE "name1" [, "name2", ...]
You can give a list of external files on which your GDL script depends on. File names should be constant strings.
All files specified here will be included in the archive project (like constant macro names used in CALL statements and constant picture names
used in various GDL commands). The command works on this level only: if the specified files are library parts, their called macro files will
not be included.
The command can be useful in cases when external files are referenced at custom places in the GDL script, for example: ADDITIONAL_DATA
file parameters, data files in file operations.
Cheers,
runxel
Legend
Braza wrote:
Its a new command called FILE_DEPENDENCE.
This, .. uhm... doesn't help me at all.
It only tells Archicad to include files into the .pla, but I don't care for that (or well, I do, but not right now).

To make it more clear: My case is not that I call a macro that I have written – instead the user shall provide his own macros (I'm not the end user...) which then get utilized by my object.
This means: I really need to know, if the macro name the user has set is valid, since otherwise the whole object will fail. If I know, that the name is not valid, I can then prevent the calling of the macro.
Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»
Anonymous
Not applicable
Ok. I got your point.
Then: Why not letting the end user define the name of the macro as a string parameter?
runxel
Legend
Braza wrote:
Ok. I got your point.
Then: Why not letting the end user define the name of the macro as a string parameter?
Well, that is my intention.
The goal is a nice and well-thought UI/UX.
See, if the provided string is wrong, because, well, mistakes happen, I want to prevent the whole object from failing, because this makes for a bad UX – the user might not know that they typed the name in wrongly.

Or a different case I'm actually working one:
There are multiple macros to be used. Now, I will deliver some basic macros along the main object. But I want to give the user the possibility to use their own macros.
I could now say: okay, here is a big list of all macros, give me your own name for each of them. But not only this would be rather cumbersome, it also doesn't work, since there are endless ways of new macros (the list isn't finite, the macro names itself are generated on-the-fly....).
So, if such an edge case appears, I somehow need to circumvent the failing of the object and instead use some kind of generic placeholder, so it's clear to the user: "Help, I need a special macro here!"
Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»
Anonymous
Not applicable
Ok...
Long shot here: Did you try IES?
GDL wrote:
Ies files
n = APPLICATION_QUERY ("LIBRARY_MANAGER", "IES_FILES", ies_files_list)
This command returns the list of file names with .ies extensions loaded with the active libraries.
Try exchanging "IES_FILES" for "GSM_FILES" and storing it in "gsm_files_list"?
runxel
Legend
Braza wrote:

Try exchanging "IES_FILES" for "GSM_FILES" and storing it in "gsm_files_list"? :idea:
Yeah but that is the feature I want. Right now that doesn't work 😉
Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»
Anonymous
Not applicable
Ok... Last idea that come to my mind: Instead of letting the user define countless macro names, you could let the user enter a single macro folder location (c:MyProject/Macros) and use this location for a File Manager I/O add-on operation.
GDL wrote:
GDL FILE MANAGER I/O ADD-ON
The GDL File Manager In-Out Add-On allows you to scan a folder for the contained files/subfolders from a GDL script.
Specify the folder you would like to scan by using the OPEN command.
Get the first/next file/folder name in the specified folder by using the INPUT command.
Finish folder scanning by using the CLOSE command.
Hope this helps.