feat: 新增自由锻圆头与无圆头毛坯的绘图功能及相应的参数绘图面板。
This commit is contained in:
parent
e5b3f5a747
commit
f430e07b95
@ -288,21 +288,21 @@ namespace CadParamPluging.Cad
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 9. 硬度符号 - 从剖面底部引出
|
// 9. 硬度符号 - 从剖面右侧引出
|
||||||
var hardnessVal = bag.GetString(FeatureDrivenDrawer.KeyHardness);
|
var hardnessVal = bag.GetString(FeatureDrivenDrawer.KeyHardness);
|
||||||
if (!string.IsNullOrWhiteSpace(hardnessVal))
|
if (!string.IsNullOrWhiteSpace(hardnessVal))
|
||||||
{
|
{
|
||||||
double xStart = (xSectionLeft + xSectionRight) / 2.0;
|
double xStart = xSectionRight;
|
||||||
double yStart = oy;
|
double yStart = oy + H * 0.25;
|
||||||
DrawHardnessSymbol(ctx, xStart, yStart);
|
DrawHardnessSymbol(ctx, xStart, yStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 10. 标刻内容引线 - 从剖面顶部引出
|
// 10. 标刻内容引线 - 从剖面左侧引出
|
||||||
var markingText = bag.GetString(FeatureDrivenDrawer.KeyMarkingContent);
|
var markingText = bag.GetString(FeatureDrivenDrawer.KeyMarkingContent);
|
||||||
if (!string.IsNullOrWhiteSpace(markingText))
|
if (!string.IsNullOrWhiteSpace(markingText))
|
||||||
{
|
{
|
||||||
double xTarget = (xSectionLeft + xSectionRight) / 2.0;
|
double xTarget = xSectionLeft;
|
||||||
double yTarget = oy + H;
|
double yTarget = oy + H * 0.75;
|
||||||
DrawSpecialHBLeaderToTop(ctx, xTarget, yTarget, markingText);
|
DrawSpecialHBLeaderToTop(ctx, xTarget, yTarget, markingText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -307,21 +307,21 @@ namespace CadParamPluging.Cad
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 9. 硬度符号 - 从剖面底部引出
|
// 9. 硬度符号 - 从剖面右侧引出
|
||||||
var hardnessVal = bag.GetString(FeatureDrivenDrawer.KeyHardness);
|
var hardnessVal = bag.GetString(FeatureDrivenDrawer.KeyHardness);
|
||||||
if (!string.IsNullOrWhiteSpace(hardnessVal))
|
if (!string.IsNullOrWhiteSpace(hardnessVal))
|
||||||
{
|
{
|
||||||
double xStart = (xSectionLeft + xSectionRight) / 2.0;
|
double xStart = xSectionRight;
|
||||||
double yStart = oy;
|
double yStart = oy + H * 0.25;
|
||||||
DrawHardnessSymbol(ctx, xStart, yStart);
|
DrawHardnessSymbol(ctx, xStart, yStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 10. 标刻内容引线 - 从剖面顶部引出
|
// 10. 标刻内容引线 - 从剖面左侧引出
|
||||||
var markingText = bag.GetString(FeatureDrivenDrawer.KeyMarkingContent);
|
var markingText = bag.GetString(FeatureDrivenDrawer.KeyMarkingContent);
|
||||||
if (!string.IsNullOrWhiteSpace(markingText))
|
if (!string.IsNullOrWhiteSpace(markingText))
|
||||||
{
|
{
|
||||||
double xTarget = (xSectionLeft + xSectionRight) / 2.0;
|
double xTarget = xSectionLeft;
|
||||||
double yTarget = oy + H;
|
double yTarget = oy + H * 0.75;
|
||||||
DrawSpecialHBLeaderToTop(ctx, xTarget, yTarget, markingText);
|
DrawSpecialHBLeaderToTop(ctx, xTarget, yTarget, markingText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -179,22 +179,18 @@ namespace CadParamPluging.UI
|
|||||||
s = s.Replace(" ", "").Replace("\u3000", "").Replace(":", ":");
|
s = s.Replace(" ", "").Replace("\u3000", "").Replace(":", ":");
|
||||||
|
|
||||||
var parts = s.Split(':');
|
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)
|
return num / denom;
|
||||||
{
|
|
||||||
throw new BusinessException("出图比例不支持放大(n 必须 >= 1)");
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1.0 / denom;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool TryParseDouble(string s, out double value)
|
private static bool TryParseDouble(string s, out double value)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user