- 积分
- 1692
- 明经币
- 个
- 注册时间
- 2004-5-12
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
以下程序实现功能很简单"换层",大侠们看看他有什么毛病,为什么当AutoCAD打开或者新建另一个文件后此程序便失效并出现"; 错误: Automation 错误。"的字样,有什么方法让他在原来的文件里依旧能用,谢谢了! 对了我用的是AutoCAD2002,XP
(DEFUN CAC (/ ss si id curlay laid lays) (SETQ ss (vl-ssget)) (SETQ id 0) (SETQ laid (GETSTRING "\n请输入层名::" )) (SETQ lays (VLA-GET-LAYERS (active-document))) (VLA-ADD lays laid) (REPEAT (VLA-GET-COUNT ss) (SETQ si (VLA-ITEM ss id)) (SETQ id (+ 1 id)) (VLA-PUT-LAYER si laid) ) (PRINC) )
(DEFUN vl-ssget (/ *vl-ssget* flag) (SETQ flag T) (WHILE flag (IF (SSGET) (SETQ flag nil) (PRINC "未选中请重新") ) ) (SETQ *vl-ssget* (VLA-GET-ACTIVESELECTIONSET (active-document))) )
(VL-LOAD-COM) (SETQ *acad-object* nil) ; Initialize global variable (DEFUN acad-object () (COND (*acad-object*) ; Return the cached object (T (SETQ *acad-object* (VLAX-GET-ACAD-OBJECT)) ) )
)
(SETQ *active-document* nil) ; Initialize global variable (DEFUN active-document () (COND (*active-document*) ; Return the cached object (T (SETQ *active-document* (VLA-GET-ACTIVEDOCUMENT (acad-object))) ) )
)
|
|