ParameterManager (hwx.common)#

class ParameterManager#

Bases: object

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.

Attribute Table#

Name

Type

onAboutToExport

Signal

onAboutToImport

Signal

Method Table#

Name

Description

add (self, name, type, expression, comment=’’)

Creates a new Variable.

clear (self)

Clears all the variables.

exportToFile (self, file)

Exports all the variable into a csv file.

get (self, name)

Returns a variable by the specified name.

importFile (self, file)

Imports variables from a specified csv file.

isImporting (self)

Variables are importing from a specified csv file.

remove (self, name)

Removes a variable by its specified name.

rename (self, oldName, newName)

Renames the variable from the specified old name to new name.

update (self, name, type=None, expression=None, comment=None)

Updates the variable from the specified variable name.

get(name)#

Returns a variable by the specified name.

Parameters:

name (str) – Name of the variable to return.

Returns:

The found variable.

Return type:

Variable

add(name, type, expression, comment='')#

Creates a new Variable.

Parameters:
  • name (str) – Name of the variable.

  • type (UnitType) – Specifies the type of Variable. It can be: Length, Angle, String and Unitless.

  • expression (str, float) – Value of the variable on basis of the type.

  • comment (str) – User added comments for the variable.

update(name, type=None, expression=None, comment=None)#

Updates the variable from the specified variable name.

Parameters:
  • name (str) – Name of the variable.

  • type (UnitType) – Specifies the type of Variable. It can be: Length, Angle, String and Unitless.

  • expression (str, float) – Value of the variable on basis of the type.

  • comment (str) – User added comments for the variable.

rename(oldName, newName)#

Renames the variable from the specified old name to new name.

Parameters:
  • oldName (str) – The old variable name.

  • newName (str) – The new variable name.

remove(name)#

Removes a variable by its specified name.

Parameters:

name (str) – Name of the variable.

clear()#

Clears all the variables.

importFile(file)#

Imports variables from a specified csv file.

Parameters:

file (str) – Csv file to import.

exportToFile(file)#

Exports all the variable into a csv file.

Parameters:

file (str) – Csv file path to export all the variables.

isImporting()#

Variables are importing from a specified csv file.

Note: This is True only when the importing process is in progress, after it is finished it becomes False