I don't know abut the supplied snippet functions, but You can create constraints without a custom name if done through API and it will auto generate the names. I created a auto origin constraining tool, here is the sub routine building the constraints:
Sub FlushOrigins(O1 As ComponentOccurrence, O2 As ComponentOccurrence, aCD As ComponentDefinition)
On Error GoTo EER
Dim oTrans As Transaction = ThisApplication.TransactionManager.StartTransaction(aCD.Document, "Constraint Creation")
'Setup Proxies
Dim wPlane1 As WorkPlaneProxy
Dim wPlane2 As WorkPlaneProxy
'Run for 3 orgin planes:
For i = 1 To 3
O1.CreateGeometryProxy(O1.Definition.WorkPlanes.Item(i), wPlane1)
O2.CreateGeometryProxy(O2.Definition.WorkPlanes.Item(i), wPlane2)
Dim flushConst As AssemblyConstraint = aCD.Constraints.AddFlushConstraint(wPlane1, wPlane2, 0)
Next
oTrans.End
Exit Sub
EER :
oTrans.Abort
End Sub
I actually do end up giving them a custom name because I like to identify my automated constraints/joints, but I simply removed that line. All you need to do is define your parent assembly's Component Definition and the 2 occurrences you want to constrain together in your main sub and then call this routine with the supplied objects:
Sub Main
'Define Assembly Def: ex: parent.ComponentDefinition [where parent is the active assembly
'Define occurrence 1: ex: oOcc1
'Define occurrence 2: ex: oOcc2
'Call Subroutine:
Call FlushOrigins(oOcc1, oOcc2, parent.ComponentDefinition)
End Sub
Let me know if this is helpful, or if you have any questions.