feat: implement drawer classes for free-forged blocks with and without round heads

This commit is contained in:
sladro 2026-04-10 10:39:06 +08:00
parent 4ab96aab54
commit 34d125f397
3 changed files with 8 additions and 74 deletions

View File

@ -294,7 +294,7 @@ namespace CadParamPluging.Cad
{
double xStart = xSectionRight;
double yStart = oy + H * 0.25;
DrawHardnessSymbol(ctx, xStart, yStart, hardnessVal);
FeatureDrivenDrawer.DrawHardnessSymbol(ctx, xStart, yStart, hardnessVal);
}
// 10. 标刻内容引线 - 从剖面左侧引出
@ -823,42 +823,6 @@ namespace CadParamPluging.Cad
return $"{baseText} {{\\H{tolScale}x;{single}}}";
}
private static void DrawHardnessSymbol(FeatureDrivenDrawer.DrawingContext ctx, double xStart, double yStart, string hardnessVal = null)
{
try
{
var p1 = new Point3d(xStart, yStart, 0);
var p2 = new Point3d(xStart + 15, yStart - 15, 0);
var p3 = new Point3d(p2.X + 10, p2.Y, 0);
var poly = new Polyline();
poly.AddVertexAt(0, new Point2d(p1.X, p1.Y), 0, 0, 0);
poly.AddVertexAt(1, new Point2d(p2.X, p2.Y), 0, 0, 0);
poly.AddVertexAt(2, new Point2d(p3.X, p3.Y), 0, 0, 0);
ctx.Style?.Apply(poly, DrawingStyleManager.Role.Dimension);
poly.ColorIndex = 3;
ctx.Btr.AppendEntity(poly);
ctx.Tr.AddNewlyCreatedDBObject(poly, true);
string displayTxt = string.IsNullOrWhiteSpace(hardnessVal) ? "HB" : hardnessVal;
var text = new DBText();
text.TextString = displayTxt;
text.Height = 3.5;
text.ColorIndex = 3;
text.HorizontalMode = TextHorizontalMode.TextLeft;
text.VerticalMode = TextVerticalMode.TextVerticalMid;
var tp = new Point3d(p3.X + 2.0, p3.Y, 0);
text.AlignmentPoint = tp;
text.Position = tp;
ctx.Btr.AppendEntity(text);
ctx.Tr.AddNewlyCreatedDBObject(text, true);
}
catch {}
}
private static void DrawSpecialHBLeaderToTop(FeatureDrivenDrawer.DrawingContext ctx, double xTarget, double yTarget, string textContent)
{
try

View File

@ -319,7 +319,7 @@ namespace CadParamPluging.Cad
{
double xStart = xSectionRight;
double yStart = oy + H * 0.25;
DrawHardnessSymbol(ctx, xStart, yStart, hardnessVal);
FeatureDrivenDrawer.DrawHardnessSymbol(ctx, xStart, yStart, hardnessVal);
}
// 10. 标刻内容引线 - 从剖面左侧引出
@ -669,42 +669,6 @@ namespace CadParamPluging.Cad
catch { }
}
private static void DrawHardnessSymbol(FeatureDrivenDrawer.DrawingContext ctx, double xStart, double yStart, string hardnessVal = null)
{
try
{
var p1 = new Point3d(xStart, yStart, 0);
var p2 = new Point3d(xStart + 15, yStart - 15, 0);
var p3 = new Point3d(p2.X + 10, p2.Y, 0);
var poly = new Polyline();
poly.AddVertexAt(0, new Point2d(p1.X, p1.Y), 0, 0, 0);
poly.AddVertexAt(1, new Point2d(p2.X, p2.Y), 0, 0, 0);
poly.AddVertexAt(2, new Point2d(p3.X, p3.Y), 0, 0, 0);
ctx.Style?.Apply(poly, DrawingStyleManager.Role.Dimension);
poly.ColorIndex = 3;
ctx.Btr.AppendEntity(poly);
ctx.Tr.AddNewlyCreatedDBObject(poly, true);
string displayTxt = string.IsNullOrWhiteSpace(hardnessVal) ? "HB" : hardnessVal;
var text = new DBText();
text.TextString = displayTxt;
text.Height = 3.5;
text.ColorIndex = 3;
text.HorizontalMode = TextHorizontalMode.TextLeft;
text.VerticalMode = TextVerticalMode.TextVerticalMid;
var tp = new Point3d(p3.X + 2.0, p3.Y, 0);
text.AlignmentPoint = tp;
text.Position = tp;
ctx.Btr.AppendEntity(text);
ctx.Tr.AddNewlyCreatedDBObject(text, true);
}
catch { }
}
private static void DrawHeadFilletRadiusLeader(FeatureDrivenDrawer.DrawingContext ctx, double cx, double cy, double r, bool isLeftSection)
{
try

6
package-lock.json generated Normal file
View File

@ -0,0 +1,6 @@
{
"name": "CadParamPluging",
"lockfileVersion": 3,
"requires": true,
"packages": {}
}