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

GDL
About building parametric objects with GDL.

GDL object with option

needretail
Participant

I´m trying to make a object like "2 in 1". Want to be able to have an "on and off" function i.e. that you can chosse whether a part sholud be visible or not. How do I achieve this?

Apple M1 - AC26
7 REPLIES 7
cuba
Expert
Add a boolean parameter "switch" 
Replace the line text2.... by the part you want to show in option 1 and 2
 
2d script =
 
IF switch THEN
      text2 0,0,"switch = on"
  ELSE
      text2 0,0,"switch = off"
ENDIF
Apple M1 Max 32 GB Ventura
AC27
Barry Kelly
Moderator

@needretail 

You have labelled your post as "Library Part Maker".

I don't think library part maker can do this.

 

Or are you looking for a solution using Library Part Maker or are you just scripting in GDL.

Cuba has given you a solution for this.

 

Barry.

 

Also I moved this post to the GDL forum.

One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

Thanks for the answer! The object that u sent i couldnt open...? and I can´t find the line text2... in my script.

Could you pls give me more information?

Apple M1 - AC26

Which AC version are you using?

Replace the text2 line with your script.

Apple M1 Max 32 GB Ventura
AC27

Add a signature to your profile with things like your AC version and some basic computer info as some things maybe software or hardware specific. See link in mine for more info.

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

AC26

Apple M1 - AC26

What cuba was suggesting is to create a boolean parameter called "switch' or "show_object" - call it what you want.

Then in your 2D and/or 3D scripts you can say ...

 

IF switch = 1 THEN
      ........ !!add your object script here - it will run if the switch is on
  ELSE
      END !!this will show nothing when the switch is off
ENDIF

 

Barry.

One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11