diff --git a/Cad/FeatureDrivenDrawer.cs b/Cad/FeatureDrivenDrawer.cs index 7bfbb07..f531a82 100644 --- a/Cad/FeatureDrivenDrawer.cs +++ b/Cad/FeatureDrivenDrawer.cs @@ -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); } /// @@ -686,7 +687,8 @@ namespace CadParamPluging.Cad new Point3d(xInnerRight, yBottom, 0), new Point3d(oxAxis + innerRadius / 2, dimLineY, 0), 0, - dimText); + dimText, + ApplyHalfSideDimStyle); } /// @@ -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 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); diff --git a/Cad/TemplateDrawingService.cs b/Cad/TemplateDrawingService.cs index 896de75..2e2b629 100644 --- a/Cad/TemplateDrawingService.cs +++ b/Cad/TemplateDrawingService.cs @@ -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 {