diff --git a/src/CAD/IFox.CAD.Shared/ExtensionMethod/Entity/BoundingInfo.cs b/src/CAD/IFox.CAD.Shared/ExtensionMethod/Entity/BoundingInfo.cs index bf10c2ed46acf934c25ef87fd1de125622b7f4ab..146cd904618c31b4e8403d8b018b60fe75bf6975 100644 --- a/src/CAD/IFox.CAD.Shared/ExtensionMethod/Entity/BoundingInfo.cs +++ b/src/CAD/IFox.CAD.Shared/ExtensionMethod/Entity/BoundingInfo.cs @@ -90,19 +90,23 @@ public struct BoundingInfo #endregion /// - /// 高 + /// 高 y增量 /// - public readonly double Height => Math.Abs(MaxX - MinX); + public readonly double Height => MaxY > MinY ? MaxY - MinY : 0; /// - /// 宽 + /// 宽 x增量 /// - public readonly double Width => Math.Abs(MaxY - MinY); + public readonly double Width => MaxX > MinX ? MaxX - MinX : 0; /// /// 面积 /// public readonly double Area => Height * Width; + /// + /// 是否有效 + /// + public readonly bool IsEffective => MinX <= MaxX; /// /// 3D包围盒 diff --git a/src/CAD/IFox.CAD.Shared/ExtensionMethod/Entity/EntityBoundingInfo.cs b/src/CAD/IFox.CAD.Shared/ExtensionMethod/Entity/EntityBoundingInfo.cs index 43c4f31e8558f454df8d1a67f2a5883a5dcc91da..53628f36160f6f6dfc8d89fbedf4f86ae34329ca 100644 --- a/src/CAD/IFox.CAD.Shared/ExtensionMethod/Entity/EntityBoundingInfo.cs +++ b/src/CAD/IFox.CAD.Shared/ExtensionMethod/Entity/EntityBoundingInfo.cs @@ -98,7 +98,6 @@ static void GetBlockBox(this Entity en, ref Extents3d ext, ref Matrix3d mat) if (block.BlockTableRecord.GetObject() is BlockTableRecord btr) foreach (ObjectId id in btr) { - id.GetObject(); if (id.GetObject() is Entity ent1) { if (ent1.Visible != true) @@ -233,7 +232,7 @@ public static Point3d[] GetMTextBoxCorners(this MText mtext) { if (ent is BlockReference block) { - Extents3d blockExt = default; + Extents3d blockExt = new Extents3d(); var mat = Matrix3d.Identity; block!.GetBlockBox(ref blockExt, ref mat); if (blockExt.IsEmptyExt())