Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Block's Effective name conflicts with *U

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
Anonymous
2210 Views, 10 Replies

Block's Effective name conflicts with *U

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

10 REPLIES 10
Message 2 of 11
hmsilva
in reply to: Anonymous

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

Message 3 of 11
Anonymous
in reply to: hmsilva

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

 

Message 4 of 11
hmsilva
in reply to: Anonymous

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

Message 5 of 11
Anonymous
in reply to: hmsilva

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:

 

Message 6 of 11
hmsilva
in reply to: Anonymous

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

 

Henrique

 

 

EESignature

Message 7 of 11
Anonymous
in reply to: hmsilva

Yes i did. it just simply jumps and no message when I press enter
Message 8 of 11
hmsilva
in reply to: Anonymous

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

Message 9 of 11
Anonymous
in reply to: hmsilva

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

 

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

Message 10 of 11
hmsilva
in reply to: Anonymous

You're welcome, JCprog
Glad I could help

Henrique

EESignature

Message 11 of 11
Anonymous
in reply to: hmsilva

unable to explode or edit block its name is *E

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report