pyedb 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pyedb might be problematic. Click here for more details.
- pyedb/__init__.py +17 -0
- pyedb/dotnet/__init__.py +0 -0
- pyedb/dotnet/application/Variables.py +2261 -0
- pyedb/dotnet/application/__init__.py +0 -0
- pyedb/dotnet/clr_module.py +103 -0
- pyedb/dotnet/edb.py +4237 -0
- pyedb/dotnet/edb_core/__init__.py +1 -0
- pyedb/dotnet/edb_core/cell/__init__.py +0 -0
- pyedb/dotnet/edb_core/cell/hierarchy/__init__.py +0 -0
- pyedb/dotnet/edb_core/cell/hierarchy/model.py +66 -0
- pyedb/dotnet/edb_core/components.py +2669 -0
- pyedb/dotnet/edb_core/configuration.py +423 -0
- pyedb/dotnet/edb_core/definition/__init__.py +0 -0
- pyedb/dotnet/edb_core/definition/component_def.py +166 -0
- pyedb/dotnet/edb_core/definition/component_model.py +30 -0
- pyedb/dotnet/edb_core/definition/definition_obj.py +18 -0
- pyedb/dotnet/edb_core/definition/definitions.py +12 -0
- pyedb/dotnet/edb_core/dotnet/__init__.py +0 -0
- pyedb/dotnet/edb_core/dotnet/database.py +1218 -0
- pyedb/dotnet/edb_core/dotnet/layout.py +238 -0
- pyedb/dotnet/edb_core/dotnet/primitive.py +1517 -0
- pyedb/dotnet/edb_core/edb_data/__init__.py +0 -0
- pyedb/dotnet/edb_core/edb_data/components_data.py +938 -0
- pyedb/dotnet/edb_core/edb_data/connectable.py +113 -0
- pyedb/dotnet/edb_core/edb_data/control_file.py +1268 -0
- pyedb/dotnet/edb_core/edb_data/design_options.py +35 -0
- pyedb/dotnet/edb_core/edb_data/edbvalue.py +45 -0
- pyedb/dotnet/edb_core/edb_data/hfss_extent_info.py +330 -0
- pyedb/dotnet/edb_core/edb_data/hfss_simulation_setup_data.py +1607 -0
- pyedb/dotnet/edb_core/edb_data/layer_data.py +576 -0
- pyedb/dotnet/edb_core/edb_data/nets_data.py +281 -0
- pyedb/dotnet/edb_core/edb_data/obj_base.py +19 -0
- pyedb/dotnet/edb_core/edb_data/padstacks_data.py +2080 -0
- pyedb/dotnet/edb_core/edb_data/ports.py +287 -0
- pyedb/dotnet/edb_core/edb_data/primitives_data.py +1397 -0
- pyedb/dotnet/edb_core/edb_data/simulation_configuration.py +2914 -0
- pyedb/dotnet/edb_core/edb_data/simulation_setup.py +716 -0
- pyedb/dotnet/edb_core/edb_data/siwave_simulation_setup_data.py +1205 -0
- pyedb/dotnet/edb_core/edb_data/sources.py +514 -0
- pyedb/dotnet/edb_core/edb_data/terminals.py +632 -0
- pyedb/dotnet/edb_core/edb_data/utilities.py +148 -0
- pyedb/dotnet/edb_core/edb_data/variables.py +91 -0
- pyedb/dotnet/edb_core/general.py +181 -0
- pyedb/dotnet/edb_core/hfss.py +1646 -0
- pyedb/dotnet/edb_core/layout.py +1244 -0
- pyedb/dotnet/edb_core/layout_validation.py +272 -0
- pyedb/dotnet/edb_core/materials.py +939 -0
- pyedb/dotnet/edb_core/net_class.py +335 -0
- pyedb/dotnet/edb_core/nets.py +1215 -0
- pyedb/dotnet/edb_core/padstack.py +1389 -0
- pyedb/dotnet/edb_core/siwave.py +1427 -0
- pyedb/dotnet/edb_core/stackup.py +2703 -0
- pyedb/edb_logger.py +396 -0
- pyedb/generic/__init__.py +0 -0
- pyedb/generic/constants.py +1063 -0
- pyedb/generic/data_handlers.py +320 -0
- pyedb/generic/design_types.py +104 -0
- pyedb/generic/filesystem.py +150 -0
- pyedb/generic/general_methods.py +1535 -0
- pyedb/generic/plot.py +1840 -0
- pyedb/generic/process.py +285 -0
- pyedb/generic/settings.py +224 -0
- pyedb/ipc2581/__init__.py +0 -0
- pyedb/ipc2581/bom/__init__.py +0 -0
- pyedb/ipc2581/bom/bom.py +21 -0
- pyedb/ipc2581/bom/bom_item.py +32 -0
- pyedb/ipc2581/bom/characteristics.py +37 -0
- pyedb/ipc2581/bom/refdes.py +16 -0
- pyedb/ipc2581/content/__init__.py +0 -0
- pyedb/ipc2581/content/color.py +38 -0
- pyedb/ipc2581/content/content.py +55 -0
- pyedb/ipc2581/content/dictionary_color.py +29 -0
- pyedb/ipc2581/content/dictionary_fill.py +28 -0
- pyedb/ipc2581/content/dictionary_line.py +30 -0
- pyedb/ipc2581/content/entry_color.py +13 -0
- pyedb/ipc2581/content/entry_line.py +14 -0
- pyedb/ipc2581/content/fill.py +15 -0
- pyedb/ipc2581/content/layer_ref.py +10 -0
- pyedb/ipc2581/content/standard_geometries_dictionary.py +72 -0
- pyedb/ipc2581/ecad/__init__.py +0 -0
- pyedb/ipc2581/ecad/cad_data/__init__.py +0 -0
- pyedb/ipc2581/ecad/cad_data/assembly_drawing.py +26 -0
- pyedb/ipc2581/ecad/cad_data/cad_data.py +37 -0
- pyedb/ipc2581/ecad/cad_data/component.py +41 -0
- pyedb/ipc2581/ecad/cad_data/drill.py +30 -0
- pyedb/ipc2581/ecad/cad_data/feature.py +54 -0
- pyedb/ipc2581/ecad/cad_data/layer.py +41 -0
- pyedb/ipc2581/ecad/cad_data/layer_feature.py +151 -0
- pyedb/ipc2581/ecad/cad_data/logical_net.py +32 -0
- pyedb/ipc2581/ecad/cad_data/outline.py +25 -0
- pyedb/ipc2581/ecad/cad_data/package.py +104 -0
- pyedb/ipc2581/ecad/cad_data/padstack_def.py +38 -0
- pyedb/ipc2581/ecad/cad_data/padstack_hole_def.py +24 -0
- pyedb/ipc2581/ecad/cad_data/padstack_instance.py +62 -0
- pyedb/ipc2581/ecad/cad_data/padstack_pad_def.py +26 -0
- pyedb/ipc2581/ecad/cad_data/path.py +89 -0
- pyedb/ipc2581/ecad/cad_data/phy_net.py +80 -0
- pyedb/ipc2581/ecad/cad_data/pin.py +31 -0
- pyedb/ipc2581/ecad/cad_data/polygon.py +169 -0
- pyedb/ipc2581/ecad/cad_data/profile.py +40 -0
- pyedb/ipc2581/ecad/cad_data/stackup.py +31 -0
- pyedb/ipc2581/ecad/cad_data/stackup_group.py +42 -0
- pyedb/ipc2581/ecad/cad_data/stackup_layer.py +21 -0
- pyedb/ipc2581/ecad/cad_data/step.py +275 -0
- pyedb/ipc2581/ecad/cad_header.py +33 -0
- pyedb/ipc2581/ecad/ecad.py +19 -0
- pyedb/ipc2581/ecad/spec.py +46 -0
- pyedb/ipc2581/history_record.py +37 -0
- pyedb/ipc2581/ipc2581.py +387 -0
- pyedb/ipc2581/logistic_header.py +25 -0
- pyedb/misc/__init__.py +0 -0
- pyedb/misc/aedtlib_personalib_install.py +14 -0
- pyedb/misc/downloads.py +322 -0
- pyedb/misc/misc.py +67 -0
- pyedb/misc/pyedb.runtimeconfig.json +13 -0
- pyedb/misc/siw_feature_config/__init__.py +0 -0
- pyedb/misc/siw_feature_config/emc/__init__.py +0 -0
- pyedb/misc/siw_feature_config/emc/component_tags.py +46 -0
- pyedb/misc/siw_feature_config/emc/net_tags.py +37 -0
- pyedb/misc/siw_feature_config/emc/tag_library.py +62 -0
- pyedb/misc/siw_feature_config/emc/xml_generic.py +78 -0
- pyedb/misc/siw_feature_config/emc_rule_checker_settings.py +179 -0
- pyedb/misc/utilities.py +27 -0
- pyedb/modeler/geometry_operators.py +2082 -0
- pyedb-0.2.0.dist-info/LICENSE +21 -0
- pyedb-0.2.0.dist-info/METADATA +208 -0
- pyedb-0.2.0.dist-info/RECORD +128 -0
- pyedb-0.2.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,1218 @@
|
|
|
1
|
+
"""Database."""
|
|
2
|
+
import os
|
|
3
|
+
import re
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
from pyedb import __version__
|
|
7
|
+
from pyedb.dotnet.edb_core.general import convert_py_list_to_net_list
|
|
8
|
+
from pyedb.edb_logger import pyedb_logger
|
|
9
|
+
from pyedb.generic.general_methods import (
|
|
10
|
+
env_path,
|
|
11
|
+
env_path_student,
|
|
12
|
+
env_value,
|
|
13
|
+
is_ironpython,
|
|
14
|
+
is_linux,
|
|
15
|
+
settings,
|
|
16
|
+
)
|
|
17
|
+
from pyedb.misc.misc import list_installed_ansysem
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class HierarchyDotNet:
|
|
21
|
+
"""Hierarchy."""
|
|
22
|
+
|
|
23
|
+
def __getattr__(self, key):
|
|
24
|
+
try:
|
|
25
|
+
return super().__getattribute__(key)
|
|
26
|
+
except AttributeError:
|
|
27
|
+
try:
|
|
28
|
+
return getattr(self._hierarchy, key)
|
|
29
|
+
except AttributeError:
|
|
30
|
+
raise AttributeError("Attribute not present")
|
|
31
|
+
|
|
32
|
+
def __init__(self, app):
|
|
33
|
+
self._app = app
|
|
34
|
+
self.edb_api = self._app._edb
|
|
35
|
+
self._hierarchy = self.edb_api.Cell.Hierarchy
|
|
36
|
+
|
|
37
|
+
@property
|
|
38
|
+
def api_class(self): # pragma: no cover
|
|
39
|
+
"""Return Ansys.Ansoft.Edb class object."""
|
|
40
|
+
return self._hierarchy
|
|
41
|
+
|
|
42
|
+
@property
|
|
43
|
+
def component(self):
|
|
44
|
+
"""Edb Dotnet Api Database `Edb.Cell.Hierarchy.Component`."""
|
|
45
|
+
return self._hierarchy.Component
|
|
46
|
+
|
|
47
|
+
@property
|
|
48
|
+
def cell_instance(self):
|
|
49
|
+
"""Edb Dotnet Api Database `Edb.Cell.Hierarchy.CellInstance`."""
|
|
50
|
+
return self._hierarchy.CellInstance
|
|
51
|
+
|
|
52
|
+
@property
|
|
53
|
+
def pin_group(self):
|
|
54
|
+
"""Edb Dotnet Api Database `Edb.Cell.Hierarchy.PinGroup`."""
|
|
55
|
+
return self._hierarchy.PinGroup
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class PolygonDataDotNet: # pragma: no cover
|
|
59
|
+
"""Polygon Data."""
|
|
60
|
+
|
|
61
|
+
def __getattr__(self, key): # pragma: no cover
|
|
62
|
+
try:
|
|
63
|
+
return super().__getattribute__(key)
|
|
64
|
+
except AttributeError:
|
|
65
|
+
try:
|
|
66
|
+
return getattr(self.dotnetobj, key)
|
|
67
|
+
except AttributeError:
|
|
68
|
+
raise AttributeError("Attribute not present")
|
|
69
|
+
|
|
70
|
+
def __init__(self, pedb, api_object=None):
|
|
71
|
+
self._pedb = pedb
|
|
72
|
+
self.dotnetobj = pedb.edb_api.geometry.api_class.PolygonData
|
|
73
|
+
self.edb_api = api_object
|
|
74
|
+
|
|
75
|
+
@property
|
|
76
|
+
def api_class(self): # pragma: no cover
|
|
77
|
+
""":class:`Ansys.Ansoft.Edb` class object."""
|
|
78
|
+
return self.dotnetobj
|
|
79
|
+
|
|
80
|
+
@property
|
|
81
|
+
def arcs(self): # pragma: no cover
|
|
82
|
+
"""List of Edb.Geometry.ArcData."""
|
|
83
|
+
return list(self.edb_api.GetArcData())
|
|
84
|
+
|
|
85
|
+
def get_points(self):
|
|
86
|
+
"""Get all points in polygon.
|
|
87
|
+
|
|
88
|
+
Returns
|
|
89
|
+
-------
|
|
90
|
+
list[list[edb_value]]
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
return [[self._pedb.edb_value(i.X), self._pedb.edb_value(i.Y)] for i in list(self.edb_api.Points)]
|
|
94
|
+
|
|
95
|
+
def add_point(self, x, y, incremental=False):
|
|
96
|
+
"""Add a point at the end of the point list of the polygon.
|
|
97
|
+
|
|
98
|
+
Parameters
|
|
99
|
+
----------
|
|
100
|
+
x: str, int, float
|
|
101
|
+
X coordinate.
|
|
102
|
+
y: str, in, float
|
|
103
|
+
Y coordinate.
|
|
104
|
+
incremental: bool
|
|
105
|
+
Whether to add the point incrementally. The default value is ``False``. When
|
|
106
|
+
``True``, the coordinates of the added point are incremental to the last point.
|
|
107
|
+
|
|
108
|
+
Returns
|
|
109
|
+
-------
|
|
110
|
+
bool
|
|
111
|
+
``True`` when successful, ``False`` when failed.
|
|
112
|
+
"""
|
|
113
|
+
if incremental:
|
|
114
|
+
x = self._pedb.edb_value(x)
|
|
115
|
+
y = self._pedb.edb_value(y)
|
|
116
|
+
last_point = self.get_points()[-1]
|
|
117
|
+
x = "({})+({})".format(x, last_point[0].ToString())
|
|
118
|
+
y = "({})+({})".format(y, last_point[1].ToString())
|
|
119
|
+
return self.edb_api.AddPoint(GeometryDotNet(self._pedb).point_data(x, y))
|
|
120
|
+
|
|
121
|
+
def get_bbox_of_boxes(self, points):
|
|
122
|
+
"""Get the EDB .NET API ``Edb.Geometry.GetBBoxOfBoxes`` database.
|
|
123
|
+
|
|
124
|
+
Parameters
|
|
125
|
+
----------
|
|
126
|
+
points : list or `Edb.Geometry.PointData`
|
|
127
|
+
"""
|
|
128
|
+
if isinstance(points, list):
|
|
129
|
+
points = convert_py_list_to_net_list(points)
|
|
130
|
+
return self.dotnetobj.GetBBoxOfBoxes(points)
|
|
131
|
+
|
|
132
|
+
def get_bbox_of_polygons(self, polygons):
|
|
133
|
+
"""Edb Dotnet Api Database `Edb.Geometry.GetBBoxOfPolygons`.
|
|
134
|
+
|
|
135
|
+
Parameters
|
|
136
|
+
----------
|
|
137
|
+
polygons : list or `Edb.Geometry.PolygonData`"""
|
|
138
|
+
if isinstance(polygons, list):
|
|
139
|
+
polygons = convert_py_list_to_net_list(polygons)
|
|
140
|
+
return self.dotnetobj.GetBBoxOfPolygons(polygons)
|
|
141
|
+
|
|
142
|
+
def create_from_bbox(self, points):
|
|
143
|
+
"""Edb Dotnet Api Database `Edb.Geometry.CreateFromBBox`.
|
|
144
|
+
|
|
145
|
+
Parameters
|
|
146
|
+
----------
|
|
147
|
+
points : list or `Edb.Geometry.PointData`
|
|
148
|
+
"""
|
|
149
|
+
from pyedb.dotnet.clr_module import Tuple
|
|
150
|
+
|
|
151
|
+
if isinstance(points, (tuple, list)):
|
|
152
|
+
points = Tuple[self._pedb.edb_api.Geometry.PointData, self._pedb.edb_api.Geometry.PointData](
|
|
153
|
+
points[0], points[1]
|
|
154
|
+
)
|
|
155
|
+
return self.dotnetobj.CreateFromBBox(points)
|
|
156
|
+
|
|
157
|
+
def create_from_arcs(self, arcs, flag):
|
|
158
|
+
"""Edb Dotnet Api Database `Edb.Geometry.CreateFromArcs`.
|
|
159
|
+
|
|
160
|
+
Parameters
|
|
161
|
+
----------
|
|
162
|
+
arcs : list or `Edb.Geometry.ArcData`
|
|
163
|
+
List of ArcData.
|
|
164
|
+
flag : bool
|
|
165
|
+
"""
|
|
166
|
+
if isinstance(arcs, list):
|
|
167
|
+
arcs = convert_py_list_to_net_list(arcs)
|
|
168
|
+
return self.dotnetobj.CreateFromArcs(arcs, flag)
|
|
169
|
+
|
|
170
|
+
def unite(self, pdata):
|
|
171
|
+
"""Edb Dotnet Api Database `Edb.Geometry.Unite`.
|
|
172
|
+
|
|
173
|
+
Parameters
|
|
174
|
+
----------
|
|
175
|
+
pdata : list or `Edb.Geometry.PolygonData`
|
|
176
|
+
Polygons to unite.
|
|
177
|
+
|
|
178
|
+
"""
|
|
179
|
+
if isinstance(pdata, list):
|
|
180
|
+
pdata = convert_py_list_to_net_list(pdata)
|
|
181
|
+
return list(self.dotnetobj.Unite(pdata))
|
|
182
|
+
|
|
183
|
+
def get_convex_hull_of_polygons(self, pdata):
|
|
184
|
+
"""Edb Dotnet Api Database `Edb.Geometry.GetConvexHullOfPolygons`.
|
|
185
|
+
|
|
186
|
+
Parameters
|
|
187
|
+
----------
|
|
188
|
+
pdata : list or List of `Edb.Geometry.PolygonData`
|
|
189
|
+
Polygons to unite in a Convex Hull.
|
|
190
|
+
"""
|
|
191
|
+
if isinstance(pdata, list):
|
|
192
|
+
pdata = convert_py_list_to_net_list(pdata)
|
|
193
|
+
return self.dotnetobj.GetConvexHullOfPolygons(pdata)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
class NetDotNet:
|
|
197
|
+
"""Net Objects."""
|
|
198
|
+
|
|
199
|
+
def __getattr__(self, key):
|
|
200
|
+
try:
|
|
201
|
+
return super().__getattribute__(key)
|
|
202
|
+
except AttributeError:
|
|
203
|
+
if self.net_obj and key in dir(self.net_obj):
|
|
204
|
+
obj = self.net_obj
|
|
205
|
+
else:
|
|
206
|
+
obj = self.net
|
|
207
|
+
try:
|
|
208
|
+
return getattr(obj, key)
|
|
209
|
+
except AttributeError:
|
|
210
|
+
raise AttributeError("Attribute not present")
|
|
211
|
+
|
|
212
|
+
def __init__(self, app, net_obj=None):
|
|
213
|
+
self.net = app._edb.Cell.Net
|
|
214
|
+
|
|
215
|
+
self.edb_api = app._edb
|
|
216
|
+
self._app = app
|
|
217
|
+
self.net_obj = net_obj
|
|
218
|
+
|
|
219
|
+
@property
|
|
220
|
+
def api_class(self): # pragma: no cover
|
|
221
|
+
"""Return Ansys.Ansoft.Edb class object."""
|
|
222
|
+
return self.net
|
|
223
|
+
|
|
224
|
+
@property
|
|
225
|
+
def api_object(self):
|
|
226
|
+
"""Return Ansys.Ansoft.Edb object."""
|
|
227
|
+
return self.net_obj
|
|
228
|
+
|
|
229
|
+
def find_by_name(self, layout, net): # pragma: no cover
|
|
230
|
+
"""Edb Dotnet Api Database `Edb.Net.FindByName`."""
|
|
231
|
+
return NetDotNet(self._app, self.net.FindByName(layout, net))
|
|
232
|
+
|
|
233
|
+
def create(self, layout, name):
|
|
234
|
+
"""Edb Dotnet Api Database `Edb.Net.Create`."""
|
|
235
|
+
|
|
236
|
+
return NetDotNet(self._app, self.net.Create(layout, name))
|
|
237
|
+
|
|
238
|
+
def delete(self):
|
|
239
|
+
"""Edb Dotnet Api Database `Edb.Net.Delete`."""
|
|
240
|
+
if self.net_obj:
|
|
241
|
+
self.net_obj.Delete()
|
|
242
|
+
self.net_obj = None
|
|
243
|
+
|
|
244
|
+
@property
|
|
245
|
+
def name(self):
|
|
246
|
+
"""Edb Dotnet Api Database `net.name` and `Net.SetName()`."""
|
|
247
|
+
if self.net_obj:
|
|
248
|
+
return self.net_obj.GetName()
|
|
249
|
+
|
|
250
|
+
@name.setter
|
|
251
|
+
def name(self, value):
|
|
252
|
+
if self.net_obj:
|
|
253
|
+
self.net_obj.SetName(value)
|
|
254
|
+
|
|
255
|
+
@property
|
|
256
|
+
def is_null(self):
|
|
257
|
+
"""Edb Dotnet Api Database `Net.IsNull()`."""
|
|
258
|
+
if self.net_obj:
|
|
259
|
+
return self.net_obj.IsNull()
|
|
260
|
+
|
|
261
|
+
@property
|
|
262
|
+
def is_power_ground(self):
|
|
263
|
+
"""Edb Dotnet Api Database `Net.IsPowerGround()` and `Net.SetIsPowerGround()`."""
|
|
264
|
+
if self.net_obj:
|
|
265
|
+
return self.net_obj.IsPowerGround()
|
|
266
|
+
|
|
267
|
+
@property
|
|
268
|
+
def _api_get_extended_net(self):
|
|
269
|
+
"""Extended net this net belongs to if it belongs to an extended net.
|
|
270
|
+
If it does not belong to an extendednet, a null extended net is returned.
|
|
271
|
+
"""
|
|
272
|
+
return self.net_obj.GetExtendedNet()
|
|
273
|
+
|
|
274
|
+
@is_power_ground.setter
|
|
275
|
+
def is_power_ground(self, value):
|
|
276
|
+
if self.net_obj:
|
|
277
|
+
self.net_obj.SetIsPowerGround(value)
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
class NetClassDotNet:
|
|
281
|
+
"""Net Class."""
|
|
282
|
+
|
|
283
|
+
def __init__(self, app, api_object=None):
|
|
284
|
+
self.cell_net_class = app._edb.Cell.NetClass
|
|
285
|
+
self.api_object = api_object
|
|
286
|
+
self.edb_api = app._edb
|
|
287
|
+
self._app = app
|
|
288
|
+
|
|
289
|
+
@property
|
|
290
|
+
def api_nets(self):
|
|
291
|
+
"""Return Edb Nets object dictionary."""
|
|
292
|
+
return {i.GetName(): i for i in list(self.api_object.Nets)}
|
|
293
|
+
|
|
294
|
+
def api_create(self, name):
|
|
295
|
+
"""Edb Dotnet Api Database `Edb.NetClass.Create`."""
|
|
296
|
+
return NetClassDotNet(self._app, self.cell_net_class.Create(self._app.active_layout, name))
|
|
297
|
+
|
|
298
|
+
@property
|
|
299
|
+
def name(self):
|
|
300
|
+
"""Edb Dotnet Api Database `NetClass.name` and `NetClass.SetName()`."""
|
|
301
|
+
if self.api_object:
|
|
302
|
+
return self.api_object.GetName()
|
|
303
|
+
|
|
304
|
+
@name.setter
|
|
305
|
+
def name(self, value):
|
|
306
|
+
if self.api_object:
|
|
307
|
+
self.api_object.SetName(value)
|
|
308
|
+
|
|
309
|
+
def add_net(self, name):
|
|
310
|
+
"""Add a new net.
|
|
311
|
+
|
|
312
|
+
Parameters
|
|
313
|
+
----------
|
|
314
|
+
name : str
|
|
315
|
+
The name of the net to be added.
|
|
316
|
+
|
|
317
|
+
Returns
|
|
318
|
+
-------
|
|
319
|
+
object
|
|
320
|
+
"""
|
|
321
|
+
if self.api_object:
|
|
322
|
+
edb_api_net = self.edb_api.Cell.Net.FindByName(self._app.active_layout, name)
|
|
323
|
+
return self.api_object.AddNet(edb_api_net)
|
|
324
|
+
|
|
325
|
+
def delete(self): # pragma: no cover
|
|
326
|
+
"""Edb Dotnet Api Database `Delete`."""
|
|
327
|
+
|
|
328
|
+
if self.api_object:
|
|
329
|
+
self.api_object.Delete()
|
|
330
|
+
self.api_object = None
|
|
331
|
+
return not self.api_object
|
|
332
|
+
|
|
333
|
+
@property
|
|
334
|
+
def is_null(self):
|
|
335
|
+
"""Edb Dotnet Api Database `NetClass.IsNull()`."""
|
|
336
|
+
if self.api_object:
|
|
337
|
+
return self.api_object.IsNull()
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
class ExtendedNetDotNet(NetClassDotNet):
|
|
341
|
+
"""Extended net class."""
|
|
342
|
+
|
|
343
|
+
def __init__(self, app, api_object=None):
|
|
344
|
+
super().__init__(app, api_object)
|
|
345
|
+
self.cell_extended_net = app._edb.Cell.ExtendedNet
|
|
346
|
+
|
|
347
|
+
@property
|
|
348
|
+
def api_class(self): # pragma: no cover
|
|
349
|
+
"""Return Ansys.Ansoft.Edb class object."""
|
|
350
|
+
return self.cell_extended_net
|
|
351
|
+
|
|
352
|
+
def find_by_name(self, layout, net): # pragma: no cover
|
|
353
|
+
"""Edb Dotnet Api Database `Edb.ExtendedNet.FindByName`."""
|
|
354
|
+
return ExtendedNetDotNet(self._app, self.cell_extended_net.FindByName(layout, net))
|
|
355
|
+
|
|
356
|
+
def api_create(self, name):
|
|
357
|
+
"""Edb Dotnet Api Database `Edb.ExtendedNet.Create`."""
|
|
358
|
+
return ExtendedNetDotNet(self._app, self.cell_extended_net.Create(self._app.active_layout, name))
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
class DifferentialPairDotNet(NetClassDotNet):
|
|
362
|
+
"""Differential Pairs."""
|
|
363
|
+
|
|
364
|
+
def __init__(self, app, api_object=None):
|
|
365
|
+
super().__init__(app, api_object)
|
|
366
|
+
self.cell_diff_pair = app._edb.Cell.DifferentialPair
|
|
367
|
+
|
|
368
|
+
@property
|
|
369
|
+
def api_class(self): # pragma: no cover
|
|
370
|
+
"""Return Ansys.Ansoft.Edb class object."""
|
|
371
|
+
return self.cell_diff_pair
|
|
372
|
+
|
|
373
|
+
def find_by_name(self, layout, net): # pragma: no cover
|
|
374
|
+
"""Edb Dotnet Api Database `Edb.DifferentialPair.FindByName`."""
|
|
375
|
+
return DifferentialPairDotNet(self._app, self.cell_diff_pair.FindByName(layout, net))
|
|
376
|
+
|
|
377
|
+
def api_create(self, name):
|
|
378
|
+
"""Edb Dotnet Api Database `Edb.DifferentialPair.Create`."""
|
|
379
|
+
return DifferentialPairDotNet(self._app, self.cell_diff_pair.Create(self._app.active_layout, name))
|
|
380
|
+
|
|
381
|
+
def _api_set_differential_pair(self, net_name_p, net_name_n):
|
|
382
|
+
edb_api_net_p = self.edb_api.Cell.Net.FindByName(self._app.active_layout, net_name_p)
|
|
383
|
+
edb_api_net_n = self.edb_api.Cell.Net.FindByName(self._app.active_layout, net_name_n)
|
|
384
|
+
self.api_object.SetDifferentialPair(edb_api_net_p, edb_api_net_n)
|
|
385
|
+
|
|
386
|
+
@property
|
|
387
|
+
def api_positive_net(self):
|
|
388
|
+
"""Edb Api Positive net object."""
|
|
389
|
+
if self.api_object:
|
|
390
|
+
return self.api_object.GetPositiveNet()
|
|
391
|
+
|
|
392
|
+
@property
|
|
393
|
+
def api_negative_net(self):
|
|
394
|
+
"""Edb Api Negative net object."""
|
|
395
|
+
if self.api_object:
|
|
396
|
+
return self.api_object.GetNegativeNet()
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
class CellClassDotNet:
|
|
400
|
+
"""Cell Class."""
|
|
401
|
+
|
|
402
|
+
def __getattr__(self, key):
|
|
403
|
+
try:
|
|
404
|
+
return super().__getattribute__(key)
|
|
405
|
+
except AttributeError:
|
|
406
|
+
try:
|
|
407
|
+
return getattr(self._cell, key)
|
|
408
|
+
except AttributeError:
|
|
409
|
+
if self._active_cell and key in dir(self._active_cell):
|
|
410
|
+
try:
|
|
411
|
+
return getattr(self._active_cell, key)
|
|
412
|
+
except AttributeError: # pragma: no cover
|
|
413
|
+
raise AttributeError("Attribute not present")
|
|
414
|
+
else:
|
|
415
|
+
raise AttributeError("Attribute not present")
|
|
416
|
+
|
|
417
|
+
def __init__(self, app, active_cell=None):
|
|
418
|
+
self._app = app
|
|
419
|
+
self.edb_api = app._edb
|
|
420
|
+
self._cell = self.edb_api.Cell
|
|
421
|
+
self._active_cell = active_cell
|
|
422
|
+
|
|
423
|
+
@property
|
|
424
|
+
def api_class(self):
|
|
425
|
+
"""Return Ansys.Ansoft.Edb class object."""
|
|
426
|
+
return self._cell
|
|
427
|
+
|
|
428
|
+
@property
|
|
429
|
+
def api_object(self):
|
|
430
|
+
"""Return Ansys.Ansoft.Edb object."""
|
|
431
|
+
return self._active_cell
|
|
432
|
+
|
|
433
|
+
def create(self, db, cell_type, cell_name):
|
|
434
|
+
return CellClassDotNet(self._app, self.cell.Create(db, cell_type, cell_name))
|
|
435
|
+
|
|
436
|
+
@property
|
|
437
|
+
def terminal(self):
|
|
438
|
+
"""Edb Dotnet Api Database `Edb.Cell.Terminal`."""
|
|
439
|
+
return self._cell.Terminal
|
|
440
|
+
|
|
441
|
+
@property
|
|
442
|
+
def hierarchy(self):
|
|
443
|
+
"""Edb Dotnet Api Database `Edb.Cell.Hierarchy`.
|
|
444
|
+
|
|
445
|
+
Returns
|
|
446
|
+
-------
|
|
447
|
+
:class:`dotnet.edb_core.dotnet.HierarchyDotNet`
|
|
448
|
+
"""
|
|
449
|
+
return HierarchyDotNet(self._app)
|
|
450
|
+
|
|
451
|
+
@property
|
|
452
|
+
def cell(self):
|
|
453
|
+
"""Edb Dotnet Api Database `Edb.Cell`."""
|
|
454
|
+
return self._cell.Cell
|
|
455
|
+
|
|
456
|
+
@property
|
|
457
|
+
def net(self):
|
|
458
|
+
"""Edb Dotnet Api Cell.Layer."""
|
|
459
|
+
return NetDotNet(self._app)
|
|
460
|
+
|
|
461
|
+
@property
|
|
462
|
+
def layer_type(self):
|
|
463
|
+
"""Edb Dotnet Api Cell.LayerType."""
|
|
464
|
+
return self._cell.LayerType
|
|
465
|
+
|
|
466
|
+
@property
|
|
467
|
+
def layer_type_set(self):
|
|
468
|
+
"""Edb Dotnet Api Cell.LayerTypeSet."""
|
|
469
|
+
return self._cell.LayerTypeSet
|
|
470
|
+
|
|
471
|
+
@property
|
|
472
|
+
def layer(self):
|
|
473
|
+
"""Edb Dotnet Api Cell.Layer."""
|
|
474
|
+
return self._cell.Layer
|
|
475
|
+
|
|
476
|
+
@property
|
|
477
|
+
def layout_object_type(self):
|
|
478
|
+
"""Edb Dotnet Api LayoutObjType."""
|
|
479
|
+
return self._cell.LayoutObjType
|
|
480
|
+
|
|
481
|
+
@property
|
|
482
|
+
def primitive(self):
|
|
483
|
+
"""Edb Dotnet Api Database `Edb.Cell.Primitive`."""
|
|
484
|
+
from pyedb.dotnet.edb_core.dotnet.primitive import PrimitiveDotNet
|
|
485
|
+
|
|
486
|
+
return PrimitiveDotNet(self._app)
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
class UtilityDotNet:
|
|
490
|
+
"""Utility Edb class."""
|
|
491
|
+
|
|
492
|
+
def __getattr__(self, key):
|
|
493
|
+
try:
|
|
494
|
+
return super().__getattribute__(key)
|
|
495
|
+
except AttributeError:
|
|
496
|
+
try:
|
|
497
|
+
return getattr(self.utility, key)
|
|
498
|
+
except AttributeError:
|
|
499
|
+
raise AttributeError("Attribute not present")
|
|
500
|
+
|
|
501
|
+
def __init__(self, app):
|
|
502
|
+
self._app = app
|
|
503
|
+
self.utility = app._edb.Utility
|
|
504
|
+
self.edb_api = app._edb
|
|
505
|
+
self.active_db = app._db
|
|
506
|
+
self.active_cell = app._active_cell
|
|
507
|
+
|
|
508
|
+
@property
|
|
509
|
+
def api_class(self):
|
|
510
|
+
"""Return Ansys.Ansoft.Edb class object."""
|
|
511
|
+
return self.utility
|
|
512
|
+
|
|
513
|
+
def value(self, value, var_server=None):
|
|
514
|
+
"""Edb Dotnet Api Utility.Value."""
|
|
515
|
+
if isinstance(value, self.utility.Value):
|
|
516
|
+
return value
|
|
517
|
+
if var_server:
|
|
518
|
+
return self.utility.Value(value, var_server)
|
|
519
|
+
if isinstance(value, (int, float)):
|
|
520
|
+
return self.utility.Value(value)
|
|
521
|
+
m1 = re.findall(r"(?<=[/+-/*//^/(/[])([a-z_A-Z/$]\w*)", str(value).replace(" ", ""))
|
|
522
|
+
m2 = re.findall(r"^([a-z_A-Z/$]\w*)", str(value).replace(" ", ""))
|
|
523
|
+
val_decomposed = list(set(m1).union(m2))
|
|
524
|
+
if not val_decomposed:
|
|
525
|
+
return self.utility.Value(value)
|
|
526
|
+
var_server_db = self.active_db.GetVariableServer()
|
|
527
|
+
var_names = var_server_db.GetAllVariableNames()
|
|
528
|
+
var_server_cell = self.active_cell.GetVariableServer()
|
|
529
|
+
var_names_cell = var_server_cell.GetAllVariableNames()
|
|
530
|
+
if set(val_decomposed).intersection(var_names_cell):
|
|
531
|
+
return self.utility.Value(value, var_server_cell)
|
|
532
|
+
if set(val_decomposed).intersection(var_names):
|
|
533
|
+
return self.utility.Value(value, var_server_db)
|
|
534
|
+
return self.utility.Value(value)
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
class GeometryDotNet:
|
|
538
|
+
"""Geometry Edb Class."""
|
|
539
|
+
|
|
540
|
+
def __getattr__(self, key):
|
|
541
|
+
try:
|
|
542
|
+
return super().__getattribute__(key)
|
|
543
|
+
except AttributeError:
|
|
544
|
+
try:
|
|
545
|
+
return getattr(self.geometry, key)
|
|
546
|
+
except AttributeError: # pragma: no cover
|
|
547
|
+
raise AttributeError("Attribute {} not present".format(key))
|
|
548
|
+
|
|
549
|
+
def __init__(self, app):
|
|
550
|
+
self._app = app
|
|
551
|
+
self.geometry = self._app._edb.Geometry
|
|
552
|
+
self.edb_api = self._app._edb
|
|
553
|
+
|
|
554
|
+
@property
|
|
555
|
+
def api_class(self):
|
|
556
|
+
"""Return Ansys.Ansoft.Edb class object."""
|
|
557
|
+
return self.geometry
|
|
558
|
+
|
|
559
|
+
@property
|
|
560
|
+
def utility(self):
|
|
561
|
+
return UtilityDotNet(self._app)
|
|
562
|
+
|
|
563
|
+
def point_data(self, p1, p2):
|
|
564
|
+
"""Edb Dotnet Api Point."""
|
|
565
|
+
if isinstance(p1, (int, float, str, list)):
|
|
566
|
+
p1 = self.utility.value(p1)
|
|
567
|
+
if isinstance(p2, (int, float, str, list)):
|
|
568
|
+
p2 = self.utility.value(p2)
|
|
569
|
+
return self.geometry.PointData(p1, p2)
|
|
570
|
+
|
|
571
|
+
def point3d_data(self, p1, p2, p3):
|
|
572
|
+
"""Edb Dotnet Api Point 3D."""
|
|
573
|
+
if isinstance(p1, (int, float, str, list)):
|
|
574
|
+
p1 = self.utility.value(p1)
|
|
575
|
+
if isinstance(p2, (int, float, str, list)):
|
|
576
|
+
p2 = self.utility.value(p2)
|
|
577
|
+
if isinstance(p3, (int, float, str, list)):
|
|
578
|
+
p3 = self.utility.value(p3)
|
|
579
|
+
return self.geometry.Point3DData(p1, p2, p3)
|
|
580
|
+
|
|
581
|
+
@property
|
|
582
|
+
def extent_type(self):
|
|
583
|
+
"""Edb Dotnet Api Extent Type."""
|
|
584
|
+
return self.geometry.ExtentType
|
|
585
|
+
|
|
586
|
+
@property
|
|
587
|
+
def polygon_data(self):
|
|
588
|
+
"""Polygon Data.
|
|
589
|
+
|
|
590
|
+
Returns
|
|
591
|
+
-------
|
|
592
|
+
:class:`dotnet.edb_core.dotnet.PolygonDataDotNet`
|
|
593
|
+
"""
|
|
594
|
+
return PolygonDataDotNet(self._app)
|
|
595
|
+
|
|
596
|
+
def arc_data(self, point1, point2, rotation=None, center=None, height=None):
|
|
597
|
+
"""Compute EBD arc data.
|
|
598
|
+
|
|
599
|
+
Parameters
|
|
600
|
+
----------
|
|
601
|
+
point1 : list or PointData object
|
|
602
|
+
point2 : list or PointData object
|
|
603
|
+
rotation : int or RotationDir enumerator
|
|
604
|
+
center : list or PointData object
|
|
605
|
+
height : float
|
|
606
|
+
|
|
607
|
+
Returns
|
|
608
|
+
-------
|
|
609
|
+
Edb ArcData object
|
|
610
|
+
"""
|
|
611
|
+
if isinstance(point1, (list, tuple)):
|
|
612
|
+
point1 = self.point_data(point1[0], point1[1])
|
|
613
|
+
if isinstance(point2, (list, tuple)):
|
|
614
|
+
point2 = self.point_data(point2[0], point2[1])
|
|
615
|
+
if center and isinstance(center, (list, tuple)):
|
|
616
|
+
center = self.point_data(center[0], center[1])
|
|
617
|
+
if rotation and center:
|
|
618
|
+
return self.geometry.ArcData(point1, point2, rotation, center)
|
|
619
|
+
elif height:
|
|
620
|
+
return self.geometry.ArcData(point1, point2, height)
|
|
621
|
+
else:
|
|
622
|
+
return self.geometry.ArcData(point1, point2)
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
class CellDotNet:
|
|
626
|
+
"""Cell Dot net."""
|
|
627
|
+
|
|
628
|
+
def __getattr__(self, key):
|
|
629
|
+
try:
|
|
630
|
+
return super().__getattribute__(key)
|
|
631
|
+
except AttributeError:
|
|
632
|
+
try:
|
|
633
|
+
return getattr(self.edb_api, key)
|
|
634
|
+
except AttributeError:
|
|
635
|
+
raise AttributeError("Attribute not present")
|
|
636
|
+
|
|
637
|
+
def __init__(self, app):
|
|
638
|
+
self._app = app
|
|
639
|
+
self.edb_api = app._edb
|
|
640
|
+
|
|
641
|
+
@property
|
|
642
|
+
def api_class(self):
|
|
643
|
+
"""Return Ansys.Ansoft.Edb class object."""
|
|
644
|
+
return self.edb_api
|
|
645
|
+
|
|
646
|
+
@property
|
|
647
|
+
def definition(self):
|
|
648
|
+
"""Edb Dotnet Api Definition."""
|
|
649
|
+
|
|
650
|
+
return self.edb_api.Definition
|
|
651
|
+
|
|
652
|
+
@property
|
|
653
|
+
def database(self):
|
|
654
|
+
"""Edb Dotnet Api Database."""
|
|
655
|
+
return self.edb_api.Database
|
|
656
|
+
|
|
657
|
+
@property
|
|
658
|
+
def cell(self):
|
|
659
|
+
"""Edb Dotnet Api Database `Edb.Cell`.
|
|
660
|
+
|
|
661
|
+
Returns
|
|
662
|
+
-------
|
|
663
|
+
:class:`pyedb.dotnet.edb_core.dotnet.database.CellClassDotNet`"""
|
|
664
|
+
return CellClassDotNet(self._app)
|
|
665
|
+
|
|
666
|
+
@property
|
|
667
|
+
def utility(self):
|
|
668
|
+
"""Utility class.
|
|
669
|
+
|
|
670
|
+
Returns
|
|
671
|
+
-------
|
|
672
|
+
:class:`pyedb.dotnet.edb_core.dotnet.database.UtilityDotNet`"""
|
|
673
|
+
|
|
674
|
+
return UtilityDotNet(self._app)
|
|
675
|
+
|
|
676
|
+
@property
|
|
677
|
+
def geometry(self):
|
|
678
|
+
"""Geometry class.
|
|
679
|
+
|
|
680
|
+
Returns
|
|
681
|
+
-------
|
|
682
|
+
:class:`pyedb.dotnet.edb_core.dotnet.database.GeometryDotNet`"""
|
|
683
|
+
return GeometryDotNet(self._app)
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
class EdbDotNet(object):
|
|
687
|
+
"""Edb Dot Net Class."""
|
|
688
|
+
|
|
689
|
+
def __init__(self, edbversion, student_version=False):
|
|
690
|
+
self._logger = pyedb_logger
|
|
691
|
+
if not edbversion: # pragma: no cover
|
|
692
|
+
try:
|
|
693
|
+
edbversion = "20{}.{}".format(list_installed_ansysem()[0][-3:-1], list_installed_ansysem()[0][-1:])
|
|
694
|
+
self._logger.info("Edb version " + edbversion)
|
|
695
|
+
except IndexError:
|
|
696
|
+
raise Exception("No ANSYSEM_ROOTxxx is found.")
|
|
697
|
+
self.edbversion = edbversion
|
|
698
|
+
self.student_version = student_version
|
|
699
|
+
"""Initialize DLLs."""
|
|
700
|
+
from pyedb.dotnet.clr_module import _clr, edb_initialized
|
|
701
|
+
|
|
702
|
+
if settings.enable_screen_logs:
|
|
703
|
+
self._logger.enable_stdout_log()
|
|
704
|
+
else: # pragma: no cover
|
|
705
|
+
self._logger.disable_stdout_log()
|
|
706
|
+
if not edb_initialized: # pragma: no cover
|
|
707
|
+
self._logger.error("Failed to initialize Dlls.")
|
|
708
|
+
return
|
|
709
|
+
self._logger.info("Logger is initialized in EDB.")
|
|
710
|
+
self._logger.info("legacy v%s", __version__)
|
|
711
|
+
self._logger.info("Python version %s", sys.version)
|
|
712
|
+
if is_linux: # pragma: no cover
|
|
713
|
+
if env_value(self.edbversion) in os.environ or settings.edb_dll_path:
|
|
714
|
+
if settings.edb_dll_path:
|
|
715
|
+
self.base_path = settings.edb_dll_path
|
|
716
|
+
else:
|
|
717
|
+
self.base_path = env_path(self.edbversion)
|
|
718
|
+
sys.path.append(self.base_path)
|
|
719
|
+
else:
|
|
720
|
+
main = sys.modules["__main__"]
|
|
721
|
+
if "oDesktop" in dir(main):
|
|
722
|
+
self.base_path = main.oDesktop.GetExeDir()
|
|
723
|
+
sys.path.append(main.oDesktop.GetExeDir())
|
|
724
|
+
os.environ[env_value(self.edbversion)] = self.base_path
|
|
725
|
+
else:
|
|
726
|
+
edb_path = os.getenv("PYAEDT_SERVER_AEDT_PATH")
|
|
727
|
+
if edb_path:
|
|
728
|
+
self.base_path = edb_path
|
|
729
|
+
sys.path.append(edb_path)
|
|
730
|
+
os.environ[env_value(self.edbversion)] = self.base_path
|
|
731
|
+
if is_ironpython:
|
|
732
|
+
_clr.AddReferenceToFile("Ansys.Ansoft.Edb.dll")
|
|
733
|
+
_clr.AddReferenceToFile("Ansys.Ansoft.EdbBuilderUtils.dll")
|
|
734
|
+
_clr.AddReferenceToFileAndPath(os.path.join(self.base_path, "Ansys.Ansoft.SimSetupData.dll"))
|
|
735
|
+
else:
|
|
736
|
+
_clr.AddReference("Ansys.Ansoft.Edb")
|
|
737
|
+
_clr.AddReference("Ansys.Ansoft.EdbBuilderUtils")
|
|
738
|
+
_clr.AddReference("Ansys.Ansoft.SimSetupData")
|
|
739
|
+
else:
|
|
740
|
+
if settings.edb_dll_path:
|
|
741
|
+
self.base_path = settings.edb_dll_path
|
|
742
|
+
elif self.student_version:
|
|
743
|
+
self.base_path = env_path_student(self.edbversion)
|
|
744
|
+
else:
|
|
745
|
+
self.base_path = env_path(self.edbversion)
|
|
746
|
+
sys.path.append(self.base_path)
|
|
747
|
+
_clr.AddReference("Ansys.Ansoft.Edb")
|
|
748
|
+
_clr.AddReference("Ansys.Ansoft.EdbBuilderUtils")
|
|
749
|
+
_clr.AddReference("Ansys.Ansoft.SimSetupData")
|
|
750
|
+
os.environ["ECAD_TRANSLATORS_INSTALL_DIR"] = self.base_path
|
|
751
|
+
oaDirectory = os.path.join(self.base_path, "common", "oa")
|
|
752
|
+
os.environ["ANSYS_OADIR"] = oaDirectory
|
|
753
|
+
os.environ["PATH"] = "{};{}".format(os.environ["PATH"], self.base_path)
|
|
754
|
+
edb = __import__("Ansys.Ansoft.Edb")
|
|
755
|
+
self._edb = edb.Ansoft.Edb
|
|
756
|
+
edbbuilder = __import__("Ansys.Ansoft.EdbBuilderUtils")
|
|
757
|
+
self.edbutils = edbbuilder.Ansoft.EdbBuilderUtils
|
|
758
|
+
self.simSetup = __import__("Ansys.Ansoft.SimSetupData")
|
|
759
|
+
self.simsetupdata = self.simSetup.Ansoft.SimSetupData.Data
|
|
760
|
+
|
|
761
|
+
@property
|
|
762
|
+
def student_version(self):
|
|
763
|
+
"""Set the student version flag."""
|
|
764
|
+
return self._student_version
|
|
765
|
+
|
|
766
|
+
@student_version.setter
|
|
767
|
+
def student_version(self, value):
|
|
768
|
+
self._student_version = value
|
|
769
|
+
|
|
770
|
+
@property
|
|
771
|
+
def logger(self):
|
|
772
|
+
"""Logger for EDB.
|
|
773
|
+
|
|
774
|
+
Returns
|
|
775
|
+
-------
|
|
776
|
+
:class:`pyedb.edb_logger.EDBLogger`
|
|
777
|
+
"""
|
|
778
|
+
return self._logger
|
|
779
|
+
|
|
780
|
+
@property
|
|
781
|
+
def edb_api(self):
|
|
782
|
+
"""Edb Dotnet Api class.
|
|
783
|
+
|
|
784
|
+
Returns
|
|
785
|
+
-------
|
|
786
|
+
:class:`pyedb.dotnet.edb_core.dotnet.database.CellDotNet`
|
|
787
|
+
"""
|
|
788
|
+
return CellDotNet(self)
|
|
789
|
+
|
|
790
|
+
@property
|
|
791
|
+
def database(self):
|
|
792
|
+
"""Edb Dotnet Api Database."""
|
|
793
|
+
return self.edb_api.database
|
|
794
|
+
|
|
795
|
+
@property
|
|
796
|
+
def definition(self):
|
|
797
|
+
"""Edb Dotnet Api Database `Edb.Definition`."""
|
|
798
|
+
return self.edb_api.Definition
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
class Database(EdbDotNet):
|
|
802
|
+
"""Class representing a database object."""
|
|
803
|
+
|
|
804
|
+
def __init__(self, edbversion, student_version=False):
|
|
805
|
+
"""Initialize a new Database."""
|
|
806
|
+
EdbDotNet.__init__(self, edbversion=edbversion, student_version=student_version)
|
|
807
|
+
self._db = None
|
|
808
|
+
|
|
809
|
+
@property
|
|
810
|
+
def api_class(self):
|
|
811
|
+
"""Return Ansys.Ansoft.Edb class object."""
|
|
812
|
+
return self._edb
|
|
813
|
+
|
|
814
|
+
@property
|
|
815
|
+
def api_object(self):
|
|
816
|
+
"""Return Ansys.Ansoft.Edb object."""
|
|
817
|
+
return self._db
|
|
818
|
+
|
|
819
|
+
@property
|
|
820
|
+
def db(self):
|
|
821
|
+
"""Active database object."""
|
|
822
|
+
return self._db
|
|
823
|
+
|
|
824
|
+
def run_as_standalone(self, flag):
|
|
825
|
+
"""Set if Edb is run as standalone or embedded in AEDT.
|
|
826
|
+
|
|
827
|
+
Parameters
|
|
828
|
+
----------
|
|
829
|
+
flag : bool
|
|
830
|
+
Whether if Edb is run as standalone or embedded in AEDT.
|
|
831
|
+
"""
|
|
832
|
+
self.edb_api.database.SetRunAsStandAlone(flag)
|
|
833
|
+
|
|
834
|
+
def create(self, db_path):
|
|
835
|
+
"""Create a Database at the specified file location.
|
|
836
|
+
|
|
837
|
+
Parameters
|
|
838
|
+
----------
|
|
839
|
+
db_path : str
|
|
840
|
+
Path to top-level database folder
|
|
841
|
+
|
|
842
|
+
Returns
|
|
843
|
+
-------
|
|
844
|
+
Database
|
|
845
|
+
"""
|
|
846
|
+
self._db = self.edb_api.database.Create(db_path)
|
|
847
|
+
return self._db
|
|
848
|
+
|
|
849
|
+
def open(self, db_path, read_only):
|
|
850
|
+
"""Open an existing Database at the specified file location.
|
|
851
|
+
|
|
852
|
+
Parameters
|
|
853
|
+
----------
|
|
854
|
+
db_path : str
|
|
855
|
+
Path to top-level Database folder.
|
|
856
|
+
read_only : bool
|
|
857
|
+
Obtain read-only access.
|
|
858
|
+
|
|
859
|
+
Returns
|
|
860
|
+
-------
|
|
861
|
+
Database or None
|
|
862
|
+
The opened Database object, or None if not found.
|
|
863
|
+
"""
|
|
864
|
+
self._db = self.edb_api.database.Open(
|
|
865
|
+
db_path,
|
|
866
|
+
read_only,
|
|
867
|
+
)
|
|
868
|
+
return self._db
|
|
869
|
+
|
|
870
|
+
def delete(self, db_path):
|
|
871
|
+
"""Delete a database at the specified file location.
|
|
872
|
+
|
|
873
|
+
Parameters
|
|
874
|
+
----------
|
|
875
|
+
db_path : str
|
|
876
|
+
Path to top-level database folder.
|
|
877
|
+
"""
|
|
878
|
+
return self.edb_api.database.Delete(db_path)
|
|
879
|
+
|
|
880
|
+
def save(self):
|
|
881
|
+
"""Save any changes into a file."""
|
|
882
|
+
return self._db.Save()
|
|
883
|
+
|
|
884
|
+
def close(self):
|
|
885
|
+
"""Close the database.
|
|
886
|
+
|
|
887
|
+
.. note::
|
|
888
|
+
Unsaved changes will be lost.
|
|
889
|
+
"""
|
|
890
|
+
return self._db.Close()
|
|
891
|
+
|
|
892
|
+
@property
|
|
893
|
+
def top_circuit_cells(self):
|
|
894
|
+
"""Get top circuit cells.
|
|
895
|
+
|
|
896
|
+
Returns
|
|
897
|
+
-------
|
|
898
|
+
list[:class:`Cell <ansys.edb.layout.Cell>`]
|
|
899
|
+
"""
|
|
900
|
+
return [CellClassDotNet(self, i) for i in list(self._db.TopCircuitCells)]
|
|
901
|
+
|
|
902
|
+
@property
|
|
903
|
+
def circuit_cells(self):
|
|
904
|
+
"""Get all circuit cells in the Database.
|
|
905
|
+
|
|
906
|
+
Returns
|
|
907
|
+
-------
|
|
908
|
+
list[:class:`Cell <ansys.edb.layout.Cell>`]
|
|
909
|
+
"""
|
|
910
|
+
return [CellClassDotNet(self, i) for i in list(self._db.CircuitCells)]
|
|
911
|
+
|
|
912
|
+
@property
|
|
913
|
+
def footprint_cells(self):
|
|
914
|
+
"""Get all footprint cells in the Database.
|
|
915
|
+
|
|
916
|
+
Returns
|
|
917
|
+
-------
|
|
918
|
+
list[:class:`Cell <ansys.edb.layout.Cell>`]
|
|
919
|
+
"""
|
|
920
|
+
return [CellClassDotNet(self, i) for i in list(self._db.FootprintCells)]
|
|
921
|
+
|
|
922
|
+
@property
|
|
923
|
+
def edb_uid(self):
|
|
924
|
+
"""Get ID of the database.
|
|
925
|
+
|
|
926
|
+
Returns
|
|
927
|
+
-------
|
|
928
|
+
int
|
|
929
|
+
The unique EDB id of the Database.
|
|
930
|
+
"""
|
|
931
|
+
return self._db.GetId()
|
|
932
|
+
|
|
933
|
+
@property
|
|
934
|
+
def is_read_only(self):
|
|
935
|
+
"""Determine if the database is open in a read-only mode.
|
|
936
|
+
|
|
937
|
+
Returns
|
|
938
|
+
-------
|
|
939
|
+
bool
|
|
940
|
+
True if Database is open with read only access, otherwise False.
|
|
941
|
+
"""
|
|
942
|
+
return self._db.IsReadOnly()
|
|
943
|
+
|
|
944
|
+
def find_by_id(self, db_id):
|
|
945
|
+
"""Find a database by ID.
|
|
946
|
+
|
|
947
|
+
Parameters
|
|
948
|
+
----------
|
|
949
|
+
db_id : int
|
|
950
|
+
The Database's unique EDB id.
|
|
951
|
+
|
|
952
|
+
Returns
|
|
953
|
+
-------
|
|
954
|
+
Database
|
|
955
|
+
The Database or Null on failure.
|
|
956
|
+
"""
|
|
957
|
+
self.edb_api.database.FindById(db_id)
|
|
958
|
+
|
|
959
|
+
def save_as(self, path, version=""):
|
|
960
|
+
"""Save this Database to a new location and older EDB version.
|
|
961
|
+
|
|
962
|
+
Parameters
|
|
963
|
+
----------
|
|
964
|
+
path : str
|
|
965
|
+
New Database file location.
|
|
966
|
+
version : str
|
|
967
|
+
EDB version to save to. Empty string means current version.
|
|
968
|
+
"""
|
|
969
|
+
self._db.SaveAs(path, version)
|
|
970
|
+
|
|
971
|
+
@property
|
|
972
|
+
def directory(self):
|
|
973
|
+
"""Get the directory of the Database.
|
|
974
|
+
|
|
975
|
+
Returns
|
|
976
|
+
-------
|
|
977
|
+
str
|
|
978
|
+
Directory of the Database.
|
|
979
|
+
"""
|
|
980
|
+
return self._db.GetDirectory()
|
|
981
|
+
|
|
982
|
+
def get_product_property(self, prod_id, attr_it):
|
|
983
|
+
"""Get the product-specific property value.
|
|
984
|
+
|
|
985
|
+
Parameters
|
|
986
|
+
----------
|
|
987
|
+
prod_id : ProductIdType
|
|
988
|
+
Product ID.
|
|
989
|
+
attr_it : int
|
|
990
|
+
Attribute ID.
|
|
991
|
+
|
|
992
|
+
Returns
|
|
993
|
+
-------
|
|
994
|
+
str
|
|
995
|
+
Property value returned.
|
|
996
|
+
"""
|
|
997
|
+
return self._db.GetProductProperty(prod_id, attr_it)
|
|
998
|
+
|
|
999
|
+
def set_product_property(self, prod_id, attr_it, prop_value):
|
|
1000
|
+
"""Set the product property associated with the given product and attribute ids.
|
|
1001
|
+
|
|
1002
|
+
Parameters
|
|
1003
|
+
----------
|
|
1004
|
+
prod_id : ProductIdType
|
|
1005
|
+
Product ID.
|
|
1006
|
+
attr_it : int
|
|
1007
|
+
Attribute ID.
|
|
1008
|
+
prop_value : str
|
|
1009
|
+
Product property's new value
|
|
1010
|
+
"""
|
|
1011
|
+
self._db.SetProductProperty(prod_id, attr_it, prop_value)
|
|
1012
|
+
|
|
1013
|
+
def get_product_property_ids(self, prod_id):
|
|
1014
|
+
"""Get a list of attribute ids corresponding to a product property id.
|
|
1015
|
+
|
|
1016
|
+
Parameters
|
|
1017
|
+
----------
|
|
1018
|
+
prod_id : ProductIdType
|
|
1019
|
+
Product ID.
|
|
1020
|
+
|
|
1021
|
+
Returns
|
|
1022
|
+
-------
|
|
1023
|
+
list[int]
|
|
1024
|
+
The attribute ids associated with this product property.
|
|
1025
|
+
"""
|
|
1026
|
+
return self._db.GetProductPropertyIds(prod_id)
|
|
1027
|
+
|
|
1028
|
+
def import_material_from_control_file(self, control_file, schema_dir=None, append=True):
|
|
1029
|
+
"""Import materials from the provided control file.
|
|
1030
|
+
|
|
1031
|
+
Parameters
|
|
1032
|
+
----------
|
|
1033
|
+
control_file : str
|
|
1034
|
+
Control file name with full path.
|
|
1035
|
+
schema_dir : str
|
|
1036
|
+
Schema file path.
|
|
1037
|
+
append : bool
|
|
1038
|
+
True if the existing materials in Database are kept. False to remove existing materials in database.
|
|
1039
|
+
"""
|
|
1040
|
+
self._db.ImportMaterialFromControlFile(
|
|
1041
|
+
control_file,
|
|
1042
|
+
schema_dir,
|
|
1043
|
+
append,
|
|
1044
|
+
)
|
|
1045
|
+
|
|
1046
|
+
@property
|
|
1047
|
+
def version(self):
|
|
1048
|
+
"""Get version of the Database.
|
|
1049
|
+
|
|
1050
|
+
Returns
|
|
1051
|
+
-------
|
|
1052
|
+
tuple(int, int)
|
|
1053
|
+
A tuple of the version numbers [major, minor]
|
|
1054
|
+
"""
|
|
1055
|
+
major, minor = self._db.GetVersion()
|
|
1056
|
+
return major, minor
|
|
1057
|
+
|
|
1058
|
+
def scale(self, scale_factor):
|
|
1059
|
+
"""Uniformly scale all geometry and their locations by a positive factor.
|
|
1060
|
+
|
|
1061
|
+
Parameters
|
|
1062
|
+
----------
|
|
1063
|
+
scale_factor : float
|
|
1064
|
+
Amount that coordinates are multiplied by.
|
|
1065
|
+
"""
|
|
1066
|
+
return self._db.Scale(scale_factor)
|
|
1067
|
+
|
|
1068
|
+
@property
|
|
1069
|
+
def source(self):
|
|
1070
|
+
"""Get source name for this Database.
|
|
1071
|
+
|
|
1072
|
+
This attribute is also used to set the source name.
|
|
1073
|
+
|
|
1074
|
+
Returns
|
|
1075
|
+
-------
|
|
1076
|
+
str
|
|
1077
|
+
name of the source
|
|
1078
|
+
"""
|
|
1079
|
+
return self._db.GetSource()
|
|
1080
|
+
|
|
1081
|
+
@source.setter
|
|
1082
|
+
def source(self, source):
|
|
1083
|
+
"""Set source name of the database."""
|
|
1084
|
+
self._db.SetSource(source)
|
|
1085
|
+
|
|
1086
|
+
@property
|
|
1087
|
+
def source_version(self):
|
|
1088
|
+
"""Get the source version for this Database.
|
|
1089
|
+
|
|
1090
|
+
This attribute is also used to set the version.
|
|
1091
|
+
|
|
1092
|
+
Returns
|
|
1093
|
+
-------
|
|
1094
|
+
str
|
|
1095
|
+
version string
|
|
1096
|
+
|
|
1097
|
+
"""
|
|
1098
|
+
return self._db.GetSourceVersion()
|
|
1099
|
+
|
|
1100
|
+
@source_version.setter
|
|
1101
|
+
def source_version(self, source_version):
|
|
1102
|
+
"""Set source version of the database."""
|
|
1103
|
+
self._db.SetSourceVersion(source_version)
|
|
1104
|
+
|
|
1105
|
+
def copy_cells(self, cells_to_copy):
|
|
1106
|
+
"""Copy Cells from other Databases or this Database into this Database.
|
|
1107
|
+
|
|
1108
|
+
Parameters
|
|
1109
|
+
----------
|
|
1110
|
+
cells_to_copy : list[:class:`Cell <ansys.edb.layout.Cell>`]
|
|
1111
|
+
Cells to copy.
|
|
1112
|
+
|
|
1113
|
+
Returns
|
|
1114
|
+
-------
|
|
1115
|
+
list[:class:`Cell <ansys.edb.layout.Cell>`]
|
|
1116
|
+
New Cells created in this Database.
|
|
1117
|
+
"""
|
|
1118
|
+
if not isinstance(cells_to_copy, list):
|
|
1119
|
+
cells_to_copy = [cells_to_copy]
|
|
1120
|
+
_dbCells = convert_py_list_to_net_list(cells_to_copy)
|
|
1121
|
+
return self._db.CopyCells(_dbCells)
|
|
1122
|
+
|
|
1123
|
+
@property
|
|
1124
|
+
def apd_bondwire_defs(self):
|
|
1125
|
+
"""Get all APD bondwire definitions in this Database.
|
|
1126
|
+
|
|
1127
|
+
Returns
|
|
1128
|
+
-------
|
|
1129
|
+
list[:class:`ApdBondwireDef <ansys.edb.definition.ApdBondwireDef>`]
|
|
1130
|
+
"""
|
|
1131
|
+
return list(self._db.APDBondwireDefs)
|
|
1132
|
+
|
|
1133
|
+
@property
|
|
1134
|
+
def jedec4_bondwire_defs(self):
|
|
1135
|
+
"""Get all JEDEC4 bondwire definitions in this Database.
|
|
1136
|
+
|
|
1137
|
+
Returns
|
|
1138
|
+
-------
|
|
1139
|
+
list[:class:`Jedec4BondwireDef <ansys.edb.definition.Jedec4BondwireDef>`]
|
|
1140
|
+
"""
|
|
1141
|
+
return list(self._db.Jedec4BondwireDefs)
|
|
1142
|
+
|
|
1143
|
+
@property
|
|
1144
|
+
def jedec5_bondwire_defs(self):
|
|
1145
|
+
"""Get all JEDEC5 bondwire definitions in this Database.
|
|
1146
|
+
|
|
1147
|
+
Returns
|
|
1148
|
+
-------
|
|
1149
|
+
list[:class:`Jedec5BondwireDef <ansys.edb.definition.Jedec5BondwireDef>`]
|
|
1150
|
+
"""
|
|
1151
|
+
return list(self._db.Jedec5BondwireDefs)
|
|
1152
|
+
|
|
1153
|
+
@property
|
|
1154
|
+
def padstack_defs(self):
|
|
1155
|
+
"""Get all Padstack definitions in this Database.
|
|
1156
|
+
|
|
1157
|
+
Returns
|
|
1158
|
+
-------
|
|
1159
|
+
list[:class:`PadstackDef <ansys.edb.definition.PadstackDef>`]
|
|
1160
|
+
"""
|
|
1161
|
+
return list(self._db.PadstackDefs)
|
|
1162
|
+
|
|
1163
|
+
@property
|
|
1164
|
+
def package_defs(self):
|
|
1165
|
+
"""Get all Package definitions in this Database.
|
|
1166
|
+
|
|
1167
|
+
Returns
|
|
1168
|
+
-------
|
|
1169
|
+
list[:class:`PackageDef <ansys.edb.definition.PackageDef>`]
|
|
1170
|
+
"""
|
|
1171
|
+
return list(self._db.PackageDefs)
|
|
1172
|
+
|
|
1173
|
+
@property
|
|
1174
|
+
def component_defs(self):
|
|
1175
|
+
"""Get all component definitions in the database.
|
|
1176
|
+
|
|
1177
|
+
Returns
|
|
1178
|
+
-------
|
|
1179
|
+
list[:class:`ComponentDef <ansys.edb.definition.ComponentDef>`]
|
|
1180
|
+
"""
|
|
1181
|
+
return list(self._db.ComponentDefs)
|
|
1182
|
+
|
|
1183
|
+
@property
|
|
1184
|
+
def material_defs(self):
|
|
1185
|
+
"""Get all material definitions in the database.
|
|
1186
|
+
|
|
1187
|
+
Returns
|
|
1188
|
+
-------
|
|
1189
|
+
list[:class:`MaterialDef <ansys.edb.definition.MaterialDef>`]
|
|
1190
|
+
"""
|
|
1191
|
+
return list(self._db.MaterialDefs)
|
|
1192
|
+
|
|
1193
|
+
@property
|
|
1194
|
+
def dataset_defs(self):
|
|
1195
|
+
"""Get all dataset definitions in the database.
|
|
1196
|
+
|
|
1197
|
+
Returns
|
|
1198
|
+
-------
|
|
1199
|
+
list[:class:`DatasetDef <ansys.edb.definition.DatasetDef>`]
|
|
1200
|
+
"""
|
|
1201
|
+
return list(self._db.DatasetDefs)
|
|
1202
|
+
|
|
1203
|
+
def attach(self, hdb): # pragma no cover
|
|
1204
|
+
"""Attach the database to existing AEDT instance.
|
|
1205
|
+
|
|
1206
|
+
Parameters
|
|
1207
|
+
----------
|
|
1208
|
+
hdb
|
|
1209
|
+
|
|
1210
|
+
Returns
|
|
1211
|
+
-------
|
|
1212
|
+
|
|
1213
|
+
"""
|
|
1214
|
+
from pyedb.generic.clr_module import Convert
|
|
1215
|
+
|
|
1216
|
+
hdl = Convert.ToUInt64(hdb)
|
|
1217
|
+
self._db = self.edb_api.database.Attach(hdl)
|
|
1218
|
+
return self._db
|