明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2053|回复: 8

autoload是什么类型的函数

[复制链接]
发表于 2004-3-8 17:09:00 | 显示全部楼层 |阅读模式
我在启动程序中使用了autoload函数,但却提示出错,请问,这个函数是外部定义的函数吗,与哪一个文件相关联。或者怎么样解决这一问题,当然不是用load函数代替。

本帖子中包含更多资源

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

x
发表于 2004-3-8 18:04:00 | 显示全部楼层
是外部定义函数。
发表于 2004-3-8 18:07:00 | 显示全部楼层
是哪个文件?


为什么我默认有此函数,而之前提到的CAL函数却不默认有,在帮助文件CAL函数则有说明包含在(外部定义:geomcal ARX 应用程序),而autoload却没有?
发表于 2004-3-8 18:14:00 | 显示全部楼层
在acad2004doc.lsp文件中定义了很多自动加载用的函数。
发表于 2004-3-8 18:57:00 | 显示全部楼层
AUTOLOAD應是LISP正常函數


       

本帖子中包含更多资源

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

x
发表于 2004-3-8 19:13:00 | 显示全部楼层
应该不是了,用APPLOAD查了一下,应该是包含在ACAD2004DOC.FAS,而ACAD2004DOC.LSP应该就是它的源文件了。。。


本帖子中包含更多资源

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

x
发表于 2004-3-8 19:26:00 | 显示全部楼层
那樣它的幫助文件就不應把它列出了! 難怪有這個程序!! ;| AutoLoader.lsp
Written by: Kevin J. Nehls 3-31-2002
Version: 1.4 6-26-2002
Credits: Thanks to Robert Bell for giving me the idea to do this.
Description:
Works the same as AutoCAD's autoloader with a few differences.
Basically the major difference in calling this routine is that
instead of passing a list of strings for the functions/commands
you now pass a list of lists of strings. The other difference
is that for a command line command you pass it with "C:" where
AutoCAD's autoloader assumed this and appended that to your
command name. A more deatailed explaination of differences are
listed below.
*************************************************************************
I think this stuff has to be here, but I'm not sure, I'm definetly not
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
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.
*************************************************************************
Release history Kevin Nehls 6-26-2002 4:07pm (version 1.4)
-Modified "(princ "\nInitalizing....")" string to include the
command/function name in uppercase
"(princ ""\"\nInitializing.... " (strcase CmdName) "\")"
-Updated naming convention for variables Kevin Nehls 4-30-2002 10:30am (version 1.3)
-Added "Initializing...." string to first call of command
-Added slightly more documentation Kevin Nehls 4-30-2002 10:00am (version 1.2)
-Added check for CmdFuncArgList and if exist then create ArgList Kevin Nehls 4-30-2002 9:15am (version 1.1)
-Removed testing code Kevin Nehls 3-31-2002 (version 1.0)
Initial release
*************************************************************************
Advantages/Differences are:
1) Default support for VLX and FAS files without having to specify
the file extension.
2) It can AutoLoad any function with any number of arguments.
3) It won't throw you into an infinite loop if the file loaded
doesn't redefine the function/command that is to be called.
--AutoCAD's AutoLoader will do this.
If this happens you now get a message telling you where the
error occured.
--AutoCAD's AutoLoader does not do this.
4) If you want to autoload a command line command you have to
prefix it with C:, see Example 1.
5) To have multiple fuctions/commands autoloaded from the same
file, just add the additional functions as shown in the examples
6) There is no error handling in this AutoLoader. The only reason you
would have it is if the file you were loading was "self-executing".
I have my functions/routines handle the error handling and don't
need the AutoLoader to do this.
7) This AutoLoader currently needs to have AutoCAD 2000 or newer installed
to work just becuase of the use of (vl-filename-extension). You can
easily add support for just about all previous versions that support
the AutoLISP functions used by either removing that or just looking
at the last four chars and determining if it's an extension or not.
8) If you want to use this routine in R12 or R13 DOS, you will need to
either modify the 2 ARX loading routines, or you will have to create
2 EXE/EXP loading routines. Basically this is a minor mod to
(_knai:AutoARXLoad) and (knai:AutoARXLoad). Oh yea, and to make this
work in a version of AutoCAD R14 or older you'll have to comment out
each of these lines instead of using the commenting style available
to 2000 Visual Lisp users. Usage and Notes: (knai:AutoLSPLoad "<filename>" '(("<func1_name>" "<arg1>" "<arg2>") ("<func2_name>" "<arg1>")))
(knai:AutoARXLoad "<filename>" '(("<func1_name>" "<arg1>") ("<func2_name>")))
Example 1:
(knai:AutoLSPLoad "lspExample1" '(("C:cmd1") ("C:cmd2"))) Example 2:
(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
andother file which has these statements. |; (defun _knai:AutoLoader (AppType AppFileName CmdFuncArgList / CmdName CmdNameStr ArgList)
(setq AppFileName (strcat "\"" AppFileName "\""))
(mapcar
(function
(lambda (CmdFuncArgList)
(setq CmdName (car CmdFuncArgList)
CmdFuncArgList (cdr CmdFuncArgList)
ArgList ""
)
(if CmdFuncArgList
(foreach x CmdFuncArgList (setq ArgList (strcat ArgList x " ")))
)
(if (not (eval (read CmdName)))
(eval (read (strcat
"(defun " CmdName " (" ArgList " / tst)"
"(princ ""\"\nInitializing.... " (strcase CmdName) "\")"
"(setq tst " CmdName ")"
"(if (_knai:FindFile " AppFileName ")"
"(progn "
"(_knai:Auto" AppType "load " AppFileName ")"
"(if (/= tst " CmdName ")"
"(" CmdName " " ArgList ")"
"(_knai:NoReDefun " "\"" AppType "\"" " " "\"" CmdName "\"" ")))"
"(_knai:NoFile " AppFileName "))"
")"
)
)
)
)
)
)
CmdFuncArgList
)
nil
) (defun _knai:AutoLSPLoad (AppFileName)
(load AppFileName)
) (defun _knai:AutoARXLoad (AppFileName)
(arxload AppFileName)
) (defun _knai:FindFile (AppFileName)
(or
(findfile (strcat AppFileName ".vlx"))
(findfile (strcat AppFileName ".fas"))
(findfile (strcat AppFileName ".lsp"))
(findfile (strcat AppFileName ".arx"))
(findfile AppFileName)
)
) (defun _knai:NoFile (AppFileName)
(alert
(strcat "The file \""
AppFileName
"\""
(if (not (vl-filename-extension AppFileName))
"(.vlx/.fas/.lsp/.arx) "
" "
)
"was not found in your search path folders.\n"
"Check the installation of the support files and try again."
)
)
(princ)
) (defun _knai:NoReDefun (AppType CmdName)
(alert (strcat
"Syntax error in knai:Auto"
(strcase AppType)
"Load for function/command:\n\n\""
"\""
(strcase CmdName)
"\""
)
)
) (defun knai:AutoLSPLoad (AppFileName CmdFuncArgList)
(_knai:AutoLoader "lsp" AppFileName CmdFuncArgList)
) (defun knai:AutoARXLoad (AppFileName CmdFuncArgList)
(_knai:AutoLoader "arx" AppFileName CmdFuncArgList)
) ;;;*************************************************************************
;;; Add knai:AutoxxxLoad statements here or load another file to house
;;; those calls.
;;;************************************************************************* ;;;(load "<your external file with the autoload statements>") ;;Silent load autoloader
(princ)
 楼主| 发表于 2004-3-8 21:28:00 | 显示全部楼层
谢谢各位,确实为外部定义文件,在cad2002及cad2000中均在ACAD2000.LSP中,原来受帮助文件的引导,一直以为是内部命令,将其用在加载文件中,但在某些系统下,出现未定义的提示。不知为什么,有时不能加载ACAD2000.LSP或ACAD2000.fas文件,当然有时是正常的。有没有具有相似功能的内部命令呢?
发表于 2004-3-9 08:00:00 | 显示全部楼层
因为你在启动组中使用,那时acad2000.fas文件还没有加载。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-10-1 21:35 , Processed in 0.203801 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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