0 Members and 1 Guest are viewing this topic.
(vlar-yourwelcome Gary)Not sure if it will work with ObjectDBX though
TimThanksSo is this how I should call it?(DeletLays_ExplodeBlk (vla-get-ActiveDocument (vlax-get-Acad-Object)) '("A-ARE*" "A-DIM*" "A-NOT*" "A-PAT*" "A-SHT*" "A-SYM*") '("UT*"))Gary
vla-have vla-you vla-check vla-how vla-many vla-arguments vla-the vla-function vla-is vla-required vla-?vlax-just vlax-guessing
(vl-position (strcase (vla-get-Name x)) (mapcar 'strcase BlkList))
Have not tested Tim's code.... are you making sure that is possible to explode the block? and is not nested?, it is a valid list of blocks, it is check with vla-item? against vla-get-blocks?.... (again guessing)
;;;by Tim Willey 8/24/06 (defun ReloadBindXrefs (Doc / XrefList LstLen TroubleList) (vlax-for Blk (vla-get-Blocks Doc) (if (= (vla-get-IsXref Blk) :vlax-true) (progn (if (vl-catch-all-error-p (vl-catch-all-apply 'vla-Reload (list Blk))) (if (vl-catch-all-error-p (vl-catch-all-apply 'vla-Detach (list Blk))) (setq TroubleList (cons Blk TroubleList)) (prompt (strcat "\n Detached xref: " (vla-get-Name Blk)))) (progn (vla-Bind Blk :vlax-true) (if (and (= (vla-get-IsXref Blk) :vlax-true) (not (vl-position (vla-get-Name Blk) XrefList))) (setq XrefList (cons Blk XrefList)))))))) (setq LstLen (length XrefList)) (while (and (> LstLen 0) (> LstLen (setq LstLen (length XrefList)))) (foreach Blk XrefList (if (or (= (vla-get-IsXref Blk) :vlax-false) (and (vla-Bind Blk :vlax-true) (= (vla-get-IsXref Blk) :vlax-true))) (setq XrefList (vl-remove Blk XrefList))))) (foreach Blk (append XrefList TroubleList) (prompt (strcat "\n Unable to bind xref: " (vla-get-Name Blk)))) (princ));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;by Tim Willey 8/28/06 (defun DeletLays_ExplodeBlk (Doc LayList BlkList / cnt) (defun ExplodeList (ObjList BlkList / NewObjList) (mapcar '(lambda (x) (if (and (= (vla-get-ObjectName x) "AcDbBlockReference") (vl-position (strcase (vla-get-Name x)) (mapcar 'strcase BlkList))) (if (vl-catch-all-error-p (setq NewObjList (vla-catch-all-apply 'vlax-invoke (list x "Explode")))) (setq cnt (1+ cnt)) (ExPlodeList NewObjList BlkList))) ObjList)) (princ)) ;------------------------------------------------------------------------------ (setq cnt 0) (vlax-for Lo (vla-get-Layouts Doc) (vlax-for Obj (vla-get-Block Lo) (cond ((vl-position T (mapcar '(lambda (x) (wcmatch (strcase (vla-get-Layer Obj)) (strcase x))) LayList)) (vla-Delete Obj)) ((and (= (vla-get-ObjectName x) "AcDbBlockReference") (vl-position (strcase (vla-get-Name x)) (mapcar 'strcase BlkList))) (if (vl-catch-all-error-p (setq NewObjList (vla-catch-all-apply 'vlax-invoke (list x "Explode")))) (setq cnt (1+ cnt)) (ExPlodeList NewObjList BlkList)))))) (princ));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (ReloadBindXrefs (vla-get-ActiveDocument (vlax-get-Acad-Object))) (DeletLays_ExplodeBlk (vla-get-ActiveDocument (vlax-get-Acad-Object)) '("A-ARE*" "A-DIM*" "A-NOT*" "A-PAT*" "A-SHT*" "A-SYM*") '("UT*")) (princ))(princ)
;;;by Tim Willey 8/24/06(defun ReloadBindXrefs (Doc / XrefList LstLen TroubleList) (vlax-for Blk (vla-get-Blocks Doc) (if (= (vla-get-IsXref Blk) :vlax-true) (progn (if (vl-catch-all-error-p (vl-catch-all-apply 'vla-Reload (list Blk))) (if (vl-catch-all-error-p (vl-catch-all-apply 'vla-Detach (list Blk))) (setq TroubleList (cons Blk TroubleList)) (prompt (strcat "\n Detached xref: " (vla-get-Name Blk)))) (progn (vla-Bind Blk :vlax-true) (if (and (= (vla-get-IsXref Blk) :vlax-true) (not (vl-position (vla-get-Name Blk) XrefList))) (setq XrefList (cons Blk XrefList)))))))) (setq LstLen (length XrefList)) (while (and (> LstLen 0) (> LstLen (setq LstLen (length XrefList)))) (foreach Blk XrefList (if (or (= (vla-get-IsXref Blk) :vlax-false) (and (vla-Bind Blk :vlax-true) (= (vla-get-IsXref Blk) :vlax-true))) (setq XrefList (vl-remove Blk XrefList))))) (foreach Blk (append XrefList TroubleList) (prompt (strcat "\n Unable to bind xref: " (vla-get-Name Blk)))) (princ));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;by Tim Willey 8/28/06 (defun DeletObjLays (Doc LayList) (vlax-for Lo (vla-get-Layouts Doc) (vlax-for Obj (vla-get-Block Lo) (if (vl-position T (mapcar '(lambda (x) (wcmatch (strcase (vla-get-Layer Obj)) (strcase x))) LayList)) (vla-Delete Obj)))) (princ));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;by Tim Willey 8/28/06(defun ExplodeBlkList (Doc BlkList / cnt) (setq cnt 0) (vlax-for Lo (vla-get-Layouts Doc) (vlax-for Obj (vla-get-Block Lo) (if (and (= (vla-get-ObjectName Obj) "AcDbBlockReference") (vl-position T (mapcar '(lambda (x) (wcmatch (strcase (vla-get-Name Obj)) (strcase x))) BlkList))) (if (vl-catch-all-error-p (vl-catch-all-apply 'vla-Explode (list Obj))) (setq cnt (1+ cnt))))) (prompt (strcat "\n " (itoa cnt) " were not able to be exploded.")) (princ)));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (ReloadBindXrefs (vla-get-ActiveDocument (vlax-get-Acad-Object))) (ExplodeBlkList (vla-get-ActiveDocument (vlax-get-Acad-Object)) '("UT*")) (DeletObjLays (vla-get-ActiveDocument (vlax-get-Acad-Object)) '("*A-ARE*" "*A-DIM*" "*A-NOT*" "*A-PAT*" "*A-SYM*")) (princ))(princ)
(setq ss (ssget (list (cons 8 "A-ARE*,A-DIM*,A-NOT*,A-PAT*,A-SHT*,A-SYM*") (cons 2 "UT*"))))