Здравствуйте, Посетитель | Регистрация | Вход
[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]

Страница 1 из 11
Форум С++ Builder Helper » Web технологии » Графические редакторы » AutoCad и Lisp (делимся опытом написания скриптов к Автокаду)
AutoCad и Lisp
InfectorДата: Понедельник, 10.12.07, 23:36 | Сообщение # 1
Группа: Пользователи
Сообщений: 13
Статус: Offline
Предлагаю поделиться опытом по автоматизации рисования нудных частоповторяющихся элементов типа болтов, швеллеров и т.п.
 
InfectorДата: Вторник, 11.12.07, 21:56 | Сообщение # 2
Группа: Пользователи
Сообщений: 13
Статус: Offline
Рисование Двухмерного болта. Перед запуском скрипта нужно включить приоритет ввода с клавиатуры над привязками.

(setq O(getpoint "[положение исходной точки]"))
(setq S1(getdist "[Введите размер под ключ]"))
(setq H1(getdist "[Введите высоту головки]"))
(setq D1(getdist "[Введите диаметр болта]"))
(setq L1(getdist "[Введите длину болта]"))
(setq L0(getdist "[Введите Длину резьбы]"))
(setq p(getdist "[Введите шаг резьбы]"))
(setq alfa(getdist "[Введите угол наклона болта к X]"))

(setq d2(- D1 p))
(setq l2(- L1 (/ p 2)))

(setq T1(list 0 (/ D1 2)))
(setq T2(list l2 (/ D1 2)))
(setq T3(list L1 (/ d2 2)))
(setq T4(list L1 0))

(command "_line" "0,0" T1 "")
(Setq line1(entlast))
(command "_line" T1 T2 "")
(Setq line2(entlast))
(command "_line" T2 T3 "")
(Setq line3(entlast))
(command "_line" T3 T4 "")
(Setq line4(entlast))

(setq DS1(/ S1 0.866))
(setq RS1(/ DS1 2))
(Setq rs2(/ RS1 2))
(setq fsk1(/ rs2 3))
(setq fsk2(* fsk1 0.57735))

(setq T5(list 0 RS1))
(setq T6(list (- fsk2 H1) RS1))
(setq T7(list (- 0 H1) (- RS1 fsk1)))
(setq T8(list (- 0 H1) 0))

(command "_line" "0,0" T5 "")
(setq line5(entlast))
(command "_line" T5 T6 "")
(setq line6(entlast))
(command "_line" T6 T7 "")
(setq line7(entlast))
(command "_line" T7 T8 "")
(setq line8(entlast))

(setq T9(list (- fsk2 H1) rs2))
(setq T10(list 0 rs2))

(command "_line" T9 T10 "")
(setq line9(entlast))

(setq T11(list (- L1 L0) (/ d2 2)))
(setq T12(list (- L1 L0) (/ D1 2)))
(setq T13(list (- L1 L0) 0))

(command "_line" T12 T13 "")
(setq line10(entlast))
(command "_line" T11 T3 "")
(setq line11(entlast))

(setq T14a(list l2 0))
(command "_line" T2 T14a "")
(setq line12(entlast))

(setq T14(list (- 0 H1) (* rs2 1.5)))
(command "_arc" T9 T14 T6)
(setq arc1(entlast))

(command "_mirror" line1 "" T8 "0,0" "_N")
(setq line1a(entlast))
(command "_mirror" line2 "" T8 "0,0" "_N")
(setq line2a(entlast))
(command "_mirror" line3 "" T8 "0,0" "_N")
(setq line3a(entlast))
(command "_mirror" line4 "" T8 "0,0" "_N")
(setq line4a(entlast))
(command "_mirror" line5 "" T8 "0,0" "_N")
(setq line5a(entlast))
(command "_mirror" line6 "" T8 "0,0" "_N")
(setq line6a(entlast))
(command "_mirror" line7 "" T8 "0,0" "_N")
(setq line7a(entlast))
(command "_mirror" line8 "" T8 "0,0" "_N")
(setq line8a(entlast))
(command "_mirror" line9 "" T8 "0,0" "_N")
(setq line9a(entlast))
(command "_mirror" line10 "" T8 "0,0" "_N")
(setq line10a(entlast))
(command "_mirror" line11 "" T8 "0,0" "_N")
(setq line11a(entlast))
(command "_mirror" line1 "" T8 "0,0" "_N")
(setq line1a(entlast))
(command "_mirror" line12 "" T8 "0,0" "_N")
(setq line12a(entlast))
(command "_mirror" arc1 "" T8 "0,0" "")
(setq arc1a(entlast))

(setq T15(list (- fsk2 H1) (- 0 rs2)))
(command "_arc" T9 T8 T15)
(setq arc2(entlast))
(command "_line" T8 T4 "")
(setq line13(entlast))

(command "_move" line1 line1a line2 line2a line3 line3a line4 line4a line5 line5a
line6 line6a line7 line7a line8 line8a line9 line9a line10 line10a line11 line11a
line12 line12a line13 arc1 arc1a arc2 "" "0,0" O)
(command "_rotate" line1 line1a line2 line2a line3 line3a line4 line4a line5 line5a
line6 line6a line7 line7a line8 line8a line9 line9a line10 line10a line11 line11a
line12 line12a line13 arc1 arc1a arc2 "" O alfa)

 
InfectorДата: Вторник, 11.12.07, 21:58 | Сообщение # 3
Группа: Пользователи
Сообщений: 13
Статус: Offline
То же самое для гайки

(setq O(getpoint "[Введите исходную точку]"))
(setq S1(getdist "[Введите размер под ключ]"))
(setq H1(getdist "[Введите высоту гайки]"))
(setq D1(getdist "[Введите диаметр отверстия]"))
(setq alfa(getdist "[введите угол наклона к оси X]"))

(setq Sp1(/ S1 1.732))
(setq Spp1(/ Sp1 2))
(setq fsk1(/ Spp1 3))
(setq fsk2(* fsk1 0.5773))

(Setq T1(list 0 (- Sp1 fsk1)))
(setq T2(list fsk2 Sp1))
(setq T3(list (- H1 fsk2) Sp1))
(setq T4(list H1 (- Sp1 fsk1)))
(setq T5(list H1 0))

(setq T6(list fsk2 Spp1))
(setq T7(list (- H1 fsk2) Spp1))
(setq T8(list 0 (* Spp1 1.5)))
(setq T9(list (- H1 fsk2) (- 0 Spp1)))
(setq T10(list H1 (* Spp1 1.5)))
(setq T11(list fsk2 (- 0 Spp1)))

(command "_line" "0,0" T1 "")
(setq line1(entlast))
(command "_line" T1 T2 "")
(setq line2(entlast))
(command "_line" T2 T3 "")
(setq line3(entlast))
(command "_line" T3 T4 "")
(setq line4(entlast))
(command "_line" T4 T5 "")
(setq line5(entlast))
(command "_line" T6 T7 "")
(setq line6(entlast))
(command "_arc" T6 T8 T2)
(setq arc1(entlast))
(command "_arc" T7 T10 T3)
(setq arc2(entlast))

(command "_mirror" line1 "" "0,0" T5 "_N")
(setq line1a(entlast))
(command "_mirror" line2 "" "0,0" T5 "_N")
(setq line2a(entlast))
(command "_mirror" line3 "" "0,0" T5 "_N")
(setq line3a(entlast))
(command "_mirror" line4 "" "0,0" T5 "_N")
(setq line4a(entlast))
(command "_mirror" line5 "" "0,0" T5 "_N")
(setq line5a(entlast))
(command "_mirror" line6 "" "0,0" T5 "_N")
(setq line6a(entlast))
(command "_mirror" arc1 "" "0,0" T5 "_N")
(setq arc1a(entlast))
(command "_mirror" arc2 "" "0,0" T5 "_N")
(setq arc2a(entlast))

(command "_arc" T6 "0,0" T11)
(setq arc3(entlast))
(command "_arc" T7 T5 T9)
(setq arc4(entlast))

(command "_move" line1 line1a line2 line2a line3 line3a line4 line4a line5 line5a
line6 line6a arc1 arc1a arc2 arc2a arc3 arc4 "" "0,0" O)
(command "_rotate" line1 line1a line2 line2a line3 line3a line4 line4a line5 line5a
line6 line6a arc1 arc1a arc2 arc2a arc3 arc4 "" O alfa)

 
Форум С++ Builder Helper » Web технологии » Графические редакторы » AutoCad и Lisp (делимся опытом написания скриптов к Автокаду)
Страница 1 из 11
Поиск:

Дизайн — Артур Нецветаев © 2005-2008 Builder Helper Group Хостинг от uCoz