| Python Example
|
Several examples are given below: (nominal, Optimetrics, spectral, Partial Discharge, 3D rectangular Bar Plot with Change Bar Properties, and Add a new orientation to a 3D model and 3D report)
Nominal Example: oModule.CreateReport( "XY Plot 2", "Standard",
"Rectangular Plot", "TR",
[
"NAME:Context",
"SimValueContext:=", [], 1, 0, 2, 0, false,
false, -1, 1, 0, 1, 1, "", 0, 0]
],
[
"Time:=" , ["All"],
"aaa:=" , ["Nominal"]
],
[
"X Component:=", "Time",
"Y Component:=", ["E1.I"]
],
[])
Optimetrics Example: oModule.CreateReport ("XY Plot 3", "Standard",
"Rectangular Plot", "TR",
[
"NAME:Context",
"OptiSetup:=", "ParametricSetup1", "SimValueContext:=",
[
1, 0, 2, 0, false, false, 0, 1,0, 1, 1, "", 0, 0
]
],
[
"Time:=", ["All"], "aaa:=", ["Nominal"]
],
[
"X Component:=" , "Time",
"Y Component:=" , ["E1.I"]
],
[])
Spectral Example: oModule.CreateReport ("XY Plot 4", "Standard",
"Rectangular Plot", "TR",
[
"NAME:Context",
"SimValueContext:=",
[
2, 0, 2, 0, false, false, -1, 1, 0, 1, 1, "",
0, 0, "CG", false, "0", "KP",false, "0", "MH",
false, "100", "TE", false, "40ms", "TH", false,
"40", "TS", false, "0ns", "UF", false, "0",
"WT", false, "0", "WW", false, "100"
]
],
[
"Spectrum:=" , ["All"], "aaa:=", ["Nominal"]
],
[
"X Component:=","Spectrum",
"Y Component:=", ["mag(E1.I)"]
],
[])
Partial Discharge Example oModule.CreateReport("Partial Discharge Plot 2",
"Partial Discharge", "Rectangular Plot",
"PartialDischarge1 : PartialDischarge", [],
[
"GasPressure:=", ["All"],
"Freq:=" , ["All"],
"bend_angle:=" , ["All"]
],
[
"X Component:=", "GasPressure",
"Y Component:=", ["Power"]
])
Example 3D Rectangular Bar Plot with Change Bar properties oModule = oDesign.GetModule("ReportSetup")
oModule.CreateReport("S Parameter Plot 4", "Modal Solution Data",
"3D Rectangular Bar Plot", "Setup1 : Sweep", [],
[
"Freq:=" , ["All"],
"UU:=" , ["All"],
"ZZZ:=" , ["Nominal"]
],
[
"X Component:=", "Freq",
"Y Component:=", "UU",
"Z Component:=", ["dB(S(wDipole1_1_p1,wDipole1_1_p1))"]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers"
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Transparency",
"Value:=", "0.5"
]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Filled",
"Value:=", False
]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Filled",
"Value:=", True
]
]
]
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Show Outline",
"Value:=", True
]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Outline Color",
"R:=", 0,
"G:=", 0,
"B:=", 160
]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Outline Width",
"Value:=", "2"
]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Bar Width",
"Value:=", "Narrow"
]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Bar Width",
"Value:=", "Wide"
]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Bar Infinity",
"Value:=", True
]
]
]
])
Example Script to add a new orientation to a 3D model and 3D report
### "AddViewOrientation" script command for 3D Report. The first argument must be the 3D report name.
import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oDesktop.OpenProject("D:/Tee.aedt")
oProject = oDesktop.SetActiveProject("Project")
oDesign = oProject.SetActiveDesign("HFSSDesign1")
oModule = oDesign.GetModule("ReportSetup")
oModule.AddViewOrientation("Gain Plot 1", "3dreport", True,
[
"NAME:OrientationVectorComponents",
[
"NAME:Direction",
-0.634171009063721,
0.12737800180912,
-0.762628972530365
],
[
"NAME:Up",
-0.577874004840851,
0.577228009700775,
0.57694798707962
]
],
[
"NAME:ProjectionParams",
[
"NAME:Scaling",
1.10227048397064,
1.10227036476135,
1.10227036476135
],
[
"NAME:Translation",
-0.601842045783997,
-0.352552056312561,
-6.46677732467651
],
"ProjectionType:=" , "Orthographic",
[
"NAME:ProjectionLimits",
-2.53312301635742,
2.53312301635742,
-1,
1,
0.994183540344238,
10.5401248931885
]
])
oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.AddViewOrientation("3dmodel", True,
[
"NAME:OrientationVectorComponents",
[
"NAME:Direction",
-0.627739012241364,
-0.134194001555443,
-0.766768991947174
],
[
"NAME:Up",
-0.694571018218994,
0.54128497838974,
0.473899990320206
]
],
[
"NAME:ProjectionParams",
[
"NAME:Scaling",
0.0173665378242731,
0.017366535961628,
0.0173665322363377
],
[
"NAME:Translation",
-0.0742612779140472,
0.195189163088799,
-5.89852476119995
],
"ProjectionType:=" , "Orthographic",
[
"NAME:ProjectionLimits",
-2.27072739601135,
2.27072739601135,
-1,
1,
0.424737930297852,
10.8078212738037
]
])
oDesktop.CloseProject("Project")
|