Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Attempting to transition away from VBA and iLogic to a VB.net addin.
Using the Nifty Add-in Template by Mr. Ekins.
Having difficulties casting my selected object into a sketchpoint.
Namespace UCSPlacementApp
Public Module SelectPoint
Private WithEvents m_intereaction As Inventor.InteractionEvents
Private WithEvents m_mouse As Inventor.MouseEvents
Public Function SelectPoint() As Inventor.SketchPoint
'Dim MyPointSelection As ClsSelectPoint
'If MyPointSelection Is Nothing Then
' MyPointSelection = New ClsSelectPoint
'End If
If g_DebugOn Then
MsgBox("Getting Point From User", vbOK, "AMA ROUTINE")
End If
Dim tempPoint As SketchPoint
Try
tempPoint = g_InventorApplication.CommandManager.Pick(SelectionFilterEnum.kSketchPointFilter, "Select UCS origin point.")
'tempPoint = MyPointSelection.GetPoint
If tempPoint Is Nothing Then
Return Nothing
End If
Catch ex As Exception
MsgBox("Error while having user select the origin point!" & vbCr & vbCr & ex.Message, vbOK, g_AMA_error_title)
' CatchErrorcatch:
Debug.Print(ex.Message)
End Try
Try
tempPoint = DirectCast(tempPoint, SketchPoint)
Catch
MsgBox("Error casting selected point!", g_AMA_error_title)
Exit Function
End Try
If Not (tempPoint Is Nothing) Then
myPoint = tempPoint.Geometry
End If
Dim oSketch As PlanarSketch = myPoint.Parent
Dim my2DPoint As Point2d = myPoint.Geometry
Dim my3DPoint As Point = oSketch.SketchToModelSpace(my2DPoint)
'tempPoint = oSketch.SketchToModelSpace(my2DPoint)
If g_DebugOn Then
PrintXYZ(tempPoint)
End If
'm_intereaction.Stop()
' ENABLE THE LISTBOX FOR THE ANGLE
g_UCSForm.lbAngleInput.Enabled = True
g_UCSForm.lbAngleInput.Visible = True
g_UCSForm.lbAngleInput.SelectedItem = ((g_UCSForm.lbAngleInput.Items.Count - 1) / 2) + 1
Return oSketch.SketchToModelSpace(my2DPoint)
End Function
Thank you in advance for your time in this matter.
M.
Solved! Go to Solution.