Skip to content

Commit

Permalink
FIX: Create package ref
Browse files Browse the repository at this point in the history
  • Loading branch information
SMoraisAnsys committed Jun 14, 2024
1 parent 9b6bad0 commit 6277f3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/pyedb/dotnet/edb_core/cell/hierarchy/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,15 @@ def package_def(self, value):
comp_prop.SetPackageDef(package_def._edb_object)
self.edbcomponent.SetComponentProperty(comp_prop)

def create_package_def(self, name=""):
def create_package_def(self, name="", extent_bounding_box=None):
"""Create a package definition and assign it to the component.
Parameters
----------
name: str, optional
Name of the package definition
extent_bounding_box : list, optional
Boundary points which define the shape of the package.
Returns
-------
Expand All @@ -152,7 +154,7 @@ def create_package_def(self, name=""):
if not name:
name = "{}_{}".format(self.refdes, self.part_name)
if name not in self._pedb.definitions.package:
self._pedb.definitions.add_package_def(name)
self._pedb.definitions.add_package_def(name, boundary_points=extent_bounding_box)
self.package_def = name

from pyedb.dotnet.edb_core.dotnet.database import PolygonDataDotNet
Expand Down
6 changes: 5 additions & 1 deletion src/pyedb/dotnet/edb_core/definition/package_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

from pyedb.dotnet.edb_core.geometry.polygon_data import PolygonData
from pyedb.dotnet.edb_core.utilities.obj_base import ObjBase
from pyedb.edb_logger import pyedb_logger


class PackageDef(ObjBase):
Expand All @@ -36,7 +37,7 @@ class PackageDef(ObjBase):
component_part_name : str, optional
Part name of the component.
extent_bounding_box : list, optional
Bounding box defines the shape of the package. For example, [[0, 0], ["2mm", "2mm"].
Bounding box defines the shape of the package. For example, [[0, 0], ["2mm", "2mm"]].
"""

Expand Down Expand Up @@ -70,6 +71,9 @@ def __create_from_name(self, name, component_part_name=None, extent_bounding_box
bbox = [[y_pt1 - y_mid, x_pt1 - x_mid], [y_pt2 - y_mid, x_pt2 - x_mid]]
else:
bbox = extent_bounding_box
if bbox is None:
pyedb_logger.warning("Package creation uses bounding box but it cannot be inferred. " \
"Please set argument 'component_part_name' or 'extent_bounding_box'.")
polygon_data = PolygonData(self._pedb, create_from_bounding_box=True, points=bbox)

edb_object.SetExteriorBoundary(polygon_data._edb_object)
Expand Down

0 comments on commit 6277f3c

Please sign in to comment.