Inserting a block, and then rotating it!

Discussion in 'AutoCAD' started by Brent Daley, Oct 11, 2004.

  1. Brent Daley

    Brent Daley Guest

    Looking for the code to put in a button. I have the blocks made, and I
    basically have a toolbar with a button for each seperate block. Basically
    what I want to happen is when the user clicks on the button it will
    automatically insert that block into the drawing...and the first prompt the
    user gets will be for base point, then when they pick that, then the next
    prompt will be for rotation based on the base point that they inserted the
    block at. I hope that I explained that well?

    Thanks!

    --
    Brent Daley
    CAD Manager
    RD Engineering, Inc.
    11920 Burt Street, Suite 180
    Omaha, NE 68154

    Phone: 402.505.4355
    Cell: 402.981.3713
    Fax: 402.505.4432
    Email:
     
    Brent Daley, Oct 11, 2004
    #1
  2. Brent Daley

    Jim Claypool Guest

    ^C^C-insert;"blockname";\;;\
     
    Jim Claypool, Oct 11, 2004
    #2
  3. Brent Daley

    Servo Guest

    I THINK this is what your asking for--->
    -insert <block name> S 1 \ \;
    it inserts the block and a scale factor of 1 (you may or may not want it
    to do that), asks for an insertion point, waits for rotation, then exits
    the routine

    --
    Servo
    "Long live the New Flesh!"
    tservo100 at
    ameritech dot net
    Slow, fiery death to all spammers!!!
     
    Servo, Oct 11, 2004
    #3
  4. Brent Daley

    Rick Keller Guest

    Yoy can try this....

    ^C^C(command "-insert" "BLOCK NAME" pause "" "" pause)

    If you want to scale it up by the dimscale try this....

    ^C^C(command "-insert" "BLOCK NAME" "scale" (getvar "dimscale") pause pause)


    Rick
     
    Rick Keller, Oct 12, 2004
    #4
  5. Brent Daley

    Brent Daley Guest

    I'm having a problem with the "BLOCK NAME" part, I've specified a path in
    there to the block...is that wrong? Do the blocks need to be preloaded or
    something for it to find the name?

    Thanks!

    --
    Brent Daley
    CAD Manager
    RD Engineering, Inc.
    11920 Burt Street, Suite 180
    Omaha, NE 68154

    Phone: 402.505.4355
    Cell: 402.981.3713
    Fax: 402.505.4432
    Email:
     
    Brent Daley, Oct 12, 2004
    #5
  6. If they're in preloaded, or in the same folder, or on a file search path in
    Options, you shouldn't need the path in there. If not, you can put the path
    in, but make sure you're using FORWARD slashes where you would ordinarily
    use backslashes in a file path (a quirk of using paths inside lisp
    expressions).
     
    Kent Cooper, AIA, Oct 12, 2004
    #6
  7. Brent Daley

    Rick Keller Guest

    *^C^Cclayer;LAYERNAME;(command "-insert"
    "//G12/Support/blocks/steel/2-bolt-left" pause "" "" pause)

    Note the forward slashes in the path.
    Also the clayer;LAYERNAME; portion will set the layer to the layer you want
    the block on.
    and the * at the begining of the line will repeat the menu line to insert
    the block over and over until you Esc.

    Rick
     
    Rick Keller, Oct 12, 2004
    #7
  8. Brent Daley

    Jimmy D Guest

    I think this routine will do the job (it does for me):

    (defun c:MOVEROTATE ()
    (setq OPTION "NNN")
    (while (/= OPTION nil)
    (initget "Move Rotate")
    (setq OPTION (getkword "\nMake Selection : Move/Rotate/(ENTER for nothing) :"))
    (setq LASTP (getvar "lastpoint"))
    (setq ss (entlast))
    (if (= OPTION "Move")(command "move" ss "" LASTP pause))
    (if (= OPTION "Rotate")(command "rotate" ss "" LASTP pause))
    )
    )
     
    Jimmy D, Oct 14, 2004
    #8
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.