Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 
Developer forum

PEN Colour

GDL Enthusiast

Hi GDL Experts,


Pens that change depending on the users pen pallet. It is a real hassle to have to create new favorites for different templates. One can define most other things, lines, fills etc.


Is there anyway after 30+ years of Archicad that one can define a pen RGB in gdl syntax that is independent of the final users pen pallet?


What about somehow using material RGB's to define a pen colour:


n = REQUEST{2} ("Material_info", 1, "gs_mat_surface_rgb", r, g, b)
PRINT r, g, b


Can that be used to drive the RGB of the pen?


I am hoping someone somewhere has found a way...


Many thanks!



I don't really understand how to relate pen RGB and material... GDL does not support pen RGB. In general pen RGB appeared only after Archicad introduced conversion of PDF into drawing primitives - in that case you have additional pen type (number 256 I think), that contains RGB values from PDF. But this variable is not accessible for user. And it also does not transfer into GDL (only if converted primitives are copied into binary drawing section in GDL). In script itself pen is defined as a number from -1 to 255. -1 means transparent, 0 - background colour (both work for fills only), rest - number from current pen set. You can extract RGB value of the pen to GDL script, but cannot do opposite - define pen colour. 

GDL Enthusiast

Hi Podolsky,


Thank you for taking the time to write and help me understand more about the pen. You are so knowledgeable! I will keep playing away...


Best regards!

REQ (parameter_string)

"Pen_of_RGB r g b": Defines the index of the pen closest to the given color. The r, g and b constants’ values are between 0 and 1.


so :

Pen_Grey = REQ("Pen_of_RGB 0.5 0.5 0.5")

Pen_White = REQ("Pen_of_RGB 1 1 1")

Pen_Black = REQ("Pen_of_RGB 0 0 0")

Pen_Red = REQ("Pen_of_RGB 1 0 0")


other REQ are:

REQ (parameter_string)

Asks the current state of the program. Its parameter - the question - is a string. The GDL interpreter answers with a numeric value. If it does
not understand the question, the answer is negative.
parameter_string: question string, one of the following:
"GDL_version": version number of the GDL compiler/interpreter. Warning: it is not the same as the Archicad version.
"Program": code of the program (e.g., 1: Archicad),
"Serial_number": the serial number of the keyplug,
"Model_size": size of the current 3D data structure in bytes,
"Red_of_material name"
"Green_of_material name"
"Blue_of_material name": Defines the given material’s color components in RGB values between 0 and 1,
"Red_of_pen index"
"Green_of_pen index"
"Blue_of_pen index": Defines the given pen’s color components in RGB values between 0 and 1,
"Pen_of_RGB r g b": Defines the index of the pen closest to the given color. The r, g and b constants’ values are between 0 and 1.


I go back to GDL Manual every day...there is always a solution in there

I am up to page 4,078 of Archicad 26 Reference Guide, (Worksheet and Detail Tool Settings), but i got to read it all 😞

As you mention, this will give you the pen index number in your current pen set that is closest to the RGB value that you want.

It will not however, allow you to set the actual pen colour.


Archicad 25 build 4013 will now allow you to set an RGB colour to the background of a fill using a Graphic Override.

But I don't think you can set an RGB value to a fill background itself without the Graphic Override (I haven't looked into this yet).

You certainly can't use RGB for the foreground (hatch) pen - and that includes the pen used for perimeters and lines.


So unfortunately I believe we are stuck with the standard 255 pens in GDL.




One of the forum moderators.
Versions 6.5 to 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

Thanks Allan, that is really helpful too!

Thank you Barry, that is very helpful knowing about AC build 4013 allowing one to set an RGB colour to the background of a fill using a Graphic Override. Wishing you the best in GDL!

Peter Baksa

Pen sets can be moved between different files with the attribute manager, would that be easier?

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest

Hi Peter, that is an option, however in my case, the team that works on civil design has several different pen sets that they don't want to change, while the architectural team has a further separate sets of pens they don't want to change.


If I want to set GDL the pens to the architectural pen set, then it doesn't work for the Civil Team. I have to set up an object favorites for them or make the GDL object twice to save them having to change pen colours.


This is a common problem for most GDL objects around the world it seems from what I can see, as one cannot control the end users pen pallet. Using the RGB closest match only works if a close target colour can be found in the pen pallet.


I wonder why Archicad doesn't allow the Pen to be defined. Searching online I have found a lot of other people who express interest in controlling the pen RGB & weight through GDL. I wonder if it is something hard coded in the software that is to complex to change which is why GS has yet to add that feature after all these years. 


Thank you for responding Peter, all the best to you!

If you don't want to unify the pen sets, which wouldn't be a bad idea in the long run, you can go through a different route: Make yourself a MVO tab (LibraryGlobal) for the office and then define a couple of pens there, which are set differently depending on whom is working on the view.

Your objects can then receive these pens.

Mostly AC 26 on Mac | Author of SelfGDL | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!