简体   繁体   中英

Programmatically refresh layer usage information

In AutoCAD, through the Layer Properties 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/mp/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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM