Edit dimension linear whit double click

Discussion in 'AutoCAD' started by Ghyslain Baril, Jan 8, 2004.

  1. Hi all,

    When I'm double click on standart text, edit dialog box appear. But when I
    double click on linear dimension or another dimension, properties dialog box
    appear. It is possible when I click on dimension, have the edit box not the
    properties box.

    Thanks a lot
     
    Ghyslain Baril, Jan 8, 2004
    #1
  2. Ghyslain Baril

    C Witt Guest

    not to my knowlage. Though it would be very nice.
     
    C Witt, Jan 8, 2004
    #2
  3. Ghyslain Baril

    James Buzbee Guest

    I wrote my own mouse reactor to give me the ability to fire any command over
    any object. Here's some stuff to get you started.
    ;;;Construct the callback function
    (defun jb:beginDoubleClick (reactorObject Listofsomething /
    point parent child obj-type obj-list
    cmd refedit 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 point Listofsomething
    parent (car (cadddr (nentselp (trans (car point) 0 1))))
    child (car (nentselp (trans (car point) 0 1)))
    gripset (cadr (ssgetfirst))
    doc (vlax-get (vlax-get-acad-object) "activedocument"))
    ;;;
    (if child
    (progn (if (not parent)
    (setq parent child))
    (setq parent (vlax-get (vlax-ename->vla-object parent) "objectname")
    child (vlax-get (vlax-ename->vla-object child) "objectname"))
    (if (= (strcase parent) "ACDBBLOCKREFERENCE")
    (setq obj-type "ACDBBLOCKREFERENCE")
    (setq obj-type (strcase child)))
    ;;; Added refedit check for swiching mspsace to pspsace 03.04.2003
    ;;; Limitation: can't refedit from paperspace in a viewport!!!!
    (if (not (and (= obj-type "ACDBBLOCKREFERENCE")
    (= (vlax-invoke doc "getvariable" "tilemode") 0)
    (> (vlax-invoke doc "getvariable" "cvport") 1)))
    (progn (setq fulllist ; This is where you change the command
    (list (cons "ACDBBLOCKREFERENCE"
    "_.refedit (princ (cdr (nentselp (trans(car point)0 1)))) ")
    (cons "ACDBATTRIBUTE"
    "_.attedit (princ (car (nentselp (trans(car point)0 1)))) ")
    (cons "ACDBMTEXT" "_.DDEDIT ")
    (cons "ACDBTEXT" "_.DDEDIT ")
    (cons "ACDBMLINE" "_.MLINEEDIT ")
    (cons "ACDBATTRIBUTEDEFINITION" "_.DDEDIT ")
    (cons "ACDBHATCH" "_.HATCHEDIT ")))
    (foreach
    x fulllist
    (if (= obj-type (car x))
    (setq cmd (cdr x))))
    ; if an object type isn't defined used properties
    (if (not cmd)
    (setq cmd "_.properties "))
    ;;; make adjustment to command
    ;;; Added multiple select 12.15.2002
    (cond ((and gripset (> (sslength gripset) 1))
    ; more than one entity gripped
    (vla-sendcommand doc "_.properties "))
    ((and gripset (= (sslength gripset) 1))
    ; probably multiple attributes in a block
    (vla-sendcommand doc cmd))
    (t (vla-sendcommand doc cmd))))))))))

    ;;;Construct the reactor
    (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 My Expanded Double Click editing!
    (if (member "acdblclkedit.arx" (arx))
    (arxunload "acdblclkedit.arx" nil)
    )
    (princ)
    )

    jb
     
    James Buzbee, Jan 9, 2004
    #3
  4. Oh James!
    ------------
    It's cool!
    I've never tryed to do such a thing but I really wanted to do...
    ....because I make only my first steps on the Planet of Reactors...

    But I was so lucky to understand your code & so cheeky
    to make some modifications! Sorry! : )

    I did it:
    1. to slightly change its behaviour for Dimensions and Blocks:
    a. to ALWAYS call for DDEDIT for Dimensions (so user didn't have
    to hit the DimText!)
    b. to call REFEDIT for Blocks with no Attributes
    c. to ALWAYS call ATTEDIT for Blocks with Attributes
    (so user didn't have to hit the Attribute!)
    2. to Close OPM if it is on the screen already

    My question: is there no method to get rid of this LISP info in the
    command line indeed

    "_.attedit (princ (car (nentselp (trans (car point) 0 1)))) "

    ???

    If there was such a way this code works more like AutoCAD
    native commands:

    Command: _.eattedit 143.600225,133.829305,0.000000

    ???


    ;;; ========================================================
    ;;;
    ;;;Construct the callback function
    ;;;
    ;;; ========================================================
    (defun jb:beginDoubleClick ( reactorObject Listofsomething
    /
    point
    parentEn ; - New
    parent
    childEn ; - New
    child
    parentHasAttr ; - New
    obj-type obj-list
    cmd refedit gripset
    jbEditPoint ; - New
    )

    ;;; 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))
    ) ; - 'vl-catch-all-error-p'
    (princ "PaperSpace")
    (progn
    (setq
    point Listofsomething
    parentEn (car (cadddr (nentselp (trans (car point) 0 1))))
    childEn (car (nentselp (trans (car point) 0 1)))
    gripset (cadr (ssgetfirst))
    doc (vlax-get (vlax-get-acad-object) "activedocument")
    ) ; - 'setq'
    ;;;
    (if childEn
    (progn
    (if (not parentEn)
    (setq parentEn childEn)
    ) ; - 'if'
    (setq
    parent (vlax-get (vlax-ename->vla-object parentEn) "objectname")
    child (vlax-get (vlax-ename->vla-object childEn) "objectname")
    ) ; - 'setq'
    ;; +++++++++++++++++++++++++++ Source +++++++++++++++++++++++++++
    ; (if (= (strcase parent) "ACDBBLOCKREFERENCE")
    ; (setq obj-type "ACDBBLOCKREFERENCE")
    ; (setq obj-type (strcase child))
    ; ) ; - 'if'
    ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    ;; +++++++++++++++++++++++++++++ NEW ++++++++++++++++++++++++++++
    (if (= (strcase parent) "ACDBBLOCKREFERENCE")
    (progn
    (setq parentHasAttr (vlax-get (vlax-ename->vla-object parentEn)
    HasAttributes"))
    (if (= parentHasAttr 0)
    (setq obj-type "ACDBBLOCKREFERENCE")
    (setq obj-type (strcase "ACDBATTRIBUTE"))
    ) ; - 'if'
    ) ; - 'progn'
    (setq obj-type (strcase parent))
    ) ; - 'if'
    ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    ;;; Added refedit check for swiching mspsace to pspsace 03.04.2003
    ;;; Limitation: can't refedit from paperspace in a viewport!!!!
    (if
    (not
    (and (= obj-type "ACDBBLOCKREFERENCE")
    (= (vlax-invoke doc "getvariable" "tilemode") 0)
    (> (vlax-invoke doc "getvariable" "cvport") 1)
    ) ; - 'and'
    ) ; - 'not'
    ;;; This is where you change the command:
    (progn
    (setq jbEditPoint (cdr (nentselp (trans (car point) 0 1))))
    (setq fulllist
    (list
    (cons
    "ACDBBLOCKREFERENCE"
    ;; Source
    ;; "_.refedit (princ (cdr (nentselp (trans (car point) 0 1)))) "
    ;; New
    "_.refedit (princ jbEditPoint) "
    )
    (cons
    "ACDBATTRIBUTE"
    ;; Source
    ;; "_.attedit (princ (car (nentselp (trans (car point) 0 1)))) "
    ;; New
    "_.attedit (princ jbEditPoint) "
    )
    (cons "ACDBMTEXT" "_.DDEDIT ")
    (cons "ACDBTEXT" "_.DDEDIT ")
    (cons "ACDBMLINE" "_.MLINEEDIT ")
    (cons "ACDBATTRIBUTEDEFINITION" "_.DDEDIT ")
    (cons "ACDBHATCH" "_.HATCHEDIT ")
    ;; New
    (cons "ACDB*DIMENSION" "_.DDEDIT ")
    (cons "ACDBFCF" "_.DDEDIT ") ; - for 'TOLERACNE'
    ) ; - 'list'
    ) ; - 'setq fullist'
    (foreach x fulllist
    ;; Source
    ; (if (= obj-type (car x))
    ;; New
    (if (wcmatch obj-type (car x))
    (setq cmd (cdr x))
    ) ; - 'if'
    ) ; - 'foreach'
    ;;; if an object type isn't defined used Properties
    (if (not cmd)
    ;;
    ;; Source
    ;; (vla-sendcommand doc "_.properties ")
    ;; New
    ;;
    ;;; ------------------------------------------------------------------------
    ;;;
    ;;; Run or Hide Properties!
    ;;;
    ;;; ------------------------------------------------------------------------
    (if (= (vlax-invoke doc "getvariable" "opmstate") 0)
    (setq cmd "_.properties ")
    (setq cmd "_.propertiesclose ")
    ) ; - 'if'
    ;;; ------------------------------------------------------------------------
    ) ; - 'if'
    ;;; make adjustment to command
    ;;; Added multiple select 12.15.2002
    (cond
    ((and gripset (> (sslength gripset) 1))
    ;;; more than one entity gripped
    ;;
    ;; Source
    ;; (vla-sendcommand doc "_.properties ")
    ;; New
    ;;
    ;;; ------------------------------------------------------------------------
    ;;;
    ;;; Run or Hide Properties!
    ;;;
    ;;; ------------------------------------------------------------------------
    (if (= (vlax-invoke doc "getvariable" "opmstate") 0)
    (vla-sendcommand doc "_.properties ")
    (vla-sendcommand doc "_.propertiesclose ")
    ) ; - 'if'
    ;;; ------------------------------------------------------------------------
    )
    ((and gripset (= (sslength gripset) 1))
    ;;; probably multiple attributes in a block
    (vla-sendcommand doc cmd)
    )
    (t (vla-sendcommand doc cmd))
    ) ; - 'cond'
    )
    )
    )
    )
    ) ; - 'progn'
    ) ; - 'if'
    ;;
    ;; New
    ;;
    ;; *****************************************************************
    (if (vlax-object-released-p doc) (vlax-release-object doc))
    ;; *****************************************************************
    (princ)
    ) ; - 'defun jb:beginDoubleClick'
    ;;; ========================================================



    ;;; ========================================================
    ;;
    ;; Why do not add? ;)
    ;;
    (vl-load-com)

    ;;;Construct the reactor
    (defun jb:LoadDoublClickReactor (/)
    (if (/= (type jbDoubleClickReactor) 'VLR-Mouse-Reactor)
    (setq jbDoubleClickReactor
    (VLR-Mouse-Reactor
    nil
    '(:)VLR-beginDoubleClick . jb:beginDoubleClick))
    ) ; - 'VLR-Mouse-Reactor'
    ) ; - 'setq'
    ) ; - 'if'

    (if (not (vlr-added-p jbDoubleClickReactor))
    (vlr-add jbDoubleClickReactor)
    ) ; - 'if'

    ;;; Unload acdblclkedit.arx in favor of My Expanded Double Click editing!
    (if (member "acdblclkedit.arx" (arx))
    (arxunload "acdblclkedit.arx" nil)
    ) ; - 'if'
    (princ)
    ) ; - 'jb:LoadDoublClickReactor'
    ;;; ========================================================
     
    Alexander V. Koshman, Jan 10, 2004
    #4
  5. And maybe use (command "_dblclkedit" "_off") then (ArxUnload ...) ???
     
    Alexander V. Koshman, Jan 10, 2004
    #5
  6. Ghyslain Baril

    James Buzbee Guest

    Alexander,

    I'm glad you found this useful! Change it all you want - and if you make it
    better remember to post and share with everyone else.
    You know when I was writting this a while ago, that was the way I got it to
    work so I never went back and tried anything different. If you find a
    better way - let me know. I'd be interested in any changes / improvements.

    jb
     
    James Buzbee, Jan 12, 2004
    #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.