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

Long Block Names - Global Edit??

5 REPLIES 5
Reply
Message 1 of 6
mdent
158 Views, 5 Replies

Long Block Names - Global Edit??

In r2002 is there a command to rename multiple blocks at the same time to a shorter common name? What about Layers?

I have a file with over 200 blocks with names exceeding 31 characters. Some stations in our office are still on r14, and these files cannot be attached as xrefs due to the long names. Since the actual names are not critical to what we do, I wanted to rename them all the with a single command so files like this can be used by other operators on r14.
5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: mdent

Ask over in Customization discussion area.

--
Dean Saadallah
http://www.pendean.com
LT Express Utilities
http://www.pendean.com/ltexpress
Expanded Links Pages
http://www.pendean.com/lt/links.htm
--
Message 3 of 6
Anonymous
in reply to: mdent

You might try this for block names, just wrote this and briefly tested it.
Try this in a temporary file before using it on a working drawing.

;; Purpose: Shorten block names longer than 31 characters

(defun C:ShrinkName (/ Prefix n i Data Name)
(while (= "" (setq Prefix (getstring "\nspecify name prefix: "))))
(setq n 0 i 0)
(while (setq Data (tblnext "block" (null Data)))
(setq Name (cdr (assoc 2 Data)))
(if (> (strlen Name) 31)
(progn
(while (tblsearch "block" (setq New (strcat Prefix (itoa n))))
(setq n (1+ n))
)
(command ".rename" "block" Name New)
(setq i (1+ i))
)
)
)
(princ (strcat "\n" (itoa i) " blocks have been renamed"))
(princ)
)

I suppose not only block and layer names could be a problem but textstyles,
dimstyles, saved view, etc..... also.
--

-Jason
Member of the Autodesk Discussion Forum Moderator Program


"mdent" wrote in message
news:f13b61b.-1@WebX.maYIadrTaRb...
> In r2002 is there a command to rename multiple blocks at the same time to
a shorter common name? What about Layers?
> I have a file with over 200 blocks with names exceeding 31 characters.
Some stations in our office are still on r14, and these files cannot be
attached as xrefs due to the long names. Since the actual names are not
critical to what we do, I wanted to rename them all the with a single
command so files like this can be used by other operators on r14.
>
>
Message 4 of 6
Anonymous
in reply to: mdent

grrr.... forgot to localize the "new" variable...

(/ Prefix n i Data Name New)

--

-Jason
Member of the Autodesk Discussion Forum Moderator Program


"Jason Piercey" wrote in message
news:092D34F4CBC12D46B86DD2AF1EC1906A@in.WebX.maYIadrTaRb...
> You might try this for block names, just wrote this and briefly tested it.
> Try this in a temporary file before using it on a working drawing.
>
> ;; Purpose: Shorten block names longer than 31 characters
>
> (defun C:ShrinkName (/ Prefix n i Data Name)
> (while (= "" (setq Prefix (getstring "\nspecify name prefix: "))))
> (setq n 0 i 0)
> (while (setq Data (tblnext "block" (null Data)))
> (setq Name (cdr (assoc 2 Data)))
> (if (> (strlen Name) 31)
> (progn
> (while (tblsearch "block" (setq New (strcat Prefix (itoa n))))
> (setq n (1+ n))
> )
> (command ".rename" "block" Name New)
> (setq i (1+ i))
> )
> )
> )
> (princ (strcat "\n" (itoa i) " blocks have been renamed"))
> (princ)
> )
Message 5 of 6
Anonymous
in reply to: mdent

Scratch that first one, try this one. Should take care of *all*
possibilities. Just out of curiosity, would saving the file as R14
accomplish the same thing?

;; Jason Piercey - January 22nd, 2003
;; Purpose: Shorten any name found in any table that is
;; longer than 31 characters for use with R14.
;; Breifly tested!!, use at your own risk.
(defun C:ShrinkNames (/ Prefix c n i Data Name New)
(while (= "" (setq Prefix (getstring T "\nspecify name prefix: "))))
(setq c 0)
(foreach x '("block" "dimstyle" "layer" "ltype"
"style" "ucs" "view" "vport")
(setq n 0 i 0)
(while (setq Data (tblnext x (null Data)))
(setq Name (cdr (assoc 2 Data)))
(if (> (strlen Name) 31)
(progn
(while (tblsearch x (setq New (strcat Prefix (itoa n))))
(setq n (1+ n))
)
(command ".rename" x Name New)
(setq i (1+ i))
)
)
)
(setq c (+ i c))
)
(princ (strcat "\n" (itoa c) " entries have been renamed"))
(princ)
)

--

-Jason
Member of the Autodesk Discussion Forum Moderator Program


"mdent" wrote in message
news:f13b61b.-1@WebX.maYIadrTaRb...
> In r2002 is there a command to rename multiple blocks at the same time to
a shorter common name? What about Layers?
> I have a file with over 200 blocks with names exceeding 31 characters.
Some stations in our office are still on r14, and these files cannot be
attached as xrefs due to the long names. Since the actual names are not
critical to what we do, I wanted to rename them all the with a single
command so files like this can be used by other operators on r14.
>
>
Message 6 of 6
Anonymous
in reply to: mdent

Just curious... long because? were they Bound
xrefs?

If so... try this one

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
In
r2002 is there a command to rename multiple blocks at the same time to a
shorter common name? What about Layers?

I have a file with over 200 blocks with names exceeding 31 characters. Some
stations in our office are still on r14, and these files cannot be attached as
xrefs due to the long names. Since the actual names are not critical to what
we do, I wanted to rename them all the with a single command so files like
this can be used by other operators on r14.

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

Post to forums  

Autodesk Design & Make Report

”Boost