修改线条箭头样式
This commit is contained in:
parent
8435f06848
commit
034c461739
@ -648,7 +648,8 @@ namespace CadParamPluging.Cad
|
||||
new Point3d(ox + radius, oy, 0),
|
||||
new Point3d(ox + radius / 2, oy - 20, 0),
|
||||
0,
|
||||
dimText);
|
||||
dimText,
|
||||
ApplyHalfSideDimStyle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -686,7 +687,8 @@ namespace CadParamPluging.Cad
|
||||
new Point3d(xInnerRight, yBottom, 0),
|
||||
new Point3d(oxAxis + innerRadius / 2, dimLineY, 0),
|
||||
0,
|
||||
dimText);
|
||||
dimText,
|
||||
ApplyHalfSideDimStyle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -1600,8 +1602,34 @@ namespace CadParamPluging.Cad
|
||||
return $"{baseText}{{\\H{tolScale}x;{single}}}";
|
||||
}
|
||||
|
||||
private static void ApplyHalfSideDimStyle(Dimension dim, DrawingContext ctx)
|
||||
{
|
||||
// 按需求修改半边标注样式:
|
||||
// 尺寸线 1和2开 (默认即为开)
|
||||
// 界线1关 (Dimse1 = true)
|
||||
// 界线2开 (Dimse2 = false)
|
||||
TrySetDimProp(dim, "Dimse1", true);
|
||||
TrySetDimProp(dim, "Dimse2", false);
|
||||
|
||||
// 箭头1 无 (Dimblk1 = _NONE)
|
||||
// 箭头2 实心闭合 (Dimblk2 = Default)
|
||||
try
|
||||
{
|
||||
// 需要设置 Dimsah = true 才能分别设置箭头
|
||||
TrySetDimProp(dim, "Dimsah", true);
|
||||
|
||||
// 尝试设置箭头1为 _NONE
|
||||
var bt = (BlockTable)ctx.Tr.GetObject(ctx.Db.BlockTableId, OpenMode.ForRead);
|
||||
if (bt.Has("_NONE"))
|
||||
{
|
||||
dim.Dimblk1 = bt["_NONE"];
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private static void AddLinearDim(DrawingContext ctx, Point3d pt1, Point3d pt2, Point3d dimLinePt,
|
||||
double rotationDeg, string textOverride)
|
||||
double rotationDeg, string textOverride, Action<Dimension, DrawingContext> customizer = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -1617,6 +1645,9 @@ namespace CadParamPluging.Cad
|
||||
try { dim.Normal = Vector3d.ZAxis; } catch { }
|
||||
TryApplyDimSizeOverrides(dim);
|
||||
TryApplyDimLayoutOverrides(dim, pt1, pt2, dimLinePt, rotRad);
|
||||
|
||||
customizer?.Invoke(dim, ctx);
|
||||
|
||||
ctx.Style?.Apply(dim, DrawingStyleManager.Role.Dimension);
|
||||
ctx.Btr.AppendEntity(dim);
|
||||
ctx.Tr.AddNewlyCreatedDBObject(dim, true);
|
||||
|
||||
@ -961,7 +961,7 @@ namespace CadParamPluging.Cad
|
||||
try
|
||||
{
|
||||
// Keep the template's white frame but enforce the desired lineweight.
|
||||
ApplyWhiteFrameLineWeight(ctx, LineWeight.LineWeight050);
|
||||
ApplyWhiteFrameLineWeight(ctx, LineWeight.LineWeight015);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user