2005-02-1202:23 PM - last edited on 2023-05-2410:36 AM by Rubia Torres
2005-02-1202:23 PM
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.
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
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]