As far as I know, this is not possible. But if you are willing to use a bit more complicated code you can implement your own sector and get the point where the user clicked. Maybe you can use that point to figure out what kind of dimension line was selected.
I tried this by getting the DimensionLine object. That object has an evaluator and a function GetParamAtPoint. that function will fail if the point is not on the DimensionLine. but did not get it to work and i really need to get to bed. Maybe someone else can get the GetParamAtPoint function to work. (this section is commented out)
Public Class ThisRule
Sub Main()
Dim doc As DrawingDocument = ThisDoc.Document
Dim selector As New Selector(ThisApplication)
selector.Pick()
Dim point As Point2d = selector.PointOnSheet
Dim dimension As LinearGeneralDimension = selector.Dimension
MsgBox("selected point on sheet: " & point.X & " , " & point.Y)
doc.SelectSet.Clear()
doc.SelectSet.Select(dimension)
' Didn't get this to work....
'Dim pointData() As Double = {point.X, point.Y}
'Dim guessParams() As Double = {0, 1}
'Dim maxDeviations() As Double
'Dim params() As Double
'Dim solTypes() As SolutionNatureEnum
'Dim line As LineSegment2d = dimension.DimensionLine
'line.Evaluator.GetParamAtPoint(pointData, guessParams, maxDeviations, params, solTypes)
End Sub
End Class
Public Class Selector
Private WithEvents _interactEvents As InteractionEvents
Private WithEvents _selectEvents As SelectEvents
Private _stillSelecting As Boolean
Private _inventor As Inventor.Application
Public Sub New(ThisApplication As Inventor.Application)
_inventor = ThisApplication
End Sub
Public Sub Pick()
_stillSelecting = True
_interactEvents = _inventor.CommandManager.CreateInteractionEvents
_interactEvents.InteractionDisabled = False
_interactEvents.StatusBarText = "Select a LinearGeneralDimension."
_selectEvents = _interactEvents.SelectEvents
_selectEvents.WindowSelectEnabled = False
_interactEvents.Start()
Do While _stillSelecting
_inventor.UserInterfaceManager.DoEvents()
Loop
_interactEvents.StatusBarText = String.Empty
_interactEvents.Stop()
_inventor.CommandManager.StopActiveCommand
_selectEvents = Nothing
_interactEvents = Nothing
End Sub
Public Property Dimension As LinearGeneralDimension
Public Property PointOnSheet As Point2d
Private Sub oSelectEvents_OnPreSelect(
ByRef PreSelectEntity As Object,
ByRef DoHighlight As Boolean,
ByRef MorePreSelectEntities As ObjectCollection,
SelectionDevice As SelectionDeviceEnum,
ModelPosition As Point,
ViewPosition As Point2d, View As Inventor.View) Handles _selectEvents.OnPreSelect
If TypeOf PreSelectEntity Is LinearGeneralDimension Then
DoHighlight = True
Else
DoHighlight = False
End If
End Sub
Private Sub oInteractEvents_OnTerminate() Handles _interactEvents.OnTerminate
_stillSelecting = False
End Sub
Private Sub oSelectEvents_OnSelect(
ByVal JustSelectedEntities As ObjectsEnumerator,
ByVal SelectionDevice As SelectionDeviceEnum,
ByVal ModelPosition As Point,
ByVal ViewPosition As Point2d,
ByVal View As Inventor.View) Handles _selectEvents.OnSelect
Dimension = JustSelectedEntities.Item(1)
PointOnSheet = _inventor.TransientGeometry.CreatePoint2d(ViewPosition.X, ViewPosition.Y)
_stillSelecting = False
End Sub
End Class
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Blog: hjalte.nl - github.com