尊敬的各位:,
我想要的是这样:
- ;Labels a lot's area using the Boundary command. LPS 2008-10
- (defun c:LA () ;(/ cl txtst txtsz oldecho oldsnap B ac sf kw)
- (setq temperr *error*);store *error*
- (setq *error* errortrap);reassign *error*
- (setq cl (getvar "clayer")
- txtst (getvar "textstyle")
- txtsz (getvar "textsize")
- oldecho (getvar "cmdecho")
- oldsnap (getvar "osmode")
- );setq
- (setvar "cmdecho" 0)
- (command "-style" "SIMPLEX" "simplex.shx" "0" "0.9" "0" "n" "n" "n")
- (setq ip (getpoint "\nPick internal point: "))
- (command "-layer" "m" "calc" "c" "63" "calc" "p" "n" "calc" "")
- (command "-boundary" ip "")
- (command "region" (entlast) "")
- (setq b (entlast))
- (command "area" "o" b)
- (setq ac (strcat (rtos (/ (getvar "area") 0.0929) 2 3) " Sq.Ft."))
- (setq sf (strcat (rtos (getvar "area") 2 2) " SQ.M."))
- (setq per (strcat (rtos (getvar "perimeter") 2 2) " M."))
- (command "-layer" "m" "LOT-AREA" "c" "53" "" "")
- (command "text"
- "s"
- "simplex"
- "c"
- ip
- (* 0.2 (getvar "dimscale"))
- "0"
- sf
- )
- (command "text" "" ac)
- (command "text" "" per)
- (initget "Yes No")
- (setq kw (getkword "\nErase boundary Yes/No? <Yes>"))
- (if
- (= kw nil)
- (command "erase" b "")
- ) ;if
- (command "textstyle" txtst)
- (setvar "clayer" cl)
- (setvar "textsize" txtsz)
- (setvar "cmdecho" oldecho)
- (setvar "osmode" oldsnap)
- (setq *error* temperr)
- (princ)
- );defun c:
- ;==========ERROR TRAP=================
- (defun errortrap (msg) ;define function
- (setvar "textstyle" txtst)
- (setvar "textsize" txtsz)
- (setvar "clayer" cl)
- (setvar "cmdecho" oldecho) ;restore variables
- (setvar "osmode" oldsnap)
- (setq *error* temperr) ;restore *error*
- (prompt "\nResetting System Variables ") ;inform user
- (princ)
- );defun
- ;==========ERROR TRAP=================
- (prompt "\nLotArea.lsp loaded, type LA to run")
- (princ)
在这种情况下,当我输入命令LA,然后通过单击封闭的形状,我立即得到其面积和外围。
同样,我想要这样的代码:
点击正方形或矩形形状,我应该得到写在形状中心的尺寸,如下所示:
10'-0“x 12'-6”
我认为这应该是可能的,当然只有在你的帮助下!! |