已知圆弧两点和圆弧角-画弧!
本帖最后由 作者 于 2008-9-9 10:49:28 编辑这是Autocad的问题
根据已知条件我可以得到如下条件 圆弧的两点,起始角和终止角
条件是圆弧上两点x1,y1x2,y2 ,alfa1,alfa2
求 圆心坐标xc,yc和半径的算法比较麻烦.
变通方法
Sub msl()
'tt = "(command " & Chr(34) & "arc" & Chr(34) & " pp " & Chr(34) & "e" & Chr(34) & " ppp " & Chr(34) & "a" & Chr(34) & " 152) "
tt = "(command " & Chr(34) & "arc" & Chr(34) & "(list -9.24 14.04 0)" & Chr(34) & "e" & Chr(34) & "(list -4.62 14.04 0)" & Chr(34) & "a" & Chr(34) & " " & 1.967808816 * 180 / 3.1415926 & ") "
ThisDrawing.SendCommand tt
End Sub
下面程序各位大侠拿去用,比较实用.
Sub DrawingArc()
nn = ThisDrawing.ModelSpace.Count - 1
Dim objArc As AcadArc, objLine As AcadLine
With ThisDrawing.ModelSpace
For ii = 0 To nn
'Debug.Print .Item(ii).ObjectName
Select Case .Item(ii).ObjectName
Case "AcDbLine"
Case "AcDbArc"
Set objArc = .Item(ii)
tt = "(command " & Chr(34) & "arc" & Chr(34) & "(list"
For jj = 0 To 2
tt = tt & " " & Round(objArc.StartPoint(jj), 2)
Next jj
tt = tt & ")" & Chr(34) & "e" & Chr(34) & "(list"
For jj = 0 To 2
tt = tt & " " & Round(objArc.EndPoint(jj), 2)
Next jj
tt = tt & ") " & Chr(34) & "a" & Chr(34) & " " & objArc.TotalAngle * 180 / 3.1415926 & ") "
Debug.Print tt
ThisDrawing.SendCommand tt
End Select
Next ii
End With
End Sub
页:
[1]