We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2023-10-20 03:36 PM - last edited on 2024-09-24 10:13 AM by Doreena Deng
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
ADDX 1.1
MATERIAL 4
BLOCK 1,1,1
DEL 1
ENDGROUP
GROUP "B"
MATERIAL 7
ADD .5,.5,.5
BLOCK 1,1,1
DEL 1
MATERIAL 6
ADD -.7,.5,.5
BLOCK 1,1,1
DEL 1
ENDGROUP
PLACEGROUP SUBGROUP{3} ("A","B",0,0,0,0)
Solved! Go to Solution.
2023-10-20 09:59 PM
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"
ADDX 1.1
MATERIAL MAT_2
BLOCK 1,1,1
DEL 1
ENDGROUP
GROUP "B"
MATERIAL 7
ADD .5,.5,.5
BLOCK 1,1,1
DEL 1
MATERIAL 6
ADD -.7,.5,.5
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)
2023-10-20 09:59 PM
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"
ADDX 1.1
MATERIAL MAT_2
BLOCK 1,1,1
DEL 1
ENDGROUP
GROUP "B"
MATERIAL 7
ADD .5,.5,.5
BLOCK 1,1,1
DEL 1
MATERIAL 6
ADD -.7,.5,.5
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)
2023-10-21 07:16 AM
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.
2023-10-21 01:33 PM
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]
addx 1.1*(NUM-1)
material mats[NUM]
block 1,1,1
del 1
endgroup
next NUM
group "B"
for NUM = 1 to NUM_BLOCKS
material 6
add -.7+(1.2*(NUM-1)),.5,.5
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
2023-10-21 04:57 PM
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
ADDX 5
MATERIAL 3
BLOCK 5,10,1
CUTEND