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

Маховичок с выемками: скрипт CadQuery (model.py)

Автор: User 254f7fd2

Построено нейросетью по описанию: «Маховичок: диск диаметром 60 мм и толщиной 12 мм, по краю шесть полукруглых выемок радиусом 6 мм для пальцев, ступица диаметром 22 мм выступает на 8 мм, сквозное отверстие 8 мм». Здесь все файлы модели: STEP, STL, GLB, архив, скрипт CadQuery и картинки. Сделать свою деталь: aisearch.ru/aimedia/3d-model

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

# Parameters
DISK_D = 60.0          # Main disk diameter
DISK_T = 12.0          # Main disk thickness
HUB_D = 22.0           # Hub diameter
HUB_H = 8.0            # Hub protrusion height (above the disk)
BORE_D = 8.0           # Through hole diameter
FINGER_R = 6.0         # Radius of finger notches
FINGER_COUNT = 6       # Number of notches
FILLET_R = 0.5         # Small fillet for edges

# 1. Create the main disk
disk = (
    cq.Workplane("XY")
    .circle(DISK_D / 2)
    .extrude(DISK_T)
)

# 2. Create the finger notches
# We create a cylinder for the notch and place it on the perimeter
notch_tool = (
    cq.Workplane("XY")
    .circle(FINGER_R)
    .extrude(DISK_T + 2)
)

# Subtract notches from disk using a loop
flywheel = disk
for i in range(FINGER_COUNT):
    angle = i * (360 / FINGER_COUNT)
    x = (DISK_D / 2) * math.cos(math.radians(angle))
    y = (DISK_D / 2) * math.sin(math.radians(angle))
    # Translate the notch tool and subtract it
    flywheel = flywheel.cut(notch_tool.translate((x, y, -1)))

# 3. Create the hub
# Hub is a cylinder on top of the disk
hub = (
    cq.Workplane("XY")
    .workplane(offset=DISK_T)
    .circle(HUB_D / 2)
    .extrude(HUB_H)
)

# Combine disk and hub
flywheel = flywheel.union(hub)

# 4. Create the through hole
# Bore goes through the entire height
flywheel = (
    flywheel.faces(">Z")
    .workplane()
    .hole(BORE_D)
)

# 5. Finishing touches
# Instead of complex filters, we use simple selectors for the top and bottom edges
# Fillet the top edge of the hub
flywheel = flywheel.edges(">Z").fillet(FILLET_R)
# Fillet the bottom edge of the disk
flywheel = flywheel.edges("<Z").fillet(FILLET_R)

# Add a small chamfer to the bore entrance
flywheel = flywheel.faces(">Z").workplane().chamfer(BORE_D, 0.5)

# Final Assembly
assy = cq.Assembly()
assy.add(flywheel, name="flywheel", color=cq.Color(0.7, 0.7, 0.7))

result = assy

Похожее