乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 80|回复: 0

[编程交流] Purging x-references

[复制链接]

33

主题

117

帖子

85

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
170
发表于 2022-7-6 00:00:47 | 显示全部楼层 |阅读模式
Hi everyone,
 
I have a lisp routine as below which purges unreferenced images from a OS tile. However, I have to open the actual OS tile run the command and then close the file.
What I'd like to do is have a lisp routine which opens the x-referenced in the main drawing then runs the purge unreferenced images lisp routine save and close the x-referenced file and then reload the x-referenced file in the main drawing.
 
  1. ; (purge-unreferenced-images)(defun purge-unreferenced-images (/ ss1 ctr id symlst enamelst delent vl_delent ipath iname tmp)(defun remlst (/ tmp1) (setq   tmp        (length (member (cdr (assoc 340 (entget delent))) enamelst)) ) (repeat (- (length symlst) tmp)   (setq tmp1 (cons (car symlst) tmp1))   (setq symlst (cdr symlst)) ) (setq tmp (list (car symlst))) (setq symlst (append (reverse tmp1) (cdr symlst))))(defun massoc (key alist / x nlist) (foreach x alist   (if        (eq key (car x))     (setq nlist (cons (cdr x) nlist))   ) ) (reverse nlist)) (vl-load-com)  (setq ss1 (ssget "x" '((0 . "IMAGE")))) (setq ctr 0) (setq id (dictsearch (namedobjdict) "acad_image_dict")) (setq symlst (massoc 3 id)) (setq enamelst (massoc 350 id)) (if ss1   (progn     (while (< ctr (sslength ss1))(setq delent (ssname ss1 ctr))(setq vl_delent (vlax-ename->vla-object delent))(setq ipath (vla-get-ImageFile vl_delent))(remlst)(setq iname (strcat (vl-filename-base ipath) (vl-filename-extension ipath)))(if (and (not (findfile ipath))         (not (findfile iname))    )  (progn    (dictremove (cdr (car id)) (car tmp))    (append tmp symlst)    (ssdel delent ss1)    (vla-delete vl_delent)  )  (progn    (setq ctr (1+ ctr))  ))     )   ) ) (while symlst   (dictremove (cdr (car id)) (car symlst))   (setq symlst (cdr symlst)) ))(defun c:PUI() (purge-unreferenced-images) (princ))(princ)
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-10 21:27 , Processed in 1.241253 second(s), 54 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表