BlenderMesh

class compas_blender.conversions.BlenderMesh[source]

Bases: BlenderGeometry

Wrapper for Blender meshes.

Attributes
  • object (bpy.types.Object) – The Blender scene object.

  • geometry (bpy.types.Mesh) – The mesh data block.

  • bmesh (bpy.types.BMesh) – The mesh data structure.

  • location (Point) – The location of the object in the scene.

  • vertices (List[Point]) – The mesh vertex locations.

  • faces (List[List[int]]) – The mesh face vertices.

Examples

import os
import compas
from compas_blender.conversions import BlenderMesh

mesh = BlenderMesh.from_monkey().to_compas()
mesh = mesh.subdivide(k=2)

path = os.path.join(os.path.expanduser(~), 'Desktop', 'monkey.json')

compas.json_dump(mesh, path)

Methods

from_bmesh

Construct a Blender mesh wrappper from a BMesh.

from_monkey

Construct a Blender mesh wrappper from the Blender monkey.

to_compas

Convert the Blender mesh to a COMPAS mesh.

Inherited Methods

from_geometry

Construct a Blender object wrapper from an existing Blender data block.

from_name

Construct a Blender object wrapper from an existing Blender object.

from_object

Construct a Blender object wrapper from an existing Blender object.

transform

Transform the Blender object.