Skip to content

Added get_pyaedt_app unit test. Fixed bug in design name when design is Hfss3dLayout #849

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 1 commit into from
Feb 10, 2022
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
6 changes: 5 additions & 1 deletion _unittest/test_01_Design.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os

# Import required modules
from pyaedt import Hfss, Desktop
from pyaedt import Hfss, Desktop, get_pyaedt_app
from pyaedt.generic.filesystem import Scratch

# Setup paths for module imports
Expand Down Expand Up @@ -242,3 +242,7 @@ def test_27_odesktop(self):
assert str(type(self.aedtapp.odesktop)) == "<type 'ADesktopWrapper'>"
else:
assert str(type(self.aedtapp.odesktop)) == "<class 'win32com.client.CDispatch'>"

def test_28_get_pyaedt_app(self):
app = get_pyaedt_app(self.aedtapp.project_name, self.aedtapp.design_name)
assert app.design_type == "HFSS"
2 changes: 1 addition & 1 deletion pyaedt/desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ def design_list(self, project=None):

Returns
-------
str
list
List of the designs.
"""

Expand Down
7 changes: 6 additions & 1 deletion pyaedt/generic/design_types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
import re

try:
from pyaedt.hfss3dlayout import Hfss3dLayout
Expand Down Expand Up @@ -78,7 +79,11 @@ def get_pyaedt_app(project_name=None, design_name=None):
oProject = main.oDesktop.SetActiveProject(project_name)
if not oProject:
raise AttributeError("No Project Present.")
design_names = [i.GetName() for i in oProject.GetDesigns()]
design_names = []
deslist = list(oProject.GetTopDesignList())
for el in deslist:
m = re.search(r"[^;]+$", el)
design_names.append(m.group(0))
if design_name and design_name not in design_names:
raise AttributeError("Design {} doesn't exists in current Project.".format(design_name))
if not design_name:
Expand Down