Create Radial Dimensions
 
 
 

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.

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.)

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:

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.

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

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

Create a radial dimension

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 Code Reference