-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python script? #34
Comments
I'm not really familiar with conventions within Blender in that regard. From my point of view, the main entry point of importing 3MF is this function:
That function reads these three attributes of the class: Blender3mfFormat/io_mesh_3mf/import_3mf.py Lines 60 to 62 in 6f33fb7
This was taken from the examples of the STL import and PLY import scripts. Perhaps those import scripts have some helper functions that make it easier to use them from a script that I have overlooked. If so, such helper functions should be added to this Import/Export add-on as well. |
Thanks, am not well versed with python, but I will try and see. Cheers |
@Ghostkeeper location: :-1 Thanks! |
I've never implemented any method to make it work from the Python command line in Blender. I hadn't considered that until you mentioned it. So most likely it's not going to work (yet). However the SyntaxError you're getting signifies that you made a mistake in the command you typed in. Possibly a typo, unmatched brackets, etc. |
So it turns out that by registering the operator, it was already accessible from the Python scripting environment in Blender automatically. You could discover this by running:
However if you try to call it that way ( So I've changed the operator's ID to be I've documented how to call these operators from a scripting environment here: https://github.com/Ghostkeeper/Blender3mfFormat#scripting |
Awesome, Thanks Works! |
Hi, There still seems to be an error with the python integration. bpy.ops.import_mesh.threemf(filepath="F:\Nextcloud\Deventus\3mf-test\microvred.3mf") |
That there is Blender calling an operator that doesn't exist. This add-on registers itself and then waits to be called. Apparently Blender kind of semi-registered it with you, where it knows that it exists but then doesn't find the operator any more, and never calls the code in this add-on. So the add-on itself could never do anything about this error. This could be the result of something like a syntax error upon registering, but then the rest of us would have the same issue (unless you edited these files yourself). More likely it is somehow not installed correctly. |
Hi, Late reply and all but here we are.
Regards |
Never mind, I now changed the bl_idname to "import_mesh.threemf" and with that it works! |
If anyone having the issue again, it's because the commit f4319b3 seem not updated in release package here https://github.com/Ghostkeeper/Blender3mfFormat/releases/tag/v1.0.1 Manually replacing the file in plugin directory from here https://github.com/Ghostkeeper/Blender3mfFormat/tree/master/io_mesh_3mf will fix the issue. |
Hi,
Thanks for this add on.
What will be its python script to call? will it be like normal method to import and export as stl? like below?
import bpy
import os
bpy.ops.import_scene.3mf(filepath='xx/xxx/1.3mf')
bpy.ops.export_mesh.stl(filepath='1.stl')
Cheers,
The text was updated successfully, but these errors were encountered: