We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

GDL
About building parametric objects with GDL.
SOLVED!

GDL: User Input - "Can't Find Macro" - Return

Lingwisyer
Guru

Hi all,

 

I have a macro call in which the user can inser their own symbol objects, and I was wondering if there was a way to detect whether the inserted name exists so that I can ignore the input if it does not whilst giving a notice about it. At the moment it just fails to generate which is highly inconvenient.

 

 

Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Lingwisyer
Guru
@DGSketcher - Could you use OPEN to test for the file presence and use the return values followed by CLOSE?

Figured out how to use the text I/O to query if the file exists

 

channel = OPEN ("TEXT", marker_call, "library")

IF marker_call # "" & channel # -1 then		!Name inserted, name exists (actually > -1)
		MUL2 marker_height * (-10) * GLOB_SCALE, marker_height * 10 * GLOB_SCALE
			CALL marker_call parameters ALL,
					penAttribute_1		=	penAttribute_1,
					penAttribute_2		=	penAttribute_2,
					penAttribute_3		=	penAttribute_3,
					penAttribute_4		=	penAttribute_4,
					fillAttribute_1		=	fillAttribute_1,
					fillAttribute_2		=	fillAttribute_2,
					lineTypeAttribute_1	=	lineTypeAttribute_1,
					lineTypeAttribute_2	=	lineTypeAttribute_2
		DEL 1
		TEXT2	0,	0,	channel				
	else
		IF i = 1 then
			TEXT2	0,	0,	"Marker Name Not Found"
		endIF
endIF

 

 

 

Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660

View solution in original post

4 REPLIES 4
DGSketcher
Legend

Could you use OPEN to test for the file presence and use the return values followed by CLOSE?

Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)
folder = OPEN (called_object, "c:", "FILES")

Any idea how you would point that at the loaded libraries? 

 

Hm. Found Runxel's thread about this...

Similar thread

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660
Solution
Lingwisyer
Guru
@DGSketcher - Could you use OPEN to test for the file presence and use the return values followed by CLOSE?

Figured out how to use the text I/O to query if the file exists

 

channel = OPEN ("TEXT", marker_call, "library")

IF marker_call # "" & channel # -1 then		!Name inserted, name exists (actually > -1)
		MUL2 marker_height * (-10) * GLOB_SCALE, marker_height * 10 * GLOB_SCALE
			CALL marker_call parameters ALL,
					penAttribute_1		=	penAttribute_1,
					penAttribute_2		=	penAttribute_2,
					penAttribute_3		=	penAttribute_3,
					penAttribute_4		=	penAttribute_4,
					fillAttribute_1		=	fillAttribute_1,
					fillAttribute_2		=	fillAttribute_2,
					lineTypeAttribute_1	=	lineTypeAttribute_1,
					lineTypeAttribute_2	=	lineTypeAttribute_2
		DEL 1
		TEXT2	0,	0,	channel				
	else
		IF i = 1 then
			TEXT2	0,	0,	"Marker Name Not Found"
		endIF
endIF

 

 

 

Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660
Lingwisyer
Guru

Hm. The OPEN command does post around 80 lines to the Session Report saying that the file is not found which is a bit excessive...

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660