GDL
About building parametric objects with GDL.

Working with TXT files and CUSTOM parameters

jakubc7
Advocate
I have spent some time trying to get my object to read an external text file to draw it's parameter values.
I finally got it working and then went to add an option to have a CUSTOM parameters that user can input through the UI using A and B values.

This seems much harder to achieve that I expected. Suddenly I realise that it's not that straight forward to write my custom values without using a text file.

I tried to write something like this:
IF use_custom THEN
EXECUTE ALTERNATIVE CODE
END
ENDIF

This kind of does the trick but now because I "END" the code prior to the object reading the remaining parameters, all my USER INTERFACE code is invalid and UI disappears when use_custom = 1

Turn back use_custom = 0 and I'm good again.

Can anyone suggest a way to do what I am trying to achieve ... I am not all that happy with my use_custom command so alternatives would be much appreciated.

Object attached. Thanks for your help.
ArchiCAD 10 - 25 | Windows 10
ARCHIcreate | Perth, Western Australia
archicad solutions | content creation | training | software implementation
7 REPLIES 7
Barry Kelly
Moderator
I haven't had a look at what you are doing, but if you don't want to END the script you can always ...

GOTO 999999

And then just add a line 999999 at the end of the script (or where ever you want it to jump to).


Barry.
One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
jakubc7
Advocate
Thanks Berry. I couldn't get GOTO "line number" to work but I did try the GOTO "SUB" to skip code.
Turns out I had another issue which I managed to fix now.

I would normally post my own resolution but it's nothing to do with my initial query so will give it a miss.
Thanks for your help as always
ArchiCAD 10 - 25 | Windows 10
ARCHIcreate | Perth, Western Australia
archicad solutions | content creation | training | software implementation
Barry Kelly
Moderator
jakubc7 wrote:
I couldn't get GOTO "line number" to work

Make sure you have the correct syntax for the line number (number and colon).
GOTO 999999

!!other code here

999999:      !!skip to here

Barry.
One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
jakubc7
Advocate
I see, makes sense.
I thought you were literally specifying and jumping to a specific code line number.
ArchiCAD 10 - 25 | Windows 10
ARCHIcreate | Perth, Western Australia
archicad solutions | content creation | training | software implementation
Lingwisyer
Guru
GOto is essentially a GOsub without the ability to return

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win10 | R5 2600 | 16GB | GTX1660 
Peter Baksa
Graphisoft
Graphisoft
The need for the goto is because an END statement in the master script blocks the running of other scripts too.
Another important thing is that GDL subroutines aren't like functions in other languages: the subroutine name is just a label that can be jumped to, but it can execute without a gosub if a line-to-line execution reaches it. That's why in 2d/3d/etc scripts we have to write an END statement before the first subroutine. In a master script this has to be done differently:
code
...
goto "masterEnd"

"subroutine":
    ! only executed with gosub, can be called from other scripts too
    ...
return

"masterEnd":
! last line of master script, execution continues in other scripts
Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest
jakubc7
Advocate
Thanks Peter. I never knew the difference between the 2 commands. Good to know that GOSUB can be called from other scripts!
ArchiCAD 10 - 25 | Windows 10
ARCHIcreate | Perth, Western Australia
archicad solutions | content creation | training | software implementation