6 Replies Latest reply on Nov 12, 2013 6:11 AM by Oleg Bezyaev

# Direction vector

How to get a direction vector for the edge or curve?

• ###### Re: Direction vector

I would call the Curve::Evaluate2 at the start of the curve (parameter = 0). The second derivative (4th, 5th, 6th elements) is the tangent vector.

____________________________________________________

Regards,

Artem Taturevych, Application Engineer at Intercad (Australia)

translationXpert – add-in to translate SolidWorks models

myIntercad an integrated tool for SolidWorks Professionals

LinkedIn SolidWorks API Education Group

• ###### Re: Direction vector

Are there any examples? I do not really understand what I should have in the method Evaluate2 (???)

• ###### Re: Direction vector

Assuming that the edge is selected:

Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2

Dim swSelMgr As SldWorks.SelectionMgr

Dim swEdge As SldWorks.Edge

Dim swCurve As SldWorks.Curve

Sub main()

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

Set swSelMgr = swModel.SelectionManager

Set swEdge = swSelMgr.GetSelectedObject6(1, -1)

Set swCurve = swEdge.GetCurve

Dim vEvalData As Variant

Const START_PARAM As Integer = 0

vEvalData = swCurve.Evaluate2(START_PARAM, 2)

Dim tangentVec(2) As Double

tangentVec(0) = vEvalData(3)

tangentVec(1) = vEvalData(4)

tangentVec(2) = vEvalData(5)

End Sub

____________________________________________________

Regards,

Artem Taturevych, Application Engineer at Intercad (Australia)

translationXpert – add-in to translate SolidWorks models

myIntercad an integrated tool for SolidWorks Professionals

LinkedIn SolidWorks API Education Group

• ###### Re: Direction vector

Is it possible to extract data from a previously obtained ICurve without selecting edge?

• ###### Re: Direction vector

Yes, sure. It doesn't matter how this curve is obtained. Evaluate returns the parametrization of the curve.