중량 리습 수정 부탁드립니다. ㅠㅠ
컨텐츠 정보
- 31 조회
- 2 댓글
- 0 추천
- 0 비추천
- 목록
본문
여태 잘 사용해오던 리습인데 오토캐드2016에서 2023으로 버전 업그레이드 이후에 문제가 생긴거 같아요.
폴리곤 선택시 원래는 정확하게 인식 되었고 크기가 작아도 선택 되었었는데
지금은 사진처럼 정확하게 인식도 안되고 작은 도형은 잡히지도 않네요 혹시 수정 가능하신 분들이 있으실까요?
(defun 객체테두리표시 (#aa / #a #b)
(vla-getboundingbox #aa ‘#a ‘#b)
(setq #a(vlax-safearray->list #a))
(setq #b(vlax-safearray->list #b))
(grvecs (list
-5 (list (car #a)(cadr #a))(list (car #b)(cadr #a))
-5 (list (car #b)(cadr #a))(list (car #b)(cadr #b))
-5 (list (car #b)(cadr #b))(list (car #a)(cadr #b))
-5 (list (car #a)(cadr #b))(list (car #a)(cadr #a))
);;list
);;grvecs
);;defun
;;========================================================================================
(defun 면적체적중량표시 (/ #ap #ad #ut #as #os #count #index #a #b #c #d #e #f #g #h #i)
(vl-load-com)
(setq #ap(vlax-get-acad-object))
(setq #ad(vla-get-activedocument #ap))
(setq #ut(vla-get-utility #ad))
(setq #as
(if (>(vla-get-activespace #ad)0)
(vla-get-modelspace #ad)
(vla-get-paperspace #ad)
);;if
);;setq
(setq #os(vlax-variant-value(vla-getvariable #ad “osmode”)))
(vla-setvariable #ad “cmdecho” 0)
(vla-setvariable #ad “osmode” 0)
(setq #count (vla-get-count #as))
(while (not(vl-catch-all-error-p(setq #a(vl-catch-all-apply ‘vla-getpoint (list #ut nil “n≫≫≫Pick internal point:”)))))
(if(not(vl-catch-all-error-p(vl-catch-all-apply ‘vl-cmdf
(list
“boundary”
“a”
“o”
“r”
“”
(vlax-safearray->list(vlax-variant-value #a))
“”
)
)
)
)
(progn
(if (and
(> (vla-get-count #as) #count)
(eq “AcDbRegion” (vla-get-objectname(vla-item #as(1-(vla-get-count #as)))))
);;and
(progn
(setq #index 1)
(repeat (- (vla-get-count #as) #count)
(setq #e(vla-item #as (- (vla-get-count #as) #index)))
(setq #b(vlax-variant-value(vla-get-centroid #e)))
(setq #c(vlax-make-safearray vlax-vbdouble ‘(0 . 2)))
(vlax-safearray-fill #c (list
(vlax-safearray-get-element #b 0)
(vlax-safearray-get-element #b 1)
0.0
);;list
);;vlax-
(setq #d(cons(vla-get-area #e)#d))
(setq #i(cons #e #i))
(setq #index(1+ #index))
);;repeat
(mapcar ‘객체테두리표시 #i)
(mapcar ‘vla-delete #i)
(setq #i nil)
(vlax-release-object #e)
(setq #d(abs(apply ‘- #d)))
;;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
(initget 0 “A M B S SS”)(setq #h(getkword “n≫≫≫Meterial [Aluminum,Mc-nylon,Brass,Steel,Sus304]?:”))
(setq #g
(cond
((eq #h “A”)'(“Aluminum” 2.7))
((eq #h “M”)'(“Mc-nylon” 1.17))
((eq #h “B”)'(“Brass” 8.65))
((eq #h “S”)'(“Steel” 7.85))
((eq #h “SS”)'(“Sus304” 7.9))
(t ‘(“Steel” 7.85))
);;cond
);;setq
(vla-addmtext #as #c 0.0 (strcat “Area=” (rtos #d 2 2) “㎟” (chr 92) “P”
“Thickness=” (rtos(setq #f(getreal “n≫≫≫Thickness?<㎜>:”))2 2) “㎜” (chr 92) “P”
“Cubic=” (rtos(* #d #f)2 2) “㎣” (chr 92) “P”
;”Weight={\C1;” (rtos(/(* #d #f (cadr #g))1000000)2 2) “㎏}” (chr 92) “P”
“Weight={\C1;” (rtos(/(* #d #f (cadr #g))1000000)2 2) (chr 92) “P”
“Material={\C5;” (car #g) “}”
);;strcat
);;vla-
;;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
(setq #count(vla-get-count #as))
);;progn
(progn
(princ “nNot internal point.≪≪≪”)
);;progn
);;if
);;progn
);;if
(setq #d nil)
);;while
(vla-setvariable #ad “cmdecho” 1)
(vla-setvariable #ad “osmode” #os)
(mapcar ‘vlax-release-object (list #as #ut #ad #ap))
(princ “n「Designed by nonno」”)
(princ)
);;defun
;;=====================================
(defun c:ww ()(면적체적중량표시))
;;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;;사용방법
;;선택집합의 (제일 큰닫힌객체 빼기 나머지 닫힌객체들) 을 연산하여
;;면적,체적,두께,중량을 엠텍스트로 그래픽에 씁니다.