pyedb 0.42.0__py3-none-any.whl → 0.43.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 CHANGED
@@ -44,7 +44,7 @@ deprecation_warning()
44
44
  #
45
45
 
46
46
  pyedb_path = os.path.dirname(__file__)
47
- __version__ = "0.42.0"
47
+ __version__ = "0.43.0"
48
48
  version = __version__
49
49
 
50
50
  #
@@ -24,81 +24,158 @@ from pyedb.configuration.cfg_common import CfgBase
24
24
 
25
25
 
26
26
  class CfgBoundaries(CfgBase):
27
- def __init__(self, pedb, boundary_data):
28
- self._pedb = pedb
29
- self.open_region = boundary_data.get("open_region", None)
30
- self.open_region_type = boundary_data.get("map_open_region_type", None)
31
- self.pml_visible = boundary_data.get("pml_visible", None)
32
- self.pml_operation_frequency = boundary_data.get("pml_operation_frequency", None)
33
- self.pml_radiation_factor = boundary_data.get("pml_radiation_factor", None)
34
- self.dielectric_extent_type = boundary_data.get("dielectric_extent_type", None)
35
- # self.dielectric_base_polygon = self.**kwargs.get("dielectric_base_polygon", None)
36
- self.horizontal_padding = boundary_data.get("horizontal_padding", None)
37
- self.honor_primitives_on_dielectric_layers = boundary_data.get("honor_primitives_on_dielectric_layers", False)
38
- self.air_box_extent_type = boundary_data.get("air_box_extent_type", None)
39
- self.air_box_base_polygon = boundary_data.get("air_box_base_polygon", None)
40
- self.air_box_truncate_model_ground_layers = boundary_data.get("air_box_truncate_model_ground_layers", None)
41
- self.air_box_horizontal_padding = boundary_data.get("air_box_horizontal_padding", None)
42
- self.air_box_positive_vertical_padding = boundary_data.get("air_box_positive_vertical_padding", None)
43
- self.air_box_negative_vertical_padding = boundary_data.get("air_box_negative_vertical_padding", None)
27
+ class Grpc:
28
+ @property
29
+ def pyedb_obj(self):
30
+ return self.parent.pyedb_obj
44
31
 
45
- def apply(self):
46
- """Imports boundary information from JSON."""
47
- if self.open_region is not None:
48
- self._pedb.hfss.hfss_extent_info.use_open_region = self.open_region
49
- if self.open_region_type:
50
- self._pedb.hfss.hfss_extent_info.open_region_type = self.open_region_type.lower()
51
- if self.pml_visible is not None:
52
- self._pedb.hfss.hfss_extent_info.is_pml_visible = self.pml_visible
53
- if self.pml_operation_frequency:
54
- self._pedb.hfss.hfss_extent_info.operating_freq = self.pml_operation_frequency
55
- if self.pml_radiation_factor:
56
- if self._pedb.grpc:
57
- self._pedb.hfss.hfss_extent_info.pml_radiation_factor = self.pml_radiation_factor
58
- else:
59
- self._pedb.hfss.hfss_extent_info.radiation_level = self.pml_radiation_factor
60
- if self.dielectric_extent_type:
61
- self._pedb.hfss.hfss_extent_info.extent_type = self.dielectric_extent_type.lower()
62
- # if self.dielectric_base_polygon:
63
- # self._pedb.hfss.hfss_extent_info.dielectric_base_polygon = self.dielectric_base_polygon
64
- if self.horizontal_padding:
65
- self._pedb.hfss.hfss_extent_info.dielectric_extent_size = float(self.horizontal_padding)
66
- if self.honor_primitives_on_dielectric_layers is not None:
67
- self._pedb.hfss.hfss_extent_info.honor_user_dielectric = self.honor_primitives_on_dielectric_layers
68
- if self.air_box_extent_type:
69
- self._pedb.hfss.hfss_extent_info.extent_type = self.air_box_extent_type.lower()
70
- if self.air_box_truncate_model_ground_layers is not None:
71
- self._pedb.hfss.hfss_extent_info.truncate_air_box_at_ground = self.air_box_truncate_model_ground_layers
72
- if self.air_box_horizontal_padding:
73
- self._pedb.hfss.hfss_extent_info.air_box_horizontal_extent = float(self.air_box_horizontal_padding)
74
- if self.air_box_positive_vertical_padding:
75
- self._pedb.hfss.hfss_extent_info.air_box_positive_vertical_extent = float(
76
- self.air_box_positive_vertical_padding
32
+ def __init__(self, parent):
33
+ self.parent = parent
34
+ self._pedb = parent.pedb
35
+ self.open_region = self.parent.boundary_data.get("open_region", None)
36
+ self.open_region_type = self.parent.boundary_data.get("map_open_region_type", None)
37
+ self.pml_visible = self.parent.boundary_data.get("pml_visible", None)
38
+ self.pml_operation_frequency = self.parent.boundary_data.get("pml_operation_frequency", None)
39
+ self.pml_radiation_factor = self.parent.boundary_data.get("pml_radiation_factor", None)
40
+ self.dielectric_extent_type = self.parent.boundary_data.get("dielectric_extent_type", None)
41
+ self.horizontal_padding = self.parent.boundary_data.get("horizontal_padding", None)
42
+ self.honor_primitives_on_dielectric_layers = self.parent.boundary_data.get(
43
+ "honor_primitives_on_dielectric_layers", False
44
+ )
45
+ self.air_box_extent_type = self.parent.boundary_data.get("air_box_extent_type", None)
46
+ self.air_box_base_polygon = self.parent.boundary_data.get("air_box_base_polygon", None)
47
+ self.air_box_truncate_model_ground_layers = self.parent.boundary_data.get(
48
+ "air_box_truncate_model_ground_layers", None
49
+ )
50
+ self.air_box_horizontal_padding = self.parent.boundary_data.get("air_box_horizontal_padding", None)
51
+ self.air_box_positive_vertical_padding = self.parent.boundary_data.get(
52
+ "air_box_positive_vertical_padding", None
77
53
  )
78
- if self.air_box_negative_vertical_padding:
79
- self._pedb.hfss.hfss_extent_info.air_box_negative_vertical_extent = float(
80
- self.air_box_negative_vertical_padding
54
+ self.air_box_negative_vertical_padding = self.parent.boundary_data.get(
55
+ "air_box_negative_vertical_padding", None
81
56
  )
82
57
 
83
- def get_data_from_db(self):
84
- self.open_region = self._pedb.hfss.hfss_extent_info.use_open_region
85
- self.open_region_type = self._pedb.hfss.hfss_extent_info.open_region_type
86
- self.pml_visible = self._pedb.hfss.hfss_extent_info.is_pml_visible
87
- if self._pedb.grpc:
58
+ def set_parameters_to_edb(self):
59
+ if self.open_region is not None:
60
+ self._pedb.hfss.hfss_extent_info.use_open_region = self.open_region
61
+ if self.open_region_type:
62
+ self._pedb.hfss.hfss_extent_info.open_region_type = self.open_region_type.lower()
63
+ if self.pml_visible is not None:
64
+ self._pedb.hfss.hfss_extent_info.is_pml_visible = self.pml_visible
65
+ if self.pml_operation_frequency:
66
+ self._pedb.hfss.hfss_extent_info.operating_freq = self.pml_operation_frequency
67
+ if self.pml_radiation_factor:
68
+ self._pedb.hfss.hfss_extent_info.pml_radiation_factor = self.pml_radiation_factor
69
+ if self.dielectric_extent_type:
70
+ self._pedb.hfss.hfss_extent_info.extent_type = self.dielectric_extent_type.lower()
71
+ if self.horizontal_padding:
72
+ self._pedb.hfss.hfss_extent_info.dielectric_extent_size = float(self.horizontal_padding)
73
+ if self.honor_primitives_on_dielectric_layers is not None:
74
+ self._pedb.hfss.hfss_extent_info.honor_user_dielectric = self.honor_primitives_on_dielectric_layers
75
+ if self.air_box_extent_type:
76
+ self._pedb.hfss.hfss_extent_info.extent_type = self.air_box_extent_type.lower()
77
+ if self.air_box_truncate_model_ground_layers is not None:
78
+ self._pedb.hfss.hfss_extent_info.truncate_air_box_at_ground = self.air_box_truncate_model_ground_layers
79
+ if self.air_box_horizontal_padding:
80
+ self._pedb.hfss.hfss_extent_info.air_box_horizontal_extent = float(self.air_box_horizontal_padding)
81
+ if self.air_box_positive_vertical_padding:
82
+ self._pedb.hfss.hfss_extent_info.parentair_box_positive_vertical_extent = float(
83
+ self.air_box_positive_vertical_padding
84
+ )
85
+ if self.air_box_negative_vertical_padding:
86
+ self._pedb.hfss.hfss_extent_info.air_box_negative_vertical_extent = float(
87
+ self.air_box_negative_vertical_padding
88
+ )
89
+
90
+ def get_parameters_from_edb(self):
91
+ self.open_region = self._pedb.hfss.hfss_extent_info.use_open_region
92
+ self.open_region_type = self._pedb.hfss.hfss_extent_info.open_region_type
93
+ self.pml_visible = self._pedb.hfss.hfss_extent_info.is_pml_visible
88
94
  self.pml_operation_frequency = self._pedb.hfss.hfss_extent_info.operating_freq
89
- else:
90
- self.pml_operation_frequency = self._pedb.hfss.hfss_extent_info.operating_freq.tostring
91
- if self._pedb.grpc:
92
95
  self.pml_radiation_factor = self._pedb.hfss.hfss_extent_info.pml_radiation_factor
96
+ self.dielectric_extent_type = self._pedb.hfss.hfss_extent_info.extent_type
97
+ self.horizontal_padding = self._pedb.hfss.hfss_extent_info.dielectric_extent_size
98
+ self.honor_primitives_on_dielectric_layers = self._pedb.hfss.hfss_extent_info.honor_user_dielectric
99
+ self.air_box_extent_type = self._pedb.hfss.hfss_extent_info.extent_type
100
+ self.air_box_truncate_model_ground_layers = self._pedb.hfss.hfss_extent_info.truncate_air_box_at_ground
101
+ self.air_box_horizontal_padding = self._pedb.hfss.hfss_extent_info.air_box_horizontal_extent
102
+ self.air_box_positive_vertical_padding = self._pedb.hfss.hfss_extent_info.air_box_positive_vertical_extent
103
+ self.air_box_negative_vertical_padding = self._pedb.hfss.hfss_extent_info.air_box_negative_vertical_extent
104
+ return self.parent.get_attributes()
105
+
106
+ class DotNet(Grpc):
107
+ def __init__(self, parent):
108
+ super().__init__(parent)
109
+
110
+ def get_parameters_from_edb(self):
111
+ self.parent.open_region = self._pedb.hfss.hfss_extent_info.use_open_region
112
+ self.parent.open_region_type = self._pedb.hfss.hfss_extent_info.open_region_type
113
+ self.parent.pml_visible = self._pedb.hfss.hfss_extent_info.is_pml_visible
114
+ self.parent.pml_operation_frequency = self._pedb.hfss.hfss_extent_info.operating_freq.tostring
115
+ self.parent.pml_radiation_factor = self._pedb.hfss.hfss_extent_info.radiation_level.tostring
116
+ self.parent.dielectric_extent_type = self._pedb.hfss.hfss_extent_info.extent_type
117
+ self.parent.horizontal_padding = self._pedb.hfss.hfss_extent_info.dielectric_extent_size
118
+ self.parent.honor_primitives_on_dielectric_layers = self._pedb.hfss.hfss_extent_info.honor_user_dielectric
119
+ self.parent.air_box_extent_type = self._pedb.hfss.hfss_extent_info.extent_type
120
+ self.parent.air_box_truncate_model_ground_layers = (
121
+ self._pedb.hfss.hfss_extent_info.truncate_air_box_at_ground
122
+ )
123
+ self.parent.air_box_horizontal_padding = self._pedb.hfss.hfss_extent_info.air_box_horizontal_extent
124
+ self.parent.air_box_positive_vertical_padding = (
125
+ self._pedb.hfss.hfss_extent_info.air_box_positive_vertical_extent
126
+ )
127
+ self.parent.air_box_negative_vertical_padding = (
128
+ self._pedb.hfss.hfss_extent_info.air_box_negative_vertical_extent
129
+ )
130
+ return self.parent.get_attributes(exclude="boundary_data")
131
+
132
+ def set_parameters_to_edb(self):
133
+ """Imports boundary information from JSON."""
134
+ if self.open_region is not None:
135
+ self._pedb.hfss.hfss_extent_info.use_open_region = self.open_region
136
+ if self.open_region_type:
137
+ self._pedb.hfss.hfss_extent_info.open_region_type = self.open_region_type.lower()
138
+ if self.pml_visible is not None:
139
+ self._pedb.hfss.hfss_extent_info.is_pml_visible = self.pml_visible
140
+ if self.pml_operation_frequency:
141
+ self._pedb.hfss.hfss_extent_info.operating_freq = self.pml_operation_frequency
142
+ if self.pml_radiation_factor:
143
+ if self._pedb.grpc:
144
+ self._pedb.hfss.hfss_extent_info.pml_radiation_factor = self.pml_radiation_factor
145
+ else:
146
+ self._pedb.hfss.hfss_extent_info.radiation_level = self.pml_radiation_factor
147
+ if self.dielectric_extent_type:
148
+ self._pedb.hfss.hfss_extent_info.extent_type = self.dielectric_extent_type.lower()
149
+ if self.horizontal_padding:
150
+ self._pedb.hfss.hfss_extent_info.dielectric_extent_size = float(self.horizontal_padding)
151
+ if self.honor_primitives_on_dielectric_layers is not None:
152
+ self._pedb.hfss.hfss_extent_info.honor_user_dielectric = self.honor_primitives_on_dielectric_layers
153
+ if self.air_box_extent_type:
154
+ self._pedb.hfss.hfss_extent_info.extent_type = self.air_box_extent_type.lower()
155
+ if self.air_box_truncate_model_ground_layers is not None:
156
+ self._pedb.hfss.hfss_extent_info.truncate_air_box_at_ground = self.air_box_truncate_model_ground_layers
157
+ if self.air_box_horizontal_padding:
158
+ self._pedb.hfss.hfss_extent_info.air_box_horizontal_extent = float(self.air_box_horizontal_padding)
159
+ if self.air_box_positive_vertical_padding:
160
+ self._pedb.hfss.hfss_extent_info.air_box_positive_vertical_extent = float(
161
+ self.air_box_positive_vertical_padding
162
+ )
163
+ if self.air_box_negative_vertical_padding:
164
+ self._pedb.hfss.hfss_extent_info.air_box_negative_vertical_extent = float(
165
+ self.air_box_negative_vertical_padding
166
+ )
167
+
168
+ def __init__(self, pedb, boundary_data):
169
+ self.pedb = pedb
170
+ self.boundary_data = boundary_data
171
+ if self.pedb.grpc:
172
+ self.api = self.Grpc(self)
93
173
  else:
94
- self.pml_radiation_factor = self._pedb.hfss.hfss_extent_info.radiation_level.tostring
95
- self.dielectric_extent_type = self._pedb.hfss.hfss_extent_info.extent_type
96
- # self.dielectric_base_polygon = self._pedb.hfss.hfss_extent_info.dielectric_base_polygon
97
- self.horizontal_padding = self._pedb.hfss.hfss_extent_info.dielectric_extent_size
98
- self.honor_primitives_on_dielectric_layers = self._pedb.hfss.hfss_extent_info.honor_user_dielectric
99
- self.air_box_extent_type = self._pedb.hfss.hfss_extent_info.extent_type
100
- self.air_box_truncate_model_ground_layers = self._pedb.hfss.hfss_extent_info.truncate_air_box_at_ground
101
- self.air_box_horizontal_padding = self._pedb.hfss.hfss_extent_info.air_box_horizontal_extent
102
- self.air_box_positive_vertical_padding = self._pedb.hfss.hfss_extent_info.air_box_positive_vertical_extent
103
- self.air_box_negative_vertical_padding = self._pedb.hfss.hfss_extent_info.air_box_negative_vertical_extent
104
- return self.get_attributes()
174
+ self.api = self.DotNet(self)
175
+
176
+ def apply(self):
177
+ """Imports boundary information from JSON."""
178
+ self.api.set_parameters_to_edb()
179
+
180
+ def get_data_from_db(self):
181
+ return self.api.get_parameters_from_edb()
@@ -24,26 +24,42 @@
24
24
  class CfgGeneral:
25
25
  """Manage configuration general settings."""
26
26
 
27
+ class Grpc:
28
+ def __init__(self, parent):
29
+ self.parent = parent
30
+ self.pedb = parent.pedb
31
+
32
+ def set_parameters_to_edb(self):
33
+ self.pedb.active_cell.anti_pads_always_on = self.parent.anti_pads_always_on
34
+ self.pedb.active_cell.suppress_pads = self.parent.suppress_pads
35
+
36
+ def get_parameters_from_edb(self):
37
+ anti_pads_always_on = self.pedb.design_options.antipads_always_on
38
+ suppress_pads = self.pedb.design_options.suppress_pads
39
+ data = {"anti_pads_always_on": anti_pads_always_on, "suppress_pads": suppress_pads}
40
+ return data
41
+
42
+ class DotNet(Grpc):
43
+ def __init__(self, parent):
44
+ super().__init__(parent)
45
+
46
+ def set_parameters_to_edb(self):
47
+ self.pedb.design_options.antipads_always_on = self.parent.anti_pads_always_on
48
+ self.pedb.design_options.suppress_pads = self.parent.suppress_pads
49
+
27
50
  def __init__(self, pedb, data):
28
- self._pedb = pedb
51
+ self.pedb = pedb
52
+ if self.pedb.grpc:
53
+ self.api = self.Grpc(self)
54
+ else:
55
+ self.api = self.DotNet(self)
29
56
  self.spice_model_library = data.get("spice_model_library", "")
30
57
  self.s_parameter_library = data.get("s_parameter_library", "")
31
58
  self.anti_pads_always_on = data.get("anti_pads_always_on", False)
32
59
  self.suppress_pads = data.get("suppress_pads", True)
33
60
 
34
61
  def apply(self):
35
- if self._pedb.grpc:
36
- self._pedb.active_cell.anti_pads_always_on = self.anti_pads_always_on
37
- self._pedb.active_cell.suppress_pads = self.suppress_pads
38
- else:
39
- self._pedb.design_options.antipads_always_on = self.anti_pads_always_on
40
- self._pedb.design_options.suppress_pads = self.suppress_pads
62
+ self.api.set_parameters_to_edb()
41
63
 
42
64
  def get_data_from_db(self):
43
- self.anti_pads_always_on = self._pedb.design_options.antipads_always_on
44
- self.suppress_pads = self._pedb.design_options.suppress_pads
45
-
46
- data = {}
47
- data["anti_pads_always_on"] = self.anti_pads_always_on
48
- data["suppress_pads"] = self.suppress_pads
49
- return data
65
+ return self.api.get_parameters_from_edb()
@@ -58,8 +58,168 @@ class CfgPlane:
58
58
  class CfgModeler:
59
59
  """Manage configuration general settings."""
60
60
 
61
+ class Grpc:
62
+ def __init__(self, parent):
63
+ self.parent = parent
64
+ self._pedb = parent._pedb
65
+
66
+ def set_parameter_to_edb(self):
67
+ from ansys.edb.core.definition.padstack_def import (
68
+ PadstackDef as GrpcPadstackDef,
69
+ )
70
+ from ansys.edb.core.definition.padstack_def_data import (
71
+ PadstackDefData as GrpcPadstackDefData,
72
+ )
73
+
74
+ from pyedb.grpc.database.definition.padstack_def import PadstackDef
75
+
76
+ if self.parent.traces:
77
+ for t in self.parent.traces:
78
+ obj = self._pedb.modeler.create_trace(
79
+ path_list=t.path,
80
+ layer_name=t.layer,
81
+ net_name=t.net_name,
82
+ width=t.width,
83
+ start_cap_style=t.start_cap_style,
84
+ end_cap_style=t.end_cap_style,
85
+ corner_style=t.corner_style,
86
+ )
87
+ obj.aedt_name = t.name
88
+
89
+ if self.parent.padstack_defs:
90
+ for p in self.parent.padstack_defs:
91
+ pdata = GrpcPadstackDefData.create()
92
+ pdef = GrpcPadstackDef.create(self._pedb.active_db, p.name)
93
+ pdef.data = pdata
94
+ pdef = PadstackDef(self._pedb, pdef)
95
+ p.pyedb_obj = pdef
96
+ p.api.set_parameters_to_edb()
97
+
98
+ if self.parent.padstack_instances:
99
+ for p in self.parent.padstack_instances:
100
+ p_inst = self._pedb.padstacks.place(
101
+ via_name=p.name,
102
+ net_name=p.net_name,
103
+ position=p.position,
104
+ definition_name=p.definition,
105
+ )
106
+ p.pyedb_obj = p_inst
107
+ p.api.set_parameters_to_edb()
108
+
109
+ if self.parent.planes:
110
+ for p in self.parent.planes:
111
+ if p.type == "rectangle":
112
+ obj = self._pedb.modeler.create_rectangle(
113
+ layer_name=p.layer,
114
+ net_name=p.net_name,
115
+ lower_left_point=p.lower_left_point,
116
+ upper_right_point=p.upper_right_point,
117
+ corner_radius=p.corner_radius,
118
+ rotation=p.rotation,
119
+ )
120
+ obj.aedt_name = p.name
121
+ elif p.type == "polygon":
122
+ obj = self._pedb.modeler.create_polygon(
123
+ points=p.points, layer_name=p.layer, net_name=p.net_name
124
+ )
125
+ obj.aedt_name = p.name
126
+
127
+ for v in p.voids:
128
+ for i in self._pedb.layout.primitives:
129
+ if i.aedt_name == v:
130
+ self._pedb.modeler.add_void(obj, i)
131
+
132
+ if self.parent.components:
133
+ pedb_p_inst = self._pedb.padstacks.instances_by_name
134
+ for c in self.parent.components:
135
+ obj = self._pedb.components.create(
136
+ [pedb_p_inst[i] for i in c.pins],
137
+ component_name=c.reference_designator,
138
+ placement_layer=c.placement_layer,
139
+ component_part_name=c.definition,
140
+ )
141
+ c.pyedb_obj = obj
142
+ c.api.set_parameters_to_edb()
143
+
144
+ class DotNet(Grpc):
145
+ def __init__(self, parent):
146
+ super().__init__(parent)
147
+
148
+ def set_parameter_to_edb(self):
149
+ if self.parent.traces:
150
+ for t in self.parent.traces:
151
+ obj = self._pedb.modeler.create_trace(
152
+ path_list=t.path,
153
+ layer_name=t.layer,
154
+ net_name=t.net_name,
155
+ width=t.width,
156
+ start_cap_style=t.start_cap_style,
157
+ end_cap_style=t.end_cap_style,
158
+ corner_style=t.corner_style,
159
+ )
160
+ obj.aedt_name = t.name
161
+
162
+ if self.parent.padstack_defs:
163
+ for p in self.parent.padstack_defs:
164
+ pdata = self._pedb._edb.Definition.PadstackDefData.Create()
165
+ pdef = self._pedb._edb.Definition.PadstackDef.Create(self._pedb.active_db, p.name)
166
+ pdef.SetData(pdata)
167
+ pdef = EDBPadstack(pdef, self._pedb.padstacks)
168
+ p.pyedb_obj = pdef
169
+ p.api.set_parameters_to_edb()
170
+
171
+ if self.parent.padstack_instances:
172
+ for p in self.parent.padstack_instances:
173
+ p_inst = self._pedb.padstacks.place(
174
+ via_name=p.name,
175
+ net_name=p.net_name,
176
+ position=p.position,
177
+ definition_name=p.definition,
178
+ )
179
+ p.pyedb_obj = p_inst
180
+ p.api.set_parameters_to_edb()
181
+
182
+ if self.parent.planes:
183
+ for p in self.parent.planes:
184
+ if p.type == "rectangle":
185
+ obj = self._pedb.modeler.create_rectangle(
186
+ layer_name=p.layer,
187
+ net_name=p.net_name,
188
+ lower_left_point=p.lower_left_point,
189
+ upper_right_point=p.upper_right_point,
190
+ corner_radius=p.corner_radius,
191
+ rotation=p.rotation,
192
+ )
193
+ obj.aedt_name = p.name
194
+ elif p.type == "polygon":
195
+ obj = self._pedb.modeler.create_polygon(
196
+ main_shape=p.points, layer_name=p.layer, net_name=p.net_name
197
+ )
198
+ obj.aedt_name = p.name
199
+
200
+ for v in p.voids:
201
+ for i in self._pedb.layout.primitives:
202
+ if i.aedt_name == v:
203
+ self._pedb.modeler.add_void(obj, i)
204
+
205
+ if self.parent.components:
206
+ pedb_p_inst = self._pedb.padstacks.instances_by_name
207
+ for c in self.parent.components:
208
+ obj = self._pedb.components.create(
209
+ [pedb_p_inst[i] for i in c.pins],
210
+ component_name=c.reference_designator,
211
+ placement_layer=c.placement_layer,
212
+ component_part_name=c.definition,
213
+ )
214
+ c.pyedb_obj = obj
215
+ c.api.set_parameters_to_edb()
216
+
61
217
  def __init__(self, pedb, data):
62
218
  self._pedb = pedb
219
+ if self._pedb.grpc:
220
+ self.api = self.Grpc(self)
221
+ else:
222
+ self.api = self.DotNet(self)
63
223
  self.traces = [CfgTrace(**i) for i in data.get("traces", [])]
64
224
  self.padstack_defs = [
65
225
  CfgPadstackDefinition(self._pedb, None, **i) for i in data.get("padstack_definitions", [])
@@ -71,70 +231,4 @@ class CfgModeler:
71
231
  self.components = [CfgComponent(self._pedb, None, **i) for i in data.get("components", [])]
72
232
 
73
233
  def apply(self):
74
- if self.traces:
75
- for t in self.traces:
76
- obj = self._pedb.modeler.create_trace(
77
- path_list=t.path,
78
- layer_name=t.layer,
79
- net_name=t.net_name,
80
- width=t.width,
81
- start_cap_style=t.start_cap_style,
82
- end_cap_style=t.end_cap_style,
83
- corner_style=t.corner_style,
84
- )
85
- obj.aedt_name = t.name
86
-
87
- if self.padstack_defs:
88
- for p in self.padstack_defs:
89
- pdata = self._pedb._edb.Definition.PadstackDefData.Create()
90
- pdef = self._pedb._edb.Definition.PadstackDef.Create(self._pedb.active_db, p.name)
91
- pdef.SetData(pdata)
92
- pdef = EDBPadstack(pdef, self._pedb.padstacks)
93
- p.pyedb_obj = pdef
94
- p.api.set_parameters_to_edb()
95
-
96
- if self.padstack_instances:
97
- for p in self.padstack_instances:
98
- p_inst = self._pedb.padstacks.place(
99
- via_name=p.name,
100
- net_name=p.net_name,
101
- position=p.position,
102
- definition_name=p.definition,
103
- )
104
- p.pyedb_obj = p_inst
105
- p.api.set_parameters_to_edb()
106
-
107
- if self.planes:
108
- for p in self.planes:
109
- if p.type == "rectangle":
110
- obj = self._pedb.modeler.create_rectangle(
111
- layer_name=p.layer,
112
- net_name=p.net_name,
113
- lower_left_point=p.lower_left_point,
114
- upper_right_point=p.upper_right_point,
115
- corner_radius=p.corner_radius,
116
- rotation=p.rotation,
117
- )
118
- obj.aedt_name = p.name
119
- elif p.type == "polygon":
120
- obj = self._pedb.modeler.create_polygon(
121
- main_shape=p.points, layer_name=p.layer, net_name=p.net_name
122
- )
123
- obj.aedt_name = p.name
124
-
125
- for v in p.voids:
126
- for i in self._pedb.layout.primitives:
127
- if i.aedt_name == v:
128
- self._pedb.modeler.add_void(obj, i)
129
-
130
- if self.components:
131
- pedb_p_inst = self._pedb.padstacks.instances_by_name
132
- for c in self.components:
133
- obj = self._pedb.components.create(
134
- [pedb_p_inst[i] for i in c.pins],
135
- component_name=c.reference_designator,
136
- placement_layer=c.placement_layer,
137
- component_part_name=c.definition,
138
- )
139
- c.pyedb_obj = obj
140
- c.api.set_parameters_to_edb()
234
+ self.api.set_parameter_to_edb()
@@ -24,8 +24,39 @@
24
24
  class CfgNets:
25
25
  """Manage configuration net class."""
26
26
 
27
+ class Grpc:
28
+ def __init__(self, parent):
29
+ self.parent = parent
30
+ self._pedb = parent._pedb
31
+
32
+ def set_parameter_to_edb(self):
33
+ for signal_net in self.parent.signal_nets:
34
+ if signal_net in self._pedb.nets:
35
+ self._pedb.nets.nets[signal_net].is_power_ground = False
36
+ for power_net in self.parent.power_nets:
37
+ if power_net in self._pedb.nets:
38
+ self._pedb.nets.nets[power_net].is_power_ground = True
39
+
40
+ def get_parameter_from_edb(self):
41
+ """Get net information."""
42
+ for net in self._pedb.nets.signal:
43
+ self.parent.signal_nets.append(net)
44
+ for net in self._pedb.nets.power:
45
+ self.parent.power_nets.append(net)
46
+ data = {"signal_nets": self.parent.signal_nets, "power_ground_nets": self.parent.power_nets}
47
+ return data
48
+
49
+ class DotNet(Grpc):
50
+ def __init__(self, parent):
51
+ self.parent = parent
52
+ super().__init__(parent)
53
+
27
54
  def __init__(self, pdata, signal_nets=None, power_nets=None):
28
55
  self._pedb = pdata._pedb
56
+ if self._pedb.grpc:
57
+ self.api = self.Grpc(self)
58
+ else:
59
+ self.api = self.DotNet(self)
29
60
  self.signal_nets = []
30
61
  self.power_nets = []
31
62
  if signal_nets:
@@ -35,23 +66,8 @@ class CfgNets:
35
66
 
36
67
  def apply(self):
37
68
  """Apply net on layout."""
38
- for signal_net in self.signal_nets:
39
- if signal_net in self._pedb.nets:
40
- self._pedb.nets.nets[signal_net].is_power_ground = False
41
- for power_net in self.power_nets:
42
- if power_net in self._pedb.nets:
43
- self._pedb.nets.nets[power_net].is_power_ground = True
44
-
45
- def _load_data_from_db(self):
46
- self.signal_nets = []
47
- self.power_nets = []
48
- for net in self._pedb.nets.signal:
49
- self.signal_nets.append(net)
50
- for net in self._pedb.nets.power:
51
- self.power_nets.append(net)
69
+ self.api.set_parameter_to_edb()
52
70
 
53
71
  def get_data_from_db(self):
54
72
  """Get net information."""
55
- self._load_data_from_db()
56
- data = {"signal_nets": self.signal_nets, "power_ground_nets": self.power_nets}
57
- return data
73
+ return self.api.get_parameter_from_edb()