As for Blender 3.6 the script by @iyad-ahmed stopped working because Blender added new builtin orientation PARENT
.
Previous script was relying that there will be exactly 6 builtins, I've updated the script so that it will get the actual list of builtin transformations so it won't break the next time Blender adds/removes new transformation.
PS there is still no other way to get list of all custom orientations besides parsing exception message and excluding builting.
import bpy
context = bpy.context
transform_slots = context.scene.transform_orientation_slots
builtin_transforms = [i.identifier for i in bpy.types.TransformOrientationSlot.bl_rna.properties['type'].enum_items]
# hacky (but the only way) to get the all available transforms
try:
context.scene.transform_orientation_slots[0].type = ""
except Exception as inst:
exec("transformstransforms = " + str(inst).split("in")[1]"'")[1::2]
for transform in transforms:
if transform in builtin_transforms:
continue
transform_slots[0].type = transform
bpy.ops.transform.delete_orientation()