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

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

AC processes a subroutine placed after the END: tag. AC 8.1

Hubert Wagner
Participant
Hello:

I have a feeling I may have asked this question some time ago althought I can't find any record of it in the database.

I find AC will process a subroutine placed after the END: tag. This means I can't put a conditional branch in the main event.

I've written five door GDL which I attempted to combine into a single macro. It doesn't work because AC insists on running uncalled sub-routines.

Q: how do other users get around this problem.

Here is a simple example which illustrates the problem.

! 3D script
if first then
gosub 1
else
if second then
gosub 2
endif
endif

end:

1:
pen 10
circle 0.1
circle 0.05

2:
pen 1
circle 0.01

If both are false I get nothing.
If second is true and first is false, I get one circle, the correct one.
However, if first is true and second false, I get three circles which is incorrect.

Cordialement: DW
3 REPLIES 3
David Maudlin
Rockstar
Douglas:

You need to add a RETURN statement at the end of each subroutine, otherwise ArchiCAD doesn't know where the subroutine ends in order to return to the main event. You might find that looking at some of the objects that come with ArchiCAD helpful in catching these sort of organizational problems.

HTH

David
David Maudlin / Architect
www.davidmaudlin.com
Digital Architecture
AC27 USA • iMac 27" 4.0GHz Quad-core i7 OSX11 | 24 gb ram • MacBook Pro M3 Pro | 36 gb ram OSX14
Aussie John
Newcomer
Yes you need returns
Also depending on what your script is trying to do it is might be easier to write your script as

if first then gosub 1
if second then gosub 2
end

1: subroutine1
return
2: subroutine2
return

of course your script might require first to be not true before second occurs so ignore above
Cheers John
John Hyland : ARINA : www.arina.biz
User ver 4 to 12 - Jumped to v22 - so many options and settings!!!
OSX 10.15.6 [Catalina] : Archicad 22 : 15" MacBook Pro 2019
[/size]
David Collins
Advocate
Also, you might want to google up the online version of the GDL Cookbook. There's a good section there on subroutines.
David Collins

Win10 64bit Intel i7 6700 3.40 Ghz, 32 Gb RAM, GeForce RTX 3070
AC 27.0 (4001 INT FULL)