EDIT: as of yet I haven't been able to find a concrete example of someone using an addon exporter in a python script, so if any of you have that I would be very grateful!
I have hundreds of files and I'm using a small script to standardize them and convert them to .json files for use in three.js, but I can't get the exporter to work. It is throwing an error (evidently a different one than ImportError) at bpy.ops.wm.addon_expand(module="three") - when I mouse over the addon in the "export" submenu, it gives me the bpy.ops.export.three(filepath = "export path") operation as how to access it, but it is still throwing errors. Here's my testing code:
import bpy import addon_utils def main(): cube = bpy.data.objects bpy.ops.object.delete() # import filePath = "import path" bpy.ops.import_scene.obj(filepath=filePath) tablet = bpy.data.objects # find dimensions and scale accordingly tabletDimensions = tablet.dimensions scale = min(10/tabletDimensions,10/tabletDimensions,10/tabletDimensions) # give 3dcursor new coordinates bpy.context.scene.cursor_location = (0.0,0.0,0.0) # set the origin on the current object to the 3dcursor location bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN') tablet.scale = (scale,scale,scale) print(addon_utils.paths()) try: bpy.ops.wm.addon_expand(module="three") bpy.ops.export.three(filepath = "export path") except ImportError: print("Threejs importer addon not available") #bpy.ops.mesh.primitive_uv_sphere_add(size=2,location=(5,5,5)) main()