BPY plus

BPY plus – a set of modules to extend the Blender Python API.

BPY plus is an open-source project based on Blender API and extending it with several features and making it easier to use some of “bpy” functions.

You can use BPY plus in your add-ons and scripts in any way for free.

At present it is small, but in the future, it can be extended with more modules.

BPY plus web-page:

Usage

The “bpy_plus” package must be placed in the same directory as the project in which it will be used. Copy “bpy_plus” to your project directory. Now you can import “bpy_plus” modules as usual

from bpy_plus import *

Example

This code finds a bounding sphere around selected objects. To display the bounding sphere this code also adds an empty with the type of sphere to the scene and set the bounding sphere location and radius to it.

import bpy
from bpy_plus.bounding import Bounding

b_sphere = Bounding.sphere(
    objects=bpy.context.selected_objects,
    mode='GEOMETRY'
    )

empty = bpy.data.objects.new(name='empty', object_data=None)
empty.empty_display_type = 'SPHERE'
empty.location = b_sphere[0]
empty.empty_display_size = b_sphere[1]
bpy.context.collection.objects.link(object=empty)
3 Likes

Updated to v. 1.2.0.

  • added the “names” module
3 Likes

Updated to v.1.3.0.

Added module for working with rendering.

1 Like

Oh wow, this is pretty cool! stuff like working with blender names and applying transforms to meshes is always a bit of a pain, so this is really useful!

1 Like