Skip to content

Commit 9a5968f

Browse files
AlejandroFernandezLucesRobPasMuePipKat
committed
doc: Add plotter clipping example (#859)
Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com>
1 parent d38a74d commit 9a5968f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,30 @@ plotter = PlotterHelper(use_trame=True)
179179
plotter.plot(plot_list)
180180
```
181181

182+
## Clip objects
183+
184+
You can clip any object represented in the plotter by defining a ``Plane`` object that
185+
intersects the target object.
186+
187+
```{code-cell} ipython
188+
189+
from ansys.geometry.core.math import Plane, Point3D
190+
ph = PlotterHelper()
191+
192+
# Define PyAnsys Geometry box
193+
box2 = Sketch()
194+
box2.box(Point2D([-10, 20], UNITS.m), Quantity(10, UNITS.m), Quantity(10, UNITS.m))
195+
box_body2 = design.extrude_sketch("JustABox", box2, Quantity(10, UNITS.m))
196+
197+
# Define plane to clip the box
198+
origin = Point3D([-10., 20., 5.], UNITS.m)
199+
plane = Plane(origin=origin, direction_x=[1, 1, 1], direction_y=[-1, 0, 1])
200+
201+
# Add the object with the clipping plane
202+
ph.add(box_body2, clipping_plane=plane)
203+
ph.plot()
204+
```
205+
182206
## Select objects interactively
183207

184208
PyAnsys Geometry's plotter supports interactive object selection within the scene.

0 commit comments

Comments
 (0)