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

Прямозубая шестерня, 30 зубьев: скрипт CadQuery (model.py)

Автор: User 254f7fd2

Построено нейросетью по описанию: «Цилиндрическая прямозубая шестерня: модуль 1,5, 30 зубьев, ширина 12 мм, отверстие под вал 10 мм со шпоночным пазом шириной 3 мм». Здесь все файлы модели: STEP, STL, GLB, архив, скрипт CadQuery и картинки. Сделать свою деталь: aisearch.ru/aimedia/3d-model

Прямозубая шестерня, 30 зубьев - model.py · 1.3 KB · text/x-pythonСделать своёОткрыть в JupyterСкачать
import cadquery as cq
import cadkit as ck

# Parameters
MODULE = 1.5           # Module of the gear
TEETH = 30             # Number of teeth
WIDTH = 12.0           # Width of the gear (face width)
BORE_D = 10.0          # Shaft diameter
KEYWAY_W = 3.0         # Keyway width
KEYWAY_H = 1.5         # Depth of the keyway slot above the bore radius

# Generate the gear using cadkit.
# ck.spur_gear creates the gear centered on the Z-axis.
# We set keyway=False and create it manually to ensure the 3mm width requirement.
gear = ck.spur_gear(
    module=MODULE, 
    teeth=TEETH, 
    width=WIDTH, 
    bore=BORE_D, 
    keyway=False
)

# Create a precise keyway cut.
# The gear is centered at Z=0 by cadkit.
# We create a rectangle on the XY plane and extrude it.
key_slot = (
    cq.Workplane("XY")
    .center(0, BORE_D/2) 
    .rect(KEYWAY_W, KEYWAY_H) 
    .extrude(WIDTH) # Extrude in +Z direction
    .translate((0, 0, -WIDTH/2)) # Center the extrusion on Z=0 to match the gear
)

# Subtract the keyway from the gear
final_gear = gear.cut(key_slot)

# Move the gear so it stands on the XY plane (z=0)
final_gear = final_gear.translate((0, 0, WIDTH/2))

# Create Assembly
assy = cq.Assembly()
assy.add(final_gear, name="spur_gear", color=cq.Color(0.7, 0.7, 0.7))

result = assy

Похожее