From 6ce86c8938095db4c6a8e1e2ec8e53bf5bb68ec6 Mon Sep 17 00:00:00 2001 From: Matteo Bini <91963243+b-matteo@users.noreply.github.com> Date: Fri, 15 Dec 2023 12:52:24 +0100 Subject: [PATCH] Bug/fix documention (#888) --- doc/source/user_guide/designer.rst | 30 +++++++++++++++++++++++++--- doc/source/user_guide/primitives.rst | 2 ++ doc/source/user_guide/shapes.rst | 4 +++- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/doc/source/user_guide/designer.rst b/doc/source/user_guide/designer.rst index c00b82b17f..423de22fd1 100644 --- a/doc/source/user_guide/designer.rst +++ b/doc/source/user_guide/designer.rst @@ -4,6 +4,19 @@ Designer The PyAnsys Geometry :class:`designer ` subpackage organizes geometry assemblies and synchronizes to a supporting Geometry service instance. +Create the model +---------------- +This code create the :class:`Modeler() ` object which owns the whole designs +tools and data. + +.. code:: python + + from ansys.geometry.core import Modeler + + # Create the modeler object itself + modeler = Modeler() + + Define the model ---------------- The following code define the model by creating a sketch with a circle on the client. @@ -11,9 +24,14 @@ It then creates the model on the server. .. code:: python + from ansys.geometry.core.sketch import Sketch + from ansys.geometry.core.math import Point2D + from ansys.geometry.core.misc import UNITS + from pint import Quantity + # Create a sketch and draw a circle on the client sketch = Sketch() - sketch.circle(Point3D([10, 10, 0], UNITS.mm), Quantity(10, UNITS.mm)) + sketch.circle(Point2D([10, 10], UNITS.mm), Quantity(10, UNITS.mm)) # Create your design on the server design_name = "ExtrudeProfile" @@ -26,6 +44,12 @@ This code adds the data structure and properties for individual materials: .. code:: python + from ansys.geometry.core.materials.material import Material + from ansys.geometry.core.materials.property import ( + MaterialProperty, + MaterialPropertyType, + ) + density = Quantity(125, 1000 * UNITS.kg / (UNITS.m * UNITS.m * UNITS.m)) poisson_ratio = Quantity(0.33, UNITS.dimensionless) tensile_strength = Quantity(45) @@ -71,7 +95,7 @@ The following code shows how to download and save the design. .. code:: python - file = "path/to/download" - design.download(file, as_stream=False) + file = "path/to/download.scdocx" + design.download(file) For more information, see the :class:`Design ` submodule. diff --git a/doc/source/user_guide/primitives.rst b/doc/source/user_guide/primitives.rst index e43319c556..446bdaea27 100644 --- a/doc/source/user_guide/primitives.rst +++ b/doc/source/user_guide/primitives.rst @@ -41,5 +41,7 @@ the 2D feature executes as expected: .. code:: python + from ansys.geometry.core.math import Plane, Point3D, UnitVector3D + origin = Point3D([42, 99, 13]) plane = Plane(origin, UnitVector3D([1, 0, 0]), UnitVector3D([0, 1, 0])) diff --git a/doc/source/user_guide/shapes.rst b/doc/source/user_guide/shapes.rst index b4f42bbe8e..db0a2d8801 100644 --- a/doc/source/user_guide/shapes.rst +++ b/doc/source/user_guide/shapes.rst @@ -37,6 +37,8 @@ which take as a starting point the last point of the previous edge. .. code:: python + from ansys.geometry.core.math import Point2D + sketch.segment_to_point(Point2D([3, 3]), "Segment2").segment_to_point( Point2D([3, 2]), "Segment3" ) @@ -48,7 +50,7 @@ of user-defined labels: .. code:: python - sketch.get("") + sketch.get("Segment2") .. jupyter-execute:: :hide-code: