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

Main edb #28

Merged
merged 3 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@

__version__ = "0.0.1"

version = __version__

from pyedb.generic.design_types import Edb
version = __version__
26 changes: 0 additions & 26 deletions src/pyedb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
from pyedb.generic.design_types import Edb


# import pyedb.legacy.downloads as downloads
# from pyedb.generic import constants
# import pyedb.generic.DataHandlers as data_handler
# import pyedb.generic.general_methods as general_methods
from pyedb.generic.general_methods import _pythonver
from pyedb.generic.general_methods import _retry_ntimes
from pyedb.generic.general_methods import generate_unique_folder_name
Expand All @@ -29,28 +25,6 @@
from pyedb.generic.general_methods import online_help
from pyedb.generic.general_methods import pyedb_function_handler
from pyedb.generic.general_methods import settings

# try:
# from pyedb.generic.design_types import Hfss3dLayout
# except:
# from pyedb.generic.design_types import Hfss3dLayout
# from pyedb.generic.design_types import Circuit
# from pyedb.generic.design_types import Desktop
# from pyedb.generic.design_types import Emit
# from pyedb.generic.design_types import Hfss
# from pyedb.generic.design_types import Icepak
# from pyedb.generic.design_types import Maxwell2d
# from pyedb.generic.design_types import Maxwell3d
# from pyedb.generic.design_types import MaxwellCircuit
# from pyedb.generic.design_types import Mechanical
# from pyedb.generic.design_types import Q2d
# from pyedb.generic.design_types import Q3d
# from pyedb.generic.design_types import Rmxprt
# from pyedb.generic.design_types import Simplorer
# from pyedb.generic.design_types import Siwave
# from pyedb.generic.design_types import TwinBuilder
# from pyedb.generic.design_types import get_pyedb_app
# from pyedb.generic.design_types import launch_desktop
from pyedb.misc.misc import current_student_version
from pyedb.misc.misc import current_version
from pyedb.misc.misc import installed_versions
4 changes: 1 addition & 3 deletions src/pyedb/generic/design_types.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import re
import sys
import os


Expand Down Expand Up @@ -99,7 +97,7 @@ def Edb(
)
# TODO: Use EDB gRPC
else:
from pyedb.edb import Edb as app
from pyedb.grpc.edb import Edb as app
return app(
edbpath=edbpath,
cellname=cellname,
Expand Down
8 changes: 0 additions & 8 deletions src/pyedb/grpc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +0,0 @@
from __future__ import absolute_import # noreorder

from pyaedt.edb_core.components import Components
from pyaedt.edb_core.hfss import EdbHfss
from pyaedt.edb_core.layout import EdbLayout
from pyaedt.edb_core.nets import EdbNets
from pyaedt.edb_core.padstack import EdbPadstacks
from pyaedt.edb_core.siwave import EdbSiwave
133 changes: 66 additions & 67 deletions src/pyedb/grpc/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
import re
import warnings

import ansys.edb.hierarchy.component_group
from pyedb.grpc.edb_data.components_data import EDBComponent
from pyedb.grpc.edb_data.components_data import EDBComponentDef
from pyedb.grpc.edb_data.padstacks_data import EDBPadstackInstance
from pyedb.grpc.edb_data.sources import Source
from pyedb.grpc.edb_data.sources import SourceType
from pyedb.grpc.edb_core.edb_data.components_data import EDBComponent
from pyedb.grpc.edb_core.edb_data.components_data import EDBComponentDef
from pyedb.grpc.edb_core.edb_data.padstacks_data import EDBPadstackInstance
from pyedb.grpc.edb_core.edb_data.sources import Source
from pyedb.grpc.edb_core.edb_data.sources import SourceType
from pyedb.grpc.padstack import EdbPadstacks
from pyedb.generic.general_methods import get_filename_without_extension
from pyedb.generic.general_methods import pyedb_function_handler
Expand All @@ -23,11 +22,9 @@
from ansys.edb.hierarchy.sparameter_model import SParameterModel
from ansys.edb.hierarchy.pin_group import PinGroup
from ansys.edb.database import ProductIdType
from ansys.edb.definition.component_pin import ComponentPin
from ansys.edb.definition.solder_ball_property import SolderballShape
from ansys.edb.definition.die_property import DieType
from ansys.edb.definition.die_property import DieOrientation
from ansys.edb.layer.layer_collection import LayerCollection
from ansys.edb.definition.component_def import ComponentDef
from ansys.edb.definition.component_pin import ComponentPin
from ansys.edb.hierarchy.component_group import ComponentGroup
Expand All @@ -41,6 +38,7 @@
from ansys.edb.hierarchy.component_group import ComponentType
from ansys.edb.utility.rlc import Rlc


def resistor_value_parser(RValue):
"""Convert a resistor value.
Expand Down Expand Up @@ -522,14 +520,14 @@ def _get_edb_pin_from_pin_name(self, cmp, pin):

@pyedb_function_handler()
def get_component_placement_vector(
self,
mounted_component,
hosting_component,
mounted_component_pin1,
mounted_component_pin2,
hosting_component_pin1,
hosting_component_pin2,
flipped=False,
self,
mounted_component,
hosting_component,
mounted_component_pin1,
mounted_component_pin2,
hosting_component_pin1,
hosting_component_pin2,
flipped=False,
):
"""Get the placement vector between 2 components.
Expand Down Expand Up @@ -807,7 +805,8 @@ def create_port_on_pins(self, refdes, pins, reference_pins, impedance=50.0):

@pyedb_function_handler()
def create_port_on_component(
self, component, net_list, port_type=SourceType.CoaxPort, do_pingroup=True, reference_net="gnd", port_name=None
self, component, net_list, port_type=SourceType.CoaxPort, do_pingroup=True, reference_net="gnd",
port_name=None
):
"""Create ports on a component.
Expand Down Expand Up @@ -895,7 +894,7 @@ def create_port_on_component(
]
for p in ref_pins:
if not p.is_layout_pin:
p.is_layout_pin= True
p.is_layout_pin = True
if len(ref_pins) == 0:
self._logger.info("No reference pin found on component {}.".format(component.GetName()))
if do_pingroup:
Expand Down Expand Up @@ -1023,9 +1022,9 @@ def replace_rlc_by_gap_boundaries(self, component=None):
return False
component_type = component.edbcomponent.component_type
if (
component_type == ComponentType.OTHER
or component_type == ComponentType.IC
or component_type == ComponentType.IO
component_type == ComponentType.OTHER
or component_type == ComponentType.IC
or component_type == ComponentType.IO
):
self._logger.info("Component %s passed to deactivate is not an RLC.", component.refdes)
return False
Expand Down Expand Up @@ -1069,9 +1068,9 @@ def deactivate_rlc_component(self, component=None, create_circuit_port=False):
return False
component_type = component.edbcomponent.component_type
if (
component_type == ComponentType.OTHER
or component_type == ComponentType.IC
or component_type == ComponentType.IO
component_type == ComponentType.OTHER
or component_type == ComponentType.IC
or component_type == ComponentType.IO
):
self._logger.info("Component %s passed to deactivate is not an RLC.", component.refdes)
return False
Expand Down Expand Up @@ -1275,7 +1274,7 @@ def _getComponentDefinition(self, name, pins):

@pyedb_function_handler()
def create_rlc_component(
self, pins, component_name="", r_value=1.0, c_value=1e-9, l_value=1e-9, is_parallel=False
self, pins, component_name="", r_value=1.0, c_value=1e-9, l_value=1e-9, is_parallel=False
): # pragma: no cover
"""Create physical Rlc component.
Expand Down Expand Up @@ -1315,16 +1314,16 @@ def create_rlc_component(

@pyedb_function_handler()
def create(
self,
pins,
component_name,
placement_layer=None,
component_part_name=None,
is_rlc=False,
r_value=1.0,
c_value=1e-9,
l_value=1e-9,
is_parallel=False,
self,
pins,
component_name,
placement_layer=None,
component_part_name=None,
is_rlc=False,
r_value=1.0,
c_value=1e-9,
l_value=1e-9,
is_parallel=False,
):
"""Create a component from pins.
Expand Down Expand Up @@ -1488,7 +1487,7 @@ def set_component_model(self, componentname, model_type="Spice", modelpath=None,
elif model_type == "Touchstone": # pragma: no cover
nPortModelName = modelname
edbComponentDef = edb_component.component_def
nPortModel = NPortComponentModel.find(edbComponentDef, nPortModelName) # -> Missing command in pyedb
nPortModel = NPortComponentModel.find(edbComponentDef, nPortModelName) # -> Missing command in pyedb
if nPortModel.IsNull():
nPortModel = NPortComponentModel.create(nPortModelName)
nPortModel.reference_file(modelpath)
Expand Down Expand Up @@ -1660,7 +1659,7 @@ def disable_rlc_component(self, component_name):
>>> edbapp.components.disable_rlc_component("A1")
"""
edb_cmp = self.get_component_by_name(component_name) # not correct need to be checked in debug
edb_cmp = self.get_component_by_name(component_name) # not correct need to be checked in debug
if edb_cmp is not None:
rlc_property = edb_cmp.component_property
pin_pair_model = rlc_property.model
Expand All @@ -1676,13 +1675,13 @@ def disable_rlc_component(self, component_name):

@pyedb_function_handler()
def set_solder_ball(
self,
component="",
sball_diam="100um",
sball_height="150um",
shape="Cylinder",
sball_mid_diam=None,
chip_orientation="chip_down",
self,
component="",
sball_diam="100um",
sball_height="150um",
shape="Cylinder",
sball_mid_diam=None,
chip_orientation="chip_down",
):
"""Set cylindrical solder balls on a given component.
Expand Down Expand Up @@ -1768,12 +1767,12 @@ def set_solder_ball(

@pyedb_function_handler()
def set_component_rlc(
self,
componentname,
res_value=None,
ind_value=None,
cap_value=None,
isparallel=False,
self,
componentname,
res_value=None,
ind_value=None,
cap_value=None,
isparallel=False,
):
"""Update values for an RLC component.
Expand Down Expand Up @@ -1833,8 +1832,8 @@ def set_component_rlc(
rlc.c = Value(cap_value)
else:
rlc.c_enabled = False
pin_pair = (from_pin.name, to_pin.name)# missing PinPair ?
rlc_model = PinPairModel.create() # all to check
pin_pair = (from_pin.name, to_pin.name) # missing PinPair ?
rlc_model = PinPairModel.create() # all to check
rlc_model.pin_pairs(pin_pair, rlc)
edb_rlc_component_property.model = rlc_model
edb_component.component_property = edb_rlc_component_property
Expand All @@ -1850,12 +1849,12 @@ def set_component_rlc(

@pyedb_function_handler()
def update_rlc_from_bom(
self,
bom_file,
delimiter=";",
valuefield="Func des",
comptype="Prod name",
refdes="Pos / Place",
self,
bom_file,
delimiter=";",
valuefield="Func des",
comptype="Prod name",
refdes="Pos / Place",
):
"""Update the EDC core component values (RLCs) with values coming from a BOM file.
Expand Down Expand Up @@ -1920,13 +1919,13 @@ def update_rlc_from_bom(

@pyedb_function_handler()
def import_bom(
self,
bom_file,
delimiter=",",
refdes_col=0,
part_name_col=1,
comp_type_col=2,
value_col=3,
self,
bom_file,
delimiter=",",
refdes_col=0,
part_name_col=1,
comp_type_col=2,
value_col=3,
):
"""Load external BOM file.
Expand Down Expand Up @@ -2084,8 +2083,8 @@ def get_pin_from_component(self, component, netName=None, pinName=None):
p
for p in list(component.layout_objs)
if int(p.obj_type) == 1
and p.is_layout_pin
and (self.get_aedt_pin_name(p) in pinName or p.name in pinName)
and p.is_layout_pin
and (self.get_aedt_pin_name(p) in pinName or p.name in pinName)
]
else:
pins = [p for p in list(component.layout_objs) if int(p.obj_type) == 1 and p.is_layout_pin]
Expand Down
Loading
Loading