• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    AutoCAD 2010/2011/2012 DWG Format

    Reply
    Active Contributor
    Posts: 44
    Registered: ‎06-28-2000
    Accepted Solution

    Invalid block name on -insert

    513 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?

    Please use plain text.
    *Expert Elite*
    pendean
    Posts: 14,959
    Registered: ‎11-06-2003

    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 | RSS | Twitter | PINS
    Please use plain text.
    Distinguished Mentor
    Posts: 1,566
    Registered: ‎05-13-2003

    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?

    Please use plain text.
    Active Contributor
    Posts: 44
    Registered: ‎06-28-2000

    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

    Please use plain text.
    Active Contributor
    Posts: 44
    Registered: ‎06-28-2000

    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

    Please use plain text.
    Distinguished Mentor
    Posts: 1,566
    Registered: ‎05-13-2003

    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)

    Please use plain text.
    Active Contributor
    Posts: 44
    Registered: ‎06-28-2000

    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

    Please use plain text.
    Distinguished Mentor
    Posts: 1,566
    Registered: ‎05-13-2003

    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.

    Please use plain text.
    Active Contributor
    Posts: 44
    Registered: ‎06-28-2000

    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.

    Please use plain text.
    Distinguished Mentor
    Posts: 1,566
    Registered: ‎05-13-2003

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

    Please use plain text.