(setq bks (ssget '((0 . "INSERT")))) ;
Hello guys .yes. you need to create BlockNameFilter function:
Is there a way to not select Xref blocks with the ssget function ?Code: [Select](setq bks (ssget '((0 . "INSERT")))) ;
Thanks in advance :)
(ssget (list (cons 0 "INSERT") (cd:009_BlockNameFilter)))
(defun cd:009_BlockNameFilter ()
(cons 2 (strcat "`*U*," (cd:STR_ReParse (cd:SYS_CollList "BLOCK" (+ 2 4) ",")))
)
it is a part of this program:(defun _foo (/ b fltr)
(setq fltr "")
(while (setq b (tblnext "block" (not b)))
(and (assoc 1 b) (setq fltr (strcat "~" (cdr (assoc 2 b)) "," fltr)))
)
(if (zerop (strlen fltr))
"*"
fltr
)
)
(setq bks (ssget "_X" (list '(0 . "INSERT") (cons 2 (_foo)))))
(defun c:ss~xref ( / ss adoc blks l )
(vl-load-com)
(setq adoc (vla-get-activedocument (vlax-get-acad-object)))
(setq blks (vla-get-blocks adoc))
(vlax-for item blks
(if (eq (vla-get-isxref item) :vlax-true)
(progn
(setq l (cons (list item (vl-catch-all-apply 'vla-get-xrefdatabase (list item))) l))
(vla-unload item)
)
)
)
(setq ss (ssget '((0 . "INSERT"))))
(foreach item l
(if (eq (type (cadr item)) 'vla-object)
(vla-reload (car item))
)
)
(sssetfirst nil ss)
(princ)
)
Thank you kruuger for your help .
I lost with all these options that you posted :oops:
Can you please clarify ?
"BL1,BL2,BL4"
and this one pass to ssget(ssget (list (cons 0 "INSERT") (cons 2 "BL1,BL2,BL4")))
k.
(defun _foo (/ b fltr)
(setq fltr "")
(while (setq b (tblnext "block" (not b)))
(and (assoc 1 b) (setq fltr (strcat (cdr (assoc 2 b)) "," fltr)))
)
fltr
)
(setq bks (ssget "_X" (list '(0 . "INSERT") '(-4 . "<NOT") (cons 2 (_foo)) '(-4 . "NOT>"))))
ribarm your codes unloaded one xref only to allow me to select blocks but the other xrefblocks didn't unloaded and they included with the selection .
(defun c:ss~xref ( / ss adoc blks )
(vl-load-com)
(setq adoc (vla-get-activedocument (vlax-get-acad-object)))
(vla-startundomark adoc)
(setq blks (vla-get-blocks adoc))
(vlax-for item blks
(if (eq (vla-get-isxref item) :vlax-true)
(vla-unload item)
)
)
(setq ss (ssget '((0 . "INSERT"))))
(command "_.undo" "")
(sssetfirst nil ss)
(princ)
)
(defun c:ss~xref ( / ss adoc )
(vl-load-com)
(setq adoc (vla-get-activedocument (vlax-get-acad-object)))
(vla-startundomark adoc)
(command "_.-xref" "u" "*")
(setq ss (ssget '((0 . "INSERT"))))
(command "_.undo" "")
(sssetfirst nil ss)
(princ)
)
I would follow a similar route to Ron, but would probably write it like this:Code - Auto/Visual Lisp: [Select]
Ron, note that your code will not select anything if there are no xrefs present in the drawing ;)
I wonder why the ~name1,~name2 filter would not work?