ParameterManager (hwx.common)¶
Defines a variable for the use in sketching and geometric tools.
Variables can be created, updated or deleted from the model. It is accessible like a dict.
Public Methods¶
add (self, name, type, expression, comment=’’) clear (self) exportToFile (self, file) get (self, name) importFile (self, file) remove (self, name) rename (self, oldName, newName) update (self, name, type=None, expression=None, comment=None)
Method Details¶
-
add(self, name, type, expression, comment='')
Creates a new Variable.
| param name: | Name of the variable. |
|---|---|
| type name: | str |
| param type: | Specifies the type of Variable. It can be: Length, Angle, String and Unitless. |
| type type: | UnitType |
| param expression: | |
| Value of the variable on basis of the type. | |
| type expression: | |
| str, float | |
| param comment: | User added comments for the variable. |
| type comment: | str |
-
clear(self)
Clears all the variables.
-
exportToFile(self, file)¶
Exports all the variable into a csv file.
| param file: | Csv file path to export all the variables. |
|---|---|
| type file: | str |
-
get(self, name)
Returns a variable by the specified name.
| param name: | Name of the variable to return. |
|---|---|
| type name: | str |
| returns: | The found variable. |
| rtype: | Variable |
-
importFile(self, file)¶
Imports variables from a specified csv file.
| param file: | Csv file to import. |
|---|---|
| type file: | str |
-
remove(self, name)
Removes a variable by its specified name.
| param name: | Name of the variable. |
|---|---|
| type name: | str |
-
rename(self, oldName, newName)
Renames the variable from the specified old name to new name.
| param oldName: | The old variable name. |
|---|---|
| type oldName: | str |
| param newName: | The new variable name. |
| type newName: | str |
-
update(self, name, type=None, expression=None, comment=None)
Updates the variable from the specified variable name.
| param name: | Name of the variable. |
|---|---|
| type name: | str |
| param type: | Specifies the type of Variable. It can be: Length, Angle, String and Unitless. |
| type type: | UnitType |
| param expression: | |
| Value of the variable on basis of the type. | |
| type expression: | |
| str, float | |
| param comment: | User added comments for the variable. |
| type comment: | str |