[Macro solidworks] Retrieve a reference feature from a reference point

Hello

 

I use a macro in which I work with a reference point that is selected on a spline.

I'd like to know the length of this spline.

 

It would therefore be necessary to be able to recover the reference entity of this reference point (the spline in this case), in order to recover its length.

 

Do you know how to do this?

 

Thank you in advance!

Hello

You can find interesting information here:

http://help.solidworks.com/2015/english/api/sldworksapi/get_spline_parameters_example_vb.htm

http://help.solidworks.com/2014/English/api/sldworksapi/Get_Curve_Spline_Points_Example_VB.htm

Or maybe here:

http://help.solidworks.com/2013/English/api/sldworksapi/Get_Sketch_Entities_Example_VB.htm

Are there several splines in this sketch?

2 Likes

Hello

As Lucas says, SW's API help is comprehensive and contains a lot of information. In particular, there are examples.

If you do a little VBA SW save this link  http://help.solidworks.com/2016/english/api/sldworksapiprogguide/Welcome.htm

Have a nice day.

2 Likes

Thank you for these links. I had already consulted several of them but being rather a beginner in the subject, I have trouble understanding their meaning.

If I have a reference point named swRefPtData positioned on a single spline, do you know if there is a property to make a code like this:

spline = swRefPtData.referenceentity

length = spline.length

 

I think I have been clear. And don't worry, I'll keep looking in your links in the meantime, but it's not easy yet my problem seems simple to me.

 

Thank you in advance!

I need to be able to retrieve the spline lengths

see attached

@+ ;-)

1 Like

It is probably the AlongCurveOption method that should be used to retrieve the curve on which the reference point is:

http://help.solidworks.com/2016/English/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IRefPointFeatureData~AlongCurveOption.html