| 创建角度维度 (.NET) 角度尺寸测量两条线或三点之间的角度。例如,您可以使用它们来测量圆的两个半径之间的角度。尺寸线形成一个圆弧。角度尺寸是通过创建 或 对象的实例来创建的。LineAngularDimension2Point3AngularDimension 
 创建 or 对象的实例时,构造函数可以选择接受设置参数。创建新对象时,可以提供以下参数:LineAngularDimension2Point3AngularDimensionLineAngularDimension2 
 创建新对象时,可以提供以下参数:Point3AngularDimension 
 创建角度维度本示例在模型空间中创建一个角度维度。 VB.NETImports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry
 
<CommandMethod("CreateAngularDimension")> _
Public Sub CreateAngularDimension()
    '' 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 angular dimension
        Using acLinAngDim As LineAngularDimension2 = New LineAngularDimension2()
            acLinAngDim.XLine1Start = New Point3d(0, 5, 0)
            acLinAngDim.XLine1End = New Point3d(1, 7, 0)
            acLinAngDim.XLine2Start = New Point3d(0, 5, 0)
            acLinAngDim.XLine2End = New Point3d(1, 3, 0)
            acLinAngDim.ArcPoint = New Point3d(3, 5, 0)
            acLinAngDim.DimensionStyle = acCurDb.Dimstyle
            '' Add the new object to Model space and the transaction
            acBlkTblRec.AppendEntity(acLinAngDim)
            acTrans.AddNewlyCreatedDBObject(acLinAngDim, True)
        End Using
        '' Commit the changes and dispose of the transaction
        acTrans.Commit()
    End Using
End SubC#using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
 
[CommandMethod("CreateAngularDimension")]
public static void CreateAngularDimension()
{
    // 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 angular dimension
        using (LineAngularDimension2 acLinAngDim = new LineAngularDimension2())
        {
            acLinAngDim.XLine1Start = new Point3d(0, 5, 0);
            acLinAngDim.XLine1End = new Point3d(1, 7, 0);
            acLinAngDim.XLine2Start = new Point3d(0, 5, 0);
            acLinAngDim.XLine2End = new Point3d(1, 3, 0);
            acLinAngDim.ArcPoint = new Point3d(3, 5, 0);
            acLinAngDim.DimensionStyle = acCurDb.Dimstyle;
            // Add the new object to Model space and the transaction
            acBlkTblRec.AppendEntity(acLinAngDim);
            acTrans.AddNewlyCreatedDBObject(acLinAngDim, true);
        }
        // Commit the changes and dispose of the transaction
        acTrans.Commit();
    }
}VBA/ActiveX 代码参考Sub CreateAngularDimension()
    Dim dimObj As AcadDimAngular
    Dim angVert(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double
 
    ' Define the dimension
    angVert(0) = 0
    angVert(1) = 5
    angVert(2) = 0
    FirstPoint(0) = 1
    FirstPoint(1) = 7
    FirstPoint(2) = 0
    SecondPoint(0) = 1
    SecondPoint(1) = 3
    SecondPoint(2) = 0
    TextPoint(0) = 3
    TextPoint(1) = 5
    TextPoint(2) = 0
 
    ' Create the angular dimension in model space
    Set dimObj = ThisDrawing.ModelSpace. _
                    AddDimAngular(angVert, FirstPoint, SecondPoint, TextPoint)
    ZoomAll
End Sub相关概念父主题: | 
 |Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
GMT+8, 2025-10-31 14:08
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.