From f430e07b953a7e2ed6542ff0a75ebfb0b48946c4 Mon Sep 17 00:00:00 2001 From: sladro Date: Tue, 24 Feb 2026 09:44:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E8=87=AA=E7=94=B1?= =?UTF-8?q?=E9=94=BB=E5=9C=86=E5=A4=B4=E4=B8=8E=E6=97=A0=E5=9C=86=E5=A4=B4?= =?UTF-8?q?=E6=AF=9B=E5=9D=AF=E7=9A=84=E7=BB=98=E5=9B=BE=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=8F=8A=E7=9B=B8=E5=BA=94=E7=9A=84=E5=8F=82=E6=95=B0=E7=BB=98?= =?UTF-8?q?=E5=9B=BE=E9=9D=A2=E6=9D=BF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cad/BlockRawFreeForgeNoRoundHeadDrawer.cs | 12 ++++++------ Cad/BlockRawFreeForgeRoundHeadDrawer.cs | 12 ++++++------ UI/ParamDrawingPanel.cs | 16 ++++++---------- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/Cad/BlockRawFreeForgeNoRoundHeadDrawer.cs b/Cad/BlockRawFreeForgeNoRoundHeadDrawer.cs index 7082461..66cfab2 100644 --- a/Cad/BlockRawFreeForgeNoRoundHeadDrawer.cs +++ b/Cad/BlockRawFreeForgeNoRoundHeadDrawer.cs @@ -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); } } diff --git a/Cad/BlockRawFreeForgeRoundHeadDrawer.cs b/Cad/BlockRawFreeForgeRoundHeadDrawer.cs index 1eef84c..f8271aa 100644 --- a/Cad/BlockRawFreeForgeRoundHeadDrawer.cs +++ b/Cad/BlockRawFreeForgeRoundHeadDrawer.cs @@ -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); } } diff --git a/UI/ParamDrawingPanel.cs b/UI/ParamDrawingPanel.cs index fcfc375..85ca1f8 100644 --- a/UI/ParamDrawingPanel.cs +++ b/UI/ParamDrawingPanel.cs @@ -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)