cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
GDL
About building parametric objects with GDL.

INPUT TEXT I/O will never be -1

rudl
Booster

Read a lines with Text IO

Input will never be -1 -> infinite loop , no End of file


Part of the script below

aii = OPEN ("TEXT",i_pathnew,"SEPARATOR = '\n',MODE = RO,NEWLINE = LF,FULLPATH")

REPEAT
	IF y # -1 THEN ! BUG will never be -1 , no EOF
		y = INPUT (aii,i,1,a_impb[j][1]) : i=i+1
		y = INPUT (aii,i,1,a_impb[j][2]) : i=i+1
		y = INPUT (aii,i,1,a_impb[j][3]) : i=i+1
	ENDIF
 	j = j+1
	IF i > 40000 THEN
		PRINT "error no EOF"
		END
	ENDIF
UNTIL y = -1 ! ( OR i > 20000) quickfix to limit

 

3 REPLIES 3
rudl
Booster

Well there seems to be more that doesn't work with the text I/O

and it might be related:

IT finds and reads the file once it seems.
But still throws an error "can't find file" for every view I guess: sections / elevations...

My guess is closing the channel doesn't work?

 

Maybe i should not have everything in master or try to prevent executing/opening the chanel that often somehow.

But still there is something wrong.

This is on AC 27

Hi rudl,

 

One issue might be, that you could read past the EOF since you read 3 times before checking if y = -1.
But that's just a quick observation. Haven't tested it.

 

Best regards,
Bernd

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com
Jochen Suehlo
Moderator

Try to use the WHILE .. DO..  ENDWHILE instead of REPEAT, because WHILE checks the condition before it runs through the loop, REPEAT checks it after.
I always used the examples in the GDL Cookbook 3 as a template for my own routines and never had the issues you described.

Jochen Suehlo . AC12-29 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!