AutoCAD 2010/2011/2012 DWG Format
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Invalid block name on -insert
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I have a small LiSP routine I wrote about 14 years ago that no longer works. It is supposed to update a logo on a title block using the -insert command with a redefine option and a cancel
(command "-insert" "K:\\FORMATS\\LAYOUTS\\GSILOGO.dwg" "y" ^c)
When I run the routine I get an error message "Invalide block name" and it cancels the command without updating.
Yet, if I insert the same block through the insert dialog box it allows the file to be inserted.
Any ideas?
Solved! Go to Solution.
Re: Invalid block name on -insert
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Re: Invalid block name on -insert
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
From Help on the -INSERT command:
Updating a Block Definition:If you make changes to a block file that is inserted in your drawing and you want to change the existing block definition without creating a new block insertion, enter the following at the Specify Insertion Point prompt (following the Enter Block Name prompt):
block name=
Does that help?
Re: Invalid block name on -insert
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
@ Dean:
Yes. That was the first thing I tried. When I type it at the command line, without quotes (K:\formats\layouts\gsilogo.dwg), it ignores the path and inserts the block that is already inserted in the drawing. When I type it with quotes ("K:\\formats\\layouts\\gsilogo.dwg") I get the invalid block error.
Thanks,
Scott
Re: Invalid block name on -insert
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Dean
I've attached a drawing that contains the block, and the block I want to replace it with. Perhaps you could test it on your end?
Thanks,
Scott
Re: Invalid block name on -insert
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I guess I wasn't specific enough. You have to indicate the block name you're replacing, followed by an "=" and the pathname\filename of the dwg you want to replace it with.
The LISP would be thus:
(command "-insert" "myblockname=mypath\\mydwgname" "y" ^c)
Re: Invalid block name on -insert
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I understood what you said, and I tried it without success. I still got the invalid block name error message
Re: Invalid block name on -insert
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Please post the exact line of code you are trying without success.
Re: Invalid block name on -insert
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
When I enter the following line at the command prompt it finds the correct block but doesn't ask if I want to redefine.
block name=k:\formats\layouts\gsilogo.dwg
When I enter the following line at the command prompt
block name=k:\formats\layouts\gsilogo.dwg =
I get the following error:
---------------------------
AutoCAD Message
---------------------------
"gsilogo.dwg =.dwg"
Can't find file in search path:
C:\Documents and Settings\srestmeyer\My Documents\ (current directory)
C:\LispTest\
C:\Documents and Settings\srestmeyer\application data\autodesk\autocad mechanical 2010\r18.0\enu\support\
C:\program files\autodesk\acadm 2010\support\
C:\program files\autodesk\acadm 2010\fonts\
C:\program files\autodesk\acadm 2010\help\
C:\program files\autodesk\acadm 2010\express\
C:\program files\autodesk\acadm 2010\support\color\
C:\program files\autodesk\acadm 2010\custom\
K:\formats\
K:\tcfonts\
C:\Program Files\Autodesk\ACADM 2010\drv\
C:\Program Files\Autodesk\ACADM 2010\
The search list is my search path setting.
Re: Invalid block name on -insert
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I didn't see the exact line of code you have been trying in your last post, but here's the line of LISP code I think you would want to use:
(command "-insert" "gsilogo=k:\\formats\\layouts\\gsilogo" "y" ^c)
(When I tested it with your sample files it worked just fine.)
To the left of the "=" is the name of the block in the current drawing that you want to replace.
To the right of the "=" is the path and filename of the drawing you want to use to replace that block. (You must use \\ instead of \ inside AutoLISP.)
Notice that the entire string "blockname=path\\filename" is enclosed in quotes.
Also, you don't have to include the ".dwg" after the filename (but it's okay if you do).


