Layout¶
tecplot.layout¶
Pages, frames and other layout-related operations.
The “layout” consists of a stack of Pages identified by index or
name. Each Page consists of a single “workspace” which holds
a collection of Frames that are laid out in relation to an area
called the Paper.
The Tecplot Engine is guaranteed to have at least one Page which is
holding onto at least one Frame. It also has the concept of an active
Frame and by extension, an active Page. Most, if not all operations
that require a handle to a Frame will use the active Frame by default.
This includes any function that operates on objects held by a Frame
such as a Cartesian3DFieldPlot or Dataset.
active_page()¶
-
tecplot.active_page()[source]¶ Returns the currently active page.
Returns: Page– The currently active page.Only one
Pagecan be active at any given time. As long as the page is not deleted (through a call tonew_layoutorload_layoutfor example) this can be used to bring it back to the active state:>>> import tecplot >>> page1 = tecplot.active_page() >>> page2 = tecplot.add_page() >>> # page2 is now active, but we can >>> # bring page1 back to the front: >>> page1.activate()
delete_page()¶
-
tecplot.delete_page(page_to_delete)[source]¶ Removes a
Pagefrom the layout.This will render any
Pageobject pointing to the deletedPageuseless. The unique ID will not be used again in the active session and it is up to the user to clear the python object usingThe del statement:>>> import tecplot as tp >>> page = tp.add_page() >>> tp.delete_page(page) >>> next_page = tp.active_page() >>> page == next_page False >>> page.active False >>> page.activate() >>> del page # clear the python object
next_page()¶
-
tecplot.next_page()[source]¶ Activates and returns the next page.
Returns: layout.Page– The next page in the layout.Pageobjects are stored in an ordered stack in the Tecplot Engine. This method rotates the stack and returns the resulting activePage:>>> import tecplot >>> from tecplot.layout import next_page >>> page1 = tecplot.add_page() >>> page2 = tecplot.add_page() >>> next_page = next_page() >>> # page1 is now the active page >>> next_page == page1 True
new_layout()¶
-
tecplot.new_layout()[source]¶ Clears the current layout and creates a blank frame.
This will invalidate any object instances previously obtained:
>>> import tecplot >>> frame = tecplot.active_frame() >>> tecplot.new_layout() >>> # frame is no longer usable: >>> try: ... frame.plot_type ... except Exception as e: ... print(type(e),e) ... <class 'ValueError'> 255 is not a valid PlotType
load_layout()¶
-
tecplot.load_layout(filename)[source]¶ Reads a layout file and replaces the active frame.
Parameters: filename (
string) – The file name of the layout to be loaded. (See note below conerning absolute and relative paths.)Raises: TecplotOSError– If file can not be found.TecplotSystemError– If the file could not be loaded.
Note
Absolute and relative paths with PyTecplot
Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling
os.getcwd(). This is true for batch andconnectedmodes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.Note that backslashes must be escaped which is especially important for windows paths such as
"C:\\Users"or"\\\\server\\path"which will resolve to"C:\Users"and"\\server\path"respectively. Alternatively, one may use Python’s raw strings:r"C:\Users"andr"\\server\path"This will replace the current layout and therefore will invalidate any object instances previously obtained:
>>> import tecplot >>> frame = tecplot.active_frame() >>> tecplot.load_layout('analysis.lay') >>> # frame is no longer usable
page()¶
-
tecplot.page(pattern)[source]¶ Returns the page by name.
Parameters: pattern ( string) –Glob-stylepattern.Returns: Page– The first page identified by pattern.Note
A layout can contain pages with identical names. When the parameter pattern is a string, the first match found is returned. This is not guaranteed to be deterministic and care should be taken to have only pages with unique names when this feature is used.
Example
>>> import tecplot >>> page11 = tecplot.add_page() >>> page11.name = 'Page 11' >>> page12 = tecplot.add_page() >>> page12.name = 'Page 12' >>> page12 == tecplot.page('Page 1*') True
pages()¶
-
tecplot.pages(pattern=None)[source]¶ Yields pages matching a specified pattern.
Parameters: pattern ( string, optional) –Glob-style patternused to match the names of the yieldedPageobjects. All pages are returned if no pattern is specified. (default:None)Returns: Page– Generator of pages identified by pattern.This function returns a generator which can only be iterated over once. It can be converted to a
listfor persistence:>>> import tecplot >>> # iterate over all pages and print their names >>> for page in tecplot.pages(): >>> print(page.name) >>> # store a persistent list of pages >>> pages = list(tecplot.pages())
save_layout()¶
-
tecplot.save_layout(filename, include_data=None, include_preview=None, use_relative_paths=None, post_layout_commands=None, pages=None)[source]¶ Writes the current layout to a file.
Parameters: - filename (
string) – The path to the output filename. (See note below conerning absolute and relative paths.) - include_data (
boolean, optional) – Associated value indicates if the layout should be saved as a layout package where the data is included with the style information or if it should reference linked data. If ‘include_data’ is None and the filename ends with ‘.lpk’, then the file will be saved as a layout package file. (default: None) - include_preview (
boolean, optional) – Associated value indicates if the layout package should also include a preview image. This argument only applies if the include data option is True. (default:True) - use_relative_paths (
boolean, optional) – Associated value indicates if the layout should be saved using relative paths. This argument only applies if the include data option isFalse. (default:False) - post_layout_commands (
string, optional) – A character string containing a set of Tecplot macro commands that are appended to the layout or layout package file. These can be almost anything and are generally used to store add-on specific state information using$!EXTENDEDCOMMANDcommands. (default:None) - pages (
listofPageobjects, optional) – IfNone, all pages are written to the layout, otherwise the specified subset of pages are written. (default:None)
Raises: Note
Absolute and relative paths with PyTecplot
Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling
os.getcwd(). This is true for batch andconnectedmodes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.Note that backslashes must be escaped which is especially important for windows paths such as
"C:\\Users"or"\\\\server\\path"which will resolve to"C:\Users"and"\\server\path"respectively. Alternatively, one may use Python’s raw strings:r"C:\Users"andr"\\server\path"Note
If you receive an exception with the error message “Journal should be valid in all frames”, then you must save a data file using
save_tecplot_asciiorsave_tecplot_pltbefore saving the layout.Example
In this example, we load an example layout file and then save it as a packaged layout file.
>>> import os >>> import tecplot >>> examples_dir = tecplot.session.tecplot_examples_directory() >>> infile = os.path.join(examples_dir, 'SimpleData', 'F18.lay') >>> tecplot.load_layout(infile) >>> tecplot.save_layout('output.lpk', include_data=True)
- filename (
layout.aux_data()¶
-
tecplot.layout.aux_data()[source]¶ Auxiliary data for the current layout.
Returns: AuxDataThis is the auxiliary data attached to the entire layout containing all frames and datasets currently held by the Tecplot Engine. Such data is written to the layout file by default and can be retrieved later. Example usage:
>>> aux = tp.layout.aux_data() >>> aux['info'] = ''' ... This layout contains a lot of things: ... 1. Something ... 2. Something else ... 3. Also this''' >>> print(aux['info']) This layout contains a lot of things: 1. Something 2. Something else 3. Also this
Frame¶
-
class
tecplot.layout.Frame(uid, page)[source]¶ Frameobject within aPage, holding onto aDatasetand a Plot.Parameters: Warning
Though it is possible to create a
Frameobject using the constructor, it is usually sufficient to obtain a frame throughtecplot.active_frame()orPage.frame(). One can also create aFrameusing aPagehandle withPage.add_frame().The concept of the
Frameis central to understanding the Tecplot Engine. TheFrameis what connects aDatasetto a Plot handle from which one manipulates the desired image as well as accessing the attached data:>>> import tecplot >>> frame = tecplot.active_frame() >>> frame Frame(uid=11, Page(uid=1)) >>> print(frame) Frame 001
Attributes
activeChecks if this Frameis active.aux_dataAuxiliary data for this frame. background_colorColor of the background. border_thicknessThe border thickness in units of Frame.size_pos_units.datasetDatasetattached to thisFrame.has_datasetChecks to see if the Frameas an attachedDatasetheader_background_colorThe header’s background color. heightThe height in units of Frame.size_pos_units.nameReturns or sets the name. pageThe Pagecontaining this Frame.plot_typeReturns or sets the current plot type. position(x,y) position of the Framein inches.show_borderShow or hide the Frame’s border.show_headerShow or hide the Frame’s header in the border.size_pos_unitsThe units used for size properties. transparentUse transparency within this Frame.widthThe width in units of Frame.size_pos_units.Methods
activate()Causes this Frameto become active.activated()Context for temporarily activating this Frame.active_zones(*zones)Returns or sets the active Zones. add_text(text[, position, coord_sys, …])Adds a textto aFrame.create_dataset(name[, var_names, reset_style])Create an empty Dataset.delete_text(text)Delete a textobject from a frame.geometries()Not Implemented images()Not Implemented load_stylesheet(filename[, plot_style, …])Apply a stylesheet settings file to this frame. move_to_bottom()Moves Framebehind all others inPage.move_to_top()Moves Framein front of all others inPage.plot([plot_type])Returns a Plot style-control object. save_stylesheet(filename[, plot_style, …])Save the frame’s current style to a file. texts()Get an iterator for all Textobjects in the frame.
-
Frame.activate()[source]¶ Causes this
Frameto become active.Raises: TecplotSystemErrorThe parent
Pageis implicitly “activated” as a side-effect of this operation:>>> import tecplot >>> page1 = tecplot.active_page() >>> frame1 = page1.active_frame() >>> page2 = tecplot.add_page() >>> frame2 = page2.active_frame() >>> frame1.active and page1.active False >>> frame2.active and page2.active True >>> frame1.activate() >>> frame2.active or page2.active False >>> frame1.active and page1.active True
-
Frame.activated()[source]¶ Context for temporarily activating this
Frame.Example:
>>> import tecplot >>> page = tecplot.active_page() >>> frame1 = page.active_frame() >>> frame2 = page.add_frame() >>> print(frame2.active) True >>> with frame1.activated(): >>> print(frame1.active) True >>> print(frame2.active) True
-
Frame.active¶ Checks if this
Frameis active.Returns: bool–Trueif thisFrameis the activeFrame.
-
Frame.active_zones(*zones)[source]¶ Returns or sets the active Zones.
Parameters: zones (Zones, optional) – The Zone objects, which must be in the Datasetattached to thisFrame, that will be activated. All other Zones will be deactivated.Returns: Zones – This will return a generator of active Zones in this Frame.This should only be used on frames with an active plot type that contains a dataset with at least one zone.
-
Frame.add_text(text, position=None, coord_sys=None, typeface=None, bold=None, italic=None, size_units=None, size=None, color=None, angle=None, line_spacing=None, anchor=None, box_type=None, line_thickness=None, box_color=None, fill_color=None, margin=None, zone=None)[source]¶ -
Parameters: - text (
string) – The text to add to theFrame. The text string must have a non-zero length. - position (
tupleoffloats(x,y), optional) – The position of the anchor as a percentage of the specified coordinates. (default: (0,0)) - coord_sys (
CoordSys, optional) – Coordinate system used to position the anchor of the text object. The possible values are:CoordSys.GridorCoordSys.Frame. (default:CoordSys.Frame) - typeface (
string, optional) – The typeface name. For consistency across various platforms, Tecplot guarantees that the following standard typeface names are available: “Helvetica”, “Times”, “Courier”, “Greek”, “Math”, and “User Defined”. Other typefaces may or may not be available depending on the TrueType fonts available. If the typeface name or style is not available, a suitable replacement will be selected. (default: “Helvetica”) - bold (
boolean, optional) – Use the bold variation of the specified typeface. (default:True) - italic (
boolean, optional) – Use the italic variation of the specified typeface. (default:False) - size_units (
Units, optional) – Text sizing units. Possible values are:Units.Grid,Units.FrameorUnits.Point. (default:Units.Point) - size (
float, optional) – Text height in the specified units. (default: 14) - color (
Color, optional) – Color of the text (default:Color.Black) - angle (
float, optional) – Angle of the text baseline in degrees from -360 to 360. (default: 0) - line_spacing (
float, optional) – Line spacing in units of line size. Can take values from 0 to 50. (default: 1) - anchor (
TextAnchor, optional) – Anchor position with respect to the text box. Possible values are:TextAnchor.Left,TextAnchor.Center,TextAnchor.Right,TextAnchor.MidLeft,TextAnchor.MidCenter,TextAnchor.MidRight,TextAnchor.HeadLeft,TextAnchor.HeadCenter,TextAnchor.HeadRight,TextAnchor.OnSide(default:TextAnchor.Left) - box_type (
constant.TextBox, optional) – Type of text box can be one of:constant.TextBox.None_,constant.TextBox.Filledorconstant.TextBox.Hollow. (default:constant.TextBox.None_) - line_thickness (
float, optional) – Text box boarder line thickness may be a value in the range from 0.0001 to 100. (default: 0.1) - box_color (
Color, optional) – Text box border line color. SeeColorfor possible values. (default:Color.Black) - fill_color (
Color, optional) – Text box fill color. SeeColorfor possible values. (default:White) - margin (
float, optional) – Margin between the text and text box. May be in the range from 0 to 2000. (default: 20) - zone (Zone, optional) – Zone or
XYLinemapto which the text will be attached. (default: None)
Returns: annotation.Text– The resultingtext boxobject.Example:
>>> import tecplot >>> from tecplot.constant import Color >>> frame = tecplot.active_frame() >>> frame.add_text('Hello, World!', position=(35, 50), ... bold=True, italic=False, text_color=Color.Blue)
See also
- text (
-
Frame.aux_data¶ Auxiliary data for this frame.
Returns: AuxDataThis is the auxiliary data attached to the frame. Such data is written to the layout file by default and can be retrieved later. Example usage:
>>> aux = tp.active_frame().aux_data >>> aux['Result'] = '3.14159' >>> print(aux['Result']) 3.14159
-
Frame.border_thickness¶ The border thickness in units of
Frame.size_pos_units.Type: float
-
Frame.create_dataset(name, var_names=None, reset_style=False)[source]¶ Create an empty
Dataset.This will create a new
Datasetand replace the existing one, destroying all data associated with it.Parameters: - name (
string) – Title of the newDataset. This does not have to be unique. - var_names (
listofstrings, optional) –Variablenames. This only sets the names and not the data type or location. Seeadd_variable. (default:None) - reset_style (
boolean) – Reset style of the activeFramebefore loading theDataset. (default:False)
Returns: Note
Relationships between
FrameandDatasetA
Framemay only hold a singleDataset, though thisDatasetmay be shared between severalFrames. Therefore, this method will only replace the current dataset when reset_style is set toTrueand will fail otherwise. If thisFramealready has aDataset, it may be more efficient to do one of the following instead:- Add a new (blank) frame with
Page.add_frame()and create aDatasetfor this. - Add new zones to the existing
DatasetwithDataset.add_ordered_zone(),Dataset.add_fe_zone()orDataset.add_poly_zone(). - Change the existing data
in-place.
Note
When performing many data-manipulation operations including adding zones, adding variables, modifying field data or connectivity, and especially in connected mode, it is recommended to do this all with the
tecplot.session.suspend(). This will prevent the Tecplot engine from trying to “keep up” with the changes. Tecplot will be notified of all changes made upon exit of this context. This may result in significant performance gains for long operations. See the documentation fortecplot.session.suspend()for more information.- name (
-
Frame.dataset¶ Datasetattached to thisFrame.Returns: Dataset– The object holding onto the data associated with thisFrame.If no
Datasethas been created for thisFrame, a new one is created and returned:>>> dataset = frame.dataset
-
Frame.delete_text(text)[source]¶ Delete a
textobject from a frame.When deleted, the text object is no longer displayed in the frame and is permanently invalid. To display the text in the frame again, a new text object must be created by calling
add_text.Warning
Use this method with care. After a text object has been deleted by calling this method, it is no longer valid, and all properties of the deleted text object will throw
TecplotLogicErrorwhen accessed.Example usage
>>> import tecplot as tp >>> text = tp.active_frame().add_text("abc") # Add a text >>> tp.active_frame().delete_text(text) # Delete the text >>> # 'text' is no longer valid and any property access >>> # will throw TecplotLogicError
See also
-
Frame.has_dataset¶ Checks to see if the
Frameas an attachedDatasetType: booleanExample usage:
>>> if not frame.has_dataset: ... dataset = frame.create_dataset('Dataset', ['x','y','z','p'])
-
Frame.height¶ The height in units of
Frame.size_pos_units.Type: float
-
Frame.load_stylesheet(filename, plot_style=True, text=True, geom=True, streams=True, contours=True, frame_geom=False, merge=False)[source]¶ Apply a stylesheet settings file to this frame.
Parameters: - filename (
string) – The path to a stylesheet file. (See note below conerning absolute and relative paths.) - plot_style (
boolean, optional) – Apply the stylesheet’s plot style. (default:True) - text (
boolean, optional) – Include the stylesheet’s text objects. (default:True) - geom (
boolean, optional) – Include the stylesheet’s geometry objects. (default:True) - streams (
boolean, optional) – Include the stylesheet’s stream traces. (default:True) - contours (
boolean, optional) – Include the stylesheet’s contour levels. (default:True) - frame_geom (
boolean, optional) – Apply the stylesheet’s frame position and size. (default:False) - merge (
boolean, optional) – Merge with the frame’s current style. (default:False)
Note
Absolute and relative paths with PyTecplot
Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling
os.getcwd(). This is true for batch andconnectedmodes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.Note that backslashes must be escaped which is especially important for windows paths such as
"C:\\Users"or"\\\\server\\path"which will resolve to"C:\Users"and"\\server\path"respectively. Alternatively, one may use Python’s raw strings:r"C:\Users"andr"\\server\path"Example usage:
>>> frame = tecplot.active_frame() >>> frame.load_stylesheet('my_style.sty')
- filename (
-
Frame.name¶ Returns or sets the name.
Type: stringThis is the name used when searching for
Frameobjects inPage.framesandPage.frame. It does not have to be unique, even for multiple frames in a singlePage.Example:
>>> import tecplot >>> frame = tecplot.active_frame() >>> frame.name = '3D Data View' >>> print('this frame:', frame.name) this frame: 3D Data View
-
Frame.page¶ The
Pagecontaining this Frame.This provides access to the parent
Page:>>> frame = tecplot.active_frame() >>> page = frame.page >>> page.name Page 001
-
Frame.plot(plot_type=<PlotType.Automatic: 0>)[source]¶ Returns a Plot style-control object.
Type: - Plot:
One of the possible Plot classes, depending on the
plot_typespecified. By default, the active plot type, obtained fromFrame.plot_type, is used.
The Plot object is the handle through which one can manipulate the style and visual representation of the
Dataset. Possible return types are:SketchPlot,Cartesian2DFieldPlot,Cartesian3DFieldPlot,PolarLinePlotandXYLinePlot. Each of these have their own specific set of attributes and methods.Example:
>>> frame = tecplot.active_frame() >>> frame.plot_type <PlotType.Cartesian3D: 1> >>> plot3d = frame.plot() >>> plot3d.show_contour = True
-
Frame.plot_type¶ Returns or sets the current plot type.
Type: constant.PlotTypeRaises: TecplotSystemErrorA
Framecan have only one active plot type at any given time. The types are enumerated byconstant.PlotType:>>> import tecplot >>> from tecplot.constant import PlotType >>> tecplot.load_layout('mylayout.lay') >>> frame = tecplot.active_frame() >>> frame.plot_type <PlotType.Sketch: 4> >>> frame.plot_type = PlotType.Cartesian3D >>> frame.plot_type <PlotType.Cartesian3D: 1>
Note
Plot type cannot be set to
constant.PlotType.Automatic.
-
Frame.position¶ (x,y) position of the
Framein inches.The
Framex position is relative to the left side of the paper. TheFramey position is relative to the top of the paper.If x is
None, theFramex position is not changed. If y isNone, theFramey position is not changed.Type: 2-tuple of floats:(x, y)Set
Frameposition 1 inch from the left side of the paper and two inches from the top of the paper:>>> tp.active_frame().position=(1.0, 2.0)
Move the active
Frameone inch to the right:>>> tp.active_frame().position=(tp.active_frame().position.x+1, None)
-
Frame.save_stylesheet(filename, plot_style=True, aux_data=True, text=True, geom=True, streams=True, contours=True, defaults=False, relative_paths=True, compress=False)[source]¶ Save the frame’s current style to a file.
Parameters: - filename (
string) – The path to a stylesheet file. (See note below conerning absolute and relative paths.) - plot_style (
boolean, optional) – Include the frame’s plot style. (default:True) - aux_data (
boolean, optional) – Include auxiliary data. (default:True) - text (
boolean, optional) – Include text objects. (default:True) - geom (
boolean, optional) – Include geometry objects. (default:True) - streams (
boolean, optional) – Include stream traces. (default:True) - contours (
boolean, optional) – Include contour levels. (default:True) - defaults (
boolean, optional) – Include all factory defaults used by the current style. (default:False) - relative_paths (
boolean, optional) – Use relative paths. (default:True) - compress (
boolean, optional) – Compress the output of the style. (default:False)
Note
Absolute and relative paths with PyTecplot
Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling
os.getcwd(). This is true for batch andconnectedmodes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.Note that backslashes must be escaped which is especially important for windows paths such as
"C:\\Users"or"\\\\server\\path"which will resolve to"C:\Users"and"\\server\path"respectively. Alternatively, one may use Python’s raw strings:r"C:\Users"andr"\\server\path"Example usage:
>>> frame = tecplot.active_frame() >>> frame.save_stylesheet('my_style.sty')
- filename (
-
Frame.size_pos_units¶ The units used for size properties.
Type: FrameSizePosUnits
-
Frame.texts()[source]¶ Get an iterator for all
Textobjects in the frame.This example shows how to obtain a list of all red
Textobjects:>>> from tecplot.constant import Color >>> all_red_text_objects = [T for T in tp.active_frame().texts() ... if T.color == Color.Red]
-
Frame.width¶ The width in units of
Frame.size_pos_units.Type: float
Page¶
-
class
tecplot.layout.Page(uid)[source]¶ Pageobject within a layout, holding onto one or moreFrames.Parameters: uid ( integer, optional) – This must be a valid unique ID number pointing internally to aPageobject orNone. A newPageis created if set toNone. (default:None)Warning
Though it is possible to create a
Pageobject using the constructor, it is usually sufficient to obtain a page throughtecplot.add_page,tecplot.active_page,tecplot.pageortecplot.pages.A
Pagecan be thought of like a canvas onto which one or moreFramescan be laid out. The engine guarantees there will always be at least onePagein the layout which can be accessed viatecplot.active_page:>>> import tecplot >>> page = tecplot.active_page() >>> page Page(uid=1) >>> for frame in page.frames(): ... print(frame) Frame 001
Attributes
activeChecks if this Pageis active.aux_dataAuxiliary data for this page. existsChecks if the Pageexists in the current layout.nameReturns or sets the name. paperThe Paperdefined in thisPage.positionReturns the position of the Page Methods
activate()Activates the Page.activated()active_frame()Returns the active Frame.add_frame()Creates a new Framein thisPage.delete_frame(frame)Removes the frame from this Page.frame(pattern)Returns the Frameby name.frames([pattern])Returns a listofFramesmatching the specified pattern.tile_frames([mode])Tile frames based on a certain mode.
-
Page.activate()[source]¶ Activates the
Page.Raises: TecplotRuntimeError– Page does not exist.TecplotSystemError– Could not activate the page.
-
Page.active_frame()[source]¶ Returns the active
Frame.Returns: Frame– The activeFrame.This implicitly activates this
Pageand returns the activeFrameattached to it.
-
Page.add_frame()[source]¶ Creates a new
Framein thisPage.Returns: Raises: TecplotRuntimeError– Could not find active frame.TecplotSystemError– Could not create a new frame.
This implicitly activates the
Pageand creates and activates a newFrame.
-
Page.aux_data¶ Auxiliary data for this page.
Returns:
AuxDataThis is the auxiliary data attached to the page. Such data is written to the layout file by default and can be retrieved later. Example usage:
>>> aux = tp.active_page().aux_data >>> aux['Result'] = '3.14159' >>> print(aux['Result']) 3.14159
-
Page.delete_frame(frame)[source]¶ Removes the frame from this
Page.Raises: TecplotRuntimeError– IfFrameis not in thisPage.TecplotSystemError– Could not delete the frame.
-
Page.frame(pattern)[source]¶ Returns the
Frameby name.Parameters: pattern ( string) –glob-stylepattern.Returns: Frame– The firstFrameidentified by pattern.Note
A
Pagecan containFrameswith identical names. When the parameter pattern is a string, the first match found is returned. This is not guaranteed to be deterministic and care should be taken to have onlyFrameswith unique names when this feature is used.Example
>>> import tecplot >>> page = tecplot.active_page() >>> frameA = page.add_frame('A') >>> frameB = page.add_frame('B') >>> frameA == page.frame('A') True
-
Page.frames(pattern=None)[source]¶ Returns a
listofFramesmatching the specified pattern.Parameters: pattern ( string, optional) –Glob-style patternused to match the names of the yieldedFrameobjects. All frames are returned if no pattern is specified. (default:None)Returns: list–Framesidentified by pattern.Example:
>>> import tecplot >>> page = tecplot.active_page() >>> # iterate over all frames and print their names >>> for frame in page.frames(): >>> print(frame.name) Frame 001 Frame 002 >>> # store a persistent list of frames >>> frames = page.frames() >>> print([f.name for f in frames]) ['Frame 001', 'Frame 002']
-
Page.name¶ Returns or sets the name.
Type: stringThis is the name used when searching for
Pageobjects intecplot.pagesandtecplot.page. It does not have to be unique.Example:
>>> import tecplot >>> page = tecplot.active_page() >>> page.name = 'My Data' >>> print('this page:', page.name) this page: My Data
-
Page.paper¶ The
Paperdefined in thisPage.Type: PaperEvery
Pagehas the concept of a workspace which includes allFramesas well as a sub-area of the workspace called thePaper. The limits of thePaperwith respect to the placement ofFramesis used when exporting certain image formats.
-
Page.position¶ Returns the position of the Page
Type: IndexThe page positions are 0 based positions relative to the current page, where the current page has a position value of 0, the next page 1, the page after that 2, and so on.
-
Page.tile_frames(mode=<TileMode.Grid: 'TILEFRAMESSQUARE'>)[source]¶ Tile frames based on a certain mode.
Parameters: mode ( TileMode, optional) – Direction and layout mode for tiling frames. Possible values:TileMode.Grid(default),TileMode.Columns,TileMode.Rows,TileMode.Wrap.Example usage:
>>> from tecplot.constant import TileMode >>> page.tile_frame(TileMode.Wrap)
Paper¶
-
class
tecplot.layout.Paper(page)[source]¶ The
Paperboundary defined on a workspace.This is the area used for certain image output formats. It is defined for a specific
Page.Framescan be laid out in reference to this sub-area of the workspace.Attributes
dimensionsWidth and height.
-
Paper.dimensions¶ Width and height.
the dimensions, (width, height) in inches, of the currently defined paper in the Tecplot workspace.