Class: CurrentLegendSettings

Represents a CurrentLegendSettings object. This object holds properties of the CurrentLegendSettings.

Remarks

CurrentLegendSettings operates on the legend of the currently active object. This may require some care when writing scripts, especially in batch mode. Furthermore, CurrentLegendSettings implicitly associates with a given viewport in multi-viewport scenarios. This means that in 4 viewport scenarios it is possible to maintain 4 separate CurrentLegendSettings objects to track the legends for the active object in each viewport independently.

Examples

The following command prints legend statistics for all results in the tree legend = Ansys.Mechanical.Graphics.Tools.CurrentLegendSettings() for res in ExtAPI.DataModel.GetObjectsByType(DataModelObjectCategory.Result): ExtAPI.DataModel.Tree.Activate([res]) low_bound = legend.GetLowerBound(0) high_bound = legend.GetUpperBound(legend.NumberOfBands-1) print('{} has {} legend bands ranging from {} to {}'.format(res.Name, legend.NumberOfBands, low_bound, high_bound))
The following command prints legend statistics for the active object in 2 viewports def dump_legend_stats_for_viewport(viewport_idx): Graphics.ModelViewManager.SetActiveViewPort(viewport_idx) obj = ExtAPI.DataModel.Tree.FirstActiveObject viewport_legend = Ansys.Mechanical.Graphics.Tools.CurrentLegendSettings() low_bound = viewport_legend.GetLowerBound(0) high_bound = viewport_legend.GetUpperBound(viewport_legend.NumberOfBands-1) print('{} has {} legend bands ranging from {} to {}'.format(obj.Name, viewport_legend.NumberOfBands, low_bound, high_bound)) dump_legend_stats_for_viewport(0) dump_legend_stats_for_viewport(1)

Methods

Name Description
GetBandColor(Int32) Gets the color of the specified band.
GetBandColorAuto(Int32) Gets whether the specified band is set to Automatic or not.
GetLowerBandValueAuto(Int32) Gets whether the specified lower band value is set to Automatic or not.
GetLowerBound(Int32) Gets lower bound value of the specified band.
GetUpperBandValueAuto(Int32) Gets whether the specified upper band value is set to Automatic or not.
GetUpperBound(Int32) Gets upper bound value of the specified band.
MakeCopy() Makes a copy of the CurrentLegendSettings object.
Reset() Resets all legend customizations into default values.
ResetColors() Resets all colors to default values.
SetBandColor(Int32, UInt32) Sets the color of the specified band.
SetBandColorAuto(Int32, Boolean) Sets the specified band to Automatic.
SetLowerBound(Int32, Quantity) Sets lower bound value of the specified band.
SetUpperBound(Int32, Quantity) Sets upper bound value of the specified band.

Properties

Name Description
AllScientificNotation Whether the result values are displayed in scientific notation.
ColorScheme Color Scheme for the legend.
Digits Number of significant digits(min:2, max:8).
HighFidelity Whether to replot and improve the synchronization of the result values.
LogarithmicScale Whether the result values are distributed in a Logarithmic scale.
NumberOfBands Number of bands on the legend (min:3, max:30). Bands are added/removed from the top of the legend.
SemiTransparency Whether the legend is semi-transparent.