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,1949 @@
1
+ from builtins import int
2
+
3
+ import collections
4
+ import ctypes
5
+
6
+ from ..tecutil import _tecutil
7
+ from ..constant import *
8
+ from ..exception import *
9
+ from ..tecutil import Index, IndexSet, color_spec, lock, sv
10
+ from .. import session, tecutil, version
11
+ from . import symbol
12
+
13
+
14
+ class StreamtraceStyle(session.Style):
15
+ def __init__(self, streamtrace, *sv_args):
16
+ self.streamtrace = streamtrace
17
+ kw = dict(uniqueid=streamtrace.plot.frame.uid)
18
+ super().__init__(streamtrace._sv, *sv_args, **kw)
19
+
20
+
21
+ class StreamtraceTiming(StreamtraceStyle):
22
+ """Timed markers for streamlines.
23
+
24
+ Use `StreamtraceTiming` to control timed markers for streamlines, and timed
25
+ dashes for all types of streamtraces. Stream markers are drawn at time
26
+ locations along streamlines. The spacing between stream markers is
27
+ proportional to the magnitude of the local vector field:
28
+
29
+ .. code-block:: python
30
+ :emphasize-lines: 22-24
31
+
32
+ import tecplot
33
+ from tecplot.constant import *
34
+ import os
35
+
36
+ examples_dir = tecplot.session.tecplot_examples_directory()
37
+ datafile = os.path.join(examples_dir, 'SimpleData', 'VortexShedding.plt')
38
+ dataset = tecplot.data.load_tecplot(datafile)
39
+
40
+ frame = tecplot.active_frame()
41
+ frame.plot_type = tecplot.constant.PlotType.Cartesian2D
42
+
43
+ plot = frame.plot()
44
+ plot.vector.u_variable = dataset.variable('U(M/S)')
45
+ plot.vector.v_variable = dataset.variable('V(M/S)')
46
+ plot.show_streamtraces = True
47
+ plot.show_shade = True
48
+ plot.fieldmap(0).shade.color = Color.LightBlue
49
+
50
+
51
+ streamtraces = plot.streamtraces
52
+ streamtraces.show_markers = True
53
+ timing = streamtraces.timing
54
+ timing.anchor = 0
55
+ timing.delta = 0.0001
56
+
57
+ streamtraces.marker_size = 1.5
58
+ streamtraces.marker_symbol().shape =GeomShape.RTri
59
+ streamtraces.marker_color = Color.Mahogany
60
+
61
+ streamtraces.add_rake(start_position=(-0.003, 0.005),
62
+ end_position=(-0.003, -0.005),
63
+ stream_type=Streamtrace.TwoDLine,
64
+ num_seed_points=10)
65
+
66
+
67
+ plot.axes.y_axis.min = -0.02
68
+ plot.axes.y_axis.max = 0.02
69
+ plot.axes.x_axis.min = -0.008
70
+ plot.axes.x_axis.max = 0.04
71
+
72
+ tecplot.export.save_png('streamtrace_timing.png', 600, supersample=3)
73
+
74
+ .. figure:: /_static/images/streamtrace_timing.png
75
+ :width: 300px
76
+ :figwidth: 300px
77
+
78
+ """
79
+
80
+ def __init__(self, streamtrace):
81
+ super().__init__(streamtrace, sv.STREAMTIMING)
82
+
83
+ @lock()
84
+ def reset_delta(self):
85
+ """Reset the time delta for dashed streamtraces.
86
+
87
+
88
+ The delta time is reset such that a stream dash in the vicinity of
89
+ the maximum vector magnitude will have a length approximately equal
90
+ to 10 percent of the frame width.
91
+
92
+ Raises:
93
+ `TecplotSystemError`: Streamtraces time delta could not be reset.
94
+
95
+ Example usage::
96
+
97
+ >>> plot.streamtraces.timing.reset_delta()
98
+ """
99
+ with self.streamtrace.plot.frame.activated():
100
+ if not _tecutil.StreamtraceResetDelta():
101
+ raise TecplotSystemError()
102
+
103
+ @property
104
+ def _show_dashes(self):
105
+ return self._get_style(bool, sv.SHOWDASHES)
106
+
107
+ @_show_dashes.setter
108
+ def _show_dashes(self, value):
109
+ self._set_style(bool(value), sv.SHOWDASHES)
110
+
111
+ @property
112
+ def _show_markers(self):
113
+ return self._get_style(bool, sv.SHOWMARKERS)
114
+
115
+ @_show_markers.setter
116
+ def _show_markers(self, value):
117
+ self._set_style(bool(value), sv.SHOWMARKERS)
118
+
119
+ @property
120
+ def _marker_color(self):
121
+ return color_spec(self._get_style(Color, sv.MARKCOLOR),
122
+ self.streamtrace.plot)
123
+
124
+ @_marker_color.setter
125
+ def _marker_color(self, value):
126
+ self._set_style(color_spec(value), sv.MARKCOLOR)
127
+
128
+ @property
129
+ def _marker_size(self):
130
+ return self._get_style(float, sv.MARKSIZE)
131
+
132
+ @_marker_size.setter
133
+ def _marker_size(self, value):
134
+ self._set_style(float(value), sv.MARKSIZE)
135
+
136
+ @property
137
+ def _dash_skip(self):
138
+ return self._get_style(int, sv.DASHSKIP)
139
+
140
+ @_dash_skip.setter
141
+ def _dash_skip(self, value):
142
+ self._set_style(int(value), sv.DASHSKIP)
143
+
144
+ @property
145
+ def _marker_symbol_type(self):
146
+ return symbol.Symbol(self, sv.MARKSYMBOL)._symbol_type
147
+
148
+ @_marker_symbol_type.setter
149
+ def _marker_symbol_type(self, value):
150
+ symbol.Symbol(self, sv.MARKSYMBOL)._symbol_type = value
151
+
152
+ def _marker_symbol(self, symbol_type=None):
153
+ _dispatch = {
154
+ SymbolType.Text: symbol.TextSymbol,
155
+ SymbolType.Geometry: symbol.GeometrySymbol}
156
+ return _dispatch[symbol_type or self._marker_symbol_type](
157
+ self, sv.MARKSYMBOL)
158
+
159
+ @property
160
+ def start(self):
161
+ """`float`: Time at which the first marker should be drawn.
162
+
163
+ A start time of zero means that the first marker is drawn at the
164
+ starting point. A start time of 2.5 means that the first stream
165
+ marker is drawn 2.5 time units downstream of the starting point.
166
+
167
+ Example usage::
168
+
169
+ >>> plot.streamtraces.timing.start = 2.5
170
+ """
171
+ return self._get_style(float, sv.TIMESTART)
172
+
173
+ @start.setter
174
+ def start(self, value):
175
+ self._set_style(float(value), sv.TIMESTART)
176
+
177
+ @property
178
+ def end(self):
179
+ """`float`: Time after which no stream markers are drawn.
180
+
181
+ Example usage::
182
+
183
+ >>> plot.streamtraces.timing.end = 3.0
184
+ """
185
+ return self._get_style(float, sv.TIMEEND)
186
+
187
+ @end.setter
188
+ def end(self, value):
189
+ self._set_style(float(value), sv.TIMEEND)
190
+
191
+ @property
192
+ def anchor(self):
193
+ """`float`: Time that a dash is guaranteed to start.
194
+
195
+ A dash is guaranteed to start at `anchor`, provided the start
196
+ and end time surround the dash.
197
+
198
+ Example usage::
199
+
200
+ >>> plot.streamtraces.timing.anchor = 1.1
201
+ """
202
+ return self._get_style(float, sv.TIMEANCHOR)
203
+
204
+ @anchor.setter
205
+ def anchor(self, value):
206
+ self._set_style(float(value), sv.TIMEANCHOR)
207
+
208
+ @property
209
+ def delta(self):
210
+ """`float`: Time between stream markers.
211
+
212
+ `delta` is the time interval that measures the time between
213
+ stream markers. The actual distance between markers is the product
214
+ of this number and the local `Vector` magnitude.
215
+
216
+ Call `StreamtraceTiming.reset_delta()` to reset this to the default.
217
+
218
+ Example usage::
219
+
220
+ >>> plot.streamtraces.timing.delta = 0.1
221
+ """
222
+ return self._get_style(float, sv.TIMEDELTA)
223
+
224
+ @delta.setter
225
+ def delta(self, value):
226
+ self._set_style(float(value), sv.TIMEDELTA)
227
+
228
+
229
+ class StreamtraceTerminationLine(StreamtraceStyle):
230
+ """Streamtraces termination line attributes.
231
+
232
+ A streamtrace termination line is a polyline that terminates any
233
+ streamtraces that cross it. The termination line is useful for stopping
234
+ streamtraces before they spiral or stall.
235
+
236
+ .. note::
237
+ Before setting any `StreamtraceTerminationLine` properties, you must
238
+ `add a termination line <set_termination_line>`.
239
+
240
+ Streamtraces are terminated whenever any of the following occur:
241
+
242
+ * The maximum number of integration steps is reached.
243
+ * Any point where a streamtrace passes outside the available data.
244
+ * The streamtrace reaches a point where the velocity magnitude is zero.
245
+
246
+ .. code-block:: python
247
+ :emphasize-lines: 19-29
248
+
249
+ import tecplot
250
+ from tecplot.constant import *
251
+ import os
252
+
253
+ examples_dir = tecplot.session.tecplot_examples_directory()
254
+ datafile = os.path.join(examples_dir, 'SimpleData', 'VortexShedding.plt')
255
+ dataset = tecplot.data.load_tecplot(datafile)
256
+
257
+ frame = tecplot.active_frame()
258
+ frame.plot_type = tecplot.constant.PlotType.Cartesian2D
259
+
260
+ plot = frame.plot()
261
+ plot.vector.u_variable = dataset.variable('U(M/S)')
262
+ plot.vector.v_variable = dataset.variable('V(M/S)')
263
+ plot.show_streamtraces = True
264
+ plot.show_shade = True
265
+ plot.fieldmap(0).shade.color = Color.LightBlue
266
+
267
+ streamtraces = plot.streamtraces
268
+ streamtraces.set_termination_line([(0.03, 0.005),
269
+ (0.03, -0.005), ])
270
+
271
+ term_line = streamtraces.termination_line
272
+ term_line.active = True
273
+ term_line.show = True
274
+ term_line.color = Color.Red
275
+ term_line.line_pattern = LinePattern.Dashed
276
+ term_line.pattern_length = .5
277
+ term_line.line_thickness = .5
278
+
279
+ streamtraces.add_rake(start_position=(-0.003, 0.005),
280
+ end_position=(-0.003, -0.005),
281
+ stream_type=Streamtrace.TwoDLine,
282
+ num_seed_points=10)
283
+
284
+ plot.axes.y_axis.min = -0.02
285
+ plot.axes.y_axis.max = 0.02
286
+ plot.axes.x_axis.min = -0.01
287
+ plot.axes.x_axis.max = 0.04
288
+
289
+ tecplot.export.save_png('streamtrace_term_line.png', 600, supersample=3)
290
+
291
+ .. figure:: /_static/images/streamtrace_term_line.png
292
+ :width: 300px
293
+ :figwidth: 300px
294
+ """
295
+
296
+ def __init__(self, streamtrace):
297
+ super().__init__(streamtrace, sv.TERMLINE)
298
+
299
+ @property
300
+ def active(self):
301
+ """`bool`: Activate/disable the streamtrace termination line.
302
+
303
+ Set to `True` to activate the termination line and terminate any
304
+ streamtraces that cross it. Set to `False` and redraw the plot
305
+ with unterminated streamtraces.
306
+
307
+ .. note::
308
+ To display the termination line itself, set `show` to `True`.
309
+
310
+ Example usage::
311
+
312
+ >>> plot.streamtraces.termination_line.active = True
313
+ """
314
+ return self._get_style(bool, sv.ISACTIVE)
315
+
316
+ @active.setter
317
+ def active(self, value):
318
+ self._set_style(bool(value), sv.ISACTIVE)
319
+
320
+ @property
321
+ def is_active(self):
322
+ tecutil.api_moved('StreamtraceTerminationLine.is_active',
323
+ 'StreamtraceTerminationLine.active',
324
+ '0.13', '2018 R2')
325
+
326
+ @is_active.setter
327
+ def is_active(self, value):
328
+ tecutil.api_moved('StreamtraceTerminationLine.is_active',
329
+ 'StreamtraceTerminationLine.active',
330
+ '0.13', '2018 R2')
331
+
332
+ @property
333
+ def show(self):
334
+ """`bool`: Display the termination line.
335
+
336
+ Set to `True` to display the termination line. Set to `False` and
337
+ redraw the plot to display terminated streamlines (if `active` is
338
+ set to `True`), but not the termination line itself.
339
+
340
+ .. note::
341
+ To display terminated streamtraces, `active` must be set to
342
+ `True`.
343
+
344
+ Example usage::
345
+
346
+ >>> plot.streamtraces.termination_line.show = True
347
+ """
348
+ return self._get_style(bool, sv.SHOW)
349
+
350
+ @show.setter
351
+ def show(self, value):
352
+ self._set_style(bool(value), sv.SHOW)
353
+
354
+ @property
355
+ def color(self):
356
+ """`Color`: Color of the termination line.
357
+
358
+ Example usage::
359
+
360
+ >>> plot.streamtraces.termination_line.color = Color.Red
361
+ """
362
+ return self._get_style(Color, sv.COLOR)
363
+
364
+ @color.setter
365
+ def color(self, value):
366
+ self._set_style(Color(value), sv.COLOR)
367
+
368
+ @property
369
+ def line_pattern(self):
370
+ """`LinePattern`: Pattern of the terminating line.
371
+
372
+ Example usage::
373
+
374
+ >>> plot.streamtraces.termination_line.line_pattern = LinePattern.Dotted
375
+ """
376
+ return self._get_style(LinePattern, sv.LINEPATTERN)
377
+
378
+ @line_pattern.setter
379
+ def line_pattern(self, value):
380
+ self._set_style(LinePattern(value), sv.LINEPATTERN)
381
+
382
+ @property
383
+ def pattern_length(self):
384
+ """`float`: Length of the pattern as a percentage of frame height.
385
+
386
+ Example usage::
387
+
388
+ >>> plot.streamtraces.termination_line.pattern_length = 2
389
+ """
390
+ return self._get_style(float, sv.PATTERNLENGTH)
391
+
392
+ @pattern_length.setter
393
+ def pattern_length(self, value):
394
+ self._set_style(float(value), sv.PATTERNLENGTH)
395
+
396
+ @property
397
+ def line_thickness(self):
398
+ """`float`: Thickness of the termination line as a percentage of frame height.
399
+
400
+ Example usage::
401
+
402
+ >>> plot.streamtraces.termination_line.line_thickness = 0.1
403
+ """
404
+ return self._get_style(float, sv.LINETHICKNESS)
405
+
406
+ @line_thickness.setter
407
+ def line_thickness(self, value):
408
+ self._set_style(float(value), sv.LINETHICKNESS)
409
+
410
+
411
+ class StreamtraceRodRibbonMesh(StreamtraceStyle):
412
+ """Streamtraces rod/ribbon mesh attributes.
413
+
414
+ .. note::
415
+ To set the mesh color or line thickness, see `Streamtraces.color`
416
+ and `Streamtraces.line_thickness`.
417
+
418
+ .. code-block:: python
419
+ :emphasize-lines: 25-28
420
+
421
+ import os
422
+ import tecplot
423
+ from tecplot.constant import *
424
+
425
+ examples_dir = tecplot.session.tecplot_examples_directory()
426
+ datafile = os.path.join(examples_dir, 'SimpleData', 'DownDraft.plt')
427
+ dataset = tecplot.data.load_tecplot(datafile)
428
+
429
+ frame = tecplot.active_frame()
430
+ frame.plot_type = tecplot.constant.PlotType.Cartesian3D
431
+
432
+ plot = frame.plot()
433
+ plot.fieldmap(0).surfaces.surfaces_to_plot = SurfacesToPlot.BoundaryFaces
434
+ plot.show_mesh = False
435
+ plot.show_shade = False
436
+ plot.show_edge = True
437
+
438
+ plot.vector.u_variable_index = 4
439
+ plot.vector.v_variable_index = 5
440
+ plot.vector.w_variable_index = 6
441
+ plot.show_streamtraces = True
442
+
443
+ ribbon = plot.streamtraces.rod_ribbon
444
+ ribbon.width = .008
445
+ ribbon.mesh.show = True
446
+ ribbon.mesh.line_thickness = 0.2
447
+ #Ribbon mesh color inherited from streamtrace color
448
+ plot.streamtraces.color = Color.AquaGreen
449
+
450
+ plot.streamtraces.add_rake(
451
+ start_position=(0, 0.22, 0),
452
+ end_position=(0, 0.22, 0.1),
453
+ stream_type=Streamtrace.VolumeRibbon)
454
+
455
+ plot.view.width = 0.644
456
+ plot.view.alpha = 66.4
457
+ plot.view.theta = -122.4
458
+ plot.view.psi = 124.5
459
+ plot.view.position = (5.3, 3.56, -4.3)
460
+
461
+ tecplot.export.save_png('streamtrace_ribbon_mesh.png', 600, supersample=3)
462
+
463
+ .. figure:: /_static/images/streamtrace_ribbon_mesh.png
464
+ :width: 300px
465
+ :figwidth: 300px
466
+
467
+ """
468
+ def __init__(self, robribbon):
469
+ super().__init__(robribbon, sv.MESH)
470
+ self.streamtrace = robribbon.streamtrace
471
+
472
+ @property
473
+ def show(self):
474
+ """`bool`: Display mesh.
475
+
476
+ .. note::
477
+
478
+ The mesh color for streamtraces is determined by the line color.
479
+
480
+ Example usage::
481
+
482
+ >>> plot.streamtraces.rod_ribbon.mesh.show = True
483
+ """
484
+ return self._get_style(bool, sv.SHOW)
485
+
486
+ @show.setter
487
+ def show(self, value):
488
+ self._set_style(bool(value), sv.SHOW)
489
+
490
+ @property
491
+ def line_thickness(self):
492
+ """`float`: Get/Set streamtrace rod/ribbon mesh line thickness as a
493
+ percentage of frame height.
494
+
495
+ Typical values are **.02, .1, .4, .8, 1.5**
496
+
497
+ Example usage::
498
+
499
+ >>> plot.streamtraces.rod_ribbon.mesh.line_thickness = 0.2
500
+ """
501
+ return self.streamtrace._get_style(float, sv.LINETHICKNESS)
502
+
503
+ @line_thickness.setter
504
+ def line_thickness(self, value):
505
+ self.streamtrace._set_style(float(value), sv.LINETHICKNESS)
506
+
507
+
508
+ class StreamtraceRodRibbonContour(StreamtraceStyle):
509
+ """Contour flooding display for streamtrace rod/ribbons.
510
+
511
+ .. code-block:: python
512
+ :emphasize-lines: 15-16,28-29
513
+
514
+ import os
515
+ import numpy as np
516
+ import tecplot
517
+ from tecplot.constant import *
518
+
519
+ examples_dir = tecplot.session.tecplot_examples_directory()
520
+ datafile = os.path.join(examples_dir, 'SimpleData', 'DownDraft.plt')
521
+ dataset = tecplot.data.load_tecplot(datafile)
522
+
523
+ frame = tecplot.active_frame()
524
+ frame.plot_type = tecplot.constant.PlotType.Cartesian3D
525
+
526
+ plot = frame.plot()
527
+ plot.fieldmap(0).surfaces.surfaces_to_plot = SurfacesToPlot.BoundaryFaces
528
+ plot.contour(0).variable = dataset.variable(3)
529
+ plot.contour(0).levels.reset_levels(np.linspace(1.15,1.25,11))
530
+ plot.show_mesh = False
531
+ plot.show_shade = False
532
+ plot.show_edge = True
533
+
534
+ plot.vector.u_variable_index = 4
535
+ plot.vector.v_variable_index = 5
536
+ plot.vector.w_variable_index = 6
537
+ plot.show_streamtraces = True
538
+
539
+ rod = plot.streamtraces.rod_ribbon
540
+ rod.width = .008
541
+ rod.contour.show = True
542
+ rod.contour.use_lighting_effect = True
543
+
544
+ plot.streamtraces.add_rake(
545
+ start_position=(0, 0.22, 0),
546
+ end_position=(0, 0.22, 0.1),
547
+ stream_type=Streamtrace.VolumeRod)
548
+
549
+ plot.view.width = 0.644
550
+ plot.view.alpha = 66.4
551
+ plot.view.theta = -122.4
552
+ plot.view.psi = 124.5
553
+ plot.view.position = (5.3, 3.56, -4.3)
554
+
555
+ tecplot.export.save_png('streamtrace_rod_contour.png', 600, supersample=3)
556
+
557
+ .. figure:: /_static/images/streamtrace_rod_contour.png
558
+ :width: 300px
559
+ :figwidth: 300px
560
+ """
561
+
562
+ def __init__(self, streamtrace):
563
+ super().__init__(streamtrace, sv.CONTOUR)
564
+
565
+ @property
566
+ def use_lighting_effect(self):
567
+ """`bool`: Enable lighting effect for streamtrace rod/ribbons.
568
+
569
+ .. note::
570
+ Setting `StreamtraceRodRibbonContour.use_lighting_effect` will also set
571
+ the same value for `StreamtraceRodRibbonShade.use_lighting_effect`,
572
+ and vice-versa.
573
+
574
+ The lighting effect is set with `StreamtraceRodRibbonEffects.lighting_effect`, and may
575
+ be one of `LightingEffect.Gouraud` or `LightingEffect.Paneled`.
576
+
577
+ Example usage::
578
+
579
+ >>> ribbon = plot.streamtraces.rod_ribbon
580
+ >>> contour = ribbon.contour
581
+ >>> contour.use_lighting_effect = True
582
+ >>> ribbon.effects.lighting_effect = LightingEffect.Paneled
583
+ """
584
+ return self._get_style(bool, sv.USELIGHTINGEFFECT)
585
+
586
+ @use_lighting_effect.setter
587
+ def use_lighting_effect(self, value):
588
+ self._set_style(bool(value), sv.USELIGHTINGEFFECT)
589
+
590
+ @property
591
+ def show(self):
592
+ """`bool`: Enable or disable contour flooding display.
593
+
594
+ Example usage::
595
+
596
+ >>> plot.streamtraces.rod_ribbon.contour.show = True
597
+ """
598
+ return self._get_style(bool, sv.SHOW)
599
+
600
+ @show.setter
601
+ def show(self, value):
602
+ self._set_style(bool(value), sv.SHOW)
603
+
604
+ @property
605
+ def flood_contour_group_index(self):
606
+ """`Index` (zero-based index): The `Index` of the `ContourGroup` to use for flooding.
607
+
608
+ This property sets and gets, by `Index`, the `ContourGroup` used for
609
+ flooding. Changing style on this `ContourGroup` will affect all
610
+ fieldmaps on the same `Frame <layout.Frame>` that use it.
611
+
612
+ Example usage::
613
+
614
+ >>> contour = plot.streamtraces.rod_ribbon.contour
615
+ >>> contour.flood_contour_group_index = 0 # First contour group
616
+ """
617
+ return self._get_style(Index, sv.FLOODCOLORING)
618
+
619
+ @flood_contour_group_index.setter
620
+ def flood_contour_group_index(self, index):
621
+ self._set_style(Index(index), sv.FLOODCOLORING)
622
+
623
+ @property
624
+ def flood_contour_group(self):
625
+ """`ContourGroup`: Contour group to use for flooding.
626
+
627
+ This property sets and gets the ContourGroup used for flooding.
628
+ Changing style on this `ContourGroup` will affect all fieldmaps on
629
+ the same `Frame <layout.Frame>` that use it.
630
+
631
+ Example usage::
632
+
633
+ >>> group = plot.contour(1)
634
+ >>> contour = plot.streamtraces.rod_ribbon.contour
635
+ >>> contour.flood_contour_group = group
636
+ """
637
+ return self.streamtrace.plot.contour(self.flood_contour_group_index)
638
+
639
+ @flood_contour_group.setter
640
+ def flood_contour_group(self, flood_contour_group):
641
+ self.flood_contour_group_index = flood_contour_group.index
642
+
643
+
644
+ class StreamtraceRodRibbonShade(StreamtraceStyle):
645
+ """Color and lighting display for rod/ribbons.
646
+
647
+ .. code-block:: python
648
+ :emphasize-lines: 25-29
649
+
650
+ import os
651
+ import tecplot
652
+ from tecplot.constant import *
653
+
654
+ examples_dir = tecplot.session.tecplot_examples_directory()
655
+ datafile = os.path.join(examples_dir, 'SimpleData', 'DuctFlow.plt')
656
+ dataset = tecplot.data.load_tecplot(datafile)
657
+
658
+ frame = tecplot.active_frame()
659
+ frame.plot_type = tecplot.constant.PlotType.Cartesian3D
660
+
661
+ plot = frame.plot()
662
+ plot.show_mesh = False
663
+ plot.show_shade = False
664
+ plot.show_edge = True
665
+ plot.fieldmap(0).edge.edge_type = EdgeType.Creases
666
+
667
+ plot.vector.u_variable_index = 3
668
+ plot.vector.v_variable_index = 4
669
+ plot.vector.w_variable_index = 5
670
+
671
+ plot.show_streamtraces = True
672
+ plot.streamtraces.show_paths = True
673
+
674
+ ribbon = plot.streamtraces.rod_ribbon
675
+ ribbon.shade.show = True
676
+ ribbon.shade.color = Color.Blue
677
+ ribbon.shade.use_lighting_effect = True
678
+ ribbon.width = .03
679
+
680
+
681
+ plot.streamtraces.add_rake(start_position=(1.5, 0, .45),
682
+ end_position=(1.5, 1, 0),
683
+ stream_type=Streamtrace.VolumeRibbon)
684
+
685
+ tecplot.export.save_png('streamtrace_ribbon_shade.png', 600, supersample=3)
686
+
687
+ .. figure:: /_static/images/streamtrace_ribbon_shade.png
688
+ :width: 300px
689
+ :figwidth: 300px
690
+ """
691
+ def __init__(self, streamtrace):
692
+ super().__init__(streamtrace, sv.SHADE)
693
+
694
+ @property
695
+ def show(self):
696
+ """`bool`: Show shade attributes.
697
+
698
+ Example usage::
699
+
700
+ >>> plot.streamtraces.rod_ribbon.shade.show = True
701
+ """
702
+ return self._get_style(bool, sv.SHOW)
703
+
704
+ @show.setter
705
+ def show(self, value):
706
+ self._set_style(bool(value), sv.SHOW)
707
+
708
+ @property
709
+ def color(self):
710
+ """`Color`: Shade color.
711
+
712
+ `Color.MultiColor` and `Color.RGBColor` coloring are not available.
713
+ Use flooded contours for multi-color or RGB flooding.
714
+
715
+ Example usage::
716
+
717
+ >>> plot.streamtraces.rod_ribbon.shade.show = True
718
+ >>> plot.streamtraces.rod_ribbon.shade.color = Color.Blue
719
+ """
720
+ return self._get_style(Color, sv.COLOR)
721
+
722
+ @color.setter
723
+ def color(self, value):
724
+ self._set_style(Color(value), sv.COLOR)
725
+
726
+ @property
727
+ def use_lighting_effect(self):
728
+ """`bool`: Use lighting effect.
729
+
730
+ When set to `True`, the lighting effect may be selected with the
731
+ `SliceEffects.lighting_effect` attribute.
732
+
733
+ .. note::
734
+ Setting `SliceShade.use_lighting_effect` will also set
735
+ the same value for `SliceContour.use_lighting_effect`,
736
+ and vice-versa.
737
+
738
+ Example usage::
739
+
740
+ >>> plot.streamtraces.rod_ribbon.shade.use_lighting_effect = True
741
+ >>> plot.streamtraces.rod_ribbon.effects.lighting_effect = LightingEffect.Paneled
742
+ """
743
+ return self._get_style(bool, sv.USELIGHTINGEFFECT)
744
+
745
+ @use_lighting_effect.setter
746
+ def use_lighting_effect(self, value):
747
+ self._set_style(bool(value), sv.USELIGHTINGEFFECT)
748
+
749
+
750
+ class StreamtraceRodRibbonEffects(StreamtraceStyle):
751
+ """Controls how lighting and translucency interacts with streamtrace rods and ribbons.
752
+
753
+ .. code-block:: python
754
+ :emphasize-lines: 28-29
755
+
756
+ import os
757
+ import tecplot
758
+ from tecplot.constant import *
759
+
760
+ examples_dir = tecplot.session.tecplot_examples_directory()
761
+ datafile = os.path.join(examples_dir, 'SimpleData', 'DuctFlow.plt')
762
+ dataset = tecplot.data.load_tecplot(datafile)
763
+
764
+ frame = tecplot.active_frame()
765
+ frame.plot_type = tecplot.constant.PlotType.Cartesian3D
766
+
767
+ plot = frame.plot()
768
+ plot.show_mesh = False
769
+ plot.show_shade = False
770
+ plot.show_edge = True
771
+ plot.fieldmap(0).edge.edge_type = EdgeType.Creases
772
+
773
+ plot.show_mesh = False
774
+ plot.show_shade = False
775
+
776
+ plot.vector.u_variable_index = 3
777
+ plot.vector.v_variable_index = 4
778
+ plot.vector.w_variable_index = 5
779
+ plot.show_streamtraces = True
780
+ plot.streamtraces.rod_ribbon.width = .03
781
+ plot.streamtraces.rod_ribbon.shade.color = Color.Green
782
+
783
+ plot.streamtraces.rod_ribbon.effects.use_translucency = True
784
+ plot.streamtraces.rod_ribbon.effects.surface_translucency = 80
785
+
786
+ plot.streamtraces.add_rake(start_position=(1.5, 0, .45),
787
+ end_position=(1.5, 1, 0),
788
+ stream_type=Streamtrace.VolumeRibbon)
789
+
790
+ tecplot.export.save_png('streamtrace_ribbon_effects.png', 600, supersample=3)
791
+
792
+ .. figure:: /_static/images/streamtrace_ribbon_effects.png
793
+ :width: 300px
794
+ :figwidth: 300px
795
+ """
796
+
797
+ def __init__(self, streamtrace):
798
+ super().__init__(streamtrace, sv.EFFECTS)
799
+
800
+ @property
801
+ def lighting_effect(self):
802
+ """`LightingEffect`: Get/set the lighting algorithm used when lighting
803
+ streamtrace rods and ribbons.
804
+
805
+ Ribbon lighting effects must be enabled by setting
806
+ `StreamtraceRodRibbonShade.use_lighting_effect` to `True` when
807
+ setting this value.
808
+
809
+ Note that setting `StreamtraceRodRibbonShade.use_lighting_effect` will also set
810
+ this value for `ribbon contours <StreamtraceRodRibbonContour>`.
811
+
812
+ There are two types of lighting effects: Paneled and Gouraud:
813
+
814
+ * `Paneled`: Within each cell, the color assigned to each area by
815
+ shading or contour flooding is tinted by a shade constant
816
+ across the cell. This shade is based on the orientation
817
+ of the cell relative to your 3D light source.
818
+ * `Gouraud`: This offers smoother, more continuous shading than
819
+ Paneled shading, but it also results in slower plotting
820
+ and larger print files. `Gouraud` shading is not continuous
821
+ across zone boundaries unless face neighbors are specified
822
+ in the data. `Gouraud` shading is not available for finite
823
+ element volume `Zone <data_access>` when blanking is active.
824
+ The zone's lighting effect reverts to `Paneled`
825
+ shading in this case.
826
+
827
+ Example usage::
828
+
829
+ >>> plot.streamtraces.rod_ribbon.shade.use_lighting_effect = True
830
+ >>> plot.streamtraces.rod_ribbon.effects.lighting_effect = LightingEffect.Paneled
831
+ """
832
+ return self._get_style(LightingEffect, sv.LIGHTINGEFFECT)
833
+
834
+ @lighting_effect.setter
835
+ def lighting_effect(self, value):
836
+ self._set_style(LightingEffect(value), sv.LIGHTINGEFFECT)
837
+
838
+ @property
839
+ def surface_translucency(self):
840
+ """`int`: Surface translucency of the streamtraces ribbon.
841
+
842
+ Surface translucency must be enabled by setting
843
+ `StreamtraceRodRibbonEffects.use_translucency` = `True`
844
+ when setting this value.
845
+
846
+ Valid translucency values range from one (opaque) to 99 (translucent).
847
+
848
+ Example usage::
849
+
850
+ >>> plot.streamtraces.rod_ribbon.effects.use_translucency = True
851
+ >>> plot.streamtraces.rod_ribbon.effects.surface_translucency = 20
852
+ """
853
+ return self._get_style(int, sv.SURFACETRANSLUCENCY)
854
+
855
+ @surface_translucency.setter
856
+ def surface_translucency(self, value):
857
+ self._set_style(int(value), sv.SURFACETRANSLUCENCY)
858
+
859
+ @property
860
+ def use_translucency(self):
861
+ """`bool`: Enable surface translucency.
862
+
863
+ The surface translucency value can be changed by setting
864
+ `StreamtraceRodRibbonEffects.surface_translucency`.
865
+
866
+ Example usage::
867
+
868
+ >>> plot.streamtraces.rod_ribbon.effects.use_translucency = True
869
+ >>> plot.streamtraces.rod_ribbon.effects.surface_translucency = 20
870
+ """
871
+ return self._get_style(bool, sv.USETRANSLUCENCY)
872
+
873
+ @use_translucency.setter
874
+ def use_translucency(self, value):
875
+ self._set_style(bool(value), sv.USETRANSLUCENCY)
876
+
877
+
878
+ class StreamtraceRodRibbon(StreamtraceStyle):
879
+ """Get/Set streamtrace rod/ribbon attributes.
880
+
881
+ The `StreamtraceRodRibbon` class allows you to query and set attributes
882
+ of streamtrace rod/ribbon types:
883
+
884
+ * `Streamtrace.SurfaceRibbon`
885
+ * `Streamtrace.VolumeRibbon`
886
+ * `Streamtrace.VolumeRod`
887
+
888
+ In addition to attributes common to all rod/ribbon
889
+ streamtrace types such as `width <StreamtraceRodRibbon.width>`,
890
+ some attributes are further divided into subcategories:
891
+
892
+ * `Rod/ribbon mesh <StreamtraceRodRibbonMesh>`
893
+ * `Rod/ribbon contour <StreamtraceRodRibbonContour>`
894
+ * `Rod/ribbon shade <StreamtraceRodRibbonShade>`
895
+ * `Rod/ribbon effects <StreamtraceRodRibbonEffects>`
896
+
897
+ .. note::
898
+ To change the color of streamtrace rods/ribbons, set
899
+ `StreamtraceRodRibbonShade.color`.
900
+
901
+ .. code-block:: python
902
+ :emphasize-lines: 25-35
903
+
904
+ import os
905
+ import tecplot
906
+ from tecplot.constant import *
907
+
908
+ examples_dir = tecplot.session.tecplot_examples_directory()
909
+ datafile = os.path.join(examples_dir, 'SimpleData', 'DuctFlow.plt')
910
+ dataset = tecplot.data.load_tecplot(datafile)
911
+
912
+ frame = tecplot.active_frame()
913
+ frame.plot_type = tecplot.constant.PlotType.Cartesian3D
914
+
915
+ plot = frame.plot()
916
+ plot.show_mesh = False
917
+ plot.show_shade = False
918
+ plot.show_edge = True
919
+ plot.fieldmap(0).edge.edge_type = EdgeType.Creases
920
+ plot.contour(0).variable = dataset.variable(3)
921
+ plot.contour(0).levels.reset_to_nice()
922
+
923
+ plot.vector.u_variable_index = 3
924
+ plot.vector.v_variable_index = 4
925
+ plot.vector.w_variable_index = 5
926
+
927
+ plot.show_streamtraces = True
928
+ plot.streamtraces.rod_ribbon.width = .03
929
+ plot.streamtraces.rod_ribbon.contour.show = True
930
+
931
+ plot.streamtraces.add_rake(start_position=(1.5, 0.1, .4),
932
+ end_position=(1.5, .9, 0.1),
933
+ stream_type=Streamtrace.VolumeRibbon,
934
+ num_seed_points=3)
935
+ plot.streamtraces.add_rake(start_position=(1.5, 0.1, 0.1),
936
+ end_position=(1.5, .9, .4),
937
+ stream_type=Streamtrace.VolumeRod,
938
+ num_seed_points=4)
939
+
940
+ tecplot.export.save_png('streamtrace_ribbon.png', 600, supersample=3)
941
+
942
+ .. figure:: /_static/images/streamtrace_ribbon.png
943
+ :width: 300px
944
+ :figwidth: 300px
945
+
946
+ """
947
+ def __init__(self, streamtrace):
948
+ super().__init__(streamtrace, sv.RODRIBBON)
949
+ self.plot = streamtrace.plot
950
+
951
+ @property
952
+ def mesh(self):
953
+ """`StreamtraceRodRibbonMesh`: Streamtraces rod/ribbon mesh attributes.
954
+
955
+ Example usage::
956
+
957
+ >>> plot.streamtraces.rod_ribbon.mesh.show = True
958
+ """
959
+ return StreamtraceRodRibbonMesh(self)
960
+
961
+ @property
962
+ def contour(self):
963
+ """`StreamtraceRodRibbonContour`: Streamtraces rod/ribbon contour attributes.
964
+
965
+ Example usage::
966
+
967
+ >>> plot.streamtraces.rod_ribbon.contour.show = True
968
+ """
969
+ return StreamtraceRodRibbonContour(self)
970
+
971
+ @property
972
+ def shade(self):
973
+ """`StreamtraceRodRibbonShade`: Streamtraces rod/ribbon color and lighting attributes.
974
+
975
+ Example usage::
976
+
977
+ >>> plot.streamtraces.rod_ribbon.shade.color = Color.Magenta
978
+ """
979
+ return StreamtraceRodRibbonShade(self)
980
+
981
+ @property
982
+ def effects(self):
983
+ """`StreamtraceRodRibbonEffects`: Streamtraces rod/ribbon effects.
984
+
985
+ Example usage::
986
+
987
+ >>> plot.streamtraces.rod_ribbon.effects.use_translucency = True
988
+ """
989
+ return StreamtraceRodRibbonEffects(self)
990
+
991
+ @property
992
+ def width(self):
993
+ """`float`: Rod/ribbon width in grid units.
994
+
995
+ Example usage::
996
+
997
+ >>> plot.streamtraces.rod_ribbon.width = 0.01
998
+ """
999
+ return self._get_style(float, sv.WIDTH)
1000
+
1001
+ @width.setter
1002
+ def width(self, value):
1003
+ self._set_style(float(value), sv.WIDTH)
1004
+
1005
+ @property
1006
+ def num_rod_points(self):
1007
+ """`int`, valid range 3-100: Number of rod points.
1008
+
1009
+ Volume rods have a polygonal cross-section; this parameter tells
1010
+ |Tecplot 360| what that cross-section should be.
1011
+ (Three is an equilateral triangle, four is a square,
1012
+ five is a regular pentagon, and so on.) If you want two sets
1013
+ of volume rods with different cross-sections, you must create one
1014
+ set and then extract the set as a zone, then configure a new
1015
+ set of streamtraces with the second cross-section.
1016
+
1017
+ Example usage::
1018
+
1019
+ >>> plot.streamtraces.rod_ribbon.num_rod_points = 10
1020
+ """
1021
+ return self._get_style(int, sv.NUMRODPOINTS)
1022
+
1023
+ @num_rod_points.setter
1024
+ def num_rod_points(self, value):
1025
+ self._set_style(int(value), sv.NUMRODPOINTS)
1026
+
1027
+
1028
+ class Streamtraces(session.Style):
1029
+ """Streamtrace attributes for the plot.
1030
+
1031
+ A streamtrace is the path traced by a massless particle placed at an
1032
+ arbitrary location in a steady-state vector field.
1033
+ Streamtraces may be used to illustrate the nature of the vector
1034
+ field flow in a particular region of the `Plot`.
1035
+
1036
+ Note:
1037
+ Because streamtraces are dependent upon a vector field, you must
1038
+ define vector components before creating streamtraces.
1039
+ However, it is not necessary to activate the Vector zone layer to
1040
+ use streamtraces.
1041
+
1042
+ .. code-block:: python
1043
+ :emphasize-lines: 22-29
1044
+
1045
+ import os
1046
+ import tecplot
1047
+ from tecplot.constant import *
1048
+
1049
+ examples_dir = tecplot.session.tecplot_examples_directory()
1050
+ datafile = os.path.join(examples_dir, 'SimpleData', 'Eddy.plt')
1051
+ dataset = tecplot.data.load_tecplot(datafile)
1052
+
1053
+ frame = tecplot.active_frame()
1054
+ frame.plot_type = tecplot.constant.PlotType.Cartesian3D
1055
+
1056
+ plot = frame.plot()
1057
+ plot.fieldmap(0).surfaces.surfaces_to_plot = SurfacesToPlot.BoundaryFaces
1058
+ plot.show_mesh = True
1059
+ plot.show_shade = False
1060
+
1061
+ plot.vector.u_variable_index = 4
1062
+ plot.vector.v_variable_index = 5
1063
+ plot.vector.w_variable_index = 6
1064
+ plot.show_streamtraces = True
1065
+
1066
+ streamtraces = plot.streamtraces
1067
+ streamtraces.color = Color.Blue
1068
+
1069
+ streamtraces.show_arrows = True
1070
+ streamtraces.arrowhead_size = 2
1071
+ streamtraces.step_size = .25
1072
+ streamtraces.line_thickness = .2
1073
+ streamtraces.max_steps = 100
1074
+
1075
+ streamtraces.add_rake(start_position=(45.49, 15.32, 59.1),
1076
+ end_position=(48.89, 53.2, 47.6),
1077
+ stream_type=Streamtrace.SurfaceLine,
1078
+ num_seed_points=4)
1079
+
1080
+
1081
+ tecplot.export.save_png('streamtrace_example.png', 600, supersample=3)
1082
+
1083
+ .. figure:: /_static/images/streamtrace_example.png
1084
+ :width: 300px
1085
+ :figwidth: 300px
1086
+ """
1087
+ def __init__(self, plot):
1088
+ super().__init__(sv.STREAMATTRIBUTES, uniqueid=plot.frame.uid)
1089
+ self.plot = plot
1090
+
1091
+ @tecutil.lock()
1092
+ def extract(self, concatenate=False, assign_strand_ids=True):
1093
+ """Create new zones from streamtraces
1094
+
1095
+ Extracts the current streamtraces defined in this class to the
1096
+ `Dataset <data.Dataset>` as one or more zones.
1097
+
1098
+ Parameters:
1099
+ concatenate (`bool`, optional): Concatenate streamtraces into a
1100
+ single zone for each format (Surface Line, Volume Line, Volume
1101
+ Ribbon, Volume Rod).
1102
+ assign_strand_ids (`bool`, optional): Automatically assign strand
1103
+ ID's to the created zones. This option is ignored if
1104
+ *concatenate* if `True`. (default: `True`)
1105
+
1106
+ Returns:
1107
+ A `generator
1108
+ <https://docs.python.org/3/reference/expressions.html#generator-expressions>`_
1109
+ of the extracted zones.
1110
+
1111
+ Example usage::
1112
+
1113
+ >>> slice_zone = plot.streamtraces.extract()
1114
+ """
1115
+ dataset = self.plot.frame.dataset
1116
+ nzones = dataset.num_zones
1117
+ with self.plot.frame.activated():
1118
+ with tecutil.ArgList() as arglist:
1119
+ arglist[sv.CONCATENATE] = bool(concatenate)
1120
+ arglist[sv.AUTOSTRANDTRANSIENTDATA] = bool(assign_strand_ids)
1121
+ if not _tecutil.ExtractStreamtracesX(arglist):
1122
+ raise TecplotSystemError()
1123
+ return (dataset.zone(i) for i in range(nzones, dataset.num_zones))
1124
+
1125
+ @property
1126
+ def rod_ribbon(self):
1127
+ """`StreamtraceRodRibbon`: Streamtrace rod/ribbon attributes.
1128
+
1129
+ Example usage::
1130
+
1131
+ >>> streamtraces.rod_ribbon.mesh.show = True
1132
+ """
1133
+ return StreamtraceRodRibbon(self)
1134
+
1135
+ @property
1136
+ def timing(self):
1137
+ """`StreamtraceTiming`: Streamtraces timing attributes.
1138
+
1139
+ Example usage::
1140
+
1141
+ >>> timing = plot.streamtraces.timing
1142
+ >>> timing.start = 0.01
1143
+ """
1144
+ return StreamtraceTiming(self)
1145
+
1146
+ @property
1147
+ def termination_line(self):
1148
+ """`StreamtraceTerminationLine`: Streamtraces termination line attributes.
1149
+
1150
+ A streamtrace termination line is a polyline that terminates any
1151
+ streamtraces that cross it. The termination line is useful for stopping
1152
+ streamtraces before they spiral or stall.
1153
+
1154
+ Example usage::
1155
+
1156
+ >>> term_line = plot.streamtraces.termination_line
1157
+ >>> term_line.show = True
1158
+ """
1159
+ return StreamtraceTerminationLine(self)
1160
+
1161
+ @property
1162
+ def show_dashes(self):
1163
+ """`bool`: Display streamtrace dashes.
1164
+
1165
+ The lengths of the dashes and the spaces between the dashes are
1166
+ controlled by the value of `StreamtraceTiming.delta`. Set the
1167
+ `Streamtraces.dash_skip` attribute to control the number of
1168
+ time deltas used for the "off" sections of the streamtraces.
1169
+
1170
+ Example usage::
1171
+
1172
+ >>> plot.streamtraces.show_dashes = True
1173
+ """
1174
+ return self.timing._show_dashes
1175
+
1176
+ @show_dashes.setter
1177
+ def show_dashes(self, value):
1178
+ self.timing._show_dashes = value
1179
+
1180
+ @property
1181
+ def show_markers(self):
1182
+ """`bool`: Display streamtrace markers.
1183
+
1184
+ Stream markers are only available for surface and volume
1185
+ type streamlines.
1186
+
1187
+ You may also specify the `size <Streamtraces.marker_size>`,
1188
+ `color <Streamtraces.marker_color>`, and
1189
+ `shape <Streamtraces.marker_symbol>` of the markers.
1190
+
1191
+ Example usage::
1192
+
1193
+ >>> plot.streamtraces.show_markers = True
1194
+
1195
+ """
1196
+ return self.timing._show_markers
1197
+
1198
+ @show_markers.setter
1199
+ def show_markers(self, value):
1200
+ self.timing._show_markers = value
1201
+
1202
+ @property
1203
+ def marker_color(self):
1204
+ """`Color` or `ContourGroup`: `Color` of the streamline markers.
1205
+
1206
+ Streamtrace markers can be a solid color or be colored by a
1207
+ `ContourGroup` as obtained through the ``plot.contour`` property.
1208
+
1209
+ Example usage::
1210
+
1211
+ >>> plot.streamtraces.marker_color = Color.Blue
1212
+ """
1213
+
1214
+ return self.timing._marker_color
1215
+
1216
+ @marker_color.setter
1217
+ def marker_color(self, value):
1218
+ self.timing._marker_color = value
1219
+
1220
+ @property
1221
+ def marker_size(self):
1222
+ """`float`: Size of streamline markers.
1223
+
1224
+ Example usage::
1225
+
1226
+ >>> plot.streamtraces.marker_size = 1.1
1227
+ """
1228
+ return self.timing._marker_size
1229
+
1230
+ @marker_size.setter
1231
+ def marker_size(self, value):
1232
+ self.timing._marker_size = value
1233
+
1234
+ @property
1235
+ def dash_skip(self):
1236
+ """`int`: Number of time deltas used for the "off" sections of the streamlines.
1237
+
1238
+ .. note::
1239
+ The ``dash_skip`` value must be greater than 0.
1240
+
1241
+ Example usage::
1242
+
1243
+ >>> plot.streamtraces.dash_skip = 2
1244
+ """
1245
+
1246
+ return int(self.timing._dash_skip)
1247
+
1248
+ @dash_skip.setter
1249
+ def dash_skip(self, value):
1250
+ self.timing._dash_skip = value
1251
+
1252
+ @property
1253
+ def marker_symbol_type(self):
1254
+ """`SymbolType`: The `SymbolType` to use for stream markers.
1255
+
1256
+ This sets the active symbol type for streamtrace markers.
1257
+ Use `Streamtraces.marker_symbol` to access the symbol::
1258
+
1259
+ >>> from tecplot.constant import SymbolType
1260
+ >>> streamtrace = plot.streamtraces
1261
+ >>> streamtraces.marker_symbol_type = SymbolType.Text
1262
+ >>> symbol = streamtraces.marker_symbol(SymbolType.Text)
1263
+ >>> symbol.text = 'a'
1264
+ """
1265
+ return self.timing._marker_symbol_type
1266
+
1267
+ @marker_symbol_type.setter
1268
+ def marker_symbol_type(self, value):
1269
+ self.timing._marker_symbol_type = value
1270
+
1271
+ def marker_symbol(self, symbol_type=None):
1272
+ """Returns a streamline symbol style object.
1273
+
1274
+ Parameters:
1275
+ symbol_type (`SymbolType`, optional): The type of symbol to return.
1276
+ By default, this will return the active marker symbol type
1277
+ which is obtained from `Streamtraces.marker_symbol_type`.
1278
+
1279
+
1280
+ Returns: `TextSymbol` or `GeometrySymbol`, depending on `marker_symbol_type`
1281
+
1282
+ Example usage::
1283
+
1284
+ >>> from tecplot.constant import SymbolType
1285
+ >>> streamtrace = plot.streamtraces
1286
+ >>> streamtraces.marker_symbol_type = SymbolType.Text
1287
+ >>> symbol = streamtraces.marker_symbol(SymbolType.Text)
1288
+ >>> symbol.text = 'a'
1289
+ """
1290
+ return self.timing._marker_symbol(symbol_type)
1291
+
1292
+ @property
1293
+ def show_arrows(self):
1294
+ """`bool`: Display arrowheads along all streamlines.
1295
+
1296
+ Example usage::
1297
+
1298
+ >>> plot.streamtraces.show_arrows = True
1299
+ """
1300
+ return self._get_style(bool, sv.ADDARROWS)
1301
+
1302
+ @show_arrows.setter
1303
+ def show_arrows(self, value):
1304
+ self._set_style(bool(value), sv.ADDARROWS)
1305
+
1306
+ @property
1307
+ def arrowhead_size(self):
1308
+ """`float`: Arrowhead size as a percentage of frame height.
1309
+
1310
+ Recommend values are one of 1, 3, 5, 8, or 12.
1311
+
1312
+ Example usage::
1313
+
1314
+ >>> plot.streamtraces.show_arrows = True
1315
+ >>> plot.streamtraces.arrowhead_size = 1.0
1316
+ """
1317
+ return self._get_style(float, sv.ARROWHEADSIZE)
1318
+
1319
+ @arrowhead_size.setter
1320
+ def arrowhead_size(self, value):
1321
+ self._set_style(float(value), sv.ARROWHEADSIZE)
1322
+
1323
+ @property
1324
+ def arrowhead_spacing(self):
1325
+ """`float`: Distance between arrowheads in terms of Y-frame units.
1326
+
1327
+ For example, a value of 10 will space arrowheads approximately
1328
+ ten percent of the frame height apart from each other along each
1329
+ streamline.
1330
+
1331
+ Example usage::
1332
+
1333
+ >>> plot.streamtraces.show_arrows = True
1334
+ >>> plot.streamtraces.arrowhead_spacing = 10
1335
+ """
1336
+ return self._get_style(float, sv.ARROWHEADSPACING)
1337
+
1338
+ @arrowhead_spacing.setter
1339
+ def arrowhead_spacing(self, value):
1340
+ self._set_style(float(value), sv.ARROWHEADSPACING)
1341
+
1342
+ @property
1343
+ def step_size(self):
1344
+ """`float`: Maximum fraction of the distance across a cell that a streamtrace
1345
+ moves in one step.
1346
+
1347
+ The step size is the maximum fraction of the distance across a cell
1348
+ that a streamtrace moves in one step. A streamtrace adjusts its
1349
+ step size between `step_size` and `min_step_size`, depending
1350
+ on local curvature of the streamtrace.
1351
+
1352
+ A typical value (and the default) is **0.25**, which results in
1353
+ four integration steps through each cell or element.
1354
+ The value for Step Size affects the accuracy of the integration.
1355
+
1356
+ .. warning::
1357
+ Setting step size too small can result in round-off errors,
1358
+ while setting it too large can result in truncation
1359
+ errors and missed cells.
1360
+
1361
+ Example usage::
1362
+
1363
+ >>> plot.streamtraces.step_size = .25
1364
+ """
1365
+ return self._get_style(float, sv.CELLFRACTION)
1366
+
1367
+ @step_size.setter
1368
+ def step_size(self, value):
1369
+ self._set_style(float(value), sv.CELLFRACTION)
1370
+
1371
+ @property
1372
+ def color(self):
1373
+ """`Color` or `ContourGroup`: Color of streamtraces line (not rods or ribbons).
1374
+
1375
+ Streamtraces can be a solid color or be colored by a
1376
+ `ContourGroup` as obtained through the ``plot.contour`` property.
1377
+
1378
+ Example usage::
1379
+
1380
+ >>> plot.streamtraces.color = Color.Red
1381
+ """
1382
+ return color_spec(self._get_style(Color, sv.COLOR),
1383
+ self.plot)
1384
+
1385
+ @color.setter
1386
+ def color(self, value):
1387
+ self._set_style(color_spec(value), sv.COLOR)
1388
+
1389
+ @property
1390
+ def line_thickness(self):
1391
+ """`float`: Streamtrace line thickness.
1392
+
1393
+ Line thickness as a percentage of the frame height for 2D lines,
1394
+ or a percentage of the median axis length for 3D surface lines and
1395
+ volume lines.
1396
+
1397
+ Suggested values are .02, .1, .4, .8, 1.5
1398
+
1399
+ Example usage::
1400
+
1401
+ >>> plot.streamtraces.line_thickness = 1.1
1402
+ """
1403
+ return self._get_style(float, sv.LINETHICKNESS)
1404
+
1405
+ @line_thickness.setter
1406
+ def line_thickness(self, value):
1407
+ self._set_style(float(value), sv.LINETHICKNESS)
1408
+
1409
+ @property
1410
+ def max_steps(self):
1411
+ """`int`: Maximum number of steps before the streamtrace is terminated.
1412
+
1413
+ `max_steps` prevents streamtraces from spinning forever in a vortex,
1414
+ or from wandering into a region where the vector components are very
1415
+ small, very random, or both.
1416
+
1417
+ If a small `step_size` is selected, the `max_steps`
1418
+ should be a large value.
1419
+
1420
+ Example usage::
1421
+
1422
+ >>> plot.streamtraces.max_steps = 5000
1423
+ """
1424
+ return self._get_style(int, sv.MAXSTEPS)
1425
+
1426
+ @max_steps.setter
1427
+ def max_steps(self, value):
1428
+ self._set_style(int(value), sv.MAXSTEPS)
1429
+
1430
+ @property
1431
+ def min_step_size(self):
1432
+ """`float`: Smallest step size to use as a percentage of cell distance.
1433
+
1434
+ A typical minimum step size value is 0.00001, which is the default.
1435
+
1436
+ .. Warning::
1437
+ Setting this too small results in integration problems. Setting
1438
+ this greater than or equal to the `step_size` results in a constant
1439
+ step size.
1440
+
1441
+ Example usage::
1442
+
1443
+ >>> plot.streamtraces.min_step_size = .0002
1444
+ """
1445
+ return self._get_style(float, sv.MINCELLFRACTION)
1446
+
1447
+ @min_step_size.setter
1448
+ def min_step_size(self, value):
1449
+ self._set_style(float(value), sv.MINCELLFRACTION)
1450
+
1451
+ @property
1452
+ def obey_source_zone_blanking(self):
1453
+ """`bool`: Obey source zone blanking.
1454
+
1455
+ When `True`, streamtraces are generated for non-blanked regions only.
1456
+ When `False`, streamtraces are generated for both blanked and
1457
+ unblanked regions.
1458
+
1459
+ Example usage::
1460
+
1461
+ >>> plot.streamtraces.obey_source_zone_blanking = True
1462
+ """
1463
+ return self._get_style(bool, sv.OBEYSOURCEZONEBLANKING)
1464
+
1465
+ @obey_source_zone_blanking.setter
1466
+ def obey_source_zone_blanking(self, value):
1467
+ self._set_style(bool(value), sv.OBEYSOURCEZONEBLANKING)
1468
+
1469
+ @property
1470
+ def show_paths(self):
1471
+ """`bool`: Draw streamtrace paths (lines, ribbons, or rods).
1472
+
1473
+ A streamtrace path may be a line, ribbon or rod.
1474
+
1475
+ Example usage::
1476
+
1477
+ >>> plot.streamtraces.show_paths = True
1478
+
1479
+ See also `Streamtraces.show_markers`
1480
+ """
1481
+ return self._get_style(bool, sv.SHOWPATHS)
1482
+
1483
+ @show_paths.setter
1484
+ def show_paths(self, value):
1485
+ self._set_style(bool(value), sv.SHOWPATHS)
1486
+
1487
+ def add_on_zone_surface(self, stream_type, zones=None, num_seed_points=10,
1488
+ direction=StreamDir.Both):
1489
+ """Add streamtraces to one or more zones in a plot.
1490
+
1491
+ The plot type must be either `Cartesian2D` or `Cartesian3D`.
1492
+
1493
+ .. note:: For volume zones the streamtraces are propagated from the
1494
+ surfaces of the volume.
1495
+
1496
+ Parameters:
1497
+ stream_type: (`Streamtrace`): Type of streamtraces to add.
1498
+
1499
+ zones (`set` of `integers <int>`, optional):
1500
+ Set of `Zones <data_access>` on which to add streamtraces. If
1501
+ `None`, then streamtraces will be added to the currently
1502
+ active zones.
1503
+
1504
+ num_seed_points: (`int`, optional):
1505
+ Number of seed points for distributing along a rake or on
1506
+ defined surfaces.
1507
+
1508
+ direction: (`StreamDir`, optional): Direction of propagation
1509
+ of the streamtraces being added.
1510
+
1511
+ .. code-block:: python
1512
+
1513
+ import os
1514
+
1515
+ import tecplot
1516
+ from tecplot.constant import *
1517
+
1518
+ examples_dir = tecplot.session.tecplot_examples_directory()
1519
+ datafile = os.path.join(examples_dir, 'OneraM6wing', 'OneraM6_SU2_RANS.plt')
1520
+ dataset = tecplot.data.load_tecplot(datafile)
1521
+
1522
+ frame = tecplot.active_frame()
1523
+ frame.plot_type = tecplot.constant.PlotType.Cartesian3D
1524
+
1525
+ plot = frame.plot()
1526
+
1527
+ plot.vector.u_variable_index = 4
1528
+ plot.vector.v_variable_index = 5
1529
+ plot.vector.w_variable_index = 6
1530
+ plot.show_streamtraces = True
1531
+
1532
+ plot.streamtraces.add_on_zone_surface(
1533
+ # To add streamtraces to the currently active zones,
1534
+ # pass zones=None
1535
+ zones=[1], # Add streamtraces on 2nd zone only
1536
+ stream_type=Streamtrace.SurfaceLine,
1537
+ num_seed_points=200)
1538
+
1539
+ tecplot.export.save_png('streamtrace_add_on_zone_surface.png', 600, supersample=3)
1540
+
1541
+ .. figure:: /_static/images/streamtrace_add_on_zone_surface.png
1542
+ :width: 300px
1543
+ :figwidth: 300px
1544
+
1545
+ """
1546
+ if zones is None:
1547
+ self._add(stream_type=stream_type,
1548
+ distribution_region=
1549
+ DistributionRegion.SurfacesOfActiveZones,
1550
+ stream_direction=direction,
1551
+ num_points=num_seed_points)
1552
+ else:
1553
+ with IndexSet(zones) as zone_set:
1554
+ self._add(stream_type=stream_type,
1555
+ distribution_region=
1556
+ DistributionRegion.SurfacesOfSuppliedZones,
1557
+ stream_direction=direction,
1558
+ num_points=num_seed_points, zones=zone_set)
1559
+
1560
+ def add_rake(self, start_position, end_position, stream_type,
1561
+ num_seed_points=10, direction=StreamDir.Both):
1562
+ """Add a rake of streamtraces to the plot of the current frame.
1563
+
1564
+ The plot type must be either `Cartesian2D` or `Cartesian3D`.
1565
+
1566
+ Parameters:
1567
+ start_position: (2- or 3- `tuple` of `floats <float>`):
1568
+ Pass a 2-`tuple` of `float` for a
1569
+ `Cartesian2DFieldPlot`, or a 3-`tuple` of `float` for a
1570
+ `Cartesian3DFieldPlot`.
1571
+
1572
+ end_position: (2- or 3- `tuple` of `floats <float>`):
1573
+ Pass a 2-`tuple` of `float` for a
1574
+ `Cartesian2DFieldPlot`, or a 3-`tuple` of `float` for a
1575
+ `Cartesian3DFieldPlot`.
1576
+
1577
+ stream_type: (`Streamtrace`): Type of streamtraces to add.
1578
+
1579
+ num_seed_points: (`int`, optional):
1580
+ Number of seed points for distributing along a rake or on
1581
+ defined surfaces.
1582
+
1583
+ direction: (`StreamDir`, optional): Direction of propagation
1584
+ of the streamtraces being added.
1585
+
1586
+ .. code-block:: python
1587
+ :emphasize-lines: 24-26
1588
+
1589
+ import os
1590
+
1591
+ import tecplot
1592
+ from tecplot.constant import *
1593
+
1594
+ examples_dir = tecplot.session.tecplot_examples_directory()
1595
+ datafile = os.path.join(examples_dir, 'SimpleData', 'Eddy.plt')
1596
+ dataset = tecplot.data.load_tecplot(datafile)
1597
+
1598
+ frame = tecplot.active_frame()
1599
+ frame.plot_type = tecplot.constant.PlotType.Cartesian3D
1600
+
1601
+ plot = frame.plot()
1602
+ plot.fieldmap(0).surfaces.surfaces_to_plot = SurfacesToPlot.BoundaryFaces
1603
+ plot.show_mesh = True
1604
+ plot.show_shade = False
1605
+
1606
+ plot.vector.u_variable_index = 4
1607
+ plot.vector.v_variable_index = 5
1608
+ plot.vector.w_variable_index = 6
1609
+ plot.show_streamtraces = True
1610
+
1611
+ streamtraces = plot.streamtraces
1612
+ streamtraces.add_rake(start_position=[.5, .5, .5],
1613
+ end_position=[20, 20, 20],
1614
+ stream_type=Streamtrace.VolumeLine)
1615
+
1616
+ tecplot.export.save_png('streamtrace_add_rake.png', 600, supersample=3)
1617
+
1618
+ .. figure:: /_static/images/streamtrace_add_rake.png
1619
+ :width: 300px
1620
+ :figwidth: 300px
1621
+
1622
+ """
1623
+
1624
+ self._add(stream_type, DistributionRegion.Rake, direction,
1625
+ num_seed_points, start_position, end_position)
1626
+
1627
+ def add(self, seed_point, stream_type, direction=StreamDir.Both):
1628
+ """Add a single streamtrace to the plot of the current frame.
1629
+
1630
+ The plot type must be either `Cartesian2D` or `Cartesian3D`.
1631
+
1632
+ Parameters:
1633
+ seed_point: (2- or 3- `tuple` of `floats <float>`):
1634
+ Pass a 2-`tuple` of `float` for a
1635
+ `Cartesian2DFieldPlot`, or a 3-`tuple` of `float` for a
1636
+ `Cartesian3DFieldPlot`.
1637
+
1638
+ stream_type: (`Streamtrace`): Type of streamtraces to add.
1639
+
1640
+ direction: (`StreamDir`, optional): Direction of propagation
1641
+ of the streamtraces being added.
1642
+
1643
+ .. note::
1644
+ *stream_type* is automatically set to `Streamtrace.SurfaceLine`
1645
+ if the plot type is `Cartesian2DFieldPlot`. The only stream
1646
+ type available for 2D plots is `Streamtrace.SurfaceLine`.
1647
+
1648
+ .. code-block:: python
1649
+ :emphasize-lines: 41
1650
+
1651
+ import os
1652
+ import tecplot
1653
+ from tecplot.constant import *
1654
+ import numpy as np
1655
+
1656
+ examples_dir = tecplot.session.tecplot_examples_directory()
1657
+ datafile = os.path.join(examples_dir, 'SimpleData', 'DuctFlow.plt')
1658
+ dataset = tecplot.data.load_tecplot(datafile)
1659
+
1660
+ frame = tecplot.active_frame()
1661
+ frame.plot_type = tecplot.constant.PlotType.Cartesian3D
1662
+
1663
+ plot = frame.plot()
1664
+ plot.contour(0).variable = dataset.variable('P(N/m2)')
1665
+ plot.contour(0).levels.reset_to_nice()
1666
+ plot.contour(0).legend.show = False
1667
+
1668
+ plot.vector.u_variable = dataset.variable('U(M/S)')
1669
+ plot.vector.v_variable = dataset.variable('V(M/S)')
1670
+ plot.vector.w_variable = dataset.variable('W(M/S)')
1671
+
1672
+ # Goal: create a grid of 12 stream trace ribbons
1673
+ x_slice_location = .79
1674
+ y_start = .077
1675
+ y_end = .914
1676
+ z_start = .052
1677
+ z_end = .415
1678
+
1679
+ num_left_right_slices = 4 # Must be >= 2
1680
+ num_top_bottom_slices = 3 # Must be >= 2
1681
+
1682
+ plot.show_streamtraces = True
1683
+ streamtraces = plot.streamtraces
1684
+ streamtraces.show_paths = True
1685
+
1686
+ rod = streamtraces.rod_ribbon
1687
+ rod.width = .03
1688
+ rod.contour.show = True
1689
+
1690
+ for y in np.linspace(y_start, y_end, num=num_left_right_slices):
1691
+ for z in np.linspace(z_start, z_end, num=num_top_bottom_slices):
1692
+ streamtraces.add([x_slice_location,y,z], Streamtrace.VolumeRibbon)
1693
+
1694
+ tecplot.export.save_png('streamtrace_add_xyz.png', 600, supersample=3)
1695
+
1696
+ .. figure:: /_static/images/streamtrace_add_xyz.png
1697
+ :width: 300px
1698
+ :figwidth: 300px
1699
+ """
1700
+ self._add(stream_type=stream_type,
1701
+ distribution_region=DistributionRegion.Point,
1702
+ stream_direction=direction,
1703
+ start_position=seed_point,
1704
+ end_position=seed_point if stream_type in (
1705
+ Streamtrace.SurfaceRibbon, Streamtrace.VolumeRibbon,
1706
+ Streamtrace.VolumeRod) else None)
1707
+
1708
+ @lock()
1709
+ def _add(self, stream_type, distribution_region, stream_direction,
1710
+ num_points=None,
1711
+ start_position=None,
1712
+ end_position=None,
1713
+ zones=None):
1714
+
1715
+ def _assign_position(arg_list, point_ordinal, value):
1716
+ try:
1717
+ if __debug__:
1718
+ frame = self.plot.frame
1719
+ if frame.plot_type == PlotType.Cartesian2D and (
1720
+ len(value) != 2):
1721
+ raise TecplotTypeError(
1722
+ '[x,y] position for streamtrace '
1723
+ 'requires 2D plot type.')
1724
+ elif frame.plot_type == PlotType.Cartesian3D and (
1725
+ len(value) != 3):
1726
+ raise TecplotTypeError(
1727
+ '[x,y] position for streamtrace '
1728
+ 'requires 2D plot type.')
1729
+
1730
+ arg_list['X' + point_ordinal], arg_list['Y' + point_ordinal] = (
1731
+ float(value[0]), float(value[1]))
1732
+ if len(value) == 3:
1733
+ arg_list['Z' + point_ordinal] = float(value[2])
1734
+ except TypeError:
1735
+ raise TecplotTypeError('streamtrace position must be a '
1736
+ '2- or 3- tuple of floats.')
1737
+
1738
+ with tecutil.ArgList() as arglist:
1739
+ arglist[sv.STREAMTYPE] = stream_type
1740
+ arglist[sv.DISTRIBUTIONREGION] = distribution_region
1741
+ arglist[sv.STREAMDIRECTION] = stream_direction
1742
+ if zones is not None:
1743
+ arglist[sv.ZONESET] = zones
1744
+
1745
+ if num_points is not None:
1746
+ arglist[sv.NUMPTS] = int(num_points)
1747
+ if start_position is not None:
1748
+ _assign_position(arglist, '1', start_position)
1749
+ if end_position is not None:
1750
+ _assign_position(arglist, '2', end_position)
1751
+
1752
+ with self.plot.frame.activated():
1753
+ if not _tecutil.StreamtraceAddX(arglist):
1754
+ raise TecplotSystemError()
1755
+
1756
+ @lock()
1757
+ def delete_all(self):
1758
+ """Delete all streamtraces for the current plot type.
1759
+
1760
+ 2D and 3D streamtraces are independent of each other.
1761
+
1762
+ If the plot type is `Cartesian2D`, all 2D streamtraces are deleted.
1763
+ If the plot type is `Cartesian3D`, all 3D streamtraces are deleted.
1764
+
1765
+ Raises:
1766
+ `TecplotSystemError`: The streamtraces could not be deleted.
1767
+
1768
+ Example usage::
1769
+
1770
+ >>> plot.streamtraces.delete_all()
1771
+ """
1772
+
1773
+ with self.plot.frame.activated():
1774
+ if not _tecutil.StreamtraceDeleteAll():
1775
+ raise TecplotSystemError()
1776
+
1777
+ @lock()
1778
+ def delete_range(self, range_start, range_end):
1779
+ """Delete a range of streamtraces.
1780
+
1781
+ Parameters:
1782
+ range_start: (`int`): 0-based start streamtrace number to delete.
1783
+
1784
+ range_end: (`int`): 0-based end streamtrace number to delete.
1785
+
1786
+ Raises:
1787
+ `TecplotSystemError`: The streamtraces in the range could not be deleted.
1788
+
1789
+ Example usage::
1790
+
1791
+ >>> # Delete the first 100 streamtraces
1792
+ >>> plot.streamtraces.delete_range(0, 99)
1793
+ """
1794
+
1795
+ with self.plot.frame.activated():
1796
+ if not _tecutil.StreamtraceDeleteRange(range_start + 1, range_end + 1):
1797
+ raise TecplotSystemError()
1798
+
1799
+ @lock()
1800
+ def set_termination_line(self, line_points):
1801
+ """Set the position of the termination line for streamtraces.
1802
+
1803
+ Parameters:
1804
+ line_points: (array of `float` `tuple`) Points of the termination line.
1805
+
1806
+ Raises:
1807
+ `TecplotSystemError`: Termination line could not be set.
1808
+
1809
+ Example usage::
1810
+
1811
+ >>> # Multi-segment line between points (0,0)-(5,8)-(3,6)
1812
+ >>> line_points = [(0, 0), (5, 8), (3,6)]
1813
+ >>> plot.streamtraces.set_termination_line(line_points)
1814
+ """
1815
+
1816
+ num_points = len(line_points)
1817
+
1818
+ #
1819
+ # __mul__() is used below because the alternative:
1820
+ # (c_double * num_points)(*P[0]... causes a lint warning in PyCharm
1821
+ #
1822
+ x_points = (ctypes.c_double.__mul__(num_points)
1823
+ )(*[P[0] for P in line_points])
1824
+ y_points = (ctypes.c_double.__mul__(num_points)
1825
+ )(*[P[1] for P in line_points])
1826
+
1827
+ with self.plot.frame.activated():
1828
+ if not _tecutil.StreamtraceSetTermLine(
1829
+ len(line_points),
1830
+ x_points,
1831
+ y_points):
1832
+ raise TecplotSystemError()
1833
+
1834
+ @property
1835
+ def count(self):
1836
+ """Query the number of active streamtraces for the current plot type.
1837
+
1838
+ Returns:
1839
+ `int`
1840
+
1841
+ .. note:: This property is read-only.
1842
+
1843
+ >>> num_active_streamtraces = plot.streamtraces.count
1844
+
1845
+ """
1846
+ with self.plot.frame.activated():
1847
+ return _tecutil.StreamtraceGetCount()
1848
+
1849
+ def position(self, stream_number):
1850
+ """Query the starting position of a streamtrace.
1851
+
1852
+ Parameters:
1853
+ stream_number: (`int`): 0-based stream number to query.
1854
+
1855
+ Returns:
1856
+ `tuple` of `floats <float>`
1857
+
1858
+ Get the position of streamtrace number 3::
1859
+
1860
+ >>> position = plot.streamtraces.position(2) # Note: 0-based
1861
+ >>> position.x # == position[0]
1862
+ 0.1
1863
+ >>> position.y # == position[1]
1864
+ 0.2
1865
+ >>> position.z # == position[2]
1866
+ 0.3
1867
+ """
1868
+ with self.plot.frame.activated():
1869
+ position = _tecutil.StreamtraceGetPos(stream_number + 1)
1870
+ return tecutil.XYZ(*position)
1871
+
1872
+ def streamtrace_type(self, stream_number):
1873
+ """Query the type of a streamtrace by streamtrace number.
1874
+
1875
+ Parameters:
1876
+ stream_number: (`int`): 0-based stream number to query.
1877
+
1878
+ Returns:
1879
+ `Streamtrace`
1880
+
1881
+ Get the type of streamtrace 3. Note 0-based stream number::
1882
+
1883
+ >>> streamtrace_type = plot.streamtraces.streamtrace_type(2)
1884
+ >>> streamtrace_type
1885
+ <Streamtrace.VolumeLine: 2>
1886
+ """
1887
+ with self.plot.frame.activated():
1888
+ return Streamtrace(_tecutil.StreamtraceGetType(stream_number+1))
1889
+
1890
+ @property
1891
+ def has_terminating_line(self):
1892
+ """Determine if the streamtraces have the terminating line.
1893
+
1894
+ .. note:: This property is read-only.
1895
+
1896
+ Returns:
1897
+ `bool`. `True` if the streamtraces have the terminating
1898
+ line, `False` otherwise.
1899
+
1900
+ Example usage::
1901
+
1902
+ >>> has_terminating_line = plot.streamtraces.has_terminating_line
1903
+
1904
+ """
1905
+ with self.plot.frame.activated():
1906
+ with lock():
1907
+ return _tecutil.StreamtraceHasTermLine()
1908
+
1909
+ @property
1910
+ def active(self):
1911
+ """`bool`: Determine if there are active streamtraces.
1912
+
1913
+ .. note:: This property is read-only.
1914
+
1915
+ Returns:
1916
+ `bool`. `True` if there are active streamtraces
1917
+ in the current plot type.
1918
+
1919
+ Example usage::
1920
+
1921
+ >>> streamtraces_are_active = plot.streamtraces.active
1922
+ """
1923
+ with self.plot.frame.activated():
1924
+ return _tecutil.QueryStreamtracesAreActive()
1925
+
1926
+ @property
1927
+ def are_active(self):
1928
+ tecutil.api_moved('Streamtraces.are_active', 'Streamtraces.active',
1929
+ '0.13', '2018 R2')
1930
+
1931
+ @property
1932
+ def use_slice_clipping(self):
1933
+ """`bool`: Clip isosurface by any intersecting slices.
1934
+
1935
+ Example usage::
1936
+
1937
+ >>> from tecplot.constant import ClipPlane
1938
+ >>> slice = plot.slice(0)
1939
+ >>> slice.clip = ClipPlane.AbovePrimarySlice
1940
+ >>> plot.fieldmap(0).effects.clip_planes = slice
1941
+ >>> plot.streamtraces.use_slice_clipping = True
1942
+
1943
+ .. seealso:: `SliceGroup.clip`
1944
+ """
1945
+ return self._get_style(bool, sv.OBEYCLIPPLANES)
1946
+
1947
+ @use_slice_clipping.setter
1948
+ def use_slice_clipping(self, value):
1949
+ self._set_style(bool(value), sv.OBEYCLIPPLANES)