Double Click Reacting

Discussion in 'AutoCAD' started by Phil Kenewell, Feb 12, 2004.

  1. Forgive me if I'm wrong, but I thought AutoCAD 2004 already had this
    double-click ability built in?
     
    Phil Kenewell, Feb 12, 2004
    #1
  2. Phil Kenewell

    Doug Broad Guest

    It does if you want to use its command choices. Otherwise
    James has shown a way to choose your own commands for
    double click by object type.
     
    Doug Broad, Feb 12, 2004
    #2
  3. Phil Kenewell

    James Buzbee Guest

    There have been some post recently on changing the way AutoCAD's double
    clicking works. This is what I've done: the following is a simple lisp
    that constructs a mouse reactor and allows the user to pick which command
    fires over which object. I think I've got most objects, including most
    ADT/AEC objects. Just edit the "command-list" variable for the command you
    want to fire. Take note that attributes and inserts require a little
    special handling. I hope this helps - it sure has increased my efficiency!
    As always - check for word wrap!

    ;;;
    ;;; James Buzbee's Double Click Reactor
    ;;;

    (vl-load-com)

    ;;; 2000i 2002 and 2004
    ;;; This is the main callback function where you'll define
    ;;; what command is fired over what object - see the command list
    ;;; If multiple objects are gripped and the command does not support
    ;;; multiple editing you will be prompted for an entity to edit.
    ;;;

    (defun jb:beginDoubleClick (reactorObject Listofsomething / point obj owner
    ownerobj command-list cmd gripset)
    ;;; added for error in 2004 - point returned from outside a
    ;;; paperspace viewport throws an error.
    (if (vl-catch-all-error-p
    (vl-catch-all-apply 'trans (list (car Listofsomething) 0 1)))
    (princ "PaperSpace")
    (progn
    (setq cmd "_.PROPERTIES" ; command default
    point Listofsomething
    obj (car (nentselp (trans (car point) 0 1)))
    owner (car (cadddr (nentselp (trans (car point) 0 1))))
    gripset (cadr (ssgetfirst))
    doc (vlax-get (vlax-get-acad-object) "activedocument"))

    (if obj
    (progn
    ; this statement will determine if the object
    ; clicked over is an insert or not
    (cond (owner
    (setq ownerobj (strcase (vlax-get (vlax-ename->vla-object owner)
    "objectname"))))
    (t (setq ownerobj (strcase (vlax-get (vlax-ename->vla-object obj)
    "objectname"))))
    )

    ;Now set up your commands for the appropriate object
    ; Object Command
    ;(cons "ACDBBLOCKREFERENCE" "_.REFEDIT ")
    (setq command-list
    (list (cons "ACDBBLOCKREFERENCE" "_.REFEDIT")
    (cons "ACDBATTRIBUTE" "_.ATTEDIT")
    (cons "ACDBMTEXT" "_.DDEDIT")
    (cons "ACDBTEXT" "_.DDEDIT")
    (cons "ACDBROTATEDDIMENSION" "_.DDEDIT")
    (cons "ACDBALIGNEDDIMENSION" "_.DDEDIT")
    (cons "ACDBORDINATEDIMENSION" "_.DDEDIT")
    (cons "ACDBDIAMETRICDIMENSION" "_.DDEDIT")
    (cons "ACDBRADIALDIMENSION" "_.DDEDIT")
    (cons "ACDB2LINEANGULARDIMENSION" "_.DDEDIT")
    (cons "ACDBMLINE" "_.MLEDIT")
    (cons "ACDBATTRIBUTEDEFINITION" "_.DDEDIT")
    (cons "ACDBHATCH" "_.HATCHEDIT")
    (cons "ACDBRASTERIMAGE" "_.IMAGEADJUST")
    (cons "AECDBWALL" "_.PROPERTIES")
    (cons "AECDBDOOR" "_.PROPERTYDATAEDIT")
    (cons "AECDBWINDOW" "_.PROPERTIES")
    (cons "AECDBWINDOWASSEMBLY" "_.PROPERTIES")
    (cons "AECDBCURTAINWALLLAYOUT" "_.PROPERTIES")
    (cons "AECDBSPACE" "_.PROPERTYDATAEDIT")
    (cons "AECDBSTAIR" "_.PROPERTIES")
    (cons "AECDBRAILING" "_.PROPERTIES")
    (cons "AECDBMVBLOCKREF" "_.PROPERTIES")
    (cons "AECDBOPENING" "_.PROPERTIES")
    (cons "AECDBCEILINGGRID" "_.PROPERTIES")
    (cons "AECDBCOLUMNGRID" "_.PROPERTIES")
    (cons "AECDBSLAB" "_.PROPERTIES")
    (cons "AECSDBMEMBER" "_.PROPERTIES")
    (cons "AECDBMASSELEM" "_.PROPERTIES")
    (cons "AECDBROOF" "_.PROPERTIES")
    (cons "AECDBROOFSLAB" "_.PROPERTIES")
    (cons "AECDBCAMERA" "_.PROPERTIES")
    (cons "AECDBSCHEDULETABLE" "_.PROPERTIES")))

    ;;; get the command
    (foreach x command-list
    (if (= (car x) ownerobj)
    (setq cmd(cdr x))))

    ;;; make adjustment to command
    (cond
    ((= cmd "_.REFEDIT")
    (setq cmd "_.refedit (princ (cdr (nentselp (trans(car point)0 1)))) "))
    ((= cmd "_.ATTEDIT")
    (setq cmd "_.attedit (princ obj) "))
    ((= cmd "_.EATTEDIT")
    (setq
    cmd "_.eattedit (princ obj) "))
    (t (setq cmd(strcat cmd " ")))
    )
    (vla-sendcommand doc cmd)
    )))))

    ;;;
    (defun jb:LoadDoublClickReactor (/)
    (if (/= (type jbDoubleClickReactor) 'VLR-Mouse-Reactor)
    (setq jbDoubleClickReactor
    (VLR-Mouse-Reactor
    nil
    '(:)VLR-beginDoubleClick . jb:beginDoubleClick))) ;_ end of
    vlr-editor-reactor
    ))
    (if (not (vlr-added-p jbDoubleClickReactor))
    (vlr-add jbDoubleClickReactor))
    ;;; Unload acdblclkedit.arx in favor of jb's Expanded Double Click editing!
    (if (member "acdblclkedit.arx" (arx))
    (arxunload "acdblclkedit.arx" nil))
    (princ))



    (progn (jb:LoadDoublClickReactor) (princ))
     
    James Buzbee, Feb 12, 2004
    #3
  4. I get this... can you fix it...

    ....
    ; error: too few arguments in SETQ: (SETQ JBDOUBLECLICKREACTOR
    (VLR-Mouse-Reactor nil ( ... )) VLR-Editor-Reactor)
    ..
     
    aaron weissner, Feb 12, 2004
    #4
  5. Phil Kenewell

    Jeff Mishler Guest

    Word wrap gotcha!

    Near the end of the routine, the text "vlr-editor-reactor" is on one
    line and should be a part of the line above it, like this: ";_ end of
    vlr-editor-reactor"

    Jeff
     
    Jeff Mishler, Feb 12, 2004
    #5
  6. that is good stuff...


     
    aaron weissner, Feb 13, 2004
    #6
  7. Phil Kenewell

    Mark Ingram Guest

    Wow. Very Nice, thank you.

    Mark

     
    Mark Ingram, Feb 13, 2004
    #7
  8. Very Nice!
     
    Phil Kenewell, Feb 13, 2004
    #8
  9. Phil Kenewell

    James Buzbee Guest

    Your welcome - I'm glad to share what I've learned.

    jb
     
    James Buzbee, Feb 17, 2004
    #9
  10. Phil Kenewell

    BTO Guest

    thanks James, many things to do with your post

    sincerely,

    Bruno Toniutti
     
    BTO, Feb 24, 2004
    #10
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.