Has anyone here managed to add a mate via macro by using the type "swMateCOORDINATE" mate?
My recorded code selects both the origins of the parts I'm trying to mate, but I keep getting error #4 (Incorrect selections for mate) when it tries to add the mate.
Even if I comment out the lines of the code that select the origins, and select it manually and try to run it, I still get the same error.
Any ideas of what may be going wrong?
Dim swApp As Object Dim Part As Object Dim boolstatus As Boolean Dim longstatus As Long, longwarnings As Long Sub main() Set swApp = _ Application.SldWorks Set Part = swApp.ActiveDoc boolstatus = Part.Extension.SelectByID2("Point1@Origin@Peça1^Assy1-1@Assy1", "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0) boolstatus = Part.Extension.SelectByID2("Point1@Origin", "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0) Dim myMate As Object Set myMate = Part.AddMate5(20, 0, False, 0, 0, 0, 0, 0, 0, 0, 0, False, False, 0, longstatus) 'swMateCOORDINATE = 20 Part.ClearSelection2 True Part.EditRebuild3 If longstatus <> 1 Then swApp.SendMsgToUser "ERROR #" & longstatus End Sub