Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

toggle drawing units

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Cinimod89
838 Views, 4 Replies

toggle drawing units

 

 

 

Is there a way of opening existing cmds in the visual lisp editor and edit them to do something else? I'd like to set up a lisp where 'uu' would switch the drawing units from decimal to architectural units and hittng 'uu' again would switch it back.

4 REPLIES 4
Message 2 of 5
_Tharwat
in reply to: Cinimod89

Try this routine but you need to hit F2 after running the code .

 

(defun c:uu nil
  (if *decimal*
    (progn
      (command "_.-units" "2" "" "" "" "" "")
      (setq *decimal* nil)
    )
    (progn
      (command "_.-units" "4" "" "" "" "" "")
      (setq *decimal* t)
    )
  )
  (princ)
)

 

Message 3 of 5
Lee_Mac
in reply to: Cinimod89

Another:

 

(defun c:uu nil
    (setvar 'lunits (- 6 (getvar 'lunits)))
    (princ)
)

 

Assumes units are already set to either Decimal or Architectural.

 

Lee

Message 4 of 5
dgorsman
in reply to: Cinimod89

To add to the other comments:  I'd suggest naming the function something more descriptive so it won't clash with something else.  You can always map "UU" to the command in the PGP file, which is much easier to edit than LISP files.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 5 of 5
stevor
in reply to: Cinimod89

And Lee's can also be: ; toggle LUnits of 2 or 4 (defun c:TU ( ) (princ " Toggle LUnits: ") (setvar 'lunits (if (= (getvar 'lunits) 2) 4 2)) (princ (if (= (getvar 'lunits) 2) "Decimal." "Arch.") ) (princ) ) The command name is almost as quick; or any name used if put into the menu/CUI. And as a lisp, it is easy to change.
S

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost