替代标注样式
 
 

Each dimension has the capability of overriding the settings assigned to it by a dimension style. The following properties are available for most dimension objects:

每个标注都可以替代该标注的标注样式中的设置值。以下特性可用于大多数标注对象:

Dimatfit

Specifies the display of dimension lines inside extension lines only, and forces dimension text and arrowheads inside or outside extension lines.

 

指定标注线仅仅显示在尺寸界线的内部,并强制标注文字和箭头在尺寸界线的内部或外部。

Dimaltrnd

Specifies the rounding of alternate units.

 

指定换算单位的舍入。

Dimasz

Specifies the size of dimension line arrowheads, leader line arrowheads, and hook lines.

 

指定尺寸线箭头、引线箭头和勾线的大小。  

Dimaunit

Specifies the unit format for angular dimensions.

 

指定角度标注的单位格式。

Dimblk1, Dimblk2

Specifies the blocks to use for arrowheads of the dimension line.

 

指定用作尺寸线箭头的块。

Dimcen

Specifies the type and size of center mark for radial and diametric dimensions.

 

指定半径标注和直径标注的中心标记大小和类型。

Dimclrd

Specifies the color of the dimension line for a dimension, leader, or tolerance object.

 

指定标注、引线或公差对象的尺寸线颜色。

Dimclre

Specifies the color for dimension extension lines.

 

指定标注尺寸界线的颜色。

Dimclrt

Specifies the color of the text for dimension and tolerance objects.

 

指定标注和公差对象的文字颜色。

Dimdec

Specifies the number of decimal places displayed for the primary units of a dimension or tolerance.

 

指定标注或公差的主单位显示的小数位数。

Dimdsep

Specifies the character to be used as the decimal separator in decimal dimension and tolerance values.

 

指定在十进制标注和公差值中用作小数分隔符的字符

Dimexe

Specifies the distance the extension line extends beyond the dimension line.

 

指定尺寸界线超出尺寸线的距离。

Dimexo

Specifies the distance the extension lines are offset from the origin points.

 

指定尺寸界线从原点偏移的距离。

Dimfrac

Specifies the format of fractional values in dimensions and tolerances.

 

指定标注和公差中的分数值的格式。

Dimgap

Specifies the distance between the dimension text and the dimension line when you break the dimension line to accommodate dimension text.

 

指定当用户截断尺寸线以放置标注文字时,标注文字与尺寸线之间的距离。

Dimlfac

Specifies a global scale factor for linear dimension measurements.

 

指定线性标注测量值的全局比例因子。

Dimltex1, Dimltex2

Specifies the linetypes for the extension lines.

 

指定尺寸界线的线型。

Dimlwd

Specifies the lineweight for the dimension line.

 

指定尺寸线的线宽。

Dimlwe

Specifies the lineweight for the extension lines.

 

指定尺寸界线的线宽。

Dimjust

Specifies the horizontal justification for dimension text.

 

指定标注文字的水平对正方式。

Dimrnd

Specifies the distance rounding for dimension measurements.

 

指定尺寸测量值取整后的距离。

Dimsd1, Dimsd2

Specifies the suppression of the dimension lines.

 

指定是否隐藏尺寸线。

Dimse1, Dimse2

Specifies the suppression of extension lines.

 

指定是否隐藏尺寸界线。

Dimtad

Specifies the vertical position of text in relation to the dimension line.

 

指定与尺寸线相关联的文字的垂直位置。

Dimtdec

Specifies the precision of tolerance values in primary dimensions.

 

指定主标注中公差值的精度。

Dimtfac

Specifies a scale factor for the text height of tolerance values relative to the dimension text height.

 

指定公差值文字高度相对于标注文字高度的比例因子。

Dimlunit

Specifies the unit format for all dimensions except angular.

 

指定角度标注除外所有标注的单位格式。

Dimtih

Specifies if the dimension text is to be drawn inside the extension lines.

 

指定是否在尺寸界线之内绘制标注文字。

Dimtm

Specifies the minimum tolerance limit for dimension text.

 

指定标注文字的最小公差下限。

Dimtmove

Specifies how dimension text is drawn when text is moved.

 

指定当文字移动时标注文字的绘制方式。

Dimtofl

Specifies if a dimension line is drawn between the extension lines even when the text is placed outside the extension lines.

 

指定所有标注类型(坐标标注除外)的标注文字是否位于尺寸界线之内。

Dimtoh

Specifies the position of dimension text outside the extension lines for all dimension types except ordinate.

 

指定所有标注类型(坐标标注除外)的标注文字在尺寸界线之外的位置。

Dimtol

Specifies if tolerances are displayed with the dimension text.

 

指定公差是否要与标注文字一起显示。

Dimtolj

Specifies the vertical justification of tolerance values relative to the nominal dimension text.

 

指定公差值相对于标注文字的垂直对正方式

Dimtp

Specifies the maximum tolerance limit for dimension text.

 

指定标注文字公差的上限。

Dimtxt

Specifies the height for the dimension or tolerance text.

 

指定标注或公差文字的高度。

Dimzin

Specifies the suppression of leading and trailing zeros, and zero foot and inch measurements in dimension values.

 

指定是否隐藏标注值中的零英尺和零英寸测量值。

Prefix

Specifies the dimension value prefix.

 

指定标注值的前缀。

Suffix

Specifies the dimension value suffix.

 

指定标注值的后缀。

TextPrecision

Specifies the precision of angular dimension text.

 

指定角度标注文字的精度。

TextPosition

Specifies the dimension text position.

 

指定标注文字的位置。

TextRotation

Specifies the rotation angle of the dimension text.

 

指定标注文字的旋转角度。

为对齐标注输入用户定义的后缀

This example creates an aligned dimension in model space and uses the Suffix property to allow the user to change the text suffix for the dimension.

本例在模型空间中创建对齐标注,并使用 Suffix 特性让用户来修改标注的文字后缀。

VB.NET

Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.Geometry
 
<CommandMethod("AddDimensionTextSuffix")> _
Public Sub AddDimensionTextSuffix()
  '' 获得当前数据库  Get the current database
  Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
  Dim acCurDb As Database = acDoc.Database
 
  ''启动一个事务   Start a transaction
  Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
 
      '' 以只读方式打开块表   Open the Block table for read
      Dim acBlkTbl As BlockTable
      acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, _
                                   OpenMode.ForRead)
 
      '' 以写方式打开模型空间块表记录   Open the Block table record Model space for write
      Dim acBlkTblRec As BlockTableRecord
      acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), _
                                      OpenMode.ForWrite)
 
      '' 创建对象标注  Create the aligned dimension
      Dim acAliDim As AlignedDimension = New AlignedDimension()
      acAliDim.SetDatabaseDefaults()
      acAliDim.XLine1Point = New Point3d(0, 5, 0)
      acAliDim.XLine2Point = New Point3d(5, 5, 0)
      acAliDim.DimLinePoint = New Point3d(5, 7, 0)
      acAliDim.DimensionStyle = acCurDb.Dimstyle
 
      '' 添加新对象到模型空间和事务中   Add the new object to Model space and the transaction
      acBlkTblRec.AppendEntity(acAliDim)
      acTrans.AddNewlyCreatedDBObject(acAliDim, True)
 
      ''追加一个后缀到标注文字中  Append a suffix to the dimension text
      Dim pStrOpts As PromptStringOptions = New PromptStringOptions("")
 
      pStrOpts.Message = vbLf & "Enter a new text suffix for the dimension: "
      pStrOpts.AllowSpaces = True
      Dim pStrRes As PromptResult = acDoc.Editor.GetString(pStrOpts)
 
      If pStrRes.Status = PromptStatus.OK Then
          acAliDim.Suffix = pStrRes.StringResult
      End If
 
      '' 提交修改并销毁事务  Commit the changes and dispose of the transaction
      acTrans.Commit()
  End Using
End Sub

C#

using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
 
[CommandMethod("AddDimensionTextSuffix")]
public static void AddDimensionTextSuffix()
{
  // 获得当前数据库  Get the current database
  Document acDoc = Application.DocumentManager.MdiActiveDocument;
  Database acCurDb = acDoc.Database;
 
  // 启动一个事务  Start a transaction
  using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
  {
      // 以只读方式打开块表   Open the Block table for read
      BlockTable acBlkTbl;
      acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId,
                                   OpenMode.ForRead) as BlockTable;
 
      // 以写方式打开模型空间块表记录   Open the Block table record Model space for write
      BlockTableRecord acBlkTblRec;
      acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace],
                                      OpenMode.ForWrite) as BlockTableRecord;
 
      // Create the aligned dimension
      AlignedDimension acAliDim = new AlignedDimension();
      acAliDim.SetDatabaseDefaults();
      acAliDim.XLine1Point = new Point3d(0, 5, 0);
      acAliDim.XLine2Point = new Point3d(5, 5, 0);
      acAliDim.DimLinePoint = new Point3d(5, 7, 0);
      acAliDim.DimensionStyle = acCurDb.Dimstyle;
 
      // 添加新对象到模型空间和事务中   Add the new object to Model space and the transaction
      acBlkTblRec.AppendEntity(acAliDim);
      acTrans.AddNewlyCreatedDBObject(acAliDim, true);
 
      // Append a suffix to the dimension text
      PromptStringOptions pStrOpts = new PromptStringOptions("");
 
      pStrOpts.Message = "\nEnter a new text suffix for the dimension: ";
      pStrOpts.AllowSpaces = true;
      PromptResult pStrRes = acDoc.Editor.GetString(pStrOpts);
 
      if (pStrRes.Status == PromptStatus.OK)
      {
          acAliDim.Suffix = pStrRes.StringResult;
      }
 
      // 提交修改并销毁事务  Commit the changes and dispose of the transaction
      acTrans.Commit();
  }
}
VBA/ActiveX 代码参考