To repair geometries errors, I'm now trying processing (grass7) using PyQGIS. For one polygon layer (QgsVectorLayer: 'hn_pg'), I wrote the below script and run the grass7:v.clean algorithm. The processing completed without any problems, but the cleaned layer could not appear to the current active layers.
output = processing.runAndLoadResults(
"grass7:v.clean",
{'input': hn_pg,
'type':[0,1,2,3,4,5,6],
'tool':[1], # snap
'threshold':0.5,
'-b':False,
'-c':False,
'GRASS_SNAP_TOLERANCE_PARAMETER':1,
'GRASS_REGION_PARAMETER': "%f, %f, %f, %f"%hn_pg.extent().xMinimum(),hn_pg.extent().xMaximum(), hn_pg.extent().yMinimum(), hn_pg.extent().yMaximum()),
'GRASS_MIN_AREA_PARAMETER':0.0001,
'GRASS_OUTPUT_TYPE_PARAMETER':0,
'output':'memory:',
'GRASS_VECTOR_DSCO' : '',
'GRASS_VECTOR_EXPORT_NOCAT' : False,
'GRASS_VECTOR_LCO' : '',
'error' : 'memory:'})
QgsProcessingUtils.tempFolder()
function provided the path of the completed file(.gpkg) and I also found the outputted file in that file. So, I tried QgsProject.instance().addMapLayer(output['output'])
but resulted in no reaction.
How Can I get the cleaned object in Qgis active layers?