Это обновлённый AiSearch.Что-то работает не так? Расскажите или вернитесь на прежнюю версиюСообщитьПрежняя версия✕

Монтажная плита с пазом: скрипт CadQuery (model.py)

Автор: User 254f7fd2

Построено нейросетью по описанию: «Монтажная плита 120×80×10 мм: четыре отверстия 8 мм в углах на расстоянии 10 мм от краёв, сквозной паз 40×10 мм в центре». Здесь все файлы модели: STEP, STL, GLB, архив, скрипт CadQuery и картинки. Сделать свою деталь: aisearch.ru/aimedia/3d-model

Монтажная плита с пазом - model.py · 1.6 KB · text/x-pythonСделать своёОткрыть в JupyterСкачать
import cadquery as cq
import cadkit as ck

# Parameters
PLATE_L = 120.0       # Length of the plate (mm)
PLATE_W = 80.0        # Width of the plate (mm)
PLATE_T = 10.0        # Thickness of the plate (mm)
HOLE_D = 8.0          # Diameter of mounting holes (mm)
HOLE_OFFSET = 10.0    # Distance of holes from edges (mm)
SLOT_L = 40.0         # Length of the central slot (mm)
SLOT_W = 10.0         # Width of the central slot (mm)
CORNER_R = 2.0        # Fillet radius for the plate corners (mm)

# Calculate hole positions
# Holes are at (±(L/2 - offset), ±(W/2 - offset))
hx = (PLATE_L / 2) - HOLE_OFFSET
hy = (PLATE_W / 2) - HOLE_OFFSET
hole_points = [
    (-hx, -hy),
    (hx, -hy),
    (hx, hy),
    (-hx, hy)
]

# Build the plate using cadkit.plate as a base or custom CQ
# Since we need a specific slot and specific holes, we'll build it with CQ
# to ensure the slot is precisely centered and the corners are handled.

plate = (
    cq.Workplane("XY")
    .box(PLATE_L, PLATE_W, PLATE_T, centered=(True, True, False))
    .edges("|Z").fillet(CORNER_R)
)

# Add the mounting holes
plate = (
    plate.faces(">Z").workplane()
    .pushPoints(hole_points)
    .hole(HOLE_D)
)

# Add the central slot
# The slot is 40x10, centered on the plate
plate = (
    plate.faces(">Z").workplane()
    .rect(SLOT_L, SLOT_W)
    .cutBlind(-PLATE_T)
)

# Final touch: chamfer the top edges of the slot for a cleaner look
plate = plate.edges(">Z").chamfer(0.5)

# Assembly for the final result
assy = cq.Assembly()
assy.add(plate, name="mounting_plate", color=cq.Color(0.7, 0.7, 0.7))

result = assy

Похожее