Framework Package#
AnimationTool class#
- class AnimationTool(page=None, **kwargs)#
Bases:
object
Class representing the Animation Tool. Provides user with tools to control the animation and its parameters.
- Parameters:
page (Union[Page, int, str]) – Page the Animation Tool will be linked to. Default is active page.
kwargs (dict) – Attributes of the Animation Tool object.
- isAnimating()#
Method to check if page is animating.
- Returns:
Returns True if page is animating.
- Return type:
bool
- next()#
Method to set the next frame of the animation.
- previous()#
Method to set the previous frame of the animation.
- setAttributes(**kwargs)#
Method to set the animation tool attributes.
- Parameters:
kwargs (dict) – Attributes
- start(num_cycles=0)#
Method to start the animation.
- stop()#
Method to stop the animation.
- property currentFrame#
Attribute to set or get the current frame of the animation.
- Getter:
Gets the current frame of the animation.
- Setter:
Sets the current frame of the animation.
- Type:
Union[int, str]
- property currentTime#
Attribute to set or get the current time of the animation.
- Getter:
Gets the current time of the animation.
- Setter:
Sets the current time of the animation.
- Type:
Union[float, str]
- property endFrame#
Attribute to set or get the end frame of the animation.
- Getter:
Gets the end frame of the animation.
- Setter:
Sets the end frame of the animation.
- Type:
Union[int, str]
- property endTime#
Attribute to set or get the endTime of the animation.
- Getter:
Gets the end time of the animation.
- Setter:
Sets the end time of the animation.
- Type:
Union[float, str]
- property numberOfFrames#
Attribute to get the number of frames.
- Getter:
Gets the number of frames.
- Type:
int
- property numberOfSteps#
Attribute to get the number of steps.
- Getter:
Gets the number of steps.
- Type:
int
- property startFrame#
Attribute to set or get the start frame of the animation.
- Getter:
Gets the start frame of the animation.
- Setter:
Sets the start frame of the animation.
- Type:
Union[int, str]
- property startTime#
Attribute to set or get the start time of the animation.
- Getter:
Gets the start time of the animation.
- Setter:
Sets the start time of the animation.
- Type:
Union[float, str]
CaptureImageTool class#
- class CaptureImageTool(*args, **kwargs)#
Bases:
object
Class representing the Capture Image Tool. Provides user with tools to define and capture screenshots.
- Parameters:
kwargs (dict) – Attributes of the Capture Image Tool object.
- capture()#
Method to capture the image and save it as a file. If the file name is not specified, the name will be set to untitled followed by an incremental value (e.g. untitled1.jpg).
- setAttributes(**kwargs)#
Method to set the CaptureImageTool attributes.
- Parameters:
kwargs (dict) – Attributes
- property area#
Attribute to set or get area to capture in image. Default is window. Available options are window or page.
- Getter:
Gets the capture image area.
- Setter:
Sets the capture image area.
- Type:
str
- property compression#
Attribute to set or get compression for capture image. Default is 100.
- Getter:
Gets the capture image compression.
- Setter:
Sets the capture image compression.
- Type:
int
- property dimension#
Attribute to set or get capture image dimension. Default is pixels. Available options are percent or pixels.
- Getter:
Gets the capture image dimension.
- Setter:
Sets the capture image dimension.
- Type:
str
- property file#
Attribute to set or get the capture image file name.
- Getter:
Gets the capture image file name.
- Setter:
Sets the capture image file name.
- Type:
str
- property height#
Attribute to set or get the height of the capture image window. Default value is 768 in batch mode, otherwise the page height.
- Getter:
Gets the capture image window height.
- Setter:
Sets the capture image window height.
- Type:
float
- property type#
Attribute to set or get the capture image type. Default is clipboard. Available options are jpg, jpeg, png, tif, bmp or clipboard.
- Getter:
Gets the capture image type.
- Setter:
Sets the capture image type.
- Type:
str
- property width#
Attribute to set or get the width of the capture image window. Default is 1024 in batch mode, otherwise the page width.
- Getter:
Gets the capture image window width.
- Setter:
Sets the capture image window width.
- Type:
float
Color class#
- class Color(*, rgb=(0, 0, 0), hex='#000000', bgr=(0, 0, 0))#
Bases:
object
Class representing colors in various formats (RGB, BGR, and Hex). A Color object can be referenced to define an entity color.
- property bgr: tuple#
Tuple representing the color in BGR format.
- property hex: str#
String representing the color in hexadecimal format.
- property postIndex: int#
Sets the color using a HyperView/HyperGraph client index. Valid values are 1-64.
- property preIndex: int#
Sets the color using a HyperMesh client index. Valid values are 0-63.
- property rgb: tuple#
Tuple representing the color in RGB format.
Font class#
- class Font(*args, **kwargs)#
Bases:
object
Class representing a font specified by the family, size, and style configuration.
- Parameters:
kwargs (dict) – The attributes of the Font.
- setAttributes(**kwargs)#
Set the attributes of the Font object.
- Parameters:
kwargs (dict) – The attributes of the Font.
- property family: str#
Set the font family attribute.
- property size: int#
Set the font size attribute.
- property style: str#
Set the font style attribute.
HyperGraphWindow class#
- class HyperGraphWindow#
Bases:
Window
- delete(entity, objOrId)#
Method to delete an entity.
- Parameters:
entity – Entity class name
objOrId – Entity object, entity ID, list of entity objects, list of entity IDs.
type – Unity[Entity,int,list,str]
- fit(x=True, y=True)#
Method to adjust the view to fit the curves in the plot window.
- Parameters:
x (bool) – If True, the curves will be fitted along x axis.
y (bool) – If True, the curves will be fitted along y axis.
- recalculate()#
Method to recalculate the curves in the window.
- update()#
Method to recalculate the curves, fit the curves along both x and y axis, and redraw the window.
HyperViewWindow class#
- class HyperViewWindow#
Bases:
Window
- addModelAndResult(model=None, result=None, overlay=False, template='none')#
Method to load model and result.
- Parameters:
model (str) – Model file name.
result (str) – Result file name.
overlay (bool) – If True, overlays the model.
template (str) – Template used to load model and result.
- addResult(resFiles, replace=False)#
Method to add results.
- Parameters:
resFiles (Union[str, list]) – Result file name.
replace (bool) – If True, replaces the currently loaded result file.
- delete(entity, objOrId)#
Method to delete an entity.
- Parameters:
entity (class) – Entity class.
objOrId (Union[Entity, int, list, str]) – Entity object, entity ID, list of entity objects, list of entity IDs, or all.
- fit(mode: str = 'model')#
Method to adjust the view to fit the objects in the modeling window.
- Parameters:
mode (str) – Mode of the fit operation. Valid values are model (default), selected, and allframes.
- getModel(id: int)#
Method to get the model object.
- Parameters:
id (int) – The ID of the model.
- Returns:
Model object.
- Return type:
- getModels() list #
Method to get the model object list.
- Returns:
Model object list.
- Return type:
list
- getResultDefinitionList(type: str)#
Method to get the ResultDefinition object list.
- Parameters:
type (int) – Type of ResultDefinition (scalar, vector, or tensor)
- Returns:
Model object.
- Return type:
- setActiveModel(id: int)#
Method to set the active model and returns model object.
- Parameters:
id (int) – The ID of the model.
- Returns:
Model object.
- Return type:
- update()#
Method to fit the model and draw the window.
Page class#
- class Page(layout=0, title='Untitled', _obj=None, _id=0)#
Bases:
object
Class representing a page of the application. The constructor raises an exception if not pointed to a valid page.
- Parameters:
layout (int) – The page layout.
title (str) – The page title.
- draw(updateInterface: bool = False)#
Method to draw the page.
- Parameters:
updateInterface (bool) – If True, the graphics are updated.
- getAverageAnimationFramerate()#
Method to get the average animation frame rate.
- Returns:
Animation frame rate.
- Return type:
int
- getNumberOfWindows() int #
Method to get the number of windows on a page.
- Returns:
Number of windows on a page.
- Return type:
int
- isAnimating()#
Method to check if page is animating.
- Returns:
Returns True if page is animating.
- Return type:
bool
- setAttributes(**kwargs)#
Method to set the page attributes.
- Parameters:
kwargs (dict) – attributes
- startAnimation(num_cycles=0)#
Method to start the animation.
- Parameters:
num_cycles (int) – Number of animation cycles defining how many times animation will be repeated (default 0).
- stopAnimation()#
Method to stop the animation.
- property id#
Attribute to get the ID of the page.
- Getter:
Gets the ID of the page.
- Type:
int
- property layout#
Attribute to set or get the window layout of the page. Valid values are 0-19.
- Getter:
Gets layout of the page.
- Setter:
Sets layout of the page.
- Type:
int
- property title#
Attribute to set or get the page title.
- Getter:
Gets title of the page.
- Setter:
Sets title of the page.
- Type:
str
- property titleAsDisplayed#
Attribute to get the displayed title (after evaluation of any embedded expressions).
- Getter:
Gets the displayed page title.
- Type:
str
Session class#
- class Session#
Bases:
object
A singleton class representing the Session. All session level attributes and methods are defined in this class.
- close()#
Method to close the session.
- delete(entity, objOrid)#
Method to delete an entity.
- classmethod get(tag, id: Any = None, label: str = None, title: str = None, page: int | Page = None, window: int | Window = None, model=None, curve: Any = None, reference: str = None, labelAsDisplayed: str = None, name: str = None, curveLabelAsDisplayed: str = None, curveLabel: str = None, operation: str = None)#
Method to get an entity object of class Page, Window, Model, Result, ResultDefinitionScalar, ResultDefinitionVector, ResultDefinitionTensor, ResultDefinitionIso, ResultDisplayIso, LegendScalar, LegendTensor, LegendVector, Note, CurveXY, DatumHorizontal, DatumVertical, AxisHorizontal, AxisVertical, Header, Footer, MathXY.
- Parameters:
tag (class) – The class of the entity to get.
id (int) – id of the entity.
label (str) – label of the entity.
title (str) – title of the entity
page (Union[Page, int]) – Page of the entity specified as either a Page object or ID. Default is active page.
window (Union[Window, int]) – Window of the entity specified as either a Window object or ID. Default is active window.
model (Union[Model, int]) – Model specified either as a Model object or ID.
- getMultiCoreMode()#
Method to get the MultiCore mode. Applicable for HyperView client.
- Returns:
Returns True if MultiCore profile is loaded.
- Return type:
bool
- getPages() list #
Method to get the pages.
- Returns:
List of Page class objects.
- Return type:
list
- getWindows(page: Any = None) list #
Method to get the windows in specified page.
- Parameters:
page (Union[Page, int, str]) – Page for the windows. Default is active page.
- Returns:
List of windows in given page.
- Return type:
list
- load(filename, append=True)#
Method to load the session.
- Parameters:
filename (str) – Session file name.
append (bool) – If True, appends the given file to the existing session. Default is True.
- new()#
Method to create a new session.
- save(filename=None)#
Method to save the session.
- Parameters:
filename (str) – Session file name. If filename is not specified, it will save the session as Untitled.mvw.
- setActive(tag, id: Any = None, title: str = None, page: int | Page = None, window: int | Window = None, model=None)#
Method to set the active entity like Page, Window, or Model.
- Parameters:
tag (Page, Window or Model) – Entity to be set as active. Applicable for Page, Window or Model.
id (int) – ID of the entity.
title (str) – Title of the entity. Applicable for Page and Model.
page (Union[Page, int]) – Page of the entity specified as either a Page object or ID. Default is active page.
window (Union[Window, int]) – Window of the entity specified as either a Window object or ID. Default is active window.
model (Union[Model, int]) – Model specified either as a Model object or ID.
Window class#
- class Window(page=None, window=None, id=None)#
Bases:
object
Class representing a Window. Get a Window for the given page. The constructor raises an exception if not pointed to a valid window.
- Parameters:
- draw()#
Method to draw the window.
- erase()#
Method to erase window content.
- isEmpty()#
Method to check if window is empty.
- Returns:
Returns True if window is empty.
- Return type:
bool
- setAttributes(**kwargs)#
Method to set window attributes.
- Parameters:
kwargs – Attributes
type – dict
- property graphicsHeight#
Attribute to get the window height.
- Getter:
Window height.
- Type:
int
- property graphicsWidth#
Attribute to get the window width.
- Getter:
Window width.
- Type:
int
- property id#
Attribute to get the window ID.
- Getter:
Gets the window ID.
- Type:
int
- property page#
Attribute to get the Page class object.
- Getter:
Gets page object.
- Type:
Page class object
- property type#
Attribute to set or get the type of window client.
- Getter:
Gets client of the window.
- Setter:
Sets client of the window.
- Type:
str
evalHWC function#
- evalHWC(command_or_file: str)#
Evaluates a HWC based expression. Alternatively, if supplied a path to a HWC command file, it executes the command file.
- Parameters:
command_or_file (str) – HWC expression or path to HWC command file.
Example#
import hw hw.evalHWC('result scalar clear "Stress, vonMises, Max, Analysis System') hw.evalHWC('result iso clear')