From 092e00e4240ea3200bcaf00f48451741b55022a1 Mon Sep 17 00:00:00 2001 From: felipeescastro Date: Wed, 6 Nov 2024 15:58:02 +0100 Subject: [PATCH] fix etree usage export_gds --- src/pyedb/dotnet/edb.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/pyedb/dotnet/edb.py b/src/pyedb/dotnet/edb.py index d9376ed05b..bef141a3bd 100644 --- a/src/pyedb/dotnet/edb.py +++ b/src/pyedb/dotnet/edb.py @@ -4618,9 +4618,7 @@ def export_gds_comp_xml(self, comps_to_export, gds_comps_unit="mm", control_path """ from pyedb.generic.general_methods import ET - root = ET.Element("Component Section") - root.set("revision", "-- To be copied inside of XML's session --") - components = ET.SubElement(root, "GDS_COMPONENTS") + components = ET.Element("GDS_COMPONENTS") components.set("LengthUnit", gds_comps_unit) if not comps_to_export: comps_to_export = self.components.components @@ -4629,15 +4627,16 @@ def export_gds_comp_xml(self, comps_to_export, gds_comps_unit="mm", control_path gds_component = ET.SubElement(components, "GDS_COMPONENT") for pin in ocomp.pins: pins_position_unit = unit_converter(ocomp.pins[pin].position, output_units=gds_comps_unit) - pin = ET.SubElement(gds_component, "GDS_PIN") - pin.set("Name", ocomp.pins[pin].component_pin) - pin.set("x", pins_position_unit[0]) - pin.set("y", pins_position_unit[1]) - pin.set("Layer", ocomp.pins[pin].placement_layer) + __pin = ET.SubElement(gds_component, "GDS_PIN") + __pin.set("Name", ocomp.pins[pin].component_pin) + __pin.set("x", str(pins_position_unit[0])) + __pin.set("y", str(pins_position_unit[1])) + __pin.set("Layer", ocomp.pins[pin].placement_layer) component = ET.SubElement(gds_component, "Component") component.set("RefDes", ocomp.refdes) component.set("PartName", ocomp.partname) component.set("PartType", ocomp.type) - tree = ET.ElementTree(root) + tree = ET.ElementTree(components) + ET.indent(tree, space="\t", level=0) tree.write(control_path) return True if os.path.exists(control_path) else False