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.
- pytecplot-1.5.2.dist-info/LICENSE.html +77 -0
- pytecplot-1.5.2.dist-info/METADATA +508 -0
- pytecplot-1.5.2.dist-info/RECORD +97 -0
- pytecplot-1.5.2.dist-info/WHEEL +5 -0
- pytecplot-1.5.2.dist-info/top_level.txt +1 -0
- tecplot/__init__.py +94 -0
- tecplot/annotation/__init__.py +7 -0
- tecplot/annotation/annotation.py +223 -0
- tecplot/annotation/geometry.py +369 -0
- tecplot/annotation/georeference.py +33 -0
- tecplot/annotation/image.py +185 -0
- tecplot/annotation/iter.py +105 -0
- tecplot/annotation/polyline.py +381 -0
- tecplot/annotation/text.py +744 -0
- tecplot/constant.py +401 -0
- tecplot/data/__init__.py +34 -0
- tecplot/data/array.py +645 -0
- tecplot/data/create.py +1 -0
- tecplot/data/dataset.py +1809 -0
- tecplot/data/extract.py +544 -0
- tecplot/data/face_neighbors.py +494 -0
- tecplot/data/facemap.py +814 -0
- tecplot/data/load.py +2075 -0
- tecplot/data/nodemap.py +577 -0
- tecplot/data/operate.py +928 -0
- tecplot/data/query.py +334 -0
- tecplot/data/save.py +343 -0
- tecplot/data/variable.py +280 -0
- tecplot/data/zone.py +841 -0
- tecplot/exception.py +201 -0
- tecplot/export/__init__.py +13 -0
- tecplot/export/animation.py +521 -0
- tecplot/export/export_setup.py +318 -0
- tecplot/export/image.py +577 -0
- tecplot/export/print_setup.py +218 -0
- tecplot/export/time_animation.py +607 -0
- tecplot/extension/__init__.py +14 -0
- tecplot/extension/ipython.py +68 -0
- tecplot/layout/__init__.py +20 -0
- tecplot/layout/frame.py +1285 -0
- tecplot/layout/layout.py +488 -0
- tecplot/layout/page.py +541 -0
- tecplot/legend/__init__.py +4 -0
- tecplot/legend/contour_legend.py +516 -0
- tecplot/legend/legend.py +141 -0
- tecplot/legend/line_legend.py +66 -0
- tecplot/legend/rgb_coloring_legend.py +291 -0
- tecplot/legend/scatter_legend.py +136 -0
- tecplot/macro.py +339 -0
- tecplot/plot/__init__.py +62 -0
- tecplot/plot/axes.py +881 -0
- tecplot/plot/axis.py +1350 -0
- tecplot/plot/blanking.py +584 -0
- tecplot/plot/contour.py +1302 -0
- tecplot/plot/effects.py +162 -0
- tecplot/plot/fieldmap.py +2159 -0
- tecplot/plot/grid.py +758 -0
- tecplot/plot/isosurface.py +1167 -0
- tecplot/plot/labels.py +338 -0
- tecplot/plot/linemap.py +1905 -0
- tecplot/plot/linking.py +489 -0
- tecplot/plot/plot.py +1791 -0
- tecplot/plot/rgb_coloring.py +281 -0
- tecplot/plot/scatter.py +396 -0
- tecplot/plot/slice.py +1544 -0
- tecplot/plot/streamtrace.py +1949 -0
- tecplot/plot/symbol.py +567 -0
- tecplot/plot/ticks.py +666 -0
- tecplot/plot/title.py +380 -0
- tecplot/plot/vector.py +679 -0
- tecplot/plot/view.py +868 -0
- tecplot/session/__init__.py +112 -0
- tecplot/session/aux_data.py +276 -0
- tecplot/session/config.py +92 -0
- tecplot/session/session.py +425 -0
- tecplot/session/state_changed.py +225 -0
- tecplot/session/style.py +504 -0
- tecplot/tecutil/__init__.py +16 -0
- tecplot/tecutil/arglist.py +230 -0
- tecplot/tecutil/captured_output.py +177 -0
- tecplot/tecutil/constant.py +1312 -0
- tecplot/tecutil/index_set.py +118 -0
- tecplot/tecutil/lock.py +36 -0
- tecplot/tecutil/message_pb2.py +39 -0
- tecplot/tecutil/preamble.py +54 -0
- tecplot/tecutil/stringlist.py +114 -0
- tecplot/tecutil/sv.py +1662 -0
- tecplot/tecutil/tecutil.py +12402 -0
- tecplot/tecutil/tecutil_client.py +627 -0
- tecplot/tecutil/tecutil_connector.py +937 -0
- tecplot/tecutil/tecutil_rpc.py +6845 -0
- tecplot/tecutil/util.py +332 -0
- tecplot/text/__init__.py +3 -0
- tecplot/text/font.py +224 -0
- tecplot/text/label_format.py +374 -0
- tecplot/text/textbox.py +106 -0
- tecplot/version.py +41 -0
|
@@ -0,0 +1,1167 @@
|
|
|
1
|
+
import collections
|
|
2
|
+
|
|
3
|
+
from collections.abc import Iterable
|
|
4
|
+
|
|
5
|
+
from ..tecutil import _tecutil
|
|
6
|
+
from ..constant import *
|
|
7
|
+
from ..exception import *
|
|
8
|
+
from .. import session, tecutil, version
|
|
9
|
+
from ..tecutil import Index, sv, color_spec
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class IsosurfaceGroupStyle(session.Style):
|
|
13
|
+
def __init__(self, isosurface, *sv_args):
|
|
14
|
+
self.isosurface = isosurface
|
|
15
|
+
kw = dict(uniqueid=isosurface.plot.frame.uid,
|
|
16
|
+
offset1=isosurface.index)
|
|
17
|
+
super().__init__(isosurface._sv, *sv_args, **kw)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class IsosurfaceMesh(IsosurfaceGroupStyle):
|
|
21
|
+
"""Mesh attributes of the isosurface group.
|
|
22
|
+
|
|
23
|
+
.. code-block:: python
|
|
24
|
+
:emphasize-lines: 20-22
|
|
25
|
+
|
|
26
|
+
import os
|
|
27
|
+
import tecplot as tp
|
|
28
|
+
from tecplot.constant import *
|
|
29
|
+
|
|
30
|
+
examples_dir = tp.session.tecplot_examples_directory()
|
|
31
|
+
datafile = os.path.join(examples_dir, 'OneraM6wing', 'OneraM6_SU2_RANS.plt')
|
|
32
|
+
dataset = tp.data.load_tecplot(datafile)
|
|
33
|
+
|
|
34
|
+
plot = tp.active_frame().plot()
|
|
35
|
+
plot.show_isosurfaces = True
|
|
36
|
+
plot.contour(0).colormap_name = 'Magma'
|
|
37
|
+
plot.contour(0).variable = dataset.variable('Mach')
|
|
38
|
+
plot.contour(0).legend.show = False
|
|
39
|
+
|
|
40
|
+
iso = plot.isosurface(0)
|
|
41
|
+
iso.show = True
|
|
42
|
+
iso.definition_contour_group = plot.contour(0)
|
|
43
|
+
iso.isosurface_selection = IsoSurfaceSelection.OneSpecificValue
|
|
44
|
+
iso.isosurface_values = 1
|
|
45
|
+
iso.mesh.show = True
|
|
46
|
+
iso.mesh.color = Color.Mahogany
|
|
47
|
+
iso.mesh.line_thickness = 0.4
|
|
48
|
+
|
|
49
|
+
view = plot.view
|
|
50
|
+
view.psi = 65.777
|
|
51
|
+
view.theta = 166.415
|
|
52
|
+
view.alpha = -1.05394
|
|
53
|
+
view.position = (-23.92541680486183, 101.8931504712126, 47.04269529295333)
|
|
54
|
+
view.width = 1.3844
|
|
55
|
+
|
|
56
|
+
tp.export.save_png('isosurface_mesh.png', 600, supersample=3)
|
|
57
|
+
|
|
58
|
+
.. figure:: /_static/images/isosurface_mesh.png
|
|
59
|
+
:width: 300px
|
|
60
|
+
:figwidth: 300px
|
|
61
|
+
"""
|
|
62
|
+
def __init__(self, isosurface):
|
|
63
|
+
super().__init__(isosurface, sv.MESH)
|
|
64
|
+
|
|
65
|
+
@property
|
|
66
|
+
def show(self):
|
|
67
|
+
"""`bool`: Display the mesh on isosurfaces.
|
|
68
|
+
|
|
69
|
+
Example usage::
|
|
70
|
+
|
|
71
|
+
>>> plot.isosurface(0).mesh.show = True
|
|
72
|
+
"""
|
|
73
|
+
return self._get_style(bool, sv.SHOW)
|
|
74
|
+
|
|
75
|
+
@show.setter
|
|
76
|
+
def show(self, value):
|
|
77
|
+
self._set_style(bool(value), sv.SHOW)
|
|
78
|
+
|
|
79
|
+
@property
|
|
80
|
+
def color(self):
|
|
81
|
+
"""`Color` or `ContourGroup`: Isosurface mesh color.
|
|
82
|
+
|
|
83
|
+
Iso-surface mesh lines can be a solid color or be colored by a
|
|
84
|
+
`ContourGroup` as obtained through the ``plot.contour`` property.
|
|
85
|
+
|
|
86
|
+
Example usage::
|
|
87
|
+
|
|
88
|
+
>>> plot.isosurface(0).mesh.show = True
|
|
89
|
+
>>> plot.isosurface(0).mesh.color = Color.Blue
|
|
90
|
+
"""
|
|
91
|
+
return color_spec(self._get_style(Color, sv.COLOR),
|
|
92
|
+
self.isosurface.plot)
|
|
93
|
+
|
|
94
|
+
@color.setter
|
|
95
|
+
def color(self, value):
|
|
96
|
+
self._set_style(color_spec(value), sv.COLOR)
|
|
97
|
+
|
|
98
|
+
@property
|
|
99
|
+
def line_thickness(self):
|
|
100
|
+
"""`float`: Isosurface mesh line thickness.
|
|
101
|
+
|
|
102
|
+
Suggested values are .002, .1, .4, .8, 1.5
|
|
103
|
+
|
|
104
|
+
Example usage::
|
|
105
|
+
|
|
106
|
+
>>> plot.isosurface(0).mesh.show = True
|
|
107
|
+
>>> plot.isosurface(0).mesh.line_thickness = .4
|
|
108
|
+
"""
|
|
109
|
+
return self._get_style(float, sv.LINETHICKNESS)
|
|
110
|
+
|
|
111
|
+
@line_thickness.setter
|
|
112
|
+
def line_thickness(self, value):
|
|
113
|
+
self._set_style(float(value), sv.LINETHICKNESS)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class IsosurfaceContour(IsosurfaceGroupStyle):
|
|
117
|
+
"""Contour attributes of the isosurface group.
|
|
118
|
+
|
|
119
|
+
.. code-block:: python
|
|
120
|
+
:emphasize-lines: 21-24
|
|
121
|
+
|
|
122
|
+
import os
|
|
123
|
+
import tecplot as tp
|
|
124
|
+
from tecplot.constant import *
|
|
125
|
+
|
|
126
|
+
examples_dir = tp.session.tecplot_examples_directory()
|
|
127
|
+
datafile = os.path.join(examples_dir, 'OneraM6wing', 'OneraM6_SU2_RANS.plt')
|
|
128
|
+
dataset = tp.data.load_tecplot(datafile)
|
|
129
|
+
|
|
130
|
+
plot = tp.active_frame().plot()
|
|
131
|
+
plot.show_isosurfaces = True
|
|
132
|
+
plot.contour(0).colormap_name = 'Magma'
|
|
133
|
+
plot.contour(0).variable = dataset.variable('Mach')
|
|
134
|
+
plot.contour(0).legend.show = False
|
|
135
|
+
|
|
136
|
+
iso = plot.isosurface(0)
|
|
137
|
+
iso.show = True
|
|
138
|
+
iso.definition_contour_group = plot.contour(0)
|
|
139
|
+
iso.isosurface_selection = IsoSurfaceSelection.OneSpecificValue
|
|
140
|
+
iso.isosurface_values = 1
|
|
141
|
+
|
|
142
|
+
plot.contour(1).variable = dataset.variable('Density')
|
|
143
|
+
iso.contour.show = True
|
|
144
|
+
iso.contour.contour_type = ContourType.PrimaryValue
|
|
145
|
+
iso.contour.flood_contour_group = plot.contour(1)
|
|
146
|
+
|
|
147
|
+
view = plot.view
|
|
148
|
+
view.psi = 65.777
|
|
149
|
+
view.theta = 166.415
|
|
150
|
+
view.alpha = -1.05394
|
|
151
|
+
view.position = (-23.92541680486183, 101.8931504712126, 47.04269529295333)
|
|
152
|
+
view.width = 1.3844
|
|
153
|
+
|
|
154
|
+
# ensure consistent output between interactive (connected) and batch
|
|
155
|
+
plot.contour(0).levels.reset_to_nice()
|
|
156
|
+
plot.contour(1).levels.reset_to_nice()
|
|
157
|
+
|
|
158
|
+
tp.export.save_png('isosurface_contour.png', 600, supersample=3)
|
|
159
|
+
|
|
160
|
+
.. figure:: /_static/images/isosurface_contour.png
|
|
161
|
+
:width: 300px
|
|
162
|
+
:figwidth: 300px
|
|
163
|
+
"""
|
|
164
|
+
|
|
165
|
+
def __init__(self, isosurface):
|
|
166
|
+
super().__init__(isosurface, sv.CONTOUR)
|
|
167
|
+
|
|
168
|
+
@property
|
|
169
|
+
def use_lighting_effect(self):
|
|
170
|
+
"""`bool`: Enable lighting effect.
|
|
171
|
+
|
|
172
|
+
When set to `True`, the lighting effect may be selected with the
|
|
173
|
+
`IsosurfaceEffects.lighting_effect` attribute.
|
|
174
|
+
|
|
175
|
+
Example usage::
|
|
176
|
+
|
|
177
|
+
>>> plot.isosurface(0).contour.use_lighting_effect = True
|
|
178
|
+
>>> plot.isosurface(0).effects.lighting_effect = LightingEffect.Paneled
|
|
179
|
+
"""
|
|
180
|
+
return self._get_style(bool, sv.USELIGHTINGEFFECT)
|
|
181
|
+
|
|
182
|
+
@use_lighting_effect.setter
|
|
183
|
+
def use_lighting_effect(self, value):
|
|
184
|
+
self._set_style(bool(value), sv.USELIGHTINGEFFECT)
|
|
185
|
+
|
|
186
|
+
@property
|
|
187
|
+
def show(self):
|
|
188
|
+
"""`bool`: Show contours on isosurfaces.
|
|
189
|
+
|
|
190
|
+
Example usage::
|
|
191
|
+
|
|
192
|
+
>>> plot.isosurface(0).contour.show = True
|
|
193
|
+
"""
|
|
194
|
+
return self._get_style(bool, sv.SHOW)
|
|
195
|
+
|
|
196
|
+
@show.setter
|
|
197
|
+
def show(self, value):
|
|
198
|
+
self._set_style(bool(value), sv.SHOW)
|
|
199
|
+
|
|
200
|
+
@property
|
|
201
|
+
def contour_type(self):
|
|
202
|
+
"""`ContourType`: Contour display type.
|
|
203
|
+
|
|
204
|
+
* `ContourType.Lines` - Draws lines of constant value of the
|
|
205
|
+
specified contour variable.
|
|
206
|
+
* `ContourType.Flood` - Floods regions between contour lines
|
|
207
|
+
with colors from a color map.
|
|
208
|
+
The distribution of colors used for contour flooding may be banded or
|
|
209
|
+
continuous. When banded distribution is used for flooding,
|
|
210
|
+
a solid color is used between contour levels.
|
|
211
|
+
If continuous color distribution is used, the flood
|
|
212
|
+
color will vary linearly in all directions.
|
|
213
|
+
* `ContourType.Overlay` - Combines the above two options.
|
|
214
|
+
* `ContourType.AverageCell` - Floods cells or finite elements with
|
|
215
|
+
colors from a color map according to the average value of the contour
|
|
216
|
+
variable over the data points bounding the cell.
|
|
217
|
+
If the variables are located at the nodes, the values at the
|
|
218
|
+
nodes are averaged. If the variables are cell-centered, the
|
|
219
|
+
cell-centered values are averaged to the nodes and the nodes
|
|
220
|
+
are then averaged.
|
|
221
|
+
* `ContourType.PrimaryValue` - Floods cells or finite elements with
|
|
222
|
+
colors from a color map according to the primary value of the contour
|
|
223
|
+
variable for each cell. If the variable is cell centered, the
|
|
224
|
+
primary value is the value assigned to the cell. If the variable
|
|
225
|
+
is node located, the primary value comes from the lowest index
|
|
226
|
+
node in the cell. If the variables are located at the nodes, the
|
|
227
|
+
value of the lowest indexed node in the cell is used. When plotting
|
|
228
|
+
IJK-ordered, FE-brick or FE-tetra cells, each face is considered
|
|
229
|
+
independently of the other faces. You may get different colors on
|
|
230
|
+
the different faces of the same cell.
|
|
231
|
+
If the variables are cell-centered, the cell-centered value is
|
|
232
|
+
used directly. When plotting I, J, or K-planes in 3D, the cell
|
|
233
|
+
on the positive side of the plane supplies the value, except
|
|
234
|
+
in the case of the last plane, where the cell on the negative
|
|
235
|
+
side supplies the value.
|
|
236
|
+
|
|
237
|
+
Example usage::
|
|
238
|
+
|
|
239
|
+
>>> plot.isosurface(0).contour.show = True
|
|
240
|
+
>>> plot.isosurface(0).contour.contour_type = ContourType.Flood
|
|
241
|
+
"""
|
|
242
|
+
return self._get_style(ContourType, sv.CONTOURTYPE)
|
|
243
|
+
|
|
244
|
+
@contour_type.setter
|
|
245
|
+
def contour_type(self, value):
|
|
246
|
+
self._set_style(ContourType(value), sv.CONTOURTYPE)
|
|
247
|
+
|
|
248
|
+
@property
|
|
249
|
+
def flood_contour_group_index(self):
|
|
250
|
+
"""`Index`: The zero-based `Index` of the `ContourGroup` to use for flooding.
|
|
251
|
+
|
|
252
|
+
This property sets and gets, by `Index`, the `ContourGroup` used for
|
|
253
|
+
flooding. Changing style on this `ContourGroup` will affect all
|
|
254
|
+
fieldmaps on the same `Frame <layout.Frame>` that use it.
|
|
255
|
+
|
|
256
|
+
Example usage::
|
|
257
|
+
|
|
258
|
+
>>> contour = plot.isosurface(0).contour
|
|
259
|
+
>>> contour.flood_contour_group_index = 1
|
|
260
|
+
"""
|
|
261
|
+
return self._get_style(Index, sv.FLOODCOLORING)
|
|
262
|
+
|
|
263
|
+
@flood_contour_group_index.setter
|
|
264
|
+
def flood_contour_group_index(self, index):
|
|
265
|
+
self._set_style(Index(index), sv.FLOODCOLORING)
|
|
266
|
+
|
|
267
|
+
@property
|
|
268
|
+
def flood_contour_group(self):
|
|
269
|
+
"""`ContourGroup`: Contour group to use for flooding.
|
|
270
|
+
|
|
271
|
+
Changing style on this `ContourGroup` will affect all
|
|
272
|
+
fieldmaps on the same `Frame <layout.Frame>` that use it.
|
|
273
|
+
|
|
274
|
+
Example usage::
|
|
275
|
+
|
|
276
|
+
>>> group = plot.contour(1)
|
|
277
|
+
>>> contour = plot.isosurface(1).contour
|
|
278
|
+
>>> contour.flood_contour_group = group
|
|
279
|
+
"""
|
|
280
|
+
return self.isosurface.plot.contour(self.flood_contour_group_index)
|
|
281
|
+
|
|
282
|
+
@flood_contour_group.setter
|
|
283
|
+
def flood_contour_group(self, flood_contour_group):
|
|
284
|
+
self.flood_contour_group_index = flood_contour_group.index
|
|
285
|
+
|
|
286
|
+
@property
|
|
287
|
+
def line_contour_group_index(self):
|
|
288
|
+
"""`int`: The zero-based `Index` of the `ContourGroup` to use for contour lines.
|
|
289
|
+
|
|
290
|
+
This property sets and gets, by `Index`, the `ContourGroup` used for
|
|
291
|
+
line placement. Although all properties of the `ContourGroup` can be
|
|
292
|
+
manipulated through this object, many of them (i.e., color) will not
|
|
293
|
+
affect the lines unless the `FieldmapContour.line_color` is set to the
|
|
294
|
+
same `ContourGroup`. Note that changing style on this `ContourGroup`
|
|
295
|
+
will affect all other fieldmaps on the same `Frame <layout.Frame>` that use it.
|
|
296
|
+
|
|
297
|
+
Example usage::
|
|
298
|
+
|
|
299
|
+
>>> contour = plot.isosurface(0).contour
|
|
300
|
+
>>> contour.line_contour_group_index = 2
|
|
301
|
+
"""
|
|
302
|
+
return self._get_style(Index, sv.LINECONTOURGROUP)
|
|
303
|
+
|
|
304
|
+
@line_contour_group_index.setter
|
|
305
|
+
def line_contour_group_index(self, index):
|
|
306
|
+
self._set_style(Index(index), sv.LINECONTOURGROUP)
|
|
307
|
+
|
|
308
|
+
@property
|
|
309
|
+
def line_contour_group(self):
|
|
310
|
+
"""`ContourGroup`: The contour group to use for contour lines.
|
|
311
|
+
|
|
312
|
+
Note that changing style on this `ContourGroup`
|
|
313
|
+
will affect all other fieldmaps on the same `Frame <layout.Frame>` that use it.
|
|
314
|
+
|
|
315
|
+
Example usage::
|
|
316
|
+
|
|
317
|
+
>>> contour = plot.isosurface(0).contour
|
|
318
|
+
>>> group = plot.contour(1)
|
|
319
|
+
>>> contour.line_contour_group = group
|
|
320
|
+
"""
|
|
321
|
+
return self.isosurface.plot.contour(self.line_contour_group_index)
|
|
322
|
+
|
|
323
|
+
@line_contour_group.setter
|
|
324
|
+
def line_contour_group(self, contour_group):
|
|
325
|
+
self.line_contour_group_index = contour_group.index
|
|
326
|
+
|
|
327
|
+
@property
|
|
328
|
+
def line_color(self):
|
|
329
|
+
"""`Color` or `ContourGroup`: `Color` of contour lines.
|
|
330
|
+
|
|
331
|
+
Contour lines can be a solid color or be colored by a
|
|
332
|
+
`ContourGroup` as obtained through the ``plot.contour`` property.
|
|
333
|
+
|
|
334
|
+
Example usage::
|
|
335
|
+
|
|
336
|
+
>>> plot.show_isosurfaces = True
|
|
337
|
+
>>> plot.isosurface(0).contour.line_color = Color.Blue
|
|
338
|
+
"""
|
|
339
|
+
return color_spec(self._get_style(Color, sv.COLOR),
|
|
340
|
+
self.isosurface.plot)
|
|
341
|
+
|
|
342
|
+
@line_color.setter
|
|
343
|
+
def line_color(self, value):
|
|
344
|
+
self._set_style(color_spec(value), sv.COLOR)
|
|
345
|
+
|
|
346
|
+
@property
|
|
347
|
+
def line_thickness(self):
|
|
348
|
+
"""`float`: Contour line thickness as a percentage of frame width.
|
|
349
|
+
|
|
350
|
+
Suggested values are one of: **.02, .1, .4, .8, 1.5**
|
|
351
|
+
|
|
352
|
+
Example usage::
|
|
353
|
+
|
|
354
|
+
>>> plot.show_isosurfaces = True
|
|
355
|
+
>>> plot.isosurface(0).contour.line_thickness = .4
|
|
356
|
+
"""
|
|
357
|
+
return self._get_style(float, sv.LINETHICKNESS)
|
|
358
|
+
|
|
359
|
+
@line_thickness.setter
|
|
360
|
+
def line_thickness(self, value):
|
|
361
|
+
self._set_style(float(value), sv.LINETHICKNESS)
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
class IsosurfaceEffects(IsosurfaceGroupStyle):
|
|
365
|
+
"""Effects of the isosurface group.
|
|
366
|
+
|
|
367
|
+
.. code-block:: python
|
|
368
|
+
:emphasize-lines: 21-23
|
|
369
|
+
|
|
370
|
+
import os
|
|
371
|
+
import tecplot as tp
|
|
372
|
+
from tecplot.constant import *
|
|
373
|
+
|
|
374
|
+
examples_dir = tp.session.tecplot_examples_directory()
|
|
375
|
+
datafile = os.path.join(examples_dir, 'OneraM6wing', 'OneraM6_SU2_RANS.plt')
|
|
376
|
+
dataset = tp.data.load_tecplot(datafile)
|
|
377
|
+
|
|
378
|
+
plot = tp.active_frame().plot()
|
|
379
|
+
plot.show_isosurfaces = True
|
|
380
|
+
plot.contour(0).colormap_name = 'Magma'
|
|
381
|
+
plot.contour(0).variable = dataset.variable('Mach')
|
|
382
|
+
plot.contour(0).legend.show = False
|
|
383
|
+
|
|
384
|
+
iso = plot.isosurface(0)
|
|
385
|
+
iso.show = True
|
|
386
|
+
iso.definition_contour_group = plot.contour(0)
|
|
387
|
+
iso.isosurface_selection = IsoSurfaceSelection.ThreeSpecificValues
|
|
388
|
+
iso.isosurface_values = [.95,1.0,1.1]
|
|
389
|
+
|
|
390
|
+
iso.effects.lighting_effect = LightingEffect.Paneled
|
|
391
|
+
iso.effects.use_translucency = True
|
|
392
|
+
iso.effects.surface_translucency = 80
|
|
393
|
+
|
|
394
|
+
view = plot.view
|
|
395
|
+
view.psi = 65.777
|
|
396
|
+
view.theta = 166.415
|
|
397
|
+
view.alpha = -1.05394
|
|
398
|
+
view.position = (-23.92541680486183, 101.8931504712126, 47.04269529295333)
|
|
399
|
+
view.width = 1.3844
|
|
400
|
+
|
|
401
|
+
tp.export.save_png('isosurface_effects.png', 600, supersample=3)
|
|
402
|
+
|
|
403
|
+
.. figure:: /_static/images/isosurface_effects.png
|
|
404
|
+
:width: 300px
|
|
405
|
+
:figwidth: 300px
|
|
406
|
+
"""
|
|
407
|
+
def __init__(self, isosurface):
|
|
408
|
+
super().__init__(isosurface, sv.EFFECTS)
|
|
409
|
+
|
|
410
|
+
@property
|
|
411
|
+
def lighting_effect(self):
|
|
412
|
+
"""`LightingEffect`: Surface lighting effect.
|
|
413
|
+
|
|
414
|
+
Isosurface lighting effects must be enabled by setting
|
|
415
|
+
`IsosurfaceShade.use_lighting_effect` to `True` when setting this value.
|
|
416
|
+
|
|
417
|
+
There are two types of lighting effects: Paneled and Gouraud:
|
|
418
|
+
|
|
419
|
+
* `Paneled`: Within each cell, the color assigned to each area by
|
|
420
|
+
shading or contour flooding is tinted by a shade constant
|
|
421
|
+
across the cell. This shade is based on the orientation
|
|
422
|
+
of the cell relative to your 3D light source.
|
|
423
|
+
* `Gouraud`: This offers smoother, more continuous shading than
|
|
424
|
+
Paneled shading, but it also results in slower plotting
|
|
425
|
+
and larger print files. `Gouraud` shading is not continuous
|
|
426
|
+
across zone boundaries unless face neighbors are specified
|
|
427
|
+
in the data. `Gouraud` shading is not available for finite
|
|
428
|
+
element volume `Zone <data_access>` when blanking is active.
|
|
429
|
+
The zone's lighting effect reverts to `Paneled`
|
|
430
|
+
shading in this case.
|
|
431
|
+
|
|
432
|
+
Example usage::
|
|
433
|
+
|
|
434
|
+
>>> plot.isosurface(0).shade.use_lighting_effect = True
|
|
435
|
+
>>> plot.isosurface(0).effects.lighting_effect = LightingEffect.Paneled
|
|
436
|
+
"""
|
|
437
|
+
return self._get_style(LightingEffect, sv.LIGHTINGEFFECT)
|
|
438
|
+
|
|
439
|
+
@lighting_effect.setter
|
|
440
|
+
def lighting_effect(self, value):
|
|
441
|
+
self._set_style(LightingEffect(value), sv.LIGHTINGEFFECT)
|
|
442
|
+
|
|
443
|
+
@property
|
|
444
|
+
def surface_translucency(self):
|
|
445
|
+
"""`int`: Surface translucency of the isosurface group.
|
|
446
|
+
|
|
447
|
+
Iso-surface surface translucency must be enabled by setting
|
|
448
|
+
`IsosurfaceEffects.use_translucency` = `True` when setting this value.
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
Valid translucency values range from one (opaque) to 99 (translucent).
|
|
452
|
+
|
|
453
|
+
Example usage::
|
|
454
|
+
|
|
455
|
+
>>> plot.isosurface(0).effects.use_translucency = True
|
|
456
|
+
>>> plot.isosurface(0).effects.surface_translucency = 20
|
|
457
|
+
"""
|
|
458
|
+
return self._get_style(int, sv.SURFACETRANSLUCENCY)
|
|
459
|
+
|
|
460
|
+
@surface_translucency.setter
|
|
461
|
+
def surface_translucency(self, value):
|
|
462
|
+
self._set_style(int(value), sv.SURFACETRANSLUCENCY)
|
|
463
|
+
|
|
464
|
+
@property
|
|
465
|
+
def use_translucency(self):
|
|
466
|
+
"""`bool`: Enable surface translucency for this isosurface group.
|
|
467
|
+
|
|
468
|
+
The surface translucency value can be changed by setting
|
|
469
|
+
`IsosurfaceEffects.surface_translucency`.
|
|
470
|
+
|
|
471
|
+
Example usage::
|
|
472
|
+
|
|
473
|
+
>>> plot.isosurface(0).effects.use_translucency = True
|
|
474
|
+
>>> plot.isosurface(0).effects.surface_translucency = 20
|
|
475
|
+
"""
|
|
476
|
+
return self._get_style(bool, sv.USETRANSLUCENCY)
|
|
477
|
+
|
|
478
|
+
@use_translucency.setter
|
|
479
|
+
def use_translucency(self, value):
|
|
480
|
+
self._set_style(bool(value), sv.USETRANSLUCENCY)
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
class IsosurfaceShade(IsosurfaceGroupStyle):
|
|
484
|
+
"""Shade attributes of the isosurface group.
|
|
485
|
+
|
|
486
|
+
.. code-block:: python
|
|
487
|
+
:emphasize-lines: 17-19
|
|
488
|
+
|
|
489
|
+
import tecplot as tp
|
|
490
|
+
from os import path
|
|
491
|
+
from tecplot.plot import IsosurfaceGroup
|
|
492
|
+
from tecplot.constant import Color, LightingEffect
|
|
493
|
+
|
|
494
|
+
examples_dir = tp.session.tecplot_examples_directory()
|
|
495
|
+
datafile = path.join(examples_dir, 'SimpleData', 'DuctFlow.plt')
|
|
496
|
+
dataset = tp.data.load_tecplot(datafile)
|
|
497
|
+
|
|
498
|
+
plot = tp.active_frame().plot()
|
|
499
|
+
plot.show_isosurfaces = True
|
|
500
|
+
plot.contour(0).variable = dataset.variable('U(M/S)')
|
|
501
|
+
iso = plot.isosurface(0)
|
|
502
|
+
|
|
503
|
+
iso.contour.show = False # Hiding the contour will reveal the shade.
|
|
504
|
+
|
|
505
|
+
iso.shade.show = True
|
|
506
|
+
iso.shade.color = Color.Red
|
|
507
|
+
iso.shade.use_lighting_effect = True
|
|
508
|
+
|
|
509
|
+
iso.effects.lighting_effect = LightingEffect.Paneled
|
|
510
|
+
|
|
511
|
+
tp.export.save_png('isosurface_shade.png', 600, supersample=3)
|
|
512
|
+
|
|
513
|
+
.. figure:: /_static/images/isosurface_shade.png
|
|
514
|
+
:width: 300px
|
|
515
|
+
:figwidth: 300px
|
|
516
|
+
|
|
517
|
+
"""
|
|
518
|
+
def __init__(self, isosurface):
|
|
519
|
+
super().__init__(isosurface, sv.SHADE)
|
|
520
|
+
|
|
521
|
+
@property
|
|
522
|
+
def show(self):
|
|
523
|
+
"""`bool`: Show shade attributes.
|
|
524
|
+
|
|
525
|
+
Example usage::
|
|
526
|
+
|
|
527
|
+
>>> plot.isosurface(0).shade.show = True
|
|
528
|
+
"""
|
|
529
|
+
return self._get_style(bool, sv.SHOW)
|
|
530
|
+
|
|
531
|
+
@show.setter
|
|
532
|
+
def show(self, value):
|
|
533
|
+
self._set_style(bool(value), sv.SHOW)
|
|
534
|
+
|
|
535
|
+
@property
|
|
536
|
+
def color(self):
|
|
537
|
+
"""`Color`: Shade color.
|
|
538
|
+
|
|
539
|
+
`Color.MultiColor` and `Color.RGBColor` coloring are not available.
|
|
540
|
+
Use flooded contours for multi-color or RGB flooding
|
|
541
|
+
|
|
542
|
+
Example usage::
|
|
543
|
+
|
|
544
|
+
>>> plot.isosurface(0).shade.show = True
|
|
545
|
+
>>> plot.isosurface(0).shade.color = Color.Blue
|
|
546
|
+
"""
|
|
547
|
+
return self._get_style(Color, sv.COLOR)
|
|
548
|
+
|
|
549
|
+
@color.setter
|
|
550
|
+
def color(self, value):
|
|
551
|
+
self._set_style(Color(value), sv.COLOR)
|
|
552
|
+
|
|
553
|
+
@property
|
|
554
|
+
def use_lighting_effect(self):
|
|
555
|
+
"""`bool`: Enable lighting effect.
|
|
556
|
+
|
|
557
|
+
When set to `True`, the lighting effect may be selected with the
|
|
558
|
+
`IsosurfaceEffects.lighting_effect` attribute.
|
|
559
|
+
|
|
560
|
+
Example usage::
|
|
561
|
+
|
|
562
|
+
>>> plot.isosurface(0).shade.use_lighting_effect = True
|
|
563
|
+
>>> plot.isosurface(0).effects.lighting_effect = LightingEffect.Paneled
|
|
564
|
+
"""
|
|
565
|
+
return self._get_style(bool, sv.USELIGHTINGEFFECT)
|
|
566
|
+
|
|
567
|
+
@use_lighting_effect.setter
|
|
568
|
+
def use_lighting_effect(self, value):
|
|
569
|
+
self._set_style(bool(value), sv.USELIGHTINGEFFECT)
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
class IsosurfaceValues(object):
|
|
573
|
+
def __init__(self, isosurface_group):
|
|
574
|
+
"""@type isosurface_group: IsosurfaceGroup"""
|
|
575
|
+
self.isosurface_group = isosurface_group
|
|
576
|
+
self._sv = [sv.ISOVALUE1, sv.ISOVALUE2, sv.ISOVALUE3]
|
|
577
|
+
|
|
578
|
+
def __iter__(self):
|
|
579
|
+
for i in range(len(self)):
|
|
580
|
+
yield self[i]
|
|
581
|
+
|
|
582
|
+
def __getitem__(self, index):
|
|
583
|
+
return self.isosurface_group._get_style(float, self._sv[index])
|
|
584
|
+
|
|
585
|
+
def __setitem__(self, index, value):
|
|
586
|
+
self.isosurface_group._set_style(float(value), self._sv[index])
|
|
587
|
+
|
|
588
|
+
def __str__(self):
|
|
589
|
+
return str(tuple(self))
|
|
590
|
+
|
|
591
|
+
def __repr__(self):
|
|
592
|
+
return repr(tuple(self))
|
|
593
|
+
|
|
594
|
+
def __len__(self):
|
|
595
|
+
return len(self._sv)
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
class IsosurfaceGroup(session.Style):
|
|
599
|
+
"""Isosurfaces style control.
|
|
600
|
+
|
|
601
|
+
.. code-block:: python
|
|
602
|
+
:emphasize-lines: 16-26
|
|
603
|
+
|
|
604
|
+
import os
|
|
605
|
+
import tecplot as tp
|
|
606
|
+
from tecplot.constant import *
|
|
607
|
+
|
|
608
|
+
examples_dir = tp.session.tecplot_examples_directory()
|
|
609
|
+
datafile = os.path.join(examples_dir, 'OneraM6wing', 'OneraM6_SU2_RANS.plt')
|
|
610
|
+
dataset = tp.data.load_tecplot(datafile)
|
|
611
|
+
|
|
612
|
+
plot = tp.active_frame().plot()
|
|
613
|
+
plot.show_isosurfaces = True
|
|
614
|
+
plot.contour(0).colormap_name = 'Magma'
|
|
615
|
+
plot.contour(0).variable = dataset.variable('Mach')
|
|
616
|
+
plot.contour(0).levels.reset_levels( [.95,1.0,1.1,1.4])
|
|
617
|
+
plot.contour(0).legend.show = False
|
|
618
|
+
|
|
619
|
+
iso = plot.isosurface(0)
|
|
620
|
+
iso.show = True
|
|
621
|
+
iso.definition_contour_group = plot.contour(0)
|
|
622
|
+
iso.isosurface_selection = IsoSurfaceSelection.ThreeSpecificValues
|
|
623
|
+
iso.isosurface_values = [.95,1,1.1]
|
|
624
|
+
|
|
625
|
+
iso.contour.show = True
|
|
626
|
+
iso.contour.flood_contour_group = plot.contour(0)
|
|
627
|
+
|
|
628
|
+
iso.effects.use_translucency = True
|
|
629
|
+
iso.effects.surface_translucency = 80
|
|
630
|
+
|
|
631
|
+
view = plot.view
|
|
632
|
+
view.psi = 65.777
|
|
633
|
+
view.theta = 166.415
|
|
634
|
+
view.alpha = -1.05394
|
|
635
|
+
view.position = (-23.92541680486183, 101.8931504712126, 47.04269529295333)
|
|
636
|
+
view.width = 1.3844
|
|
637
|
+
|
|
638
|
+
tp.export.save_png('isosurface_group.png', 600, supersample=3)
|
|
639
|
+
|
|
640
|
+
.. figure:: /_static/images/isosurface_group.png
|
|
641
|
+
:width: 600px
|
|
642
|
+
:figwidth: 300px
|
|
643
|
+
"""
|
|
644
|
+
def __init__(self, index, plot):
|
|
645
|
+
assert 0 <= index < 8, 'Iso-surface index out of range (must be < 8)'
|
|
646
|
+
self.index = Index(index)
|
|
647
|
+
self.plot = plot
|
|
648
|
+
super().__init__(sv.ISOSURFACEATTRIBUTES, uniqueid=self.plot.frame.uid,
|
|
649
|
+
offset1=self.index)
|
|
650
|
+
|
|
651
|
+
def __eq__(self, other):
|
|
652
|
+
return (self.index == other.index) and (self.plot == other.plot)
|
|
653
|
+
|
|
654
|
+
def __ne__(self, other):
|
|
655
|
+
return not self.__eq__(other)
|
|
656
|
+
|
|
657
|
+
@tecutil.lock()
|
|
658
|
+
def extract(self, mode=ExtractMode.SingleZone, assign_strand_ids=True):
|
|
659
|
+
"""Create new zones from this isosurface.
|
|
660
|
+
|
|
661
|
+
Extracts the current isosurfaces represented by this group to the
|
|
662
|
+
`Dataset <data.Dataset>` as one or more zones.
|
|
663
|
+
|
|
664
|
+
Parameters:
|
|
665
|
+
mode (`ExtractMode`, optional): Determines how many zones are
|
|
666
|
+
created upon extraction. Possible values are:
|
|
667
|
+
`ExtractMode.SingleZone` (default) and
|
|
668
|
+
`ExtractMode.OneZonePerConnectedRegion`.
|
|
669
|
+
assign_strand_ids (`bool`, optional): Automatically assign strand
|
|
670
|
+
ID's to the created zones. (default: `True`)
|
|
671
|
+
|
|
672
|
+
Returns:
|
|
673
|
+
The extracted zone if **mode** is `ExtractMode.SingleZone`,
|
|
674
|
+
otherwise a `generator
|
|
675
|
+
<https://docs.python.org/3/reference/expressions.html#generator-expressions>`_
|
|
676
|
+
of the extracted zones.
|
|
677
|
+
|
|
678
|
+
Example usage::
|
|
679
|
+
|
|
680
|
+
>>> isosurface_zone = plot.isosurface(0).extract()
|
|
681
|
+
|
|
682
|
+
.. versionadded:: 2017.3
|
|
683
|
+
Isosurface extraction requires Tecplot 360 2017 R3 or later.
|
|
684
|
+
..
|
|
685
|
+
"""
|
|
686
|
+
dataset = self.plot.frame.dataset
|
|
687
|
+
mode = ExtractMode(mode)
|
|
688
|
+
nzones = dataset.num_zones
|
|
689
|
+
with self.plot.frame.activated():
|
|
690
|
+
with tecutil.ArgList(**{sv.GROUP: self.index + 1}) as arglist:
|
|
691
|
+
arglist[sv.EXTRACTMODE] = mode
|
|
692
|
+
arglist[sv.AUTOSTRANDTRANSIENTDATA] = bool(assign_strand_ids)
|
|
693
|
+
if not _tecutil.ExtractIsoSurfacesX(arglist):
|
|
694
|
+
raise TecplotSystemError()
|
|
695
|
+
if mode == ExtractMode.SingleZone:
|
|
696
|
+
return dataset.zone(nzones)
|
|
697
|
+
else:
|
|
698
|
+
return (dataset.zone(i) for i in range(nzones, dataset.num_zones))
|
|
699
|
+
|
|
700
|
+
@property
|
|
701
|
+
def mesh(self):
|
|
702
|
+
"""`IsosurfaceMesh`: Mesh attributes for this isosurface group.
|
|
703
|
+
|
|
704
|
+
Example usage::
|
|
705
|
+
|
|
706
|
+
>>> plot.isosurface(0).show = True
|
|
707
|
+
>>> plot.isosurface(0).mesh.show = True
|
|
708
|
+
"""
|
|
709
|
+
return IsosurfaceMesh(self)
|
|
710
|
+
|
|
711
|
+
@property
|
|
712
|
+
def contour(self):
|
|
713
|
+
"""`IsosurfaceContour`: Contour attributes for this isosurface group.
|
|
714
|
+
|
|
715
|
+
Example usage::
|
|
716
|
+
|
|
717
|
+
>>> plot.isosurface(0).show = True
|
|
718
|
+
>>> plot.isosurface(0).contour.show = True
|
|
719
|
+
"""
|
|
720
|
+
return IsosurfaceContour(self)
|
|
721
|
+
|
|
722
|
+
@property
|
|
723
|
+
def effects(self):
|
|
724
|
+
"""`IsosurfaceEffects`: Settings for isosurface effects.
|
|
725
|
+
|
|
726
|
+
Example usage::
|
|
727
|
+
|
|
728
|
+
>>> plot.isosurface(0).show = True
|
|
729
|
+
>>> plot.isosurface(0).effects.use_translucency = True
|
|
730
|
+
"""
|
|
731
|
+
return IsosurfaceEffects(self)
|
|
732
|
+
|
|
733
|
+
@property
|
|
734
|
+
def shade(self):
|
|
735
|
+
"""`IsosurfaceShade`: Shade attributes for this isosurface group.
|
|
736
|
+
|
|
737
|
+
Example usage::
|
|
738
|
+
|
|
739
|
+
>>> plot.isosurface(0).shade.show = True
|
|
740
|
+
"""
|
|
741
|
+
return IsosurfaceShade(self)
|
|
742
|
+
|
|
743
|
+
@property
|
|
744
|
+
def vector(self):
|
|
745
|
+
"""`IsosurfaceVector`: Vector attributes for this isosurface group.
|
|
746
|
+
|
|
747
|
+
Example usage::
|
|
748
|
+
|
|
749
|
+
>>> plot.isosurface(0).vector.show = True
|
|
750
|
+
"""
|
|
751
|
+
return IsosurfaceVector(self)
|
|
752
|
+
|
|
753
|
+
@property
|
|
754
|
+
def show(self):
|
|
755
|
+
"""`bool`: Show isosurfaces for this isosurface group.
|
|
756
|
+
|
|
757
|
+
Example usage::
|
|
758
|
+
|
|
759
|
+
>>> plot.isosurface(1).show = True
|
|
760
|
+
"""
|
|
761
|
+
return self._get_style(bool, sv.SHOWGROUP)
|
|
762
|
+
|
|
763
|
+
@show.setter
|
|
764
|
+
def show(self, value):
|
|
765
|
+
self._set_style(bool(value), sv.SHOWGROUP)
|
|
766
|
+
|
|
767
|
+
@property
|
|
768
|
+
def isosurface_values(self):
|
|
769
|
+
"""`tuple` or `float`: Values at which to draw isosurfaces.
|
|
770
|
+
|
|
771
|
+
This may be a 1, 2, or 3-`tuple` of `floats <float>`, or a single
|
|
772
|
+
scalar `float`.
|
|
773
|
+
|
|
774
|
+
To draw isosurfaces at up to 3 values:
|
|
775
|
+
#. Set `isosurface_selection` to one of the
|
|
776
|
+
following: `IsoSurfaceSelection.OneSpecificValue`
|
|
777
|
+
`IsoSurfaceSelection.TwoSpecificValues`
|
|
778
|
+
`IsoSurfaceSelection.ThreeSpecificValues`
|
|
779
|
+
#. Set `isosurface_values` to a 1, 2, or 3 `tuple` or `list` of
|
|
780
|
+
`floats <float>`, or set to a scalar `float` to assign the
|
|
781
|
+
first value only.
|
|
782
|
+
|
|
783
|
+
When queried, this property will always return
|
|
784
|
+
a 3 tuple of `floats <float>`.
|
|
785
|
+
|
|
786
|
+
See also `isosurface_selection`.
|
|
787
|
+
|
|
788
|
+
Assign first isosurface value using a scalar `float`::
|
|
789
|
+
|
|
790
|
+
>>> plot.isosurface(0).isosurface_selection = IsoSurfaceSelection.OneSpecificValue
|
|
791
|
+
>>> plot.isosurface(0).isosurface_values = 0.5
|
|
792
|
+
>>> plot.isosurface(0).isosurface_values[0]
|
|
793
|
+
0.5
|
|
794
|
+
|
|
795
|
+
Assign first isosurface value using a 1-`tuple`::
|
|
796
|
+
|
|
797
|
+
>>> plot.isosurface(0).isosurface_selection = IsoSurfaceSelection.OneSpecificValue
|
|
798
|
+
>>> plot.isosurface(0).isosurface_values = (.5,) # 1-tuple
|
|
799
|
+
>>> plot.isosurface(0).isosurface_values
|
|
800
|
+
0.5
|
|
801
|
+
|
|
802
|
+
Assign all three isosurface values::
|
|
803
|
+
|
|
804
|
+
>>> plot.isosurface(0).isosurface_selection = IsoSurfaceSelection.ThreeSpecificValues
|
|
805
|
+
>>> plot.isosurface(0).isosurface_values = (.5, .7, 9)
|
|
806
|
+
|
|
807
|
+
Assign the third isosurface values after assigning the first two::
|
|
808
|
+
|
|
809
|
+
>>> plot.isosurface(0).isosurface_selection = IsoSurfaceSelection.ThreeSpecificValues
|
|
810
|
+
>>> # Assign first and second isosurface value using a tuple
|
|
811
|
+
>>> plot.isosurface(0).isosurface_values = (0.0, 0.1)
|
|
812
|
+
>>> # Assign third isosurface value
|
|
813
|
+
>>> plot.isosurface(0).isosurface_values[2] = .3
|
|
814
|
+
>>> plot.isosurface(0).isosurface_values[2]
|
|
815
|
+
.3
|
|
816
|
+
>>> plot.isosurface(0).isosurface_values
|
|
817
|
+
(0.0, 0.1, .3)
|
|
818
|
+
|
|
819
|
+
Query the three isosurface values::
|
|
820
|
+
|
|
821
|
+
>>> # isosurface_values always returns a
|
|
822
|
+
>>> # list-like object of 3 floats with of current
|
|
823
|
+
>>> # isosurface values, even if fewer than three have been set.
|
|
824
|
+
>>> values = plot.isosurface(0).isosurface_values
|
|
825
|
+
>>> values
|
|
826
|
+
(0.1, 0.2, 0.3)
|
|
827
|
+
>>> values[0]
|
|
828
|
+
0.1
|
|
829
|
+
>>> values[1]
|
|
830
|
+
0.2
|
|
831
|
+
>>> values[2]
|
|
832
|
+
0.3
|
|
833
|
+
>>> len(values)
|
|
834
|
+
3
|
|
835
|
+
"""
|
|
836
|
+
return IsosurfaceValues(self)
|
|
837
|
+
|
|
838
|
+
@isosurface_values.setter
|
|
839
|
+
def isosurface_values(self, values):
|
|
840
|
+
self_values = IsosurfaceValues(self)
|
|
841
|
+
if isinstance(values, Iterable):
|
|
842
|
+
for i, value in enumerate(values):
|
|
843
|
+
self_values[i] = value
|
|
844
|
+
else:
|
|
845
|
+
self_values[0] = values
|
|
846
|
+
|
|
847
|
+
@property
|
|
848
|
+
def isosurface_selection(self):
|
|
849
|
+
"""`IsoSurfaceSelection`: Select where to draw isosurfaces.
|
|
850
|
+
|
|
851
|
+
Iso-surfaces may be drawn at:
|
|
852
|
+
* Contour group levels
|
|
853
|
+
* At specified value(s) - Specify up to three values of the
|
|
854
|
+
contour variable at which to draw isosurfaces.
|
|
855
|
+
|
|
856
|
+
To draw isosurfaces at contour group lines:
|
|
857
|
+
#. Set `isosurface_selection` to `IsoSurfaceSelection.AllContourLevels`.
|
|
858
|
+
#. Optional: Change `tecplot.plot.ContourLevels`
|
|
859
|
+
|
|
860
|
+
To draw isosurfaces at up to 3 values:
|
|
861
|
+
#. Set `isosurface_selection` to one
|
|
862
|
+
of the following: `IsoSurfaceSelection.OneSpecificValue`
|
|
863
|
+
`IsoSurfaceSelection.TwoSpecificValues`
|
|
864
|
+
`IsoSurfaceSelection.ThreeSpecificValues`
|
|
865
|
+
#. Set `isosurface_values` to a
|
|
866
|
+
1, 2, or 3 `tuple` of `floats <float>`
|
|
867
|
+
|
|
868
|
+
See also `isosurface_values`.
|
|
869
|
+
|
|
870
|
+
Example usage::
|
|
871
|
+
|
|
872
|
+
>>> plot.isosurface(0).show = True
|
|
873
|
+
>>> plot.isosurface(0).isosurface_selection = IsoSurfaceSelection.TwoSpecificValues
|
|
874
|
+
>>> plot.isosurface(0).isosurface_values = (.3, .8)
|
|
875
|
+
"""
|
|
876
|
+
return self._get_style(IsoSurfaceSelection, sv.ISOSURFACESELECTION)
|
|
877
|
+
|
|
878
|
+
@isosurface_selection.setter
|
|
879
|
+
def isosurface_selection(self, value):
|
|
880
|
+
self._set_style(IsoSurfaceSelection(value), sv.ISOSURFACESELECTION)
|
|
881
|
+
|
|
882
|
+
@property
|
|
883
|
+
def definition_contour_group_index(self):
|
|
884
|
+
"""`Index`: Contour group index from which isosurfaces are based.
|
|
885
|
+
|
|
886
|
+
Contour group settings can be changed from `plot.ContourGroup`.
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
Example usage::
|
|
890
|
+
|
|
891
|
+
>>> plot.isosurface(0).show = True
|
|
892
|
+
>>> plot.isosurface(0).definition_contour_group_index = 1
|
|
893
|
+
"""
|
|
894
|
+
return self._get_style(Index, sv.DEFINITIONCONTOURGROUP)
|
|
895
|
+
|
|
896
|
+
@definition_contour_group_index.setter
|
|
897
|
+
def definition_contour_group_index(self, value):
|
|
898
|
+
self._set_style(Index(value), sv.DEFINITIONCONTOURGROUP)
|
|
899
|
+
|
|
900
|
+
@property
|
|
901
|
+
def definition_contour_group(self):
|
|
902
|
+
"""`ContourGroup`: Contour group from which isosurfaces are based.
|
|
903
|
+
|
|
904
|
+
Example usage::
|
|
905
|
+
|
|
906
|
+
>>> group = plot.contour(1)
|
|
907
|
+
>>> plot.isosurface(0).definition_contour_group = group
|
|
908
|
+
"""
|
|
909
|
+
return self.plot.contour(self.definition_contour_group_index)
|
|
910
|
+
|
|
911
|
+
@definition_contour_group.setter
|
|
912
|
+
def definition_contour_group(self, contour_group):
|
|
913
|
+
self.definition_contour_group_index = contour_group.index
|
|
914
|
+
|
|
915
|
+
@property
|
|
916
|
+
def obey_source_zone_blanking(self):
|
|
917
|
+
"""`bool`: Obey source zone blanking.
|
|
918
|
+
|
|
919
|
+
* When `True`, isosurfaces are generated for non-blanked regions only.
|
|
920
|
+
* When `False`, isosurfaces are generated for blanked and unblanked.
|
|
921
|
+
regions.
|
|
922
|
+
|
|
923
|
+
Example usage::
|
|
924
|
+
|
|
925
|
+
>>> plot.isosurface(0).show = True
|
|
926
|
+
>>> plot.isosurface(0).obey_source_zone_blanking = True
|
|
927
|
+
"""
|
|
928
|
+
return self._get_style(bool, sv.OBEYSOURCEZONEBLANKING)
|
|
929
|
+
|
|
930
|
+
@obey_source_zone_blanking.setter
|
|
931
|
+
def obey_source_zone_blanking(self, value):
|
|
932
|
+
self._set_style(bool(value), sv.OBEYSOURCEZONEBLANKING)
|
|
933
|
+
|
|
934
|
+
@property
|
|
935
|
+
def surface_generation_method(self):
|
|
936
|
+
"""`SurfaceGenerationMethod`: Determines how the surface is generated.
|
|
937
|
+
|
|
938
|
+
May be one of:
|
|
939
|
+
|
|
940
|
+
* `SurfaceGenerationMethod.Auto`:
|
|
941
|
+
Selects one of the surface generation algorithms
|
|
942
|
+
best suited for the zones participating in the iso-surface
|
|
943
|
+
generation. "All polygons" is used if one or more
|
|
944
|
+
of the participating zones is polytope, otherwise
|
|
945
|
+
"all triangles" are used unless the iso-surface is
|
|
946
|
+
defined by a coordinate variable in which case
|
|
947
|
+
"allow quads" is used.
|
|
948
|
+
* `SurfaceGenerationMethod.AllPolygons`:
|
|
949
|
+
Similar to the "All triangles" method except that all
|
|
950
|
+
interior faces generated as a result of triangulation
|
|
951
|
+
that are not part of the original mesh are eliminated.
|
|
952
|
+
This preserves the original mesh of the source zones
|
|
953
|
+
on the resulting iso-surface.
|
|
954
|
+
* `SurfaceGenerationMethod.AllTriangles`:
|
|
955
|
+
An advanced algorithm that can handle complex saddle issues and
|
|
956
|
+
guarantees that there will be no holes in the final surface. As the
|
|
957
|
+
surface is composed entirely of triangles, it can be delivered more
|
|
958
|
+
efficiently to the graphics hardware.
|
|
959
|
+
* `SurfaceGenerationMethod.AllowQuads`:
|
|
960
|
+
Produces quads or triangles, and the resulting surface more closely
|
|
961
|
+
resembles the shape of the volume cells from the source zone. Since
|
|
962
|
+
the quads are not arbitrarily divided into triangles, no biases are
|
|
963
|
+
introduced, and the resulting surface may appear smoother.
|
|
964
|
+
This method is preferred when the source zone is FE-Brick or IJK-Ordered
|
|
965
|
+
and the surface is aligned with the source cells.
|
|
966
|
+
|
|
967
|
+
Example usage::
|
|
968
|
+
|
|
969
|
+
>>> from tecplot.constant import SurfaceGenerationMethod
|
|
970
|
+
>>> AllowQuads = SurfaceGenerationMethod.AllowQuads
|
|
971
|
+
>>> plot.isosurface(0).surface_generation_method = AllowQuads
|
|
972
|
+
"""
|
|
973
|
+
return self._get_style(SurfaceGenerationMethod,
|
|
974
|
+
sv.SURFACEGENERATIONMETHOD)
|
|
975
|
+
|
|
976
|
+
@surface_generation_method.setter
|
|
977
|
+
def surface_generation_method(self, value):
|
|
978
|
+
self._set_style(SurfaceGenerationMethod(value),
|
|
979
|
+
sv.SURFACEGENERATIONMETHOD)
|
|
980
|
+
|
|
981
|
+
@property
|
|
982
|
+
def use_slice_clipping(self):
|
|
983
|
+
"""`bool`: Clip isosurface by any intersecting slices.
|
|
984
|
+
|
|
985
|
+
Example usage::
|
|
986
|
+
|
|
987
|
+
>>> from tecplot.constant import ClipPlane
|
|
988
|
+
>>> slice = plot.slice(0)
|
|
989
|
+
>>> slice.clip = ClipPlane.AbovePrimarySlice
|
|
990
|
+
>>> plot.fieldmap(0).effects.clip_planes = slice
|
|
991
|
+
>>> plot.isosurface(0).use_slice_clipping = True
|
|
992
|
+
|
|
993
|
+
.. seealso:: `SliceGroup.clip`
|
|
994
|
+
"""
|
|
995
|
+
return self._get_style(bool, sv.OBEYCLIPPLANES)
|
|
996
|
+
|
|
997
|
+
@use_slice_clipping.setter
|
|
998
|
+
def use_slice_clipping(self, value):
|
|
999
|
+
self._set_style(bool(value), sv.OBEYCLIPPLANES)
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
class IsosurfaceVector(IsosurfaceGroupStyle):
|
|
1003
|
+
"""Isosurface vector field control.
|
|
1004
|
+
|
|
1005
|
+
.. versionadded:: 2017.3
|
|
1006
|
+
Isosurface vectors requires Tecplot 360 2017 R3 or later.
|
|
1007
|
+
|
|
1008
|
+
.. code-block:: python
|
|
1009
|
+
|
|
1010
|
+
import os
|
|
1011
|
+
import tecplot as tp
|
|
1012
|
+
from tecplot.constant import *
|
|
1013
|
+
|
|
1014
|
+
examples_dir = tp.session.tecplot_examples_directory()
|
|
1015
|
+
datafile = os.path.join(examples_dir, 'SimpleData', 'DuctFlow.plt')
|
|
1016
|
+
dataset = tp.data.load_tecplot(datafile)
|
|
1017
|
+
|
|
1018
|
+
plot = tp.active_frame().plot()
|
|
1019
|
+
plot.contour(0).variable = dataset.variable('T(K)')
|
|
1020
|
+
plot.contour(1).variable = dataset.variable('P(N/m2)')
|
|
1021
|
+
plot.vector.u_variable = dataset.variable('U(M/S)')
|
|
1022
|
+
plot.vector.v_variable = dataset.variable('V(M/S)')
|
|
1023
|
+
plot.vector.w_variable = dataset.variable('W(M/S)')
|
|
1024
|
+
|
|
1025
|
+
plot.show_isosurfaces = True
|
|
1026
|
+
plot.contour(0).legend.show = False
|
|
1027
|
+
plot.contour(1).legend.show = False
|
|
1028
|
+
|
|
1029
|
+
iso = plot.isosurface(0)
|
|
1030
|
+
iso.definition_contour_group = plot.contour(0)
|
|
1031
|
+
iso.contour.flood_contour_group = plot.contour(1)
|
|
1032
|
+
iso.isosurface_values = 200
|
|
1033
|
+
iso.show = True
|
|
1034
|
+
|
|
1035
|
+
iso.vector.show = True
|
|
1036
|
+
iso.vector.line_thickness = 0.4
|
|
1037
|
+
iso.vector.color = Color.Grey
|
|
1038
|
+
|
|
1039
|
+
view = plot.view
|
|
1040
|
+
view.psi = 53.80
|
|
1041
|
+
view.theta = -139.15
|
|
1042
|
+
view.alpha = 0
|
|
1043
|
+
view.position = (7.54498, 8.42026, 7.94559)
|
|
1044
|
+
view.width = 0.551882
|
|
1045
|
+
|
|
1046
|
+
tp.export.save_png('isosurface_vector.png', 600, supersample=3)
|
|
1047
|
+
|
|
1048
|
+
.. figure:: /_static/images/isosurface_vector.png
|
|
1049
|
+
:width: 600px
|
|
1050
|
+
:figwidth: 300px
|
|
1051
|
+
"""
|
|
1052
|
+
def __init__(self, isosurface):
|
|
1053
|
+
super().__init__(isosurface, sv.VECTOR)
|
|
1054
|
+
|
|
1055
|
+
@property
|
|
1056
|
+
def show(self):
|
|
1057
|
+
"""`bool`: Show vectors on isosurfaces.
|
|
1058
|
+
|
|
1059
|
+
Example usage::
|
|
1060
|
+
|
|
1061
|
+
>>> plot.isosurface(0).vector.show = True
|
|
1062
|
+
|
|
1063
|
+
.. versionadded:: 2017.3
|
|
1064
|
+
Isosurface vectors requires Tecplot 360 2017 R3 or later.
|
|
1065
|
+
"""
|
|
1066
|
+
return self._get_style(bool, sv.SHOW)
|
|
1067
|
+
|
|
1068
|
+
@show.setter
|
|
1069
|
+
def show(self, value):
|
|
1070
|
+
self._set_style(bool(value), sv.SHOW)
|
|
1071
|
+
|
|
1072
|
+
@property
|
|
1073
|
+
def vector_type(self):
|
|
1074
|
+
"""`VectorType`: Type of vector for isosurfaces.
|
|
1075
|
+
|
|
1076
|
+
Example usage::
|
|
1077
|
+
|
|
1078
|
+
>>> plot.isosurface(0).vector.show = True
|
|
1079
|
+
>>> plot.isosurface(0).vector.vector_type = VectorType.MidAtPoint
|
|
1080
|
+
|
|
1081
|
+
.. versionadded:: 2017.3
|
|
1082
|
+
Isosurface vectors requires Tecplot 360 2017 R3 or later.
|
|
1083
|
+
"""
|
|
1084
|
+
return self._get_style(VectorType, sv.VECTORTYPE)
|
|
1085
|
+
|
|
1086
|
+
@vector_type.setter
|
|
1087
|
+
def vector_type(self, value):
|
|
1088
|
+
self._set_style(VectorType(value), sv.VECTORTYPE)
|
|
1089
|
+
|
|
1090
|
+
@property
|
|
1091
|
+
def arrowhead_style(self):
|
|
1092
|
+
"""`ArrowheadStyle`: Arrowhead style of isosurface vectors.
|
|
1093
|
+
|
|
1094
|
+
Example usage::
|
|
1095
|
+
|
|
1096
|
+
>>> isosurface_vector = plot.isosurface(0).vector
|
|
1097
|
+
>>> isosurface_vector.show = True
|
|
1098
|
+
>>> isosurface_vector.arrowhead_style = ArrowheadStyle.Hollow
|
|
1099
|
+
|
|
1100
|
+
.. versionadded:: 2017.3
|
|
1101
|
+
Isosurface vectors requires Tecplot 360 2017 R3 or later.
|
|
1102
|
+
"""
|
|
1103
|
+
return self._get_style(ArrowheadStyle, sv.ARROWHEADSTYLE)
|
|
1104
|
+
|
|
1105
|
+
@arrowhead_style.setter
|
|
1106
|
+
def arrowhead_style(self, value):
|
|
1107
|
+
self._set_style(ArrowheadStyle(value), sv.ARROWHEADSTYLE)
|
|
1108
|
+
|
|
1109
|
+
@property
|
|
1110
|
+
def color(self):
|
|
1111
|
+
"""`Color` or `ContourGroup`: Isosurface vector color.
|
|
1112
|
+
|
|
1113
|
+
Iso-surface vectors can be a solid color or be colored by a
|
|
1114
|
+
`ContourGroup` as obtained through the ``plot.contour`` property.
|
|
1115
|
+
|
|
1116
|
+
Example usage::
|
|
1117
|
+
|
|
1118
|
+
>>> plot.isosurface(0).vector.show = True
|
|
1119
|
+
>>> plot.isosurface(0).vector.color = Color.Blue
|
|
1120
|
+
|
|
1121
|
+
.. versionadded:: 2017.3
|
|
1122
|
+
Isosurface vectors requires Tecplot 360 2017 R3 or later.
|
|
1123
|
+
"""
|
|
1124
|
+
return color_spec(self._get_style(Color, sv.COLOR),
|
|
1125
|
+
self.isosurface.plot)
|
|
1126
|
+
|
|
1127
|
+
@color.setter
|
|
1128
|
+
def color(self, value):
|
|
1129
|
+
self._set_style(color_spec(value), sv.COLOR)
|
|
1130
|
+
|
|
1131
|
+
@property
|
|
1132
|
+
def is_tangent(self):
|
|
1133
|
+
"""`bool`: Use tangent vectors for isosurfaces.
|
|
1134
|
+
|
|
1135
|
+
Example usage::
|
|
1136
|
+
|
|
1137
|
+
>>> plot.isosurface(0).vector.show = True
|
|
1138
|
+
>>> plot.isosurface(0).vector.is_tangent = True
|
|
1139
|
+
|
|
1140
|
+
.. versionadded:: 2017.3
|
|
1141
|
+
Isosurface vectors requires Tecplot 360 2017 R3 or later.
|
|
1142
|
+
"""
|
|
1143
|
+
return self._get_style(bool, sv.ISTANGENT)
|
|
1144
|
+
|
|
1145
|
+
@is_tangent.setter
|
|
1146
|
+
def is_tangent(self, value):
|
|
1147
|
+
self._set_style(bool(value), sv.ISTANGENT)
|
|
1148
|
+
|
|
1149
|
+
@property
|
|
1150
|
+
def line_thickness(self):
|
|
1151
|
+
"""`float`: Vector line thickness as a percentage of the frame height.
|
|
1152
|
+
|
|
1153
|
+
Typical values are .02, .1, .4, .8, 1.5
|
|
1154
|
+
|
|
1155
|
+
Example usage::
|
|
1156
|
+
|
|
1157
|
+
>>> plot.isosurface(0).vector.show = True
|
|
1158
|
+
>>> plot.isosurface(0).vector.line_thickness = .1
|
|
1159
|
+
|
|
1160
|
+
.. versionadded:: 2017.3
|
|
1161
|
+
Isosurface vectors requires Tecplot 360 2017 R3 or later.
|
|
1162
|
+
"""
|
|
1163
|
+
return self._get_style(float, sv.LINETHICKNESS)
|
|
1164
|
+
|
|
1165
|
+
@line_thickness.setter
|
|
1166
|
+
def line_thickness(self, value):
|
|
1167
|
+
self._set_style(float(value), sv.LINETHICKNESS)
|