blender-interface-scene-setup-via-python-script

Sub-skill of blender-interface: Scene Setup via Python Script (+5).

5 stars

Best use case

blender-interface-scene-setup-via-python-script is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Sub-skill of blender-interface: Scene Setup via Python Script (+5).

Teams using blender-interface-scene-setup-via-python-script should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/scene-setup-via-python-script/SKILL.md --create-dirs "https://raw.githubusercontent.com/vamseeachanta/workspace-hub/main/.agents/skills/_archive/engineering/cad/blender/scene-setup-via-python-script/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/scene-setup-via-python-script/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How blender-interface-scene-setup-via-python-script Compares

Feature / Agentblender-interface-scene-setup-via-python-scriptStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Sub-skill of blender-interface: Scene Setup via Python Script (+5).

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Scene Setup via Python Script (+5)

## Scene Setup via Python Script


```python
import bpy
import math

# Clear default scene
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete()

# Create objects programmatically
bpy.ops.mesh.primitive_cylinder_add(
    radius=0.5, depth=10.0,
    location=(0, 0, 5),
    rotation=(0, 0, 0)
)
cylinder = bpy.context.active_object
cylinder.name = "Riser_Section"
```


## Import Engineering Geometry


| Format | Operator | Notes |
|--------|----------|-------|
| STL | `bpy.ops.wm.stl_import(filepath=path)` | Blender 4.x; use `import_mesh.stl` for 3.x |
| OBJ | `bpy.ops.wm.obj_import(filepath=path)` | Blender 4.x; use `import_scene.obj` for 3.x |
| FBX | `bpy.ops.import_scene.fbx(filepath=path)` | Same across versions |
| PLY | `bpy.ops.wm.ply_import(filepath=path)` | Blender 4.x |
| GLTF | `bpy.ops.import_scene.gltf(filepath=path)` | Same across versions |
| DAE | `bpy.ops.wm.collada_import(filepath=path)` | Collada |


## Blender 3.x / 4.x / 5.x API Migration


| Operation | Blender 3.x | Blender 4.x | Blender 5.x |
|-----------|-------------|-------------|-------------|
| Import STL | `bpy.ops.import_mesh.stl()` | `bpy.ops.wm.stl_import()` | same as 4.x |
| Import OBJ | `bpy.ops.import_scene.obj()` | `bpy.ops.wm.obj_import()` | same as 4.x |
| Import PLY | `bpy.ops.import_mesh.ply()` | `bpy.ops.wm.ply_import()` | same as 4.x |
| Export STL | `bpy.ops.export_mesh.stl()` | `bpy.ops.wm.stl_export()` | same as 4.x |
| Export OBJ | `bpy.ops.export_scene.obj()` | `bpy.ops.wm.obj_export()` | same as 4.x |
| BSDF Specular | `node.inputs['Specular']` | `node.inputs['Specular IOR Level']` | same as 4.x |
| EEVEE engine | `'BLENDER_EEVEE'` | `'BLENDER_EEVEE_NEXT'` | `'BLENDER_EEVEE'` (reverted) |
| `use_nodes` | required | required | deprecated (always on) |


## Material Assignment (Principled BSDF)


```python
def create_material(name, color_rgba, metallic=0.0, roughness=0.5):
    """Create a Principled BSDF material."""
    mat = bpy.data.materials.new(name=name)
    if bpy.app.version[0] < 5:  # use_nodes deprecated in 5.x (always on)
        mat.use_nodes = True
    bsdf = mat.node_tree.nodes["Principled BSDF"]
    bsdf.inputs['Base Color'].default_value = color_rgba  # (R, G, B, A)
    bsdf.inputs['Metallic'].default_value = metallic
    bsdf.inputs['Roughness'].default_value = roughness
    return mat

def assign_material(obj, material):
    """Assign material to object."""
    if obj.data.materials:
        obj.data.materials[0] = material
    else:
        obj.data.materials.append(material)

# Engineering color scheme
steel_mat = create_material("Steel", (0.6, 0.6, 0.65, 1.0), metallic=0.8, roughness=0.3)
water_mat = create_material("Water", (0.1, 0.3, 0.6, 0.7), metallic=0.0, roughness=0.1)
seabed_mat = create_material("Seabed", (0.4, 0.35, 0.2, 1.0), metallic=0.0, roughness=0.9)
```


## Camera and Lighting Setup


```python
def setup_engineering_camera(target=(0, 0, 0), distance=20, elevation=30, azimuth=45):
    """Set up camera for engineering visualization."""
    elev_rad = math.radians(elevation)
    azim_rad = math.radians(azimuth)

    cam_x = target[0] + distance * math.cos(elev_rad) * math.sin(azim_rad)
    cam_y = target[1] - distance * math.cos(elev_rad) * math.cos(azim_rad)
    cam_z = target[2] + distance * math.sin(elev_rad)

    bpy.ops.object.camera_add(location=(cam_x, cam_y, cam_z))
    camera = bpy.context.active_object
    camera.name = "Eng_Camera"

    # Point at target
    constraint = camera.constraints.new(type='TRACK_TO')
    empty = bpy.ops.object.empty_add(location=target)
    constraint.target = bpy.context.active_object
    constraint.track_axis = 'TRACK_NEGATIVE_Z'
    constraint.up_axis = 'UP_Y'

    bpy.context.scene.camera = camera
    return camera

def setup_lighting():
    """Add 3-point lighting for engineering renders."""
    bpy.ops.object.light_add(type='SUN', location=(10, -10, 20))
    key = bpy.context.active_object
    key.data.energy = 3.0

    bpy.ops.object.light_add(type='AREA', location=(-10, 5, 10))
    fill = bpy.context.active_object
    fill.data.energy = 1.5

    bpy.ops.object.light_add(type='POINT', location=(0, -15, 5))
    rim = bpy.context.active_object
    rim.data.energy = 2.0
```


## Render Settings Template


```python
def configure_render(engine='CYCLES', resolution=(1920, 1080), samples=128, gpu=True):
    """Configure render settings."""
    scene = bpy.context.scene
    # EEVEE enum name changed across versions:
    #   3.x: 'BLENDER_EEVEE', 4.x: 'BLENDER_EEVEE_NEXT', 5.x: 'BLENDER_EEVEE'
    if engine in ('EEVEE', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT'):
        engine = 'BLENDER_EEVEE_NEXT' if bpy.app.version[0] == 4 else 'BLENDER_EEVEE'
    scene.render.engine = engine  # 'CYCLES' or resolved EEVEE name
    scene.render.resolution_x = resolution[0]
    scene.render.resolution_y = resolution[1]

    if engine == 'CYCLES':
        scene.cycles.samples = samples
        scene.cycles.use_denoising = True
        if gpu:
            prefs = bpy.context.preferences.addons['cycles'].preferences
            prefs.compute_device_type = 'CUDA'  # or 'OPTIX', 'HIP'
            prefs.get_devices()
            for device in prefs.devices:
                device.use = True
            scene.cycles.device = 'GPU'

    scene.render.image_settings.file_format = 'PNG'
    scene.render.image_settings.color_depth = '16'
```

Related Skills

solidworks-to-blender-pipeline

5
from vamseeachanta/workspace-hub

Use when converting SolidWorks .sldprt/.sldasm geometry to Blender for rendering, animation, or visualization, including questions about STEP export settings, FreeCAD as a bridge, or which mesh format (STL/OBJ/GLTF) to choose.

blender-worktree-test-hardening

5
from vamseeachanta/workspace-hub

Recover and harden digitalmodel Blender automation work in isolated worktrees when uv/editable dependency paths break and local machines lack a Blender executable.

tax-filing-session-setup-with-github-tracking

5
from vamseeachanta/workspace-hub

Structured workflow for preparing and tracking a tax filing session using prepared documents, task checklist, and GitHub issue cross-referencing

tax-filing-session-setup-with-github-traceability

5
from vamseeachanta/workspace-hub

Structured workflow for setting up a multi-file tax filing session with GitHub issue tracking and prepared-file validation

python-import-path-mismatch-debugging

5
from vamseeachanta/workspace-hub

Diagnose and fix ModuleNotFoundError when a package is installed but imports still fail due to environment/path mismatches

python-import-path-debugging

5
from vamseeachanta/workspace-hub

Diagnose ModuleNotFoundError when a package is installed but still fails to import

python-debugpy

5
from vamseeachanta/workspace-hub

Debug Python: pdb REPL + debugpy remote (DAP).

orcaflex-vessel-setup

5
from vamseeachanta/workspace-hub

Configure 6-DOF vessels in OrcaFlex with hydrodynamic properties, RAO import from AQWA, and vessel type creation. Covers initial position, orientation, calculation settings, and motion options.

blender-interface

5
from vamseeachanta/workspace-hub

AI interface skill for Blender 3D — headless CLI execution, Python bpy API, mesh import/export, rendering, and integration with engineering analysis workflows.

webhook-subscriptions

5
from vamseeachanta/workspace-hub

Create and manage webhook subscriptions for event-driven agent activation. Use when the user wants external services to trigger agent runs automatically.

hermes-windows-setup

5
from vamseeachanta/workspace-hub

Install and configure a repo-centric Hermes agent workspace on Windows. Covers prerequisites, repo cloning, Python/uv environment, skills system, memory bridge, and multi-agent coordination — the Windows equivalent of the Linux workspace-hub pattern.

python-project-template

5
from vamseeachanta/workspace-hub

Generate standardized Python project structure with pyproject.toml, UV environment, pytest configuration, and workspace-hub compliance. Creates production-ready project scaffolding.