HFSS VBscript about ExportToFile, i'm lost
时间:03-31
整理:3721RD
点击:
I want to use HFSS API VBscript program to export the results to a file. But it doesn't work in HFSS10. It is said that the HFSS10 doesn't support the method "oDesign.ExportToFile". So how can i export the results to a file using the VBscript. I hope someone can give me a hint. Thank you so much.
Dim oHfssApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oHfssApp = CreateObject("AnsoftHfss.HfssScriptInterface")
Set oDesktop = oHfssApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.OpenProject "E:/GPS.hfss"
Set oProject = oDesktop.GetActiveProject
Set oDesign = oProject.SetActiveDesign("GPS")
oDesign.CreateReport Array("NAME:SParam",_
"ReportType:=","Modal S Parameters",_
"DisplayType:=","Rectangular Plot", _
Array("NAME:Traces",_
Array("NAME:Trace1",_
"SolutionName:=","Setup1 : Sweep1",_
"Context:=","", _
"Freq:=", Array("All"), _
"XComponent:=", "freq",_
"YComponent:=", "db(S(p1,p1))",_
"YAxis:=",0)))
oDesign.ExportToFile "SParam", "E:\ssp.txt"
oProject.Save
with
Hope this works for you...
Dim oHfssApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oHfssApp = CreateObject("AnsoftHfss.HfssScriptInterface")
Set oDesktop = oHfssApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.OpenProject "E:/GPS.hfss"
Set oProject = oDesktop.GetActiveProject
Set oDesign = oProject.SetActiveDesign("GPS")
oDesign.CreateReport Array("NAME:SParam",_
"ReportType:=","Modal S Parameters",_
"DisplayType:=","Rectangular Plot", _
Array("NAME:Traces",_
Array("NAME:Trace1",_
"SolutionName:=","Setup1 : Sweep1",_
"Context:=","", _
"Freq:=", Array("All"), _
"XComponent:=", "freq",_
"YComponent:=", "db(S(p1,p1))",_
"YAxis:=",0)))
oDesign.ExportToFile "SParam", "E:\ssp.txt"
oProject.Save
Tip: When you aren't sure how to do something, click 'Record Script', do what you want, click 'Stop Recording' and view the file HFSS generates. Very instructive.
To answer your question, the HFSS documentation is incorrect in stating that 'ExportToFile' is a method of the Design Object. Rather, it is contained in the Report Setup Module.
Replace
Code:
oDesign.ExportToFile "SParam", "E:\ssp.txt"
Code:
Set oModule = oDesign.GetModule("ReportSetup") oModule.ExportToFile "SParam", "E:\ssp.txt"