Jump to content

Reload and Bind Xref's Question


Recommended Posts

what I'm trying to do is, Check if there any (not found, or not resolved Xref's Proceed to Bind) If their Xrefs need to reload (Reload them) and then Bind all resolved Xrefs.

ObjectIdCollection btrCol = new ObjectIdCollection();
                    XrefGraph xrgraph = doc.Database.GetHostDwgXrefGraph(false);
                    db.ResolveXrefs(true, false);
                    for (int i = 1; i < (xrgraph.NumNodes); i++)
                        XrefGraphNode xrNode = xrgraph.GetXrefNode(i);                        
                        switch (xrNode.XrefStatus)
                            case XrefStatus.Resolved:
                            case XrefStatus.Unloaded:
                            case XrefStatus.FileNotFound:
                            case XrefStatus.NotAnXref:
                            case XrefStatus.Unreferenced:
                        if (btrCol.Count > 0)
                            db.BindXrefs(btrCol, true);

In debug mode, the code going well and I check the ObjectIdCollection,

 and it contains the target Xrefs and voids the (unresolved) Xref's as I need. But not Bind or Reload.

the conclusion is:

I need the code to Reload all Xref's need to reload. then Bind all. regardless any Xref's (Not Found, Not an Xref, etc...)

as the attached lisp.

(defun c:bindloaded(/ cObj cName)
  (setq cObj(tblnext "BLOCK" T))
  (while cObj
    (setq cName(cdr(assoc 2 cObj)))
	 (=(logand(cdr(assoc 70 cObj))32)32)
	 (=(logand(cdr(assoc 70 cObj))4)4)
	 ); end and
       (vl-cmdf "bindtype" "1")
       (vl-cmdf "_.xref" "_unload" cName)
       (vl-cmdf "_.xref" "_reload" cName)
       (vl-cmdf "_.xref" "_bind" cName)
       ); end progn
      ); wnd if
  (setq cObj(tblnext "BLOCK"))
  ); end while
  ); end of c:bindloaded

thanks in advance.

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.

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