Try this, it was in a script called mop-automate.py
# Select All...
view.SelectAllVisibleGeometry()
# Convert to polylines...
PolylineUtils.PolyLinesConvert(view)
# The gui operation runs in a worker process, so wait for the
# thinking message to disapear...
while view.CurrentEditMode is not None:
app.Sleep(1)
# Edit - Join
PolylineUtils.JoinPolyLines(view,0.001)
# wait for the thinking message to disapear...
while view.CurrentEditMode is not None:
app.Sleep(1)
Also found this in a C# script, InvoluteGearGenerator.cs
Polyline[] array6 = new Polyline[num_teeth];
// put some polylines into the array
// now define a new Polyline array to hold those joined
Polyline[] array7 = Polyline.Join(array6, 1E-05);