bkkar_55 Posted January 20, 2019 Posted January 20, 2019 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: btrCol.Add(xrNode.BlockTableRecordId); break; case XrefStatus.Unloaded: btrCol.Add(xrNode.BlockTableRecordId); break; case XrefStatus.FileNotFound: break; case XrefStatus.NotAnXref: break; case XrefStatus.Unreferenced: break; } } try { if (btrCol.Count > 0) { db.ReloadXrefs(btrCol); 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))) (if (and (=(logand(cdr(assoc 70 cObj))32)32) (=(logand(cdr(assoc 70 cObj))4)4) ); end and (progn (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 (princ) ); end of c:bindloaded thanks in advance. Quote
Recommended Posts
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.