pohlke.scripting#

Scripting interface to use Pohlke functions in Blender scripts.

Blender console autocomplete:

>>> bpy.pohlke.
               add_axonometric_camera(
               add_oblique_camera(
               add_preset_camera(
               names
               presets

Classes#

Scriber

The Pohlke scripting interface object.

Module Contents#

class pohlke.scripting.Scriber[source]#

The Pohlke scripting interface object.

This object is instantiated in pohlke.register() and exposed as bpy.pohlke.

presets: dict[str, dict[str, pohlke.utils.data.CameraPreset]][source]#

Presets dicitonary from the main pohlke module.

c.f. pohlke.utils.data.CameraSettings

Examples

>>> bpy.pohlke.presets['AXONOMETRIC']
{'Dimetric  (37°/16°)': {'alpha': 37, 'beta': 16},
 'Dimetric  (41.5°/41.5°)': {'alpha': 41.5, 'beta': 41.5},
 'Dimetric  (60°/15°)': {'alpha': 60, 'beta': 15},
 'Dimetric  Engineering (41.4°/7.2°)': {'alpha': 41.4, 'beta': 7.2},
 'Dimetric  Pixel 1:2 (26.56°/26.56°)': {'alpha': 26.565, 'beta': 26.565},
 'Dimetric  Pixel 3:4 (36.87°/36.87°)': {'alpha': 36.873, 'beta': 36.873},
 'Isometric (30°/30°)': {'alpha': 30, 'beta': 30},
 'Trimetric (18°/11°)': {'alpha': 18, 'beta': 11},
 'Trimetric (30°/15°)': {'alpha': 30, 'beta': 15},
 'Trimetric (45°/15°)': {'alpha': 45, 'beta': 15},
 'Trimetric (45°/30°)': {'alpha': 45, 'beta': 30},
 'Trimetric (52°/13°)': {'alpha': 52, 'beta': 13}}
>>> bpy.pohlke.presets['OBLIQUE']
{'Cavalier 1:1': {'alpha': 45, 'beta': 45, 'shortening': 1},
 'Cavalier 1:2': {'alpha': 45, 'beta': 45, 'shortening': 0.5},
 'Cavalier 3:4': {'alpha': 45, 'beta': 45, 'shortening': 0.75},
 'Hejduk': {'alpha': 90, 'beta': 0, 'shortening': 1},
 'Military 1:1': {'alpha': 60, 'beta': 30, 'shortening': 1},
 'Military 1:2': {'alpha': 60, 'beta': 30, 'shortening': 0.5},
 'Military 3:4': {'alpha': 60, 'beta': 30, 'shortening': 0.75}}
>>> bpy.pohlke.presets['OBLIQUE']['Hejduk']
{'alpha': 90, 'beta': 0, 'shortening': 1}
property names: list[str][source]#

Get a list of the preset names.

Examples

>>> bpy.pohlke.names
['Isometric (30°/30°)',
 'Dimetric  Pixel 1:2 (26.56°/26.56°)',
 'Dimetric  Pixel 3:4 (36.87°/36.87°)',
 'Dimetric  (41.5°/41.5°)',
 'Dimetric  Engineering (41.4°/7.2°)',
 'Dimetric  (37°/16°)',
 'Dimetric  (60°/15°)',
 'Trimetric (18°/11°)',
 'Trimetric (30°/15°)',
 'Trimetric (45°/15°)',
 'Trimetric (52°/13°)',
 'Trimetric (45°/30°)',
 'Hejduk',
 'Cavalier 1:1',
 'Cavalier 3:4',
 'Cavalier 1:2',
 'Military 1:1',
 'Military 3:4',
 'Military 1:2']
>>> bpy.pohlke.names[12]
'Hejduk'
add_axonometric_camera(alpha: float, beta: float, ortho_scale: float = 10.0, position: Literal['ABOVE', 'BELOW'] = 'ABOVE', orientation: Literal['0', '1', '2', '3'] = '0') bpy.types.Camera[source]#

Add axonometric camera.

Parameters:
alphafloat

The alpha angle of the plan.

betafloat

The beta angle of the plan.

ortho_scale10.0, optional

The camera’s orthographic scale.

position{‘ABOVE’, ‘BELOW’}, optional

Vertical direction of view.

orientation{‘0’, ‘1’, ‘2’, ‘3’}, optional

Side of view. Quadrants are selected by index.

Returns:
bpy.context.active_object

The instance of the created camera object.

Examples

>>> bpy.pohlke.add_axonometric_camera(18, 11)
bpy.data.objects['Camera']
add_oblique_camera(alpha: float, beta: float, shortening: float = 1.0, ortho_scale: float = 10.0, position: Literal['ABOVE', 'BELOW'] = 'ABOVE', orientation: Literal['0', '1', '2', '3'] = '0') bpy.types.Camera[source]#

Add oblique camera.

Parameters:
alphafloat

The alpha angle of the plan.

betafloat

The beta angle of the plan.

shortening: 1.0, optional

The vertical reduction factor.

ortho_scale10.0, optional

The camera’s orthographic scale.

position{‘ABOVE’, ‘BELOW’}, optional

Vertical direction of view.

orientation{‘0’, ‘1’, ‘2’, ‘3’}, optional

Side of view. Quadrants are selected by index.

Returns:
bpy.context.active_object

The instance of the created camera object.

Raises:
ValueError

The sum of alpha and beta needs to be 90.

Examples

>>> bpy.pohlke.add_oblique_camera(60, 30, 0.5)
bpy.data.objects['Camera']
add_preset_camera(preset_name: str, ortho_scale: float = 10.0, position: Literal['ABOVE', 'BELOW'] = 'ABOVE', orientation: Literal['0', '1', '2', '3'] = '0') bpy.types.Camera[source]#

Add camera by preset name.

Parameters:
preset_name

The name of the preset.

ortho_scale10.0, optional

The camera’s orthographic scale.

position{‘ABOVE’, ‘BELOW’}, optional

Vertical direction of view.

orientation{‘0’, ‘1’, ‘2’, ‘3’}, optional

Side of view. Quadrants are selected by index.

Returns:
bpy.context.active_object

The instance of the created camera object.

Examples

>>> bpy.pohlke.add_preset_camera('Military 1:2 (60°/30°)')
bpy.data.objects['Camera']
>>> bpy.pohlke.add_preset_camera('Trimetric (18°/11°)')
bpy.data.objects['Camera.001']
>>> bpy.pohlke.add_preset_camera(bpy.pohlke.names[0])
bpy.data.objects['Camera.002']