feat: 新增自由锻圆头与无圆头毛坯的绘图功能及相应的参数绘图面板。

This commit is contained in:
sladro 2026-02-24 09:44:20 +08:00
parent e5b3f5a747
commit f430e07b95
3 changed files with 18 additions and 22 deletions

View File

@ -288,21 +288,21 @@ namespace CadParamPluging.Cad
}
}
// 9. 硬度符号 - 从剖面底部引出
// 9. 硬度符号 - 从剖面右侧引出
var hardnessVal = bag.GetString(FeatureDrivenDrawer.KeyHardness);
if (!string.IsNullOrWhiteSpace(hardnessVal))
{
double xStart = (xSectionLeft + xSectionRight) / 2.0;
double yStart = oy;
double xStart = xSectionRight;
double yStart = oy + H * 0.25;
DrawHardnessSymbol(ctx, xStart, yStart);
}
// 10. 标刻内容引线 - 从剖面顶部引出
// 10. 标刻内容引线 - 从剖面左侧引出
var markingText = bag.GetString(FeatureDrivenDrawer.KeyMarkingContent);
if (!string.IsNullOrWhiteSpace(markingText))
{
double xTarget = (xSectionLeft + xSectionRight) / 2.0;
double yTarget = oy + H;
double xTarget = xSectionLeft;
double yTarget = oy + H * 0.75;
DrawSpecialHBLeaderToTop(ctx, xTarget, yTarget, markingText);
}
}

View File

@ -307,21 +307,21 @@ namespace CadParamPluging.Cad
}
}
// 9. 硬度符号 - 从剖面底部引出
// 9. 硬度符号 - 从剖面右侧引出
var hardnessVal = bag.GetString(FeatureDrivenDrawer.KeyHardness);
if (!string.IsNullOrWhiteSpace(hardnessVal))
{
double xStart = (xSectionLeft + xSectionRight) / 2.0;
double yStart = oy;
double xStart = xSectionRight;
double yStart = oy + H * 0.25;
DrawHardnessSymbol(ctx, xStart, yStart);
}
// 10. 标刻内容引线 - 从剖面顶部引出
// 10. 标刻内容引线 - 从剖面左侧引出
var markingText = bag.GetString(FeatureDrivenDrawer.KeyMarkingContent);
if (!string.IsNullOrWhiteSpace(markingText))
{
double xTarget = (xSectionLeft + xSectionRight) / 2.0;
double yTarget = oy + H;
double xTarget = xSectionLeft;
double yTarget = oy + H * 0.75;
DrawSpecialHBLeaderToTop(ctx, xTarget, yTarget, markingText);
}
}

View File

@ -179,22 +179,18 @@ namespace CadParamPluging.UI
s = s.Replace(" ", "").Replace("\u3000", "").Replace("", ":");
var parts = s.Split(':');
if (parts.Length != 2 || !string.Equals(parts[0], "1", StringComparison.OrdinalIgnoreCase))
if (parts.Length != 2)
{
throw new BusinessException("出图比例格式错误,应为 1:n例如 1:5");
throw new BusinessException("出图比例格式错误,应为 M:N例如 1:5 或 2:1");
}
if (!TryParseDouble(parts[1], out var denom) || denom < 1e-9)
if (!TryParseDouble(parts[0], out var num) || num < 1e-9 ||
!TryParseDouble(parts[1], out var denom) || denom < 1e-9)
{
throw new BusinessException("出图比例格式错误,应为 1:n例如 1:5");
throw new BusinessException("出图比例数值错误M和N必须为大于0的数字");
}
if (denom < 1.0)
{
throw new BusinessException("出图比例不支持放大n 必须 >= 1");
}
return 1.0 / denom;
return num / denom;
}
private static bool TryParseDouble(string s, out double value)