2014.03.07 10:55
여기에서 자동면적,길이를 구하는 tadd란 리습을 받아 실행하려는데 실행이 안되네요....도와주세요...
;| ;;
TotalADD Total Addition v. 1.0 ;;
By: Andrea Andreetti 2009-10-20 ;;
|;
;;
(princ
"\nTotalADDition v.1.0 activated! -run \"TADD\" to start or \"TADD-r\" to end."
)
(defun c:tadd (/ itemarea itemperimeter itemlinelength
itemarclength itemsplinelength itemregionperimeter itemcircumference
itemsplineperimeter itemplineperimeter itemplinelength itemtracelength
itemarclength itemellipselength a b c d p1 p2 itemlength tarea tperim tlength
)
(vl-load-com)
(defun *oo_object_modification* (objreactor objectsmodified)
(setq selected_objects (vla-get-pickfirstselectionset
(vla-get-activedocument (vlax-get-acad-object))
)
)
(setq itemarea 0
itemperimeter 0
itemlinelength 0
itemarclength 0
itemsplinelength 0
itemregionperimeter 0
itemcircumference 0
itemsplineperimeter 0
itemplineperimeter 0
itemplinelength 0
itemtracelength 0
itemarclength 0
itemellipselength 0
)
;AREA
(vlax-for n selected_objects
(if (vlax-property-available-p n 'area)
(if (eq (vla-get-objectname n) "AcDbRegion")
(setq itemarea (+ itemarea (vla-get-area n)))
(if (vlax-curve-isclosed n)
(setq itemarea (+ itemarea (vla-get-area n)))
)
)
)
;;CIRCLE
(if (vlax-property-available-p n 'circumference)
(setq itemcircumference (+ itemcircumference (vla-get-circumference n)))
)
;;SPLINE
(if (eq (vla-get-objectname n) "AcDbSpline")
(if (vlax-curve-isclosed n)
(setq itemsplineperimeter (+ itemsplineperimeter
(vlax-curve-getdistatparam n (vlax-curve-getendparam n))
)
)
(setq itemsplinelength (+ itemsplinelength
(vlax-curve-getdistatparam n (vlax-curve-getendparam n))
)
)
)
)
;;REGION
(if (eq (vla-get-objectname n) "AcDbRegion")
(setq itemregionperimeter (+ itemregionperimeter (vla-get-perimeter n)))
)
;;PLINE
(if (or (eq (vla-get-objectname n) "AcDb2dPolyline")
(eq (vla-get-objectname n) "AcDbPolyline")
)
(if (vlax-curve-isclosed n)
(setq itemplineperimeter (+ itemplineperimeter
(vlax-curve-getdistatparam n (vlax-curve-getendparam n))
)
)
(setq itemplinelength (+ itemplinelength
(vlax-curve-getdistatparam n (vlax-curve-getendparam n))
)
)
)
)
;;LINE
(if (eq (vla-get-objectname n) "AcDbLine")
(setq itemlinelength (+ itemlinelength (vla-get-length n)))
)
;;ARC
(if (eq (vla-get-objectname n) "AcDbArc")
(setq itemarclength (+ itemarclength (vla-get-arclength n)))
)
(if (eq (vla-get-objectname n) "AcDbEllipse")
(setq itemellipselength (+ itemellipselength
(vlax-curve-getdistatparam n (vlax-curve-getendparam n))
)
)
)
;;TRACE
(if (eq (vla-get-objectname n) "AcDbTrace")
(progn (setq plist (vlax-safearray->list
(vlax-variant-value (vla-get-coordinates n))
)
)
(setq a (list (nth 0 plist) (nth 1 plist) (nth 2 plist)))
(setq b (list (nth 3 plist) (nth 4 plist) (nth 5 plist)))
(setq c (list (nth 6 plist) (nth 7 plist) (nth 8 plist)))
(setq d (list (nth 9 plist) (nth 10 plist) (nth 11 plist)))
(setq p1 (polar a (angle a b) (/ (distance a b) 2.0)))
(setq p2 (polar c (angle c d) (/ (distance c d) 2.0)))
(setq itemtracelength (+ itemtracelength (distance p1 p2)))
)
)
)
;;_end vlax-for
(setq itemperimeter (+ itemcircumference
itemsplineperimeter
itemregionperimeter
itemplineperimeter
)
)
(setq itemlength (+ itemplinelength itemsplinelength itemlinelength itemtracelength itemarclength itemellipselength)
)
(setq tarea (rtos itemarea 2 8))
(setq tperim (rtos itemperimeter 2 8))
(setq tlength (rtos itemlength 2 8))
(acet-ui-status (strcat "Toatl Area: " tarea "\n" "Total Perimeter: " tperim "\n"
"Total Length: " tlength)
)
)
;;OBJECT SELECTION
(if oo_object_modification
(progn (vlr-remove oo_object_modification)
(setq oo_object_modification nil)
)
)
(setq oo_object_modification
(vlr-miscellaneous-reactor
nil
'((:vlr-pickfirstmodified . *oo_object_modification*))
)
)
;;Command ended
(if oo_object_modification_action
(progn (vlr-remove oo_object_modification_action)
(setq oo_object_modification_action nil)
)
)
(setq oo_object_modification_action
(vlr-command-reactor nil
'((:vlr-commandended . *oo_object_modification*)
;(:vlr-commandcancelled . *oo_object_modification_CANCEL*))
)
)
)
)
(defun c:TADD-r ()
(if oo_object_modification_action
(progn (vlr-remove oo_object_modification_action)
(setq oo_object_modification_action nil)
)
)
(if oo_object_modification
(progn (vlr-remove oo_object_modification)
(setq oo_object_modification nil)
)
)
)
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
공지 | ★ 드림플러스 질문은 메일 또는 홈페이지에 부탁합니다 ★ | 아저씨 | 2017.05.16 | 2775 |
공지 | 제목이 엉망이면 답변달지 않습니다. [1] | 아저씨 | 2014.04.04 | 23854 |
공지 | 순수 캐드 질문은 고캐드로 | 아저씨 | 2013.05.28 | 68641 |
공지 | 질문 답변 게시판을 만들었습니다. | 아저씨 | 2013.02.09 | 74943 |
514 | 관리자권한으로 설치 후 명령어를 입력하면 매크로를 찾을 수 없습니다가 나와요 ㅠㅠ [1] | 하하호호 | 2014.05.20 | 824 |
513 | 다중삽입(minsert)로 만들어진 블럭을 깰 수 있게 해주세요 [2] | 티타 | 2016.06.29 | 826 |
512 | 숨겨진 모듈의 컴파일 오류 [1] | 이성호 | 2015.08.19 | 832 |
511 | 윈7 64 에 오토캐드 2011 설치 관련 오류 [1] | MaenG | 2014.07.29 | 834 |
510 | 캐드도면에서 배수라인타입 관련 질문입니다 [4] | 드림사용자 | 2015.04.19 | 838 |
509 | automation 오류 vba를 로드하는 중에 문제 발생 라고 오류 뜹니다. [1] | enend4937 | 2017.01.20 | 841 |
508 | 드림캐드 명령어 인식 불가 [1] | 캐드초보 | 2014.03.18 | 843 |
507 | dxf 파일도 다중플롯 [1] | 김영일 | 2014.06.03 | 846 |
506 | 64비트 운영체제에서 32비트 캐드 설치하기 [1] | 왕초보 | 2015.03.26 | 852 |
505 | 깎기부 라운딩 [1] | 미르천하 | 2013.11.07 | 855 |
504 | 캐드 2010 VBA모듈이 설치오류 문의 드립니다. [2] | 이정현 | 2015.04.09 | 857 |
503 | 삭제요 [1] | 킴이요 | 2014.02.28 | 859 |
502 | 다중플롯시 개체가 이 속성 또는 매서드를 원하지 않습니다. [1] | 지명 | 2014.06.16 | 862 |
501 | CAD파일이 무거워서 늦게 열릴때 해결방법 알려주세요 [1] | 토목설계 | 2015.02.01 | 864 |
500 | 연속 숫자 증가(TEI) 명령어로 질문이 있습니다. [4] | sweme | 2017.01.19 | 866 |
캐드 설치시 함께 설치하는 Express 설치되어 있어야되는 리습이네요
http://autoc.tistory.com/169 이 글 보시고 설치 안되어 있으면 설치 후 실행해보세요.
설치되었는데도 안되면
제가 아는 범위를 벗어난 것이니 고캐드 사이트의 질문방에 글 남겨보세요.