Method of testing for XREFS

Discussion in 'AutoCAD' started by Chris Shoemaker, Jun 29, 2004.

  1. I've been working on a short script to save down ABS drawings into 2000
    format, including the explosion on all AEC objects using the -AecObjExplode
    command. My question is, do you know of any method to test for the existance
    of attached xrefs in a drawing? The problem I'm having is the prompts change
    in -AecObjExplode depending on if xrefs are attached, breaking the script.
    If I could test for the presense of attached xrefs before hand, I could just
    use a conditional statement. Anyone have any ideas?

    -Chris

    Thus far:

    (command "tilemode" "1")
    (command "_-AecObjExplode" "yes" "all" "no" "no" "yes" "yes" "yes" "yes"
    "31" "no" "yes")
    (command "tilemode" "0")
    scr-saveas-2000
     
    Chris Shoemaker, Jun 29, 2004
    #1
  2. Chris Shoemaker

    randy benson Guest

    You could adapt this:

    ; ListXrefs - well, it lists all xrefs w/full paths

    (defun c:lx ( / ss cnt xrs en ed cnt bn xp)
    (setq ss (ssget "x" '((0 . "INSERT")))
    cnt 0
    xrs (list)
    )
    (while (< cnt (sslength ss))
    (setq en (ssname ss cnt)
    ed (entget en)
    cnt (1+ cnt)
    bn (dxf 2 ed)
    )
    (if (/= 0 (logand 12 (dxf 70 (tblsearch "BLOCK" bn)))); is an Xref?
    (progn
    (setq xp (dxf 1 (entget (tblobjname "block" bn)))
    xrs (cons (cons bn xp) xrs)
    )

    )
    )
    )
    (foreach n xrs (princ (strcat "\n" (car n) " " (cdr n))))
    (princ)
    )
     
    randy benson, Jun 29, 2004
    #2
  3. Thanks Randy. Not to be a bother, but would you be able to provide the dxf
    function as well? When stepping though it I get a "; error: no function
    definition: DXF" error. Thanks.

    -Chris
     
    Chris Shoemaker, Jul 6, 2004
    #3
  4. (defun dxf (i a) (cdr (assoc i a)))

    --
    R. Robert Bell


    Thanks Randy. Not to be a bother, but would you be able to provide the dxf
    function as well? When stepping though it I get a "; error: no function
    definition: DXF" error. Thanks.

    -Chris
     
    R. Robert Bell, Jul 7, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.