Skip to content

Commit 33a3df2

Browse files
docs: add warning section for minimum version on methods (#2062)
Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent 9ed72b9 commit 33a3df2

File tree

12 files changed

+364
-92
lines changed

12 files changed

+364
-92
lines changed

doc/changelog.d/2062.documentation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add warning section for minimum version on methods

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

Lines changed: 79 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,12 @@ def name(self) -> str:
148148

149149
@abstractmethod
150150
def set_name(self, str) -> None:
151-
"""Set the name of the body."""
151+
"""Set the name of the body.
152+
153+
Warnings
154+
--------
155+
This method is only available starting on Ansys release 25R1.
156+
"""
152157
return
153158

154159
@abstractmethod
@@ -158,17 +163,32 @@ def fill_style(self) -> FillStyle:
158163

159164
@abstractmethod
160165
def set_fill_style(self, fill_style: FillStyle) -> None:
161-
"""Set the fill style of the body."""
166+
"""Set the fill style of the body.
167+
168+
Warnings
169+
--------
170+
This method is only available starting on Ansys release 25R1.
171+
"""
162172
return
163173

164174
@abstractmethod
165175
def is_suppressed(self) -> bool:
166-
"""Get the body suppression state."""
176+
"""Get the body suppression state.
177+
178+
Warnings
179+
--------
180+
This method is only available starting on Ansys release 25R2.
181+
"""
167182
return
168183

169184
@abstractmethod
170185
def set_suppressed(self, suppressed: bool) -> None:
171-
"""Set the body suppression state."""
186+
"""Set the body suppression state.
187+
188+
Warnings
189+
--------
190+
This method is only available starting on Ansys release 25R2.
191+
"""
172192
return
173193

174194
@abstractmethod
@@ -182,14 +202,20 @@ def opacity(self) -> float:
182202
return
183203

184204
@abstractmethod
185-
def set_color(self, color: str | tuple[float, float, float]) -> None:
205+
def set_color(
206+
self, color: str | tuple[float, float, float] | tuple[float, float, float, float]
207+
) -> None:
186208
"""Set the color of the body.
187209
188210
Parameters
189211
----------
190-
color : str | tuple[float, float, float]
212+
color : str | tuple[float, float, float] | tuple[float, float, float, float]
191213
Color to set the body to. This can be a string representing a color name
192214
or a tuple of RGB values in the range [0, 1] (RGBA) or [0, 255] (pure RGB).
215+
216+
Warnings
217+
--------
218+
This method is only available starting on Ansys release 25R1.
193219
"""
194220
return
195221

@@ -272,6 +298,10 @@ def bounding_box(self) -> BoundingBox:
272298
-------
273299
BoundingBox
274300
Bounding box of the body.
301+
302+
Warnings
303+
--------
304+
This method is only available starting on Ansys release 25R2.
275305
"""
276306
return
277307

@@ -430,10 +460,6 @@ def translate(self, direction: UnitVector3D, distance: Quantity | Distance | Rea
430460
Direction of the translation.
431461
distance: ~pint.Quantity | Distance | Real
432462
Distance (magnitude) of the translation.
433-
434-
Returns
435-
-------
436-
None
437463
"""
438464
return
439465

@@ -455,57 +481,63 @@ def rotate(
455481
angle: ~pint.Quantity | Angle | Real
456482
Angle (magnitude) of the rotation.
457483
458-
Returns
459-
-------
460-
None
484+
Warnings
485+
--------
486+
This method is only available starting on Ansys release 24R2.
461487
"""
462488
return
463489

464490
@abstractmethod
465491
def scale(self, value: Real) -> None:
466492
"""Scale the geometry body by the given value.
467493
494+
The calling object is directly modified when this method is called.
495+
Thus, it is important to make copies if needed.
496+
468497
Parameters
469498
----------
470499
value: Real
471500
Value to scale the body by.
472501
473-
Notes
474-
-----
475-
The calling object is directly modified when this method is called.
476-
Thus, it is important to make copies if needed.
502+
Warnings
503+
--------
504+
This method is only available starting on Ansys release 24R2.
477505
"""
478506
return
479507

480508
@abstractmethod
481509
def map(self, frame: Frame) -> None:
482510
"""Map the geometry body to the new specified frame.
483511
512+
The calling object is directly modified when this method is called.
513+
Thus, it is important to make copies if needed.
514+
484515
Parameters
485516
----------
486517
frame: Frame
487518
Structure defining the orientation of the body.
488519
489-
Notes
490-
-----
491-
The calling object is directly modified when this method is called.
492-
Thus, it is important to make copies if needed.
520+
Warnings
521+
--------
522+
This method is only available starting on Ansys release 24R2.
493523
"""
494524
return
495525

496526
@abstractmethod
497527
def mirror(self, plane: Plane) -> None:
498528
"""Mirror the geometry body across the specified plane.
499529
530+
The calling object is directly modified when this method is called.
531+
Thus, it is important to make copies if needed.
532+
500533
Parameters
501534
----------
502535
plane: Plane
503536
Represents the mirror.
504537
505-
Notes
506-
-----
507-
The calling object is directly modified when this method is called.
508-
Thus, it is important to make copies if needed.
538+
Warnings
539+
--------
540+
This method is only available starting on Ansys release 24R2.
509541
"""
510542
return
511543

@@ -522,6 +554,10 @@ def get_collision(self, body: "Body") -> CollisionType:
522554
-------
523555
CollisionType
524556
Enum that defines the collision state between bodies.
557+
558+
Warnings
559+
--------
560+
This method is only available starting on Ansys release 24R2.
525561
"""
526562
return
527563

@@ -615,6 +651,10 @@ def shell_body(self, offset: Real) -> bool:
615651
-------
616652
bool
617653
``True`` when successful, ``False`` when failed.
654+
655+
Warnings
656+
--------
657+
This method is only available starting on Ansys release 25R2.
618658
"""
619659
return
620660

@@ -633,6 +673,10 @@ def remove_faces(self, selection: Face | Iterable[Face], offset: Real) -> bool:
633673
-------
634674
bool
635675
``True`` when successful, ``False`` when failed.
676+
677+
Warnings
678+
--------
679+
This method is only available starting on Ansys release 25R2.
636680
"""
637681
return
638682

@@ -1097,16 +1141,14 @@ def set_fill_style( # noqa: D102
10971141
def set_suppressed( # noqa: D102
10981142
self, suppressed: bool
10991143
) -> None:
1100-
"""Set the body suppression state."""
11011144
self._grpc_client.log.debug(f"Setting body {self.id}, as suppressed: {suppressed}.")
11021145
self._grpc_client.services.bodies.set_suppressed(bodies=[self.id], is_suppressed=suppressed)
11031146

11041147
@check_input_types
11051148
@min_backend_version(25, 1, 0)
1106-
def set_color(
1149+
def set_color( # noqa: D102
11071150
self, color: str | tuple[float, float, float] | tuple[float, float, float, float]
11081151
) -> None:
1109-
"""Set the color of the body."""
11101152
self._grpc_client.log.debug(f"Setting body color of {self.id} to {color}.")
11111153
color = convert_color_to_hex(color)
11121154
self._grpc_client.services.bodies.set_color(id=self.id, color=color)
@@ -1115,7 +1157,12 @@ def set_color(
11151157
@check_input_types
11161158
@min_backend_version(25, 2, 0)
11171159
def set_opacity(self, opacity: float) -> None:
1118-
"""Set the opacity of the body."""
1160+
"""Set the opacity of the body.
1161+
1162+
Warnings
1163+
--------
1164+
This method is only available starting on Ansys release 25R2.
1165+
"""
11191166
self._grpc_client.log.debug(f"Setting body opacity of {self.id} to {opacity}.")
11201167
opacity = convert_opacity_to_hex(opacity)
11211168
new_color = self.color[0:7] + opacity
@@ -1686,7 +1733,9 @@ def set_suppressed(self, suppressed: bool) -> None: # noqa: D102
16861733
return self._template.set_suppressed(suppressed)
16871734

16881735
@ensure_design_is_active
1689-
def set_color(self, color: str | tuple[float, float, float]) -> None: # noqa: D102
1736+
def set_color( # noqa: D102
1737+
self, color: str | tuple[float, float, float] | tuple[float, float, float, float]
1738+
) -> None:
16901739
return self._template.set_color(color)
16911740

16921741
@ensure_design_is_active

0 commit comments

Comments
 (0)