The ``conversions.py`` module ============================= .. py:module:: ansys.geometry.core.connection.conversions Summary ------- .. py:currentmodule:: conversions .. tab-set:: .. tab-item:: Functions .. list-table:: :header-rows: 0 :widths: auto * - :py:obj:`~unit_vector_to_grpc_direction` - Convert a ``UnitVector3D`` class to a unit vector gRPC message. * - :py:obj:`~frame_to_grpc_frame` - Convert a ``Frame`` class to a frame gRPC message. * - :py:obj:`~plane_to_grpc_plane` - Convert a ``Plane`` class to a plane gRPC message. * - :py:obj:`~sketch_shapes_to_grpc_geometries` - Convert lists of ``SketchEdge`` and ``SketchFace`` to a gRPC message. * - :py:obj:`~sketch_edges_to_grpc_geometries` - Convert a list of ``SketchEdge`` to a gRPC message. * - :py:obj:`~sketch_arc_to_grpc_arc` - Convert an ``Arc`` class to an arc gRPC message. * - :py:obj:`~sketch_ellipse_to_grpc_ellipse` - Convert a ``SketchEllipse`` class to an ellipse gRPC message. * - :py:obj:`~sketch_circle_to_grpc_circle` - Convert a ``SketchCircle`` class to a circle gRPC message. * - :py:obj:`~point3d_to_grpc_point` - Convert a ``Point3D`` class to a point gRPC message. * - :py:obj:`~point2d_to_grpc_point` - Convert a ``Point2D`` class to a point gRPC message. * - :py:obj:`~sketch_polygon_to_grpc_polygon` - Convert a ``Polygon`` class to a polygon gRPC message. * - :py:obj:`~sketch_segment_to_grpc_line` - Convert a ``Segment`` class to a line gRPC message. * - :py:obj:`~tess_to_pd` - Convert an ``ansys.api.geometry.Tessellation`` to ``pyvista.PolyData``. * - :py:obj:`~grpc_matrix_to_matrix` - Convert an ``ansys.api.geometry.Matrix`` to a ``Matrix44``. * - :py:obj:`~grpc_frame_to_frame` - Convert a frame gRPC message to a ``Frame`` class. * - :py:obj:`~grpc_surface_to_surface` - Convert a surface gRPC message to a ``Surface`` class. * - :py:obj:`~grpc_curve_to_curve` - Convert a curve gRPC message to a ``Curve``. * - :py:obj:`~curve_to_grpc_curve` - Convert a ``Curve`` object to a curve gRPC message. * - :py:obj:`~trimmed_curve_to_grpc_trimmed_curve` - Convert a ``TrimmedCurve`` to a trimmed curve gRPC message. Description ----------- Module providing for conversions. .. !! processed by numpydoc !! Module detail ------------- .. py:function:: unit_vector_to_grpc_direction(unit_vector: ansys.geometry.core.math.vector.UnitVector3D) -> ansys.api.geometry.v0.models_pb2.Direction Convert a ``UnitVector3D`` class to a unit vector gRPC message. :Parameters: **unit_vector** : :obj:`UnitVector3D` Source vector data. :Returns: :obj:`GRPCDirection` Geometry service gRPC direction message. .. !! processed by numpydoc !! .. py:function:: frame_to_grpc_frame(frame: ansys.geometry.core.math.frame.Frame) -> ansys.api.geometry.v0.models_pb2.Frame Convert a ``Frame`` class to a frame gRPC message. :Parameters: **frame** : :obj:`Frame` Source frame data. :Returns: :obj:`GRPCFrame` Geometry service gRPC frame message. The unit for the frame origin is meters. .. !! processed by numpydoc !! .. py:function:: plane_to_grpc_plane(plane: ansys.geometry.core.math.plane.Plane) -> ansys.api.geometry.v0.models_pb2.Plane Convert a ``Plane`` class to a plane gRPC message. :Parameters: **plane** : :obj:`Plane` Source plane data. :Returns: :obj:`GRPCPlane` Geometry service gRPC plane message. The unit is meters. .. !! processed by numpydoc !! .. py:function:: sketch_shapes_to_grpc_geometries(plane: ansys.geometry.core.math.plane.Plane, edges: list[ansys.geometry.core.sketch.edge.SketchEdge], faces: list[ansys.geometry.core.sketch.face.SketchFace], only_one_curve: bool = False) -> ansys.api.geometry.v0.models_pb2.Geometries Convert lists of ``SketchEdge`` and ``SketchFace`` to a gRPC message. :Parameters: **plane** : :obj:`Plane` Plane for positioning the 2D sketches. **edges** : :class:`python:list`\[:obj:`SketchEdge`] Source edge data. **faces** : :class:`python:list`\[:obj:`SketchFace`] Source face data. **only_one_curve** : :ref:`bool `, default: :data:`python:False` Whether to project one curve of the whole set of geometries to enhance performance. :Returns: :obj:`GRPCGeometries` Geometry service gRPC geometries message. The unit is meters. .. !! processed by numpydoc !! .. py:function:: sketch_edges_to_grpc_geometries(edges: list[ansys.geometry.core.sketch.edge.SketchEdge], plane: ansys.geometry.core.math.plane.Plane) -> tuple[list[ansys.api.geometry.v0.models_pb2.Line], list[ansys.api.geometry.v0.models_pb2.Arc]] Convert a list of ``SketchEdge`` to a gRPC message. :Parameters: **edges** : :class:`python:list`\[:obj:`SketchEdge`] Source edge data. **plane** : :obj:`Plane` Plane for positioning the 2D sketches. :Returns: :class:`python:tuple`\[:class:`python:list`\[:obj:`GRPCLine`], :class:`python:list`\[:obj:`GRPCArc`]] Geometry service gRPC line and arc messages. The unit is meters. .. !! processed by numpydoc !! .. py:function:: sketch_arc_to_grpc_arc(arc: ansys.geometry.core.sketch.arc.Arc, plane: ansys.geometry.core.math.plane.Plane) -> ansys.api.geometry.v0.models_pb2.Arc Convert an ``Arc`` class to an arc gRPC message. :Parameters: **arc** : :obj:`Arc` Source arc data. **plane** : :obj:`Plane` Plane for positioning the arc within. :Returns: :obj:`GRPCArc` Geometry service gRPC arc message. The unit is meters. .. !! processed by numpydoc !! .. py:function:: sketch_ellipse_to_grpc_ellipse(ellipse: ansys.geometry.core.sketch.ellipse.SketchEllipse, plane: ansys.geometry.core.math.plane.Plane) -> ansys.api.geometry.v0.models_pb2.Ellipse Convert a ``SketchEllipse`` class to an ellipse gRPC message. :Parameters: **ellipse** : :obj:`SketchEllipse` Source ellipse data. :Returns: :obj:`GRPCEllipse` Geometry service gRPC ellipse message. The unit is meters. .. !! processed by numpydoc !! .. py:function:: sketch_circle_to_grpc_circle(circle: ansys.geometry.core.sketch.circle.SketchCircle, plane: ansys.geometry.core.math.plane.Plane) -> ansys.api.geometry.v0.models_pb2.Circle Convert a ``SketchCircle`` class to a circle gRPC message. :Parameters: **circle** : :obj:`SketchCircle` Source circle data. **plane** : :obj:`Plane` Plane for positioning the circle. :Returns: :obj:`GRPCCircle` Geometry service gRPC circle message. The unit is meters. .. !! processed by numpydoc !! .. py:function:: point3d_to_grpc_point(point: ansys.geometry.core.math.point.Point3D) -> ansys.api.geometry.v0.models_pb2.Point Convert a ``Point3D`` class to a point gRPC message. :Parameters: **point** : :obj:`Point3D` Source point data. :Returns: :obj:`GRPCPoint` Geometry service gRPC point message. The unit is meters. .. !! processed by numpydoc !! .. py:function:: point2d_to_grpc_point(plane: ansys.geometry.core.math.plane.Plane, point2d: ansys.geometry.core.math.point.Point2D) -> ansys.api.geometry.v0.models_pb2.Point Convert a ``Point2D`` class to a point gRPC message. :Parameters: **plane** : :obj:`Plane` Plane for positioning the 2D point. **point** : :obj:`Point2D` Source point data. :Returns: :obj:`GRPCPoint` Geometry service gRPC point message. The unit is meters. .. !! processed by numpydoc !! .. py:function:: sketch_polygon_to_grpc_polygon(polygon: ansys.geometry.core.sketch.polygon.Polygon, plane: ansys.geometry.core.math.plane.Plane) -> ansys.api.geometry.v0.models_pb2.Polygon Convert a ``Polygon`` class to a polygon gRPC message. :Parameters: **polygon** : :obj:`Polygon` Source polygon data. :Returns: :obj:`GRPCPolygon` Geometry service gRPC polygon message. The unit is meters. .. !! processed by numpydoc !! .. py:function:: sketch_segment_to_grpc_line(segment: ansys.geometry.core.sketch.segment.SketchSegment, plane: ansys.geometry.core.math.plane.Plane) -> ansys.api.geometry.v0.models_pb2.Line Convert a ``Segment`` class to a line gRPC message. :Parameters: **segment** : :obj:`SketchSegment` Source segment data. :Returns: :obj:`GRPCLine` Geometry service gRPC line message. The unit is meters. .. !! processed by numpydoc !! .. py:function:: tess_to_pd(tess: ansys.api.geometry.v0.models_pb2.Tessellation) -> pyvista.PolyData Convert an ``ansys.api.geometry.Tessellation`` to ``pyvista.PolyData``. .. !! processed by numpydoc !! .. py:function:: grpc_matrix_to_matrix(m: ansys.api.geometry.v0.models_pb2.Matrix) -> ansys.geometry.core.math.matrix.Matrix44 Convert an ``ansys.api.geometry.Matrix`` to a ``Matrix44``. .. !! processed by numpydoc !! .. py:function:: grpc_frame_to_frame(frame: ansys.api.geometry.v0.models_pb2.Frame) -> ansys.geometry.core.math.frame.Frame Convert a frame gRPC message to a ``Frame`` class. :Parameters: **GRPCFrame** Geometry service gRPC frame message. The unit for the frame origin is meters. :Returns: **frame** : :obj:`Frame` Resulting converted frame. .. !! processed by numpydoc !! .. py:function:: grpc_surface_to_surface(surface: ansys.api.geometry.v0.models_pb2.Surface, surface_type: ansys.geometry.core.designer.face.SurfaceType) -> ansys.geometry.core.shapes.surfaces.surface.Surface Convert a surface gRPC message to a ``Surface`` class. :Parameters: **surface** : :obj:`GRPCSurface` Geometry service gRPC surface message. :Returns: :obj:`Surface` Resulting converted surface. .. !! processed by numpydoc !! .. py:function:: grpc_curve_to_curve(curve: ansys.api.geometry.v0.models_pb2.CurveGeometry) -> ansys.geometry.core.shapes.curves.curve.Curve Convert a curve gRPC message to a ``Curve``. :Parameters: **curve** : :obj:`GRPCCurve` Geometry service gRPC curve message. :Returns: :obj:`Curve` Resulting converted curve. .. !! processed by numpydoc !! .. py:function:: curve_to_grpc_curve(curve: ansys.geometry.core.shapes.curves.curve.Curve) -> ansys.api.geometry.v0.models_pb2.CurveGeometry Convert a ``Curve`` object to a curve gRPC message. :Parameters: **curve** : :obj:`Curve` Curve to convert. :Returns: :obj:`GRPCCurve` Return ``Curve`` as a ``ansys.api.geometry.CurveGeometry`` message. .. !! processed by numpydoc !! .. py:function:: trimmed_curve_to_grpc_trimmed_curve(curve: ansys.geometry.core.shapes.curves.trimmed_curve.TrimmedCurve) -> ansys.api.geometry.v0.models_pb2.TrimmedCurve Convert a ``TrimmedCurve`` to a trimmed curve gRPC message. :Parameters: **curve** : :obj:`TrimmedCurve` Curve to convert. :Returns: :obj:`GRPCTrimmedCurve` Geometry service gRPC ``TrimmedCurve`` message. .. !! processed by numpydoc !!