NoelStalker Posted November 11, 2008 Posted November 11, 2008 Hello everyone. I would like to have multiple commands within one function. I am having a hard time figuring it out. Here is the code I am working on. (defun c:UIRN () (command "ucsicon" "on" " " "or") (princ) ) other things I have tried (command "ucsicon" "on" "" "or") ) (command "ucsicon" "on" "ucsicon" "or") ) (command "ucsicon" "on" command "ucsicon" "or") ) Quote
Lee Mac Posted November 11, 2008 Posted November 11, 2008 Is this what you are trying to achieve? (defun c:uirn () (setvar "cmdecho" 0) (command "_ucsicon" "ON") (setvar "cmdecho" 1) (princ) ) or are you trying to create a toggle between something? If its a toggle you are after, maybe something like this: (defun c:uirn2 () (cond ((= (getvar "ucsicon") 3) (setvar "ucsicon" 2)) ((= (getvar "ucsicon") 2) (setvar "ucsicon" 3)) ) ; end cond (princ) ) ; end function Please clarify Noel Quote
lpseifert Posted November 11, 2008 Posted November 11, 2008 Maybe as simple as this (defun c:uirn () (setvar "ucsicon" 3) (princ) ) Quote
NoelStalker Posted November 12, 2008 Author Posted November 12, 2008 I am trying to create a lisp that turns the ucsicon on ("ucsicon" "on")and also puts the ucsicon to origin ("ucsicon" "or"). Sorry for the confusion. Thanks! Quote
lpseifert Posted November 12, 2008 Posted November 12, 2008 From Sysvdlg (Express tools System Variable Editor) Displays the UCS icon for the current viewport using bitcode. UCSICON is both a command and a system variable. It is the sum of the following: 0 No icon displayed 1 On; icon is displayed 2 Origin; if icon is displayed, the icon floats to the UCS origin if possible 3 On and displayed at origin. Quote
Lee Mac Posted November 12, 2008 Posted November 12, 2008 Using the information kindly provided by lpseifert, you could create a LISP as follows: (defun c:uirn () (setvar "ucsicon" 3) (princ) ) Or if you desire a toggle between ON (ORIGIN) and OFF: (defun c:uirn2 () (cond ((= (getvar "ucsicon") 3) (setvar "ucsicon" 0)) ((= (getvar "ucsicon") 0) (setvar "ucsicon" 3)) ) ; end cond (princ) ) ; end function Hope this helps FYI. If you prefer to use the "command" syntax in the LISP instead of changing the system variables: (defun c:uirn3 () (setvar "cmdecho" 0) (command "_ucsicon" "ON") (command "_ucsicon" "OR") (setvar "cmdecho" 1) (princ "\nUCS Icon Set to Origin.") (princ) ) Quote
NoelStalker Posted November 12, 2008 Author Posted November 12, 2008 Got it working now thanks to all of your input. Thanks so much for your help and enjoy your day. Here is the code that I am using ; UIN sets the ucs icon to on (defun c:UIN () (command "ucsicon" "on") (princ) ; exit cleanly ) ; end program ; UIR sets the ucs icon to origin (defun c:UIR () (command "ucsicon" "or") (princ) ; exit cleanly ) ; end program ; UIRN sets the ucs icon to on and to origin (defun c:uirn () (setvar "ucsicon" 3) (princ) ) ; UCSA sets the ucs icon to on and to origin and sets UCS to world (defun c:ucsa () (setvar "cmdecho" 0) (command "_ucsicon" "ON") (command "_ucsicon" "OR") (command "ucs" "world") (princ) ) Quote
Lee Mac Posted November 12, 2008 Posted November 12, 2008 Make sure you include (setvar "cmdecho" 1) In your ucsa code - otherwise you won't be prompted when running standard ACAD commands Quote
NoelStalker Posted November 24, 2008 Author Posted November 24, 2008 Thanks for the helpful tip Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.