找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 849|回复: 2

[求助] [求助]:我怎么让lsp程序自动加载

[复制链接]
发表于 2007-1-17 08:05:06 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
我自己编了一个lsp程序,但是每次用的时候总是要用appload函数加载,有什么办法可以让cad打开的时候自动加载呢?
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2007-1-17 08:36:38 | 显示全部楼层
在加载的对话框中还有一个启动组按钮,将你的程序加到启动组中就可以了。
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 2个

财富等级: 恭喜发财

发表于 2007-1-17 09:15:23 | 显示全部楼层

  1.   [FONT=courier new]
  2. Loading AutoLISP Files.
  3. Note!!
  4. One of the most important things to remember about loading AutoLisp Routines is to
  5. ensure that your Lisp files and any support files (i.e DCL Files; DAT Files; etc) are in your
  6. AutoCad search path. (I dedicate a directory to all my Lisp files and relevant support
  7. files.
  8. There are numerous ways of loading AutoLisp Files :
  9. Command Line Loading.
  10. The simplest is from the AutoCad command line.
  11. The syntax for loading AutoLisp files is :
  12. (load "filename")
  13. The.lsp extension is not required.
  14. Menu Loading.
  15. The following code samples are one way of loading AutoLisp files from a menu.
  16. Pull Down Menu's :
  17. ***POP12
  18. T_Steel [Steel Menu]
  19. T_Beams [Drawing Setup]^C^C^P+
  20. (cond ((null C:DDSTEEL) (prompt "Please Wait...")(load "DDSTEEL"))) DDSTEEL
  21. Toolbars :
  22. ***TOOLBARS
  23. **STEEL
  24. TB_DDSTEEL [_Button("Steel", "STEEL.bmp", "STEEL32.bmp")]^C^C^P+
  25. (cond ((null C:ddsteel) (prompt "Please Wait...")(load "ddsteel"))) ddsteel
  26. This method of loading Lisp files first checks to see if the routine is already loaded. If it
  27. is, it runs the routine. If it is not, it first loads the routine, then runs it. Clever Hey...
  28. AcadDoc.Lsp File.
  29. The AcadDoc.Lsp file is a useful way of loading a library of AutoLisp routines.
  30. Each time you start a drawing AutoCad searches the library path for an AcadDoc.Lsp
  31. file. If it finds one, it loads the file into memory.
  32. You could use the normal load function (load "filename") in your AcadDoc.Lsp file but if
  33. an error occurs whilst attempting to load one of your routines, the remainder of the file is
  34. ignored and is not loaded.
  35. Therefore, you must use the on failure argument with the load function :
  36. (load "Lispfile1" "\nLispfile1 not loaded")
  37. (load "Lispfile2" "\nLispfile2 not loaded")
  38. (load "Lispfile3" "\nLispfile3 not loaded")
  39. The .MNL File
  40. The other type of file that AutoCad loads automatically is the .MNL file.
  41. If you have a partial menu file it can also have it's own .MNL file.
  42. Just remember that the .MNL file must have exactly the same name as your partial menu
  43. file. (except for the .MNL extension, of course.)
  44. You can load Lisp files from this file using the load function exactly the same as you did
  45. in the AcadDoc.Lsp file.
  46. Command Autoloader
  47. When you automatically load a command from your AcadDoc.Lsp file (or a .MNL file) the
  48. commands definition consumes your systems resources whether you actually use the
  49. command or not. The Autoload function makes a command available without loading the
  50. entire routine into memory.
  51. (Autoload "Utils" '("Utils1" Utils2" "Utils3"))
  52. (Autoload "DDSteel" '("DDSteel"))
  53. This would automatically load the commands Utils1, Utils2 and Utils3 from the Utils.Lsp
  54. file and DDSteel from the DDSteel.Lsp file.
  55. S::Startup Function.
  56. If the user defined function S::Startup is included in the AcadDoc.lsp or a .MNL file,
  57. it is called when you enter a new drawing or open an existing drawing.
  58. e.g. Say that you wanted to override the standard AutoCad LINE and COPY commands
  59. with versions of your own, your AcadDoc.Lsp file would something like this :
  60. (defun C:LINE ()
  61. .....Your Definition.....
  62. )
  63. (defun C:COPY ()
  64. .....Your Definition.....
  65. )
  66. (defun S::Startup ()
  67. (command "Undefine" "LINE")
  68. (command "Undefine" "COPY")
  69. )
  70. Before the drawing is initialised, new definitions for LINE and COPY are defined. After
  71. the drawing is initialised, the S::Startup function is called and the standard definitions of
  72. LINE and COPY are undefined.
  73.   [/FONT]
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-11-17 20:33 , Processed in 0.191088 second(s), 35 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表