I install 3mf add-on, and I use Python scripting as the following but it does not work.
How can I write the script?
import bpy
bpy.ops.import_mesh.threemf(filepath=c:\\work\\sample.3mf)
I install 3mf add-on, and I use Python scripting as the following but it does not work.
How can I write the script?
import bpy
bpy.ops.import_mesh.threemf(filepath=c:\\work\\sample.3mf)
The add-on somehow uses an operator name that starts with a number. That's the problem. You should report this to the author of the add-on as a bug. You can fix this by changing the text:
bl_idname = "export_mesh.3mf"
to
bl_idname = "export_mesh.three_mf"
in %AppData%\Blender Foundation\Blender\3.3\scripts\addons\io_mesh_3mf\export_3mf.py
and also doing the same thing to %AppData%\Blender Foundation\Blender\3.3\scripts\addons\io_mesh_3mf\import_3mf.py
only this time change
bl_idname = "import_mesh.3mf"
to
bl_idname = "import_mesh.three_mf"
You can then use 3mf import operator in your scripts
bpy.ops.import_mesh.three_mf(filepath="c:\\some_file.3mf")
The above code is correct but not showing 3mf add-on installation on server environment where you don't have graphics card, and you can't install add-on using blender software. Below is the code to install and enable 3mf format using blender script:
import bpy
bpy.ops.preferences.addon_install(filepath='yourpath\\io_mesh_3mf\\__init__.py') # Need this part only one time to install add-on.
bpy.ops.preferences.addon_enable(module='io_mesh_3mf')
bpy.ops.import_mesh.threemf(filepath=yourpath)
Thanks
filepath="c:\\work\\sample.3mf"
$\endgroup$AttributeError: Calling operator "bpy.ops.import_mesh.threemf" error, could not be found
$\endgroup$