In AutoCAD, through the Layer Prop开发者_JAVA百科erties Manager UI, a user can refresh the usage information for layers in a drawing. The information sometimes get stale when you have layers from xrefs. In your code, when you access the LayerTable
for a drawing, its records will not include those layers that it deems as unused (in the Layer Properties Manager UI grey status = unused, blue status = used). In order for me to get to those layers, my program first needs to refresh the usage information. Is there a way to do this through the .NET API, COM API, or the command line?
I'm also pursing an answer in parallel in the AutoCAD forums
http://forums.autodesk.com/t5/NET/Programmatically-refresh-layer-usage-information-NET/m-p/2794756
It seems that the problem was that one of the entities in the particular drawing was corrupt. When one of the users recreated the drawing (including re-adding some xrefs) and ran the program it worked just fine. I also double checked the code and it was definitely hitting the correct layers this time. I am however open to suggestions or solutions on how to detect corruption problems in AutoCAD drawings.
精彩评论