Sub main()

        'set Z coordinate to 0 for all points in a polyline
         'if a selection exists
        
        If CamBamUI.MainUI.ActiveView.SelectedEntities.Length > 0 Then

            'scan the current selection of drawing objects (Entities)

            For Each ent As Entity In CamBamUI.MainUI.ActiveView.SelectedEntities

                'test if it's a polyline

                If TypeOf ent Is Polyline Then
                    ent.Flatten()
                End If

            Next ent

            CamBamUI.MainUI.ActiveView.RefreshView()

        End If

End Sub