56 lines
1.3 KiB
Python
56 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
This script is designed to create atx_psu extrusion with build123d.
|
|
"""
|
|
from typing import Optional, Tuple
|
|
from pydantic import BaseModel
|
|
from build123d import *
|
|
from ocp_vscode import *
|
|
|
|
from wetrocks import config as conf
|
|
|
|
config = conf.WetRocksConfig()
|
|
|
|
|
|
class AtxpsuConfig(BaseModel):
|
|
atx_psu_length: float = config.atx_psu_length
|
|
atx_psu_width: float = config.atx_psu_width
|
|
atx_psu_height: float = config.atx_psu_height
|
|
|
|
|
|
def create_atx_psu(
|
|
atx_psu_length: float,
|
|
atx_psu_width: float,
|
|
atx_psu_height: float,
|
|
) -> "BuildPart":
|
|
with BuildPart() as part:
|
|
with BuildSketch() as profile:
|
|
# Atxpsu Outline
|
|
with Locations((0, 0)):
|
|
RectangleRounded(
|
|
atx_psu_width,
|
|
atx_psu_height,
|
|
0.5,
|
|
align=(Align.MIN, Align.MIN),
|
|
mode=Mode.ADD,
|
|
)
|
|
|
|
extrude(amount=atx_psu_length)
|
|
|
|
part.color = Color("Black", 0.9)
|
|
return part
|
|
|
|
|
|
def main():
|
|
atx_psu_config = AtxpsuConfig()
|
|
atx_psu = create_atx_psu(**atx_psu_config.model_dump())
|
|
show_object(
|
|
atx_psu,
|
|
name="Atxpsu",
|
|
black_edges=True,
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|