- ;alisp方法实现
- (defun c:amf(/ YH_INDEX YH_LAYER YH_LAYERS)
- (setq YH_layers (list (cdr (assoc 2 (tblnext "LAYER" T))))
- YH_index 1
- )
- (while (setq YH_layer (tblnext "LAYER"))
- (setq YH_layers (append YH_layers (list (cdr (assoc 2 YH_layer))))
- YH_index (1+ YH_index))
- )
- (princ YH_layers)
- (princ YH_index)
- (princ)
- )
- ;vlisp方法实现
- (defun c:vmf()
- (vl-load-com)
- (setq YH_layersclt (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
- YH_index (vla-get-count YH_layersclt)
- YH_layers '()
- )
- (vlax-for YH_layer YH_layersclt
- (setq YH_layers (append YH_layers (list (vla-get-name YH_layer))))
- )
- (princ YH_layers)
- (princ YH_index)
- (princ)
- )
|