Autodesk Creative Platform Core Version 1.19.0
A broad and deep collection of 2D and 3D capabilities.

Debug Overview

When a Creative Platform Library runs, it is executed remotely in the cloud where it has access to the computing resources of a large cluster of server computers. When everything is going as expected, your script will only need to return the 3D solid it has generated. In error situations and for debugging purposes, you may need to send back some other data as well. These functions allow you to return data from your Creative Platform Library back to the app.

Introduced in Version: 1.0.0

Static Member Summary

Static Member Details

Debug color (args) | Chainable

Set the color for the visualized debugging lines and points. Once you change the color, the color will apply to all the new created debugging lines and points. The previous lines and points are not affected.
  • args: Array [ Number ] - Various permutations of arguments are allowed. Define the color with r, g, b, a. The value ranges are [0,1]. The alpha value is optional and default to 1.0. Please see the examples for usage.

4 Examples:

// Define the color with r, g, b, a:
Debug.color(0.5, 0.6, 0.2, 0.8);
// Define the color with r, g, b:
Debug.color(0.5, 0.6, 0.2);
// Define the color with [r, g, b, a]:
Debug.color([0.5, 0.6, 0.2, 0.8]);
// Define the color with [r, g, b]:
Debug.color([0.5, 0.6, 0.2]);

Debug line (args) | Chainable

Creates a debugging line from the point start to the point end. The line is displayed in the editor when the Autodesk Creative Platform Library Editor is open. You can use debugging lines to visualize values in 3D space.
  • args: Array [ Number ] - Various permutations of arguments are allowed. Please see the examples for usage.

3 Examples:

// Define a line by passing in 6 numbers 
// cooresponding to the X, Y and Z values of 
// 2 points:
Debug.line(0, 0, 0, 1, 0, 0);
// Define a line by passing in 2 arrays 
// containing 3 numbers each, cooresponding 
// to the X, Y and Z:
Debug.line([0, 0, 0], [1, 0, 0]);
// Define a line by passing in 1 array 
// containing 6 numbers cooresponding to 
// the X, Y and Z values of 2 points:
Debug.line([0, 0, 0, 1, 0, 0]);

Debug log (str) | Chainable

Prints the string str into the printout list in the script editor. You can use this method to inspect the state of your script when it's being executed.
  • str: String - The log string.

Debug point (args) | Chainable

Displays a point in 3D space for diagnostic or debugging purposes. The point is only displayed when the Autodesk Creative Platform Library Editor is open, so end users will not see it.
  • args: Array [ Number ] - Various permutations of arguments are allowed. Please see the examples for usage.

2 Examples:

// Define a point by passing in 3 numbers 
// cooresponding to the X, Y and Z:
Debug.point(0, 1, 0);
// Define a point by passing in i array 
// containing 3 numbers cooresponding 
// to the X, Y and Z:
Debug.point([0, 1, 0]);

Debug show (item) | Chainable

Allows the developer to visualize any object that implements the IDebuggable for diagnostic or debugging purposes.

Debug triangles (vertices, [indices]) | Chainable

Displays a set of triangles in 3D space for diagnostic or debugging purposes. Triangles should be specified in counter-clockwise winding order. The triangles are only displayed when the Autodesk Creative Platform Library Editor is open, so end users will not see it.

How to use:

    var showTriangleList = function() {
        var triangleList = [
            10, -10, 0,
            30, -10, 0,
            30, 10, 0,    
            30, 10, 0,
            10, 10, 0,
            10, -10, 0    
        ];
        Debug.triangles(triangleList);
    };

    var showIndexedTriangles = function() {
        var vertices = [
            40, -10, 0,
            60, -10, 0,
            60, 10, 0,
            40, 10, 0    
        ];  
        var indices = [
            0, 1, 2,
            2, 3, 0
        ];  
        Debug.triangles(vertices, indices);
    };

    Debug.color(0, 0, 255);
    showTriangleList();
    Debug.color(255, 0, 0);
    showIndexedTriangles();

Result:

debug_triangles

  • vertices: Array [ Number ] or Array [ Point3D ] - An array of points to use for the vertices of the triangles.
  • indices: Array [ Number ] - An optional set of indices that can be used | Optional