cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:
GDL
About building parametric objects with GDL.

# how to use Inline defined materials for Cprism

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

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

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

block 1,1,1``````
AC 22, 24 | Win 10
1 ACCEPTED SOLUTION
2 REPLIES 2
Solution
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

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``````
MacOS Monterey

Thank you

AC 22, 24 | Win 10

Latest solutions

Most liked posts