Option Explicit Sub Main Dim doc As FMDocument Dim pt As FMModel, pt2 As FMPoint Dim surface As FMModel, selected As FMModels Dim new_points() As String Dim cnt As Long, i As Long Dim found_pt As Boolean, found_surface As Boolean Set doc = ActiveDocument Set selected = doc.Selected found_surface = False For Each surface In selected If( surface.ModelType = eMT_Surface Or _ surface.ModelType = eMT_Solid Or _ surface.ModelType = eMT_Face ) Then found_surface = True Exit For End If Next surface If( Not found_surface) Then MsgBox "no surface selected" Exit Sub End If cnt = 0 found_pt = False ReDim new_points( selected.Count ) For Each pt In selected If( TypeName( pt) = "IFMPoint") Then Set pt2 = doc.AddPointProjectedToSurface( pt, surface, True) If( pt2 Is Nothing) Then If( MsgBox( pt.Name & " does not project to surface", vbOkCancel) = vbCancel) Then Exit Sub Else new_points(cnt) = pt2.Name cnt = cnt+1 found_pt = True End If End If Next pt If( Not found_pt) Then MsgBox( "no points selected") ElseIf( cnt = 0) Then MsgBox( "no projections found with surface") Else For i=0 To cnt doc.Select( new_points(i), True, i=0) Next i End If End Sub ' ' Add a toolbar button for this macro upon loading of this addin into FeatureCAM. ' Private Sub OnLoadAddin() Dim bars As FMCmdBars Dim bar As FMCmdBar Dim ctrl As FMCmdBarBtn Set bars = Application.CommandBars Set bar = bars("Macros") If bar Is Nothing Then Set bar = bars.Add ("Macros") End If Set ctrl = bar.Controls.Add( ,,"Main") ctrl.FaceId = 35 bar.Visible=True End Sub ' ' Remove the toolbar button for this macro upon unloading of this addin from FeatureCAM. ' Private Sub OnUnloadAddin() Dim bars As FMCmdBars Dim bar As FMCmdBar Dim ctrl As FMCmdBarCtrl Set bars = Application.CommandBars Set bar = bars("Macros") If Not bar Is Nothing Then Set ctrl = bar.Controls("Main") If Not ctrl Is Nothing Then ctrl.Delete End If End If End Sub Private Sub AddIn_OnConnect(ByVal flags As FeatureCAM.tagFMAddInFlags) OnLoadAddin End Sub Private Sub AddIn_OnDisConnect(ByVal flags As FeatureCAM.tagFMAddInFlags) OnUnloadAddin End Sub