Bring block defenition into drawing without being displayed.

Discussion in 'AutoCAD' started by Sage Cowsert, Apr 7, 2005.

  1. Sage Cowsert

    Sage Cowsert Guest

    I need block PCSACO2a in my drawing so I can use it as a custom arrowhead.
    Right now I have my routine check to see if it exists and if it doesn't
    insert then delete it. Is there a better way? I'd rather not see it flash on
    the screen for a second but my method seems to work. I'm always looking for
    a better mouse trap. Any ideas?


    (if (= (tblsearch "block" "PCSAC02a") NIL)
    (progn
    (command "_.insert" "PCSAC02a.dwg" (getvar "viewctr") 1 1 0)
    (command "_.erase" (entlast) "")
    )
    )
     
    Sage Cowsert, Apr 7, 2005
    #1
  2. You can cancel the Insert once it has brought in the definition, which it
    does as soon as you give it the name, so as to be able to drag it to an
    insertion point. There's no need to even get as far as giving it an
    insertion point, much less the scales and rotation. If you don't even want
    to see it appear at your cursor location momentarily for dragging into
    place, you can turn dragmode off, call up Insert, give it the name, cancel,
    then reset dragmode.

    And by the way, you don't need to check whether it's in the drawing already.
    That would only matter if it was in there, but with the wrong definition,
    and you wanted to update the definition from the external drawing. But in
    that case you'd want a routine that would anticipate the question of whether
    you want to replace it, and provide the Yes answer. If that's not the
    situation, plain old inserting (or starting to, anyway) will do just fine,
    whether it's already in there or not.
     
    Kent Cooper, AIA, Apr 7, 2005
    #2
  3. Sage Cowsert

    Jeff Mishler Guest

    (if (not (tblsearch "block" "PCSAC02a") )
    (progn
    (command "_.insert" "PCSAC02a.dwg");gets the block def in the drawing
    (command);cancels the insert command
    )
    )
     
    Jeff Mishler, Apr 7, 2005
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.