When processing DWG data in QGIS, exporting multiple layers individually becomes tedious. Here are three efficient batch export methods。

Method 1: Batch Vector Layer Saver Plugin

  1. Install plugin via Plugins → Manage and Install Plugins...
  2. Navigate: Vector → Batch Vector Layer Save
  3. Configure format (ESRI Shapefile) and output directory

Method 2: Native Processing Tool

  1. Search "Save Vector Features to File" in Processing Toolbox
  2. Select "Run as Batch Process"
  3. Choose input layers and configure output paths

Method 3: Python Script

Execute in Python Console (Plugins → Python Console):

import os
from qgis.core import QgsVectorLayer, QgsVectorFileWriter

# Configure layers and output
layer_list = [iface.activeLayer()]  # Replace with target layers
output_folder = '/path/to/output/'  # Update path

for layer in layer_list:
    if isinstance(layer, QgsVectorLayer) and layer.isValid():
        output_path = os.path.join(output_folder, f'{layer.name()}.shp')
        error = QgsVectorFileWriter.writeAsVectorFormat(
            layer, 
            output_path, 
            'utf-8', 
            layer.crs(), 
            'ESRI Shapefile'
        )
        print(f"{layer.name()}: {'Success' if error == QgsVectorFileWriter.NoError else 'Failed'}")

Requirements:

  • Valid layer objects
  • Existing output directory with write permissions

Recommendation

  • Quick solution: Method 2 (native tool)
  • Custom workflows: Method 3 (scripting)
  • Plugin enthusiasts: Method 1