Skip to content

Commit

Permalink
REFACTOR: layer property (#980)
Browse files Browse the repository at this point in the history
* REFACCTOR: layer property

* MISC: Auto fixes from pre-commit.com hooks

For more information, see https://pre-commit.ci

---------

Co-authored-by: ring630 <@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
hui-zhou-a and pre-commit-ci[bot] authored Jan 14, 2025
1 parent bc039fb commit e804b3a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,15 @@ def _get_parameters(self):
def padstack_instance(self):
p_inst, _ = self._get_parameters()
return self._pedb.layout.find_object_by_id(p_inst.GetId())

@property
def layer(self):
"""Get layer of the terminal."""
_, _, layer = self._edb_object.GetParameters()
return self._pedb.stackup.all_layers[layer.GetName()]

@layer.setter
def layer(self, value):
layer = self._pedb.stackup.layers[value]._edb_layer
point_data = self._pedb.point_data(*self.location)
self._edb_object.SetParameters(point_data, layer)
12 changes: 12 additions & 0 deletions src/pyedb/dotnet/edb_core/cell/terminal/point_terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,15 @@ def create(self, name, net, location, layer, is_ref=False):
raise Exception(msg)
else:
return terminal

@property
def layer(self):
"""Get layer of the terminal."""
_, _, layer = self._edb_object.GetParameters()
return self._pedb.stackup.all_layers[layer.GetName()]

@layer.setter
def layer(self, value):
layer = self._pedb.stackup.layers[value]._edb_layer
point_data = self._pedb.point_data(*self.location)
self._edb_object.SetParameters(point_data, layer)
12 changes: 1 addition & 11 deletions src/pyedb/dotnet/edb_core/cell/terminal/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,7 @@ def hfss_type(self, value):
@property
def layer(self):
"""Get layer of the terminal."""
try:
_, _, layer = self._edb_object.GetParameters()
return self._pedb.stackup.all_layers[layer.GetName()]
except:
self._pedb.logger.error("Cannot determine terminal layer")

@layer.setter
def layer(self, value):
layer = self._pedb.stackup.layers[value]._edb_layer
point_data = self._pedb.point_data(*self.location)
self._edb_object.SetParameters(point_data, layer)
return self._pedb.logger.error("Cannot determine terminal layer")

@property
def location(self):
Expand Down

0 comments on commit e804b3a

Please sign in to comment.