CadParamPluging/Tests/RingRollingNominalWallGeometryTests.cs

50 lines
1.9 KiB
C#

using System;
using System.IO;
public static class RingRollingNominalWallGeometryTests
{
public static int Main()
{
try
{
RollingDrawerUsesNominalWallForGeometry("Cad", "RingMachinedRollingDrawer.cs");
RollingDrawerUsesNominalWallForGeometry("Cad", "RingRawRollingDrawer.cs");
Console.WriteLine("Ring rolling nominal wall geometry tests passed.");
return 0;
}
catch (Exception ex)
{
Console.Error.WriteLine(ex.Message);
return 1;
}
}
private static void RollingDrawerUsesNominalWallForGeometry(params string[] pathParts)
{
var sourcePath = Path.Combine(pathParts);
var source = File.ReadAllText(sourcePath);
if (!source.Contains("var nominalWallThickness = (physicalOuterR - physicalInnerR);"))
{
throw new InvalidOperationException(sourcePath + ": rolling geometry must derive wall width from nominal outer/inner diameters.");
}
if (!source.Contains("visualInnerR = nominalWallThickness * 2.0;") ||
!source.Contains("visualOuterR = nominalWallThickness * 3.0;"))
{
throw new InvalidOperationException(sourcePath + ": rolling schematic geometry must use nominal wall thickness for 2:1 hole/wall visual ratio.");
}
if (source.Contains("visualInnerR = minWallThkParam.Value * 2.0;") ||
source.Contains("visualOuterR = minWallThkParam.Value * 3.0;"))
{
throw new InvalidOperationException(sourcePath + ": rolling geometry must not use tolerance-adjusted MinWallThickness.");
}
if (!source.Contains("FeatureDrivenDrawer.DrawMinWallThicknessNote(ctx, xInnerRight.Value, ox + visualOuterR, oy, minWallThickness.Value"))
{
throw new InvalidOperationException(sourcePath + ": rolling Tmin annotation must continue to display MinWallThickness.");
}
}
}