把图纸中的所有外部参照选中
在autodesk community看到一个把所有普通块选中的程序,我想把所有外部参照选中,怎么写呢?(setq objs (ssadd))(mapcar '(lambda (h)(if (not(vlax-property-available-p(vlax-ename->vla-object h)'path))(ssadd h objs)))(mapcar 'cadr (ssnamex (ssget "_x" '((0 . "INSERT"))))))
有无测试图呀????? 自贡黄明儒 发表于 2016-10-11 13:39
有无测试图呀?????
图纸中包含普通块以及外部参照的块,用ssget 会把他们都选出来,我想单独把所有的外部参照选中,不需要测试图吧~ 顶起来,我需要选中块,正相反。。。。
用二楼黄大师的就行啦。
;;40 [功能] XRef图块列表 a list of all xref names
;;返回示例("xref1" "x2")
(defun MJ:xrefs (/ b bn tl)
(vlax-for b (vla-get-blocks *DOC*)
(if (= (vla-get-isxref b) :vlax-true)
(setq tl (cons (vla-get-name b) tl))
)
)
(reverse tl)
)
附上黄大师的函数
(setq *En2Obj*vlax-ename->vla-object
*Obj2En*vlax-vla-object->ename
*2PI* (* PI 2)
*0.5PI* (/ PI 2)
*0.25PI*(/ PI 4)
;;常用VLA对象、集合
*ACAD*(vlax-get-acad-object)
*DOC* (vla-get-ActiveDocument *ACAD*)
*DOCS*(vla-get-Documents *ACAD*)
*MS* (vla-get-modelSpace *DOC*)
*PS* (vla-get-paperSpace *DOC*)
*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*)
*VPS* (vla-get-Viewports *DOC*)
*VS* (vla-get-Views *DOC*)
*DICS*(vla-get-Dictionaries *DOC*)
;;常用的几个外部接口对象
*FSO* (vlax-get-or-create-object "Scripting.FileSystemObject")
*WSH* (vlax-get-or-create-object "wscript.shell")
*SHELL* (vlax-get-or-create-object "Shell.Application")
*SCR* (vlax-get-or-create-object "ScriptControl")
*WBEM*(vlax-get-or-create-object "WbemScripting.SWbemLocator")
) 可以把外部参照归置一个图层,按图层选定即可,我的主题里有
页:
[1]