Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

rgb for PLANE?

Mats_Knutsson
Advisor
Hi,
Playing with planes. How do I assign the planes an rgb colour? /M
AC 25 SWE Full

HP Zbook Fury 15,6 G8. 32 GB RAM. Nvidia RTX A3000.
7 REPLIES 7

DEFINE MATERIAL "material_matte" 2, red, green, blue
Did you mean this?
Joachim Suehlo . AC12-25 . MAC OSX 10.15 . WIN10

wow Mats! your playing is pretty crazy, would scare most of the kids out of the park.

To assign an rgb colour to the planes you have to define the "material" in the master script. Simple RGB material definitions are quite simple, below is the logic and an example:

define material <name> <type>,
r, g, b

The definition can get more complex with more values if you want to control "shininess", "transparency" and alike. This is determined by the <type> value. if you just want the rgb values then choose a <type> value between 2 and 7:
2: matte
3: metal
4: plastic
5: glass
6: glowing
7: constant

The rgb values are in the range of 0 - 1, so typically I write them as a fraction of 255 (eg 194/255, 72/255, 44/255). Though for the example below I have just used the 1 and 0 because its a straight red colour.
This is my red clearance space using the glass <type> to make it transparent.

define material "Clearance Surface" 5,
	1, 0, 0
You do this in the master script and then you set the material in the 3D script using
material "Clearance Surface"
Is the image you sent a single object? if so you may want to set the rgb value to an array parameter with 3 columns (r, g and b) and a separate row for each plane. Then you will have to definite the material in the 3D script so the one material can have varying results using loop function and referencing the array. actually this might not work as it might say that the material has already been defined. If thats the case then you could perhaps make the name of the material also a variable based on the loop number (eg "Plane Surface " +str(n, 1, 0). I haven't tested this logic yet but it works for GROUP statements.
Creator of Cadswift's parametric GDL libraries
Creator of Infinite Openings and Component Catalogues
Push the envelope & watch it bend
website: https://cadswift.com.au/
YouTube: https://www.youtube.com/user/CADSwift/playlists

Peter Baksa
Graphisoft
Graphisoft
Be aware that you can't define too many materials. Enough for a few hundred colors from a palette, but not for smooth multi-color gradients.
Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest

Peter wrote:
Be aware that you can't define too many materials. Enough for a few hundred colors from a palette, but not for smooth multi-color gradients.
Does that apply to materials contain within a GDL object (not MASTER_GDL) that doesn't populate the attribute list, or is it just for attribute list materials?
Creator of Cadswift's parametric GDL libraries
Creator of Infinite Openings and Component Catalogues
Push the envelope & watch it bend
website: https://cadswift.com.au/
YouTube: https://www.youtube.com/user/CADSwift/playlists

Peter Baksa
Graphisoft
Graphisoft
Yes, inline materials too, combined for all objects.
Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest

Peter wrote:
Yes, inline materials too, combined for all objects.
Thanks
Creator of Cadswift's parametric GDL libraries
Creator of Infinite Openings and Component Catalogues
Push the envelope & watch it bend
website: https://cadswift.com.au/
YouTube: https://www.youtube.com/user/CADSwift/playlists

Mats_Knutsson
Advisor
Kristian wrote:
wow Mats! your playing is pretty crazy, would scare most of the kids out of the park.

To assign an rgb colour to the planes you have to define the "material" in the master script. Simple RGB material definitions are quite simple, below is the logic and an example:

define material <name> <type>,
r, g, b

The definition can get more complex with more values if you want to control "shininess", "transparency" and alike. This is determined by the <type> value. if you just want the rgb values then choose a <type> value between 2 and 7:
2: matte
3: metal
4: plastic
5: glass
6: glowing
7: constant

The rgb values are in the range of 0 - 1, so typically I write them as a fraction of 255 (eg 194/255, 72/255, 44/255). Though for the example below I have just used the 1 and 0 because its a straight red colour.
This is my red clearance space using the glass <type> to make it transparent.

define material "Clearance Surface" 5,
	1, 0, 0
You do this in the master script and then you set the material in the 3D script using
material "Clearance Surface"
Is the image you sent a single object? if so you may want to set the rgb value to an array parameter with 3 columns (r, g and b) and a separate row for each plane. Then you will have to definite the material in the 3D script so the one material can have varying results using loop function and referencing the array. actually this might not work as it might say that the material has already been defined. If thats the case then you could perhaps make the name of the material also a variable based on the loop number (eg "Plane Surface " +str(n, 1, 0). I haven't tested this logic yet but it works for GROUP statements.
Thanks Kristian!
I'll try this when I'm back from skiing holidays. I now understand I need a material...was hoping I could just use a colour without having to create a material. My not so genius plan was to add colour definitions in a stack with PUT.
AC 25 SWE Full

HP Zbook Fury 15,6 G8. 32 GB RAM. Nvidia RTX A3000.

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!