@J.VandeMerckt,
Here are the code snippets for the flush & the insert constraints. You can uncomment the one you need :
Dim f As Inventor.Face = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Pick a face :")
Dim doc As Inventor.PartDocument = ThisApplication.ActiveDocument
Dim pcd As Inventor.PartComponentDefinition = doc.ComponentDefinition
Dim matchList As String() = {"Match1", "Match2", "Match3"}
'Dim mate As Inventor.iMateDefinition = pcd.iMateDefinitions.AddMateiMateDefinition(f, 0, , , "New iMate", matchList)
Dim flush As Inventor.iMateDefinition = pcd.iMateDefinitions.AddFlushiMateDefinition(f, 0, , "New iFlush", matchList)
'Dim instert As Inventor.iMateDefinition = pcd.iMateDefinitions.AddInsertiMateDefinition(f, False, 0,, "New iInsert", matchList)
Notice that you need a circular face for the insert constraint.
As for the match list, it requires a string array. I implemented it in the code above.
Here is some info about arrays :
Arrays - Visual Basic | Microsoft Learn
VB.NET Array Examples - Dot Net Perls
Kind regards,
FINET L.
If this post solved your question, please kindly mark it as "Solution"
If this post helped out in any way to solve your question, please drop a "Like"@LinkedIn @JohnCockerill