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)