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: polygon doesn't update after expansion #880

Merged
merged 6 commits into from
Nov 5, 2024
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
4 changes: 3 additions & 1 deletion src/pyedb/configuration/cfg_padstacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ def apply(self):

def retrieve_parameters_from_edb(self):
self.clean()
for _, obj in self._pedb.padstacks.definitions.items():
for name, obj in self._pedb.padstacks.definitions.items():
if name.lower() == "symbol":
continue
pdef = CfgPadstackDefinition(self._pedb, obj)
pdef.retrieve_parameters_from_edb()
self.definitions.append(pdef)
Expand Down
2 changes: 1 addition & 1 deletion src/pyedb/configuration/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def export(
self,
file_path,
stackup=True,
package_definitions=True,
package_definitions=False,
setups=True,
sources=True,
ports=True,
Expand Down
22 changes: 0 additions & 22 deletions src/pyedb/dotnet/edb_core/cell/primitive/primitive.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,10 +603,6 @@ def polygon_data(self):
""":class:`pyedb.dotnet.edb_core.dotnet.database.PolygonDataDotNet`: Outer contour of the Polygon object."""
return PolygonData(self._pedb, self._edb_object.GetPolygonData())

@polygon_data.setter
def polygon_data(self, poly):
self._edb_object.SetPolygonData(poly._edb_object)

def add_void(self, point_list):
"""Add a void to current primitive.

Expand Down Expand Up @@ -757,24 +753,6 @@ def points_raw(self):
points.append(point)
return points

def expand(self, offset=0.001, tolerance=1e-12, round_corners=True, maximum_corner_extension=0.001):
"""Expand the polygon shape by an absolute value in all direction.
Offset can be negative for negative expansion.

Parameters
----------
offset : float, optional
Offset value in meters.
tolerance : float, optional
Tolerance in meters.
round_corners : bool, optional
Whether to round corners or not.
If True, use rounded corners in the expansion otherwise use straight edges (can be degenerate).
maximum_corner_extension : float, optional
The maximum corner extension (when round corners are not used) at which point the corner is clipped.
"""
return self.polygon_data.expand(offset, tolerance, round_corners, maximum_corner_extension)

def scale(self, factor, center=None):
"""Scales the polygon relative to a center point by a factor.

Expand Down
31 changes: 31 additions & 0 deletions src/pyedb/dotnet/edb_core/edb_data/primitives_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
RectangleDotNet,
TextDotNet,
)
from pyedb.dotnet.edb_core.geometry.polygon_data import PolygonData
from pyedb.modeler.geometry_operators import GeometryOperators


Expand Down Expand Up @@ -305,6 +306,36 @@ def in_polygon(
# prim = point_list
# return self.add_void(prim)

@property
def polygon_data(self):
""":class:`pyedb.dotnet.edb_core.dotnet.database.PolygonDataDotNet`: Outer contour of the Polygon object."""
return PolygonData(self._pedb, self._edb_object.GetPolygonData())

@polygon_data.setter
def polygon_data(self, poly):
self._edb_object.SetPolygonData(poly._edb_object)

def expand(self, offset=0.001, tolerance=1e-12, round_corners=True, maximum_corner_extension=0.001):
"""Expand the polygon shape by an absolute value in all direction.
Offset can be negative for negative expansion.

Parameters
----------
offset : float, optional
Offset value in meters.
tolerance : float, optional
Tolerance in meters.
round_corners : bool, optional
Whether to round corners or not.
If True, use rounded corners in the expansion otherwise use straight edges (can be degenerate).
maximum_corner_extension : float, optional
The maximum corner extension (when round corners are not used) at which point the corner is clipped.
"""
pd = self.polygon_data
pd.expand(offset, tolerance, round_corners, maximum_corner_extension)
self.polygon_data = pd
return pd


class EdbText(Primitive, TextDotNet):
def __init__(self, raw_primitive, core_app):
Expand Down
3 changes: 0 additions & 3 deletions tests/legacy/system/test_edb_modeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ def test_modeler_polygons(self):
assert k.expand(0.0005)
# edb.modeler.parametrize_polygon(k, poly_5953, offset_name=f"offset_{i}", origin=centroid)

poly_167 = [i for i in self.edbapp.modeler.paths if i.id == 167][0]
assert poly_167.expand(0.0005)

def test_modeler_paths(self, edb_examples):
"""Evaluate modeler paths"""
edbapp = edb_examples.get_si_verse()
Expand Down
Loading