cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The 2025 Technology Preview Program is now live. Join today!

GDL
About building parametric objects with GDL.

GDL Pgon code issue

RhinoX
Booster

Hi everyone, I’m still learning GDL and wrote a simple script to create two triangular polygons using the pgon command. For some reason, it keeps throwing an error and I can’t figure out why. Any help would be much appreciated. Thanks!

 

RhinoX_0-1756910643793.pngRhinoX_1-1756910668223.png

vert 0.00, 0.00, 0.00 ! 01
vert 1.00, 0.00, 0.00 ! 02
vert 1.00, 1.00, 0.00 ! 03
vert 0.00, 1.00, 0.00 ! 04

edge 1, 2, 1, 0, 0 ! 01
edge 2, 3, 1, 0, 0 ! 02
edge 3, 1, 1, 2, 0 ! 03
 
edge 3, 4, 1, 0, 0 ! 04
edge 4, 1, 1, 0, 0 ! 05

vect 0, 0, 1
vect 0, 0, 1
 
pgon 3, 1, 0, 1, 2, 3
pgon 3, 2, 0, 4, 5, -3

RhinoX_2-1756910845678.png

 

Operating system used: Mac Intel-based

7 REPLIES 7
Lingwisyer
Guru

I have not tried using pgons, but does it work without the the vert 4 points?

AC22-28 AUS 3110Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win11 | R5 2600 | 16GB | GTX1660

No, it’s not possible. The points must be defined first before the edges can be determined.

I mean if you defined a single triangle rather than two with a common edge.

AC22-28 AUS 3110Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win11 | R5 2600 | 16GB | GTX1660
MF BIM
Enthusiast

Hi @RhinoX ,

 

It seems that the issue is coming from the definition of pgon1 (the 3rd argument) in edge 04 (line 31)

 

I'm not familiar with primitive elements but from my understanding, arguments pgon1 and pgon2 are the indices of the polygons they refer to. Edges 04 and 05 are edges of the second polygon so pgon1 should be 2 I think.

 

RhinoX_0-1756910643793.png

 

It you do this, does it work ?

edge 3, 4, 2, 0, 0 ! 04
edge 4, 1, 2, 0, 0 ! 05

https://mfbim.fr | https://youtube.com/@mfbim | My GDL course on Udemy, try it !
AC24 FRA 7600 - AC26 FRA 4027 | MacBook M1 Pro

Thanks, will try your way. Actually, I have just started learning GDL, but it feels like getting lost in a forest of commands and syntax. For example, when creating a terrain mesh, there are too many similar commands like Mesh, Pgon, Mass, Coons… I’m not sure which ones people usually use. Some seem rarely used, since there are very few tutorials about them. I think Graphisoft should remove some of the less commonly used commands so that beginners don’t get overwhelmed.

The Primitives command set you are tinkering around with is what the automatically generated scripts use as it is just constructing triangles which while mathamatically very simple, are not very intuitive... I have not seen MASS or COONS used before, though coons seems like a more primitive version of RULEDSHELL... I feel like if you are going beyond Basic Shapes and Planar Shapes, you are going beyond a beginner level. A bit like the level of understanding between Python and C++.

 

If you are just starting out, find yourself a copy of the GDL Cookbook, though old and a bit out dated, it is still a great learning guide.

 

Ling.

AC22-28 AUS 3110Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win11 | R5 2600 | 16GB | GTX1660

Thanks a lot! I actually started with the Cookbook – it’s a fantastic resource – but it does feel quite old. I’m not sure if Graphisoft has introduced any smarter commands since then to replace the older ones. Right now I’m mainly trying to wrap my head around how Mesh works, and whether it’s possible to generate meshes through GDL using Grasshopper.

Setup info provided by author