- 积分
- 17457
- 明经币
- 个
- 注册时间
- 2011-8-12
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2021-8-13 18:35:11
|
显示全部楼层
本帖最后由 vitalgg 于 2021-8-13 19:39 编辑
(setq @:cmd (if command-s command-s (if vl-cmdf vl-cmdf command)))
(@:cmd ....)
可变参数个数的功能在浩辰不能用。
弹出建议多是因为 自定义了 *error* ,后没有恢复 以及 没有 *push-error-using-command*
符号可以指向数值,字符串,也可以指向函数 ,指向表。
command 与 command-s比并不是一无是处。
自行翻译理解:
The command-s function is a variation of the command function which has some restrictions on command token content, but is both faster than command and can be used in *error* handlers due to internal logic differences.
A command token is a single argument provided to the command-s function. This could be a string, real, integer, point, entity name, list, and so on. The following example shows the AutoCAD LINE command and three command tokens:
(command-s "._line" "0,0" "5,7" "")
The "-s" suffix stands for "subroutine" execution of the supplied command tokens. In this form, AutoCAD is directly called from AutoLISP, processes the supplied command tokens in a temporary command processor distinct from the main document command processor, and then returns, thus terminating the temporary command processor. The command that is being executed must be started and completed in the same command-s function.
In contrast, the command function remains a "co-routine" execution of the supplied command tokens, where AutoLISP evaluates the tokens one at a time, sending the result to AutoCAD, and then returning to allow AutoCAD to process that token. AutoCAD then calls AutoLISP back, and AutoLISP resumes evaluation of the expression in progress. In this logic flow, subsequent token expressions can query AutoCAD for the results of previous token processing and use it.
In summary, the "co-routine" style of command token processing is more functionally powerful, but is limited in when it can be used when running. The "subroutine" style of command token processing can be used in a much wider range of contexts, but processes all command tokens in advance, and actual execution is non-interactive. For the same set of command tokens, command-s function is significantly faster.
|
|