Automating mates in assemblies using SOLIDWORKS API
{ width=200 }
Assembly components can be mated programmatically via IAssemblyDoc::AddMate3 SOLIDWORKS API method (or newer versions of this method).
It is required to mark the selected objects with different marks for the different mate types. Please refer the SOLIDWORKS API help documentation for the values of marks for a specific mate or use SOLIDWORKS macro recorder to capture the correct mark.