Author Topic: Double click editing on / off ...  (Read 5448 times)

0 Members and 1 Guest are viewing this topic.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Double click editing on / off ...
« on: January 09, 2006, 11:49:09 AM »
... I had a user this morning have want for the ability to turn on / off double click editing; this is what I wrote for him.

Code: [Select]
(defun c:DblClkOn ( )

    (if
        (zerop
            (vl-registry-read
                (strcat
                    "HKEY_CURRENT_USER\\"
                    (vlax-product-key)
                    "\\profiles\\"
                    (vla-get-activeprofile
                        (vla-get-profiles
                            (vla-get-preferences
                                (vlax-get-acad-object)
                            )
                        )
                    )
                    "\\General"
                )
                "DoubleClickEdit"
            )
        )
        (command ".dblclkedit" "_on")
    )

    (if (zerop (getvar "pickfirst"))
        (setvar "pickfirst" 1)
    )

    (princ)

)

(defun c:DblClkOff ( )

    (if
        (eq 1
            (vl-registry-read
                (strcat
                    "HKEY_CURRENT_USER\\"
                    (vlax-product-key)
                    "\\profiles\\"
                    (vla-get-activeprofile
                        (vla-get-profiles
                            (vla-get-preferences
                                (vlax-get-acad-object)
                            )
                        )
                    )
                    "\\General"
                )
                "DoubleClickEdit"
            )
        )
        (command ".dblclkedit" "_off")
    )

    (princ)

)

Cheers.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

whdjr

  • Guest
Re: Double click editing on / off ...
« Reply #1 on: January 09, 2006, 12:12:11 PM »
Just out of curiosity could you set this up like a boolean operation, if it's on turn it off and vice versa.  I've seen similar functions with with system variables.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Double click editing on / off ...
« Reply #2 on: January 09, 2006, 12:35:54 PM »
Just out of curiosity could you set this up like a boolean operation, if it's on turn it off and vice versa. I've seen similar functions with with system variables.

As you wish ...

Code: [Select]
(defun c:DblClk ( )

    (cond
        (   (zerop
                (vl-registry-read
                    (strcat
                        "HKEY_CURRENT_USER\\"
                        (vlax-product-key)
                        "\\profiles\\"
                        (vla-get-activeprofile
                            (vla-get-profiles
                                (vla-get-preferences
                                    (vlax-get-acad-object)
                                )
                            )
                        )
                        "\\General"
                    )
                    "DoubleClickEdit"
                )
            )
            (command ".dblclkedit" "_on")
            (if (zerop (getvar "pickfirst"))
                (setvar "pickfirst" 1)
            )
        )
        ((command ".dblclkedit" "_off"))
    )

    (princ)

)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

whdjr

  • Guest
Re: Double click editing on / off ...
« Reply #3 on: January 09, 2006, 12:53:11 PM »
Now doesn't that just look cleaner?   :-)

LE

  • Guest
Re: Double click editing on / off ...
« Reply #4 on: January 09, 2006, 12:55:32 PM »
? why not just use the built in command.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Double click editing on / off ...
« Reply #5 on: January 09, 2006, 01:07:02 PM »
? why not just use the built in command.

Because said command does not automatically force pickfirst to 1; a dumb oversite on Autodesk's part if you ask me.

Ok, so you didn't ask me. Oh well.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

LE

  • Guest
Re: Double click editing on / off ...
« Reply #6 on: January 09, 2006, 01:18:00 PM »
It makes sense now...

GDF

  • Water Moccasin
  • Posts: 2081
Re: Double click editing on / off ...
« Reply #7 on: January 09, 2006, 02:54:20 PM »
Works for 2006 also.

Code: [Select]

;;;
;;; 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))

Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64