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

IShapeGenerator Overview

A Shape Generator is an object that can generate geometry from user-supplied parameters. Shape Generators are assigned to shapes via the ShapeJSON.geom member.

Introduced in Version: 1.4.0

Interface Summary

Interface Details

• configuration (callback) | Optional , Asynchronous , Coming Soon!

Allows the shape generator to specify a curated viewing experience for standalone experience when downloading a disconnected version of the viewer.

• evaluate (parameters, callback) | Required , Asynchronous

Allows the shape generator to evaluate the user-defined parameters then generate a Solid3D. This function is called every time the parameters are changed. Beware that the results are cached for each unique set of parameter combinations, so if the Shape Generator uses any random number generation, it must be a repeatable random number to ensure consistency across various evaluations. In earlier versions of the Autodesk Creative Platform this was achieved by implementing a synchronous function called process or an asynchronous function called shapeGeneratorEvaluate.
  • parameters: Object [ String , Object ] - A Key-Value dictionary that contains the parameter values, where the key is equivalent to ParameterJSON.id and the value is the value of the parameter.
  • callback: Function ( Solid3D ) - A callback function that accepts a single Solid3D as an argument.

• parameters (callback) | Optional , Asynchronous

Allows the Shape Generator to describe the parameters and their default values asynchronously. If this is not implemented, then no parameters will be shown to the user. In earlier versions of the Autodesk Creative Platform this was achieved by either assigning a variable named params or by implementation a function called shapeGeneratorDefaults.

• presets (callback) | Optional , Asynchronous , Coming Soon!

Allows the Shape Generator to curate the presets for the shape a bit better. For right now only a single preset is used, even if multiple presets are specified. In the future multiple presets may be allowed and the schema may be updated to permit more flexibility.
  • callback: Function ( Array [ Object ] ) - A callback that's invoked with information about what parameters are available.

• preview (parameters, callback) | Optional , Asynchronous , Coming Soon!

Allows the shape generator to evaluate the parameters then generate a Solid3D for preview purposes. Sometimes there are some shortcuts that can be taken for preview purposes that cannot be taken for the final results in evaluate. For example, for previewing sometimes it's not necessary to perform boolean or CSG operations on multiple meshes, but for the final result that may need to be done.

• randomize (args, callback) | Optional , Asynchronous

A Shape Generator can present randomization buttons to a user by including LayoutGroupItemRandomizerJSON sections in the ShapeGeneratorConfigurationJSON returned by configuration. If this option is included, then the shape generator needs to implement a method for generating the random values for the various parameters, since there could be rules that govern how they relate to each other.

• validate (args, callback) | Optional , Asynchronous

Allows the shape generator to evaluate the parameters for validity, and respond with information about the validation. This function is only called when a parameter is modified that has the ParameterJSON.validate field set to true or if the client implements configuration and the configuration contains a LayoutGroupMapJSON element which the user happens to change.
  • args: Object
    • .changed: Object - Information about what has changed to trigger this validation.
      • .parameters: Object [ String , Object ] - A Key-Value dictionary that contains keys for each parameter that changed, where the key is equivalent to ParameterJSON.id and the value is the value of the parameter. | Optional
      • .maps: Object [ String , String ] - A Key-Value dictionary that contains the keys for the maps that changed. The key is LayoutGroupJSON.id and the value is the currently selected map value MapKeyJSON.color. | Optional
    • .parameters: Object [ String , Object ] - A Key-Value dictionary that contains the parameter values, where the key is equivalent to ParameterJSON.id and the value is the value of the parameter.
    • .maps: Object [ String , String ] - A Key-Value dictionary that contains the currently selected color(s) on the image maps. The key is LayoutGroupJSON.id and the value is the currently selected map value MapKeyJSON.color. | Optional
  • callback: Function ( Array [ ParameterJSON , ... ] ) - A callback function that allows an array of ParameterJSON objects to be returned, such that only the subset of parameters and parameter fields that are affected need to be returned.