Double Click Attribute reactor

Discussion in 'AutoCAD' started by Mark Douglas, Mar 20, 2005.

  1. Mark Douglas

    Mark Douglas Guest

    Im trying to write a double click reactor and have read through all the
    posts here dealing with reactors and cant figure out how to get my code to
    fire AFTER the users has double clicked a attribute, filled the attribute
    information in then I want my code to fire.

    I can only get it to run before the attribute dialog box is opened.

    Thanks for any help!!!
     
    Mark Douglas, Mar 20, 2005
    #1
  2. Mark Douglas

    Gary Fowler Guest

    Try the following, it will do what you want....do a search to get the code.

    ;;;
    ;;; 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.
    ;;;
     
    Gary Fowler, Mar 21, 2005
    #2
  3. Mark Douglas

    Mark Douglas Guest

    I did a search and could not find it. I also did a search in google and had
    no luck. I did find another post that someone said to check this same topic
    you said but couldnt find it. You know the date?

    Thanks again for the help!!!

    Mark
     
    Mark Douglas, Mar 21, 2005
    #3
  4. Mark Douglas

    Gary Fowler Guest

    I cannot remember, where I got it.

    ;;;
    ;;; 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" "_.EATTEDIT")
    (cons "ACDBMTEXT" "_.DDEDIT")
    (cons "ACDBTEXT" "_.DDEDIT")
    (cons "ACDBROTATEDDIMENSION" "_.DIM-ALL")
    (cons "ACDBALIGNEDDIMENSION" "_.DIM-ALL")
    (cons "ACDBORDINATEDIMENSION" "_.DIM-ALL")
    (cons "ACDBDIAMETRICDIMENSION" "_.DIM-ALL")
    (cons "ACDBRADIALDIMENSION" "_.DIM-ALL")
    (cons "ACDB2LINEANGULARDIMENSION" "_.DIM-ALL")
    (cons "ACDBLEADER" "_.LISO")
    (cons "ACDBMLINE" "_.MLEDIT")
    (cons "ACDBPOLYLINE" "_.LISO")
    (cons "ACDBLINE" "_.LISO")
    (cons "ACDBCIRCLE" "_.LISO")
    (cons "ACDBSPLINE" "_.LISO")
    (cons "ACDBPOINT" "_.LISO")
    (cons "ACDBATTRIBUTEDEFINITION" "_.DDEDIT")
    (cons "ACDBHATCH" "_.HATCHEDIT")
    (cons "ACDBRASTERIMAGE" "_.IMAGEADJUST")
    ;;; architectural desktop commands
    (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))

    (jb:LoadDoublClickReactor)
     
    Gary Fowler, Mar 21, 2005
    #4
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.