明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1712|回复: 9

[已解答] 怎么判断图纸中是否存在外部参照

[复制链接]
发表于 2014-9-15 10:53 | 显示全部楼层 |阅读模式
RT,关于外部参照的函数不熟,请各位前辈教一下
发表于 2014-9-15 11:10 | 显示全部楼层
 楼主| 发表于 2014-9-15 11:34 | 显示全部楼层
Andyhon 发表于 2014-9-15 11:10
check here:
http://discussion.autodesk.com/thread.jspa?messageID=1131046

这..英文水平不行,看百度翻译都看得倒懂不懂的,谢谢了
 楼主| 发表于 2014-9-15 11:48 | 显示全部楼层
大概看懂点,
setq ss (ssget "x" (list (cons 0 "insert")(cons 2 "*"))))

If the selection set is nil, there are no xrefs, otherwise
(sslength ss) tells you how many objects are attached
xrefs.
这句命令为何和他描述的不一样...有参照和没参照SS都不是nil
发表于 2014-9-15 12:38 | 显示全部楼层
Reply From: Bethel, David
Re: Check if Xref's exist in drawing

Ron,
via Lisp;

(defun FindXref (/ td xrf)
  (while (setq td (tblnext "BLOCK" (not td)))
    (and (= (logand (cdr (assoc 70 td)) 4) 4)
         (setq xrf (cons (strcase (cdr (assoc 2 td))) xrf))
    )
  )
  xrf
)
 楼主| 发表于 2014-9-15 15:18 | 显示全部楼层
Andyhon 发表于 2014-9-15 12:38
Reply From: Bethel, David
Re: Check if Xref's exist in drawing

谢谢,英文好能看国外技术网站真好
发表于 2014-9-15 15:26 | 显示全部楼层
王与韩1 发表于 2014-9-15 15:18
谢谢,英文好能看国外技术网站真好

  1. (vlax-for a (vla-get-blocks (vla-get-ActiveDocument (vlax-get-acad-object)))
  2.   (if (= :vlax-true (vla-get-IsXRef a))
  3.     (princ "\n图形有外部参照...")
  4.     )
  5.   )
 楼主| 发表于 2014-9-15 16:42 | 显示全部楼层
Gu_xl 发表于 2014-9-15 15:26

多谢g版,都很好用
发表于 2020-2-1 23:07 | 显示全部楼层
好帖子,刚好有需要!
发表于 2024-3-27 17:34 | 显示全部楼层
本帖最后由 sandyvs 于 2024-3-27 18:27 编辑

G版,请教下,如何判断一个块是块参照还是外部参照啊?

找到一个,不知道可以不
(setq *adoc* (vla-get-activedocument (vlax-get-acad-object)))

(setq blk (car (entsel)))
(= :vlax-true (vla-get-isxref (vla-item (vla-get-blocks *adoc*) (cdr (assoc 2 (entget blk))))))

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

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-4-28 06:39 , Processed in 0.217100 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表