Skip to content

Commit

Permalink
test #91 done
Browse files Browse the repository at this point in the history
  • Loading branch information
svandenb-dev committed Oct 29, 2024
1 parent eca0ed0 commit 68f247b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 44 deletions.
31 changes: 9 additions & 22 deletions src/pyedb/grpc/edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,7 @@ def cutout(
self.close_edb()
self.edbpath = legacy_path
self.open_edb()
return result
return result

def _create_cutout_legacy(
self,
Expand Down Expand Up @@ -1942,8 +1942,7 @@ def _create_cutout_multithread(
]
for i in custom_extent
]
plane = self.modeler.Shape("polygon", points=custom_extent)
_poly = self.modeler.shape_to_polygon_data(plane)
_poly = GrpcPolygonData(points=custom_extent)
elif custom_extent:
_poly = custom_extent
else:
Expand Down Expand Up @@ -2207,7 +2206,7 @@ def _create_cutout_on_point_list(

_netsClip = _ref_nets
# Create new cutout cell/design
_cutout = self.active_cell.cutOut(_netsClip, _netsClip, polygon_data)
_cutout = self.active_cell.cutout(_netsClip, _netsClip, polygon_data)
layout = _cutout.layout
cutout_obj_coll = layout.padstack_instances
ids = []
Expand Down Expand Up @@ -2278,29 +2277,17 @@ def _create_cutout_on_point_list(
for layer in layers:
layer_primitves = self.modeler.get_primitives(layer_name=layer)
if len(layer_primitves) == 0:
self.modeler.create_polygon(plane, layer, net_name="DUMMY")
self.modeler.create_polygon(point_list, layer, net_name="DUMMY")
self.logger.info(f"Cutout {_cutout.name} created correctly")
id = 1
for _setup in self.active_cell.SimulationSetups:
# Empty string '' if coming from setup copy and don't set explicitly.
_setup_name = _setup.name
# if "GetSimSetupInfo" in dir(_setup):
# _hfssSimSetupInfo = _setup.GetSimSetupInfo()
# _hfssSimSetupInfo.Name = "HFSS Setup " + str(id) # Set name of analysis setup
# _setup.SetSimSetupInfo(_hfssSimSetupInfo)
# _cutout.AddSimulationSetup(_setup) # Add simulation setup to the cutout design
# id += 1
# else:
# _cutout.AddSimulationSetup(_setup) # Add simulation setup to the cutout design
# TODO add simulation setup with grpc
for _setup in self.active_cell.simulation_setups:
# Add the create Simulation setup to cutout cell
# might need to add a clone setup method.
pass

_dbCells = [_cutout]
if output_aedb_path:
db2 = self.create(output_aedb_path)
if not db2.save():
self.logger.error("Failed to create new Edb. Check if the path already exists and remove it.")
return []
db2.save()
cell_copied = db2.copy_cells(_dbCells) # Copies cutout cell/design to db2 project
cell = cell_copied[0]
cell.name = os.path.basename(output_aedb_path[:-5])
Expand All @@ -2326,7 +2313,7 @@ def _create_cutout_on_point_list(
self.logger.warning("aedb def file manually created.")
except:
pass
return [[pt.x.value, pt.y.value] for pt in GrpcPolygonData.without_arcs().points]
return [[pt.x.value, pt.y.value] for pt in polygon_data.without_arcs().points]

@staticmethod
def write_export3d_option_config_file(path_to_output, config_dictionaries=None):
Expand Down
40 changes: 18 additions & 22 deletions tests/grpc/system/test_edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,28 +234,24 @@ def test_create_custom_cutout_0(self, edb_examples):
bounding = edbapp.get_bounding_box()
assert bounding

# check bug #434 status PolygonData.is_inside(pt) failing
# cutout_line_x = 41
# cutout_line_y = 30
# points = [[bounding[0][0], bounding[0][1]]]
# points.append([cutout_line_x, bounding[0][1]])
# points.append([cutout_line_x, cutout_line_y])
# points.append([bounding[0][0], cutout_line_y])
# points.append([bounding[0][0], bounding[0][1]])

# output = os.path.join(self.local_scratch.path, "cutout2.aedb")
# check bug #434 status PolygonData.is_inside(pt) failing
# assert edbapp.cutout(
# custom_extent=points,
# signal_list=["GND", "1V0"],
# output_aedb_path=output,
# open_cutout_at_end=False,
# include_partial_instances=True,
# use_pyaedt_cutout=False,
# )
# assert os.path.exists(os.path.join(output, "edb.def"))
# output = os.path.join(self.local_scratch.path, "cutout3.aedb")
# edbapp.close()
cutout_line_x = 41
cutout_line_y = 30
points = [[bounding[0][0], bounding[0][1]]]
points.append([cutout_line_x, bounding[0][1]])
points.append([cutout_line_x, cutout_line_y])
points.append([bounding[0][0], cutout_line_y])
points.append([bounding[0][0], bounding[0][1]])

output = os.path.join(self.local_scratch.path, "cutout2.aedb")
assert edbapp.cutout(
custom_extent=points,
signal_list=["GND", "1V0"],
output_aedb_path=output,
open_cutout_at_end=False,
include_partial_instances=True,
use_pyaedt_cutout=False,
)
assert os.path.exists(os.path.join(output, "edb.def"))

def test_create_custom_cutout_1(self, edb_examples):
"""Create custom cutout 1."""
Expand Down

0 comments on commit 68f247b

Please sign in to comment.