[Search tip detail and code files using keywords, tip number, author name, etc ]
    For tip to function correctly, you must ensure that the downloaded file name matches the file name
    displayed in the Rename File To field. Please rename downloaded files when necessary.
PasteBlock with New Name
Tip# 4366 By Kent Cooper On 14-Sep-2014
Rated By 0 users Downloaded : 738
Categories : Enforce Standards, Standard Blocks
Software type : AutoCAD 2015
Rename File To : PasteBlockWithName-2.lsp
Replace the built-in PasteBlock command with a version that enables renaming on the fly.

Editor's Note: This tip was updated in July 2015. The tip author explains that the new version uses the up-in-the-screen Text Editor, and Alerts for unacceptable inputs, rather than operating from the Command line.  

One of Kent Cooper's previous tips, "Rename a Pasted Block (#3751)", allows users to pick an existing block in an AutoCAD drawing and rename it. Although it should work for any block, it was primarily created to allow for easy renaming of blocks that are pasted into a drawing.

What if you could intercept the action of pasting in a block and rename it on the fly? That is what this routine does. If you ensure it is loaded at startup by something like acaddoc.lsp, you can all but eliminate the wacky, random, automatically created block names like A$CFG5D32S.

If you want to test this before adding it to your startup code, manually load the LISP file, then copy some drawing entities to the clipboard using the CopyClip or CopyBase command. Next use the PasteBlock command (this routine replaces the built-in PasteBlock command), and it will prompt you for a file name. If you enter a block name already in use, it will ask you again until you enter an unused name. Great job, Kent.


Average Rating:

User comments