From 7e06b6e5145bb73a067d9cd7b50aee3eb4fc8eb2 Mon Sep 17 00:00:00 2001 From: Jorge Martinez Garrido Date: Fri, 18 Aug 2023 16:37:11 +0200 Subject: [PATCH 01/13] DOC: powerful templates --- .gitignore | 2 +- doc/source/_autoapi_templates/index.rst | 2 +- .../_autoapi_templates/python/module.rst | 219 +++ .../core/connection/backend/index.rst | 90 ++ .../geometry/core/connection/client/index.rst | 188 +++ .../core/connection/conversions/index.rst | 298 ++++ .../core/connection/defaults/index.rst | 92 ++ .../ansys/geometry/core/connection/index.rst | 107 ++ .../core/connection/launcher/index.rst | 224 +++ .../core/connection/local_instance/index.rst | 175 +++ .../core/connection/validate/index.rst | 76 + .../geometry/core/designer/beam/index.rst | 221 +++ .../geometry/core/designer/body/index.rst | 1352 +++++++++++++++++ .../core/designer/component/index.rst | 652 ++++++++ .../core/designer/coordinate_system/index.rst | 117 ++ .../geometry/core/designer/design/index.rst | 312 ++++ .../core/designer/designpoint/index.rst | 108 ++ .../geometry/core/designer/edge/index.rst | 144 ++ .../geometry/core/designer/face/index.rst | 294 ++++ .../ansys/geometry/core/designer/index.rst | 122 ++ .../geometry/core/designer/part/index.rst | 171 +++ .../core/designer/selection/index.rst | 102 ++ .../ansys/geometry/core/errors/index.rst | 113 ++ .../autoapi/ansys/geometry/core/index.rst | 167 ++ .../ansys/geometry/core/logger/index.rst | 565 +++++++ .../ansys/geometry/core/materials/index.rst | 82 + .../core/materials/material/index.rst | 103 ++ .../core/materials/property/index.rst | 154 ++ .../ansys/geometry/core/math/bbox/index.rst | 207 +++ .../geometry/core/math/constants/index.rst | 117 ++ .../ansys/geometry/core/math/frame/index.rst | 166 ++ .../ansys/geometry/core/math/index.rst | 107 ++ .../ansys/geometry/core/math/matrix/index.rst | 147 ++ .../ansys/geometry/core/math/plane/index.rst | 105 ++ .../ansys/geometry/core/math/point/index.rst | 232 +++ .../ansys/geometry/core/math/vector/index.rst | 445 ++++++ .../geometry/core/misc/accuracy/index.rst | 222 +++ .../ansys/geometry/core/misc/checks/index.rst | 207 +++ .../ansys/geometry/core/misc/index.rst | 92 ++ .../geometry/core/misc/measurements/index.rst | 212 +++ .../ansys/geometry/core/misc/units/index.rst | 100 ++ .../ansys/geometry/core/modeler/index.rst | 189 +++ .../ansys/geometry/core/plotting/index.rst | 110 ++ .../geometry/core/plotting/plotter/index.rst | 413 +++++ .../core/plotting/trame_gui/index.rst | 83 + .../core/plotting/widgets/button/index.rst | 97 ++ .../widgets/displace_arrows/index.rst | 128 ++ .../geometry/core/plotting/widgets/index.rst | 97 ++ .../core/plotting/widgets/ruler/index.rst | 96 ++ .../plotting/widgets/view_button/index.rst | 137 ++ .../core/plotting/widgets/widget/index.rst | 100 ++ .../geometry/core/primitives/circle/index.rst | 308 ++++ .../geometry/core/primitives/cone/index.rst | 371 +++++ .../primitives/curve_evaluation/index.rst | 104 ++ .../core/primitives/cylinder/index.rst | 377 +++++ .../core/primitives/ellipse/index.rst | 330 ++++ .../ansys/geometry/core/primitives/index.rst | 122 ++ .../geometry/core/primitives/line/index.rst | 255 ++++ .../primitives/parameterization/index.rst | 311 ++++ .../geometry/core/primitives/sphere/index.rst | 346 +++++ .../primitives/surface_evaluation/index.rst | 141 ++ .../geometry/core/primitives/torus/index.rst | 367 +++++ .../ansys/geometry/core/sketch/arc/index.rst | 183 +++ .../ansys/geometry/core/sketch/box/index.rst | 125 ++ .../geometry/core/sketch/circle/index.rst | 125 ++ .../ansys/geometry/core/sketch/edge/index.rst | 120 ++ .../geometry/core/sketch/ellipse/index.rst | 135 ++ .../ansys/geometry/core/sketch/face/index.rst | 109 ++ .../geometry/core/sketch/gears/index.rst | 185 +++ .../ansys/geometry/core/sketch/index.rst | 137 ++ .../geometry/core/sketch/polygon/index.rst | 143 ++ .../geometry/core/sketch/segment/index.rst | 136 ++ .../geometry/core/sketch/sketch/index.rst | 638 ++++++++ .../ansys/geometry/core/sketch/slot/index.rst | 125 ++ .../geometry/core/sketch/trapezoid/index.rst | 124 ++ .../geometry/core/sketch/triangle/index.rst | 111 ++ .../ansys/geometry/core/typing/index.rst | 67 + doc/source/autoapi/index.rst | 11 + doc/source/conf.py | 35 +- 79 files changed, 15571 insertions(+), 31 deletions(-) create mode 100644 doc/source/_autoapi_templates/python/module.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/connection/backend/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/connection/client/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/connection/conversions/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/connection/defaults/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/connection/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/connection/launcher/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/connection/local_instance/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/connection/validate/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/designer/beam/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/designer/body/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/designer/component/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/designer/coordinate_system/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/designer/design/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/designer/designpoint/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/designer/edge/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/designer/face/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/designer/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/designer/part/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/designer/selection/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/errors/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/logger/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/materials/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/materials/material/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/materials/property/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/math/bbox/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/math/constants/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/math/frame/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/math/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/math/matrix/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/math/plane/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/math/point/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/math/vector/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/misc/accuracy/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/misc/checks/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/misc/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/misc/measurements/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/misc/units/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/modeler/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/plotting/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/plotting/plotter/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/plotting/trame_gui/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/plotting/widgets/button/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/plotting/widgets/displace_arrows/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/plotting/widgets/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/plotting/widgets/ruler/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/plotting/widgets/view_button/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/plotting/widgets/widget/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/primitives/circle/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/primitives/cone/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/primitives/curve_evaluation/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/primitives/cylinder/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/primitives/ellipse/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/primitives/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/primitives/line/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/primitives/parameterization/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/primitives/sphere/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/primitives/surface_evaluation/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/primitives/torus/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/sketch/arc/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/sketch/box/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/sketch/circle/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/sketch/edge/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/sketch/ellipse/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/sketch/face/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/sketch/gears/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/sketch/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/sketch/polygon/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/sketch/segment/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/sketch/sketch/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/sketch/slot/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/sketch/trapezoid/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/sketch/triangle/index.rst create mode 100644 doc/source/autoapi/ansys/geometry/core/typing/index.rst create mode 100644 doc/source/autoapi/index.rst diff --git a/.gitignore b/.gitignore index f69b812c77..7ef3b01bec 100644 --- a/.gitignore +++ b/.gitignore @@ -76,7 +76,7 @@ instance/ # Sphinx documentation doc/_build/ -doc/source/autoapi/ +#doc/source/autoapi/ # PyBuilder .pybuilder/ diff --git a/doc/source/_autoapi_templates/index.rst b/doc/source/_autoapi_templates/index.rst index 09bfbea354..835630363b 100644 --- a/doc/source/_autoapi_templates/index.rst +++ b/doc/source/_autoapi_templates/index.rst @@ -6,7 +6,7 @@ to interact with them programmatically. .. toctree:: :titlesonly: - :maxdepth: 2 + :maxdepth: 3 {% for page in pages %} {% if (page.top_level_object or page.name.split('.') | length == 3) and page.display %} diff --git a/doc/source/_autoapi_templates/python/module.rst b/doc/source/_autoapi_templates/python/module.rst new file mode 100644 index 0000000000..50d780e941 --- /dev/null +++ b/doc/source/_autoapi_templates/python/module.rst @@ -0,0 +1,219 @@ +{% if not obj.display %} +:orphan: + +{% endif %} + +{% if obj.name.split(".") | length == 3 %} +{{ obj.name }} +{{ "=" * obj.name|length }} + +{% else %} + +{% if obj.type == "package" %} + +Package ``{{ obj.short_name }}`` +{{ "============" + "=" * obj.short_name|length }} + +{% else %} + +Module ``{{ obj.short_name }}`` +{{ "===========" + "=" * obj.short_name|length }} + +{% endif %} + +{% endif %} + +.. py:module:: {{ obj.name }} + + +{# Include the description for the module #} + +{% if obj.docstring %} +Description +----------- + +{{ obj.docstring }} + +{% endif %} + + +Summary +------- + +.. tab-set:: + + {% set visible_subpackages = obj.subpackages|selectattr("display")|list %} + {% if visible_subpackages %} + .. tab-item:: Subpackages + + .. list-table:: + :header-rows: 0 + :widths: auto + + {% for subpackage in visible_subpackages %} + * - :py:mod:`{{ subpackage.name }}` + - {{ subpackage.summary }} + {% endfor %} + {% endif %} + + {% set visible_submodules = obj.submodules|selectattr("display")|list %} + {% if visible_submodules %} + .. tab-item:: Submodules + + .. list-table:: + :header-rows: 0 + :widths: auto + + {% for submodule in visible_submodules %} + * - :py:mod:`{{ submodule.name }}` + - {{ submodule.summary }} + {% endfor %} + {% endif %} + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + +{% block subpackages %} +{% set visible_subpackages = obj.subpackages|selectattr("display")|list %} +{% if visible_subpackages %} +Subpackages +----------- + +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Name + - Description + {% for subpackage in visible_subpackages %} + * - :py:mod:`{{ subpackage.name }}` + - {{ subpackage.summary }} + {% endfor %} + +.. toctree:: + :titlesonly: + :maxdepth: 1 + :hidden: + +{% for subpackage in visible_subpackages %} + {{subpackage.short_name}}<{{ subpackage.short_name }}/index.rst> +{% endfor %} + + +{% endif %} +{% endblock %} + + + + +{% block submodules %} +{% set visible_submodules = obj.submodules|selectattr("display")|list %} +{% if visible_submodules %} +Submodules +---------- + +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Name + - Description + {% for submodule in visible_submodules %} + * - :py:mod:`{{ submodule.name }}` + - {{ submodule.summary }} + {% endfor %} + +.. toctree:: + :titlesonly: + :maxdepth: 1 + :hidden: + +{% for submodule in visible_submodules %} + {{submodule.short_name}}<{{ submodule.short_name }}/index.rst> +{% endfor %} + + +{% endif %} +{% endblock %} +{% block content %} +{% if obj.all is not none %} +{% set visible_children = obj.children|selectattr("short_name", "in", obj.all)|list %} +{% elif obj.type is equalto("package") %} +{% set visible_children = obj.children|selectattr("display")|list %} +{% else %} +{% set visible_children = obj.children|selectattr("display")|rejectattr("imported")|list %} +{% endif %} +{% if visible_children %} +Contents +-------- + +{% set visible_classes = visible_children|selectattr("type", "equalto", "class")|list %} +{% set visible_functions = visible_children|selectattr("type", "equalto", "function")|list %} +{% set visible_attributes = visible_children|selectattr("type", "equalto", "data")|list %} +{% if "show-module-summary" in autoapi_options and (visible_classes or visible_functions) %} +{% block classes scoped %} +{% if visible_classes %} +Classes +~~~~~~~ + +.. autoapisummary:: + +{% for klass in visible_classes %} + {{ klass.id }} +{% endfor %} + + +{% endif %} +{% endblock %} + +{% block functions scoped %} +{% if visible_functions %} +Functions +~~~~~~~~~ + +.. autoapisummary:: + +{% for function in visible_functions %} + {{ function.id }} +{% endfor %} + + +{% endif %} +{% endblock %} + +{% block attributes scoped %} +{% if visible_attributes %} +Attributes +~~~~~~~~~~ + +.. autoapisummary:: + +{% for attribute in visible_attributes %} + {{ attribute.id }} +{% endfor %} + + +{% endif %} +{% endblock %} +{% endif %} +{% for obj_item in visible_children %} +{{ obj_item.render()|indent(0) }} +{% endfor %} +{% endif %} +{% endblock %} + diff --git a/doc/source/autoapi/ansys/geometry/core/connection/backend/index.rst b/doc/source/autoapi/ansys/geometry/core/connection/backend/index.rst new file mode 100644 index 0000000000..b0c4ea9a8d --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/connection/backend/index.rst @@ -0,0 +1,90 @@ + + + +Module ``backend`` +================== + + + +.. py:module:: ansys.geometry.core.connection.backend + + + +Description +----------- + +Module providing definitions for the backend types. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + +Classes +~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.connection.backend.BackendType + + + + +.. py:class:: BackendType + + + Bases: :py:obj:`enum.Enum` + + Provides an enum holding the available backend types. + + .. py:attribute:: DISCOVERY + :value: 0 + + + + .. py:attribute:: SPACECLAIM + :value: 1 + + + + .. py:attribute:: WINDOWS_SERVICE + :value: 2 + + + + .. py:attribute:: LINUX_SERVICE + :value: 3 + + + + diff --git a/doc/source/autoapi/ansys/geometry/core/connection/client/index.rst b/doc/source/autoapi/ansys/geometry/core/connection/client/index.rst new file mode 100644 index 0000000000..5a51b62b36 --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/connection/client/index.rst @@ -0,0 +1,188 @@ + + + +Module ``client`` +================= + + + +.. py:module:: ansys.geometry.core.connection.client + + + +Description +----------- + +Module providing a wrapped abstraction of the gRPC PROTO API definition and stubs. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + +Classes +~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.connection.client.GrpcClient + + + +Functions +~~~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.connection.client.wait_until_healthy + + + +.. py:function:: wait_until_healthy(channel: grpc.Channel, timeout: float) + + Wait until a channel is healthy before returning. + + Parameters + ---------- + channel : ~grpc.Channel + Channel that must be established and healthy. + timeout : float + Timeout in seconds. An attempt is made every 100 milliseconds + until the timeout is exceeded. + + Raises + ------ + TimeoutError + Raised when the total elapsed time exceeds the value for the ``timeout`` parameter. + + +.. py:class:: GrpcClient(host: beartype.typing.Optional[str] = DEFAULT_HOST, port: beartype.typing.Union[str, int] = DEFAULT_PORT, channel: beartype.typing.Optional[grpc.Channel] = None, remote_instance: beartype.typing.Optional[ansys.platform.instancemanagement.Instance] = None, local_instance: beartype.typing.Optional[ansys.geometry.core.connection.local_instance.LocalDockerInstance] = None, timeout: beartype.typing.Optional[ansys.geometry.core.typing.Real] = 60, logging_level: beartype.typing.Optional[int] = logging.INFO, logging_file: beartype.typing.Optional[beartype.typing.Union[pathlib.Path, str]] = None, backend_type: beartype.typing.Optional[ansys.geometry.core.connection.backend.BackendType] = None) + + + Wraps the gRPC connection for the Geometry service. + + Parameters + ---------- + host : str, default: DEFAULT_HOST + Host where the server is running. + port : Union[str, int], default: DEFAULT_PORT + Port number where the server is running. + channel : ~grpc.Channel, default: None + gRPC channel for server communication. + remote_instance : ansys.platform.instancemanagement.Instance, default: None + Corresponding remote instance when the Geometry service + is launched through `PyPIM `_. + This instance is deleted when calling the + :func:`GrpcClient.close ` + method. + local_instance : LocalDockerInstance, default: None + Corresponding local instance when the Geometry service is launched using + the ``launch_local_modeler()`` method. This local instance is deleted + when the :func:`GrpcClient.close ` + method is called. + timeout : real, default: 60 + Maximum time to spend trying to make the connection. + logging_level : int, default: INFO + Logging level to apply to the client. + logging_file : str or Path, default: None + File to output the log to, if requested. + backend_type: BackendType, default: None + Type of the backend that PyGeometry is communicating with. By default, this + value is unknown, which results in ``None`` being the default value. + + .. py:property:: backend_type + :type: ansys.geometry.core.connection.backend.BackendType + + Backend type. + + Options are ``Windows Service``, ``Linux Service``, ``Discovery``, + and ``SpaceClaim``. + + Notes + ----- + This method might return ``None`` because determining the backend type is + not straightforward. + + + .. py:property:: channel + :type: grpc.Channel + + Client gRPC channel. + + + .. py:property:: log + :type: ansys.geometry.core.logger.PyGeometryCustomAdapter + + Specific instance logger. + + + .. py:property:: is_closed + :type: bool + + Flag indicating whether the client connection is closed. + + + .. py:property:: healthy + :type: bool + + Flag indicating whether the client channel is healthy. + + + .. py:method:: __repr__() -> str + + Represent the client as a string. + + + .. py:method:: close() + + Close the channel. + + Notes + ----- + If an instance of the Geometry service was started using + `PyPIM `_, this instance is + deleted. Furthermore, if a local instance + of the Geometry service was started, it is stopped. + + + .. py:method:: target() -> str + + Get the target of the channel. + + + .. py:method:: get_name() -> str + + Get the target name of the connection. + + + diff --git a/doc/source/autoapi/ansys/geometry/core/connection/conversions/index.rst b/doc/source/autoapi/ansys/geometry/core/connection/conversions/index.rst new file mode 100644 index 0000000000..6a16208d33 --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/connection/conversions/index.rst @@ -0,0 +1,298 @@ + + + +Module ``conversions`` +====================== + + + +.. py:module:: ansys.geometry.core.connection.conversions + + + +Description +----------- + +Module providing for conversions. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + + +Functions +~~~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.connection.conversions.unit_vector_to_grpc_direction + ansys.geometry.core.connection.conversions.frame_to_grpc_frame + ansys.geometry.core.connection.conversions.plane_to_grpc_plane + ansys.geometry.core.connection.conversions.sketch_shapes_to_grpc_geometries + ansys.geometry.core.connection.conversions.sketch_edges_to_grpc_geometries + ansys.geometry.core.connection.conversions.sketch_arc_to_grpc_arc + ansys.geometry.core.connection.conversions.sketch_ellipse_to_grpc_ellipse + ansys.geometry.core.connection.conversions.sketch_circle_to_grpc_circle + ansys.geometry.core.connection.conversions.point3d_to_grpc_point + ansys.geometry.core.connection.conversions.point2d_to_grpc_point + ansys.geometry.core.connection.conversions.sketch_polygon_to_grpc_polygon + ansys.geometry.core.connection.conversions.sketch_segment_to_grpc_line + ansys.geometry.core.connection.conversions.tess_to_pd + ansys.geometry.core.connection.conversions.grpc_matrix_to_matrix + ansys.geometry.core.connection.conversions.grpc_frame_to_frame + + + +.. py:function:: unit_vector_to_grpc_direction(unit_vector: ansys.geometry.core.math.UnitVector3D) -> ansys.api.geometry.v0.models_pb2.Direction + + Convert a ``UnitVector3D`` class to a unit vector Geometry service gRPC message. + + Parameters + ---------- + unit_vector : UnitVector3D + Source vector data. + + Returns + ------- + GRPCDirection + Geometry service gRPC direction message. + + +.. py:function:: frame_to_grpc_frame(frame: ansys.geometry.core.math.Frame) -> ansys.api.geometry.v0.models_pb2.Frame + + Convert a ``Frame`` class to a frame Geometry service gRPC message. + + Parameters + ---------- + frame : Frame + Source frame data. + + Returns + ------- + GRPCFrame + Geometry service gRPC frame message. The unit for the frame origin is meters. + + +.. py:function:: plane_to_grpc_plane(plane: ansys.geometry.core.math.Plane) -> ansys.api.geometry.v0.models_pb2.Plane + + Convert a ``Plane`` class to a plane Geometry service gRPC message. + + Parameters + ---------- + plane : Plane + Source plane data. + + Returns + ------- + GRPCPlane + Geometry service gRPC plane message. The unit is meters. + + +.. py:function:: sketch_shapes_to_grpc_geometries(plane: ansys.geometry.core.math.Plane, edges: beartype.typing.List[ansys.geometry.core.sketch.SketchEdge], faces: beartype.typing.List[ansys.geometry.core.sketch.SketchFace], only_one_curve: beartype.typing.Optional[bool] = False) -> ansys.api.geometry.v0.models_pb2.Geometries + + Convert lists of ``SketchEdge`` and ``SketchFace`` to a ``Geometries`` gRPC message. + + Parameters + ---------- + plane : Plane + Plane for positioning the 2D sketches. + edges : List[SketchEdge] + Source edge data. + faces : List[SketchFace] + Source face data. + shapes : List[BaseShape] + Source shape data. + only_one_curve : bool, default: False + Whether to project one curve of the whole set of geometries to + enhance performance. + + Returns + ------- + Geometries + Geometry service gRPC geometries message. The unit is meters. + + +.. py:function:: sketch_edges_to_grpc_geometries(edges: beartype.typing.List[ansys.geometry.core.sketch.SketchEdge], plane: ansys.geometry.core.math.Plane) -> beartype.typing.Tuple[beartype.typing.List[ansys.api.geometry.v0.models_pb2.Line], beartype.typing.List[ansys.api.geometry.v0.models_pb2.Arc]] + + Convert a list of ``SketchEdge`` to a ``Geometries`` gRPC message. + + Parameters + ---------- + edges : List[SketchEdge] + Source edge data. + plane : Plane + Plane for positioning the 2D sketches. + + Returns + ------- + Tuple[List[GRPCLine], List[GRPCArc]] + Geometry service gRPC line and arc messages. The unit is meters. + + +.. py:function:: sketch_arc_to_grpc_arc(arc: ansys.geometry.core.sketch.Arc, plane: ansys.geometry.core.math.Plane) -> ansys.api.geometry.v0.models_pb2.Arc + + Convert an ``Arc`` class to an arc Geometry service gRPC message. + + Parameters + ---------- + arc : Arc + Source arc data. + plane : Plane + Plane for positioning the arc within. + + Returns + ------- + GRPCArc + Geometry service gRPC arc message. The unit is meters. + + +.. py:function:: sketch_ellipse_to_grpc_ellipse(ellipse: ansys.geometry.core.sketch.SketchEllipse, plane: ansys.geometry.core.math.Plane) -> ansys.api.geometry.v0.models_pb2.Ellipse + + Convert a ``SketchEllipse`` class to an ellipse Geometry service gRPC message. + + Parameters + ---------- + ellipse : SketchEllipse + Source ellipse data. + + Returns + ------- + GRPCEllipse + Geometry service gRPC ellipse message. The unit is meters. + + +.. py:function:: sketch_circle_to_grpc_circle(circle: ansys.geometry.core.sketch.SketchCircle, plane: ansys.geometry.core.math.Plane) -> ansys.api.geometry.v0.models_pb2.Circle + + Convert a ``SketchCircle`` class to a circle Geometry service gRPC message. + + Parameters + ---------- + circle : SketchCircle + Source circle data. + plane : Plane + Plane for positioning the circle. + + Returns + ------- + GRPCCircle + Geometry service gRPC circle message. The unit is meters. + + +.. py:function:: point3d_to_grpc_point(point: ansys.geometry.core.math.Point3D) -> ansys.api.geometry.v0.models_pb2.Point + + Convert a ``Point3D`` class to a point Geometry service gRPC message. + + Parameters + ---------- + point : Point3D + Source point data. + + Returns + ------- + GRPCPoint + Geometry service gRPC point message. The unit is meters. + + +.. py:function:: point2d_to_grpc_point(plane: ansys.geometry.core.math.Plane, point2d: ansys.geometry.core.math.Point2D) -> ansys.api.geometry.v0.models_pb2.Point + + Convert a ``Point2D`` class to a point Geometry service gRPC message. + + Parameters + ---------- + plane : Plane + Plane for positioning the 2D point. + point : Point2D + Source point data. + + Returns + ------- + GRPCPoint + Geometry service gRPC point message. The unit is meters. + + +.. py:function:: sketch_polygon_to_grpc_polygon(polygon: ansys.geometry.core.sketch.Polygon, plane: ansys.geometry.core.math.Plane) -> ansys.api.geometry.v0.models_pb2.Polygon + + Convert a ``Polygon`` class to a polygon Geometry service gRPC message. + + Parameters + ---------- + polygon : Polygon + Source polygon data. + + Returns + ------- + GRPCPolygon + Geometry service gRPC polygon message. The unit is meters. + + +.. py:function:: sketch_segment_to_grpc_line(segment: ansys.geometry.core.sketch.SketchSegment, plane: ansys.geometry.core.math.Plane) -> ansys.api.geometry.v0.models_pb2.Line + + Convert a ``Segment`` class to a line Geometry service gRPC message. + + Parameters + ---------- + segment : SketchSegment + Source segment data. + + Returns + ------- + GRPCLine + Geometry service gRPC line message. The unit is meters. + + +.. py:function:: tess_to_pd(tess: ansys.api.geometry.v0.models_pb2.Tessellation) -> pyvista.PolyData + + Convert an ``ansys.api.geometry.Tessellation`` to ``pyvista.PolyData``. + + +.. py:function:: grpc_matrix_to_matrix(m: ansys.api.geometry.v0.models_pb2.Matrix) -> ansys.geometry.core.math.Matrix44 + + Convert an ``ansys.api.geometry.Matrix`` to a ``Matrix44``. + + +.. py:function:: grpc_frame_to_frame(frame: ansys.api.geometry.v0.models_pb2.Frame) -> ansys.geometry.core.math.Frame + + Convert an ``ansys.api.geometry.Frame`` gRPC message to a ``Frame`` class. + + Parameters + ---------- + GRPCFrame + Geometry service gRPC frame message. The unit for the frame origin is meters. + + Returns + ------- + frame : Frame + Resulting converted frame. + + diff --git a/doc/source/autoapi/ansys/geometry/core/connection/defaults/index.rst b/doc/source/autoapi/ansys/geometry/core/connection/defaults/index.rst new file mode 100644 index 0000000000..34ffcfc3f7 --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/connection/defaults/index.rst @@ -0,0 +1,92 @@ + + + +Module ``defaults`` +=================== + + + +.. py:module:: ansys.geometry.core.connection.defaults + + + +Description +----------- + +Module providing default connection parameters. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + +.. py:data:: DEFAULT_HOST + + Default for the HOST name. + + By default, PyGeometry searches for the environment variable ``ANSRV_GEO_HOST``, + and if this variable does not exist, PyGeometry uses ``127.0.0.1`` as the host. + + +.. py:data:: DEFAULT_PORT + :type: int + + Default for the HOST port. + + By default, PyGeometry searches for the environment variable ``ANSRV_GEO_PORT``, + and if this variable does not exist, PyGeometry uses ``50051`` as the port. + + +.. py:data:: MAX_MESSAGE_LENGTH + + Default for the gRPC maximum message length. + + By default, PyGeometry searches for the environment variable ``PYGEOMETRY_MAX_MESSAGE_LENGTH``, + and if this variable does not exist, PyGeometry uses ``256Mb`` as the maximum message length. + + +.. py:data:: GEOMETRY_SERVICE_DOCKER_IMAGE + :value: 'ghcr.io/ansys/geometry' + + Default for the Geometry service Docker image location. + + Tag is dependent on what OS service is requested. + + +.. py:data:: DEFAULT_PIM_CONFIG + + Default for the PIM configuration when running PIM Light. + + This parameter is only to be used when PIM Light is being run. + + diff --git a/doc/source/autoapi/ansys/geometry/core/connection/index.rst b/doc/source/autoapi/ansys/geometry/core/connection/index.rst new file mode 100644 index 0000000000..674412ad37 --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/connection/index.rst @@ -0,0 +1,107 @@ + + + +Package ``connection`` +====================== + + + +.. py:module:: ansys.geometry.core.connection + + + +Description +----------- + +PyGeometry connection subpackage. + + + + +Summary +------- + +.. tab-set:: + + + .. tab-item:: Submodules + + .. list-table:: + :header-rows: 0 + :widths: auto + + * - :py:mod:`ansys.geometry.core.connection.backend` + - Module providing definitions for the backend types. + * - :py:mod:`ansys.geometry.core.connection.client` + - Module providing a wrapped abstraction of the gRPC PROTO API definition and stubs. + * - :py:mod:`ansys.geometry.core.connection.conversions` + - Module providing for conversions. + * - :py:mod:`ansys.geometry.core.connection.defaults` + - Module providing default connection parameters. + * - :py:mod:`ansys.geometry.core.connection.launcher` + - Module for connecting to instances of the Geometry service. + * - :py:mod:`ansys.geometry.core.connection.local_instance` + - Module for connecting to a local Docker container with the Geometry service. + * - :py:mod:`ansys.geometry.core.connection.validate` + - Module to perform a connection validation check. + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Submodules +---------- + +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Name + - Description + * - :py:mod:`ansys.geometry.core.connection.backend` + - Module providing definitions for the backend types. + * - :py:mod:`ansys.geometry.core.connection.client` + - Module providing a wrapped abstraction of the gRPC PROTO API definition and stubs. + * - :py:mod:`ansys.geometry.core.connection.conversions` + - Module providing for conversions. + * - :py:mod:`ansys.geometry.core.connection.defaults` + - Module providing default connection parameters. + * - :py:mod:`ansys.geometry.core.connection.launcher` + - Module for connecting to instances of the Geometry service. + * - :py:mod:`ansys.geometry.core.connection.local_instance` + - Module for connecting to a local Docker container with the Geometry service. + * - :py:mod:`ansys.geometry.core.connection.validate` + - Module to perform a connection validation check. + +.. toctree:: + :titlesonly: + :maxdepth: 1 + :hidden: + + backend + client + conversions + defaults + launcher + local_instance + validate + + diff --git a/doc/source/autoapi/ansys/geometry/core/connection/launcher/index.rst b/doc/source/autoapi/ansys/geometry/core/connection/launcher/index.rst new file mode 100644 index 0000000000..c4dee7c5ce --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/connection/launcher/index.rst @@ -0,0 +1,224 @@ + + + +Module ``launcher`` +=================== + + + +.. py:module:: ansys.geometry.core.connection.launcher + + + +Description +----------- + +Module for connecting to instances of the Geometry service. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + + +Functions +~~~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.connection.launcher.launch_modeler + ansys.geometry.core.connection.launcher.launch_remote_modeler + ansys.geometry.core.connection.launcher.launch_local_modeler + ansys.geometry.core.connection.launcher.launch_modeler_with_pimlight_and_discovery + ansys.geometry.core.connection.launcher.launch_modeler_with_pimlight_and_geometry_service + ansys.geometry.core.connection.launcher.launch_modeler_with_pimlight_and_spaceclaim + + + +.. py:function:: launch_modeler(**kwargs: beartype.typing.Optional[beartype.typing.Dict]) -> ansys.geometry.core.modeler.Modeler + + Start the ``Modeler`` interface for PyGeometry. + + Parameters + ---------- + **kwargs : dict, default: None + Keyword arguments for the launching methods. For allowable keyword arguments, see the + :func:`launch_remote_modeler` and :func:`launch_local_modeler` methods. Some of these + keywords might be unused. + + Returns + ------- + ansys.geometry.core.Modeler + Pythonic interface for geometry modeling. + + Examples + -------- + Launch the Geometry service. + + >>> from ansys.geometry.core import launch_modeler + >>> modeler = launch_modeler() + + +.. py:function:: launch_remote_modeler(version: beartype.typing.Optional[str] = None, **kwargs: beartype.typing.Optional[beartype.typing.Dict]) -> ansys.geometry.core.modeler.Modeler + + Start the Geometry service remotely using the PIM API. + + When calling this method, you must ensure that you are in an + environment where `PyPIM `_ is + configured. You can use the + :func:`pypim.is_configured ` + method to check if it is configured. + + Parameters + ---------- + version : str, default: None + Version of the Geometry service to run in the three-digit format. + For example, "232". If you do not specify the version, the server + chooses the version. + **kwargs : dict, default: None + Keyword arguments for the launching methods. For allowable keyword arguments, see the + :func:`launch_remote_modeler` and :func:`launch_local_modeler` methods. Some of these + keywords might be unused. + + Returns + ------- + ansys.geometry.core.modeler.Modeler + Instance of the Geometry service. + + +.. py:function:: launch_local_modeler(port: int = DEFAULT_PORT, connect_to_existing_service: bool = True, restart_if_existing_service: bool = False, name: beartype.typing.Optional[str] = None, image: beartype.typing.Optional[ansys.geometry.core.connection.local_instance.GeometryContainers] = None, **kwargs: beartype.typing.Optional[beartype.typing.Dict]) -> ansys.geometry.core.modeler.Modeler + + Start the Geometry service locally using the ``LocalDockerInstance`` class. + + When calling this method, a Geometry service (as a local Docker container) + is started. By default, if a container with the Geometry service already exists + at the given port, it connects to it. Otherwise, it tries to launch its own + service. + + Parameters + ---------- + port : int, optional + Localhost port to deploy the Geometry service on or the + the ``Modeler`` interface to connect to (if it is already deployed). By default, + the value is the one for the ``DEFAULT_PORT`` connection parameter. + connect_to_existing_service : bool, default: True + Whether the ``Modeler`` interface should connect to a Geometry + service already deployed at the specified port. + restart_if_existing_service : bool, default: False + Whether the Geometry service (which is already running) + should be restarted when attempting connection. + name : Optional[str], default: None + Name of the Docker container to deploy. The default is ``None``, + in which case Docker assigns it a random name. + image : Optional[GeometryContainers], default: None + The Geometry service Docker image to deploy. The default is ``None``, + in which case the ``LocalDockerInstance`` class identifies the OS of your + Docker engine and deploys the latest version of the Geometry service for + that OS. + **kwargs : dict, default: None + Keyword arguments for the launching methods. For allowable keyword arguments, see the + :func:`launch_remote_modeler` and :func:`launch_local_modeler` methods. Some of these + keywords might be unused. + + Returns + ------- + Modeler + Instance of the Geometry service. + + +.. py:function:: launch_modeler_with_pimlight_and_discovery(version: beartype.typing.Optional[str] = None) -> ansys.geometry.core.modeler.Modeler + + Start Ansys Discovery remotely using the PIM API. + + When calling this method, you must ensure that you are in an + environment where `PyPIM `_ is configured. + You can use the :func:`pypim.is_configured ` + method to check if it is configured. + + Parameters + ---------- + version : str, default: None + Version of Discovery to run in the three-digit format. + For example, "232". If you do not specify the version, the server + chooses the version. + + Returns + ------- + ansys.geometry.core.Modeler + Instance of Modeler. + + +.. py:function:: launch_modeler_with_pimlight_and_geometry_service(version: beartype.typing.Optional[str] = None) -> ansys.geometry.core.modeler.Modeler + + Start the Geometry service remotely using the PIM API. + + When calling this method, you must ensure that you are in an + environment where `PyPIM `_ is configured. + You can use the :func:`pypim.is_configured ` + method to check if it is configured. + + Parameters + ---------- + version : str, default: None + Version of the Geometry service to run in the three-digit format. + For example, "232". If you do not specify the version, the server + chooses the version. + + Returns + ------- + ansys.geometry.core.Modeler + Instance of Modeler. + + +.. py:function:: launch_modeler_with_pimlight_and_spaceclaim(version: beartype.typing.Optional[str] = None) -> ansys.geometry.core.modeler.Modeler + + Start Ansys SpaceClaim remotely using the PIM API. + + When calling this method, you must ensure that you are in an + environment where `PyPIM `_ is configured. + You can use the :func:`pypim.is_configured ` + method to check if it is configured. + + Parameters + ---------- + version : str, default: None + Version of SpaceClaim to run in the three-digit format. + For example, "232". If you do not specify the version, the server + chooses the version. + + Returns + ------- + ansys.geometry.core.Modeler + Instance of Modeler. + + diff --git a/doc/source/autoapi/ansys/geometry/core/connection/local_instance/index.rst b/doc/source/autoapi/ansys/geometry/core/connection/local_instance/index.rst new file mode 100644 index 0000000000..cc472996cd --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/connection/local_instance/index.rst @@ -0,0 +1,175 @@ + + + +Module ``local_instance`` +========================= + + + +.. py:module:: ansys.geometry.core.connection.local_instance + + + +Description +----------- + +Module for connecting to a local Docker container with the Geometry service. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + +Classes +~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.connection.local_instance.GeometryContainers + ansys.geometry.core.connection.local_instance.LocalDockerInstance + + + + +.. py:class:: GeometryContainers + + + Bases: :py:obj:`enum.Enum` + + Provides an enum holding the available Geometry services. + + .. py:attribute:: WINDOWS_LATEST + :value: (0, 'windows', 'windows-latest') + + + + .. py:attribute:: LINUX_LATEST + :value: (1, 'linux', 'linux-latest') + + + + .. py:attribute:: WINDOWS_LATEST_UNSTABLE + :value: (2, 'windows', 'windows-latest-unstable') + + + + .. py:attribute:: LINUX_LATEST_UNSTABLE + :value: (3, 'linux', 'linux-latest-unstable') + + + + +.. py:class:: LocalDockerInstance(port: int = DEFAULT_PORT, connect_to_existing_service: bool = True, restart_if_existing_service: bool = False, name: beartype.typing.Optional[str] = None, image: beartype.typing.Optional[GeometryContainers] = None) + + + Instantiates a Geometry service as a local Docker container. + + By default, if a container with the Geometry service already exists at the given port, + PyGeometry connects to it. Otherwise, PyGeometry tries to launch its own service. + + Parameters + ---------- + port : int, optional + Localhost port to deploy the Geometry service on or the + the ``Modeler`` interface to connect to (if it is already deployed). By default, + the value is the one for the ``DEFAULT_PORT`` connection parameter. + connect_to_existing_service : bool, default: True + Whether the ``Modeler`` interface should connect to a Geometry + service already deployed at the specified port. + restart_if_existing_service : bool, default: False + Whether the Geometry service (which is already running) + should be restarted when attempting connection. + name : Optional[str], default: None + Name of the Docker container to deploy. The default is ``None``, + in which case Docker assigns it a random name. + image : Optional[GeometryContainers], default: None + The Geometry service Docker image to deploy. The default is ``None``, + in which case the ``LocalDockerInstance`` class identifies the OS of your + Docker engine and deploys the latest version of the Geometry service for that + OS. + + .. py:property:: container + :type: docker.models.containers.Container + + Docker container object that hosts the deployed Geometry service. + + + .. py:property:: existed_previously + :type: bool + + Flag indicating whether the container previously existed. + + Returns ``False`` if the Geometry service was effectively + deployed by this class or ``True`` if it already existed. + + + .. py:attribute:: __DOCKER_CLIENT__ + :type: docker.DockerClient + + Docker client class variable. The default is ``None``, in which case lazy + initialization is used. + + Notes + ----- + ``__DOCKER_CLIENT__`` is a class variable, meaning that it is + the same variable for all instances of this class. + + + .. py:method:: docker_client() -> docker.DockerClient + :staticmethod: + + Get the initialized ``__DOCKER_CLIENT__`` object. + + Notes + ----- + The ``LocalDockerInstance`` class performs a lazy initialization of the + ``__DOCKER_CLIENT__`` class variable. + + Returns + ------- + docker.DockerClient + Initialized Docker client. + + + .. py:method:: is_docker_installed() -> bool + :staticmethod: + + Check whether a local installation of Docker engine is available and running. + + Returns + ------- + bool + ``True`` if Docker engine is available and running, ``False`` otherwise. + + + diff --git a/doc/source/autoapi/ansys/geometry/core/connection/validate/index.rst b/doc/source/autoapi/ansys/geometry/core/connection/validate/index.rst new file mode 100644 index 0000000000..4d80b0bffb --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/connection/validate/index.rst @@ -0,0 +1,76 @@ + + + +Module ``validate`` +=================== + + + +.. py:module:: ansys.geometry.core.connection.validate + + + +Description +----------- + +Module to perform a connection validation check. + +The method in this module is only used for testing the default Docker service on +GitHub and can safely be skipped within testing. + +This command shows how this method is typically used: + +.. code:: bash + + python -c "from ansys.geometry.core.connection import validate; validate()" + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + + +Functions +~~~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.connection.validate.validate + + + +.. py:function:: validate() + + Create a client using the default settings and validate it. + + diff --git a/doc/source/autoapi/ansys/geometry/core/designer/beam/index.rst b/doc/source/autoapi/ansys/geometry/core/designer/beam/index.rst new file mode 100644 index 0000000000..641cb01188 --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/designer/beam/index.rst @@ -0,0 +1,221 @@ + + + +Module ``beam`` +=============== + + + +.. py:module:: ansys.geometry.core.designer.beam + + + +Description +----------- + +Provides for creating and managing a beam. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + +Classes +~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.designer.beam.BeamProfile + ansys.geometry.core.designer.beam.BeamCircularProfile + ansys.geometry.core.designer.beam.Beam + + + + +.. py:class:: BeamProfile(id: str, name: str) + + + Represents a single beam profile organized within the design assembly. + + This profile synchronizes to a design within a supporting Geometry service instance. + + Parameters + ---------- + id : str + Server-defined ID for the beam profile. + name : str + User-defined label for the beam profile. + + Notes + ----- + ``BeamProfile`` objects are expected to be created from the ``Design`` object. + This means that you are not expected to instantiate your own ``BeamProfile`` + object. You should call the specific ``Design`` API for the ``BeamProfile`` desired. + + .. py:property:: id + :type: str + + ID of the beam profile. + + + .. py:property:: name + :type: str + + Name of the beam profile. + + + +.. py:class:: BeamCircularProfile(id: str, name: str, radius: ansys.geometry.core.misc.Distance, center: ansys.geometry.core.math.Point3D, direction_x: ansys.geometry.core.math.UnitVector3D, direction_y: ansys.geometry.core.math.UnitVector3D) + + + Bases: :py:obj:`BeamProfile` + + Represents a single circular beam profile organized within the design assembly. + + This profile synchronizes to a design within a supporting Geometry service instance. + + Parameters + ---------- + id : str + Server-defined ID for the beam profile. + name : str + User-defined label for the beam profile. + radius : Distance + Radius of the circle. + center: Point3D + 3D point representing the center of the circle. + direction_x: UnitVector3D + X-axis direction. + direction_y: UnitVector3D + Y-axis direction. + + Notes + ----- + ``BeamProfile`` objects are expected to be created from the ``Design`` object. + This means that you are not expected to instantiate your own ``BeamProfile`` + object. You should call the specific ``Design`` API for the ``BeamProfile`` desired. + + .. py:property:: radius + :type: ansys.geometry.core.misc.Distance + + Radius of the circular beam profile. + + + .. py:property:: center + :type: ansys.geometry.core.math.Point3D + + Center of the circular beam profile. + + + .. py:property:: direction_x + :type: ansys.geometry.core.math.UnitVector3D + + X-axis direction of the circular beam profile. + + + .. py:property:: direction_y + :type: ansys.geometry.core.math.UnitVector3D + + Y-axis direction of the circular beam profile. + + + .. py:method:: __repr__() -> str + + Represent the ``BeamCircularProfile`` as a string. + + + +.. py:class:: Beam(id: str, start: ansys.geometry.core.math.Point3D, end: ansys.geometry.core.math.Point3D, profile: BeamProfile, parent_component: ansys.geometry.core.designer.component.Component) + + + Represents a simplified solid body with an assigned 2D cross-section. + + This body synchronizes to a design within a supporting Geometry service instance. + + Parameters + ---------- + id : str + Server-defined ID for the body. + name : str + User-defined label for the body. + start : Point3D + Start of the beam line segment. + end : Point3D + End of the beam line segment. + profile : BeamProfile + Beam profile to use to create the beam. + parent_component : Component + Parent component to nest the new beam under within the design assembly. + + .. py:property:: id + :type: str + + Service-defined ID of the beam. + + + .. py:property:: start + :type: ansys.geometry.core.math.Point3D + + Start of the beam line segment. + + + .. py:property:: end + :type: ansys.geometry.core.math.Point3D + + End of the beam line segment. + + + .. py:property:: profile + :type: BeamProfile + + Beam profile of the beam line segment. + + + .. py:property:: parent_component + :type: beartype.typing.Union[ansys.geometry.core.designer.component.Component, None] + + Component node that the beam is under. + + + .. py:property:: is_alive + :type: bool + + Flag indicating whether the beam is still alive on the server side. + + + .. py:method:: __repr__() -> str + + Represent the beam as a string. + + + diff --git a/doc/source/autoapi/ansys/geometry/core/designer/body/index.rst b/doc/source/autoapi/ansys/geometry/core/designer/body/index.rst new file mode 100644 index 0000000000..14fcaa2a1e --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/designer/body/index.rst @@ -0,0 +1,1352 @@ + + + +Module ``body`` +=============== + + + +.. py:module:: ansys.geometry.core.designer.body + + + +Description +----------- + +Provides for managing a body. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + +Classes +~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.designer.body.MidSurfaceOffsetType + ansys.geometry.core.designer.body.IBody + ansys.geometry.core.designer.body.MasterBody + ansys.geometry.core.designer.body.Body + + + + +.. py:class:: MidSurfaceOffsetType + + + Bases: :py:obj:`enum.Enum` + + Provides values for mid-surface offsets supported by the Geometry service. + + .. py:attribute:: MIDDLE + :value: 0 + + + + .. py:attribute:: TOP + :value: 1 + + + + .. py:attribute:: BOTTOM + :value: 2 + + + + .. py:attribute:: VARIABLE + :value: 3 + + + + .. py:attribute:: CUSTOM + :value: 4 + + + + +.. py:class:: IBody + + + Bases: :py:obj:`abc.ABC` + + Defines the common methods for a body, providing the abstract body interface. + + Both the ``MasterBody`` class and ``Body`` class both inherit from the ``IBody`` + class. All child classes must implement all abstract methods. + + .. py:method:: id() -> str + :abstractmethod: + + Get the ID of the body as a string. + + + .. py:method:: name() -> str + :abstractmethod: + + Get the name of the body. + + + .. py:method:: faces() -> beartype.typing.List[ansys.geometry.core.designer.face.Face] + :abstractmethod: + + Get a list of all faces within the body. + + Returns + ------- + List[Face] + + + .. py:method:: edges() -> beartype.typing.List[ansys.geometry.core.designer.edge.Edge] + :abstractmethod: + + Get a list of all edges within the body. + + Returns + ------- + List[Edge] + + + .. py:method:: is_alive() -> bool + :abstractmethod: + + Check if the body is still alive and has not been deleted. + + + .. py:method:: is_surface() -> bool + :abstractmethod: + + Check if the body is a planar body. + + + .. py:method:: surface_thickness() -> beartype.typing.Union[pint.Quantity, None] + :abstractmethod: + + Get the surface thickness of a surface body. + + Notes + ----- + This method is only for surface-type bodies that have been assigned a surface thickness. + + + .. py:method:: surface_offset() -> beartype.typing.Union[ansys.geometry.core.designer.design.MidSurfaceOffsetType, None] + :abstractmethod: + + Get the surface offset type of a surface body. + + Notes + ----- + This method is only for surface-type bodies that have been assigned a surface offset. + + + .. py:method:: volume() -> pint.Quantity + :abstractmethod: + + Calculate the volume of the body. + + Notes + ----- + When dealing with a planar surface, a value of ``0`` is returned as a volume. + + + .. py:method:: assign_material(material: ansys.geometry.core.materials.Material) -> None + :abstractmethod: + + Assign a material against the design in the active Geometry service instance. + + Parameters + ---------- + material : Material + Source material data. + + + .. py:method:: add_midsurface_thickness(thickness: pint.Quantity) -> None + :abstractmethod: + + Add a mid-surface thickness to a surface body. + + Parameters + ---------- + thickness : Quantity + Thickness to assign. + + Notes + ----- + Only surface bodies are eligible for mid-surface thickness assignment. + + + .. py:method:: add_midsurface_offset(offset: ansys.geometry.core.designer.design.MidSurfaceOffsetType) -> None + :abstractmethod: + + Add a mid-surface offset to a surface body. + + Parameters + ---------- + offset_type : MidSurfaceOffsetType + Surface offset to assign. + + Notes + ----- + Only surface bodies are eligible for mid-surface offset assignment. + + + .. py:method:: imprint_curves(faces: beartype.typing.List[ansys.geometry.core.designer.face.Face], sketch: ansys.geometry.core.sketch.Sketch) -> beartype.typing.Tuple[beartype.typing.List[ansys.geometry.core.designer.edge.Edge], beartype.typing.List[ansys.geometry.core.designer.face.Face]] + :abstractmethod: + + Imprint all specified geometries onto specified faces of the body. + + Parameters + ---------- + faces: List[Face] + List of faces to imprint the curves of the sketch onto. + sketch: Sketch + All curves to imprint on the faces. + + Returns + ------- + Tuple[List[Edge], List[Face]] + All impacted edges and faces from the imprint operation. + + + .. py:method:: project_curves(direction: ansys.geometry.core.math.UnitVector3D, sketch: ansys.geometry.core.sketch.Sketch, closest_face: bool, only_one_curve: beartype.typing.Optional[bool] = False) -> beartype.typing.List[ansys.geometry.core.designer.face.Face] + :abstractmethod: + + Project all specified geometries onto the body. + + Parameters + ---------- + direction: UnitVector3D + Direction of the projection. + sketch: Sketch + All curves to project on the body. + closest_face: bool + Whether to target the closest face with the projection. + only_one_curve: bool, default: False + Whether to project only one curve of the entire sketch. When + ``True``, only one curve is projected. + + Notes + ----- + The ``only_one_curve`` parameter allows you to optimize the server call because + projecting curves is an expensive operation. This reduces the workload on the + server side. + + Returns + ------- + List[Face] + All faces from the project curves operation. + + + .. py:method:: imprint_projected_curves(direction: ansys.geometry.core.math.UnitVector3D, sketch: ansys.geometry.core.sketch.Sketch, closest_face: bool, only_one_curve: beartype.typing.Optional[bool] = False) -> beartype.typing.List[ansys.geometry.core.designer.face.Face] + :abstractmethod: + + Project and imprint specified geometries onto the body. + + This method combines the ``project_curves()`` and ``imprint_curves()`` method into + one method. It is much more performant than calling them back-to-back when dealing + with many curves. Because it is a specialized function, this method only returns + the faces (and not the edges) from the imprint operation. + + Parameters + ---------- + direction: UnitVector3D + Direction of the projection. + sketch: Sketch + All curves to project on the body. + closest_face: bool + Whether to target the closest face with the projection. + only_one_curve: bool, default: False + Whether to project only one curve of the entire sketch. When + ``True``, only one curve is projected. + + Notes + ----- + The ``only_one_curve`` parameter allows you to optimize the server call because + projecting curves is an expensive operation. This reduces the workload on the + server side. + + Returns + ------- + List[Face] + All imprinted faces from the operation. + + + .. py:method:: translate(direction: ansys.geometry.core.math.UnitVector3D, distance: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.Distance, ansys.geometry.core.typing.Real]) -> None + :abstractmethod: + + Translate the geometry body in the specified direction by a given distance. + + Parameters + ---------- + direction: UnitVector3D + Direction of the translation. + distance: Union[Quantity, Distance, Real] + Distance (magnitude) of the translation. + + Returns + ------- + None + + + .. py:method:: copy(parent: ansys.geometry.core.designer.component.Component, name: str = None) -> Body + :abstractmethod: + + Create a copy of the body and place it under the specified parent component. + + Parameters + ---------- + parent: Component + Parent component to place the new body under within the design assembly. + name: str + Name to give the new body. + + Returns + ------- + Body + Copy of the body. + + + .. py:method:: tessellate(merge: beartype.typing.Optional[bool] = False) -> beartype.typing.Union[pyvista.PolyData, pyvista.MultiBlock] + :abstractmethod: + + Tessellate the body and return the geometry as triangles. + + Parameters + ---------- + merge : bool, default: False + Whether to merge the body into a single mesh. When ``False`` (default), the + number of triangles are preserved and only the topology is merged. + When ``True``, the individual faces of the tessellation are merged. + + Returns + ------- + ~pyvista.PolyData, ~pyvista.MultiBlock + Merged :class:`pyvista.PolyData` if ``merge=True`` or a composite dataset. + + Examples + -------- + Extrude a box centered at the origin to create a rectangular body and + tessellate it: + + >>> from ansys.geometry.core.misc.units import UNITS as u + >>> from ansys.geometry.core.sketch import Sketch + >>> from ansys.geometry.core.math import Plane, Point2D, Point3D, UnitVector3D + >>> from ansys.geometry.core import Modeler + >>> modeler = Modeler() + >>> origin = Point3D([0, 0, 0]) + >>> plane = Plane(origin, direction_x=[1, 0, 0], direction_y=[0, 0, 1]) + >>> sketch = Sketch(plane) + >>> box = sketch.box(Point2D([2, 0]), 4, 4) + >>> design = modeler.create_design("my-design") + >>> my_comp = design.add_component("my-comp") + >>> body = my_comp.extrude_sketch("my-sketch", sketch, 1 * u.m) + >>> blocks = body.tessellate() + >>> blocks + >>> MultiBlock (0x7f94ec757460) + N Blocks: 6 + X Bounds: 0.000, 4.000 + Y Bounds: -1.000, 0.000 + Z Bounds: -0.500, 4.500 + + Merge the body: + + >>> mesh = body.tessellate(merge=True) + >>> mesh + PolyData (0x7f94ec75f3a0) + N Cells: 12 + N Points: 24 + X Bounds: 0.000e+00, 4.000e+00 + Y Bounds: -1.000e+00, 0.000e+00 + Z Bounds: -5.000e-01, 4.500e+00 + N Arrays: 0 + + + .. py:method:: plot(merge: bool = False, screenshot: beartype.typing.Optional[str] = None, use_trame: beartype.typing.Optional[bool] = None, **plotting_options: beartype.typing.Optional[dict]) -> None + :abstractmethod: + + Plot the body. + + Parameters + ---------- + merge : bool, default: False + Whether to merge the body into a single mesh. When ``False`` (default), + the number of triangles are preserved and only the topology is merged. + When ``True``, the individual faces of the tessellation are merged. + screenshot : str, default: None + Path for saving a screenshot of the image that is being represented. + use_trame : bool, default: None + Whether to enable the use of `trame `_. + The default is ``None``, in which case the ``USE_TRAME`` global setting + is used. + **plotting_options : dict, default: None + Keyword arguments for plotting. For allowable keyword arguments, see the + :func:`pyvista.Plotter.add_mesh` method. + + Examples + -------- + Extrude a box centered at the origin to create rectangular body and + plot it: + + >>> from ansys.geometry.core.misc.units import UNITS as u + >>> from ansys.geometry.core.sketch import Sketch + >>> from ansys.geometry.core.math import Plane, Point2D, Point3D, UnitVector3D + >>> from ansys.geometry.core import Modeler + >>> modeler = Modeler() + >>> origin = Point3D([0, 0, 0]) + >>> plane = Plane(origin, direction_x=[1, 0, 0], direction_y=[0, 0, 1]) + >>> sketch = Sketch(plane) + >>> box = sketch.box(Point2D([2, 0]), 4, 4) + >>> design = modeler.create_design("my-design") + >>> mycomp = design.add_component("my-comp") + >>> body = mycomp.extrude_sketch("my-sketch", sketch, 1 * u.m) + >>> body.plot() + + Plot the body and color each face individually: + + >>> body.plot(multi_colors=True) + + + .. py:method:: intersect(other: Body) -> None + + Intersect two bodies. + + Notes + ----- + The ``self`` parameter is directly modified with the result, and + the ``other`` parameter is consumed. Thus, it is important to make + copies if needed. + + Parameters + ---------- + other : Body + Body to intersect with. + + Raises + ------ + ValueError + If the bodies do not intersect. + + + .. py:method:: subtract(other: Body) -> None + + Subtract two bodies. + + Notes + ----- + The ``self`` parameter is directly modified with the result, and + the ``other`` parameter is consumed. Thus, it is important to make + copies if needed. + + Parameters + ---------- + other : Body + Body to subtract from the ``self`` parameter. + + Raises + ------ + ValueError + If the subtraction results in an empty (complete) subtraction. + + + .. py:method:: unite(other: Body) -> None + + Unite two bodies. + + Notes + ----- + The ``self`` parameter is directly modified with the result, and + the ``other`` parameter is consumed. Thus, it is important to make + copies if needed. + + Parameters + ---------- + other : Body + Body to unite with the ``self`` parameter. + + + +.. py:class:: MasterBody(id: str, name: str, grpc_client: ansys.geometry.core.connection.GrpcClient, is_surface: bool = False) + + + Bases: :py:obj:`IBody` + + Represents solids and surfaces organized within the design assembly. + + Solids and surfaces synchronize to a design within a supporting Geometry service instance. + + Parameters + ---------- + id : str + Server-defined ID for the body. + name : str + User-defined label for the body. + parent_component : Component + Parent component to place the new component under within the design assembly. + grpc_client : GrpcClient + Active supporting geometry service instance for design modeling. + is_surface : bool, default: False + Whether the master body is a surface or an 3D object (with volume). The default + is ``False``, in which case the master body is a surface. When ``True``, the + master body is a 3D object (with volume). + + .. py:property:: id + :type: str + + Get the ID of the body as a string. + + + .. py:property:: name + :type: str + + Get the name of the body. + + + .. py:property:: is_surface + :type: bool + + Check if the body is a planar body. + + + .. py:property:: surface_thickness + :type: beartype.typing.Union[pint.Quantity, None] + + Get the surface thickness of a surface body. + + Notes + ----- + This method is only for surface-type bodies that have been assigned a surface thickness. + + + .. py:property:: surface_offset + :type: beartype.typing.Union[ansys.geometry.core.designer.design.MidSurfaceOffsetType, None] + + Get the surface offset type of a surface body. + + Notes + ----- + This method is only for surface-type bodies that have been assigned a surface offset. + + + .. py:property:: faces + :type: beartype.typing.List[ansys.geometry.core.designer.face.Face] + + Get a list of all faces within the body. + + Returns + ------- + List[Face] + + + .. py:property:: edges + :type: beartype.typing.List[ansys.geometry.core.designer.edge.Edge] + + Get a list of all edges within the body. + + Returns + ------- + List[Edge] + + + .. py:property:: is_alive + :type: bool + + Check if the body is still alive and has not been deleted. + + + .. py:property:: volume + :type: pint.Quantity + + Calculate the volume of the body. + + Notes + ----- + When dealing with a planar surface, a value of ``0`` is returned as a volume. + + + .. py:method:: reset_tessellation_cache() + + Decorate ``MasterBody`` methods that require a tessellation cache update. + + Parameters + ---------- + func : method + Method to call. + + Returns + ------- + Any + Output of the method, if any. + + + .. py:method:: assign_material(material: ansys.geometry.core.materials.Material) -> None + + Assign a material against the design in the active Geometry service instance. + + Parameters + ---------- + material : Material + Source material data. + + + .. py:method:: add_midsurface_thickness(thickness: pint.Quantity) -> None + + Add a mid-surface thickness to a surface body. + + Parameters + ---------- + thickness : Quantity + Thickness to assign. + + Notes + ----- + Only surface bodies are eligible for mid-surface thickness assignment. + + + .. py:method:: add_midsurface_offset(offset: ansys.geometry.core.designer.design.MidSurfaceOffsetType) -> None + + Add a mid-surface offset to a surface body. + + Parameters + ---------- + offset_type : MidSurfaceOffsetType + Surface offset to assign. + + Notes + ----- + Only surface bodies are eligible for mid-surface offset assignment. + + + .. py:method:: imprint_curves(faces: beartype.typing.List[ansys.geometry.core.designer.face.Face], sketch: ansys.geometry.core.sketch.Sketch) -> beartype.typing.Tuple[beartype.typing.List[ansys.geometry.core.designer.edge.Edge], beartype.typing.List[ansys.geometry.core.designer.face.Face]] + :abstractmethod: + + Imprint all specified geometries onto specified faces of the body. + + Parameters + ---------- + faces: List[Face] + List of faces to imprint the curves of the sketch onto. + sketch: Sketch + All curves to imprint on the faces. + + Returns + ------- + Tuple[List[Edge], List[Face]] + All impacted edges and faces from the imprint operation. + + + .. py:method:: project_curves(direction: ansys.geometry.core.math.UnitVector3D, sketch: ansys.geometry.core.sketch.Sketch, closest_face: bool, only_one_curve: beartype.typing.Optional[bool] = False) -> beartype.typing.List[ansys.geometry.core.designer.face.Face] + :abstractmethod: + + Project all specified geometries onto the body. + + Parameters + ---------- + direction: UnitVector3D + Direction of the projection. + sketch: Sketch + All curves to project on the body. + closest_face: bool + Whether to target the closest face with the projection. + only_one_curve: bool, default: False + Whether to project only one curve of the entire sketch. When + ``True``, only one curve is projected. + + Notes + ----- + The ``only_one_curve`` parameter allows you to optimize the server call because + projecting curves is an expensive operation. This reduces the workload on the + server side. + + Returns + ------- + List[Face] + All faces from the project curves operation. + + + .. py:method:: imprint_projected_curves(direction: ansys.geometry.core.math.UnitVector3D, sketch: ansys.geometry.core.sketch.Sketch, closest_face: bool, only_one_curve: beartype.typing.Optional[bool] = False) -> beartype.typing.List[ansys.geometry.core.designer.face.Face] + :abstractmethod: + + Project and imprint specified geometries onto the body. + + This method combines the ``project_curves()`` and ``imprint_curves()`` method into + one method. It is much more performant than calling them back-to-back when dealing + with many curves. Because it is a specialized function, this method only returns + the faces (and not the edges) from the imprint operation. + + Parameters + ---------- + direction: UnitVector3D + Direction of the projection. + sketch: Sketch + All curves to project on the body. + closest_face: bool + Whether to target the closest face with the projection. + only_one_curve: bool, default: False + Whether to project only one curve of the entire sketch. When + ``True``, only one curve is projected. + + Notes + ----- + The ``only_one_curve`` parameter allows you to optimize the server call because + projecting curves is an expensive operation. This reduces the workload on the + server side. + + Returns + ------- + List[Face] + All imprinted faces from the operation. + + + .. py:method:: translate(direction: ansys.geometry.core.math.UnitVector3D, distance: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.Distance, ansys.geometry.core.typing.Real]) -> None + + Translate the geometry body in the specified direction by a given distance. + + Parameters + ---------- + direction: UnitVector3D + Direction of the translation. + distance: Union[Quantity, Distance, Real] + Distance (magnitude) of the translation. + + Returns + ------- + None + + + .. py:method:: copy(parent: ansys.geometry.core.designer.component.Component, name: str = None) -> Body + + Create a copy of the body and place it under the specified parent component. + + Parameters + ---------- + parent: Component + Parent component to place the new body under within the design assembly. + name: str + Name to give the new body. + + Returns + ------- + Body + Copy of the body. + + + .. py:method:: tessellate(merge: beartype.typing.Optional[bool] = False, transform: ansys.geometry.core.math.Matrix44 = IDENTITY_MATRIX44) -> beartype.typing.Union[pyvista.PolyData, pyvista.MultiBlock] + + Tessellate the body and return the geometry as triangles. + + Parameters + ---------- + merge : bool, default: False + Whether to merge the body into a single mesh. When ``False`` (default), the + number of triangles are preserved and only the topology is merged. + When ``True``, the individual faces of the tessellation are merged. + + Returns + ------- + ~pyvista.PolyData, ~pyvista.MultiBlock + Merged :class:`pyvista.PolyData` if ``merge=True`` or a composite dataset. + + Examples + -------- + Extrude a box centered at the origin to create a rectangular body and + tessellate it: + + >>> from ansys.geometry.core.misc.units import UNITS as u + >>> from ansys.geometry.core.sketch import Sketch + >>> from ansys.geometry.core.math import Plane, Point2D, Point3D, UnitVector3D + >>> from ansys.geometry.core import Modeler + >>> modeler = Modeler() + >>> origin = Point3D([0, 0, 0]) + >>> plane = Plane(origin, direction_x=[1, 0, 0], direction_y=[0, 0, 1]) + >>> sketch = Sketch(plane) + >>> box = sketch.box(Point2D([2, 0]), 4, 4) + >>> design = modeler.create_design("my-design") + >>> my_comp = design.add_component("my-comp") + >>> body = my_comp.extrude_sketch("my-sketch", sketch, 1 * u.m) + >>> blocks = body.tessellate() + >>> blocks + >>> MultiBlock (0x7f94ec757460) + N Blocks: 6 + X Bounds: 0.000, 4.000 + Y Bounds: -1.000, 0.000 + Z Bounds: -0.500, 4.500 + + Merge the body: + + >>> mesh = body.tessellate(merge=True) + >>> mesh + PolyData (0x7f94ec75f3a0) + N Cells: 12 + N Points: 24 + X Bounds: 0.000e+00, 4.000e+00 + Y Bounds: -1.000e+00, 0.000e+00 + Z Bounds: -5.000e-01, 4.500e+00 + N Arrays: 0 + + + .. py:method:: plot(merge: bool = False, screenshot: beartype.typing.Optional[str] = None, use_trame: beartype.typing.Optional[bool] = None, **plotting_options: beartype.typing.Optional[dict]) -> None + + Plot the body. + + Parameters + ---------- + merge : bool, default: False + Whether to merge the body into a single mesh. When ``False`` (default), + the number of triangles are preserved and only the topology is merged. + When ``True``, the individual faces of the tessellation are merged. + screenshot : str, default: None + Path for saving a screenshot of the image that is being represented. + use_trame : bool, default: None + Whether to enable the use of `trame `_. + The default is ``None``, in which case the ``USE_TRAME`` global setting + is used. + **plotting_options : dict, default: None + Keyword arguments for plotting. For allowable keyword arguments, see the + :func:`pyvista.Plotter.add_mesh` method. + + Examples + -------- + Extrude a box centered at the origin to create rectangular body and + plot it: + + >>> from ansys.geometry.core.misc.units import UNITS as u + >>> from ansys.geometry.core.sketch import Sketch + >>> from ansys.geometry.core.math import Plane, Point2D, Point3D, UnitVector3D + >>> from ansys.geometry.core import Modeler + >>> modeler = Modeler() + >>> origin = Point3D([0, 0, 0]) + >>> plane = Plane(origin, direction_x=[1, 0, 0], direction_y=[0, 0, 1]) + >>> sketch = Sketch(plane) + >>> box = sketch.box(Point2D([2, 0]), 4, 4) + >>> design = modeler.create_design("my-design") + >>> mycomp = design.add_component("my-comp") + >>> body = mycomp.extrude_sketch("my-sketch", sketch, 1 * u.m) + >>> body.plot() + + Plot the body and color each face individually: + + >>> body.plot(multi_colors=True) + + + .. py:method:: intersect(other: Body) -> None + :abstractmethod: + + Intersect two bodies. + + Notes + ----- + The ``self`` parameter is directly modified with the result, and + the ``other`` parameter is consumed. Thus, it is important to make + copies if needed. + + Parameters + ---------- + other : Body + Body to intersect with. + + Raises + ------ + ValueError + If the bodies do not intersect. + + + .. py:method:: subtract(other: Body) -> None + :abstractmethod: + + Subtract two bodies. + + Notes + ----- + The ``self`` parameter is directly modified with the result, and + the ``other`` parameter is consumed. Thus, it is important to make + copies if needed. + + Parameters + ---------- + other : Body + Body to subtract from the ``self`` parameter. + + Raises + ------ + ValueError + If the subtraction results in an empty (complete) subtraction. + + + .. py:method:: unite(other: Body) -> None + :abstractmethod: + + Unite two bodies. + + Notes + ----- + The ``self`` parameter is directly modified with the result, and + the ``other`` parameter is consumed. Thus, it is important to make + copies if needed. + + Parameters + ---------- + other : Body + Body to unite with the ``self`` parameter. + + + .. py:method:: __repr__() -> str + + Represent the master body as a string. + + + +.. py:class:: Body(id, name, parent: ansys.geometry.core.designer.component.Component, template: MasterBody) + + + Bases: :py:obj:`IBody` + + Represents solids and surfaces organized within the design assembly. + + Solids and surfaces synchronize to a design within a supporting Geometry service instance. + + Parameters + ---------- + id : str + Server-defined ID for the body. + name : str + User-defined label for the body. + parent : Component + Parent component to place the new component under within the design assembly. + template : MasterBody + Master body that this body is an occurrence of. + + .. py:property:: id + :type: str + + Get the ID of the body as a string. + + + .. py:property:: name + :type: str + + Get the name of the body. + + + .. py:property:: parent + :type: ansys.geometry.core.designer.component.Component + + + .. py:property:: faces + :type: beartype.typing.List[ansys.geometry.core.designer.face.Face] + + Get a list of all faces within the body. + + Returns + ------- + List[Face] + + + .. py:property:: edges + :type: beartype.typing.List[ansys.geometry.core.designer.edge.Edge] + + Get a list of all edges within the body. + + Returns + ------- + List[Edge] + + + .. py:property:: is_alive + :type: bool + + Check if the body is still alive and has not been deleted. + + + .. py:property:: is_surface + :type: bool + + Check if the body is a planar body. + + + .. py:property:: surface_thickness + :type: beartype.typing.Union[pint.Quantity, None] + + Get the surface thickness of a surface body. + + Notes + ----- + This method is only for surface-type bodies that have been assigned a surface thickness. + + + .. py:property:: surface_offset + :type: beartype.typing.Union[ansys.geometry.core.designer.design.MidSurfaceOffsetType, None] + + Get the surface offset type of a surface body. + + Notes + ----- + This method is only for surface-type bodies that have been assigned a surface offset. + + + .. py:property:: volume + :type: pint.Quantity + + Calculate the volume of the body. + + Notes + ----- + When dealing with a planar surface, a value of ``0`` is returned as a volume. + + + .. py:method:: reset_tessellation_cache() + + Decorate ``Body`` methods that require a tessellation cache update. + + Parameters + ---------- + func : method + Method to call. + + Returns + ------- + Any + Output of the method, if any. + + + .. py:method:: assign_material(material: ansys.geometry.core.materials.Material) -> None + + Assign a material against the design in the active Geometry service instance. + + Parameters + ---------- + material : Material + Source material data. + + + .. py:method:: add_midsurface_thickness(thickness: pint.Quantity) -> None + + Add a mid-surface thickness to a surface body. + + Parameters + ---------- + thickness : Quantity + Thickness to assign. + + Notes + ----- + Only surface bodies are eligible for mid-surface thickness assignment. + + + .. py:method:: add_midsurface_offset(offset: ansys.geometry.core.designer.design.MidSurfaceOffsetType) -> None + + Add a mid-surface offset to a surface body. + + Parameters + ---------- + offset_type : MidSurfaceOffsetType + Surface offset to assign. + + Notes + ----- + Only surface bodies are eligible for mid-surface offset assignment. + + + .. py:method:: imprint_curves(faces: beartype.typing.List[ansys.geometry.core.designer.face.Face], sketch: ansys.geometry.core.sketch.Sketch) -> beartype.typing.Tuple[beartype.typing.List[ansys.geometry.core.designer.edge.Edge], beartype.typing.List[ansys.geometry.core.designer.face.Face]] + + Imprint all specified geometries onto specified faces of the body. + + Parameters + ---------- + faces: List[Face] + List of faces to imprint the curves of the sketch onto. + sketch: Sketch + All curves to imprint on the faces. + + Returns + ------- + Tuple[List[Edge], List[Face]] + All impacted edges and faces from the imprint operation. + + + .. py:method:: project_curves(direction: ansys.geometry.core.math.UnitVector3D, sketch: ansys.geometry.core.sketch.Sketch, closest_face: bool, only_one_curve: beartype.typing.Optional[bool] = False) -> beartype.typing.List[ansys.geometry.core.designer.face.Face] + + Project all specified geometries onto the body. + + Parameters + ---------- + direction: UnitVector3D + Direction of the projection. + sketch: Sketch + All curves to project on the body. + closest_face: bool + Whether to target the closest face with the projection. + only_one_curve: bool, default: False + Whether to project only one curve of the entire sketch. When + ``True``, only one curve is projected. + + Notes + ----- + The ``only_one_curve`` parameter allows you to optimize the server call because + projecting curves is an expensive operation. This reduces the workload on the + server side. + + Returns + ------- + List[Face] + All faces from the project curves operation. + + + .. py:method:: imprint_projected_curves(direction: ansys.geometry.core.math.UnitVector3D, sketch: ansys.geometry.core.sketch.Sketch, closest_face: bool, only_one_curve: beartype.typing.Optional[bool] = False) -> beartype.typing.List[ansys.geometry.core.designer.face.Face] + + Project and imprint specified geometries onto the body. + + This method combines the ``project_curves()`` and ``imprint_curves()`` method into + one method. It is much more performant than calling them back-to-back when dealing + with many curves. Because it is a specialized function, this method only returns + the faces (and not the edges) from the imprint operation. + + Parameters + ---------- + direction: UnitVector3D + Direction of the projection. + sketch: Sketch + All curves to project on the body. + closest_face: bool + Whether to target the closest face with the projection. + only_one_curve: bool, default: False + Whether to project only one curve of the entire sketch. When + ``True``, only one curve is projected. + + Notes + ----- + The ``only_one_curve`` parameter allows you to optimize the server call because + projecting curves is an expensive operation. This reduces the workload on the + server side. + + Returns + ------- + List[Face] + All imprinted faces from the operation. + + + .. py:method:: translate(direction: ansys.geometry.core.math.UnitVector3D, distance: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.Distance, ansys.geometry.core.typing.Real]) -> None + + Translate the geometry body in the specified direction by a given distance. + + Parameters + ---------- + direction: UnitVector3D + Direction of the translation. + distance: Union[Quantity, Distance, Real] + Distance (magnitude) of the translation. + + Returns + ------- + None + + + .. py:method:: copy(parent: ansys.geometry.core.designer.component.Component, name: str = None) -> Body + + Create a copy of the body and place it under the specified parent component. + + Parameters + ---------- + parent: Component + Parent component to place the new body under within the design assembly. + name: str + Name to give the new body. + + Returns + ------- + Body + Copy of the body. + + + .. py:method:: tessellate(merge: beartype.typing.Optional[bool] = False) -> beartype.typing.Union[pyvista.PolyData, pyvista.MultiBlock] + + Tessellate the body and return the geometry as triangles. + + Parameters + ---------- + merge : bool, default: False + Whether to merge the body into a single mesh. When ``False`` (default), the + number of triangles are preserved and only the topology is merged. + When ``True``, the individual faces of the tessellation are merged. + + Returns + ------- + ~pyvista.PolyData, ~pyvista.MultiBlock + Merged :class:`pyvista.PolyData` if ``merge=True`` or a composite dataset. + + Examples + -------- + Extrude a box centered at the origin to create a rectangular body and + tessellate it: + + >>> from ansys.geometry.core.misc.units import UNITS as u + >>> from ansys.geometry.core.sketch import Sketch + >>> from ansys.geometry.core.math import Plane, Point2D, Point3D, UnitVector3D + >>> from ansys.geometry.core import Modeler + >>> modeler = Modeler() + >>> origin = Point3D([0, 0, 0]) + >>> plane = Plane(origin, direction_x=[1, 0, 0], direction_y=[0, 0, 1]) + >>> sketch = Sketch(plane) + >>> box = sketch.box(Point2D([2, 0]), 4, 4) + >>> design = modeler.create_design("my-design") + >>> my_comp = design.add_component("my-comp") + >>> body = my_comp.extrude_sketch("my-sketch", sketch, 1 * u.m) + >>> blocks = body.tessellate() + >>> blocks + >>> MultiBlock (0x7f94ec757460) + N Blocks: 6 + X Bounds: 0.000, 4.000 + Y Bounds: -1.000, 0.000 + Z Bounds: -0.500, 4.500 + + Merge the body: + + >>> mesh = body.tessellate(merge=True) + >>> mesh + PolyData (0x7f94ec75f3a0) + N Cells: 12 + N Points: 24 + X Bounds: 0.000e+00, 4.000e+00 + Y Bounds: -1.000e+00, 0.000e+00 + Z Bounds: -5.000e-01, 4.500e+00 + N Arrays: 0 + + + .. py:method:: plot(merge: bool = False, screenshot: beartype.typing.Optional[str] = None, use_trame: beartype.typing.Optional[bool] = None, **plotting_options: beartype.typing.Optional[dict]) -> None + + Plot the body. + + Parameters + ---------- + merge : bool, default: False + Whether to merge the body into a single mesh. When ``False`` (default), + the number of triangles are preserved and only the topology is merged. + When ``True``, the individual faces of the tessellation are merged. + screenshot : str, default: None + Path for saving a screenshot of the image that is being represented. + use_trame : bool, default: None + Whether to enable the use of `trame `_. + The default is ``None``, in which case the ``USE_TRAME`` global setting + is used. + **plotting_options : dict, default: None + Keyword arguments for plotting. For allowable keyword arguments, see the + :func:`pyvista.Plotter.add_mesh` method. + + Examples + -------- + Extrude a box centered at the origin to create rectangular body and + plot it: + + >>> from ansys.geometry.core.misc.units import UNITS as u + >>> from ansys.geometry.core.sketch import Sketch + >>> from ansys.geometry.core.math import Plane, Point2D, Point3D, UnitVector3D + >>> from ansys.geometry.core import Modeler + >>> modeler = Modeler() + >>> origin = Point3D([0, 0, 0]) + >>> plane = Plane(origin, direction_x=[1, 0, 0], direction_y=[0, 0, 1]) + >>> sketch = Sketch(plane) + >>> box = sketch.box(Point2D([2, 0]), 4, 4) + >>> design = modeler.create_design("my-design") + >>> mycomp = design.add_component("my-comp") + >>> body = mycomp.extrude_sketch("my-sketch", sketch, 1 * u.m) + >>> body.plot() + + Plot the body and color each face individually: + + >>> body.plot(multi_colors=True) + + + .. py:method:: intersect(other: Body) -> None + + Intersect two bodies. + + Notes + ----- + The ``self`` parameter is directly modified with the result, and + the ``other`` parameter is consumed. Thus, it is important to make + copies if needed. + + Parameters + ---------- + other : Body + Body to intersect with. + + Raises + ------ + ValueError + If the bodies do not intersect. + + + .. py:method:: subtract(other: Body) -> None + + Subtract two bodies. + + Notes + ----- + The ``self`` parameter is directly modified with the result, and + the ``other`` parameter is consumed. Thus, it is important to make + copies if needed. + + Parameters + ---------- + other : Body + Body to subtract from the ``self`` parameter. + + Raises + ------ + ValueError + If the subtraction results in an empty (complete) subtraction. + + + .. py:method:: unite(other: Body) -> None + + Unite two bodies. + + Notes + ----- + The ``self`` parameter is directly modified with the result, and + the ``other`` parameter is consumed. Thus, it is important to make + copies if needed. + + Parameters + ---------- + other : Body + Body to unite with the ``self`` parameter. + + + .. py:method:: __repr__() -> str + + Represent the ``Body`` as a string. + + + diff --git a/doc/source/autoapi/ansys/geometry/core/designer/component/index.rst b/doc/source/autoapi/ansys/geometry/core/designer/component/index.rst new file mode 100644 index 0000000000..53270df761 --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/designer/component/index.rst @@ -0,0 +1,652 @@ + + + +Module ``component`` +==================== + + + +.. py:module:: ansys.geometry.core.designer.component + + + +Description +----------- + +Provides for managing components. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + +Classes +~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.designer.component.SharedTopologyType + ansys.geometry.core.designer.component.Component + + + + +.. py:class:: SharedTopologyType + + + Bases: :py:obj:`enum.Enum` + + Enum for the component shared topologies available in the Geometry service. + + .. py:attribute:: SHARETYPE_NONE + :value: 0 + + + + .. py:attribute:: SHARETYPE_SHARE + :value: 1 + + + + .. py:attribute:: SHARETYPE_MERGE + :value: 2 + + + + .. py:attribute:: SHARETYPE_GROUPS + :value: 3 + + + + +.. py:class:: Component(name: str, parent_component: beartype.typing.Union[Component, None], grpc_client: ansys.geometry.core.connection.GrpcClient, template: beartype.typing.Optional[Component] = None, preexisting_id: beartype.typing.Optional[str] = None, master_component: beartype.typing.Optional[ansys.geometry.core.designer.part.MasterComponent] = None, read_existing_comp: bool = False) + + + Provides for creating and managing a component. + + This class synchronizes to a design within a supporting Geometry service instance. + + Parameters + ---------- + name : str + User-defined label for the new component. + parent_component : Component or None + Parent component to place the new component under within the design assembly. The + default is ``None`` only when dealing with a ``Design`` object. + grpc_client : GrpcClient + Active supporting Geometry service instance for design modeling. + template : Component, default: None + Template to create this component from. This creates an + instance component that shares a master with the template component. + preexisting_id : str, default: None + ID of a component pre-existing on the server side to use to create the component + on the client-side data model. If an ID is specified, a new component is not + created on the server. + master_component : MasterComponent, default: None + Master component to use to create a nested component instance instead + of creating a new conponent. + read_existing_comp : bool, default: False + Whether an existing component on the service should be read. This + parameter is only valid when connecting to an existing service session. + Otherwise, avoid using this optional parameter. + + .. py:property:: id + :type: str + + ID of the component. + + + .. py:property:: name + :type: str + + Name of the component. + + + .. py:property:: components + :type: beartype.typing.List[Component] + + List of ``Component`` objects inside of the component. + + + .. py:property:: bodies + :type: beartype.typing.List[ansys.geometry.core.designer.body.Body] + + List of ``Body`` objects inside of the component. + + + .. py:property:: beams + :type: beartype.typing.List[ansys.geometry.core.designer.beam.Beam] + + List of ``Beam`` objects inside of the component. + + + .. py:property:: design_points + :type: beartype.typing.List[ansys.geometry.core.designer.designpoint.DesignPoint] + + List of ``DesignPoint`` objects inside of the component. + + + .. py:property:: coordinate_systems + :type: beartype.typing.List[ansys.geometry.core.designer.coordinate_system.CoordinateSystem] + + List of ``CoordinateSystem`` objects inside of the component. + + + .. py:property:: parent_component + :type: beartype.typing.Union[Component, None] + + Parent of the component. + + + .. py:property:: is_alive + :type: bool + + Whether the component is still alive on the server side. + + + .. py:property:: shared_topology + :type: beartype.typing.Union[SharedTopologyType, None] + + Shared topology type of the component (if any). + + Notes + ----- + If no shared topology has been set, ``None`` is returned. + + + .. py:method:: get_world_transform() -> ansys.geometry.core.math.Matrix44 + + Get the full transformation matrix of the component in world space. + + Returns + ------- + Matrix44 + 4x4 transformation matrix of the component in world space. + + + .. py:method:: modify_placement(translation: beartype.typing.Optional[ansys.geometry.core.math.Vector3D] = None, rotation_origin: beartype.typing.Optional[ansys.geometry.core.math.Point3D] = None, rotation_direction: beartype.typing.Optional[ansys.geometry.core.math.UnitVector3D] = None, rotation_angle: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.Angle, ansys.geometry.core.typing.Real] = 0) + + Apply a translation and/or rotation to the existing placement matrix. + + Notes + ----- + To reset a component's placement to an identity matrix, see + :func:`reset_placement()` or call :func:`modify_placement()` with no arguments. + + Parameters + ---------- + translation : Vector3D, default: None + Vector that defines the desired translation to the component. + rotation_origin : Point3D, default: None + Origin that defines the axis to rotate the component about. + rotation_direction : UnitVector3D, default: None + Direction of the axis to rotate the component about. + rotation_angle : Union[Quantity, Angle, Real], default: 0 + Angle to rotate the component around the axis. + + + .. py:method:: reset_placement() + + Reset a component's placement matrix to an identity matrix. + + See :func:`modify_placement()`. + + + .. py:method:: add_component(name: str, template: beartype.typing.Optional[Component] = None) -> Component + + Add a new component under this component within the design assembly. + + Parameters + ---------- + name : str + User-defined label for the new component. + template : Component, default: None + Template to create this component from. This creates an + instance component that shares a master with the template component. + + Returns + ------- + Component + New component with no children in the design assembly. + + + .. py:method:: set_shared_topology(share_type: SharedTopologyType) -> None + + Set the shared topology to apply to the component. + + Parameters + ---------- + share_type : SharedTopologyType + Shared topology type to assign to the component. + + + .. py:method:: extrude_sketch(name: str, sketch: ansys.geometry.core.sketch.Sketch, distance: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.Distance, ansys.geometry.core.typing.Real]) -> ansys.geometry.core.designer.body.Body + + Create a solid body by extruding the sketch profile up by a given distance. + + Notes + ----- + The newly created body is placed under this component within the design assembly. + + Parameters + ---------- + name : str + User-defined label for the new solid body. + sketch : Sketch + Two-dimensional sketch source for the extrusion. + distance : Union[Quantity, Distance, Real] + Distance to extrude the solid body. + + Returns + ------- + Body + Extruded body from the given sketch. + + + .. py:method:: extrude_face(name: str, face: ansys.geometry.core.designer.face.Face, distance: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.Distance]) -> ansys.geometry.core.designer.body.Body + + Extrude the face profile by a given distance to create a solid body. + + There are no modifications against the body containing the source face. + + Notes + ----- + The source face can be anywhere within the design component hierarchy. + Therefore, there is no validation requiring that the face is placed under the + target component where the body is to be created. + + Parameters + ---------- + name : str + User-defined label for the new solid body. + face : Face + Target face to use as the source for the new surface. + distance : Union[Quantity, Distance] + Distance to extrude the solid body. + + Returns + ------- + Body + Extruded solid body. + + + .. py:method:: create_surface(name: str, sketch: ansys.geometry.core.sketch.Sketch) -> ansys.geometry.core.designer.body.Body + + Create a surface body with a sketch profile. + + The newly created body is placed under this component within the design assembly. + + Parameters + ---------- + name : str + User-defined label for the new surface body. + sketch : Sketch + Two-dimensional sketch source for the surface definition. + + Returns + ------- + Body + Body (as a planar surface) from the given sketch. + + + .. py:method:: create_surface_from_face(name: str, face: ansys.geometry.core.designer.face.Face) -> ansys.geometry.core.designer.body.Body + + Create a surface body based on a face. + + Notes + ----- + The source face can be anywhere within the design component hierarchy. + Therefore, there is no validation requiring that the face is placed under the + target component where the body is to be created. + + Parameters + ---------- + name : str + User-defined label for the new surface body. + face : Face + Target face to use as the source for the new surface. + + Returns + ------- + Body + Surface body. + + + .. py:method:: create_coordinate_system(name: str, frame: ansys.geometry.core.math.Frame) -> ansys.geometry.core.designer.coordinate_system.CoordinateSystem + + Create a coordinate system. + + The newly created coordinate system is place under this component + within the design assembly. + + Parameters + ---------- + name : str + User-defined label for the new coordinate system. + frame : Frame + Frame defining the coordinate system bounds. + + Returns + ------- + CoordinateSystem + + + .. py:method:: translate_bodies(bodies: beartype.typing.List[ansys.geometry.core.designer.body.Body], direction: ansys.geometry.core.math.UnitVector3D, distance: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.Distance, ansys.geometry.core.typing.Real]) -> None + + Translate the geometry bodies in a specified direction by a given distance. + + Notes + ----- + If the body does not belong to this component (or its children), it + is not translated. + + Parameters + ---------- + bodies: List[Body] + List of bodies to translate by the same distance. + direction: UnitVector3D + Direction of the translation. + distance: Union[Quantity, Distance, Real] + Magnitude of the translation. + + Returns + ------- + None + + + .. py:method:: create_beams(segments: beartype.typing.List[beartype.typing.Tuple[ansys.geometry.core.math.Point3D, ansys.geometry.core.math.Point3D]], profile: ansys.geometry.core.designer.beam.BeamProfile) -> beartype.typing.List[ansys.geometry.core.designer.beam.Beam] + + Create beams under the component. + + Notes + ----- + The newly created beams synchronize to a design within a supporting + Geometry service instance. + + Parameters + ---------- + segments : List[Tuple[Point3D, Point3D]] + List of start and end pairs, each specifying a single line segment. + profile : BeamProfile + Beam profile to use to create the beams. + + + .. py:method:: create_beam(start: ansys.geometry.core.math.Point3D, end: ansys.geometry.core.math.Point3D, profile: ansys.geometry.core.designer.beam.BeamProfile) -> ansys.geometry.core.designer.beam.Beam + + Create a beam under the component. + + The newly created beam synchronizes to a design within a supporting + Geometry service instance. + + Parameters + ---------- + start : Point3D + Starting point of the beam line segment. + end : Point3D + Ending point of the beam line segment. + profile : BeamProfile + Beam profile to use to create the beam. + + + .. py:method:: delete_component(component: beartype.typing.Union[Component, str]) -> None + + Delete a component (itself or its children). + + Notes + ----- + If the component is not this component (or its children), it + is not deleted. + + Parameters + ---------- + component : Union[Component, str] + ID of the component or instance to delete. + + + .. py:method:: delete_body(body: beartype.typing.Union[ansys.geometry.core.designer.body.Body, str]) -> None + + Delete a body belonging to this component (or its children). + + Notes + ----- + If the body does not belong to this component (or its children), it + is not deleted. + + Parameters + ---------- + body : Union[Body, str] + ID of the body or instance to delete. + + + .. py:method:: add_design_point(name: str, point: ansys.geometry.core.math.Point3D) -> ansys.geometry.core.designer.designpoint.DesignPoint + + Create a single design point. + + Parameters + ---------- + name : str + User-defined label for the design points. + points : Point3D + 3D point constituting the design point. + + + .. py:method:: add_design_points(name: str, points: beartype.typing.List[ansys.geometry.core.math.Point3D]) -> beartype.typing.List[ansys.geometry.core.designer.designpoint.DesignPoint] + + Create a list of design points. + + Parameters + ---------- + name : str + User-defined label for the list of design points. + points : List[Point3D] + List of the 3D points that constitute the list of design points. + + + .. py:method:: delete_beam(beam: beartype.typing.Union[ansys.geometry.core.designer.beam.Beam, str]) -> None + + Delete an existing beam belonging to this component (or its children). + + Notes + ----- + If the beam does not belong to this component (or its children), it + is not deleted. + + Parameters + ---------- + beam : Union[Beam, str] + ID of the beam or instance to delete. + + + .. py:method:: search_component(id: str) -> beartype.typing.Union[Component, None] + + Search nested components recursively for a component. + + Parameters + ---------- + id : str + ID of the component to search for. + + Returns + ------- + Component + Component with the requested ID. If this ID is not found, ``None`` is returned. + + + .. py:method:: search_body(id: str) -> beartype.typing.Union[ansys.geometry.core.designer.body.Body, None] + + Search bodies in the component and nested components recursively for a body. + + Parameters + ---------- + id : str + ID of the body to search for. + + Returns + ------- + Body + Body with the requested ID. If the ID is not found, ``None`` is returned. + + + .. py:method:: search_beam(id: str) -> beartype.typing.Union[ansys.geometry.core.designer.beam.Beam, None] + + Search beams in the component and nested components recursively for a beam. + + Parameters + ---------- + id : str + ID of the beam to search for. + + Returns + ------- + Union[Beam, None] + Beam with the requested ID. If the ID is not found, ``None`` is returned. + + + .. py:method:: tessellate(merge_component: bool = False, merge_bodies: bool = False) -> beartype.typing.Union[pyvista.PolyData, pyvista.MultiBlock] + + Tessellate the component. + + Parameters + ---------- + merge_component : bool, default: False + Whether to merge this component into a single dataset. When ``True``, + all the individual bodies are effectively combined into a single + dataset without any hierarchy. + merge_bodies : bool, default: False + Whether to merge each body into a single dataset. When ``True``, + all the faces of each individual body are effectively + merged into a single dataset without separating faces. + + Returns + ------- + ~pyvista.PolyData, ~pyvista.MultiBlock + Merged :class:`pyvista.PolyData` if ``merge_component=True`` or a + composite dataset. + + Examples + -------- + Create two stacked bodies and return the tessellation as two merged bodies: + + >>> from ansys.geometry.core.sketch import Sketch + >>> from ansys.geometry.core import Modeler + >>> from ansys.geometry.core.math import Point2D, Point3D, Plane + >>> from ansys.geometry.core.misc import UNITS + >>> from ansys.geometry.core.plotting import Plotter + >>> modeler = Modeler("10.54.0.72", "50051") + >>> sketch_1 = Sketch() + >>> box = sketch_1.box( + >>> Point2D([10, 10], UNITS.m), Quantity(10, UNITS.m), Quantity(5, UNITS.m)) + >>> sketch_1.circle(Point2D([0, 0], UNITS.m), Quantity(25, UNITS.m)) + >>> design = modeler.create_design("MyDesign") + >>> comp = design.add_component("MyComponent") + >>> distance = Quantity(10, UNITS.m) + >>> body = comp.extrude_sketch("Body", sketch=sketch_1, distance=distance) + >>> sketch_2 = Sketch(Plane([0, 0, 10])) + >>> box = sketch_2.box( + >>> Point2D([10, 10], UNITS.m), Quantity(10, UNITS.m), Quantity(5, UNITS.m)) + >>> circle = sketch_2.circle(Point2D([0, 0], UNITS.m), Quantity(25, UNITS.m)) + >>> body = comp.extrude_sketch("Body", sketch=sketch_2, distance=distance) + >>> dataset = comp.tessellate(merge_bodies=True) + >>> dataset + MultiBlock (0x7ff6bcb511e0) + N Blocks: 2 + X Bounds: -25.000, 25.000 + Y Bounds: -24.991, 24.991 + Z Bounds: 0.000, 20.000 + + + .. py:method:: plot(merge_component: bool = False, merge_bodies: bool = False, screenshot: beartype.typing.Optional[str] = None, use_trame: beartype.typing.Optional[bool] = None, **plotting_options: beartype.typing.Optional[dict]) -> None + + Plot the component. + + Parameters + ---------- + merge_component : bool, default: False + Whether to merge the component into a single dataset. When ``True``, + all the individual bodies are effectively merged into a single + dataset without any hierarchy. + merge_bodies : bool, default: False + Whether to merge each body into a single dataset. When ``True``, + all the faces of each individual body are effectively merged + into a single dataset without separating faces. + screenshot : str, default: None + Path for saving a screenshot of the image being represented. + use_trame : bool, default: None + Whether to enable the use of `trame `_. + The default is ``None``, in which case the ``USE_TRAME`` global setting + is used. + **plotting_options : dict, default: None + Keyword arguments for plotting. For allowable keyword arguments, see the + + Examples + -------- + Create 25 small cylinders in a grid-like pattern on the XY plane and + plot them. Make the cylinders look metallic by enabling + physically-based rendering with ``pbr=True``. + + >>> from ansys.geometry.core.misc.units import UNITS as u + >>> from ansys.geometry.core.sketch import Sketch + >>> from ansys.geometry.core.math import Plane, Point2D, Point3D, UnitVector3D + >>> from ansys.geometry.core import Modeler + >>> import numpy as np + >>> modeler = Modeler() + >>> origin = Point3D([0, 0, 0]) + >>> plane = Plane(origin, direction_x=[1, 0, 0], direction_y=[0, 1, 0]) + >>> design = modeler.create_design("my-design") + >>> mycomp = design.add_component("my-comp") + >>> n = 5 + >>> xx, yy = np.meshgrid( + ... np.linspace(-4, 4, n), + ... np.linspace(-4, 4, n), + ... ) + >>> for x, y in zip(xx.ravel(), yy.ravel()): + ... sketch = Sketch(plane) + ... sketch.circle(Point2D([x, y]), 0.2*u.m) + ... mycomp.extrude_sketch(f"body-{x}-{y}", sketch, 1 * u.m) + >>> mycomp + ansys.geometry.core.designer.Component 0x2203cc9ec50 + Name : my-comp + Exists : True + Parent component : my-design + N Bodies : 25 + N Components : 0 + N Coordinate Systems : 0 + >>> mycomp.plot(pbr=True, metallic=1.0) + + + .. py:method:: __repr__() -> str + + Represent the ``Component`` as a string. + + + diff --git a/doc/source/autoapi/ansys/geometry/core/designer/coordinate_system/index.rst b/doc/source/autoapi/ansys/geometry/core/designer/coordinate_system/index.rst new file mode 100644 index 0000000000..c17091a056 --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/designer/coordinate_system/index.rst @@ -0,0 +1,117 @@ + + + +Module ``coordinate_system`` +============================ + + + +.. py:module:: ansys.geometry.core.designer.coordinate_system + + + +Description +----------- + +Provides for managing a user-defined coordinate system. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + +Classes +~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.designer.coordinate_system.CoordinateSystem + + + + +.. py:class:: CoordinateSystem(name: str, frame: ansys.geometry.core.math.Frame, parent_component: ansys.geometry.core.designer.component.Component, grpc_client: ansys.geometry.core.connection.GrpcClient, preexisting_id: beartype.typing.Optional[str] = None) + + + Represents a user-defined coordinate system within the design assembly. + + This class synchronizes to a design within a supporting Geometry + service instance. + + Parameters + ---------- + name : str + User-defined label for the coordinate system. + frame : Frame + Frame defining the coordinate system bounds. + parent_component : Component, default: Component + Parent component the coordinate system is assigned against. + grpc_client : GrpcClient + Active supporting Geometry service instance for design modeling. + + .. py:property:: id + :type: str + + ID of the coordinate system. + + + .. py:property:: name + :type: str + + Name of the coordinate system. + + + .. py:property:: frame + :type: ansys.geometry.core.math.Frame + + Frame of the coordinate system. + + + .. py:property:: parent_component + :type: ansys.geometry.core.designer.component.Component + + Parent component of the coordinate system. + + + .. py:property:: is_alive + :type: bool + + Flag indicating if coordinate system is still alive on the server side. + + + .. py:method:: __repr__() -> str + + Represent the coordinate system as a string. + + + diff --git a/doc/source/autoapi/ansys/geometry/core/designer/design/index.rst b/doc/source/autoapi/ansys/geometry/core/designer/design/index.rst new file mode 100644 index 0000000000..10db1d5ea0 --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/designer/design/index.rst @@ -0,0 +1,312 @@ + + + +Module ``design`` +================= + + + +.. py:module:: ansys.geometry.core.designer.design + + + +Description +----------- + +Provides for managing designs. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + +Classes +~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.designer.design.DesignFileFormat + ansys.geometry.core.designer.design.Design + + + + +.. py:class:: DesignFileFormat + + + Bases: :py:obj:`enum.Enum` + + Provides supported file formats that can be downloaded for designs. + + .. py:attribute:: SCDOCX + :value: ('SCDOCX', None) + + + + .. py:attribute:: PARASOLID_TEXT + :value: ('PARASOLID_TEXT',) + + + + .. py:attribute:: PARASOLID_BIN + :value: ('PARASOLID_BIN',) + + + + .. py:attribute:: FMD + :value: ('FMD',) + + + + .. py:attribute:: STEP + :value: ('STEP',) + + + + .. py:attribute:: IGES + :value: ('IGES',) + + + + .. py:attribute:: INVALID + :value: ('INVALID', None) + + + + +.. py:class:: Design(name: str, grpc_client: ansys.geometry.core.connection.GrpcClient, read_existing_design: bool = False) + + + Bases: :py:obj:`ansys.geometry.core.designer.component.Component` + + Provides for organizing geometry assemblies. + + This class synchronizes to a supporting Geometry service instance. + + Parameters + ---------- + name : str + User-defined label for the design. + grpc_client : GrpcClient + Active supporting Geometry service instance for design modeling. + read_existing_design : bool, default: False + Whether an existing design on the service should be read. This parameter is + only valid when connecting to an existing service session. Otherwise, avoid + using this optional parameter. + + .. py:property:: materials + :type: beartype.typing.List[ansys.geometry.core.materials.Material] + + List of materials available for the design. + + + .. py:property:: named_selections + :type: beartype.typing.List[ansys.geometry.core.designer.selection.NamedSelection] + + List of named selections available for the design. + + + .. py:property:: beam_profiles + :type: beartype.typing.List[ansys.geometry.core.designer.beam.BeamProfile] + + List of beam profile available for the design. + + + .. py:method:: add_material(material: ansys.geometry.core.materials.Material) -> None + + Add a material to the design. + + Parameters + ---------- + material : Material + Material to add. + + + .. py:method:: save(file_location: beartype.typing.Union[pathlib.Path, str]) -> None + + Save a design to disk on the active Geometry server instance. + + Parameters + ---------- + file_location : Union[Path, str] + Location on disk to save the file to. + + + .. py:method:: download(file_location: beartype.typing.Union[pathlib.Path, str], format: beartype.typing.Optional[DesignFileFormat] = DesignFileFormat.SCDOCX) -> None + + Download a design from the active Geometry server instance. + + Parameters + ---------- + file_location : Union[Path, str] + Location on disk to save the file to. + format :DesignFileFormat, default: DesignFileFormat.SCDOCX + Format for the file to save to. + + + .. py:method:: create_named_selection(name: str, bodies: beartype.typing.Optional[beartype.typing.List[ansys.geometry.core.designer.body.Body]] = None, faces: beartype.typing.Optional[beartype.typing.List[ansys.geometry.core.designer.face.Face]] = None, edges: beartype.typing.Optional[beartype.typing.List[ansys.geometry.core.designer.edge.Edge]] = None, beams: beartype.typing.Optional[beartype.typing.List[ansys.geometry.core.designer.beam.Beam]] = None, design_points: beartype.typing.Optional[beartype.typing.List[ansys.geometry.core.designer.designpoint.DesignPoint]] = None) -> ansys.geometry.core.designer.selection.NamedSelection + + Create a named selection on the active Geometry server instance. + + Parameters + ---------- + name : str + User-defined name for the named selection. + bodies : List[Body], default: None + All bodies to include in the named selection. + faces : List[Face], default: None + All faces to include in the named selection. + edges : List[Edge], default: None + All edges to include in the named selection. + beams : List[Beam], default: None + All beams to include in the named selection. + design_points : List[DesignPoints], default: None + All design points to include in the named selection. + + Returns + ------- + NamedSelection + Newly created named selection that maintains references to all target entities. + + + .. py:method:: delete_named_selection(named_selection: beartype.typing.Union[ansys.geometry.core.designer.selection.NamedSelection, str]) -> None + + Delete a named selection on the active Geometry server instance. + + Parameters + ---------- + named_selection : Union[NamedSelection, str] + Name of the named selection or instance. + + + .. py:method:: delete_component(component: beartype.typing.Union[ansys.geometry.core.designer.component.Component, str]) -> None + + Delete a component (itself or its children). + + Notes + ----- + If the component is not this component (or its children), it + is not deleted. + + Parameters + ---------- + id : Union[Component, str] + Name of the component or instance to delete. + + Raises + ------ + ValueError + The design itself cannot be deleted. + + + .. py:method:: set_shared_topology(share_type: ansys.geometry.core.designer.component.SharedTopologyType) -> None + + Set the shared topology to apply to the component. + + Parameters + ---------- + share_type : SharedTopologyType + Shared topology type to assign. + + Raises + ------ + ValueError + Shared topology does not apply to a design. + + + .. py:method:: add_beam_circular_profile(name: str, radius: beartype.typing.Union[pint.Quantity, ansys.geometry.core.misc.Distance], center: beartype.typing.Union[numpy.ndarray, ansys.geometry.core.typing.RealSequence, ansys.geometry.core.math.Point3D] = ZERO_POINT3D, direction_x: beartype.typing.Union[numpy.ndarray, ansys.geometry.core.typing.RealSequence, ansys.geometry.core.math.UnitVector3D, ansys.geometry.core.math.Vector3D] = UNITVECTOR3D_X, direction_y: beartype.typing.Union[numpy.ndarray, ansys.geometry.core.typing.RealSequence, ansys.geometry.core.math.UnitVector3D, ansys.geometry.core.math.Vector3D] = UNITVECTOR3D_Y) -> ansys.geometry.core.designer.beam.BeamCircularProfile + + Add a new beam circular profile under the design for the creating beams. + + Parameters + ---------- + name : str + User-defined label for the new beam circular profile. + radius : Real + Radius of the beam circular profile. + center : Union[~numpy.ndarray, RealSequence, Point3D] + Center of the beam circular profile. + direction_x : Union[~numpy.ndarray, RealSequence, UnitVector3D, Vector3D] + X-plane direction. + direction_y : Union[~numpy.ndarray, RealSequence, UnitVector3D, Vector3D] + Y-plane direction. + + + .. py:method:: add_midsurface_thickness(thickness: pint.Quantity, bodies: beartype.typing.List[ansys.geometry.core.designer.body.Body]) -> None + + Add a mid-surface thickness to a list of bodies. + + Parameters + ---------- + thickness : Quantity + Thickness to be assigned. + bodies : List[Body] + All bodies to include in the mid-surface thickness assignment. + + Notes + ----- + Only surface bodies will be eligible for mid-surface thickness assignment. + + + .. py:method:: add_midsurface_offset(offset_type: ansys.geometry.core.designer.body.MidSurfaceOffsetType, bodies: beartype.typing.List[ansys.geometry.core.designer.body.Body]) -> None + + Add a mid-surface offset type to a list of bodies. + + Parameters + ---------- + offset_type : MidSurfaceOffsetType + Surface offset to be assigned. + bodies : List[Body] + All bodies to include in the mid-surface offset assignment. + + Notes + ----- + Only surface bodies will be eligible for mid-surface offset assignment. + + + .. py:method:: delete_beam_profile(beam_profile: beartype.typing.Union[ansys.geometry.core.designer.beam.BeamProfile, str]) -> None + + Remove a beam profile on the active geometry server instance. + + Parameters + ---------- + beam_profile : Union[BeamProfile, str] + A beam profile name or instance that should be deleted. + + + .. py:method:: __repr__() -> str + + Represent the ``Design`` as a string. + + + diff --git a/doc/source/autoapi/ansys/geometry/core/designer/designpoint/index.rst b/doc/source/autoapi/ansys/geometry/core/designer/designpoint/index.rst new file mode 100644 index 0000000000..36bb46cdeb --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/designer/designpoint/index.rst @@ -0,0 +1,108 @@ + + + +Module ``designpoint`` +====================== + + + +.. py:module:: ansys.geometry.core.designer.designpoint + + + +Description +----------- + +Module for creating and managing design points. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + +Classes +~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.designer.designpoint.DesignPoint + + + + +.. py:class:: DesignPoint(id: str, name: str, point: ansys.geometry.core.math.Point3D, parent_component: ansys.geometry.core.designer.component.Component) + + + Provides for creating design points in components. + + Parameters + ---------- + id : str + Server-defined ID for the design points. + name : str + User-defined label for the design points. + points : Point3D + 3D point constituting the design points. + parent_component : Component + Parent component to place the new design point under within the design assembly. + + .. py:property:: id + :type: str + + ID of the design point. + + + .. py:property:: name + :type: str + + Name of the design point. + + + .. py:property:: value + :type: ansys.geometry.core.math.Point3D + + Value of the design point. + + + .. py:property:: parent_component + :type: beartype.typing.Union[ansys.geometry.core.designer.component.Component, None] + + Component node that the design point is under. + + + .. py:method:: __repr__() -> str + + Represent the design points as a string. + + + diff --git a/doc/source/autoapi/ansys/geometry/core/designer/edge/index.rst b/doc/source/autoapi/ansys/geometry/core/designer/edge/index.rst new file mode 100644 index 0000000000..101af8f60d --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/designer/edge/index.rst @@ -0,0 +1,144 @@ + + + +Module ``edge`` +=============== + + + +.. py:module:: ansys.geometry.core.designer.edge + + + +Description +----------- + +Module for managing an edge. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + +Classes +~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.designer.edge.CurveType + ansys.geometry.core.designer.edge.Edge + + + + +.. py:class:: CurveType + + + Bases: :py:obj:`enum.Enum` + + Provides values for the curve types supported by the Geometry service. + + .. py:attribute:: CURVETYPE_UNKNOWN + :value: 0 + + + + .. py:attribute:: CURVETYPE_LINE + :value: 1 + + + + .. py:attribute:: CURVETYPE_CIRCLE + :value: 2 + + + + .. py:attribute:: CURVETYPE_ELLIPSE + :value: 3 + + + + .. py:attribute:: CURVETYPE_NURBS + :value: 4 + + + + .. py:attribute:: CURVETYPE_PROCEDURAL + :value: 5 + + + + +.. py:class:: Edge(id: str, curve_type: CurveType, body: ansys.geometry.core.designer.body.Body, grpc_client: ansys.geometry.core.connection.GrpcClient) + + + Represents a single edge of a body within the design assembly. + + This class synchronizes to a design within a supporting Geometry service instance. + + Parameters + ---------- + id : str + Server-defined ID for the body. + curve_type : CurveType + Type of curve that the edge forms. + body : Body + Parent body that the edge constructs. + grpc_client : GrpcClient + Active supporting Geometry service instance for design modeling. + + .. py:property:: id + :type: str + + ID of the edge. + + + .. py:property:: length + :type: pint.Quantity + + Calculated length of the edge. + + + .. py:property:: curve_type + :type: CurveType + + Curve type of the edge. + + + .. py:property:: faces + :type: beartype.typing.List[ansys.geometry.core.designer.face.Face] + + Faces that contain the edge. + + + diff --git a/doc/source/autoapi/ansys/geometry/core/designer/face/index.rst b/doc/source/autoapi/ansys/geometry/core/designer/face/index.rst new file mode 100644 index 0000000000..b69f7ded05 --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/designer/face/index.rst @@ -0,0 +1,294 @@ + + + +Module ``face`` +=============== + + + +.. py:module:: ansys.geometry.core.designer.face + + + +Description +----------- + +Module for managing a face. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + +Classes +~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.designer.face.SurfaceType + ansys.geometry.core.designer.face.FaceLoopType + ansys.geometry.core.designer.face.FaceLoop + ansys.geometry.core.designer.face.Face + + + + +.. py:class:: SurfaceType + + + Bases: :py:obj:`enum.Enum` + + Provides values for the surface types supported by the Geometry service. + + .. py:attribute:: SURFACETYPE_UNKNOWN + :value: 0 + + + + .. py:attribute:: SURFACETYPE_PLANE + :value: 1 + + + + .. py:attribute:: SURFACETYPE_CYLINDER + :value: 2 + + + + .. py:attribute:: SURFACETYPE_CONE + :value: 3 + + + + .. py:attribute:: SURFACETYPE_TORUS + :value: 4 + + + + .. py:attribute:: SURFACETYPE_SPHERE + :value: 5 + + + + .. py:attribute:: SURFACETYPE_NURBS + :value: 6 + + + + .. py:attribute:: SURFACETYPE_PROCEDURAL + :value: 7 + + + + +.. py:class:: FaceLoopType + + + Bases: :py:obj:`enum.Enum` + + Provides values for the face loop types supported by the Geometry service. + + .. py:attribute:: INNER_LOOP + :value: 'INNER' + + + + .. py:attribute:: OUTER_LOOP + :value: 'OUTER' + + + + +.. py:class:: FaceLoop(type: FaceLoopType, length: pint.Quantity, min_bbox: ansys.geometry.core.math.Point3D, max_bbox: ansys.geometry.core.math.Point3D, edges: beartype.typing.List[ansys.geometry.core.designer.edge.Edge]) + + + Provides an internal class holding the face loops defined on the server side. + + Notes + ----- + This class is to be used only when parsing server side results. It is not + intended to be instantiated by a user. + + Parameters + ---------- + type : FaceLoopType + Type of loop. + length : Quantity + Length of the loop. + min_bbox : Point3D + Minimum point of the bounding box containing the loop. + max_bbox : Point3D + Maximum point of the bounding box containing the loop. + edges : List[Edge] + Edges contained in the loop. + + .. py:property:: type + :type: FaceLoopType + + Type of the loop. + + + .. py:property:: length + :type: pint.Quantity + + Length of the loop. + + + .. py:property:: min_bbox + :type: ansys.geometry.core.math.Point3D + + Minimum point of the bounding box containing the loop. + + + .. py:property:: max_bbox + :type: ansys.geometry.core.math.Point3D + + Maximum point of the bounding box containing the loop. + + + .. py:property:: edges + :type: beartype.typing.List[ansys.geometry.core.designer.edge.Edge] + + Edges contained in the loop. + + + +.. py:class:: Face(id: str, surface_type: SurfaceType, body: ansys.geometry.core.designer.body.Body, grpc_client: ansys.geometry.core.connection.GrpcClient) + + + Represents a single face of a body within the design assembly. + + This class synchronizes to a design within a supporting Geometry service instance. + + Parameters + ---------- + id : str + Server-defined ID for the body. + surface_type : SurfaceType + Type of surface that the face forms. + body : Body + Parent body that the face constructs. + grpc_client : GrpcClient + Active supporting Geometry service instance for design modeling. + + .. py:property:: id + :type: str + + Face ID. + + + .. py:property:: body + :type: ansys.geometry.core.designer.body.Body + + Body that the face belongs to. + + + .. py:property:: area + :type: pint.Quantity + + Calculated area of the face. + + + .. py:property:: surface_type + :type: SurfaceType + + Surface type of the face. + + + .. py:property:: edges + :type: beartype.typing.List[ansys.geometry.core.designer.edge.Edge] + + List of all edges of the face. + + + .. py:property:: loops + :type: beartype.typing.List[FaceLoop] + + List of all loops of the face. + + + .. py:method:: face_normal(u: float = 0.5, v: float = 0.5) -> ansys.geometry.core.math.UnitVector3D + + Get the normal direction to the face evaluated at certain UV coordinates. + + Notes + ----- + To properly use this method, you must handle UV coordinates. Thus, you must + know how these relate to the underlying Geometry service. It is an advanced + method for Geometry experts only. + + Parameters + ---------- + u : float, default: 0.5 + First coordinate of the 2D representation of a surface in UV space. + The default is ``0.5``, which is the center of the surface. + v : float, default: 0.5 + Second coordinate of the 2D representation of a surface in UV space. + The default is ``0.5``, which is the center of the surface. + + Returns + ------- + UnitVector3D + :class:`UnitVector3D ` + object evaluated at the given U and V coordinates. + This :class:`UnitVector3D ` + object is perpendicular to the surface at the given UV coordinates. + + + .. py:method:: face_point(u: float = 0.5, v: float = 0.5) -> ansys.geometry.core.math.Point3D + + Get a point of the face evaluated at certain UV coordinates. + + Notes + ----- + To properly use this method, you must handle UV coordinates. Thus, you must + know how these relate to the underlying Geometry service. It is an advanced + method for Geometry experts only. + + Parameters + ---------- + u : float, default: 0.5 + First coordinate of the 2D representation of a surface in UV space. + The default is ``0.5``, which is the center of the surface. + v : float, default: 0.5 + Second coordinate of the 2D representation of a surface in UV space. + The default is ``0.5``, which is the center of the surface. + + Returns + ------- + Point + :class:`Point3D ` + object evaluated at the given UV coordinates. + + + diff --git a/doc/source/autoapi/ansys/geometry/core/designer/index.rst b/doc/source/autoapi/ansys/geometry/core/designer/index.rst new file mode 100644 index 0000000000..ca401c2d56 --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/designer/index.rst @@ -0,0 +1,122 @@ + + + +Package ``designer`` +==================== + + + +.. py:module:: ansys.geometry.core.designer + + + +Description +----------- + +PyGeometry designer subpackage. + + + + +Summary +------- + +.. tab-set:: + + + .. tab-item:: Submodules + + .. list-table:: + :header-rows: 0 + :widths: auto + + * - :py:mod:`ansys.geometry.core.designer.beam` + - Provides for creating and managing a beam. + * - :py:mod:`ansys.geometry.core.designer.body` + - Provides for managing a body. + * - :py:mod:`ansys.geometry.core.designer.component` + - Provides for managing components. + * - :py:mod:`ansys.geometry.core.designer.coordinate_system` + - Provides for managing a user-defined coordinate system. + * - :py:mod:`ansys.geometry.core.designer.design` + - Provides for managing designs. + * - :py:mod:`ansys.geometry.core.designer.designpoint` + - Module for creating and managing design points. + * - :py:mod:`ansys.geometry.core.designer.edge` + - Module for managing an edge. + * - :py:mod:`ansys.geometry.core.designer.face` + - Module for managing a face. + * - :py:mod:`ansys.geometry.core.designer.part` + - Module providing fundamental data of an assembly. + * - :py:mod:`ansys.geometry.core.designer.selection` + - Module for creating a named selection. + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Submodules +---------- + +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Name + - Description + * - :py:mod:`ansys.geometry.core.designer.beam` + - Provides for creating and managing a beam. + * - :py:mod:`ansys.geometry.core.designer.body` + - Provides for managing a body. + * - :py:mod:`ansys.geometry.core.designer.component` + - Provides for managing components. + * - :py:mod:`ansys.geometry.core.designer.coordinate_system` + - Provides for managing a user-defined coordinate system. + * - :py:mod:`ansys.geometry.core.designer.design` + - Provides for managing designs. + * - :py:mod:`ansys.geometry.core.designer.designpoint` + - Module for creating and managing design points. + * - :py:mod:`ansys.geometry.core.designer.edge` + - Module for managing an edge. + * - :py:mod:`ansys.geometry.core.designer.face` + - Module for managing a face. + * - :py:mod:`ansys.geometry.core.designer.part` + - Module providing fundamental data of an assembly. + * - :py:mod:`ansys.geometry.core.designer.selection` + - Module for creating a named selection. + +.. toctree:: + :titlesonly: + :maxdepth: 1 + :hidden: + + beam + body + component + coordinate_system + design + designpoint + edge + face + part + selection + + diff --git a/doc/source/autoapi/ansys/geometry/core/designer/part/index.rst b/doc/source/autoapi/ansys/geometry/core/designer/part/index.rst new file mode 100644 index 0000000000..54651e839e --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/designer/part/index.rst @@ -0,0 +1,171 @@ + + + +Module ``part`` +=============== + + + +.. py:module:: ansys.geometry.core.designer.part + + + +Description +----------- + +Module providing fundamental data of an assembly. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + +Classes +~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.designer.part.Part + ansys.geometry.core.designer.part.MasterComponent + + + + +.. py:class:: Part(id: str, name: str, components: beartype.typing.List[MasterComponent], bodies: beartype.typing.List[ansys.geometry.core.designer.body.MasterBody]) + + + Represents a part master. + + This class should not be accessed by users. The ``Part`` class holds fundamental + data of an assembly. + + Parameters + ---------- + id : str + Unique identifier for the part. + name : str + Name of the part. + components : List[MasterComponent] + List of ``MasterComponent`` children that the part contains. + bodies : List[MasterBody] + List of ``MasterBody`` children that the part contains. These are master bodies. + + .. py:property:: id + :type: str + + ID of the part. + + + .. py:property:: name + :type: str + + Name of the part. + + + .. py:property:: components + :type: beartype.typing.List[MasterComponent] + + ``MasterComponent`` children that the part contains. + + + .. py:property:: bodies + :type: beartype.typing.List[ansys.geometry.core.designer.body.MasterBody] + + ``MasterBody`` children that the part contains. + + These are master bodies. + + + .. py:method:: __repr__() -> str + + Represent the part as a string. + + + +.. py:class:: MasterComponent(id: str, name: str, part: Part, transform: ansys.geometry.core.math.Matrix44 = IDENTITY_MATRIX44) + + + Represents a part occurrence. + + Notes + ----- + This class should not be accessed by users. It holds the fundamental data of + an assembly. Master components wrap parts by adding a transform matrix. + + Parameters + ---------- + id : str + Unique identifier for the transformed part. + name : str + Name of the transformed part. + part : Part + Reference to the transformed part's master part. + transform : Matrix44 + 4x4 transformation matrix from the master part. + + .. py:property:: id + :type: str + + ID of the transformed part. + + + .. py:property:: name + :type: str + + Name of the transformed part. + + + .. py:property:: occurrences + :type: beartype.typing.List[ansys.geometry.core.designer.component.Component] + + List of all occurrences of the component. + + + .. py:property:: part + :type: Part + + Master part of the transformed part. + + + .. py:property:: transform + :type: ansys.geometry.core.math.Matrix44 + + 4x4 transformation matrix from the master part. + + + .. py:method:: __repr__() -> str + + Represent the master component as a string. + + + diff --git a/doc/source/autoapi/ansys/geometry/core/designer/selection/index.rst b/doc/source/autoapi/ansys/geometry/core/designer/selection/index.rst new file mode 100644 index 0000000000..396f15c6d3 --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/designer/selection/index.rst @@ -0,0 +1,102 @@ + + + +Module ``selection`` +==================== + + + +.. py:module:: ansys.geometry.core.designer.selection + + + +Description +----------- + +Module for creating a named selection. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + +Classes +~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.designer.selection.NamedSelection + + + + +.. py:class:: NamedSelection(name: str, grpc_client: ansys.geometry.core.connection.GrpcClient, bodies: beartype.typing.Optional[beartype.typing.List[ansys.geometry.core.designer.body.Body]] = None, faces: beartype.typing.Optional[beartype.typing.List[ansys.geometry.core.designer.face.Face]] = None, edges: beartype.typing.Optional[beartype.typing.List[ansys.geometry.core.designer.edge.Edge]] = None, beams: beartype.typing.Optional[beartype.typing.List[ansys.geometry.core.designer.beam.Beam]] = None, design_points: beartype.typing.Optional[beartype.typing.List[ansys.geometry.core.designer.designpoint.DesignPoint]] = None, preexisting_id: beartype.typing.Optional[str] = None) + + + Represents a single named selection within the design assembly. + + This class synchronizes to a design within a supporting Geometry service instance. + + A named selection organizes one or more design entities together for common actions + against the entire group. + + Parameters + ---------- + name : str + User-defined name for the named selection. + grpc_client : GrpcClient + Active supporting Geometry service instance for design modeling. + bodies : List[Body], default: None + All bodies to include in the named selection. + faces : List[Face], default: None + All faces to include in the named selection. + edges : List[Edge], default: None + All edges to include in the named selection. + beams : List[Beam], default: None + All beams to include in the named selection. + design_points : List[DesignPoints], default: None + All design points to include in the named selection. + + .. py:property:: id + :type: str + + ID of the named selection. + + + .. py:property:: name + :type: str + + Name of the named selection. + + + diff --git a/doc/source/autoapi/ansys/geometry/core/errors/index.rst b/doc/source/autoapi/ansys/geometry/core/errors/index.rst new file mode 100644 index 0000000000..b1e11d0242 --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/errors/index.rst @@ -0,0 +1,113 @@ + + + +Module ``errors`` +================= + + + +.. py:module:: ansys.geometry.core.errors + + + +Description +----------- + +Provides PyGeometry-specific errors. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + + +Functions +~~~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.errors.handler + ansys.geometry.core.errors.protect_grpc + + + +Attributes +~~~~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.errors.SIGINT_TRACKER + + +.. py:data:: SIGINT_TRACKER + :value: [] + + + +.. py:exception:: GeometryRuntimeError + + + Bases: :py:obj:`RuntimeError` + + Provides error message to raise when Geometry service passes a runtime error. + + +.. py:exception:: GeometryExitedError(msg='Geometry service has exited.') + + + Bases: :py:obj:`RuntimeError` + + Provides error message to raise when Geometry service has exited. + + Parameters + ---------- + msg : str, default: "Geometry service has exited." + Message to raise. + + +.. py:function:: handler(sig, frame) + + Pass signal to the custom interrupt handler. + + +.. py:function:: protect_grpc(func) + + Capture gRPC exceptions and raise a more succinct error message. + + This method captures the ``KeyboardInterrupt`` exception to avoid + segfaulting the Geometry service. + + While this works some of the time, it does not work all of the time. For some + reason, gRPC still captures SIGINT. + + diff --git a/doc/source/autoapi/ansys/geometry/core/index.rst b/doc/source/autoapi/ansys/geometry/core/index.rst new file mode 100644 index 0000000000..bbb923151e --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/index.rst @@ -0,0 +1,167 @@ + +ansys.geometry.core +=================== + + +.. py:module:: ansys.geometry.core + + + +Description +----------- + +PyGeometry is a Python wrapper for the Ansys Geometry service. + + + + +Summary +------- + +.. tab-set:: + + .. tab-item:: Subpackages + + .. list-table:: + :header-rows: 0 + :widths: auto + + * - :py:mod:`ansys.geometry.core.connection` + - PyGeometry connection subpackage. + * - :py:mod:`ansys.geometry.core.designer` + - PyGeometry designer subpackage. + * - :py:mod:`ansys.geometry.core.materials` + - PyGeometry materials subpackage. + * - :py:mod:`ansys.geometry.core.math` + - PyGeometry math subpackage. + * - :py:mod:`ansys.geometry.core.misc` + - Provides the PyGeometry miscellaneous subpackage. + * - :py:mod:`ansys.geometry.core.plotting` + - Provides the PyGeometry plotting subpackage. + * - :py:mod:`ansys.geometry.core.primitives` + - PyGeometry primitives subpackage. + * - :py:mod:`ansys.geometry.core.sketch` + - PyGeometry sketch subpackage. + + .. tab-item:: Submodules + + .. list-table:: + :header-rows: 0 + :widths: auto + + * - :py:mod:`ansys.geometry.core.errors` + - Provides PyGeometry-specific errors. + * - :py:mod:`ansys.geometry.core.logger` + - Provides a general framework for logging in PyGeometry. + * - :py:mod:`ansys.geometry.core.modeler` + - Provides for interacting with the Geometry service. + * - :py:mod:`ansys.geometry.core.typing` + - Provides typing of values for PyGeometry. + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + +Subpackages +----------- + +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Name + - Description + * - :py:mod:`ansys.geometry.core.connection` + - PyGeometry connection subpackage. + * - :py:mod:`ansys.geometry.core.designer` + - PyGeometry designer subpackage. + * - :py:mod:`ansys.geometry.core.materials` + - PyGeometry materials subpackage. + * - :py:mod:`ansys.geometry.core.math` + - PyGeometry math subpackage. + * - :py:mod:`ansys.geometry.core.misc` + - Provides the PyGeometry miscellaneous subpackage. + * - :py:mod:`ansys.geometry.core.plotting` + - Provides the PyGeometry plotting subpackage. + * - :py:mod:`ansys.geometry.core.primitives` + - PyGeometry primitives subpackage. + * - :py:mod:`ansys.geometry.core.sketch` + - PyGeometry sketch subpackage. + +.. toctree:: + :titlesonly: + :maxdepth: 1 + :hidden: + + connection + designer + materials + math + misc + plotting + primitives + sketch + + + + + + +Submodules +---------- + +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Name + - Description + * - :py:mod:`ansys.geometry.core.errors` + - Provides PyGeometry-specific errors. + * - :py:mod:`ansys.geometry.core.logger` + - Provides a general framework for logging in PyGeometry. + * - :py:mod:`ansys.geometry.core.modeler` + - Provides for interacting with the Geometry service. + * - :py:mod:`ansys.geometry.core.typing` + - Provides typing of values for PyGeometry. + +.. toctree:: + :titlesonly: + :maxdepth: 1 + :hidden: + + errors + logger + modeler + typing + + +Contents +-------- + +.. py:data:: __version__ + + PyGeometry version. + + +.. py:data:: USE_TRAME + :value: False + + Global constant for checking whether to use `trame `_ + for visualization. + + diff --git a/doc/source/autoapi/ansys/geometry/core/logger/index.rst b/doc/source/autoapi/ansys/geometry/core/logger/index.rst new file mode 100644 index 0000000000..5987f67cec --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/logger/index.rst @@ -0,0 +1,565 @@ + + + +Module ``logger`` +================= + + + +.. py:module:: ansys.geometry.core.logger + + + +Description +----------- + +Provides a general framework for logging in PyGeometry. + +This module is built on the `Logging facility for +Python `_. +It is not intended to replace the standard Python logging library but rather provide +a way to interact between its ``logging`` class and PyGeometry. + +The loggers used in this module include the name of the instance, which +is intended to be unique. This name is printed in all active +outputs and is used to track the different Geometry service instances. + + +Logger usage +------------ + +Global logger +~~~~~~~~~~~~~ +There is a global logger named ``PyGeometry_global`` that is created when +``ansys.geometry.core.__init__`` is called. If you want to use this global +logger, you must call it at the top of your module: + +.. code:: python + + from ansys.geometry.core import LOG + +You can rename this logger to avoid conflicts with other loggers (if any): + +.. code:: python + + from ansys.geometry.core import LOG as logger + + +The default logging level of ``LOG`` is ``ERROR``. +You can change this level and output lower-level messages with +this code: + +.. code:: python + + LOG.logger.setLevel("DEBUG") + LOG.file_handler.setLevel("DEBUG") # If present. + LOG.stdout_handler.setLevel("DEBUG") # If present. + + +Alternatively, you can ensure that all the handlers are set to the input log +level with this code: + +.. code:: python + + LOG.setLevel("DEBUG") + +This logger does not log to a file by default. If you want, you can +add a file handler with this code: + +.. code:: python + + import os + + file_path = os.path.join(os.getcwd(), "pygeometry.log") + LOG.log_to_file(file_path) + +This also sets the logger to be redirected to this file. If you want +to change the characteristics of this global logger from the beginning +of the execution, you must edit the ``__init__`` file in the directory +``ansys.geometry.core``. + +To log using this logger, call the desired method as a normal logger with: + +.. code:: pycon + + >>> import logging + >>> from ansys.geometry.core.logging import Logger + >>> LOG = Logger(level=logging.DEBUG, to_file=False, to_stdout=True) + >>> LOG.debug("This is LOG debug message.") + + DEBUG - - - - This is LOG debug message. + + +Instance logger +~~~~~~~~~~~~~~~ +Every time an instance of the :class:`Modeler ` +class is created, a logger is created and stored in ``LOG._instances``. This field is a +dictionary where the key is the name of the created logger. + +These instance loggers inherit the ``PyGeometry_global`` output handlers and +logging level unless otherwise specified. The way this logger works is very +similar to the global logger. If you want to add a file handler, you can use +the :func:`log_to_file() ` method. If you want +to change the log level, you can use the :func:`logger.Logging.setLevel` method. + +Here is an example of how you can use this logger: + +.. code:: pycon + + >>> from ansys.geometry.core import Modeler + >>> modeler = Modeler() + >>> modeler._log.info("This is a useful message") + + INFO - GRPC_127.0.0.1:50056 - <...> - - This is a useful message + + +Other loggers +~~~~~~~~~~~~~ +You can create your own loggers using a Python ``logging`` library as +you would do in any other script. There would be no conflicts between +these loggers. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + +Classes +~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.logger.PyGeometryCustomAdapter + ansys.geometry.core.logger.PyGeometryPercentStyle + ansys.geometry.core.logger.PyGeometryFormatter + ansys.geometry.core.logger.InstanceFilter + ansys.geometry.core.logger.Logger + + + +Functions +~~~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.logger.addfile_handler + ansys.geometry.core.logger.add_stdout_handler + + + +Attributes +~~~~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.logger.LOG_LEVEL + ansys.geometry.core.logger.FILE_NAME + ansys.geometry.core.logger.DEBUG + ansys.geometry.core.logger.INFO + ansys.geometry.core.logger.WARN + ansys.geometry.core.logger.ERROR + ansys.geometry.core.logger.CRITICAL + ansys.geometry.core.logger.STDOUT_MSG_FORMAT + ansys.geometry.core.logger.FILE_MSG_FORMAT + ansys.geometry.core.logger.DEFAULT_STDOUT_HEADER + ansys.geometry.core.logger.DEFAULT_FILE_HEADER + ansys.geometry.core.logger.NEW_SESSION_HEADER + ansys.geometry.core.logger.string_to_loglevel + ansys.geometry.core.logger.LOG + + +.. py:data:: LOG_LEVEL + + + +.. py:data:: FILE_NAME + :value: 'pygeometry.log' + + + +.. py:data:: DEBUG + + + +.. py:data:: INFO + + + +.. py:data:: WARN + + + +.. py:data:: ERROR + + + +.. py:data:: CRITICAL + + + +.. py:data:: STDOUT_MSG_FORMAT + :value: '%(levelname)s - %(instance_name)s - %(module)s - %(funcName)s - %(message)s' + + + +.. py:data:: FILE_MSG_FORMAT + + + +.. py:data:: DEFAULT_STDOUT_HEADER + :value: Multiline-String + + .. raw:: html + +
Show Value + + .. code-block:: python + + """ + LEVEL - INSTANCE NAME - MODULE - FUNCTION - MESSAGE + """ + + .. raw:: html + +
+ + + +.. py:data:: DEFAULT_FILE_HEADER + + + +.. py:data:: NEW_SESSION_HEADER + + + +.. py:data:: string_to_loglevel + + + +.. py:class:: PyGeometryCustomAdapter(logger, extra=None) + + + Bases: :py:obj:`logging.LoggerAdapter` + + Keeps the reference to the Geometry service instance name dynamic. + + If you use the standard approach, which is supplying *extra* input to the logger, + you must input Geometry service instances each time you do a log. + + Using adapters, you only need to specify the Geometry service instance that you are + referring to once. + + .. py:attribute:: level + + + + .. py:attribute:: file_handler + + + + .. py:attribute:: stdout_handler + + + + .. py:method:: process(msg, kwargs) + + Process the logging message and keyword arguments passed in to + a logging call to insert contextual information. You can either + manipulate the message itself, the keyword args or both. Return + the message and kwargs modified (or not) to suit your needs. + + Normally, you'll only need to override this one method in a + LoggerAdapter subclass for your specific needs. + + + .. py:method:: log_to_file(filename: str = FILE_NAME, level: int = LOG_LEVEL) + + Add a file handler to the logger. + + Parameters + ---------- + filename : str, default: "pygeometry.log" + Name of the file to write log messages to. + level : int, default: 10 + Level of logging. The default is ``10``, in which case the + ``logging.DEBUG`` level is used. + + + .. py:method:: log_to_stdout(level=LOG_LEVEL) + + Add a standard output handler to the logger. + + Parameters + ---------- + level : int, default: 10 + Level of logging. The default is ``10``, in which case the + ``logging.DEBUG`` level is used. + + + .. py:method:: setLevel(level='DEBUG') + + Change the log level of the object and the attached handlers. + + Parameters + ---------- + level : int, default: 10 + Level of logging. The default is ``10``, in which case the + ``logging.DEBUG`` level is used. + + + +.. py:class:: PyGeometryPercentStyle(fmt, *, defaults=None) + + + Bases: :py:obj:`logging.PercentStyle` + + Provides a common messaging style for the ``PyGeometryFormatter`` class. + + +.. py:class:: PyGeometryFormatter(fmt=STDOUT_MSG_FORMAT, datefmt=None, style='%', validate=True, defaults=None) + + + Bases: :py:obj:`logging.Formatter` + + Provides a ``Formatter`` class for overwriting default format styles. + + +.. py:class:: InstanceFilter(name='') + + + Bases: :py:obj:`logging.Filter` + + Ensures that the ``instance_name`` record always exists. + + .. py:method:: filter(record) + + Ensure that the ``instance_name`` attribute is always present. + + + +.. py:class:: Logger(level=logging.DEBUG, to_file=False, to_stdout=True, filename=FILE_NAME) + + + Provides the logger used for each PyGeometry session. + + This class allows you to add handlers to the logger to output messages + to a file or to the standard output (stdout). + + Parameters + ---------- + level : int, default: 10 + Logging level to filter the message severity allowed in the logger. + The default is ``10``, in which case the ``logging.DEBUG`` level + is used. + to_file : bool, default: False + Whether to write log messages to a file. + to_stdout : bool, default: True + Whether to write log messages to the standard output. + filename : str, default: "pygeometry.log" + Name of the file to write log log messages to. + + Examples + -------- + Demonstrate logger usage from the ``Modeler`` instance, which is automatically + created when a Geometry service instance is created. + + >>> from ansys.geometry.core import Modeler + >>> modeler = Modeler(loglevel='DEBUG') + >>> modeler._log.info('This is a useful message') + INFO - - - - This is LOG debug message. + + Import the global PyGeometry logger and add a file output handler. + + >>> import os + >>> from ansys.geometry.core import LOG + >>> file_path = os.path.join(os.getcwd(), 'pygeometry.log') + >>> LOG.log_to_file(file_path) + + .. py:attribute:: file_handler + + + + .. py:attribute:: std_out_handler + + + + .. py:method:: log_to_file(filename=FILE_NAME, level=LOG_LEVEL) + + Add a file handler to the logger. + + Parameters + ---------- + filename : str, default: "pygeometry.log" + Name of the file to write log messages to. + level : int, default: 10 + Level of logging. The default is ``10``, in which case the + ``logging.DEBUG`` level is used. + + Examples + -------- + Write to the ``"pygeometry.log"`` file in the current working directory: + + >>> from ansys.geometry.core import LOG + >>> import os + >>> file_path = os.path.join(os.getcwd(), 'pygeometry.log') + >>> LOG.log_to_file(file_path) + + + .. py:method:: log_to_stdout(level=LOG_LEVEL) + + Add the standard output handler to the logger. + + Parameters + ---------- + level : int, default: 10 + Level of logging. The default is ``10``, in which case the + ``logging.DEBUG`` level is used. + + + .. py:method:: setLevel(level='DEBUG') + + Change the log level of the object and the attached handlers. + + + .. py:method:: add_child_logger(sufix: str, level: beartype.typing.Optional[str] = None) + + Add a child logger to the main logger. + + This logger is more general than an instance logger, which is designed to + track the state of Geometry service instances. + + If the logging level is in the arguments, a new logger with a reference + to the ``_global`` logger handlers is created instead of a child logger. + + Parameters + ---------- + sufix : str + Name of the child logger. + level : str, default: None + Level of logging. + + Returns + ------- + logging.logger + Logger class. + + + .. py:method:: add_instance_logger(name: str, client_instance: ansys.geometry.core.connection.client.GrpcClient, level: beartype.typing.Optional[int] = None) -> PyGeometryCustomAdapter + + Add a logger for a Geometry service instance. + + The Geometry service instance logger is a logger with an adapter that adds + contextual information such as the Geometry service instance name. This logger is + returned, and you can use it to log events as a normal logger. It is + stored in the ``_instances`` field. + + Parameters + ---------- + name : str + Name for the new instance logger. + client_instance : GrpcClient + Geometry service GrpcClient object, which should contain the ``get_name`` method. + level : int, default: None + Level of logging. + + Returns + ------- + PyGeometryCustomAdapter + Logger adapter customized to add Geometry service information to the + logs. You can use this class to log events in the same + way you would with the ``Logger`` class. + + + .. py:method:: __getitem__(key) + + Overload the access method by item for the ``Logger`` class. + + + .. py:method:: add_handling_uncaught_expections(logger) + + Redirect the output of an exception to a logger. + + Parameters + ---------- + logger : str + Name of the logger. + + + +.. py:function:: addfile_handler(logger, filename=FILE_NAME, level=LOG_LEVEL, write_headers=False) + + Add a file handler to the input. + + Parameters + ---------- + logger : logging.Logger + Logger to add the file handler to. + filename : str, default: "pygeometry.log" + Name of the output file. + level : int, default: 10 + Level of logging. The default is ``10``, in which case the + ``logging.DEBUG`` level is used. + write_headers : bool, default: False + Whether to write the headers to the file. + + Returns + ------- + logger + Logger or Logger object. + + +.. py:function:: add_stdout_handler(logger, level=LOG_LEVEL, write_headers=False) + + Add a standout handler to the logger. + + Parameters + ---------- + logger : logging.Logger + Logger to add the file handler to. + level : int, default: 10 + Level of logging. The default is ``10``, in which case the + ``logging.DEBUG`` level is used. + write_headers : bool, default: False + Whether to write headers to the file. + + Returns + ------- + logger + Logger or Logger object. + + +.. py:data:: LOG + + + diff --git a/doc/source/autoapi/ansys/geometry/core/materials/index.rst b/doc/source/autoapi/ansys/geometry/core/materials/index.rst new file mode 100644 index 0000000000..babd23e416 --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/materials/index.rst @@ -0,0 +1,82 @@ + + + +Package ``materials`` +===================== + + + +.. py:module:: ansys.geometry.core.materials + + + +Description +----------- + +PyGeometry materials subpackage. + + + + +Summary +------- + +.. tab-set:: + + + .. tab-item:: Submodules + + .. list-table:: + :header-rows: 0 + :widths: auto + + * - :py:mod:`ansys.geometry.core.materials.material` + - Provides the data structure for material and for adding a material property. + * - :py:mod:`ansys.geometry.core.materials.property` + - Provides the ``MaterialProperty`` class. + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Submodules +---------- + +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Name + - Description + * - :py:mod:`ansys.geometry.core.materials.material` + - Provides the data structure for material and for adding a material property. + * - :py:mod:`ansys.geometry.core.materials.property` + - Provides the ``MaterialProperty`` class. + +.. toctree:: + :titlesonly: + :maxdepth: 1 + :hidden: + + material + property + + diff --git a/doc/source/autoapi/ansys/geometry/core/materials/material/index.rst b/doc/source/autoapi/ansys/geometry/core/materials/material/index.rst new file mode 100644 index 0000000000..a49bbfbfa0 --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/materials/material/index.rst @@ -0,0 +1,103 @@ + + + +Module ``material`` +=================== + + + +.. py:module:: ansys.geometry.core.materials.material + + + +Description +----------- + +Provides the data structure for material and for adding a material property. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + +Classes +~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.materials.material.Material + + + + +.. py:class:: Material(name: str, density: pint.Quantity, additional_properties: beartype.typing.Optional[beartype.typing.Sequence[ansys.geometry.core.materials.property.MaterialProperty]] = None) + + + Provides the data structure for a material. + + Parameters + ---------- + name: str + Material name. + density: ~pint.Quantity + Material density. + additional_properties: Sequence[MaterialProperty], default: None + Additional material properties. + + .. py:property:: properties + :type: beartype.typing.Dict[ansys.geometry.core.materials.property.MaterialPropertyType, ansys.geometry.core.materials.property.MaterialProperty] + + Dictionary of the material property type and material properties. + + + .. py:property:: name + :type: str + + Material name. + + + .. py:method:: add_property(type: ansys.geometry.core.materials.property.MaterialPropertyType, name: str, quantity: pint.Quantity) -> None + + Add a material property to the ``Material`` class. + + Parameters + ---------- + type : MaterialPropertyType + Material property type. + name: str + Material name. + quantity: ~pint.Quantity + Material value and unit. + + + diff --git a/doc/source/autoapi/ansys/geometry/core/materials/property/index.rst b/doc/source/autoapi/ansys/geometry/core/materials/property/index.rst new file mode 100644 index 0000000000..580f7c1133 --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/materials/property/index.rst @@ -0,0 +1,154 @@ + + + +Module ``property`` +=================== + + + +.. py:module:: ansys.geometry.core.materials.property + + + +Description +----------- + +Provides the ``MaterialProperty`` class. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + +Classes +~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.materials.property.MaterialPropertyType + ansys.geometry.core.materials.property.MaterialProperty + + + + +.. py:class:: MaterialPropertyType + + + Bases: :py:obj:`enum.Enum` + + Provides an enum holding the possible values for ``MaterialProperty`` objects. + + .. py:attribute:: DENSITY + :value: 'Density' + + + + .. py:attribute:: ELASTIC_MODULUS + :value: 'ElasticModulus' + + + + .. py:attribute:: POISSON_RATIO + :value: 'PoissonsRatio' + + + + .. py:attribute:: SHEAR_MODULUS + :value: 'ShearModulus' + + + + .. py:attribute:: SPECIFIC_HEAT + :value: 'SpecificHeat' + + + + .. py:attribute:: TENSILE_STRENGTH + :value: 'TensileStrength' + + + + .. py:attribute:: THERMAL_CONDUCTIVITY + :value: 'ThermalConductivity' + + + + .. py:method:: from_id() -> MaterialPropertyType + + Return the ``MaterialPropertyType`` value from the service representation. + + Parameters + ---------- + id : str + Geometry Service string representation of a property type. + + Returns + ------- + MaterialPropertyType + Common name for property type. + + + +.. py:class:: MaterialProperty(type: MaterialPropertyType, name: str, quantity: pint.Quantity) + + + Provides the data structure for a material property. + + Parameters + ---------- + type : MaterialPropertyType + Type of the material property. + name: str + Material property name. + quantity: ~pint.Quantity + Value and unit. + + .. py:property:: type + :type: MaterialPropertyType + + Material property ID. + + + .. py:property:: name + :type: str + + Material property name. + + + .. py:property:: quantity + :type: pint.Quantity + + Material property quantity and unit. + + + diff --git a/doc/source/autoapi/ansys/geometry/core/math/bbox/index.rst b/doc/source/autoapi/ansys/geometry/core/math/bbox/index.rst new file mode 100644 index 0000000000..c573693766 --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/math/bbox/index.rst @@ -0,0 +1,207 @@ + + + +Module ``bbox`` +=============== + + + +.. py:module:: ansys.geometry.core.math.bbox + + + +Description +----------- + +Provides for managing a bounding box. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + +Classes +~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.math.bbox.BoundingBox2D + + + + +.. py:class:: BoundingBox2D(x_min: ansys.geometry.core.typing.Real = sys.float_info.max, x_max: ansys.geometry.core.typing.Real = sys.float_info.min, y_min: ansys.geometry.core.typing.Real = sys.float_info.max, y_max: ansys.geometry.core.typing.Real = sys.float_info.min) + + + Maintains the X and Y dimensions. + + Parameters + ---------- + x_min : Real + Minimum value for the x-dimensional bounds. + x_max : Real + Maximum value for the x-dimensional bounds. + y_min : Real + Minimum value for the y-dimensional bounds. + y_max : Real + Maximum value for the y-dimensional bounds. + + .. py:property:: x_min + :type: ansys.geometry.core.typing.Real + + Minimum value of X-dimensional bounds. + + Returns + ------- + Real + Minimum value of the X-dimensional bounds. + + + .. py:property:: x_max + :type: ansys.geometry.core.typing.Real + + Maximum value of the X-dimensional bounds. + + Returns + ------- + Real + Maximum value of the X-dimensional bounds. + + + .. py:property:: y_min + :type: ansys.geometry.core.typing.Real + + Minimum value of Y-dimensional bounds. + + Returns + ------- + Real + Minimum value of Y-dimensional bounds. + + + .. py:property:: y_max + :type: ansys.geometry.core.typing.Real + + Maximum value of Y-dimensional bounds. + + Returns + ------- + Real + Maximum value of Y-dimensional bounds. + + + .. py:method:: add_point(point: ansys.geometry.core.math.point.Point2D) -> None + + Extend the ranges of the bounding box to include a point. + + Notes + ----- + This method is only applicable if the point components are outside + the current bounds. + + Parameters + ---------- + point : Point2D + Point to include within the bounds. + + + .. py:method:: add_point_components(x: ansys.geometry.core.typing.Real, y: ansys.geometry.core.typing.Real) -> None + + Extend the ranges of the bounding box to include the X and Y values. + + Notes + ----- + This method is only applicable if the point components are outside + the current bounds. + + Parameters + ---------- + x : Real + Point X component to include within the bounds. + y : Real + Point Y component to include within the bounds. + + + .. py:method:: add_points(points: beartype.typing.List[ansys.geometry.core.math.point.Point2D]) -> None + + Extend the ranges of the bounding box to include given points. + + Parameters + ---------- + points : List[Point2D] + List of points to include within the bounds. + + + .. py:method:: contains_point(point: ansys.geometry.core.math.point.Point2D) -> bool + + Evaluate whether a provided point lies within the X and Y ranges of the bounds. + + Parameters + ---------- + point : Point2D + Point to compare against the bounds. + + Returns + ------- + bool + ``True`` if the point is contained in the bounding box. Otherwise, ``False``. + + + .. py:method:: contains_point_components(x: ansys.geometry.core.typing.Real, y: ansys.geometry.core.typing.Real) -> bool + + Check if point components are within current X and Y ranges of the bounds. + + Parameters + ---------- + x : Real + Point X component to compare against the bounds. + y : Real + Point Y component to compare against the bounds. + + Returns + ------- + bool + ``True`` if the components are contained in the bounding box. Otherwise, ``False``. + + + .. py:method:: __eq__(other: BoundingBox2D) -> bool + + Equals operator for the ``BoundingBox2D`` class. + + + .. py:method:: __ne__(other: BoundingBox2D) -> bool + + Not equals operator for the ``BoundingBox2D`` class. + + + diff --git a/doc/source/autoapi/ansys/geometry/core/math/constants/index.rst b/doc/source/autoapi/ansys/geometry/core/math/constants/index.rst new file mode 100644 index 0000000000..344c25868e --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/math/constants/index.rst @@ -0,0 +1,117 @@ + + + +Module ``constants`` +==================== + + + +.. py:module:: ansys.geometry.core.math.constants + + + +Description +----------- + +Provides mathematical constants. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + +.. py:data:: DEFAULT_POINT3D + + Default value for a 3D point. + + +.. py:data:: DEFAULT_POINT2D + + Default value for a 2D point. + + +.. py:data:: IDENTITY_MATRIX33 + + Identity for a ``Matrix33`` object. + + +.. py:data:: IDENTITY_MATRIX44 + + Identity for a ``Matrix44`` object. + + +.. py:data:: UNITVECTOR3D_X + + Default 3D unit vector in the Cartesian traditional X direction. + + +.. py:data:: UNITVECTOR3D_Y + + Default 3D unit vector in the Cartesian traditional Y direction. + + +.. py:data:: UNITVECTOR3D_Z + + Default 3D unit vector in the Cartesian traditional Z direction. + + +.. py:data:: UNITVECTOR2D_X + + Default 2D unit vector in the Cartesian traditional X direction. + + +.. py:data:: UNITVECTOR2D_Y + + Default 2D unit vector in the Cartesian traditional Y direction. + + +.. py:data:: ZERO_VECTOR3D + + Zero-valued ``Vector3D`` object. + + +.. py:data:: ZERO_VECTOR2D + + Zero-valued ``Vector2D`` object. + + +.. py:data:: ZERO_POINT3D + + Zero-valued ``Point3D`` object. + + +.. py:data:: ZERO_POINT2D + + Zero-valued ``Point2D`` object. + + diff --git a/doc/source/autoapi/ansys/geometry/core/math/frame/index.rst b/doc/source/autoapi/ansys/geometry/core/math/frame/index.rst new file mode 100644 index 0000000000..e13f5c4fa6 --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/math/frame/index.rst @@ -0,0 +1,166 @@ + + + +Module ``frame`` +================ + + + +.. py:module:: ansys.geometry.core.math.frame + + + +Description +----------- + +Provides for managing a frame. + + + + +Summary +------- + +.. tab-set:: + + + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Contents +-------- + +Classes +~~~~~~~ + +.. autoapisummary:: + + ansys.geometry.core.math.frame.Frame + + + + +.. py:class:: Frame(origin: beartype.typing.Union[numpy.ndarray, ansys.geometry.core.typing.RealSequence, ansys.geometry.core.math.point.Point3D] = ZERO_POINT3D, direction_x: beartype.typing.Union[numpy.ndarray, ansys.geometry.core.typing.RealSequence, ansys.geometry.core.math.vector.UnitVector3D, ansys.geometry.core.math.vector.Vector3D] = UNITVECTOR3D_X, direction_y: beartype.typing.Union[numpy.ndarray, ansys.geometry.core.typing.RealSequence, ansys.geometry.core.math.vector.UnitVector3D, ansys.geometry.core.math.vector.Vector3D] = UNITVECTOR3D_Y) + + + Primitive representation of a frame (an origin and three fundamental directions). + + Parameters + ---------- + origin : Union[~numpy.ndarray, RealSequence, Point3D], default: ZERO_POINT3D + Centered origin of the`frame. The default is ``ZERO_POINT3D``, which is the + Cartesian origin. + direction_x : Union[~numpy.ndarray, RealSequence, UnitVector3D, Vector3D], default: UNITVECTOR3D_X + X-axis direction. + direction_y : Union[~numpy.ndarray, RealSequence, UnitVector3D, Vector3D], default: UNITVECTOR3D_Y + Y-axis direction. + + .. py:property:: origin + :type: ansys.geometry.core.math.point.Point3D + + Origin of the frame. + + + .. py:property:: direction_x + :type: ansys.geometry.core.math.vector.UnitVector3D + + X-axis direction of the frame. + + + .. py:property:: direction_y + :type: ansys.geometry.core.math.vector.UnitVector3D + + Y-axis direction of the frame. + + + .. py:property:: direction_z + :type: ansys.geometry.core.math.vector.UnitVector3D + + Z-axis direction of the frame. + + + .. py:property:: global_to_local_rotation + :type: ansys.geometry.core.math.matrix.Matrix33 + + Global to local space transformation matrix. + + Returns + ------- + Matrix33 + 3x3 matrix representing the transformation from global to local + coordinate space, excluding origin translation. + + + .. py:property:: local_to_global_rotation + :type: ansys.geometry.core.math.matrix.Matrix33 + + Local to global space transformation matrix. + + Returns + ------- + Matrix33 + 3x3 matrix representing the transformation from local to global + coordinate space. + + + .. py:property:: transformation_matrix + :type: ansys.geometry.core.math.matrix.Matrix44 + + Full 4x4 transformation matrix. + + Returns + ------- + Matrix44 + 4x4 matrix representing the transformation from global to local + coordinate space. + + + .. py:method:: transform_point2d_local_to_global(point: ansys.geometry.core.math.point.Point2D) -> ansys.geometry.core.math.point.Point3D + + Transform a 2D point to a global 3D point. + + This method transforms a local, plane-contained ``Point2D`` object in the global + coordinate system, thus representing it as a ``Point3D`` object. + + Parameters + ---------- + point : Point2D + ``Point2D`` local object to express in global coordinates. + + Returns + ------- + Point3D + Global coordinates for the 3D point. + + + .. py:method:: __eq__(other: Frame) -> bool + + Equals operator for the ``Frame`` class. + + + .. py:method:: __ne__(other: Frame) -> bool + + Not equals operator for the ``Frame`` class. + + + diff --git a/doc/source/autoapi/ansys/geometry/core/math/index.rst b/doc/source/autoapi/ansys/geometry/core/math/index.rst new file mode 100644 index 0000000000..7731e70dc4 --- /dev/null +++ b/doc/source/autoapi/ansys/geometry/core/math/index.rst @@ -0,0 +1,107 @@ + + + +Package ``math`` +================ + + + +.. py:module:: ansys.geometry.core.math + + + +Description +----------- + +PyGeometry math subpackage. + + + + +Summary +------- + +.. tab-set:: + + + .. tab-item:: Submodules + + .. list-table:: + :header-rows: 0 + :widths: auto + + * - :py:mod:`ansys.geometry.core.math.bbox` + - Provides for managing a bounding box. + * - :py:mod:`ansys.geometry.core.math.constants` + - Provides mathematical constants. + * - :py:mod:`ansys.geometry.core.math.frame` + - Provides for managing a frame. + * - :py:mod:`ansys.geometry.core.math.matrix` + - Provides matrix primitive representations. + * - :py:mod:`ansys.geometry.core.math.plane` + - Provides primitive representation of a 2D plane in 3D space. + * - :py:mod:`ansys.geometry.core.math.point` + - Provides geometry primitive representation for 2D and 3D points. + * - :py:mod:`ansys.geometry.core.math.vector` + - Provides for creating and managing 2D and 3D vectors. + + + .. tab-item:: Classes + + Content 2 + + .. tab-item:: Functions + + Content 2 + + .. tab-item:: Enumerations + + Content 2 + + .. tab-item:: Attributes + + Content 2 + + + + + + +Submodules +---------- + +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Name + - Description + * - :py:mod:`ansys.geometry.core.math.bbox` + - Provides for managing a bounding box. + * - :py:mod:`ansys.geometry.core.math.constants` + - Provides mathematical constants. + * - :py:mod:`ansys.geometry.core.math.frame` + - Provides for managing a frame. + * - :py:mod:`ansys.geometry.core.math.matrix` + - Provides matrix primitive representations. + * - :py:mod:`ansys.geometry.core.math.plane` + - Provides primitive representation of a 2D plane in 3D space. + * - :py:mod:`ansys.geometry.core.math.point` + - Provides geometry primitive representation for 2D and 3D points. + * - :py:mod:`ansys.geometry.core.math.vector` + - Provides for creating and managing 2D and 3D vectors. + +.. toctree:: + :titlesonly: + :maxdepth: 1 + :hidden: + + bbox + constants + frame
- component - coordinate_system - design - designpoint - edge - face - part - selection - - diff --git a/doc/source/autoapi/ansys/geometry/core/designer/part/index.rst b/doc/source/autoapi/ansys/geometry/core/designer/part/index.rst deleted file mode 100644 index 54651e839e..0000000000 --- a/doc/source/autoapi/ansys/geometry/core/designer/part/index.rst +++ /dev/null @@ -1,171 +0,0 @@ - - - -Module ``part`` -=============== - - - -.. py:module:: ansys.geometry.core.designer.part - - - -Description ------------ - -Module providing fundamental data of an assembly. - - - - -Summary -------- - -.. tab-set:: - - - - - .. tab-item:: Classes - - Content 2 - - .. tab-item:: Functions - - Content 2 - - .. tab-item:: Enumerations - - Content 2 - - .. tab-item:: Attributes - - Content 2 - - - - - - -Contents --------- - -Classes -~~~~~~~ - -.. autoapisummary:: - - ansys.geometry.core.designer.part.Part - ansys.geometry.core.designer.part.MasterComponent - - - - -.. py:class:: Part(id: str, name: str, components: beartype.typing.List[MasterComponent], bodies: beartype.typing.List[ansys.geometry.core.designer.body.MasterBody]) - - - Represents a part master. - - This class should not be accessed by users. The ``Part`` class holds fundamental - data of an assembly. - - Parameters - ---------- - id : str - Unique identifier for the part. - name : str - Name of the part. - components : List[MasterComponent] - List of ``MasterComponent`` children that the part contains. - bodies : List[MasterBody] - List of ``MasterBody`` children that the part contains. These are master bodies. - - .. py:property:: id - :type: str - - ID of the part. - - - .. py:property:: name - :type: str - - Name of the part. - - - .. py:property:: components - :type: beartype.typing.List[MasterComponent] - - ``MasterComponent`` children that the part contains. - - - .. py:property:: bodies - :type: beartype.typing.List[ansys.geometry.core.designer.body.MasterBody] - - ``MasterBody`` children that the part contains. - - These are master bodies. - - - .. py:method:: __repr__() -> str - - Represent the part as a string. - - - -.. py:class:: MasterComponent(id: str, name: str, part: Part, transform: ansys.geometry.core.math.Matrix44 = IDENTITY_MATRIX44) - - - Represents a part occurrence. - - Notes - ----- - This class should not be accessed by users. It holds the fundamental data of - an assembly. Master components wrap parts by adding a transform matrix. - - Parameters - ---------- - id : str - Unique identifier for the transformed part. - name : str - Name of the transformed part. - part : Part - Reference to the transformed part's master part. - transform : Matrix44 - 4x4 transformation matrix from the master part. - - .. py:property:: id - :type: str - - ID of the transformed part. - - - .. py:property:: name - :type: str - - Name of the transformed part. - - - .. py:property:: occurrences - :type: beartype.typing.List[ansys.geometry.core.designer.component.Component] - - List of all occurrences of the component. - - - .. py:property:: part - :type: Part - - Master part of the transformed part. - - - .. py:property:: transform - :type: ansys.geometry.core.math.Matrix44 - - 4x4 transformation matrix from the master part. - - - .. py:method:: __repr__() -> str - - Represent the master component as a string. - - - diff --git a/doc/source/autoapi/ansys/geometry/core/designer/selection/index.rst b/doc/source/autoapi/ansys/geometry/core/designer/selection/index.rst deleted file mode 100644 index 396f15c6d3..0000000000 --- a/doc/source/autoapi/ansys/geometry/core/designer/selection/index.rst +++ /dev/null @@ -1,102 +0,0 @@ - - - -Module ``selection`` -==================== - - - -.. py:module:: ansys.geometry.core.designer.selection - - - -Description ------------ - -Module for creating a named selection. - - - - -Summary -------- - -.. tab-set:: - - - - - .. tab-item:: Classes - - Content 2 - - .. tab-item:: Functions - - Content 2 - - .. tab-item:: Enumerations - - Content 2 - - .. tab-item:: Attributes - - Content 2 - - - - - - -Contents --------- - -Classes -~~~~~~~ - -.. autoapisummary:: - - ansys.geometry.core.designer.selection.NamedSelection - - - - -.. py:class:: NamedSelection(name: str, grpc_client: ansys.geometry.core.connection.GrpcClient, bodies: beartype.typing.Optional[beartype.typing.List[ansys.geometry.core.designer.body.Body]] = None, faces: beartype.typing.Optional[beartype.typing.List[ansys.geometry.core.designer.face.Face]] = None, edges: beartype.typing.Optional[beartype.typing.List[ansys.geometry.core.designer.edge.Edge]] = None, beams: beartype.typing.Optional[beartype.typing.List[ansys.geometry.core.designer.beam.Beam]] = None, design_points: beartype.typing.Optional[beartype.typing.List[ansys.geometry.core.designer.designpoint.DesignPoint]] = None, preexisting_id: beartype.typing.Optional[str] = None) - - - Represents a single named selection within the design assembly. - - This class synchronizes to a design within a supporting Geometry service instance. - - A named selection organizes one or more design entities together for common actions - against the entire group. - - Parameters - ---------- - name : str - User-defined name for the named selection. - grpc_client : GrpcClient - Active supporting Geometry service instance for design modeling. - bodies : List[Body], default: None - All bodies to include in the named selection. - faces : List[Face], default: None - All faces to include in the named selection. - edges : List[Edge], default: None - All edges to include in the named selection. - beams : List[Beam], default: None - All beams to include in the named selection. - design_points : List[DesignPoints], default: None - All design points to include in the named selection. - - .. py:property:: id - :type: str - - ID of the named selection. - - - .. py:property:: name - :type: str - - Name of the named selection. - - - diff --git a/doc/source/autoapi/ansys/geometry/core/errors/index.rst b/doc/source/autoapi/ansys/geometry/core/errors/index.rst deleted file mode 100644 index b1e11d0242..0000000000 --- a/doc/source/autoapi/ansys/geometry/core/errors/index.rst +++ /dev/null @@ -1,113 +0,0 @@ - - - -Module ``errors`` -================= - - - -.. py:module:: ansys.geometry.core.errors - - - -Description ------------ - -Provides PyGeometry-specific errors. - - - - -Summary -------- - -.. tab-set:: - - - - - .. tab-item:: Classes - - Content 2 - - .. tab-item:: Functions - - Content 2 - - .. tab-item:: Enumerations - - Content 2 - - .. tab-item:: Attributes - - Content 2 - - - - - - -Contents --------- - - -Functions -~~~~~~~~~ - -.. autoapisummary:: - - ansys.geometry.core.errors.handler - ansys.geometry.core.errors.protect_grpc - - - -Attributes -~~~~~~~~~~ - -.. autoapisummary:: - - ansys.geometry.core.errors.SIGINT_TRACKER - - -.. py:data:: SIGINT_TRACKER - :value: [] - - - -.. py:exception:: GeometryRuntimeError - - - Bases: :py:obj:`RuntimeError` - - Provides error message to raise when Geometry service passes a runtime error. - - -.. py:exception:: GeometryExitedError(msg='Geometry service has exited.') - - - Bases: :py:obj:`RuntimeError` - - Provides error message to raise when Geometry service has exited. - - Parameters - ---------- - msg : str, default: "Geometry service has exited." - Message to raise. - - -.. py:function:: handler(sig, frame) - - Pass signal to the custom interrupt handler. - - -.. py:function:: protect_grpc(func) - - Capture gRPC exceptions and raise a more succinct error message. - - This method captures the ``KeyboardInterrupt`` exception to avoid - segfaulting the Geometry service. - - While this works some of the time, it does not work all of the time. For some - reason, gRPC still captures SIGINT. - - diff --git a/doc/source/autoapi/ansys/geometry/core/index.rst b/doc/source/autoapi/ansys/geometry/core/index.rst deleted file mode 100644 index bbb923151e..0000000000 --- a/doc/source/autoapi/ansys/geometry/core/index.rst +++ /dev/null @@ -1,167 +0,0 @@ - -ansys.geometry.core -=================== - - -.. py:module:: ansys.geometry.core - - - -Description ------------ - -PyGeometry is a Python wrapper for the Ansys Geometry service. - - - - -Summary -------- - -.. tab-set:: - - .. tab-item:: Subpackages - - .. list-table:: - :header-rows: 0 - :widths: auto - - * - :py:mod:`ansys.geometry.core.connection` - - PyGeometry connection subpackage. - * - :py:mod:`ansys.geometry.core.designer` - - PyGeometry designer subpackage. - * - :py:mod:`ansys.geometry.core.materials` - - PyGeometry materials subpackage. - * - :py:mod:`ansys.geometry.core.math` - - PyGeometry math subpackage. - * - :py:mod:`ansys.geometry.core.misc` - - Provides the PyGeometry miscellaneous subpackage. - * - :py:mod:`ansys.geometry.core.plotting` - - Provides the PyGeometry plotting subpackage. - * - :py:mod:`ansys.geometry.core.primitives` - - PyGeometry primitives subpackage. - * - :py:mod:`ansys.geometry.core.sketch` - - PyGeometry sketch subpackage. - - .. tab-item:: Submodules - - .. list-table:: - :header-rows: 0 - :widths: auto - - * - :py:mod:`ansys.geometry.core.errors` - - Provides PyGeometry-specific errors. - * - :py:mod:`ansys.geometry.core.logger` - - Provides a general framework for logging in PyGeometry. - * - :py:mod:`ansys.geometry.core.modeler` - - Provides for interacting with the Geometry service. - * - :py:mod:`ansys.geometry.core.typing` - - Provides typing of values for PyGeometry. - - - .. tab-item:: Classes - - Content 2 - - .. tab-item:: Functions - - Content 2 - - .. tab-item:: Enumerations - - Content 2 - - .. tab-item:: Attributes - - Content 2 - - -Subpackages ------------ - -.. list-table:: - :header-rows: 1 - :widths: auto - - * - Name - - Description - * - :py:mod:`ansys.geometry.core.connection` - - PyGeometry connection subpackage. - * - :py:mod:`ansys.geometry.core.designer` - - PyGeometry designer subpackage. - * - :py:mod:`ansys.geometry.core.materials` - - PyGeometry materials subpackage. - * - :py:mod:`ansys.geometry.core.math` - - PyGeometry math subpackage. - * - :py:mod:`ansys.geometry.core.misc` - - Provides the PyGeometry miscellaneous subpackage. - * - :py:mod:`ansys.geometry.core.plotting` - - Provides the PyGeometry plotting subpackage. - * - :py:mod:`ansys.geometry.core.primitives` - - PyGeometry primitives subpackage. - * - :py:mod:`ansys.geometry.core.sketch` - - PyGeometry sketch subpackage. - -.. toctree:: - :titlesonly: - :maxdepth: 1 - :hidden: - - connection - designer - materials - math - misc - plotting - primitives - sketch - - - - - - -Submodules ----------- - -.. list-table:: - :header-rows: 1 - :widths: auto - - * - Name - - Description - * - :py:mod:`ansys.geometry.core.errors` - - Provides PyGeometry-specific errors. - * - :py:mod:`ansys.geometry.core.logger` - - Provides a general framework for logging in PyGeometry. - * - :py:mod:`ansys.geometry.core.modeler` - - Provides for interacting with the Geometry service. - * - :py:mod:`ansys.geometry.core.typing` - - Provides typing of values for PyGeometry. - -.. toctree:: - :titlesonly: - :maxdepth: 1 - :hidden: - - errors - logger - modeler - typing - - -Contents --------- - -.. py:data:: __version__ - - PyGeometry version. - - -.. py:data:: USE_TRAME - :value: False - - Global constant for checking whether to use `trame `_ - for visualization. - - diff --git a/doc/source/autoapi/ansys/geometry/core/logger/index.rst b/doc/source/autoapi/ansys/geometry/core/logger/index.rst deleted file mode 100644 index 5987f67cec..0000000000 --- a/doc/source/autoapi/ansys/geometry/core/logger/index.rst +++ /dev/null @@ -1,565 +0,0 @@ - - - -Module ``logger`` -================= - - - -.. py:module:: ansys.geometry.core.logger - - - -Description ------------ - -Provides a general framework for logging in PyGeometry. - -This module is built on the `Logging facility for -Python `_. -It is not intended to replace the standard Python logging library but rather provide -a way to interact between its ``logging`` class and PyGeometry. - -The loggers used in this module include the name of the instance, which -is intended to be unique. This name is printed in all active -outputs and is used to track the different Geometry service instances. - - -Logger usage ------------- - -Global logger -~~~~~~~~~~~~~ -There is a global logger named ``PyGeometry_global`` that is created when -``ansys.geometry.core.__init__`` is called. If you want to use this global -logger, you must call it at the top of your module: - -.. code:: python - - from ansys.geometry.core import LOG - -You can rename this logger to avoid conflicts with other loggers (if any): - -.. code:: python - - from ansys.geometry.core import LOG as logger - - -The default logging level of ``LOG`` is ``ERROR``. -You can change this level and output lower-level messages with -this code: - -.. code:: python - - LOG.logger.setLevel("DEBUG") - LOG.file_handler.setLevel("DEBUG") # If present. - LOG.stdout_handler.setLevel("DEBUG") # If present. - - -Alternatively, you can ensure that all the handlers are set to the input log -level with this code: - -.. code:: python - - LOG.setLevel("DEBUG") - -This logger does not log to a file by default. If you want, you can -add a file handler with this code: - -.. code:: python - - import os - - file_path = os.path.join(os.getcwd(), "pygeometry.log") - LOG.log_to_file(file_path) - -This also sets the logger to be redirected to this file. If you want -to change the characteristics of this global logger from the beginning -of the execution, you must edit the ``__init__`` file in the directory -``ansys.geometry.core``. - -To log using this logger, call the desired method as a normal logger with: - -.. code:: pycon - - >>> import logging - >>> from ansys.geometry.core.logging import Logger - >>> LOG = Logger(level=logging.DEBUG, to_file=False, to_stdout=True) - >>> LOG.debug("This is LOG debug message.") - - DEBUG - - - - This is LOG debug message. - - -Instance logger -~~~~~~~~~~~~~~~ -Every time an instance of the :class:`Modeler ` -class is created, a logger is created and stored in ``LOG._instances``. This field is a -dictionary where the key is the name of the created logger. - -These instance loggers inherit the ``PyGeometry_global`` output handlers and -logging level unless otherwise specified. The way this logger works is very -similar to the global logger. If you want to add a file handler, you can use -the :func:`log_to_file() ` method. If you want -to change the log level, you can use the :func:`logger.Logging.setLevel` method. - -Here is an example of how you can use this logger: - -.. code:: pycon - - >>> from ansys.geometry.core import Modeler - >>> modeler = Modeler() - >>> modeler._log.info("This is a useful message") - - INFO - GRPC_127.0.0.1:50056 - <...> - - This is a useful message - - -Other loggers -~~~~~~~~~~~~~ -You can create your own loggers using a Python ``logging`` library as -you would do in any other script. There would be no conflicts between -these loggers. - - - - -Summary -------- - -.. tab-set:: - - - - - .. tab-item:: Classes - - Content 2 - - .. tab-item:: Functions - - Content 2 - - .. tab-item:: Enumerations - - Content 2 - - .. tab-item:: Attributes - - Content 2 - - - - - - -Contents --------- - -Classes -~~~~~~~ - -.. autoapisummary:: - - ansys.geometry.core.logger.PyGeometryCustomAdapter - ansys.geometry.core.logger.PyGeometryPercentStyle - ansys.geometry.core.logger.PyGeometryFormatter - ansys.geometry.core.logger.InstanceFilter - ansys.geometry.core.logger.Logger - - - -Functions -~~~~~~~~~ - -.. autoapisummary:: - - ansys.geometry.core.logger.addfile_handler - ansys.geometry.core.logger.add_stdout_handler - - - -Attributes -~~~~~~~~~~ - -.. autoapisummary:: - - ansys.geometry.core.logger.LOG_LEVEL - ansys.geometry.core.logger.FILE_NAME - ansys.geometry.core.logger.DEBUG - ansys.geometry.core.logger.INFO - ansys.geometry.core.logger.WARN - ansys.geometry.core.logger.ERROR - ansys.geometry.core.logger.CRITICAL - ansys.geometry.core.logger.STDOUT_MSG_FORMAT - ansys.geometry.core.logger.FILE_MSG_FORMAT - ansys.geometry.core.logger.DEFAULT_STDOUT_HEADER - ansys.geometry.core.logger.DEFAULT_FILE_HEADER - ansys.geometry.core.logger.NEW_SESSION_HEADER - ansys.geometry.core.logger.string_to_loglevel - ansys.geometry.core.logger.LOG - - -.. py:data:: LOG_LEVEL - - - -.. py:data:: FILE_NAME - :value: 'pygeometry.log' - - - -.. py:data:: DEBUG - - - -.. py:data:: INFO - - - -.. py:data:: WARN - - - -.. py:data:: ERROR - - - -.. py:data:: CRITICAL - - - -.. py:data:: STDOUT_MSG_FORMAT - :value: '%(levelname)s - %(instance_name)s - %(module)s - %(funcName)s - %(message)s' - - - -.. py:data:: FILE_MSG_FORMAT - - - -.. py:data:: DEFAULT_STDOUT_HEADER - :value: Multiline-String - - .. raw:: html - -
Show Value - - .. code-block:: python - - """ - LEVEL - INSTANCE NAME - MODULE - FUNCTION - MESSAGE - """ - - .. raw:: html - -
- - - -.. py:data:: DEFAULT_FILE_HEADER - - - -.. py:data:: NEW_SESSION_HEADER - - - -.. py:data:: string_to_loglevel - - - -.. py:class:: PyGeometryCustomAdapter(logger, extra=None) - - - Bases: :py:obj:`logging.LoggerAdapter` - - Keeps the reference to the Geometry service instance name dynamic. - - If you use the standard approach, which is supplying *extra* input to the logger, - you must input Geometry service instances each time you do a log. - - Using adapters, you only need to specify the Geometry service instance that you are - referring to once. - - .. py:attribute:: level - - - - .. py:attribute:: file_handler - - - - .. py:attribute:: stdout_handler - - - - .. py:method:: process(msg, kwargs) - - Process the logging message and keyword arguments passed in to - a logging call to insert contextual information. You can either - manipulate the message itself, the keyword args or both. Return - the message and kwargs modified (or not) to suit your needs. - - Normally, you'll only need to override this one method in a - LoggerAdapter subclass for your specific needs. - - - .. py:method:: log_to_file(filename: str = FILE_NAME, level: int = LOG_LEVEL) - - Add a file handler to the logger. - - Parameters - ---------- - filename : str, default: "pygeometry.log" - Name of the file to write log messages to. - level : int, default: 10 - Level of logging. The default is ``10``, in which case the - ``logging.DEBUG`` level is used. - - - .. py:method:: log_to_stdout(level=LOG_LEVEL) - - Add a standard output handler to the logger. - - Parameters - ---------- - level : int, default: 10 - Level of logging. The default is ``10``, in which case the - ``logging.DEBUG`` level is used. - - - .. py:method:: setLevel(level='DEBUG') - - Change the log level of the object and the attached handlers. - - Parameters - ---------- - level : int, default: 10 - Level of logging. The default is ``10``, in which case the - ``logging.DEBUG`` level is used. - - - -.. py:class:: PyGeometryPercentStyle(fmt, *, defaults=None) - - - Bases: :py:obj:`logging.PercentStyle` - - Provides a common messaging style for the ``PyGeometryFormatter`` class. - - -.. py:class:: PyGeometryFormatter(fmt=STDOUT_MSG_FORMAT, datefmt=None, style='%', validate=True, defaults=None) - - - Bases: :py:obj:`logging.Formatter` - - Provides a ``Formatter`` class for overwriting default format styles. - - -.. py:class:: InstanceFilter(name='') - - - Bases: :py:obj:`logging.Filter` - - Ensures that the ``instance_name`` record always exists. - - .. py:method:: filter(record) - - Ensure that the ``instance_name`` attribute is always present. - - - -.. py:class:: Logger(level=logging.DEBUG, to_file=False, to_stdout=True, filename=FILE_NAME) - - - Provides the logger used for each PyGeometry session. - - This class allows you to add handlers to the logger to output messages - to a file or to the standard output (stdout). - - Parameters - ---------- - level : int, default: 10 - Logging level to filter the message severity allowed in the logger. - The default is ``10``, in which case the ``logging.DEBUG`` level - is used. - to_file : bool, default: False - Whether to write log messages to a file. - to_stdout : bool, default: True - Whether to write log messages to the standard output. - filename : str, default: "pygeometry.log" - Name of the file to write log log messages to. - - Examples - -------- - Demonstrate logger usage from the ``Modeler`` instance, which is automatically - created when a Geometry service instance is created. - - >>> from ansys.geometry.core import Modeler - >>> modeler = Modeler(loglevel='DEBUG') - >>> modeler._log.info('This is a useful message') - INFO - - - - This is LOG debug message. - - Import the global PyGeometry logger and add a file output handler. - - >>> import os - >>> from ansys.geometry.core import LOG - >>> file_path = os.path.join(os.getcwd(), 'pygeometry.log') - >>> LOG.log_to_file(file_path) - - .. py:attribute:: file_handler - - - - .. py:attribute:: std_out_handler - - - - .. py:method:: log_to_file(filename=FILE_NAME, level=LOG_LEVEL) - - Add a file handler to the logger. - - Parameters - ---------- - filename : str, default: "pygeometry.log" - Name of the file to write log messages to. - level : int, default: 10 - Level of logging. The default is ``10``, in which case the - ``logging.DEBUG`` level is used. - - Examples - -------- - Write to the ``"pygeometry.log"`` file in the current working directory: - - >>> from ansys.geometry.core import LOG - >>> import os - >>> file_path = os.path.join(os.getcwd(), 'pygeometry.log') - >>> LOG.log_to_file(file_path) - - - .. py:method:: log_to_stdout(level=LOG_LEVEL) - - Add the standard output handler to the logger. - - Parameters - ---------- - level : int, default: 10 - Level of logging. The default is ``10``, in which case the - ``logging.DEBUG`` level is used. - - - .. py:method:: setLevel(level='DEBUG') - - Change the log level of the object and the attached handlers. - - - .. py:method:: add_child_logger(sufix: str, level: beartype.typing.Optional[str] = None) - - Add a child logger to the main logger. - - This logger is more general than an instance logger, which is designed to - track the state of Geometry service instances. - - If the logging level is in the arguments, a new logger with a reference - to the ``_global`` logger handlers is created instead of a child logger. - - Parameters - ---------- - sufix : str - Name of the child logger. - level : str, default: None - Level of logging. - - Returns - ------- - logging.logger - Logger class. - - - .. py:method:: add_instance_logger(name: str, client_instance: ansys.geometry.core.connection.client.GrpcClient, level: beartype.typing.Optional[int] = None) -> PyGeometryCustomAdapter - - Add a logger for a Geometry service instance. - - The Geometry service instance logger is a logger with an adapter that adds - contextual information such as the Geometry service instance name. This logger is - returned, and you can use it to log events as a normal logger. It is - stored in the ``_instances`` field. - - Parameters - ---------- - name : str - Name for the new instance logger. - client_instance : GrpcClient - Geometry service GrpcClient object, which should contain the ``get_name`` method. - level : int, default: None - Level of logging. - - Returns - ------- - PyGeometryCustomAdapter - Logger adapter customized to add Geometry service information to the - logs. You can use this class to log events in the same - way you would with the ``Logger`` class. - - - .. py:method:: __getitem__(key) - - Overload the access method by item for the ``Logger`` class. - - - .. py:method:: add_handling_uncaught_expections(logger) - - Redirect the output of an exception to a logger. - - Parameters - ---------- - logger : str - Name of the logger. - - - -.. py:function:: addfile_handler(logger, filename=FILE_NAME, level=LOG_LEVEL, write_headers=False) - - Add a file handler to the input. - - Parameters - ---------- - logger : logging.Logger - Logger to add the file handler to. - filename : str, default: "pygeometry.log" - Name of the output file. - level : int, default: 10 - Level of logging. The default is ``10``, in which case the - ``logging.DEBUG`` level is used. - write_headers : bool, default: False - Whether to write the headers to the file. - - Returns - ------- - logger - Logger or Logger object. - - -.. py:function:: add_stdout_handler(logger, level=LOG_LEVEL, write_headers=False) - - Add a standout handler to the logger. - - Parameters - ---------- - logger : logging.Logger - Logger to add the file handler to. - level : int, default: 10 - Level of logging. The default is ``10``, in which case the - ``logging.DEBUG`` level is used. - write_headers : bool, default: False - Whether to write headers to the file. - - Returns - ------- - logger - Logger or Logger object. - - -.. py:data:: LOG - - - diff --git a/doc/source/autoapi/ansys/geometry/core/materials/index.rst b/doc/source/autoapi/ansys/geometry/core/materials/index.rst deleted file mode 100644 index babd23e416..0000000000 --- a/doc/source/autoapi/ansys/geometry/core/materials/index.rst +++ /dev/null @@ -1,82 +0,0 @@ - - - -Package ``materials`` -===================== - - - -.. py:module:: ansys.geometry.core.materials - - - -Description ------------ - -PyGeometry materials subpackage. - - - - -Summary -------- - -.. tab-set:: - - - .. tab-item:: Submodules - - .. list-table:: - :header-rows: 0 - :widths: auto - - * - :py:mod:`ansys.geometry.core.materials.material` - - Provides the data structure for material and for adding a material property. - * - :py:mod:`ansys.geometry.core.materials.property` - - Provides the ``MaterialProperty`` class. - - - .. tab-item:: Classes - - Content 2 - - .. tab-item:: Functions - - Content 2 - - .. tab-item:: Enumerations - - Content 2 - - .. tab-item:: Attributes - - Content 2 - - - - - - -Submodules ----------- - -.. list-table:: - :header-rows: 1 - :widths: auto - - * - Name - - Description - * - :py:mod:`ansys.geometry.core.materials.material` - - Provides the data structure for material and for adding a material property. - * - :py:mod:`ansys.geometry.core.materials.property` - - Provides the ``MaterialProperty`` class. - -.. toctree:: - :titlesonly: - :maxdepth: 1 - :hidden: - - material - property - - diff --git a/doc/source/autoapi/ansys/geometry/core/materials/material/index.rst b/doc/source/autoapi/ansys/geometry/core/materials/material/index.rst deleted file mode 100644 index a49bbfbfa0..0000000000 --- a/doc/source/autoapi/ansys/geometry/core/materials/material/index.rst +++ /dev/null @@ -1,103 +0,0 @@ - - - -Module ``material`` -=================== - - - -.. py:module:: ansys.geometry.core.materials.material - - - -Description ------------ - -Provides the data structure for material and for adding a material property. - - - - -Summary -------- - -.. tab-set:: - - - - - .. tab-item:: Classes - - Content 2 - - .. tab-item:: Functions - - Content 2 - - .. tab-item:: Enumerations - - Content 2 - - .. tab-item:: Attributes - - Content 2 - - - - - - -Contents --------- - -Classes -~~~~~~~ - -.. autoapisummary:: - - ansys.geometry.core.materials.material.Material - - - - -.. py:class:: Material(name: str, density: pint.Quantity, additional_properties: beartype.typing.Optional[beartype.typing.Sequence[ansys.geometry.core.materials.property.MaterialProperty]] = None) - - - Provides the data structure for a material. - - Parameters - ---------- - name: str - Material name. - density: ~pint.Quantity - Material density. - additional_properties: Sequence[MaterialProperty], default: None - Additional material properties. - - .. py:property:: properties - :type: beartype.typing.Dict[ansys.geometry.core.materials.property.MaterialPropertyType, ansys.geometry.core.materials.property.MaterialProperty] - - Dictionary of the material property type and material properties. - - - .. py:property:: name - :type: str - - Material name. - - - .. py:method:: add_property(type: ansys.geometry.core.materials.property.MaterialPropertyType, name: str, quantity: pint.Quantity) -> None - - Add a material property to the ``Material`` class. - - Parameters - ---------- - type : MaterialPropertyType - Material property type. - name: str - Material name. - quantity: ~pint.Quantity - Material value and unit. - - - diff --git a/doc/source/autoapi/ansys/geometry/core/materials/property/index.rst b/doc/source/autoapi/ansys/geometry/core/materials/property/index.rst deleted file mode 100644 index 580f7c1133..0000000000 --- a/doc/source/autoapi/ansys/geometry/core/materials/property/index.rst +++ /dev/null @@ -1,154 +0,0 @@ - - - -Module ``property`` -=================== - - - -.. py:module:: ansys.geometry.core.materials.property - - - -Description ------------ - -Provides the ``MaterialProperty`` class. - - - - -Summary -------- - -.. tab-set:: - - - - - .. tab-item:: Classes - - Content 2 - - .. tab-item:: Functions - - Content 2 - - .. tab-item:: Enumerations - - Content 2 - - .. tab-item:: Attributes - - Content 2 - - - - - - -Contents --------- - -Classes -~~~~~~~ - -.. autoapisummary:: - - ansys.geometry.core.materials.property.MaterialPropertyType - ansys.geometry.core.materials.property.MaterialProperty - - - - -.. py:class:: MaterialPropertyType - - - Bases: :py:obj:`enum.Enum` - - Provides an enum holding the possible values for ``MaterialProperty`` objects. - - .. py:attribute:: DENSITY - :value: 'Density' - - - - .. py:attribute:: ELASTIC_MODULUS - :value: 'ElasticModulus' - - - - .. py:attribute:: POISSON_RATIO - :value: 'PoissonsRatio' - - - - .. py:attribute:: SHEAR_MODULUS - :value: 'ShearModulus' - - - - .. py:attribute:: SPECIFIC_HEAT - :value: 'SpecificHeat' - - - - .. py:attribute:: TENSILE_STRENGTH - :value: 'TensileStrength' - - - - .. py:attribute:: THERMAL_CONDUCTIVITY - :value: 'ThermalConductivity' - - - - .. py:method:: from_id() -> MaterialPropertyType - - Return the ``MaterialPropertyType`` value from the service representation. - - Parameters - ---------- - id : str - Geometry Service string representation of a property type. - - Returns - ------- - MaterialPropertyType - Common name for property type. - - - -.. py:class:: MaterialProperty(type: MaterialPropertyType, name: str, quantity: pint.Quantity) - - - Provides the data structure for a material property. - - Parameters - ---------- - type : MaterialPropertyType - Type of the material property. - name: str - Material property name. - quantity: ~pint.Quantity - Value and unit. - - .. py:property:: type - :type: MaterialPropertyType - - Material property ID. - - - .. py:property:: name - :type: str - - Material property name. - - - .. py:property:: quantity - :type: pint.Quantity - - Material property quantity and unit. - - - diff --git a/doc/source/autoapi/ansys/geometry/core/math/bbox/index.rst b/doc/source/autoapi/ansys/geometry/core/math/bbox/index.rst deleted file mode 100644 index c573693766..0000000000 --- a/doc/source/autoapi/ansys/geometry/core/math/bbox/index.rst +++ /dev/null @@ -1,207 +0,0 @@ - - - -Module ``bbox`` -=============== - - - -.. py:module:: ansys.geometry.core.math.bbox - - - -Description ------------ - -Provides for managing a bounding box. - - - - -Summary -------- - -.. tab-set:: - - - - - .. tab-item:: Classes - - Content 2 - - .. tab-item:: Functions - - Content 2 - - .. tab-item:: Enumerations - - Content 2 - - .. tab-item:: Attributes - - Content 2 - - - - - - -Contents --------- - -Classes -~~~~~~~ - -.. autoapisummary:: - - ansys.geometry.core.math.bbox.BoundingBox2D - - - - -.. py:class:: BoundingBox2D(x_min: ansys.geometry.core.typing.Real = sys.float_info.max, x_max: ansys.geometry.core.typing.Real = sys.float_info.min, y_min: ansys.geometry.core.typing.Real = sys.float_info.max, y_max: ansys.geometry.core.typing.Real = sys.float_info.min) - - - Maintains the X and Y dimensions. - - Parameters - ---------- - x_min : Real - Minimum value for the x-dimensional bounds. - x_max : Real - Maximum value for the x-dimensional bounds. - y_min : Real - Minimum value for the y-dimensional bounds. - y_max : Real - Maximum value for the y-dimensional bounds. - - .. py:property:: x_min - :type: ansys.geometry.core.typing.Real - - Minimum value of X-dimensional bounds. - - Returns - ------- - Real - Minimum value of the X-dimensional bounds. - - - .. py:property:: x_max - :type: ansys.geometry.core.typing.Real - - Maximum value of the X-dimensional bounds. - - Returns - ------- - Real - Maximum value of the X-dimensional bounds. - - - .. py:property:: y_min - :type: ansys.geometry.core.typing.Real - - Minimum value of Y-dimensional bounds. - - Returns - ------- - Real - Minimum value of Y-dimensional bounds. - - - .. py:property:: y_max - :type: ansys.geometry.core.typing.Real - - Maximum value of Y-dimensional bounds. - - Returns - ------- - Real - Maximum value of Y-dimensional bounds. - - - .. py:method:: add_point(point: ansys.geometry.core.math.point.Point2D) -> None - - Extend the ranges of the bounding box to include a point. - - Notes - ----- - This method is only applicable if the point components are outside - the current bounds. - - Parameters - ---------- - point : Point2D - Point to include within the bounds. - - - .. py:method:: add_point_components(x: ansys.geometry.core.typing.Real, y: ansys.geometry.core.typing.Real) -> None - - Extend the ranges of the bounding box to include the X and Y values. - - Notes - ----- - This method is only applicable if the point components are outside - the current bounds. - - Parameters - ---------- - x : Real - Point X component to include within the bounds. - y : Real - Point Y component to include within the bounds. - - - .. py:method:: add_points(points: beartype.typing.List[ansys.geometry.core.math.point.Point2D]) -> None - - Extend the ranges of the bounding box to include given points. - - Parameters - ---------- - points : List[Point2D] - List of points to include within the bounds. - - - .. py:method:: contains_point(point: ansys.geometry.core.math.point.Point2D) -> bool - - Evaluate whether a provided point lies within the X and Y ranges of the bounds. - - Parameters - ---------- - point : Point2D - Point to compare against the bounds. - - Returns - ------- - bool - ``True`` if the point is contained in the bounding box. Otherwise, ``False``. - - - .. py:method:: contains_point_components(x: ansys.geometry.core.typing.Real, y: ansys.geometry.core.typing.Real) -> bool - - Check if point components are within current X and Y ranges of the bounds. - - Parameters - ---------- - x : Real - Point X component to compare against the bounds. - y : Real - Point Y component to compare against the bounds. - - Returns - ------- - bool - ``True`` if the components are contained in the bounding box. Otherwise, ``False``. - - - .. py:method:: __eq__(other: BoundingBox2D) -> bool - - Equals operator for the ``BoundingBox2D`` class. - - - .. py:method:: __ne__(other: BoundingBox2D) -> bool - - Not equals operator for the ``BoundingBox2D`` class. - - - diff --git a/doc/source/autoapi/ansys/geometry/core/math/constants/index.rst b/doc/source/autoapi/ansys/geometry/core/math/constants/index.rst deleted file mode 100644 index 344c25868e..0000000000 --- a/doc/source/autoapi/ansys/geometry/core/math/constants/index.rst +++ /dev/null @@ -1,117 +0,0 @@ - - - -Module ``constants`` -==================== - - - -.. py:module:: ansys.geometry.core.math.constants - - - -Description ------------ - -Provides mathematical constants. - - - - -Summary -------- - -.. tab-set:: - - - - - .. tab-item:: Classes - - Content 2 - - .. tab-item:: Functions - - Content 2 - - .. tab-item:: Enumerations - - Content 2 - - .. tab-item:: Attributes - - Content 2 - - - - - - -Contents --------- - -.. py:data:: DEFAULT_POINT3D - - Default value for a 3D point. - - -.. py:data:: DEFAULT_POINT2D - - Default value for a 2D point. - - -.. py:data:: IDENTITY_MATRIX33 - - Identity for a ``Matrix33`` object. - - -.. py:data:: IDENTITY_MATRIX44 - - Identity for a ``Matrix44`` object. - - -.. py:data:: UNITVECTOR3D_X - - Default 3D unit vector in the Cartesian traditional X direction. - - -.. py:data:: UNITVECTOR3D_Y - - Default 3D unit vector in the Cartesian traditional Y direction. - - -.. py:data:: UNITVECTOR3D_Z - - Default 3D unit vector in the Cartesian traditional Z direction. - - -.. py:data:: UNITVECTOR2D_X - - Default 2D unit vector in the Cartesian traditional X direction. - - -.. py:data:: UNITVECTOR2D_Y - - Default 2D unit vector in the Cartesian traditional Y direction. - - -.. py:data:: ZERO_VECTOR3D - - Zero-valued ``Vector3D`` object. - - -.. py:data:: ZERO_VECTOR2D - - Zero-valued ``Vector2D`` object. - - -.. py:data:: ZERO_POINT3D - - Zero-valued ``Point3D`` object. - - -.. py:data:: ZERO_POINT2D - - Zero-valued ``Point2D`` object. - - diff --git a/doc/source/autoapi/ansys/geometry/core/math/frame/index.rst b/doc/source/autoapi/ansys/geometry/core/math/frame/index.rst deleted file mode 100644 index e13f5c4fa6..0000000000 --- a/doc/source/autoapi/ansys/geometry/core/math/frame/index.rst +++ /dev/null @@ -1,166 +0,0 @@ - - - -Module ``frame`` -================ - - - -.. py:module:: ansys.geometry.core.math.frame - - - -Description ------------ - -Provides for managing a frame. - - - - -Summary -------- - -.. tab-set:: - - - - - .. tab-item:: Classes - - Content 2 - - .. tab-item:: Functions - - Content 2 - - .. tab-item:: Enumerations - - Content 2 - - .. tab-item:: Attributes - - Content 2 - - - - - - -Contents --------- - -Classes -~~~~~~~ - -.. autoapisummary:: - - ansys.geometry.core.math.frame.Frame - - - - -.. py:class:: Frame(origin: beartype.typing.Union[numpy.ndarray, ansys.geometry.core.typing.RealSequence, ansys.geometry.core.math.point.Point3D] = ZERO_POINT3D, direction_x: beartype.typing.Union[numpy.ndarray, ansys.geometry.core.typing.RealSequence, ansys.geometry.core.math.vector.UnitVector3D, ansys.geometry.core.math.vector.Vector3D] = UNITVECTOR3D_X, direction_y: beartype.typing.Union[numpy.ndarray, ansys.geometry.core.typing.RealSequence, ansys.geometry.core.math.vector.UnitVector3D, ansys.geometry.core.math.vector.Vector3D] = UNITVECTOR3D_Y) - - - Primitive representation of a frame (an origin and three fundamental directions). - - Parameters - ---------- - origin : Union[~numpy.ndarray, RealSequence, Point3D], default: ZERO_POINT3D - Centered origin of the`frame. The default is ``ZERO_POINT3D``, which is the - Cartesian origin. - direction_x : Union[~numpy.ndarray, RealSequence, UnitVector3D, Vector3D], default: UNITVECTOR3D_X - X-axis direction. - direction_y : Union[~numpy.ndarray, RealSequence, UnitVector3D, Vector3D], default: UNITVECTOR3D_Y - Y-axis direction. - - .. py:property:: origin - :type: ansys.geometry.core.math.point.Point3D - - Origin of the frame. - - - .. py:property:: direction_x - :type: ansys.geometry.core.math.vector.UnitVector3D - - X-axis direction of the frame. - - - .. py:property:: direction_y - :type: ansys.geometry.core.math.vector.UnitVector3D - - Y-axis direction of the frame. - - - .. py:property:: direction_z - :type: ansys.geometry.core.math.vector.UnitVector3D - - Z-axis direction of the frame. - - - .. py:property:: global_to_local_rotation - :type: ansys.geometry.core.math.matrix.Matrix33 - - Global to local space transformation matrix. - - Returns - ------- - Matrix33 - 3x3 matrix representing the transformation from global to local - coordinate space, excluding origin translation. - - - .. py:property:: local_to_global_rotation - :type: ansys.geometry.core.math.matrix.Matrix33 - - Local to global space transformation matrix. - - Returns - ------- - Matrix33 - 3x3 matrix representing the transformation from local to global - coordinate space. - - - .. py:property:: transformation_matrix - :type: ansys.geometry.core.math.matrix.Matrix44 - - Full 4x4 transformation matrix. - - Returns - ------- - Matrix44 - 4x4 matrix representing the transformation from global to local - coordinate space. - - - .. py:method:: transform_point2d_local_to_global(point: ansys.geometry.core.math.point.Point2D) -> ansys.geometry.core.math.point.Point3D - - Transform a 2D point to a global 3D point. - - This method transforms a local, plane-contained ``Point2D`` object in the global - coordinate system, thus representing it as a ``Point3D`` object. - - Parameters - ---------- - point : Point2D - ``Point2D`` local object to express in global coordinates. - - Returns - ------- - Point3D - Global coordinates for the 3D point. - - - .. py:method:: __eq__(other: Frame) -> bool - - Equals operator for the ``Frame`` class. - - - .. py:method:: __ne__(other: Frame) -> bool - - Not equals operator for the ``Frame`` class. - - - diff --git a/doc/source/autoapi/ansys/geometry/core/math/index.rst b/doc/source/autoapi/ansys/geometry/core/math/index.rst deleted file mode 100644 index 7731e70dc4..0000000000 --- a/doc/source/autoapi/ansys/geometry/core/math/index.rst +++ /dev/null @@ -1,107 +0,0 @@ - - - -Package ``math`` -================ - - - -.. py:module:: ansys.geometry.core.math - - - -Description ------------ - -PyGeometry math subpackage. - - - - -Summary -------- - -.. tab-set:: - - - .. tab-item:: Submodules - - .. list-table:: - :header-rows: 0 - :widths: auto - - * - :py:mod:`ansys.geometry.core.math.bbox` - - Provides for managing a bounding box. - * - :py:mod:`ansys.geometry.core.math.constants` - - Provides mathematical constants. - * - :py:mod:`ansys.geometry.core.math.frame` - - Provides for managing a frame. - * - :py:mod:`ansys.geometry.core.math.matrix` - - Provides matrix primitive representations. - * - :py:mod:`ansys.geometry.core.math.plane` - - Provides primitive representation of a 2D plane in 3D space. - * - :py:mod:`ansys.geometry.core.math.point` - - Provides geometry primitive representation for 2D and 3D points. - * - :py:mod:`ansys.geometry.core.math.vector` - - Provides for creating and managing 2D and 3D vectors. - - - .. tab-item:: Classes - - Content 2 - - .. tab-item:: Functions - - Content 2 - - .. tab-item:: Enumerations - - Content 2 - - .. tab-item:: Attributes - - Content 2 - - - - - - -Submodules ----------- - -.. list-table:: - :header-rows: 1 - :widths: auto - - * - Name - - Description - * - :py:mod:`ansys.geometry.core.math.bbox` - - Provides for managing a bounding box. - * - :py:mod:`ansys.geometry.core.math.constants` - - Provides mathematical constants. - * - :py:mod:`ansys.geometry.core.math.frame` - - Provides for managing a frame. - * - :py:mod:`ansys.geometry.core.math.matrix` - - Provides matrix primitive representations. - * - :py:mod:`ansys.geometry.core.math.plane` - - Provides primitive representation of a 2D plane in 3D space. - * - :py:mod:`ansys.geometry.core.math.point` - - Provides geometry primitive representation for 2D and 3D points. - * - :py:mod:`ansys.geometry.core.math.vector` - - Provides for creating and managing 2D and 3D vectors. - -.. toctree:: - :titlesonly: - :maxdepth: 1 - :hidden: - - bbox - constants - frame