Lv.0 등록일: 2021-10-122021-10-12T13:08:04+09:00 2021-10-12T13:08:04+09:00카테고리: AutoCAD & CADian 블록 리스트 엑셀이나 텍스트 파일로 가져올 수 있는 리습 안녕하세요 🙂 캐드에서 renname 명령어를 입력하면 블록 이름들이 리스트로 쭉 나오는데 그 리스트를 엑셀이나 텍스트로 가져올 수 있는 리습이 있을까요 ? ㅠ 공유 Facebook 관련 있는 질문들 캐드에서 복사해서 방향 옮길때 다른방향으로 가요. 캐드에서 복사해서 방향 옮길때 다른방향으로 가요. FAQ 51을 참조 하라는데 FAQ가 어디에 있나요?? jsk.shx 파일 받을 부탁드립니다 ㅠ 1 답변 작성 순 최신 순 공감 순 bee누 Lv.0 2021-11-25T16:45:07+09:00답변 등록 답변 등록 일시 2021-11-25 4:45 pm 파일첨부 안되어서 리습짜집기로 만들어봤어요 (defun c:bbb(/) (vlax-for Blk (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (entmake (list ‘(0 . “MTEXT”) ‘(100 . “AcDbEntity”) ‘(100 . “AcDbMText”) (cons 10 (list 0.0 0.0 0.0)) (cons 40 20) (cons 1 (strcat (vla-get-name blk) )) (cons 7 (getvar “TEXTSTYLE”)) )) (princ) ) (command “zoom” “w” “-50,-50” “200,200”) (aa) ) ;—————————– ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Text to Excel ;; Made By………. TaeEun -_-)=b ;; ;; Contact Me……. arin9916@naver.com ;; … http://cafe.naver.com/ptelisp ;; Client……….. Gocad ;; Date…………. 2012-04-15 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun aa( / objs doc tol excel cell str x y PTE:sortobj LM:UnFormat) ; Sub-function – 01 (defun PTE:sortobj ( olst typ tol / typ objs opt npt lst data lst rev sx sy dxf x y PTE:s1 PTE:s2 PTE:s3 PTE:s4 ) (defun rev (ls f) (mapcar ‘(lambda (l)(if (setq f (not f)) (reverse l) l)) ls)) (defun sx (objs) (vl-sort objs ‘(lambda (a b) (< (x a) (x b))))) (defun sy (objs) (vl-sort objs ‘(lambda (a b) (< (y a) (y b))))) (defun dxf (o c) (cdr (assoc c (entget (vlax-vla-object->ename o))))) (defun x (o) (car (dxf o 10))) (defun y (o) (cadr (dxf o 10))) (setq typ (vl-string->list (strcase typ))) (if (member (car typ) ‘(76 82)) (setq PTE:s1 sy PTE:s2 y PTE:s3 sx PTE:s4 rev) (setq PTE:s1 sx PTE:s2 x PTE:s3 sy PTE:s4 rev) ) (setq objs (PTE:s1 olst) opt (PTE:s2 (car objs))) (foreach o objs (if (< tol (abs (- (setq npt (PTE:s2 o)) opt))) (setq lst (cons data lst) data (list o) opt npt) (setq data (cons o data)) ) ) (setq lst (mapcar ‘(lambda (l) (PTE:s3 l))(cons data lst)) lst (if (member (cadr typ) ‘(85 82)) (reverse lst) lst) lst (if (member (car typ) ‘(68 76)) (mapcar ‘(lambda (l) (reverse l)) lst) lst) lst (if (/= (car typ) (caddr typ))(PTE:s4 lst t) lst) ) ) ; Sub-function – 02 (defun LM:UnFormat ( str mtx / _Replace regex ) ;; и╧ Lee Mac 2010 (defun _Replace ( new old str ) (vlax-put-property regex ‘pattern old) (vlax-invoke regex ‘replace str new) ) (setq regex (vlax-get-or-create-object “VBScript.RegExp”)) (mapcar (function (lambda ( x ) (vlax-put-property regex (car x) (cdr x))) ) (list (cons ‘global actrue) (cons ‘ignorecase acfalse) (cons ‘multiline actrue)) ) (mapcar (function (lambda ( x ) (setq str (_Replace (car x) (cdr x) str))) ) ‘( (“ив” . “\\\\”) (” ” . “\\P|\n|\t”) (“$1” . “\\(\\[ACcFfHLlOopQTW])|\\[ACcFfHLlOopQTW][^\\;]*;|\\[ACcFfHLlOopQTW]”) (“$1$2/$3” . “([^\\])\\S([^;]*)[/#\^]([^;]*);”) (“$1$2” . “\\(\\S)|[\\](})|}”) (“$1” . “[\\]({)|{“) ) ) (setq str (if mtx (_Replace “\\” “ив” (_Replace “\$1$2$3” “(\\[ACcFfHLlOoPpQSTW])|({)|(})” str)) (_Replace “\” “ив” str) ) ) (vlax-release-object regex) str ) ;================================================================================== ; Main function ;================================================================================== (ssget ‘((0 . “text,mtext”))) (setq doc (vla-get-activedocument (vlax-get-acad-object)) objs (vlax-for o (vla-get-activeselectionset doc) (setq objs (cons o objs))) tol (car (vl-sort (mapcar ‘vla-get-height objs) ‘<)) objs (PTE:sortobj objs “rdr” tol) ) (or (setq excel(vlax-get-or-create-object “Excel.Application”)) (alert “Fail to Excel load”) (exit) ) (vlax-invoke-method (vlax-get-property excel ‘Workbooks) ‘Add) (vlax-put Excel ‘visible :vlax-true) (setq cell (vlax-get-property (vlax-get-property excel ‘ActiveSheet) ‘Cells) x 1 y 1 ) (foreach os objs (foreach o os (setq str (if (= (vla-get-objectname o) “AcDbText”) (vla-get-textstring o) (LM:UnFormat (vla-get-textstring o) nil) ) ) (vlax-put-property cell ‘item y x (strcat “‘” str)) (setq y (1+ y)) ) (setq y (1+ y) x 1) )(princ) )(vl-load-com) ;——————-
1 답변