rami_9630 Posted March 16, 2010 Posted March 16, 2010 Hi guys, I'm looking for a lisp or macro that can select everything in the drawing without including XREF's in the selection Many thanks, Quote
Tommy78 Posted March 16, 2010 Posted March 16, 2010 I don't think you need a lisp for that, just lock the layers with the xrefs on them and press CTRL+A should work. Quote
rami_9630 Posted March 16, 2010 Author Posted March 16, 2010 it makes sense but hope i can find code and incorporate it in bottom so i can do it in just one click Quote
alanjt Posted March 16, 2010 Posted March 16, 2010 Perhaps something like this... (defun c:SAEX (/ #Str) ;; Select All Except XRefs; Alan J. Thompson, 03.16.10 (vl-load-com) (setq #Str "") (or *AcadDoc* (setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object)))) (vlax-for x (vla-get-filedependencies *AcadDoc*) (and (eq (vla-get-feature x) "Acad:XRef") (setq #Str (strcat #Str "," (vl-filename-base (vla-get-filename x)))) ) ;_ and ) ;_ vlax-for (sssetfirst nil (ssget "_X" (list (cons 410 (getvar 'ctab)) '(-4 . "<NOT") (cons 2 #Str) '(-4 . "NOT>"))) ) ;_ sssetfirst (princ) ) ;_ defun Quote
alanjt Posted March 16, 2010 Posted March 16, 2010 yes that's it, thanks a lot ! You're welcome. Enjoy. Quote
Lee Mac Posted March 16, 2010 Posted March 16, 2010 Nice method Alan - I haven't seen vla-get-filedependencies used too much.. More cat-skinning: (defun selx (/ blk xrefs) (while (setq blk (tblnext "BLOCK" (not blk))) (if (> (logand 4 (cdr (assoc 70 blk))) 0) (progn (setq name (cdr (assoc 2 blk)) xrefs (if xrefs (strcat xrefs "," name) name))))) (sssetfirst nil (ssget "X" (list '(0 . "INSERT") (cons 2 xrefs)))) (princ)) (defun selx (/ blk xrefs) (vl-load-com) (vlax-for blk (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) (if (eq :vlax-true (vla-get-isXref blk)) (setq xrefs (if xrefs (strcat xrefs "," (vla-get-Name blk)) (vla-get-Name blk))))) (sssetfirst nil (ssget "_X" (list (cons 0 "INSERT") (cons 2 xrefs)))) (princ)) Lee Quote
alanjt Posted March 16, 2010 Posted March 16, 2010 Thought it might be quicker than digging though the block definitions. BTW, it's supposed to ignore XRefs, not select only them. Nice method Alan - I haven't seen vla-get-filedependencies used too much.. More cat-skinning: (defun selx (/ blk xrefs) (while (setq blk (tblnext "BLOCK" (not blk))) (if (> (logand 4 (cdr (assoc 70 blk))) 0) (progn (setq name (cdr (assoc 2 blk)) xrefs (if xrefs (strcat xrefs "," name) name))))) (sssetfirst nil (ssget "X" (list '(0 . "INSERT") (cons 2 xrefs)))) (princ)) (defun selx (/ blk xrefs) (vl-load-com) (vlax-for blk (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) (if (eq :vlax-true (vla-get-isXref blk)) (setq xrefs (if xrefs (strcat xrefs "," (vla-get-Name blk)) (vla-get-Name blk))))) (sssetfirst nil (ssget "_X" (list (cons 0 "INSERT") (cons 2 xrefs)))) (princ)) Lee Quote
Lee Mac Posted March 16, 2010 Posted March 16, 2010 Thought it might be quicker than digging though the block definitions. BTW, it's supposed to ignore XRefs, not select only them. Hahaha! I read that as 'Select All Xref' Oh, well, I've provided the fish (or something like that)... Quote
alanjt Posted March 16, 2010 Posted March 16, 2010 Hahaha! I read that as 'Select All Xref' Oh, well, I've provided the fish (or something like that)... Close enough. :wink: Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.