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

GDL
About building parametric objects with GDL.
SOLVED!

How to make primitives solid?

runxel
Legend

Howdy folks,

what's the secret for having primitives being displayed as solid?

The following script will still be hollow...

 

 

base

!------
vert 0, 0, 0 
vert A, 0, 0
vert A/2, 0, zzyzx

vert 0, B, 0
vert A, B, 0
vert A/2, B, zzyzx

vect 0,0,-1 !1 
vect 0,-1,0 !2
vect 0,1,0  !3

!-----
edge 1, 2, -1, -1, 0 !#1
edge 2, 3, -1, -1, 0
edge 3, 1, -1, -1, 0

edge 4, 5,-1, -1, 0
edge 5, 6,-1, -1, 0
edge 6, 4,-1, -1, 0

edge 1, 4, -1, -1, 0 !#7
edge 2, 5, -1, -1, 0
edge 3, 6, -1, -1, 0

!-----
pgon 3, 2, -1, 1, 2, 3
pgon 3, 3, -1, 4, 5, 6

pgon 4, 1, -1, 1, 8, -4 ,-7

pgon 4, 0, -1, 3, 7, -6, -9
pgon 4, 0, -1, 2, 9, -5, -8

body -1

 

 

Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
runxel
Legend

Thanks @Miha_M for the link to the GDL center. Sometimes you just have to read the manual very carefully for the 100th time. There is an innocent sentence hidden in plain sight:

 

In the case of closed bodies, the polygon’s orientation is correct if the edge has different prefixes in the edge list of the two polygons.

And that is the issue...

A solid is defined by the simple rule that every defined edge must be referenced exactly 2 times. AND to have an actual cut fill the sign of the number must be different. E.g. edge #1 must be referenced as "1" and as "-1" the other time.

 

In other news: All polygons strictly need to be defined counter clockwise (when viewed from the "outside"). So screw VECTs. You would assume that defining them would be able to "heal" the wrong orientation, but nope! Note that this works only if you already defined the EDGEs in a correct manner. If they are wrong you are out of luck.

 

My example script corrected would look like this:

base

vert 0, 0, 0 
vert A, 0, 0
vert A/2, 0, zzyzx

vert 0, B, 0
vert A, B, 0
vert A/2, B, zzyzx

edge 1,2, -1, -1, 0
edge 2,3, -1, -1, 0
edge 3,1, -1, -1, 0

edge 5,4, -1, -1, 0
edge 6,5, -1, -1, 0
edge 4,6, -1, -1, 0

edge 1,4, -1,-1, 0
edge 2,5, -1,-1, 0
edge 3,6, -1,-1, 0

pgon 3, 0, -1, 1,2,3
pgon 3, 0, -1, 4,6,5
pgon 4, 0, -1, -1,7,-4,-8
pgon 4, 0, -1, -3,9,-6,-7
pgon 4, 0, -1, 8,-5,-9,-2

body -1

 

Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»

View solution in original post

4 REPLIES 4
DGSketcher
Legend

@runxel Random suggestion as I have never ventured into creating solids but there is a Directive MODEL SOLID, which you may need to issue in your script?

 

Other than that I bow to your far greater knowledge of GDL. 

Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)

Thanks for input and compliment @DGSketcher!

The "model solid" does not help but of course I tried it.

What's even more curious: When converted to a morph the element will report as solid, even tho it cleary is not (check with a section or a cut plane in 3D).

If a boolean is performed on the body it will suddenly be filled.

 

Maybe @Peter Baksa has some insights.

Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
Miha_M
Advisor

My GDL knowledge is very basic and I can't even imagine how far GDL can reach. My compliments to all of you who dare to walk the GDL path.

I tried one simple thing though, based on a GDL example here, which I added to your script:

Primitive Elements | Graphisoft GDL Center

and this one does give me a solid body. @runxel I am sure you can figure out why this one is working fine and find a solution for your triangled body to become solid - at my knowledge level it would take a long time so I won't even try it. 

!your script here
addx 2
VERT 0.0, 0.0, 0.0 !#1 VERT 1.0, 0.0, 0.0 !#2 VERT 1.0, 1.0, 0.0 !#3 VERT 0.0, 1.0, 0.0 !#4 VERT 0.0, 0.0, 1.0 !#5 VERT 1.0, 0.0, 1.0 !#6 VERT 1.0, 1.0, 1.0 !#7 VERT 0.0, 1.0, 1.0 !#8 EDGE 1, 2, -1, -1, 0 !#1 EDGE 2, 3, -1, -1, 0 !#2 EDGE 3, 4, -1, -1, 0 !#3 EDGE 4, 1, -1, -1, 0 !#4 EDGE 5, 6, -1, -1, 0 !#5 EDGE 6, 7, -1, -1, 0 !#6 EDGE 7, 8, -1, -1, 0 !#7 EDGE 8, 5, -1, -1, 0 !#8 EDGE 1, 5, -1, -1, 0 !#9 EDGE 2, 6, -1, -1, 0 !#10 EDGE 3, 7, -1, -1, 0 !#11 EDGE 4, 8, -1, -1, 0 !#12 PGON 4, 0, -1, -1, -4, -3, -2 !#1 !VERT1,2,3,4 PGON 4, 0, -1, 5, 6, 7, 8 !#2 !VERT5,6,7,8 PGON 4, 0, -1, 1, 10, -5, -9 !#3 !VERT1,2,5,6 PGON 4, 0, -1, 2, 11, -6, -10 !#4 !VERT2,3,6,7 PGON 4, 0, -1, 3, 12, -7, -11 !#5 !VERT3,4,7,8 PGON 4, 0, -1, 4, 9, -8, -12 !#6 !VERT1,4,5,8 BODY -1 !CUBE

EDIT: Well, I tried to replicate the GS script on your geometry and even without the VECT definitions the body doesn't become solid. Interesting.

| Archicad 4.55 - 27
| HP Z840 | 2× E5-2643 v4 | 64 GB RAM | Quadro M5000 | Windows 10 Pro x64
| HP Z4 G4 | W-2245 | 64 GB RAM | RTX A4000 | Windows 11

Solution
runxel
Legend

Thanks @Miha_M for the link to the GDL center. Sometimes you just have to read the manual very carefully for the 100th time. There is an innocent sentence hidden in plain sight:

 

In the case of closed bodies, the polygon’s orientation is correct if the edge has different prefixes in the edge list of the two polygons.

And that is the issue...

A solid is defined by the simple rule that every defined edge must be referenced exactly 2 times. AND to have an actual cut fill the sign of the number must be different. E.g. edge #1 must be referenced as "1" and as "-1" the other time.

 

In other news: All polygons strictly need to be defined counter clockwise (when viewed from the "outside"). So screw VECTs. You would assume that defining them would be able to "heal" the wrong orientation, but nope! Note that this works only if you already defined the EDGEs in a correct manner. If they are wrong you are out of luck.

 

My example script corrected would look like this:

base

vert 0, 0, 0 
vert A, 0, 0
vert A/2, 0, zzyzx

vert 0, B, 0
vert A, B, 0
vert A/2, B, zzyzx

edge 1,2, -1, -1, 0
edge 2,3, -1, -1, 0
edge 3,1, -1, -1, 0

edge 5,4, -1, -1, 0
edge 6,5, -1, -1, 0
edge 4,6, -1, -1, 0

edge 1,4, -1,-1, 0
edge 2,5, -1,-1, 0
edge 3,6, -1,-1, 0

pgon 3, 0, -1, 1,2,3
pgon 3, 0, -1, 4,6,5
pgon 4, 0, -1, -1,7,-4,-8
pgon 4, 0, -1, -3,9,-6,-7
pgon 4, 0, -1, 8,-5,-9,-2

body -1

 

Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»