Download VLAX.cls and Curve.cls... Then the following codes can find out the tangent direction of a point on curve. Sub TEST() Dim C As Curve Dim objCur As AcadEntity Dim pickPnt As Variant Dim closePnt As Variant Dim paramatclosePnt As Double Dim tangentatclosePnt As Variant Set C = New Curve ThisDrawing.Utility.GetEntity objCur, pickPnt, "SELECT A CURVE:" Set C.Entity = objCur closePnt = C.GetClosestPointTo(pickPnt) paramatclosePnt = C.GetParameterAtPoint(closePnt) tangentatclosePnt = C.GetFirstDerivative(paramatclosePnt) Dim objRay As AcadRay Dim origin(2) As Double Dim pt2(2) As Double origin(0) = 0#: origin(1) = 0#: origin(2) = 0# pt2(0) = tangentatclosePnt(0): pt2(1) = tangentatclosePnt(1): pt2(2) = tangentatclosePnt(2) Set objRay = ThisDrawing.ModelSpace.AddRay(origin, pt2) objRay.Move origin, closePnt End Sub |