02-10-2021
12:12 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
02-10-2021
12:12 PM
Selecting Ordinate Dimension Members using Select Set
Is there a way to use the select set selection box to grab only the members of an ordinate dimension set that are in the selection box? I am trying to find a way to select a few then do something then select a few more different members and do something. I do not want to do something to the entire set.
02-14-2021
06:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
02-14-2021
06:47 AM
this rule will let you select ordinate dimension
Public Class ThisRule Sub Main() Dim oSelect As New Selector Dim selectedItems As ObjectsEnumerator = oSelect.Pick(ThisApplication) If selectedItems Is Nothing Then Return ' selectedItems holds all of your Ordinate Dimension Dim oSelSet As SelectSet = ThisApplication.ActiveDocument.SelectSet oSelSet.Clear() For Each oFace In selectedItems oSelSet.Select(oFace) Next End Sub End Class Public Class Selector ' taken from: ' https://adndevblog.typepad.com/manufacturing/2016/07/filter-out-faces-not-facing-the-user.html Private WithEvents oInteractEvents As InteractionEvents Private WithEvents oSelectEvents As SelectEvents Private bStillSelecting As Boolean 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) 'here we check if a selected item is of the type OrdinateDimension If Not TypeOf PreSelectEntity Is OrdinateDimension Then DoHighlight = False Exit Sub Else DoHighlight = True End If End Sub Public Function Pick(ThisApplication As Inventor.Application) As ObjectsEnumerator bStillSelecting = True oInteractEvents = ThisApplication.CommandManager.CreateInteractionEvents oInteractEvents.InteractionDisabled = False oSelectEvents = oInteractEvents.SelectEvents oSelectEvents.WindowSelectEnabled = True AddHandler oSelectEvents.OnPreSelect, AddressOf oSelectEvents_OnPreSelect AddHandler oSelectEvents.OnSelect, AddressOf oSelectEvents_OnSelect AddHandler oInteractEvents.OnTerminate, AddressOf oInteractEvents_OnTerminate oInteractEvents.Start() Do While bStillSelecting ThisApplication.UserInterfaceManager.DoEvents() Loop Dim oSelectedEnts As ObjectsEnumerator oSelectedEnts = oSelectEvents.SelectedEntities If oSelectedEnts.Count > 0 Then Pick = oSelectedEnts Else Pick = Nothing End If oInteractEvents.Stop() oSelectEvents = Nothing oInteractEvents = Nothing End Function Private Sub oInteractEvents_OnTerminate() bStillSelecting = 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) bStillSelecting = 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
02-15-2021
06:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
02-15-2021
06:27 AM
Thank you but that's not exactly what I'm looking for. I don't want an ilogic rule. I want to do this is vba using API. In any case, I could not get your code to work. Thank you for the suggestion though.