- Sub Example_AddDimRotated()
- ' 明经通道VBA示例,http://www.mjtd.com
-
- ' 该示例在模型空间中创建水平和垂直标注。
-
- Dim dimObj As AcadDimRotated
- Dim LineObj As AcadLine
- Dim point1(0 To 2) As Double
- Dim point2(0 To 2) As Double
- Dim location(0 To 2) As Double
- Dim rotAngle As Double
-
- ' 定义标注
- point1(0) = 0#: point1(1) = 0#: point1(2) = 0#
- point2(0) = 5#: point2(1) = 5#: point2(2) = 0#
- location(0) = 0#: location(1) = 0#: location(2) = 0#
-
- '绘制直线
- Set LineObj = ThisDrawing.ModelSpace.AddLine(point1, point2)
- LineObj.color = acRed
-
- ' 在模型空间中创建水平标注
- rotAngle = 0
- rotAngle = rotAngle * 3.141592 / 180# ' 转换为弧度
-
- Set dimObj = ThisDrawing.ModelSpace.AddDimRotated(point1, point2, location, rotAngle)
- dimObj.color = acGreen
-
- ' 在模型空间中创建垂直标注
- rotAngle = 90
- rotAngle = rotAngle * 3.141592 / 180# ' 转换为弧度
-
- Set dimObj = ThisDrawing.ModelSpace.AddDimRotated(point1, point2, location, rotAngle)
- dimObj.color = acGreen
-
- ThisDrawing.Application.ZoomExtents
- End Sub
|