Skip to content

Commit

Permalink
fix etree usage export_gds
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeescastro committed Nov 6, 2024
1 parent 6b40d2a commit 092e00e
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/pyedb/dotnet/edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <GDS_COMPONENTS> 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
Expand All @@ -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

0 comments on commit 092e00e

Please sign in to comment.