Select to view content in your preferred language

set attr color

612
3
Jump to solution
01-11-2024 02:45 AM
Labels (1)
biaozeng
New Contributor III
version "2023.1"
 
attr col=[1,1,1]
lot-->
extrude(30) color(col)
 
//I want to assign color attributes on the shape to the extruded model
 
 
 
 
0 Kudos
1 Solution

Accepted Solutions
desert
by
New Contributor III

There's probably a better way, but here's the one I know.

#################
# Use Array

@Order(0)
attr Color_array = [0,0,0]

Lot1 -->
	color(Color_array[0], Color_array[1], Color_array[2]) 
	extrude(10)
	X.
##################


 	
#################
# OR

@Order(1)
@Range(min=0, max=1, stepsize=0.1)
attr Red = 0

@Order(2)
@Range(min=0, max=1, stepsize=0.1)
attr Green = 0

@Order(3)
@Range(min=0, max=1, stepsize=0.1)
attr Blue = 0

Lot2 -->
	color(Red, Green, Blue) 
	extrude(10) 
	X.
##################

 

View solution in original post

3 Replies
plfontes
Occasional Contributor

A possible way to represent this would be:

@Color
attr col = "#FFFFFF"

lot-->
  color(col) 
  extrude(30)

 

0 Kudos
biaozeng
New Contributor III

If the color attribute on my shape data is RGB value, how should it be converted

0 Kudos
desert
by
New Contributor III

There's probably a better way, but here's the one I know.

#################
# Use Array

@Order(0)
attr Color_array = [0,0,0]

Lot1 -->
	color(Color_array[0], Color_array[1], Color_array[2]) 
	extrude(10)
	X.
##################


 	
#################
# OR

@Order(1)
@Range(min=0, max=1, stepsize=0.1)
attr Red = 0

@Order(2)
@Range(min=0, max=1, stepsize=0.1)
attr Green = 0

@Order(3)
@Range(min=0, max=1, stepsize=0.1)
attr Blue = 0

Lot2 -->
	color(Red, Green, Blue) 
	extrude(10) 
	X.
##################