Skip to content

Commit 8321970

Browse files
feat: adapt to new ansys-tools-visualization-interface v0.4.0 (#1338)
Co-authored-by: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com>
1 parent 3dfe1c3 commit 8321970

File tree

5 files changed

+32
-4
lines changed

5 files changed

+32
-4
lines changed

doc/changelog.d/1338.changed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
feat: adapt to new ansys-tools-visualization-interface v0.4.0
59.3 KB
Loading

doc/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#
3434
# Using env var instead
3535
os.environ["PYANSYS_VISUALIZER_DOC_MODE"] = "true"
36+
os.environ["PYANSYS_VISUALIZER_HTML_BACKEND"] = "true"
3637

3738
LaTeXBuilder.supported_image_types = ["image/png", "image/pdf", "image/svg+xml"]
3839

doc/source/examples/01_getting_started/05_plotter_picker.mystnb

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,37 @@ The Python visualizer is used by default. However, you can also use
175175

176176
```python
177177

178-
plotter = GeometryPlotter
179-
(use_trame=True)
178+
plotter = GeometryPlotter(use_trame=True)
180179
plotter.show(plot_list)
181180
```
182181

182+
## Render in different colors
183+
184+
You can render the objects in different colors automatically using PyVista's default
185+
color cycler. In order to do this, activate the ``multi_colors=True`` option when calling
186+
the ``plot()`` method.
187+
188+
In the following cell we will create a new design and plot a prism and a cylinder in different colors.
189+
190+
```python
191+
design = modeler.create_design("MultiColors")
192+
193+
# Create a sketch of a box
194+
sketch_box = Sketch().box(Point2D([0, 0], unit=UNITS.m), width=30 * UNITS.m, height=40 * UNITS.m)
195+
196+
# Create a sketch of a circle (overlapping the box slightly)
197+
sketch_circle = Sketch().circle(Point2D([20, 0], unit=UNITS.m), radius=3 * UNITS.m)
198+
199+
# Extrude both sketches to get a prism and a cylinder
200+
design.extrude_sketch("Prism", sketch_box, 50 * UNITS.m)
201+
design.extrude_sketch("Cylinder", sketch_circle, 50 * UNITS.m)
202+
203+
# Design plotting
204+
design.plot(multi_colors=True)
205+
```
206+
207+
![](../../_static/assets/multicolors.png)
208+
183209
## Clip objects
184210

185211
You can clip any object represented in the plotter by defining a ``Plane`` object that

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ all = [
5151
tests = [
5252
"ansys-platform-instancemanagement==1.1.2",
5353
"ansys-tools-path==0.6.0",
54-
"ansys-tools-visualization-interface==0.3.0",
54+
"ansys-tools-visualization-interface==0.4.0",
5555
"beartype==0.18.5",
5656
"docker==7.1.0",
5757
"grpcio==1.65.1",
@@ -78,7 +78,7 @@ tests-minimal = [
7878
]
7979
doc = [
8080
"ansys-sphinx-theme[autoapi]==0.16.6",
81-
"ansys-tools-visualization-interface==0.3.0",
81+
"ansys-tools-visualization-interface==0.4.0",
8282
"beartype==0.18.5",
8383
"docker==7.1.0",
8484
"ipyvtklink==0.2.3",

0 commit comments

Comments
 (0)