本帖最后由 菜卷鱼 于 2022-2-28 09:29 编辑
我是先删掉那些取不到边界范围的图元
- (defun vl-remove-if-Boundless (vobj / aobj ADOC BLKS BLKN)
- (and
- (= (vla-get-ObjectName vobj) "AcDbBlockReference")
- (setq blkn (vla-get-Name vobj))
- (setq aobj (vlax-get-acad-object))
- (setq adoc (vla-get-ActiveDocument aobj))
- (setq blks (vla-get-blocks adoc))
- (vl-catch-all-apply
- '(lambda ()
- (vlax-for vbj (vla-item blks blkn)
- ; (wipe vbj)
- (and (vl-catch-all-error-p
- (vl-catch-all-apply
- 'vla-getboundingbox
- (list vbj 'entpl 'entpr)
- )
- )
- (if (= (vla-get-ObjectName vbj) "AcDbBlockReference")
- (vl-remove-if-Boundless vbj)
- (progn (vla-delete vbj) (mapcar 'princ (list"\n::remove[" vbj "]")))
- )
- )
- )
- )
- )
- )
- vobj
- )
|