Skip to content

Commit

Permalink
Merge branch 'main' into release/0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcapodi78 authored and maxcapodi78 committed Apr 28, 2023
2 parents 9fb6056 + a2378ba commit b258359
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pyaedt/edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def cell_names(self):
list of str, cell names.
"""
names = []
for cell in list(self._db.TopCircuitCells):
for cell in list(self._db.CircuitCells):
names.append(cell.GetName())
return names

Expand Down
41 changes: 31 additions & 10 deletions pyaedt/edb_core/stackup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import os.path
import warnings

from pyaedt import generate_unique_name
from pyaedt.edb_core.edb_data.layer_data import LayerEdbClass
from pyaedt.edb_core.general import convert_py_list_to_net_list
from pyaedt.generic.general_methods import ET
Expand Down Expand Up @@ -1333,6 +1334,7 @@ def place_instance(
angle=0.0,
offset_x=0.0,
offset_y=0.0,
offset_z=0.0,
flipped_stackup=True,
place_on_top=True,
solder_height=0,
Expand All @@ -1348,8 +1350,14 @@ def place_instance(
The rotation angle applied on the design.
offset_x : double, optional
The x offset value.
The default value is ``0.0``.
offset_y : double, optional
The y offset value.
The default value is ``0.0``.
offset_z : double, optional
The z offset value. (i.e. elevation offset for placement relative to the top layer conductor).
The default value is ``0.0``, which places the cell layout on top of the top conductor
layer of the target EDB.
flipped_stackup : bool, optional
Either if the current layout is inverted.
If `True` and place_on_top is `True` the stackup will be flipped before the merge.
Expand Down Expand Up @@ -1411,7 +1419,7 @@ def place_instance(
_dbCell = convert_py_list_to_net_list([edb_cell])
list_cells = self._pedb.db.CopyCells(_dbCell)
edb_cell = list_cells[0]
for cell in list(self._pedb.db.TopCircuitCells):
for cell in list(self._pedb.db.CircuitCells):
if cell.GetName() == edb_cell.GetName():
edb_cell = cell
# Keep Cell Independent
Expand All @@ -1423,8 +1431,10 @@ def place_instance(
_offset_x = self._edb_value(offset_x)
_offset_y = self._edb_value(offset_y)

instance_name = generate_unique_name(edb_cell.GetName(), n=2)

cell_inst2 = self._pedb.edb.Cell.Hierarchy.CellInstance.Create(
self._pedb.active_layout, edb_cell.GetName(), edb_cell.GetLayout()
self._pedb.active_layout, instance_name, edb_cell.GetLayout()
)

stackup_source = self._pedb.edb.Cell.LayerCollection(edb_cell.GetLayout().GetLayerCollection())
Expand All @@ -1448,14 +1458,14 @@ def place_instance(
source_stack_bot_elevation = res_s[4]

if place_on_top and flipped_stackup:
elevation = target_top_elevation + source_stack_top_elevation
elevation = target_top_elevation + source_stack_top_elevation + offset_z
elif place_on_top:
elevation = target_top_elevation - source_stack_bot_elevation
elevation = target_top_elevation - source_stack_bot_elevation + offset_z
elif flipped_stackup:
elevation = target_bottom_elevation + source_stack_bot_elevation
elevation = target_bottom_elevation + source_stack_bot_elevation - offset_z
solder_height = -solder_height
else:
elevation = target_bottom_elevation - source_stack_top_elevation
elevation = target_bottom_elevation - source_stack_top_elevation - offset_z
solder_height = -solder_height

h_stackup = self._edb_value(elevation + solder_height)
Expand All @@ -1468,10 +1478,18 @@ def place_instance(
point_to = self._pedb.point_3d(math.cos(_angle), -1 * math.sin(_angle), zero_data)
cell_inst2.Set3DTransformation(point_loc, point_from, point_to, rotation, point3d_t)
self.refresh_layer_collection()
return True
return cell_inst2

@pyaedt_function_handler()
def place_a3dcomp_3d_placement(self, a3dcomp_path, angle=0.0, offset_x=0.0, offset_y=0.0, place_on_top=True):
def place_a3dcomp_3d_placement(
self,
a3dcomp_path,
angle=0.0,
offset_x=0.0,
offset_y=0.0,
offset_z=0.0,
place_on_top=True,
):
"""Place a 3D Component into current layout.
3D Component ports are not visible via EDB. They will be visible after the EDB has been opened in Ansys
Electronics Desktop as a project.
Expand All @@ -1488,6 +1506,9 @@ def place_a3dcomp_3d_placement(self, a3dcomp_path, angle=0.0, offset_x=0.0, offs
offset_y : double, optional
The y offset value.
The default value is ``0.0``.
offset_z : double, optional
The z offset value. (i.e. elevation)
The default value is ``0.0``.
place_on_top : bool, optional
Whether to place the 3D Component on the top or the bottom of this layout.
If ``False`` then the 3D Component will also be flipped over around its X axis.
Expand Down Expand Up @@ -1519,10 +1540,10 @@ def place_a3dcomp_3d_placement(self, a3dcomp_path, angle=0.0, offset_x=0.0, offs
target_bottom_elevation = res[4]
flip_angle = self._edb_value("0deg")
if place_on_top:
elevation = target_top_elevation
elevation = target_top_elevation + offset_z
else:
flip_angle = self._edb_value("180deg")
elevation = target_bottom_elevation
elevation = target_bottom_elevation - offset_z
h_stackup = self._edb_value(elevation)
location = self._pedb.point_3d(offset_x, offset_y, h_stackup)

Expand Down
2 changes: 2 additions & 0 deletions pyaedt/generic/clr_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
is_linux = os.name == "posix"
is_windows = not is_linux
is_clr = False
sys.path.append(os.path.join(pyaedt_path, "dlls", "PDFReport"))
if is_linux and cpython: # pragma: no cover
try:
if os.environ.get("DOTNET_ROOT") is None:
Expand Down Expand Up @@ -44,6 +45,7 @@

load("coreclr")
is_clr = True

except:
pass

Expand Down
2 changes: 0 additions & 2 deletions pyaedt/generic/pdf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import sys
import warnings

from pyaedt import __version__
Expand All @@ -9,7 +8,6 @@
from pyaedt.generic.clr_module import _clr
from pyaedt.generic.clr_module import is_clr

sys.path.append(os.path.join(pyaedt_path, "dlls", "PDFReport"))
try:
_clr.AddReference("AnsysReport")
from AnsysReport import CreatePdfReport
Expand Down

0 comments on commit b258359

Please sign in to comment.