Skip to content

Commit 54ca2a0

Browse files
docs: revisit examples to make sure they are properly styled (#1509)
Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent de6f822 commit 54ca2a0

File tree

6 files changed

+40
-33
lines changed

6 files changed

+40
-33
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
revisit examples to make sure they are properly styled

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ Perform the required imports.
3131
from pint import Quantity
3232
import pyvista as pv
3333

34-
from ansys.geometry.core import Modeler
35-
from ansys.geometry.core.connection.defaults import GEOMETRY_SERVICE_DOCKER_IMAGE
36-
from ansys.geometry.core.connection.docker_instance import LocalDockerInstance
3734
from ansys.geometry.core.math import Point2D
3835
from ansys.geometry.core.misc import UNITS
3936
from ansys.geometry.core.plotting import GeometryPlotter
@@ -220,7 +217,7 @@ You can render the objects in different colors automatically using PyVista's def
220217
color cycler. In order to do this, activate the ``multi_colors=True`` option when calling
221218
the ``plot()`` method.
222219

223-
In the following cell we will create a new design and plot a prism and a cylinder in different colors.
220+
In the following cell you can create a new design and plot a prism and a cylinder in different colors.
224221

225222
```{code-cell} ipython
226223
design = modeler.create_design("MultiColors")

doc/source/examples/03_modeling/design_tree.mystnb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ structure of the model in the terminal.
1818

1919
## Perform required imports
2020

21-
For the following example, we need to import these modules:
21+
For the following example, you need to import these modules:
2222

2323
```{code-cell} ipython3
2424
from pint import Quantity
@@ -60,7 +60,7 @@ distance = 30 * UNITS.m
6060
#
6161
#
6262
# Now, only "comp_3", "nested_2_comp_1" and "nested_1_nested_1_comp_1"
63-
# will have a body associated.
63+
# has a body associated.
6464
#
6565

6666
# Create the components
@@ -106,7 +106,7 @@ design.tree_print()
106106
### Controlling the depth of the tree
107107

108108
The ``tree_print()`` method accepts an optional argument ``depth`` to control the depth of the
109-
tree to be printed. The default value is ``None``, which means the entire tree will be printed.
109+
tree to be printed. The default value is ``None``, which means the entire tree is printed.
110110

111111
```{code-cell} ipython3
112112
design.tree_print(depth=1)

doc/source/examples/03_modeling/scale_map_mirror_bodies.mystnb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ dynamic resizing of bodies.
5151

5252
To use the ``scale()`` function, you call it on an instance of a geometry body, passing a
5353
single argument: the scale value. This value is a real number (``Real``) that determines
54-
the factor by which the body's size will be changed.
54+
the factor by which the body's size is changed.
5555

5656
```python
5757
body.scale(value)
@@ -302,7 +302,7 @@ design.plot()
302302

303303
#### Mirror the triangular body
304304

305-
We will first make a copy of the triangular body, then using ``mirror()``, we will mirror the
305+
First, make a copy of the triangular body. Then, using ``mirror()``, you can mirror the
306306
copied body over the ZY plane.
307307

308308
```{code-cell} ipython3

doc/source/examples/03_modeling/service_colors.mystnb

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ design = modeler.create_design("ServiceColors")
5050

5151
## Extrude the box sketch to create the matrix style design
5252

53-
Given our initial sketch, we will extrude it to create a matrix style design.
54-
We will create a 2x3 matrix of bodies. Each body will be separated by 30 units
55-
in the X direction and 30 units in the Y direction. We will have a total of 6 bodies.
53+
Given the initial sketch, you can extrude it to create a matrix style design.
54+
In this example, you can create a 2x3 matrix of bodies. Each body is separated by 30 units
55+
in the X direction and 30 units in the Y direction. You have a total of 6 bodies.
5656

5757
```{code-cell} ipython3
5858
translate = [[0, 30, 60], [0, 30, 60]]
@@ -70,10 +70,9 @@ design.plot()
7070

7171
## Assign colors to the bodies
7272

73-
Given our previous design, we will assign a color to each body. We will assign
74-
a different color to each one of them. We could have done this assignment while
75-
creating the bodies, but we will do it now for the sake of encapsulating the
76-
color assignment logic.
73+
Given the previous design, you can assign a color to each body. You could have done
74+
this assignment while creating the bodies, but for the sake of encapsulating the
75+
color assignment logic, it is done in its own code cell.
7776

7877
```{code-cell} ipython3
7978

@@ -87,8 +86,8 @@ for c_idx, comp in enumerate(design.components):
8786

8887
## Plotting the design with colors
8988

90-
By default, the plot method will **not** use the colors assigned to the bodies.
91-
To plot the design with the assigned colors, we need to specifically request it.
89+
By default, the plot method does **not** use the colors assigned to the bodies.
90+
To plot the design with the assigned colors, you need to specifically request it.
9291

9392
Users have two options for plotting with the assigned colors:
9493

@@ -99,21 +98,21 @@ It is important to note that the usage of colors when plotting might slow down t
9998
plotting process, as it requires additional information to be sent from the server
10099
to the client and processed in the client side.
101100

102-
If we just request the plot without setting the global parameter, the plot will
101+
If you just request the plot without setting the global parameter, the plot will
103102
be displayed without the colors, as shown below.
104103

105104
```{code-cell} ipython3
106105
design.plot()
107106
```
108107

109-
As stated previously, if we pass the parameter ``use_service_colors=True`` to the plot
110-
method, the plot will be displayed with the assigned colors.
108+
As stated previously, if you pass the parameter ``use_service_colors=True`` to the plot
109+
method, the plot is displayed with the assigned colors.
111110

112111
```{code-cell} ipython3
113112
design.plot(use_service_colors=True)
114113
```
115114

116-
However, if we set the global parameter to ``True``, the plot will be displayed
115+
However, if you set the global parameter to ``True``, the plot is displayed
117116
with the assigned colors without the need to pass the parameter to the plot method.
118117

119118
```{code-cell} ipython3
@@ -138,7 +137,7 @@ If the user wants to plot specific bodies with the assigned colors, the user can
138137
follow the same approach as before. The user can pass the parameter ``use_service_colors=True``
139138
to the plot method or set the global parameter ``USE_SERVICE_COLORS`` to ``True``.
140139

141-
In the following examples, we will just demonstrate how to do this using the
140+
In the following examples, you are shown how to do this using the
142141
``use_service_colors=True`` parameter.
143142

144143
Let's plot the first body of the first component with the assigned colors.

doc/source/examples/03_modeling/surface_bodies.mystnb

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ kernelspec:
1212
---
1313

1414
# Modeling: Surface bodies and trimmed surfaces
15-
This example will show how to trim different surfaces, and how to use those surfaces to create surface bodies.
15+
16+
This example shows how to trim different surfaces, and how to use those surfaces
17+
to create surface bodies.
1618

1719
## Create a surface
20+
1821
Create a sphere surface. This can be done without launching the modeler.
1922

2023
```{code-cell} ipython3
@@ -31,7 +34,10 @@ surface.parameterization()
3134
```
3235

3336
## Trim the surface
34-
For a sphere, its parametization is (`u: [0, 2*pi]`, `v:[-pi/2, pi/2]`), where u corresponds to longitude and v corresponds to latitude. We can **trim** a surface by providing new parameters.
37+
38+
For a sphere, its parametization is (`u: [0, 2*pi]`, `v:[-pi/2, pi/2]`),
39+
where u corresponds to longitude and v corresponds to latitude. You
40+
can **trim** a surface by providing new parameters.
3541

3642
```{code-cell} ipython3
3743
from ansys.geometry.core.shapes.box_uv import BoxUV
@@ -41,15 +47,16 @@ import math
4147
trimmed_surface = surface.trim(BoxUV(range_u=Interval(0, math.pi), range_v=Interval(0, math.pi/2)))
4248
```
4349

44-
From a TrimmedSurface, you can always refer back to the underlying Surface if needed.
50+
From a ``TrimmedSurface``, you can always refer back to the underlying ``Surface`` if needed.
4551

4652
```{code-cell} ipython3
4753
trimmed_surface.geometry
4854
```
4955

5056
## Create a surface body
5157

52-
Now create a surface body by launching the modeler session and providing the trimmed surface. Then plot the body to see how we created a quarter of a sphere as a surface body.
58+
Now create a surface body by launching the modeler session and providing the trimmed surface.
59+
Then plot the body to see how you created a quarter of a sphere as a surface body.
5360

5461
```{code-cell} ipython3
5562
from ansys.geometry.core import launch_modeler
@@ -64,20 +71,23 @@ body = design.create_body_from_surface("trimmed_sphere", trimmed_surface)
6471
design.plot()
6572
```
6673

67-
If the sphere was left untrimmed, it would create a solid body since the surface is fully closed. In this case, since the surface was open, it created a surface body.
74+
If the sphere was left untrimmed, it would create a solid body since the surface is fully
75+
closed. In this case, since the surface was open, it created a surface body.
6876

6977
This same process can be used with other surfaces including:
70-
- cone
71-
- cylinder
72-
- plane
73-
- torus
78+
- ``Cone``
79+
- ``Cylinder``
80+
- ``Plane``
81+
- ``Torus``
7482

7583
Each surface has its own unique parameterization, which must be understood before trying to trim it.
7684

7785
+++
7886

7987
## Close session
80-
When you finish interacting with your modeling service, you should close the active server session. This frees resources wherever the service is running.
88+
89+
When you finish interacting with your modeling service, you should close the active server
90+
session. This frees resources wherever the service is running.
8191

8292
Close the server session.
8393

0 commit comments

Comments
 (0)