马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
改变图层层名的VLISP程序

- ;;; renames an existing layer. returns nothing
- ;;; ARGUMENTS
- ;;; current-name = string (existing layer name)
- ;;; new-name = string (new name for existing layer)
- ;;; USAGE
- ;;; to re-name a layer use (MST-LayerReName "fred" "barney")
- ;;; were "fred" is the current layer name and "barney" is
- ;;; new name
- ;;;
- ;;; PLATFORMS 2000+
- ;;;
- ;;; AUTHOR
- ;;; Copyright© 2003 Mark S. Thomas
- ;;; [email]mark.thomas@theswamp.org[/email]
- ;;;
- ;;; VERSION
- ;;; 1.0 Fri Oct 10, 2003
- (defun MST-LayerReName (current-name new-name / laysobj re-named-layer)
- (if
- (and (= (type current-name) (type new-name) 'STR))
- (progn
- (setq laysobj
- (vla-get-Layers
- (vla-get-ActiveDocument (vlax-get-acad-object))
- )
- ); setq
- (if
- (not
- (vl-catch-all-error-p
- (setq re-named-layer
- (vl-catch-all-apply
- 'vlax-invoke-method
- (list laysobj 'Item current-name)
- )
- ); setq
- )
- ); not
- (progn
- (vlax-put-property re-named-layer 'Name new-name)
- (vlax-release-object re-named-layer)
- )
- ); if
- (vlax-release-object laysobj)
- ); progn
- ); if
- (princ)
- ); defun
|