Files
kompas3d-mcp/tests/Kompas.Mcp.Tests/Integration/FeatureOpsTests.cs
T
mikhail fef0741eef fix(feature): правки shell по ревью Codex
- сообщение shell считает грани после дедупликации (Distinct)
- тест переименован (open_cap) + комментарий о симметрии торцов
- RCW-долг транзитов shell задокументирован в OPEN_QUESTIONS v2-2

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 22:31:59 +03:00

52 lines
2.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Kompas.Mcp.Core.Documents;
using Kompas.Mcp.Core.Modeling;
using Kompas.Mcp.Core.Query;
namespace Kompas.Mcp.Tests.Integration;
/// <summary>Интеграция: формообразующие операции пакета B.</summary>
[Trait("Category", "Integration")]
[Collection(KompasCollection.Name)]
public sealed class FeatureOpsTests
{
private readonly DocumentService _docs;
private readonly PartModeler _modeler;
private readonly QueryService _query;
public FeatureOpsTests(KompasFixture fx)
{
_docs = new DocumentService(fx.Session, fx.Dispatcher);
_modeler = new PartModeler(fx.Session, fx.Dispatcher);
_query = new QueryService(fx.Session, fx.Dispatcher);
}
[Fact]
public async Task Shell_box_hollows_with_open_cap()
{
await _docs.CreateAsync(KompasDocumentType.Part);
try
{
// Коробка 40×30×20.
var s = await _modeler.OpenSketchAsync(BasePlane.XOY);
await _modeler.AddRectangleAsync(s, 0, 0, 40, 30);
await _modeler.CloseSketchAsync(s);
await _modeler.ExtrudeAsync(s, depth: 20);
var before = (await _query.GetPartInfoAsync()).Volume; // 24000
// Удаляем один из двух плоских торцов (площадь 40×30=1200) → открытая оболочка.
// Какой именно торец (верх/низ) — для объёма не важно: результат симметричен.
var faces = await _query.ListFacesAsync();
var cap = faces.First(f => f.Type == "plane" && Math.Abs(f.Area - 1200) < 1);
var id = await _modeler.ShellAsync(new[] { cap.Index }, thickness: 2, outward: false);
Assert.True(id > 0);
await _modeler.RebuildAsync();
// Оболочка 2 мм с открытым торцом: 24000 36×26×18 = 7152 мм³.
var after = (await _query.GetPartInfoAsync()).Volume;
Assert.True(after < before, "После оболочки объём должен уменьшиться.");
Assert.InRange(after, 7152 * 0.95, 7152 * 1.05);
}
finally { await _docs.CloseAsync(save: false); }
}
}