Wishes forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Request if Object/Macro exists

runxel
Mentor
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.
AC 24 [ger] | Win 10 | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»
11 REPLIES 11

Braza
Newcomer
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.
Paulo Henrique Santos, Architect
AC24_INT#3008 / I7 / 16Gb / 512Mb SSD / Windows 10

runxel
Mentor
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.
AC 24 [ger] | Win 10 | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»

Braza
Newcomer
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,
Paulo Henrique Santos, Architect
AC24_INT#3008 / I7 / 16Gb / 512Mb SSD / Windows 10

runxel
Mentor
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.
AC 24 [ger] | Win 10 | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»

Braza
Newcomer
Ok. I got your point.
Then: Why not letting the end user define the name of the macro as a string parameter?
Paulo Henrique Santos, Architect
AC24_INT#3008 / I7 / 16Gb / 512Mb SSD / Windows 10

runxel
Mentor
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!"
AC 24 [ger] | Win 10 | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»

Braza
Newcomer
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"?
Paulo Henrique Santos, Architect
AC24_INT#3008 / I7 / 16Gb / 512Mb SSD / Windows 10

runxel
Mentor
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 😉
AC 24 [ger] | Win 10 | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»

Braza
Newcomer
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.
Paulo Henrique Santos, Architect
AC24_INT#3008 / I7 / 16Gb / 512Mb SSD / Windows 10

runxel
Mentor
Thanks Braza, you're so sweet for always having another idea!
AC 24 [ger] | Win 10 | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»

Braza
Newcomer
"Ideas" is my middle name!
Always welcome runxel.
Cheers,
Paulo Henrique Santos, Architect
AC24_INT#3008 / I7 / 16Gb / 512Mb SSD / Windows 10

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!