- ;;36 [功能] 删除指定名的所有块
- ;; (MJ:EraseBlock "BTL");删除名叫"BTL"的所有块
- (defun MJ:EraseBlock (bn / layout i)
- (vlax-for layout *LOUTS*
- (vlax-for i (vla-get-block layout)
- (if (and
- (= (vla-get-objectname i) "AcDbBlockReference")
- (= (strcase (vla-get-name i)) (strcase bn))
- )
- (vla-Delete i)
- )
- )
- )
- )
- ;;28.1 [功能] 清理打开文档
- (defun MJ:PurgeAllDocs (/ item cur)
- (vlax-for item *DOCS*
- (vla-PurgeAll item)
- )
- )
- (LH:DELETETBLK "1")
- ;;28.1 [功能] 清理打开文档BLK
- (defun LH:DELETETBLK (BLK / item cur)
- (setq
- *ACAD* (vlax-get-acad-object)
- *DOC* (vla-get-ActiveDocument *ACAD*)
- *BLKS* (vla-get-Blocks *DOC*)
- )
- (vlax-for item *BLKS*
- (IF (= (VLA-GET-NAME ITEM) BLK)
- (PROGN
- (SETQ ERR (vl-catch-all-apply 'vla-delete (LIST item)))
- (IF (vl-catch-all-error-p ERR)
- (PROGN
- (PRINC (vl-catch-all-error-message ERR))
- )
- )
- )
- )
- )
- )
- (setq
- *ACAD* (vlax-get-acad-object)
- *DOC* (vla-get-ActiveDocument *ACAD*)
- *BLKS* (vla-get-Blocks *DOC*)
- *LAYS* (vla-get-Layers *DOC*)
- *LTS* (vla-get-Linetypes *DOC*)
- *STS* (vla-get-TextStyles *DOC*)
- *GRPS* (vla-get-groups *DOC*)
- *DIMS* (vla-get-DimStyles *DOC*)
- *LOUTS* (vla-get-Layouts *DOC*)
-
- )
|