feat: Material list

This commit is contained in:
Leni Aniva 2024-06-26 09:48:32 -04:00
parent c8613b5f18
commit 57e1bce3e7
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
2 changed files with 26 additions and 0 deletions

View File

@ -15,3 +15,10 @@ and this should succeed
python3 -c "import nhf" python3 -c "import nhf"
``` ```
## Testing
Run all tests with
``` sh
python3 -m unittest
```

19
nhf/materials.py Normal file
View File

@ -0,0 +1,19 @@
"""
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)
ACRYLIC_BLACK = 0.5, _color('gray50', 0.6)
def __init__(self, density: float, color: Cq.Color):
self.density = density
self.color = color