Skip to content
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

FIX: IPC export efficiency #752

Merged
merged 7 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion src/pyedb/dotnet/edb_core/cell/primitive/primitive.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def net_name(self, name):
def layer(self):
"""Get the primitive edb layer object."""
layer_name = self._edb_object.GetLayer().GetName()
return self._pedb.stackup.all_layers[layer_name]
return self._pedb.stackup.find_layer_by_name(layer_name)

@property
def layer_name(self):
Expand Down
7 changes: 7 additions & 0 deletions src/pyedb/dotnet/edb_core/edb_data/layer_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
from __future__ import absolute_import


def layer_cast(pedb, edb_object):
if edb_object.IsStackupLayer():
return StackupLayerEdbClass(pedb, edb_object.Clone(), name=edb_object.GetName())
else:
return LayerEdbClass(pedb, edb_object.Clone(), name=edb_object.GetName())


class LayerEdbClass(object):
"""Manages Edb Layers. Replaces EDBLayer."""

Expand Down
18 changes: 12 additions & 6 deletions src/pyedb/dotnet/edb_core/stackup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from pyedb.dotnet.edb_core.edb_data.layer_data import (
LayerEdbClass,
StackupLayerEdbClass,
layer_cast,
)
from pyedb.dotnet.edb_core.general import convert_py_list_to_net_list
from pyedb.generic.general_methods import ET, generate_unique_name
Expand Down Expand Up @@ -284,10 +285,7 @@ def all_layers(self):
layer_list = list(self._edb_object.Layers(self._pedb.edb_api.cell.layer_type_set.AllLayerSet))
temp = dict()
for i in layer_list:
if i.IsStackupLayer():
obj = StackupLayerEdbClass(self._pedb, i.Clone(), name=i.GetName())
else:
obj = LayerEdbClass(self._pedb, i.Clone(), name=i.GetName())
obj = layer_cast(self._pedb, i)
temp[obj.name] = obj
return temp

Expand All @@ -306,12 +304,20 @@ def layers(self):
"""
return {name: obj for name, obj in self.all_layers.items() if obj.is_stackup_layer}

def find_layer_by_name(self, name: str):
"""Finds a layer in a layer with given name."""
hui-zhou-a marked this conversation as resolved.
Show resolved Hide resolved
obj = self._pedb.edb_api.cell._cell.Layer.FindByName(self._edb_object, name)
if obj.IsNull():
raise ValueError("Layer with name '{}' was not found.".format(name))
else:
return layer_cast(self._pedb, obj.Clone())


class Stackup(LayerCollection):
"""Manages EDB methods for stackup accessible from `Edb.stackup` property."""

def __getitem__(self, item):
return self.all_layers[item]
return self.find_layer_by_name(item)

def __init__(self, pedb, edb_object=None):
super().__init__(pedb, edb_object)
Expand Down Expand Up @@ -1800,7 +1806,7 @@ def residual_copper_area_per_layer(self):
temp_data = {name: 0 for name, _ in self.signal_layers.items()}
outline_area = 0
for i in self._pedb.modeler.primitives:
layer_name = i.layer.name
layer_name = i._edb_object.GetLayer().GetName()
if layer_name.lower() == "outline":
if i.area() > outline_area:
outline_area = i.area()
Expand Down
Loading