📄 acad2005doc.lsp
字号:
; (princ "Auto:(arxload ") (princ app) (princ ")") (terpri)
(arxload app)
)
(defun ai_ffile (app)
(or (findfile (strcat app ".lsp"))
(findfile (strcat app ".exp"))
(findfile (strcat app ".exe"))
(findfile (strcat app ".arx"))
(findfile app)
)
)
(defun ai_nofile (filename)
(princ
(strcat "\nThe file "
filename
"(.lsp/.exe/.arx) was not found in your search path folders."
)
)
(princ "\nCheck the installation of the support files and try again.")
(princ)
)
;;;===== AutoLoad LISP Applications =====
; Set help for those apps with a command line interface
(autoload "edge" '("edge"))
(setfunhelp "C:edge" "" "edge")
(autoload "3d" '("3d" "3d" "ai_box" "ai_pyramid" "ai_wedge" "ai_dome"
"ai_mesh" "ai_sphere" "ai_cone" "ai_torus" "ai_dish")
)
(setfunhelp "C:3d" "" "3d")
(setfunhelp "C:ai_box" "" "3d_box")
(setfunhelp "C:ai_pyramid" "" "3d_pyramid")
(setfunhelp "C:ai__wedge" "" "3d_wedge")
(setfunhelp "C:ai_dome" "" "3d_dome")
(setfunhelp "C:ai_mesh" "" "3d_mesh")
(setfunhelp "C:ai_sphere" "" "3d_sphere")
(setfunhelp "C:ai_cone" "" "3d_cone")
(setfunhelp "C:ai_torus" "" "3d_torus")
(setfunhelp "C:ai_dish" "" "3d_dish")
(autoload "3darray" '("3darray"))
(setfunhelp "C:3darray" "" "3darray")
(autoload "mvsetup" '("mvsetup"))
(setfunhelp "C:mvsetup" "" "mvsetup")
(autoload "attredef" '("attredef"))
(setfunhelp "C:attredef" "" "attredef")
(autoload "tutorial" '("tutdemo" "tutclear"
"tutdemo"
"tutclear"))
;;;===== AutoArxLoad Arx Applications =====
;;; ===== Double byte character handling functions =====
(defun is_lead_byte(code)
(setq asia_cd (getvar "dwgcodepage"))
(cond
( (or (= asia_cd "dos932")
(= asia_cd "ANSI_932")
)
(or (and (<= 129 code) (<= code 159))
(and (<= 224 code) (<= code 252))
)
)
( (or (= asia_cd "big5")
(= asia_cd "ANSI_950")
)
(and (<= 129 code) (<= code 254))
)
( (or (= asia_cd "gb2312")
(= asia_cd "ANSI_936")
)
(and (<= 161 code) (<= code 254))
)
( (or (= asia_cd "johab")
(= asia_cd "ANSI_1361")
)
(and (<= 132 code) (<= code 211))
)
( (or (= asia_cd "ksc5601")
(= asia_cd "ANSI_949")
)
(and (<= 129 code) (<= code 254))
)
)
)
;;; ====================================================
;;;
;;; FITSTR2LEN
;;;
;;; Truncates the given string to the given length.
;;; This function should be used to fit symbol table names, that
;;; may turn into \U+ sequences into a given size to be displayed
;;; inside a dialog box.
;;;
;;; Ex: the following string:
;;;
;;; "This is a long string that will not fit into a 32 character static text box."
;;;
;;; would display as a 32 character long string as follows:
;;;
;;; "This is a long...tatic text box."
;;;
(defun fitstr2len (str1 maxlen)
;;; initialize internals
(setq tmpstr str1)
(setq len (strlen tmpstr))
(if (> len maxlen)
(progn
(setq maxlen2 (/ maxlen 2))
(if (> maxlen (* maxlen2 2))
(setq maxlen2 (- maxlen2 1))
)
(if (is_lead_byte (substr tmpstr (- maxlen2 2) 1))
(setq tmpstr1 (substr tmpstr 1 (- maxlen2 3)))
(setq tmpstr1 (substr tmpstr 1 (- maxlen2 2)))
)
(if (is_lead_byte (substr tmpstr (- len (- maxlen2 1)) 1))
(setq tmpstr2 (substr tmpstr (- len (- maxlen2 3))))
(setq tmpstr2 (substr tmpstr (- len (- maxlen2 2))))
)
(setq str2 (strcat tmpstr1 "..." tmpstr2))
) ;;; progn
(setq str2 (strcat tmpstr))
) ;;; if
) ;;; defun
;;;
;;; If the first object in a selection set has an attached URL
;;; Then launch browser and point to the URL.
;;; Called by the Grips Cursor Menu
;;;
(defun C:gotourl ( / ssurl url i)
(setq m:err *error* *error* *merrmsg* i 0)
; if some objects are not already pickfirst selected,
; then allow objects to be selected
(if (not (setq ssurl (ssget "_I")))
(setq ssurl (ssget))
)
; if geturl LISP command not found then load arx application
(if (/= (type geturl) 'EXRXSUBR)
(arxload "achlnkui")
)
; Search list for first object with an URL
(while (and (= url nil) (< i (sslength ssurl)))
(setq url (geturl (ssname ssurl i))
i (1+ i))
)
; If an URL has be found, open browser and point to URL
(if (= url nil)
(alert "No Universal Resource Locator associated with the object.")
(command "_.browser" url)
)
(setq *error* m:err m:err nil)
(princ)
)
;; Used by the import dialog to silently load a 3ds file
(defun import3ds (filename / filedia_old render)
;; Load Render if not loaded
(setq render (findfile "acRender.arx"))
(if render
(verify_arxapp_loaded render)
(quit)
)
;; Save current filedia & cmdecho setting.
(setq filedia-save (getvar "FILEDIA"))
(setq cmdecho-save (getvar "CMDECHO"))
(setvar "FILEDIA" 0)
(setvar "CMDECHO" 0)
;; Call 3DSIN and pass in filename.
(c:3dsin 1 filename)
;; Reset filedia & cmdecho
(setvar "FILEDIA" filedia-save)
(setvar "CMDECHO" cmdecho-save)
(princ)
)
;;;----------------------------------------------------------------------------
; New "Select All" function. Cannot be called transparently.
(defun c:ai_selall ( / ss old_error a b old_cmd old_hlt)
(setq a "CMDECHO" b "HIGHLIGHT"
old_cmd (getvar a) old_hlt (getvar b)
old_error *error* *error* ai_error)
(if (ai_notrans)
(progn
(princ "Selecting objects...")
(setvar a 0)
(setvar b 0)
(command "_.SELECT" "_ALL" "") ; Create Previous SS
(setvar a old_cmd)
(setvar b old_hlt)
(setq ss (ssget "_P"))
(sssetfirst ss ss) ; Non-gripped, but selected (someday!)
(princ "done.\n")
)
)
(setq *error* old_error old_error nil ss nil)
(princ)
)
;;;
;;; Routines that check CMDACTIVE and post an alert if the calling routine
;;; should not be called in the current CMDACTIVE state. The calling
;;; routine calls (ai_trans) if it can be called transparently or
;;; (ai_notrans) if it cannot.
;;;
;;; 1 - Ordinary command active.
;;; 2 - Ordinary and transparent command active.
;;; 4 - Script file active.
;;; 8 - Dialogue box active.
;;;
(defun ai_trans ()
(if (zerop (logand (getvar "cmdactive") (+ 2 8) ))
T
(progn
(alert "This command may not be invoked transparently.")
nil
)
)
)
(defun ai_transd ()
(if (zerop (logand (getvar "cmdactive") (+ 2) ))
T
(progn
(alert "This command may not be invoked transparently.")
nil
)
)
)
(defun ai_notrans ()
(if (zerop (logand (getvar "cmdactive") (+ 1 2 8) ))
T
(progn
(alert "This command may not be invoked transparently.")
nil
)
)
)
;;;----------------------------------------------------------------------------
; New function for invoking the product support help through the browser
(defun C:ai_product_support ()
(setq url "http://www.autodesk.com/autocad-support")
(command "_.browser" url)
)
(defun C:ai_product_support_safe ()
(setq url "http://www.autodesk.com/autocad-support")
(setq 404page "WSProdSupp404.htm")
(command "_.browser2" 404page url)
)
(defun C:ai_training_safe ()
(setq url "http://www.autodesk.com/autocad-training")
(setq 404page "WSTraining404.htm")
(command "_.browser2" 404page url)
)
(defun C:ai_custom_safe ()
(setq url "http://www.autodesk.com/developautocad")
(setq 404page "WSCustom404.htm")
(command "_.browser2" 404page url)
)
;; Silent load.
(princ)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -