The Dimension class is the base class for all dimension entities in AutoCAD including linear, aligned, rotated, angular, radial, and diameter dimensions.
Autodesk.AutoCAD.DatabaseServices
System.Object
└─ RXObject
└─ DBObject
└─ Entity
└─ Dimension
├─ AlignedDimension
├─ RotatedDimension
├─ RadialDimension
├─ DiametricDimension
└─ AngularDimension
| Property | Type | Description |
|---|---|---|
DimensionText |
string |
Gets/sets the dimension text override |
Measurement |
double |
Gets the measured value |
DimensionStyle |
ObjectId |
Gets/sets the dimension style |
TextPosition |
Point3d |
Gets/sets the text position |
TextRotation |
double |
Gets/sets the text rotation |
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockTableRecord btr = tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord;
Point3d pt1 = new Point3d(0, 0, 0);
Point3d pt2 = new Point3d(100, 50, 0);
Point3d dimLinePoint = new Point3d(50, 75, 0);
AlignedDimension dim = new AlignedDimension(pt1, pt2, dimLinePoint, "", db.Dimstyle);
btr.AppendEntity(dim);
tr.AddNewlyCreatedDBObject(dim, true);
tr.Commit();
}- Entity - Base class
- DimStyleTable - Dimension styles