Skip to content

FEAT: Uncover face #6122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f08d46a
[refactor][pathlib] Refactor test_generic_filesystem.py for pathlib
jvela018 Apr 22, 2025
3b246ea
Merge branch 'main' of ssh://ssh.github.com:443/ansys/pyaedt
jvela018 May 2, 2025
b408448
Added automatic search in modeler getitem of FaceID and EdgeIds.
maxcapodi78 May 5, 2025
6122b14
chore: adding changelog file 6109.added.md [dependabot-skip]
pyansys-ci-bot May 5, 2025
e87f667
Merge branch 'main' of ssh://ssh.github.com:443/ansys/pyaedt
jvela018 May 5, 2025
e0d07e5
[enhancement][add] Add uncover face method to modeler class
jvela018 May 5, 2025
29154eb
Merge branch 'main' into add/uncover_face
jvela018 May 7, 2025
9fdded7
Merge branch 'main' into add/uncover_face
jvela018 May 7, 2025
4d4e967
chore: adding changelog file 6122.added.md [dependabot-skip]
pyansys-ci-bot May 7, 2025
069fa7d
[feat][uncover faces] revert changes in test_generic_filesystem.py
jvela018 May 7, 2025
8598e6f
Merge branch 'main' into add/uncover_face
jvela018 May 8, 2025
c24dc6f
[enhancement] Add multi face selection coming from different objects
jvela018 May 12, 2025
5f25712
Merge branch 'main' into add/uncover_face
jvela018 May 12, 2025
fe0b3e7
[enhancement] Update uncover_faces test
jvela018 May 12, 2025
35a7f70
[enhancement] Update uncover_faces test for coverage
jvela018 May 12, 2025
61e2190
Merge branch 'add/uncover_face' of ssh://ssh.github.com:443/ansys/pya…
jvela018 May 12, 2025
85a6845
[enhancement] Correct assert in test
jvela018 May 12, 2025
8619db9
Update src/ansys/aedt/core/modeler/cad/primitives.py
jvela018 May 12, 2025
2680ba4
Update src/ansys/aedt/core/modeler/cad/primitives.py
jvela018 May 12, 2025
b2e3aa3
Update src/ansys/aedt/core/modeler/cad/primitives.py
jvela018 May 12, 2025
a20f145
Update src/ansys/aedt/core/modeler/cad/primitives.py
jvela018 May 12, 2025
10f4c50
[enhancement] Fix formatting in example
jvela018 May 12, 2025
30fa0c6
Merge branch 'main' into add/uncover_face
jvela018 May 12, 2025
03bd7c2
Merge branch 'main' into add/uncover_face
Samuelopez-ansys May 13, 2025
40e7714
[tests] Correct create_circle call in test_97_uncover_faces
jvela018 May 13, 2025
d178926
[tests] Create item and item list tests for test_97_uncover_faces
jvela018 May 13, 2025
00dca2b
[enhancement][uncover_faces] Correct docstring parameters assignment:…
jvela018 May 13, 2025
dc2d1d4
[enhancement][uncover_faces] Correct example
jvela018 May 13, 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/6122.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Uncover face
60 changes: 60 additions & 0 deletions src/ansys/aedt/core/modeler/cad/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,66 @@
self.oeditor.CoverSurfaces(["NAME:Selections", "Selections:=", obj_to_cover, "NewPartsModelFlag:=", "Model"])
return True

@pyaedt_function_handler()
def uncover_faces(self, assignment):
"""Uncover faces.

Parameters
----------
assignment : list
Sheet objects to uncover.

Returns
-------
bool
``True`` when successful, ``False`` when failed.

References
----------
>>> oEditor.UncoverFaces

Examples
--------
>>> from ansys.aedt.core import Maxwell3D
>>> app = Maxwell3D()
>>> circle_1 = app.modeler.create_circle(cs_plane=0, position=[0, 0, 0], radius=3, name="Circle1")
>>> box_1 = app.modeler.create_box(origin=[-13.9 ,0 ,0],sizes=[27.8,-40,25.4], name="Box1")
>>> app.modeler.uncover_faces([circle_1.faces[0], [box_1.faces[0], box_1.faces[2]]])
"""

faces = {}
flat_assignment = []

Check warning on line 1512 in src/ansys/aedt/core/modeler/cad/primitives.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/modeler/cad/primitives.py#L1511-L1512

Added lines #L1511 - L1512 were not covered by tests

# create a flat list from assignment
for item in assignment:
if isinstance(item, list):
flat_assignment.extend(item)

Check warning on line 1517 in src/ansys/aedt/core/modeler/cad/primitives.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/modeler/cad/primitives.py#L1515-L1517

Added lines #L1515 - L1517 were not covered by tests
else:
flat_assignment.append(item)

Check warning on line 1519 in src/ansys/aedt/core/modeler/cad/primitives.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/modeler/cad/primitives.py#L1519

Added line #L1519 was not covered by tests

# loop through each item in the flattened list and create a dictionary
# associating object names to the face ids of faces to be uncovered
for fid in flat_assignment:
face_id = int(self.convert_to_selections(fid, False))
if fid.name not in faces.keys():
faces[fid.name] = [face_id]
elif fid.name in faces.keys():
faces[fid.name].append(face_id)

Check warning on line 1528 in src/ansys/aedt/core/modeler/cad/primitives.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/modeler/cad/primitives.py#L1523-L1528

Added lines #L1523 - L1528 were not covered by tests

# create variables used in the native api in the right format
# for selections a concatenated string and for faces_to_uncover a list of int
selections = ", ".join(str(x) for x in faces.keys())
faces_to_uncover = []
for key in faces.keys():
faces_to_uncover.append(["NAME:UncoverFacesParameters", "FacesToUncover:=", faces[key]])

Check warning on line 1535 in src/ansys/aedt/core/modeler/cad/primitives.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/modeler/cad/primitives.py#L1532-L1535

Added lines #L1532 - L1535 were not covered by tests
# call native api to uncover assigned faces
self.oeditor.UncoverFaces(

Check warning on line 1537 in src/ansys/aedt/core/modeler/cad/primitives.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/modeler/cad/primitives.py#L1537

Added line #L1537 was not covered by tests
["NAME:Selections", "Selections:=", selections, "NewPartsModelFlag:=", "Model"],
["NAME:Parameters", *faces_to_uncover],
)

return True

Check warning on line 1542 in src/ansys/aedt/core/modeler/cad/primitives.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/modeler/cad/primitives.py#L1542

Added line #L1542 was not covered by tests

@pyaedt_function_handler()
def create_coordinate_system(
self,
Expand Down
15 changes: 15 additions & 0 deletions tests/system/general/test_08_Primitives3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -2110,3 +2110,18 @@ def test_96_sweep_around_axis(self):
assert circle1.name in self.aedtapp.modeler.solid_names
assert circle2.name in self.aedtapp.modeler.solid_names
assert circle3.name in self.aedtapp.modeler.solid_names

def test_97_uncover_faces(self):
o1 = self.aedtapp.modeler.create_circle(cs_plane=0, position=[0, 0, 0], radius=10)
assert self.aedtapp.modeler.uncover_faces([o1.faces[0]])
c1 = self.aedtapp.modeler.create_circle(orientation=AXIS.X, origin=[0, 10, 20], radius="3", name="Circle1")
b1 = self.aedtapp.modeler.create_box(origin=[-13.9, 0, 0], sizes=[27.8, -40, 25.4], name="Box1")
assert self.aedtapp.modeler.uncover_faces([c1.faces[0], b1.faces[0], b1.faces[2]])
assert len(b1.faces) == 4
c2 = self.aedtapp.modeler.create_circle(orientation=AXIS.X, origin=[0, 10, 20], radius="3", name="Circle2")
b2 = self.aedtapp.modeler.create_box(origin=[-13.9, 0, 0], sizes=[27.8, -40, 25.4], name="Box2")
assert self.aedtapp.modeler.uncover_faces([c2.faces, b2.faces])
c3 = self.aedtapp.modeler.create_circle(orientation=AXIS.X, origin=[0, 10, 20], radius="3", name="Circle3")
b3 = self.aedtapp.modeler.create_box(origin=[-13.9, 0, 0], sizes=[27.8, -40, 25.4], name="Box3")
assert self.aedtapp.modeler.uncover_faces([c3.faces[0], b3.faces])
assert len(b3.faces) == 0
Loading