Select to view content in your preferred language

set attr color

1092
3
Jump to solution
01-11-2024 02:45 AM
Labels (1)
biaozeng
Occasional Contributor
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
Occasional Contributor

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
Regular Contributor

A possible way to represent this would be:

@Color
attr col = "#FFFFFF"

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

 

0 Kudos
biaozeng
Occasional Contributor

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

0 Kudos
desert
by
Occasional Contributor

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.
##################