[讨论]怎样求曲线交点处向量?
Public Sub Test()<BR>Dim a As AcadEntity<BR>Dim b As New Curve<BR>Dim e(4) As Variant<BR>Dim f(14) As Double<BR>Dim d As Double<BR>Set a = ThisDrawing.ModelSpace(0)<BR>Set b.Entity = a<BR>c = a.IntersectWith(a, acExtendNone)<BR>d = b.GetDistanceAtPoint(c)<BR>e(0) = b.GetPointAtDistance(0)<BR>e(1) = b.GetPointAtDistance(d / 4)<BR>e(2) = b.GetPointAtDistance(d / 2)<BR>e(3) = b.GetPointAtDistance(d * 3 / 4)<BR>e(4) = b.GetPointAtDistance(d)<BR>f(0) = e(0)(0): f(1) = e(0)(1): f(2) = 0<BR>f(3) = e(1)(0): f(4) = e(1)(1): f(5) = 0<BR>f(6) = e(2)(0): f(7) = e(2)(1): f(8) = 0<BR>f(9) = e(3)(0): f(10) = e(3)(1): f(11) = 0<BR>f(12) = e(4)(0): f(13) = e(4)(1): f(14) = 0<BR>Dim endTan(2) As Double<BR>endTan(0) = 0.5: endTan(1) = -0.35: endTan(2) = 0
ThisDrawing.ModelSpace.AddSpline f, a.StartTangent, endTan
End Sub<BR> VLISP是
傳回曲線上指定位置的第一個衍生向量 (使用 WCS) <BR>(vlax-curve-getFirstDeriv curve-obj param)
引數
curve-obj
測量 VLA 物件。
param
指定在曲線參數的數字。
傳回值
如果成功的話是 3D 向量串列,否則為 nil。
範例
下列的範例中,假設 splineObj 指到顯示於範例中的 vlax-curve-getDistAtParam 函數。<BR>取得曲線的起點參數:
_$ (setq startSpline (vlax-curve-getStartParam splineObj))
0.0
取得曲線的終點參數:
_$ (setq endSpline (vlax-curve-getEndParam splineObj))
17.1546
決定沿曲線在參數中間的第一個衍生向量:
_$ (vlax-curve-getFirstDeriv splineObj <BR> ( / (- endspline startspline) 2))
(0.422631 -1.0951 0.0) 谢谢,我试试吧
献花一朵 我把后面一部分改为
Dim entt
dim g(2) as double<BR>entt = b.GetFirstDerivative(b.GetParameterAtPoint(e(4)))<BR>For i = 0 To 2<BR>g(i) = entt(i)<BR>Next i<BR>ThisDrawing.ModelSpace.AddSpline f, a.StartTangent, g<BR>但这样求出的曲线和原曲线是相交的,我是想用ActiveX方法模拟Break,好像不太成功?还是方法有误?
页:
[1]