Welcome to FEI python API documentation

Object handling classes

class hx.core.HxObjectFactory

Bases: object

This class enables instantiation of all modules and loading of all data in Python.

All instances of this classes are interchangeable. There is one instance already instantiated named hx_object_factory.

Methods

create(classname) This function creates a module.
get(obj_name) This function try to find a module or a data by its name.
load(filename) This function loads a data.
create(classname)

This function creates a module.

Parameters:

classname : str

String that represents the classname to instantiate.

Returns:

HxBase

Returns an instance of HxBase hierarchy most derivated possible class.

Examples

This example illustrates how to instantiate an HxOrthoSlice.

>>> my_var = hx_object_factory.create( 'HxOrthoSlice' )
get(obj_name)

This function try to find a module or a data by its name.

Parameters:

obj_name : str

String that represents the name property of the searched module. (it refers to the HxBase.name property)

Returns:

HxBase

Returns an instance of HxBase hierarchy most derivated possible class that has the name obj_name.

Raises:

KeyError

This exception is raised if no module called obj_name could be found.

Examples

We try to find a module which name is ‘Ortho Slice’

>>> my_var = hx_object_factory.get( 'Ortho Slice' )
load(filename)

This function loads a data.

Parameters:

filename : str

String that represents the file to load.

Returns:

HxBase or list of HxBase

Returns an instance of HxData hierarchy most derivated possible class if there is only one module corresponding to the filename. Returns a list of HxBase in case filename corresponds to multiple modules.

Raises:

KeyError

RuntimeError

Examples

This example illustrates how to load a file.

>>> my_var = hx_object_factory.load(hx_paths.tutorials_dir + '/chocolate-bar.am')
class hx.core.HxProject

Bases: object

This class allows the user to interact with the project view (also called the object pool) by adding or removing objects from it.

All instances of this class are interchangeable. There is one instance of this class which is called hx_project.

Methods

add(obj) Adds obj to the project view.
create(classname) Method that creates an object whose type is classname and add it to the project view.
get(obj_name) Retrieves an object in the project view given its name.
load(filename) Method that loads the file specified by filename and add it to the project view.
remove(obj) Removes obj from the project view.
remove_all() Removes all objects from the project view.
add(obj)

Adds obj to the project view.

Parameters:

obj : HxObject

Object that must be added to the project view.

Examples

We create an Ortho Slice with the object factory, then add it to the project view:

>>> ortho = hx_object_factory.create('HxOrthoSlice')
>>> hx_project.add(ortho)
create(classname)

Method that creates an object whose type is classname and add it to the project view.

Parameters:

classname : string

String that represents the class of the object to instantiate.

Returns:

HxBase

Returns the most derivate class of HxBase hierarchy that could handle the object instantiated in the application.

Notes

The following code:

>>> some_obj = hx_project.create('HxOrthoSlice')

is equivalent to:

>>> some_obj = hx_object_factory.create('HxOrthoSlice')
>>> hx_project.add(some_obj)

Examples

Creates an Ortho Slice and adds it to the project view:

>>> some_obj = hx_project.create('HxOrthoSlice')
get(obj_name)

Retrieves an object in the project view given its name.

Parameters:

obj_name : string

Name of the object that must be retrieved.

Raises:

KeyError

This exception is raised if no object called obj_name could be found in the project view.

Examples

We create an Ortho Slice, give it a name, add it to project view and query it by its name:

>>> ortho = hx_object_factory.create('HxOrthoSlice')
>>> ortho.name = "MyNewName"
>>> hx_project.add(ortho)
>>> ortho2 = hx_project.get("MyNewName")

Notices that in this case ortho and ortho2 represents the same object in the application:

>>> print ortho.is_same_object(ortho2)
True
load(filename)

Method that loads the file specified by filename and add it to the project view.

Parameters:

filename : string

String that represents the file to load.

Returns:

HxBase

Returns the most derivate class of HxData hierarchy that could handle the object instantiated in the application.

Notes

The following code:

>>> some_obj = hx_project.load(hx_paths.tutorials_dir + '/chocolate-bar.am')

is equivalent to:

>>> some_obj = hx_object_factory.load(hx_paths.tutorials_dir + '/chocolate-bar.am')
>>> hx_project.add(some_obj)

Examples

Loads chocolate-bar.am and adds it to the project view:

>>> some_obj = hx_project.load(hx_paths.tutorials_dir + '/chocolate-bar.am')
remove(obj)

Removes obj from the project view.

Parameters:

obj : HxObject

Object that must be removed from the project view.

Raises:

KeyError

This exception is raised if obj was not in the project view.

Examples

We create an orthoslice with the object factory, add it to the project view, then remove it from the project view:

>>> ortho = hx_object_factory.create('HxOrthoSlice')
>>> hx_project.add(ortho)
>>> hx_project.remove(ortho)
remove_all()

Removes all objects from the project view. (Only object that are removable will be removed.)

Examples

>>> hx_project.remove_all()

Path management

class hx.core.HxPaths

Bases: object

This class allows the user to retrieve information relative to the Product paths.

There is one instance of this class called hx_paths.

Attributes

executable_dir Read-only property bounded to the executable directory.
install_data_dir Read-only property bounded to the data directory of the Product.
install_dir Read-only property bounded to the installation directory of the Product.
python_modules_dir Read-only property bounded to the python modules directory of the Product.
python_script_objects_dir Read-only property bounded to the python script objects directory of the Product.
python_share_dir Read-only property bounded to the share directory of the Product.
tutorials_dir Read-only property bounded to the tutorials directory of the Product.
executable_dir

Read-only property bounded to the executable directory.

install_data_dir

Read-only property bounded to the data directory of the Product.

install_dir

Read-only property bounded to the installation directory of the Product.

python_modules_dir

Read-only property bounded to the python modules directory of the Product.

python_script_objects_dir

Read-only property bounded to the python script objects directory of the Product.

python_share_dir

Read-only property bounded to the share directory of the Product.

tutorials_dir

Read-only property bounded to the tutorials directory of the Product.

Messaging utilities

class hx.core.HxMessage

Bases: object

This interface is used to pop up modal dialogs. (e.g. error, warning, info, file overwrite, question).

Those simple dialogs (message boxes) have implemented “Do not show this message again” feature. With this feature users have ability to disable showing some messages. Also, users have ability to restore disabled message boxes trough Preference panel. When this feature is used in message boxes, unique key for message boxes is created and that key is saved into the settings, along side with button index which user has clicked. This feature is disabled by default for all message boxes, and if we want to enable this feature we have to pass additional parameter.

There is one instance of this class called hx_message.

Methods

confirmations(message, button0_text, ...[, ...]) Confirmation dialog, usage same as question().
error(message[, button0_text, button1_text, ...]) Pops up a modal dialog displaying a user-defined error message.
info(message[, do_not_show_again_btn]) In contrast to the error, warning, and question dialogs the info dialog always has exactly one button labeled Close.
overwrite(filename) A modal dialog will be popped up saying that the specified file already exists.
question(message, button0_text, button1_text) Question dialog, usage same as error().
warning(message[, button0_text, ...]) Warning dialog, usage same as error().
confirmations(message, button0_text, button1_text, do_not_show_again_btn=False)

Confirmation dialog, usage same as question().

Parameters:

message : basestring

The message to display in the message-box.

button0_text : basestring

The button0 label.

button1_text : basestring

The button1 label.

do_not_show_again_btn : bool, optional

If set to True this parameter adds a check-box “do not show this again” that prevent displaying this message again if checked by the user.

Returns:

int:

The return value indicates which button has been pressed by the user.

Examples

Display a simple confirmation message-box:

>>> ret = hx_message.confirmations("Computation may be very long. Do you want to continue ?", "Yes", "No")
>>> if ret == 0:
>>>     compute()
error(message, button0_text="", button1_text="", button2_text="", default_button_index=-1, escape_button_index=-1)

Pops up a modal dialog displaying a user-defined error message. Up to three different buttons can be displayed. If button0_text is null, Close will be displayed. Pressing Return or Enter is the same as clicking the default button. Pressing Escape is the same as clicking the escape button. On default, both button numbers are set to -1, indicating that pressing the corresponding key has no effect.

Parameters:

message : basestring

The message to display in the message-box.

button0_text : basestring, optional

The button0 label.

button1_text : basestring, optional

The button1 label.

button2_text : basestring, optional

The button2 label.

default_button_index : int, optional

The index of the default button (0-2).

escape_button_index : int, optional

The index of the escape button.

Returns:

int:

The return value indicates which button has been pressed by the user.

Examples

Display a simple message-box error:

>>> hx_message.error("Could not locate specified file.")
info(message, do_not_show_again_btn=False)

In contrast to the error, warning, and question dialogs the info dialog always has exactly one button labeled Close. No additional strings have to be defined.

Parameters:

message : basestring

The message to display in the message-box.

do_not_show_again_btn : bool, optional

If set to True this parameter adds a check-box “do not show this again” that prevent displaying this message again if checked by the user.

Returns:

int:

Returns 0.

Examples

Display a simple information message-box:

>>> hx_message.info("Computation was a success !")
overwrite(filename)

A modal dialog will be popped up saying that the specified file already exists. The user may choose Overwrite or Cancel. If overwrite is chosen the method returns True. Otherwise, it returns False. It is not checked whether the specified file really already exists.

Parameters:

filename : basestring

The filename that already exists.

Returns:

bool:

Returns True if user choose to overwrite existing file. Returns False otherwise.

question(message, button0_text, button1_text, button2_text="", default_button_index=-1, escape_button_index=-1, do_not_show_again_btn=False)

Question dialog, usage same as error().

Parameters:

message : basestring

The message to display in the message-box.

button0_text : basestring

The button0 label.

button1_text : basestring

The button1 label.

button2_text : basestring, optional

The button2 label.

default_button_index : int, optional

The index of the default button (0-2).

escape_button_index : int, optional

The index of the escape button.

do_not_show_again_btn : bool, optional

If set to True this parameter adds a check-box “do not show this again” that prevent displaying this message again if checked by the user.

Returns:

int:

The return value indicates which button has been pressed by the user.

Examples

Display a simple message-box question:

>>> ret = hx_message.question("Specified file seems corrupted. Do you want to load the data anyway ?", "Yes", "No")
>>> if ret == 0:
>>>     print "Abort image loading..."
warning(message, button0_text="", button1_text="", button2_text="", default_button_index=-1, escape_button_index=-1, do_not_show_again_btn=False)

Warning dialog, usage same as error().

Parameters:

message : basestring

The message to display in the message-box.

button0_text : basestring, optional

The button0 label.

button1_text : basestring, optional

The button1 label.

button2_text : basestring, optional

The button2 label.

default_button_index : int, optional

The index of the default button (0-2).

escape_button_index : int, optional

The index of the escape button.

do_not_show_again_btn : bool, optional

If set to True this parameter adds a check-box “do not show this again” that prevent displaying this message again if checked by the user.

Returns:

int:

The return value indicates which button has been pressed by the user.

Examples

Display a simple message-box warning:

>>> hx_message.warning("Imported file does not have the expected size.")

Hierarchy of objects

class hx.core.McInterface

Bases: object

Base class of all Interfaces, including the HxBase hierarchy. This class is an Abstract Base Class.

Attributes

all_interfaces Attribute that contains all admissible interfaces as sub-members.

Methods

get_all_interface_names() Returns the list of all supported interfaces names.
all_interfaces

Attribute that contains all admissible interfaces as sub-members.

Examples

Retrieve an HxBase interface on an orthoslice:

>>> ortho = hx_project.create('HxOrthoSlice')
>>> base = ortho.all_interfaces.HxBase
get_all_interface_names()

Returns the list of all supported interfaces names.

Returns:

list of strings

Returns the list of all interfaces names that are supported by this object.

Examples

Print all interfaces supported by an orthoslice:

>>> ortho = hx_project.create('HxOrthoSlice')
>>> print ortho.get_all_interface_names()
['HxPlanarModBase', 'HxModule', 'HxObject', 'HxBase']
class hx.core.HxBase

Bases: _hx_core.__init__.McInterface

Base class of all data objects, modules, and editors.

Attributes

all_interfaces Attribute that contains all admissible interfaces as sub-members.
is_geometry_clipped Read-only boolean property bound to the fact the geometry is clipped.
name String property bound to the name of this object displayed in the application Gui.
portnames Read-only list of all ports names owned by this object.
ports This members contains all ports of an object.
viewer_mask Integer property bound to the mask applied to the object that trigger its visibility in all viewers.

Methods

clip_geometry(self, planar_mod, inverted) Clips the geometry of this object regarding the plane defined by planar_mod
get_all_interface_names() Returns the list of all supported interfaces names.
is_same_object(other_obj) Returns True if other_obj represents the same object as the self object , False otherwise
unclip_geometry(planar_mod) Unclips the geometry of this object regarding the plane defined by planar_mod
clip_geometry(self, planar_mod, inverted)

Clips the geometry of this object regarding the plane defined by planar_mod

Parameters:

planar_mod : HxPlanarModBase

Module that will define the plane used to clip the geometry.

inverted : bool

If inverted is set, the clipped region will be then region below the planar_mod, otherwise the clipped region is the region above planar_mod (Default value is False)

Examples

Lets suppose that volren is a Volume Rendering Settings and ortho is an HxOrthoSlice:

>>> volren.clip_geometry(ortho, True)
is_geometry_clipped

Read-only boolean property bound to the fact the geometry is clipped.

Examples

Lets suppose that volren is a Volume Rendering Settings and ortho is an HxOrthoSlice:

>>> volren.clip_geometry(ortho, True)
>>> print volren.is_geometry_clipped
True
is_same_object(other_obj)

Returns True if other_obj represents the same object as the self object , False otherwise

Parameters:

other_obj : HxBase

Object that must be tested if it represent the same object in the application.

Returns:

bool

Returns True if other_obj represents the same object as the self object , False otherwise

Examples

>>> ortho = hx_object_factory.create('HxOrthoSlice')
>>> ortho2 = ortho
>>> print ortho.is_same_object(ortho2)
True
>>> ortho.name = "SomeLabel"
>>> hx_project.add(ortho)
>>> ortho3 = hx_project.get("SomeLabel")
>>> print ortho.is_same_object(ortho3)
True
>>> ortho4 = hx_object_factory.create('HxOrthoSlice')
>>> ortho.is_same_object(ortho4)
False
name

String property bound to the name of this object displayed in the application Gui.

Examples

Sets a new name to some_obj.

>>> some_obj.name = 'MyNewName'

Retrieves the name of some_obj.

>>> name = some_obj.name
portnames

Read-only list of all ports names owned by this object.

Examples

Prints the name of all port of an Ortho Slice:

>>> ortho = hx_object_factory.create('HxOrthoSlice')
>>> print ortho.portnames
['data', 'origin', 'normal', 'frameSettings', 'planeDefinition', 'planeNormal', 'planePoint1', 'planePoint2',
'planePoint3', 'planeVector1', 'planeVector2', 'planeDistance', 'sliceOrientation', 'options', 'embossingOnOff',
'depth', 'specularShininess', 'specularIntensity', 'mappingType', 'contrastLimit', 'colormap', 'sliceNumber',
'transparency', 'alpha', 'channels']
ports

This members contains all ports of an object. Ports are accessible by their name.

Examples

Lets suppose some_obj have a port named myPort it can be accessed:

>>> port = some_obj.ports.myPort

Changes the slice number of an Ortho Slice:

>>> ortho = hx_object_factory.create('HxOrthoSlice')
>>> ortho.ports.sliceNumber.value = 123
unclip_geometry(planar_mod)

Unclips the geometry of this object regarding the plane defined by planar_mod

Parameters:

planar_mod : HxPlanarModBase

Module which defines the plane used to unclip the geometry.

Examples

Lets suppose that volren is a Volume Rendering Settings and ortho is an HxOrthoSlice:

>>> volren.unclip_geometry(ortho)
viewer_mask

Integer property bound to the mask applied to the object that trigger its visibility in all viewers.

Examples

The following example creates an Ortho Slice which is hidden in all viewers.

>>> ortho = hx_object_factory.create('HxOrthoSlice')
>>> ortho.viewer_mask = 0

The viewer_mask could be accessed the same way:

>>> print ortho.viewer_mask
0
class hx.core.HxObject

Bases: _hx_core.__init__.HxBase

This is the first class of HxBase hierarchy which represents items that can be added to the project view.

Attributes

all_interfaces Attribute that contains all admissible interfaces as sub-members.
can_be_renamed Boolean property bound to the fact the object could be renamed by user in the GUI.
downstream_connections Read-only property bound to the sequence of all port HxConnection targeting this object.
icon_color Read-only property bound to the color of the icon of the object in the project view.
icon_position Pair of int property bound to the position of the icon of the object in the project view
icon_visible Boolean property bound to the fact the icon of the object is visible in the project view.
is_geometry_clipped Read-only boolean property bound to the fact the geometry is clipped.
name String property bound to the name of this object displayed in the application Gui.
need_saving Boolean property bound to the fact the object needs to be saved on project saving.
portnames Read-only list of all ports names owned by this object.
ports This members contains all ports of an object.
removable Boolean property bound to the fact the object could be removed from project by user in the GUI.
selected Boolean property bound to the fact the object is selected in the project view.
viewer_mask Integer property bound to the mask applied to the object that trigger its visibility in all viewers.

Methods

clip_geometry(self, planar_mod, inverted) Clips the geometry of this object regarding the plane defined by planar_mod
compute() This method performs computation.
create_doc_file() Method that creates the .tex help file associated to the object.
create_port_snaps() Method that takes snapshot of all ports of the object.
duplicate() Method that performs a copy of this object and returns the newly created object.
execute() This method will simulate a click on the green apply button under the property area of this object, and performs a `fire`() on this object.
fire() This method will trigger a call to update() on the object and eventually a compute() if this is a computational module and if its port doIt has been touched or if auto-refresh is activated.
get_all_interface_names() Returns the list of all supported interfaces names.
is_same_object(other_obj) Returns True if other_obj represents the same object as the self object , False otherwise
unclip_geometry(planar_mod) Unclips the geometry of this object regarding the plane defined by planar_mod
update() This method will update the Gui of the object in the properties panel.
can_be_renamed

Boolean property bound to the fact the object could be renamed by user in the GUI.

Examples

Creates an ortho slice, set its can_be_renamed property to False:

>>> ortho = hx_object_factory.create('HxOrthoSlice')
>>> ortho.can_be_renamed = False
>>> print ortho.can_be_renamed
False
compute()

This method performs computation.

Examples

We load chocolate-bar.am and connect an HxGradient module to it:

>>> dataLoaded = hx_project.load(hx_paths.tutorials_dir + '/chocolate-bar.am')
>>> gradient = hx_project.create('HxGradient')
>>> gradient.ports.data.connect(dataLoaded)

We could assert there is no result attached to the gradient module:

>>> print gradient.results[0]
None

Now we invoke computation by triggering the port doIt:

>>> gradient.ports.doIt.was_hit = True
>>> gradient.compute()

Finally we display the name of the result of gradient:

>>> print gradient.results[0].name
dataLoaded.Gradient
create_doc_file()

Method that creates the .tex help file associated to the object.

Examples

>>> ortho = hx_object_factory.create('HxOrthoSlice')
>>> ortho.create_doc_file()
create_port_snaps()

Method that takes snapshot of all ports of the object.

Examples

>>> ortho = hx_object_factory.create('HxOrthoSlice')
>>> ortho.create_port_snaps()
downstream_connections

Read-only property bound to the sequence of all port HxConnection targeting this object.

Examples

Loads a lattice, and selects it. The permanent colormap will automatically connect to it:

>>> dataLoaded = hx_project.load(hx_paths.tutorials_dir + '/chocolate-bar.am')
>>> dataLoaded.selected = True
>>> print len(dataLoaded.downstream_connections)
1
>>> print dataLoaded.downstream_connections[0].get_owner().name
PermanentColormapEditor

Now attaches to dataLoaded an orthoslice:

>>> ortho = hx_project.create('HxOrthoSlice')
>>> ortho.ports.data.connect(dataLoaded)
>>> print len(dataLoaded.downstream_connections)
2
>>> for connection in dataLoaded.downstream_connections:
>>>     print connection.get_owner().name
PermanentColormapEditor
Ortho Slice
duplicate()

Method that performs a copy of this object and returns the newly created object.

Returns:

HxObject

Returns an instance of the most derivated class that could handle the newly duplicated object.

Examples

Loads chocolate-bar.am and duplicates it:

>>> dataLoaded = hx_object_factory.load(hx_paths.tutorials_dir + '/chocolate-bar.am')
>>> dataLoaded2 = dataLoaded.duplicate()
>>> print dataLoaded.is_same_object(dataLoaded2)
False
execute()

This method will simulate a click on the green apply button under the property area of this object, and performs a `fire`() on this object. For a compute module, it could be considered a “do your job” method. (For XPand developer, this method has no C++ unitary counterpart).

Examples

Loads chocolate-bar-labels.am, creates an HxGMC and connects its port data to the label-field:

>>> gmc = hx_project.create('HxGMC')
>>> label = hx_project.load(hx_paths.tutorials_dir + '/chocolate-bar-labels.am')
>>> gmc.ports.data.connect(label)

Does generate the surface by using the execute() method of gmc:

>>> gmc.execute()
fire()

This method will trigger a call to update() on the object and eventually a compute() if this is a computational module and if its port doIt has been touched or if auto-refresh is activated.

Examples

The first example illustrates the use of fire() on a display module. We load chocolate-bar.am and attach to it an HxOrthoSlice. Then inovking fire() on the Ortho Slice will update the module Gui and update the display of the viewer by implicitly invoking the update() method on the object.

>>> dataLoaded = hx_project.load(hx_paths.tutorials_dir + '/chocolate-bar.am')
>>> ortho = hx_project.create('HxOrthoSlice')
>>> ortho.ports.data.connect(dataLoaded)
>>> ortho.fire()

The second example illustrates the use of fire() on a module that permits to refresh the properties panel Gui by implicitly invoking the update() method on the object. We firstly load chocolate-bar.am, attach an HxOrthoSlice module to it, select the Ortho Slice and change its mappingType port to Histogram instead of Colormap:

>>> dataLoaded = hx_project.load(hx_paths.tutorials_dir + '/chocolate-bar.am')
>>> ortho = hx_project.create('HxOrthoSlice')
>>> ortho.ports.data.connect(dataLoaded)
>>> ortho.selected = True
>>> ortho.ports.mappingType.menus[0].selected = 1

You could see that the Gui of the properties panel of the Ortho Slice has not been updated as the port colormap is still present although it should not as the color mapping is done regarding the histogram and not a colormap. Now if we invoke a fire() on the Ortho Slice:

>>> ortho.fire()

The Gui of the properties panel has been updated: the port colormap has disappeared and has been replaced by the port contrastLimit.

The third example shows the implicit invokation of the compute() method of a computational module when calling fire() if the port doIt of the module has been triggered. We load chocolate-bar.am and connect an HxGradient module to it:

>>> dataLoaded = hx_project.load(hx_paths.tutorials_dir + '/chocolate-bar.am')
>>> gradient = hx_project.create('HxGradient')
>>> gradient.ports.data.connect(dataLoaded)

We could assert that there is no result attached to the gradient module:

>>> print gradient.results[0]
None

Then we invoke computation by triggering the port doIt and calling method fire():

>>> gradient.ports.doIt.was_hit = True
>>> gradient.fire()

And finally we could display the name of the result of gradient:

>>> print gradient.results[0].name
dataLoaded.Gradient
icon_color

Read-only property bound to the color of the icon of the object in the project view.

Examples

Shows the color of the icon of an ortho slice (using chocolate-bar.am):

>>> ortho = hx_object_factory.create('HxOrthoSlice')
>>> print ortho.icon_color
(0.9803921580314636, 0.6823529601097107, 0.4470588266849518)
icon_position

Pair of int property bound to the position of the icon of the object in the project view

The first element of the pair represents the abscissa of the upper-left corner of the icon. The second element of the pair represents the ordinate of the upper-left corner of the icon. The project view’s origin is its upper-left corner, abscissa are growing right and ordinates are growing down.

Examples

Creates an orthoslice in the project view, and set its icon position to (200, 200):

>>> ortho = hx_project.create('HxOrthoSlice')
>>> ortho.icon_position = (200, 200)
>>> print ortho.icon_position
(200, 200)
icon_visible

Boolean property bound to the fact the icon of the object is visible in the project view.

Examples

Creates an ortho slice, set its icon_visible property to False:

>>> ortho = hx_object_factory.create('HxOrthoSlice')
>>> ortho.icon_visible = False
>>> print ortho.icon_visible
False
need_saving

Boolean property bound to the fact the object needs to be saved on project saving.

Examples

Creates an ortho slice, set its need_saving property to False:

>>> ortho = hx_object_factory.create('HxOrthoSlice')
>>> ortho.need_saving = False
>>> print ortho.need_saving
False
removable

Boolean property bound to the fact the object could be removed from project by user in the GUI.

Examples

Creates an ortho slice, set its removable property to False:

>>> ortho = hx_object_factory.create('HxOrthoSlice')
>>> ortho.removable = False
>>> print ortho.removable
False
selected

Boolean property bound to the fact the object is selected in the project view.

Examples

Creates an orthoslice in the project view, and select it:

>>> ortho = hx_project.create('HxOrthoSlice')
>>> ortho.selected = True
>>> print ortho.selected
True
update()

This method will update the Gui of the object in the properties panel.

Examples

Firstly, we create an ortho slice, load chocolate-bar.am and connect each other:

>>> ortho = hx_project.create('HxOrthoSlice')
>>> dataLoaded = hx_project.load(hx_paths.tutorials_dir + '/chocolate-bar.am')
>>> ortho.selected = True
>>> ortho.ports.data.connect(dataLoaded)

Notices that the Slice Number port is set to zero. Now we performs an update():

>>> ortho.update()

Now port Slice Number is set to 64 as GUI has been refreshed in the properties panel.

class hx.core.HxModule

Bases: _hx_core.__init__.HxObject

Attributes

all_interfaces Attribute that contains all admissible interfaces as sub-members.
can_be_renamed Boolean property bound to the fact the object could be renamed by user in the GUI.
downstream_connections Read-only property bound to the sequence of all port HxConnection targeting this object.
icon_color Read-only property bound to the color of the icon of the object in the project view.
icon_position Pair of int property bound to the position of the icon of the object in the project view
icon_visible Boolean property bound to the fact the icon of the object is visible in the project view.
is_geometry_clipped Read-only boolean property bound to the fact the geometry is clipped.
name String property bound to the name of this object displayed in the application Gui.
need_saving Boolean property bound to the fact the object needs to be saved on project saving.
portnames Read-only list of all ports names owned by this object.
ports This members contains all ports of an object.
removable Boolean property bound to the fact the object could be removed from project by user in the GUI.
selected Boolean property bound to the fact the object is selected in the project view.
viewer_mask Integer property bound to the mask applied to the object that trigger its visibility in all viewers.

Methods

clip_geometry(self, planar_mod, inverted) Clips the geometry of this object regarding the plane defined by planar_mod
compute() This method performs computation.
create_doc_file() Method that creates the .tex help file associated to the object.
create_port_snaps() Method that takes snapshot of all ports of the object.
duplicate() Method that performs a copy of this object and returns the newly created object.
execute() This method will simulate a click on the green apply button under the property area of this object, and performs a `fire`() on this object.
fire() This method will trigger a call to update() on the object and eventually a compute() if this is a computational module and if its port doIt has been touched or if auto-refresh is activated.
get_all_interface_names() Returns the list of all supported interfaces names.
is_same_object(other_obj) Returns True if other_obj represents the same object as the self object , False otherwise
unclip_geometry(planar_mod) Unclips the geometry of this object regarding the plane defined by planar_mod
update() This method will update the Gui of the object in the properties panel.
class hx.core.HxBatchModule

Bases: _hx_core.__init__.HxModule

Attributes

all_interfaces Attribute that contains all admissible interfaces as sub-members.
can_be_renamed Boolean property bound to the fact the object could be renamed by user in the GUI.
downstream_connections Read-only property bound to the sequence of all port HxConnection targeting this object.
icon_color Read-only property bound to the color of the icon of the object in the project view.
icon_position Pair of int property bound to the position of the icon of the object in the project view
icon_visible Boolean property bound to the fact the icon of the object is visible in the project view.
is_geometry_clipped Read-only boolean property bound to the fact the geometry is clipped.
name String property bound to the name of this object displayed in the application Gui.
need_saving Boolean property bound to the fact the object needs to be saved on project saving.
portnames Read-only list of all ports names owned by this object.
ports This members contains all ports of an object.
removable Boolean property bound to the fact the object could be removed from project by user in the GUI.
selected Boolean property bound to the fact the object is selected in the project view.
viewer_mask Integer property bound to the mask applied to the object that trigger its visibility in all viewers.

Methods

clip_geometry(self, planar_mod, inverted) Clips the geometry of this object regarding the plane defined by planar_mod
compute() This method performs computation.
create_doc_file() Method that creates the .tex help file associated to the object.
create_port_snaps() Method that takes snapshot of all ports of the object.
duplicate() Method that performs a copy of this object and returns the newly created object.
execute() This method will simulate a click on the green apply button under the property area of this object, and performs a `fire`() on this object.
fire() This method will trigger a call to update() on the object and eventually a compute() if this is a computational module and if its port doIt has been touched or if auto-refresh is activated.
get_all_interface_names() Returns the list of all supported interfaces names.
is_same_object(other_obj) Returns True if other_obj represents the same object as the self object , False otherwise
unclip_geometry(planar_mod) Unclips the geometry of this object regarding the plane defined by planar_mod
update() This method will update the Gui of the object in the properties panel.
class hx.core.HxCompModule

Bases: _hx_core.__init__.HxBatchModule

Base class for compute modules. Compute modules take one or multiple input objects and compute one or multiple output objects of type HxData.

Attributes

all_interfaces Attribute that contains all admissible interfaces as sub-members.
apply_transform_to_result Boolean property bound to the fact the module copy the transform (the object to world matrix) of its source (input) to all its results.
can_be_renamed Boolean property bound to the fact the object could be renamed by user in the GUI.
downstream_connections Read-only property bound to the sequence of all port HxConnection targeting this object.
icon_color Read-only property bound to the color of the icon of the object in the project view.
icon_position Pair of int property bound to the position of the icon of the object in the project view
icon_visible Boolean property bound to the fact the icon of the object is visible in the project view.
is_geometry_clipped Read-only boolean property bound to the fact the geometry is clipped.
name String property bound to the name of this object displayed in the application Gui.
need_saving Boolean property bound to the fact the object needs to be saved on project saving.
portnames Read-only list of all ports names owned by this object.
ports This members contains all ports of an object.
removable Boolean property bound to the fact the object could be removed from project by user in the GUI.
results Mutable sequence of HxData property that represents all the results of a compute module.
selected Boolean property bound to the fact the object is selected in the project view.
viewer_mask Integer property bound to the mask applied to the object that trigger its visibility in all viewers.

Methods

clip_geometry(self, planar_mod, inverted) Clips the geometry of this object regarding the plane defined by planar_mod
compute() This method performs computation.
create_doc_file() Method that creates the .tex help file associated to the object.
create_port_snaps() Method that takes snapshot of all ports of the object.
duplicate() Method that performs a copy of this object and returns the newly created object.
execute() This method will simulate a click on the green apply button under the property area of this object, and performs a `fire`() on this object.
fire() This method will trigger a call to update() on the object and eventually a compute() if this is a computational module and if its port doIt has been touched or if auto-refresh is activated.
get_all_interface_names() Returns the list of all supported interfaces names.
is_same_object(other_obj) Returns True if other_obj represents the same object as the self object , False otherwise
unclip_geometry(planar_mod) Unclips the geometry of this object regarding the plane defined by planar_mod
update() This method will update the Gui of the object in the properties panel.
apply_transform_to_result

Boolean property bound to the fact the module copy the transform (the object to world matrix) of its source (input) to all its results.

results

Mutable sequence of HxData property that represents all the results of a compute module.

Notes

Some of the results may be set None and are not instance of HxData hierarchy: a check must be performed.

Examples

Select all results of a compute module comp_module:

>>> for result in comp_module.results:
>>>     if result is not None:
>>>         result.selected = True
class hx.core.HxPlanarModBase

Bases: _hx_core.__init__.HxModule

Attributes

all_interfaces Attribute that contains all admissible interfaces as sub-members.
can_be_renamed Boolean property bound to the fact the object could be renamed by user in the GUI.
downstream_connections Read-only property bound to the sequence of all port HxConnection targeting this object.
icon_color Read-only property bound to the color of the icon of the object in the project view.
icon_position Pair of int property bound to the position of the icon of the object in the project view
icon_visible Boolean property bound to the fact the icon of the object is visible in the project view.
is_geometry_clipped Read-only boolean property bound to the fact the geometry is clipped.
name String property bound to the name of this object displayed in the application Gui.
need_saving Boolean property bound to the fact the object needs to be saved on project saving.
portnames Read-only list of all ports names owned by this object.
ports This members contains all ports of an object.
removable Boolean property bound to the fact the object could be removed from project by user in the GUI.
selected Boolean property bound to the fact the object is selected in the project view.
viewer_mask Integer property bound to the mask applied to the object that trigger its visibility in all viewers.

Methods

clip_geometry(self, planar_mod, inverted) Clips the geometry of this object regarding the plane defined by planar_mod
compute() This method performs computation.
create_doc_file() Method that creates the .tex help file associated to the object.
create_port_snaps() Method that takes snapshot of all ports of the object.
duplicate() Method that performs a copy of this object and returns the newly created object.
execute() This method will simulate a click on the green apply button under the property area of this object, and performs a `fire`() on this object.
fire() This method will trigger a call to update() on the object and eventually a compute() if this is a computational module and if its port doIt has been touched or if auto-refresh is activated.
get_all_interface_names() Returns the list of all supported interfaces names.
is_same_object(other_obj) Returns True if other_obj represents the same object as the self object , False otherwise
unclip_geometry(planar_mod) Unclips the geometry of this object regarding the plane defined by planar_mod
update() This method will update the Gui of the object in the properties panel.

Hierarchy of data classes

class hx.core.HxData

Bases: _hx_core.__init__.HxObject

Base class for all application data objects. This class add the following features to ordinary objects of type HxObject.

Possibility to mark data objects as new by calling touch. A special bit mask can be used to indicate that only certain parts like transformation or parameters have changed. Downstream modules will only be fired if a data object has changed, i.e., if it is marked as touched (see is_touched)). In addition, a module may save redundant computations by querying which of the touch flags are set.

Attributes

all_interfaces Attribute that contains all admissible interfaces as sub-members.
can_be_renamed Boolean property bound to the fact the object could be renamed by user in the GUI.
downstream_connections Read-only property bound to the sequence of all port HxConnection targeting this object.
icon_color Read-only property bound to the color of the icon of the object in the project view.
icon_position Pair of int property bound to the position of the icon of the object in the project view
icon_visible Boolean property bound to the fact the icon of the object is visible in the project view.
is_geometry_clipped Read-only boolean property bound to the fact the geometry is clipped.
is_touched Read-only immutable dictionary property bound to the fact each new flag is set or not.
name String property bound to the name of this object displayed in the application Gui.
need_saving Boolean property bound to the fact the object needs to be saved on project saving.
portnames Read-only list of all ports names owned by this object.
ports This members contains all ports of an object.
removable Boolean property bound to the fact the object could be removed from project by user in the GUI.
selected Boolean property bound to the fact the object is selected in the project view.
viewer_mask Integer property bound to the mask applied to the object that trigger its visibility in all viewers.

Methods

clip_geometry(self, planar_mod, inverted) Clips the geometry of this object regarding the plane defined by planar_mod
compute() This method performs computation.
create_doc_file() Method that creates the .tex help file associated to the object.
create_port_snaps() Method that takes snapshot of all ports of the object.
duplicate() Method that performs a copy of this object and returns the newly created object.
execute() This method will simulate a click on the green apply button under the property area of this object, and performs a `fire`() on this object.
fire() This method will trigger a call to update() on the object and eventually a compute() if this is a computational module and if its port doIt has been touched or if auto-refresh is activated.
get_all_interface_names() Returns the list of all supported interfaces names.
is_same_object(other_obj) Returns True if other_obj represents the same object as the self object , False otherwise
touch(flag) Function that mark certains part of the data as new.
unclip_geometry(planar_mod) Unclips the geometry of this object regarding the plane defined by planar_mod
update() This method will update the Gui of the object in the properties panel.
is_touched

Read-only immutable dictionary property bound to the fact each new flag is set or not.

Access to items is done by using the following keys:

  • NEW_TRANSFORMATION: The world to space transformation has changed.
  • NEW_COORDINATES: The coordinates of the bounding-box has changed.
  • NEW_DATA: The data has changed.
  • NEW_LABEL: The name of the object has changed.
  • NEW_RANGE: The data range has changed.
  • NEW_PARAMETERS: Some bundle parameters of the data have changed.
  • NEW_COLOR: The color or transparency values changed.
  • NEW_RANGE_STATE: Indicates that local range flag was toggled.
  • NEW_SELECTION: Selection status in the project view has changed.
  • NEW_VISIBILITY: Visibility status in the project view has changed.

Examples

Load chocolate-bar.am:

>>> dataLoaded = hx_project.load(hx_paths.tutorials_dir + '/chocolate-bar.am')

Print if dataLoaded has a new transformation:

>>> print dataLoaded.is_touched[HxData.NEW_TRANSFORMATION]
False

Set the transformation of dataLoaded as touched:

>>> dataLoaded.touch(HxData.NEW_TRANSFORMATION)

Print if dataLoaded has a new transformation:

>>> print dataLoaded.is_touched[HxData.NEW_TRANSFORMATION]
True
touch(flag)

Function that mark certains part of the data as new.

Parameters:

flag: int

This flag must be one of the following:

* `NEW_TRANSFORMATION`: The world to space transformation has changed.

* `NEW_COORDINATES`: The coordinates of the bounding-box has changed.

* `NEW_DATA`: The data has changed.

* `NEW_LABEL`: The name of the object has changed.

* `NEW_RANGE`: The data range has changed.

* `NEW_PARAMETERS`: Some bundle parameters of the data have changed.

* `NEW_COLOR`: The color or transparency values changed.

* `NEW_RANGE_STATE`: Indicates that local range flag was toggled.

* `NEW_SELECTION`: Selection status in the project view has changed.

* `NEW_VISIBILITY`: Visibility status in the project view has changed.

Examples

Load chocolate-bar.am:

>>> dataLoaded = hx_project.load(hx_paths.tutorials_dir + '/chocolate-bar.am')

Print if dataLoaded has a new transformation:

>>> print dataLoaded.is_touched[HxData.NEW_TRANSFORMATION]
False

Set the transformation of dataLoaded as touched:

>>> dataLoaded.touch(HxData.NEW_TRANSFORMATION)

Print if dataLoaded has a new transformation:

>>> print dataLoaded.is_touched[HxData.NEW_TRANSFORMATION]
True
class hx.core.HxSpatialData

Bases: _hx_core.__init__.HxData

Base class for all data objects that are defined in three dimensional space. Every such data object defines a 3D bounding box. It also may be transformed by a 4x4 homogeneous transformation matrix.

Attributes

all_interfaces Attribute that contains all admissible interfaces as sub-members.
bounding_box Read-only property that returns the bounding-box of the data.
can_be_renamed Boolean property bound to the fact the object could be renamed by user in the GUI.
downstream_connections Read-only property bound to the sequence of all port HxConnection targeting this object.
icon_color Read-only property bound to the color of the icon of the object in the project view.
icon_position Pair of int property bound to the position of the icon of the object in the project view
icon_visible Boolean property bound to the fact the icon of the object is visible in the project view.
is_geometry_clipped Read-only boolean property bound to the fact the geometry is clipped.
is_touched Read-only immutable dictionary property bound to the fact each new flag is set or not.
name String property bound to the name of this object displayed in the application Gui.
need_saving Boolean property bound to the fact the object needs to be saved on project saving.
portnames Read-only list of all ports names owned by this object.
ports This members contains all ports of an object.
removable Boolean property bound to the fact the object could be removed from project by user in the GUI.
selected Boolean property bound to the fact the object is selected in the project view.
transform Property bound to the transform applied to the data represented as a 4x4 homogeneous matrix
viewer_mask Integer property bound to the mask applied to the object that trigger its visibility in all viewers.

Methods

clip_geometry(self, planar_mod, inverted) Clips the geometry of this object regarding the plane defined by planar_mod
compute() This method performs computation.
create_doc_file() Method that creates the .tex help file associated to the object.
create_port_snaps() Method that takes snapshot of all ports of the object.
duplicate() Method that performs a copy of this object and returns the newly created object.
execute() This method will simulate a click on the green apply button under the property area of this object, and performs a `fire`() on this object.
fire() This method will trigger a call to update() on the object and eventually a compute() if this is a computational module and if its port doIt has been touched or if auto-refresh is activated.
get_all_interface_names() Returns the list of all supported interfaces names.
is_same_object(other_obj) Returns True if other_obj represents the same object as the self object , False otherwise
touch(flag) Function that mark certains part of the data as new.
unclip_geometry(planar_mod) Unclips the geometry of this object regarding the plane defined by planar_mod
update() This method will update the Gui of the object in the properties panel.
bounding_box

Read-only property that returns the bounding-box of the data.

Returns:The bounding-box is returned as a pair of 3D coordinates.

Examples

Load chocolate-bar.am and print its bounding-box:

>>> dataLoaded = hx_project.load(hx_paths.tutorials_dir + '/chocolate-bar.am')
>>> print dataLoaded.bounding_box
((-0.000898451020475477, -0.0004531150043476373, -0.00028124501113779843), (0.5608980059623718, 0.7884529829025269, 0.4362809956073761))
transform

Property bound to the transform applied to the data represented as a 4x4 homogeneous matrix

Examples

Load chocolate-bar.am and print its transform matrix:

>>> dataLoaded = hx_project.load(hx_paths.tutorials_dir + '/chocolate-bar.am')
>>> print dataLoaded.transform
((1.0, 0.0, 0.0, 0.0), (0.0, 1.0, 0.0, 0.0), (0.0, 0.0, 1.0, 0.0), (0.0, 0.0, 0.0, 1.0))

Displace dataLoaded by 0.2 on the x coordinates:

>>> dataLoaded.transform = ((1.0, 0.0, 0.0, 0.0), (0.0, 1.0, 0.0, 0.0), (0.0, 0.0, 1.0, 0.0), (0.2, 0.0, 0.0, 1.0))
class hx.core.HxColormap

Bases: _hx_core.__init__.HxData

Attributes

all_interfaces Attribute that contains all admissible interfaces as sub-members.
can_be_renamed Boolean property bound to the fact the object could be renamed by user in the GUI.
downstream_connections Read-only property bound to the sequence of all port HxConnection targeting this object.
icon_color Read-only property bound to the color of the icon of the object in the project view.
icon_position Pair of int property bound to the position of the icon of the object in the project view
icon_visible Boolean property bound to the fact the icon of the object is visible in the project view.
is_geometry_clipped Read-only boolean property bound to the fact the geometry is clipped.
is_touched Read-only immutable dictionary property bound to the fact each new flag is set or not.
name String property bound to the name of this object displayed in the application Gui.
need_saving Boolean property bound to the fact the object needs to be saved on project saving.
portnames Read-only list of all ports names owned by this object.
ports This members contains all ports of an object.
removable Boolean property bound to the fact the object could be removed from project by user in the GUI.
selected Boolean property bound to the fact the object is selected in the project view.
viewer_mask Integer property bound to the mask applied to the object that trigger its visibility in all viewers.

Methods

clip_geometry(self, planar_mod, inverted) Clips the geometry of this object regarding the plane defined by planar_mod
compute() This method performs computation.
create_doc_file() Method that creates the .tex help file associated to the object.
create_port_snaps() Method that takes snapshot of all ports of the object.
duplicate() Method that performs a copy of this object and returns the newly created object.
execute() This method will simulate a click on the green apply button under the property area of this object, and performs a `fire`() on this object.
fire() This method will trigger a call to update() on the object and eventually a compute() if this is a computational module and if its port doIt has been touched or if auto-refresh is activated.
get_all_interface_names() Returns the list of all supported interfaces names.
is_same_object(other_obj) Returns True if other_obj represents the same object as the self object , False otherwise
touch(flag) Function that mark certains part of the data as new.
unclip_geometry(planar_mod) Unclips the geometry of this object regarding the plane defined by planar_mod
update() This method will update the Gui of the object in the properties panel.

Fields classes

class hx.core.HxField3

Bases: _hx_core.__init__.HxSpatialData

Generic field in 3D space. This class represent a generic field in @f$R^3@f$

Attributes

all_interfaces Attribute that contains all admissible interfaces as sub-members.
bounding_box Read-only property that returns the bounding-box of the data.
can_be_renamed Boolean property bound to the fact the object could be renamed by user in the GUI.
downstream_connections Read-only property bound to the sequence of all port HxConnection targeting this object.
icon_color Read-only property bound to the color of the icon of the object in the project view.
icon_position Pair of int property bound to the position of the icon of the object in the project view
icon_visible Boolean property bound to the fact the icon of the object is visible in the project view.
is_geometry_clipped Read-only boolean property bound to the fact the geometry is clipped.
is_touched Read-only immutable dictionary property bound to the fact each new flag is set or not.
name String property bound to the name of this object displayed in the application Gui.
need_saving Boolean property bound to the fact the object needs to be saved on project saving.
portnames Read-only list of all ports names owned by this object.
ports This members contains all ports of an object.
removable Boolean property bound to the fact the object could be removed from project by user in the GUI.
selected Boolean property bound to the fact the object is selected in the project view.
transform Property bound to the transform applied to the data represented as a 4x4 homogeneous matrix
viewer_mask Integer property bound to the mask applied to the object that trigger its visibility in all viewers.

Methods

clip_geometry(self, planar_mod, inverted) Clips the geometry of this object regarding the plane defined by planar_mod
compute() This method performs computation.
create_doc_file() Method that creates the .tex help file associated to the object.
create_port_snaps() Method that takes snapshot of all ports of the object.
duplicate() Method that performs a copy of this object and returns the newly created object.
execute() This method will simulate a click on the green apply button under the property area of this object, and performs a `fire`() on this object.
fire() This method will trigger a call to update() on the object and eventually a compute() if this is a computational module and if its port doIt has been touched or if auto-refresh is activated.
get_all_interface_names() Returns the list of all supported interfaces names.
is_same_object(other_obj) Returns True if other_obj represents the same object as the self object , False otherwise
touch(flag) Function that mark certains part of the data as new.
unclip_geometry(planar_mod) Unclips the geometry of this object regarding the plane defined by planar_mod
update() This method will update the Gui of the object in the properties panel.
class hx.core.HxScalarField3

Bases: _hx_core.__init__.HxField3

Class representing a generic scalar field in 3 dimensions. This is the base class for all scalar field.

Attributes

all_interfaces Attribute that contains all admissible interfaces as sub-members.
bounding_box Read-only property that returns the bounding-box of the data.
can_be_renamed Boolean property bound to the fact the object could be renamed by user in the GUI.
downstream_connections Read-only property bound to the sequence of all port HxConnection targeting this object.
icon_color Read-only property bound to the color of the icon of the object in the project view.
icon_position Pair of int property bound to the position of the icon of the object in the project view
icon_visible Boolean property bound to the fact the icon of the object is visible in the project view.
is_geometry_clipped Read-only boolean property bound to the fact the geometry is clipped.
is_touched Read-only immutable dictionary property bound to the fact each new flag is set or not.
name String property bound to the name of this object displayed in the application Gui.
need_saving Boolean property bound to the fact the object needs to be saved on project saving.
portnames Read-only list of all ports names owned by this object.
ports This members contains all ports of an object.
range Read-only pair of floats property bound to the range of the data contained in the field.
removable Boolean property bound to the fact the object could be removed from project by user in the GUI.
selected Boolean property bound to the fact the object is selected in the project view.
transform Property bound to the transform applied to the data represented as a 4x4 homogeneous matrix
viewer_mask Integer property bound to the mask applied to the object that trigger its visibility in all viewers.

Methods

clip_geometry(self, planar_mod, inverted) Clips the geometry of this object regarding the plane defined by planar_mod
compute() This method performs computation.
create_doc_file() Method that creates the .tex help file associated to the object.
create_port_snaps() Method that takes snapshot of all ports of the object.
duplicate() Method that performs a copy of this object and returns the newly created object.
execute() This method will simulate a click on the green apply button under the property area of this object, and performs a `fire`() on this object.
fire() This method will trigger a call to update() on the object and eventually a compute() if this is a computational module and if its port doIt has been touched or if auto-refresh is activated.
get_all_interface_names() Returns the list of all supported interfaces names.
is_same_object(other_obj) Returns True if other_obj represents the same object as the self object , False otherwise
touch(flag) Function that mark certains part of the data as new.
unclip_geometry(planar_mod) Unclips the geometry of this object regarding the plane defined by planar_mod
update() This method will update the Gui of the object in the properties panel.
range

Read-only pair of floats property bound to the range of the data contained in the field.

Examples

>>> dataLoaded = hx_project.load(hx_paths.tutorials_dir + '/chocolate-bar.am')
>>> print dataLoaded.range
(0.0, 255.0)
class hx.core.HxRegScalarField3

Bases: _hx_core.__init__.HxScalarField3

This class represents a scalar field based on a regular lattice.

Attributes

all_interfaces Attribute that contains all admissible interfaces as sub-members.
bounding_box Pair of 3D coordinates property bound to the bounding-box of the data.
can_be_renamed Boolean property bound to the fact the object could be renamed by user in the GUI.
downstream_connections Read-only property bound to the sequence of all port HxConnection targeting this object.
icon_color Read-only property bound to the color of the icon of the object in the project view.
icon_position Pair of int property bound to the position of the icon of the object in the project view
icon_visible Boolean property bound to the fact the icon of the object is visible in the project view.
is_geometry_clipped Read-only boolean property bound to the fact the geometry is clipped.
is_touched Read-only immutable dictionary property bound to the fact each new flag is set or not.
name String property bound to the name of this object displayed in the application Gui.
need_saving Boolean property bound to the fact the object needs to be saved on project saving.
portnames Read-only list of all ports names owned by this object.
ports This members contains all ports of an object.
range Read-only pair of floats property bound to the range of the data contained in the field.
removable Boolean property bound to the fact the object could be removed from project by user in the GUI.
selected Boolean property bound to the fact the object is selected in the project view.
transform Property bound to the transform applied to the data represented as a 4x4 homogeneous matrix
viewer_mask Integer property bound to the mask applied to the object that trigger its visibility in all viewers.

Methods

clip_geometry(self, planar_mod, inverted) Clips the geometry of this object regarding the plane defined by planar_mod
compute() This method performs computation.
create_doc_file() Method that creates the .tex help file associated to the object.
create_port_snaps() Method that takes snapshot of all ports of the object.
duplicate() Method that performs a copy of this object and returns the newly created object.
execute() This method will simulate a click on the green apply button under the property area of this object, and performs a `fire`() on this object.
fire() This method will trigger a call to update() on the object and eventually a compute() if this is a computational module and if its port doIt has been touched or if auto-refresh is activated.
get_all_interface_names() Returns the list of all supported interfaces names.
get_array Returns a NumPy array corresponding to the underlying lattice.
is_same_object(other_obj) Returns True if other_obj represents the same object as the self object , False otherwise
set_array(array) This function recopy the numpy array provided in the inner lattice of the object.
touch(flag) Function that mark certains part of the data as new.
unclip_geometry(planar_mod) Unclips the geometry of this object regarding the plane defined by planar_mod
update() This method will update the Gui of the object in the properties panel.
bounding_box

Pair of 3D coordinates property bound to the bounding-box of the data.

Returns:The bounding-box is returned as a pair of 3D coordinates. ((xmin, ymin, zmin), (xmax, ymax, zmax))

Examples

Load chocolate-bar.am and print set its bounding-box to ((0.0, 0.0, 0.0), (1.0, 1.0, 1.0)):

>>> dataLoaded = hx_project.load(hx_paths.tutorials_dir + '/chocolate-bar.am')
>>> dataLoaded.bounding_box = ((0.0, 0.0, 0.0), (1.0, 1.0, 1.0))

Print dataLoaded bounding-box:

>>> print dataLoaded.bounding_box
((0.0, 0.0, 0.0), (1.0, 1.0, 1.0))
get_array()

Returns a NumPy array corresponding to the underlying lattice. It allows the user to modify explicitly the lattice.

Returns:numpy.ndarray: NumPy array bound to the lattice contained in the HxRegScalarField.

Notes

The returned numpy array will prevent lattice deletion while it is not released.

Examples

Acquire a numpy array on chocolate-bar.am:

>>> dataLoaded = hx_project.load(hx_paths.tutorials_dir + '/chocolate-bar.am')
>>> array = dataLoaded.get_array()

Set all voxels of dataLoaded to value 0:

>>> for i in range(array.shape[0]):
>>>     for j in range(array.shape[1]):
>>>         for k in range(array.shape[2]):
>>>             array[i, j, k] = 0

Do the same in a far more efficient way using intrinsic numpy functions fill:

>>> array.fill(0)
set_array(array)

This function recopy the numpy array provided in the inner lattice of the object.

Parameters:

array: numpy.ndarray

Array to copy in the lattice of this object.

Notes

Calling this function does not involve this object getting ownership of the provided numpy array in argument. Any modification on the numpy array provided as argument after this function call will not modify this object.

Examples

Create an uniform scalar field:

>>> field = hx_project.create('HxUniformScalarField3')

Create a numpy array and affect it to the previously created field.

>>> import numpy as np
>>> array = np.ndarray(shape=(128, 128, 128), dtype=float)
>>> field.set_array(array)

Now print the dimensions of the new field:

>>> print field.get_array().shape
(128L, 128L, 128L)

Viewer management

class hx.core.HxViewerManager

Bases: object

This class is responsible for getting all viewers.

There is one instance of this class called hx_viewer_manager

Attributes

viewers Immutable sequence of all viewers.
viewers

Immutable sequence of all viewers. There are 16 viewers.

Examples

Retrieve the second viewer:

>>> hx_viewer_manager.viewers[1]
class hx.core.HxViewer

Bases: object

This class encapsulated a customized Open Inventor examiner viewer.

Attributes

auto_redraw Boolean property indicating if the viewer updates its content itself on scene-graph modification or not.
camera HxCamera instance used to configure the camera of the viewer.
camera_mode Integer property bound to the way the stereoscopy is handled.
interactive_draw_style Integer property bound to the current drawing style in the main view when the display is in interactive mode.
is_viewing Boolean property bound to the fact the viewer is turned on or off.
still_draw_style Integer property bound to the current drawing style in the main view when the display is still.
transparency_type Integer property bound to the way the transparency is handled in the viewer.
viewing_mode Integer property defining how the camera is spatially constrained: what are the different degrees of freedom of the camera.
viewport HxViewport member used to configure the viewport (render surface) of the viewer.

Methods

snapshot([filename]) Take a snapshot of the viewer.
auto_redraw

Boolean property indicating if the viewer updates its content itself on scene-graph modification or not.

Examples

Deactivate auto-redraw of the viewer 0:

>>> hx_viewer_manager.viewers[0].auto_redraw = False

Print if the viewers does have auto-redraw enabled:

>>> print hx_viewer_manager.viewers[0].auto_redraw
False
camera

HxCamera instance used to configure the camera of the viewer.

Examples

Set the camera of the viewer 0 to an orthographic camera:

>>> hx_viewer_manager.viewers[0].camera = HxOrthographicCamera()

Change the view direction of the camera:

>>> hx_viewer_manager.viewers[0].camera.view_direction = (1, 1, 0)

Print the view direction of the camera:

>>> print hx_viewer_manager.viewers[0].camera.view_direction
(1.0, 1.0, 0.0)
camera_mode

Integer property bound to the way the stereoscopy is handled.

This property take its value between the following:
  • MONOSCOPIC: Classic monoscopic camera.
  • LEFT_VIEW: Left view of a stereoscopic display.
  • RIGHT_VIEW: Right view of a stereoscopic display.
  • ACTIVE_STEREO: Stereoscopic display.

Examples

Set the camera_mode to ACTIVE_STEREO for viewer 0:

>>> hx_viewer_manager.viewers[0].camera_mode = HxViewer.ACTIVE_STEREO
interactive_draw_style

Integer property bound to the current drawing style in the main view when the display is in interactive mode. Default is VIEW_SAME_AS_STILL draw style.

Possible draw styles are:

  • VIEW_AS_IS: Leaves the objects unchanged.
  • VIEW_HIDDEN_LINE: Renders the object as wireframe, but only shows the object front faces. This is accomplished using a two-pass rendering. In the first pass, the objects are rendered as FILLED using the background BASE_COLOR (this sets up the wanted z-buffer values). The second pass then renders the objects as LINES, while adjusting the z-buffer range to limit overlapping polygons problems.
  • VIEW_NO_TEXTURE: Renders the objects without any textures. This is done by setting the override flag on an empty SoTexture2 node.
  • VIEW_LOW_COMPLEXITY: Renders the objects without any textures and with a low complexity. This is done by setting the override flag on an empty SoTexture2 node, and by setting a low complexity value on an SoComplexity node with override set to TRUE.
  • VIEW_LINE: Renders the objects as LINES (no texture) with lighting model set to BASE_COLOR.
  • VIEW_LOW_RES_LINE: Renders the objects as LINES (no texture) using a low complexity, with lighting model set to BASE_COLOR and no depth comparison.
  • VIEW_POINT: Renders the objects as POINTS (no texture) with lighting model set to BASE_COLOR.
  • VIEW_LOW_RES_POINT: Renders the objects as POINTS (no texture) using a low complexity, with lighting model set to BASE_COLOR and no depth comparison.
  • VIEW_BBOX: Renders the objects with complexity BOUNDING_BOX, lighting model set to BASE_COLOR and drawing style LINES (no texture) with no depth comparison.
  • VIEW_SAME_AS_STILL: This only applies to INTERACTIVE draw type. It enables the interactive draw style mode to match the regular draw style mode without having to set it explicitly.

Examples

Set the interactive_draw_style property of the viewer 0 to VIEW_HIDDEN_LINE:

>>> hx_viewer_manager.viewers[0].interactive_draw_style = HxViewer.VIEW_HIDDEN_LINE
is_viewing

Boolean property bound to the fact the viewer is turned on or off.

Examples

Turn off the viewer 0:

>>> hx_viewer_manager.viewers[0].is_viewing = False

Print if the viewer is activated:

>>> print hx_viewer_manager.viewers[0].is_viewing
False
snapshot(filename='')

Take a snapshot of the viewer.

Parameters:

filename: basestring

Specified filename where the snapshot will be saved. (Default is empty string which means that a new filename will be created automatically).

still_draw_style

Integer property bound to the current drawing style in the main view when the display is still. Default is VIEW_AS_IS draw style.

Possible draw styles are:

  • VIEW_AS_IS: Leaves the objects unchanged.
  • VIEW_HIDDEN_LINE: Renders the object as wireframe, but only shows the object front faces. This is accomplished using a two-pass rendering. In the first pass, the objects are rendered as FILLED using the background BASE_COLOR (this sets up the wanted z-buffer values). The second pass then renders the objects as LINES, while adjusting the z-buffer range to limit overlapping polygons problems.
  • VIEW_NO_TEXTURE: Renders the objects without any textures. This is done by setting the override flag on an empty SoTexture2 node.
  • VIEW_LOW_COMPLEXITY: Renders the objects without any textures and with a low complexity. This is done by setting the override flag on an empty SoTexture2 node, and by setting a low complexity value on an SoComplexity node with override set to TRUE.
  • VIEW_LINE: Renders the objects as LINES (no texture) with lighting model set to BASE_COLOR.
  • VIEW_LOW_RES_LINE: Renders the objects as LINES (no texture) using a low complexity, with lighting model set to BASE_COLOR and no depth comparison.
  • VIEW_POINT: Renders the objects as POINTS (no texture) with lighting model set to BASE_COLOR.
  • VIEW_LOW_RES_POINT: Renders the objects as POINTS (no texture) using a low complexity, with lighting model set to BASE_COLOR and no depth comparison.
  • VIEW_BBOX: Renders the objects with complexity BOUNDING_BOX, lighting model set to BASE_COLOR and drawing style LINES (no texture) with no depth comparison.

Examples

Set the still_draw_style property of the viewer 0 to VIEW_HIDDEN_LINE:

>>> hx_viewer_manager.viewers[0].still_draw_style = HxViewer.VIEW_HIDDEN_LINE
transparency_type

Integer property bound to the way the transparency is handled in the viewer.

Possibles values are:

  • SCREEN_DOOR: Uses stipple patterns to simulate transparency. Note: This algorithm is very fast because it does not require blending, shaders or sorting. However most applications should use one of the other algorithms. Screen door rendering is low quality and only works for polygons with a single transparency (alpha) value for the entire face. Screen door does not correctly handle the case of transparency per vertex or transparent textures.

  • ADD: Uses additive alpha blending

  • DELAYED_ADD: Uses additive blending, rendering all transparent objects after opaque ones. Note: When using this algorithm the OpenGL depth buffer is not updated (depth buffer writes are disabled) while rendering transparent objects. As a result complex 3D shapes may not be rendered correctly.

  • BLEND:Uses multiplicative alpha blending

  • DELAYED_BLEND: Uses multiplicative alpha blending, rendering all transparent objects after opaque ones. Note: When using this algorithm the OpenGL depth buffer is not updated (depth buffer writes are disabled) while rendering transparent objects. As a result complex 3D shapes may not be rendered correctly.

  • SORTED_OBJECT_ADD: Same as DELAYED_ADD, but sorts transparent objects by distances of bounding boxes from camera

  • SORTED_OBJECT_BLEND: Same as DELAYED_BLEND, but sorts transparent objects by distances of bounding boxes from camera

  • SORTED_LAYERS_BLEND: Deprecated name of SORTED_PIXELS_BLEND.

  • SORTED_PIXELS_BLEND: Uses a fragment-level depth sorting technique. This mode generally gives the best results for complex transparent objects.

    Since Open Inventor 9.4, if the hardware supports the necessary OpenGL features, this transparency mode (and DELAYED_SORTED_PIXELS_BLEND) is implemented using a single-pass, order-independent fragment sorting (A-buffer) algorithm. The required OpenGL hardware features are: shader_image_load_store, shader_atomic_counters and shading_language_420pack. These features are standard in core OpenGL 4.2.

    If the hardware does not support single-pass transparency, then a multi-pass “depth peeling” algorithm is used. The required OpenGL hardware features are: Multi-Texture, Texture Environment Combine, Depth texture, and Shadow. These features are standard starting with OpenGL 1.4.

    If the graphics board does not support multi-pass transparency, SORTED_OBJECT_BLEND is used.

    Limitations:
    • This transparency type is not compatible with interlaced stereo.
    • Texturing on transparent objects is limited to one texture.
    • Using the single-pass algorithm, it is possible to run out of GPU memory for storing fragment transparency values. This should only happen for scenes with both high depth complexity and a large number of transparent objects. In this case fragments from the objects traversed last in the scene graph may not be sorted correctly, resulting in small artifacts.
  • DELAYED_SORTED_LAYERS_BLEND: Deprecated name of DELAYED_SORTED_PIXELS_BLEND.

  • DELAYED_SORTED_PIXELS_BLEND: Same as SORTED_PIXELS_BLEND but rendering all transparent objects after opaque ones.

  • SORTED_TRIANGLES_ADD: Renders all the transparent triangles of the scene using additive blending. All of the transparent triangles of all objects of the scene are collected, and then sorted by triangle position.

  • SORTED_TRIANGLES_BLEND: Same as SORTED_TRIANGLES_ADD, but uses multiplicative alpha blending.

  • SORTED_OBJECT_TRIANGLES_ADD: Renders all the transparent triangles of the scene using additive blending. All of the triangles of all transparent objects of the scene are collected and then sorted by object.

  • SORTED_OBJECT_TRIANGLES_BLEND: Same as SORTED_OBJECT_TRIANGLES_ADD, but uses multiplicative alpha blending.

  • NO_TRANSPARENCY: Draw all objects as opaque ignoring their transparency.

Examples

Set the viewer 0 to NO_TRANSPARENCY mode:

>>> hx_viewer_manager.viewers[0].transparency_type = HxViewer.NO_TRANSPARENCY
viewing_mode

Integer property defining how the camera is spatially constrained: what are the different degrees of freedom of the camera.

Values could be one of the following:

  • VIEWING_MODE_SPIN: Rotate the camera around the point of interest.

  • VIEWING_MODE_SPIN_CONSTRAINED: Same as VIEWING_MODE_SPIN but add also constrained camera rotation. It modifies the viewer usage described previously as follow:

    • Ctrl + Left Mouse: Rotation around the Z axis
    • Shift + Left Mouse : Rotation around the X or the Y axis.

    If the mouse movement is globally from the left to the right (resp. from up to down) the Y axis (resp. X axis) is chosen.

  • VIEWING_MODE_PAN: Translate the camera in the viewer plane.

  • VIEWING_MODE_ROLL: Roll the camera in the viewer plane

  • VIEWING_MODE_ZOOM: Dolly/Zoom (move forward and backward) to get closer to or further away from the point of interest.

Examples

Constraint the viewer 0 camera to be a panning camera:

>>> hx_viewer_manager.viewers[0].viewing_mode = HxViewer.VIEWING_MODE_PAN
viewport

HxViewport member used to configure the viewport (render surface) of the viewer.

class hx.core.HxViewport

Bases: object

This class represents the render surface of a viewer.

Attributes

background_color Triplet of floats property representing the first color used for the background.
background_color2 Triplet of floats property representing the second color used for the background.
background_mode Integer property indicating what the render area background does look like.
size Pair of integers property bound to the size of the render area.
background_color

Triplet of floats property representing the first color used for the background.

Examples

Set the first color of the background to deep-blue:

>>> hx_viewer_manager.viewers[0].viewport.background_color = (0.0, 0.0, 0.5)

Print the first color of the background:

>>> print hx_viewer_manager.viewers[0].viewport.background_color
(0.0, 0.0, 0.5)
background_color2

Triplet of floats property representing the second color used for the background.

Examples

Set the second color of the background to bright-green:

>>> hx_viewer_manager.viewers[0].viewport.background_color2 = (0.5, 1.0, 0.5)

Print the second color of the background:

>>> print hx_viewer_manager.viewers[0].viewport.background_color2
(0.5, 1.0, 0.5)
background_mode

Integer property indicating what the render area background does look like.

Value could be one of:

  • BG_DEFAULT: Simple monochrome background.
  • BG_GRADIENT: Horizontal color gradient.
  • BG_CHECKERBOARD: Checkerboad pattern, useful for transparent displays.
  • BG_IMAGE: An arbitrary image is used as background.
  • BG_UNIFORM_REVERSE: Monochrome background using color2
  • BG_GRADIENT_REVERSE: Gradient pattern with reversed colors

Examples

Set the background of the render area of the viewer 0 to a checker:

>>> hx_viewer_manager.viewers[0].viewport.background_mode = HxViewport.BG_CHECKERBOARD
size

Pair of integers property bound to the size of the render area.

Examples

Set the size of the render area of the viewer 0 to (200, 200):

>>> hx_viewer_manager.viewers[0].viewport.size = (200, 200)

Now print the size of the render area:

>>> print hx_viewer_manager.viewers[0].viewport.size
(200, 200)
class hx.core.HxCamera

Bases: object

Base class handling the camera of a viewer.

Attributes

far_distance Float property bound to the far distance (farthest point to the camera that is in the view frustum and will be rendered).
focal_distance Floating point property bound to the focal distance of the camera.
near_distance Float property bound to the near distance (closest point to the camera that is in the view frustum and will be rendered).
orientation This property is a pair of elements: the first element is a triplet of floats representing a vector, the second element is a float representing an angle in radian.
position Triplet of floats property representing the position of the camera in the world.
up_direction Triplet of floats property representing the vector of the up direction of the camera.
view_direction Triplet of floats property representing the vector of the direction of the camera.
far_distance

Float property bound to the far distance (farthest point to the camera that is in the view frustum and will be rendered).

Examples

Print the far distance of the camera of the first viewer:

>>> print hx_viewer_manager.viewers[0].camera.far_distance
158.96
focal_distance

Floating point property bound to the focal distance of the camera.

Examples

Set the focal distance of the camera of the first viewer to 12.0:

>>> hx_viewer_manager.viewers[0].camera.focal_distance = 12.0

Print the focal distance of the camera:

>>> print hx_viewer_manager.viewers[0].camera.focal_distance
12.0
near_distance

Float property bound to the near distance (closest point to the camera that is in the view frustum and will be rendered).

Examples

Print the near distance of the camera of the first viewer:

>>> print hx_viewer_manager.viewers[0].camera.near_distance
145.21
orientation

This property is a pair of elements: the first element is a triplet of floats representing a vector, the second element is a float representing an angle in radian. It represents the rotation to apply to vector (0.0, 0.0, -1.0) to move it to the view direction of the camera.

Examples

Set the view direction of the camera to (0, 0, 1). Then, set its orientation to ((0, 1, 0), pi/2):

>>> hx_viewer_manager.viewers[0].camera.view_direction = (0, 0, 1)
>>> hx_viewer_manager.viewers[0].camera.orientation = ((0, 1, 0), 3.14159265358979323/2)

Now print the view direction:

>>> print hx_viewer_manager.viewers[0].camera.view_direction
(-0.9999999403953552, 0.0, -5.960464477539063e-08)
position

Triplet of floats property representing the position of the camera in the world.

Examples

Set the position of the camera to point (1.0, 2.0, 3.0):

>>> hx_viewer_manager.viewers[0].camera.position = (1.0, 2.0, 3.0)

Print the position of the camera:

>>> print hx_viewer_manager.viewers[0].camera.position
(1.0, 2.0, 3.0)
up_direction

Triplet of floats property representing the vector of the up direction of the camera. (read-only)

Examples

Print the up direction of the camera:

>>> print hx_viewer_manager.viewers[0].camera.up_direction
(0.0, 1.0, 0.0)
view_direction

Triplet of floats property representing the vector of the direction of the camera.

Examples

Set the direction of the camera to vector (1.0, 1.0, 0.0):

>>> hx_viewer_manager.viewers[0].camera.view_direction = (1.0, 1.0, 0.0)

Print the direction of the camera:

>>> print hx_viewer_manager.viewers[0].camera.view_direction
(1.0, 1.0, 0.0)
class hx.core.HxOrthographicCamera

Bases: _hx_core.__init__.HxCamera

This class represents the camera of a viewer with orthographic perspective. That is to say parallels line in 3D are parallels line once projected on the render surface.

Attributes

far_distance Float property bound to the far distance (farthest point to the camera that is in the view frustum and will be rendered).
focal_distance Floating point property bound to the focal distance of the camera.
height Float property representing the height of the viewing volume.
near_distance Float property bound to the near distance (closest point to the camera that is in the view frustum and will be rendered).
orientation This property is a pair of elements: the first element is a triplet of floats representing a vector, the second element is a float representing an angle in radian.
position Triplet of floats property representing the position of the camera in the world.
up_direction Triplet of floats property representing the vector of the up direction of the camera.
view_direction Triplet of floats property representing the vector of the direction of the camera.
height

Float property representing the height of the viewing volume.

Examples

Set the height of the viewing volume to 12.0:

>>> hx_viewer_manager.viewers[0].camera = HxOrthographicCamera()
>>> hx_viewer_manager.viewers[0].camera.height = 12.0

Print the height of the viewing volume:

>>> print hx_viewer_manager.viewers[0].camera.height
12.0
class hx.core.HxPerspectiveCamera

Bases: _hx_core.__init__.HxCamera

This class represents the camera of a viewer with perspective.

Attributes

far_distance Float property bound to the far distance (farthest point to the camera that is in the view frustum and will be rendered).
focal_distance Floating point property bound to the focal distance of the camera.
height_angle Float property representing the vertical angle in radian of the viewing volume (frustum).
near_distance Float property bound to the near distance (closest point to the camera that is in the view frustum and will be rendered).
orientation This property is a pair of elements: the first element is a triplet of floats representing a vector, the second element is a float representing an angle in radian.
position Triplet of floats property representing the position of the camera in the world.
up_direction Triplet of floats property representing the vector of the up direction of the camera.
view_direction Triplet of floats property representing the vector of the direction of the camera.
height_angle

Float property representing the vertical angle in radian of the viewing volume (frustum).

Examples

Set the height angle of the frustum to pi/4:

>>> hx_viewer_manager.viewers[0].camera.height_angle = 3.14159265358979323 / 4.0

Print the height angle of the frustum:

>>> print hx_viewer_manager.viewers[0].camera.height_angle
0.785398185253

Ports hierarchy

class hx.core.HxPort

Bases: object

Base class used to set all parameters (also called ports) of modules in the application

Attributes

is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
tooltip String property bound to the tooltip shown in the GUI.
visible Boolean property indicating if port is shown or hidden.

Methods

get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
get_owner()

This function returns the object that owns the port.

Returns:

HxBase

Returns an instance of a derivative class of HxBase hierarchy

Examples

Creates an Ortho Slice. Then its port data must have the Ortho Slice as owner:

>>> ortho = hx_project.create('HxOrthoSlice')
>>> ortho.ports.data.get_owner().is_same_object(ortho)
True
is_new

Boolean property bound to the fact the port has been touched since last fire.

Examples

Shows state of ortho.ports.data:

>>> print ortho.ports.data.is_new
True

Simulates a user action on ortho.ports.data:

>>> ortho.ports.data.is_new = True
label

String property bound to the label shown for this port in the GUI.

Examples

Sets label of a port ortho.ports.data to “Custom Options”:

>>> ortho.ports.data.label = "Custom Options"

Retrieves label of ortho.ports.data:

>>> print ortho.ports.data.label
Custom Options:

Method that mades an interconnection with another_port. another_port should be of the same type as this port.

Parameters:

another_port : HxPort

Port that should be linked with this one.

Raises:

RuntimeError

An exception is raised if another_port is of a different type than this port, or the 2 ports are already linked.

Examples

Creates two Ortho Slices and links their respective port sliceNumber

>>> ortho1 = hx_project.create('HxOrthoSlice')
>>> ortho2 = hx_project.create('HxOrthoSlice')
>>> ortho1.ports.sliceNumber.link(ortho2.ports.sliceNumber)
>>> ortho1.ports.sliceNumber.value = 123
>>> print ortho2.ports.sliceNumber.value
123
name

String property bound to the port name (how it is accessed in Tcl).

Examples

Sets the name of the port ortho.ports.data to ‘customOptions’.

>>> ortho = hx_project.create('HxOrthoSlice')
>>> some_port = ortho.ports.data
>>> some_port.name = 'customOptions'
>>> some_port.get_owner().ports.customOptions.name
'customOptions'

Shows the name of the port ‘some_port`:

>>> print some_port.name
customOptions

Retrieves the port ortho.ports.customOptions to ‘data’.

>>> some_port.name = 'data'
pinned

Boolean property bound to the fact the port is pinned.

Examples

Sets the port ortho.ports.data pinned.

>>> ortho.ports.data.pinned = True

Shows the pin-status of port ortho.ports.data

>>> print ortho.ports.data.pinned
True
position

Integer property bound to the position of this port in the port list of its HxBase owner.

Raises:

IndexError

If position is out of bound, an exception is raised.

Examples

Sets ortho.ports.data in fourth position

>>> ortho.ports.data.position = 3

Shows port position in the port list of the owner of this port.

>>> print ortho.ports.data.position
3
tooltip

String property bound to the tooltip shown in the GUI.

Examples

Sets tooltip of ortho.ports.data to “This port allows the users to select options”:

>>> ortho.ports.data.tooltip = 'This port allows the users to select options'

Shows tooltip of ortho.ports.data:

>>> print ortho.ports.data.tooltip
'This port allows the users to select options'

Method that removes the interconnection on this port.

Parameters:

another_port : HxPort

Port that should be unlinked with this one.

Raises:

KeyError

An exception is raised if another_port was not previously linked with this port.

Examples

>>> ortho.ports.data.unlink(ortho2.ports.sliceNumber)
visible

Boolean property indicating if port is shown or hidden.

Examples

Sets ortho.ports.data visible:

>>> ortho.ports.data.visible = True

Retrieves visibility information of ortho.ports.data:

>>> print ortho.ports.data.visible
True
class hx.core.HxConnection

Bases: _hx_core.__init__.HxPort

This class allows the user to connect modules.

Attributes

connected Read-only boolean property bound to the fact this port is connected to something.
editable Boolean property bound to the fact the user can modify the port connection in the Gui.
is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
tooltip String property bound to the tooltip shown in the GUI.
valid_types Property bound to the list of all admissible types for this port connection.
visible Boolean property indicating if port is shown or hidden.

Methods

connect(obj) Connects this port to the object obj
disconnect() Disconnects this port.
get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
source() Retrieves the object that is connected to this port.
unlink(another_port) Method that removes the interconnection on this port.
connect(obj)

Connects this port to the object obj

Parameters:

obj : HxObject

Object to connect to this port.

Raises:

TypeError

This exception is raised if obj is not a valid object to connect to for this port.

Examples

>>> dataLoaded = hx_object_factory.load(hx_paths.tutorials_dir + '/chocolate-bar.am')
>>> ortho = hx_object_factory.create('HxOrthoSlice')
>>> ortho.ports.data.connect(dataLoaded)

Now we can disconnect the port:

>>> ortho.ports.data.connect(None)
>>> print ortho.ports.data.source()
None
connected

Read-only boolean property bound to the fact this port is connected to something.

Examples

Creates an HxOrthoSlice and loads chocolate-bar.am and show connection status:

>>> dataLoaded = hx_object_factory.load(hx_paths.tutorials_dir + '/chocolate-bar.am')
>>> ortho = hx_object_factory.create('HxOrthoSlice')
>>> print ortho.ports.data.connected
False

Connects the HxOrthoSlice to the data and shows connection status:

>>> ortho.ports.data.connect(dataLoaded)
>>> print ortho.ports.data.connected
True
disconnect()

Disconnects this port.

Examples

>>> dataLoaded = hx_object_factory.load(hx_paths.tutorials_dir + '/chocolate-bar.am')
>>> ortho = hx_object_factory.create('HxOrthoSlice')
>>> ortho.ports.data.connect(dataLoaded)
>>> ortho.ports.data.disconnect()
editable

Boolean property bound to the fact the user can modify the port connection in the Gui.

Examples

Create an HxOrthoSlice, load chocolate-bar.am and set its data port as non-editable:

>>> dataLoaded = hx_object_factory.load(hx_paths.tutorials_dir + '/chocolate-bar.am')
>>> ortho = hx_object_factory.create('HxOrthoSlice')
>>> ortho.ports.data.editable = False

Show if the port HxConnection is modifiable by user:

>>> print ortho.ports.data.editable
False
source()

Retrieves the object that is connected to this port.

Returns:

HxObject

Returns the most derivate class from HxObject hierarchy that could handle the object connected to this port. If nothing is connected, it returns None.

Examples

>>> dataLoaded = hx_object_factory.load(hx_paths.tutorials_dir + '/chocolate-bar.am')
>>> ortho = hx_object_factory.create('HxOrthoSlice')
>>> ortho.ports.data.connect(dataLoaded)
>>> print ortho.ports.data.source().is_same_object(dataLoaded)
True
valid_types

Property bound to the list of all admissible types for this port connection.

Notices that this property does not fulfil the mutable sequence paradigm.

Returns:

list of strings

This list of strings represents the list of classnames of admissible type for the port connection.

Examples

Configures a port connection called ortho.ports.data to accept only HxUniformScalarField3 and HxStackedScalarField3:

>>> ortho.ports.data.valid_types = ['HxUniformScalarField3', 'HxStackedScalarField3']

Now if we want to print all accepted types for this port:

>>> print ortho.ports.data.valid_types
['HxUniformScalarField3', 'HxStackedScalarField3']
class hx.core.HxPortButtonList

Bases: _hx_core.__init__.HxPort

This class represents a port with a variable amount of buttons.

Each button could be configure using the buttons mutable sequence.

Attributes

buttons Mutable sequence bound to all _HxPortButtonList_Button interfaces
is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
tooltip String property bound to the tooltip shown in the GUI.
visible Boolean property indicating if port is shown or hidden.

Methods

Button This class is used to modify a button in an HxPortButtonList through its property.
get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
class Button

Bases: object

This class is used to modify a button in an HxPortButtonList through its property.

Attributes

caption String property bound to the button’s caption.
enabled Boolean property bound to the fact the button is enabled.
hit Boolean property bound to button state.
snap_toggle Boolean property bound to the fact the button has snap toggling enabled.
snapped Boolean property bound to the fact the button is snapped or not.
tooltip “String property bound to the tool-tip of the button.
visible Boolean property bound to the fact the button is visible.
caption

String property bound to the button’s caption.

Examples

Set caption of third button to ‘Button 3’

>>> port_button_list.buttons[2].caption = 'Button 3'
>>> print port_button_list.buttons[2].caption
Button 3
enabled

Boolean property bound to the fact the button is enabled. (It respond to user actions)

Examples

Deactivate first button:

>>> port_button_list.buttons[0].enabled = False
>>> print port_button_list.buttons[0].enabled
False
hit

Boolean property bound to button state.

Examples

Simulate a click on the first button, then show the clicked-status of this button

>>> some_button_list.buttons[0].hit = True
>>> print some_button_list.buttons[0].hit
True
snap_toggle

Boolean property bound to the fact the button has snap toggling enabled.

Examples

Activate snap toggle on the first button, and show if it is snap-able:

>>> port_button_list.buttons[0].snap_toggle = True
>>> print port_button_list.buttons[0].snap_toggle
True
snapped

Boolean property bound to the fact the button is snapped or not.

Examples

Activate snap toggle on the second button, then set it snapped, and finally display its snapped status:

>>> port_button_list.buttons[1].snap_toggle = True
>>> port_button_list.buttons[1].snapped = True
>>> print port_button_list.buttons[1].snapped
True
tooltip

“String property bound to the tool-tip of the button.

Set the tool-tip of the first button to ‘Activate some options’:

>>> port_button_list.buttons[0].tool_tip = 'Activate some options'
>>> print port_button_list.buttons[0].tool_tip
Activate some options
visible

Boolean property bound to the fact the button is visible.

Examples

Hide the third button:

>>> port_button_list.buttons[2].visible = True
>>> print port_button_list.buttons[2].visible
True
HxPortButtonList.buttons

Mutable sequence bound to all _HxPortButtonList_Button interfaces

Examples

Create 3 buttons:

>>> port_button_list.buttons = [HxPortButtonList.Button(caption='Okay'),
                                HxPortButtonList.Button(caption='Cancel', enabled=False),
                                HxPortButtonList.Button(caption='Retry')]

Modify caption of the first button:

>>> port_button_list.buttons[0].caption = 'Ok'

Make all buttons snappable:

>>> for btn in port_button_list.buttons:
>>>     btn.snap_toggle = True

Change the button in the middle:

>>> port_button_list.buttons[1] = HxPortButtonList.Button(caption='Cancel')

Displays all buttons captions:

>>> for btn in port_button_list.buttons:
>>>     print btn.caption
Ok
Cancel
Retry
class hx.core.HxPortDoIt

Bases: _hx_core.__init__.HxPortButtonList

This class handles the green apply button under the properties area that allows the user to launch a module computation and its auto-refresh check-box.

Attributes

auto_refresh Boolean property bound to the fact the auto-refresh check-box under the properties area is checked.
buttons Mutable sequence bound to all _HxPortButtonList_Button interfaces
is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
tooltip String property bound to the tooltip shown in the GUI.
visible Boolean property indicating if port is shown or hidden.
was_hit Boolean property bound to the fact the Apply button under the properties area has been pressed.

Methods

Button This class is used to modify a button in an HxPortButtonList through its property.
get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
auto_refresh

Boolean property bound to the fact the auto-refresh check-box under the properties area is checked.

Examples

Creates an HxGMC module and checks its auto-refresh button:

>>> gmc = hx_project.create('HxGMC')
>>> gmc.ports.action.auto_refresh = True

Prints the status of the auto-refresh button of gmc:

>>> print gmc.ports.action.auto_refresh
was_hit

Boolean property bound to the fact the Apply button under the properties area has been pressed.

See also

HxObject.execute

Examples

Creates an HxGMC module, connects it to chocolate-bar-labels.am and simulates a click on apply:

>>> label = hx_project.load(hx_paths.tutorials_dir + '/chocolate-bar-labels.am')
>>> gmc = hx_project.create('HxGMC')
>>> gmc.ports.data.connect(label)
>>> gmc.ports.action.was_hit = True

Performs the computation:

>>> gmc.fire()
class hx.core.HxPortFilename

Bases: _hx_core.__init__.HxPort

This port can be used to define a filename. In addition to a simple text field the port provides a button which activates the file browser.

There are mainly 2 possible modes for this port, one useful for saving a file (ANY_FILE) and one for loading a file (EXISTING_FILE).

Attributes

filenames String or sequence of string representing selected filenames.
is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
mode Enumerated property bound to the mode in which the dialog will works.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
tooltip String property bound to the tooltip shown in the GUI.
visible Boolean property indicating if port is shown or hidden.

Methods

get_owner() This function returns the object that owns the port.
launch() Opens the file selection dialog.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
filenames

String or sequence of string representing selected filenames.

Notes

This property does not support the mutable sequence paradigm.

Examples

if port_filename is an HxPortFilename, we could set its selected file to MyFile.py:

>>> port_filename.filenames = 'MyFile.py'

Print current filename:

>>> print port_filename.filenames
launch()

Opens the file selection dialog.

Examples

if port_filename is an HxPortFilename, we could open the dialog:

>>> port_filename.launch()
mode

Enumerated property bound to the mode in which the dialog will works. This property must be one of the following values:

  • ANY_FILE: This mode will accept any filename, even if the file does not exist yet.
  • EXISTING_FILE: This mode will accept only one filename that refers to an existing file.
  • MULTI_FILE: This mode will accept multiple filenames that refers to one or more existing files.
  • LOAD_DIRECTORY: This mode will accept any directory name that already exists.
  • SAVE_DIRECTORY: This mode will accept any directory name even if the directory does not exist yet.

Examples

if port_filename is an HxPortFilename, we could set it to accept only one existing file:

>>> port_filename.mode = HxPortFilename.EXISTING_FILE

Now print if port_filename is in EXISTING_FILE mode or not:

>>> print port_filename.mode is HxPortFilename.EXISTING_FILE
True
class hx.core.HxPortFloatSlider

Bases: _hx_core.__init__.HxPort

This class handles a port with a float value that could be changed with a slider. The slider could have arrows to increment or decrement the selected value. The minimum and maximum values that can be selected in the slider are parametrizable via the clamp_range property. This slider also exhibits a sub-range selector, allowing the user to select a value on the slider more accurately.

Attributes

arrow_increment Float property bound to the amount of increment or decrement applied to the slider’s value when using the arrows buttons.
clamp_range Pair of floats property bound to the minimal and maximal admissible value that can take the slider.
discrete Boolean property bound to the fact the slider is constraint to take values that are a multiple of the arrow_increment value.
has_arrow_buttons Boolean property bound to the fact the port contains the arrow buttons allowing the user to
has_edit_button Boolean property bound to the fact the port contains a button allowing the user to configure the Gui (called the edit button).
has_sub_range_buttons Boolean property bound to the fact the port contains the sub-range buttons allowing the user to select the range displayed in the slider.
is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
sub_range Pair of floats property bound to the sub-range of the slider.
tooltip String property bound to the tooltip shown in the GUI.
tracking Boolean property bound to the fact the slider is notifying value changes when slider is pressed and currently edited.
value Float property bound to the selected value in the slider.
visible Boolean property indicating if port is shown or hidden.

Methods

get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
arrow_increment

Float property bound to the amount of increment or decrement applied to the slider’s value when using the arrows buttons.

Examples

Creates an HxIsosurfaceRender2 and retrieves its port threshold

>>> iso_ren = hx_project.create('HxIsosurfaceRender2')
>>> port_float_slider = iso_ren.ports.threshold

Sets the arrow_increment of the port threshold to 0.1:

>>> port_float_slider.arrow_increment = 0.1

Prints the arrow_increment of the port threshold:

>>> print port_float_slider.arrow_increment
0.1
clamp_range

Pair of floats property bound to the minimal and maximal admissible value that can take the slider.

Examples

Creates an HxIsosurfaceRender2 and retrieves its port threshold

>>> iso_ren = hx_project.create('HxIsosurfaceRender2')
>>> port_float_slider = iso_ren.ports.threshold

Sets the clamp_range of the port threshold to (-100.0, 100.0):

>>> port_float_slider.clamp_range = (-100.0, 100.0)

Prints the clamp_range of the port threshold:

>>> print port_float_slider.clamp_range
(-100.0, 100.0)

Sets the maximum admissible value to 255.0:

>>> port_float_slider.clamp_range[1] = 255.0

Prints the maximum admissible value:

>>> print port_float_slider.clamp_range[1]
255.0
discrete

Boolean property bound to the fact the slider is constraint to take values that are a multiple of the arrow_increment value.

Examples

Creates an HxIsosurfaceRender2, retrieves its port threshold, sets the clamp_range to (-1000.0, 1000.0) and sets the arrow_increment to 100.0:

>>> iso_ren = hx_project.create('HxIsosurfaceRender2')
>>> port_float_slider = iso_ren.ports.threshold
>>> port_float_slider.clamp_range = (-1000.0, 1000.0)
>>> port_float_slider.arrow_increment = 100.0

Makes the slider of port threshold accept only integer values:

>>> port_float_slider.discrete = True

Sets the value of the slider to 125.0 and prints the slider’s value:

>>> port_float_slider.value = 125.0
>>> print port_float_slider.value
100.0
has_arrow_buttons

Boolean property bound to the fact the port contains the arrow buttons allowing the user to increase or decrease the slider’s value by the amount arrow_increment

Examples

Creates an HxIsosurfaceRender2 and retrieves its port threshold

>>> iso_ren = hx_project.create('HxIsosurfaceRender2')
>>> port_float_slider = iso_ren.ports.threshold

Enables the arrow buttons of the port threshold:

>>> port_float_slider.has_arrow_button = True

Prints the presence of the arrow buttons:

>>> print port_float_slider.has_arrow_button
True
has_edit_button

Boolean property bound to the fact the port contains a button allowing the user to configure the Gui (called the edit button).

Examples

Creates an HxIsosurfaceRender2 and retrieves its port threshold

>>> iso_ren = hx_project.create('HxIsosurfaceRender2')
>>> port_float_slider = iso_ren.ports.threshold

Removes the edit button of the port threshold:

>>> port_float_slider.has_edit_button = False

Prints the presence of the edit button:

>>> print port_float_slider.has_edit_button
False
has_sub_range_buttons

Boolean property bound to the fact the port contains the sub-range buttons allowing the user to select the range displayed in the slider.

Examples

Creates an HxIsosurfaceRender2 and retrieves its port threshold

>>> iso_ren = hx_project.create('HxIsosurfaceRender2')
>>> port_float_slider = iso_ren.ports.threshold

Enables the sub-range buttons of the port threshold:

>>> port_float_slider.has_subrange_buttons = True

Prints the presence of the sub-range buttons:

>>> print port_float_slider.has_subrange_buttons
True
sub_range

Pair of floats property bound to the sub-range of the slider. (i.e. The value that are displayed in the slider)

Examples

Creates an HxIsosurfaceRender2 and retrieves its port threshold and sets the clamp_range to (-1000.0, 1000.0):

>>> iso_ren = hx_project.create('HxIsosurfaceRender2')
>>> port_float_slider = iso_ren.ports.threshold
>>> port_float_slider.clamp_range = (-1000.0, 1000.0)

Sets the sub_range of the port threshold to (-100.0, 100.0):

>>> port_float_slider.sub_range = (-100.0, 100.0)

Prints the sub_range of the port threshold:

>>> print port_float_slider.sub_range
(-100.0, 100.0)

Sets the maximum value displayed in the slider to 255.0:

>>> port_float_slider.sub_range[1] = 255.0

Prints the maximum value displayed in the slider:

>>> print port_float_slider.sub_range[1]
255.0
tracking

Boolean property bound to the fact the slider is notifying value changes when slider is pressed and currently edited.

Examples

Creates an HxIsosurfaceRender2 and retrieves its port threshold

>>> iso_ren = hx_project.create('HxIsosurfaceRender2')
>>> port_float_slider = iso_ren.ports.threshold

Sets the slider of port threshold not tracking:

>>> port_float_slider.tracking = False

Prints the tracking state of the port:

>>> print port_float_slider.tracking
False
value

Float property bound to the selected value in the slider.

Examples

Creates an HxIsosurfaceRender2 and retrieves its port threshold

>>> iso_ren = hx_project.create('HxIsosurfaceRender2')
>>> port_float_slider = iso_ren.ports.threshold

Sets the selected value of the port threshold to 12.0:

>>> port_float_slider.value = 12.0

Prints the value of the port threshold:

>>> print port_float_slider.value
12.0
class hx.core.HxPortIntSlider

Bases: _hx_core.__init__.HxPortFloatSlider

This class handles a port with an integer value that could be changed with a slider. The slider could have arrows to increment or decrement the selected value. The minimum and maximum values that can be selected in the slider are parametrizable via the clamp_range property. This slider also exhibits a sub-range selector, allowing the user to select a value on the slider more accurately.

Attributes

arrow_increment Integer property bound to the amount of increment or decrement applied to the slider’s value when using the arrows buttons.
clamp_range Pair of integers property bound to the minimal and maximal admissible values that can take the slider.
discrete Boolean property bound to the fact the slider is constraint to take values that are a multiple of the arrow_increment value.
has_arrow_buttons Boolean property bound to the fact the port contains the arrow buttons allowing the user to
has_edit_button Boolean property bound to the fact the port contains a button allowing the user to configure the Gui (called the edit button).
has_sub_range_buttons Boolean property bound to the fact the port contains the sub-range buttons allowing the user to select the range displayed in the slider.
is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
sub_range Pair of floats property bound to the sub-range of the slider.
tooltip String property bound to the tooltip shown in the GUI.
tracking Boolean property bound to the fact the slider is notifying value changes when slider is pressed and currently edited.
value Integer property bound to the selected value in the slider.
visible Boolean property indicating if port is shown or hidden.

Methods

get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
arrow_increment

Integer property bound to the amount of increment or decrement applied to the slider’s value when using the arrows buttons.

Examples

Creates an HxOrthoSlice and retrieves its port sliceNumber

>>> ortho = hx_project.create('HxOrthoSlice')
>>> port_int_slider = ortho.ports.sliceNumber

Sets the arrow_increment of the port sliceNumber to 2:

>>> port_int_slider.arrow_increment = 2

Prints the arrow_increment of the port sliceNumber:

>>> print port_int_slider.arrow_increment
2
clamp_range

Pair of integers property bound to the minimal and maximal admissible values that can take the slider.

Examples

Creates an HxOrthoSlice and retrieves its port sliceNumber

>>> ortho = hx_project.create('HxOrthoSlice')
>>> port_int_slider = ortho.ports.sliceNumber

Sets the clamp_range of the port sliceNumber to (-100, 100):

>>> port_int_slider.clamp_range = (-100, 100)

Prints the clamp_range of the port sliceNumber:

>>> print port_int_slider.clamp_range
(-100, 100)

Sets the maximum admissible value to 255:

>>> port_int_slider.clamp_range[1] = 255

Prints the maximum admissible value:

>>> print port_int_slider.clamp_range[1]
255
value

Integer property bound to the selected value in the slider.

Examples

Creates an HxOrthoSlice and retrieves its port sliceNumber

>>> ortho = hx_project.create('HxOrthoSlice')
>>> port_int_slider = ortho.ports.sliceNumber

Sets the selected value of the port sliceNumber to 12:

>>> port_int_slider.value = 12

Prints the value of the port sliceNumber:

>>> print port_int_slider.value
12
class hx.core.HxPortFloatTextN

Bases: _hx_core.__init__.HxPort

This class handles a port with a variable amount of edit-boxes allowing the user to enter floats values.

Access to these edit-box is granted by property texts.

Attributes

is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
texts Mutable sequence of FloatText interface.
tooltip String property bound to the tooltip shown in the GUI.
visible Boolean property indicating if port is shown or hidden.

Methods

FloatText This class allows the user to modify an edit-box containing a float value by modifying its properties.
get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
class FloatText

Bases: object

This class allows the user to modify an edit-box containing a float value by modifying its properties.

Attributes

clamp_range Pair of floats property bound to the range of admissible value typed in the edit-box.
enabled Boolean property bound to the fact the edit-box is editable or not.
label String property bound to the label displayed before the edit-box.
tooltip String property bound to the tooltip of the edit-box.
value Float property bound to the value typed in the edit-box:
clamp_range

Pair of floats property bound to the range of admissible value typed in the edit-box.

Examples

Creates an HxSurfaceLIC module and get its contrast port:

>>> surface_lic = hx_project.create('HxSurfaceLIC')
>>> port_float_text_n = surface_lic.ports.contrast

Sets the clamp range of the first edit-box to (0.0, 1000.0):

>>> port_float_text_n.texts[0].clamp_range = (0.0, 1000.0)

Sets the maximum value of the clamp range to 500.0:

>>> port_float_text_n.texts[0].clamp_range[1] = 500.0

Prints the clamp range:

>>> print port_float_text_n.texts[0].clamp_range
(0.0, 500.0)
enabled

Boolean property bound to the fact the edit-box is editable or not.

Examples

Creates an HxSurfaceLIC module and get its contrast port:

>>> surface_lic = hx_project.create('HxSurfaceLIC')
>>> port_float_text_n = surface_lic.ports.contrast

Sets the value of the first edit-box non-editable:

>>> port_float_text_n.texts[0].enabled = False

Prints the enabled-status of the first edit-box:

>>> print port_float_text_n.texts[0].enabled
False
label

String property bound to the label displayed before the edit-box.

Examples

Creates an HxSurfaceLIC module and get its contrast port:

>>> surface_lic = hx_project.create('HxSurfaceLIC')
>>> port_float_text_n = surface_lic.ports.contrast

Sets the label of the first edit-box to “min value”:

>>> port_float_text_n.texts[0].label = "min value"

Prints the label of the first edit-box:

>>> print port_float_text_n.texts[0].label
min value
tooltip

String property bound to the tooltip of the edit-box.

Examples

Creates an HxSurfaceLIC module and get its contrast port:

>>> surface_lic = hx_project.create('HxSurfaceLIC')
>>> port_float_text_n = surface_lic.ports.contrast

Sets the value of the first edit-box to “some tooltip”:

>>> port_float_text_n.texts[0].tooltip = "some tooltip"

Prints the value of the first edit-box:

>>> print port_float_text_n.texts[0].tooltip
some tooltip
value

Float property bound to the value typed in the edit-box:

Examples

Creates an HxSurfaceLIC module and get its contrast port:

>>> surface_lic = hx_project.create('HxSurfaceLIC')
>>> port_float_text_n = surface_lic.ports.contrast

Sets the value of the first edit-box to 0.5:

>>> port_float_text_n.texts[0].value = 0.5

Prints the value of the first edit-box:

>>> print port_float_text_n.texts[0].value
0.5
HxPortFloatTextN.texts

Mutable sequence of FloatText interface.

Examples

Lets suppose port_float_text_n is an instance of HxPortFloatTextN. We can create 3 edit-boxes:

>>> port_float_text_n.texts = [HxPortFloatTextN.FloatText(label="threshold"),
                               HxPortFloatTextN.FloatText(label="average resolution"),
                               HxPortFloatTextN.FloatText(label="size")]

Now we can disable the third edit-box:

>>> port_float_text_n.texts[2].enabled = False

We can set all clamping_range to (-1000.0, 1000.0):

>>> for float_text in port_float_text_n.texts:
        float_text.clamp_range = (0.0, 1000.0)

Now we want to redefine the first edit-box:

>>> port_float_text_n.texts[0] = HxPortFloatTextN.FloatText(label="thresh.", value=1, clamp_range=(0.0, 10.0))

We can add an edit-box in second position:

>>> port_float_text_n.texts.insert(1, HxPortFloatTextN.FloatText(label="length"))

And finally we can remove the last edit-box:

>>> del port_float_text_n.texts[3]
class hx.core.HxPortIntTextN

Bases: _hx_core.__init__.HxPortFloatTextN

This class handles a port with a variable amount of edit-boxes allowing the user to enter integer values.

Access to these edit-box is granted by property texts.

Attributes

is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
texts Mutable sequence of IntText interface.
tooltip String property bound to the tooltip shown in the GUI.
visible Boolean property indicating if port is shown or hidden.

Methods

FloatText This class allows the user to modify an edit-box containing a float value by modifying its properties.
IntText This class allows the user to modify an edit-box containing a float value by modifying its properties.
get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
class IntText

Bases: _hx_core.__init__._HxPortFloatTextN_FloatText

This class allows the user to modify an edit-box containing a float value by modifying its properties.

Attributes

clamp_range Pair of integers property bound to the range of admissible value typed in the edit-box.
enabled Boolean property bound to the fact the edit-box is editable or not.
label String property bound to the label displayed before the edit-box.
tooltip String property bound to the tooltip of the edit-box.
value Integer property bound to the value typed in the edit-box:
clamp_range

Pair of integers property bound to the range of admissible value typed in the edit-box.

Examples

Create an HxResample module and get its resolution port:

>>> resample = hx_project.create('HxResample')
>>> port_int_text_n = resample.ports.resolution

Set the clamp range of the first edit-box to (0, 1000):

>>> port_int_text_n.texts[0].clamp_range = (0, 1000)

Set the maximum value of the clamp range to 500:

>>> port_int_text_n.texts[0].clamp_range[1] = 500

Print the clamp range:

>>> print port_int_text_n.texts[0].clamp_range
(0, 500)
value

Integer property bound to the value typed in the edit-box:

Examples

Create an HxResample module and get its resolution port:

>>> resample = hx_project.create('HxResample')
>>> port_int_text_n = resample.ports.resolution

Set the value of the first edit-box to 0.5:

>>> port_int_text_n.texts[0].value = 0.5

Print the value of the first edit-box:

>>> print port_int_text_n.texts[0].value
0.5
HxPortIntTextN.texts

Mutable sequence of IntText interface.

Examples

Let suppose port_int_text_n is an instance of HxPortFloatTextN. We can create 3 edit-boxes:

>>> port_int_text_n.texts = [HxPortIntTextN.IntText(label="threshold"),
                             HxPortIntTextN.IntText(label="average resolution"),
                             HxPortIntTextN.IntText(label="size")]

Now we can disable the third edit-box:

>>> port_int_text_n.texts[2].enabled = False

We can set all clamping_range to (-1000, 1000):

>>> for float_text in port_int_text_n.texts:
        float_text.clamp_range = (0, 1000)

Now we want to redefine the first edit-box:

>>> port_int_text_n.texts[0] = HxPortIntTextN.IntText(label="thresh.", value=1, clamp_range=(0, 10))

We can add an edit-box in second position:

>>> port_int_text_n.texts.insert(1, HxPortIntTextN.IntText(label="length"))

And finally we can remove the last edit-box:

>>> del port_int_text_n.texts[3]
class hx.core.HxPort3DPointList

Bases: _hx_core.__init__.HxPort

This port defines a list of points in 3D space. The point coordinates can be edited via a text field or by using a 3D dragger.

The number of points managed by this port may be changed using the property points which respect the mutable sequence paradigm. Points may be interactively added or removed by the user if the minimal and maximal numbers of points are specified with properties min_points and max_points. On default, no dynamic range is used, i.e., the number of points is fixed. The minimal number of points may be any number greater than 0.

In order to use this port first a bounding box has to be defined. Otherwise, the points and the 3D dragger will not be visible. The coordinates of any point will be clipped to lie inside the bounding box if the property clamped_to_bbox is set to True (default behavior)

Attributes

bounding_box Pair of 3D space vectors representing the bounding-box in which the points_sequence must lie.
clamped_to_bbox Boolean property bound to the fact points coordinates must lie within the bounding_box.
is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
max_points Integer property bound to the maximal amount of points the user could settle in the port Gui.
min_points Integer property bound to the minimal amount of points the user could settle in the port Gui.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
points Mutable sequence property bound to all Point interface contained in the port.
position Integer property bound to the position of this port in the port list of its HxBase owner.
show_dragger Boolean property bound to the fact the dragger is visible in the 3D viewer.
show_points Boolean property bound to the fact the points are visible in the 3D viewer.
tooltip String property bound to the tooltip shown in the GUI.
tracking Boolean property bound to the fact the owner of this port is notified of changes of the port during point dragging in the 3D viewer, or only when the dragger is released.
visible Boolean property indicating if port is shown or hidden.

Methods

Point This class aims to defines a point in 3D space.
get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
class Point

Bases: object

This class aims to defines a point in 3D space. Its coordinates could be accessed via the coords property.

Attributes

coords Tuple of floats property bound to the coordinates of the point in the 3D space.
coords

Tuple of floats property bound to the coordinates of the point in the 3D space.

Examples

Set the coordinates of the second point of the port to (0.5, 0.8, 0.1):

>>> port3DPointList.points[1].coords = (0.5, 0.8, 0.1)

Print the coordinates of the second point of the port:

>>> print port3DPointList.points[1].coords
(0.5, 0.8, 0.1)
HxPort3DPointList.bounding_box

Pair of 3D space vectors representing the bounding-box in which the points_sequence must lie. If the property clamped_to_bbox is set, all points will be clamped inside the bounding-box.

Examples

Set the bounding-box of the port to (0.0, 0.0, 0.0) to (1.0, 1.0, 1.0):

>>> port3DPointList.bounding_box = ((0.0, 0.0, 0.0), (1.0, 1.0, 1.0))

Print the bounding-box:

>>> print port3DPointList.bounding_box
((0.0, 0.0, 0.0), (1.0, 1.0, 1.0))

Force the port to clamp points inside the bounding-box and set the coordinates of the first point (0.5, 1.5, -1.5) (outside of the bounding-box).

>>> port3DPointList.clamped_to_bbox = True
>>> port3DPointList.points[0].coords = (0.5, 1.5, -1.5)

Now print the coords of the first point:

>>> print port3DPointList.points[0].coords
(0.5, 1.0, 0.0)

See how the coordinates of the first point have been clamped to the bounding-box.

HxPort3DPointList.clamped_to_bbox

Boolean property bound to the fact points coordinates must lie within the bounding_box.

Examples

Force points to lie within the bounding-box:

>>> port3DPointList.clamped_to_bbox = True

Show if points must lie within the bounding-box:

>>> print port3DPointList.clamped_to_bbox
True
HxPort3DPointList.max_points

Integer property bound to the maximal amount of points the user could settle in the port Gui.

Examples

Force the port to have at most 8 points:

>>> port3DPointList.max_points = 8

Show the maximal amount of points settable in the Gui:

>>> print port3DPointList.max_points
8
HxPort3DPointList.min_points

Integer property bound to the minimal amount of points the user could settle in the port Gui.

Examples

Force the port to have at least 3 points:

>>> port3DPointList.min_points = 3

Show the minimal amount of points settable in the Gui:

>>> print port3DPointList.min_points
3
HxPort3DPointList.points

Mutable sequence property bound to all Point interface contained in the port.

Raises:

RuntimeError

This exception will be raised if by inserting, removing items or affecting this property the amount of points goes outside of min_points and max_points.

TypeError

This exception will be raised if trying to affect an element of the sequence with something else than a Point interface.

Examples

Firstly, we must set the minimal and maximal amount of points that could be edited in the Gui. We will set them respectively to 2 and 8:

>>> port3DPointList.min_points = 2
>>> port3DPointList.max_points = 8

Secondly, we can defined a Point as a HxPort3DPointList.Point class

>>> Point = HxPort3DPointList.Point

Now we could affect 4 points to the port:

>>> port3DPointList.points = [Point(coords=(1.0, 1.0, 1.0)), Point(coords=(2.0, 2.0, 2.0)),
>>>                           Point(coords=(3.0, 3.0, 3.0)), Point(coords=(4.0, 4.0, 4.0))]

Now we print the coordinates of the four points:

>>> for point in port3DPointList.points:
>>>     print point.coords
(1.0, 1.0, 1.0)
(2.0, 2.0, 2.0)
(3.0, 3.0, 3.0)
(4.0, 4.0, 4.0)

We could insert an element in the first position:

>>> port3DPointList.points.insert(0, Point(coords=(0.0, 0.0, 0.0)))
>>> print port3DPointList.points[0].coords
(0.0, 0.0, 0.0)

We could delete the last element:

>>> del port3DPointList.points[4]

If we try to affect to points a sequence with a length greater than max_points, an exception will be raised:

>>> port3DPointList.points = [Point(), Point(), Point(), Point(), Point(), Point(), Point(), Point(), Point()]
RuntimeError: Wrong Point sequence size.

If we try to affect to points a sequence with a length lessert than min_points, an exception will be raised:

>>> port3DPointList.points = [Point()]
RuntimeError: Wrong Point sequence size.

Notice that a similar behavior will be observed when using insert, append or deleting items.

HxPort3DPointList.show_dragger

Boolean property bound to the fact the dragger is visible in the 3D viewer.

Examples

Show dragger in the 3D viewer:

>>> port3DPointList.show_dragger = True

Show if the dragger is visible in the 3D viewer:

>>> print port3DPointList.show_dragger
True
HxPort3DPointList.show_points

Boolean property bound to the fact the points are visible in the 3D viewer.

Examples

Show points in the 3D viewer:

>>> port3DPointList.show_points = True

Show if the point are visible in the 3D viewer:

>>> print port3DPointList.show_points
True
HxPort3DPointList.tracking

Boolean property bound to the fact the owner of this port is notified of changes of the port during point dragging in the 3D viewer, or only when the dragger is released.

Examples

Set the port in tracking mode:

>>> port3DPointList.tracking = True

Print if the port is in tracking mode:

>>> print port3DPointList.tracking
True
class hx.core.HxPortInfo

Bases: _hx_core.__init__.HxPort

This port provides a label to show information to the user.

Attributes

is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
text String property bound to the text displayed in the label.
tooltip String property bound to the tooltip shown in the GUI.
visible Boolean property indicating if port is shown or hidden.

Methods

get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
text

String property bound to the text displayed in the label.

Examples

Creates an HxContrast module and retrieve its info port:

>>> contrast = hx_project.create('HxContrast')
>>> port_info = contrast.ports.info

Sets port_info text to “some useful info.”

>>> port_info.text = "some useful info."

Now we print the content of port port_info:

>>> print port_info.text
some useful info.
class hx.core.HxPortGeneric

Bases: _hx_core.__init__.HxPort

This port can be customized by inserting several different predefined user-interface components. The design goal of this class was ease-of-use.

Several different predefined user-interface components can be used:
  • text fields for integer values
  • text fields for floating point values
  • check boxes
  • groups of radio buttons
  • combo boxes (option menus)
  • push buttons
  • labels

Adding or removing interface components can be performed by modifying the mutable sequence attribute items.

Attributes

is_new Boolean property bound to the fact the port has been touched since last fire.
items Mutable sequence property containing all Gui elements.
label String property bound to the label shown for this port in the GUI.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
tooltip String property bound to the tooltip shown in the GUI.
visible Boolean property indicating if port is shown or hidden.

Methods

GenericCheckBox This class is a 2-state check-box.
GenericColorEdit This class enables to the user to select a color in a dedicated dialog.
GenericComboBox This class is a combo-box.
GenericFloatTextEdit This class is a text-box where user could enter a floating value.
GenericItem Abstract Base Class from which all item that can be appended to HxPortGeneric.items derivate from.
GenericLabel This class is a text label.
GenericPushButton This class is a standard push button
GenericRadioGroup This class is a group of radio-buttons (only one at a time could be checked.)
GenericTextEdit This class is a text edit box.
get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
class GenericCheckBox

Bases: _hx_core.__init__._HxPortGeneric_GenericItem

This class is a 2-state check-box.

Attributes

caption String property bound to the text displayed next to the check-box.
checked Boolean property bound to the fact the check-box is checked or not.
enabled Boolean property bound to the fact this item is modifiable by the user in the Gui.
is_new Boolean property bound to the fact this item of the port has changed since last fire of the port’s owner.
tooltip String property bound to the tooltip to display in the Gui for this item.
caption

String property bound to the text displayed next to the check-box.

Examples

Set the caption of the check-box to “this is a check-box”:

>>> port_generic.items[0].caption = "this is a check-box"

Print the content of the check-box:

>>> print port_generic.items[0].caption
this is a check-box
checked

Boolean property bound to the fact the check-box is checked or not.

Examples

Check all check-box in the port port_generic:

>>> for item in port_generic.items:
>>>     if isinstance(item, HxPortGeneric.GenericCheckBox):
>>>         item.checked = True

Print if first check-box is checked or not:

>>> print port_generic.items[0].checked
True
class HxPortGeneric.GenericColorEdit

Bases: _hx_core.__init__._HxPortGeneric_GenericItem

This class enables to the user to select a color in a dedicated dialog.

Attributes

caption String property bound to the text displayed next to the color button.
color 3-uplet of floats between [0, 1] property bound to the color selected by user.
enabled Boolean property bound to the fact this item is modifiable by the user in the Gui.
is_new Boolean property bound to the fact this item of the port has changed since last fire of the port’s owner.
tooltip String property bound to the tooltip to display in the Gui for this item.
caption

String property bound to the text displayed next to the color button.

Examples

Set the displayed text to “Select your color”

>>> port_generic.items[0].caption = "Select your color"

Print the text displayed in the label:

>>> print port_generic.items[0].caption
Select your color
color

3-uplet of floats between [0, 1] property bound to the color selected by user.

Examples

Set the selected color to green:

>>> port_generic.items[0].color = (0.0, 1.0, 0.0)

Print selected color:

>>> print port_generic.items[0].color
(0.0, 1.0, 0.0)
class HxPortGeneric.GenericComboBox

Bases: _hx_core.__init__._HxPortGeneric_GenericItem

This class is a combo-box.

Attributes

elements Mutable sequence of strings bound to the list of all displayed items in the combo-box.
enabled Boolean property bound to the fact this item is modifiable by the user in the Gui.
is_new Boolean property bound to the fact this item of the port has changed since last fire of the port’s owner.
selected Integer property bound to the index of the selected item in the combo-box.
tooltip String property bound to the tooltip to display in the Gui for this item.
elements

Mutable sequence of strings bound to the list of all displayed items in the combo-box.

Examples

Set the combo-box with 4 items:

>>> port_generic.items[0].elements = ['choice 5', 'choice 4', 'choice 3', 'choice 2']

Append ‘choice 1’ in the combo-box:

>>> port_generic.items[0].elements.append('choice 1')

Reorder items in the combo-box and print them:

>>> port_generic.items[0].elements.reverse()
>>> for element in port_generic.items[0].elements:
>>>     print element
choice 1
choice 2
choice 3
choice 4
choice 5
selected

Integer property bound to the index of the selected item in the combo-box.

Examples

Select the fourth item in the combo-box:

>>> port_generic.items[0].selected = 3

Print caption of selected element:

>>> print port_generic.items[0].elements[port_generic.items[0].selected]
choice 4
class HxPortGeneric.GenericFloatTextEdit

Bases: _hx_core.__init__._HxPortGeneric_GenericItem

This class is a text-box where user could enter a floating value.

Attributes

discrete Boolean property bound to the fact the edit-box accepts only integer value.
enabled Boolean property bound to the fact this item is modifiable by the user in the Gui.
is_new Boolean property bound to the fact this item of the port has changed since last fire of the port’s owner.
tooltip String property bound to the tooltip to display in the Gui for this item.
value Property bound to the value displayed in the edit-box.
discrete

Boolean property bound to the fact the edit-box accepts only integer value. (default is False)

Examples

Set the edit-box as not discrete and set its value to 12.0, print its value:

>>> port_generic.items[0].discrete = False
>>> port_generic.items[0].value = 12.0
>>> print port_generic.items[0].value
12.0

Set the edit-box in discrete mode and print its value:

>>> port_generic.items[0].discrete = True
>>> print port_generic.items[0].value
12
value

Property bound to the value displayed in the edit-box. If discrete is set, this property is an Integer property. If discrete is not set, this property is a float property.

Examples

Set the value of the edit-box to 12.0:

>>> port_generic.items[0].value = 12.0

Print the value of the edit-box:

>>> print port_generic.items[0].value
12.0
class HxPortGeneric.GenericItem

Bases: object

Abstract Base Class from which all item that can be appended to HxPortGeneric.items derivate from.

Attributes

enabled Boolean property bound to the fact this item is modifiable by the user in the Gui.
is_new Boolean property bound to the fact this item of the port has changed since last fire of the port’s owner.
tooltip String property bound to the tooltip to display in the Gui for this item.
enabled

Boolean property bound to the fact this item is modifiable by the user in the Gui.

Examples

Set all widgets of port_generic not modifiable by the user:

>>> for item in port_generic.items:
>>>     item.enabled = False

Print if the first widget is modifiable or not:

>>> print port_generic.items[0].enabled
False
is_new

Boolean property bound to the fact this item of the port has changed since last fire of the port’s owner.

Set the first item of port_generic as changed:

>>> port_generic.items[0].is_new = True

Performs a fire on port owner, and print the value of is_new of this item:

>>> port_generic.get_owner().fire()
>>> print port_generic.items[0].is_new
False

Notice that fire has reset the is_new flag to False.

tooltip

String property bound to the tooltip to display in the Gui for this item.

Examples

Set the tooltip of the first item to the string “tooltip”:

>>> port_generic.items[0].tooltip = "tooltip"

Print the content of the tooltip of the first item:

>>> print port_generic.items[0].tooltip
tooltip
class HxPortGeneric.GenericLabel

Bases: _hx_core.__init__._HxPortGeneric_GenericItem

This class is a text label.

Attributes

caption String property bound to the text displayed.
enabled Boolean property bound to the fact this item is modifiable by the user in the Gui.
is_new Boolean property bound to the fact this item of the port has changed since last fire of the port’s owner.
tooltip String property bound to the tooltip to display in the Gui for this item.
caption

String property bound to the text displayed.

Examples

Set the displayed text to “Ok, it’s alright”

>>> port_generic.items[0].caption = "Ok, it's alright"

Print the text displayed in the label:

>>> print port_generic.items[0].caption
Ok, it's alright
class HxPortGeneric.GenericPushButton

Bases: _hx_core.__init__._HxPortGeneric_GenericItem

This class is a standard push button

Attributes

caption String property bound to the caption displayed in the push button.
enabled Boolean property bound to the fact this item is modifiable by the user in the Gui.
hit Boolean property bound to the fact the push button has been triggered.
is_new Boolean property bound to the fact this item of the port has changed since last fire of the port’s owner.
tooltip String property bound to the tooltip to display in the Gui for this item.
caption

String property bound to the caption displayed in the push button.

Examples

Set the caption of the push-button to ‘Cancel’:

>>> port_generic.items[0].caption = 'Cancel'

Print the caption of the push-button:

>>> print port_generic.items[0].caption
Cancel
hit

Boolean property bound to the fact the push button has been triggered.

Examples

Set the push-button as triggered:

>>> port_generic.items[0].hit = True

Print the status of the push-button:

>>> print port_generic.items[0].hit
True
class HxPortGeneric.GenericRadioGroup

Bases: _hx_core.__init__._HxPortGeneric_GenericItem

This class is a group of radio-buttons (only one at a time could be checked.)

Attributes

captions Mutable sequence of strings property bound to the text displayed in all radio-boxes.
enabled Boolean property bound to the fact this item is modifiable by the user in the Gui.
is_new Boolean property bound to the fact this item of the port has changed since last fire of the port’s owner.
selected Integer property bound to the index of the selected radio-box inside the radio-group.
tooltip String property bound to the tooltip to display in the Gui for this item.
captions

Mutable sequence of strings property bound to the text displayed in all radio-boxes.

Examples

Create in first position of port port_generic a radio group with 5 elements:

>>> port_generic.items.insert(0, HxPortGeneric.GenericRadioGroup(captions=['option 5', 'option 4', 'option 3', 'option 2', 'option 1']))

Reorder the options in growing order:

>>> port_generic.items[0].captions.reverse()

Prints captions of all radio-boxes:

>>> for caption in port_generic.items[0].captions:
>>>     print caption
option 1
option 2
option 3
option 4
option 5
selected

Integer property bound to the index of the selected radio-box inside the radio-group.

Examples

Select the third radio-box:

>>> port_generic.items[0].selected = 2

Print the caption of the selected radio-box:

>>> print port_generic.items[0].captions[port_generic.items[0].selected]
option 3
class HxPortGeneric.GenericTextEdit

Bases: _hx_core.__init__._HxPortGeneric_GenericItem

This class is a text edit box.

Attributes

enabled Boolean property bound to the fact this item is modifiable by the user in the Gui.
is_new Boolean property bound to the fact this item of the port has changed since last fire of the port’s owner.
text String property bound to the text displayed in the text edit box.
tooltip String property bound to the tooltip to display in the Gui for this item.
text

String property bound to the text displayed in the text edit box.

Examples

Set the text in the edit box to “This is here.”

>>> port_generic.items[0].text = "This is here."

Print the content of the edit box:

>>> print port_generic.items[0].text
This is here.
HxPortGeneric.items

Mutable sequence property containing all Gui elements. This attribute allows the developer to add/remove interface components from the portand gives an access to all these components to customize them.

Examples

Create a module HxAnnotation and retrieve its background port

>>> annotation = hx_project.create('HxAnnotation')
>>> port_generic = annotation.ports.background

Create different widgets in the port by setting the attribute:

>>> port_generic.items = [
>>>     HxPortGeneric.GenericFloatTextEdit(value=12.0),
>>>     HxPortGeneric.GenericCheckBox(caption="caption check-box", checked=True),
>>>     HxPortGeneric.GenericRadioGroup(captions=['radio 1', 'radio 2', 'radio 3'], selected=1),
>>>     HxPortGeneric.GenericComboBox(elements=['choice 1', 'choice 2', 'choice 3', 'choice 4'], selected=1),
>>>     HxPortGeneric.GenericPushButton(caption="Generate", hit=True),
>>>     HxPortGeneric.GenericLabel(caption="My custom label"),
>>>     HxPortGeneric.GenericColorEdit(caption="colorcap", color=(1.0, 0.5, 1.0)),
>>>     HxPortGeneric.GenericTextEdit(text="SomeText")
>>> ]

Insert a push-button at the first position:

>>> port_generic.items.insert(0, HxPortGeneric.GenericPushButton())

Insert a label at the end:

>>> port_generic.items.append(HxPortGeneric.GenericLabel())

Remove the second widget:

>>> del port_generic.items[1]

Print the number of widgets contained in the port:

>>> print len(port_generic.items)
9

Replace the second widget by a text-edit:

>>> port_generic.items[1] = HxPortGeneric.GenericTextEdit()

Change the color of the seventh item (which is a color-box) to white:

>>> port_generic.items[6].color = (1.0, 1.0, 1.0)

Disable all widgets:

>>> for item in port_generic.items:
>>>     item.enabled = False
class hx.core.HxPortMultiMenu

Bases: _hx_core.__init__.HxPort

This class handles a port with a variable amount of combo-boxes (also called menus)

Each menu could be configured using the menus mutable sequence.

Attributes

is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
menus Mutable sequence of Menu interface provided by this port.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
tooltip String property bound to the tooltip shown in the GUI.
visible Boolean property indicating if port is shown or hidden.

Methods

get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
menus

Mutable sequence of Menu interface provided by this port.

Examples

Creates 3 menus:

>>> port_multi_menu.menus = [ HxPortButtonMenu.Menu(options=["Red", "Green", "Blue"]),
                              HxPortButtonMenu.Menu(options=["0", "1", "2", "3"], selected=2),
                              HxPortButtonMenu.Menu(options=["Ok", "Cancel", "Retry"], enabled=False)]

Now if we want to enable the third combo-box:

>>> port_multi_menu.menus[2].enabled = True

We can set all combo-box tooltip to the value “some tooltip”:

>>> for menu in port_multi_menu.menus:
        menu.tooltip = "some tooltip"

We can change the first combo-box entry:

>>> port_multi_menu.menus[0] = HxPortButtonMenu.Menu(options=["Violet", "Pink", "Grey"], selected=1, enabled=False)

We can add a combo-box in the second position:

>>> port_multi_menu.menus.insert(1, HxPortButtonMenu.Menu(options=["None", "12", "42"]))

And finally we can remove the last combo-box:

>>> del port_multi_menu.menus[3]
class hx.core.HxPortButtonMenu

Bases: _hx_core.__init__.HxPortButtonList

This class handles a port with a variable amount of buttons, and a variable amount of combo-boxes (also called menus)

Each button could be configured using the buttons mutable sequence.

Each menu could be configured using the menus mutable sequence.

Attributes

buttons Mutable sequence bound to all _HxPortButtonList_Button interfaces
is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
menus Mutable sequence of Menu interface provided by this port.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
tooltip String property bound to the tooltip shown in the GUI.
visible Boolean property indicating if port is shown or hidden.

Methods

Button This class is used to modify a button in an HxPortButtonList through its property.
Menu This class allows the user to modify a combo-box (also called a menu) by modifying its properties.
get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
class Menu

Bases: object

This class allows the user to modify a combo-box (also called a menu) by modifying its properties.

Attributes

enabled Boolean property bound to the fact the combo-box is activated or not.
options Mutable sequence off all options that could be selected in the combo-box.
selected Integer property bound to the index of the selected item in the combo-box.
tooltip String property bound to the tooltip being displayed in the combo-box.
enabled

Boolean property bound to the fact the combo-box is activated or not.

Examples

Instantiates an HxDisplayISL and retrieves its distribute port:

>>> display_isl = hx_project.create("HxDisplayISL")
>>> portButtonMenu = display_isl.ports.distribute

Now we can disable the first combo-box:

>>> portButtonMenu.menus[0].enabled = False

Now we can print the enabled status of the first combo-box:

>>> print portButtonMenu.menus[0].enabled
False
options

Mutable sequence off all options that could be selected in the combo-box.

Examples

Instantiates an HxDisplayISL and retrieves its distribute port:

>>> display_isl = hx_project.create("HxDisplayISL")
>>> portButtonMenu = display_isl.ports.distribute

Now we can define its selectable values:

>>> portButtonMenu.menus[0].options = ["Red", "Green", "Blue"]

If we want to print the second admissible value of the combo-box:

>>> print portButtonMenu.menus[0].options[1]
Green

We will now append a last element to the option list:

>>> portButtonMenu.menus[0].options.append("Black")

Inserts the element “Violet” just after “Green”:

>>> portButtonMenu.menus[0].options.insert(2, "Violet")

And finally removes the first element:

>>> del portButtonMenu.menus[0].options[0]

Now we can print all values:

>>> for option in portButtonMenu.menus[0].options:
>>>     print option
Green
Violet
Blue
Black
selected

Integer property bound to the index of the selected item in the combo-box.

Examples

Instantiates an HxDisplayISL and retrieves its distribute port:

>>> display_isl = hx_project.create("HxDisplayISL")
>>> portButtonMenu = display_isl.ports.distribute

Now we can select the second item of the first combo-box:

>>> portButtonMenu.menus[0].selected = 1

If we want to print the index of the selected element:

>>> print portButtonMenu.menus[0].selected
1
tooltip

String property bound to the tooltip being displayed in the combo-box.

Examples

Instantiates an HxDisplayISL and retrieves its distribute port:

>>> display_isl = hx_project.create("HxDisplayISL")
>>> portButtonMenu = display_isl.ports.distribute

Sets the tooltip of the first combo-box to “some tooltip”:

>>> portButtonMenu.menus[0].tooltip = "some tooltip"

Now we can print the tooltip of the first combo-box:

>>> print portButtonMenu.menus[0].tooltip
some tooltip
HxPortButtonMenu.menus

Mutable sequence of Menu interface provided by this port.

Examples

Creates 3 menus:

>>> port_button_menu.menus = [HxPortButtonMenu.Menu(options=["Red", "Green", "Blue"]),
                              HxPortButtonMenu.Menu(options=["0", "1", "2", "3"], selected=2),
                              HxPortButtonMenu.Menu(options=["Ok", "Cancel", "Retry"], enabled=False)]

Now if we want to enable the third combo-box:

>>> port_button_menu.menus[2].enabled = True

We can set all combo-box tooltip to the value “some tooltip”:

>>> for menu in port_button_menu.menus:
        menu.tooltip = "some tooltip"

We can change the first combo-box entry:

>>> port_button_menu.menus[0] = HxPortButtonMenu.Menu(options=["Violet", "Pink", "Grey"], selected=1, enabled=False)

We can add a combo-box in the second position:

>>> port_button_menu.menus.insert(1, HxPortButtonMenu.Menu(options=["None", "12", "42"]))

And finally we can remove the last combo-box:

>>> del port_button_menu.menus[3]
class hx.core.HxPortMultiOptions

Bases: _hx_core.__init__.HxPort

Provides multiple checkable options. These options are displayed as a list view.

Each option item has a text and an associated check state which can be set using the options mutable sequence.

A tooltip for all options could be given with the property tooltip.

Attributes

is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
name String property bound to the port name (how it is accessed in Tcl).
options Mutable Sequence of Option instances allowing to settle all Option instances contained in this port:
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
tooltip String property bound to the tooltip being displayed by all options.
visible Boolean property indicating if port is shown or hidden.

Methods

Option This class provides allows the user to settle a check-box by accessing all properties.
get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
class Option

Bases: object

This class provides allows the user to settle a check-box by accessing all properties.

Attributes

checked Boolean property bound to the fact the option is checked or not.
enabled Boolean property bound to the fact the option is editable in the Gui.
label String property bound to the label being displayed in the Gui for this option.
checked

Boolean property bound to the fact the option is checked or not.

Examples

Check all options or the port:

>>> for option in port_multi_options.options:
>>>     option.checked = True`

Print if the first option is checked:

>>> print port_multi_options.options[0].checked
True
enabled

Boolean property bound to the fact the option is editable in the Gui.

Examples

Set the first option as uneditable in the Gui:

>>> port_multi_options.options[0].enabled = False

Print if the first option is editable in the Gui.

>>> print port_multi_options.options[0].enabled
False
label

String property bound to the label being displayed in the Gui for this option.

Examples

Set the label of the first option to ‘SomeLabel’:

>>> port_multi_options.options[0].label = 'SomeLabel'

Print the label of the first option:

>>> print port_multi_options.options[0].label
SomeLabel
HxPortMultiOptions.options

Mutable Sequence of Option instances allowing to settle all Option instances contained in this port:

Examples

Set the port port_multi_options with two options:

>>> port_multi_options.options = [HxPortMultiOptions.Option(label='Option1'), HxPortMultiOptions.Option(label='Option2')]
>>> print len(port_multi_options.options)
2

Now set all options of the port unchecked:

>>> for option in port_multi_options.options:
>>>     option.checked = False

We could insert an option in the first position:

>>> port_multi_options.options.insert(0, HxPortMultiOptions.Option(label='Option0'))
>>> print port_multi_options.options[0].label
Option0

We could delete the first option too:

>>> del port_multi_options.options[0]
>>> print port_multi_options.options[0].label
Option1
HxPortMultiOptions.tooltip

String property bound to the tooltip being displayed by all options.

Examples

Set the tooltip of an HxPortMultiOptions instance called port_multi_options:

>>> port_multi_options.tooltip = "Tooltip"

Now, print the tooltip of the port:

>>> print port_multi_options.tooltip
Tooltip
class hx.core.HxPortRadioBox

Bases: _hx_core.__init__.HxPort

This port handles a variable quantity of radio-box in which only one could be selected. Each radio-box could be set a label.

Access to radio-boxes is provided by the mutable sequence property radio_boxes.

Attributes

is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
radio_boxes Mutable sequence of RadioBox interfaces.
selected Integer property bound to the index of the selected radio-box.
tooltip String property bound to the tooltip shown in the GUI.
visible Boolean property indicating if port is shown or hidden.

Methods

RadioBox This class allows the user to modify a radio-box in particular of a port HxPortRadioBox by modifying its properties.
get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
class RadioBox

Bases: object

This class allows the user to modify a radio-box in particular of a port HxPortRadioBox by modifying its properties.

Attributes

enabled Boolean property bound to the fact the radio-box is editable.
label String property bound to the label displayed after the radio-box.
tooltip String property bound to the tooltip displayed when mouse if over the radio-box.
enabled

Boolean property bound to the fact the radio-box is editable.

Examples

Creates an HxArithmetic module and retrieve its resultType port:

>>> arith = hx_project.create('HxArithmetic')
>>> port_radiobox = arith.ports.resultType

Sets the first radio-box uneditable:

>>> port_radiobox.radio_boxes[0].enabled = False

Prints the ‘editability-status’ of the first radio-box:

>>> print port_radiobox.radio_boxes[0].enabled
False
label

String property bound to the label displayed after the radio-box.

Examples

Creates an HxArithmetic module and retrieve its resultType port:

>>> arith = hx_project.create('HxArithmetic')
>>> port_radiobox = arith.ports.resultType

Sets the label of the first radio-box to “this is a label”:

>>> port_radiobox.radio_boxes[0].label = "this is a label"

Prints the label of the first radio-box:

>>> print port_radiobox.radio_boxes[0].label
this is a label
tooltip

String property bound to the tooltip displayed when mouse if over the radio-box.

Examples

Creates an HxArithmetic module and retrieve its resultType port:

>>> arith = hx_project.create('HxArithmetic')
>>> port_radiobox = arith.ports.resultType

Sets the tooltip of the first radio-box to “this is a tooltip”:

>>> port_radiobox.radio_boxes[0].tooltip = "this is a tooltip"

Prints the label of the first radio-box:

>>> print port_radiobox.radio_boxes[0].tooltip
this is a tooltip
HxPortRadioBox.radio_boxes

Mutable sequence of RadioBox interfaces.

Examples

Creates an HxArithmetic module and retrieve its resultType port:

>>> arith = hx_project.create('HxArithmetic')
>>> port_radiobox = arith.ports.resultType

Instantiates 5 different radio-boxes:

>>> port_radiobox.radio_boxes = [HxPortRadioBox.RadioBox(label="option 1"),
                                 HxPortRadioBox.RadioBox(label="option 2"),
                                 HxPortRadioBox.RadioBox(label="option 3"),
                                 HxPortRadioBox.RadioBox(label="option 4"),
                                 HxPortRadioBox.RadioBox(label="option 5")]

Disables the second radio-box:

>>> port_radiobox.radio_boxes[1].enabled = False

Inserts a new radio-box in second position:

>>> port_radiobox.radio_boxes.insert(1, HxPortRadioBox.RadioBox(label="option 1.5"))
>>> print port_radiobox.radio_boxes[1].label
option 1.5

Removes the newly created radio-box:

>>> del port_radiobox.radio_boxes[1]

Prints the label of each radio:

>>> for radiobox in port_radiobox.radio_boxes:
>>>     print radiobox.label
option 1
option 2
option 3
option 4
option 5
HxPortRadioBox.selected

Integer property bound to the index of the selected radio-box.

Examples

Selects the 4th item of port_radiobox:

>>> port_radiobox.selected = 3

Prints the label of the selected item:

>>> print port_radiobox.radio_boxes[port_radiobox.selected].label
option 4
class hx.core.HxPortText

Bases: _hx_core.__init__.HxPort

This class represents a port with a text edit widget allowing the user to enter some text.

Attributes

column_qty Integer property bound to the width of the edit box in character unit.
editable Boolean property bound to the fact the edit text is editable or not.
is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
text String property bound to the text present in the text edit widget.
tooltip String property bound to the tooltip shown in the GUI.
visible Boolean property indicating if port is shown or hidden.

Methods

get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
column_qty

Integer property bound to the width of the edit box in character unit.

Examples

Creates an HxAnnotation and sets its port text to be 12 characters wide:

>>> annotation = hx_project.create('HxAnnotation')
>>> portText = annotation.ports.text
>>> portText.column_qty = 12

Now we can print the width of the edit box:

>>> print portText.column_qty
12
editable

Boolean property bound to the fact the edit text is editable or not.

Examples

Creates an HxAnnotation and sets its port text to be uneditable:

>>> annotation = hx_project.create('HxAnnotation')
>>> portText = annotation.ports.text
>>> portText.editable = False

Now we can print the editability-status of the port:

>>> print portText.editable
False
text

String property bound to the text present in the text edit widget.

Examples

Creates an HxAnnotation and sets its port text to contain the value “some example string”:

>>> annotation = hx_project.create('HxAnnotation')
>>> portText = annotation.ports.text
>>> portText.text = "some example string"

Now we can print the content of the port:

>>> print portText.text
some example string
class hx.core.HxPortTextEdit

Bases: _hx_core.__init__.HxPort

This class represents a port with a text edit widget allowing the user to enter a multi-line text.

Attributes

column_qty Integer property bound to the width of the edit box in character unit.
editable Boolean property bound to the fact the edit text is editable or not.
is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
row_qty Integer property bound to the height of the edit box in character unit.
selection Read-only string property bound to the text being selected by the user in the text edit widget.
text String property bound to the text present in the text edit widget.
tooltip String property bound to the tooltip shown in the GUI.
visible Boolean property indicating if port is shown or hidden.

Methods

get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
column_qty

Integer property bound to the width of the edit box in character unit.

Examples

Creates an HxIvScene and sets its port text to be 12 characters wide:

>>> ivscene = hx_project.create('HxIvScene')
>>> portText = ivscene.ports.text
>>> portText.column_qty = 12

Now we can print the width of the edit box:

>>> print portText.column_qty
12
editable

Boolean property bound to the fact the edit text is editable or not.

Examples

Creates an HxIvScene and sets its port text to be uneditable:

>>> ivscene = hx_project.create('HxIvScene')
>>> portText = ivscene.ports.text
>>> portText.editable = False

Now we can print the editability-status of the port:

>>> print portText.editable
False
row_qty

Integer property bound to the height of the edit box in character unit.

Examples

Creates an HxIvScene and sets its port text to have a height of 12 characters:

>>> ivscene = hx_project.create('HxIvScene')
>>> portText = ivscene.ports.text
>>> portText.row_qty = 12

Now we can print the height of the edit box:

>>> print portText.row_qty
12
selection

Read-only string property bound to the text being selected by the user in the text edit widget.

text

String property bound to the text present in the text edit widget.

Examples

Creates an HxIvScene and sets its port text to contain the value “some example string”:

>>> ivscene = hx_project.create('HxIvScene')
>>> portText = ivscene.ports.text
>>> portText.text = "some example string"

Now we can print the content of the port:

>>> print portText.text
some example string
class hx.core.HxPortToggleList

Bases: _hx_core.__init__.HxPort

This port handles a variable amount of toggles (check-box) that could be modified by the Toggle mutable sequence member toggles.

Attributes

is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
toggles Mutable sequence of Toggle interface.
tooltip String property bound to the tooltip shown in the GUI.
visible Boolean property indicating if port is shown or hidden.

Methods

Toggle This interface allows to modify a toggle list (check-box) in particular of the port through its properties.
get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
class Toggle

Bases: object

This interface allows to modify a toggle list (check-box) in particular of the port through its properties.

Attributes

checked Enumerated property bound to the fact the check-box has a third state (half-checked or partially checked).
enabled Boolean property bound to the fact the check-box is enabled (editable).
is_tristate Boolean property bound to the fact the check-box has a third state (half-checked or
label String property bound to the label displayed after the check-box.
tooltip String property bound to the tooltip displayed when mouse is over the check-box.
visible Boolean property bound to the fact the check-box is visible.
checked

Enumerated property bound to the fact the check-box has a third state (half-checked or partially checked). Take its value in HxPortToggleList.Toggle.CHECKED, HxPortToggleList.Toggle.UNCHECKED, HxPortToggleList.Toggle.PARTIALLY_CHECKED.

Notes

In order to set the checked property of a check-box to HxPortToggleList.Toggle.PARTIALLY_CHECKED, its is_tristate property must be set to True.

Examples

Creates an HxConvolution and retrieves its port options:

>>> conv = hx_project.create('HxConvolution')
>>> port_toggle_list = conv.ports.options

Modifies the first check-box to make it a tristate one:

>>> port_toggle_list.toggles[0].is_tristate = True

Sets the first check-box partially_checked:

>>> port_toggle_list.toggles[0].checked = HxPortToggleList.Toggle.PARTIALLY_CHECKED
enabled

Boolean property bound to the fact the check-box is enabled (editable).

Examples

Creates an HxConvolution and retrieves its port options:

>>> conv = hx_project.create('HxConvolution')
>>> port_toggle_list = conv.ports.options

Disables the first check-box:

>>> port_toggle_list.toggles[0].enabled = False

Prints the enabled status of the first check-box:

>>> print port_toggle_list.toggles[0].enabled
False
is_tristate

Boolean property bound to the fact the check-box has a third state (half-checked or partially checked)

Examples

Creates an HxConvolution and retrieves its port options:

>>> conv = hx_project.create('HxConvolution')
>>> port_toggle_list = conv.ports.options

Modifies the first check-box to make it a tristate one:

>>> port_toggle_list.toggles[0].is_tristate = True

Prints the tristate status of the first check-box:

>>> print port_toggle_list.toggles[0].is_tristate
True
label

String property bound to the label displayed after the check-box.

Examples

Creates an HxConvolution and retrieves its port options:

>>> conv = hx_project.create('HxConvolution')
>>> port_toggle_list = conv.ports.options

Sets the label of the first check-box to “discard null value”:

>>> port_toggle_list.toggles[0].label = "discard null value"

Prints the label of the first check-box:

>>> print port_toggle_list.toggles[0].label
discard null value
tooltip

String property bound to the tooltip displayed when mouse is over the check-box.

Examples

Creates an HxConvolution and retrieves its port options:

>>> conv = hx_project.create('HxConvolution')
>>> port_toggle_list = conv.ports.options

Sets the tooltip of the first check-box to “Some helpful tooltip”:

>>> port_toggle_list.toggles[0].tooltip = "Some helpful tooltip"

Prints the tooltip of the first check-box:

>>> print port_toggle_list.toggles[0].tooltip
Some helpful tooltip
visible

Boolean property bound to the fact the check-box is visible.

Examples

Creates an HxConvolution and retrieves its port options:

>>> conv = hx_project.create('HxConvolution')
>>> port_toggle_list = conv.ports.options

Hides the first check-box:

>>> port_toggle_list.toggles[0].visible = False

Prints the visibility status of the first check-box:

>>> print port_toggle_list.toggles[0].visible
False
HxPortToggleList.toggles

Mutable sequence of Toggle interface. (Check-box)

Examples

Lets suppose port_toggle_list is an instance of HxPortToggleList. We can create 3 check-boxes:

>>> port_toggle_list.toggles = [HxPortToggleList.Toggle(label="discard NaN"),
                                HxPortToggleList.Toggle(label="option 2"),
                                HxPortToggleList.Toggle(label="discard voxel size")]

Now we can disable the third check-box:

>>> port_toggle_list.toggles[2].enabled = False

We can check all check-boxes:

>>> for toggle in port_toggle_list.toggles:
        toggle.checked = HxPortToggleList.Toggle.CHECKED

Now we want to redefine the first check-box:

>>> port_toggle_list.toggles[0] = HxPortToggleList.Toggle(label="create output", checked=HxPortToggleList.Toggle.CHECKED)
class hx.core.HxPortText

Bases: _hx_core.__init__.HxPort

This class represents a port with a text edit widget allowing the user to enter some text.

Attributes

column_qty Integer property bound to the width of the edit box in character unit.
editable Boolean property bound to the fact the edit text is editable or not.
is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
text String property bound to the text present in the text edit widget.
tooltip String property bound to the tooltip shown in the GUI.
visible Boolean property indicating if port is shown or hidden.

Methods

get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
column_qty

Integer property bound to the width of the edit box in character unit.

Examples

Creates an HxAnnotation and sets its port text to be 12 characters wide:

>>> annotation = hx_project.create('HxAnnotation')
>>> portText = annotation.ports.text
>>> portText.column_qty = 12

Now we can print the width of the edit box:

>>> print portText.column_qty
12
editable

Boolean property bound to the fact the edit text is editable or not.

Examples

Creates an HxAnnotation and sets its port text to be uneditable:

>>> annotation = hx_project.create('HxAnnotation')
>>> portText = annotation.ports.text
>>> portText.editable = False

Now we can print the editability-status of the port:

>>> print portText.editable
False
text

String property bound to the text present in the text edit widget.

Examples

Creates an HxAnnotation and sets its port text to contain the value “some example string”:

>>> annotation = hx_project.create('HxAnnotation')
>>> portText = annotation.ports.text
>>> portText.text = "some example string"

Now we can print the content of the port:

>>> print portText.text
some example string
class hx.core.HxPortBox3D

Bases: _hx_core.__init__.HxPort

Port for selecting an axis aligned 3D box.

Attributes

bounding_box Pair of triplets of float representing the 3D box being edited by this port.
is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
tooltip String property bound to the tooltip shown in the GUI.
visible Boolean property indicating if port is shown or hidden.

Methods

get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
bounding_box

Pair of triplets of float representing the 3D box being edited by this port.

Examples

Set the bounding-box to (0, 0, 0) to (1, 2, 3):

>>> port_3D_box.bounding_box = ((0, 0, 0), (1, 2, 3))

Now print the bounding-box holds by this port:

>>> print port_3D_box.bounding_box
((0.0, 0.0, 0.0), (1.0, 2.0, 3.0))
class hx.core.HxPortColormap

Bases: _hx_core.__init__.HxConnection

This port is used to select a colormap and define a range of usage for this colormap. This range could be local (only the owner of this port is impacted by the selected range in the port) or global (if the range of the colormap itself is changed, it modifies potentially several modules).

It is also possible to define a constant color instead of a classic colormap.

Attributes

auto_adjust_range Boolean property bound to the fact the port will adjust its range to the data window automatically at data connection.
connected Read-only boolean property bound to the fact this port is connected to something.
default_alpha Float property bound to the opacity value of the constant color when no colormap is connected.
default_color Color property bound to the default color used when no colormap is connected to this port.
editable Boolean property bound to the fact the user can modify the port connection in the Gui.
global_range Pair of floats property bound to the global range of the port (i.e.
has_alpha_toggle Boolean property indicating if a button is present in the Gui that permits the user to modify the use_alpha property.
is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
local_range Pair of floats property bound to the local range of the port.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
range Pair of floats property bound to local_range or to global_range whether use_local_range is set or not.
tooltip String property bound to the tooltip shown in the GUI.
use_alpha Boolean property indicating if the port uses the alpha value from the attached colormap or if the color should be considered as opaque.
use_local_range Boolean property bound to the fact the port uses a local range or a global range.
valid_types Property bound to the list of all admissible types for this port connection.
visible Boolean property indicating if port is shown or hidden.

Methods

adjust_range() Method that adjusts the range of the port according to data min-max computed by Intensity Range Partitioning.
connect(obj) Connects this port to the object obj
disconnect() Disconnects this port.
get_color(value) Get the corresponding color at value defined by value according to the current range of the colormap.
get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
source() Retrieves the object that is connected to this port.
unlink(another_port) Method that removes the interconnection on this port.
adjust_range()

Method that adjusts the range of the port according to data min-max computed by Intensity Range Partitioning.

Examples

Load chocolate-bar.am, attach an orthoslice and set the range of its colormap ports to (0.0, 255.0):

>>> dataLoaded = hx_project.load(hx_paths.tutorials_dir+'/chocolate-bar.am')
>>> ortho = hx_project.create('HxOrthoSlice')
>>> ortho.ports.data.connect(dataLoaded)
>>> ortho.fire()
>>> ortho.ports.colormap.range = (0.0, 255.0)
>>> ortho.fire()

Now we want to adjust range to the data, and print this range:

>>> ortho.ports.colormap.adjust_range()
>>> print ortho.ports.colormap.range
(410.0, 1910.0)
auto_adjust_range

Boolean property bound to the fact the port will adjust its range to the data window automatically at data connection.

Examples

Load chocolate-bar.am create an orthoslice, set the range of its colormap ports to (0.0, 255.0) and activate the port auto_adjust_range:

>>> dataLoaded = hx_project.load(hx_paths.tutorials_dir+'/chocolate-bar.am')
>>> ortho = hx_project.create('HxOrthoSlice')
>>> ortho.ports.colormap.range = (0.0, 255.0)
>>> ortho.ports.colormap.auto_adjust_range = True

Now we connect dataLoaded to ortho and print the colormap range:

>>> ortho.ports.data.connect(dataLoaded)
>>> print ortho.ports.colormap.range
(0.0, 1910.0)

Now we disconnect dataLoaded from ortho, set the range to (-100.0, 100.0), disable the auto_adjust_range and reconnect dataLoaded to ortho:

>>> ortho.ports.data.disconnect()
>>> ortho.ports.colormap.range = (-100.0, 100.0)
>>> ortho.ports.colormap.auto_adjust_range = False
>>> ortho.ports.data.connect(dataLoaded)
>>> print ortho.ports.colormap.range
(-100.0, 100.0)
default_alpha

Float property bound to the opacity value of the constant color when no colormap is connected. (alpha value must be in range 0.0 to 1.0)

Examples

Set the default alpha value to 0.5:

>>> ortho.ports.colormap.default_alpha = 0.5

Print the default alpha value of the port:

>>> print ortho.ports.colormap.default_alpha
0.5
default_color

Color property bound to the default color used when no colormap is connected to this port.

Examples

Set the default color of the port to red:

>>> ortho.ports.colormap.default_color = (1.0, 0.0, 0.0)

Print the default color of the port:

>>> print ortho.ports.colormap.default_color
(1.0, 0.0, 0.0)
get_color(value)

Get the corresponding color at value defined by value according to the current range of the colormap.

Parameters:

value : float

Value for which we want to retrieve the corresponding color.

Examples

Create an HxOrthoSlice connected on a chocolate-bar.am:

>>> dataLoaded = hx_project.load(hx_paths.tutorials_dir+"/chocolate-bar.am")
>>> ortho = hx_project.create('HxOrthoSlice')
>>> ortho.ports.data.connect(dataLoaded)
>>> ortho.fire()

Set the range of the colormap to (0.0, 255.0) and retrieve the color corresponding to the value 12.0:

>>> ortho.ports.colormap.range = (0.0, 255.0)
>>> print ortho.ports.colormap.get_color(12.0)
(0.046873558312654495, 0.046873558312654495, 0.046873558312654495)
global_range

Pair of floats property bound to the global range of the port (i.e. the range of the colormap itself).

Examples

Set the global range of the port to (0.0, 255.0):

>>> ortho.ports.colormap.global_range = (0.0, 255.0)

Print the local range of the port:

>>> print ortho.ports.colormap.global_range
(0.0, 255.0)
has_alpha_toggle

Boolean property indicating if a button is present in the Gui that permits the user to modify the use_alpha property.

Examples

Make the alpha toggle button visible:

>>> ortho.ports.colormap.has_alpha_toggle = True

Display if the alpha toggle is visible or not:

>>> print ortho.ports.colormap.has_alpha_toggle
True
local_range

Pair of floats property bound to the local range of the port.

Examples

Set the local range of the port to (0.0, 127.0):

>>> ortho.ports.colormap.local_range = (0.0, 127.0)

Print the local range of the port:

>>> print ortho.ports.colormap.local_range
(0.0, 127.0)
range

Pair of floats property bound to local_range or to global_range whether use_local_range is set or not.

Examples

Set the range of the port to (12.0, 100.0):

>>> ortho.ports.colormap.range = (12.0, 100.0)

Print the range of the port:

>>> print ortho.ports.colormap.range
(12.0, 100.0)

Change the right value of the range to 200.0:

>>> ortho.ports.colormap.range[1] = 200.0

Print the range of the port:

>>> print ortho.ports.colormap.range
(12.0, 200.0)
use_alpha

Boolean property indicating if the port uses the alpha value from the attached colormap or if the color should be considered as opaque.

Examples

Set the port colormap as using the alpha value of the connected colormap:

>>> ortho.ports.colormap.use_alpha = True

Print if the alpha value of the colormap is retrieved when fetching a color with this port:

>>> print ortho.ports.colormap.use_alpha
True
use_local_range

Boolean property bound to the fact the port uses a local range or a global range. If set to True the property range will be bound to the property local_range otherwise it will be bound to the property global_range.

Set the port to be working in local range, and set its local range to (0.0, 1.0):

>>> ortho.ports.colormap.use_local_range = True
>>> ortho.ports.colormap.local_range = (0.0, 1.0)

Print the range of the port which should be its local range now:

>>> print ortho.ports.colormap.range
(0.0, 1.0)
class hx.core.HxPortLabelMeasure

Bases: _hx_core.__init__.HxPort

This port aims to choose and edit a label measure.

Attributes

is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
measure_name string property bound to the name of the measure selected by this port.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
tooltip String property bound to the tooltip shown in the GUI.
visible Boolean property indicating if port is shown or hidden.

Methods

get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
measure_name

string property bound to the name of the measure selected by this port.

Raises:ValueError : This exception is raised when setting this property to an unknown measure name.

Examples

Set current measure to ‘Area3d’:

>>> port_label_measure.measure_name = 'Area3d'

Print current measure:

>>> print port_label_measure.measure_name
Area3d
class hx.core.HxPortLabelMeasureGroup

Bases: _hx_core.__init__.HxPort

This port aims to choose and edit a group of label measures.

Attributes

is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
measure_group_name string property bound to the name of the group of measures selected by this port.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
tooltip String property bound to the tooltip shown in the GUI.
visible Boolean property indicating if port is shown or hidden.

Methods

get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
measure_group_name

string property bound to the name of the group of measures selected by this port.

Raises:ValueError : This exception is raised when setting this property to an unknown measure group name.

Examples

Set current measure to ‘basic’:

>>> port_label_measure_group.measure_group_name = 'basic'

Print current measure group name:

>>> print port_label_measure_group.measure_group_name
basic
class hx.core.HxPortRangeSlider

Bases: _hx_core.__init__.HxPort

This class represents a floating point range that can be edited with a slider and 2 tab stops.

Examples

Instantiate an HxInteractiveThreshold module and retrieve its port intensityRange:

>>> int_threshold = hx_project.create('HxInteractiveThreshold')
>>> port_rs = int_threshold.ports.intensityRange

Set the values of intensityRange to (10.0, 200.0)

>>> port_rs.range = (10.0, 200.0)

Attributes

clamp_range Pair of floats property bound to the range in which the user selected range must fit.
clamped Boolean property bound to the fact the user settable range must fit in the clamp range or not.
discrete Boolean property bound to the fact the user settable range must take integer values or not.
enabled Boolean property bound to the fact the Gui is user editable or not.
has_edit_button Boolean property bound to the fact the edit button in the Gui is displayed or not.
is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
range Pair of floats property bound to the range selected by the user in the Gui.
tooltip String property bound to the tooltip shown in the GUI.
tracking Boolean property bound to the fact the owner of this port is notify when slider is being modified.
visible Boolean property indicating if port is shown or hidden.
window_range Pair of floats property bound to the range displayed in the slider’s Gui.

Methods

get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
clamp_range

Pair of floats property bound to the range in which the user selected range must fit. This property is active only if property clamped is set to True. If user range do not fit, it will be truncated.

Examples

Set the user range to (0.0, 50.0), then activate clamping, finally set the clamp_range range to (10.0, 100.0):

>>> port_rs.range = (0.0, 50.0)
>>> port_rs.clamped = True
>>> port_rs.clamp_range = (10.0, 100.0)

Print the clamp range:

>>> print port_rs.clamp_range
(10.0, 100.0)

We do have what we should expect, now print the user range:

>>> print port_rs.range
(10.0, 50.0)

See how the clamp range has affected retroactively the user settable range!

clamped

Boolean property bound to the fact the user settable range must fit in the clamp range or not.

Examples

Set the clamp range to (20.0, 100.0):

>>> port_rs.clamp_range = (20.0, 100.0)

No deactivate clamping:

>>> port_rs.clamped = False

Set user settable range to (0.0, 200.0):

>>> port_rs.range = (0.0, 200.0)

Now if we print the range we have set:

>>> print port_rs.range
(0.0, 200.0)

See how the user settable range has not been clamped to range (20.0, 100.0)!

discrete

Boolean property bound to the fact the user settable range must take integer values or not.

Examples

Set the port in discrete mode:

>>> port_rs.discrete = True

Now set the user settable range to (0, 12.2)

>>> port_rs.range = (0, 12.2)

Now print the user settable range:

>>> print port_rs.range
(0.0, 12.0)

See how the right boundary has been modified to fit the nearest integer!

enabled

Boolean property bound to the fact the Gui is user editable or not. If this value is set to False, the user could not modify the value in the Gui anymore; therefore values are still modifiable in Python.

Examples

Disable the port:

>>> port_rs.enabled = False`

Print the enabled-status of the port:

>>> print port_rs.enabled
False
has_edit_button

Boolean property bound to the fact the edit button in the Gui is displayed or not. This button is responsible from letting the user select different ranges.

Examples

Hide the edit button:

>>> port_rs.has_edit_button = False

Print if the port exhibits edit button:

>>> print port_rs.enabled
False
range

Pair of floats property bound to the range selected by the user in the Gui.

Examples

Set the range of port_rs to (10.0, 200.0):

>>> port_rs.range = (10.0, 200.0)

Prints the range value of port_rs:

>>> print port_rs.range
(10.0, 200.0)
tracking

Boolean property bound to the fact the owner of this port is notify when slider is being modified.

Examples

Set the slider in tracking mode:

>>> port_rs.tracking = True

Print if the slider is tracking:

>>> print port_rs.tracking
True
window_range

Pair of floats property bound to the range displayed in the slider’s Gui. Notice that the displayed range must contains the user settable range.

Examples

Set the user settable range to (50.0, 100.0) and the window range to (30.0, 200.0)

>>> port_rs.range = (50.0, 100.0)
>>> port_rs.window_range = (30.0, 200.0)

Now if we print the window range:

>>> print port_rs.window_range
(30.0, 200.0)

Now set the user settable range to (10.0, 150.0) and print the window range:

>>> port_rs.range = (10.0, 150.0)
>>> print port_rs.window_range
(5.0, 200.0)

See how the left boundary has been modified by modifying the user settable range!

class hx.core.HxPortScript

Bases: _hx_core.__init__.HxPort

This port is used by Tcl script object in order to select a Tcl script-object file and start it. It is composed of an editable text box and a button.

Attributes

button_label String property bound to the label displayed in the button.
filename String property bound to the filename of the script-object to execute
is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
tooltip String property bound to the tooltip shown in the GUI.
visible Boolean property indicating if port is shown or hidden.

Methods

get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.
button_label

String property bound to the label displayed in the button.

Examples

Set the label displayed in the button to ‘Launch now!’:

>>> port_script.button_label = 'Launch now!'

Print the filename of the label displayed in the button:

>>> print port_script.button_label
Launch now!
filename

String property bound to the filename of the script-object to execute

Examples

Set the current script-object to ‘C:MyFolderMyScriptObject.scro’:

>>> port_script.filename = 'C:\MyFolder\MyScriptObject.scro'

Print the filename of the current script-object:

>>> print port_script.filename
'C:\MyFolder\MyScriptObject.scro'
class hx.core.HxPortSeparator

Bases: _hx_core.__init__.HxPort

This class handle a port that does nothing but acting as a separator for other ports in the Gui.

Examples

Create an HxFftFilter and retrieve its separator:

>>> FFT = hx_project.create('HxFftFilter')
>>> port_separator = FFT.ports.separatorSpotFilter

Attributes

is_new Boolean property bound to the fact the port has been touched since last fire.
label String property bound to the label shown for this port in the GUI.
name String property bound to the port name (how it is accessed in Tcl).
pinned Boolean property bound to the fact the port is pinned.
position Integer property bound to the position of this port in the port list of its HxBase owner.
tooltip String property bound to the tooltip shown in the GUI.
visible Boolean property indicating if port is shown or hidden.

Methods

get_owner() This function returns the object that owns the port.
link(another_port) Method that mades an interconnection with another_port.
unlink(another_port) Method that removes the interconnection on this port.

Useful interfaces

class hx.core.HxSpreadSheetInterface

Bases: _hx_core.__init__.McInterface

This interface defines the behavior of a spreadsheet in the product. A spreadsheet contains one or several tables, each table is composed of a set of columns and rows. Each Column is associated to a data type (string, float, integer).

Examples

Retrieve an HxSpreadSheetInterface on an HxSpreadSheet.

>>> ss = hx_project.create('HxSpreadSheet')
>>> ssi = ss.all_interfaces.HxSpreadSheetInterface

Attributes

all_interfaces Attribute that contains all admissible interfaces as sub-members.
tables Sequence of Table instances contained in the spreadsheet.

Methods

Column This class represents a column of a Table instance.
Row This class represents a row of a Table instance.
Table A Table is composed of a set of columns and rows.
get_all_interface_names() Returns the list of all supported interfaces names.
class Column

Bases: object

This class represents a column of a Table instance.

Attributes

name String property bound to the name of the column.
typename String property bound to the name of the type of the column.
name

String property bound to the name of the column. Depending on the HxSpreadSheetInterface instance, this property may be a read-only one.

Examples

Print the name of the second column of the first table:

>>> print ssi.tables[0].columns[1].name
Description
typename
String property bound to the name of the type of the column. It could be:
  • ‘string’ for a column storing string values.
  • ‘int’ for a column storing integer values.
  • ‘float’ for a column storing floating point numbers.

Please notice that depending on the HxSpreadSheetInterface instance, this property may be read-only.

Examples

Print the type name of the second column of the first table:

>>> print ssi.tables[0].columns[1].typename
string
class HxSpreadSheetInterface.Row

Bases: object

This class represents a row of a Table instance.

Attributes

items Sequence of elements contained in the row.
items

Sequence of elements contained in the row.

Examples

Set the value of the second element of the first row to 12.0 given the fact the second column accepts floats:

>>> ssi.tables[0].row[0].items[1] = 12.0

Notice that this code is equivalent to:

>>> ssi.tables[0].items[0, 1] = 12.0

Now print the value of the second element of the first row:

>>> print ssi.tables[0].row[0].items[1]
12.0
class HxSpreadSheetInterface.Table

Bases: object

A Table is composed of a set of columns and rows. Each Column is associated to a data type (string, float, integer).

Attributes

columns Mutable sequence of all the columns contained in a Table.
items Property indexed by a pair of integer to access elements of the spreadsheet’s table.
name String property bound to the name of the Table.
rows Mutable sequence of all the rows contained in a Table.
columns

Mutable sequence of all the columns contained in a Table.

Notice that not all instances of HxSpreadSheetInterface do follow the Mutable sequence paradigm for this attribute.

Examples

Print the type of the first column of the first table:

>>> print ssi.tables[0].columns[0].typename
float

Add a column containing integer values:

>>> ssi.tables[0].columns.append(HxSpreadSheetInterface.Column(name='Some kind of Id', typename='int'))
items

Property indexed by a pair of integer to access elements of the spreadsheet’s table. The pair of float indexing the cells are 0 based and row comes first.

Notice that the type of the content is defined by the column. (All items of a given column share the same type.)

Examples

Set content of the cell on the second row and in the third column to float value 12.0:

>>> ssi.tables[0].items[1, 2] = 12.0

Print content of the cell on the second row and in the third column:

>>> print ssi.tables[0].items[1, 2]
12.0
name

String property bound to the name of the Table.

rows

Mutable sequence of all the rows contained in a Table.

Notice that not all instances of HxSpreadSheetInterface do follow the Mutable sequence paradigm for this attribute.

Examples

Let suppose our first table contains two columns, the first being an integer one, and the second a string one. We will insert in the first row some values:

>>> ssi.tables[0].rows.insert(0, HxSpreadSheetInterface.Row(items=(42, 'some useful description')))

Now print the content of the first row

>>> ssi.tables[0].rows[0].items
(42, 'some useful description')
HxSpreadSheetInterface.tables

Sequence of Table instances contained in the spreadsheet.

Examples

Print the number of tables contained in the HxSpreadSheetInterface ssi:

>>> print len(ssi.tables)
1

Print the name of the first table contained in the HxSpreadSheetInterface ssi:

>>> print ssi.tables[0].name
None

Python Script Object base class

class hx.core.PyScriptObject

Bases: _hx_core.__init__.HxCompModule

This class must be inherited in order to create a new Python Script Object.

To implement the behavior of the new module, the user must redefines the 3 methods:

  • __init__()
  • compute()
  • update()

Attributes

all_interfaces Attribute that contains all admissible interfaces as sub-members.
apply_transform_to_result Boolean property bound to the fact the module copy the transform (the object to world matrix) of its source (input) to all its results.
can_be_renamed Boolean property bound to the fact the object could be renamed by user in the GUI.
data Read-only property bound to the object connected to the data port of this module.
downstream_connections Read-only property bound to the sequence of all port HxConnection targeting this object.
icon_color Read-only property bound to the color of the icon of the object in the project view.
icon_position Pair of int property bound to the position of the icon of the object in the project view
icon_visible Boolean property bound to the fact the icon of the object is visible in the project view.
is_geometry_clipped Read-only boolean property bound to the fact the geometry is clipped.
name String property bound to the name of this object displayed in the application Gui.
need_saving Boolean property bound to the fact the object needs to be saved on project saving.
portnames Read-only list of all ports names owned by this object.
ports This members contains all ports of an object.
removable Boolean property bound to the fact the object could be removed from project by user in the GUI.
results Mutable sequence of HxData property that represents all the results of a compute module.
selected Boolean property bound to the fact the object is selected in the project view.
viewer_mask Integer property bound to the mask applied to the object that trigger its visibility in all viewers.

Methods

clip_geometry(self, planar_mod, inverted) Clips the geometry of this object regarding the plane defined by planar_mod
compute() This method performs computation.
create_doc_file() Method that creates the .tex help file associated to the object.
create_port_snaps() Method that takes snapshot of all ports of the object.
duplicate() Method that performs a copy of this object and returns the newly created object.
execute() This method will simulate a click on the green apply button under the property area of this object, and performs a `fire`() on this object.
fire() This method will trigger a call to update() on the object and eventually a compute() if this is a computational module and if its port doIt has been touched or if auto-refresh is activated.
get_all_interface_names() Returns the list of all supported interfaces names.
is_same_object(other_obj) Returns True if other_obj represents the same object as the self object , False otherwise
unclip_geometry(planar_mod) Unclips the geometry of this object regarding the plane defined by planar_mod
update() This method will update the Gui of the object in the properties panel.
compute()

This method performs computation.

This method should be overridden by the extending class to implement the computation part of the module.

data

Read-only property bound to the object connected to the data port of this module.

update()

This method will update the Gui of the object in the properties panel.

This method should be overridden by the extending class to implement any update of the Gui of the module.

Indices and tables