32 flag of group 70 not set for "not found" xref??

Discussion in 'AutoCAD' started by James Maeding, Oct 14, 2004.

  1. Everyone knows to check the 70 dxf group for xref loaded/unloaded status.
    I thought I had this nailed but not so.
    I am working on a drawing with 1 xref "not found" and 3 unloaded xrefs.
    The dxf of the 70 group from block table gives me 12 on all of them.

    here is the code I am dealing with, simple stuff.
    I put a debug watch on the (CDR (ASSOC 70 SS)) to keep an eye on that expression, its 12 every time.

    (WHILE (SETQ SS (TBLNEXT "BLOCK" (NULL SS)))
    (IF (EQ 4 (LOGAND 4 (CDR (ASSOC 70 SS))))
    (SETQ XREF-LIST (CONS (CDR (ASSOC 2 SS)) XREF-LIST))
    )
    )

    What is up with this?
    How can I check (with lisp or VBA) if the xrefs listed in the xref dialog are loaded or found?
    thanks
    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Oct 14, 2004
    #1
  2. I hate to say it but I think I read the dxf help wrong, the 32 flag gets set for RESOLVED xrefs, which of course 12
    indicates they are not resolved, which agrees with what I am seeing.

    Like Spock says, when the logical explanations do not work, consider the illogical (operator error...)

    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Oct 14, 2004
    #2
  3. James Maeding

    T.Willey Guest

    James,

    Here is my X-Ref checking routine, I haven't had any problems with it yet, so you can see if it works for you.

    Tim

    (defun c:xr-check(/ tbl1 bname btype btype2 bpath bpath2 blist blist2 cnt1 cnt2 cnt3 op1 op2 cmd1 bdwg olderr)
    ;
    (command "_.undo" "_end")
    (command "_.undo" "_group")
    (setq olderr *error* *error* xr-err)
    (setq cmd1 (getvar "cmdecho"))
    (setvar "cmdecho" 0)
    (setq cnt1 T)
    (while (setq tbl1 (tblnext "block" cnt1))
    (if (setq bpath (cdr (assoc 1 tbl1)))
    (progn
    (setq bname (cdr (assoc 2 tbl1)))
    (if (= (logand 32 (cdr (assoc 70 tbl1))) 0)
    (if (findfile bpath)
    (progn
    (setq btype "Unloaded")
    (setq blist (append blist (list bname)))
    (setq cnt2 "Yes")
    )
    (progn
    (setq btype (strcat "Not-Found (Can't find drawing file \"" bname "\")"))
    (setq blist2 (append blist2 (list bname)))
    (setq cnt3 "Yes")
    )
    )
    (setq btype "Loaded")
    )
    (if (= (logand 8 (cdr (assoc 70 tbl1))) 0)
    (setq btype2 "Attach")
    (setq btype2 "Overlay")
    )
    (princ (strcat "\n" bname " - " btype2 " - " btype))
    )
    )
    (if cnt1 (setq cnt1 nil))
    )
    (if (not btype)
    (princ "\n No Xref in drawing. ")
    (textpage)
    )
    (if (= cnt2 "Yes")
    (progn
    (initget "Y N")
    (setq op1 (getkword "\nWould you like to reload all \"Unloaded\" xrefs [<Y>,N]? "))
    (if op1
    (setq op1 (strcase op1))
    (setq op1 "Y")
    )
    (if (= op1 "Y")
    (foreach item blist
    (command "_.xref" "_r" item)
    )
    )
    )
    )
    (if (= cnt3 "Yes")
    (progn
    (initget "Y N")
    (setq op2 (getkword "\nWould you like to fix \"Not-Found\" xref paths (one at a time) [<Y>,N]? "))
    (if op2
    (setq op2 (strcase op2))
    (setq op2 "Y")
    )
    (if (= op2 "Y")
    (progn
    (graphscr)
    (if (not bpath2)
    (setq bpath2 "H:\\")
    )
    (foreach item blist2
    (if (setq bdwg (getfiled (strcat "Select file \""item"\"") bpath2 "dwg" 16))
    (progn
    (setq bpath2 (vl-filename-directory bdwg))
    (command "_.xref" "_p" item bdwg)
    )
    )
    )
    )
    )
    )
    )
    (command "_.undo" "_end")
    (setvar "cmdecho" cmd1)
    (princ)
    )
     
    T.Willey, Oct 14, 2004
    #3
  4. Thanks

    "T.Willey" <>
    |>James,
    |>
    |> Here is my X-Ref checking routine, I haven't had any problems with it yet, so you can see if it works for you.
    |>
    |>Tim
    |>
    |>(defun c:xr-check(/ tbl1 bname btype btype2 bpath bpath2 blist blist2 cnt1 cnt2 cnt3 op1 op2 cmd1 bdwg olderr)
    |>;
    |>(command "_.undo" "_end")
    |>(command "_.undo" "_group")
    |>(setq olderr *error* *error* xr-err)
    |>(setq cmd1 (getvar "cmdecho"))
    |>(setvar "cmdecho" 0)
    |>(setq cnt1 T)
    |>(while (setq tbl1 (tblnext "block" cnt1))
    |> (if (setq bpath (cdr (assoc 1 tbl1)))
    |> (progn
    |> (setq bname (cdr (assoc 2 tbl1)))
    |> (if (= (logand 32 (cdr (assoc 70 tbl1))) 0)
    |> (if (findfile bpath)
    |> (progn
    |> (setq btype "Unloaded")
    |> (setq blist (append blist (list bname)))
    |> (setq cnt2 "Yes")
    |> )
    |> (progn
    |> (setq btype (strcat "Not-Found (Can't find drawing file \"" bname "\")"))
    |> (setq blist2 (append blist2 (list bname)))
    |> (setq cnt3 "Yes")
    |> )
    |> )
    |> (setq btype "Loaded")
    |> )
    |> (if (= (logand 8 (cdr (assoc 70 tbl1))) 0)
    |> (setq btype2 "Attach")
    |> (setq btype2 "Overlay")
    |> )
    |> (princ (strcat "\n" bname " - " btype2 " - " btype))
    |> )
    |> )
    |> (if cnt1 (setq cnt1 nil))
    |>)
    |>(if (not btype)
    |> (princ "\n No Xref in drawing. ")
    |> (textpage)
    |>)
    |>(if (= cnt2 "Yes")
    |> (progn
    |> (initget "Y N")
    |> (setq op1 (getkword "\nWould you like to reload all \"Unloaded\" xrefs [<Y>,N]? "))
    |> (if op1
    |> (setq op1 (strcase op1))
    |> (setq op1 "Y")
    |> )
    |> (if (= op1 "Y")
    |> (foreach item blist
    |> (command "_.xref" "_r" item)
    |> )
    |> )
    |> )
    |>)
    |>(if (= cnt3 "Yes")
    |> (progn
    |> (initget "Y N")
    |> (setq op2 (getkword "\nWould you like to fix \"Not-Found\" xref paths (one at a time) [<Y>,N]? "))
    |> (if op2
    |> (setq op2 (strcase op2))
    |> (setq op2 "Y")
    |> )
    |> (if (= op2 "Y")
    |> (progn
    |> (graphscr)
    |> (if (not bpath2)
    |> (setq bpath2 "H:\\")
    |> )
    |> (foreach item blist2
    |> (if (setq bdwg (getfiled (strcat "Select file \""item"\"") bpath2 "dwg" 16))
    |> (progn
    |> (setq bpath2 (vl-filename-directory bdwg))
    |> (command "_.xref" "_p" item bdwg)
    |> )
    |> )
    |> )
    |> )
    |> )
    |> )
    |>)
    |>(command "_.undo" "_end")
    |>(setvar "cmdecho" cmd1)
    |>(princ)
    |>)

    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Oct 15, 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.