아래 리습이 py와 m2를 같이 산출해주는데요.
저는 m2만 필요한데 어떻게 변경하면 될까요.
그리고 표시할때 m2: 352
이런식으로 표현이 되는데 m2: <-이것 없이 면적값인 숫자만 출력해주도록 변경하고 싶습니다.
리습을 다룰줄 몰라서 변경하고 싶은데 변경할 줄 몰라 요청드려요 ㅠㅠ
(defun c:py ( / a area b decimal doc inspt len ltsc maxpt minpt n obj space ss txtsize yn)
;;;—————————————————————————–;
;; 원작자 : 모름 (보시면 여기에 서명해 주세요~~)
;; edit by kimhyunchul.co.kr 2016-12-28 (필요한 부분만 출력 하도록 조정함)
;;;—————————————————————————–;
(vl-load-com)
(princ “n 객체 중앙에 면적 문자 넣기. (문자높이는 선축척을 곱해서 표현됨)”)
(setvar “cmdecho” 0)
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(if (not (tblsearch “style” “TEXT-AREA”))
(entmake
(list
(cons 0 “STYLE”)
(cons 100 “AcDbSymbolTableRecord”)
(cons 100 “AcDbTextStyleTableRecord”)
(cons 2 “TEXT-AREA”)
(cons 3 “romans.shx”)
(cons 4 “whgtxt.shx”)
(cons 40 0)
(cons 41 1)
(cons 42 1)
(cons 70 0)
(cons 71 0)
(cons 50 0)
)
)
)
(if
(not
(and
(setq txtsize (getcfg “AppData/XiCAD/xiAREA1”))
(/= txtsize “”)
(setq decimal (getcfg “AppData/XiCAD/xiAREA2”))
(/= decimal “”)
)
)
(setq txtsize “2.5”
decimal “2”
)
)
(setq ltsc (getvar ‘ltscale))
(cond
( (= (vla-get-activespace doc) 1) (setq space (vla-get-modelspace doc)) )
( (= (vla-get-activespace doc) 0) (setq space (vla-get-paperspace doc)) )
)
(if (setq ss (ssget (list (cons 0 “CIRCLE,ARC,*POLYLINE,LINE,ELLIPSE,SPLINE”))))
(progn
(initget “Yes No”)
(setq yn
(getkword
(strcat “n <선축척=” (rtos ltsc 2 1) “, 문자높이=” txtsize “, 자리수=” decimal “> 변경여부? [Y/N] <N>: “)
)
)
(if (= yn “Yes”)
(progn
(setq a (getdist (strcat “n>> 문자높이 지정 <” txtsize “>:”)))
(if (and a (numberp a))
(setq txtsize (rtos a 2 1))
)
(setq b (getint (strcat “n>> 소수점 자리수 지정 <” decimal “>:”)))
(if (and b (numberp b))
(setq decimal (rtos b 2 0))
)
(if (and txtsize decimal)
(progn
(setcfg “AppData/XiCAD/xiAREA1” txtsize)
(setcfg “AppData/XiCAD/xiAREA2” decimal)
)
)
)
)
(setq txtsize (* (atof txtsize) ltsc)
decimal (atoi decimal)
)
(repeat (setq n (sslength ss))
(setq obj (vlax-ename->vla-object (ssname ss (setq n (1- n)))))
(vla-getboundingbox obj ‘mi ‘mx)
(setq minpt (vlax-safearray->list mi)
maxpt (vlax-safearray->list mx)
area (vla-get-area obj)
len (vlax-curve-getdistatparam obj (vlax-curve-getendparam obj))
inspt (polar (polar minpt
(angle minpt maxpt)
(/ (distance minpt maxpt) 2)
)
0
(/ (* txtsize 14) 2)
)
inspt (list (car inspt) (+ (cadr inspt) (* txtsize 2)))
)
(mapcar
‘(lambda (a b)
(setq p (vlax-3d-point inspt))
(setq txtobj (vla-addtext space (strcat a b) p txtsize))
(vla-put-alignment txtobj 2)
(vla-put-textalignmentpoint txtobj p)
(vla-put-stylename txtobj “Standard”)
(setq inspt (polar inspt (/ (* 270 pi) 180) (* txtsize 2)))
)
‘(“㎡: ” “PY: ” )
(list
(rtos (/ area 1000000.) 2 decimal)
(rtos (/ area 3305796.) 2 decimal)
;; (rtos len 2 decimal)
)
)
)
(command “chprop” (ssget “x” ‘((0 . “TEXT”) (1 . “PY*”))) “” “c” “7” “”)
)
)
(princ)
)
(princ)
;;;—————————————————————————–;
‘(“㎡: ” “PY: ” )이부분 ‘(” ” “PY: ” ) 변경
감사해요 참고해서 바꿨습니다!