Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8d16dc3
implement faces v1 - needs testing
jacobrkerstetter Nov 21, 2025
fb08ca4
Merge branch 'main' of https://github.com/ansys/pyansys-geometry into…
jacobrkerstetter Nov 24, 2025
2a3fe73
added quantity conversion and fixed a few faces bugs
jacobrkerstetter Nov 24, 2025
6ee5a1d
wip
jacobrkerstetter Nov 24, 2025
2e1887d
faces/edges wip - failing some tests
jacobrkerstetter Nov 24, 2025
c9b613a
reverting v1 hardcode
jacobrkerstetter Nov 25, 2025
f3b7477
chore: auto fixes from pre-commit hooks
pre-commit-ci[bot] Nov 25, 2025
5e8b48c
chore: adding changelog file 2412.maintenance.md [dependabot-skip]
pyansys-ci-bot Nov 25, 2025
c421ab3
extracting entity identifier id's
jacobrkerstetter Nov 25, 2025
f9a6f39
Merge branch 'chore/v1_faces_edges_impl' of https://github.com/ansys/…
jacobrkerstetter Nov 25, 2025
903bd46
fix offsetfaces todo
jacobrkerstetter Nov 25, 2025
b7b53f9
Merge branch 'main' into chore/v1_faces_edges_impl
jacobrkerstetter Nov 25, 2025
7ef54ea
resolving comments
jacobrkerstetter Nov 25, 2025
1fa600b
Merge branch 'main' into chore/v1_faces_edges_impl
jacobrkerstetter Nov 25, 2025
bf487d4
Merge branch 'main' into chore/v1_faces_edges_impl
jacobrkerstetter Nov 25, 2025
b8ce12f
wip
jacobrkerstetter Nov 25, 2025
2a0fdc9
final impl's
jacobrkerstetter Nov 25, 2025
f2d3bc3
full impl of patterns
jacobrkerstetter Nov 25, 2025
7187ea1
Merge branch 'main' into chore/v1_patterns_impl
jacobrkerstetter Nov 25, 2025
023b071
chore: auto fixes from pre-commit hooks
pre-commit-ci[bot] Nov 25, 2025
5f8ede5
chore: adding changelog file 2416.maintenance.md [dependabot-skip]
pyansys-ci-bot Nov 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/2416.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
V1 implementation of patterns stub
197 changes: 189 additions & 8 deletions src/ansys/geometry/core/_grpc/_services/v1/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@
import grpc

from ansys.geometry.core.errors import protect_grpc
from ansys.geometry.core.misc.measurements import Distance

from ..base.patterns import GRPCPatternsService
from .conversions import (
build_grpc_id,
from_angle_to_grpc_quantity,
from_length_to_grpc_quantity,
)


class GRPCPatternsServiceV1(GRPCPatternsService): # pragma: no cover
Expand All @@ -43,30 +49,205 @@ class GRPCPatternsServiceV1(GRPCPatternsService): # pragma: no cover

@protect_grpc
def __init__(self, channel: grpc.Channel): # noqa: D102
from ansys.api.geometry.v1.patterns_pb2_grpc import PatternsStub
from ansys.api.discovery.v1.design.relationships.pattern_pb2_grpc import PatternStub

self.stub = PatternsStub(channel)
self.stub = PatternStub(channel)

@protect_grpc
def create_linear_pattern(self, **kwargs) -> dict: # noqa: D102
raise NotImplementedError
from ansys.api.discovery.v1.design.relationships.pattern_pb2 import (
LinearPatternCreationRequest,
LinearPatternCreationRequestData,
)

# Create the request - assumes all inputs are valid and of the proper type
request = LinearPatternCreationRequest(
request_data=[
LinearPatternCreationRequestData(
selection_ids=[build_grpc_id(id) for id in kwargs["selection_ids"]],
linear_direction_id=build_grpc_id(kwargs["linear_direction_id"]),
count_x=kwargs["count_x"],
pitch_x=from_length_to_grpc_quantity(kwargs["pitch_x"]),
two_dimensional=kwargs["two_dimensional"],
count_y=kwargs["count_y"],
pitch_y=(
from_length_to_grpc_quantity(kwargs["pitch_y"])
if kwargs["pitch_y"]
else from_length_to_grpc_quantity(Distance(0))
),
Comment on lines +73 to +77
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this come from the call itself? I would rather avoid any logic inside the _grpc layer

)
]
)

# Call the gRPC service
response = self.stub.CreateLinear(request)

# Return the response - formatted as a dictionary
return {
"success": response.tracked_creation_response.creation_response.success,
}

@protect_grpc
def modify_linear_pattern(self, **kwargs) -> dict: # noqa: D102
raise NotImplementedError
from ansys.api.discovery.v1.design.relationships.pattern_pb2 import (
SetLinearPatternDataRequest,
SetLinearPatternDataRequestData,
)

# Create the request - assumes all inputs are valid and of the proper type
request = SetLinearPatternDataRequest(
request_data=[
SetLinearPatternDataRequestData(
selection_ids=[build_grpc_id(id) for id in kwargs["selection_ids"]],
count_x=kwargs["count_x"],
pitch_x=from_length_to_grpc_quantity(kwargs["pitch_x"]),
count_y=kwargs["count_y"],
pitch_y=from_length_to_grpc_quantity(kwargs["pitch_y"]),
new_seed_index=kwargs["new_seed_index"],
old_seed_index=kwargs["old_seed_index"],
)
]
)

# Call the gRPC service
response = self.stub.SetLinearData(request)

# Return the response - formatted as a dictionary
return {
"success": response.tracked_set_response.set_response.success,
}

@protect_grpc
def create_circular_pattern(self, **kwargs) -> dict: # noqa: D102
raise NotImplementedError
from ansys.api.discovery.v1.design.relationships.pattern_pb2 import (
CircularPatternCreationRequest,
CircularPatternCreationRequestData,
)

from ansys.geometry.core.shapes.curves.line import Line

from .conversions import from_line_to_grpc_line, from_unit_vector_to_grpc_direction

# Create direction if not None
radial_direction = (
from_unit_vector_to_grpc_direction(kwargs["radial_direction"])
if kwargs["radial_direction"] is not None
else None
)

# Create linear pitch if not None
linear_pitch = (
from_length_to_grpc_quantity(kwargs["linear_pitch"])
if kwargs["linear_pitch"]
else from_length_to_grpc_quantity(Distance(0.0))
)
Comment on lines +138 to +143
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here


# Create line if axis is a line object
circular_axis, axis = None, None
if isinstance(kwargs["circular_axis"], Line):
axis = from_line_to_grpc_line(kwargs["circular_axis"])
else:
circular_axis = build_grpc_id(kwargs["circular_axis"])

# Create the request - assumes all inputs are valid and of the proper type
request = CircularPatternCreationRequest(
request_data=[
CircularPatternCreationRequestData(
selection_ids=[build_grpc_id(id) for id in kwargs["selection_ids"]],
circular_count=kwargs["circular_count"],
edge_axis_id=circular_axis,
circular_angle=from_angle_to_grpc_quantity(kwargs["circular_angle"]),
two_dimensional=kwargs["two_dimensional"],
linear_count=kwargs["linear_count"],
linear_pitch=linear_pitch,
radial_direction=radial_direction,
line_axis=axis,
)
]
)

# Call the gRPC service
response = self.stub.CreateCircular(request)

# Return the response - formatted as a dictionary
return {
"success": response.tracked_creation_response.creation_response.success,
}

@protect_grpc
def modify_circular_pattern(self, **kwargs) -> dict: # noqa: D102
raise NotImplementedError
from ansys.api.discovery.v1.design.relationships.pattern_pb2 import (
SetCircularPatternDataRequest,
SetCircularPatternDataRequestData,
)

# Create the request - assumes all inputs are valid and of the proper type
request = SetCircularPatternDataRequest(
request_data=[
SetCircularPatternDataRequestData(
selection_ids=[build_grpc_id(id) for id in kwargs["selection_ids"]],
circular_count=kwargs["circular_count"],
linear_count=kwargs["linear_count"],
step_angle=from_angle_to_grpc_quantity(kwargs["step_angle"]),
step_linear=from_length_to_grpc_quantity(kwargs["step_linear"]),
)
]
)

# Call the gRPC service
response = self.stub.SetCircularData(request)

# Return the response - formatted as a dictionary
return {
"success": response.tracked_set_response.set_response.success,
}

@protect_grpc
def create_fill_pattern(self, **kwargs) -> dict: # noqa: D102
raise NotImplementedError
from ansys.api.discovery.v1.design.relationships.pattern_pb2 import (
FillPatternCreationRequest,
FillPatternCreationRequestData,
)

# Create the request - assumes all inputs are valid and of the proper type
request = FillPatternCreationRequest(
request_data=[
FillPatternCreationRequestData(
selection_ids=[build_grpc_id(id) for id in kwargs["selection_ids"]],
linear_direction_id=build_grpc_id(kwargs["linear_direction_id"]),
fill_pattern_type=kwargs["fill_pattern_type"].value,
margin=from_length_to_grpc_quantity(kwargs["margin"]),
x_spacing=from_length_to_grpc_quantity(kwargs["x_spacing"]),
y_spacing=from_length_to_grpc_quantity(kwargs["y_spacing"]),
row_x_offset=from_length_to_grpc_quantity(kwargs["row_x_offset"]),
row_y_offset=from_length_to_grpc_quantity(kwargs["row_y_offset"]),
column_x_offset=from_length_to_grpc_quantity(kwargs["column_x_offset"]),
column_y_offset=from_length_to_grpc_quantity(kwargs["column_y_offset"]),
)
]
)

# Call the gRPC service
response = self.stub.CreateFill(request)

# Return the response - formatted as a dictionary
return {
"success": response.tracked_creation_response.creation_response.success,
}

@protect_grpc
def update_fill_pattern(self, **kwargs) -> dict: # noqa: D102
raise NotImplementedError
from ansys.api.discovery.v1.design.relationships.pattern_pb2 import UpdateFillRequest

# Create the request - assumes all inputs are valid and of the proper type
request = UpdateFillRequest(
ids=[build_grpc_id(id) for id in kwargs["selection_ids"]],
)

# Call the gRPC service
response = self.stub.UpdateFill(request)

# Return the response - formatted as a dictionary
return {
"success": response.tracked_command_response.command_response.success,
}
Loading