My company has a client we do many projects for and their CAD standards do not allow nested XRefs or attached XRefs.
I'm writing a routine in which I iterate through the block table with tblsearch and check all XRef's by bit-masking the DXF 70 value for 'resolved' (bit-mask 32) and 'overlay' (bit-mask 8 ). If it is resolved and not an overlay, then I check with ssget to see if there are any instances in the dwg. If not, then I assume it's nested. Not very elegant. I read a post that said a bit mask of 64 in the DXF 70 value means it's nested but this doesn't seem to be the case. Is there a better way to directly check an XRef's status for being nested? (Hopefully with Visual LISP but AutoLISP is OK.)
Also, is there any way to change an attached XRef into an overlay in Visual LISP or AutoLISP?
Lastly, in working on this routine, I noticed that when I erase an XRef in a session, causing it to become unreferenced, the next time I open the dwg, the unreferenced XRef has been removed. Is this how AutoCAD is supposed to work? (I'm using AutoCAD 2018 ) I don't have a problem with this, I just need to know if I can depend on this behaviour when the client gets the drawings.
As always, any help is greatly appreciated.