如何通过三点作一段直线PLINE和圆弧PLINE?
已知Pt1,Pt2,Pt3,怎么样用才能作出一段PLINE,要求Pt1至Pt2为直线,Pt2至Pt3 之间为一圆弧? 我知道在AUTOCAD里面可以轻松实现,在VBA里面怎么实现啊?紧急求助!谢谢! 先画三个点的多段线,然后设置第二段的凸度。 一般的可以作出来,但是如果要求圆弧和直线相切的话,圆弧的凸度应该怎么计算啊? tangagen发表于2004-6-18 18:03:00static/image/common/back.gif一般的可以作出来,但是如果要求圆弧和直线相切的话,圆弧的凸度应该怎么计算啊?Sub test()Dim p1, p2, p3 As Variant, p(5) As Double
p1 = ThisDrawing.Utility.GetPoint(, "请输入第一点:")
p2 = ThisDrawing.Utility.GetPoint(p1, "请输入第二点:")
p3 = ThisDrawing.Utility.GetPoint(p2, "请输入第三点:")
p(0) = p1(0): p(1) = p1(1)
p(2) = p2(0): p(3) = p2(1)
p(4) = p3(0): p(5) = p3(1)Dim ang1 As Double, ang2 As Double, ang As Double
ang1 = ThisDrawing.Utility.AngleFromXAxis(p1, p2)
ang2 = ThisDrawing.Utility.AngleFromXAxis(p2, p3)
ang = 3.1415926 + ang1 - ang2Dim pl As AcadLWPolyline
Set pl = ThisDrawing.ModelSpace.AddLightWeightPolyline(p)pl.SetBulge 1, Tan(0.5 * 3.1415926 - 0.5 * ang)
End Sub ang = 3.1415926 + ang1 - ang2
pl.SetBulge 1, Tan(0.5 * 3.1415926 - 0.5 * ang)
为什么不直接用pl.SetBulge 1,Tan(0.5 * (ang1 - ang2)) 呢,还有这种情况在ang = 90 还得专门处理吧?<BR> 程序很多都要求角度为弧度 有意思!好用,我先下.
页:
[1]