I'm trying to write a macro to add reference points to multiple pre-selected edges. I'd like to be able to cycle through so that i can add the points both evenly distributed along the edges and at the intersections.

Basically, i'm pulling point clouds off of splines and exporting them to excel for manipulation. I have the excel part down, but i'm currently manually adding the reference points. Would like to be able to just select the multiple edges and have a steady distribution across all selected edges.

bonus points: not really a math guy, but is there a way to determine if an edge is a more or less extreme curve? I'd rather have more points on the "bendier" splines and fewer on the straight ones. If not, I can live with that.

Hi Sean. Amen Allah Jlili is right and only one edge need to be selected at a time for this operation. Try to use this code

Dim swApp As Object

Dim swModel As Object

Dim swSelMgr As SldWorks.SelectionMgr

Dim numSel As Integer

Dim selType As Integer

Dim vRefPoint As Variant

Sub main()

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

Set swSelMgr = swModel.SelectionManager

Dim swSelData As SldWorks.SelectDataSet swSelData = swSelMgr.CreateSelectDataDim egdeColl As New Collection

numSel = swSelMgr.GetSelectedObjectCount2(-1)

For i = 1 To numSel

selType = swSelMgr.GetSelectedObjectType3(i, -1)

If selType = 1 Then

Dim edgeEntity As EntitySet edgeEntity = swSelMgr.GetSelectedObject6(i, 0)egdeColl.Add edgeEntityEnd If

Next i

For i = 1 To egdeColl.countegdeColl(i).Select4 False, swSelDatavRefPoint = swModel.FeatureManager.InsertReferencePoint(2, 2, 0, 8)Next iEnd Sub

Regards

Viktor