I am working on a script to automatically take screenshots of a dataset of .stl meshes and I’d like to have only the .stl object framed, that is with all menus, tools and other buttons hidden. The result I am trying to achieve with a script can be reproduced with the CTRL + ALT + Space keyboard shortcut in the UI.
This has already been discussed here, although it’s not working as desired for me. I have adapted the script so it works on Blender 2.8 as explained here, to no avail.
Also, although my issue is similar to that described here, it is neither working for me.
Could anyone help?
Cheers!
Asked
Active
Viewed 514 times
2
ckxz
- 61
- 4
-
What exactly does not work? Could you share the current state of your code? – brockmann Sep 10 '20 at 15:34
-
1Compared to last issue referenced, since I'm not working with Animations that was obviously not working for me. Furthermore, all gizmos and overlays were still visible. Found the solution and shared it down below. Thanks for your comment! – ckxz Sep 10 '20 at 15:44
1 Answers
4
Solved. What I was looking for was indeed really close to the issue discussed in this post.
Here's the code snippet that does the work:
import bpy
context = bpy.context.copy()
for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
context['area'] = area
bpy.ops.screen.screen_full_area(context, use_hide_panels=True)
bpy.context.space_data.show_gizmo = False
bpy.context.space_data.overlay.show_overlays = False
Hope it can be of some help to others!
ckxz
- 61
- 4