创建半径标注
 
 

Radial dimensions measure the radii and diameters of arcs and circles. Radial and diametric dimensions are created by creaing instances of RadialDimension and DiametricDimension objects.

半径标注用于测量圆弧和圆的半径与直径。半径或直径标注是通过创建 RadialDimension 和 DiametricDimension 对象的实例来创建的。

Different types of radial dimensions are created depending on the size of the circle or arc, the position of the dimension text, and the values in the DIMUPT, DIMTOFL, DIMFIT, DIMTIH, DIMTOH, DIMJUST, and DIMTAD dimension system variables. (System variables can be queried or set using the GetSystemVariable and SetSystemVariable methods.)

根据圆或圆弧的大小、标注文本的位置以及 DIMUPT、DIMTOFL、DIMFIT、DIMTIH、DIMTOH、DIMJUST 和 DIMTAD 标注系统变量中的值,可以创建各种类型的半径标注。(系统变量可以使用 GetSystemVariableSetSystemVariable 方法查询或设置。)

For horizontal dimension text, if the angle of the dimension line is more than 15 degrees from horizontal, and is outside the circle or arc, AutoCAD draws a hook line, also called a landing or dogleg. The hook line is placed next to or belowthe dimension text, as shown in the following illustrations:

对于水平标注文字,如果尺寸线与水平线的角度大于 15 度,而且位于圆或圆弧的外面,则 AutoCAD 将绘制钩线,也称为引导线或弯钩。钩线为一个箭头的长度,放在标注文字的旁边,如以下图解所示:

When you create an instance of a RadialDimension object, you have the option to specify the center and chord points, the length of the leader, dimension text, and the dimension style to apply. Creating a DiametricDimension object is similar to a RadialDimension object except you specify chord and far chord points instead of a center and chord point.

当创建 RadialDimension 对象的实例后,用户可以指定圆心和引线附着点坐标、引线长度、标注文字和应用的标注样式这些选项。创建 DiametricDimension 对象与创建 RadialDimension 对象相似,除了使用指定引线附着点和远端引线附着点代替加以与引线附着点外。

The LeaderLength property specifies the distance from the ChordPoint to the annotation text (or stop if no hook line is necessary).

LeaderLength 属性指定从 ChordPoint 到标注为注释文字的距离(如果不需要钩线则停止)。

For additional information about creating radial dimensions, see “Create Radial Dimensions” in the AutoCAD User's Guide.

更多有关创建半径标注的详细信息,请参见《AutoCAD 用户手册》中的“创建半径标注”。

创建半径标注

This example creates a radial dimension in Model space.

本例在模型空间中创建一个半径标注。

VB.NET

Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry
 
<CommandMethod("CreateRadialDimension")> _
Public Sub CreateRadialDimension()
  '' 获得当前数据库  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 radial dimension
      Dim acRadDim As RadialDimension = New RadialDimension()
      acRadDim.SetDatabaseDefaults()
      acRadDim.Center = New Point3d(0, 0, 0)
      acRadDim.ChordPoint = New Point3d(5, 5, 0)
      acRadDim.LeaderLength = 5
      acRadDim.DimensionStyle = acCurDb.Dimstyle
 
      '' 添加新对象到模型空间和事务中   Add the new object to Model space and the transaction
      acBlkTblRec.AppendEntity(acRadDim)
      acTrans.AddNewlyCreatedDBObject(acRadDim, True)
 
      '' 提交修改并销毁事务  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.Geometry;
 
[CommandMethod("CreateRadialDimension")]
public static void CreateRadialDimension()
{
  // 获得当前数据库  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 radial dimension
      RadialDimension acRadDim = new RadialDimension();
      acRadDim.SetDatabaseDefaults();
      acRadDim.Center = new Point3d(0, 0, 0);
      acRadDim.ChordPoint = new Point3d(5, 5, 0);
      acRadDim.LeaderLength = 5;
      acRadDim.DimensionStyle = acCurDb.Dimstyle;
 
      // 添加新对象到模型空间和事务中   Add the new object to Model space and the transaction
      acBlkTblRec.AppendEntity(acRadDim);
      acTrans.AddNewlyCreatedDBObject(acRadDim, true);
 
      // 提交修改并销毁事务  Commit the changes and dispose of the transaction
      acTrans.Commit();
  }
}
VBA/ActiveX 代码参考