Here is the VBA sample:
Sub CylinderFacesMateSample()
Dim oDoc As AssemblyDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oFace1 As Face
Set oFace1 = ThisApplication.CommandManager.Pick(kPartFaceCylindricalFilter, "Select a cylindrical face")
Dim oFace2 As Face
Set oFace2 = ThisApplication.CommandManager.Pick(kPartFaceCylindricalFilter, "Select another cylindrical face")
Dim omate As MateConstraint
Set omate = oDoc.ComponentDefinition.Constraints.AddMateConstraint(oFace1, oFace2, 0, kInferredLine, kInferredLine)
End Sub
Hope it helps.
If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.
Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.