删除图中所有图像
(defun RemoveAllRaster (doc / _catchapply dict lockd)
(vl-load-com)
(defun _catchapply (method params / result)
(if (not (vl-catch-all-error-p
(setq result (vl-catch-all-apply method params))
)
)
result
)
)
(vlax-for layer (vla-get-layers doc)
(if (eq :vlax-true (vla-get-lock layer))
(vla-put-lock
(car (setq lockd (cons layer lockd)))
:vlax-false
)
)
)
(vlax-for block (vla-get-blocks doc)
(vlax-for object block
(if (member (vla-get-objectname object)
'("AcDbOle2Frame" "AcDbRasterImage")
)
(_catchapply 'vla-delete (list object))
)
)
)
(if (setq dict (_catchapply
'vla-item
(list (vla-get-dictionaries doc) "ACAD_IMAGE_DICT")
)
)
(progn (vlax-for object dict
(_catchapply 'vla-delete (list object))
)
(_catchapply 'vla-delete (list dict))
)
)
(if (setq dict (_catchapply
'vla-item
(list (vla-get-dictionaries doc) "ACAD_IMAGE_VARS")
)
)
(_catchapply 'vla-delete (list dict))
)
(foreach layer lockd (vla-put-lock layer :vlax-true))
(vla-regen doc acallviewports)
(princ)
)
(defun c:RemoveAllPics nil
(RemoveAllRaster
(vla-get-activedocument (vlax-get-acad-object))
)
(princ)
)
版主给力~~~ 删除图中所有图像,感谢楼主分享! 感谢楼主分享源码! 楼主这是针对cass10的功能吗? 版主厉害,vl-catch-all-error-p vl-catch-all-apply 整合成函数了。收藏! 不错,学习了! 不错,学习了 学习了。好东西 ole图像也可以嘛?
页:
[1]