HFSS 获取一个点上三维复数场的方法
查到GetTopEntryValue 这个命令的使用方法如下:
GetTopEntryValue(, )
The document is for study only,if tort to your rights,please inform us,we will delete
Introduction to Scripting in HFSS
Fields Calculator Script Commands 19-11
Return Value:
Returns an array of variants, which is either a scalar (one double) or a
vector (3 doubles) based on the quantity on top of the stack.
Parameters:
Type:
Example: “Setup1: LastAdaptive”
Array of variable name, value pair
但如果我们要获取三维复数场,类似于这样
<(1.53505554554611E-007, -0.00185365305808792),
(4.91913811672111E-009, 4.98254361561423E-009),
(-1.86695894790351E-008, -1.85415677955474E-008)>
就无能为力了,但是可以通过先取实部再取虚部的方法获得,如下代码:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 15.0.0
' 3:57:52 下午 11月 15, 2017
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("AnsoftHfss.HfssScriptInterface")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("cavity-waveguide-for-MAGY")
Set oDesign = oProject.SetActiveDesign("cavity-eigenModel")
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.CalcStack "clear"
oModule.EnterQty "H"
oModule.EnterPoint "Point_0_0"
oModule.CalcOp "Value"
oModule.CalcOp "Real"
oModule.ClcEval "Setup1 : LastAdaptive", Array("L:=", "20mm", "Phase:=", "0deg", "W:=", _
"26mm", "b:=", "10mm", "d:=", "8mm")
' ======get real part of 3-dimensional complex field ==========
Real_xyz = oModule.GetTopEntryValue("Setup1 : LastAdaptive", Array("L:=", "20mm", "Phase:=", "0deg", "W:=", _
"26mm", "b:=", "10mm", "d:=", "8mm") )
str_Bs = CStr(Real_xyz)
oModule.CalcStack "pop"
oModule.CalcStack "undo"
oModule.CalcOp "Imag"
oModule.ClcEval "Setup1 : LastAdaptive", Array("L:=", "20mm", "Phase:=", "0deg", "W:=", _
"26mm", "b:=", "10mm", "d:=", "8mm")
Imag_xyz = oModule.GetTopEntryValue("Setup1 : LastAdaptive", Array("L:=", "20mm", "Phase:=", "0deg", "W:=", _
"26mm", "b:=", "10mm", "d:=", "8mm") )
str_Bs = CStr(Imag_xyz(1))
MsgBox str_Bs
HFSS 学习培训课程套装,专家讲解,视频教学,帮助您全面系统地学习掌握HFSS
上一篇:error LNK2019: 无法解析的外部符号 _RtlStringValidateDestW@12,该符号在函数 _RtlStringCchPrintfW
下一篇:基于遗传算法的HFSS和C#联合仿真(三)模型演化