Загрузка данных


(defun c:ДЕТАЛИ ( / oldos)
  (setq oldos (getvar "OSMODE"))
  (setvar "OSMODE" 0)
  (setvar "CMDECHO" 0)

  ;; =============================================================
  ;; ДЕТАЛЬ 1: КРЫШКА (Базовый центр: X=100, Y=100)
  ;; =============================================================
  (setq ox1 100.0 oy1 100.0)
  (setq cx1 ox1 cy1 (+ oy1 75.0))

  ;; 1. Отверстия в нижней части (3 шт. D=18, R=9)
  (command "_circle" (list (- ox1 42) oy1) 9.0)
  (command "_circle" (list ox1 oy1) 9.0)
  (command "_circle" (list (+ ox1 42) oy1) 9.0)

  ;; 2. Центральная часть (D=66, R=33)
  (command "_circle" (list cx1 cy1) 33.0)

  ;; 7 отверстий D=10 (R=5) на окружности D=48 (R=24)
  (setq i 0)
  (while (< i 7)
    (setq ang (+ (/ pi 2.0) (* i (/ (* 2.0 pi) 7.0))))
    (command "_circle" (list (+ cx1 (* 24.0 (cos ang))) (+ cy1 (* 24.0 (sin ang)))) 5.0)
    (setq i (1+ i))
  )

  ;; 3. Верхние ушки (2 шт. D=12, R=6)
  (command "_circle" (list (- cx1 43) cy1) 6.0)
  (command "_circle" (list (+ cx1 43) cy1) 6.0)

  ;; 4. Внешний контур крышки
  ;; Вертикальные боковые линии
  (command "_line" (list (- ox1 55) oy1) (list (- ox1 55) cy1) "")
  (command "_line" (list (+ ox1 55) oy1) (list (+ ox1 55) cy1) "")

  ;; Верхняя дуга R70
  (setq r70_y (- cy1 38.923))
  (setq a70 (atan 38.923 43.0))
  (setq p70_l (list (- cx1 (* 70.0 (cos a70))) (+ r70_y (* 70.0 (sin a70)))))
  (setq p70_r (list (+ cx1 (* 70.0 (cos a70))) (+ r70_y (* 70.0 (sin a70)))))
  (command "_arc" p70_l "_c" (list cx1 r70_y) p70_r)

  ;; Верхние ушки R12
  (command "_arc" (list (- ox1 55) cy1) "_c" (list (- cx1 43) cy1) p70_l)
  (command "_arc" p70_r "_c" (list (+ cx1 43) cy1) (list (+ ox1 55) cy1))

  ;; Внутренние сопряжения R8 ушек с окружностью R33
  (command "_arc" (list 105.318 (+ cy1 -32.562)) "_c" (list (+ cx1 6.605) (- cy1 40.465)) (list 121.163 (+ cy1 -24.279)))
  (command "_arc" (list 78.837 (+ cy1 -24.279)) "_c" (list (- cx1 6.605) (- cy1 40.465)) (list 94.682 (+ cy1 -32.562)))

  ;; Нижние внешние дуги R13
  (command "_arc" (list (- ox1 55) oy1) "_c" (list (- ox1 42) oy1) (list 70.746 97.401))
  (command "_arc" (list 129.254 97.401) "_c" (list (+ ox1 42) oy1) (list (+ ox1 55) oy1))

  ;; Нижний фигурный контур с сопряжениями R10
  (command "_arc" (list 70.746 97.401) "_c" (list 58.036 95.402) (list 90.268 97.701))
  (command "_arc" (list 90.268 97.701) "_c" (list ox1 oy1) (list 109.732 97.701))
  (command "_arc" (list 109.732 97.701) "_c" (list 141.964 95.402) (list 129.254 97.401))


  ;; =============================================================
  ;; ДЕТАЛЬ 2: ЦИЛИНДР (Базовый центр: X=300, Y=100)
  ;; =============================================================
  (setq ox2 300.0 oy2 100.0)

  ;; 1. Внутреннее отверстие D=24 (R=12) и средняя окружность D=60 (R=30)
  (command "_circle" (list ox2 oy2) 12.0)
  (command "_circle" (list ox2 oy2) 30.0)

  ;; 2. Нижние отверстия (2 шт. D=18, R=9)
  (setq b1_x (- ox2 22.0) b1_y (- oy2 24.597))
  (setq b2_x (+ ox2 22.0) b2_y (- oy2 24.597))
  (command "_circle" (list b1_x b1_y) 9.0)
  (command "_circle" (list b2_x b2_y) 9.0)

  ;; 3. Верхний овальный паз (R=10, длина 34, центр верхний Y=175, нижний Y=141)
  (command "_line" (list (- ox2 10.0) 141.0) (list (- ox2 10.0) 175.0) "")
  (command "_line" (list (+ ox2 10.0) 141.0) (list (+ ox2 10.0) 175.0) "")
  (command "_arc" (list (- ox2 10.0) 175.0) "_c" (list ox2 175.0) (list (+ ox2 10.0) 175.0))
  (command "_arc" (list (+ ox2 10.0) 141.0) "_c" (list ox2 141.0) (list (- ox2 10.0) 141.0))

  ;; 4. Внешняя стойка R20 и сопряжения R10 к окружности D=100 (R=50)
  (command "_line" (list (- ox2 20.0) 151.962) (list (- ox2 20.0) 175.0) "")
  (command "_line" (list (+ ox2 20.0) 151.962) (list (+ ox2 20.0) 175.0) "")
  (command "_arc" (list (- ox2 20.0) 175.0) "_c" (list ox2 175.0) (list (+ ox2 20.0) 175.0))

  ;; Сопряжения R10 стойки к D=100
  (command "_arc" (list (+ ox2 25.0) 143.301) "_c" (list (+ ox2 30.0) 151.962) (list (+ ox2 20.0) 151.962))
  (command "_arc" (list (- ox2 20.0) 151.962) "_c" (list (- ox2 30.0) 151.962) (list (- ox2 25.0) 143.301))

  ;; Дуги окружности D=100 (R=50) по бокам
  (command "_arc" (list 329.584 95.020) "_c" (list ox2 oy2) (list (+ ox2 25.0) 143.301))
  (command "_arc" (list (- ox2 25.0) 143.301) "_c" (list ox2 oy2) (list 270.416 95.020))

  ;; Нижние ушки R17
  (command "_arc" (list 264.499 94.024) "_c" (list b1_x b1_y) (list 294.261 70.445))
  (command "_arc" (list 305.739 70.445) "_c" (list b2_x b2_y) (list 335.501 94.024))

  ;; Нижнее центральное сопряжение R6
  (command "_arc" (list 294.261 70.445) "_c" (list ox2 68.695) (list 305.739 70.445))

  ;; Верхние сопряжения R6 (между ушками R17 и окружностью D=60)
  (command "_arc" (list 329.584 95.020) "_c" (list 335.501 94.024) (list 331.979 89.155))
  (command "_arc" (list 268.021 89.155) "_c" (list 264.499 94.024) (list 270.416 95.020))

  (setvar "OSMODE" oldos)
  (command "_zoom" "_e")
  (princ "\nОбе детали успешно построены!")
  (princ)
)