Skip to content

Commit 4bda50f

Browse files
committed
Merge branch 'main' into release/0.5
2 parents 4f5db55 + 5a1f6cf commit 4bda50f

File tree

6 files changed

+39
-3
lines changed

6 files changed

+39
-3
lines changed

doc/changelog.d/1175.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fix: semver intersphinx mapping not resolved properly

doc/changelog.d/1176.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fix: start and end points for edge

src/ansys/geometry/core/connection/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,13 @@ def backend_type(self) -> BackendType:
217217
return self._backend_type
218218

219219
@property
220-
def backend_version(self) -> semver.Version:
220+
def backend_version(self) -> semver.version.Version:
221221
"""
222222
Get the current backend version.
223223
224224
Returns
225225
-------
226-
~semver.Version
226+
~semver.version.Version
227227
Backend version.
228228
"""
229229
return self._backend_version

src/ansys/geometry/core/designer/edge.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ def is_reversed(self) -> bool:
107107
return self._is_reversed
108108

109109
@property
110+
@protect_grpc
111+
@ensure_design_is_active
110112
@min_backend_version(24, 2, 0)
111113
def shape(self) -> TrimmedCurve:
112114
"""
@@ -175,3 +177,29 @@ def faces(self) -> List["Face"]:
175177
)
176178
for grpc_face in grpc_faces
177179
]
180+
181+
@property
182+
@protect_grpc
183+
@ensure_design_is_active
184+
def start(self) -> Point3D:
185+
"""Start point of the edge."""
186+
try:
187+
return self.shape.start
188+
except GeometryRuntimeError: # pragma: no cover
189+
# Only for versions earlier than 24.2.0 (before the introduction of the shape property)
190+
self._grpc_client.log.debug("Requesting edge start point from server.")
191+
response = self._edges_stub.GetStartAndEndPoints(self._grpc_id)
192+
return Point3D([response.start.x, response.start.y, response.start.z])
193+
194+
@property
195+
@protect_grpc
196+
@ensure_design_is_active
197+
def end(self) -> Point3D:
198+
"""End point of the edge."""
199+
try:
200+
return self.shape.end
201+
except GeometryRuntimeError: # pragma: no cover
202+
# Only for versions earlier than 24.2.0 (before the introduction of the shape property)
203+
self._grpc_client.log.debug("Requesting edge end point from server.")
204+
response = self._edges_stub.GetStartAndEndPoints(self._grpc_id)
205+
return Point3D([response.end.x, response.end.y, response.end.z])

src/ansys/geometry/core/designer/face.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ def body(self) -> "Body":
200200
return self._body
201201

202202
@property
203+
@protect_grpc
204+
@ensure_design_is_active
203205
@min_backend_version(24, 2, 0)
204206
def shape(self) -> TrimmedSurface:
205207
"""
@@ -284,6 +286,7 @@ def loops(self) -> List[FaceLoop]:
284286
return loops
285287

286288
@protect_grpc
289+
@ensure_design_is_active
287290
def normal(self, u: float = 0.5, v: float = 0.5) -> UnitVector3D:
288291
"""
289292
Get the normal direction to the face at certain proportional UV coordinates.
@@ -319,6 +322,7 @@ def normal(self, u: float = 0.5, v: float = 0.5) -> UnitVector3D:
319322
return UnitVector3D([response.x, response.y, response.z])
320323

321324
@protect_grpc
325+
@ensure_design_is_active
322326
def point(self, u: float = 0.5, v: float = 0.5) -> Point3D:
323327
"""
324328
Get a point of the face evaluated at certain proportional UV coordinates.
@@ -381,6 +385,8 @@ def __grpc_edges_to_edges(self, edges_grpc: List[GRPCEdge]) -> List[Edge]:
381385
)
382386
return edges
383387

388+
@protect_grpc
389+
@ensure_design_is_active
384390
def create_isoparametric_curves(
385391
self, use_u_param: bool, parameter: float
386392
) -> List[TrimmedCurve]:

src/ansys/geometry/core/plotting/plotter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def add_body_edges(self, body_plot: GeomObjectPlot, **plotting_options: Optional
256256
"""
257257
edge_plot_list = []
258258
for edge in body_plot.object.edges:
259-
line = pv.Line(edge.shape.start, edge.shape.start)
259+
line = pv.Line(edge.start, edge.end)
260260
edge_actor = self.scene.add_mesh(
261261
line, line_width=10, color=EDGE_COLOR, **plotting_options
262262
)

0 commit comments

Comments
 (0)