xiug修改线条样式
This commit is contained in:
parent
c3188c9c0b
commit
8435f06848
@ -595,9 +595,34 @@ namespace CadParamPluging.Cad
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private static void DrawRingSymmetryAxis(DrawingContext ctx, double ox, double oy, double height)
|
private static void DrawRingSymmetryAxis(DrawingContext ctx, double ox, double oy, double height)
|
||||||
{
|
{
|
||||||
// 直接使用“高度标注”的两端点(锻件外轮廓的上下边),不做上下延长,避免越过图框上边界。
|
const double extend = 5.0; // 中心线在轮廓上下各延长一点(与其它中心线的延长量保持一致)
|
||||||
var y0 = oy;
|
const double frameMargin = 5.0; // 避免越过图框边界
|
||||||
var y1 = oy + height;
|
|
||||||
|
var y0 = oy - extend;
|
||||||
|
var y1 = oy + height + extend;
|
||||||
|
|
||||||
|
// 若能检测到白色外框,则把中心线端点夹在图框内(留出少量安全边距)。
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var frameExtents = TemplateDrawingService.ComputeWhiteFrameExtents(ctx?.Ctx);
|
||||||
|
if (frameExtents.HasValue)
|
||||||
|
{
|
||||||
|
var frame = frameExtents.Value;
|
||||||
|
y0 = Math.Max(y0, frame.MinPoint.Y + frameMargin);
|
||||||
|
y1 = Math.Min(y1, frame.MaxPoint.Y - frameMargin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
|
||||||
|
// 极端情况下(图框过小/检测异常导致端点反转)退回到原始高度。
|
||||||
|
if (y1 <= y0)
|
||||||
|
{
|
||||||
|
y0 = oy;
|
||||||
|
y1 = oy + height;
|
||||||
|
}
|
||||||
|
|
||||||
var line = new Line(new Point3d(ox, y0, 0), new Point3d(ox, y1, 0));
|
var line = new Line(new Point3d(ox, y0, 0), new Point3d(ox, y1, 0));
|
||||||
ctx.Style?.Apply(line, DrawingStyleManager.Role.Centerline);
|
ctx.Style?.Apply(line, DrawingStyleManager.Role.Centerline);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user