Skip to content

Commit

Permalink
test #70 done
Browse files Browse the repository at this point in the history
  • Loading branch information
svandenb-dev committed Oct 24, 2024
1 parent 55a0ed5 commit a36a134
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
12 changes: 5 additions & 7 deletions src/pyedb/grpc/edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -3950,16 +3950,14 @@ def create_model_for_arbitrary_wave_ports(
padstack_inst.delete()
else:
if padstack_inst.net.name in signal_nets:
padstack_instances_index.insert(padstack_inst.id, padstack_inst.position)
padstack_instances_index.insert(padstack_inst.edb_uid, padstack_inst.position)
if not padstack_inst.padstack_def.name in used_padstack_defs:
used_padstack_defs.append(padstack_inst.padstack_def.name)

polys = [
poly
for poly in self.modeler.primitives
if poly.layer.name == reference_layer
and self.modeler.primitives[0].primitive_type.name == "POLYGON"
and poly.has_voids
if poly.layer.name == reference_layer and self.modeler.primitives[0].type == "polygon" and poly.has_voids
]
if not polys:
self.logger.error(
Expand All @@ -3978,7 +3976,7 @@ def create_model_for_arbitrary_wave_ports(
)
included_instances = list(padstack_instances_index.intersection(void_bbox))
if included_instances:
void_padstacks.append((void, [self.padstacks.instances[edb_id] for edb_id in included_instances]))
void_padstacks.append((void, [self.padstacks.instances[edb_uid] for edb_uid in included_instances]))

if not void_padstacks:
self.logger.error(
Expand Down Expand Up @@ -4013,10 +4011,10 @@ def create_model_for_arbitrary_wave_ports(
)
for void_info in void_padstacks:
port_poly = cloned_edb.modeler.create_polygon(
main_shape=void_info[0].polygon_data, layer_name="ref", net_name="GND"
points=void_info[0].polygon_data, layer_name="ref", net_name="GND"
)
pec_poly = cloned_edb.modeler.create_polygon(
main_shape=port_poly.polygon_data, layer_name="port_pec", net_name="GND"
points=port_poly.polygon_data, layer_name="port_pec", net_name="GND"
)
pec_poly.scale(1.5)

Expand Down
4 changes: 2 additions & 2 deletions src/pyedb/grpc/edb_core/primitive/polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ def scale(self, factor, center=None):
factor = float(factor)
polygon_data = GrpcPolygonData(points=self.polygon_data.points)
if not center:
center = self.polygon_data.bounding_circle()
center = self.polygon_data.bounding_circle()[0]
if center:
polygon_data.scale(factor, center[0])
polygon_data.scale(factor, center)
self.polygon_data = polygon_data
return True
else:
Expand Down
12 changes: 8 additions & 4 deletions tests/grpc/system/test_edb_modeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,12 +555,13 @@ def test_get_primitives_by_point_layer_and_nets(self, edb_examples):
assert len(primitives) == 3
edbapp.close()

def arbitrary_wave_ports(self):
def test_arbitrary_wave_ports(self):
# TODO check buh #462 polygon_data.scale failing
example_folder = os.path.join(local_path, "example_models", test_subfolder)
source_path_edb = os.path.join(example_folder, "example_arbitrary_wave_ports.aedb")
target_path_edb = os.path.join(self.local_scratch.path, "test_wave_ports", "test.aedb")
self.local_scratch.copyfolder(source_path_edb, target_path_edb)
edbapp = Edb(target_path_edb, desktop_version)
edbapp = Edb(target_path_edb, desktop_version, restart_rpc_server=True)
edbapp.create_model_for_arbitrary_wave_ports(
temp_directory=self.local_scratch.path,
output_edb="wave_ports.aedb",
Expand All @@ -576,6 +577,7 @@ def arbitrary_wave_ports(self):
test_edb.close()

def test_path_center_line(self):
# TODO wait Material class done.
edb = Edb()
edb.stackup.add_layer("GND", "Gap")
edb.stackup.add_layer("Substrat", "GND", layer_type="dielectric", thickness="0.2mm", material="Duroid (tm)")
Expand All @@ -596,9 +598,11 @@ def test_path_center_line(self):
edb.modeler.paths[0].center_line = [[0.0, 0.0], [0.0, 5e-3]]
assert edb.modeler.paths[0].center_line == [[0.0, 0.0], [0.0, 5e-3]]

def test_polygon_data_refaxtoring_bounding_box(self, edb_examples):
def test_polygon_data_refactoring_bounding_box(self, edb_examples):
# Done
edbapp = edb_examples.get_si_verse()
poly_with_voids = [pp for pp in edbapp.modeler.polygons if pp.has_voids]
for poly in poly_with_voids:
for void in poly.voids:
assert void.polygon_data.bounding_box
assert void.bbox
edbapp.close()

0 comments on commit a36a134

Please sign in to comment.