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

ListParameterJSON Overview

Inherits Classes: ParameterJSON

A list of labels or images presented to the user in a combobox and values that accompany them. The listLabels or listImages field must be provided.

5 Examples:

var params = [
  {
    "id": "technique",
    "displayName": "Size Specifies",
    "type": "list",
    "listLabels": ["Radius", "Length of Apothem", "Length of Side"],
    "listValues": ["c", "a", "s"],
    "default": "c"
  }
];
var params = [
  {
    "id": "diameter",
    "displayName": "Diameter",
    "type": "list",
    "listImages": ["http://domain/nominal.png", "http://domain/inside.png", "http://domain/outside.png"],
    "listClasses": ["css-nominal", "css-inside", "css-outside"],
    "listValues": ["n", "i", "o"],
    "default": "n"
  }
];
//This example demonstrates how local resource images can be used within the listImages
var images = ["resource1.png", "resource2.png", "resource3.png"];
var listImages = [];
for(var i=0,len=image.length;i<len;i++) {
    listImages.push(Library.imageURL(images[i]));
}

var params = [
  {
    "id": "diameter",
    "displayName": "Diameter",
    "type": "list",
    "listImages": listImages,
    "listValues": ["n", "i", "o"],
    "default": "n"
  }
];
var params = [
  {
    "id": "diameter",
    "displayName": "Diameter",
    "type": "list",
    "listImages": [
        {
            "active": "http://domain/nominal_active.png",
            "hover": "http://domain/nominal_hover.png",
            "normal": "http://domain/nominal.png"
        },
        {
            "active": "http://domain/inside_active.png",
            "hover": "http://domain/inside_hover.png",
            "normal": "http://domain/inside.png"
        },
        {
            "active": "http://domain/outside_active.png",
            "hover": "http://domain/outside_hover.png",
            "normal": "http://domain/outside.png"
        }
    ],
    "listValues": ["n", "i", "o"],
    "default": "n"
  }
];
var params = [
  {
    "id": "diameter",
    "displayName": "Diameter",
    "type": "list",
    "listImages": [
        {
            "active": Library.imageURL("first_active32x32.png"),
            "hover": Library.imageURL("first_hover32x32.png"),
            "normal": Library.imageURL("first_normal32x32.png")
        },
        {
            "active": Library.imageURL("second_active32x32.png"),
            "hover": Library.imageURL("second_hover32x32.png"),
            "normal": Library.imageURL("second_normal32x32.png")
        },
        {
            "active": Library.imageURL("third_active32x32.png"),
            "hover": Library.imageURL("third_hover32x32.png"),
            "normal": Library.imageURL("third_normal32x32.png")
        }
    ],
    "listValues": ["n", "i", "o"],
    "default": "n"
  }
];

JSON Field Summary

JSON Field Details

String or Number default | Required

The default value for the parameter, which corresponds to a key in listValues. The value of this parameter when accessed through IShapeGenerator.preview, IShapeGenerator.evaluate or IShapeGenerator.validate will be the same type.

Array [ String , ... ] listClasses | Optional

An array of css classes corresponding to the listLabels entries. Must contain the same number of elements that are in listLabels. The values must be a valid css class name.

Array [ String , ... ] or Array [ ListImageItem , ... ] listImages | Optional

An array of user-visible images that appear for the user to select from for the set of listValues that is supplied. The values coorespond to fully qualified URLs, for example: "http://domain/image1.png", "http://domain/image2.png", etc. Or a ListImageItem having image names for different states. To know more about setting the URL of a local resource added to the Library, see Library.imageURL

Array [ String , ... ] listLabels | Optional

An array of user-visible strings that appear in a drop down box for the set of listValues that is supplied.

Array [ String or Number ] listValues | Required , Default: []

An array of values cooresponding to the listLabels entries. Must contain the same number of elements that are in listLabels.

Number pageSize | Optional

Specifies the maximum number of listImages that need to be shown in a single page. If the total number of images in the listImages property are more than the pageSize, the control can generate a paging navigation. If this property is not set, all the images will be shown without any pagination.