Public Sub Test() Dim a As AcadEntity Dim b As New Curve Dim e(4) As Variant Dim f(14) As Double Dim d As Double Set a = ThisDrawing.ModelSpace(0) Set b.Entity = a c = a.IntersectWith(a, acExtendNone) d = b.GetDistanceAtPoint(c) e(0) = b.GetPointAtDistance(0) e(1) = b.GetPointAtDistance(d / 4) e(2) = b.GetPointAtDistance(d / 2) e(3) = b.GetPointAtDistance(d * 3 / 4) e(4) = b.GetPointAtDistance(d) f(0) = e(0)(0): f(1) = e(0)(1): f(2) = 0 f(3) = e(1)(0): f(4) = e(1)(1): f(5) = 0 f(6) = e(2)(0): f(7) = e(2)(1): f(8) = 0 f(9) = e(3)(0): f(10) = e(3)(1): f(11) = 0 f(12) = e(4)(0): f(13) = e(4)(1): f(14) = 0 Dim endTan(2) As Double endTan(0) = 0.5: endTan(1) = -0.35: endTan(2) = 0
ThisDrawing.ModelSpace.AddSpline f, a.StartTangent, endTan
End Sub
我把后面一部分改为
Dim entt
dim g(2) as double entt = b.GetFirstDerivative(b.GetParameterAtPoint(e(4))) For i = 0 To 2 g(i) = entt(i) Next i ThisDrawing.ModelSpace.AddSpline f, a.StartTangent, g 但这样求出的曲线和原曲线是相交的,我是想用ActiveX方法模拟Break,好像不太成功?还是方法有误?