Skip to content

Commit

Permalink
added flag in cutout method to keep back compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcapodi78 authored and maxcapodi78 committed Oct 26, 2023
1 parent 44d17ff commit 8eb4004
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
13 changes: 5 additions & 8 deletions pyaedt/edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2101,18 +2101,15 @@ def subtract(poly, voids):
return poly.Subtract(convert_py_list_to_net_list(poly), convert_py_list_to_net_list(voids))

def clip_path(path):
pdata = path.polygon_data.edb_api
int_data = _poly.GetIntersectionType(pdata)
if int_data == 0:
prims_to_delete.append(path)
return
result = path._edb_object.SetClipInfo(_poly, True)
if not result:
self.logger.info("Failed to clip path {}. Clipping as polygon.".format(path.id))
reference_prims.append(path)
else:
center_points = list(path._edb_object.GetCenterLine().Points)
new_points = []
for i in range(len(center_points)):
if _poly.PointInPolygon(center_points[i]):
new_points.append(i)
if not new_points:
prims_to_delete.append(path)

def clean_prim(prim_1): # pragma: no cover
pdata = prim_1.polygon_data.edb_api
Expand Down
8 changes: 4 additions & 4 deletions pyaedt/edb_core/dotnet/primitive.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ def end_cap_style(self):
**end_cap2** : End cap style of path end end cap.
"""
return self.prim_obj.GetEndCapStyle()
return self._edb_object.GetEndCapStyle()

@end_cap_style.setter
def end_cap_style(self, end_cap1, end_cap2):
Expand All @@ -759,7 +759,7 @@ def end_cap_style(self, end_cap1, end_cap2):
end_cap2: :class:`PathEndCapType`
End cap style of path end end cap.
"""
self.prim_obj.SetEndCapStyle(end_cap1, end_cap2)
self._edb_object.SetEndCapStyle(end_cap1, end_cap2)

@property
def get_clip_info(self):
Expand All @@ -777,7 +777,7 @@ def get_clip_info(self):
**keep_inside** : Indicates whether the part of the path inside the polygon is preserved.
"""
return self.prim_obj.GetClipInfo()
return self._edb_object.GetClipInfo()

@get_clip_info.setter
def get_clip_info(self, clipping_poly, keep_inside=True):
Expand All @@ -790,7 +790,7 @@ def get_clip_info(self, clipping_poly, keep_inside=True):
keep_inside: bool
Indicates whether the part of the path inside the polygon should be preserved.
"""
self.prim_obj.SetClipInfo(
self._edb_object.SetClipInfo(
clipping_poly,
keep_inside,
)
Expand Down

0 comments on commit 8eb4004

Please sign in to comment.