TEMP build123d extremely basic panel demo
Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
This commit is contained in:
parent
e63a5da6a2
commit
0dcd1cb5ff
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,5 +1,7 @@
|
||||
build/
|
||||
venv/
|
||||
*.egg-info/
|
||||
.tox/
|
||||
|
||||
*.pyc
|
||||
*.sw*
|
||||
|
45
src/bss/panels.py
Normal file
45
src/bss/panels.py
Normal file
@ -0,0 +1,45 @@
|
||||
"""The base panel from which all other panels inherit.
|
||||
|
||||
SPDX-FileCopyrightText: © 2023 Brian S. Stephan <bss@incorporeal.org>
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""
|
||||
import logging
|
||||
|
||||
import build123d as bd
|
||||
|
||||
from bss import core, layouts
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Panel(bd.BasePartObject):
|
||||
"""A panel meant to be secured to the top or bottom of a base.
|
||||
|
||||
This is a hard box by default as an inset panel will be flush with the frame.
|
||||
"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""Create our part."""
|
||||
with bd.BuildPart() as panel:
|
||||
bd.Box(core.PANEL_X, core.PANEL_Y, core.PANEL_Z)
|
||||
logger.info(panel.faces().sort_by(bd.Axis.Z))
|
||||
with bd.Locations(panel.faces().sort_by(bd.Axis.Z)[-1]):
|
||||
with bd.Locations((core.PANEL_TO_FRAME_POINT_X, core.PANEL_TO_FRAME_POINT_Y),
|
||||
(-core.PANEL_TO_FRAME_POINT_X, core.PANEL_TO_FRAME_POINT_Y),
|
||||
(-core.PANEL_TO_FRAME_POINT_X, -core.PANEL_TO_FRAME_POINT_Y),
|
||||
(core.PANEL_TO_FRAME_POINT_X, -core.PANEL_TO_FRAME_POINT_Y)):
|
||||
bd.CounterSinkHole(core.M4_BOLT_RADIUS, core.M4_BOLT_COUNTERSINK_RADIUS)
|
||||
super().__init__(panel.part, *args, **kwargs)
|
||||
|
||||
|
||||
with bd.BuildPart() as sega_2p_panel:
|
||||
panel = Panel()
|
||||
with layouts.Layout(layouts.SEGA_2P_SIX_BUTTON):
|
||||
with bd.Locations((5, 45)):
|
||||
with bd.Locations(panel.faces().sort_by(bd.Axis.Z)[0]):
|
||||
core.CutoutButtonHole(layouts.SEGA_2P_SIX_BUTTON['radius'])
|
||||
|
||||
try:
|
||||
show_object(sega_2p_panel)
|
||||
except NameError:
|
||||
pass
|
Loading…
Reference in New Issue
Block a user