VERSION 1.0 CLASS BEGIN MultiUse = -1 'True END Attribute VB_Name = "clsPick" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = False Attribute VB_Exposed = False ' Declare the event objects Private WithEvents oInteractEvents As InteractionEvents Attribute oInteractEvents.VB_VarHelpID = -1 Private WithEvents oMouseEvents As MouseEvents Attribute oMouseEvents.VB_VarHelpID = -1 Private bStillSelecting As Boolean Private PickPkt As point Public Function Pick() As point bStillSelecting = True ' Create an InteractionEvents object. Set oInteractEvents = ThisApplication.CommandManager.CreateInteractionEvents Set oMouseEvents = oInteractEvents.MouseEvents ' Start the InteractionEvents object. oInteractEvents.Start ' Loop until a selection is made. Do While bStillSelecting DoEvents Loop ' Stop the InteractionEvents object. oInteractEvents.Stop Set Pick = PickPkt ' Clean up. Set oInteractEvents = Nothing Set oMouseEvents = Nothing End Function Private Sub oMouseEvents_OnMouseClick(ByVal Button As Inventor.MouseButtonEnum, ByVal ShiftKeys As Inventor.ShiftStateEnum, ByVal ModelPosition As Inventor.point, ByVal ViewPosition As Inventor.Point2d, ByVal View As Inventor.View) 'Select Case Button ' Case 1: MsgBox "Left Mouse" & " X= " & ModelPosition.X & " Y= " & ModelPosition.Y & " Z= " & ModelPosition.Z ' Case 2: MsgBox "Right Mouse" & " X= " & ModelPosition.X & " Y= " & ModelPosition.Y & " Z= " & ModelPosition.Z ' Case 4: MsgBox "Middle Mouse" & " X= " & ModelPosition.X & " Y= " & ModelPosition.Y & " Z= " & ModelPosition.Z 'End Select Set PickPkt = ModelPosition bStillSelecting = False End Sub