乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 16|回复: 5

[编程交流] AutoLisp Error Handling - Comm

[复制链接]

1

主题

3

帖子

2

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 00:02:33 | 显示全部楼层 |阅读模式
My error trapper crashes when (command "layer"...) is run. The following is returned. ; error: An error has occurred inside the *error* functionFunction
 
The error trapper works fine when (command "layer"...) is not included.
 
  1. ;====================== Error Trapper(defun MyExit (msg) (command "-layer" "off" "ToolTracker" "") (close file) (setvar "highlight" 1) (setvar "cmdecho" 1) (alert "Tool Tracker Stopped") (princ))
回复

使用道具 举报

44

主题

3166

帖子

2803

银币

中流砥柱

Rank: 25

铜币
557
发表于 2022-7-6 00:20:53 | 显示全部楼层
Is this error handler localized within your main routine?
 
Where are you restoring the default error handler, as your error handler is not doing so?
 
So that we might be able to better assist you, please post the rest of your code, as more information is needed.
 
Cheers
回复

使用道具 举报

4

主题

2143

帖子

2197

银币

限制会员

铜币
-24
发表于 2022-7-6 00:26:58 | 显示全部楼层
Please read the Code posting guidelines and edit your code to be in code tags.
回复

使用道具 举报

1

主题

3

帖子

2

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 00:43:13 | 显示全部楼层
Is this error handler localized within your main routine? No
 
  1. (defun C:TrackToolRT (/ *error*) (setq *error* MyExit)... rest of main code (MyExit nil))
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 00:59:13 | 显示全部楼层
Is the error handler being used in conjunction with a reactor callback function?
 
Also:
 


  • It would be better to ensure that the file symbol is correctly defined, rather than assume that it points to a file descriptor.

 


  • System variables should be reset to their original values, not the values that you choose.

  
  1. (defun myexit ( msg / ent )   (if       (and           (setq ent (tblobjname "layer" "ToolTracker"))           (setq ent (entget ent))       )       (entmod (subst (cons 62 (- (abs (cdr (assoc 62 ent))))) (assoc 62 ent) ent))   )   (if (= 'file (type file))       (close file)   )   (princ))
回复

使用道具 举报

1

主题

3

帖子

2

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 01:11:52 | 显示全部楼层
Lee Mac
 
Thanks. That method eliminates my error in my error trap. Any idea however, why the command version resulted in an error since it is suppose to accomplish the same thing?
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-10 21:04 , Processed in 0.445279 second(s), 64 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表