0
$\begingroup$


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!

$\endgroup$
  • $\begingroup$ What exactly does not work? Could you share the current state of your code? $\endgroup$ – brockmann Sep 10 at 15:34
  • 1
    $\begingroup$ Compared 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! $\endgroup$ – ckxz Sep 10 at 15:44
2
$\begingroup$

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!

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.