from builtins import super
from ..tecutil import sv
from ..constant import *
from .. import session, tecutil, version
from ..exception import *
from ..tecutil import _require_surface_flow_effects_sdk
[docs]
class SurfaceFlowEffects(session.Style):
"""Shared surface-flow effect settings for field-plot surfaces.
.. versionadded:: 1.8, Tecplot 360 2026.1
Surface-flow effects require Tecplot 360 2026 R1 or later.
"""
def __init__(self, plot):
_require_surface_flow_effects_sdk()
self.plot = plot
super().__init__(sv.GLOBALSURFACEFLOWEFFECTS,
uniqueid=self.plot.frame.uid)
@property
def line_integral_convolution(self):
"""`LineIntegralConvolution`: Line integral convolution parameter settings.
Example usage::
>>> lic = plot.surface_flow_effects.line_integral_convolution
>>> lic.step_size = 0.9
"""
return LineIntegralConvolution(self)
[docs]
class LineIntegralConvolution(session.Style):
"""Shared line integral convolution settings for field-plot surfaces.
.. versionadded:: 1.8, Tecplot 360 2026.1
Line integral convolution requires Tecplot 360 2026 R1 or later.
.. code-block:: python
:emphasize-lines: 18-24
import os
import tecplot
from tecplot.constant import *
examples_dir = tecplot.session.tecplot_examples_directory()
datafile = os.path.join(examples_dir, 'SimpleData', 'VortexShedding.plt')
dataset = tecplot.data.load_tecplot(datafile)
frame = dataset.frame
frame.plot_type = PlotType.Cartesian2D
plot = frame.plot()
plot.axes.x_axis.min = -0.004
plot.axes.x_axis.max = 0.004
plot.axes.y_axis.min = -0.004
plot.axes.y_axis.max = 0.004
plot.use_surface_flow_effect = True
fmap = plot.fieldmap(1)
fmap.effects.surface_flow_effect = SurfaceFlowEffect.LIC
lic = plot.surface_flow_effects.line_integral_convolution
lic.intensity = 0.95
tecplot.export.save_png('line_integral_convolution.png')
.. figure:: /_static/images/line_integral_convolution.png
:width: 300px
:figwidth: 300px
"""
def __init__(self, surface_flow_effects):
self.surface_flow_effects = surface_flow_effects
self.plot = surface_flow_effects.plot
super().__init__(surface_flow_effects._sv, sv.LINEINTEGRALCONVOLUTION,
**surface_flow_effects._kw)
@property
def step_size(self):
"""`float`: Convolution step size."""
return self._get_style(float, sv.STEPSIZE)
@step_size.setter
def step_size(self, value):
self._set_style(float(value), sv.STEPSIZE)
@property
def num_steps(self):
"""`int`: Number of convolution steps."""
return self._get_style(int, sv.NUMSTEPS)
@num_steps.setter
def num_steps(self, value):
self._set_style(int(value), sv.NUMSTEPS)
@property
def intensity(self):
"""`float`: Line integral convolution intensity."""
return self._get_style(float, sv.INTENSITY)
@intensity.setter
def intensity(self, value):
self._set_style(float(value), sv.INTENSITY)
@property
def smoothing(self):
"""`int`: Smoothing pass count."""
return self._get_style(int, sv.SMOOTHING)
@smoothing.setter
def smoothing(self, value):
self._set_style(int(value), sv.SMOOTHING)
@property
def contrast_boost(self):
"""`float`: Line integral convolution contrast boost amount."""
return self._get_style(float, sv.CONTRASTBOOST)
@contrast_boost.setter
def contrast_boost(self, value):
self._set_style(float(value), sv.CONTRASTBOOST)
@property
def shading(self):
"""`float`: Line integral convolution surface shading amount."""
return self._get_style(float, sv.SHADING)
@shading.setter
def shading(self, value):
self._set_style(float(value), sv.SHADING)
@property
def color_mode(self):
"""`LICColorMode`: Line integral convolution compositing mode."""
return self._get_style(LICColorMode, sv.COLORMODE)
@color_mode.setter
def color_mode(self, value):
self._set_style(LICColorMode(value), sv.COLORMODE)
@property
def mask_threshold(self):
"""`float`: Line integral convolution mask threshold."""
return self._get_style(float, sv.LICMASKTHRESHOLD)
@mask_threshold.setter
def mask_threshold(self, value):
self._set_style(float(value), sv.LICMASKTHRESHOLD)
@property
def mask_fade_size(self):
"""`float`: Line integral convolution mask fade size."""
return self._get_style(float, sv.LICMASKFADESIZE)
@mask_fade_size.setter
def mask_fade_size(self, value):
self._set_style(float(value), sv.LICMASKFADESIZE)
@property
def use_mask_threshold(self):
"""`bool`: Enable the Line integral convolution mask threshold."""
return self._get_style(bool, sv.USELICMASKTHRESHOLD)
@use_mask_threshold.setter
def use_mask_threshold(self, value):
self._set_style(bool(value), sv.USELICMASKTHRESHOLD)
@property
def overlay_color(self):
"""`Color`: Line integral convolution overlay color used when color mode is Overlay."""
return self._get_style(Color, sv.OVERLAYCOLOR)
@overlay_color.setter
def overlay_color(self, value):
self._set_style(Color(value), sv.OVERLAYCOLOR)
[docs]
class LightSource(session.Style):
"""Three-dimensional light source style control.
The light source is a point of light infinitely far from the drawing area.
.. code-block:: python
:emphasize-lines: 13-16
from os import path
import tecplot as tp
from tecplot.constant import PlotType, Color
examples_dir = tp.session.tecplot_examples_directory()
infile = path.join(examples_dir, 'SimpleData', 'F18.plt')
dataset = tp.data.load_tecplot(infile)
frame = tp.active_frame()
plot = frame.plot(PlotType.Cartesian3D)
plot.activate()
plot.light_source.direction = (0., -0.7, 0.9)
plot.light_source.intensity = 70
plot.light_source.specular_intensity = 80
plot.light_source.specular_shininess = 50
tp.export.save_png('light_source.png')
.. figure:: /_static/images/light_source.png
:width: 300px
:figwidth: 300px
"""
def __init__(self, plot):
self.plot = plot
super().__init__(sv.GLOBALTHREED, sv.LIGHTSOURCE,
uniqueid=self.plot.frame.uid)
@property
def background_light(self):
"""`float`: Percentage intensity of the omni-directional fill light.
Example usage::
>>> plot.light_source.background_light = 70.0
"""
return self._get_style(float, sv.BACKGROUNDLIGHT)
@background_light.setter
def background_light(self, value):
self._set_style(float(value), sv.BACKGROUNDLIGHT)
@property
def intensity(self):
"""`float`: Percentage intensity of the light source.
Example usage::
>>> plot.light_source.intensity = 50.0
"""
return self._get_style(float, sv.INTENSITY)
@intensity.setter
def intensity(self, value):
self._set_style(float(value), sv.INTENSITY)
@property
def specular_intensity(self):
"""`float`: Percentage intensity of specular highlights.
Set this to zero to turn off specular effects::
>>> plot.light_source.specular_intensity = 0
"""
if self._get_style(bool, sv.INCLUDESPECULAR):
return self._get_style(float, sv.SPECULARINTENSITY)
else:
return 0
@specular_intensity.setter
def specular_intensity(self, value):
if not value:
self._set_style(False, sv.INCLUDESPECULAR)
else:
self._set_style(True, sv.INCLUDESPECULAR)
self._set_style(float(value), sv.SPECULARINTENSITY)
@property
def specular_shininess(self):
"""`float`: Percentage of shininess for specular highlights.
Example usage::
>>> plot.light_source.specular_shininess = 80.0
"""
return self._get_style(float, sv.SPECULARSHININESS)
@specular_shininess.setter
def specular_shininess(self, value):
self._set_style(float(value), sv.SPECULARSHININESS)
@property
def surface_color_contrast(self):
"""`float`: Percentage of contrast for surface colors.
Example usage::
>>> plot.light_source.surface_color_contrast = 80.0
"""
return self._get_style(float, sv.SURFACECOLORCONTRAST)
@surface_color_contrast.setter
def surface_color_contrast(self, value):
self._set_style(float(value), sv.SURFACECOLORCONTRAST)
@property
def direction(self):
"""`tuple`: :math:`(x, y, z)` direction of the light rays.
The direction is in the view coordinate system where :math:`z` goes
into the page and the origin of :math:`(x, y)` is in the lower left
corner. The default is :math:`(-0.2, -0.2, 0.959)`::
>>> plot.light_source.direction = (0, -0.7, 0.9)
"""
return session.XYZ(self, sv.XYZDIRECTION)
@direction.setter
def direction(self, values):
session.XYZ(self, sv.XYZDIRECTION)[:] = values
@property
def force_gouraud_for_contour_flood(self):
if version.sdk_version_info < (2025, 2):
return self._get_style(bool, sv.FORCEGOURAUDFOR3DCONTFLOOD)
else:
tecutil.api_changed('''\
LightSource.force_gouraud_for_contour_flood property has been removed.
Set the lighting_effect property to LightingEffect.SmoothWithCreases
on fieldmap.effects, isosurface.effects, slice.effects, or
streamtrace.effects as desired.''', '1.7.3', '2025 R2', warning=True)
@force_gouraud_for_contour_flood.setter
def force_gouraud_for_contour_flood(self, value):
if version.sdk_version_info < (2025, 2):
self._set_style(bool(value), sv.FORCEGOURAUDFOR3DCONTFLOOD)
else:
tecutil.api_changed('''\
LightSource.force_gouraud_for_contour_flood property has been removed.
Set the lighting_effect property to LightingEffect.SmoothWithCreases
on fieldmap.effects, isosurface.effects, slice.effects, or
streamtrace.effects as desired.''', '1.7.3', '2025 R2', warning=True)
@property
def force_paneled_for_cell_flood(self):
"""`bool`: Force paneled effects for shaded cell flooding.
Example usage::
>>> plot.light_source.force_paneled_for_cell_flood = True
"""
return self._get_style(bool, sv.FORCEPANELEDFOR3DCELLFLOOD)
@force_paneled_for_cell_flood.setter
def force_paneled_for_cell_flood(self, value):
self._set_style(bool(value), sv.FORCEPANELEDFOR3DCELLFLOOD)