cqnj023 发表于 2004-3-8 17:09:00

autoload是什么类型的函数

我在启动程序中使用了autoload函数,但却提示出错,请问,这个函数是外部定义的函数吗,与哪一个文件相关联。或者怎么样解决这一问题,当然不是用load函数代替。

mccad 发表于 2004-3-8 18:04:00

是外部定义函数。

meflying 发表于 2004-3-8 18:07:00

是哪个文件?


为什么我默认有此函数,而之前提到的CAL函数却不默认有,在帮助文件CAL函数则有说明包含在(外部定义:geomcal ARX 应用程序),而autoload却没有?

mccad 发表于 2004-3-8 18:14:00

在acad2004doc.lsp文件中定义了很多自动加载用的函数。

龙龙仔 发表于 2004-3-8 18:57:00

AUTOLOAD應是LISP正常函數


       

meflying 发表于 2004-3-8 19:13:00

应该不是了,用APPLOAD查了一下,应该是包含在ACAD2004DOC.FAS,而ACAD2004DOC.LSP应该就是它的源文件了。。。


龙龙仔 发表于 2004-3-8 19:26:00

那樣它的幫助文件就不應把它列出了!


難怪有這個程序!!


;|       AutoLoader.lsp<BR>                       Written by: Kevin J. Nehls 3-31-2002<BR>                       Version:       1.4 6-26-2002<BR>                       Credits:       Thanks to Robert Bell for giving me the idea to do this.<BR>                       Description:<BR>                                                       Works the same as AutoCAD's autoloader with a few differences.<BR>                                                       Basically the major difference in calling this routine is that<BR>                                                       instead of passing a list of strings for the functions/commands<BR>                                                       you now pass a list of lists of strings.       The other difference<BR>                                                       is that for a command line command you pass it with "C:" where<BR>                                                       AutoCAD's autoloader assumed this and appended that to your<BR>                                                       command name.       A more deatailed explaination of differences are<BR>                                                       listed below.<BR>*************************************************************************<BR>       I think this stuff has to be here, but I'm not sure, I'm definetly not<BR>       going to be selling this.       I just hope some people find it useful.


                       Copyright (C) 1994 - 2001 by Autodesk, Inc.


                       Permission to use, copy, modify, and distribute this software<BR>                       for any purpose and without fee is hereby granted, provided<BR>                       that the above copyright notice appears in all copies and<BR>                       that both that copyright notice and the limited warranty and<BR>                       restricted rights notice below appear in all supporting<BR>                       documentation.


                       AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.<BR>                       AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF<BR>                       MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.       AUTODESK, INC.<BR>                       DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE<BR>                       UNINTERRUPTED OR ERROR FREE.


                       Use, duplication, or disclosure by the U.S. Government is subject to<BR>                       restrictions set forth in FAR 52.227-19 (Commercial Computer<BR>                       Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) <BR>                       (Rights in Technical Data and Computer Software), as applicable.<BR>*************************************************************************<BR>Release history


Kevin Nehls 6-26-2002 4:07pm (version 1.4)<BR>       -Modified "(princ "\nInitalizing....")" string to include the<BR>               command/function name in uppercase<BR>               "(princ ""\"\nInitializing....       " (strcase CmdName) "\")"<BR>       -Updated naming convention for variables


Kevin Nehls 4-30-2002 10:30am (version 1.3)<BR>       -Added "Initializing...." string to first call of command<BR>       -Added slightly more documentation


Kevin Nehls 4-30-2002 10:00am (version 1.2)<BR>       -Added check for CmdFuncArgList and if exist then create ArgList


Kevin Nehls 4-30-2002 9:15am (version 1.1)<BR>       -Removed testing code


Kevin Nehls 3-31-2002 (version 1.0)<BR>       Initial release<BR>*************************************************************************<BR>Advantages/Differences are:<BR>       1) Default support for VLX and FAS files without having to specify<BR>                               the file extension.<BR>       2) It can AutoLoad any function with any number of arguments.<BR>       3) It won't throw you into an infinite loop if the file loaded<BR>                               doesn't redefine the function/command that is to be called.<BR>                               --AutoCAD's AutoLoader will do this.<BR>                               If this happens you now get a message telling you where the<BR>                               error occured.<BR>                               --AutoCAD's AutoLoader does not do this.<BR>       4) If you want to autoload a command line command you have to<BR>                               prefix it with C:, see Example 1.<BR>       5) To have multiple fuctions/commands autoloaded from the same<BR>                               file, just add the additional functions as shown in the examples<BR>       6) There is no error handling in this AutoLoader.       The only reason you<BR>                               would have it is if the file you were loading was "self-executing".<BR>                               I have my functions/routines handle the error handling and don't<BR>                               need the AutoLoader to do this.<BR>       7) This AutoLoader currently needs to have AutoCAD 2000 or newer installed<BR>                               to work just becuase of the use of (vl-filename-extension).       You can<BR>                               easily add support for just about all previous versions that support<BR>                               the AutoLISP functions used by either removing that or just looking<BR>                               at the last four chars and determining if it's an extension or not.<BR>       8) If you want to use this routine in R12 or R13 DOS, you will need to<BR>                               either modify the 2 ARX loading routines, or you will have to create<BR>                               2 EXE/EXP loading routines.       Basically this is a minor mod to<BR>                               (_knai:AutoARXLoad) and (knai:AutoARXLoad).       Oh yea, and to make this<BR>                               work in a version of AutoCAD R14 or older you'll have to comment out<BR>                               each of these lines instead of using the commenting style available<BR>                               to 2000 Visual Lisp users.


Usage and Notes:


(knai:AutoLSPLoad "&lt;filename&gt;" '(("&lt;func1_name&gt;" "&lt;arg1&gt;" "&lt;arg2&gt;") ("&lt;func2_name&gt;" "&lt;arg1&gt;")))<BR>(knai:AutoARXLoad "&lt;filename&gt;" '(("&lt;func1_name&gt;" "&lt;arg1&gt;") ("&lt;func2_name&gt;")))<BR>Example 1:<BR>(knai:AutoLSPLoad "lspExample1" '(("C:cmd1") ("C:cmd2")))


Example 2:<BR>(knai:AutoLSPLoad "lspExample2" '(("knai:EX2" "str1" "str2" "real" "int")))


--knai:AutoARXLoad works exactly the same way as knai:AutoLSPLoad only for ARX files


Just add your knai:AutoxxxLoad statements to the end of this file or have this file load<BR>andother file which has these statements.


|;


(defun _knai:AutoLoader        (AppType AppFileName CmdFuncArgList / CmdName CmdNameStr ArgList)<BR>       (setq AppFileName (strcat "\"" AppFileName "\""))<BR>       (mapcar<BR>                       (function<BR>                                       (lambda (CmdFuncArgList)<BR>        (setq CmdName (car CmdFuncArgList)<BR>                                               CmdFuncArgList (cdr CmdFuncArgList)<BR>                                               ArgList ""<BR>        )<BR>        (if CmdFuncArgList<BR>               (foreach x CmdFuncArgList (setq ArgList (strcat ArgList x " ")))<BR>        )<BR>        (if (not (eval (read CmdName)))<BR>               (eval        (read (strcat<BR>                        "(defun " CmdName " (" ArgList " / tst)"<BR>                        "(princ ""\"\nInitializing....       " (strcase CmdName) "\")"<BR>                        "(setq tst " CmdName ")"<BR>                        "(if (_knai:FindFile " AppFileName ")"<BR>                        "(progn "<BR>                        "(_knai:Auto" AppType "load " AppFileName ")"<BR>                        "(if (/= tst " CmdName ")"<BR>                        "(" CmdName " " ArgList ")"<BR>                        "(_knai:NoReDefun " "\"" AppType "\"" " " "\"" CmdName "\"" ")))"<BR>                        "(_knai:NoFile " AppFileName "))"<BR>                        ")"<BR>                                                               )<BR>                )<BR>               )<BR>        )<BR>                                       )<BR>                       )<BR>                       CmdFuncArgList<BR>       )<BR>       nil<BR>)


(defun _knai:AutoLSPLoad (AppFileName)<BR>       (load AppFileName)<BR>)


(defun _knai:AutoARXLoad (AppFileName)<BR>       (arxload AppFileName)<BR>)


(defun _knai:FindFile (AppFileName)<BR>       (or<BR>                       (findfile (strcat AppFileName ".vlx"))<BR>                       (findfile (strcat AppFileName ".fas"))<BR>                       (findfile (strcat AppFileName ".lsp"))<BR>                       (findfile (strcat AppFileName ".arx"))<BR>                       (findfile AppFileName)<BR>       )<BR>)


(defun _knai:NoFile (AppFileName)<BR>       (alert<BR>                       (strcat "The file \""<BR>                               AppFileName<BR>                               "\""<BR>                               (if        (not (vl-filename-extension AppFileName))<BR>                                               "(.vlx/.fas/.lsp/.arx) "<BR>                                               " "<BR>                               )<BR>                               "was not found in your search path folders.\n"<BR>                               "Check the installation of the support files and try again."<BR>                       )<BR>       )<BR>       (princ)<BR>)


(defun _knai:NoReDefun (AppType CmdName)<BR>       (alert (strcat<BR>                       "Syntax error in knai:Auto"<BR>                       (strcase AppType)<BR>                       "Load for function/command:\n\n\""<BR>                       "\""<BR>                       (strcase CmdName)<BR>                       "\""<BR>       )<BR>       )<BR>)


(defun knai:AutoLSPLoad        (AppFileName CmdFuncArgList)<BR>       (_knai:AutoLoader "lsp" AppFileName CmdFuncArgList)<BR>)


(defun knai:AutoARXLoad        (AppFileName CmdFuncArgList)<BR>       (_knai:AutoLoader "arx" AppFileName CmdFuncArgList)<BR>)


;;;*************************************************************************<BR>;;;       Add knai:AutoxxxLoad statements here or load another file to house<BR>;;;       those calls.<BR>;;;*************************************************************************


;;;(load "&lt;your external file with the autoload statements&gt;")


;;Silent load autoloader<BR>(princ)

cqnj023 发表于 2004-3-8 21:28:00

谢谢各位,确实为外部定义文件,在cad2002及cad2000中均在ACAD2000.LSP中,原来受帮助文件的引导,一直以为是内部命令,将其用在加载文件中,但在某些系统下,出现未定义的提示。不知为什么,有时不能加载ACAD2000.LSP或ACAD2000.fas文件,当然有时是正常的。有没有具有相似功能的内部命令呢?

mccad 发表于 2004-3-9 08:00:00

因为你在启动组中使用,那时acad2000.fas文件还没有加载。
页: [1]
查看完整版本: autoload是什么类型的函数