캐드 분류
길이구하는 리습인데요 숫자 앞에 3자리만 나오게 할수없나요?<br>길이구하는 리습인데요 숫자 앞에 3자리만 나오게 할수없나요?
컨텐츠 정보
- 260 조회
- 6 댓글
- 0 추천
- 0 비추천
- 목록
본문
(defun c:lle (/ ent n dis ent_l #a #ad #as )
(setvar "cmdecho" 0)
(setq ent (ssget '((0 . "LINE,CIRCLE,ARC,POLYLINE,LWPOLYLINE,ELLIPSE,SPLINE"))))
(setq n 0 dis 0)
(repeat (sslength ent)
(setq ent_l (ssname ent n))
(command-s "lengthen" ent_l "" "" "")
(setq dis (+ dis (GETVAR "PERIMETER")))
(setq n (1+ n))
)
(setq #a(strcat "***** 선택 객체수 = " (rtos n) " 길이합계 = " (rtos (*0.001 dis)2 2))
(prompt (strcat "n" #a))
(vl-load-com)
(setq #ad(vla-get-activedocument (vlax-get-acad-object)))
(setq #as
(if (> (vla-get-activespace #ad) 0)
(vla-get-modelspace #ad)
(vla-get-paperspace #ad)
);;if
);;setq
(vla-addtext #as #a (vlax-3d-point (getpoint "n≫≫≫Pick text point:"))(* (getvar "textsize")1.0))
(mapcar 'vlax-release-object (list #as #ad))
(princ)
(setvar "cmdecho" 1)
)
(setvar "cmdecho" 0)
(setq ent (ssget '((0 . "LINE,CIRCLE,ARC,POLYLINE,LWPOLYLINE,ELLIPSE,SPLINE"))))
(setq n 0 dis 0)
(repeat (sslength ent)
(setq ent_l (ssname ent n))
(command-s "lengthen" ent_l "" "" "")
(setq dis (+ dis (GETVAR "PERIMETER")))
(setq n (1+ n))
)
(setq #a(strcat "***** 선택 객체수 = " (rtos n) " 길이합계 = " (rtos (*0.001 dis)2 2))
(prompt (strcat "n" #a))
(vl-load-com)
(setq #ad(vla-get-activedocument (vlax-get-acad-object)))
(setq #as
(if (> (vla-get-activespace #ad) 0)
(vla-get-modelspace #ad)
(vla-get-paperspace #ad)
);;if
);;setq
(vla-addtext #as #a (vlax-3d-point (getpoint "n≫≫≫Pick text point:"))(* (getvar "textsize")1.0))
(mapcar 'vlax-release-object (list #as #ad))
(princ)
(setvar "cmdecho" 1)
)
이 리습 사용하면 길이 합계가 나오긴하는데,
12550.000으로 나오는데,
이걸 12.55 이렇게 소수점 찍히도록 나오게 응용이 안되네요 ;
12550.000으로 나오는데,
이걸 12.55 이렇게 소수점 찍히도록 나오게 응용이 안되네요 ;
(defun c:Dst (/ ent n dis ent_l #a #ad #as )
(setvar "cmdecho" 0)
(setq ent (ssget '((0 . "LINE,CIRCLE,ARC,POLYLINE,LWPOLYLINE,ELLIPSE,SPLINE"))))
(setq n 0 dis 0)
(repeat (sslength ent)
(setq ent_l (ssname ent n))
(command "lengthen" ent_l "")
(setq dis (+ dis (GETVAR "PERIMETER")))
(setq n (1+ n))
)
(setq txs(getint "nIn Put Text Size:")) ; 텍스트 사이즈
(setvar "cmdecho" 0)
(setq ent (ssget '((0 . "LINE,CIRCLE,ARC,POLYLINE,LWPOLYLINE,ELLIPSE,SPLINE"))))
(setq n 0 dis 0)
(repeat (sslength ent)
(setq ent_l (ssname ent n))
(command "lengthen" ent_l "")
(setq dis (+ dis (GETVAR "PERIMETER")))
(setq n (1+ n))
)
(setq txs(getint "nIn Put Text Size:")) ; 텍스트 사이즈
(setq #a(strcat (rtos dis 2 0)))
(prompt (strcat "n" #a))
(vl-load-com)
(setq #ad(vla-get-activedocument(vlax-get-acad-object)))
(setq #as
(if (> (vla-get-activespace #ad) 0)
(vla-get-modelspace #ad)
(vla-get-paperspace #ad)
);;if
);;setq
(vla-addtext #as #a (vlax-3d-point(getpoint "n≫≫≫Pick text point:")) txs)
(mapcar 'vlax-release-object (list #as #ad))
(princ)
(setvar "cmdecho" 1)
)
(prompt (strcat "n" #a))
(vl-load-com)
(setq #ad(vla-get-activedocument(vlax-get-acad-object)))
(setq #as
(if (> (vla-get-activespace #ad) 0)
(vla-get-modelspace #ad)
(vla-get-paperspace #ad)
);;if
);;setq
(vla-addtext #as #a (vlax-3d-point(getpoint "n≫≫≫Pick text point:")) txs)
(mapcar 'vlax-release-object (list #as #ad))
(princ)
(setvar "cmdecho" 1)
)
길이값을 구하면 숫자가 6자리 다 나오는데 앞에 3자리만 나오게 할수없나요ㅠㅠㅠ
관련자료
댓글 6