马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
Entity.GeometricExtents throws an exception (eNullExtents) By Marat Mirgaleev
Issue
When I calculate the extents of entities in a drawing, for some entities an exception is thrown with the "eNullExtents" message. What is wrong?
Solution
This exception occurs for an insert of an empty block or for an empty block attribute. It is "as designed", it's just a notification to the developer about an empty object. An easy solution is to add a separate catch block for this particular exception:
 - Extents3d extents;
- try
- {
- extents = pEntity.GeometricExtents;
- }
- catch (Autodesk.AutoCAD.Runtime.Exception ex)
- {
- if (ex.Message == "eNullExtents")
- // The entity is empty and has no extents
- {
- // TODO. We can simply skip this entity...
- }
- else
- // something is wrong ...
- TODO!
- }
|