Skip to content

Commit 68f0981

Browse files
add design points from get assembly and remove None type from design point constructor
1 parent 5442275 commit 68f0981

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

src/ansys/geometry/core/_grpc/_services/v0/designs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,9 @@ def serialize_beam(beam):
432432
def serialize_design_point(design_point):
433433
return {
434434
"id": design_point.id,
435-
"parent": design_point.owner_name,
435+
"name": design_point.owner_name,
436+
"point": from_grpc_point_to_point3d(design_point.points[0]),
437+
"parent_id": design_point.parent_id.id,
436438
}
437439

438440
parts = getattr(response, "parts", [])

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,6 +1308,18 @@ def __read_existing_design(self) -> None:
13081308
component.coordinate_systems.append(new_cs)
13091309
num_created_coord_systems += 1
13101310

1311+
# Create DesignPoints
1312+
for dp in response.get("design_points"):
1313+
created_dp = DesignPoint(
1314+
dp.get("id"),
1315+
dp.get("name"),
1316+
dp.get("point"),
1317+
created_components.get(dp.get("parent_id"), self),
1318+
)
1319+
1320+
# Append the design point to the component to which it belongs
1321+
created_dp.parent_component._design_points.append(created_dp)
1322+
13111323
end = time.time()
13121324

13131325
# Set SharedTopology

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,12 @@ class DesignPoint:
4646
User-defined label for the design points.
4747
points : Point3D
4848
3D point constituting the design points.
49-
parent_component : Component | None
49+
parent_component : Component
5050
Parent component to place the new design point under within the design assembly.
51-
Its default value is None.
5251
"""
5352

5453
def __init__(
55-
self, id: str, name: str, point: Point3D, parent_component: Union["Component", None] = None
54+
self, id: str, name: str, point: Point3D, parent_component: Union["Component"]
5655
):
5756
"""Initialize the ``DesignPoints`` class."""
5857
self._id = id

0 commit comments

Comments
 (0)