Block's Effective name conflicts with *U

This widget could not be displayed.

Block's Effective name conflicts with *U

Anonymous
Not applicable

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!!!!Smiley Happy

0 Likes
Reply
Accepted solutions (1)
2,306 Views
10 Replies
Replies (10)

hmsilva
Mentor
Mentor

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

EESignature

0 Likes

Anonymous
Not applicable

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)
)

 

0 Likes

hmsilva
Mentor
Mentor

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

EESignature

0 Likes

Anonymous
Not applicable

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:

 

0 Likes

hmsilva
Mentor
Mentor

Did you change the block names and the directory to load the attout.lsp?

 

Henrique

 

 

EESignature

0 Likes

Anonymous
Not applicable
Yes i did. it just simply jumps and no message when I press enter
0 Likes

hmsilva
Mentor
Mentor
Accepted solution

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

EESignature

0 Likes

Anonymous
Not applicable

Your code worked perfect!!!!!Smiley Very Happy

 

Thanks Henrique!!!!!!!!!!

0 Likes

hmsilva
Mentor
Mentor
You're welcome, JCprog
Glad I could help

Henrique

EESignature

0 Likes

Anonymous
Not applicable

unable to explode or edit block its name is *E

0 Likes