Skip to content

Commit fd740b8

Browse files
authored
Merge branch 'main' into F511_dm_part_1_0
2 parents b3fc4f1 + ae0e67d commit fd740b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+954
-429
lines changed

CONTRIBUTORS.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66

77
## Individual Contributors
88

9+
* [amruta3991](https://github.com/amruta3991)
10+
* [apasarka](https://github.com/apasarka)
11+
* [asamaiya](https://github.com/asamaiya)
12+
* [chenchienjacklin](https://github.com/chenchienjacklin)
13+
* [drewm102](https://github.com/drewm102)
914
* [Hiroki](https://github.com/hiro727)
1015
* [Isaac Waldron](https://github.com/isaacwaldron)
1116
* [Karan Bhagat](https://github.com/kbhagat-ansys)
@@ -14,11 +19,6 @@
1419
* [Roberto Pastor Muela](https://github.com/RobPasMue)
1520
* [SitaRamesh](https://github.com/SitaRamesh)
1621
* [SriniSundararajan](https://github.com/SriniSundararajan)
17-
* [Sébastien Morais](https://github.com/SMoraisAnsys)
18-
* [amruta3991](https://github.com/amruta3991)
19-
* [apasarka](https://github.com/apasarka)
20-
* [asamaiya](https://github.com/asamaiya)
21-
* [chenchienjacklin](https://github.com/chenchienjacklin)
22-
* [drewm102](https://github.com/drewm102)
2322
* [svandenb-dev](https://github.com/svandenb-dev)
23+
* [Sébastien Morais](https://github.com/SMoraisAnsys)
2424
* [vamartid](https://github.com/vmartidis)

doc/source/api/simulation_setup.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Classes
3636
simulation_setup.FreqSweepType
3737
simulation_setup.HFSSRegionComputeResource
3838
simulation_setup.InterpolatingSweepData
39+
simulation_setup.FrequencyData
3940
raptor_x_simulation_settings.RaptorXSimulationSettings
4041
raptor_x_simulation_settings.RaptorXGeneralSettings
4142
raptor_x_simulation_settings.RaptorXAdvancedSettings
@@ -71,6 +72,7 @@ Enums
7172
:toctree: _autosummary
7273

7374
simulation_setup.SimulationSetupType
75+
simulation_setup.Distribution
7476
hfss_simulation_settings.AdaptType
7577
hfss_simulation_settings.BasisFunctionOrder
7678
hfss_simulation_settings.SolverType

doc/source/api/utility.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,18 @@ Classes
2020
transform.Transform
2121
transform3d.Transform3D
2222
value.Value
23+
edb_error_manager.EDBErrorSeverity
24+
edb_error_manager.EDBError
25+
edb_error_manager.get_error_messages
26+
27+
28+
Enums
29+
-----
30+
31+
.. autosummary::
32+
:toctree: _autosummary
33+
34+
heat_sink.HeatSinkFinOrientation
35+
hfss_extent_info.HFSSExtentInfoType
36+
hfss_extent_info.OpenRegionType
37+
layer_map.LayerMapUniqueDirection

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "flit_core.buildapi"
55
[project]
66
# Check https://flit.readthedocs.io/en/latest/pyproject_toml.html for all available sections
77
name = "ansys-edb-core"
8-
version = "0.2.0.dev3"
8+
version = "0.2.0.dev4"
99
description = "A python wrapper for Ansys Edb service"
1010
readme = "README.rst"
1111
requires-python = ">=3.8"
@@ -25,7 +25,7 @@ classifiers = [
2525

2626

2727
dependencies = [
28-
"ansys-api-edb==0.2.dev3",
28+
"ansys-api-edb==0.2.dev6",
2929
"protobuf>=3.19.3,<5",
3030
"grpcio>=1.44.0",
3131
"Django>=4.2.16"

src/ansys/edb/core/definition/component_def.py

Lines changed: 92 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
"""Component definition."""
2+
from __future__ import annotations
3+
4+
from typing import TYPE_CHECKING, List
5+
6+
if TYPE_CHECKING:
7+
from src.ansys.edb.core.database import ProductIdType
8+
29
from ansys.api.edb.v1.component_def_pb2_grpc import ComponentDefServiceStub
310

411
from ansys.edb.core.definition import component_model, component_pin
512
from ansys.edb.core.edb_defs import DefinitionObjType
613
from ansys.edb.core.inner import ObjBase, messages
14+
from ansys.edb.core.inner.messages import (
15+
edb_obj_collection_property_message,
16+
edb_obj_pair_message,
17+
get_product_property_ids_message,
18+
get_product_property_message,
19+
set_product_property_message,
20+
)
721
from ansys.edb.core.inner.utils import map_list
822
from ansys.edb.core.session import StubAccessor, StubType
923

@@ -87,7 +101,7 @@ def component_models(self):
87101
This property is read-only.
88102
"""
89103
objs = self.__stub.GetComponentModels(self.msg).items
90-
return map_list(objs, component_model.ComponentModel)
104+
return map_list(objs, lambda msg: component_model.ComponentModel(msg).cast())
91105

92106
@property
93107
def component_pins(self):
@@ -125,3 +139,80 @@ def remove_component_model(self, value):
125139
Once a component model is added to one component def, it cannot be added to any other, even when removed.
126140
"""
127141
self.__stub.RemoveComponentModel(messages.pointer_property_message(self, value))
142+
143+
def reorder_pins(self, reordered_pins: List[component_pin.ComponentPin]):
144+
"""Reorders the existing pins in the components definition to be in the same order \
145+
as in the provided list.
146+
147+
Parameters
148+
----------
149+
reordered_pins : list of .ComponentPin
150+
The component pins in the new order. These must be the same pins \
151+
that already exist in the component definition.
152+
"""
153+
self.__stub.ReorderPins(edb_obj_collection_property_message(self, reordered_pins))
154+
155+
def remove_pin(self, pin_to_remove: component_pin.ComponentPin):
156+
"""Remove the provided component pin from the component definition. \
157+
the pin will be deleted and set to :meth:`null <.is_null>`.
158+
159+
Parameters
160+
----------
161+
pin_to_remove : .ComponentPin
162+
The pin to be removed.
163+
"""
164+
self.__stub.RemovePin(edb_obj_pair_message(self, pin_to_remove))
165+
pin_to_remove.msg = None
166+
167+
def get_product_property(self, prod_id: ProductIdType, attr_it: int) -> str:
168+
"""Get the product property for a given product ID and attribute ID.
169+
170+
Parameters
171+
----------
172+
prod_id : .ProductIdType
173+
Product ID.
174+
attr_it : int
175+
Attribute ID.
176+
177+
Returns
178+
-------
179+
str
180+
Product property for the given product ID and attribute ID.
181+
"""
182+
return self.__stub.GetProductProperty(
183+
get_product_property_message(self, prod_id, attr_it)
184+
).value
185+
186+
def set_product_property(self, prod_id: ProductIdType, attr_it: int, prop_value: str):
187+
"""Set the product property for the given product ID and attribute ID.
188+
189+
Parameters
190+
----------
191+
prod_id : .ProductIdType
192+
Product ID.
193+
attr_it : int
194+
Attribute ID.
195+
prop_value : str
196+
New value for the product property.
197+
"""
198+
self.__stub.SetProductProperty(
199+
set_product_property_message(self, prod_id, attr_it, prop_value)
200+
)
201+
202+
def get_product_property_ids(self, prod_id: ProductIdType) -> List[int]:
203+
"""Get the list of property IDs for a given property ID.
204+
205+
Parameters
206+
----------
207+
prod_id : ProductIdType
208+
Product ID.
209+
210+
Returns
211+
-------
212+
list[int]
213+
Attribute IDs for the given product ID.
214+
"""
215+
attr_ids = self.__stub.GetProductPropertyIds(
216+
get_product_property_ids_message(self, prod_id)
217+
).ids
218+
return [attr_id for attr_id in attr_ids]

src/ansys/edb/core/definition/component_model.py

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""Component model definition."""
2+
from enum import Enum
3+
4+
from ansys.api.edb.v1.component_model_pb2 import ComponentModelType as pb_comp_model_Type
25
from ansys.api.edb.v1.component_model_pb2_grpc import (
36
ComponentModelServiceStub,
47
DynamicLinkComponentModelServiceStub,
@@ -10,6 +13,14 @@
1013
from ansys.edb.core.session import StubAccessor, StubType
1114

1215

16+
class ComponentModelType(Enum):
17+
"""Enum representing component model types."""
18+
19+
N_PORT = pb_comp_model_Type.N_PORT
20+
DYNAMIC_LINK = pb_comp_model_Type.DYNAMIC_LINK
21+
UNKNOWN_COMPONENT_MODEL_TYPE = pb_comp_model_Type.UNKNOWN_MODEL_TYPE
22+
23+
1324
class ComponentModel(ObjBase):
1425
"""Represents a component model."""
1526

@@ -42,7 +53,7 @@ def find_by_name(cls, comp_def, value):
4253
"""
4354
return ComponentModel(
4455
cls.__stub.FindByName(messages.string_property_message(comp_def, value))
45-
)
56+
).cast()
4657

4758
@classmethod
4859
def find_by_id(cls, comp_def, value):
@@ -60,7 +71,51 @@ def find_by_id(cls, comp_def, value):
6071
ComponentModel
6172
Component model that is found, ``None`` otherwise.
6273
"""
63-
return ComponentModel(cls.__stub.FindById(messages.int_proprty_message(comp_def, value)))
74+
return ComponentModel(
75+
cls.__stub.FindById(messages.int_property_message(comp_def, value))
76+
).cast()
77+
78+
@property
79+
def name(self) -> str:
80+
""":obj:`str`: The name of the component model.
81+
82+
This property is read-only.
83+
"""
84+
return self.__stub.GetName(self.msg).value
85+
86+
@property
87+
def component_model_type(self) -> ComponentModelType:
88+
""":class:`.ComponentModelType`: The type of the component model.
89+
90+
This property is read-only.
91+
"""
92+
return ComponentModelType(self.__stub.GetType(self.msg).type)
93+
94+
@property
95+
def component_model_id(self) -> int:
96+
""":obj:`int`: The id of the component model.
97+
98+
This property is read-only.
99+
"""
100+
return self.__stub.GetId(self.msg).value
101+
102+
def cast(self) -> "ComponentModel":
103+
"""Cast the component model object to the correct concrete type.
104+
105+
Returns
106+
-------
107+
.ComponentModel
108+
"""
109+
comp_model_type = (
110+
ComponentModelType.UNKNOWN_COMPONENT_MODEL_TYPE
111+
if self.is_null
112+
else self.component_model_type
113+
)
114+
if comp_model_type == ComponentModelType.N_PORT:
115+
return NPortComponentModel(self.msg)
116+
elif comp_model_type == ComponentModelType.DYNAMIC_LINK:
117+
return DynamicLinkComponentModel(self.msg)
118+
return ComponentModel(self.msg)
64119

65120

66121
class NPortComponentModel(ComponentModel):

src/ansys/edb/core/definition/padstack_def_data.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,15 @@ def get_pad_parameters(self, layer, pad_type):
189189
Value(message.generic.offset_y),
190190
Value(message.generic.rotation),
191191
)
192-
else:
192+
elif message.HasField("polygon"):
193193
return (
194194
parser.to_polygon_data(message.polygon.fp),
195195
Value(message.polygon.offset_x),
196196
Value(message.polygon.offset_y),
197197
Value(message.polygon.rotation),
198198
)
199+
else:
200+
return ()
199201

200202
def set_pad_parameters(
201203
self, layer, pad_type, offset_x, offset_y, rotation, type_geom=None, sizes=None, fp=None

src/ansys/edb/core/geometry/polygon_data.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from ansys.edb.core import session
1010
from ansys.edb.core.geometry.arc_data import ArcData
1111
from ansys.edb.core.inner import messages, parser
12+
from ansys.edb.core.inner.utils import client_stream_iterator
1213
from ansys.edb.core.utility import conversions
1314

1415

@@ -40,6 +41,17 @@ class IntersectionType(Enum):
4041
class PolygonData:
4142
"""Represents a polygon data object."""
4243

44+
@staticmethod
45+
def _polygon_data_request_iterator(polys):
46+
chunk_entry_creator = lambda poly: messages.polygon_data_message(poly)
47+
chunk_entries_getter = lambda chunk: chunk.polygons
48+
return client_stream_iterator(
49+
polys,
50+
polygon_data_pb2.PolygonDataListMessage,
51+
chunk_entry_creator,
52+
chunk_entries_getter,
53+
)
54+
4355
__stub: polygon_data_pb2_grpc.PolygonDataServiceStub = session.StubAccessor(
4456
session.StubType.polygon_data
4557
)
@@ -355,7 +367,7 @@ def bbox_of_polygons(cls, polygons):
355367
-------
356368
tuple[.PointData, .PointData]
357369
"""
358-
return cls.__stub.GetBBox(messages.polygon_data_list_message(polygons))
370+
return cls.__stub.GetStreamedBBox(PolygonData._polygon_data_request_iterator(polygons))
359371

360372
@parser.to_circle
361373
def bounding_circle(self):

src/ansys/edb/core/hierarchy/group.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from ansys.edb.core.edb_defs import LayoutObjType
77
from ansys.edb.core.hierarchy.hierarchy_obj import HierarchyObj
88
from ansys.edb.core.inner import messages
9+
from ansys.edb.core.inner.utils import query_lyt_object_collection
910
from ansys.edb.core.session import StubAccessor, StubType
1011

1112

@@ -113,7 +114,10 @@ def members(self):
113114
114115
This property is read-only.
115116
"""
116-
from ansys.edb.core.inner import factory
117-
118-
objs = self.__stub.GetMembers(self.msg).items
119-
return [factory.create_conn_obj(co) for co in objs]
117+
return query_lyt_object_collection(
118+
self,
119+
LayoutObjType.INVALID_LAYOUT_OBJ,
120+
self.__stub.GetMembers,
121+
self.__stub.StreamMembers,
122+
False,
123+
)

src/ansys/edb/core/hierarchy/spice_model.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""SPICE Model."""
22
from ansys.edb.core.hierarchy.model import Model
3-
from ansys.edb.core.inner import messages
3+
from ansys.edb.core.inner import messages, parser
44
from ansys.edb.core.session import SpiceModelServiceStub, StubAccessor, StubType
55

66

@@ -78,3 +78,10 @@ def remove_terminal(self, terminal):
7878
Terminal name.
7979
"""
8080
self.__stub.RemoveTerminalPinPair(messages.string_property_message(self, terminal))
81+
82+
@property
83+
@parser.to_string_dict
84+
def terminal_pin_pairs(self):
85+
""":obj:`dict` of {:obj:`str` : :obj:`str`}: A dictionary showing the mapping of terminals in the layout to \
86+
pins in the spice model by name."""
87+
return self.__stub.GetTerminalPinPairs(self.msg)

src/ansys/edb/core/inner/conn_obj.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from ansys.edb.core.edb_defs import LayoutObjType
55
from ansys.edb.core.inner import layout_obj, messages
6+
from ansys.edb.core.inner.factory import create_lyt_obj
67
from ansys.edb.core.layout import mcad_model as mm
78
from ansys.edb.core.session import ConnectableServiceStub, StubAccessor, StubType
89

@@ -48,6 +49,15 @@ def get_client_prim_type_from_class():
4849
return client_obj
4950
return cls(None)
5051

52+
def cast(self):
53+
"""Cast the ConnObj object to the correct concrete type.
54+
55+
Returns
56+
-------
57+
.ConnObj
58+
"""
59+
return create_lyt_obj(self.msg, self.obj_type)
60+
5161
@property
5262
def obj_type(self):
5363
""":class:`LayoutObjType <ansys.edb.core.edb_defs.LayoutObjType>`: Layout object type.

0 commit comments

Comments
 (0)