diff --git a/Cad/Drawers/ShaftRawFreeForgeRoundShaftGenerator.cs b/Cad/Drawers/ShaftRawFreeForgeRoundShaftGenerator.cs
new file mode 100644
index 0000000..efce132
--- /dev/null
+++ b/Cad/Drawers/ShaftRawFreeForgeRoundShaftGenerator.cs
@@ -0,0 +1,33 @@
+using CadParamPluging.Common;
+using CadParamPluging.Domain.Models;
+using Autodesk.AutoCAD.Geometry;
+
+namespace CadParamPluging.Cad
+{
+ public sealed class ShaftRawFreeForgeRoundShaftGenerator : ITemplateDrawingGenerator
+ {
+ // 对应 TemplateSchemaDefaults.cs 中的定义
+ // ProjectType = "毛料态", DrawingType = "自由锻", SheetSize = "轴杆", Scale = "圆轴"
+ public static readonly string Key = TemplateKeyBuilder.Build("毛料态", "自由锻", "轴杆", "圆轴");
+
+ public string TemplateKey => Key;
+
+ public FeatureDrivenDrawer.ExpectedDrawingSize CalculateExpectedSize(ParamBag bag, TemplateParams templateParams)
+ {
+ var diameter = bag.GetDoubleOrNull(FeatureDrivenDrawer.KeyDiameter) ?? 0;
+ var length = bag.GetDoubleOrNull(FeatureDrivenDrawer.KeyLength) ?? 0;
+
+ var extraMargin = 40;
+ return new FeatureDrivenDrawer.ExpectedDrawingSize
+ {
+ Width = length + extraMargin * 2,
+ Height = diameter + extraMargin * 2
+ };
+ }
+
+ public void Draw(CadContext ctx, ParamBag bag, TemplateParams templateParams, Point3d center, double scaleFactor)
+ {
+ ShaftRawFreeForgeRoundShaftDrawer.Draw(ctx, bag, center, scaleFactor);
+ }
+ }
+}
diff --git a/Cad/Drawers/ShaftRawFreeForgeSquareShaftGenerator.cs b/Cad/Drawers/ShaftRawFreeForgeSquareShaftGenerator.cs
new file mode 100644
index 0000000..165fade
--- /dev/null
+++ b/Cad/Drawers/ShaftRawFreeForgeSquareShaftGenerator.cs
@@ -0,0 +1,44 @@
+using CadParamPluging.Common;
+using CadParamPluging.Domain.Models;
+using Autodesk.AutoCAD.Geometry;
+
+namespace CadParamPluging.Cad
+{
+ public sealed class ShaftRawFreeForgeSquareShaftGenerator : ITemplateDrawingGenerator
+ {
+ // 对应 TemplateSchemaDefaults.cs 中的定义
+ // ProjectType = "毛料态", DrawingType = "自由锻", SheetSize = "轴杆", Scale = "方轴"
+ public static readonly string Key = TemplateKeyBuilder.Build("毛料态", "自由锻", "轴杆", "方轴");
+
+ public string TemplateKey => Key;
+
+ public FeatureDrivenDrawer.ExpectedDrawingSize CalculateExpectedSize(ParamBag bag, TemplateParams templateParams)
+ {
+ var l = bag.GetDoubleOrNull(FeatureDrivenDrawer.KeySquareShaftSize1) ?? 0;
+ var w = bag.GetDoubleOrNull(FeatureDrivenDrawer.KeySquareShaftSize2) ?? 0;
+ var t = bag.GetDoubleOrNull(FeatureDrivenDrawer.KeySquareShaftSize3) ?? 0; // if side view exists
+
+ var extraMargin = 40;
+ double totalWidth = l + extraMargin * 2;
+
+ if (t > 0)
+ {
+ double gap = 50.0;
+ totalWidth = (l + gap + t) + extraMargin * 2;
+ }
+
+ double activeHeight = w;
+
+ return new FeatureDrivenDrawer.ExpectedDrawingSize
+ {
+ Width = totalWidth,
+ Height = activeHeight + extraMargin * 2
+ };
+ }
+
+ public void Draw(CadContext ctx, ParamBag bag, TemplateParams templateParams, Point3d center, double scaleFactor)
+ {
+ ShaftRawFreeForgeSquareShaftDrawer.Draw(ctx, bag, center, scaleFactor);
+ }
+ }
+}
diff --git a/Cad/Drawers/TemplateDrawingRegistry.cs b/Cad/Drawers/TemplateDrawingRegistry.cs
index b2f379b..bf2b078 100644
--- a/Cad/Drawers/TemplateDrawingRegistry.cs
+++ b/Cad/Drawers/TemplateDrawingRegistry.cs
@@ -18,6 +18,8 @@ namespace CadParamPluging.Cad
Register(new RingRawFreeForgeNonCenterPunchGenerator());
Register(new BlockRawFreeForgeNoRoundHeadGenerator());
Register(new RingRawFreeForgeCenterPunchGenerator());
+ Register(new ShaftRawFreeForgeRoundShaftGenerator());
+ Register(new ShaftRawFreeForgeSquareShaftGenerator());
}
public static bool TryResolve(string templateKey, out ITemplateDrawingGenerator generator)
diff --git a/Cad/FeatureDrivenDrawer.cs b/Cad/FeatureDrivenDrawer.cs
index 291186e..6d045d4 100644
--- a/Cad/FeatureDrivenDrawer.cs
+++ b/Cad/FeatureDrivenDrawer.cs
@@ -55,6 +55,21 @@ namespace CadParamPluging.Cad
public const string KeyDiameterPrime = "DiameterPrime"; // 轴杆零件直径
public const string KeyLengthPrime = "LengthPrime"; // 轴杆零件长度
+ // 轴杆参数(方轴)
+ public const string KeySquareShaftSize1 = "SquareShaftSize1";
+ public const string KeySquareShaftSize1TolPlus = "SquareShaftSize1TolPlus";
+ public const string KeySquareShaftSize1TolMinus = "SquareShaftSize1TolMinus";
+ public const string KeySquareShaftSize2 = "SquareShaftSize2";
+ public const string KeySquareShaftSize2TolPlus = "SquareShaftSize2TolPlus";
+ public const string KeySquareShaftSize2TolMinus = "SquareShaftSize2TolMinus";
+ public const string KeySquareShaftSize3 = "SquareShaftSize3";
+ public const string KeySquareShaftSize3TolPlus = "SquareShaftSize3TolPlus";
+ public const string KeySquareShaftSize3TolMinus = "SquareShaftSize3TolMinus";
+ public const string KeySquareShaftFilletRadiusMax = "SquareShaftFilletRadiusMax"; // 未注圆角半径R≤
+ public const string KeySquareShaftSize1Prime = "SquareShaftSize1Prime";
+ public const string KeySquareShaftSize2Prime = "SquareShaftSize2Prime";
+ public const string KeySquareShaftSize3Prime = "SquareShaftSize3Prime";
+
// 方体参数
public const string KeyBoxSize1 = "BoxSize1";
public const string KeyBoxSize1TolPlus = "BoxSize1TolPlus";
@@ -218,6 +233,18 @@ namespace CadParamPluging.Cad
private static ExpectedDrawingSize CalculateShaftSize(ParamBag bag)
{
+ var l = bag.GetDoubleOrNull(KeySquareShaftSize1);
+ if (l.HasValue)
+ {
+ var w = bag.GetDoubleOrNull(KeySquareShaftSize2) ?? 0;
+ var extraMarginSq = 40;
+ return new ExpectedDrawingSize
+ {
+ Width = l.Value + extraMarginSq * 2,
+ Height = w + extraMarginSq * 2
+ };
+ }
+
var diameter = bag.GetDoubleOrNull(KeyDiameter) ?? 0;
var length = bag.GetDoubleOrNull(KeyLength) ?? 0;
@@ -308,7 +335,18 @@ namespace CadParamPluging.Cad
}
else if (IsShaft(structuralFeature))
{
- DrawShaftFeatures(context);
+ if (deliveryStatus == "毛料态" && processMethod == "自由锻" && specialCondition == "圆轴")
+ {
+ ShaftRawFreeForgeRoundShaftDrawer.Draw(context.Ctx, context.OriginalBag ?? context.Bag, context.Center, scaleFactor);
+ }
+ else if (deliveryStatus == "毛料态" && processMethod == "自由锻" && specialCondition == "方轴")
+ {
+ ShaftRawFreeForgeSquareShaftDrawer.Draw(context.Ctx, context.OriginalBag ?? context.Bag, context.Center, scaleFactor);
+ }
+ else
+ {
+ DrawShaftFeatures(context);
+ }
}
else if (IsBlock(structuralFeature))
{
diff --git a/Cad/ShaftRawFreeForgeRoundShaftDrawer.cs b/Cad/ShaftRawFreeForgeRoundShaftDrawer.cs
new file mode 100644
index 0000000..a0c52a7
--- /dev/null
+++ b/Cad/ShaftRawFreeForgeRoundShaftDrawer.cs
@@ -0,0 +1,369 @@
+using System;
+using System.Collections.Generic;
+using Autodesk.AutoCAD.DatabaseServices;
+using Autodesk.AutoCAD.Geometry;
+using CadParamPluging.Common;
+
+namespace CadParamPluging.Cad
+{
+ public static class ShaftRawFreeForgeRoundShaftDrawer
+ {
+ public static void Draw(CadContext ctx, ParamBag bag, Point3d center, double scaleFactor = 1.0)
+ {
+ if (ctx == null) throw new ArgumentNullException(nameof(ctx));
+ if (bag == null) throw new ArgumentNullException(nameof(bag));
+
+ var effectiveBag = scaleFactor < 1.0 ? ScaleParamBag(bag, scaleFactor) : bag;
+
+ var db = ctx.Database;
+ var tr = ctx.Transaction;
+
+ var prevDb = HostApplicationServices.WorkingDatabase;
+ HostApplicationServices.WorkingDatabase = db;
+ BlockTableRecord btr;
+ try
+ {
+ var bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
+ btr = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
+ }
+ finally
+ {
+ HostApplicationServices.WorkingDatabase = prevDb;
+ }
+
+ var context = new FeatureDrivenDrawer.DrawingContext
+ {
+ Ctx = ctx,
+ Bag = effectiveBag,
+ OriginalBag = bag,
+ Center = center,
+ DeliveryStatus = "毛料态",
+ StructuralFeature = "轴杆",
+ SpecialCondition = "圆轴",
+ ProcessMethod = "自由锻",
+ Btr = btr,
+ Style = new DrawingStyleManager(db, tr) // Reusing existing StyleManager
+ };
+
+ DrawCore(context);
+ }
+
+ private static void DrawCore(FeatureDrivenDrawer.DrawingContext ctx)
+ {
+ var bag = ctx.Bag;
+
+ // Parameters
+ var diameter = bag.GetDoubleOrNull(FeatureDrivenDrawer.KeyDiameter);
+ var length = bag.GetDoubleOrNull(FeatureDrivenDrawer.KeyLength);
+
+ if (!diameter.HasValue || diameter.Value <= 0 || !length.HasValue || length.Value <= 0)
+ {
+ return;
+ }
+
+ double D = diameter.Value;
+ double L = length.Value;
+
+ // Visual Size Calculation
+ // Keep aspect ratio but maybe limit if too extreme?
+ // For now, draw 1:1 visually unless scaled by scaleFactor (which is handled in bag).
+
+ // Calculate coordinates (Center is geometric center)
+ double ox = ctx.Center.X - L / 2.0;
+ double oy = ctx.Center.Y - D / 2.0;
+
+ // 1. Draw Shaft Outline (Rectangle with optional fillets)
+ var filletRParam = bag.GetDoubleOrNull(FeatureDrivenDrawer.KeyShaftFilletRadiusMax);
+ double filletR = filletRParam.HasValue && filletRParam.Value > 0 ? filletRParam.Value : 0;
+
+ // Limit fillet radius
+ double maxR = Math.Min(D / 2.0, L / 2.0);
+ if (filletR > maxR) filletR = maxR;
+
+ DrawShaftOutline(ctx, ox, oy, L, D, filletR);
+
+ // 2. Draw Symmetry Axis
+ DrawSymmetryAxis(ctx, ox, oy, L, D);
+
+ // 3. Draw Part Contour (Yellow dashed)
+ var diameterPrime = bag.GetDoubleOrNull(FeatureDrivenDrawer.KeyDiameterPrime);
+ var lengthPrime = bag.GetDoubleOrNull(FeatureDrivenDrawer.KeyLengthPrime);
+
+ if (diameterPrime.HasValue && diameterPrime.Value > 0 && lengthPrime.HasValue && lengthPrime.Value > 0)
+ {
+ double partD = diameterPrime.Value;
+ double partL = lengthPrime.Value;
+
+ // Center part contour
+ double partOx = ctx.Center.X - partL / 2.0;
+ double partOy = ctx.Center.Y - partD / 2.0;
+
+ DrawPartContour(ctx, partOx, partOy, partL, partD);
+ }
+
+ // 4. Dimensions
+
+ // Length Dimension (Bottom)
+ {
+ var val = ctx.OriginalBag?.GetDoubleOrNull(FeatureDrivenDrawer.KeyLength) ?? L;
+ var str = ctx.OriginalBag?.GetString(FeatureDrivenDrawer.KeyLength);
+ var tolPlus = ctx.OriginalBag?.GetDoubleOrNull(FeatureDrivenDrawer.KeyLengthTolPlus);
+ var tolMinus = ctx.OriginalBag?.GetDoubleOrNull(FeatureDrivenDrawer.KeyLengthTolMinus);
+
+ var dimText = BuildDimensionText(FormatDimNumber(val, str), tolPlus, tolMinus);
+
+ // Add Part Length (Prime) below
+ var valPrime = ctx.OriginalBag?.GetDoubleOrNull(FeatureDrivenDrawer.KeyLengthPrime);
+ if (valPrime.HasValue && valPrime.Value > 0)
+ {
+ dimText += $"\\X({FormatDimNumber(valPrime.Value)})";
+ }
+
+ // Place below
+ double dimY = oy - 20; // Offset downwards? Usually dependent on margin
+ // Let's use a standard offset. If D is small, 20 is fine.
+
+ AddLinearDim(
+ ctx,
+ new Point3d(ox, oy, 0),
+ new Point3d(ox + L, oy, 0),
+ new Point3d(ctx.Center.X, dimY, 0),
+ 0,
+ dimText);
+ }
+
+ // Diameter Dimension (Right side usually for shafts, or put on side)
+ // Vertical dimension for Diameter
+ {
+ var val = ctx.OriginalBag?.GetDoubleOrNull(FeatureDrivenDrawer.KeyDiameter) ?? D;
+ var str = ctx.OriginalBag?.GetString(FeatureDrivenDrawer.KeyDiameter);
+ var tolPlus = ctx.OriginalBag?.GetDoubleOrNull(FeatureDrivenDrawer.KeyDiameterTolPlus);
+ var tolMinus = ctx.OriginalBag?.GetDoubleOrNull(FeatureDrivenDrawer.KeyDiameterTolMinus);
+
+ // Prefix with %%c for diameter
+ var dimText = BuildDimensionText("%%c" + FormatDimNumber(val, str), tolPlus, tolMinus);
+
+ // Add Part Diameter (Prime) below
+ var valPrime = ctx.OriginalBag?.GetDoubleOrNull(FeatureDrivenDrawer.KeyDiameterPrime);
+ if (valPrime.HasValue && valPrime.Value > 0)
+ {
+ dimText += $"\\X(%%c{FormatDimNumber(valPrime.Value)})";
+ }
+
+ double dimX = ox + L + 20;
+
+ AddLinearDim(
+ ctx,
+ new Point3d(ox + L, oy, 0),
+ new Point3d(ox + L, oy + D, 0),
+ new Point3d(dimX, ctx.Center.Y, 0),
+ 90,
+ dimText);
+ }
+
+ // Unspecified Fillet Note
+ if (filletR > 0)
+ {
+ // Usually text near the drawing or a general note.
+ // Ring template puts it at bottom left/right.
+ // Let's place it at top left.
+ // "未注圆角 R<=..."
+
+ // Construct text
+ string note = $"未注圆角 R≤{FormatDimNumber(filletR)}";
+
+ // Position: Top Left, slightly above
+ DrawSimpleText(ctx, new Point3d(ox, oy + D + 10, 0), note, 3.5);
+ }
+ }
+
+ private static void DrawShaftOutline(FeatureDrivenDrawer.DrawingContext ctx, double x, double y, double w, double h, double r)
+ {
+ var poly = new Polyline();
+
+ if (r < 0.01)
+ {
+ poly.AddVertexAt(0, new Point2d(x, y), 0, 0, 0);
+ poly.AddVertexAt(1, new Point2d(x + w, y), 0, 0, 0);
+ poly.AddVertexAt(2, new Point2d(x + w, y + h), 0, 0, 0);
+ poly.AddVertexAt(3, new Point2d(x, y + h), 0, 0, 0);
+ }
+ else
+ {
+ var bulge = Math.Tan(Math.PI / 8.0);
+
+ // Bottom-Left corner
+ poly.AddVertexAt(0, new Point2d(x + r, y), 0, 0, 0); // Start of bottom line
+
+ // Bottom-Right corner
+ poly.AddVertexAt(1, new Point2d(x + w - r, y), bulge, 0, 0); // Arc start
+ poly.AddVertexAt(2, new Point2d(x + w, y + r), 0, 0, 0); // Right line start
+
+ // Top-Right corner
+ poly.AddVertexAt(3, new Point2d(x + w, y + h - r), bulge, 0, 0);
+ poly.AddVertexAt(4, new Point2d(x + w - r, y + h), 0, 0, 0);
+
+ // Top-Left corner
+ poly.AddVertexAt(5, new Point2d(x + r, y + h), bulge, 0, 0);
+ poly.AddVertexAt(6, new Point2d(x, y + h - r), 0, 0, 0);
+
+ // Back to bottom-left arc
+ poly.AddVertexAt(7, new Point2d(x, y + r), bulge, 0, 0);
+ }
+
+ poly.Closed = true;
+ ctx.Style?.Apply(poly, DrawingStyleManager.Role.OutlineBold);
+ ctx.Btr.AppendEntity(poly);
+ ctx.Tr.AddNewlyCreatedDBObject(poly, true);
+
+ // Hatching? Shafts are usually not hatched unless sectioned.
+ // "Raw State Free Forging" might be just the outline.
+ // Ring templates hatch because they are sections. Shaft is usually full view.
+ // But if user wants a "template", maybe it mimics others?
+ // Ring Free Forge has hatching. Block has hatching in section.
+ // If this is a SECTION of a shaft (which is just a circle?), no.
+ // Should be side view. No hatching typically.
+ }
+
+ private static void DrawSymmetryAxis(FeatureDrivenDrawer.DrawingContext ctx, double x, double y, double w, double h)
+ {
+ // Horizontal axis? Shafts are usually horizontal.
+ // Center Y = y + h/2
+ double midY = y + h / 2.0;
+ double extend = w * 0.1;
+ if (extend > 15) extend = 15;
+
+ var line = new Line(new Point3d(x - extend, midY, 0), new Point3d(x + w + extend, midY, 0));
+ ctx.Style?.Apply(line, DrawingStyleManager.Role.Centerline);
+ ctx.Btr.AppendEntity(line);
+ ctx.Tr.AddNewlyCreatedDBObject(line, true);
+ }
+
+ private static void DrawPartContour(FeatureDrivenDrawer.DrawingContext ctx, double x, double y, double w, double h)
+ {
+ var poly = new Polyline();
+ poly.AddVertexAt(0, new Point2d(x, y), 0, 0, 0);
+ poly.AddVertexAt(1, new Point2d(x + w, y), 0, 0, 0);
+ poly.AddVertexAt(2, new Point2d(x + w, y + h), 0, 0, 0);
+ poly.AddVertexAt(3, new Point2d(x, y + h), 0, 0, 0);
+ poly.Closed = true;
+
+ ctx.Style?.Apply(poly, DrawingStyleManager.Role.PartContour); // Yellow Dashed
+ ctx.Btr.AppendEntity(poly);
+ ctx.Tr.AddNewlyCreatedDBObject(poly, true);
+ }
+
+ // --- Helpers copied/adapted to ensure isolation ---
+
+ private static ParamBag ScaleParamBag(ParamBag original, double scaleFactor)
+ {
+ if (original == null) return null;
+ if (Math.Abs(scaleFactor - 1.0) < 0.000001) return original;
+ // Simplified copy for specific keys
+ var newBag = new ParamBag();
+ foreach(var k in original.GetKeys())
+ {
+ var v = original.GetString(k);
+ if (IsScaleableKey(k) && double.TryParse(v, out var d))
+ {
+ newBag.Set(k, (d * scaleFactor).ToString("0.###"));
+ }
+ else
+ {
+ newBag.Set(k, v);
+ }
+ }
+ return newBag;
+ }
+
+ private static bool IsScaleableKey(string key)
+ {
+ // List relevant keys for this template
+ return key.StartsWith("Diameter") || key.StartsWith("Length") || key.EndsWith("Prime") || key.Contains("Radius");
+ }
+
+ private static void AddLinearDim(FeatureDrivenDrawer.DrawingContext ctx, Point3d p1, Point3d p2, Point3d ptDim, double rot, string text)
+ {
+ try
+ {
+ var dim = new RotatedDimension();
+ dim.SetDatabaseDefaults();
+ dim.XLine1Point = p1;
+ dim.XLine2Point = p2;
+ dim.DimLinePoint = ptDim;
+ dim.Rotation = rot * Math.PI / 180.0;
+ dim.DimensionStyle = ctx.Db.Dimstyle;
+ dim.DimensionText = text;
+
+ // Force Green
+ dim.ColorIndex = 3;
+
+ // Basic overrides if possible
+ // Using reflection setup similar to other files
+ SetDimColor(dim, "Dimclrd", 3);
+ SetDimColor(dim, "Dimclre", 3);
+ SetDimColor(dim, "Dimclrt", 3);
+ SetDimBool(dim, "Dimtofl", true);
+
+ ctx.Style?.Apply(dim, DrawingStyleManager.Role.Dimension);
+ dim.ColorIndex = 3;
+
+ ctx.Btr.AppendEntity(dim);
+ ctx.Tr.AddNewlyCreatedDBObject(dim, true);
+ }
+ catch {}
+ }
+
+ private static void DrawSimpleText(FeatureDrivenDrawer.DrawingContext ctx, Point3d pos, string text, double height)
+ {
+ try
+ {
+ var mtxt = new MText();
+ mtxt.SetDatabaseDefaults();
+ mtxt.Location = pos;
+ mtxt.Contents = text;
+ mtxt.TextHeight = height;
+ mtxt.Attachment = AttachmentPoint.BottomLeft;
+
+ ctx.Style?.Apply(mtxt, DrawingStyleManager.Role.Text);
+ ctx.Btr.AppendEntity(mtxt);
+ ctx.Tr.AddNewlyCreatedDBObject(mtxt, true);
+ }
+ catch {}
+ }
+
+ private static string FormatDimNumber(double value, string rawInput = null)
+ {
+ // Simplified formatter
+ return value.ToString("0.###");
+ }
+
+ private static string BuildDimensionText(string baseText, double? tolPlus, double? tolMinus)
+ {
+ if (!tolPlus.HasValue && !tolMinus.HasValue) return baseText;
+
+ if (tolPlus.HasValue && tolMinus.HasValue && Math.Abs(Math.Abs(tolPlus.Value) - Math.Abs(tolMinus.Value)) < 0.00001)
+ {
+ return $"{baseText}%%p{Math.Abs(tolPlus.Value):0.###}";
+ }
+
+ string p = tolPlus.HasValue ? (tolPlus.Value >= 0 ? "+" : "") + tolPlus.Value.ToString("0.###") : "0";
+ string m = tolMinus.HasValue ? tolMinus.Value.ToString("0.###") : "0";
+
+ return $"{baseText}\\S{p}^{m};";
+ }
+
+ // Reflection helpers
+ private static void SetDimColor(Dimension dim, string prop, int colorIndex)
+ {
+ try {
+ var p = dim.GetType().GetProperty(prop);
+ if (p != null) p.SetValue(dim, Autodesk.AutoCAD.Colors.Color.FromColorIndex(Autodesk.AutoCAD.Colors.ColorMethod.ByAci, (short)colorIndex));
+ } catch {}
+ }
+ private static void SetDimBool(Dimension dim, string prop, bool val)
+ {
+ try { dim.GetType().GetProperty(prop)?.SetValue(dim, val); } catch {}
+ }
+ }
+}
diff --git a/Cad/ShaftRawFreeForgeSquareShaftDrawer.cs b/Cad/ShaftRawFreeForgeSquareShaftDrawer.cs
new file mode 100644
index 0000000..f67a5f8
Binary files /dev/null and b/Cad/ShaftRawFreeForgeSquareShaftDrawer.cs differ
diff --git a/CadParamPluging.csproj b/CadParamPluging.csproj
index 62f66f3..184e196 100644
--- a/CadParamPluging.csproj
+++ b/CadParamPluging.csproj
@@ -91,7 +91,11 @@
+
+
+
+
diff --git a/Common/ParamCatalog.cs b/Common/ParamCatalog.cs
index 14e38c2..387b1dc 100644
--- a/Common/ParamCatalog.cs
+++ b/Common/ParamCatalog.cs
@@ -796,6 +796,152 @@ namespace CadParamPluging.Common
Order = 930,
Group = "尺寸-饼盘"
},
+
+ // --- Dimensions: square shaft (方轴) ---
+ new ParamDefinition
+ {
+ Key = "SquareShaftSize1",
+ Label = "尺寸1",
+ Type = ParamValueType.Double,
+ Required = false,
+ DefaultValue = "",
+ Hint = "手动编辑(长度)",
+ Order = 781,
+ Group = "尺寸-轴杆(方轴)"
+ },
+ new ParamDefinition
+ {
+ Key = "SquareShaftSize1TolPlus",
+ Label = "尺寸1上差a1",
+ Type = ParamValueType.Double,
+ Required = false,
+ DefaultValue = "",
+ Hint = "下拉列表(+2~+7),可手动编辑",
+ Order = 782,
+ Group = "尺寸-轴杆(方轴)"
+ },
+ new ParamDefinition
+ {
+ Key = "SquareShaftSize1TolMinus",
+ Label = "尺寸1下差b1",
+ Type = ParamValueType.Double,
+ Required = false,
+ DefaultValue = "",
+ Hint = "下拉列表(-2~-7),可手动编辑",
+ Order = 783,
+ Group = "尺寸-轴杆(方轴)"
+ },
+ new ParamDefinition
+ {
+ Key = "SquareShaftSize2",
+ Label = "尺寸2",
+ Type = ParamValueType.Double,
+ Required = false,
+ DefaultValue = "",
+ Hint = "手动编辑",
+ Order = 784,
+ Group = "尺寸-轴杆(方轴)"
+ },
+ new ParamDefinition
+ {
+ Key = "SquareShaftSize2TolPlus",
+ Label = "尺寸2上差a2",
+ Type = ParamValueType.Double,
+ Required = false,
+ DefaultValue = "",
+ Hint = "下拉列表(+2~+7),可手动编辑",
+ Order = 785,
+ Group = "尺寸-轴杆(方轴)"
+ },
+ new ParamDefinition
+ {
+ Key = "SquareShaftSize2TolMinus",
+ Label = "尺寸2下差b2",
+ Type = ParamValueType.Double,
+ Required = false,
+ DefaultValue = "",
+ Hint = "下拉列表(-2~-7),可手动编辑",
+ Order = 786,
+ Group = "尺寸-轴杆(方轴)"
+ },
+ new ParamDefinition
+ {
+ Key = "SquareShaftSize3",
+ Label = "尺寸3",
+ Type = ParamValueType.Double,
+ Required = false,
+ DefaultValue = "",
+ Hint = "手动编辑",
+ Order = 787,
+ Group = "尺寸-轴杆(方轴)"
+ },
+ new ParamDefinition
+ {
+ Key = "SquareShaftSize3TolPlus",
+ Label = "尺寸3上差a3",
+ Type = ParamValueType.Double,
+ Required = false,
+ DefaultValue = "",
+ Hint = "下拉列表(+2~+7),可手动编辑",
+ Order = 788,
+ Group = "尺寸-轴杆(方轴)"
+ },
+ new ParamDefinition
+ {
+ Key = "SquareShaftSize3TolMinus",
+ Label = "尺寸3下差b3",
+ Type = ParamValueType.Double,
+ Required = false,
+ DefaultValue = "",
+ Hint = "下拉列表(-2~-7),可手动编辑",
+ Order = 789,
+ Group = "尺寸-轴杆(方轴)"
+ },
+ new ParamDefinition
+ {
+ Key = "SquareShaftFilletRadiusMax",
+ Label = "未注圆角半径R≤",
+ Type = ParamValueType.Enum,
+ Required = false,
+ DefaultValue = "",
+ EnumOptions = new List { "6", "5", "4" },
+ Hint = "下拉列表(6/5/4),可手动编辑",
+ Order = 790,
+ Group = "尺寸-轴杆(方轴)"
+ },
+ new ParamDefinition
+ {
+ Key = "SquareShaftSize1Prime",
+ Label = "尺寸1'",
+ Type = ParamValueType.Double,
+ Required = false,
+ DefaultValue = "",
+ Hint = "零件尺寸",
+ Order = 791,
+ Group = "尺寸-轴杆(方轴)"
+ },
+ new ParamDefinition
+ {
+ Key = "SquareShaftSize2Prime",
+ Label = "尺寸2'",
+ Type = ParamValueType.Double,
+ Required = false,
+ DefaultValue = "",
+ Hint = "零件尺寸",
+ Order = 792,
+ Group = "尺寸-轴杆(方轴)"
+ },
+ new ParamDefinition
+ {
+ Key = "SquareShaftSize3Prime",
+ Label = "尺寸3'",
+ Type = ParamValueType.Double,
+ Required = false,
+ DefaultValue = "",
+ Hint = "零件尺寸",
+ Order = 793,
+ Group = "尺寸-轴杆(方轴)"
+ },
new ParamDefinition
{
Key = "DiskHeightTolPlus",
diff --git a/Common/TemplateSchemaDefaults.cs b/Common/TemplateSchemaDefaults.cs
index 8286793..7b8f134 100644
--- a/Common/TemplateSchemaDefaults.cs
+++ b/Common/TemplateSchemaDefaults.cs
@@ -218,6 +218,67 @@ namespace CadParamPluging.Common
PartOwnershipConfigured = true
});
+ // 模板:交付状态=毛料态, 工艺方法=自由锻, 结构特征=轴杆, 特殊条件=圆轴
+ schemas.Items.Add(new TemplateSchemaDefinition
+ {
+ ProjectType = "毛料态",
+ DrawingType = "自由锻",
+ SheetSize = "轴杆",
+ Scale = "圆轴", // Special Condition
+ DisplayName = "轴杆(毛料态/自由锻/圆轴)",
+ SelectedParamKeys = new List
+ {
+ "Diameter",
+ "DiameterTolPlus",
+ "DiameterTolMinus",
+ "Length",
+ "LengthTolPlus",
+ "LengthTolMinus",
+ "ShaftFilletRadiusMax", // 未注圆角半径R≤
+ "DiameterPrime",
+ "LengthPrime"
+ },
+ SelectedPartParamKeys = new List
+ {
+ "DiameterPrime",
+ "LengthPrime"
+ },
+ PartOwnershipConfigured = true
+ });
+
+ // 模板:交付状态=毛料态, 工艺方法=自由锻, 结构特征=轴杆, 特殊条件=方轴
+ schemas.Items.Add(new TemplateSchemaDefinition
+ {
+ ProjectType = "毛料态",
+ DrawingType = "自由锻",
+ SheetSize = "轴杆",
+ Scale = "方轴",
+ DisplayName = "轴杆(毛料态/自由锻/方轴)",
+ SelectedParamKeys = new List
+ {
+ "SquareShaftSize1",
+ "SquareShaftSize1TolPlus",
+ "SquareShaftSize1TolMinus",
+ "SquareShaftSize2",
+ "SquareShaftSize2TolPlus",
+ "SquareShaftSize2TolMinus",
+ "SquareShaftSize3",
+ "SquareShaftSize3TolPlus",
+ "SquareShaftSize3TolMinus",
+ "SquareShaftFilletRadiusMax", // 未注圆角半径R≤
+ "SquareShaftSize1Prime",
+ "SquareShaftSize2Prime",
+ "SquareShaftSize3Prime"
+ },
+ SelectedPartParamKeys = new List
+ {
+ "SquareShaftSize1Prime",
+ "SquareShaftSize2Prime",
+ "SquareShaftSize3Prime"
+ },
+ PartOwnershipConfigured = true
+ });
+
schemas.Normalize();
return schemas;
}