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

fix import_dxf + tests #3593

Merged
merged 5 commits into from
Sep 19, 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
3,968 changes: 3,968 additions & 0 deletions _unittest/example_models/cad/DXF/dxf2.dxf

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions _unittest/test_20_HFSS.py
Original file line number Diff line number Diff line change
Expand Up @@ -1529,3 +1529,11 @@ def test_63_set_phase_center_per_port(self):
assert self.aedtapp.set_phase_center_per_port(["Global", "Global"])
assert not self.aedtapp.set_phase_center_per_port(["Global"])
assert not self.aedtapp.set_phase_center_per_port("Global")

@pytest.mark.skipif(config["NonGraphical"], reason="Test fails on build machine")
def test_64_import_dxf(self):
self.aedtapp.insert_design("dxf")
dxf_file = os.path.join(local_path, "example_models", "cad", "DXF", "dxf2.dxf")
dxf_layers = self.aedtapp.get_dxf_layers(dxf_file)
assert isinstance(dxf_layers, list)
assert self.aedtapp.import_dxf(dxf_file, dxf_layers)
4 changes: 3 additions & 1 deletion _unittest/test_27_Maxwell2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,10 @@ def test_32_control_program(self):
if os.path.exists(user_ctl_path):
os.unlink(user_ctl_path)

@pytest.mark.skipif(config["NonGraphical"], reason="Test fails on build machine")
def test_33_import_dxf(self):
self.aedtapp.insert_design("dxf")
dxf_file = os.path.join(local_path, "example_models", "cad", "DXF", "dxf1.dxf")
dxf_file = os.path.join(local_path, "example_models", "cad", "DXF", "dxf2.dxf")
dxf_layers = self.aedtapp.get_dxf_layers(dxf_file)
assert isinstance(dxf_layers, list)
assert self.aedtapp.import_dxf(dxf_file, dxf_layers)
4 changes: 3 additions & 1 deletion _unittest/test_28_Maxwell3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,11 +848,13 @@ def test_50_objects_segmentation(self, cyl_gap):
assert isinstance(sheets[object_name], list)
assert len(sheets[object_name]) == segments_number - 1

@pytest.mark.skipif(config["NonGraphical"], reason="Test fails on build machine")
def test_51_import_dxf(self):
self.aedtapp.insert_design("dxf")
dxf_file = os.path.join(local_path, "example_models", "cad", "DXF", "dxf1.dxf")
dxf_file = os.path.join(local_path, "example_models", "cad", "DXF", "dxf2.dxf")
dxf_layers = self.aedtapp.get_dxf_layers(dxf_file)
assert isinstance(dxf_layers, list)
assert self.aedtapp.import_dxf(dxf_file, dxf_layers)

def test_52_assign_flux_tangential(self):
self.aedtapp.insert_design("flux_tangential")
Expand Down
9 changes: 9 additions & 0 deletions _unittest/test_30_Q2D.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os

from _unittest.conftest import config
from _unittest.conftest import desktop_version
from _unittest.conftest import local_path
import pytest
Expand Down Expand Up @@ -286,3 +287,11 @@ def test_17_set_variable(self):
self.aedtapp["var_test"] = "234"
assert "var_test" in self.aedtapp.variable_manager.design_variable_names
assert self.aedtapp.variable_manager.design_variables["var_test"].expression == "234"

@pytest.mark.skipif(config["NonGraphical"], reason="Test fails on build machine")
def test_18_import_dxf(self):
self.aedtapp.insert_design("dxf")
dxf_file = os.path.join(local_path, "example_models", "cad", "DXF", "dxf2.dxf")
dxf_layers = self.aedtapp.get_dxf_layers(dxf_file)
assert isinstance(dxf_layers, list)
assert self.aedtapp.import_dxf(dxf_file, dxf_layers)
2 changes: 0 additions & 2 deletions _unittest/test_44_TouchstoneParser.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import os

from _unittest.conftest import config
from _unittest.conftest import local_path
import pytest

from pyaedt import Hfss3dLayout

config["NonGraphical"] = False
test_subfolder = "T44"
test_T44_dir = os.path.join(local_path, "example_models", test_subfolder)

Expand Down
8 changes: 8 additions & 0 deletions _unittest/test_98_Icepak.py
Original file line number Diff line number Diff line change
Expand Up @@ -1295,3 +1295,11 @@ def test_66_update_3d_component(self):
comp.modeler.create_3dcomponent(component_filepath)
comp.close_project()
assert self.aedtapp.modeler.user_defined_components["test"].update_definition()

@pytest.mark.skipif(config["NonGraphical"], reason="Test fails on build machine")
def test_67_import_dxf(self):
self.aedtapp.insert_design("dxf")
dxf_file = os.path.join(local_path, "example_models", "cad", "DXF", "dxf2.dxf")
dxf_layers = self.aedtapp.get_dxf_layers(dxf_file)
assert isinstance(dxf_layers, list)
assert self.aedtapp.import_dxf(dxf_file, dxf_layers)
4 changes: 3 additions & 1 deletion pyaedt/application/Analysis3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -1231,8 +1231,10 @@ def import_dxf(
self.logger.error("{} does not exist in specified dxf.".format(layer))
return False

if self.is3d:
if hasattr(self, "is3d") and self.is3d:
sheet_bodies_2d = False
else:
sheet_bodies_2d = True

vArg1 = ["NAME:options"]
vArg1.append("FileName:="), vArg1.append(file_path.replace(os.sep, "/"))
Expand Down
Loading