Jump to content

Selection Sets for AECObjects


MiGo

Recommended Posts

I use selection sets to get all of objects like dimensions, circles, images, inserts... How does one get a selection set of all AECObjects in a drawing? Objects like windows walls doors that are drawn with AutoCAD architectural.

Link to comment
Share on other sites

What return do you get when you click on it with this?

 

(defun c:en (/ Obj eNxt)
 (if (setq Obj (car (entsel "\nSelect Object: ")))
   (progn (textscr)
     (foreach x (entget Obj)
       (print x))
     (if (setq eNxt (entnext Obj))
       (while (not (eq "SEQEND" (cdadr (entget eNxt))))
         (princ "\n\nSub:\n")
         (foreach x (entget eNxt)
           (print x)) (setq eNxt (entnext eNxt)))))) (princ))

Link to comment
Share on other sites

I use (entget (car (entsel))) to get all the data for an AEC object to help set up selection set filters. Just paste it into the command line and select the object.

Link to comment
Share on other sites

As part of my ever growing script to the client, they don't want any AECObjects in the drawing because they have problems using their older version. As of now we just use an E-transmit with the first drawing in the package open, and add all drawings in the project to that list. In the E-transmit settings we have it Bind the External References, and explode AECObjects. The problem is this is another step that the user has to go through and wait for it to finish, so I'm trying to have my script bind the external references, then after bursting the block representing the external reference I will get all of the AECObjects and explode them to simulate what an E-transmit would do. I have tried actually running E-transmit on the drawing via the script, but it creates another drawing in another directory then I have to find it then it wasn't bound... and that was just too annoying for me.

 

The (setq ss (ssget "X" '((0 . "AEC*")))) works great to select all of the AECObjects because they all start with AEC then it's _NAME (like wall door window...).

Link to comment
Share on other sites

Well the exploding of the AECObjects worked on the drawing that I have open, but I haven't put together the binding section with the AECObject section as a whole into the script yet. I will let you know tho.

Link to comment
Share on other sites

Is there a way when in modelspace to have a selection set get all of external references like (setq ss (ssget "x" '((0 . "xref"))))?

Link to comment
Share on other sites

Is there a way when in modelspace to have a selection set get all of external references like (setq ss (ssget "x" '((0 . "xref"))))?

needed this a while back for a routine.

 

;;; List of Xref Names
;;; xref retreival credit: Tim Willey
;;; written by: Alan J. Thompson, 3.16.09
 (defun XrefNameList (/ #list)
   (vlax-for i (vla-get-filedependencies
                 (vla-get-activedocument (vlax-get-acad-object))
               ) ;_ vla-get-filedependencies
     (if (= (vla-get-feature i) "Acad:XRef")
       (setq
         #list (cons (vl-filename-base (vla-get-filename i)) #list)
       ) ;_ setq
     ) ;_ if
   ) ;_ vlax-for
   (vl-sort #list '<)
 ) ;_ defun

Link to comment
Share on other sites

actually, i guess you'd want something more like this:

;;; String of Xref Names
;;; xref retreival credit: Tim Willey
;;; written by: Alan J. Thompson, 04.22.09
(defun XrefNameString (/ #list #String)
 (setq #String "")
 (vlax-for i (vla-get-filedependencies
               (vla-get-activedocument (vlax-get-acad-object))
             ) ;_ vla-get-filedependencies
   (if (= (vla-get-feature i) "Acad:XRef")
     (setq #String (strcat (vl-filename-base (vla-get-filename i))
                           ","
                           #String
                   ) ;_ strcat
     ) ;_ setq
   ) ;_ if
 ) ;_ vlax-for
 (substr #String 1 (1- (strlen #String)))
) ;_ defun

(setq ss (ssget "_X" '((cons 2 (XrefNameString)))))

Link to comment
Share on other sites

I have made a lisp out of your text and loaded it, but when i type xrefnamelist I get an error

add (vl-load-com) to it

i never add this because it's in my startup.

Link to comment
Share on other sites

Another method, if you prefer the DXF way:

 

[b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] selx  [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] blk xrefs[b][color=RED])[/color][/b]
 [b][color=RED]([/color][/b][b][color=BLUE]while[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] blk [b][color=RED]([/color][/b][b][color=BLUE]tblnext[/color][/b] [b][color=MAGENTA]"BLOCK"[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]not[/color][/b] blk[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]
   [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]>[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]logand[/color][/b] 4 [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] 70 blk[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] 0[b][color=RED])[/color][/b]
     [b][color=RED]([/color][/b][b][color=BLUE]progn[/color][/b]
       [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] name  [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] 2 blk[b][color=RED])[/color][/b][b][color=RED])[/color][/b]
             xrefs [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] xrefs [b][color=RED]([/color][/b][b][color=BLUE]strcat[/color][/b] xrefs [b][color=MAGENTA]","[/color][/b] name[b][color=RED])[/color][/b] name[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]
 [b][color=RED]([/color][/b][b][color=BLUE]ssget[/color][/b] [b][color=MAGENTA]"X"[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]list[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b]0 . [b][color=MAGENTA]"INSERT"[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][color=Blue]cons[/color][/b] 2 xrefs[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]

Link to comment
Share on other sites

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...