?? acad.mnl
字號:
;;; ACAD.MNL
;;; Copyright (C) 1992 - 1997 by Autodesk, Inc.
;;;
;;; Permission to use, copy, modify, and distribute this software
;;; for any purpose and without fee is hereby granted, provided
;;; that the above copyright notice appears in all copies and
;;; that both that copyright notice and the limited warranty and
;;; restricted rights notice below appear in all supporting
;;; documentation.
;;;
;;; AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
;;; AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
;;; MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
;;; DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
;;; UNINTERRUPTED OR ERROR FREE.
;;;
;;; Use, duplication, or disclosure by the U.S. Government is subject to
;;; restrictions set forth in FAR 52.227-19 (Commercial Computer
;;; Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
;;; (Rights in Technical Data and Computer Software), as applicable.
;;;
;;; AutoLISP routines used by the AutoCAD Standard Menu.
;;;
;;; This file is loaded automatically following the menu ACAD.
(princ "\nAutoCAD menu utilities ")
;;;=== Icon Menu Functions ===
;;; View -> Layout -> Tiled Viewports...
(defun ai_tiledvp_chk (new)
(setq m:err *error* *error* *merrmsg*)
(if (= (getvar "TILEMODE") 0)
(progn
(princ "\n** Command not allowed in a Layout **")
(princ)
)
(progn
(if new
(menucmd "I=ACAD.IMAGE_VPORTI")
(menucmd "I=IMAGE_VPORTI")
)
(menucmd "I=*")
)
)
(setq *error* m:err m:err nil)
(princ)
)
(defun ai_tiledvp (num ori / ai_tiles_g ai_tiles_cmde)
(setq m:err *error* *error* *merrmsg*
ai_tiles_cmde (getvar "CMDECHO")
ai_tiles_g (getvar "GRIDMODE")
)
(ai_undo_push)
(setvar "CMDECHO" 0)
(setvar "GRIDMODE" 0)
(cond ((= num 1)
(command "_.VPORTS" "_SI")
(setvar "GRIDMODE" ai_tiles_g)
)
((< num 4)
(command "_.VPORTS" "_SI")
(command "_.VPORTS" num ori)
(setvar "GRIDMODE" ai_tiles_g)
)
((= ori nil)
(command "_.VPORTS" "_SI")
(command "_.VPORTS" num)
(setvar "GRIDMODE" ai_tiles_g)
)
((= ori "_L")
(command "_.VPORTS" "_SI")
(command "_.VPORTS" "2" "")
(setvar "CVPORT" (car (cadr (vports))))
(command "_.VPORTS" "2" "")
(command "_.VPORTS" "_J" "" (car (cadr (vports))))
(setvar "CVPORT" (car (cadr (vports))))
(command "_.VPORTS" "3" "_H")
(setvar "GRIDMODE" ai_tiles_g)
(setvar "CVPORT" (car (cadddr (vports))))
(setvar "GRIDMODE" ai_tiles_g)
(setvar "CVPORT" (car (cadddr (vports))))
(setvar "GRIDMODE" ai_tiles_g)
(setvar "CVPORT" (car (cadddr (vports))))
(setvar "GRIDMODE" ai_tiles_g)
)
(T
(command "_.VPORTS" "_SI")
(command "_.VPORTS" "2" "")
(command "_.VPORTS" "2" "")
(setvar "CVPORT" (car (caddr (vports))))
(command "_.VPORTS" "_J" "" (car (caddr (vports))))
(setvar "CVPORT" (car (cadr (vports))))
(command "_.VPORTS" "3" "_H")
(setvar "GRIDMODE" ai_tiles_g)
(setvar "CVPORT" (car (cadddr (vports))))
(setvar "GRIDMODE" ai_tiles_g)
(setvar "CVPORT" (car (cadddr (vports))))
(setvar "GRIDMODE" ai_tiles_g)
(setvar "CVPORT" (car (cadddr (vports))))
(setvar "GRIDMODE" ai_tiles_g)
)
)
(ai_undo_pop)
(setq *error* m:err m:err nil)
(setvar "CMDECHO" ai_tiles_cmde)
(princ)
)
;;;=== General Utility Functions ===
;;; ai_popmenucfg -- retrieve parameter from cfg settings
;;; <param> is a string specifiying the parameter
(defun ai_popmenucfg (param)
(set (read param) (getcfg (strcat "CfgData/Menu/" param)))
)
;;; ai_putmenucfg -- store parameter in cfg settings
;;; <param> is a string specifiying the parameter
;;; <cfgval> is the value for that parameter
(defun ai_putmenucfg (param cfgval)
(setcfg (strcat "CfgData/Menu/" param) cfgval)
)
(defun *merr* (msg)
(ai_sysvar nil) ;; reset system variables
(setq *error* m:err m:err nil)
(princ)
)
(defun *merrmsg* (msg)
(princ msg)
(setq *error* m:err m:err nil)
(princ)
)
(defun ai_showedge_alert ()
(alert "Invisible edges will be shown after next Regeneration.")
(princ)
)
(defun ai_hideedge_alert ()
(alert "Invisible edges will be HIDDEN after next Regeneration.")
(princ)
)
(defun ai_viewports_alert ()
(princ "** Command not allowed in Model Tab **")
(setq *error* m:err m:err nil)
(princ)
)
(defun ai_refedit_alert ()
(princ "\n** Command not allowed unless a reference is checked out with REFEDIT command **")
(setq *error* m:err m:err nil)
(princ)
)
;;; --- ai_sysvar ------------------------------------------
;;; Change system variable settings and save current settings
;;; (Note: used by *merr* to restore system settings on error.)
;;;
;;; The <vars> argument is used to...
;;; restore previous settings (ai_sysvar NIL)
;;; set a single sys'var (ai_sysvar '("cmdecho" . 0))
;;; set multiple sys'vars (ai_sysvar '(("cmdecho" . 0)("gridmode" . 0)))
;;;
;;; defun-q is needed by Visual Lisp for functions which redefine themselves.
;;; it is aliased to defun for seamless use with AutoLISP.
(defun-q ai_sysvar (vars / savevar pair varname varvalue varlist)
(setq varlist nil) ;; place holder for varlist
(defun savevar (varname varvalue / pair)
(cond
;; if new value is NIL, save current setting
((not varvalue)
(setq varlist
(cons
(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
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -