From c5315a7e70c773f9a59bfa2e4688251cf4df9c21 Mon Sep 17 00:00:00 2001 From: gkorompi Date: Sat, 21 Feb 2026 16:11:09 +0200 Subject: [PATCH 1/5] FIX: dxf fixes on mcad & ecad --- .../aedt/core/application/analysis_3d.py | 19 +++++++++++-------- src/ansys/aedt/core/generic/file_utils.py | 5 +++++ src/ansys/aedt/core/hfss3dlayout.py | 2 +- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/ansys/aedt/core/application/analysis_3d.py b/src/ansys/aedt/core/application/analysis_3d.py index 97f0cb5ec3b..a188953a141 100644 --- a/src/ansys/aedt/core/application/analysis_3d.py +++ b/src/ansys/aedt/core/application/analysis_3d.py @@ -1229,7 +1229,7 @@ def check_intersections(output, input_list, cad_in=None): def import_dxf( self, input_file: str | Path, - layers: list[str], + layers: list[str] = None, auto_detect_close: bool = True, self_stitch: bool = True, self_stitch_tolerance: float = 0.0, @@ -1247,9 +1247,9 @@ def import_dxf( ---------- input_file : str or :class:`pathlib.Path` Path to the DXF file. - layers : list - List of layer names to import. To get the dxf_layers in the DXF file, - you can call the ``get_dxf_layers`` method. + layers : list, optional + List of layer names to import, if empty all layers will be imported. + To get the dxf_layers in the DXF file, you can call the ``get_dxf_layers`` method. auto_detect_close : bool, optional Whether to check polylines to see if they are closed. The default is ``True``. If a polyline is closed, the modeler @@ -1294,10 +1294,13 @@ def import_dxf( self.logger.error("Method is supported only in graphical mode.") return False dxf_layers = get_dxf_layers(input_file) - for layer in layers: - if layer not in dxf_layers: - self.logger.error(f"{layer} does not exist in specified dxf.") - return False + if not layers: + layers = dxf_layers + else: + for layer in layers: + if layer not in dxf_layers: + self.logger.error(f"{layer} does not exist in specified dxf.") + return False if hasattr(self, "is3d") and self.is3d: sheet_bodies_2d = False diff --git a/src/ansys/aedt/core/generic/file_utils.py b/src/ansys/aedt/core/generic/file_utils.py index 4e5cf6b69b2..2da6b1563e5 100644 --- a/src/ansys/aedt/core/generic/file_utils.py +++ b/src/ansys/aedt/core/generic/file_utils.py @@ -821,6 +821,11 @@ def find_indices(list_to_check, item_to_find): for idx in indices: if "2" in lines[idx + index_offset]: layer_names.append(lines[idx + index_offset + 1].replace("\n", "")) + if not layer_names: + index_offset = 1 + for idx in indices: + if "2" in lines[idx + index_offset]: + layer_names.append(lines[idx + index_offset + 1].replace("\n", "")) return layer_names diff --git a/src/ansys/aedt/core/hfss3dlayout.py b/src/ansys/aedt/core/hfss3dlayout.py index 1d5b266eab6..5f343dff304 100644 --- a/src/ansys/aedt/core/hfss3dlayout.py +++ b/src/ansys/aedt/core/hfss3dlayout.py @@ -1433,7 +1433,7 @@ def _import_cad( aedb_path = aedb_path.replace(old_name, project_name) self.logger.warning("aedb_exists. Renaming it to %s", project_name) if xml_path is None: - xml_path = Path("").name + xml_path = str(Path(cad_path).with_suffix(".xml")) elif Path(xml_path).suffix == ".tech": xml_path = Path(tech_to_control_file(xml_path)).name if cad_format == "gds": From 0237d650eb2ab4b2d06a7f64e78f709b6619942a Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Sat, 21 Feb 2026 14:15:09 +0000 Subject: [PATCH 2/5] chore: adding changelog file 7298.fixed.md [dependabot-skip] --- doc/changelog.d/7298.fixed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/7298.fixed.md diff --git a/doc/changelog.d/7298.fixed.md b/doc/changelog.d/7298.fixed.md new file mode 100644 index 00000000000..e1673fde01b --- /dev/null +++ b/doc/changelog.d/7298.fixed.md @@ -0,0 +1 @@ +Dxf fixes on mcad & ecad From 97a8ee4094933c86e01d04375912831306b9d8b0 Mon Sep 17 00:00:00 2001 From: gkorompi <156683163+gkorompi@users.noreply.github.com> Date: Mon, 23 Feb 2026 13:03:59 +0200 Subject: [PATCH 3/5] Update src/ansys/aedt/core/application/analysis_3d.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sébastien Morais <146729917+SMoraisAnsys@users.noreply.github.com> --- src/ansys/aedt/core/application/analysis_3d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/aedt/core/application/analysis_3d.py b/src/ansys/aedt/core/application/analysis_3d.py index a188953a141..463d1ef2326 100644 --- a/src/ansys/aedt/core/application/analysis_3d.py +++ b/src/ansys/aedt/core/application/analysis_3d.py @@ -1248,7 +1248,7 @@ def import_dxf( input_file : str or :class:`pathlib.Path` Path to the DXF file. layers : list, optional - List of layer names to import, if empty all layers will be imported. + List of layer names to import, if ``None`` or empty list all layers will be imported. To get the dxf_layers in the DXF file, you can call the ``get_dxf_layers`` method. auto_detect_close : bool, optional Whether to check polylines to see if they are closed. From f5d31a39d1a6c2dd7582c85c7275d5b61e600b5c Mon Sep 17 00:00:00 2001 From: gkorompi <156683163+gkorompi@users.noreply.github.com> Date: Mon, 23 Feb 2026 13:04:17 +0200 Subject: [PATCH 4/5] Update src/ansys/aedt/core/application/analysis_3d.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sébastien Morais <146729917+SMoraisAnsys@users.noreply.github.com> --- src/ansys/aedt/core/application/analysis_3d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/aedt/core/application/analysis_3d.py b/src/ansys/aedt/core/application/analysis_3d.py index 463d1ef2326..6e5c38a663c 100644 --- a/src/ansys/aedt/core/application/analysis_3d.py +++ b/src/ansys/aedt/core/application/analysis_3d.py @@ -1249,7 +1249,7 @@ def import_dxf( Path to the DXF file. layers : list, optional List of layer names to import, if ``None`` or empty list all layers will be imported. - To get the dxf_layers in the DXF file, you can call the ``get_dxf_layers`` method. + To get the layers in the DXF file, you can call the ``get_dxf_layers`` method. auto_detect_close : bool, optional Whether to check polylines to see if they are closed. The default is ``True``. If a polyline is closed, the modeler From 82a7c28a753a16f251b2902f5e9c86413fe93b9b Mon Sep 17 00:00:00 2001 From: gkorompi <156683163+gkorompi@users.noreply.github.com> Date: Mon, 23 Feb 2026 13:05:50 +0200 Subject: [PATCH 5/5] Update src/ansys/aedt/core/application/analysis_3d.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sébastien Morais <146729917+SMoraisAnsys@users.noreply.github.com> --- src/ansys/aedt/core/application/analysis_3d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/aedt/core/application/analysis_3d.py b/src/ansys/aedt/core/application/analysis_3d.py index 6e5c38a663c..420f5644538 100644 --- a/src/ansys/aedt/core/application/analysis_3d.py +++ b/src/ansys/aedt/core/application/analysis_3d.py @@ -1299,7 +1299,7 @@ def import_dxf( else: for layer in layers: if layer not in dxf_layers: - self.logger.error(f"{layer} does not exist in specified dxf.") + self.logger.error(f"{layer} does not exist in specified DXF file.") return False if hasattr(self, "is3d") and self.is3d: