Python Functions & Operators

Earth Volumetric Studio uses Python 3.3

A listing of Python Functions & Operators can be found at python.org. Below are links to relevant pages:

Please note: C Tech does not provide Python programming or syntax assistance as a part of Technical Support (included at no additional cost with current maintenance). Python scripting and functionality is provided as an advanced feature of Earth Volumetric Studio, but is not required to use the basic functionality.

 

Below are Earth Volumetric Studio specific functions which provide means to get and set parameters and to act upon the modules in the libraries and network.

 

evs.check_cancel():

Inserting this function at one or more locations in your Python script allows you to terminate (exit) the script when it is running once this function is reached. This should be inserted in loops which may run repeatedly so that canceling the script is possible.

 

Keyword Arguments: None

 

evs.get_application_info():

Gets basic information about the current application.

 

Keyword Arguments: None

 

evs.get_module(module, category, property):

Get a value from a module within the application.

 

Keyword Arguments:

module -- the name of the module (required)

category -- the category of the property (required)

property -- the name of the property to read (required)

 

evs.get_modules():

Gets a list of all module names in the application.

 

Keyword Arguments: None

 

evs.get_module_type(module):

Gets the type of a module given its name.

 

Keyword Arguments:

module -- the name of the module (required)

 

evs.rename_module(module, newName):

Renames a module, and returns the new name.

 

Keyword Arguments:

module -- the name of the module (required)

newName -- the suggested name of the module after renaming (required)

 

evs.get_module_extended(module, category, property):

Get an extended value from a module within the application.

Keyword Arguments:

module -- the name of the module (required)

category -- the category of the property (required)

property -- the name of the property to read (required)

 

evs.set_module(module, category, property, value):

Set a property value in a module within the application.

Keyword Arguments:

module -- the name of the module (required)

category -- the category of the property (required)

property -- the name of the property to set (required)

value -- the new value for the property (required)

 

evs.get_port(module, port, category, property):

Get a value from a port in a module within the application.

 

Keyword Arguments:

module -- the name of the module (required)

port -- the name of the port (required)

category -- the category of the property (required)

property -- the name of the property to read (required)

 

evs.get_port_extended(module, port, category, property):

Get an extended value from a port in a module within the application.

Keyword Arguments:

module -- the name of the module (required)

port -- the name of the port (required)

category -- the category of the property (required)

property -- the name of the property to read (required)

 

evs.set_port(module, port, category, property, value):

Set a property value in a port in a module within the application.

 

Keyword Arguments:

module -- the name of the module (required)

port -- the name of the port (required)

category -- the category of the property (required)

property -- the name of the property to set (required)

value -- the new value for the property (required)

 

evs.connect(starting_module, starting_port, ending_module, ending_port):

Connect two modules in the application.

 

Keyword Arguments:

starting_module -- the starting module (required)

starting_port -- the port on the starting module (required)

ending_module -- the ending module (required)

ending_port -- the port on the ending module (required)

 

 

evs.disconnect(starting_module, starting_port, ending_module, ending_port):

Disconnect two modules in the application.

 

Keyword Arguments:

starting_module -- the starting module (required)

starting_port -- the port on the starting module (required)

ending_module -- the ending module (required)

ending_port -- the port on the ending module (required)

 

evs.delete_module(module):

Delete a module from the application.

 

Keyword Arguments:

module -- the module to delete (required)

 

evs.instance_module(module, suggested_name, x, y):

Instances a module in the application.

 

Keyword Arguments:

module -- the module to instance (required)

suggested_name -- the suggested name for the module to instance (required)

x -- the x coordinate (required)

y -- the y coordinate (required)

Result - The name of the instanced module

 

evs.get_module_position(module):

Gets the position of a module.

 

Keyword Arguments:

module -- the module (required)

Result - A tuple containing the (x,y) coordinate

 

 

evs.suspend():

Suspends the execution of the application until a resume is called.

Keyword Arguments: None

 

evs.resume():

Resumes the execution of the application, causing any suspended operations to run.

Keyword Arguments: None

 

evs.refresh():

Refreshes the viewer and processes all mouse and keyboard actions in the application. Potentially unsafe operation.

Keyword Arguments: None

 

Refreshes the viewer and processes all mouse and keyboard actions in the application. At each occurrence of this function, your scripts will catch-up to behave more like manual actions. In most cases this is the only way that you can see the consequences of the commands reflected in your viewer upon this function's execution.

This is a potentially unsafe operation under certain (hard to predict) circumstances.

If your script is malfunctioning with this command, try removing or commenting all occurrences.

We do not recommend using this command within Python scripts executed by the trigger_script module.

evs.sigfig(number, digits):

Rounds a number to a specific number of significant figures.

 

Keyword Arguments:

number -- the number to round (required)

digits -- the number of significant digits (required)

 

Result - The rounded value

 

evs.fn(number, digits = 6, include_thousands_separators = True, preserve_trailing_zeros = False):

Formats a number as string using a specific number of significant figures.

 

Keyword Arguments:

number -- the number to round (required)

digits -- the number of significant digits (optional, defaults to 6)

include_thousands_separators -- whether to include separators for thousands (optional, defaults to True)

preserve_trailing_zeros -- whether to preserve trailing zeros when computing significant digits (optional, defaults to False)

 

Result - The formatted number as a string

 

evs.is_module_executed():

Returns true if the script is being executed by a module.

Returns false when user executes (ie: hitting play in script window).

Keyword Arguments: None

 

evs_util.evsdate_to_datetime(d):

Convert a scripting "date" value to a datetime.datetime

 

Keyword Arguments:

d: the date to convert (required)

 

Result - The converted date

 

evs_util.datetime_to_evsdate(d):

Convert a datetime.datetime to a scripting "date" value

 

Keyword Arguments:

d: the date to convert (required)

 

Result - The converted date

 

evs_util.datetime_to_excel(d):

Convert a datetime.datetime into an excel compatible date number

 

Keyword Arguments:

d: the date to convert (required)

 

Result - The converted date

 

evs_util.evsdate_to_excel(d):

Convert a scripting "date" into an excel compatible date number

 

Keyword Arguments:

d: the date to convert (required)

 

Result - The converted date

 

evs_util.excel_to_datetime(d):

Convert form an excel compatible date number into a datetime.datetime

 

Keyword Arguments:

d: the date to convert (required)

 

Result - The converted date

 

evs_util.excel_to_evsdate(d):

Convert form an excel compatible date number into a scripting date value

 

Keyword Arguments:

d: the date to convert (required)

 

Result - The converted date