Jump to content

Recommended Posts

Posted

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,

Posted

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.

Posted

it makes sense but hope i can find code and incorporate it in bottom so i can do it in just one click

Posted

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

Posted
yes that's it, thanks a lot !

 

 

:) You're welcome. Enjoy.

Posted

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

Posted

:) 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

Posted
:) 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)... o:)

Posted
Hahaha! I read that as 'Select All Xref' :)

 

Oh, well, I've provided the fish (or something like that)... o:)

 

Close enough. :wink:

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...