有关AddDimRotated的问题
请问如何添加一个测量y柱方向两点距离的标注呀。好像默认是绘制的水平方向的标注。 用ThisDrawing.ModelSpace.AddDimAligned代替 改变一种思路,的确得到了解决。谢谢 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
页:
[1]