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

Modeling
About Archicad's design tools, element connections, modeling concepts, etc.
SOLVED!

Custom 2D Object

Nicholas Jones
Booster

Good day all,

 

It has occurred to me that being able to combine 2D symbols has a ton of useful applications, right now I have a set of 2D symbols for various sizes of bike rack from a manufacturer, I would like to create a single object with an option set that will allow me to change the symbol on the fly.

 

 

Similar to the 2D car or tree object included in the inbuilt libraries.  

 

I have nosed about the car object and can see the general idea for how it is achieved but I am hoping there might be a way to do it that won't require me to get that deep into GDL just yet.

 

If not, a starting point will be much appreciated, maybe it is time....

 

Many thanks!

 


Screenshot 2022-03-25 at 12.12.49.png
AC25 solo UK • 2017 MacBook Pro 15" 2.9GHz Quad-core i7 16 gb ram

OSX10.15.5
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
scottjm
Advisor

There are two simple ways you can do this with super basic GDL.

 

1. Place your 2d linework onto a separate layer in the 2D Symbol window.  Have a parameter with different options (Refer the steps 1&2 in @Jeff Griffin link). Then a simple if statement for each option to call a FRAGMENT2 for the relevant 2D symbol layer.    Something along these lines in your master code:

 

 

IF Plan_Symbol_Det = "Bikerack" THEN FRAGMENT2 1,0  !Shows only 2D Symbol Layer 1
IF Plan_Symbol_Det = "Tree" THEN FRAGMENT2 2,0      !Shows only 2D Symbol Layer 2

 

 

Refer: https://gdl.graphisoft.com/reference-guide/binary-2d

Get's a bit messy when you want to edit the linework of a symbol, but it's easy to do.

 

2. (As @SenecaDesignLLC suggested) Create an object for each 2D symbol (use the Save as Object.. function).  Make each of these objects un-placeable.  Have a parameter with the different options (Refer the steps 1&2 in @Jeff Griffin link).  Then a simple if statement for each option to perform a CALL function to the name of each object.  Something along these lines in your master code:

 

 

IF Plan_Symbol_Det = "Bikerack" THEN CALL "Bikerack_Symbol" PARAMETERS ALL
IF Plan_Symbol_Det = "Tree" THEN CALL "Tree_Symbol" PARAMETERS ALL​

 

 

Refer:https://gdl.graphisoft.com/reference-guide/macro-objects

This option is more difficult to modify the linework of each symbol as Archicad will convert all your linework into hundreds of lines of GDL when you use (Save as Object.. function), but keeps symbol better organised.

 

Tip - when you draw your symbol linework, do it at 0,0 origin.

 

Cheers,

Scott

Scott J. Moore | Fulton Trotter Architects | BIM Manager, Associate, Architect
Since AC13 | Current versions AC23.7000 & AC26.5002 | BIMCloud Basic | Python, GDL, VBA, PHP, SQL, CSS
Certified Graphisoft BIM Manger (2022)
Win 10, i9-9900K, 32GB, Quadro P2200, 500GB NVMe

View solution in original post

9 REPLIES 9

The gdl for something like this is super simple.

You need values for a parameter to specify which object you want, then in 2d if parameter equals the given name call the object

Super simple is encouraging,..

AC25 solo UK • 2017 MacBook Pro 15" 2.9GHz Quad-core i7 16 gb ram

OSX10.15.5

Hi Nicholas,

 

I bookmarked this page awhile ago, but haven't gotten around to trying it yet. I hope it helps! All credit goes to Patrick May!

https://sites.google.com/site/noscriptgdl/some-scripting-required/creating-multiple-2d-3d-views

iMac 27 (2020) 3.8 GHz Core i7; 128 GB RAM; Radeon Pro 5700 XT 16 GB GPU (macOS Sonoma)
MacBook Pro M1 Max; 64 GB RAM; 32-Core GPU (macOS Sonoma)
ArchiCAD 27/26/25 Full (latest builds). User since AC12 (2008).
Solution
scottjm
Advisor

There are two simple ways you can do this with super basic GDL.

 

1. Place your 2d linework onto a separate layer in the 2D Symbol window.  Have a parameter with different options (Refer the steps 1&2 in @Jeff Griffin link). Then a simple if statement for each option to call a FRAGMENT2 for the relevant 2D symbol layer.    Something along these lines in your master code:

 

 

IF Plan_Symbol_Det = "Bikerack" THEN FRAGMENT2 1,0  !Shows only 2D Symbol Layer 1
IF Plan_Symbol_Det = "Tree" THEN FRAGMENT2 2,0      !Shows only 2D Symbol Layer 2

 

 

Refer: https://gdl.graphisoft.com/reference-guide/binary-2d

Get's a bit messy when you want to edit the linework of a symbol, but it's easy to do.

 

2. (As @SenecaDesignLLC suggested) Create an object for each 2D symbol (use the Save as Object.. function).  Make each of these objects un-placeable.  Have a parameter with the different options (Refer the steps 1&2 in @Jeff Griffin link).  Then a simple if statement for each option to perform a CALL function to the name of each object.  Something along these lines in your master code:

 

 

IF Plan_Symbol_Det = "Bikerack" THEN CALL "Bikerack_Symbol" PARAMETERS ALL
IF Plan_Symbol_Det = "Tree" THEN CALL "Tree_Symbol" PARAMETERS ALL​

 

 

Refer:https://gdl.graphisoft.com/reference-guide/macro-objects

This option is more difficult to modify the linework of each symbol as Archicad will convert all your linework into hundreds of lines of GDL when you use (Save as Object.. function), but keeps symbol better organised.

 

Tip - when you draw your symbol linework, do it at 0,0 origin.

 

Cheers,

Scott

Scott J. Moore | Fulton Trotter Architects | BIM Manager, Associate, Architect
Since AC13 | Current versions AC23.7000 & AC26.5002 | BIMCloud Basic | Python, GDL, VBA, PHP, SQL, CSS
Certified Graphisoft BIM Manger (2022)
Win 10, i9-9900K, 32GB, Quadro P2200, 500GB NVMe

I think this should be:

 

IF Plan_Symbol_Det = "Tree" THEN FRAGMENT2 2,0 !Shows only 2D Symbol Layer 2

 

From the GDL Reference Guide:

FRAGMENT2 fragment_index, use_current_attributes_flag

 

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

I noticed that, too.

I have now corrected the script in scottjm's post.

Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac27
scottjm
Advisor

Whoops my bad. Was a bit too quick with my copy/paste. Thanks for fixing that @Laszlo Nagy   .

 

Cheers,

Scott

Scott J. Moore | Fulton Trotter Architects | BIM Manager, Associate, Architect
Since AC13 | Current versions AC23.7000 & AC26.5002 | BIMCloud Basic | Python, GDL, VBA, PHP, SQL, CSS
Certified Graphisoft BIM Manger (2022)
Win 10, i9-9900K, 32GB, Quadro P2200, 500GB NVMe

Awesome Scott !

 

thanks for this I will give it a try. 

AC25 solo UK • 2017 MacBook Pro 15" 2.9GHz Quad-core i7 16 gb ram

OSX10.15.5

Many thanks! this was just the sort of thing I was after.

AC25 solo UK • 2017 MacBook Pro 15" 2.9GHz Quad-core i7 16 gb ram

OSX10.15.5