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

Editing Anonymous Blocks

10 REPLIES 10
Reply
Message 1 of 11
m_rogoff
1714 Views, 10 Replies

Editing Anonymous Blocks

I have a DWG (attached) with anonymous blocks. The names are "U1", "U2", etc. I cannot go into block editor without specifying the name. The text inside the block had the color manually changed. I want to change the color (or layer) of the text inside the block. The actual drawing I need to edit has 100's of these ****ing things. 

How can I change them quickly and uniformly? Thanks for your help!

10 REPLIES 10
Message 2 of 11
braudpat
in reply to: m_rogoff

 

Hello from France

 

This routine UNANON does the job but one block by one block !

http://www.draftsperson.net/index.php?title=Anonymous_Blocks_in_AutoCAD

 

Sorry I have not a multiple block routine !?

If you find one, I am ready to use it !

 

 

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 3 of 11
pbejse
in reply to: m_rogoff


@m_rogoff wrote:

I have a DWG (attached) with anonymous blocks. The names are "U1", "U2", etc. I cannot go into block editor without specifying the name. The text inside the block had the color manually changed. I want to change the color (or layer) of the text inside the block. The actual drawing I need to edit has 100's of these ****ing things. 

How can I change them quickly and uniformly? Thanks for your help!


(defun tolayer (lay)
  (if (tblsearch "layer" lay)
    (vlax-for b	(vla-get-blocks
		  (vla-get-activedocument (vlax-get-acad-object))
		)
      (if (and (eq (vla-get-ObjectName b) "AcDbBlockTableRecord")
	       (wcmatch (Vla-get-name b) "`*U*")
	  )
	(vlax-for o b
	  (if (and (vlax-write-enabled-p o)
		   (eq (vla-get-objectname o) "AcDbMText")
	      )
	    (progn
	      (vla-put-layer o lay)
	      (vla-put-color o acByLayer)
	    )
	  )
	)
      )
    )
    (princ "\n<<Layer Does not Exist>>")
  )
  (vla-regen (vla-get-activedocument (vlax-get-acad-object))
	     acActiveViewport
  )
  (princ)
)
(vl-load-com) (princ)

 HTH

Message 4 of 11
3wood
in reply to: m_rogoff

SETBYLAYER command?

Message 5 of 11
~Opie
in reply to: braudpat

It looks like that UNANON routine has an additional routine to process all of the anonymous blocks. Try UNANONALL.
Message 6 of 11
braudpat
in reply to: ~Opie

 

Hello

 

I am a STUPID boy because I have not seen the UNANONALL command

which immediately "convert" the 7 *U blocks of the OP to 7 named blocks (TEMP1-TEMP7) !!

 

I have always use this routine for ONE Block !?

 

Congratulations and Kudos for you !

 

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 7 of 11
~Opie
in reply to: braudpat

Pat,
With some drawings, that must have been painful. Good luck with your new knowledge. 😉

And thanks.
Message 8 of 11
braudpat
in reply to: ~Opie

 

Hello from France

 

YES I know that we have to be very careful with some anonymous Blocks !

 

Thks

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 9 of 11
MRogoff
in reply to: 3wood

SETBYLAYER is the easiest, and gets the results I am looking for. 

Thanks all for your input

Message 10 of 11
MRogoff
in reply to: pbejse

pbejse, where do I specify the layer in your routine? Thanks

Message 11 of 11
Shneuph
in reply to: MRogoff

run it like this.

 

Command: (tolayer "Layername")

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)

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

Post to forums  

Autodesk Design & Make Report

”Boost