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

Added short_component_pins to edb and parameters_values and polygon_data to Padstack Instances #848

Merged
merged 13 commits into from
Feb 10, 2022
8 changes: 8 additions & 0 deletions _unittest/test_00_EDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,13 @@ def test_49_get_padstack(self):
assert pad.hole_offset_y is not None or False
assert pad.hole_type is not None or False
assert pad.pad_by_layer[pad.via_stop_layer].parameters is not None or False
assert pad.pad_by_layer[pad.via_stop_layer].parameters_values is not None or False
assert pad.pad_by_layer[pad.via_stop_layer].offset_x is not None or False
assert pad.pad_by_layer[pad.via_stop_layer].offset_y is not None or False
assert isinstance(pad.pad_by_layer[pad.via_stop_layer].geometry_type, int)
polygon = pad.pad_by_layer[pad.via_stop_layer].polygon_data
if polygon:
assert polygon.GetBBox()

def test_50_set_padstack(self):
pad = self.edbapp.core_padstack.padstacks["C10N116"]
Expand Down Expand Up @@ -597,3 +601,7 @@ def test_75_primitives_area(self):
assert self.edbapp.core_primitives.primitives[i].area(False) > 0
assert self.edbapp.core_primitives.primitives[i].area(True) > 0
i += 1

def test_76_short_component(self):
assert self.edbapp.core_components.short_component_pins("EU1", width=0.2e-3)
assert self.edbapp.core_components.short_component_pins("U10", ["2", "5"])
1 change: 1 addition & 0 deletions doc/source/API/Boundaries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ Example without NativeComponentObject:
NativeComponentObject
BoundaryObject
FarFieldSetup
Matrix


1 change: 1 addition & 0 deletions doc/source/Resources/pyaedt_with_IDE.bat
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ if not exist "%APPDATA%\pyaedt_env_ide\" (
"%APPDATA%\pyaedt_env_ide\Scripts\pip" install jupyterlab
"%APPDATA%\pyaedt_env_ide\Scripts\pip" install spyder
"%APPDATA%\pyaedt_env_ide\Scripts\pip" install ipython -U
"%APPDATA%\pyaedt_env_ide\Scripts\pip" install ipyvtklink
call "%APPDATA%\pyaedt_env_ide\Scripts\python" "%APPDATA%\pyaedt_env_ide\Lib\site-packages\pyaedt\misc\aedtlib_personalib_install.py" %aedt_var%
)
if [%1%]==[-update] (
Expand Down
16 changes: 11 additions & 5 deletions examples/05-Q3D/Q3D_Example.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,23 @@

q.create_setup(props={"AdaptiveFreq": "100MHz"})


###############################################################################
# Create a Rectangular Plot
# ~~~~~~~~~~~~~~~~~~~~~~~~~
# This command creates a rectangular plot and a Data Table.
# Get Curves for plot
# ~~~~~~~~~~~~~~~~~~~
# This command simplify the way you can get curves to be plotted.

data_plot_self = q.matrices[0].get_sources_for_plot(get_self_terms=True, get_mutual_terms=False)
data_plot_mutual = q.get_traces_for_plot(get_self_terms=False, get_mutual_terms=True)
data_plot_self
data_plot_mutual

###############################################################################
# Create a Rectangular Plot
# ~~~~~~~~~~~~~~~~~~~~~~~~~
# This command creates a rectangular plot and a Data Table.
q.post.create_rectangular_plot(expression=data_plot_self, context="Original")

data_plot_mutual = q.get_traces_for_plot(get_self_terms=False, get_mutual_terms=True)

q.post.create_rectangular_plot(expression=data_plot_mutual, context="Original", plot_type="Data Table")

###############################################################################
Expand Down
Binary file modified pyaedt/dlls/EDBLib/DataModel.dll
Binary file not shown.
Binary file modified pyaedt/dlls/EDBLib/EdbLib.dll
Binary file not shown.
42 changes: 42 additions & 0 deletions pyaedt/edb_core/EDB_Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,35 @@ def geometry_type(self, geom_type):
params = [val, val, val]
self._update_pad_parameters_parameters(geom_type=geom_type, params=params)

@property
def parameters_values(self):
"""Parameters.

Returns
-------
list
List of parameters.
"""
pad_values = self._padstack_methods.GetPadParametersValue(self._edb_padstack, self.layer_name, self.pad_type)
return [i.ToDouble() for i in pad_values.Item2]

@property
def polygon_data(self):
"""Parameters.

Returns
-------
list
List of parameters.
"""
try:
pad_values = self._padstack_methods.GetPolygonalPadParameters(
self._edb_padstack, self.layer_name, self.pad_type
)
return pad_values.Item1
except:
return

@property
def parameters(self):
"""Parameters.
Expand Down Expand Up @@ -2243,6 +2272,19 @@ def is_parallel_rlc(self):
return pair.IsParallel
return None

@property
def center(self):
"""Compute the component center.

Returns
-------
list
"""
layinst = self.edbcomponent.GetLayout().GetLayoutInstance()
cmpinst = layinst.GetLayoutObjInstance(self.edbcomponent, None)
center = cmpinst.GetCenter()
return [center.X.ToDouble(), center.Y.ToDouble()]

@property
def pinlist(self):
"""Pins of Component.
Expand Down
117 changes: 117 additions & 0 deletions pyaedt/edb_core/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from pyaedt.generic.constants import SourceType
from pyaedt.edb_core.EDB_Data import EDBComponent
from pyaedt.edb_core.padstack import EdbPadstacks
from pyaedt.modeler.GeometryOperators import GeometryOperators

try:
import clr
Expand Down Expand Up @@ -1486,3 +1487,119 @@ def get_through_resistor_list(self, threshold=1):
through_comp_list.append(refdes)

return through_comp_list

@aedt_exception_handler
def short_component_pins(self, component_name, pins_to_short=None, width=1e-3):
"""Short pins of component with a trace.

Parameters
----------
component_name : str
Name of the component.
pins_to_short : list, optional
List of pins to short. If `None`, all pins will be shorted.
width : float, optional
Short Trace width. It will be used in trace computation algorithm

Returns
-------
bool
``True`` when successful, ``False`` when failed.

Examples
--------

>>> from pyaedt import Edb
>>> edbapp = Edb("myaedbfolder")
>>> edbapp.core_components.short_component_pins("J4A2", ["G4", "9", "3"])

"""
component = self.components[component_name]
pins = component.pins
pins_list = []

component.center
for pin_name, pin in pins.items():
if pins_to_short:
if pin_name in pins_to_short:
pins_list.append(pin)
else:
pins_list.append(pin)
positions_to_short = []
center = component.center
c = [center[0], center[1], 0]
delta_pins = []
w = width
for pin in pins_list:
placement_layer = pin.placement_layer
positions_to_short.append(pin.position)
pad = self._pedb.core_padstack.padstacks[pin.pin.GetPadstackDef().GetName()].pad_by_layer[placement_layer]
pars = pad.parameters_values
geom = pad.geometry_type
if geom < 6 and pars:
delta_pins.append(max(pars) + min(pars) / 2)
w = min(min(pars), w)
elif pars:
delta_pins.append(1.5 * pars[0])
w = min(pars[0], w)
elif pad.polygon_data:
bbox = pad.polygon_data.GetBBox()
lower = [bbox.Item1.X.ToDouble(), bbox.Item1.Y.ToDouble()]
upper = [bbox.Item2.X.ToDouble(), bbox.Item2.Y.ToDouble()]
pars = [abs(lower[0] - upper[0]), abs(lower[1] - upper[1])]
delta_pins.append(max(pars) + min(pars) / 2)
w = min(min(pars), w)
else:
delta_pins.append(1.5 * width)
i = 0

while i < len(positions_to_short) - 1:
p0 = []
p0.append([positions_to_short[i][0] - delta_pins[i], positions_to_short[i][1], 0])
p0.append([positions_to_short[i][0] + delta_pins[i], positions_to_short[i][1], 0])
p0.append([positions_to_short[i][0], positions_to_short[i][1] - delta_pins[i], 0])
p0.append([positions_to_short[i][0], positions_to_short[i][1] + delta_pins[i], 0])
p0.append([positions_to_short[i][0], positions_to_short[i][1], 0])
l0 = [
GeometryOperators.points_distance(p0[0], c),
GeometryOperators.points_distance(p0[1], c),
GeometryOperators.points_distance(p0[2], c),
GeometryOperators.points_distance(p0[3], c),
GeometryOperators.points_distance(p0[4], c),
]
l0_min = l0.index(min(l0))
p1 = []
p1.append([positions_to_short[i + 1][0] - delta_pins[i + 1], positions_to_short[i + 1][1], 0])
p1.append([positions_to_short[i + 1][0] + delta_pins[i + 1], positions_to_short[i + 1][1], 0])
p1.append([positions_to_short[i + 1][0], positions_to_short[i + 1][1] - delta_pins[i + 1], 0])
p1.append([positions_to_short[i + 1][0], positions_to_short[i + 1][1] + delta_pins[i + 1], 0])
p1.append([positions_to_short[i + 1][0], positions_to_short[i + 1][1], 0])

l1 = [
GeometryOperators.points_distance(p1[0], c),
GeometryOperators.points_distance(p1[1], c),
GeometryOperators.points_distance(p1[2], c),
GeometryOperators.points_distance(p1[3], c),
GeometryOperators.points_distance(p1[4], c),
]
l1_min = l1.index(min(l1))

trace_points = [positions_to_short[i]]

trace_points.append(p0[l0_min][:2])
trace_points.append(c[:2])
trace_points.append(p1[l1_min][:2])

trace_points.append(positions_to_short[i + 1])

path = self._pedb.core_primitives.Shape("polygon", points=trace_points)
self._pedb.core_primitives.create_path(
path,
layer_name=placement_layer,
net_name="short",
width=w,
start_cap_style="Flat",
end_cap_style="Flat",
)
i += 1
return True
23 changes: 13 additions & 10 deletions pyaedt/edb_core/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,8 @@ def create_path(
``"Extended",`` and ``"Flat"``. The default is
``"Round"``.
corner_style : str, optional
Style of the corner. Options are ``"Round"`` and
``"Flat"``. The default is ``"Round"``.
Style of the corner. Options are ``"Round"``,
``"Sharp"`` and ``"Mitered"``. The default is ``"Round"``.

Returns
-------
Expand All @@ -449,21 +449,24 @@ def create_path(
"""
net = self._pedb.core_nets.find_or_create_net(net_name)
if start_cap_style.lower() == "round":
start_cap_style = 0
start_cap_style = self._edb.Cell.Primitive.PathEndCapStyle.Round
elif start_cap_style.lower() == "extended":
start_cap_style = 2
start_cap_style = self._edb.Cell.Primitive.PathEndCapStyle.Extended # pragma: no cover
else:
start_cap_style = 1
start_cap_style = self._edb.Cell.Primitive.PathEndCapStyle.Flat # pragma: no cover
if end_cap_style.lower() == "round":
end_cap_style = 0
end_cap_style = self._edb.Cell.Primitive.PathEndCapStyle.Round # pragma: no cover
elif end_cap_style.lower() == "extended":
end_cap_style = 2
end_cap_style = self._edb.Cell.Primitive.PathEndCapStyle.Extended # pragma: no cover
else:
end_cap_style = 1
end_cap_style = self._edb.Cell.Primitive.PathEndCapStyle.Flat
if corner_style.lower() == "round":
corner_style = 0
corner_style = self._edb.Cell.Primitive.PathCornerStyle.RoundCorner
elif corner_style.lower() == "sharp":
corner_style = self._edb.Cell.Primitive.PathCornerStyle.SharpCorner # pragma: no cover
else:
corner_style = 1
corner_style = self._edb.Cell.Primitive.PathCornerStyle.MiterCorner # pragma: no cover

pointlists = [
self._edb.Geometry.PointData(self._edb_value(i[0]), self._edb_value(i[1])) for i in path_list.points
]
Expand Down