Skip to content

SamuelReithmeir/Blender.Net

Repository files navigation

Blender.Net

NuGet Version NuGet Downloads

A .NET library that provides programmatic access to Blender's 3D modeling, animation, and rendering capabilities through Python script execution.

Overview

Blender.Net is a slim wrapper around Blender's Cli capabilities and its Python API, allowing developers to execute Blender scripts directly from .NET applications.
It is designed to be lightweight and easy to use, providing a straightforward interface for integrating Blender functionalities into .NET projects.
It also comes with extra packages containing Blender binaries for Windows and Linux, making it easy to get started without needing to install Blender separately.

Key Features

  • Self-contained deployment: Blender binaries included in NuGet package
  • Python script execution: Direct execution of Blender Python API scripts
  • Cross-platform support: Windows and Linux compatibility
  • Asynchronous operations: Non-blocking script execution with async/await patterns
  • Process isolation: Each operation runs in a separate Blender process

Usage

  1. Install the Blender.Net NuGet package in your .NET project.

  2. Install the Native Binaries package for Windows or Linux as needed.
    Or use your own Blender installation by passing its path as a parameter in step 3.

  3. Create an instance of BlenderEngine. (optional parameter to specify Blender executable path)

  4. Create a 'BlenderProcess' using the Builder pattern.

    var process = blenderEngine.NewProcess()
    .WithTemporaryDirectory()
    .WithScriptContent("import bpy\nprint('Hello from Blender!')")
    .Build();
  5. Execute the process and handle the result.

    await process.Execute();
    var result = process.GetFile("mygeneratedModel.obj");
  6. Optionally, you can listen to Standard Output and Error streams.

    await foreach (var error in process.StandardError)
    {
        Console.Error.WriteLine(error);
    }

About

A C# Wrapper for interacting with the 3d modeling Software Blender

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages