GDL
About building parametric objects with GDL.
SOLVED!

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

Mario Sacco
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
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)
 
MarioSacco_0-1697808867519.png

 

MacBook M1 Max 64GB- OS X 12.2.1 - Archicad 27
https://www.archiradar.it/en/
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
MF BIM
Enthusiast

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)

 

 

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

View solution in original post

4 REPLIES 4
Solution
MF BIM
Enthusiast

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)

 

 

https://mfbim.fr | https://youtube.com/@mfbim | https://bsky.app/profile/mfbim.fr
AC24 FRA 7600 - AC26 FRA 4027 | MacBook M1 Pro
Mario Sacco
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.

 

MarioSacco_0-1697865165624.png

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
https://www.archiradar.it/en/

@Mario Sacco,

 

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

 

https://mfbim.fr | https://youtube.com/@mfbim | https://bsky.app/profile/mfbim.fr
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

ADDX 5
MATERIAL 3
BLOCK 5,10,1

CUTEND
MacBook M1 Max 64GB- OS X 12.2.1 - Archicad 27
https://www.archiradar.it/en/

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!