Skip to content

Commit 6ac79b1

Browse files
fix grpc surface conversion
1 parent 0281b93 commit 6ac79b1

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/ansys/geometry/core/_grpc/_services/v1/conversions.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,11 @@ def from_grpc_edge_tess_to_pd(tess: GRPCEdgeTessellation) -> "pv.PolyData":
478478

479479
def from_grpc_edge_tess_to_raw_data(tess: GRPCEdgeTessellation) -> dict:
480480
"""Convert a ``EdgeTessellation`` to raw data."""
481-
return {"vertices": [coord for pt in tess.vertices for coord in (pt.x, pt.y, pt.z)]}
481+
return {
482+
"vertices": [
483+
coord.value_in_geometry_units for pt in tess.vertices for coord in (pt.x, pt.y, pt.z)
484+
]
485+
}
482486

483487

484488
def from_tess_options_to_grpc_tess_options(
@@ -1204,15 +1208,18 @@ def from_grpc_surface_to_surface(surface: GRPCSurface, surface_type: "SurfaceTyp
12041208
origin = from_grpc_point_to_point3d(surface.origin)
12051209
axis = UnitVector3D([surface.axis.x, surface.axis.y, surface.axis.z])
12061210
reference = UnitVector3D([surface.reference.x, surface.reference.y, surface.reference.z])
1211+
radius = surface.radius.value_in_geometry_units
1212+
major_radius = surface.major_radius.value_in_geometry_units
1213+
minor_radius = surface.minor_radius.value_in_geometry_units
12071214

12081215
if surface_type == SurfaceType.SURFACETYPE_CONE:
1209-
result = Cone(origin, surface.radius, surface.half_angle, reference, axis)
1216+
result = Cone(origin, radius, surface.half_angle.value_in_geometry_units, reference, axis)
12101217
elif surface_type == SurfaceType.SURFACETYPE_CYLINDER:
1211-
result = Cylinder(origin, surface.radius, reference, axis)
1218+
result = Cylinder(origin, radius, reference, axis)
12121219
elif surface_type == SurfaceType.SURFACETYPE_SPHERE:
1213-
result = Sphere(origin, surface.radius, reference, axis)
1220+
result = Sphere(origin, radius, reference, axis)
12141221
elif surface_type == SurfaceType.SURFACETYPE_TORUS:
1215-
result = Torus(origin, surface.major_radius, surface.minor_radius, reference, axis)
1222+
result = Torus(origin, major_radius, minor_radius, reference, axis)
12161223
elif surface_type == SurfaceType.SURFACETYPE_PLANE:
12171224
result = PlaneSurface(origin, reference, axis)
12181225
else:

0 commit comments

Comments
 (0)