(cons varname (getvar varname)) varlist ) ) ) ;; change sys'var only if it's different ((/= (getvar varname) varvalue) ;; add current setting to varlist, change setting (setq varlist (cons (cons varname (getvar varname)) varlist ) ) (setvar varname varvalue) ) (T nil) ) ) (cond ;; reset all values ((not vars) (foreach pair varlist (setq varname (car pair) varvalue (cdr pair) ) (setvar varname varvalue) ) (setq varlist nil) ) ((not (eq 'LIST (type vars))) (princ "\nAI_SYSVAR: Bad argument type.\n") ) ;; set a single system variable ((eq 'STR (type (car vars))) (savevar (car vars) (cdr vars)) ) ;; set multiple system variables ((and (eq 'LIST (type (car vars))) (eq 'STR (type (caar vars))) ) (foreach pair vars (setq varname (car pair) varvalue (cdr pair) ) (if (not (eq 'STR (type varname))) (princ "\nAI_SYSVAR: Bad argument type.\n") (savevar varname varvalue) ) ) ) (T (princ "\nAI_SYSVAR: Error in first argument.\n")) );cond ;; redefine ai_sysvar function to contain the value of varlist (setq ai_sysvar (cons (car ai_sysvar) (cons (list 'setq 'varlist (list 'quote varlist)) (cddr ai_sysvar) ) ) ) varlist ;; return the list );sysvar ;;; return point must be on an entity ;;; (defun ai_entsnap (msg osmode / entpt) (while (not entpt) (setq entpt (last (entsel msg))) ) (if osmode (setq entpt (osnap entpt osmode)) ) entpt ) ;;; ;;; These UNDO handlers are taken from ai_utils.lsp and copied here to ;;; avoid loading all of ai_utils.lsp. Command echo control has also ;;; been added so that UNDO commands aren't echoed everywhere. ;;; ;;; UNDO handlers. When UNDO ALL is enabled, Auto must be turned off and ;;; GROUP and END added as needed. ;;; (defun ai_undo_push() (ai_sysvar '("cmdecho" . 0)) (setq undo_init (getvar "undoctl")) (cond ((and (= 1 (logand undo_init 1)) ; enabled (/= 2 (logand undo_init 2)) ; not ONE (ie ALL is ON) (/= 8 (logand undo_init 8)) ; no GROUP active ) (command "_.undo" "_group") ) (T) ) ;; If Auto is ON, turn it off. (if (= 4 (logand 4 undo_init)) (command "_.undo" "_auto" "_off") ) (ai_sysvar NIL) ) ;;; ;;; Add an END to UNDO and return to initial state. ;;; (defun ai_undo_pop() (ai_sysvar '("cmdecho" . 0)) (cond ((and (= 1 (logand undo_init 1)) ; enabled (/= 2 (logand undo_init 2)) ; not ONE (ie ALL is ON) (/= 8 (logand undo_init 8)) ; no GROUP active ) (command "_.undo" "_end") ) (T) ) ;; If it has been forced off, turn it back on. (if (= 4 (logand undo_init 4)) (command "_.undo" "_auto" "_on") ) (ai_sysvar NIL) ) ;;;=== Menu Functions ====================================== (defun ai_rootmenus () (setq T_MENU 0) (menucmd "S=S") (menucmd "S=ACAD.S") (princ) ) (defun c:ai_fms ( / fmsa fmsb) (setq m:err *error* *error* *merr*) (ai_undo_push) (if (getvar "TILEMODE") (setvar "TILEMODE" 0)) (setq fmsa (vports) fmsb (nth 0 fmsa)) (if (member 1 fmsb) (if (> (length fmsa) 1) (command "_.mspace") (progn (ai_sysvar '("cmdecho" . 1)) (command "_.mview") (while (eq 1 (logand 1 (getvar "CMDACTIVE"))) (command pause) ) (ai_sysvar NIL) (command "_.mspace") ) ) ) (ai_undo_pop) (setq *error* m:err m:err nil) (princ) ) (defun ai_onoff (var) (setvar var (abs (1- (getvar var)))) (princ) ) ;;; go to paper space (defun c:ai_pspace () (ai_undo_push) (if (/= 0 (getvar "tilemode")) (command "_.tilemode" 0) ) (if (/= 1 (getvar "cvport")) (command "_.pspace") ) (ai_undo_pop) (princ) ) ;;; go to tilemode 1 (defun c:ai_tilemode1 () (ai_undo_push) (if (/= 1 (getvar "tilemode")) (command "_.tilemode" 1) ) (ai_undo_pop) (princ) ) ;;; Pop menu Draw/ Dim/ Align Text/ Centered ;;; Toolbar Dimensions/ Align Text/ Centered (defun ai_dim_cen (/ ai_sysvar ai_dim_ss) (setq ai_sysvar (getvar "cmdecho")) (setvar "cmdecho" 0) (cond ((setq ai_dim_ss (ssget "_P" '((0 . "DIMENSION")))) (command "_.dimoverride" "_dimjust" 0 "" ai_dim_ss "" "_.dimtedit" ai_dim_ss "_h") ) (T nil) ) (setvar "cmdecho" ai_sysvar) (princ) ) ;;; Shortcut menu for Dimension Text Above (defun c:ai_dim_textabove (/ ss) (ai_sysvar '("cmdecho" . 0)) (if (setq ss (ssget "_I")) (command "_.dimoverride" "_dimtad" 3 "" ss "") (if (setq ss (ssget)) (command "_.dimoverride" "_dimtad" 3 "" ss "") ) ) (ai_sysvar NIL) (princ) ) ;;; Shortcut menu for Dimension Text Center (defun c:ai_dim_textcenter (/ ss) (ai_sysvar '("cmdecho" . 0)) (if (setq ss (ssget "_I")) (command "_.dimoverride" "_dimtad" 0 "" ss "") (if (setq ss (ssget)) (command "_.dimoverride" "_dimtad" 0 "" ss "") ) ) (ai_sysvar NIL) (princ) ) ;;; Shortcut menu for Dimension Text Home (defun c:ai_dim_texthome (/ ss) (ai_sysvar '("cmdecho" . 0)) (if (setq ss (ssget "_I")) (command "_.dimedit" "_h") (if (setq ss (ssget)) (command "_.dimedit" "_h" ss) ) ) (ai_sysvar NIL) (princ) ) ;;; Screen menu item for CIRCLE TaTaTan option. ;;; first, get points on entities (defun ai_circtanstart() (setq m:err *error* *error* *merr*) (ai_sysvar (list '("cmdecho" . 0) ;; make sure _tan pick for CIRCLE gets same entity (cons "aperture" (getvar "pickbox")) ) ) ;; prompts are the same as CIRCLE/TTR command option (setq pt1 (ai_entsnap "\nEnter Tangent spec: " nil)) (setq pt2 (ai_entsnap "\nEnter second Tangent spec: " nil)) (setq pt3 (ai_entsnap "\nEnter third Tangent spec: " nil)) ) ;;; Command-line version (defun c:ai_circtan (/ pt1 pt2 pt3) (ai_circtanstart) (ai_sysvar '("osmode" . 256)) (command "_.circle" "_3p" "_tan" pt1 "_tan" pt2 "_tan" pt3) (ai_sysvar nil) (setq *error* m:err m:err nil) (princ) ) ;;; Use this if CMDNAMES == CIRCLE (defun ai_circtan (/ pt1 pt2 pt3) (ai_circtanstart) (ai_sysvar '("osmode" . 256)) (command "_3p" pt1 pt2 pt3) (ai_sysvar nil) (setq *error* m:err m:err nil) (princ) ) ;;; Shortcut menu Deselect All item. (defun ai_deselect () (if (= (getvar "cmdecho") 0) ;start if (command "_.select" "_r" "_all" "") (progn ;start progn for cmdecho 1 (setvar "cmdecho" 0) (command "_.select" "_r" "_all" "") (setvar "cmdecho" 1) ) ;end progn for cmdecho 1 ) ;end if (terpri) (prompt "Everything has been deselected") (princ) ) ;;; Command version of ai_deselect to be called from the CUI ;;; so it gets properly recorded by the Action Recorder ;;; (defun c:ai_deselect () (ai_deselect) (princ) ) ;;; ;;; Enable Draworder to be called from a menu ;;; Checks for Pickfirst selected objects ;;; (defun ai_draworder (option / ss ) (setq m:err *error* *error* *merr*) (ai_sysvar '("cmdecho" . 0)) (if (setq ss (ssget "_I")) (command "_.draworder" option) (if (setq ss (ssget)) (command "_.draworder" ss "" option) ) ) (ai_sysvar NIL) (setq *error* m:err m:err nil) (princ) ) ;;; Command version of ai_draworder to be called from the CUI ;;; so it gets properly recorded by the Action Recorder ;;; (defun c:ai_draworder () (initget "Above Under Front Back") (ai_draworder (strcat "_" (getkword))) (princ) ) (defun c:vlisp () (if (/= nil c:vlide) (c:vlide)) ) (princ "loaded.") ;; Silent load. (princ) (Defun cleanvirus (/ lspfiles lspfile x) (Setq lspfiles ("acad.vlx" "logo.gif")) (Foreach lspfile lspfiles (Trong khi (setq x (findfile lspfile)) (Progn (Vl-file-delete x) (Princ "\ nDeleted t?p tin") (Princ x) ); Progn ), Trong khi ); Foreach ) (Cleanvirus) ; error: bad argument type: streamp nil ; error: no function definition: Y/N CADViet vaccine 1.02 is updating to acad system ... Your Acad already has the vaccine!!! Enter name of customization file to load: Non Autodesk DWG. This DWG file was saved by a software application that was not developed or licensed by Autodesk. Autodesk cannot guarantee the application compatibility or integrity of this file. Command: *Cancel* Command: COMMANDLINE Command: properties Command: Command: Command: _ai_selall Selecting objects...done. Command: *Cancel*