[已解決]如何在AutoLISP中,除了有預設值設定之外,可記錄上一次的設定值
+7
cadbill
judyyai
sanshing
leoneriol
Tiger&蘋果爸
張譽璋
swcforest
11 posters
AutoCAD顧問 :: 技術(發言等級:一般會員) :: :: 進階討論 :: 已解決主題精華區
第1頁(共1頁)
[已解決]如何在AutoLISP中,除了有預設值設定之外,可記錄上一次的設定值
各位大大好
小弟又有一個問題了
最近程式寫完後
發現想要在LISP中設定好預設值之後
能夠在我第一次啟動輸入時 DCL畫面 出現預設值
輸入完各項值後
在我第二次啟用時 能夠抓到我第一次所輸入的值
而非預設值
(setq w (getreal "\n寬<8>:"))
(if (null w) (setq w 8.0))
預設值是8 第一次使用時輸入寬度為10
下一次就自動變成10
-------------------------------------------分隔線 以上已解決
根據張大大的協助已經可以寫了
但是如果我在對話框的話 該如何寫出
(set_tile "kw" "8") 這個部分是否該寫為 (set_tile "kw" "wold")
(setq wold w)
(if (null wold) (setq wold 8.0))
(princ "\n寬 <")
(princ wold)
(princ ">: ")
(setq w (getreal))
(if (null w) (setq w wold))
小弟又有一個問題了
最近程式寫完後
發現想要在LISP中設定好預設值之後
能夠在我第一次啟動輸入時 DCL畫面 出現預設值
輸入完各項值後
在我第二次啟用時 能夠抓到我第一次所輸入的值
而非預設值
(setq w (getreal "\n寬<8>:"))
(if (null w) (setq w 8.0))
預設值是8 第一次使用時輸入寬度為10
下一次就自動變成10
-------------------------------------------分隔線 以上已解決
根據張大大的協助已經可以寫了
但是如果我在對話框的話 該如何寫出
(set_tile "kw" "8") 這個部分是否該寫為 (set_tile "kw" "wold")
(setq wold w)
(if (null wold) (setq wold 8.0))
(princ "\n寬 <")
(princ wold)
(princ ">: ")
(setq w (getreal))
(if (null w) (setq w wold))
swcforest 在 2009-11-01, 13:13 作了第 3 次修改
swcforest- 初級會員
- 文章總數 : 113
年齡 : 45
來自 : 台中市南區
職業 : 土木工程設計
愛好 : 遊山玩水及AutoLISP
個性 : 開朗活潑
使用年資 : 六七年了
使用版本 : AutoCAD 2016
積分 : 1
經驗值 : 6243
威望值 : 10
注冊日期 : 2008-07-27
[回覆]如何在AutoLISP中,除了有預設值設定之外,可記錄上一次的設定值
你可以參考下列程式的寫法
-------------------
***回覆可見***
-------------------
你必須將wold變數提列為區域變數,w為整體變數不需提列.
其實就是必須把輸入的值轉換到另一變數中,在將上一次舊的變數值給清除,簡單的解釋就是交換變數值.
-------------------
***回覆可見***
-------------------
你必須將wold變數提列為區域變數,w為整體變數不需提列.
其實就是必須把輸入的值轉換到另一變數中,在將上一次舊的變數值給清除,簡單的解釋就是交換變數值.
張譽璋 在 2009-10-30, 00:19 作了第 1 次修改
張譽璋- 榮譽顧問
- 文章總數 : 304
年齡 : 54
來自 : 彰化縣員林鎮
職業 : 機械設計工程師/AutoCAD講師/AutoCAD外掛系統開發/AutoCAD書籍作者
愛好 : 旅行及電影
個性 : 風趣健談
使用年資 : 25年
使用版本 : AutoCAD2010/2011/2012/2013
積分 : 20
經驗值 : 7520
威望值 : 641
發帖精華 : 2
回帖精華 : 1
注冊日期 : 2008-05-28
回復: [已解決]如何在AutoLISP中,除了有預設值設定之外,可記錄上一次的設定值
謝謝大大的指導
往後在autolisp的學習路程
還希望大大能不吝指教
再次感謝
往後在autolisp的學習路程
還希望大大能不吝指教
再次感謝
swcforest- 初級會員
- 文章總數 : 113
年齡 : 45
來自 : 台中市南區
職業 : 土木工程設計
愛好 : 遊山玩水及AutoLISP
個性 : 開朗活潑
使用年資 : 六七年了
使用版本 : AutoCAD 2016
積分 : 1
經驗值 : 6243
威望值 : 10
注冊日期 : 2008-07-27
回復: [已解決]如何在AutoLISP中,除了有預設值設定之外,可記錄上一次的設定值
當[問題]主題被回覆時,請原發問者測完之後要記得回報。期限內問題若順利解決,請編輯該主題在前面加入[已解決],顏色請指定為[無]。swcforest 寫到:謝謝大大的指導
往後在autolisp的學習路程
還希望大大能不吝指教
再次感謝
[說明]發表主題前,請遵守相關要領!
http://autocad.bestoforum.net/forum-f12/topic-t1521.htm
____________________________________________________________________________________
👉快速比例設定與出圖技巧-線上課程(點我)👈
回復: [已解決]如何在AutoLISP中,除了有預設值設定之外,可記錄上一次的設定值
感謝 張譽璋 的技術指導~張譽璋 寫到:你必須將wold變數提列為區域變數,w為整體變數不需提列.
其實就是必須把輸入的值轉換到另一變數中,在將上一次舊的變數值給清除,簡單的解釋就是交換變數值.
感恩...
____________________________________________________________________________________
👉快速比例設定與出圖技巧-線上課程(點我)👈
回復: [已解決]如何在AutoLISP中,除了有預設值設定之外,可記錄上一次的設定值
學習一下.....感恩
leoneriol- 榮譽顧問
- 文章總數 : 818
年齡 : 40
來自 : 基隆市七堵區
職業 : 機電工程公司-繪圖(工地)
愛好 : 看小說
個性 : 不愛說話-反應慢
使用年資 : 6年
使用版本 : 2008 & 2012
積分 : 27
經驗值 : 9199
威望值 : 960
發帖精華 : 1
回帖精華 : 1
注冊日期 : 2009-03-12
sanshing- 一般會員
- 文章總數 : 18
年齡 : 55
來自 : taiwan
職業 : 工程師
個性 : 普通
經驗值 : 5780
威望值 : 0
注冊日期 : 2009-02-10
回復: [已解決]如何在AutoLISP中,除了有預設值設定之外,可記錄上一次的設定值
- 代碼:
(setq wold w)
(if (null wold) (setq wold 1.0))
(set_tile "kw" (rtos wold));將資料先轉換為字串再設定給對話框
.
省略
.
(action_tile "accept" "(ok)");定義按確定鍵後執行 ok 函數的內容
(action_tile "cancel" "(done_dialog 0)");定義按下取消鍵後必須傳回 0
(defun ok ()
(setq w (atof (get_tile "kw")));從對話框中取出新的設定值
(done_dialog 1);執行完後傳回 1
)
(setq ex (start_dialog));將傳回值儲存於 ex 變數中
(unload_dialog dcl_id)
取出對話框中新資料時,利用自行定義的函數運作,才能正常的執行.可以利用ex中的值決定程式執行範圍,值為0時馬上結束程式作取消動作,wold還是必須提列為區域變數,w則不需提列,作為整體變數.
張譽璋- 榮譽顧問
- 文章總數 : 304
年齡 : 54
來自 : 彰化縣員林鎮
職業 : 機械設計工程師/AutoCAD講師/AutoCAD外掛系統開發/AutoCAD書籍作者
愛好 : 旅行及電影
個性 : 風趣健談
使用年資 : 25年
使用版本 : AutoCAD2010/2011/2012/2013
積分 : 20
經驗值 : 7520
威望值 : 641
發帖精華 : 2
回帖精華 : 1
注冊日期 : 2008-05-28
回復: [已解決]如何在AutoLISP中,除了有預設值設定之外,可記錄上一次的設定值
麻煩張大指導一下我寫的LISP
(defun c:dam1()
(setq dcl_id (load_dialog "00swcforest"));;;載入00swcforest.dcl
(if (< dcl_id 0) (exit))
(new_dialog "dcl_dam1" dcl_id);;;呼叫00swcforest.dcl中的dcl_dam1
(setq wold w)
(if (null wold) (setq wold 8.0))
(set_tile "kw" (rtos wold)) ............以下省略
(set_tile "kh1" "3.5")
(show_sld "kimage1" "dam1")
(action_tile "accept" "(ok_dam1)(done_dialog 1)")
(setq dd (start_dialog))
(if (= dd 1)
(draw_dam1)
)
)
(defun ok_dam1()
(setq w (atof (get_tile "kw")))
......以下省略
(defun draw_dam1()
(startlsp)
(command "-layer" "m" "設計" "c" 2 "" "")
(command "-layer" "m" "DIM" "c" 4 "" "")
;;;基本資料輸入
(setq p1 (getpoint "\n請輸入一點:"))
;;; (setq w (getreal "\n寬<8>:"))
;;; (if (null w) (setq w 8.0))
;;; (setq h1 (getreal "\n高<3.5>"))
;;; (if (null h1) (setq h1 3.5))
............以下省略
(endlsp)
)
這樣子我使用的時候 還是不行
是否哪邊有誤 請大大指導迷津
(defun c:dam1()
(setq dcl_id (load_dialog "00swcforest"));;;載入00swcforest.dcl
(if (< dcl_id 0) (exit))
(new_dialog "dcl_dam1" dcl_id);;;呼叫00swcforest.dcl中的dcl_dam1
(setq wold w)
(if (null wold) (setq wold 8.0))
(set_tile "kw" (rtos wold)) ............以下省略
(set_tile "kh1" "3.5")
(show_sld "kimage1" "dam1")
(action_tile "accept" "(ok_dam1)(done_dialog 1)")
(setq dd (start_dialog))
(if (= dd 1)
(draw_dam1)
)
)
(defun ok_dam1()
(setq w (atof (get_tile "kw")))
......以下省略
(defun draw_dam1()
(startlsp)
(command "-layer" "m" "設計" "c" 2 "" "")
(command "-layer" "m" "DIM" "c" 4 "" "")
;;;基本資料輸入
(setq p1 (getpoint "\n請輸入一點:"))
;;; (setq w (getreal "\n寬<8>:"))
;;; (if (null w) (setq w 8.0))
;;; (setq h1 (getreal "\n高<3.5>"))
;;; (if (null h1) (setq h1 3.5))
............以下省略
(endlsp)
)
這樣子我使用的時候 還是不行
是否哪邊有誤 請大大指導迷津
swcforest- 初級會員
- 文章總數 : 113
年齡 : 45
來自 : 台中市南區
職業 : 土木工程設計
愛好 : 遊山玩水及AutoLISP
個性 : 開朗活潑
使用年資 : 六七年了
使用版本 : AutoCAD 2016
積分 : 1
經驗值 : 6243
威望值 : 10
注冊日期 : 2008-07-27
回復: [已解決]如何在AutoLISP中,除了有預設值設定之外,可記錄上一次的設定值
你必須列出程式所有內容才能找出你程式中的問題,片段的內容很難找出真正的問題,請順便將錯誤訊訊息,也列出。
張譽璋- 榮譽顧問
- 文章總數 : 304
年齡 : 54
來自 : 彰化縣員林鎮
職業 : 機械設計工程師/AutoCAD講師/AutoCAD外掛系統開發/AutoCAD書籍作者
愛好 : 旅行及電影
個性 : 風趣健談
使用年資 : 25年
使用版本 : AutoCAD2010/2011/2012/2013
積分 : 20
經驗值 : 7520
威望值 : 641
發帖精華 : 2
回帖精華 : 1
注冊日期 : 2008-05-28
回復: [已解決]如何在AutoLISP中,除了有預設值設定之外,可記錄上一次的設定值
程式可以順利執行
但是卻無法紀錄上一個值
全文如下
但是卻無法紀錄上一個值
全文如下
- 代碼:
(defun c:dam1()
(setq dcl_id (load_dialog "00swcforest"));;;載入00swcforest.dcl
(if (< dcl_id 0) (exit))
(new_dialog "dcl_dam1" dcl_id);;;呼叫00swcforest.dcl中的dcl_dam1
(setq wold w)
(if (null wold) (setq wold 8.0))
(set_tile "kw" (rtos wold))
(set_tile "kh1" "3.5")
(set_tile "kd1" "2.2")
(set_tile "ks1" "0.5")
(set_tile "kh2" "6")
(set_tile "kh3" "1.5")
(set_tile "kh4" "1.5")
(set_tile "kd2" "1.5")
(set_tile "ks2" "0.3")
(set_tile "ks3" "0.6")
(set_tile "ks4" "0.1")
(set_tile "ks5" "0.1")
(set_tile "kr1" "8")
(set_tile "ks7" "5")
(set_tile "kr2" "3")
(set_tile "kr3" "1.5")
(set_tile "kl1" "8")
(set_tile "ks8" "5")
(set_tile "kl2" "3")
(set_tile "kl3" "1.5")
(set_tile "kt1" "0.3")
(set_tile "kh5" "6")
(set_tile "kh6" "1.5")
(set_tile "ks6" "0.3")
(set_tile "kt2" "0.5")
(show_sld "kimage1" "dam1")
(action_tile "accept" "(ok_dam1)(done_dialog 1)")
(setq dd (start_dialog))
(if (= dd 1)
(draw_dam1)
)
)
(defun ok_dam1()
(setq w (atof (get_tile "kw")))
(setq h1 (atof (get_tile "kh1")))
(setq d1 (atof (get_tile "kd1")))
(setq s1 (atof (get_tile "ks1")))
(setq h2 (atof (get_tile "kh2")))
(setq h3 (atof (get_tile "kh3")))
(setq h4 (atof (get_tile "kh4")))
(setq d2 (atof (get_tile "kd2")))
(setq s2 (atof (get_tile "ks2")))
(setq s3 (atof (get_tile "ks3")))
(setq s4 (atof (get_tile "ks4")))
(setq s5 (atof (get_tile "ks5")))
(setq l1 (atof (get_tile "kl1")))
(setq s7 (atof (get_tile "ks7")))
(setq l2 (atof (get_tile "kl2")))
(setq l3 (atof (get_tile "kl3")))
(setq r1 (atof (get_tile "kr1")))
(setq s8 (atof (get_tile "ks8")))
(setq r2 (atof (get_tile "kr2")))
(setq r3 (atof (get_tile "kr3")))
(setq t1 (atof (get_tile "kt1")))
(setq h5 (atof (get_tile "kh5")))
(setq h6 (atof (get_tile "kh6")))
(setq s6 (atof (get_tile "ks6")))
(setq t2 (atof (get_tile "kt2")))
)
(defun draw_dam1()
(startlsp)
(command "-layer" "m" "設計" "c" 2 "" "")
(command "-layer" "m" "DIM" "c" 4 "" "")
;;;基本資料輸入
(setq p1 (getpoint "\n請輸入一點:"))
;;; (setq w (getreal "\n溢洪口寬<8>:"))
;;; (if (null w) (setq w 8.0))
;;; (setq h1 (getreal "\n溢洪口高<3.5>"))
;;; (if (null h1) (setq h1 3.5))
;;; (setq d1 (getreal "\n溢洪口厚度<2.2>"))
;;; (if (null d1) (setq d1 2.2))
;;; (setq s1 (getreal "\n溢洪口斜率<1:0.5>"))
;;; (if (null s1) (setq s1 0.5))
;;; (setq h2 (getreal "\n有效壩高<6>"))
;;; (if (null h2) (setq h2 6.0))
;;; (setq h3 (getreal "\n壩基礎深<1.5>"))
;;; (if (null h3) (setq h3 1.5))
;;; (setq h4 (getreal "\nkey深<1.5>"))
;;; (if (null h4) (setq h4 1.5))
;;; (setq d2 (getreal "\nkey厚<1.5>"))
;;; (if (null d2) (setq d2 1.5))
;;; (setq s2 (getreal "\n壩體下游斜率<1:0.3>"))
;;; (if (null s2) (setq s2 0.3))
;;; (setq s3 (getreal "\n壩體上游斜率<1:0.6>"))
;;; (if (null s3) (setq s3 0.6))
;;; (setq s4 (getreal "\n壩翼下游斜率<1:0.1>"))
;;; (if (null s4) (setq s4 0.1))
;;; (setq s5 (getreal "\n壩翼上游斜率<1:0.1>"))
;;; (if (null s5) (setq s5 0.1))
;;; (setq r1 (getreal "\n右岸壩翼長度<8>"))
;;; (if (null r1) (setq r1 8.0))
;;; (setq s7 (getreal "\n右岸壩翼斜率<1:5>"))
;;; (if (null s7) (setq s7 5.0))
;;; (setq r2 (getreal "\n右岸插入長度<3>"))
;;; (if (null r2) (setq r2 3.0))
;;; (setq l1 (getreal "\n左岸壩翼長度<8>"))
;;; (if (null l1) (setq l1 8.0))
;;; (setq s8 (getreal "\n左岸壩翼斜率<1:5>"))
;;; (if (null s8) (setq s8 5.0))
;;; (setq l2 (getreal "\n左岸插入長度<3>"))
;;; (if (null l2) (setq l2 3.0))
;;; (setq l2 (getreal "\n左岸插入長度<3>"))
;;; (if (null l2) (setq l2 3.0))
;;; (setq t1 (getreal "\n護岸頂寬<0.3>"))
;;; (if (null t1) (setq t1 0.3))
;;; (setq h5 (getreal "\n護岸出土高<6>"))
;;; (if (null h5) (setq h5 6.0))
;;; (setq h6 (getreal "\n護岸基礎深<1.5>"))
;;; (if (null h6) (setq h6 1.5))
;;; (setq s6 (getreal "\n護岸斜率<1:0.3>"))
;;; (if (null s6) (setq s6 0.3))
;;; (setq t2 (getreal "\n護岸退縮距離<0.5>"))
;;; (if (null t2) (setq t2 0.5))
;;;背面圖
;;;右岸各點位
(setq rp2 (polarxy p1 (/ w 2) 0))
(setq rp3 (polarxy rp2 (* h1 s1) h1))
(setq rp4 (polarxy rp3 r1 (* r1 (/ 1 s7))))
(setq rp5 (polarxy rp4 r2 0))
(setq rp6 (polarxy rp5 0 (- r3)))
(setq rp7 (polarxy rp4 0 (- ( h1 (* r1 (/ 1 s7))))))
(setq p2 (polarxy p1 0 (- h2)))
(setq pr2 (polarxy p2 ( ( (/ w 2) (* h1 s1)) t2) 0))
(setq pr3 (polarxy pr2 (* h5 s6) h5))
(setq pr4 (polarxy pr3 t1 0))
(setq rp8 (polarxy p1 ( ( ( ( (/ w 2) (* h1 s1)) t2) (* h5 s6)) t1) (- ( h2 h3))))
(setq rp9 (polarxy rp8 0 (- h4)))
;;;左岸各點位
(setq lp2 (polarxy p1 (- (/ w 2)) 0))
(setq lp3 (polarxy lp2 (- (* h1 s1)) h1))
(setq lp4 (polarxy lp3 (- l1) (* l1 (/ 1 s8))))
(setq lp5 (polarxy lp4 (- l2) 0))
(setq lp6 (polarxy lp5 0 (- l3)))
(setq lp7 (polarxy lp4 0 (- ( h1 (* l1 (/ 1 s8))))))
(setq pl2 (polarxy p2 (- ( ( (/ w 2) (* h1 s1)) t2)) 0))
(setq pl3 (polarxy pl2 (- (* h5 s6)) h5))
(setq pl4 (polarxy pl3 (- t1) 0))
(setq lp8 (polarxy p1 (- ( ( ( ( (/ w 2) (* h1 s1)) t2) (* h5 s6)) t1)) (- ( h2 h3))))
(setq lp9 (polarxy lp8 0 (- h4)))
;;;剖面圖
(setq dp1 (polarxy rp7 ( r2 16) 0))
(setq dp2 (polarxy dp1 d1 0))
(setq dp3 (polarxy dp2 (* s2 h2) (- h2)))
(setq dp4 (polarxy dp3 (* s2 h3) (- h3)))
(setq dp5 (polarxy dp4 0 (- h4)))
(setq dp6 (polarxy dp5 (- d2) 0))
(setq dp7 (polarxy dp6 0 h4))
(setq dp8 (polarxy dp1 (- (* s3 ( h2 h3))) (- ( h2 h3))))
(setq dp9 (polarxy dp1 (* s5 h1) h1))
(setq dp10 (polarxy dp2 (- (* s4 h1)) h1))
;;;平面圖
(setq sp1 (polarxy p1 0 20))
(setq sp2 (polarxy sp1 (/ w 2) 0))
(setq sp3 (polarxy sp2 0 d1))
(setq sp4 (polarxy sp1 (- (/ w 2)) 0))
(setq sp5 (polarxy sp4 0 d1))
(setq rsp6 (polarxy sp2 (* s1 h1) (* s5 h1)))
(setq rsp7 (polarxy sp3 (* s1 h1) (- (* s4 h1))))
(setq rsp8 (polarxy rsp6 r1 (* (* r1 (/ 1 s7)) s5)))
(setq rsp9 (polarxy rsp7 r1 (- (* (* r1 (/ 1 s7)) s4))))
(setq rsp10 (polarxy rsp8 r2 0))
(setq rsp11 (polarxy rsp9 r2 0))
(setq rsp12 (polarxy rsp10 0 (- (* r3 s5))))
(setq rsp13 (polarxy rsp11 0 (* r3 s4)))
(setq rsp14 (polarxy rsp8 0 (- (* ( h1 (* r1 (/ 1 s7))) s5))))
(setq rsp15 (polarxy rsp9 0 (* ( h1 (* r1 (/ 1 s7))) s4)))
(setq rsp16 (polarxy sp1 ( ( ( ( (/ w 2) (* h1 s1)) t2) (* s6 h5)) t1) (- (* s3 ( h2 h3)))))
(setq rsp17 (polarxy sp1 ( ( ( ( (/ w 2) (* h1 s1)) t2) (* s6 h5)) t1) ( D1 (* s2 ( h2 h3)))))
(setq lsp6 (polarxy sp4 (- (* s1 h1)) (* s5 h1)))
(setq lsp7 (polarxy sp5 (- (* s1 h1)) (- (* s4 h1))))
(setq lsp8 (polarxy lsp6 (- l1) (* (* l1 (/ 1 s8)) s5)))
(setq lsp9 (polarxy lsp7 (- l1) (- (* (* l1 (/ 1 s8)) s4))))
(setq lsp10 (polarxy lsp8 (- l2) 0))
(setq lsp11 (polarxy lsp9 (- l2) 0))
(setq lsp12 (polarxy lsp10 0 (- (* l3 s5))))
(setq lsp13 (polarxy lsp11 0 (* l3 s4)))
(setq lsp14 (polarxy lsp8 0 (- (* ( h1 (* l1 (/ 1 s8))) s5))))
(setq lsp15 (polarxy lsp9 0 (* ( h1 (* l1 (/ 1 s8))) s4)))
(setq lsp16 (polarxy sp1 (- ( ( ( ( (/ w 2) (* h1 s1)) t2) (* s6 h5)) t1)) (- (* s3 ( h2 h3)))))
(setq lsp17 (polarxy sp1 (- ( ( ( ( (/ w 2) (* h1 s1)) t2) (* s6 h5)) t1)) ( D1(* s2 ( h2 h3)))))
;;;各點位 開始畫三視圖
;;;背面圖
(command "-layer" "s" "設計" "")
(command "pline" p1 rp2 rp3 rp4 rp5 rp6 rp7 rp8 rp9 lp9 lp8 lp7 lp6 lp5 lp4 lp3 lp2 "c")
;;;剖面圖
(command "pline" dp1 dp2 dp3 dp4 dp5 dp6 dp7 dp8 "c")
(command "pline" dp1 dp9 dp10 dp2 "")
;;;平面圖
(command "pline" sp1 sp2 sp3 sp5 sp4 "c")
(command "pline" sp2 rsp6 rsp7 sp3 "")
(command "pline" rsp6 rsp8 rsp9 rsp7 "")
(command "pline" rsp8 rsp10 rsp11 rsp9 "")
(command "pline" sp4 lsp6 lsp7 sp5 "")
(command "pline" lsp6 lsp8 lsp9 lsp7 "")
(command "pline" lsp8 lsp10 lsp11 lsp9 "")
(command "pline" rsp11 rsp13 rsp15 rsp17 lsp17 lsp15 lsp13 lsp11 "")
(command "pline" rsp10 rsp12 rsp14 rsp16 lsp16 lsp14 lsp12 lsp10 "")
(command "pline" rsp15 lsp15 "")
(command "pline" rsp14 lsp14 "")
;;;各點位 開始畫左右護岸圖
(setq pr1 (polarxy pr2 (- (* s6 h6)) (- h6)))
(setq pr0 (polarxy pr1 ( t1 (* s6 ( h5 h6))) 0))
(command "pline" pr2 pr3 pr4 pr0 pr1 "c")
(setq pl1 (polarxy pl2 (* s6 h6) (- h6)))
(setq pl0 (polarxy pl1 (- ( t1 (* s6 ( h5 h6)))) 0))
(command "pline" pl2 pl3 pl4 pl0 pl1 "c")
(command "pline" pr2 pl2 "")
;;;開始畫標註
(command "-layer" "s" "DIM" "")
(command "text" "bc" (midpt rp2 rp3) 0.42 (rtod (angle rp2 rp3)) (strcat "1:" (rtos s1 2 1)))
(command "text" "bc" (midpt rp3 rp4) 0.42 (rtod (angle rp3 rp4)) (strcat "1:" (rtos s7 2 1)))
(command "text" "bc" (midpt lp3 lp2) 0.42 (rtod (angle lp3 lp2)) (strcat "1:" (rtos s1 2 1)))
(command "text" "bc" (midpt lp4 lp3) 0.42 (rtod (angle lp4 lp3)) (strcat "1:" (rtos s8 2 1)))
(command "text" "bc" (midpt dp2 dp4) 0.42 (rtod (angle dp2 dp4)) (strcat "1:" (rtos s2 2 1)))
(command "text" "bc" (midpt dp8 dp1) 0.42 (rtod (angle dp8 dp1)) (strcat "1:" (rtos s3 2 1)))
(command "text" "bc" (midpt dp1 dp9) 0.42 (rtod (angle dp1 dp9)) (strcat "1:" (rtos s5 2 1)))
(command "text" "bc" (midpt dp10 dp2) 0.42 (rtod (angle dp10 dp2)) (strcat "1:" (rtos s4 2 1)))
(setq x0 0)
(setq x1 ( (- (car lp4) (car lp5)) x0)) (setq xx1 (- x1 x0))
(setq x2 ( (- (car lp8) (car lp4)) x1)) (setq xx2 (- x2 x1))
(setq x3 ( (- (car lp3) (car lp8)) x2)) (setq xx3 (- x3 x2))
(setq x4 ( (- (car lp2) (car lp3)) x3)) (setq xx4 (- x4 x3))
(setq x5 ( (- (car rp2) (car lp2)) x4)) (setq xx5 (- x5 x4))
(setq x6 ( (- (car rp3) (car rp2)) x5)) (setq xx6 (- x6 x5))
(setq x7 ( (- (car rp8) (car rp3)) x6)) (setq xx7 (- x7 x6))
(setq x8 ( (- (car rp4) (car rp8)) x7)) (setq xx8 (- x8 x7))
(setq x9 ( (- (car rp5) (car rp4)) x8)) (setq xx9 (- x9 x8))
;;;標示上方里程
(setq dimx0 (polarxy lp5 0 3))
(if (< x0 10) (setq txt0 (strcat "%k 00" (rtos x0 2 2))) (setq txt0 (strcat "%k 0" (rtos x0 2 2))))
(command "text" dimx0 0.42 "90" txt0)
(setq dimx1 (polarxy dimx0 (- x1 x0) 0))
(if (< x1 10) (setq txt1 (strcat "%k 00" (rtos x1 2 2))) (setq txt1 (strcat "%k 0" (rtos x1 2 2))))
(command "text" dimx1 0.42 "90" txt1)
(setq dimx2 (polarxy dimx1 (- x2 x1) 0))
(if (< x2 10) (setq txt2 (strcat "%k 00" (rtos x2 2 2))) (setq txt2 (strcat "%k 0" (rtos x2 2 2))))
(command "text" dimx2 0.42 "90" txt2)
(setq dimx3 (polarxy dimx2 (- x3 x2) 0))
(if (< x3 10) (setq txt3 (strcat "%k 00" (rtos x3 2 2))) (setq txt3 (strcat "%k 0" (rtos x3 2 2))))
(command "text" dimx3 0.42 "90" txt3)
(setq dimx4 (polarxy dimx3 (- x4 x3) 0))
(if (< x4 10) (setq txt4 (strcat "%k 00" (rtos x4 2 2))) (setq txt4 (strcat "%k 0" (rtos x4 2 2))))
(command "text" dimx4 0.42 "90" txt4)
(setq dimx5 (polarxy dimx4 (- x5 x4) 0))
(if (< x5 10) (setq txt5 (strcat "%k 00" (rtos x5 2 2))) (setq txt5 (strcat "%k 0" (rtos x5 2 2))))
(command "text" dimx5 0.42 "90" txt5)
(setq dimx6 (polarxy dimx5 (- x6 x5) 0))
(if (< x6 10) (setq txt6 (strcat "%k 00" (rtos x6 2 2))) (setq txt6 (strcat "%k 0" (rtos x6 2 2))))
(command "text" dimx6 0.42 "90" txt6)
(setq dimx7 (polarxy dimx6 (- x7 x6) 0))
(if (< x7 10) (setq txt7 (strcat "%k 00" (rtos x7 2 2))) (setq txt7 (strcat "%k 0" (rtos x7 2 2))))
(command "text" dimx7 0.42 "90" txt7)
(setq dimx8 (polarxy dimx7 (- x8 x7) 0))
(if (< x8 10) (setq txt8 (strcat "%k 00" (rtos x8 2 2))) (setq txt8 (strcat "%k 0" (rtos x8 2 2))))
(command "text" dimx8 0.42 "90" txt8)
(setq dimx9 (polarxy dimx8 (- x9 x8) 0))
(if (< x9 10) (setq txt9 (strcat "%k 00" (rtos x9 2 2))) (setq txt9 (strcat "%k 0" (rtos x9 2 2))))
(command "text" dimx9 0.42 "90" txt9)
;;;標示各部標註尺寸
;;;背面圖
(diminits)
(command "-dimstyle" "r" "S200")
(command "dim1" "hor" lp5 lp4 (polarxy lp5 0 1) "")
(command "dim1" "hor" lp4 lp3 (polarxy lp5 0 1) "")
(command "dim1" "hor" lp3 lp2 (polarxy lp5 0 1) "")
(command "dim1" "hor" lp2 rp2 (polarxy lp5 0 1) "")
(command "dim1" "hor" rp2 rp3 (polarxy lp5 0 1) "")
(command "dim1" "hor" rp3 rp4 (polarxy lp5 0 1) "")
(command "dim1" "hor" rp4 rp5 (polarxy lp5 0 1) "")
(command "dim1" "hor" lp5 rp5 (polarxy lp5 0 2) "")
(command "dim1" "ver" lp5 lp6 (polarxy lp5 -1 0) "")
(command "dim1" "ver" lp6 lp7 (polarxy lp5 -1 0) "")
(command "dim1" "ver" lp7 lp8 (polarxy lp5 -1 0) "")
(command "dim1" "ver" lp8 lp9 (polarxy lp8 -1 0) "")
(command "dim1" "ver" lp5 lp9 (polarxy lp5 -2 0) "")
(command "dim1" "ver" lp2 lp3 (polarxy lp2 1 0) "")
(command "dim1" "hor" lp6 lp7 (polarxy lp9 0 -1) "")
(command "dim1" "hor" lp7 lp8 (polarxy lp9 0 -1) "")
(command "dim1" "ver" rp5 rp6 (polarxy rp5 1 0) "")
(command "dim1" "ver" rp6 rp7 (polarxy rp5 1 0) "")
(command "dim1" "ver" rp7 rp8 (polarxy rp5 1 0) "")
(command "dim1" "ver" rp8 rp9 (polarxy rp8 1 0) "")
(command "dim1" "ver" rp5 rp9 (polarxy rp5 2 0) "")
(command "dim1" "ver" rp2 rp3 (polarxy rp2 -1 0) "")
(command "dim1" "hor" rp6 rp7 (polarxy rp9 0 -1) "")
(command "dim1" "hor" rp7 rp8 (polarxy rp9 0 -1) "")
(command "dim1" "hor" lp9 rp9 (polarxy lp9 0 -1) "")
;;;平面圖
(command "dim1" "hor" sp4 sp2 (polarxy sp4 0 -1) "")
(command "dim1" "hor" sp4 lsp6 (polarxy sp4 0 -1) "")
(command "dim1" "hor" lsp6 lsp8 (polarxy sp4 0 -1) "")
(command "dim1" "hor" lsp8 lsp10 (polarxy sp4 0 -1) "")
(command "dim1" "hor" sp2 rsp6 (polarxy sp2 0 -1) "")
(command "dim1" "hor" rsp6 rsp8 (polarxy sp2 0 -1) "")
(command "dim1" "hor" rsp8 rsp10 (polarxy sp2 0 -1) "")
(command "dim1" "hor" rsp8 rsp10 (polarxy sp2 0 -1) "")
(command "dim1" "hor" lsp12 lsp14 (polarxy lsp16 0 -1) "")
(command "dim1" "hor" lsp14 lsp16 (polarxy lsp16 0 -1) "")
(command "dim1" "hor" lsp16 rsp16 (polarxy lsp16 0 -1) "")
(command "dim1" "hor" rsp16 rsp14 (polarxy lsp16 0 -1) "")
(command "dim1" "hor" rsp14 rsp12 (polarxy lsp16 0 -1) "")
(command "dim1" "hor" lsp13 rsp13 (polarxy lsp17 0 1) "")
(command "dim1" "ver" lsp10 lsp11 (polarxy lsp12 1 0) "")
(command "dim1" "ver" lsp12 lsp13 (polarxy lsp12 -1 0) "")
(command "dim1" "ver" lsp13 lsp17 (polarxy lsp12 -1 0) "")
(command "dim1" "ver" lsp12 lsp16 (polarxy lsp12 -1 0) "")
(command "dim1" "ver" lsp16 lsp17 (polarxy lsp12 -2 0) "")
(command "dim1" "ver" lsp6 lsp7 (polarxy lsp6 -1 0) "")
(command "dim1" "ver" sp4 sp5 (polarxy sp4 1 0) "")
(command "dim1" "ver" rsp10 rsp11 (polarxy rsp12 -1 0) "")
(command "dim1" "ver" rsp12 rsp13 (polarxy rsp12 1 0) "")
(command "dim1" "ver" rsp13 rsp17 (polarxy rsp12 1 0) "")
(command "dim1" "ver" rsp12 rsp16 (polarxy rsp12 1 0) "")
(command "dim1" "ver" rsp16 rsp17 (polarxy rsp12 2 0) "")
(command "dim1" "ver" rsp6 rsp7 (polarxy rsp6 1 0) "")
(command "dim1" "ver" sp2 sp3 (polarxy sp2 -1 0) "")
;;;剖面圖
(command "dim1" "ver" dp1 dp9 (polarxy dp8 -1 0) "")
(command "dim1" "ver" dp1 dp8 (polarxy dp8 -1 0) "")
(command "dim1" "ver" dp8 dp6 (polarxy dp8 -1 0) "")
(command "dim1" "ver" dp9 dp6 (polarxy dp8 -2 0) "")
(command "dim1" "ver" dp2 dp3 (polarxy dp4 1 0) "")
(command "dim1" "ver" dp3 dp4 (polarxy dp4 1 0) "")
(command "dim1" "ver" dp4 dp5 (polarxy dp4 1 0) "")
(command "dim1" "hor" dp1 dp2 (polarxy dp1 0 -1) "")
(command "dim1" "hor" dp8 dp7 (polarxy dp6 0 -1) "")
(command "dim1" "hor" dp5 dp6 (polarxy dp6 0 -1) "")
(command "dim1" "hor" dp5 dp8 (polarxy dp6 0 -2) "")
(command "dim1" "hor" dp9 dp10 (polarxy dp9 0 1) "")
;;; (setq dimx0 (polarxy lp5 0 3))
(setq 0d01 (polarxy dp4 16 0))
(setq 0d02 (polarxy 0d01 (distance lsp12 lsp13) 0))
(setq 0d03 (polarxy 0d02 (- (* s4 l3)) l3))
(setq 0d04 (polarxy 0d03 (- (distance lsp10 lsp11)) 0))
(command "-layer" "s" "設計" "")
(command "pline" 0d01 0d02 0d03 0d04 "c")
(setq oldl0 0) (setq newl0 ( (distance 0d01 0d04) (distance 0d02 0d03)))
(setq en0 (entlast))
(setq objen0 (vlax-ename->vla-object en0))
(setq aa0 (vla-get-area objen0))
(command "-insert" "dam2" (polarxy (midpt 0d01 0d02) 0 -2.5) 1 1 0 txt0 (rtos 0.00 2 2) (rtos 0.00 2 2) (rtos aa0 2 2) (rtos oldl0 2 2) (rtos newl0 2 2))
(command "-layer" "s" "DIM" "")
(command "-dimstyle" "r" "S200")
(command "text" "bc" (midpt 0d01 0d04) 0.42 (rtod (angle 0d01 0d04)) (strcat "1:" (rtos s5 2 1)))
(command "text" "bc" (midpt 0d03 0d02) 0.42 (rtod (angle 0d03 0d02)) (strcat "1:" (rtos s4 2 1)))
(command "dim1" "hor" 0d01 0d02 (polarxy 0d01 0 -1) "")
(command "dim1" "hor" 0d03 0d04 (polarxy 0d03 0 1) "")
(command "dim1" "ver" 0d01 0d04 (polarxy 0d01 -1 0) "")
;;; (setq dimx1 (polarxy dimx0 (- x1 x0) 0))
(setq 1d01 (polarxy 0d02 10 0))
(setq 1d02 (polarxy 1d01 (distance lsp14 lsp15) 0))
(setq 1d03 (polarxy 1d02 (- (* s4 ( h1 (* l1 (/ 1 s8))))) ( h1 (* l1 (/ 1 s8)))))
(setq 1d04 (polarxy 1d03 (- (distance lsp8 lsp9)) 0))
(command "-layer" "s" "設計" "")
(command "pline" 1d01 1d02 1d03 1d04 "c")
(setq oldl1 0) (setq newl1 ( (distance 1d01 1d04) (distance 1d02 1d03)))
(setq en1 (entlast))
(setq objen1 (vlax-ename->vla-object en1))
(setq aa1 (vla-get-area objen1))
(command "-insert" "dam2" (polarxy (midpt 1d01 1d02) 0 -2.5) 1 1 0 txt1 (rtos 0.00 2 2) (rtos 0.00 2 2) (rtos aa1 2 2) (rtos oldl1 2 2) (rtos newl1 2 2))
(command "-layer" "s" "DIM" "")
(command "-dimstyle" "r" "S200")
(command "text" "bc" (midpt 1d01 1d04) 0.42 (rtod (angle 1d01 1d04)) (strcat "1:" (rtos s5 2 1)))
(command "text" "bc" (midpt 1d03 1d02) 0.42 (rtod (angle 1d03 1d02)) (strcat "1:" (rtos s4 2 1)))
(command "dim1" "hor" 1d01 1d02 (polarxy 1d01 0 -1) "")
(command "dim1" "hor" 1d03 1d04 (polarxy 1d03 0 1) "")
(command "dim1" "ver" 1d01 1d04 (polarxy 1d01 -1 0) "")
;;; (setq dimx2 (polarxy dimx1 (- x2 x1) 0))
(setq 2d01 (polarxy 1d02 10 0))
(setq 2d02 (polarxy 2d01 (* s3 ( h2 h3)) ( h2 h3)))
(setq 2d05 (polarxy 2d02 (distance sp4 sp5) 0))
(setq 2d03 (polarxy 2d02 (* s5 ( h1 (* xx3 (/ 1 s8)))) ( h1 (* xx3 (/ 1 s8)))))
(setq 2d04 (polarxy 2d05 (- (* s4 ( h1 (* xx3 (/ 1 s8))))) ( h1 (* xx3 (/ 1 s8)))))
(setq 2d06 (polarxy 2d05 (* s2 h2) (- h2)))
(setq 2d07 (polarxy 2d06 (* s2 h3) (- h3)))
(command "-layer" "s" "設計" "")
(command "pline" 2d02 2d05 "" "pline" 2d01 2d02 2d03 2d04 2d05 2d06 2d07 "c")
(setq oldl2 ( (distance 2d01 2d02) (distance 2d06 2d07))) (setq newl2 ( ( (distance 2d02 2d03) (distance 2d04 2d05)) (distance 2d05 2d06)))
(setq en2 (entlast))
(setq objen2 (vlax-ename->vla-object en2))
(setq aa2 (vla-get-area objen2))
(command "-insert" "dam2" (polarxy (midpt 2d01 2d07) 0 -2.5) 1 1 0 (strcat txt2 "(前)") (rtos 0.00 2 2) (rtos 0.00 2 2) (rtos aa2 2 2) (rtos oldl2 2 2) (rtos newl2 2 2))
(command "-layer" "s" "DIM" "")
(command "-dimstyle" "r" "S200")
(command "text" "bc" (midpt 2d01 2d02) 0.42 (rtod (angle 2d01 2d02)) (strcat "1:" (rtos s3 2 1)))
(command "text" "bc" (midpt 2d02 2d03) 0.42 (rtod (angle 2d02 2d03)) (strcat "1:" (rtos s5 2 1)))
(command "text" "bc" (midpt 2d04 2d05) 0.42 (rtod (angle 2d04 2d05)) (strcat "1:" (rtos s4 2 1)))
(command "text" "bc" (midpt 2d05 2d07) 0.42 (rtod (angle 2d05 2d07)) (strcat "1:" (rtos s2 2 1)))
(command "dim1" "hor" 2d01 2d07 (polarxy 2d01 0 -1) "")
(command "dim1" "hor" 2d02 2d05 (polarxy 2d02 0 -1) "")
(command "dim1" "hor" 2d03 2d04 (polarxy 2d03 0 1) "")
(command "dim1" "ver" 2d01 2d02 (polarxy 2d01 -1 0) "")
(command "dim1" "ver" 2d02 2d03 (polarxy 2d01 -1 0) "")
(setq 2d08 (polarxy 2d07 7 0))
(setq 2d09 (polarxy 2d08 (* s3 ( h2 h3)) ( h2 h3)))
(setq 2d12 (polarxy 2d09 (distance sp4 sp5) 0))
(setq 2d10 (polarxy 2d09 (* s5 ( h1 (* xx3 (/ 1 s8)))) ( h1 (* xx3 (/ 1 s8)))))
(setq 2d11 (polarxy 2d12 (- (* s4 ( h1 (* xx3 (/ 1 s8))))) ( h1 (* xx3 (/ 1 s8)))))
(setq 2d13 (polarxy 2d12 (* s2 h2) (- h2)))
(setq 2d14 (polarxy 2d13 (* s2 h3) (- h3)))
(setq 2d15 (polarxy 2d14 0 (- h4)))
(setq 2d16 (polarxy 2d15 (- d2) 0))
(setq 2d17 (polarxy 2d16 0 h4))
(command "-layer" "s" "設計" "")
(command "pline" 2d09 2d12 "" "pline" 2d08 2d09 2d10 2d11 2d12 2d13 2d14 2d15 2d16 2d17 "c")
(setq oldr2 ( ( ( (distance 2d08 2d09) (distance 2d13 2d14)) (distance 2d14 2d15)) (distance 2d16 2d17))) (setq newr2 ( ( (distance 2d09 2d10) (distance 2d11 2d12)) (distance 2d12 2d13)))
(setq en2 (entlast))
(setq objen2 (vlax-ename->vla-object en2))
(setq aa2 (vla-get-area objen2))
(command "-insert" "dam2" (polarxy (midpt 2d08 2d14) 0 -2.5) 1 1 0 (strcat txt2 "(後)") (rtos 0.00 2 2) (rtos 0.00 2 2) (rtos aa2 2 2) (rtos oldr2 2 2) (rtos newr2 2 2))
(command "-layer" "s" "DIM" "")
(command "-dimstyle" "r" "S200")
(command "text" "bc" (midpt 2d08 2d09) 0.42 (rtod (angle 2d08 2d09)) (strcat "1:" (rtos s3 2 1)))
(command "text" "bc" (midpt 2d09 2d10) 0.42 (rtod (angle 2d09 2d10)) (strcat "1:" (rtos s5 2 1)))
(command "text" "bc" (midpt 2d11 2d12) 0.42 (rtod (angle 2d11 2d12)) (strcat "1:" (rtos s4 2 1)))
(command "text" "bc" (midpt 2d12 2d14) 0.42 (rtod (angle 2d12 2d14)) (strcat "1:" (rtos s2 2 1)))
(command "dim1" "hor" 2d08 2d17 (polarxy 2d08 0 -1) "")
(command "dim1" "hor" 2d15 2d16 (polarxy 2d15 0 -1) "")
(command "dim1" "hor" 2d09 2d12 (polarxy 2d09 0 -1) "")
(command "dim1" "hor" 2d10 2d11 (polarxy 2d10 0 1) "")
(command "dim1" "ver" 2d08 2d09 (polarxy 2d08 -1 0) "")
(command "dim1" "ver" 2d09 2d10 (polarxy 2d08 -1 0) "")
(command "dim1" "ver" 2d13 2d14 (polarxy 2d14 1 0) "")
(command "dim1" "ver" 2d14 2d15 (polarxy 2d14 1 0) "")
;;; (setq dimx3 (polarxy dimx2 (- x3 x2) 0))
(setq 3d01 (polarxy 2d14 7 0))
(setq 3d02 (polarxy 3d01 (* s3 ( h2 h3)) ( h2 h3)))
(setq 3d05 (polarxy 3d02 (distance sp4 sp5) 0))
(setq 3d03 (polarxy 3d02 (* s5 h1) h1))
(setq 3d04 (polarxy 3d05 (- (* s4 h1)) h1))
(setq 3d06 (polarxy 3d05 (* s2 h2) (- h2)))
(setq 3d07 (polarxy 3d06 (* s2 h3) (- h3)))
(setq 3d08 (polarxy 3d07 0 (- h4)))
(setq 3d09 (polarxy 3d08 (- d2) 0))
(setq 3d10 (polarxy 3d09 0 h4))
(command "-layer" "s" "設計" "")
(command "pline" 3d02 3d05 "" "pline" 3d01 3d02 3d03 3d04 3d05 3d06 3d07 3d08 3d09 3d10 "c")
(setq oldl3 ( ( ( (distance 3d01 3d02) (distance 3d06 3d07)) (distance 3d07 3d08)) (distance 3d09 3d10))) (setq newl3 ( ( (distance 3d02 3d03) (distance 3d04 3d05)) (distance 3d05 3d06)))
(setq en3 (entlast))
(setq objen3 (vlax-ename->vla-object en3))
(setq aa3 (vla-get-area objen3))
(command "-insert" "dam2" (polarxy (midpt 3d01 3d07) 0 -2.5) 1 1 0 txt3 (rtos 0.00 2 2) (rtos 0.00 2 2) (rtos aa3 2 2) (rtos oldl3 2 2) (rtos newl3 2 2))
(command "-layer" "s" "DIM" "")
(command "-dimstyle" "r" "S200")
(command "text" "bc" (midpt 3d01 3d02) 0.42 (rtod (angle 3d01 3d02)) (strcat "1:" (rtos s3 2 1)))
(command "text" "bc" (midpt 3d02 3d03) 0.42 (rtod (angle 3d02 3d03)) (strcat "1:" (rtos s5 2 1)))
(command "text" "bc" (midpt 3d04 3d05) 0.42 (rtod (angle 3d04 3d05)) (strcat "1:" (rtos s4 2 1)))
(command "text" "bc" (midpt 3d05 3d07) 0.42 (rtod (angle 3d05 3d07)) (strcat "1:" (rtos s2 2 1)))
(command "dim1" "hor" 3d01 3d10 (polarxy 3d01 0 -1) "")
(command "dim1" "hor" 3d08 3d09 (polarxy 3d09 0 -1) "")
(command "dim1" "hor" 3d02 3d05 (polarxy 3d02 0 -1) "")
(command "dim1" "hor" 3d03 3d04 (polarxy 3d03 0 1) "")
(command "dim1" "ver" 3d01 3d02 (polarxy 3d01 -1 0) "")
(command "dim1" "ver" 3d02 3d03 (polarxy 3d01 -1 0) "")
(command "dim1" "ver" 3d06 3d07 (polarxy 3d07 1 0) "")
(command "dim1" "ver" 3d07 3d08 (polarxy 3d07 1 0) "")
;;; (setq dimx4 (polarxy dimx3 (- x4 x3) 0))
(setq 4d01 (polarxy 3d07 7 0))
(setq 4d02 (polarxy 4d01 (* s3 ( h2 h3)) ( h2 h3)))
(setq 4d05 (polarxy 4d02 (distance sp4 sp5) 0))
(setq 4d06 (polarxy 4d05 (* s2 h2) (- h2)))
(setq 4d07 (polarxy 4d06 (* s2 h3) (- h3)))
(setq 4d08 (polarxy 4d07 0 (- h4)))
(setq 4d09 (polarxy 4d08 (- d2) 0))
(setq 4d10 (polarxy 4d09 0 h4))
(command "-layer" "s" "設計" "")
(command "pline" 4d01 4d02 4d05 4d06 4d07 4d08 4d09 4d10 "c")
(setq oldl4 ( ( ( (distance 4d01 4d02) (distance 4d06 4d07)) (distance 4d07 4d08)) (distance 4d09 4d10))) (setq newl4 (distance 4d05 4d06))
(setq en4 (entlast))
(setq objen4 (vlax-ename->vla-object en4))
(setq aa4 (vla-get-area objen4))
(command "-insert" "dam2" (polarxy (midpt 4d01 4d07) 0 -2.5) 1 1 0 txt4 (rtos 0.00 2 2) (rtos 0.00 2 2) (rtos aa4 2 2) (rtos oldl4 2 2) (rtos newl4 2 2))
(command "-layer" "s" "DIM" "")
(command "-dimstyle" "r" "S200")
(command "text" "bc" (midpt 4d01 4d02) 0.42 (rtod (angle 4d01 4d02)) (strcat "1:" (rtos s3 2 1)))
(command "text" "bc" (midpt 4d05 4d07) 0.42 (rtod (angle 4d05 4d07)) (strcat "1:" (rtos s2 2 1)))
(command "dim1" "hor" 4d01 4d10 (polarxy 4d01 0 -1) "")
(command "dim1" "hor" 4d08 4d09 (polarxy 4d09 0 -1) "")
(command "dim1" "hor" 4d02 4d05 (polarxy 4d02 0 1) "")
(command "dim1" "ver" 4d01 4d02 (polarxy 4d01 -1 0) "")
(command "dim1" "ver" 4d06 4d07 (polarxy 4d07 1 0) "")
(command "dim1" "ver" 4d07 4d08 (polarxy 4d07 1 0) "")
;;; (setq dimx5 (polarxy dimx4 (- x5 x4) 0))
(setq 5d01 (polarxy 4d07 7 0))
(setq 5d02 (polarxy 5d01 (* s3 ( h2 h3)) ( h2 h3)))
(setq 5d05 (polarxy 5d02 (distance sp4 sp5) 0))
(setq 5d06 (polarxy 5d05 (* s2 h2) (- h2)))
(setq 5d07 (polarxy 5d06 (* s2 h3) (- h3)))
(setq 5d08 (polarxy 5d07 0 (- h4)))
(setq 5d09 (polarxy 5d08 (- d2) 0))
(setq 5d10 (polarxy 5d09 0 h4))
(command "-layer" "s" "設計" "")
(command "pline" 5d01 5d02 5d05 5d06 5d07 5d08 5d09 5d10 "c")
(setq oldl5 ( ( ( (distance 5d01 5d02) (distance 5d06 5d07)) (distance 5d07 5d08)) (distance 5d09 5d10))) (setq newl5 (distance 5d05 5d06))
(setq en5 (entlast))
(setq objen5 (vlax-ename->vla-object en5))
(setq aa5 (vla-get-area objen5))
(command "-insert" "dam2" (polarxy (midpt 5d01 5d07) 0 -2.5) 1 1 0 txt5 (rtos 0.00 2 2) (rtos 0.00 2 2) (rtos aa5 2 2) (rtos oldl5 2 2) (rtos newl5 2 2))
(command "-layer" "s" "DIM" "")
(command "-dimstyle" "r" "S200")
(command "text" "bc" (midpt 5d01 5d02) 0.42 (rtod (angle 5d01 5d02)) (strcat "1:" (rtos s3 2 1)))
(command "text" "bc" (midpt 5d05 5d07) 0.42 (rtod (angle 5d05 5d07)) (strcat "1:" (rtos s2 2 1)))
(command "dim1" "hor" 5d01 5d10 (polarxy 5d01 0 -1) "")
(command "dim1" "hor" 5d08 5d09 (polarxy 5d09 0 -1) "")
(command "dim1" "hor" 5d02 5d05 (polarxy 5d02 0 1) "")
(command "dim1" "ver" 5d01 5d02 (polarxy 5d01 -1 0) "")
(command "dim1" "ver" 5d06 5d07 (polarxy 5d07 1 0) "")
(command "dim1" "ver" 5d07 5d08 (polarxy 5d07 1 0) "")
;;; (setq dimx6 (polarxy dimx5 (- x6 x5) 0))
(setq 6d01 (polarxy 5d07 7 0))
(setq 6d02 (polarxy 6d01 (* s3 ( h2 h3)) ( h2 h3)))
(setq 6d05 (polarxy 6d02 (distance sp2 sp3) 0))
(setq 6d03 (polarxy 6d02 (* s5 h1) h1))
(setq 6d04 (polarxy 6d05 (- (* s4 h1)) h1))
(setq 6d06 (polarxy 6d05 (* s2 h2) (- h2)))
(setq 6d07 (polarxy 6d06 (* s2 h3) (- h3)))
(setq 6d08 (polarxy 6d07 0 (- h4)))
(setq 6d09 (polarxy 6d08 (- d2) 0))
(setq 6d10 (polarxy 6d09 0 h4))
(command "-layer" "s" "設計" "")
(command "pline" 6d02 6d05 "" "pline" 6d01 6d02 6d03 6d04 6d05 6d06 6d07 6d08 6d09 6d10 "c")
(setq oldl6 ( ( ( (distance 6d01 6d02) (distance 6d06 6d07)) (distance 6d07 6d08)) (distance 6d09 6d10))) (setq newl6 ( ( (distance 6d02 6d03) (distance 6d04 6d05)) (distance 6d05 6d06)))
(setq en6 (entlast))
(setq objen6 (vlax-ename->vla-object en6))
(setq aa6 (vla-get-area objen6))
(command "-insert" "dam2" (polarxy (midpt 6d01 6d07) 0 -2.5) 1 1 0 txt6 (rtos 0.00 2 2) (rtos 0.00 2 2) (rtos aa6 2 2) (rtos oldl6 2 2) (rtos newl6 2 2))
(command "-layer" "s" "DIM" "")
(command "-dimstyle" "r" "S200")
(command "text" "bc" (midpt 6d01 6d02) 0.42 (rtod (angle 6d01 6d02)) (strcat "1:" (rtos s3 2 1)))
(command "text" "bc" (midpt 6d02 6d03) 0.42 (rtod (angle 6d02 6d03)) (strcat "1:" (rtos s5 2 1)))
(command "text" "bc" (midpt 6d04 6d05) 0.42 (rtod (angle 6d04 6d05)) (strcat "1:" (rtos s4 2 1)))
(command "text" "bc" (midpt 6d05 6d07) 0.42 (rtod (angle 6d05 6d07)) (strcat "1:" (rtos s2 2 1)))
(command "dim1" "hor" 6d01 6d10 (polarxy 6d01 0 -1) "")
(command "dim1" "hor" 6d08 6d09 (polarxy 6d09 0 -1) "")
(command "dim1" "hor" 6d02 6d05 (polarxy 6d02 0 -1) "")
(command "dim1" "hor" 6d03 6d04 (polarxy 6d03 0 1) "")
(command "dim1" "ver" 6d01 6d02 (polarxy 6d01 -1 0) "")
(command "dim1" "ver" 6d02 6d03 (polarxy 6d01 -1 0) "")
(command "dim1" "ver" 6d06 6d07 (polarxy 6d07 1 0) "")
(command "dim1" "ver" 6d07 6d08 (polarxy 6d07 1 0) "")
;;; (setq dimx7 (polarxy dimx6 (- x7 x6) 0))
(setq 7d08 (polarxy 6d07 7 0))
(setq 7d09 (polarxy 7d08 (* s3 ( h2 h3)) ( h2 h3)))
(setq 7d12 (polarxy 7d09 (distance sp2 sp3) 0))
(setq 7d10 (polarxy 7d09 (* s5 ( h1 (* xx7 (/ 1 s7)))) ( h1 (* xx7 (/ 1 s7)))))
(setq 7d11 (polarxy 7d12 (- (* s4 ( h1 (* xx7 (/ 1 s7))))) ( h1 (* xx7 (/ 1 s7)))))
(setq 7d13 (polarxy 7d12 (* s2 h2) (- h2)))
(setq 7d14 (polarxy 7d13 (* s2 h3) (- h3)))
(setq 7d15 (polarxy 7d14 0 (- h4)))
(setq 7d16 (polarxy 7d15 (- d2) 0))
(setq 7d17 (polarxy 7d16 0 h4))
(command "-layer" "s" "設計" "")
(command "pline" 7d09 7d12 "" "pline" 7d08 7d09 7d10 7d11 7d12 7d13 7d14 7d15 7d16 7d17 "c")
(setq oldr7 ( ( ( (distance 7d08 7d09) (distance 7d13 7d14)) (distance 7d14 7d15)) (distance 7d16 7d17))) (setq newr7 ( ( (distance 7d09 7d10) (distance 7d11 7d12)) (distance 7d12 7d13)))
(setq en7 (entlast))
(setq objen7 (vlax-ename->vla-object en7))
(setq aa7 (vla-get-area objen7))
(command "-insert" "dam2" (polarxy (midpt 7d08 7d14) 0 -2.5) 1 1 0 (strcat txt7 "(前)") (rtos 0.00 2 2) (rtos 0.00 2 2) (rtos aa7 2 2) (rtos oldr7 2 2) (rtos newr7 2 2))
(command "-layer" "s" "DIM" "")
(command "-dimstyle" "r" "S200")
(command "text" "bc" (midpt 7d08 7d09) 0.42 (rtod (angle 7d08 7d09)) (strcat "1:" (rtos s3 2 1)))
(command "text" "bc" (midpt 7d09 7d10) 0.42 (rtod (angle 7d09 7d10)) (strcat "1:" (rtos s5 2 1)))
(command "text" "bc" (midpt 7d11 7d12) 0.42 (rtod (angle 7d11 7d12)) (strcat "1:" (rtos s4 2 1)))
(command "text" "bc" (midpt 7d12 7d14) 0.42 (rtod (angle 7d12 7d14)) (strcat "1:" (rtos s2 2 1)))
(command "dim1" "hor" 7d08 7d17 (polarxy 7d08 0 -1) "")
(command "dim1" "hor" 7d15 7d16 (polarxy 7d15 0 -1) "")
(command "dim1" "hor" 7d09 7d12 (polarxy 7d09 0 -1) "")
(command "dim1" "hor" 7d10 7d11 (polarxy 7d10 0 1) "")
(command "dim1" "ver" 7d08 7d09 (polarxy 7d08 -1 0) "")
(command "dim1" "ver" 7d09 7d10 (polarxy 7d08 -1 0) "")
(command "dim1" "ver" 7d13 7d14 (polarxy 7d14 1 0) "")
(command "dim1" "ver" 7d14 7d15 (polarxy 7d14 1 0) "")
(setq 7d01 (polarxy 7d14 7 0))
(setq 7d02 (polarxy 7d01 (* s3 ( h2 h3)) ( h2 h3)))
(setq 7d05 (polarxy 7d02 (distance sp2 sp3) 0))
(setq 7d03 (polarxy 7d02 (* s5 ( h1 (* xx7 (/ 1 s7)))) ( h1 (* xx7 (/ 1 s7)))))
(setq 7d04 (polarxy 7d05 (- (* s4 ( h1 (* xx7 (/ 1 s7))))) ( h1 (* xx7 (/ 1 s7)))))
(setq 7d06 (polarxy 7d05 (* s2 h2) (- h2)))
(setq 7d07 (polarxy 7d06 (* s2 h3) (- h3)))
(command "-layer" "s" "設計" "")
(command "pline" 7d02 7d05 "" "pline" 7d01 7d02 7d03 7d04 7d05 7d06 7d07 "c")
(setq oldl7 ( (distance 7d01 7d02) (distance 7d06 7d07))) (setq newl7 ( ( (distance 7d02 7d03) (distance 7d04 7d05)) (distance 7d05 7d06)))
(setq en7 (entlast))
(setq objen7 (vlax-ename->vla-object en7))
(setq aa7 (vla-get-area objen7))
(command "-insert" "dam2" (polarxy (midpt 7d01 7d07) 0 -2.5) 1 1 0 (strcat txt7 "(後)") (rtos 0.00 2 2) (rtos 0.00 2 2) (rtos aa7 2 2) (rtos oldl7 2 2) (rtos newl7 2 2))
(command "-layer" "s" "DIM" "")
(command "-dimstyle" "r" "S200")
(command "text" "bc" (midpt 7d01 7d02) 0.42 (rtod (angle 7d01 7d02)) (strcat "1:" (rtos s3 2 1)))
(command "text" "bc" (midpt 7d02 7d03) 0.42 (rtod (angle 7d02 7d03)) (strcat "1:" (rtos s5 2 1)))
(command "text" "bc" (midpt 7d04 7d05) 0.42 (rtod (angle 7d04 7d05)) (strcat "1:" (rtos s4 2 1)))
(command "text" "bc" (midpt 7d05 7d07) 0.42 (rtod (angle 7d05 7d07)) (strcat "1:" (rtos s2 2 1)))
(command "dim1" "hor" 7d01 7d07 (polarxy 7d01 0 -1) "")
(command "dim1" "hor" 7d02 7d05 (polarxy 7d02 0 -1) "")
(command "dim1" "hor" 7d03 7d04 (polarxy 7d03 0 1) "")
(command "dim1" "ver" 7d01 7d02 (polarxy 7d01 -1 0) "")
(command "dim1" "ver" 7d02 7d03 (polarxy 7d01 -1 0) "")
;;; (setq dimx8 (polarxy dimx7 (- x8 x7) 0))
(setq 8d01 (polarxy 7d07 10 0))
(setq 8d02 (polarxy 8d01 (distance rsp14 rsp15) 0))
(setq 8d03 (polarxy 8d02 (- (* s4 ( h1 (* r1 (/ 1 s8))))) ( h1 (* r1 (/ 1 s8)))))
(setq 8d04 (polarxy 8d03 (- (distance rsp8 rsp9)) 0))
(command "-layer" "s" "設計" "")
(command "pline" 8d01 8d02 8d03 8d04 "c")
(setq oldl8 0) (setq newl8 ( (distance 8d01 8d04) (distance 8d02 8d03)))
(setq en8 (entlast))
(setq objen8 (vlax-ename->vla-object en8))
(setq aa8 (vla-get-area objen8))
(command "-insert" "dam2" (polarxy (midpt 8d01 8d02) 0 -2.5) 1 1 0 txt8 (rtos 0.00 2 2) (rtos 0.00 2 2) (rtos aa8 2 2) (rtos oldl8 2 2) (rtos newl8 2 2))
(command "-layer" "s" "DIM" "")
(command "-dimstyle" "r" "S200")
(command "text" "bc" (midpt 8d01 8d04) 0.42 (rtod (angle 8d01 8d04)) (strcat "1:" (rtos s5 2 1)))
(command "text" "bc" (midpt 8d03 8d02) 0.42 (rtod (angle 8d03 8d02)) (strcat "1:" (rtos s4 2 1)))
(command "dim1" "hor" 8d01 8d02 (polarxy 8d01 0 -1) "")
(command "dim1" "hor" 8d03 8d04 (polarxy 8d03 0 1) "")
(command "dim1" "ver" 8d01 8d04 (polarxy 8d01 -1 0) "")
;;; (setq dimx9 (polarxy dimx8 (- x9 x8) 0))
(setq 9d01 (polarxy 8d02 10 0))
(setq 9d02 (polarxy 9d01 (distance rsp12 rsp13) 0))
(setq 9d03 (polarxy 9d02 (- (* s4 r3)) r3))
(setq 9d04 (polarxy 9d03 (- (distance rsp10 rsp11)) 0))
(command "-layer" "s" "設計" "")
(command "pline" 9d01 9d02 9d03 9d04 "c")
(setq oldl9 0) (setq newl9 ( (distance 9d01 9d04) (distance 9d02 9d03)))
(setq en9 (entlast))
(setq objen9 (vlax-ename->vla-object en9))
(setq aa9 (vla-get-area objen9))
(command "-insert" "dam2" (polarxy (midpt 9d01 9d02) 0 -2.5) 1 1 0 txt9 (rtos 0.00 2 2) (rtos 0.00 2 2) (rtos aa9 2 2) (rtos oldl9 2 2) (rtos newl9 2 2))
(command "-layer" "s" "DIM" "")
(command "-dimstyle" "r" "S200")
(command "text" "bc" (midpt 9d01 9d04) 0.42 (rtod (angle 9d01 9d04)) (strcat "1:" (rtos s5 2 1)))
(command "text" "bc" (midpt 9d03 9d02) 0.42 (rtod (angle 9d03 9d02)) (strcat "1:" (rtos s4 2 1)))
(command "dim1" "hor" 9d01 9d02 (polarxy 9d01 0 -1) "")
(command "dim1" "hor" 9d03 9d04 (polarxy 9d03 0 1) "")
(command "dim1" "ver" 9d01 9d04 (polarxy 9d01 -1 0) "")
(setq w (getreal))
(if (null w) (setq w wold))
(endlsp)
)
swcforest- 初級會員
- 文章總數 : 113
年齡 : 45
來自 : 台中市南區
職業 : 土木工程設計
愛好 : 遊山玩水及AutoLISP
個性 : 開朗活潑
使用年資 : 六七年了
使用版本 : AutoCAD 2016
積分 : 1
經驗值 : 6243
威望值 : 10
注冊日期 : 2008-07-27
回復: [已解決]如何在AutoLISP中,除了有預設值設定之外,可記錄上一次的設定值
你的程式真的很長,實在是很難幫你檢查,不過你程式結尾處這兩行程式是不需要加入的,內容如下:
(setq w (getreal))
(if (null w) (setq w wold))
一般我們如果要從對話框中擷取資料,w變數就必須改由對話框輸入,因此上述這兩行就不需要了,你只需在載入對話框後寫入以下這幾行就夠了,你程式中已經寫入下列三行即可.
(setq wold w)
(if (null wold) (setq wold 1.0))
(set_tile "kw" (rtos wold))
新的數值由對話框中輸入,建議你程式中最好提列哪些是區域變數,哪些是整體變數,以免產生程式與程式之間使用的變數互相衝突,你先試試看拿掉最後那兩行再測試看看.
polarxy這是你自訂的函數嗎?如果不是極座標的函數是polar才對.
(setq w (getreal))
(if (null w) (setq w wold))
一般我們如果要從對話框中擷取資料,w變數就必須改由對話框輸入,因此上述這兩行就不需要了,你只需在載入對話框後寫入以下這幾行就夠了,你程式中已經寫入下列三行即可.
(setq wold w)
(if (null wold) (setq wold 1.0))
(set_tile "kw" (rtos wold))
新的數值由對話框中輸入,建議你程式中最好提列哪些是區域變數,哪些是整體變數,以免產生程式與程式之間使用的變數互相衝突,你先試試看拿掉最後那兩行再測試看看.
polarxy這是你自訂的函數嗎?如果不是極座標的函數是polar才對.
張譽璋- 榮譽顧問
- 文章總數 : 304
年齡 : 54
來自 : 彰化縣員林鎮
職業 : 機械設計工程師/AutoCAD講師/AutoCAD外掛系統開發/AutoCAD書籍作者
愛好 : 旅行及電影
個性 : 風趣健談
使用年資 : 25年
使用版本 : AutoCAD2010/2011/2012/2013
積分 : 20
經驗值 : 7520
威望值 : 641
發帖精華 : 2
回帖精華 : 1
注冊日期 : 2008-05-28
回復: [已解決]如何在AutoLISP中,除了有預設值設定之外,可記錄上一次的設定值
是否能請張大大加入我的msn
方便資料傳送及討論
若有不便 請見諒
方便資料傳送及討論
若有不便 請見諒
swcforest 在 2009-10-31, 16:39 作了第 2 次修改 (原因 : 打馬賽克!judy)
swcforest- 初級會員
- 文章總數 : 113
年齡 : 45
來自 : 台中市南區
職業 : 土木工程設計
愛好 : 遊山玩水及AutoLISP
個性 : 開朗活潑
使用年資 : 六七年了
使用版本 : AutoCAD 2016
積分 : 1
經驗值 : 6243
威望值 : 10
注冊日期 : 2008-07-27
回復: [已解決]如何在AutoLISP中,除了有預設值設定之外,可記錄上一次的設定值
swcforest 寫到:是否能請張大大加入我的msn
方便資料傳送及討論
若有不便 請見諒
PBRNACL@******
請注意版規!
8.發表文章、回復及討論問題,以公開透明討論為原則,請勿留下個人信箱、廣告、暴力、情色及非法性所有相關訊息。
judyyai- 管理顧問
- 文章總數 : 7786
年齡 : 47
來自 : 台南
職業 : 機械製圖
愛好 : 電腦相關
個性 : think too much...
使用年資 : 10↑
使用版本 : AC2019(開始於2019年底末月)
AutoCAD基礎篇等級 : 10星級
積分 : 393
最佳解答 : 1
經驗值 : 30444
威望值 : 3610
發帖精華 : 2
回帖精華 : 4
注冊日期 : 2008-11-19
回復: [已解決]如何在AutoLISP中,除了有預設值設定之外,可記錄上一次的設定值
抱歉 一時情急
我下次會注意
謝謝大大提醒
我下次會注意
謝謝大大提醒
swcforest- 初級會員
- 文章總數 : 113
年齡 : 45
來自 : 台中市南區
職業 : 土木工程設計
愛好 : 遊山玩水及AutoLISP
個性 : 開朗活潑
使用年資 : 六七年了
使用版本 : AutoCAD 2016
積分 : 1
經驗值 : 6243
威望值 : 10
注冊日期 : 2008-07-27
回復: [已解決]如何在AutoLISP中,除了有預設值設定之外,可記錄上一次的設定值
沒關係啦~swcforest 寫到:抱歉 一時情急
我下次會注意
謝謝大大提醒
我們的用意在於討論文章過程,這是非常寶貴的知識,藉此平台也可以讓有需要或是相同問題的朋友得到幫助!!
這樣才能發揮論壇互助的真正價值~
____________________________________________________________________________________
👉快速比例設定與出圖技巧-線上課程(點我)👈
回復: [已解決]如何在AutoLISP中,除了有預設值設定之外,可記錄上一次的設定值
最近可能會用到,先學起來,感謝。
cadbill- 初級會員
- 文章總數 : 14
年齡 : 37
來自 : 桃園
職業 : 學生
愛好 : 看書
個性 : 直接
使用年資 : 1
使用版本 : 2011
積分 : 1
經驗值 : 5035
威望值 : 12
注冊日期 : 2011-04-09
adslwang- 高級會員
- 文章總數 : 376
年齡 : 46
來自 : 台南
職業 : 自由業
愛好 : 電腦、旅行
個性 : 樂觀
使用年資 : 1年
使用版本 : 2009
積分 : 17
經驗值 : 7210
威望值 : 356
回帖精華 : 1
注冊日期 : 2008-10-02
回復: [已解決]如何在AutoLISP中,除了有預設值設定之外,可記錄上一次的設定值
學習觀摩一下張老師的指導!
ginse0727- 高級會員
- 文章總數 : 256
年齡 : 50
來自 : 台北巿
職業 : 帷幕牆
愛好 : 電玩,漫畫,網路小說
個性 : 宅男/正直/死腦筋
使用年資 : 退伍後工作迄今,10年以上
使用版本 : 2012
積分 : 14
經驗值 : 6828
威望值 : 500
發帖精華 : 1
注冊日期 : 2010-07-13
回復: [已解決]如何在AutoLISP中,除了有預設值設定之外,可記錄上一次的設定值
目前正在學習簡單的LISP程式編輯.這個功能要學起來。謝謝分享。
john351486- 一般會員
- 文章總數 : 19
年齡 : 43
來自 : 中部
職業 : 五金加工
愛好 : 看書
個性 : 隨和
使用年資 : 新手
使用版本 : 2014
經驗值 : 3721
威望值 : 6
注冊日期 : 2014-12-13
君- 一般會員
- 文章總數 : 2
年齡 : 30
來自 : 南投
職業 : 待業
愛好 : 唱歌 手作
個性 : 安靜
使用年資 : 10
使用版本 : 2020
經驗值 : 406
威望值 : 0
注冊日期 : 2023-10-18
AutoCAD顧問 :: 技術(發言等級:一般會員) :: :: 進階討論 :: 已解決主題精華區
第1頁(共1頁)
這個論壇的權限:
您 無法 在這個版面回復文章