输入两点和弧长,画弧,谁能帮我,谢谢。
输入两点和弧长,画弧,谁能帮我,弧的方向列所谓,画两个也可以。VBA,lisp,都可以。谢谢。 <P>我以前写的。还有LISP,请到LISP版:<A href="dispbbs.asp?boardid=3&id=42791" target="_blank" >dispbbs.asp?boardid=3&id=42791</A></P><P><FONT face=宋体 size=2>Sub ddARC()<BR>Dim ddARC As AcadArc<BR>Dim S, L, R, a0, a1, fx, flx, c, angs, ange As Double<BR>Dim pa, pb, cen As Variant<BR>Const PI = 3.1415926535<BR><BR>pa = ThisDrawing.Utility.GetPoint(, "请输入圆弧起点:")<BR>pb = ThisDrawing.Utility.GetPoint(pa, "请输入圆弧终点:")<BR>S = ThisDrawing.Utility.GetDistance(pa, "请输入圆弧弧长:")<BR><BR>L = dis(pa, pb)<BR>b = ThisDrawing.Utility.AngleFromXAxis(pa, pb)<BR><BR>If S <= L Then<BR>MsgBox "您要画的圆弧并不存在,请再执行一次程序!"<BR>End<BR>End If<BR><BR>a0 = 2<BR>a1 = a0<BR>Do<BR>a0 = a1<BR>fx = Sin(a0 / 2) / a0 - L / (2 * S)<BR>flx = (Cos(a0 / 2) * a0 * 0.5 - Sin(a0 / 2)) / (a0 * a0)<BR>a1 = a0 - fx / flx<BR>Loop While Abs(a1 - a0) > 0.0000000001<BR><BR>R = S / a1<BR>c = b - a1 * 0.5 + 90 * PI / 180<BR>cen = ThisDrawing.Utility.PolarPoint(pa, c, R)<BR>angs = c + PI<BR>ange = angs + a1<BR><BR>Set ddARC = ThisDrawing.ModelSpace.AddArc(cen, R, angs, ange)<BR>End Sub<BR><BR>Public Function dis(pa, pb As Variant) As Double<BR>dis = ((pa(0) - pb(0)) ^ 2 + (pa(1) - pb(1)) ^ 2 + (pa(2) - pb(2)) ^ 2) ^ 0.5<BR>End Function<BR></FONT></P> <P>发完贴子,就不来了,这样的人以后谁愿意帮你!</P> <P>正需要这样的程序呢</P>
<P>感谢!</P> 很受用啊。谢谢。 支持xxxxxx 谢谢楼主的分享!很有意思的代码,收藏备用。
页:
[1]