cad面积累计lisp怎么用_cad中面积及重量、长度及等分、长度及总长、导出文字、数字编号等lisp应用...
(defun c:AW1();;根據(jù)比例自動(dòng)變換
(setvar"cmdecho"0)
(prompt"重量面積標(biāo)注")(terpri)
(setvar "osmode" 4271)
(command "area" "O" (car(entsel "\n單選閉合對(duì)象:")))
(setq t1 (getdist "\n 板厚<4>:"))
(if (null t1)(setq t1 4))
(setq f1 (getreal " 密度304為7.93 316L為7.98<7.85>:"))
(if (null f1)(setq f1 7.85))
(setq aa1 (* (/ (getvar "area") 1000000) f1 t1))
(setq aa2 (/ (getvar "area") 1000000))
(setq aa3 (getvar "area"))
(print "重量kg")(princ aa1)
(print "平米")(princ aa2)
(print "平方毫米")(princ aa3)
(setq p1 (getpoint "\n 文字標(biāo)注點(diǎn):"))
(setq hh1 (getvar "dimSCALE"))
(setq h1 (* 6 hh1))
(setvar "osmode" 20655)
(command "layer" "m" "6文字層" "c" 3 "6文字層" "l" "continuous" "6文字層" "");6文字層
(command "text" "m" p1 h1 0 (strcat (rtos t1 2 2) "mm 密度" (rtos f1 2 2) "重量kg"))
(command "text" "m" (polar p1 (* 1.5 pi) (* 1.1 h1)) h1 0 (rtos aa1 2 2))
;(command "text" "m" (polar p1 (* 1.5 pi) 130) h1 0 "平米")
;(command "text" "m" (polar p1 (* 1.5 pi) 195) h1 0 (rtos aa2 2 2))
(command "text" "m" (polar p1 (* 1.5 pi) (* 2.2 h1)) h1 0 "平方毫米")
(command "text" "m" (polar p1 (* 1.5 pi) (* 3.3 h1)) h1 0 (rtos aa3 2 0))
(princ)
)
(defun c:CD1();;根據(jù)比例自動(dòng)變換
(setvar"cmdecho"0)
(prompt"長度及等分長度標(biāo)注")(terpri)
(setvar "osmode" 4271)
(setq ssl (car (entsel "\n單選標(biāo)注對(duì)象:")));;選擇首個(gè)所選對(duì)象
(command "lengthen" ?ssl "")
(setq LL (getvar "PERIMETER"));;獲取周長
(Setq cn3 (GetInt "等分?jǐn)?shù):"))
(if (null cn3)(setq cn3 1))
(setq LL1 (/ (* LL 1.0) cn3))
(setq p1 (getpoint "\n 文字標(biāo)注點(diǎn):"))
(setq hh1 (getvar "dimSCALE"))
(setq h1 (* 6 hh1))
(setvar "osmode" 20655)
(command "layer" "m" "6文字層" "c" 3 "6文字層" "l" "continuous" "6文字層" "");6文字層
(command "text" "m" p1 h1 0 "長度mm")
(command "text" "m" (polar p1 (* 1.5 pi) (* 1.1 h1)) h1 0 (rtos LL 2 2))
(command "text" "m" (polar p1 (* 1.5 pi) (* 2.2 h1)) h1 0 (strcat (itoa cn3) "等分長度" (rtos LL1 2 2)));;整數(shù)實(shí)數(shù)轉(zhuǎn)字符
(command "text" "m" (polar p1 (* 1.5 pi) (* 3.3 h1)) h1 0 (rtos LL1 2 2))
(princ)
)
(defun c:LL1 ();;根據(jù)比例自動(dòng)變換
(setvar "cmdecho" 0)
(prompt"長度及總長從下往上標(biāo)注")(terpri)
(command "layer" "m" "6文字層" "c" 3 "6文字層" "l" "continuous" "6文字層" "");6文字層
(setq p1 (getpoint "\n 文字標(biāo)注點(diǎn):空白處"))
(setq hh1 (getvar "dimSCALE"))
(setq h1 (* 6 hh1))
(setvar "osmode" 20655)
(setq en (ssget '((0 . "ARC,ELLIPSE,CIRCLE,*LINE"))))
(setq i 0)
(setq ll 0)
(repeat (sslength en)
(setq ss (ssname en i))
(setq endata (entget ss))
(command "lengthen" ss "")
(setq dd (getvar "perimeter"))
(setq ll (+ dd ll))
(setq i (1+ i))
(setq p1 (polar p1 (* 0.5 pi) (* 1.1 h1)))
(command "text" "m" p1 h1 0 (rtos dd 2 2))
)
(princ "\n 所選線條總長為:")(princ ll)
;(setvar "osmode" 20655)
(command "text" "m" (polar p1 (* 0.5 pi) (* 1.1 h1)) h1 0 "長度及總長mm")
(command "text" "m" (polar p1 (* 0.5 pi) (* 2.2 h1)) h1 0 (rtos LL 2 2))
(princ)
)
(defun c:GT ()
(setvar"cmdecho"0)
(prompt"從下往上提取文字")(terpri)
(setq i 0)
(princ "\n選擇文字: ")
(if (and (setq ss (ssget '((0 . "text"))))
(setq ff (open (getfiled "文件保存為" "E:\cad\lsp提取文字" "txt" 1) "w")) ;保存路徑
)
(repeat (sslength ss)
(setq en (entget (ssname ss i))
sn (itoa (+ i 1))
pt (cdr (assoc 10 en))
x ?(rtos (cadr pt) 2 3)
y ?(rtos (car pt) 2 3)
z ?(cdr (assoc 1 en))
i ?(1+ i)
)
(write-line (strcat z) ff)
)
)
(princ)
)
(defun c:BH ()
(setvar"cmdecho"0)
(prompt"標(biāo)注號(hào)碼")(terpri)
(setq i (getint " 起始編號(hào):"))
(if (null i)(setq i 1))
(setq n1 (getint " 總數(shù):"))
(if (null n1)(setq n1 10))
(setq hh1 (getvar "LTSCALE"))
;(setq hh (getdist " 文字倍數(shù):"))
;(if (null hh)(setq hh hh1))
(setq h1 (* 0.6 hh1))
(setq s (getstring "前綴:"))
(if (null s)(setq s "前綴"))
(command "layer" "m" "6文字層" "c" 3 "6文字層" "l" "continuous" "6文字層" "");6文字層
(setq p1 (getpoint "\n 文字標(biāo)注點(diǎn):"))
(repeat n1
(command "text" "m" p1 h1 0 (strcat s (rtos i 2 0)))
(setq i (1+ i))
(setq p1 (getpoint "\n 文字標(biāo)注點(diǎn):"))
)
(princ)
)
總結(jié)
以上是生活随笔為你收集整理的cad面积累计lisp怎么用_cad中面积及重量、长度及等分、长度及总长、导出文字、数字编号等lisp应用...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 怎么恢复相机内存卡?
- 下一篇: 中国红客联盟宣布解散 网站同步关闭