最初由 jx2008 发布
[B]有如下一种结构的表,怎样才能分层次的取得相应图元名,然后entget该图元名的数据库。
表的层次,可能不止三层。
(((<图元名: 7ef671b0> . 2) ... [/B]
看看这个对你有没有用。以后请你不要发错版块!

- [FONT=courier new]
- ;;; ==================================================================
- ;;;blkname为块名
- (defun th_subelst_blk (blkname / blk lst)
- (setq blk (vla-item (th-doccollection 'blocks) blkname))
- (setq lst (list blkname))
- (vlax-for each blk (if (/= (vla-get-objectname each) "AcDbBlockReference")
- (setq lst (cons each lst))
- (setq lst (cons (th_subelst_blk (vla-get-name each)) lst))
- )
- )
- (reverse lst)
- )
- ;;; ==================================================================
- (defun th-doccollection (typename)
- (vlax-get-property (thactdoc) typename)
- )
- (defun thacadobj ()
- (cond
- (%$*thacadobj*$%)
- (setq %$*thacadobj*$% (vlax-get-acad-object))
- )
- )
- (defun thactdoc ()
- (cond
- (%$*thactdoc*$%)
- (setq %$*thactdoc*$% (vla-get-activedocument (thacadobj)))
- )
- )
- ;;; ==================================================================
- [/FONT]
|