Skip to content

Commit 3c2c4fa

Browse files
Variable renames (#530)
Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com>
1 parent f604299 commit 3c2c4fa

File tree

6 files changed

+58
-58
lines changed

6 files changed

+58
-58
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""Provides the PyGeometry ``designer`` subpackage."""
22

3-
from ansys.geometry.core.designer.body import Body, MidSurfaceOffsetType, TemplateBody
3+
from ansys.geometry.core.designer.body import Body, MasterBody, MidSurfaceOffsetType
44
from ansys.geometry.core.designer.component import Component, SharedTopologyType
55
from ansys.geometry.core.designer.design import Design, DesignFileFormat
66
from ansys.geometry.core.designer.designpoint import DesignPoint
77
from ansys.geometry.core.designer.edge import CurveType, Edge
88
from ansys.geometry.core.designer.face import Face, SurfaceType
9-
from ansys.geometry.core.designer.part import Part, TransformedPart
9+
from ansys.geometry.core.designer.part import MasterComponent, Part
1010
from ansys.geometry.core.designer.selection import NamedSelection

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class IBody(ABC):
5858
"""
5959
Abstract Body interface.
6060
61-
Defines the common methods for a body. TemplateBody and Body both inherit from this.
61+
Defines the common methods for a body. MasterBody and Body both inherit from this.
6262
All child classes must implement all abstract methods.
6363
"""
6464

@@ -443,7 +443,7 @@ def unite(self, other: "Body") -> None:
443443
return
444444

445445

446-
class TemplateBody(IBody):
446+
class MasterBody(IBody):
447447
"""
448448
Represents solids and surfaces organized within the design assembly.
449449
@@ -460,7 +460,7 @@ class TemplateBody(IBody):
460460
grpc_client : GrpcClient
461461
An active supporting geometry service instance for design modeling.
462462
is_surface : bool, default: False
463-
Boolean indicating whether the ``TemplateBody`` is in fact a surface or an actual
463+
Boolean indicating whether the ``MasterBody`` is in fact a surface or an actual
464464
3D object (with volume).
465465
"""
466466

@@ -471,7 +471,7 @@ def __init__(
471471
grpc_client: GrpcClient,
472472
is_surface: bool = False,
473473
):
474-
"""Initialize ``TemplateBody`` class."""
474+
"""Initialize ``MasterBody`` class."""
475475
check_type(id, str)
476476
check_type(name, str)
477477
check_type(grpc_client, GrpcClient)
@@ -489,7 +489,7 @@ def __init__(
489489
self._tessellation = None
490490

491491
def reset_tessellation_cache(func):
492-
"""Decorate ``TemplateBody`` methods that require a tessellation cache update.
492+
"""Decorate ``MasterBody`` methods that require a tessellation cache update.
493493
494494
Parameters
495495
----------
@@ -503,7 +503,7 @@ def reset_tessellation_cache(func):
503503
"""
504504

505505
@wraps(func)
506-
def wrapper(self: "TemplateBody", *args, **kwargs):
506+
def wrapper(self: "MasterBody", *args, **kwargs):
507507
self._tessellation = None
508508
return func(self, *args, **kwargs)
509509

@@ -614,7 +614,7 @@ def imprint_curves(
614614
) -> Tuple[List[Edge], List[Face]]: # noqa: D102
615615
raise NotImplementedError(
616616
"""
617-
imprint_curves is not implemented at the TemplateBody level.
617+
imprint_curves is not implemented at the MasterBody level.
618618
Instead, call this method on a Body.
619619
"""
620620
)
@@ -630,7 +630,7 @@ def project_curves(
630630
) -> List[Face]: # noqa: D102
631631
raise NotImplementedError(
632632
"""
633-
project_curves is not implemented at the TemplateBody level.
633+
project_curves is not implemented at the MasterBody level.
634634
Instead, call this method on a Body.
635635
"""
636636
)
@@ -676,7 +676,7 @@ def copy(self, parent: "Component", name: str = None) -> "Body": # noqa: D102
676676
)
677677

678678
# Assign the new body to its specified parent (and return the new body)
679-
tb = TemplateBody(
679+
tb = MasterBody(
680680
response.master_id, copy_name, self._grpc_client, is_surface=self.is_surface
681681
)
682682
parent._transformed_part.part.bodies.append(tb)
@@ -726,23 +726,23 @@ def plot(
726726

727727
def intersect(self, other: "Body") -> None: # noqa: D102
728728
raise NotImplementedError(
729-
"TemplateBody does not implement boolean methods. Call this method on a Body instead."
729+
"MasterBody does not implement boolean methods. Call this method on a Body instead."
730730
)
731731

732732
def subtract(self, other: "Body") -> None: # noqa: D102
733733
raise NotImplementedError(
734-
"TemplateBody does not implement boolean methods. Call this method on a Body instead."
734+
"MasterBody does not implement boolean methods. Call this method on a Body instead."
735735
)
736736

737737
def unite(self, other: "Body") -> None:
738738
# noqa: D102
739739
raise NotImplementedError(
740-
"TemplateBody does not implement boolean methods. Call this method on a Body instead."
740+
"MasterBody does not implement boolean methods. Call this method on a Body instead."
741741
)
742742

743743
def __repr__(self) -> str:
744-
"""Represent the ``TemplateBody`` as a string."""
745-
lines = [f"ansys.geometry.core.designer.TemplateBody {hex(id(self))}"]
744+
"""Represent the ``MasterBody`` as a string."""
745+
lines = [f"ansys.geometry.core.designer.MasterBody {hex(id(self))}"]
746746
lines.append(f" Name : {self.name}")
747747
lines.append(f" Exists : {self.is_alive}")
748748
lines.append(f" Surface body : {self.is_surface}")
@@ -767,11 +767,11 @@ class Body(IBody):
767767
User-defined label for the body.
768768
parent : Component
769769
Parent component to nest the new component under within the design assembly.
770-
template : TemplateBody
770+
template : MasterBody
771771
The master body that this body is an occurrence of.
772772
"""
773773

774-
def __init__(self, id, name, parent: "Component", template: TemplateBody) -> None:
774+
def __init__(self, id, name, parent: "Component", template: MasterBody) -> None:
775775
"""Initialize ``Body`` class."""
776776
self._id = id
777777
self._name = name
@@ -1016,7 +1016,7 @@ def __repr__(self) -> str:
10161016
lines.append(f" Name : {self.name}")
10171017
lines.append(f" Exists : {self.is_alive}")
10181018
lines.append(f" Parent component : {self._parent.name}")
1019-
lines.append(f" TemplateBody : {self._template.id}")
1019+
lines.append(f" MasterBody : {self._template.id}")
10201020
lines.append(f" Surface body : {self.is_surface}")
10211021
if self.is_surface:
10221022
lines.append(f" Surface thickness : {self.surface_thickness}")

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434
)
3535
from ansys.geometry.core.connection.conversions import point3d_to_grpc_point
3636
from ansys.geometry.core.designer.beam import Beam, BeamProfile
37-
from ansys.geometry.core.designer.body import Body, TemplateBody
37+
from ansys.geometry.core.designer.body import Body, MasterBody
3838
from ansys.geometry.core.designer.coordinate_system import CoordinateSystem
3939
from ansys.geometry.core.designer.designpoint import DesignPoint
4040
from ansys.geometry.core.designer.face import Face
41-
from ansys.geometry.core.designer.part import Part, TransformedPart
41+
from ansys.geometry.core.designer.part import MasterComponent, Part
4242
from ansys.geometry.core.errors import protect_grpc
4343
from ansys.geometry.core.math import (
4444
IDENTITY_MATRIX44,
@@ -87,7 +87,7 @@ class Component:
8787
If a component already exists on the server, you can pass in its ID to create it on the
8888
client-side data model. If this is argument is present, a new Component will not be created
8989
on the server.
90-
transformed_part : TransformedPart, optional
90+
transformed_part : MasterComponent, optional
9191
This argument should be present when creating a nested instance component. It will use the
9292
given transformed_part instead of creating a new one.
9393
read_existing_comp : bool, optional
@@ -112,7 +112,7 @@ def __init__(
112112
grpc_client: GrpcClient,
113113
template: Optional["Component"] = None,
114114
preexisting_id: Optional[str] = None,
115-
transformed_part: Optional[TransformedPart] = None,
115+
transformed_part: Optional[MasterComponent] = None,
116116
read_existing_comp: bool = False,
117117
):
118118
"""Initialize ``Component`` class."""
@@ -152,8 +152,8 @@ def __init__(
152152
if template:
153153
# If this is not a nested instance
154154
if not transformed_part:
155-
# Create new TransformedPart, but use template's Part
156-
tp = TransformedPart(
155+
# Create new MasterComponent, but use template's Part
156+
tp = MasterComponent(
157157
uuid.uuid4(),
158158
f"tp_{name}",
159159
template._transformed_part.part,
@@ -167,9 +167,9 @@ def __init__(
167167
return
168168

169169
elif not read_existing_comp:
170-
# This is an independent Component - Create new Part and TransformedPart
170+
# This is an independent Component - Create new Part and MasterComponent
171171
p = Part(uuid.uuid4(), f"p_{name}", [], [])
172-
tp = TransformedPart(uuid.uuid4(), f"tp_{name}", p)
172+
tp = MasterComponent(uuid.uuid4(), f"tp_{name}", p)
173173
p.parts.append(tp)
174174
self._transformed_part = tp
175175

@@ -401,7 +401,7 @@ def extrude_sketch(
401401

402402
self._grpc_client.log.debug(f"Extruding sketch provided on {self.id}. Creating body...")
403403
response = self._bodies_stub.CreateExtrudedBody(request)
404-
tb = TemplateBody(response.master_id, name, self._grpc_client, is_surface=False)
404+
tb = MasterBody(response.master_id, name, self._grpc_client, is_surface=False)
405405
self._transformed_part.part.bodies.append(tb)
406406
return Body(response.id, response.name, self, tb)
407407

@@ -448,7 +448,7 @@ def extrude_face(self, name: str, face: Face, distance: Union[Quantity, Distance
448448
self._grpc_client.log.debug(f"Extruding from face provided on {self.id}. Creating body...")
449449
response = self._bodies_stub.CreateExtrudedBodyFromFaceProfile(request)
450450

451-
tb = TemplateBody(response.master_id, name, self._grpc_client, is_surface=False)
451+
tb = MasterBody(response.master_id, name, self._grpc_client, is_surface=False)
452452
self._transformed_part.part.bodies.append(tb)
453453
return Body(response.id, response.name, self, tb)
454454

@@ -485,7 +485,7 @@ def create_surface(self, name: str, sketch: Sketch) -> Body:
485485
)
486486
response = self._bodies_stub.CreatePlanarBody(request)
487487

488-
tb = TemplateBody(response.master_id, name, self._grpc_client, is_surface=True)
488+
tb = MasterBody(response.master_id, name, self._grpc_client, is_surface=True)
489489
self._transformed_part.part.bodies.append(tb)
490490
return Body(response.id, response.name, self, tb)
491491

@@ -525,7 +525,7 @@ def create_surface_from_face(self, name: str, face: Face) -> Body:
525525
)
526526
response = self._bodies_stub.CreateBodyFromFace(request)
527527

528-
tb = TemplateBody(response.master_id, name, self._grpc_client, is_surface=True)
528+
tb = MasterBody(response.master_id, name, self._grpc_client, is_surface=True)
529529
self._transformed_part.part.bodies.append(tb)
530530
return Body(response.id, response.name, self, tb)
531531

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131
point3d_to_grpc_point,
3232
)
3333
from ansys.geometry.core.designer.beam import Beam, BeamCircularProfile, BeamProfile
34-
from ansys.geometry.core.designer.body import Body, MidSurfaceOffsetType, TemplateBody
34+
from ansys.geometry.core.designer.body import Body, MasterBody, MidSurfaceOffsetType
3535
from ansys.geometry.core.designer.component import Component, SharedTopologyType
3636
from ansys.geometry.core.designer.coordinate_system import CoordinateSystem
3737
from ansys.geometry.core.designer.designpoint import DesignPoint
3838
from ansys.geometry.core.designer.edge import Edge
3939
from ansys.geometry.core.designer.face import Face
40-
from ansys.geometry.core.designer.part import Part, TransformedPart
40+
from ansys.geometry.core.designer.part import MasterComponent, Part
4141
from ansys.geometry.core.designer.selection import NamedSelection
4242
from ansys.geometry.core.errors import protect_grpc
4343
from ansys.geometry.core.materials import Material, MaterialProperty, MaterialPropertyType
@@ -571,12 +571,12 @@ def __read_existing_design(self) -> None:
571571
created_bodies = {}
572572

573573
# Make dummy TP for design since server doesn't have one
574-
self._transformed_part = TransformedPart("1", "tp_design", created_parts[self.id])
574+
self._transformed_part = MasterComponent("1", "tp_design", created_parts[self.id])
575575

576-
# Create TransformedParts
576+
# Create MasterComponents
577577
for tp in response.transformed_parts:
578578
part = created_parts.get(tp.part_master.id)
579-
new_tp = TransformedPart(tp.id, tp.name, part, grpc_matrix_to_matrix(tp.placement))
579+
new_tp = MasterComponent(tp.id, tp.name, part, grpc_matrix_to_matrix(tp.placement))
580580
created_tps[tp.id] = new_tp
581581

582582
# Create Components
@@ -598,7 +598,7 @@ def __read_existing_design(self) -> None:
598598
# TODO: is_surface?
599599
for body in response.bodies:
600600
part = created_parts.get(body.parent_id)
601-
tb = TemplateBody(body.id, body.name, self._grpc_client)
601+
tb = MasterBody(body.id, body.name, self._grpc_client)
602602
part.bodies.append(tb)
603603
created_bodies[body.id] = tb
604604

@@ -647,7 +647,7 @@ def __read_existing_design(self) -> None:
647647
num_created_shared_topologies += 1
648648

649649
self._grpc_client.log.debug(f"Parts created: {len(created_parts)}")
650-
self._grpc_client.log.debug(f"TransformedParts created: {len(created_tps) + 1}")
650+
self._grpc_client.log.debug(f"MasterComponents created: {len(created_tps) + 1}")
651651
self._grpc_client.log.debug(f"Components created: {len(created_components)}")
652652
self._grpc_client.log.debug(f"Bodies created: {len(created_bodies)}")
653653
self._grpc_client.log.debug(f"Materials created: {len(self.materials)}")

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

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Provides the ``Part`` class module."""
22
from beartype.typing import List
33

4-
from ansys.geometry.core.designer.body import TemplateBody
4+
from ansys.geometry.core.designer.body import MasterBody
55
from ansys.geometry.core.math import IDENTITY_MATRIX44, Matrix44
66

77

@@ -17,20 +17,20 @@ class Part:
1717
Unique identifier for this part.
1818
name : str
1919
Name of this part.
20-
parts : List[TransformedPart]
21-
List of TransformedPart children that this Part contains.
22-
bodies : List[TemplateBody]
23-
List of TemplateBody children that this Part contains. These are master bodies.
20+
parts : List[MasterComponent]
21+
List of MasterComponent children that this Part contains.
22+
bodies : List[MasterBody]
23+
List of MasterBody children that this Part contains. These are master bodies.
2424
"""
2525

2626
def __init__(
27-
self, id: str, name: str, parts: List["TransformedPart"], bodies: List[TemplateBody]
27+
self, id: str, name: str, parts: List["MasterComponent"], bodies: List[MasterBody]
2828
) -> None:
2929
"""Initialize the ``Part`` class."""
3030
self._id: str = id
3131
self._name: str = name
32-
self._parts: List["TransformedPart"] = parts
33-
self._bodies: List[TemplateBody] = bodies
32+
self._parts: List["MasterComponent"] = parts
33+
self._bodies: List[MasterBody] = bodies
3434

3535
@property
3636
def id(self) -> str:
@@ -43,25 +43,25 @@ def name(self) -> str:
4343
return self._name
4444

4545
@property
46-
def parts(self) -> List["TransformedPart"]:
47-
"""``TransformedPart`` children that this ``Part`` contains."""
46+
def parts(self) -> List["MasterComponent"]:
47+
"""``MasterComponent`` children that this ``Part`` contains."""
4848
return self._parts
4949

5050
@parts.setter
51-
def parts(self, parts: List["TransformedPart"]) -> None:
51+
def parts(self, parts: List["MasterComponent"]) -> None:
5252
self._parts = parts
5353

5454
@property
55-
def bodies(self) -> List[TemplateBody]:
55+
def bodies(self) -> List[MasterBody]:
5656
"""
57-
``TemplateBody`` children that this ``Part`` contains.
57+
``MasterBody`` children that this ``Part`` contains.
5858
5959
These are master bodies.
6060
"""
6161
return self._bodies
6262

6363
@bodies.setter
64-
def bodies(self, bodies: List["TemplateBody"]) -> None:
64+
def bodies(self, bodies: List["MasterBody"]) -> None:
6565
self._bodies = bodies
6666

6767
def __repr__(self) -> str:
@@ -74,14 +74,14 @@ def __repr__(self) -> str:
7474
)
7575

7676

77-
class TransformedPart:
77+
class MasterComponent:
7878
"""
7979
Represents a Part Occurrence.
8080
8181
Notes
8282
-----
8383
This class should not be accessed by users.
84-
TransformedParts hold fundamental data of an assembly. TransformedParts wrap Parts
84+
MasterComponents hold fundamental data of an assembly. MasterComponents wrap Parts
8585
by adding a transform matrix.
8686
8787
Parameters
@@ -99,7 +99,7 @@ class TransformedPart:
9999
def __init__(
100100
self, id: str, name: str, part: Part, transform: Matrix44 = IDENTITY_MATRIX44
101101
) -> None:
102-
"""Initialize ``TransformedPart`` class."""
102+
"""Initialize ``MasterComponent`` class."""
103103
self._id: str = id
104104
self._name: str = name
105105
self._part: Part = part
@@ -130,9 +130,9 @@ def transform(self, matrix: Matrix44) -> None:
130130
self._transform = matrix
131131

132132
def __repr__(self) -> str:
133-
"""Represent the ``TransformedPart`` as a string."""
133+
"""Represent the ``MasterComponent`` as a string."""
134134
return (
135-
f"TransformedPart(id={self.id}, "
135+
f"MasterComponent(id={self.id}, "
136136
f"name={self.name}, "
137137
f"template={self.part}, "
138138
f"transform={self.transform})"

0 commit comments

Comments
 (0)