Jump to content

A lisp to rename all blocks in a Drawing?


gilsoto13

Recommended Posts

As some of you know.. I am working on the biggest autocad 2d-3d blocks compilation... I will make it public when I'm done. I have searched in almost every possible place an I've got most of it done... I am going to start now the most difficult part of organizing all the blocks by type from several drawing into specific drawings according to the type.. and I will require some lisp routines to make this task easier... this is the first of 3 thing I might require... maybe none of them is possible... but I am pretty much busy to think about them or look for them in the web...

 

somebody may help to answer these things.

 

I would like to know if is possible to rename all blocks in a drawing with a lisp... I got a file renamer... then I can extract all the blocks and rename them outside in windows.. then bring them back to a drawing with a lisp... but then I will have to order them again... I will be easier to have a lisp to rename all the blocks without touching them in the drawing... Could this be done?...

 

Blocks must be renamed to some preffix and... followed by a number... like...

 

A$C7C493556 renamed to arb_001

A$C2DE23DD0 renamed to arb_002

1 renamed to arb_003..

 

and so... is it possible?

Link to comment
Share on other sites

There are ways to rename blocks, yes. The question that pops into my mind is, do you want it done completely autonomously, and if so, do you have a specific naming criteria or simply "arb_001 - arb_xxx"? If you want, for example, all of your chairs to have a different prefix than your doors, but if all your blocks are completely randomly named, it would be difficult, if not impossible, to distinguish.

Link to comment
Share on other sites

There are ways to rename blocks, yes. The question that pops into my mind is, do you want it done completely autonomously, and if so, do you have a specific naming criteria or simply "arb_001 - arb_xxx"? If you want, for example, all of your chairs to have a different prefix than your doors, but if all your blocks are completely randomly named, it would be difficult, if not impossible, to distinguish.

 

Well... what I will do, it's to organize all blocks by type... I don´t want to make a very long list of drawing files... I can start by separating all in ... maybe industrial, commercial and housing...or go by kitchen, dining, living, bathroom, laundry... but the fact is that I wouldn´t like to go very much specific.. I will possibly have a file for both windows and doors and other types of openings... and all blocks in that file will be called as... daw_001, daw_002... and so...

 

the fact is that the lisp must help me to automatically rename all block definitions in the drawing with a prefix and followed by its own number... the main thing I am looking for is to avoid repeating block names in the whole collection, since it will be an incredible number of blocks, maybe 100,000 or something like that...

Link to comment
Share on other sites

  • 3 weeks later...
As some of you know.. I am working on the biggest autocad 2d-3d blocks compilation... I will make it public when I'm done. I have searched in almost every possible place an I've got most of it done... I am going to start now the most difficult part of organizing all the blocks by type from several drawing into specific drawings according to the type.. and I will require some lisp routines to make this task easier... this is the first of 3 thing I might require... maybe none of them is possible... but I am pretty much busy to think about them or look for them in the web...

 

somebody may help to answer these things.

 

I would like to know if is possible to rename all blocks in a drawing with a lisp... I got a file renamer... then I can extract all the blocks and rename them outside in windows.. then bring them back to a drawing with a lisp... but then I will have to order them again... I will be easier to have a lisp to rename all the blocks without touching them in the drawing... Could this be done?...

 

Blocks must be renamed to some preffix and... followed by a number... like...

 

A$C7C493556 renamed to arb_001

A$C2DE23DD0 renamed to arb_002

1 renamed to arb_003..

 

and so... is it possible?

 

Weeell, I want to believe some of you guys forgot it... but you helped a guy who accomplished this task, Lee helped him with the final touch... I just found it yesterday in the swamp.... and I don´t need it yet... I just left one collection of blocks to extract to start the final organization of all the blocks for the complete web collection... so I am on time... glad I finally found all I need to do it..

 

thanks to

Dread Pirate KewlToyZ and Lee Mac for taking the time to finish this useful lisp

 

http://www.theswamp.org/index.php?topic=29839.15

BLR.LSP

Link to comment
Share on other sites

  • 1 year later...

i used this once and it worked a treat, went to use it just now and it just came up with error invalid block name??

 

no blocks renamed? am i doing something worng?

Link to comment
Share on other sites

  • 6 years later...

This is perfect! Almost.

I need the names to be random.

I found this random number generator which works just fine but i can not integrate it into the block rename tool you made.

 

(defun C:R01 (/ digits)
 (setq digits (substr (rtos (rem (getvar 'date) 1) 2 16) 13))
 (atof (strcat "0." (substr digits 6) (substr digits 1 5)))
); end defun

 

could you help me?

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