GDL
About building parametric objects with GDL.
SOLVED!

how to use Inline defined materials for Cprism

A_ Smith
Expert

Is it possible to use not materials index, but kinda its name (pre-defined materials in gdl has names, not index) basically for all shapes with prism_, tube and so on ?

 

define material 'purple' 2, 1, 0, 1
define material 'white' 2, 1, 1, 1



material 'purple'
mat1=10 ! black
pen 1
_si=15

block 1,1,1

add 2, 2, 0

cprism_{3} 'white' , 'white' , 'white' , 0,
5, 2,
0, 0, 0, _si, mat1,
0, 1, 0, _si, mat1,
1, 1, 0, _si, mat1,
1, 0, 0, _si, mat1,
0, 0, 0, -1, mat1



add 2, 2, 0

material 'white'
mat2=76 ! green
mat3=78 ! yellow

cprism_{3} 'purple', 'purple', 'purple', 0,
5, 2,
0, 0, 0, _si, mat3,
0, 1, 0, _si, mat3,
1, 1, 0, _si, mat3,
1, 0, 0, _si, mat3,
0, 0, 0, -1, mat3



add 2,2, 0

block 1,1,1

defineMaterial.png
AC 22, 24 | Win 10
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
BrunoH
Expert

Hi A_Smith,

No a numerical expression is required for mat1, mat2 and mat3 variable,

but you can easily set them with the IND command :

 

define material 'purple' 2, 1, 0, 1
define material 'white' 2, 1, 1, 1



mat1 = IND (MATERIAL, 'purple')

mat3 = IND (MATERIAL, 'white')


_si=15



pen 1


cprism_{3} 'white' , 'white' , 'white' , 0,
5, 2,
0, 0, 0, _si, mat1,
0, 1, 0, _si, mat1,
1, 1, 0, _si, mat1,
1, 0, 0, _si, mat1,
0, 0, 0, -1, mat1



add 2, 2, 0

cprism_{3} 'purple', 'purple', 'purple', 0,
5, 2,
0, 0, 0, _si, mat3,
0, 1, 0, _si, mat1,
1, 1, 0, _si, mat3,
1, 0, 0, _si, mat1,
0, 0, 0, -1, mat3
ArchiCad 3.43 to 28
MacOS Monterey

View solution in original post

2 REPLIES 2
Solution
BrunoH
Expert

Hi A_Smith,

No a numerical expression is required for mat1, mat2 and mat3 variable,

but you can easily set them with the IND command :

 

define material 'purple' 2, 1, 0, 1
define material 'white' 2, 1, 1, 1



mat1 = IND (MATERIAL, 'purple')

mat3 = IND (MATERIAL, 'white')


_si=15



pen 1


cprism_{3} 'white' , 'white' , 'white' , 0,
5, 2,
0, 0, 0, _si, mat1,
0, 1, 0, _si, mat1,
1, 1, 0, _si, mat1,
1, 0, 0, _si, mat1,
0, 0, 0, -1, mat1



add 2, 2, 0

cprism_{3} 'purple', 'purple', 'purple', 0,
5, 2,
0, 0, 0, _si, mat3,
0, 1, 0, _si, mat1,
1, 1, 0, _si, mat3,
1, 0, 0, _si, mat1,
0, 0, 0, -1, mat3
ArchiCad 3.43 to 28
MacOS Monterey

Thank you

AC 22, 24 | Win 10