知識社群
登入
中文(台灣)
English(US)
Q&A
線上人數:
434
AutoCAD開放式教學
社群功能
社群首頁
文件區
(34)
精華區
行事曆
活動
討論區
(454)
即時塗鴉牆
問卷
相簿
(5)
申請加入社群
文件分類
[
總覽
]
未分類
(34)
程式設計相關
常用連結
版主在台灣大學 資工所 系統訓練班的 課程介紹網頁
良葛格的 C語言程式教學講義
社群資訊
訪客: 536726
文章: 34
討論: 454
公告: 2
容量: 剩餘
433 MB
(500 MB)
閱讀權限: 開放
分類:
電腦資訊 / 軟體教學
版主: 高顯忠
副版主: 無
位置:
AutoCAD開放式教學
>
討論區
>
討論
教AutoCAD 作分角線的 AutoLISP 程式分享
(高顯忠,
sjgau4311@gmail.com
, 2010-11-11 17:00)
1樓
; file: div-ang.LSP
(defun mid-point(p1 p2 / x1 y1 x2 y2)
(setq x1 (car p1)
y1 (cadr p1)
x2 (car p2)
y2 (cadr p2))
(list (/ (+ x1 x2) 2.0) (/ (+ y1 y2) 2.0))
); end of mid-point()
; ------------------------------
-----------------
(defun c:div-ang( / e1 e2 p1 p2 pm1 p1a pm2 p2a p3 t1 t2 s1 s2 ss pm)
(setq e1 (entsel "\n Pick the 1st LINE: ")
e2 (entsel "\n Pick the 2nd LINE: "))
(setq p1 (cadr e1)
p2 (cadr e2))
(setq p1 (osnap p1 "nea")
p2 (osnap p2 "nea"))
(setq pm1 (osnap p1 "mid")
p1a (osnap p1 "end"))
(setq pm2 (osnap p2 "mid")
p2a (osnap p2 "end"))
(setq p3 (inters pm1 p1a pm2 p2a nil))
(setq t1 (angle p3 p1)
t2 (angle p3 p2)
s1 (distance p3 p1)
s2 (distance p3 p2))
(setq ss (+ s1 s2))
(setq p1 (polar p3 t1 ss)
p2 (polar p3 t2 ss))
(setq pm (mid-point p1 p2))
(command "LINE" p3 pm "")
); end of c:div-ang()
(princ "\n Do the new command of: DIV-ANG ")
(princ)
; end of file
© 2010 FormosaSoft Corp.
http://www.powercam.com.tw
service@powercam.com.tw
All rights reserved.
; file: div-ang.LSP
(defun mid-point(p1 p2 / x1 y1 x2 y2)
(setq x1 (car p1)
y1 (cadr p1)
x2 (car p2)
y2 (cadr p2))
(list (/ (+ x1 x2) 2.0) (/ (+ y1 y2) 2.0))
); end of mid-point()
; ------------------------------
(defun c:div-ang( / e1 e2 p1 p2 pm1 p1a pm2 p2a p3 t1 t2 s1 s2 ss pm)
(setq e1 (entsel "\n Pick the 1st LINE: ")
e2 (entsel "\n Pick the 2nd LINE: "))
(setq p1 (cadr e1)
p2 (cadr e2))
(setq p1 (osnap p1 "nea")
p2 (osnap p2 "nea"))
(setq pm1 (osnap p1 "mid")
p1a (osnap p1 "end"))
(setq pm2 (osnap p2 "mid")
p2a (osnap p2 "end"))
(setq p3 (inters pm1 p1a pm2 p2a nil))
(setq t1 (angle p3 p1)
t2 (angle p3 p2)
s1 (distance p3 p1)
s2 (distance p3 p2))
(setq ss (+ s1 s2))
(setq p1 (polar p3 t1 ss)
p2 (polar p3 t2 ss))
(setq pm (mid-point p1 p2))
(command "LINE" p3 pm "")
); end of c:div-ang()
(princ "\n Do the new command of: DIV-ANG ")
(princ)
; end of file