Skip to content
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

Add is used flag to material #3854

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions _unittest/test_03_Materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ def test_09_non_linear_materials(self, add_app):
assert app.materials["myMat"].permittivity.type == "nonlinear"
assert app.materials["myMat"].permeability.bunit == "tesla"
mat2 = app.materials.add_material("myMat2")
assert not mat2.is_used
assert app.modeler.create_box([0, 0, 0], [10, 10, 10], matname="myMat2")
assert app.materials.material_keys["mymat2"].is_used

def test_10_add_material_sweep(self):
assert self.aedtapp.materials.add_material_sweep(["copper", "aluminum"], "sweep_copper")
Expand Down
8 changes: 8 additions & 0 deletions pyaedt/modules/Material.py
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,14 @@ def __init__(self, materials, name, props=None):
self.mod_since_lib = self._props["ModSinceLib"]
del self._props["ModSinceLib"]

@property
def is_used(self):
"""Checks if a project material is in use."""
is_used = self._omaterial_manager.IsUsed(self.name)
if is_used == 0:
return False
return True

@property
def coordinate_system(self):
"""Material coordinate system."""
Expand Down
Loading