mirror of
https://github.com/yeicor-3d/yet-another-cad-viewer.git
synced 2025-12-19 22:24:17 +01:00
Also color edges and vertices, add examples and minor improvements
This commit is contained in:
@@ -3,6 +3,7 @@ import logging
|
||||
import os
|
||||
|
||||
from build123d import * # Also works with cadquery objects!
|
||||
from build123d import Compound
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
@@ -15,9 +16,14 @@ with BuildPart() as example:
|
||||
Box(10, 10, 5)
|
||||
Cylinder(4, 5, mode=Mode.SUBTRACT)
|
||||
|
||||
# Show it in the frontend with hot-reloading
|
||||
show(example)
|
||||
# Custom colors (optional)
|
||||
example.color = (0.1, 0.3, 0.1, 1) # RGBA
|
||||
to_highlight = example.edges().group_by(Axis.Z)[-1]
|
||||
example_hl = Compound(to_highlight).translate((0, 0, 1e-3)) # To avoid z-fighting
|
||||
example_hl.color = (1, 1, .0, 1)
|
||||
|
||||
# Show it in the frontend with hot-reloading
|
||||
show(example, example_hl)
|
||||
|
||||
# %%
|
||||
|
||||
|
||||
Reference in New Issue
Block a user