Hi, I think you can approach it with the 'Dissolve' tool which is also exposed as a python function.
You could go with more fine-grained manipulations through the arcpy.Geometry class and it's respective methods but it might be overkill for now.
Bearing in mind that the output will be a new featureclass, you can choose to output to an 'in-memory' or 'physical' featureclass in the fGDB - choosing to write the in-memory featureclass to the fGDB later.
1. set your file GDB as the workspace with:
arcpy.env.workspace = //path/to/Test.gdb
(replace the full path to your Test.gdb above).
2. Next you would need to loop through each featureclass in your fGDB, but first list all featureclasses inside it.
3. Dissolve on each featureclass and choose to dissolve on a particular field or leave the default. (ensure you leave the parameter 'MULTI_PART' so that a multipart feature is written).
4. Keep a reference to the original featureclass (restore it later)
5. delete the original featureclass
6. Rename the dissolved feature class back to your original.
So, together:
import arcpy
import sys
fileGDB = "C:\\path\\to\\test.gdb"
arcpy.env.workspace = fileGDB
featureclasses = arcpy.ListFeatureClasses()
for fc in featureclasses:
original_featureclass = fc
dissolved_featureclass = fc + '_dissolved'
try:
print("original featureclass: {0}".format(original_featureclass))
arcpy.management.Dissolve(fc, dissolved_featureclass, None, None, "MULTI_PART", "DISSOLVE_LINES")
print("dissolved featureclass: {0}".format(dissolved_featureclass))
except Exception:
e = sys.exc_info()[1]
print(e.args[0])
try:
arcpy.Delete_management(fc)
print("original featureclass deleted: {0}".format(fc))
except Exception:
e = sys.exc_info()[1]
print(e.args[0])
try:
arcpy.Rename_management(dissolved_featureclass, original_featureclass)
print("original featureclass restored: {0}".format(original_featureclass))
except Exception:
e = sys.exc_info()[1]
print(e.args[0])
All the best.
------
Edit: after I returned to this I saw Dan's post and yes, you need to dissolve on an attribute.
I'm not sure what it dissolves on if you leave the dissolve field blank - probably the geometries.
It would be worthwhile getting to know the nuances in the arcpy.Geometry class.