"""Кнопка и зуб поворачиваются на двух торсионных перемычках. Показан цикл отжатия и возврата. Деформация задана геометрически, без расчёта напряжений.""" import FreeCAD # noqa: F401 (initialize the CAD runtime first) # isort: split import math import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1])) from common import App, Part, Piece, V, box, join, main, params, require MODEL_ID = "torsion" DEFAULTS = { "width": 42, "depth": 32, "height": 12, "beam_thickness": 2, "flexure_thickness": 1.2, "button_angle": 16, "clearance": 0.3, } NOTE = "Кнопка и зуб поворачиваются на двух торсионных перемычках. Показан цикл отжатия и возврата. Деформация задана геометрически, без расчёта напряжений." MODE = "elastic" def make_parts(supplied=None): p = params(DEFAULTS, supplied) w, d, h, b, f, a, c = [ p[k] for k in ( "width", "depth", "height", "beam_thickness", "flexure_thickness", "button_angle", "clearance", ) ] require( w > 32 and d > 20 and h > 7 and f < b, "Allow space around the rotating arm" ) base = box(-w / 2, -d / 2, 0, w / 2 + 15, d, 3) for y in (-d / 2, d / 2 - 4): base = join(base, box(-3, y, 3, 6, 4, h - 3 + f)) receiver = join(box(22, -8, 0, 4, 16, h + 10), box(16, -8, h + 6 + c, 10, 16, 3)) def latch(t): angle = a * math.sin(math.pi * t) arm = join(box(-18, -3, h, 36, 6, b), box(15, -3, h + b, 3, 6, 4)).rotated( V(0, 0, h), V(0, 1, 0), angle ) arms = [arm] for sign in (-1, 1): wires = [] for y, ang in [(sign * 3, angle), (sign * (d / 2 - 3), 0)]: pts = [ V(x, y, z).sub(V(0, 0, h)) for x, z in [ (-f / 2, h - f / 2), (f / 2, h - f / 2), (f / 2, h + f / 2), (-f / 2, h + f / 2), ] ] pts = [ App.Rotation(V(0, 1, 0), ang).multVec(v) + V(0, 0, h) for v in pts ] wires.append(Part.makePolygon(pts + pts[:1])) arms.append(Part.makeLoft(wires, True, False)) return join(base, *arms) return [ Piece("latch", "Кнопка с торсионами и основанием", latch(1), deform=latch), Piece("receiver", "Ответная полка", receiver), ] if __name__ == "__main__": main(make_parts, DEFAULTS, MODEL_ID, __file__, NOTE, MODE)