Skip to content

FEAT: Adding import - export layout component #1329

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

Merged
merged 1 commit into from
Jul 4, 2025
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
38 changes: 38 additions & 0 deletions src/pyedb/grpc/edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
from zipfile import ZipFile as zpf

from ansys.edb.core.geometry.polygon_data import PolygonData as GrpcPolygonData
from ansys.edb.core.hierarchy.layout_component import (
LayoutComponent as GrpcLayoutComponent,
)
import ansys.edb.core.layout.cell
from ansys.edb.core.simulation_setup.siwave_dcir_simulation_setup import (
SIWaveDCIRSimulationSetup as GrpcSIWaveDCIRSimulationSetup,
Expand Down Expand Up @@ -3834,3 +3837,38 @@ def compare(self, input_file, results=""):
else:
self.logger.info("Comparison correctly completed")
return True

def import_layout_component(self, component_path) -> GrpcLayoutComponent:
"""Import a layout component inside the current layout and place it at the origin.
This feature is only supported with PyEDB gRPC. Encryption is not yet supported.

Parameters
----------
component_path : str
Layout component path (.aedbcomp file).

Returns
-------
class:`LayoutComponent <ansys.edb.core.hierarchy.layout_component.LayoutComponent>`.
"""

return GrpcLayoutComponent.import_layout_component(layout=self.active_layout, aedb_comp_path=component_path)

def export_layout_component(self, component_path) -> bool:
"""Export a layout component from the current layout.
This feature is only supported with PyEDB gRPC. Encryption is not yet supported.

Parameters
----------
component_path : str
Layout component path (.aedbcomp file).

Returns
-------
bool
`True` if layout component is successfully exported, `False` otherwise.
"""

return GrpcLayoutComponent.export_layout_component(
layout=self.active_layout, output_aedb_comp_path=component_path
)
10 changes: 10 additions & 0 deletions tests/grpc/system/test_edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1971,3 +1971,13 @@ def test_compare_edbs(self, edb_examples):
assert edbapp.compare(edb_base)
folder = edbapp.edbpath[:-5] + "_compare_results"
assert os.path.exists(folder)

def test_create_layout_component(self, edb_examples):
edbapp = edb_examples.get_si_verse()
out_file = os.path.join(self.local_scratch.path, "test.aedbcomp")
edbapp.export_layout_component(component_path=out_file)
assert os.path.isfile(out_file)
edbapp.close()
edbapp = Edb(edbversion=desktop_version)
layout_comp = edbapp.import_layout_component(out_file)
assert not layout_comp.cell_instance.is_null
Loading