![]() |
GeMA
The GeMA main application
|
Property set objects are a Lua wrapper over a GeMA property set providing a full set of methods for querying and updating property data. They can be obtained in the orchestration by calling modelData:
propertySet()
or by retrieving a list of property sets tied to a mesh by calling the mesh:
propertySets()
method.
Example:
Index:
pset:
id()
pset:
numProperties()
pset:
propertyIds()
pset:
propertyInfo()
pset:
propertyAccessor()
pset:
numValues()
pset:
valueIds()
pset:
valueIndex()
pset:
addValues()
pset:id() | |
---|---|
Description: | Returns the property set name. |
Parameters: | None. |
Returns: | Returns a string with the property set name (the id attribute given during its model definition). |
Example:
pset:numProperties() | |
---|---|
Description: | Returns the number of properties (columns) on the property set. |
Parameters: | None. |
Returns: | Returns the number of properties. |
Example:
pset:propertyIds() | |
---|---|
Description: | Returns a list with the name (id) of every property (column) on the property set. |
Parameters: | None. |
Returns: | Returns a table with property ids (strings). |
Example:
pset:propertyInfo(name) | |
---|---|
Description: | Returns an object with metadata information about the named property. |
Parameters: | name - The property name (id). |
Returns: | Returns a value info object or nil if the requested name was not found in the property set. |
Example:
pset:propertyAccessor(name, unit) | ||
---|---|---|
Description: | Returns a Value accessor object that can be used to retrieve data for properties. Unlike other accessor types, a property accessor always retrieves data from the current state. Property accessors retrieved from the property set can not be used to evaluate user functions since they are indexed by table row and not by mesh cells. Its main usage is for updating property set data. For evaluating functions, a property accessor retrieved through a mesh object should be used (refer to the mesh: cellPropertyAccessor() method). | |
Parameters: | name | The name (id) of the property. |
unit | An optional string with the desired unit for returned values. If different from the data unit, the accessor will automatically convert values. | |
Returns: | A Value accessor object or nil on errors (the requested name is unknown, or the requested unit is incompatible with the data unit, for example). |
Example:
pset:numValues() | |
---|---|
Description: | Returns the number of property values (lines) stored on the property set. |
Parameters: | None. |
Returns: | Returns the number of values. |
Example:
pset:valueIds() | |
---|---|
Description: | Returns a table with value ids, one for each line in the property set. If a line does not have a user defined id, a numeric one, equal to the line number (zero based and not 1 based), will be returned in the table. |
Parameters: | None. |
Returns: | A table with value ids (strings). |
Example:
pset:valueIndex(valueName) | |
---|---|
Description: | Returns the index of a value identifier in the property set. |
Parameters: | valueName - The value name. |
Returns: | Returns an index between 1 and pset: numValues() or nil for invalid names. |
Example:
pset:addValues(numLines, idList) | ||
---|---|---|
Description: | Adds new lines to the property set table, optionaly setting their ids. | |
Parameters: | numLines | The number of lines to add to the property set. |
idList | An optional list with line ids. If present, this table should have numLines entries with unique values (among each other and existing property set values). | |
Returns: | Returns the index of the first new line in the set or nil on errors. |
Example: