pytecplot 1.5.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. pytecplot-1.5.2.dist-info/LICENSE.html +77 -0
  2. pytecplot-1.5.2.dist-info/METADATA +508 -0
  3. pytecplot-1.5.2.dist-info/RECORD +97 -0
  4. pytecplot-1.5.2.dist-info/WHEEL +5 -0
  5. pytecplot-1.5.2.dist-info/top_level.txt +1 -0
  6. tecplot/__init__.py +94 -0
  7. tecplot/annotation/__init__.py +7 -0
  8. tecplot/annotation/annotation.py +223 -0
  9. tecplot/annotation/geometry.py +369 -0
  10. tecplot/annotation/georeference.py +33 -0
  11. tecplot/annotation/image.py +185 -0
  12. tecplot/annotation/iter.py +105 -0
  13. tecplot/annotation/polyline.py +381 -0
  14. tecplot/annotation/text.py +744 -0
  15. tecplot/constant.py +401 -0
  16. tecplot/data/__init__.py +34 -0
  17. tecplot/data/array.py +645 -0
  18. tecplot/data/create.py +1 -0
  19. tecplot/data/dataset.py +1809 -0
  20. tecplot/data/extract.py +544 -0
  21. tecplot/data/face_neighbors.py +494 -0
  22. tecplot/data/facemap.py +814 -0
  23. tecplot/data/load.py +2075 -0
  24. tecplot/data/nodemap.py +577 -0
  25. tecplot/data/operate.py +928 -0
  26. tecplot/data/query.py +334 -0
  27. tecplot/data/save.py +343 -0
  28. tecplot/data/variable.py +280 -0
  29. tecplot/data/zone.py +841 -0
  30. tecplot/exception.py +201 -0
  31. tecplot/export/__init__.py +13 -0
  32. tecplot/export/animation.py +521 -0
  33. tecplot/export/export_setup.py +318 -0
  34. tecplot/export/image.py +577 -0
  35. tecplot/export/print_setup.py +218 -0
  36. tecplot/export/time_animation.py +607 -0
  37. tecplot/extension/__init__.py +14 -0
  38. tecplot/extension/ipython.py +68 -0
  39. tecplot/layout/__init__.py +20 -0
  40. tecplot/layout/frame.py +1285 -0
  41. tecplot/layout/layout.py +488 -0
  42. tecplot/layout/page.py +541 -0
  43. tecplot/legend/__init__.py +4 -0
  44. tecplot/legend/contour_legend.py +516 -0
  45. tecplot/legend/legend.py +141 -0
  46. tecplot/legend/line_legend.py +66 -0
  47. tecplot/legend/rgb_coloring_legend.py +291 -0
  48. tecplot/legend/scatter_legend.py +136 -0
  49. tecplot/macro.py +339 -0
  50. tecplot/plot/__init__.py +62 -0
  51. tecplot/plot/axes.py +881 -0
  52. tecplot/plot/axis.py +1350 -0
  53. tecplot/plot/blanking.py +584 -0
  54. tecplot/plot/contour.py +1302 -0
  55. tecplot/plot/effects.py +162 -0
  56. tecplot/plot/fieldmap.py +2159 -0
  57. tecplot/plot/grid.py +758 -0
  58. tecplot/plot/isosurface.py +1167 -0
  59. tecplot/plot/labels.py +338 -0
  60. tecplot/plot/linemap.py +1905 -0
  61. tecplot/plot/linking.py +489 -0
  62. tecplot/plot/plot.py +1791 -0
  63. tecplot/plot/rgb_coloring.py +281 -0
  64. tecplot/plot/scatter.py +396 -0
  65. tecplot/plot/slice.py +1544 -0
  66. tecplot/plot/streamtrace.py +1949 -0
  67. tecplot/plot/symbol.py +567 -0
  68. tecplot/plot/ticks.py +666 -0
  69. tecplot/plot/title.py +380 -0
  70. tecplot/plot/vector.py +679 -0
  71. tecplot/plot/view.py +868 -0
  72. tecplot/session/__init__.py +112 -0
  73. tecplot/session/aux_data.py +276 -0
  74. tecplot/session/config.py +92 -0
  75. tecplot/session/session.py +425 -0
  76. tecplot/session/state_changed.py +225 -0
  77. tecplot/session/style.py +504 -0
  78. tecplot/tecutil/__init__.py +16 -0
  79. tecplot/tecutil/arglist.py +230 -0
  80. tecplot/tecutil/captured_output.py +177 -0
  81. tecplot/tecutil/constant.py +1312 -0
  82. tecplot/tecutil/index_set.py +118 -0
  83. tecplot/tecutil/lock.py +36 -0
  84. tecplot/tecutil/message_pb2.py +39 -0
  85. tecplot/tecutil/preamble.py +54 -0
  86. tecplot/tecutil/stringlist.py +114 -0
  87. tecplot/tecutil/sv.py +1662 -0
  88. tecplot/tecutil/tecutil.py +12402 -0
  89. tecplot/tecutil/tecutil_client.py +627 -0
  90. tecplot/tecutil/tecutil_connector.py +937 -0
  91. tecplot/tecutil/tecutil_rpc.py +6845 -0
  92. tecplot/tecutil/util.py +332 -0
  93. tecplot/text/__init__.py +3 -0
  94. tecplot/text/font.py +224 -0
  95. tecplot/text/label_format.py +374 -0
  96. tecplot/text/textbox.py +106 -0
  97. tecplot/version.py +41 -0
@@ -0,0 +1,577 @@
1
+ from builtins import str
2
+
3
+ import logging
4
+
5
+ from ..tecutil import _tecutil, lock, sv
6
+ from ..constant import *
7
+ from ..exception import *
8
+ from .. import layout, session
9
+
10
+ from .export_setup import ExportSetup
11
+ from .print_setup import PrintSetup
12
+
13
+ log = logging.getLogger(__name__)
14
+
15
+
16
+ @lock()
17
+ def export_image(region):
18
+ if isinstance(region, layout.Frame):
19
+ ExportSetup().region = ExportRegion.CurrentFrame
20
+ with region.activated():
21
+ success = _tecutil.Export(append=False)
22
+ else:
23
+ ExportSetup().region = region
24
+ success = _tecutil.Export(append=False)
25
+ if not success:
26
+ raise TecplotSystemError()
27
+
28
+
29
+ def save_bmp(filename, width=800, region=ExportRegion.AllFrames,
30
+ supersample=3, convert_to_256_colors=False):
31
+ """Save a `BMP image <https://en.wikipedia.org/wiki/BMP_file_format>`_.
32
+
33
+ Parameters:
34
+ filename (`str`): |export_filename_description| (See note
35
+ below concerning absolute and relative paths.)
36
+ width (`int`): |export_width_description|
37
+ region (`frame <tecplot.layout.Frame>` or `ExportRegion`, optional): If
38
+ ``region`` is a `frame object <tecplot.layout.Frame>`, then the
39
+ contents of the frame will be exported. If region is
40
+ `ExportRegion.CurrentFrame`, then the contents of the currently
41
+ active frame will be exported. If region is
42
+ `ExportRegion.AllFrames`, then the smallest rectangle containing
43
+ all frames will be exported. If region is `ExportRegion.WorkArea`,
44
+ then everything shown in the workspace will be exported. (default:
45
+ `ExportRegion.AllFrames`)
46
+ supersample (`int`, optional): |export_supersample_description|
47
+ convert_to_256_colors (`Boolean <bool>`, optional): |export_convert256_description|
48
+
49
+ Raises:
50
+ `TecplotSystemError`: The image could not be saved due to a
51
+ file I/O error or invalid attribute.
52
+
53
+ .. note:: **Absolute and relative paths with PyTecplot**
54
+
55
+ Relative paths, when used within the PyTecplot API are always from
56
+ Python's current working directory which can be obtained by calling
57
+ :func:`os.getcwd()`. This is true for batch and `connected
58
+ <tecplot.session.connect()>` modes. One exception to this is paths
59
+ within a macro command or file which will be relative to the |Tecplot
60
+ Engine|'s home directory, which is typically the |Tecplot 360|
61
+ installation directory. Finally, when connected to a remote (non-local)
62
+ instance of Tecplot 360, only absolute paths are allowed.
63
+
64
+ Note that backslashes must be escaped which is especially important for
65
+ windows paths such as ``"C:\\\\Users"`` or ``"\\\\\\\\server\\\\path"``
66
+ which will resolve to ``"C:\\Users"`` and ``"\\\\server\\path"``
67
+ respectively. Alternatively, one may use Python's raw strings:
68
+ ``r"C:\\Users"`` and ``r"\\\\server\\path"``
69
+
70
+ .. note::
71
+ |export_general_info|
72
+
73
+ Save a BMP image of the entire workspace with supersampling::
74
+
75
+ >>> from tecplot.constant import ExportRegion
76
+ >>> tecplot.load_layout('mylayout.lay')
77
+ >>> tecplot.export.save_bmp('image.bmp', width=600, supersample=3,
78
+ ... region=ExportRegion.WorkArea)
79
+ """
80
+ setup = ExportSetup()
81
+ setup.reset()
82
+ setup.format = ExportFormat.BMP
83
+ setup.filename = filename
84
+ setup.width = width
85
+ setup.supersample = supersample
86
+ setup.convert_to_256_colors = convert_to_256_colors
87
+
88
+ export_image(region)
89
+ log.info('BMP image file created: ' + filename)
90
+
91
+
92
+ def save_eps(filename, palette=Palette.Color, region=ExportRegion.AllFrames,
93
+ force_extra_3d_sorting=False, extra_precision=0,
94
+ render_type=PrintRenderType.Vector, resolution=150,
95
+ preview_type=EPSPreviewImage.TIFF, preview_width=128,
96
+ preview_height=128, preview_gray_scale_depth=0):
97
+ """Save an `Encapsulated PostScript image
98
+ <https://en.wikipedia.org/wiki/Encapsulated_PostScript>`_.
99
+
100
+ Parameters:
101
+ filename (`str`): |export_filename_description| (See note
102
+ below concerning absolute and relative paths.)
103
+ palette (`Palette`, optional): Export color image. (default:
104
+ `Palette.Color`)
105
+ region (`frame <tecplot.layout.Frame>` or `ExportRegion`, optional): If
106
+ ``region`` is a `frame object <tecplot.layout.Frame>`, then the
107
+ contents of the frame will be exported. If region is
108
+ `ExportRegion.CurrentFrame`, then the contents of the currently
109
+ active frame will be exported. If region is
110
+ `ExportRegion.AllFrames`, then the smallest rectangle containing
111
+ all frames will be exported. If region is `ExportRegion.WorkArea`,
112
+ then everything shown in the workspace will be exported. (default:
113
+ `ExportRegion.AllFrames`)
114
+ force_extra_3d_sorting (`bool`, optional): Force extra sorting for all
115
+ 3D frames. (default: `False`)
116
+ extra_precision (`int`, optional): Additional digits for all numbers
117
+ written to postscript file. (default: 0)
118
+ render_type (`PrintRenderType`, optional): Whether to render the
119
+ postscript as a rasterized or vector image. (default:
120
+ `PrintRenderType.Vector`)
121
+ resolution (`int`): Resolution of the image in dots per inch.
122
+ Larger values create more accurate plots, but result in larger file
123
+ sizes. Note: this value is ignored if `PrintRenderType` is
124
+ `PrintRenderType.Vector` (default: **150**)
125
+ preview_type (`EPSPreviewImage`, optional): The type of image to use as
126
+ an embedded preview. Possible values are `EPSPreviewImage.None_`,
127
+ `EPSPreviewImage.TIFF` (default), `EPSPreviewImage.EPSI2` or
128
+ `EPSPreviewImage.FRAME`.
129
+ preview_width (`int`, optional): Width of the preview image in pixels
130
+ (default: 128). This is only used if *preview_type* is not
131
+ `EPSPreviewImage.None_`.
132
+ preview_height (`int`, optional): Height of the preview image in pixels
133
+ (default: 128). This is only used if *preview_type* is not
134
+ `EPSPreviewImage.None_`.
135
+ preview_gray_scale_depth (`int`, optional): Gray-scale depth to use for
136
+ embedded TIFF preview images. See documentation for the
137
+ *gray_scale_depth* parameter in `save_tiff()`. This is only used if
138
+ *preview_type* is not `EPSPreviewImage.None_`.
139
+
140
+ Raises:
141
+ `TecplotSystemError`: The image could not be saved due to a
142
+ file I/O error or invalid attribute.
143
+
144
+ .. note:: **Absolute and relative paths with PyTecplot**
145
+
146
+ Relative paths, when used within the PyTecplot API are always from
147
+ Python's current working directory which can be obtained by calling
148
+ :func:`os.getcwd()`. This is true for batch and `connected
149
+ <tecplot.session.connect()>` modes. One exception to this is paths
150
+ within a macro command or file which will be relative to the |Tecplot
151
+ Engine|'s home directory, which is typically the |Tecplot 360|
152
+ installation directory. Finally, when connected to a remote (non-local)
153
+ instance of Tecplot 360, only absolute paths are allowed.
154
+
155
+ Note that backslashes must be escaped which is especially important for
156
+ windows paths such as ``"C:\\\\Users"`` or ``"\\\\\\\\server\\\\path"``
157
+ which will resolve to ``"C:\\Users"`` and ``"\\\\server\\path"``
158
+ respectively. Alternatively, one may use Python's raw strings:
159
+ ``r"C:\\Users"`` and ``r"\\\\server\\path"``
160
+
161
+ Save an Ecapsulated PostScript image of the active frame::
162
+
163
+ >>> tecplot.load_layout('mylayout.lay')
164
+ >>> tecplot.export.save_eps('image.eps')
165
+ """
166
+ print_setup = PrintSetup()
167
+ print_setup.reset()
168
+ print_setup.palette = palette
169
+ print_setup.force_extra_3d_sorting = force_extra_3d_sorting
170
+ print_setup.extra_precision = extra_precision
171
+ print_setup.resolution = resolution
172
+
173
+ export_setup = ExportSetup()
174
+ export_setup.reset()
175
+ export_setup.format = ExportFormat.EPS
176
+ export_setup.filename = filename
177
+ export_setup.render_type = render_type
178
+
179
+ export_setup.preview_image.type = preview_type
180
+ export_setup.preview_image.width = preview_width
181
+ export_setup.preview_image.height = preview_height
182
+ export_setup.preview_image.gray_scale_depth = preview_gray_scale_depth
183
+
184
+ export_image(region)
185
+ log.info('Encapsulated postscript file created: ' + filename)
186
+
187
+
188
+ def save_jpeg(filename, width=800, region=ExportRegion.AllFrames,
189
+ supersample=3, encoding=JPEGEncoding.Standard, quality=75):
190
+ """Save a `JPEG image
191
+ <https://en.wikipedia.org/wiki/JPEG>`_.
192
+
193
+ Parameters:
194
+ filename (`str`): |export_filename_description| (See note
195
+ below concerning absolute and relative paths.)
196
+ width (`int`): |export_width_description|
197
+ region (`frame <tecplot.layout.Frame>` or `ExportRegion`, optional): If
198
+ ``region`` is a `frame object <tecplot.layout.Frame>`, then the
199
+ contents of the frame will be exported. If region is
200
+ `ExportRegion.CurrentFrame`, then the contents of the currently
201
+ active frame will be exported. If region is
202
+ `ExportRegion.AllFrames`, then the smallest rectangle containing
203
+ all frames will be exported. If region is `ExportRegion.WorkArea`,
204
+ then everything shown in the workspace will be exported. (default:
205
+ `ExportRegion.AllFrames`)
206
+ supersample (`int`, optional): |export_supersample_description|
207
+ encoding (`JPEGEncoding`, optional) Encoding method for the JPEG
208
+ file which may be one of the following: *
209
+ `JPEGEncoding.Standard` Creates a JPEG which downloads
210
+ one line at a time, starting at the top line. *
211
+ `JPEGEncoding.Progressive` Creates a JPEG image that
212
+ can be displayed with a "fade in" effect in a browser.
213
+ This is sometimes useful when viewing the JPEG in a
214
+ browser with a slow connection, since it allows an
215
+ approximation of the JPEG to be drawn immediately, and
216
+ the browser does not have to wait for the entire image
217
+ to download.
218
+
219
+ (default: `JPEGEncoding.Standard`)
220
+ quality (`int` 1-100, optional) Select the quality of JPEG image.
221
+ Higher quality settings produce larger files and better looking
222
+ export images. Lower quality settings produce smaller files.
223
+ For best results, use a quality setting of **75** or higher.
224
+ (default: **75**)
225
+
226
+ Raises:
227
+ `TecplotSystemError`: The image could not be saved due to a
228
+ file I/O error or invalid attribute.
229
+
230
+ .. note:: **Absolute and relative paths with PyTecplot**
231
+
232
+ Relative paths, when used within the PyTecplot API are always from
233
+ Python's current working directory which can be obtained by calling
234
+ :func:`os.getcwd()`. This is true for batch and `connected
235
+ <tecplot.session.connect()>` modes. One exception to this is paths
236
+ within a macro command or file which will be relative to the |Tecplot
237
+ Engine|'s home directory, which is typically the |Tecplot 360|
238
+ installation directory. Finally, when connected to a remote (non-local)
239
+ instance of Tecplot 360, only absolute paths are allowed.
240
+
241
+ Note that backslashes must be escaped which is especially important for
242
+ windows paths such as ``"C:\\\\Users"`` or ``"\\\\\\\\server\\\\path"``
243
+ which will resolve to ``"C:\\Users"`` and ``"\\\\server\\path"``
244
+ respectively. Alternatively, one may use Python's raw strings:
245
+ ``r"C:\\Users"`` and ``r"\\\\server\\path"``
246
+
247
+ .. note::
248
+ |export_general_info|
249
+
250
+ Create a new `frame <layout.Frame>` and save a JPEG image of the frame
251
+ with quality **50** and supersampling::
252
+
253
+ >>> frame = tecplot.active_page().add_frame()
254
+ >>> tecplot.load_layout('mylayout.lay')
255
+ >>> tecplot.export.save_jpeg('image.jpeg', width=600, supersample=3,
256
+ ... region=frame, quality=50)
257
+ """
258
+ setup = ExportSetup()
259
+ setup.reset()
260
+ setup.format = ExportFormat.JPEG
261
+ setup.filename = filename
262
+ setup.width = width
263
+ setup.supersample = supersample
264
+ setup.quality = quality
265
+ setup.jpeg_encoding = encoding
266
+
267
+ export_image(region)
268
+ log.info('JPEG image file created: ' + filename)
269
+
270
+
271
+ def save_tiff(filename, width=800, region=ExportRegion.AllFrames,
272
+ supersample=3, convert_to_256_colors=False,
273
+ gray_scale_depth=None, byte_order=TIFFByteOrder.Intel):
274
+ """Save a `TIFF image
275
+ <https://en.wikipedia.org/wiki/TIFF>`_.
276
+
277
+ Parameters:
278
+ filename (`str`): |export_filename_description| (See note
279
+ below concerning absolute and relative paths.)
280
+ width (`int`): |export_width_description|
281
+ region (`frame <tecplot.layout.Frame>` or `ExportRegion`, optional): If
282
+ ``region`` is a `frame object <tecplot.layout.Frame>`, then the
283
+ contents of the frame will be exported. If region is
284
+ `ExportRegion.CurrentFrame`, then the contents of the currently
285
+ active frame will be exported. If region is
286
+ `ExportRegion.AllFrames`, then the smallest rectangle containing
287
+ all frames will be exported. If region is `ExportRegion.WorkArea`,
288
+ then everything shown in the workspace will be exported. (default:
289
+ `ExportRegion.AllFrames`)
290
+ supersample (`int`, optional): |export_supersample_description|
291
+ convert_to_256_colors (`Boolean <bool>`, optional): |export_convert256_description|
292
+ gray_scale_depth (`int`, optional) Export a gray-scale TIFF.
293
+ The ``gray_scale_depth`` parameter may be set to a depth of
294
+ **1-8**
295
+
296
+ ``gray_scale_depth`` specifies the number of shades of gray by how
297
+ many bits of gray scale information is used per pixel. The larger
298
+ the number of bits per pixel, the larger the resulting file.
299
+
300
+ Options are: * **0**: On/Off One bit per pixel using an
301
+ on/off strategy. All background pixels are made white (on),
302
+ and all foreground pixels, black (off). This setting
303
+ creates small files and is good for images with lots of
304
+ background, such as line plots and contour lines. *
305
+ **1**: 1 Bit per Pixel One bit per pixel using gray scale
306
+ values of pixels to determine black or white. Those
307
+ pixels that are more than 50 percent gray are black; the
308
+ rest are white. This setting creates small files that might
309
+ be useful for a rough draft or a preview image. *
310
+ **4**: 4 Bits per Pixel Four bits per pixel resulting
311
+ in sixteen levels of gray scale. This setting generates
312
+ fairly small image files with a fair number of gray levels.
313
+ This setting works well for most preview image purposes. *
314
+ **8**: 8 Bits per Pixel Eight bits per pixel resulting in
315
+ 256 levels of gray. This setting is useful for full image
316
+ representation, but the files generated by this setting can
317
+ be large.
318
+
319
+ (default: `None`)
320
+ byte_order (`TIFFByteOrder`, optional) Specify the byte order
321
+ (Intel or Motorola) of the TIFF image. (Default:
322
+ `TIFFByteOrder.Intel`)
323
+
324
+ Raises:
325
+ `TecplotSystemError`: The image could not be saved due to a
326
+ file I/O error or invalid attribute.
327
+
328
+ .. note:: **Absolute and relative paths with PyTecplot**
329
+
330
+ Relative paths, when used within the PyTecplot API are always from
331
+ Python's current working directory which can be obtained by calling
332
+ :func:`os.getcwd()`. This is true for batch and `connected
333
+ <tecplot.session.connect()>` modes. One exception to this is paths
334
+ within a macro command or file which will be relative to the |Tecplot
335
+ Engine|'s home directory, which is typically the |Tecplot 360|
336
+ installation directory. Finally, when connected to a remote (non-local)
337
+ instance of Tecplot 360, only absolute paths are allowed.
338
+
339
+ Note that backslashes must be escaped which is especially important for
340
+ windows paths such as ``"C:\\\\Users"`` or ``"\\\\\\\\server\\\\path"``
341
+ which will resolve to ``"C:\\Users"`` and ``"\\\\server\\path"``
342
+ respectively. Alternatively, one may use Python's raw strings:
343
+ ``r"C:\\Users"`` and ``r"\\\\server\\path"``
344
+
345
+ .. note::
346
+ |export_general_info|
347
+
348
+ Save a 4-bit gray scale TIFF image of the entire workspace with supersampling::
349
+
350
+ >>> from tecplot.constant import ExportRegion
351
+ >>> tecplot.load_layout('mylayout.lay')
352
+ >>> tecplot.export.save_tiff('image.tiff', width=600, supersample=2,
353
+ >>> region=ExportRegion.WorkArea,
354
+ >>> gray_scale_depth=4)
355
+ """
356
+
357
+ print_setup = PrintSetup()
358
+ print_setup.palette = (
359
+ Palette.Color if gray_scale_depth is None else Palette.Monochrome)
360
+
361
+ setup = ExportSetup()
362
+ setup.reset()
363
+ setup.format = ExportFormat.TIFF
364
+ setup.filename = filename
365
+ setup.width = width
366
+ setup.supersample = supersample
367
+ setup.convert_to_256_colors = convert_to_256_colors
368
+ setup.gray_scale_depth = gray_scale_depth
369
+ setup.tiff_byte_order = byte_order
370
+
371
+ export_image(region)
372
+ log.info('TIFF image file created: ' + filename)
373
+
374
+
375
+ def save_png(filename, width=800, region=ExportRegion.AllFrames,
376
+ supersample=3, convert_to_256_colors=False):
377
+ """Save a `PNG image
378
+ <https://en.wikipedia.org/wiki/Portable_Network_Graphics>`_.
379
+
380
+ Parameters:
381
+ filename (`str`): |export_filename_description| (See note
382
+ below concerning absolute and relative paths.)
383
+ width (`int`): |export_width_description|
384
+ region (`frame <tecplot.layout.Frame>` or `ExportRegion`, optional): If
385
+ ``region`` is a `frame object <tecplot.layout.Frame>`, then the
386
+ contents of the frame will be exported. If region is
387
+ `ExportRegion.CurrentFrame`, then the contents of the currently
388
+ active frame will be exported. If region is
389
+ `ExportRegion.AllFrames`, then the smallest rectangle containing
390
+ all frames will be exported. If region is `ExportRegion.WorkArea`,
391
+ then everything shown in the workspace will be exported. (default:
392
+ `ExportRegion.AllFrames`)
393
+ supersample (`int`, optional): |export_supersample_description|
394
+ convert_to_256_colors (`Boolean <bool>`, optional): |export_convert256_description|
395
+
396
+ Raises:
397
+ `TecplotSystemError`: The image could not be saved due to a
398
+ file I/O error or invalid attribute.
399
+
400
+ .. note:: **Absolute and relative paths with PyTecplot**
401
+
402
+ Relative paths, when used within the PyTecplot API are always from
403
+ Python's current working directory which can be obtained by calling
404
+ :func:`os.getcwd()`. This is true for batch and `connected
405
+ <tecplot.session.connect()>` modes. One exception to this is paths
406
+ within a macro command or file which will be relative to the |Tecplot
407
+ Engine|'s home directory, which is typically the |Tecplot 360|
408
+ installation directory. Finally, when connected to a remote (non-local)
409
+ instance of Tecplot 360, only absolute paths are allowed.
410
+
411
+ Note that backslashes must be escaped which is especially important for
412
+ windows paths such as ``"C:\\\\Users"`` or ``"\\\\\\\\server\\\\path"``
413
+ which will resolve to ``"C:\\Users"`` and ``"\\\\server\\path"``
414
+ respectively. Alternatively, one may use Python's raw strings:
415
+ ``r"C:\\Users"`` and ``r"\\\\server\\path"``
416
+
417
+ .. note::
418
+ |export_general_info|
419
+
420
+ Save a PNG image of the entire workspace with supersampling::
421
+
422
+ >>> from tecplot.constant import ExportRegion
423
+ >>> tecplot.load_layout('mylayout.lay')
424
+ >>> tecplot.export.save_png('image.png', width=600, supersample=3,
425
+ ... region=ExportRegion.WorkArea)
426
+ """
427
+ setup = ExportSetup()
428
+ setup.reset()
429
+ setup.format = ExportFormat.PNG
430
+ setup.filename = filename
431
+ setup.width = width
432
+ setup.supersample = supersample
433
+ setup.convert_to_256_colors = convert_to_256_colors
434
+
435
+ export_image(region)
436
+ log.info('PNG image file created: ' + filename)
437
+
438
+
439
+ def save_wmf(filename, palette=Palette.Color, region=ExportRegion.AllFrames,
440
+ force_extra_3d_sorting=False):
441
+ """Save a Windows Metafile image
442
+
443
+ Parameters:
444
+ filename (`str`): |export_filename_description| (See note
445
+ below concerning absolute and relative paths.)
446
+ palette (`Palette`, optional): Export color image. (default:
447
+ `Palette.Color`) Note: `Palette.PenPlotter` cannot be used.
448
+ region (`frame <tecplot.layout.Frame>` or `ExportRegion`, optional): If
449
+ ``region`` is a `frame object <tecplot.layout.Frame>`, then the
450
+ contents of the frame will be exported. If region is
451
+ `ExportRegion.CurrentFrame`, then the contents of the currently
452
+ active frame will be exported. If region is
453
+ `ExportRegion.AllFrames`, then the smallest rectangle containing
454
+ all frames will be exported. If region is `ExportRegion.WorkArea`,
455
+ then everything shown in the workspace will be exported. (default:
456
+ `ExportRegion.AllFrames`)
457
+ force_extra_3d_sorting (`bool`, optional): Force extra sorting for all
458
+ 3D frames. (default: `False`)
459
+
460
+ Raises:
461
+ `TecplotSystemError`: The image could not be saved due to a
462
+ file I/O error or invalid attribute.
463
+
464
+ .. note:: **Absolute and relative paths with PyTecplot**
465
+
466
+ Relative paths, when used within the PyTecplot API are always from
467
+ Python's current working directory which can be obtained by calling
468
+ :func:`os.getcwd()`. This is true for batch and `connected
469
+ <tecplot.session.connect()>` modes. One exception to this is paths
470
+ within a macro command or file which will be relative to the |Tecplot
471
+ Engine|'s home directory, which is typically the |Tecplot 360|
472
+ installation directory. Finally, when connected to a remote (non-local)
473
+ instance of Tecplot 360, only absolute paths are allowed.
474
+
475
+ Note that backslashes must be escaped which is especially important for
476
+ windows paths such as ``"C:\\\\Users"`` or ``"\\\\\\\\server\\\\path"``
477
+ which will resolve to ``"C:\\Users"`` and ``"\\\\server\\path"``
478
+ respectively. Alternatively, one may use Python's raw strings:
479
+ ``r"C:\\Users"`` and ``r"\\\\server\\path"``
480
+
481
+ .. note::
482
+ WMF (Windows Metafile) is a Microsoft vector graphics format widely
483
+ accepted by Windows applications. Since WMFs are vector graphics, they
484
+ can be easily resized by the importing application without the
485
+ introduction of visual artifacts, but they cannot accurately represent
486
+ plots with translucency or smooth color gradations
487
+
488
+ Save a WMF image of the active frame::
489
+
490
+ >>> tecplot.load_layout('mylayout.lay')
491
+ >>> tecplot.export.save_wmf('image.wmf')
492
+ """
493
+ print_setup = PrintSetup()
494
+ print_setup.reset()
495
+ print_setup.palette = palette
496
+ print_setup.force_extra_3d_sorting = force_extra_3d_sorting
497
+
498
+ export_setup = ExportSetup()
499
+ export_setup.reset()
500
+ export_setup.format = ExportFormat.WindowsMetafile
501
+ export_setup.filename = filename
502
+
503
+ export_image(region)
504
+ log.info('Windows metafile image created: ' + filename)
505
+
506
+
507
+ def save_ps(filename, palette=Palette.Color, region=ExportRegion.AllFrames,
508
+ force_extra_3d_sorting=False, extra_precision=0,
509
+ render_type=PrintRenderType.Vector, resolution=150):
510
+ """Save a `PostScript image <https://en.wikipedia.org/wiki/PostScript>`_.
511
+
512
+ Parameters:
513
+ filename (`str`): |export_filename_description| (See note
514
+ below concerning absolute and relative paths.)
515
+ palette (`Palette`, optional): Export color image. (default: `Palette.Color`)
516
+ region (`frame <tecplot.layout.Frame>` or `ExportRegion`, optional): If
517
+ ``region`` is a `frame object <tecplot.layout.Frame>`, then the
518
+ contents of the frame will be exported. If region is
519
+ `ExportRegion.CurrentFrame`, then the contents of the currently
520
+ active frame will be exported. If region is
521
+ `ExportRegion.AllFrames`, then the smallest rectangle containing
522
+ all frames will be exported. If region is `ExportRegion.WorkArea`,
523
+ then everything shown in the workspace will be exported. (default:
524
+ `ExportRegion.AllFrames`)
525
+ force_extra_3d_sorting (`bool`, optional): Force extra sorting for all
526
+ 3D frames. (default: `False`)
527
+ extra_precision (`int`, optional): Additional digits for all numbers
528
+ written to postscript file. (default: 0)
529
+ render_type (`PrintRenderType`, optional): Whether to render the
530
+ postscript as a rasterized or vector image. (default:
531
+ `PrintRenderType.Vector`)
532
+ resolution (`int`): Resolution of the image in dots per inch.
533
+ Larger values create more accurate plots, but result in larger file
534
+ sizes. Note: this value is ignored if `PrintRenderType` is
535
+ `PrintRenderType.Vector` (default: **150**)
536
+
537
+ Raises:
538
+ `TecplotSystemError`: The image could not be saved due to a
539
+ file I/O error or invalid attribute.
540
+
541
+ .. note:: **Absolute and relative paths with PyTecplot**
542
+
543
+ Relative paths, when used within the PyTecplot API are always from
544
+ Python's current working directory which can be obtained by calling
545
+ :func:`os.getcwd()`. This is true for batch and `connected
546
+ <tecplot.session.connect()>` modes. One exception to this is paths
547
+ within a macro command or file which will be relative to the |Tecplot
548
+ Engine|'s home directory, which is typically the |Tecplot 360|
549
+ installation directory. Finally, when connected to a remote (non-local)
550
+ instance of Tecplot 360, only absolute paths are allowed.
551
+
552
+ Note that backslashes must be escaped which is especially important for
553
+ windows paths such as ``"C:\\\\Users"`` or ``"\\\\\\\\server\\\\path"``
554
+ which will resolve to ``"C:\\Users"`` and ``"\\\\server\\path"``
555
+ respectively. Alternatively, one may use Python's raw strings:
556
+ ``r"C:\\Users"`` and ``r"\\\\server\\path"``
557
+
558
+ Save a PostScript image of the active frame::
559
+
560
+ >>> tecplot.load_layout('mylayout.lay')
561
+ >>> tecplot.export.save_ps('image.ps')
562
+ """
563
+ print_setup = PrintSetup()
564
+ print_setup.reset()
565
+ print_setup.palette = palette
566
+ print_setup.force_extra_3d_sorting = force_extra_3d_sorting
567
+ print_setup.extra_precision = extra_precision
568
+ print_setup.resolution = resolution
569
+
570
+ export_setup = ExportSetup()
571
+ export_setup.reset()
572
+ export_setup.format = ExportFormat.PS
573
+ export_setup.filename = filename
574
+ export_setup.render_type = render_type
575
+
576
+ export_image(region)
577
+ log.info('Postscript file created: ' + filename)