AutoCAD 2010/2011/2012

Reply
Active Contributor
Posts: 49
Registered: ‎06-28-2000
Message 1 of 11 (952 Views)
Accepted Solution

Invalid block name on -insert

952 Views, 10 Replies
10-11-2012 01:59 PM

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?

*Expert Elite*
pendean
Posts: 20,357
Registered: ‎11-06-2003
Message 2 of 11 (929 Views)

Re: Invalid block name on -insert

10-12-2012 05:48 AM in reply to: srestmeyer

Did you type it all out at the command line to test (instead of using something totally different like the pop-up)?

Testing is key. Seems to work fine here with my blocks/paths so you might be able to discover the problem manaully.

Dean Saadallah Blog | Facebook | Google+ | Twitter | PINS
**Master
Posts: 2,535
Registered: ‎05-13-2003
Message 3 of 11 (915 Views)

Re: Invalid block name on -insert

10-12-2012 10:09 AM in reply to: srestmeyer

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?

Active Contributor
Posts: 49
Registered: ‎06-28-2000
Message 4 of 11 (871 Views)

Re: Invalid block name on -insert

10-15-2012 06:22 AM in reply to: srestmeyer

@ 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

Active Contributor
Posts: 49
Registered: ‎06-28-2000
Message 5 of 11 (866 Views)

Re: Invalid block name on -insert

10-15-2012 07:22 AM in reply to: pendean

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

**Master
Posts: 2,535
Registered: ‎05-13-2003
Message 6 of 11 (859 Views)

Re: Invalid block name on -insert

10-15-2012 08:07 AM in reply to: srestmeyer

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)

Active Contributor
Posts: 49
Registered: ‎06-28-2000
Message 7 of 11 (857 Views)

Re: Invalid block name on -insert

10-15-2012 08:09 AM in reply to: dmfrazier

I understood what you said, and I tried it without success. I still got the invalid block name error message

**Master
Posts: 2,535
Registered: ‎05-13-2003
Message 8 of 11 (855 Views)

Re: Invalid block name on -insert

10-15-2012 08:11 AM in reply to: srestmeyer

Please post the exact line of code you are trying without success.

Active Contributor
Posts: 49
Registered: ‎06-28-2000
Message 9 of 11 (839 Views)

Re: Invalid block name on -insert

10-15-2012 08:50 AM in reply to: dmfrazier

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.

**Master
Posts: 2,535
Registered: ‎05-13-2003
Message 10 of 11 (833 Views)

Re: Invalid block name on -insert

10-15-2012 09:11 AM in reply to: srestmeyer

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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you interested in helping shape the Autodesk Community?
We’re looking at a few different ways to improve the “All Forums” landing page and need your feedback! If interested, please take a few minutes to fill out the following Usability Study. Thank you for your time!

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community




Connect with AutoCAD

Twitter

Facebook

Blogs

Pinterest

Youtube