Importing 3D object, setting the delta parameter and adding infinite sphere in HFSS12
时间:03-31
整理:3721RD
点击:
Hi,
I am new with scripting HFSS12. I wrote a script using the HFSS script pdf file and it was successful except 3 things:
1) I can not import a 3D object (stl file). My code for this part is as follows:
Dim oHfssApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oHfssApp = CreateObject("AnsoftHfss.HfssScriptInterface")
Set oDesktop = oHfssApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.NewProject
Set oProject = oDesktop.GetActiveProject
oProject.InsertDesign "HFSS", "first", "DrivenModal", ""
Set oDesign = oProject.SetActiveDesign("first")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.Import _
Array("NAME:NativeBodyParameters", _
"CoordinateSystemID:=", -1, _
"HealOption:=", 0, _
"CheckModel:=", true, _
"Options:=", "", _
"FileType:=", "UnRecognized", _
"MaxStitchTol:=", 0.001, _
"SourceFile:=", "first.stl")
2) In the analysis part, I can not set the delta parameter. I set maxDeltaS to 0.02 but in the gui it is still 0.1.
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup "HfssDriven", _
Array("NAME:Setup400MHz", _
"Frequency:=", "0.400000GHz", _
"PortsOnly:=", false, _
"maxDeltaS:=", 0.020000, _
"UseMatrixConv:=", false, _
"MaximumPasses:=", 20, _
"MinimumPasses:=", 1, _
"MinimumConvergedPasses:=", 1, _
"PercentRefinement:=", 20, _
"ReducedSolutionBasis:=", false, _
"DoLambdaRefine:=", true, _
"DoMaterialLambda:=", true, _
"Target:=", 0.3333, _
"PortAccuracy:=", 2, _
"SetPortMinMaxTri:=", false)
3) I can not add an infinite sphere. I got an error massage for both of the following implementations.
oModule.EditFarFieldSphereSetup _
Array("NAME:InfSphere", _
"UseCustomRadiationSurface:=", true, _
"ThetaStart:=", "0deg", _
"ThetaStop:=", "180deg", _
"ThetaStep:=", "10deg", _
"PhiStart:=", "0deg", _
"PhiStop:=", "360deg", _
"PhiStep:=", "10deg", _
"UseLocalCS:=", false)
--------
oModule.InsertFarFieldSphereSetup Array("NAME:InfiniteSphere1", _
"UseCustomRadiationSurface:=", false, _
"ThetaStart:=", "0deg",_
"ThetaStop:=", "180deg",_
"ThetaStep:=", "10deg",_
"PhiStart:=", "0deg",_
"PhiStop:=", "36deg",_
"PhiStep:=", "10deg",_
"UseLocalCS:=", true,_
"CoordSystem:=", "RelativeCS1")
thanks,
hn1
I am new with scripting HFSS12. I wrote a script using the HFSS script pdf file and it was successful except 3 things:
1) I can not import a 3D object (stl file). My code for this part is as follows:
Dim oHfssApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oHfssApp = CreateObject("AnsoftHfss.HfssScriptInterface")
Set oDesktop = oHfssApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.NewProject
Set oProject = oDesktop.GetActiveProject
oProject.InsertDesign "HFSS", "first", "DrivenModal", ""
Set oDesign = oProject.SetActiveDesign("first")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.Import _
Array("NAME:NativeBodyParameters", _
"CoordinateSystemID:=", -1, _
"HealOption:=", 0, _
"CheckModel:=", true, _
"Options:=", "", _
"FileType:=", "UnRecognized", _
"MaxStitchTol:=", 0.001, _
"SourceFile:=", "first.stl")
2) In the analysis part, I can not set the delta parameter. I set maxDeltaS to 0.02 but in the gui it is still 0.1.
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup "HfssDriven", _
Array("NAME:Setup400MHz", _
"Frequency:=", "0.400000GHz", _
"PortsOnly:=", false, _
"maxDeltaS:=", 0.020000, _
"UseMatrixConv:=", false, _
"MaximumPasses:=", 20, _
"MinimumPasses:=", 1, _
"MinimumConvergedPasses:=", 1, _
"PercentRefinement:=", 20, _
"ReducedSolutionBasis:=", false, _
"DoLambdaRefine:=", true, _
"DoMaterialLambda:=", true, _
"Target:=", 0.3333, _
"PortAccuracy:=", 2, _
"SetPortMinMaxTri:=", false)
3) I can not add an infinite sphere. I got an error massage for both of the following implementations.
oModule.EditFarFieldSphereSetup _
Array("NAME:InfSphere", _
"UseCustomRadiationSurface:=", true, _
"ThetaStart:=", "0deg", _
"ThetaStop:=", "180deg", _
"ThetaStep:=", "10deg", _
"PhiStart:=", "0deg", _
"PhiStop:=", "360deg", _
"PhiStep:=", "10deg", _
"UseLocalCS:=", false)
--------
oModule.InsertFarFieldSphereSetup Array("NAME:InfiniteSphere1", _
"UseCustomRadiationSurface:=", false, _
"ThetaStart:=", "0deg",_
"ThetaStop:=", "180deg",_
"ThetaStep:=", "10deg",_
"PhiStart:=", "0deg",_
"PhiStop:=", "36deg",_
"PhiStep:=", "10deg",_
"UseLocalCS:=", true,_
"CoordSystem:=", "RelativeCS1")
thanks,
hn1
according to my experience, the most efficient way to write the scripts is: you use the record script function first. then edit the recorded script