cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:
BIM Coordinator Program (INT) April 22, 2024

# Find the next step in your career as a Graphisoft Certified BIM Coordinator!

GDL
About building parametric objects with GDL.
SOLVED!

# How to inherit Material (surface) from the "base group" using SUBGROUP{3} in GDL

Expert

I can't find a solution to inherit the material from the "base group" in GDL.

The code I made, always attribuites to the cut polygons the material of the "tool group"

I'd like to have the cubes inherit their own material

``````PEN 1

GROUP "A"
MATERIAL 5
BLOCK 1,1,1
MATERIAL 4
BLOCK 1,1,1
DEL 1
ENDGROUP

GROUP "B"
MATERIAL 7
BLOCK 1,1,1
DEL 1

MATERIAL 6
BLOCK 1,1,1
DEL 1
ENDGROUP

PLACEGROUP SUBGROUP{3} ("A","B",0,0,0,0)``````

MacBook M1 Max 64GB- OS X 12.2.1 - Archicad 27
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Booster

Hello @Mario Sacco ,

You need to input the materialId value in the 4th argument of the subgroup command. If you want each block to have its own material then you would need to have as many base groups and subgroup commands.

``````PEN 1
MAT_1 = 5
MAT_2 = 4

GROUP "A1"
MATERIAL MAT_1
BLOCK 1,1,1
ENDGROUP

GROUP "A2"
MATERIAL MAT_2
BLOCK 1,1,1
DEL 1
ENDGROUP

GROUP "B"
MATERIAL 7
BLOCK 1,1,1
DEL 1

MATERIAL 6
BLOCK 1,1,1
DEL 1
ENDGROUP

PLACEGROUP SUBGROUP{3} ("A1", "B", 0, MAT_1, 0, 0)
PLACEGROUP SUBGROUP{3} ("A2", "B", 0, MAT_2, 0, 0)``````

AC21 FRA 3005 - AC24 FRA 7600 - AC26 FRA 4027 | MacBook M1 Pro
4 REPLIES 4
Solution
Booster

Hello @Mario Sacco ,

You need to input the materialId value in the 4th argument of the subgroup command. If you want each block to have its own material then you would need to have as many base groups and subgroup commands.

``````PEN 1
MAT_1 = 5
MAT_2 = 4

GROUP "A1"
MATERIAL MAT_1
BLOCK 1,1,1
ENDGROUP

GROUP "A2"
MATERIAL MAT_2
BLOCK 1,1,1
DEL 1
ENDGROUP

GROUP "B"
MATERIAL 7
BLOCK 1,1,1
DEL 1

MATERIAL 6
BLOCK 1,1,1
DEL 1
ENDGROUP

PLACEGROUP SUBGROUP{3} ("A1", "B", 0, MAT_1, 0, 0)
PLACEGROUP SUBGROUP{3} ("A2", "B", 0, MAT_2, 0, 0)``````

AC21 FRA 3005 - AC24 FRA 7600 - AC26 FRA 4027 | MacBook M1 Pro
Expert

This solution is ok if I can separate the single objects.

My code include hundreds of objects with different colours and I need execute the subtraction only one.

As you can see the are many panels and the side cutted volumes have an incorrect surface.

I probably will try to use CUTPOLY for my problem, but for complex operation it can't work.

MacBook M1 Max 64GB- OS X 12.2.1 - Archicad 27

You could use arrays and iterate through them, maybe. Probably not very efficient but it'll work.

``````pen 1

NUM_BLOCKS = 4

dim names[]
dim mats[]
mats[1] = 5
mats[2] = 4
mats[3] = 3
mats[4] = 2

for NUM = 1 to NUM_BLOCKS
names[NUM]	= "A" + str(NUM, 1, 0) ! A1, A2...

group names[NUM]
material mats[NUM]
block 1,1,1
del 1
endgroup
next NUM

group "B"
for NUM = 1 to NUM_BLOCKS
material 6
block 1,1,1
del 1
next NUM
endgroup

for NUM = 1 to NUM_BLOCKS
placegroup subgroup{3} (names[NUM], "B", 0, mats[NUM], 0, 0)
next NUM``````

AC21 FRA 3005 - AC24 FRA 7600 - AC26 FRA 4027 | MacBook M1 Pro

This is the code using CUTPOLYA. It works fine but you can use only an extrusion as subtraction.

``````PEN 1
CUTPOLYA 11,1,0,
-1,-1,15,
-1,11,15,
11,11,15,
11,-1,15,
-1,-1,15,
1,1,15,
7,2,15,
8,7,15,
2,8,15,
1,1,15,
-1,-1,15

MATERIAL 2
BLOCK 4,10,1

MATERIAL 3
BLOCK 5,10,1

CUTEND
``````
MacBook M1 Max 64GB- OS X 12.2.1 - Archicad 27