pyedb 0.9.0__py3-none-any.whl → 0.10.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 +1 -1
- pyedb/configuration/__init__.py +0 -0
- pyedb/configuration/cfg_data.py +45 -0
- pyedb/configuration/cfg_ports.py +149 -0
- pyedb/{dotnet/edb_core → configuration}/configuration.py +68 -32
- pyedb/dotnet/edb.py +4 -3
- pyedb/dotnet/edb_core/components.py +19 -8
- pyedb/dotnet/edb_core/edb_data/hfss_simulation_setup_data.py +4 -0
- pyedb/dotnet/edb_core/edb_data/layer_data.py +164 -62
- pyedb/dotnet/edb_core/edb_data/simulation_configuration.py +49 -0
- pyedb/dotnet/edb_core/hfss.py +29 -11
- pyedb/dotnet/edb_core/materials.py +73 -81
- pyedb/dotnet/edb_core/stackup.py +289 -84
- {pyedb-0.9.0.dist-info → pyedb-0.10.0.dist-info}/METADATA +5 -5
- {pyedb-0.9.0.dist-info → pyedb-0.10.0.dist-info}/RECORD +17 -14
- {pyedb-0.9.0.dist-info → pyedb-0.10.0.dist-info}/LICENSE +0 -0
- {pyedb-0.9.0.dist-info → pyedb-0.10.0.dist-info}/WHEEL +0 -0
|
@@ -131,9 +131,8 @@ class Material(object):
|
|
|
131
131
|
@property
|
|
132
132
|
def conductivity(self):
|
|
133
133
|
"""Get material conductivity."""
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
self.__properties.conductivity = self.__property_value(material_property_id)
|
|
134
|
+
material_property_id = self.__edb_definition.MaterialPropertyId.Conductivity
|
|
135
|
+
self.__properties.conductivity = self.__property_value(material_property_id)
|
|
137
136
|
return self.__properties.conductivity
|
|
138
137
|
|
|
139
138
|
@conductivity.setter
|
|
@@ -141,15 +140,13 @@ class Material(object):
|
|
|
141
140
|
"""Set material conductivity."""
|
|
142
141
|
edb_value = self.__edb_value(value)
|
|
143
142
|
material_property_id = self.__edb_definition.MaterialPropertyId.Conductivity
|
|
144
|
-
self.__material_def.SetProperty(material_property_id,
|
|
145
|
-
self.__properties.conductivity = edb_value.ToDouble()
|
|
143
|
+
self.__material_def.SetProperty(material_property_id, edb_value)
|
|
146
144
|
|
|
147
145
|
@property
|
|
148
146
|
def permittivity(self):
|
|
149
147
|
"""Get material permittivity."""
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
self.__properties.permittivity = self.__property_value(material_property_id)
|
|
148
|
+
material_property_id = self.__edb_definition.MaterialPropertyId.Permittivity
|
|
149
|
+
self.__properties.permittivity = self.__property_value(material_property_id)
|
|
153
150
|
return self.__properties.permittivity
|
|
154
151
|
|
|
155
152
|
@permittivity.setter
|
|
@@ -158,14 +155,12 @@ class Material(object):
|
|
|
158
155
|
edb_value = self.__edb_value(value)
|
|
159
156
|
material_property_id = self.__edb_definition.MaterialPropertyId.Permittivity
|
|
160
157
|
self.__material_def.SetProperty(material_property_id, edb_value)
|
|
161
|
-
self.__properties.permittivity = edb_value.ToDouble()
|
|
162
158
|
|
|
163
159
|
@property
|
|
164
160
|
def permeability(self):
|
|
165
161
|
"""Get material permeability."""
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
self.__properties.permeability = self.__property_value(material_property_id)
|
|
162
|
+
material_property_id = self.__edb_definition.MaterialPropertyId.Permeability
|
|
163
|
+
self.__properties.permeability = self.__property_value(material_property_id)
|
|
169
164
|
return self.__properties.permeability
|
|
170
165
|
|
|
171
166
|
@permeability.setter
|
|
@@ -174,7 +169,6 @@ class Material(object):
|
|
|
174
169
|
edb_value = self.__edb_value(value)
|
|
175
170
|
material_property_id = self.__edb_definition.MaterialPropertyId.Permeability
|
|
176
171
|
self.__material_def.SetProperty(material_property_id, edb_value)
|
|
177
|
-
self.__properties.permeability = edb_value.ToDouble()
|
|
178
172
|
|
|
179
173
|
@property
|
|
180
174
|
def loss_tangent(self):
|
|
@@ -184,15 +178,13 @@ class Material(object):
|
|
|
184
178
|
"Use property dielectric_loss_tangent instead.",
|
|
185
179
|
DeprecationWarning,
|
|
186
180
|
)
|
|
187
|
-
|
|
188
181
|
return self.dielectric_loss_tangent
|
|
189
182
|
|
|
190
183
|
@property
|
|
191
184
|
def dielectric_loss_tangent(self):
|
|
192
185
|
"""Get material loss tangent."""
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
self.__properties.dielectric_loss_tangent = self.__property_value(material_property_id)
|
|
186
|
+
material_property_id = self.__edb_definition.MaterialPropertyId.DielectricLossTangent
|
|
187
|
+
self.__properties.dielectric_loss_tangent = self.__property_value(material_property_id)
|
|
196
188
|
return self.__properties.dielectric_loss_tangent
|
|
197
189
|
|
|
198
190
|
@loss_tangent.setter
|
|
@@ -203,7 +195,6 @@ class Material(object):
|
|
|
203
195
|
"Use property dielectric_loss_tangent instead.",
|
|
204
196
|
DeprecationWarning,
|
|
205
197
|
)
|
|
206
|
-
|
|
207
198
|
return self.dielectric_loss_tangent(value)
|
|
208
199
|
|
|
209
200
|
@dielectric_loss_tangent.setter
|
|
@@ -212,12 +203,11 @@ class Material(object):
|
|
|
212
203
|
edb_value = self.__edb_value(value)
|
|
213
204
|
material_property_id = self.__edb_definition.MaterialPropertyId.DielectricLossTangent
|
|
214
205
|
self.__material_def.SetProperty(material_property_id, edb_value)
|
|
215
|
-
self.__properties.dielectric_loss_tangent = edb_value.ToDouble()
|
|
216
206
|
|
|
217
207
|
@property
|
|
218
208
|
def dc_conductivity(self):
|
|
219
209
|
"""Get material dielectric conductivity."""
|
|
220
|
-
if self.__dc_model
|
|
210
|
+
if self.__dc_model:
|
|
221
211
|
self.__properties.dc_conductivity = self.__dc_model.GetDCConductivity()
|
|
222
212
|
return self.__properties.dc_conductivity
|
|
223
213
|
|
|
@@ -226,12 +216,13 @@ class Material(object):
|
|
|
226
216
|
"""Set material dielectric conductivity."""
|
|
227
217
|
if self.__dc_model:
|
|
228
218
|
self.__dc_model.SetDCConductivity(value)
|
|
229
|
-
|
|
219
|
+
else:
|
|
220
|
+
self.__edb.logger.error(f"DC conductivity cannot be updated in material without DC model.")
|
|
230
221
|
|
|
231
222
|
@property
|
|
232
223
|
def dc_permittivity(self):
|
|
233
224
|
"""Get material dielectric relative permittivity"""
|
|
234
|
-
if self.__dc_model
|
|
225
|
+
if self.__dc_model:
|
|
235
226
|
self.__properties.dc_permittivity = self.__dc_model.GetDCRelativePermitivity()
|
|
236
227
|
return self.__properties.dc_permittivity
|
|
237
228
|
|
|
@@ -240,12 +231,13 @@ class Material(object):
|
|
|
240
231
|
"""Set material dielectric relative permittivity"""
|
|
241
232
|
if self.__dc_model:
|
|
242
233
|
self.__dc_model.SetDCRelativePermitivity(value)
|
|
243
|
-
|
|
234
|
+
else:
|
|
235
|
+
self.__edb.logger.error(f"DC permittivity cannot be updated in material without DC model.")
|
|
244
236
|
|
|
245
237
|
@property
|
|
246
238
|
def dielectric_model_frequency(self):
|
|
247
239
|
"""Get material frequency in GHz."""
|
|
248
|
-
if self.__dc_model
|
|
240
|
+
if self.__dc_model:
|
|
249
241
|
self.__properties.dielectric_model_frequency = self.__dc_model.GetFrequency()
|
|
250
242
|
return self.__properties.dielectric_model_frequency
|
|
251
243
|
|
|
@@ -254,27 +246,29 @@ class Material(object):
|
|
|
254
246
|
"""Get material frequency in GHz."""
|
|
255
247
|
if self.__dc_model:
|
|
256
248
|
self.__dc_model.SetFrequency(value)
|
|
257
|
-
|
|
249
|
+
else:
|
|
250
|
+
self.__edb.logger.error(f"Material frequency cannot be updated in material without DC model.")
|
|
258
251
|
|
|
259
252
|
@property
|
|
260
253
|
def loss_tangent_at_frequency(self):
|
|
261
254
|
"""Get material loss tangeat at frequency."""
|
|
262
|
-
if self.__dc_model
|
|
255
|
+
if self.__dc_model:
|
|
263
256
|
self.__properties.loss_tangent_at_frequency = self.__dc_model.GetLossTangentAtFrequency()
|
|
264
257
|
return self.__properties.loss_tangent_at_frequency
|
|
265
258
|
|
|
266
259
|
@loss_tangent_at_frequency.setter
|
|
267
260
|
def loss_tangent_at_frequency(self, value):
|
|
268
|
-
"""Set material loss
|
|
261
|
+
"""Set material loss tangent at frequency."""
|
|
269
262
|
if self.__dc_model:
|
|
270
263
|
edb_value = self.__edb_value(value)
|
|
271
264
|
self.__dc_model.SetLossTangentAtFrequency(edb_value)
|
|
272
|
-
|
|
265
|
+
else:
|
|
266
|
+
self.__edb.logger.error(f"Loss tangent at frequency cannot be updated in material without DC model.")
|
|
273
267
|
|
|
274
268
|
@property
|
|
275
269
|
def permittivity_at_frequency(self):
|
|
276
270
|
"""Get material relative permittivity at frequency."""
|
|
277
|
-
if self.__dc_model
|
|
271
|
+
if self.__dc_model:
|
|
278
272
|
self.__properties.permittivity_at_frequency = self.__dc_model.GetRelativePermitivityAtFrequency()
|
|
279
273
|
return self.__properties.permittivity_at_frequency
|
|
280
274
|
|
|
@@ -283,14 +277,14 @@ class Material(object):
|
|
|
283
277
|
"""Set material relative permittivity at frequency."""
|
|
284
278
|
if self.__dc_model:
|
|
285
279
|
self.__dc_model.SetRelativePermitivityAtFrequency(value)
|
|
286
|
-
|
|
280
|
+
else:
|
|
281
|
+
self.__edb.logger.error(f"Permittivity at frequency cannot be updated in material without DC model.")
|
|
287
282
|
|
|
288
283
|
@property
|
|
289
284
|
def magnetic_loss_tangent(self):
|
|
290
285
|
"""Get material magnetic loss tangent."""
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
self.__properties.magnetic_loss_tangent = self.__property_value(material_property_id)
|
|
286
|
+
material_property_id = self.__edb_definition.MaterialPropertyId.MagneticLossTangent
|
|
287
|
+
self.__properties.magnetic_loss_tangent = self.__property_value(material_property_id)
|
|
294
288
|
return self.__properties.magnetic_loss_tangent
|
|
295
289
|
|
|
296
290
|
@magnetic_loss_tangent.setter
|
|
@@ -299,14 +293,12 @@ class Material(object):
|
|
|
299
293
|
edb_value = self.__edb_value(value)
|
|
300
294
|
material_property_id = self.__edb_definition.MaterialPropertyId.MagneticLossTangent
|
|
301
295
|
self.__material_def.SetProperty(material_property_id, edb_value)
|
|
302
|
-
self.__properties.magnetic_loss_tangent = edb_value.ToDouble()
|
|
303
296
|
|
|
304
297
|
@property
|
|
305
298
|
def thermal_conductivity(self):
|
|
306
299
|
"""Get material thermal conductivity."""
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
self.__properties.thermal_conductivity = self.__property_value(material_property_id)
|
|
300
|
+
material_property_id = self.__edb_definition.MaterialPropertyId.ThermalConductivity
|
|
301
|
+
self.__properties.thermal_conductivity = self.__property_value(material_property_id)
|
|
310
302
|
return self.__properties.thermal_conductivity
|
|
311
303
|
|
|
312
304
|
@thermal_conductivity.setter
|
|
@@ -315,14 +307,12 @@ class Material(object):
|
|
|
315
307
|
edb_value = self.__edb_value(value)
|
|
316
308
|
material_property_id = self.__edb_definition.MaterialPropertyId.ThermalConductivity
|
|
317
309
|
self.__material_def.SetProperty(material_property_id, edb_value)
|
|
318
|
-
self.__properties.thermal_conductivity = edb_value.ToDouble()
|
|
319
310
|
|
|
320
311
|
@property
|
|
321
312
|
def mass_density(self):
|
|
322
313
|
"""Get material mass density."""
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
self.__properties.mass_density = self.__property_value(material_property_id)
|
|
314
|
+
material_property_id = self.__edb_definition.MaterialPropertyId.MassDensity
|
|
315
|
+
self.__properties.mass_density = self.__property_value(material_property_id)
|
|
326
316
|
return self.__properties.mass_density
|
|
327
317
|
|
|
328
318
|
@mass_density.setter
|
|
@@ -331,14 +321,12 @@ class Material(object):
|
|
|
331
321
|
edb_value = self.__edb_value(value)
|
|
332
322
|
material_property_id = self.__edb_definition.MaterialPropertyId.MassDensity
|
|
333
323
|
self.__material_def.SetProperty(material_property_id, edb_value)
|
|
334
|
-
self.__properties.mass_density = edb_value.ToDouble()
|
|
335
324
|
|
|
336
325
|
@property
|
|
337
326
|
def youngs_modulus(self):
|
|
338
327
|
"""Get material youngs modulus."""
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
self.__properties.youngs_modulus = self.__property_value(material_property_id)
|
|
328
|
+
material_property_id = self.__edb_definition.MaterialPropertyId.YoungsModulus
|
|
329
|
+
self.__properties.youngs_modulus = self.__property_value(material_property_id)
|
|
342
330
|
return self.__properties.youngs_modulus
|
|
343
331
|
|
|
344
332
|
@youngs_modulus.setter
|
|
@@ -347,14 +335,12 @@ class Material(object):
|
|
|
347
335
|
edb_value = self.__edb_value(value)
|
|
348
336
|
material_property_id = self.__edb_definition.MaterialPropertyId.YoungsModulus
|
|
349
337
|
self.__material_def.SetProperty(material_property_id, edb_value)
|
|
350
|
-
self.__properties.youngs_modulus = edb_value.ToDouble()
|
|
351
338
|
|
|
352
339
|
@property
|
|
353
340
|
def specific_heat(self):
|
|
354
341
|
"""Get material specific heat."""
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
self.__properties.specific_heat = self.__property_value(material_property_id)
|
|
342
|
+
material_property_id = self.__edb_definition.MaterialPropertyId.SpecificHeat
|
|
343
|
+
self.__properties.specific_heat = self.__property_value(material_property_id)
|
|
358
344
|
return self.__properties.specific_heat
|
|
359
345
|
|
|
360
346
|
@specific_heat.setter
|
|
@@ -363,14 +349,12 @@ class Material(object):
|
|
|
363
349
|
edb_value = self.__edb_value(value)
|
|
364
350
|
material_property_id = self.__edb_definition.MaterialPropertyId.SpecificHeat
|
|
365
351
|
self.__material_def.SetProperty(material_property_id, edb_value)
|
|
366
|
-
self.__properties.specific_heat = edb_value.ToDouble()
|
|
367
352
|
|
|
368
353
|
@property
|
|
369
354
|
def poisson_ratio(self):
|
|
370
355
|
"""Get material poisson ratio."""
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
self.__properties.poisson_ratio = self.__property_value(material_property_id)
|
|
356
|
+
material_property_id = self.__edb_definition.MaterialPropertyId.PoissonsRatio
|
|
357
|
+
self.__properties.poisson_ratio = self.__property_value(material_property_id)
|
|
374
358
|
return self.__properties.poisson_ratio
|
|
375
359
|
|
|
376
360
|
@poisson_ratio.setter
|
|
@@ -379,14 +363,12 @@ class Material(object):
|
|
|
379
363
|
edb_value = self.__edb_value(value)
|
|
380
364
|
material_property_id = self.__edb_definition.MaterialPropertyId.PoissonsRatio
|
|
381
365
|
self.__material_def.SetProperty(material_property_id, edb_value)
|
|
382
|
-
self.__properties.poisson_ratio = edb_value.ToDouble()
|
|
383
366
|
|
|
384
367
|
@property
|
|
385
368
|
def thermal_expansion_coefficient(self):
|
|
386
369
|
"""Get material thermal coefficient."""
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
self.__properties.thermal_expansion_coefficient = self.__property_value(material_property_id)
|
|
370
|
+
material_property_id = self.__edb_definition.MaterialPropertyId.ThermalExpansionCoefficient
|
|
371
|
+
self.__properties.thermal_expansion_coefficient = self.__property_value(material_property_id)
|
|
390
372
|
return self.__properties.thermal_expansion_coefficient
|
|
391
373
|
|
|
392
374
|
@thermal_expansion_coefficient.setter
|
|
@@ -394,8 +376,7 @@ class Material(object):
|
|
|
394
376
|
"""Set material thermal coefficient."""
|
|
395
377
|
edb_value = self.__edb_value(value)
|
|
396
378
|
material_property_id = self.__edb_definition.MaterialPropertyId.ThermalExpansionCoefficient
|
|
397
|
-
self.__material_def.SetProperty(material_property_id,
|
|
398
|
-
self.__properties.thermal_expansion_coefficient = edb_value.ToDouble()
|
|
379
|
+
self.__material_def.SetProperty(material_property_id, edb_value)
|
|
399
380
|
|
|
400
381
|
@pyedb_function_handler()
|
|
401
382
|
def to_dict(self):
|
|
@@ -482,19 +463,15 @@ class Materials(object):
|
|
|
482
463
|
self.__edb = edb
|
|
483
464
|
self.__edb_definition = edb.edb_api.definition
|
|
484
465
|
self.__syslib = os.path.join(self.__edb.base_path, "syslib")
|
|
485
|
-
self.__materials: dict[str, Material] = {
|
|
486
|
-
material_def.GetName(): Material(self.__edb, material_def)
|
|
487
|
-
for material_def in list(self.__edb.active_db.MaterialDefs)
|
|
488
|
-
}
|
|
489
466
|
|
|
490
467
|
def __contains__(self, item):
|
|
491
468
|
if isinstance(item, Material):
|
|
492
|
-
return item.name in self.
|
|
469
|
+
return item.name in self.materials
|
|
493
470
|
else:
|
|
494
|
-
return item in self.
|
|
471
|
+
return item in self.materials
|
|
495
472
|
|
|
496
473
|
def __getitem__(self, item):
|
|
497
|
-
return self.
|
|
474
|
+
return self.materials[item]
|
|
498
475
|
|
|
499
476
|
@property
|
|
500
477
|
def syslib(self):
|
|
@@ -504,7 +481,11 @@ class Materials(object):
|
|
|
504
481
|
@property
|
|
505
482
|
def materials(self):
|
|
506
483
|
"""Get materials."""
|
|
507
|
-
|
|
484
|
+
materials = {
|
|
485
|
+
material_def.GetName(): Material(self.__edb, material_def)
|
|
486
|
+
for material_def in list(self.__edb.active_db.MaterialDefs)
|
|
487
|
+
}
|
|
488
|
+
return materials
|
|
508
489
|
|
|
509
490
|
def __edb_value(self, value):
|
|
510
491
|
"""Convert a value to an EDB value.
|
|
@@ -528,8 +509,11 @@ class Materials(object):
|
|
|
528
509
|
-------
|
|
529
510
|
:class:`pyedb.dotnet.edb_core.materials.Material`
|
|
530
511
|
"""
|
|
531
|
-
|
|
512
|
+
curr_materials = self.materials
|
|
513
|
+
if name in curr_materials:
|
|
532
514
|
raise ValueError(f"Material {name} already exists in material library.")
|
|
515
|
+
elif name.lower() in (material.lower() for material in curr_materials):
|
|
516
|
+
raise ValueError(f"Material names are case-insensitive and {name.lower()} already exists.")
|
|
533
517
|
|
|
534
518
|
material_def = self.__edb_definition.MaterialDef.Create(self.__edb.active_db, name)
|
|
535
519
|
material = Material(self.__edb, material_def)
|
|
@@ -544,7 +528,6 @@ class Materials(object):
|
|
|
544
528
|
if attributes_input_dict:
|
|
545
529
|
material.update(attributes_input_dict)
|
|
546
530
|
|
|
547
|
-
self.__materials[name] = material
|
|
548
531
|
return material
|
|
549
532
|
|
|
550
533
|
@pyedb_function_handler()
|
|
@@ -621,8 +604,11 @@ class Materials(object):
|
|
|
621
604
|
-------
|
|
622
605
|
:class:`pyedb.dotnet.edb_core.materials.Material`
|
|
623
606
|
"""
|
|
624
|
-
|
|
607
|
+
curr_materials = self.materials
|
|
608
|
+
if name in curr_materials:
|
|
625
609
|
raise ValueError(f"Material {name} already exists in material library.")
|
|
610
|
+
elif name.lower() in (material.lower() for material in curr_materials):
|
|
611
|
+
raise ValueError(f"Material names are case-insensitive and {name.lower()} already exists.")
|
|
626
612
|
|
|
627
613
|
material_model = self.__edb_definition.DjordjecvicSarkarModel()
|
|
628
614
|
material_model.SetRelativePermitivityAtFrequency(permittivity_at_frequency)
|
|
@@ -644,7 +630,6 @@ class Materials(object):
|
|
|
644
630
|
DeprecationWarning,
|
|
645
631
|
)
|
|
646
632
|
setattr(material, "dielectric_loss_tangent", kwargs["loss_tangent"])
|
|
647
|
-
self.__materials[name] = material
|
|
648
633
|
return material
|
|
649
634
|
except MaterialModelException:
|
|
650
635
|
raise ValueError("Use realistic values to define DS model.")
|
|
@@ -688,8 +673,11 @@ class Materials(object):
|
|
|
688
673
|
-------
|
|
689
674
|
:class:`pyedb.dotnet.edb_core.materials.Material`
|
|
690
675
|
"""
|
|
691
|
-
|
|
676
|
+
curr_materials = self.materials
|
|
677
|
+
if name in curr_materials:
|
|
692
678
|
raise ValueError(f"Material {name} already exists in material library.")
|
|
679
|
+
elif name.lower() in (material.lower() for material in curr_materials):
|
|
680
|
+
raise ValueError(f"Material names are case-insensitive and {name.lower()} already exists.")
|
|
693
681
|
|
|
694
682
|
material_model = self.__edb_definition.DebyeModel()
|
|
695
683
|
# FIXME: Seems like there is a bug here (we need to provide higher value for
|
|
@@ -710,7 +698,6 @@ class Materials(object):
|
|
|
710
698
|
DeprecationWarning,
|
|
711
699
|
)
|
|
712
700
|
setattr(material, "dielectric_loss_tangent", kwargs["loss_tangent"])
|
|
713
|
-
self.__materials[name] = material
|
|
714
701
|
return material
|
|
715
702
|
except MaterialModelException:
|
|
716
703
|
raise ValueError("Use realistic values to define Debye model.")
|
|
@@ -750,8 +737,11 @@ class Materials(object):
|
|
|
750
737
|
>>> loss_tan = [0.025, 0.026, 0.027, 0.028, 0.029, 0.030]
|
|
751
738
|
>>> diel = edb.materials.add_multipole_debye_material("My_MP_Debye", freq, rel_perm, loss_tan)
|
|
752
739
|
"""
|
|
753
|
-
|
|
740
|
+
curr_materials = self.materials
|
|
741
|
+
if name in curr_materials:
|
|
754
742
|
raise ValueError(f"Material {name} already exists in material library.")
|
|
743
|
+
elif name.lower() in (material.lower() for material in curr_materials):
|
|
744
|
+
raise ValueError(f"Material names are case-insensitive and {name.lower()} already exists.")
|
|
755
745
|
|
|
756
746
|
frequencies = [float(i) for i in frequencies]
|
|
757
747
|
permittivities = [float(i) for i in permittivities]
|
|
@@ -773,7 +763,6 @@ class Materials(object):
|
|
|
773
763
|
DeprecationWarning,
|
|
774
764
|
)
|
|
775
765
|
setattr(material, "dielectric_loss_tangent", kwargs["loss_tangent"])
|
|
776
|
-
self.__materials[name] = material
|
|
777
766
|
return material
|
|
778
767
|
except MaterialModelException:
|
|
779
768
|
raise ValueError("Use realistic values to define Multipole Debye model.")
|
|
@@ -790,7 +779,10 @@ class Materials(object):
|
|
|
790
779
|
Dielectric material model.
|
|
791
780
|
"""
|
|
792
781
|
if self.__edb_definition.MaterialDef.FindByName(self.__edb.active_db, name).IsNull():
|
|
782
|
+
if name.lower() in (material.lower() for material in self.materials):
|
|
783
|
+
raise ValueError(f"Material names are case-insensitive and {name.lower()} already exists.")
|
|
793
784
|
self.__edb_definition.MaterialDef.Create(self.__edb.active_db, name)
|
|
785
|
+
|
|
794
786
|
material_def = self.__edb_definition.MaterialDef.FindByName(self.__edb.active_db, name)
|
|
795
787
|
succeeded = material_def.SetDielectricMaterialModel(material_model)
|
|
796
788
|
if succeeded:
|
|
@@ -813,8 +805,11 @@ class Materials(object):
|
|
|
813
805
|
-------
|
|
814
806
|
:class:`pyedb.dotnet.edb_core.materials.Material`
|
|
815
807
|
"""
|
|
816
|
-
|
|
808
|
+
curr_materials = self.materials
|
|
809
|
+
if new_material_name in curr_materials:
|
|
817
810
|
raise ValueError(f"Material {new_material_name} already exists in material library.")
|
|
811
|
+
elif new_material_name.lower() in (material.lower() for material in curr_materials):
|
|
812
|
+
raise ValueError(f"Material names are case-insensitive and {new_material_name.lower()} already exists.")
|
|
818
813
|
|
|
819
814
|
material = self.materials[material_name]
|
|
820
815
|
material_def = self.__edb_definition.MaterialDef.Create(self.__edb.active_db, new_material_name)
|
|
@@ -822,7 +817,6 @@ class Materials(object):
|
|
|
822
817
|
new_material = Material(self.__edb, material_def)
|
|
823
818
|
new_material.update(material_dict)
|
|
824
819
|
|
|
825
|
-
self.__materials[new_material_name] = new_material
|
|
826
820
|
return new_material
|
|
827
821
|
|
|
828
822
|
@pyedb_function_handler()
|
|
@@ -832,12 +826,11 @@ class Materials(object):
|
|
|
832
826
|
if material_def.IsNull():
|
|
833
827
|
raise ValueError(f"Cannot find material {material_name}.")
|
|
834
828
|
material_def.Delete()
|
|
835
|
-
del self.__materials[material_name]
|
|
836
829
|
|
|
837
830
|
@pyedb_function_handler()
|
|
838
831
|
def update_material(self, material_name, input_dict):
|
|
839
832
|
"""Update material attributes."""
|
|
840
|
-
if material_name not in self.
|
|
833
|
+
if material_name not in self.materials:
|
|
841
834
|
raise ValueError(f"Material {material_name} does not exist in material library.")
|
|
842
835
|
|
|
843
836
|
material = self[material_name]
|
|
@@ -851,11 +844,10 @@ class Materials(object):
|
|
|
851
844
|
attributes_input_dict["dielectric_loss_tangent"] = input_dict["loss_tangent"]
|
|
852
845
|
if attributes_input_dict:
|
|
853
846
|
material.update(attributes_input_dict)
|
|
854
|
-
self.__materials[material_name] = material
|
|
855
847
|
return material
|
|
856
848
|
|
|
857
849
|
@pyedb_function_handler()
|
|
858
|
-
def load_material(self, material):
|
|
850
|
+
def load_material(self, material: dict):
|
|
859
851
|
"""Load material."""
|
|
860
852
|
if material:
|
|
861
853
|
material_name = material["name"]
|