Skip to content

Commit f2d3bc3

Browse files
full impl of patterns
1 parent 2a0fdc9 commit f2d3bc3

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@
2424
import grpc
2525

2626
from ansys.geometry.core.errors import protect_grpc
27+
from ansys.geometry.core.misc.measurements import Distance
2728

2829
from ..base.patterns import GRPCPatternsService
2930
from .conversions import (
3031
build_grpc_id,
31-
from_length_to_grpc_quantity,
3232
from_angle_to_grpc_quantity,
33+
from_length_to_grpc_quantity,
3334
)
3435

3536

@@ -63,16 +64,16 @@ def create_linear_pattern(self, **kwargs) -> dict: # noqa: D102
6364
request = LinearPatternCreationRequest(
6465
request_data=[
6566
LinearPatternCreationRequestData(
66-
selection_ids=kwargs["selection_ids"],
67-
linear_direction_id=kwargs["linear_direction_id"],
67+
selection_ids=[build_grpc_id(id) for id in kwargs["selection_ids"]],
68+
linear_direction_id=build_grpc_id(kwargs["linear_direction_id"]),
6869
count_x=kwargs["count_x"],
6970
pitch_x=from_length_to_grpc_quantity(kwargs["pitch_x"]),
7071
two_dimensional=kwargs["two_dimensional"],
7172
count_y=kwargs["count_y"],
7273
pitch_y=(
7374
from_length_to_grpc_quantity(kwargs["pitch_y"])
7475
if kwargs["pitch_y"]
75-
else 0.0
76+
else from_length_to_grpc_quantity(Distance(0))
7677
),
7778
)
7879
]
@@ -138,7 +139,7 @@ def create_circular_pattern(self, **kwargs) -> dict: # noqa: D102
138139
linear_pitch = (
139140
from_length_to_grpc_quantity(kwargs["linear_pitch"])
140141
if kwargs["linear_pitch"]
141-
else None
142+
else from_length_to_grpc_quantity(Distance(0.0))
142143
)
143144

144145
# Create line if axis is a line object
@@ -158,7 +159,7 @@ def create_circular_pattern(self, **kwargs) -> dict: # noqa: D102
158159
circular_angle=from_angle_to_grpc_quantity(kwargs["circular_angle"]),
159160
two_dimensional=kwargs["two_dimensional"],
160161
linear_count=kwargs["linear_count"],
161-
linear_pitch=from_length_to_grpc_quantity(linear_pitch),
162+
linear_pitch=linear_pitch,
162163
radial_direction=radial_direction,
163164
line_axis=axis,
164165
)
@@ -188,7 +189,7 @@ def modify_circular_pattern(self, **kwargs) -> dict: # noqa: D102
188189
circular_count=kwargs["circular_count"],
189190
linear_count=kwargs["linear_count"],
190191
step_angle=from_angle_to_grpc_quantity(kwargs["step_angle"]),
191-
step_linear=from_angle_to_grpc_quantity(kwargs["step_linear"]),
192+
step_linear=from_length_to_grpc_quantity(kwargs["step_linear"]),
192193
)
193194
]
194195
)

0 commit comments

Comments
 (0)