The conversions.py module#

Summary#

unit_vector_to_grpc_direction

Convert a UnitVector3D class to a unit vector gRPC message.

frame_to_grpc_frame

Convert a Frame class to a frame gRPC message.

plane_to_grpc_plane

Convert a Plane class to a plane gRPC message.

sketch_shapes_to_grpc_geometries

Convert lists of SketchEdge and SketchFace to a gRPC message.

sketch_edges_to_grpc_geometries

Convert a list of SketchEdge to a gRPC message.

sketch_arc_to_grpc_arc

Convert an Arc class to an arc gRPC message.

sketch_ellipse_to_grpc_ellipse

Convert a SketchEllipse class to an ellipse gRPC message.

sketch_circle_to_grpc_circle

Convert a SketchCircle class to a circle gRPC message.

point3d_to_grpc_point

Convert a Point3D class to a point gRPC message.

point2d_to_grpc_point

Convert a Point2D class to a point gRPC message.

sketch_polygon_to_grpc_polygon

Convert a Polygon class to a polygon gRPC message.

sketch_segment_to_grpc_line

Convert a Segment class to a line gRPC message.

tess_to_pd

Convert an ansys.api.geometry.Tessellation to pyvista.PolyData.

grpc_matrix_to_matrix

Convert an ansys.api.geometry.Matrix to a Matrix44.

grpc_frame_to_frame

Convert a frame gRPC message to a Frame class.

grpc_surface_to_surface

Convert a surface gRPC message to a Surface class.

grpc_curve_to_curve

Convert a curve gRPC message to a Curve.

curve_to_grpc_curve

Convert a Curve object to a curve gRPC message.

trimmed_curve_to_grpc_trimmed_curve

Convert a TrimmedCurve to a trimmed curve gRPC message.

surface_to_grpc_surface

Convert a Surface object to a surface gRPC message.

trimmed_surface_to_grpc_trimmed_surface

Convert a TrimmedSurface to a trimmed surface gRPC message.

Description#

Module providing for conversions.

Module detail#

conversions.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_vectorUnitVector3D

Source vector data.

Returns:
GRPCDirection

Geometry service gRPC direction message.

conversions.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:
frameFrame

Source frame data.

Returns:
GRPCFrame

Geometry service gRPC frame message. The unit for the frame origin is meters.

conversions.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:
planePlane

Source plane data.

Returns:
GRPCPlane

Geometry service gRPC plane message. The unit is meters.

conversions.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:
planePlane

Plane for positioning the 2D sketches.

edgeslist[SketchEdge]

Source edge data.

faceslist[SketchFace]

Source face data.

only_one_curvebool, default: False

Whether to project one curve of the whole set of geometries to enhance performance.

Returns:
GRPCGeometries

Geometry service gRPC geometries message. The unit is meters.

conversions.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:
edgeslist[SketchEdge]

Source edge data.

planePlane

Plane for positioning the 2D sketches.

Returns:
tuple[list[GRPCLine], list[GRPCArc]]

Geometry service gRPC line and arc messages. The unit is meters.

conversions.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:
arcArc

Source arc data.

planePlane

Plane for positioning the arc within.

Returns:
GRPCArc

Geometry service gRPC arc message. The unit is meters.

conversions.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:
ellipseSketchEllipse

Source ellipse data.

Returns:
GRPCEllipse

Geometry service gRPC ellipse message. The unit is meters.

conversions.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:
circleSketchCircle

Source circle data.

planePlane

Plane for positioning the circle.

Returns:
GRPCCircle

Geometry service gRPC circle message. The unit is meters.

conversions.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:
pointPoint3D

Source point data.

Returns:
GRPCPoint

Geometry service gRPC point message. The unit is meters.

conversions.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:
planePlane

Plane for positioning the 2D point.

pointPoint2D

Source point data.

Returns:
GRPCPoint

Geometry service gRPC point message. The unit is meters.

conversions.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:
polygonPolygon

Source polygon data.

Returns:
GRPCPolygon

Geometry service gRPC polygon message. The unit is meters.

conversions.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:
segmentSketchSegment

Source segment data.

Returns:
GRPCLine

Geometry service gRPC line message. The unit is meters.

conversions.tess_to_pd(tess: ansys.api.geometry.v0.models_pb2.Tessellation) pyvista.PolyData#

Convert an ansys.api.geometry.Tessellation to pyvista.PolyData.

conversions.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.

conversions.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:
frameFrame

Resulting converted frame.

conversions.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:
surfaceGRPCSurface

Geometry service gRPC surface message.

Returns:
Surface

Resulting converted surface.

conversions.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:
curveGRPCCurve

Geometry service gRPC curve message.

Returns:
Curve

Resulting converted curve.

conversions.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:
curveCurve

Curve to convert.

Returns:
GRPCCurve

Return Curve as a ansys.api.geometry.CurveGeometry message.

conversions.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:
curveTrimmedCurve

Curve to convert.

Returns:
GRPCTrimmedCurve

Geometry service gRPC TrimmedCurve message.

conversions.surface_to_grpc_surface(surface: ansys.geometry.core.shapes.surfaces.surface.Surface) tuple[ansys.api.geometry.v0.models_pb2.Surface, ansys.api.geometry.v0.models_pb2.SurfaceType]#

Convert a Surface object to a surface gRPC message.

Parameters:
surfaceSurface

Surface to convert.

Returns:
GRPCSurface

Return Surface as a ansys.api.geometry.Surface message.

GRPCSurfaceType

Return the grpc surface type of Surface.

conversions.trimmed_surface_to_grpc_trimmed_surface(trimmed_surface: ansys.geometry.core.shapes.surfaces.TrimmedSurface) ansys.api.geometry.v0.models_pb2.TrimmedSurface#

Convert a TrimmedSurface to a trimmed surface gRPC message.

Parameters:
trimmed_surfaceTrimmedSurface

Surface to convert.

Returns:
GRPCTrimmedSurface

Geometry service gRPC TrimmedSurface message.