diff --git a/src/Kompas.Mcp.Core/Modeling/PartModeler.Sketch.cs b/src/Kompas.Mcp.Core/Modeling/PartModeler.Sketch.cs index 01adf8c..9062646 100644 --- a/src/Kompas.Mcp.Core/Modeling/PartModeler.Sketch.cs +++ b/src/Kompas.Mcp.Core/Modeling/PartModeler.Sketch.cs @@ -93,7 +93,8 @@ public sealed partial class PartModeler ?? throw new InvalidOperationException("GetDefinition() эскиза вернул не ksSketchDefinition."); def.SetPlane(planeEntity); - entity.Create(); + if (!entity.Create()) + throw new InvalidOperationException("Create() эскиза вернул FALSE."); var editor = def.BeginEdit() as ksDocument2D ?? throw new InvalidOperationException("BeginEdit() не вернул ksDocument2D."); diff --git a/src/Kompas.Mcp.Host/Tools/FeatureTools.cs b/src/Kompas.Mcp.Host/Tools/FeatureTools.cs index 4bea927..8772cbf 100644 --- a/src/Kompas.Mcp.Host/Tools/FeatureTools.cs +++ b/src/Kompas.Mcp.Host/Tools/FeatureTools.cs @@ -130,7 +130,8 @@ public sealed class FeatureTools(KompasSession session, PartModeler modeler) { await session.ConnectAsync(); var id = await modeler.LoftAsync(sketchIds, closed); - return $"Операция по сечениям создана ({sketchIds.Length} сечений), id={id}."; + var sections = sketchIds?.Distinct().Count() ?? 0; + return $"Операция по сечениям создана ({sections} сечений), id={id}."; } [McpServerTool(Name = "rebuild")] diff --git a/tests/Kompas.Mcp.Tests/Integration/FeatureOpsTests.cs b/tests/Kompas.Mcp.Tests/Integration/FeatureOpsTests.cs index 33a8de2..e74662f 100644 --- a/tests/Kompas.Mcp.Tests/Integration/FeatureOpsTests.cs +++ b/tests/Kompas.Mcp.Tests/Integration/FeatureOpsTests.cs @@ -156,6 +156,12 @@ public sealed class FeatureOpsTests var v = (await _query.GetPartInfoAsync()).Volume; // 20×20×40 = 16000 Assert.InRange(v, 16000 * 0.9, 16000 * 1.1); + + // Габарит подтверждает соединение сечений по высоте: ≈20×20×40. + var box = await _query.GetBoundingBoxAsync(); + Assert.InRange(box.SizeX, 20 * 0.95, 20 * 1.05); + Assert.InRange(box.SizeY, 20 * 0.95, 20 * 1.05); + Assert.InRange(box.SizeZ, 40 * 0.95, 40 * 1.05); } finally { await _docs.CloseAsync(save: false); } }