Download this example
Download this example as a Jupyter Notebook or as a Python script.
Miscellaneous: Example template#
This example serves as a template for creating new examples in the documentation. It shows developers how to structure their code and comments for clarity and consistency. It also provides a basic outline for importing necessary modules, initializing the modeler, performing operations, and closing the modeler.
It is important to follow the conventions and formatting used in this example to ensure that the documentation is easy to read and understandable.
Example imports#
Perform the required imports for this example. This section should include all necessary imports for the example to run correctly.
[1]:
# Imports
from ansys.geometry.core import launch_modeler
from ansys.geometry.core.math import Point2D
from ansys.geometry.core.sketch import Sketch
Initialize the modeler#
[2]:
# Initialize the modeler for this example notebook
m = launch_modeler()
print(m)
Ansys Geometry Modeler (0x7f738ae59460)
Ansys Geometry Modeler Client (0x7f738af0d760)
Target: localhost:700
Connection: Healthy
Body of your example#
Developers can add their code here to perform the desired operations. This section should include comments and explanations to explain what the code is doing.
Example section: Initialize a design#
Create a design named example-design
.
[3]:
# Initialize the example design
design = m.create_design("example-design")
Example section: Include images#
This section demonstrates how to include static images in the documentation. You should place these images in the doc/source/_static/
directory.
You can then reference images in the documentation using the following syntax:

Example section: Create a sketch and plot it#
This section demonstrates how to create a sketch and plot it.
[4]:
sketch = Sketch()
sketch.box(Point2D([0, 0]), 10, 10)
sketch.plot()
Example section: Extrude the sketch and create a body#
This section demonstrates how to extrude the sketch and create a body.
[5]:
design.extrude_sketch(f"BoxBody", sketch, distance=10)
design.plot()
Close the modeler#
[6]:
# Close the modeler
m.close()
Download this example
Download this example as a Jupyter Notebook or as a Python script.