From 54fcc25ed5284191e62e728f3046ffe5a02c5180 Mon Sep 17 00:00:00 2001 From: Massimo Capodiferro <77293250+maxcapodi78@users.noreply.github.com> Date: Fri, 30 Aug 2024 13:33:13 +0200 Subject: [PATCH] FIX: Ltspice (#5107) Co-authored-by: maxcapodi78 --- src/ansys/aedt/core/circuit.py | 9 +++++---- src/ansys/aedt/core/misc/asc_circuit_mapping.json | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ansys/aedt/core/circuit.py b/src/ansys/aedt/core/circuit.py index 7e79a9b5793..89ef67149f6 100644 --- a/src/ansys/aedt/core/circuit.py +++ b/src/ansys/aedt/core/circuit.py @@ -2416,7 +2416,7 @@ def _parse_asc_file(self, input_file, l_scale=2.54e-3 / 16, c_scale=2.54e-3 / 16 else: try: val = float(".".join(value)) - except: + except Exception: if tmp[0] not in ["voltage", "current"]: val = 0 elif "PULSE" in value: @@ -2601,12 +2601,13 @@ def create_schematic_from_asc_file(self, input_file, config_file=None): comp.set_property(els[el], val) elif component in ["voltage", "current"]: try: - if value and value.startswith("AC"): + if isinstance(value, str) and value.startswith("AC"): comp.set_property("ACMAG", value.split(" ")[-1]) - elif value: + elif isinstance(value, (int, float)): comp.set_property("DC", value) - except Exception: + except: self.logger.info("Failed to set DC Value or unnkown source type {}".format(component)) + pass if size_change != 0: self.modeler.schematic.create_wire(points=pts) diff --git a/src/ansys/aedt/core/misc/asc_circuit_mapping.json b/src/ansys/aedt/core/misc/asc_circuit_mapping.json index e939af9d1db..f3d1bb25964 100644 --- a/src/ansys/aedt/core/misc/asc_circuit_mapping.json +++ b/src/ansys/aedt/core/misc/asc_circuit_mapping.json @@ -43,7 +43,7 @@ "Component Name": "DIODE_Level1", "xoffset": 200, "yoffset": -600, - "rotation_offset": 0, + "rotation_offset": 180, "component_size": 400, "orientation": "-x", "size_change": 400 @@ -53,7 +53,7 @@ "Component Name": "DIODE_Level1", "xoffset": 200, "yoffset": -600, - "rotation_offset": 0, + "rotation_offset": 180, "component_size": 400, "orientation": "-x", "size_change": 400