moniz 发表于 2022-7-6 22:24:00

获取角度

大家好。
 
我试图通过vba复制\u dimanagular命令,但失败了!
 
我试过这个:
 

ponto1(0) = coords(c - 2)
ponto1(1) = coords(c - 1)
                     
ponto2(0) = coords(c + 2)
ponto2(1) = coords(c + 3)
                        
texto(0) = bloco.InsertionPoint(0) + 1
texto(1) = bloco.InsertionPoint(1) + 1
                        
vertice(0) = bloco.InsertionPoint(0)
vertice(1) = bloco.InsertionPoint(1)

Set angulo = ThisDrawing.ModelSpace.AddDimAngular(vertice, ponto2, vertice, texto)

 
但它甚至没有将角度添加到绘图中。
 
我也有它的功能,我从一些网站
 

Private Function AngleSample(ByVal vPoint1 As Variant, ByVal vPoint2 As Variant) As String

Dim vTrans1 As Variant
Dim vTrans2 As Variant
Dim d As Double
Dim strMsg As String
With ThisDrawing.Utility
On Error Resume Next
vPoint1 = .GetPoint(, "Select Point 1: " & vbCr)
If Err <> 0 Then Exit Sub
vTrans1 = .TranslateCoordinates(vPoint1, acWorld, acUCS, 0)
vPoint2 = .GetPoint(vTrans1, "Select Point 2: ")
If Err <> 0 Then Exit Sub
On Error GoTo 0
vTrans2 = .TranslateCoordinates(vPoint2, acWorld, acUCS, 0)
d = .AngleFromXAxis(vTrans1, vTrans2)
strMsg = .AngleToString(d, acDegrees, 2)
.Prompt "Angle in Degrees is " & strMsg & vbLf
End With


AngleSample = strMsg
End Function


 
 
但它并没有回报我所期望的。
 
http://s12.postimage.org/qhwa0g2st/exemplo.jpg
 
我想得到所有红白方块的角度。
 
有什么想法吗?
页: [1]
查看完整版本: 获取角度