allenliuyy Posted November 2, 2009 Posted November 2, 2009 In Inventor part sketch mode, how can I get a mouse click point and show this point in the sketch plan by VBA? I have some codes as following, but still need help to finish it. Thank you in advance. Form: Private Sub cmdClickSketchScreen_Click() Dim oApp As Inventor.Application Dim oDoc As PartDocument Dim oSketch As PlanarSketch Dim oTransGeom As TransientGeometry Dim oTrans As Transaction Dim oClick As New clsClick Dim oPoint2d As Point2d Dim oPoints As SketchPoint Set oPoint2d = oClick.Click(kLeftMouseButton) ' how to transfer this click to a point??? Set oPoints = oSketch.SketchPoints.Add(oPoint2d, True) End sub Class Module: clsClick Private WithEvents oInteraction As InteractionEvents Private WithEvents oMouseEvents As MouseEvents Public Function Click(filter As MouseButtonEnum) As Object Set oInteraction = ThisApplication.CommandManager.CreateInteractionEvents Set oMouseEvents = oInteraction.MouseEvents oMouseEvents.MouseMoveEnabled = True oInteraction.Start End Function Private Sub oMouseEvents_OnMouseClick(ByVal Button As MouseButtonEnum, _ ByVal ShiftKeys As ShiftStateEnum, _ ByVal ModelPosition As Point, ByVal ViewPosition As Inventor.Point2d, _ ByVal View As View) End Sub Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.