TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: masao on June 18, 2022, 10:24:31 PM
-
Hi,everyone. I'm from taiwan. I'm masao.
Excuse me how to modify the LISP,make it like "pedit" function?
*This function can't use list.(photo 2)
(defun expt()
(command "_explode" (entlast))
)
(defun c:tz()
(setvar "osmode" 0 )
(terpri)
;size
(initget "A0 A1 A2 A3 A0V A1V A2V A3V")
(setq size (getint "paper size:[A0/A1/A2/A3/A0V/A1V/A2V/A3V]<A3>:"))
(if (= size nil) (setq size "A3")) ;if not
(setq size (strcase size))
(setq ii "A3h.dwg")
;if
(cond ((= size "A3V") (setq ii "A3v.dwg"))
((= size "A2") (setq ii "A2h.dwg"))
((= size "A2V") (setq ii "A2v.dwg"))
((= size "A1") (setq ii "A1h.dwg"))
((= size "A1V") (setq ii "A1v.dwg"))
((= size "A0") (setq ii "A0h.dwg"))
((= size "A0V") (setq ii "A0v.dwg"))
)
(command "_insert" ii pause 1 1 "")
(expt)
)
(princ)
(princ "\n:: loadpaper.lsp- command\"tz\" ::")
(princ "\n:: \"A0~A3\" - horizontal paper ::")
(princ "\n:: \"A0V~A3V\" - vertical paper ::")
(princ)
-
sorry,i complete it.
use "getkword" can get photo 2 and function list must use one word,make function click complete. :idea:
(defun expt()
(command "_explode" (entlast))
)
(defun c:tz()
;size值需使用者輸入
(initget "A B C D E F G H")
(setq size (getkword "請輸入圖紙大小[A3橫式(A)/A2橫式(B)/A1橫式(C)/A0橫式(D)/A3直式(E)/A2直式(F)/A1直式(G)/A0直式(H)]<A3橫式(A)>:"))
(if (= size nil) (setq size "A")) ;若輸入為空白即套用預設值
(setq size (strcase size))
;if判斷式
(cond ((= size "A") (setq ii "A3橫.dwg"))
((= size "B") (setq ii "A2橫.dwg"))
((= size "C") (setq ii "A1橫.dwg"))
((= size "D") (setq ii "A0橫.dwg"))
((= size "E") (setq ii "A3直.dwg"))
((= size "F") (setq ii "A2直.dwg"))
((= size "G") (setq ii "A1直.dwg"))
((= size "H") (setq ii "A0直.dwg"))
)
(command "_insert" ii pause 1 1 "")
(expt)
)
(princ)
(princ "\n:: 載入圖框.lsp- 輸入\"tz\"執行程式 ::")
(princ "\n:: \"A~D\" - 橫式圖框 ::")
(princ "\n:: \"E~H\" - 直式圖框 ::")
(princ)
-
Hi,everyone. I'm from taiwan. I'm masao.
you are welcome
I'm from Shandong. I'm baitang36. i'm glad to meet you