feat: Implement square shaft free forge drawing functionality, including its generator, drawer, and parameter UI, and add .editorconfig.完善了方轴的画法

This commit is contained in:
sladro 2026-02-05 10:14:21 +08:00
parent f11403cc2f
commit d876d663a4
4 changed files with 14 additions and 0 deletions

4
.editorconfig Normal file
View File

@ -0,0 +1,4 @@
root = true
[*.cs]
charset = utf-8-bom

View File

@ -38,7 +38,9 @@ namespace CadParamPluging.Cad
public void Draw(CadContext ctx, ParamBag bag, TemplateParams templateParams, Point3d center, double scaleFactor)
{
System.Diagnostics.Debug.WriteLine($"[SquareShaftGenerator] Draw() 被调用,准备调用 Drawer");
ShaftRawFreeForgeSquareShaftDrawer.Draw(ctx, bag, center, scaleFactor);
System.Diagnostics.Debug.WriteLine($"[SquareShaftGenerator] Drawer 调用完成");
}
}
}

View File

@ -236,6 +236,9 @@ namespace CadParamPluging.UI
AppendLog($"未找到该模板的图纸生成逻辑TemplateKey={templateKey})。请先实现对应模板生成器。");
return;
}
// 调试日志:显示找到的生成器类型
AppendLog($"[调试] 已找到生成器: {generator.GetType().Name}, TemplateKey={templateKey}");
var catalog = ParamCatalogStore.Load();
CadParamPluging.Common.ParamBag bag;
@ -442,14 +445,19 @@ namespace CadParamPluging.UI
// Let's just log specific keys we suspect.
AppendLog($"Bag Keys check: OD1={bag.GetDoubleOrNull("OuterDiameter1")}, H1={bag.GetDoubleOrNull("Height1")}");
// 方轴参数检查
AppendLog($"[方轴参数] Size1={bag.GetDoubleOrNull("SquareShaftSize1")}, Size2={bag.GetDoubleOrNull("SquareShaftSize2")}, Size3={bag.GetDoubleOrNull("SquareShaftSize3")}");
// 根据模板参数绘制半剖视图,居中放置于原图纸位置
// 使用特征驱动模式:根据参数存在性动态绘制对应特征
AppendLog($"[绘图] 准备调用 generator.Draw, scaleFactor={scaleFactor}");
generator.Draw(
ctx,
bag,
tplParams,
removeResult.OriginalCenter,
scaleFactor);
AppendLog($"[绘图] generator.Draw 调用完成");
// Force Zoom Extents to ensure visibility
try { doc.SendStringToExecute("._ZOOM _E ", true, false, false); } catch { }