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

GDL
About building parametric objects with GDL.
SOLVED!

GDL tutorial

Camu
Enthusiast

Is there an explicit tutorial with examples for the GDL other than the gdl reference which does not explain the procedure for novices. I am trying to make my 2D symbol with an editable frame (outline, frame pen, frame background pen). Here is my gdl code but it does not work.

 

Operating system used: Windows 11

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

@Camu,

 

POLY2_B will be the command indeed, it should go like this :

pen PC_SdL
fill T_SdL

POLY2_B 9, 1+2,
        P_SdL, PF_SdL,
        0, 0, 1, ! Point 1
        0, var_9 + var_21, 1, ! Point 2
        (var_2 + (2 * var_19)), var_9 + var_21, 1, ! Point 3
        (var_19 + var_2 + var_19), 0, 1, ! Point 4
        var_19+var_2, 0, 1, ! Point 5
        (var_19 + var_2 + var_19 - var_20), var_9, 1, ! Point 6
        var_20, var_9, 1, ! Point 7
        var_19, 0, 1, ! Point 8
        0, 0, 1 ! Point 1

 

https://mfbim.fr | https://youtube.com/@mfbim
AC24 FRA 7600 - AC26 FRA 4027 | MacBook M1 Pro

View solution in original post

9 REPLIES 9
MF BIM
Enthusiast

Hello @Camu ,

 

I made a very simple tutorial a year ago on youtube (shameless plug 😅 : https://www.youtube.com/playlist?list=PL786jdG-2TRfwCaJ8uQgzYs2ynGHTH2Ky). It's really a basic overview of the language in order to create a simple (but functional) table in around 2 hours.

 

You could also check :

- On this very subforum, there's a pinned thread about Barking Dog's youtube channel

- The GDL Center : https://gdl.graphisoft.com/reference-guide/gdl-guide

- Books like the GDL Cookbook or the GDL Handbook are excellent sources.

 

I couldn't open your object as I don't have 27 installed but considering what you'd want to do, I believe you should use the POLY2_B command (page 185, in the 2D Shapes chapter) that would allow you to create an object with control over the outline, its fills and pen.

 

The command goes like this :

 

pen        yourPen
fill       yourFill
line_type  yourLineType

poly2_b  n, 1+2,
         yourFillPen, yourBackgroundFillPen,
         x1, y1, 1,
         x2, y2, 1,
         x3, y3, 1,
         ...
         xn, yn, 1

 

n is the number of nodes which is equal to the number of sides + 1 as the last node is a repeat of the first node. So if you're drawing an hexagon, n would be equal to 7.

https://mfbim.fr | https://youtube.com/@mfbim
AC24 FRA 7600 - AC26 FRA 4027 | MacBook M1 Pro

This was my code

 

! --TRAME--
   
    pen PC_SdL
    Fill T_SdL ! Type de trame
    ! FILL_HOLES_NR P_SdL
      
    POLY2 8, 1+2+4, ! Le deuxième paramètre (1+2+4) est la somme des options pour : 1 (fermeture automatique), 2 (contour tracé), 4 (remplissage)
   
    0, 0, ! Point 1
    0, var_9 + var_21, ! Point 2
    (var_2 + (2 * var_19)), var_9 + var_21, ! Point 3
    (var_19 + var_2 + var_19), 0, ! Point 4
    var_19+var_2, 0, ! Point 5
    (var_19 + var_2 + var_19 - var_20), var_9, ! Point 6
    var_20, var_9, ! Point 7
    var_19, 0 ! Point 8

Il semble que tu sois francophone. Je veux simplement faire une trame avec la plume de contour éditable, la plume de motif éditable et le fond de motif éditable, mais ça marche pas. quand je fait avec poy2_b il me fait une erreur. si tu as un exemple je suis preneur. Un grand merci à toi d'avoir répondu si rapidement

 

English only please in this forum.

Translation...

It seems that you are French-speaking. I just want to make a screen with the editable outline pen, the editable pattern pen and the editable pattern fill, but it doesn't work. when I do it with poy2_b it gives me an error. If you have an example I'm interested. Many thanks to you for responding so quickly.

Que te dit l'erreur exactement ? Car j'ai rentré ton code avec POLY2 et ça marche de mon côté. Donc soit tu as une erreur de valeur dans tes paramètres, soit tes paramètres ne sont pas des longueurs ou soit tu as un paramètre qui n'est pas trouvé, je pense.

 

Translation ...

What exactly does the error tell you? Because I entered your code with POLY2 and it works for me. So either you have a value error in your parameters, or your parameters are not lengths or you have a parameter that is not found, I think.

 

Capture d’écran 2024-08-14 à 14.57.28.png

 

Capture d’écran 2024-08-14 à 15.01.09.png

 

Pour info, il est mieux de répéter le premier noeud car l'équivalent en 3D (prism) n'a pas l'option de fermeture automatique. Donc en général, on fait juste 1+2 et on ajoute le premier noeud en dernier comme ça tu gardes une bonne habitude.

 

FYI, it is better to repeat the first node because the 3D equivalent (prism) does not have the automatic closing option. So in general, we just do 1+2 and add the first node last so you keep a good habit.

https://mfbim.fr | https://youtube.com/@mfbim
AC24 FRA 7600 - AC26 FRA 4027 | MacBook M1 Pro
Yves
Advocate

Hi,
The poly2_b is not working because you are missing some parameters
You need to add the pens of the fill  (yourFillPen, yourBackgroundFillPen)
and also your points must have three values ​​x1,y1,s1, … ,xn,yn,sn

The s1 and sn correspond to this table

 

Capture d’écran.png

 

Here is your script for a poly2_b

 

POLY2 9, 1+2, ! Le deuxième paramètre (1+2+4) est la somme des options pour : 1 (fermeture automatique), 2 (contour tracé), 4 (remplissage)
   
yourFillPen, yourBackgroundFillPen,

    0, 0, 15,! Point 1
    0, var_9 + var_21,15, ! Point 2
    (var_2 + (2 * var_19)), var_9 + var_21, 15,! Point 3
    (var_19 + var_2 + var_19), 0, 15,! Point 4
    var_19+var_2, 0, 15,! Point 5
    (var_19 + var_2 + var_19 - var_20), var_9, 15,! Point 6
    var_20, var_9, 15,! Point 7
    var_19, 0 , 15,! Point 8
    0, 0, 15! Point 9

 

Yves Houssier
Belgium
Archicad 19 -> 24
iMac - Mac Os 10,13
Sur ton ecran je vois pas le paramètre pour la plume de contour (P_SdL), la plume de trame (T_SdL) et la plume de fond de trame (FT_SdL). mon saut de loup est couper et donc son contour doit avoir une épaisseur et il me faut aussi le choix de trame en fonction de couler sur place ou préfabriqué. C'est ça que j'arrive pas à coder. 
Avec la fonction Poly2 je vois ma trame mais j'ai pas toute les variable. je pensais que Poly2_b me permettrait de la faire
 
On your screen I don't see the parameter for the outline pen (P_SdL), the frame pen (T_SdL) and the background frame pen (FT_SdL). My wolf jump is cut and therefore its outline must have a thickness and I also need the choice of frame depending on whether to cast on site or prefabricated. That's what I can't code.
With the Poly2 function I see my frame but I don't have all the variables. I thought that Poly2_b would allow me to do it
 
 


Capture SdL.jpg

Solution

@Camu,

 

POLY2_B will be the command indeed, it should go like this :

pen PC_SdL
fill T_SdL

POLY2_B 9, 1+2,
        P_SdL, PF_SdL,
        0, 0, 1, ! Point 1
        0, var_9 + var_21, 1, ! Point 2
        (var_2 + (2 * var_19)), var_9 + var_21, 1, ! Point 3
        (var_19 + var_2 + var_19), 0, 1, ! Point 4
        var_19+var_2, 0, 1, ! Point 5
        (var_19 + var_2 + var_19 - var_20), var_9, 1, ! Point 6
        var_20, var_9, 1, ! Point 7
        var_19, 0, 1, ! Point 8
        0, 0, 1 ! Point 1

 

https://mfbim.fr | https://youtube.com/@mfbim
AC24 FRA 7600 - AC26 FRA 4027 | MacBook M1 Pro
Camu
Enthusiast

Thank you very much it works. Thanks for your time Thanks for your patience I try to learn this gdl, but there is not much tutorial with real commented example to understand these errors. I wish you a very nice day

Glad to know it worked ! Just please mark the subject as solved then so people who encounter a similar issue as yours can find the solution 👍

https://mfbim.fr | https://youtube.com/@mfbim
AC24 FRA 7600 - AC26 FRA 4027 | MacBook M1 Pro

Setup info provided by author