Skip to content

Enhancement props setters and getters #939

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _unittest/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"skip_debug": False,
"local": False,
}
settings.non_graphical = config["NonGraphical"]


class BasisTest(object):
Expand Down Expand Up @@ -107,7 +108,7 @@ def my_teardown(self):

def add_app(self, project_name=None, design_name=None, solution_type=None, application=None):
if "oDesktop" not in dir(sys.modules["__main__"]):
desktop = Desktop(desktop_version, non_graphical, new_thread)
desktop = Desktop(desktop_version, settings.non_graphical, new_thread)
desktop.disable_autosave()
if project_name:
example_project = os.path.join(local_path, "example_models", project_name + ".aedt")
Expand Down Expand Up @@ -170,7 +171,6 @@ def setup(self):
# Define desktopVersion explicitly since this is imported by other modules
desktop_version = config["desktopVersion"]
new_thread = config["NewThread"]
non_graphical = config["NonGraphical"]


@pytest.fixture(scope="session", autouse=True)
Expand Down
8 changes: 8 additions & 0 deletions _unittest/test_28_Maxwell3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ def test_07_setup(self):
Setup.props["MinimumConvergedPasses"] = 1
Setup.props["PercentRefinement"] = 30
Setup.props["Frequency"] = adaptive_frequency
dc_freq = 0.1
stop_freq = 10
count = 1
assert Setup.add_eddy_current_sweep("LinearStep", dc_freq, stop_freq, count, clear=True)
assert isinstance(Setup.props["SweepRanges"]["Subrange"], dict)
assert Setup.add_eddy_current_sweep("LinearCount", dc_freq, stop_freq, count, clear=False)
assert isinstance(Setup.props["SweepRanges"]["Subrange"], list)

assert Setup.update()
assert Setup.enable_expression_cache(["CoreLoss"], "Fields", "Phase='0deg' ", True)
assert Setup.disable()
Expand Down
2 changes: 1 addition & 1 deletion doc/source/API/CoreEdb.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Those classes are the container of Data read from edb file.
EDB_Data.EDBLayers
EDB_Data.EDBPadProperties
EDB_Data.EDBPadstack
EDB_Data.EDBPinInstances
EDB_Data.EDBPadstackInstance
EDB_Data.EDBComponent
EDB_Data.EDBNetsData
EDB_Data.EDBPrimitives
Expand Down
1 change: 0 additions & 1 deletion doc/source/API/Primitives.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ It contains all getter and setter to simplify object manipulation.

Object3d.CircuitComponent
Object3d.CircuitPins
Object3d.ComponentParameters


Objects in Hfss3d Layout
Expand Down
1 change: 0 additions & 1 deletion examples/00-EDB/03_5G_antenna_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ def points(self):
setup = h3d.create_setup()
setup.props["AdaptiveSettings"]["SingleFrequencyDataList"]["AdaptiveFrequencyData"]["AdaptiveFrequency"] = "20GHz"
setup.props["AdaptiveSettings"]["SingleFrequencyDataList"]["AdaptiveFrequencyData"]["MaxPasses"] = 4
setup.update()
h3d.create_linear_count_sweep(
setupname=setup.name,
unit="GHz",
Expand Down
6 changes: 0 additions & 6 deletions examples/01-Modeling-Setup/HFSS_CoordinateSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,13 @@
cs1.props["OriginX"] = 10
cs1.props["OriginY"] = 10
cs1.props["OriginZ"] = 10
cs1.update()

# The pointing vectors can be changed.

ypoint = [0, -1, 0]
cs1.props["YAxisXvec"] = ypoint[0]
cs1.props["YAxisYvec"] = ypoint[1]
cs1.props["YAxisZvec"] = ypoint[2]
cs1.update()

###############################################################################
# Rename the Coordinate System
Expand All @@ -80,7 +78,6 @@
cs1.props["Phi"] = "10deg"
cs1.props["Theta"] = "22deg"
cs1.props["Psi"] = "30deg"
cs1.update()

###############################################################################
# Delete the Coordinate System
Expand Down Expand Up @@ -151,7 +148,6 @@

# The axis can also be changed after the coordinate system is created.
fcs3.props["WhichAxis"] = "X"
fcs3.update()

###############################################################################
# Apply a rotation around the Z axis.
Expand All @@ -162,7 +158,6 @@

# The rotation can also be changed after the coordinate system is created.
fcs4.props["ZRotationAngle"] = "3deg"
fcs4.update()

###############################################################################
# Apply an offset to the X and Y axis of a Face coordinate system
Expand All @@ -175,7 +170,6 @@
# The offset can also be changed after the coordinate system is created.
fcs5.props["XOffset"] = "0.2mm"
fcs5.props["YOffset"] = "0.1mm"
fcs5.update()

###############################################################################
# Create a coordinate system relative to a Face coordinate system
Expand Down
1 change: 0 additions & 1 deletion examples/02-HFSS/Flex_CPWG.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ def create_bending(radius, extension=0):
setup.props["Frequency"] = "2GHz"
setup.props["MaximumPasses"] = 10
setup.props["MinimumConvergedPasses"] = 2
setup.update()
hfss.create_linear_count_sweep(
setupname="setup1",
unit="GHz",
Expand Down
1 change: 0 additions & 1 deletion examples/02-HFSS/HFSS_Dipole.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
setup = hfss.create_setup("MySetup")
setup.props["Frequency"] = "1GHz"
setup.props["MaximumPasses"] = 1
setup.update()
hfss.create_linear_count_sweep(
setupname=setup.name,
unit="GHz",
Expand Down
1 change: 0 additions & 1 deletion examples/02-HFSS/HFSS_Spiral.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ def create_line(pts):
setup1 = hfss.create_setup(setupname="setup1")
setup1.props["Frequency"] = "10GHz"
hfss.create_linear_count_sweep("setup1", "GHz", 1e-3, 50, 451, sweep_type="Interpolating")
setup1.update()
hfss.save_project()
hfss.analyze_all()

Expand Down
1 change: 0 additions & 1 deletion examples/02-HFSS/SBR_Example.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
setup1.props["Sweeps"]["Sweep"]["RangeType"] = "SinglePoints"
setup1.props["Sweeps"]["Sweep"]["RangeStart"] = "10GHz"
setup1.props["RadiationSetup"] = "ATK_3D"
setup1.update()
target.analyze_nominal()

###############################################################################
Expand Down
1 change: 0 additions & 1 deletion examples/02-Maxwell/Maxwell2D_Transient.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
setup.props["N Steps"] = "1"
setup.props["Steps From"] = "0s"
setup.props["Steps To"] = "0.002s"
setup.update()

###############################################################################
# Create a Rectangular Plot
Expand Down
8 changes: 2 additions & 6 deletions examples/02-Maxwell/Maxwell3DTeam3.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
################################################################################
# Create TEAM3 aluminium material for the ladder plate
mat = M3D.materials.add_material("team3_aluminium")
mat.update()
mat.conductivity = 32780000

###############################################################################
Expand Down Expand Up @@ -98,10 +97,8 @@
Setup = M3D.create_setup(setupname="Setup1")
Setup.props["Frequency"] = "200Hz"
Setup.props["HasSweepSetup"] = True
Setup.props["StartValue"] = "50Hz"
Setup.props["StopValue"] = "200Hz"
Setup.props["StepSize"] = "150Hz"
Setup.update()
Setup.add_eddy_current_sweep("LinearStep", 50, 200, 150, clear=True)


################################################################################
# Adjust Eddy Effects for LadderPlate and SearchCoil
Expand All @@ -116,7 +113,6 @@
param.props["ProdOptiSetupDataV2"]["SaveFields"] = True
param.props["ProdOptiSetupDataV2"]["CopyMesh"] = False
param.props["ProdOptiSetupDataV2"]["SolveWithCopiedMeshOnly"] = True
param.update()

# Solve the model, we solve the parametric sweep directly so results of all variations are available.
M3D.analyze_setup(sweepname)
Expand Down
6 changes: 1 addition & 5 deletions examples/02-Maxwell/Maxwell3DTeam7.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,9 @@
Setup = M3D.create_setup(setupname="Setup1")
Setup.props["Frequency"] = "200Hz"
Setup.props["HasSweepSetup"] = True
Setup.props["StartValue"] = str(dc_freq) + "Hz"
Setup.props["StopValue"] = str(stop_freq) + "Hz"
Setup.props["StepSize"] = str(stop_freq - dc_freq) + "Hz"
Setup.add_eddy_current_sweep("LinearStep", dc_freq, stop_freq, stop_freq - dc_freq, clear=True)
Setup.props["UseHighOrderShapeFunc"] = True
Setup.props["PercentError"] = 0.4
Setup.update()

###########################################################################################
# Coil Dimensions
Expand Down Expand Up @@ -106,7 +103,6 @@

# Add a new material with Team 7 properties for Aluminium
mat = M3D.materials.add_material("team7_aluminium")
mat.update()
mat.conductivity = 3.526e7

# Model the Aluminium plate with a hole in by subtracting two rectangular cuboids.
Expand Down
11 changes: 2 additions & 9 deletions examples/03-Circuit/Circuit_Example.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,7 @@
# This method creates and customizes a Linear Network Analysis (LNA) setup.

setup1 = aedt_app.create_setup("MyLNA")
setup1.SweepDefinition = [
("Variable", "Freq"),
("Data", "LINC 0GHz 4GHz 10001"),
("OffsetF1", False),
("Synchronize", 0),
]
setup1.update()
setup1.props["SweepDefinition"]["Data"] = "LINC 0GHz 4GHz 10001"

###############################################################################
# Create Components
Expand Down Expand Up @@ -94,8 +88,7 @@
# This method adds a transient setup.

setup2 = aedt_app.create_setup("MyTransient", aedt_app.SETUPS.NexximTransient)
setup2.TransientData = ["0.01ns", "200ns"]
setup2.update()
setup2.props["TransientData"] = ["0.01ns", "200ns"]
setup3 = aedt_app.create_setup("MyDC", aedt_app.SETUPS.NexximDC)

###############################################################################
Expand Down
1 change: 0 additions & 1 deletion examples/04-Icepak/Icepak_Example.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
setup1.props["Convergence Criteria - Max Iterations"] = 5
setup1.props["Linear Solver Type - Pressure"] = "flex"
setup1.props["Linear Solver Type - Temperature"] = "flex"
setup1.update()
ipk.save_project(r"C:\temp\Graphic_card.aedt")

###############################################################################
Expand Down
1 change: 0 additions & 1 deletion examples/04-Icepak/Sherlock_Example.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@
setup1.props["Radiation Model"] = "Discrete Ordinates Model"
setup1.props["Include Gravity"] = True
setup1.props["Secondary Gradient"] = True
setup1.update()
ipk.assign_openings(ipk.modeler.get_object_faces("Region"))

###############################################################################
Expand Down
1 change: 0 additions & 1 deletion examples/05-Q3D/Q3D_Example.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
q.assign_source_to_objectface("Bar3", axisdir=q.AxisDir.XPos, source_name="Source3")
bar3_sink = q.assign_sink_to_objectface("Bar3", axisdir=q.AxisDir.YPos)
bar3_sink.name = "Sink3"
bar3_sink.update()

###############################################################################
# Print Infos
Expand Down
2 changes: 0 additions & 2 deletions examples/06-Multiphysics/Hfss_Icepak_Coupling.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@
setup.props["Frequency"] = "1GHz"
setup.props["BasisOrder"] = 2
setup.props["MaximumPasses"] = 1
setup.update()

###############################################################################
# Generate a Sweep
Expand Down Expand Up @@ -193,7 +192,6 @@

setup_ipk = ipkapp.create_setup("SetupIPK")
setup_ipk.props["Convergence Criteria - Max Iterations"] = 3
setup_ipk.update()

################################################################################
# Edit or Review Mesh Parameters
Expand Down
1 change: 0 additions & 1 deletion examples/06-Multiphysics/Hfss_Mechanical.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
unit = "GHz"
sweep_list = ["LINC", str(bw_start) + unit, str(bw_stop) + unit, str(n_points)]
LNA_setup.props["SweepDefinition"]["Data"] = " ".join(sweep_list)
LNA_setup.update()

###############################################################################
# Solve and Push Excitation
Expand Down
2 changes: 2 additions & 0 deletions pyaedt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
with open(os.path.join(os.path.dirname(__file__), "version.txt"), "r") as f:
__version__ = f.read().strip()


from pyaedt.generic.general_methods import settings

from pyaedt.generic import constants
from pyaedt.generic.general_methods import pyaedt_function_handler, generate_unique_name, _retry_ntimes
from pyaedt.generic.general_methods import is_ironpython, _pythonver, inside_desktop, convert_remote_object
Expand Down
3 changes: 1 addition & 2 deletions pyaedt/application/AnalysisNexxim.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,10 @@ def create_setup(self, setupname="MySetupAuto", setuptype=None, props={}):

name = self.generate_unique_setup_name(setupname)
setup = SetupCircuit(self, setuptype, name)
setup.name = name
setup.create()
if props:
for el in props:
setup.props[el] = props[el]
setup.props._setitem_without_update(el, props[el])
setup.update()
self.analysis_setup = name
self.setups.append(setup)
Expand Down
2 changes: 1 addition & 1 deletion pyaedt/application/MessageManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import logging
import sys

from pyaedt.generic.general_methods import settings
from pyaedt import settings

message_levels = {"Global": 0, "Project": 1, "Design": 2}

Expand Down
15 changes: 12 additions & 3 deletions pyaedt/desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
import subprocess

from pyaedt.misc import list_installed_ansysem
from pyaedt import pyaedt_function_handler, settings
from pyaedt import pyaedt_function_handler
from pyaedt.generic.general_methods import is_ironpython, _pythonver, inside_desktop
from pyaedt import settings

from pyaedt import aedt_logger, __version__

Expand Down Expand Up @@ -284,7 +285,6 @@ def __init__(
self._main.pyaedt_version = pyaedtversion
self._main.interpreter_ver = _pythonver
self._main.student_version = student_version
settings.non_graphical = non_graphical
if is_ironpython:
self._main.isoutsideDesktop = False
else:
Expand All @@ -295,13 +295,22 @@ def __init__(
self.release_on_exit = False
self._main.oDesktop = oDesktop
settings.aedt_version = oDesktop.GetVersion()[0:6]
try:
settings.non_graphical = oDesktop.GetIsNonGraphical()
except:
settings.non_graphical = non_graphical
elif "oDesktop" in dir(self._main) and self._main.oDesktop is not None: # pragma: no cover
self.release_on_exit = False
try:
settings.non_graphical = self._main.oDesktop.GetIsNonGraphical()
except:
settings.non_graphical = non_graphical
else:
settings.non_graphical = non_graphical
if "oDesktop" in dir(self._main):
del self._main.oDesktop
self._main.student_version, version_key, version = self._set_version(specified_version, student_version)
settings.aedt_version = version
settings.aedt_version = version_key
if _com == "ironpython": # pragma: no cover
print("Launching PyAEDT outside AEDT with IronPython.")
self._init_ironpython(non_graphical, new_desktop_session, version)
Expand Down
5 changes: 3 additions & 2 deletions pyaedt/edb_core/EDB_Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1971,7 +1971,7 @@ def is_pin(self, pin):

@property
def position(self):
"""padstack instance position.
"""Padstack instance position.

Returns
-------
Expand All @@ -1991,7 +1991,7 @@ def position(self):

@property
def rotation(self):
"""padstack instance rotation.
"""Padstack instance rotation.

Returns
-------
Expand Down Expand Up @@ -2022,6 +2022,7 @@ def id(self):

@property
def name(self):
"""Padstack Instance Name. If is a pin the syntax will be like in AEDT ComponentName-PinName."""
if self.is_pin:
comp_name = self._edb_padstackinstance.GetComponent().GetName()
pin_name = self._edb_padstackinstance.GetName()
Expand Down
2 changes: 2 additions & 0 deletions pyaedt/generic/DataHandlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ def _dict2arg(d, arg_out):

"""
for k, v in d.items():
if "_pyaedt" in k:
continue
if k == "Point" or k == "DimUnits":
if isinstance(v[0], (list, tuple)):
for e in v:
Expand Down
Loading