Batch "Save as" layers w.r.t their geometry type in QGIS?
You already know the general procedure and have experience with the script How to batch "Layer save as"-process in QGIS?. Consider the line
QgsVectorFileWriter.writeAsVectorFormat(layer, pathToFile + newName, "utf-8", None, "ESRI Shapefile")
You have to change 2 things.
1) To get the original file name add following lines to the top of the loop
import os
for layer in layers:
# get path to dgn file
dgn_pn = layer.dataProvider().dataSourceUri().split('|')[0]
dgn_fn = os.path.basename(dgn_pn)
# get rid of the file extension
dgn_fn_wo_ext = os.path.splitext(dgn_fn)[0]
# define geometry strings and get geometry type of layer
geom_name = {0: 'Points', 1: 'Lines', 2: 'Polygons'}
geom_type = layer.geometryType()
# build the new file name
newName = dgn_fn_wo_ext + '_' + geom_name[geom_type]
2) To change the coordinate system to WGS84 add to the top of the script
trs = QgsCoordinateReferenceSystem()
trs.createFromId(4326)
To bring it all together change following line:
ret = QgsVectorFileWriter.writeAsVectorFormat(
layer,
pathToFile + newName,
'utf-8',
trs,
'ESRI Shapefile')