cam.testing#

BlenderCAM ‘testing.py’ © 2012 Vilem Novak

Functions for automated testing.

Attributes#

Functions#

addTestCurve(loc)

Add a test curve to the Blender scene.

addTestMesh(loc)

Add a test mesh to the Blender scene.

deleteFirstVert(ob)

Delete the first vertex of a given object.

testCalc(o)

Test the calculation of the camera path for a given object.

testCutout(pos)

Test the cutout functionality in the scene.

testPocket(pos)

Test the pocket operation in a 3D scene.

testParallel(pos)

Test the parallel functionality of the camera operations.

testWaterline(pos)

Test the waterline functionality in the scene.

testSimulation()

Testsimulation function.

cleanUp()

Clean up the Blender scene by removing all objects and camera

testOperation(i)

Test the operation of a camera path in Blender.

testAll()

Run tests on all camera operations in the current scene.

Module Contents#

addTestCurve(loc)[source]#

Add a test curve to the Blender scene.

This function creates a Bezier circle at the specified location in the Blender scene. It first adds a primitive Bezier circle, then enters edit mode to duplicate the circle twice, resizing each duplicate to half its original size. The function ensures that the transformations are applied in the global orientation and does not use proportional editing.

Parameters:

loc (tuple) – A tuple representing the (x, y, z) coordinates where the Bezier circle will be added in the 3D space.

addTestMesh(loc)[source]#

Add a test mesh to the Blender scene.

This function creates a monkey mesh and a plane mesh at the specified location in the Blender scene. It first adds a monkey mesh with a small radius, rotates it, and applies the transformation. Then, it toggles into edit mode, adds a plane mesh, resizes it, and translates it slightly before toggling back out of edit mode.

Parameters:

loc (tuple) – A tuple representing the (x, y, z) coordinates where the meshes will be added in the Blender scene.

deleteFirstVert(ob)[source]#

Delete the first vertex of a given object.

This function activates the specified object, enters edit mode, deselects all vertices, selects the first vertex, and then deletes it. The function ensures that the object is properly updated after the deletion.

Parameters:

ob (bpy.types.Object) – The Blender object from which the first

testCalc(o)[source]#

Test the calculation of the camera path for a given object.

This function invokes the Blender operator to calculate the camera path for the specified object and then deletes the first vertex of that object. It is intended to be used within a Blender environment where the bpy module is available.

Parameters:

o (Object) – The Blender object for which the camera path is to be calculated.

testCutout(pos)[source]#

Test the cutout functionality in the scene.

This function adds a test curve based on the provided position, performs a camera operation, and sets the strategy to ‘CUTOUT’. It then calls the testCalc function to perform further calculations on the camera operation.

Parameters:

pos (tuple) – A tuple containing the x and y coordinates for the position of the test curve.

testPocket(pos)[source]#

Test the pocket operation in a 3D scene.

This function sets up a pocket operation by adding a test curve based on the provided position. It configures the camera operation settings for the pocket strategy, enabling helix entry and tangential retraction. Finally, it performs a calculation based on the configured operation.

Parameters:

pos (tuple) – A tuple containing the x and y coordinates for the position of the test curve.

testParallel(pos)[source]#

Test the parallel functionality of the camera operations.

This function adds a test mesh at a specified position and then performs camera operations in the Blender environment. It sets the ambient behavior of the camera operation to ‘AROUND’ and configures the material radius around the model. Finally, it calculates the camera path based on the current scene settings.

Parameters:

pos (tuple) – A tuple containing the x and y coordinates for positioning the test mesh.

testWaterline(pos)[source]#

Test the waterline functionality in the scene.

This function adds a test mesh at a specified position and then performs a camera operation with the strategy set to ‘WATERLINE’. It also configures the optimization pixel size for the operation. The function is intended for use in a 3D environment where waterline calculations are necessary for rendering or simulation.

Parameters:

pos (tuple) – A tuple containing the x and y coordinates for the position of the test mesh.

testSimulation()[source]#

Testsimulation function.

cleanUp()[source]#

Clean up the Blender scene by removing all objects and camera operations.

This function selects all objects in the current Blender scene and deletes them. It also removes any camera operations that are present in the scene. This is useful for resetting the scene to a clean state before performing further operations.

testOperation(i)[source]#

Test the operation of a camera path in Blender.

This function tests a specific camera operation by comparing the generated camera path with an existing reference path. It retrieves the camera operation from the scene and checks if the generated path matches the expected path in terms of vertex count and positions. If there is no existing reference path, it marks the new result as comparable. The function generates a report detailing the results of the comparison, including any discrepancies found.

Parameters:

i (int) – The index of the camera operation to test.

Returns:

A report summarizing the results of the operation test.

Return type:

str

testAll()[source]#

Run tests on all camera operations in the current scene.

This function iterates through all camera operations defined in the current Blender scene and executes a test for each operation. The results of these tests are collected into a report string, which is then printed to the console. This is useful for verifying the functionality of camera operations within the Blender environment.

tests[source]#
p[source]#