座標(または基準線)寸法は、起点からフィーチャ(部品の穴など)までの水平および垂直距離を示します。これらの寸法は、起点からフィーチャまでの正確な距離を管理することで、誤差の累積を防ぎます。

座標寸法は、X 座標または Y 座標、および引出線で構成されます。座標寸法の X 座標値は、データムからフィーチャまでの距離を X 軸に沿って計測したものです。Y 基準の座標寸法は、Y 軸上の起点からフィーチャまでの距離を示します。AutoCAD は、現在の UCS の原点を使用して、計測する座標を決定します。座標の絶対値が使用されます。
寸法値は、現在の寸法スタイルで定義された方向に関係なく、座標寸法の引出線に沿って表示されます。既定の寸法値を使用するか、自分の寸法値を優先することができます。
座標寸法を記入するには、OrdinateDimension オブジェクトのインスタンスを作成します。OrdinateDimension オブジェクトのインスタンスを作成するときは、そのコンストラクタでオプションのパラメータ セットを使用できます。新しい OrdinateDimension オブジェクトの作成時には、次のパラメータを指定できます。
OrdinateDimension オブジェクト コンストラクタに最初に渡される値は、寸法が X 座標または Y 座標の座標寸法のどちらであるかを指定するブール値フラグです。TRUE を入力すると、X 座標の座標寸法が作成されます。FALSE を入力すると、Y 座標の座標寸法が作成されます。また、UsingXAxis プロパティを使用して座標寸法が X 座標または Y 座標のどちらであるかを指定することができます。
次の例は、モデル空間に座標寸法を記入します。
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry
<CommandMethod("CreateOrdinateDimension")> _
Public Sub CreateOrdinateDimension()
'' 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 an ordinate dimension
Using acOrdDim As OrdinateDimension = New OrdinateDimension()
acOrdDim.UsingXAxis = True
acOrdDim.DefiningPoint = New Point3d(5, 5, 0)
acOrdDim.LeaderEndPoint = New Point3d(10, 5, 0)
acOrdDim.DimensionStyle = acCurDb.Dimstyle
'' Add the new object to Model space and the transaction
acBlkTblRec.AppendEntity(acOrdDim)
acTrans.AddNewlyCreatedDBObject(acOrdDim, True)
End Using
'' Commit the changes and dispose of the transaction
acTrans.Commit()
End Using
End Sub
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
[CommandMethod("CreateOrdinateDimension")]
public static void CreateOrdinateDimension()
{
// 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 an ordinate dimension
using (OrdinateDimension acOrdDim = new OrdinateDimension())
{
acOrdDim.UsingXAxis = true;
acOrdDim.DefiningPoint = new Point3d(5, 5, 0);
acOrdDim.LeaderEndPoint = new Point3d(10, 5, 0);
acOrdDim.DimensionStyle = acCurDb.Dimstyle;
// Add the new object to Model space and the transaction
acBlkTblRec.AppendEntity(acOrdDim);
acTrans.AddNewlyCreatedDBObject(acOrdDim, true);
}
// Commit the changes and dispose of the transaction
acTrans.Commit();
}
}
Sub CreateOrdinateDimension()
Dim dimObj As AcadDimOrdinate
Dim definingPoint(0 To 2) As Double
Dim leaderEndPoint(0 To 2) As Double
Dim useXAxis As Boolean
' Define the dimension
definingPoint(0) = 5
definingPoint(1) = 5
definingPoint(2) = 0
leaderEndPoint(0) = 10
leaderEndPoint(1) = 5
leaderEndPoint(2) = 0
useXAxis = True
' Create an ordinate dimension in model space
Set dimObj = ThisDrawing.ModelSpace. _
AddDimOrdinate(definingPoint, _
leaderEndPoint, useXAxis)
ZoomAll
End Sub