I want to activate the biggest face by a script. It's no problem to locate and get the data, but how can I activate it in Editor?
# Activate biggest face exclusivly:
import bpy
import operator
# List of Polygons of (first) selected object:
pgList = bpy.context.selected_objects[0].data.polygons
# sort and get biggest face:
pgMax = sorted(pgList, key=operator.attrgetter('area'), reverse=True)[0]
print("{0:} Polygons, largest = {1:.2f}, selected = {2:}".format(len(pgList),pgMax.area,pgMax.select))
# How do I activate this Polygon?
# The results are very random. Sometimes selected, sometimes not, sometimes Blender chrashes.
bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.object.mode_set(mode = 'OBJECT')
pgMax.select=True
bpy.ops.object.mode_set(mode = 'EDIT')
#Later i'ld like to create a TransformOrientationSystem. But this will be next problem.
#pgMax .... .transform.create_orientation(use=True)
# erzeuge dazu ein lokales Bezugssystem
```