WebCAD-Lib-TS API 文档 - v1.0.0
    Preparing search index...

    Class DimensionStyle

    标注样式类

    // 创建默认样式
    const style = new DimensionStyle();

    // 自定义样式
    style.arrowSize = 3.0;
    style.textHeight = 3.5;
    style.decimalPlaces = 2;
    style.textColor = 7; // 白色

    // 应用到标注
    dimension.applyStyle(style);
    Index

    Constructors

    • 创建默认标注样式

      Parameters

      • name: string = 'Standard'

      Returns DimensionStyle

    Properties

    name: string = 'Standard'

    样式名称

    dimensionLineColor: number = 256

    标注线颜色 (256=随层)

    extensionLineColor: number = 256

    延伸线颜色 (256=随层)

    dimensionLineWeight: number = -3

    标注线线宽 (-3=随层)

    extensionLineWeight: number = -3

    延伸线线宽 (-3=随层)

    extensionLineExtend: number = 1.25

    延伸线超出量

    extensionLineOffset: number = 0.625

    延伸线偏移(起点偏移)

    suppressDimensionLine1: boolean = false

    是否抑制第一条标注线

    suppressDimensionLine2: boolean = false

    是否抑制第二条标注线

    suppressExtensionLine1: boolean = false

    是否抑制第一条延伸线

    suppressExtensionLine2: boolean = false

    是否抑制第二条延伸线

    extensionLineFixedLength: number = 1.0

    延伸线固定长度

    extensionLineFixedLengthEnabled: boolean = false

    是否使用固定长度延伸线

    arrowSize: number = 2.5

    箭头大小

    arrowType: DimensionArrowType = DimensionArrowType.ClosedFilled

    箭头类型

    arrow1Type: DimensionArrowType = DimensionArrowType.ClosedFilled

    第一个箭头类型

    arrow2Type: DimensionArrowType = DimensionArrowType.ClosedFilled

    第二个箭头类型

    useSeparateArrows: boolean = false

    是否使用独立箭头

    tickSize: number = 0

    刻度线大小(0表示使用箭头)

    centerMarkSize: number = 2.5

    圆心标记大小(>0标记,<0中心线,0无)

    arcSymbolType: ArcSymbolType = ArcSymbolType.BeforeText

    弧长符号类型

    textStyleName: string = 'Standard'

    文字样式名称

    textColor: number = 256

    文字颜色 (256=随层)

    textHeight: number = 2.5

    文字高度

    toleranceTextScaleFactor: number = 1.0

    公差文字比例因子

    textGap: number = 0.625

    文字与标注线间距

    textVerticalPosition: DimensionTextVerticalPosition = DimensionTextVerticalPosition.Above

    文字垂直位置

    textAlignment: DimensionTextAlignment = DimensionTextAlignment.Centered

    文字水平对齐

    textInsideHorizontal: boolean = true

    文字在内部是否水平

    textOutsideHorizontal: boolean = true

    文字在外部是否水平

    textLeftToRight: boolean = true

    文字方向(true=从左到右)

    scaleFactor: number = 1.0

    全局缩放因子

    fitMode: number = 3

    箭头和文字适合方式 (0-3)

    forceTextInside: boolean = false

    强制文字在内部

    suppressOutsideExtensionLines: boolean = false

    抑制外部延伸线

    alwaysDrawDimensionLine: boolean = false

    始终绘制标注线

    textMovementMode: number = 0

    文字移动方式 (0-2)

    linearScaleFactor: number = 1.0

    线性比例因子

    linearUnitFormat: DimensionUnitFormat = DimensionUnitFormat.Decimal

    线性单位格式

    decimalPlaces: number = 4

    小数位数

    roundOff: number = 0

    舍入值

    prefix: string = ''

    后缀/前缀

    suffix: string = ''
    decimalSeparator: string = '.'

    小数分隔符

    angularUnitFormat: DimensionAngularFormat = DimensionAngularFormat.DecimalDegrees

    角度单位格式

    angularDecimalPlaces: number = 0

    角度小数位数

    suppressAngularLeadingZeros: boolean = false

    是否抑制角度零

    suppressAngularTrailingZeros: boolean = false
    showTolerance: boolean = false

    是否显示公差

    showLimits: boolean = false

    是否显示界限

    tolerancePlus: number = 0

    正公差

    toleranceMinus: number = 0

    负公差

    toleranceAlignment: number = 1

    公差垂直对齐 (0-2)

    toleranceDecimalPlaces: number = 4

    公差小数位数

    Methods

    • 获取实际箭头大小(考虑缩放因子)

      Returns number

    • 获取实际文字高度(考虑缩放因子)

      Returns number

    • 获取实际文字间距(考虑缩放因子)

      Returns number

    • 获取实际延伸线超出量(考虑缩放因子)

      Returns number

    • 获取实际延伸线偏移(考虑缩放因子)

      Returns number

    • 将 DimensionArrowType 转换为 ArrowTypeEnum

      Parameters

      Returns "SOLID_DOT" | "OPEN_ARROW" | "SOLID_ARROW" | "NONE"