cam.operators.simulation_ops#

Fabex ‘simulation_ops.py’ © 2012 Vilem Novak

Blender Operator definitions are in this file. They mostly call the functions from ‘utils.py’

Classes#

CAMSimulate

Simulate CAM Operation

CAMSimulateChain

Simulate CAM Chain, Compared to Single Op Simulation Just Writes Into One Image and Thus Enables

Module Contents#

class CAMSimulate[source]#

Bases: bpy.types.Operator, cam.operators.async_op.AsyncOperatorMixin

Simulate CAM Operation This Is Performed by: Creating an Image, Painting Z Depth of the Brush Subtractively. Works only for Some Operations, Can Not Be Used for 4-5 Axis.

bl_idname = 'object.cam_simulate'[source]#
bl_label = 'CAM Simulation'[source]#
bl_options[source]#
operation: StringProperty(name='Operation', description='Specify the operation to calculate', default='Operation')[source]#
async execute_async(context)[source]#

Execute an asynchronous simulation operation based on the active camera operation.

This method retrieves the current scene and the active camera operation. It constructs the operation name and checks if the corresponding object exists in the Blender data. If it does, it attempts to run the simulation asynchronously. If the simulation is cancelled, it returns a cancellation status. If the object does not exist, it reports an error and returns a finished status.

Parameters:

context – The context in which the operation is executed.

Returns:

A dictionary indicating the status of the operation, either

{‘CANCELLED’} or {‘FINISHED’}.

Return type:

dict

draw(context)[source]#

Draws the user interface for selecting camera operations.

This method creates a layout element in the user interface that allows users to search and select a specific camera operation from a list of available operations defined in the current scene. It utilizes the Blender Python API to integrate with the UI.

Parameters:

context – The context in which the drawing occurs, typically provided by Blender’s UI system.

class CAMSimulateChain[source]#

Bases: bpy.types.Operator, cam.operators.async_op.AsyncOperatorMixin

Simulate CAM Chain, Compared to Single Op Simulation Just Writes Into One Image and Thus Enables to See how Ops Work Together.

bl_idname = 'object.cam_simulate_chain'[source]#
bl_label = 'CAM Simulation'[source]#
bl_options[source]#
classmethod poll(context)[source]#

Check the validity of the active camera chain in the scene.

This method retrieves the currently active camera chain from the scene’s camera chains and checks its validity using the isChainValid function. It returns a boolean indicating whether the active camera chain is valid.

Parameters:

context (object) – The context containing the scene and its properties.

Returns:

True if the active camera chain is valid, False otherwise.

Return type:

bool

operation: StringProperty(name='Operation', description='Specify the operation to calculate', default='Operation')[source]#
async execute_async(context)[source]#

Execute an asynchronous simulation for a specified camera chain.

This method retrieves the active camera chain from the current Blender scene and determines the operations associated with that chain. It checks if all operations are valid and can be simulated. If valid, it proceeds to execute the simulation asynchronously. If any operation is invalid, it logs a message and returns a finished status without performing the

Parameters:

context – The context in which the operation is executed.

Returns:

A dictionary indicating the status of the operation, either operation completed successfully.

Return type:

dict

draw(context)[source]#

Draw the user interface for selecting camera operations.

This function creates a user interface element that allows the user to search and select a specific camera operation from a list of available operations in the current scene. It utilizes the Blender Python API to create a property search layout.

Parameters:

context – The context in which the drawing occurs, typically containing information about the current scene and UI elements.