本帖最后由 Gu_xl 于 2012-12-17 08:19 编辑
修改块内物体显示顺序示例代码:
- (defun c:tt (/ el st dict blkdef r)
- (if (and
- (setq el (nentsel "\n 选择图块:"))
- (= 'ename (type (last (last el))))
- )
- (if (setq st
- (cond
- (
- (if
- (not
- (VL-CATCH-ALL-ERROR-P
- (setq st
- (VL-CATCH-ALL-APPLY
- 'vla-item
- (list
- (setq dict
- (vla-GetExtensionDictionary
- (setq blkdef
- (vla-item
- (vla-get-blocks
- (vla-get-ActiveDocument
- (vlax-get-acad-object)
- )
- )
- (cdr (assoc 2 (entget (last (last el)))))
- )
- )
- )
- )
- "ACAD_SORTENTS"
- )
- )
- )
- )
- )
- st
- )
- )
- (
- if
- (not
- (VL-CATCH-ALL-ERROR-P
- (setq st
- (VL-CATCH-ALL-APPLY
- 'vla-AddObject
- (list dict "ACAD_SORTENTS" "AcDbSortentsTable")
- )
- )
- )
- )
- st
- )
- )
- )
- (progn
- (vlax-for obj blkdef
- (if (= "AcDbLine" (vla-get-ObjectName obj))
- (setq r (cons obj r))
- )
- )
- (vla-MoveTotop ;_ 移到最上面
- st
- (vlax-make-variant
- (vlax-safearray-fill
- (vlax-make-safearray
- vlax-vbObject
- (cons 0 (1- (length r)))
- )
- r
- )
- )
- )
- )
- )
- )
- (princ)
- )
|