Parameter with a Python list

The value of the PythonPart parameter can be created as a Python list object of the used value type.

../../../../_images/OneDimList.png

Syntax

<Parameter>
<Name>CubeDimensions</Name>
<Text> </Text>
<Value>[1000.,1200.,1400.,1600.,1800.]</Value>
<ValueType>Length</ValueType>
</Parameter>

For the definition of the list in the <Value> tag a general Python statement for list creation can be used

  • []

  • [1000.,1200.,1400.,1600.,1800.]

  • [1000.] * 5

  • [[0 for x in range(3)] for y in range(5)]

By adding the list parameter to a Row and setting the value of the row to 1, the entire row can be used for the controls

../../../../_images/EntireListRow.png

Optional tags

If the length of the list is to be dynamic, the following tag must be added

<Dimensions>CubeCount</Dimensions>

The name assigned to <Dimensions> must be the name of an existing Integer parameter, an integer constant or a formula created by parameter names like

<Dimensions>CubeCount + 1</Dimensions>

Depending on the value of this parameter, the list is lengthened or shortened.

The list can be a one-dimensional or two-dimensional. In case of a two-dimensional list the <Dimensions> tag must consist of two entries like

<Dimensions>CubeCount,CoordDimension3D + 2</Dimensions>

The result in the property palette looks like

../../../../_images/TwoDimList.png

Each row of the list in the property palette is tagged with a row index. By default this index starts at 0. The starting index can be changed by adding the tag

<ValueListStartRow>1</ValueListStartRow>

with the defined start index. If the value is set to -1, no index is displayed

../../../../_images/TwoDimListNoIndex.png

If only one row of the list is to be displayed in the property palette, the tag

<ValueIndexName>VisibleRowIndex</ValueIndexName>

must be added. The name assigned to <ValueIndexName> must be the name of an existing Integer or IntegerComboBox parameter. The row index starts from 1.

Additionally, all optional tags from the defined <ValueType> can be used. Advanced possibilities for the enable and visible state of a list row can be found here Enable and visible options.

Access to list row values

The special keyword $list_row allows access to values from a row in the tags <Visible>, <Enable>, <MinValue> and <MaxValue>.

Example

The implementation of the list value type is described in the example ListValues, which is located in

…\etc\Examples\PythonParts\PaletteExamples\ListValues.pyp
…\etc\PythonPartsExampleScripts\PaletteExamples\ListValues.py