feat: 实现毛料态自由锻圆轴的绘制功能

This commit is contained in:
sladro 2026-02-28 11:53:16 +08:00
parent ad76f1bb32
commit 60a5954e58

View File

@ -81,23 +81,38 @@ namespace CadParamPluging.Cad
bool needBreakLines = originalW > 150;
const double lineSpacing = 3.5;
// 1. 绘制主体轮廓 (矩形 + 圆角) - 保持原来的白色边框
// 计算平滑相切数据模型
double arcHeight = H / 5.0;
double r = filletR;
double w = arcHeight;
double Rm = (H * H) / (8.0 * w) + w / 2.0;
double xInnerLeft = ox;
double xc_left = xInnerLeft - w + Rm;
double D_tangent = (Rm >= r) ? Math.Sqrt(Math.Max(0, (Rm - r) * (Rm - r) - (H / 2.0 - r) * (H / 2.0 - r))) : (Rm - w);
double xf_left = r > 0 ? xc_left - D_tangent : xInnerLeft;
double xInnerRight = ox + W;
double xc_right = xInnerRight + w - Rm;
double xf_right = r > 0 ? xc_right + D_tangent : xInnerRight;
double fx_L_tang = r > 0 ? xc_left + (Rm / (Rm - r)) * (xf_left - xc_left) : xInnerLeft;
double fy_L_tangBot = r > 0 ? (oy + H / 2.0) + (Rm / (Rm - r)) * ((oy + r) - (oy + H / 2.0)) : oy;
double fx_R_tang = r > 0 ? xc_right + (Rm / (Rm - r)) * (xf_right - xc_right) : xInnerRight;
double fy_R_tangBot = r > 0 ? (oy + H / 2.0) + (Rm / (Rm - r)) * ((oy + r) - (oy + H / 2.0)) : oy;
double fx_L_tangTop = r > 0 ? xc_left + (Rm / (Rm - r)) * (xf_left - xc_left) : xInnerLeft;
double fy_L_tangTop = r > 0 ? (oy + H / 2.0) + (Rm / (Rm - r)) * ((oy + H - r) - (oy + H / 2.0)) : oy + H;
double fx_R_tangTop = r > 0 ? xc_right + (Rm / (Rm - r)) * (xf_right - xc_right) : xInnerRight;
double fy_R_tangTop = r > 0 ? (oy + H / 2.0) + (Rm / (Rm - r)) * ((oy + H - r) - (oy + H / 2.0)) : oy + H;
double xBreak = ox + W / 4.0;
// 1. 绘制主体轮廓 (矩形 + 圆角) - 保持原来的白色边框
if (needBreakLines)
{
DrawRectWithBreak(ctx, ox, oy, W, H, filletR, xBreak, lineSpacing);
}
else
{
DrawRectWithFillets(ctx, ox, oy, W, H, filletR, DrawingStyleManager.Role.OutlineBold);
}
// 2. 绘制左右两端的弧线(向外凸出)
// 弧高设为 H/5高度的1/5确保弧高小于半弦长
double arcHeight = H / 5.0;
DrawEndArcs(ctx, ox, oy, W, H, arcHeight);
// 1. 绘制主体轮廓 (矩形 + 平滑相切圆角) 和 2. 绘制左右两端的弧线 一体化
DrawShaftRoundHeadUnifiedOutline(ctx, ox, oy, W, H, w, r, xf_left, xf_right, fx_L_tangTop, fy_L_tangTop, fx_L_tang, fy_L_tangBot, fx_R_tangTop, fy_R_tangTop, fx_R_tang, fy_R_tangBot, needBreakLines, xBreak, lineSpacing);
// 3. 绘制中心线 (横向,在中间位置)
DrawHorizontalCenterLine(ctx, ctx.Center.Y, ox, ox + W, needBreakLines, xBreak, lineSpacing);
@ -128,9 +143,8 @@ namespace CadParamPluging.Cad
}
double dimY = oy - 25;
double dimOriginY = oy + filletR;
FeatureDrivenDrawer.AddLinearDim(ctx, new Point3d(ox, dimOriginY, 0), new Point3d(ox + W, dimOriginY, 0), new Point3d(ctx.Center.X, dimY, 0), 0, dimText);
// 修正:引线起点基于真正的倒角切点,保证垂线和尺寸界线接合完美
FeatureDrivenDrawer.AddLinearDim(ctx, new Point3d(fx_L_tang, fy_L_tangBot, 0), new Point3d(fx_R_tang, fy_R_tangBot, 0), new Point3d(ctx.Center.X, dimY, 0), 0, dimText);
}
// 3.2 直径标注 (右侧) - 对应高度H
@ -151,10 +165,16 @@ namespace CadParamPluging.Cad
dimText += @"\X(%%c" + FeatureDrivenDrawer.FormatDimNumber(valPrime.Value) + ")";
}
double dimX = ox + W + 20;
double dimOriginX = ox + W - filletR;
FeatureDrivenDrawer.AddLinearDim(ctx, new Point3d(dimOriginX, oy, 0), new Point3d(dimOriginX, oy + H, 0), new Point3d(dimX, ctx.Center.Y, 0), 90, dimText);
double dimX = ox + W + 20 + arcHeight;
FeatureDrivenDrawer.AddLinearDim(ctx, new Point3d(xf_right, oy, 0), new Point3d(xf_right, oy + H, 0), new Point3d(dimX, ctx.Center.Y, 0), 90, dimText);
}
// 3.3 补加未注侧倒角标注指示
if (filletR > 0)
{
double cxRight = xf_right;
double cyTop = oy + H - filletR;
DrawHeadFilletRadiusLeader(ctx, cxRight, cyTop, filletR);
}
// 4. 硬度和标刻
@ -200,43 +220,155 @@ namespace CadParamPluging.Cad
}
}
private static void DrawRectWithFillets(FeatureDrivenDrawer.DrawingContext ctx, double x, double y, double w, double h, double r, DrawingStyleManager.Role role = DrawingStyleManager.Role.OutlineBold)
private static void DrawShaftRoundHeadUnifiedOutline(FeatureDrivenDrawer.DrawingContext ctx, double ox, double oy, double W, double H, double w, double r, double xf_left, double xf_right, double fx_L_tangTop, double fy_L_tangTop, double fx_L_tangBotX, double fy_L_tangBot, double fx_R_tangTop, double fy_R_tangTop, double fx_R_tangBotX, double fy_R_tangBot, bool needBreakLines, double xBreak, double breakWidth)
{
var poly = CreateRectPoly(x, y, w, h, r);
ctx.Style?.Apply(poly, role);
ctx.Btr.AppendEntity(poly);
ctx.Tr.AddNewlyCreatedDBObject(poly, true);
}
double Rm = (H * H) / (8.0 * w) + w / 2.0;
private static Polyline CreateRectPoly(double x, double y, double w, double h, double r)
{
var poly = new Polyline();
if (r < 0.01)
// -------- Left Unified End --------
double xInnerLeft = ox;
double xc_left = xInnerLeft - w + Rm;
Point2d C_m_L = new Point2d(xc_left, oy + H / 2.0);
Point2d C_fTop_L = new Point2d(xf_left, oy + H - r);
Point2d C_fBot_L = new Point2d(xf_left, oy + r);
var leftPoly = 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);
double angTop1 = Math.PI / 2.0;
double angTop2 = Math.Atan2(fy_L_tangTop - C_fTop_L.Y, fx_L_tangTop - C_fTop_L.X);
double diffTop = angTop2 - angTop1;
while (diffTop < 0) diffTop += Math.PI * 2;
while (diffTop >= Math.PI * 2) diffTop -= Math.PI * 2;
double bulgeTop = Math.Tan(diffTop / 4.0);
double angM1 = Math.Atan2(fy_L_tangTop - C_m_L.Y, fx_L_tangTop - C_m_L.X);
double angM2 = Math.Atan2(fy_L_tangBot - C_m_L.Y, fx_L_tangBotX - C_m_L.X);
double diffM = angM2 - angM1;
while (diffM < 0) diffM += Math.PI * 2;
while (diffM >= Math.PI * 2) diffM -= Math.PI * 2;
double bulgeM = Math.Tan(diffM / 4.0);
double angBot1 = Math.Atan2(fy_L_tangBot - C_fBot_L.Y, fx_L_tangBotX - C_fBot_L.X);
double angBot2 = -Math.PI / 2.0;
double diffBot = angBot2 - angBot1;
while (diffBot < 0) diffBot += Math.PI * 2;
while (diffBot >= Math.PI * 2) diffBot -= Math.PI * 2;
double bulgeBot = Math.Tan(diffBot / 4.0);
leftPoly.AddVertexAt(0, new Point2d(xf_left, oy + H), bulgeTop, 0, 0);
leftPoly.AddVertexAt(1, new Point2d(fx_L_tangTop, fy_L_tangTop), bulgeM, 0, 0);
leftPoly.AddVertexAt(2, new Point2d(fx_L_tangBotX, fy_L_tangBot), bulgeBot, 0, 0);
leftPoly.AddVertexAt(3, new Point2d(xf_left, oy), 0, 0, 0);
}
else
{
var bulge = Math.Tan(Math.PI / 8.0);
poly.AddVertexAt(0, new Point2d(x + r, y), 0, 0, 0);
poly.AddVertexAt(1, new Point2d(x + w - r, y), bulge, 0, 0);
poly.AddVertexAt(2, new Point2d(x + w, y + r), 0, 0, 0);
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);
poly.AddVertexAt(5, new Point2d(x + r, y + h), bulge, 0, 0);
poly.AddVertexAt(6, new Point2d(x, y + h - r), 0, 0, 0);
poly.AddVertexAt(7, new Point2d(x, y + r), bulge, 0, 0);
}
double angM1 = Math.Atan2(oy + H - C_m_L.Y, xInnerLeft - C_m_L.X);
double angM2 = Math.Atan2(oy - C_m_L.Y, xInnerLeft - C_m_L.X);
double diffM = angM2 - angM1;
while (diffM < 0) diffM += Math.PI * 2;
while (diffM >= Math.PI * 2) diffM -= Math.PI * 2;
double bulgeM = Math.Tan(diffM / 4.0);
poly.Closed = true;
return poly;
leftPoly.AddVertexAt(0, new Point2d(xInnerLeft, oy + H), bulgeM, 0, 0);
leftPoly.AddVertexAt(1, new Point2d(xInnerLeft, oy), 0, 0, 0);
}
ctx.Style?.Apply(leftPoly, DrawingStyleManager.Role.OutlineBold);
ctx.Btr.AppendEntity(leftPoly);
ctx.Tr.AddNewlyCreatedDBObject(leftPoly, true);
var leftClosureLine = new Line(new Point3d(fx_L_tangTop, fy_L_tangTop, 0), new Point3d(fx_L_tangBotX, fy_L_tangBot, 0));
ctx.Style?.Apply(leftClosureLine, DrawingStyleManager.Role.OutlineBold);
ctx.Btr.AppendEntity(leftClosureLine);
ctx.Tr.AddNewlyCreatedDBObject(leftClosureLine, true);
// -------- Right Unified End --------
double xInnerRight = ox + W;
double xc_right = xInnerRight + w - Rm;
Point2d C_m_R = new Point2d(xc_right, oy + H / 2.0);
Point2d C_fTop_R = new Point2d(xf_right, oy + H - r);
Point2d C_fBot_R = new Point2d(xf_right, oy + r);
var rightPoly = new Polyline();
if (r > 0.01)
{
double angBot1 = -Math.PI / 2.0;
double angBot2 = Math.Atan2(fy_R_tangBot - C_fBot_R.Y, fx_R_tangBotX - C_fBot_R.X);
double diffBot = angBot2 - angBot1;
while (diffBot < 0) diffBot += Math.PI * 2;
while (diffBot >= Math.PI * 2) diffBot -= Math.PI * 2;
double bulgeBot = Math.Tan(diffBot / 4.0);
double angM1 = Math.Atan2(fy_R_tangBot - C_m_R.Y, fx_R_tangBotX - C_m_R.X);
double angM2 = Math.Atan2(fy_R_tangTop - C_m_R.Y, fx_R_tangTop - C_m_R.X);
double diffM = angM2 - angM1;
while (diffM < 0) diffM += Math.PI * 2;
while (diffM >= Math.PI * 2) diffM -= Math.PI * 2;
double bulgeM = Math.Tan(diffM / 4.0);
double angTop1 = Math.Atan2(fy_R_tangTop - C_fTop_R.Y, fx_R_tangTop - C_fTop_R.X);
double angTop2 = Math.PI / 2.0;
double diffTop = angTop2 - angTop1;
while (diffTop < 0) diffTop += Math.PI * 2;
while (diffTop >= Math.PI * 2) diffTop -= Math.PI * 2;
double bulgeTop = Math.Tan(diffTop / 4.0);
rightPoly.AddVertexAt(0, new Point2d(xf_right, oy), bulgeBot, 0, 0);
rightPoly.AddVertexAt(1, new Point2d(fx_R_tangBotX, fy_R_tangBot), bulgeM, 0, 0);
rightPoly.AddVertexAt(2, new Point2d(fx_R_tangTop, fy_R_tangTop), bulgeTop, 0, 0);
rightPoly.AddVertexAt(3, new Point2d(xf_right, oy + H), 0, 0, 0);
}
else
{
double angM1 = Math.Atan2(oy - C_m_R.Y, xInnerRight - C_m_R.X);
double angM2 = Math.Atan2(oy + H - C_m_R.Y, xInnerRight - C_m_R.X);
double diffM = angM2 - angM1;
while (diffM < 0) diffM += Math.PI * 2;
while (diffM >= Math.PI * 2) diffM -= Math.PI * 2;
double bulgeM = Math.Tan(diffM / 4.0);
rightPoly.AddVertexAt(0, new Point2d(xInnerRight, oy), bulgeM, 0, 0);
rightPoly.AddVertexAt(1, new Point2d(xInnerRight, oy + H), 0, 0, 0);
}
ctx.Style?.Apply(rightPoly, DrawingStyleManager.Role.OutlineBold);
ctx.Btr.AppendEntity(rightPoly);
ctx.Tr.AddNewlyCreatedDBObject(rightPoly, true);
var rightClosureLine = new Line(new Point3d(fx_R_tangTop, fy_R_tangTop, 0), new Point3d(fx_R_tangBotX, fy_R_tangBot, 0));
ctx.Style?.Apply(rightClosureLine, DrawingStyleManager.Role.OutlineBold);
ctx.Btr.AppendEntity(rightClosureLine);
ctx.Tr.AddNewlyCreatedDBObject(rightClosureLine, true);
// -------- Horizontal Connectors --------
if (!needBreakLines)
{
var top = new Line(new Point3d(xf_left, oy + H, 0), new Point3d(xf_right, oy + H, 0));
var bot = new Line(new Point3d(xf_left, oy, 0), new Point3d(xf_right, oy, 0));
ctx.Style?.Apply(top, DrawingStyleManager.Role.OutlineBold);
ctx.Style?.Apply(bot, DrawingStyleManager.Role.OutlineBold);
ctx.Btr.AppendEntity(top);
ctx.Btr.AppendEntity(bot);
ctx.Tr.AddNewlyCreatedDBObject(top, true);
ctx.Tr.AddNewlyCreatedDBObject(bot, true);
}
else
{
var tL = new Line(new Point3d(xf_left, oy + H, 0), new Point3d(xBreak, oy + H, 0));
var tR = new Line(new Point3d(xBreak + breakWidth, oy + H, 0), new Point3d(xf_right, oy + H, 0));
var bL = new Line(new Point3d(xf_left, oy, 0), new Point3d(xBreak, oy, 0));
var bR = new Line(new Point3d(xBreak + breakWidth, oy, 0), new Point3d(xf_right, oy, 0));
ctx.Style?.Apply(tL, DrawingStyleManager.Role.OutlineBold);
ctx.Style?.Apply(tR, DrawingStyleManager.Role.OutlineBold);
ctx.Style?.Apply(bL, DrawingStyleManager.Role.OutlineBold);
ctx.Style?.Apply(bR, DrawingStyleManager.Role.OutlineBold);
ctx.Btr.AppendEntity(tL); ctx.Tr.AddNewlyCreatedDBObject(tL, true);
ctx.Btr.AppendEntity(tR); ctx.Tr.AddNewlyCreatedDBObject(tR, true);
ctx.Btr.AppendEntity(bL); ctx.Tr.AddNewlyCreatedDBObject(bL, true);
ctx.Btr.AppendEntity(bR); ctx.Tr.AddNewlyCreatedDBObject(bR, true);
}
}
// Legacy pure end arcs method removed as it is now unified inside DrawShaftRoundHeadUnifiedOutline
private static void DrawRectOutline(FeatureDrivenDrawer.DrawingContext ctx, double x, double y, double w, double h, DrawingStyleManager.Role role)
{
var poly = new Polyline();
@ -251,50 +383,67 @@ namespace CadParamPluging.Cad
ctx.Tr.AddNewlyCreatedDBObject(poly, true);
}
/// <summary>
/// 绘制左右两端的弧线(向外凸出)
/// 使用Polyline的bulge凸度值绘制确保端点精确对齐
/// </summary>
private static void DrawEndArcs(FeatureDrivenDrawer.DrawingContext ctx, double ox, double oy, double W, double H, double arcHeight)
private static void DrawHeadFilletRadiusLeader(FeatureDrivenDrawer.DrawingContext ctx, double cx, double cy, double r)
{
try
{
// 弧线端点:
// 左侧弧线:从(ox, oy+H)到(ox, oy)向左凸出arcHeight
// 右侧弧线:从(ox+W, oy)到(ox+W, oy+H)向右凸出arcHeight
var val = ctx.OriginalBag?.GetDoubleOrNull(FeatureDrivenDrawer.KeyShaftFilletRadiusMax);
if (!val.HasValue || val.Value <= 0) return;
// 计算凸度 bulge
// bulge = tan(theta/4),其中 theta 是圆弧对应的圆心角
// 或者使用 bulge = sagitta / (chordLength / 2) 的近似公式
// 更精确的公式bulge = 2 * sagitta / chordLength当弧线较小时
double angleDeg = 45; // 右上角向右上方画出
double angleRad = angleDeg * Math.PI / 180.0;
double chordLength = H;
double sagitta = arcHeight;
double px = cx + r * Math.Cos(angleRad);
double py = cy + r * Math.Sin(angleRad);
double ex = px + 25 * Math.Cos(angleRad);
double ey = py + 25 * Math.Sin(angleRad);
var line = new Line(new Point3d(px, py, 0), new Point3d(ex, ey, 0));
ctx.Style?.Apply(line, DrawingStyleManager.Role.Dimension);
line.ColorIndex = 4; // Cyan
ctx.Btr.AppendEntity(line);
ctx.Tr.AddNewlyCreatedDBObject(line, true);
double arrowLength = 5.0;
double arrowWidth = 1.5;
double baseX = px + arrowLength * Math.Cos(angleRad);
double baseY = py + arrowLength * Math.Sin(angleRad);
// 计算凸度bulge = 2 * 拱高 / 弦长
// 注意:正值表示向左/上凸出(逆时针方向),负值表示向右/下凸出(顺时针方向)
double bulge = (2.0 * sagitta) / chordLength;
double perpAngle = angleRad + Math.PI / 2;
double p1X = baseX + (arrowWidth / 2) * Math.Cos(perpAngle);
double p1Y = baseY + (arrowWidth / 2) * Math.Sin(perpAngle);
double p2X = baseX - (arrowWidth / 2) * Math.Cos(perpAngle);
double p2Y = baseY - (arrowWidth / 2) * Math.Sin(perpAngle);
var arrow = new Solid(new Point3d(px, py, 0), new Point3d(p1X, p1Y, 0), new Point3d(p2X, p2Y, 0));
arrow.ColorIndex = 4;
ctx.Btr.AppendEntity(arrow);
ctx.Tr.AddNewlyCreatedDBObject(arrow, true);
// 左侧弧线:从(ox, oy+H)到(ox, oy),向左凸出(正凸度)
var leftArc = new Polyline();
leftArc.AddVertexAt(0, new Point2d(ox, oy + H), bulge, 0, 0); // 起点(上端),设置凸度
leftArc.AddVertexAt(1, new Point2d(ox, oy), 0, 0, 0); // 终点(下端)
ctx.Style?.Apply(leftArc, DrawingStyleManager.Role.OutlineBold);
ctx.Btr.AppendEntity(leftArc);
ctx.Tr.AddNewlyCreatedDBObject(leftArc, true);
var textStr = $"R\\U+2264{val.Value}";
var text = new DBText();
text.TextString = textStr;
text.Height = 3.5;
text.ColorIndex = 4; // Cyan
text.Rotation = angleRad;
text.HorizontalMode = TextHorizontalMode.TextCenter;
text.VerticalMode = TextVerticalMode.TextBottom;
double offsetX = 2.0 * Math.Cos(angleRad + Math.PI / 2);
double offsetY = 2.0 * Math.Sin(angleRad + Math.PI / 2);
var tp = new Point3d(ex + offsetX, ey + offsetY, 0);
text.AlignmentPoint = tp;
text.Position = tp;
// 右侧弧线:从(ox+W, oy)到(ox+W, oy+H),向右凸出(正凸度)
var rightArc = new Polyline();
rightArc.AddVertexAt(0, new Point2d(ox + W, oy), bulge, 0, 0); // 起点(下端),设置凸度
rightArc.AddVertexAt(1, new Point2d(ox + W, oy + H), 0, 0, 0); // 终点(上端)
ctx.Style?.Apply(rightArc, DrawingStyleManager.Role.OutlineBold);
ctx.Btr.AppendEntity(rightArc);
ctx.Tr.AddNewlyCreatedDBObject(rightArc, true);
}
catch
{
// ignore
ctx.Style?.Apply(text, DrawingStyleManager.Role.Text);
text.ColorIndex = 4;
ctx.Btr.AppendEntity(text);
ctx.Tr.AddNewlyCreatedDBObject(text, true);
}
catch { }
}
private static void DrawHorizontalCenterLine(FeatureDrivenDrawer.DrawingContext ctx, double centerY, double xLeft, double xRight, bool hasBreak = false, double xBreak = 0, double breakWidth = 0)
@ -376,47 +525,7 @@ namespace CadParamPluging.Cad
ctx.Tr.AddNewlyCreatedDBObject(line2, true);
}
/// <summary>
/// 绘制带断口的矩形轮廓(在断线位置打断上下横线)
/// </summary>
private static void DrawRectWithBreak(FeatureDrivenDrawer.DrawingContext ctx, double x, double y, double w, double h, double r, double xBreak, double breakWidth)
{
// 左边竖线
var leftLine = new Line(new Point3d(x, y, 0), new Point3d(x, y + h, 0));
ctx.Style?.Apply(leftLine, DrawingStyleManager.Role.OutlineBold);
ctx.Btr.AppendEntity(leftLine);
ctx.Tr.AddNewlyCreatedDBObject(leftLine, true);
// 右边竖线
var rightLine = new Line(new Point3d(x + w, y, 0), new Point3d(x + w, y + h, 0));
ctx.Style?.Apply(rightLine, DrawingStyleManager.Role.OutlineBold);
ctx.Btr.AppendEntity(rightLine);
ctx.Tr.AddNewlyCreatedDBObject(rightLine, true);
// 底边:断开 [xBreak, xBreak + breakWidth]
// 左段
var bottomLeft = new Line(new Point3d(x, y, 0), new Point3d(xBreak, y, 0));
ctx.Style?.Apply(bottomLeft, DrawingStyleManager.Role.OutlineBold);
ctx.Btr.AppendEntity(bottomLeft);
ctx.Tr.AddNewlyCreatedDBObject(bottomLeft, true);
// 右段
var bottomRight = new Line(new Point3d(xBreak + breakWidth, y, 0), new Point3d(x + w, y, 0));
ctx.Style?.Apply(bottomRight, DrawingStyleManager.Role.OutlineBold);
ctx.Btr.AppendEntity(bottomRight);
ctx.Tr.AddNewlyCreatedDBObject(bottomRight, true);
// 顶边:断开 [xBreak, xBreak + breakWidth]
// 左段
var topLeft = new Line(new Point3d(x, y + h, 0), new Point3d(xBreak, y + h, 0));
ctx.Style?.Apply(topLeft, DrawingStyleManager.Role.OutlineBold);
ctx.Btr.AppendEntity(topLeft);
ctx.Tr.AddNewlyCreatedDBObject(topLeft, true);
// 右段
var topRight = new Line(new Point3d(xBreak + breakWidth, y + h, 0), new Point3d(x + w, y + h, 0));
ctx.Style?.Apply(topRight, DrawingStyleManager.Role.OutlineBold);
ctx.Btr.AppendEntity(topRight);
ctx.Tr.AddNewlyCreatedDBObject(topRight, true);
}
// Legacy box-drawing method replaced.
/// <summary>
/// 绘制带断口的零件轮廓(在断线位置打断上下横线)