Insertion point??

Discussion in 'AutoCAD' started by blairmack, Mar 4, 2005.

  1. blairmack

    blairmack Guest

    I'm stuck with this simple part of my code but for the life of me I cant get my head working.
    I want to be able to insert a block and have it's position ghosted on screen until the insertion point picked. This works fine, but I also want to be able to reset the scale to another value if <enter> returned. I can reset the scale fine myself but I cant get out of the insert command by hitting enter when prompted. How do I do this?
    Any help would be appreciated.

    (setq sf 1)
    (setq ip nil)
    (command "-insert" blk "s" sf)
    (princ "insertion point?? or <enter> to change scale")
    (command pause "0")
    (setq ip (getvar "lastpoint"))
     
    blairmack, Mar 4, 2005
    #1
  2. blairmack

    OLD-CADaver Guest

    Collect all the data prior to executing the (command
     
    OLD-CADaver, Mar 4, 2005
    #2
  3. blairmack

    blairmack Guest

    That's not realy waht I want to achieve. I really want to see the block being inserted ghosted on screen while asking for the insertion point. It's just a rectangle but if you can see that the extents of the rectangle are not big enough or are too big then I want to be able to hit enter and go back to the part of the code that sets the scale prior to picking the insertion point.
    It would be easier to use say
    (setq p1 (getpoint "\nPick insertion point or hit <enter> to reset scale: "))
    and then say if (= p1 nil)
    then return to scale setting code.
    The problem with this is that when you use the getpoint command you cease to see my block ghosted on screen during the insert command.

    Hope someone has some ideas.
     
    blairmack, Mar 5, 2005
    #3
  4. blairmack

    ECCAD Guest

    Blair,
    This is close. You can tune it from here.

    (defun sb ( blk / x flag ); scale block, pass in blockname
    (if (not sf)(setq sf 1.0)); default scale
    (setq oattdia (getvar "attdia"))
    (setq oattreq (getvar "attreq"))
    ;; Loop
    (setq flag nil); loop exit flag
    (While (not flag)
    (setq ip nil)
    (setvar "attdia" 0); force no attribute dialog
    (setvar "attreq" 0); and no attributes required
    (command "-insert" blk "s" sf)
    (command pause "0")
    (command "erase" "l" ""); just drag, insert, see size..
    ;;
    (setvar "attdia" 1); force attribute dialog
    (setvar "attreq" 1); and attributes required
    ;;
    (initget "Exit Rescale Last")
    (setq x (getpoint "\nInsertion point [Last/Rescale/Exit] <pick>"))
    (cond
    ( (= (type x) 'STR)
    (if (= x "Rescale")
    (setq sf (getreal "\nNew Scale Factor:"))
    ); if
    (if (= x "Exit")
    (setq Flag 1)
    ); if
    (if (= x "Last")
    (progn
    (command "-insert" blk "s" sf (getvar "lastpoint") "0")
    (setq Flag 1)
    ); progn
    ); if
    )
    ( (= (type x) 'LIST); Picked a point
    (command "-insert" blk "s" sf x "0")
    (setq ip (getvar "lastpoint"))
    (setq Flag 1)
    )
    ); cond
    ); while
    (if oattreq (setvar "attreq" oattreq))
    (if oattdia (setvar "attdia" oattdia))
    ); function
    ;;
    (sb blk); call above

    Bob
     
    ECCAD, Mar 6, 2005
    #4
  5. Maybe I'm missing something here, but how about just typing S instead of
    hitting Enter to give it a different scale? You can do that as many times
    as you want until you actually pick an insertion point.
     
    Kent Cooper, AIA, Mar 7, 2005
    #5
  6. Why not just insert it normally and if necessary use the scale command which will visually let you adjust it to suit.

    Jesse
     
    Jesse_Pickrum, Mar 7, 2005
    #6
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.