Skip to content

Commit 270a5d3

Browse files
camuherPipKat
andauthored
Adding Process ID so PyAEDT can point to a specific instance of Electronics Desktop (#1187)
* Add a variable to the constructors of the classes needed to aim PyAEDT, running from CPython 3.x, at a specific instance of Electronics Desktop. Only implemented and tested for the Hfss class and parent classes. The parameter is optional and does not modify the behavior of previous examples. * added aedt_process_id to: circuit, emit, hfss3dlayout, icepak, maxwell3d, maxwell2d, maxwellcircuit, mechanical, Qextractor, q3d, q2d, rmxprt, twinbuilder and their parent classes for uniformity. * Improves style compliance. Also adds aedt_process_id to RMxport ant twinbuilder parent classes which was overlooked in the previous commit, causing build failures. * Minor edits to match the style * Update pyaedt/application/Analysis.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/application/Analysis3D.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/application/Analysis3DLayout.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/application/AnalysisMaxwellCircuit.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/application/Design.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/circuit.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/desktop.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/emit.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/hfss.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/hfss3dlayout.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/icepak.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/maxwell.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/maxwell.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/maxwellcircuit.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/mechanical.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/q3d.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/q3d.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/rmxprt.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/twinbuilder.py Co-authored-by: Kathy Pippert <[email protected]> Co-authored-by: Kathy Pippert <[email protected]>
1 parent 20b47c2 commit 270a5d3

21 files changed

+137
-6
lines changed

pyaedt/application/Analysis.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ class Analysis(Design, object):
6969
Whether to release AEDT on exit.
7070
student_version : bool
7171
Whether to enable the student version of AEDT.
72+
aedt_process_id : int, optional
73+
Only used when ``new_desktop_session = False``, specifies by process ID which instance
74+
of Electronics Desktop to point PyAEDT at.
7275
7376
"""
7477

@@ -86,6 +89,7 @@ def __init__(
8689
student_version,
8790
machine="",
8891
port=0,
92+
aedt_process_id=None,
8993
):
9094
self.setups = []
9195
Design.__init__(
@@ -101,6 +105,7 @@ def __init__(
101105
student_version,
102106
machine,
103107
port,
108+
aedt_process_id,
104109
)
105110
self.logger.info("Design Loaded")
106111
self._setup = None

pyaedt/application/Analysis3D.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ class FieldAnalysis3D(Analysis, object):
6161
student_version : bool, optional
6262
Whether to enable the student version of AEDT. The default
6363
is ``False``.
64+
aedt_process_id : int, optional
65+
Only used when ``new_desktop_session = False``, specifies by process ID which instance
66+
of Electronics Desktop to point PyAEDT at.
6467
"""
6568

6669
def __init__(
@@ -77,6 +80,7 @@ def __init__(
7780
student_version=False,
7881
machine="",
7982
port=0,
83+
aedt_process_id=None,
8084
):
8185
Analysis.__init__(
8286
self,
@@ -92,6 +96,7 @@ def __init__(
9296
student_version,
9397
machine,
9498
port,
99+
aedt_process_id,
95100
)
96101
self._osolution = self._odesign.GetModule("Solutions")
97102
self._oboundary = self._odesign.GetModule("BoundarySetup")

pyaedt/application/Analysis3DLayout.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ class FieldAnalysis3DLayout(Analysis):
5555
student_version : bool, optional
5656
Whether to enable the student version of AEDT. The default
5757
is ``False``.
58+
aedt_process_id : int, optional
59+
Only used when ``new_desktop_session = False``, specifies by process ID which instance
60+
of Electronics Desktop to point PyAEDT at.
5861
5962
"""
6063

@@ -72,6 +75,7 @@ def __init__(
7275
student_version=False,
7376
machine="",
7477
port=0,
78+
aedt_process_id=None,
7579
):
7680
Analysis.__init__(
7781
self,
@@ -87,6 +91,7 @@ def __init__(
8791
student_version,
8892
machine,
8993
port,
94+
aedt_process_id,
9095
)
9196
self._osolution = self._odesign.GetModule("SolveSetups")
9297
self._oexcitation = self._odesign.GetModule("Excitations")

pyaedt/application/AnalysisEmit.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def __init__(
3737
student_version=False,
3838
machine="",
3939
port=0,
40+
aedt_process_id=None,
4041
):
4142
Design.__init__(
4243
self,
@@ -51,6 +52,7 @@ def __init__(
5152
student_version,
5253
machine=machine,
5354
port=machine,
55+
aedt_process_id=aedt_process_id,
5456
)
5557
self.solution_type = solution_type
5658
self.oanalysis = None

pyaedt/application/AnalysisMaxwellCircuit.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ class AnalysisMaxwellCircuit(Analysis):
3535
Whether to release AEDT on exit. The default is ``True``.
3636
student_version : bool, optional
3737
Whether open AEDT Student Version. The default is ``False``.
38+
aedt_process_id : int, optional
39+
Only used when ``new_desktop_session = False``, specifies by process ID which instance
40+
of Electronics Desktop to point PyAEDT at.
3841
3942
"""
4043

@@ -50,6 +53,7 @@ def __init__(
5053
student_version=False,
5154
machine="",
5255
port=0,
56+
aedt_process_id=None,
5357
):
5458

5559
Analysis.__init__(
@@ -66,6 +70,7 @@ def __init__(
6670
student_version,
6771
machine,
6872
port,
73+
aedt_process_id,
6974
)
7075
self.solution_type = None
7176
self._modeler = ModelerMaxwellCircuit(self)

pyaedt/application/AnalysisNexxim.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def __init__(
3636
student_version=False,
3737
machine="",
3838
port=0,
39+
aedt_process_id=None,
3940
):
4041
Analysis.__init__(
4142
self,
@@ -51,6 +52,7 @@ def __init__(
5152
student_version,
5253
machine,
5354
port,
55+
aedt_process_id,
5456
)
5557

5658
self._modeler = ModelerNexxim(self)

pyaedt/application/AnalysisRMxprt.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def __init__(
3232
student_version=False,
3333
machine="",
3434
port=0,
35+
aedt_process_id=None,
3536
):
3637
Analysis.__init__(
3738
self,
@@ -47,6 +48,7 @@ def __init__(
4748
student_version,
4849
machine,
4950
port,
51+
aedt_process_id,
5052
)
5153

5254
self._modeler = ModelerRMxprt(self)

pyaedt/application/AnalysisTwinBuilder.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def __init__(
5454
student_version=False,
5555
machine="",
5656
port=0,
57+
aedt_process_id=None,
5758
):
5859

5960
Analysis.__init__(
@@ -70,6 +71,7 @@ def __init__(
7071
student_version,
7172
machine,
7273
port,
74+
aedt_process_id,
7375
)
7476
self.solution_type = solution_type
7577
self._modeler = ModelerTwinBuilder(self)

pyaedt/application/Design.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,9 @@ class Design(object):
308308
student_version : bool, optional
309309
Whether to enable the student version of AEDT. The default
310310
is ``False``.
311+
aedt_process_id : int, optional
312+
Only used when ``new_desktop_session = False``, specifies by process ID which instance
313+
of Electronics Desktop to point PyAEDT at.
311314
312315
"""
313316

@@ -366,6 +369,7 @@ def __init__(
366369
student_version=False,
367370
machine="",
368371
port=0,
372+
aedt_process_id=None,
369373
):
370374
self._init_variables()
371375
# Get Desktop from global Desktop Environment
@@ -378,7 +382,14 @@ def __init__(
378382

379383
if "pyaedt_initialized" not in dir(main_module):
380384
desktop = Desktop(
381-
specified_version, non_graphical, new_desktop_session, close_on_exit, student_version, machine, port
385+
specified_version,
386+
non_graphical,
387+
new_desktop_session,
388+
close_on_exit,
389+
student_version,
390+
machine,
391+
port,
392+
aedt_process_id,
382393
)
383394
self._logger = desktop.logger
384395
self.release_on_exit = True

pyaedt/circuit.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ class Circuit(FieldAnalysisCircuit, object):
6161
Port number of which start the oDesktop communication on already existing server.
6262
This parameter is ignored in new server creation. It works only on 2022R2.
6363
Remote Server must be up and running with command `"ansysedt.exe -grpcsrv portnum"`.
64+
aedt_process_id : int, optional
65+
Only used when ``new_desktop_session = False``, specifies by process ID which instance
66+
of Electronics Desktop to point PyAEDT at.
6467
6568
Examples
6669
--------
@@ -111,6 +114,7 @@ def __init__(
111114
student_version=False,
112115
machine="",
113116
port=0,
117+
aedt_process_id=None,
114118
):
115119
FieldAnalysisCircuit.__init__(
116120
self,
@@ -126,6 +130,7 @@ def __init__(
126130
student_version,
127131
machine,
128132
port,
133+
aedt_process_id,
129134
)
130135

131136
self.onetwork_data_explorer = self._desktop.GetTool("NdExplorer")

0 commit comments

Comments
 (0)