grread & grread

Discussion in 'AutoCAD' started by mmm, Mar 15, 2005.

  1. mmm

    mmm Guest

    a quibble about inserting blocks from my users has me at a loss - and it
    relates to acad's handling of dragmode, commands and graphics.

    I want the user to have a selection of options for insetrting blocks.

    so say I do this:
    (while loopy
    (initget 'whatever')
    (setq pt1 (getpoint "\nChoose a point or \do this\do that\ <eXit> :"))
    (command ".insert" "blockname" "scale" myscale pt1) (prompt "\nRotation
    Angle :")(command pause)
    (cond
    ((whatever....


    );;; end loopy


    now this prevents the user from seeing the object in the first phase (no
    dragmode of object while in getpoint)

    I could loop with all in the command - then the user gets to see all, but
    has no option except to esc when they are finished

    lastly i could introduce a (getkword) to ask if the user wants to do
    something else - which means an extra key press on every block insertion.

    i could set up grread and grdarw to dragmode the block, and with some fancy
    footwork (which I haven;t worked out yet) have the options of dragmode with
    the block, and have it check for keypresses that offer options.

    this sounds like alot of work, but as this will replace 20 block insert
    routines with one master, i kind of want to get it as good as possible.

    Any comments? pitfalls? should I take the (getkword) easy way out?
    should the user esx out of the routine and access the options another way?

    Thanks
     
    mmm, Mar 15, 2005
    #1
  2. I use something like this to return the insert point:

    ;;f:get_insert shows a ghosted block to return an insertion point

    (defun f:get_insert_point (bn / lst ret)

    (cond
    ((not (tblsearch "BLOCK" bn)) nil)
    (T
    (setq lst (f:cmd (list "_.insert" bn pause)))
    (f:cancel)
    (if (not (member nil lst))
    (setq ret (getvar "LASTPOINT"))
    )
    );else
    );cond
    ret
    )
    - essentially, cancel the command after the point input then return use the "LASTPOINT" variable. This won't allow for an initget override as with getpoint. One option to look into might be the acet-ss-drag-move function from the express tools acetutil.arx - this returns a point from a dragged/ghosted selection set and allows for initget settings.

    Peter

    ;;f:cmd sends a list of strings as a command and suppresses cmdecho

    (defun f:cmd (lst / ret ce)
    (setq ce (getvar "CMDECHO"))
    (setvar "CMDECHO" 0)
    (setq ret (mapcar 'vl-cmdf lst))
    (setvar "CMDECHO" ce)
    ret
    )

    ;;(f:cancel): cancel command

    (defun f:cancel ( / ce)
    (setq ce (getvar "CMDECHO"))
    (setvar "CMDECHO" 0)
    (vl-cmdf)
    (setvar "CMDECHO" ce)
    )
     
    petersciganek, Mar 15, 2005
    #2
  3. mmm

    mmm Guest

    I had forgotten about those - very interesting.

    Thanks!

    --
    Princess Jamie,

    Life shrinks or expands in proportion to one's courage.
    - Anais Nin

    | I use something like this to return the insert point:
    |
    | ;;f:get_insert shows a ghosted block to return an insertion point
    |
    | (defun f:get_insert_point (bn / lst ret)
    |
    | (cond
    | ((not (tblsearch "BLOCK" bn)) nil)
    | (T
    | (setq lst (f:cmd (list "_.insert" bn pause)))
    | (f:cancel)
    | (if (not (member nil lst))
    | (setq ret (getvar "LASTPOINT"))
    | )
    | );else
    | );cond
    | ret
    | )
    | - essentially, cancel the command after the point input then return use
    the "LASTPOINT" variable. This won't allow for an initget override as with
    getpoint. One option to look into might be the acet-ss-drag-move function
    from the express tools acetutil.arx - this returns a point from a
    dragged/ghosted selection set and allows for initget settings.
    |
    | Peter
    |
    | ;;f:cmd sends a list of strings as a command and suppresses cmdecho
    |
    | (defun f:cmd (lst / ret ce)
    | (setq ce (getvar "CMDECHO"))
    | (setvar "CMDECHO" 0)
    | (setq ret (mapcar 'vl-cmdf lst))
    | (setvar "CMDECHO" ce)
    | ret
    | )
    |
    | ;;(f:cancel): cancel command
    |
    | (defun f:cancel ( / ce)
    | (setq ce (getvar "CMDECHO"))
    | (setvar "CMDECHO" 0)
    | (vl-cmdf)
    | (setvar "CMDECHO" ce)
    | )
     
    mmm, Mar 15, 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.