Hello Everyone!
Need some help on a code. The code works to pick on specific blocks and attout data but when other dynamic blocks goes in the mix it grabs those data as well, coz if the dynamic blocks parameters changed ACAD names it as *UXXX. I know I need to get the effectivename and tried to insert it to the code but I cant make it work. Please help!!!!
Here's the code:
(defun c:out-att () (load "attout") (setq fna "C:\\folder1\\att.txt") (setq data nil bnames "blk01,blk02,blk03,`*U*" ss (ssget "_X" (list '(0 . "INSERT") '(66 . 1) (cons 2 bnames)) ) ) (repeat (setq i (sslength ss)) (setq e (vlax-ename->vla-object (ssname ss (setq i (1- i))))) (if (and (wcmatch (strcase (vla-get-effectivename e)) bnames) (bns_attout fna ss) )
Thanks in advance!!!!
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
Something like this perhaps
(defun c:out-att ( / bnames e fna i n o ss ss1) (load "attout") (setq fna "C:\\folder1\\att.txt" bnames "blk01,blk02,blk03,`*U*" ss1 (ssadd) ) (if (setq ss (ssget "_X" (list '(0 . "INSERT") '(66 . 1) (cons 2 bnames)))) (repeat (setq i (sslength ss)) (setq e (vlax-ename->vla-object (setq o (ssname ss (setq i (1- i)))))) (if (vlax-property-available-p e 'effectivename) (setq n (vla-get-effectivename e)) (setq n (vla-get-name e)) ) (if (wcmatch (strcase n) bnames) (ssadd o ss1) ) ) (if (/= (sslength ss1) 0) (bns_attout fna ss1) ) ) (princ) )
HTH
Henrique
Hello Henrique,
Thanks for the reply! The code still grabs all dblocks with *U. Here's the original code:
(defun c:out-att () (load "attout") (setq fna "C:\\folder1\\att.txt") (setq data nil bnames "blk01,blk02,blk03,`*U*" ss (ssget "_X" (list '(0 . "INSERT") '(66 . 1) (cons 2 bnames)) ) ) (bns_attout fna ss) )
Revised...
(defun c:out-att ( / bnames e fna i n o ss ss1) (load "attout") (setq fna "C:\\folder1\\att.txt" bnames "blk01,blk02,blk03" ss1 (ssadd) ) (if (setq ss (ssget "_X" (list (cons 0 "INSERT") (cons 2 (strcat bnames ",`*U*"))))) (repeat (setq i (sslength ss)) (setq e (vlax-ename->vla-object (setq o (ssname ss (setq i (1- i)))))) (if (vlax-property-available-p e 'effectivename) (setq n (vla-get-effectivename e)) (setq n (vla-get-name e)) ) (if (wcmatch (strcase n) bnames) (ssadd o ss1) ) ) (if (/= (sslength ss1) 0) (bns_attout fna ss1) ) ) (princ) )
HTH
Henrique
It's not doing anything. No error message either. Its not re-writing to its designated directory.
it just goes like this:
Command: OUT-ATT Command:
Sorry, my bad...
(defun c:out-att (/ bnames e fna i n o ss ss1) (load "attout") (setq fna "C:\\folder1\\att.txt" bnames "block1,block02,blk03" ss1 (ssadd) ) (if (setq ss (ssget "_X" (list (cons 0 "INSERT") (cons 2 (strcat "`*U*," bnames))) ) ) (progn (repeat (setq i (sslength ss)) (setq e (vlax-ename->vla-object (setq o (ssname ss (setq i (1- i)))))) (if (vlax-property-available-p e 'effectivename) (setq n (vla-get-effectivename e)) (setq n (vla-get-name e)) ) (if (wcmatch (strcase n) bnames) (ssadd o ss1) ) ) (if (/= (sslength ss1) 0) (bns_attout fna ss1) ) ) ) (princ) )
HTH
Henrique
Can't find what you're looking for? Ask the community or share your knowledge.