Jump to content

Change layer attribute of text nested in multiple blocks


hosannabizarre

Recommended Posts

I greatly desire the following AutoCAD power: the ability to change the layer attribute of text nested in multiple blocks (of different names), using a lisp routine.

 

It is possible to change the colour attribute of text nested in multiple blocks (of different names) using ATColour.lsp, which goes like this:

 

;; NOTE: this was written for my personal use only...
;; I only guarentee that it takes up disk space !!
; ERROR MESSAGE ***********
(defun *error* (s)
 (if old_error (setq *error* old_error))
 (princ)
)
(defun None ( )
(command "")
)
(defun C:ATC (/ NewV OldV )
 (setq nmbr (strcase (getstring"\nEnter Number of Attributes to change: ")))
(setq nmbr (atoi nmbr))
(setq cntr 0)             ; repeat counter
(setq NewV (strcase (getstring "\nEnter New Attribute Colour: ")))
 (command "attedit" "" "" "" "" "w" pause pause "C" NewV "")
  (setq cntr (+ 1 cntr))
(while
(/= nmbr cntr)
(if (= nmbr cntr) (none))
(if (/= nmbr cntr) (command "C" NewV ""))
  (setq cntr (+ 1 cntr))
) ;while
(if (= nmbr cntr) (none) (EXIT))
(EXIT)
) ;defun

 

This is very efficient - you have to follow a few prompts. 1) You state the number of instances you want to update 2) You name the colour you want to apply 3) You drag out a selection, and nested text within that area will assume the colour attribute you specified.

 

Try it out - it works great.

 

If someone could help me work out a version of this routine to tackle the updating of the layer attribute, instead of the colour attribute, I would be profoundly grateful and impressed.

 

Here's hoping someone has the smarts to crack this one - I'm still a total newb at this stuff.

 

Thanks!!

Link to comment
Share on other sites

  • 2 years later...

Hi hosannabizarre,

 

Your lisp routine is very useful and saves me a great deal of time, for that I thank you.

 

I was wondering though, is there a way to select the colour as being bylayer rather than selecting a number value for it?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...