제가 쓰는 리습인데요 . 면적(m2), 평 모두 출력이 되어서요.
이것을 면적(m2) 만 화면에 출력되면서 _글씨 스케일_자동 조절 되게 되었으면 합니다.
첨부 화일 같이 올립니다.
(defun *ERROR* (st)
;(COMMAND “LAYER” “S” Q:LAINIT “”)
(SETVAR “BLIPMODE” 1)
(SETVAR “CMDECHO” 1)
(if (and (= (type cepickbox) ‘INT ) (/= cepickbox 0))
(if (and (= (type cepickbox) ‘INT ) (/= cepickbox 0))
(setvar “pickbox” cepickbox)))
;(command “color” cecol)
(princ “nError: ” )
(princ st)
(prin1)
)
(defun instr (s c / i l)
(setq i 1 l (strlen s))
(while (and (<= i l) (/= (substr s i 1) c ))
(setq i (1+ i)) )
(if (> i l) nil i))
(defun delzro (s / l w)
(setq l (strlen s))
(cond ( (= 0 l) “” )
(T (while (= “0” (substr s l 1))
(setq s (substr s 1 (setq l (1- l))
))
)
(cond ((= “.” (substr s l 1))
(substr s 1 (1- l))) (T s)) )))
(defun ac (s / w k i d l)
(setq l (strlen s) k 5)
(if (null (setq d (instr s “.” )) )
(setq d (1+ l)) )
(setq i (- l d -1) w (delzro (substr s d i) ))
(setq floatback (substr s (+ d 1) l ))
(while (< (setq i (+ k i)) l )
(setq d (- d k) w (strcat “,” (substr s d k) w )) )
(strcat (substr s 1 (1- d) ) w ))
;;; AREA WRIGHTING
(defun C:pp
(/ cmd n nn ar arr arrr loop)
(graphscr)
(setvar “CMDECHO” 0)
;(setq Q:LAINIT (getvar “clayer” ))
;(setq cecol (getvar “cecolor” ))
(setq cepickbox (getvar “pickbox” ))
(setq cusc (getvar “ltscale” ))
(setq cusnap (getvar “snapang” ))
(setq cmd (getvar “cmdecho” ))
;(setq inp (vslin “Cadp6(cp6p-x19)”
; “n>> Select number ” “1 2” 2 2 T ))
(SETQ INP “2” );;;1995,7,20
(cond ( (= inp “1” )
(setq Loop T)
(command “Units””” “8””” “””” “”)
(setq spt1 (getpoint “n>> Pick point : ” ))
(command “Pline” spt1)
(while (and loop (setq spt1 (getpoint spt1 “n>Pick point : ” )))
(command spt1)
(initget “C” )
(if (= spt1 “C” )
(setq loop nil) ))
(if (/= spt1 “C” )
(command “” ))
(command “area” “e” “L”)
(setq mscale (getreal “n>> Scale <1> : ” ))
(if (not mscale) (setq mscale 1))
(setq mscale (* mscale mscale))
(setq ar (/ (/ (* (getvar “area” ) mscale ) 1.0e+06 ) 0.3025 ))
(setq arr (rtos ar 2 2))
(setq arrr (ac arr))
(princ (strcat “n Area (M2) : “
(rtos (* (* (getvar “area” ) mscale ) 1.0e+06 ) 2 2 ) ) )
(princ (strcat “n Area (py) : ” arrr ))
(command “Units””” “0””” “””” “” )
(entdel (entlast))
(setvar “cmdecho” cmd))
;;;;PLINE
( (= inp “2” )
(command “Units””” “8””” “””” “”)
(setq S_ent (entsel “n>> Select pline : ” ))
(command “area” “e” S_ent )
(setq mscale (getreal “n>> Scale <1> : ” ))
(if (= mscale nil) (setq mscale 1.0))
(setq mscale (* mscale mscale))
(setq ar (* (/ (* (getvar “area” ) mscale ) 1.0e+06 ) 0.3025 ))
(setq arr (rtos ar 2 5 ));;;;;;2 2))
(setq arrr (ac arr ))
(princ (strcat “”
(rtos (/ (* (getvar “area” ) mscale ) 1.0e+06 ) 2 5 )))
(princ (strcat “n Area (py) : ” arrr ) )
(command “Units””” “0””” “””” “” ) ;(entdel (entlast)- 😉
(setvar “cmdecho” cmd)
))
(if inp (progn (setq spt1 (getpoint “n>> Pick text point : ” ))
(if spt1 (progn
;;;(setlayer “C17” )
(COMMAND “LAYER” “M” “TEXT” “”)
(command “text” spt1 (* cusc 5) “” (strcat “”
(ac (rtos (/ (* (getvar “area”) mscale ) 1.0e+06 ) 2 5 ) ) )
(command “text” (polar spt1 (dtr 270) (* cusc 9))
(* cusc 3) “” (strcat “n Area (py) : ” arrr
) ) ) ) ) ) )
(setvar “BLIPMODE” 1)
;(COMMAND “LAYER” “s” Q:LAINIT “” )
;(command “color” cecol)
(if (and (= (type cepickbox) ‘INT ) (/= cepickbox 0) )
(if (and (= (type cepickbox) ‘INT ) (/= cepickbox 0) )
(setvar “pickbox” cepickbox) ))
(PRINC))
잘쓰겠습니다.
면적구할때 편리하겠네요