马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 Lisphk 于 2018-2-22 09:28 编辑
 - ;; ===============================================================
- (defun get-activedocument ()
- (setq *doc*
- (cond
- (*doc*)
- ((vla-get-activedocument (get-acadobject)))
- (T nil))))
- ;; ===============================================================
- (defun get-statenames (/ collection names)
- (if (not (vl-catch-all-error-p
- (setq collection
- (vl-catch-all-apply
- (function (lambda ()
- (vla-item (vla-getextensiondictionary
- (vla-get-layers
- (get-activedocument)))
- "ACAD_LAYERSTATES")))))))
- (vlax-for item collection
- (setq names (cons (strcase (vla-get-name item)) names)))))
- ;; ===============================================================
- (defun restore-layerstate (name)
- (if (and state
- (vl-position
- (strcase name)
- (get-statenames)))
- (progn (vla-restore state name)
- (delete-layerstate state name)
- (vlax-release-object state)
- (setq state nil)))
- );; ===============================================================
- (defun delete-layerstate (obj name)
- (if (vl-catch-all-error-p
- (vl-catch-all-apply 'vla-delete (list obj name)))
- nil
- T)
- )
|