Message 1 of 1
iMate match list for AddMateiMateDefinition

Not applicable
02-08-2017
08:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am working on Inventor 2016 and Trying to come up with a macro to create imate.
A little tweak is that the macro interacts with the user to select face to Create Mate-iMate.
Attached Code works fine and Creates the imate. But if i Insert the option for MatchList (Commented out in the last line of Code) it throws up an error.
I need to add the Matchlist too. Can anbody help.
Regards,
Jiten
Sub Create_MateiMate() Dim oDoc As Document Dim oCompDef As ComponentDefinition Dim nFace As Face Dim oSelectedFace As New ClsGetSelectedFace Dim oMateiMateDefinition As MateiMateDefinition Dim oInsertiMateDefinition As InsertiMateDefinition Dim strMatchList(2) As String Set oDoc = ThisApplication.ActiveDocument Set oCompDef = oDoc.ComponentDefinition Set nFace = oSelectedFace.GetFace(oDoc) ' Create a match list of names to use for the next iMateDefinition. strMatchList(0) = "InA" strMatchList(1) = "InB" strMatchList(2) = "InC" Set oMateiMateDefinition = oCompDef.iMateDefinitions.AddMateiMateDefinition( _ nFace, 0, , , "MateA") ', strMatchList) End Sub Below Code is for Class ClsGetSelectedFace
Private WithEvents oInteractionEvents As InteractionEvents Private WithEvents i_SelectEvents As SelectEvents Private bStillSelecting As Boolean Private iFace As Face Public Function GetFace(ByVal i_Doc As Document) As Face i_Doc.SelectSet.Clear ' Create interaction events Set oInteractionEvents = ThisApplication.CommandManager.CreateInteractionEvents 'oInteractionEvents.InteractionDisabled = False Set i_SelectEvents = oInteractionEvents.SelectEvents i_SelectEvents.ResetSelections i_SelectEvents.ClearSelectionFilter i_SelectEvents.SingleSelectEnabled = True i_SelectEvents.Enabled = True i_SelectEvents.AddSelectionFilter kPartFacePlanarFilter bStillSelecting = True oInteractionEvents.Start Do While bStillSelecting DoEvents Loop Set GetFace = iFace End Function Private Sub i_SelectEvents_OnSelect(ByVal JustSelectedEntities As ObjectsEnumerator, ByVal SelectionDevice As SelectionDeviceEnum, ByVal ModelPosition As Point, ByVal ViewPosition As Point2d, ByVal View As View) Set iFace = i_SelectEvents.SelectedEntities(1) bStillSelecting = False End Sub