19 lines
442 B
Python
19 lines
442 B
Python
|
"""
|
||
|
A catalog of material properties
|
||
|
"""
|
||
|
from enum import Enum
|
||
|
import cadquery as Cq
|
||
|
|
||
|
def _color(name: str, alpha: float) -> Cq.Color:
|
||
|
r, g, b, _ = Cq.Color(name).toTuple()
|
||
|
return Cq.Color(r, g, b, alpha)
|
||
|
|
||
|
class Material(Enum):
|
||
|
|
||
|
WOOD_BIRCH = 0.8, _color('bisque', 0.9)
|
||
|
PLASTIC_PLA = 0.5, _color('azure3', 0.6)
|
||
|
|
||
|
def __init__(self, density: float, color: Cq.Color):
|
||
|
self.density = density
|
||
|
self.color = color
|