求VB大神!
05-08
VB脚本添加语言生成完整的,能运行的VB语言。望高手指点!谢谢!
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("Tee1")
oProject.SaveAs "D:\Ansoft\Tee2.hfss", true
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
oDesign.SetSolutionType "DrivenModal"
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.SetModelUnits Array("NAME:Units Parameter", "Units:=", "in", "Rescale:=", _
false)
oEditor.CreateBox Array("NAME:BoxParameters", "CoordinateSystemID:=", -1, "XPosition:=", _
"0in", "YPosition:=", "0in", "ZPosition:=", "0in", "XSize:=", "2in", "YSize:=", _
"0.9in", "ZSize:=", "0.4in"), Array("NAME:Attributes", "Name:=", "Box1", "Flags:=", _
"", "Color:=", "(132 132 193)", "Transparency:=", 0, "PartCoordinateSystem:=", _
"Global", "MaterialName:=", "vacuum", "SolveInside:=", true)
oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:Geometry3DCmdTab", Array("NAME:PropServers", _
"Box1:CreateBox:1"), Array("NAME:ChangedProps", Array("NAME:Position", "X:=", "0in", "Y:=", _
"-0.45in", "Z:=", "0in"))))
oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:Geometry3DAttributeTab", Array("NAME:PropServers", _
"Box1"), Array("NAME:ChangedProps", Array("NAME:Name", "Value:=", "Tee"))))
oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:Geometry3DAttributeTab", Array("NAME:PropServers", _
"Tee"), Array("NAME:ChangedProps", Array("NAME:Transparent", "Value:=", 0.4))))
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignWavePort Array("NAME:Port1", "NumModes:=", 1, "PolarizeEField:=", _
false, "DoDeembed:=", false, Array("NAME:Modes", Array("NAME:Mode1", "ModeNum:=", 1, "UseIntLine:=", _
true, Array("NAME:IntLine", "Start:=", Array("2in", "0in", "0in"), "End:=", Array( _
"2in", "0in", "0.4in")), "CharImp:=", "Zpi")), "Faces:=", Array(12))
oEditor.DuplicateAroundAxis Array("NAME:Selections", "Selections:=", "Tee"), Array("NAME:DuplicateAroundAxisParameters", "WhichAxis:=", _
"Z", "AngleStr:=", "90deg", "NumClones:=", 2), Array("NAME:Options", "DuplicateBoundaries:=", _
true)
oEditor.DuplicateAroundAxis Array("NAME:Selections", "Selections:=", "Tee"), Array("NAME:DuplicateAroundAxisParameters", "WhichAxis:=", _
"Z", "AngleStr:=", "-90deg", "NumClones:=", 2), Array("NAME:Options", "DuplicateBoundaries:=", _
true)
oEditor.Unite Array("NAME:Selections", "Selections:=", "Tee,Tee_1,Tee_2"), Array("NAME:UniteParameters", "CoordinateSystemID:=", _
-1, "KeepOriginals:=", false)
oEditor.CreateBox Array("NAME:BoxParameters", "CoordinateSystemID:=", -1, "XPosition:=", _
"0in", "YPosition:=", "0in", "ZPosition:=", "0in", "XSize:=", "0.2in", "YSize:=", _
"0.2in", "ZSize:=", "0.2in"), Array("NAME:Attributes", "Name:=", "Box1", "Flags:=", _
"", "Color:=", "(132 132 193)", "Transparency:=", 0, "PartCoordinateSystem:=", _
"Global", "MaterialName:=", "vacuum", "SolveInside:=", true)
oDesign.ChangeProperty Array("NAME:AllTabs", Array("NAME:LocalVariableTab", Array("NAME:PropServers", _
"LocalVariables"), Array("NAME:NewProps", Array("NAME:offset", "PropType:=", _
"VariableProp", "UserDef:=", true, "Value:=", "0in"))))
oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:Geometry3DCmdTab", Array("NAME:PropServers", _
"Box1:CreateBox:1"), Array("NAME:ChangedProps", Array("NAME:Position", "X:=", "-0.45in", "Y:=", _
"offset-0.05in", "Z:=", "0in"), Array("NAME:XSize", "Value:=", "0.45in"), Array("NAME:YSize", "Value:=", _
"0.1in"), Array("NAME:ZSize", "Value:=", "0.4in"))), Array("NAME:Geometry3DAttributeTab", Array("NAME:PropServers", _
"Box1"), Array("NAME:ChangedProps", Array("NAME:Name", "Value:=", "Septum"))))
oEditor.Subtract Array("NAME:Selections", "Blank Parts:=", "Tee", "Tool Parts:=", _
"Septum"), Array("NAME:SubtractParameters", "CoordinateSystemID:=", -1, "KeepOriginals:=", _
false)
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup "HfssDriven", Array("NAME:Setup1", "Frequency:=", "10GHz", "PortsOnly:=", _
false, "MaxDeltaS:=", 0.02, "UseMatrixConv:=", false, "MaximumPasses:=", 3, "MinimumPasses:=", _
1, "MinimumConvergedPasses:=", 1, "PercentRefinement:=", 20, "ReducedSolutionBasis:=", _
false, "DoLambdaRefine:=", true, "DoMaterialLambda:=", true, "Target:=", _
0.3333, "UseConvOutputVariable:=", false, "IsEnabled:=", true, "ExternalMesh:=", _
false, "UseMaxTetIncrease:=", false, "MaxTetIncrease:=", 100000, "PortAccuracy:=", _
2, "UseABCOnPort:=", false, "SetPortMinMaxTri:=", false)
oModule.InsertDrivenSweep "Setup1", Array("NAME:Sweep1", "IsEnabled:=", true, "Type:=", _
"Interpolating", "InterpTolerance:=", 0.5, "InterpMaxSolns:=", 50, "InterpUseS:=", _
true, "InterpUseT:=", false, "InterpUsePortImped:=", false, "InterpUsePropConst:=", _
false, "UseFullBasis:=", true, "SetupType:=", "LinearStep", "StartFreq:=", _
"8GHz", "StopFreq:=", "10GHz", "StepSize:=", "0.02GHz", "SaveFields:=", false, "ExtrapToDC:=", _
false)
oProject.Save
oDesign.AnalyzeAll
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.CreateFieldPlot Array("NAME:Mag_E1", "SolutionName:=", _
"Setup1 : LastAdaptive", "QuantityName:=", "Mag_E", "PlotFolder:=", "E Field", "UserSpecifyName:=", _
0, "UserSpecifyFolder:=", 0, "IntrinsicVar:=", "Freq=" & Chr(39) & "10GHz" & Chr(39) & " Phase=" & Chr(39) & "0deg" & Chr(39) & "", "PlotGeomInfo:=", Array( _
1, "Surface", "FacesList", 1, "7"), "FilterBoxes:=", Array(0), Array("NAME:PlotOnSurfaceSettings", "Filled:=", _
false, "IsoValType:=", "Tone", "SmoothShade:=", true, "AddGrid:=", false, "MapTransparency:=", _
true, "Transparency:=", 0, Array("NAME:Arrow3DSpacingSettings", "ArrowUniform:=", _
true, "ArrowSpacing:=", 0, "MinArrowSpacing:=", 0, "MaxArrowSpacing:=", 0), "GridColor:=", Array( _
255, 255, 255)))
oProject.Save
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("Tee1")
oProject.SaveAs "D:\Ansoft\Tee2.hfss", true
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
oDesign.SetSolutionType "DrivenModal"
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.SetModelUnits Array("NAME:Units Parameter", "Units:=", "in", "Rescale:=", _
false)
oEditor.CreateBox Array("NAME:BoxParameters", "CoordinateSystemID:=", -1, "XPosition:=", _
"0in", "YPosition:=", "0in", "ZPosition:=", "0in", "XSize:=", "2in", "YSize:=", _
"0.9in", "ZSize:=", "0.4in"), Array("NAME:Attributes", "Name:=", "Box1", "Flags:=", _
"", "Color:=", "(132 132 193)", "Transparency:=", 0, "PartCoordinateSystem:=", _
"Global", "MaterialName:=", "vacuum", "SolveInside:=", true)
oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:Geometry3DCmdTab", Array("NAME:PropServers", _
"Box1:CreateBox:1"), Array("NAME:ChangedProps", Array("NAME:Position", "X:=", "0in", "Y:=", _
"-0.45in", "Z:=", "0in"))))
oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:Geometry3DAttributeTab", Array("NAME:PropServers", _
"Box1"), Array("NAME:ChangedProps", Array("NAME:Name", "Value:=", "Tee"))))
oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:Geometry3DAttributeTab", Array("NAME:PropServers", _
"Tee"), Array("NAME:ChangedProps", Array("NAME:Transparent", "Value:=", 0.4))))
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignWavePort Array("NAME:Port1", "NumModes:=", 1, "PolarizeEField:=", _
false, "DoDeembed:=", false, Array("NAME:Modes", Array("NAME:Mode1", "ModeNum:=", 1, "UseIntLine:=", _
true, Array("NAME:IntLine", "Start:=", Array("2in", "0in", "0in"), "End:=", Array( _
"2in", "0in", "0.4in")), "CharImp:=", "Zpi")), "Faces:=", Array(12))
oEditor.DuplicateAroundAxis Array("NAME:Selections", "Selections:=", "Tee"), Array("NAME:DuplicateAroundAxisParameters", "WhichAxis:=", _
"Z", "AngleStr:=", "90deg", "NumClones:=", 2), Array("NAME:Options", "DuplicateBoundaries:=", _
true)
oEditor.DuplicateAroundAxis Array("NAME:Selections", "Selections:=", "Tee"), Array("NAME:DuplicateAroundAxisParameters", "WhichAxis:=", _
"Z", "AngleStr:=", "-90deg", "NumClones:=", 2), Array("NAME:Options", "DuplicateBoundaries:=", _
true)
oEditor.Unite Array("NAME:Selections", "Selections:=", "Tee,Tee_1,Tee_2"), Array("NAME:UniteParameters", "CoordinateSystemID:=", _
-1, "KeepOriginals:=", false)
oEditor.CreateBox Array("NAME:BoxParameters", "CoordinateSystemID:=", -1, "XPosition:=", _
"0in", "YPosition:=", "0in", "ZPosition:=", "0in", "XSize:=", "0.2in", "YSize:=", _
"0.2in", "ZSize:=", "0.2in"), Array("NAME:Attributes", "Name:=", "Box1", "Flags:=", _
"", "Color:=", "(132 132 193)", "Transparency:=", 0, "PartCoordinateSystem:=", _
"Global", "MaterialName:=", "vacuum", "SolveInside:=", true)
oDesign.ChangeProperty Array("NAME:AllTabs", Array("NAME:LocalVariableTab", Array("NAME:PropServers", _
"LocalVariables"), Array("NAME:NewProps", Array("NAME:offset", "PropType:=", _
"VariableProp", "UserDef:=", true, "Value:=", "0in"))))
oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:Geometry3DCmdTab", Array("NAME:PropServers", _
"Box1:CreateBox:1"), Array("NAME:ChangedProps", Array("NAME:Position", "X:=", "-0.45in", "Y:=", _
"offset-0.05in", "Z:=", "0in"), Array("NAME:XSize", "Value:=", "0.45in"), Array("NAME:YSize", "Value:=", _
"0.1in"), Array("NAME:ZSize", "Value:=", "0.4in"))), Array("NAME:Geometry3DAttributeTab", Array("NAME:PropServers", _
"Box1"), Array("NAME:ChangedProps", Array("NAME:Name", "Value:=", "Septum"))))
oEditor.Subtract Array("NAME:Selections", "Blank Parts:=", "Tee", "Tool Parts:=", _
"Septum"), Array("NAME:SubtractParameters", "CoordinateSystemID:=", -1, "KeepOriginals:=", _
false)
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup "HfssDriven", Array("NAME:Setup1", "Frequency:=", "10GHz", "PortsOnly:=", _
false, "MaxDeltaS:=", 0.02, "UseMatrixConv:=", false, "MaximumPasses:=", 3, "MinimumPasses:=", _
1, "MinimumConvergedPasses:=", 1, "PercentRefinement:=", 20, "ReducedSolutionBasis:=", _
false, "DoLambdaRefine:=", true, "DoMaterialLambda:=", true, "Target:=", _
0.3333, "UseConvOutputVariable:=", false, "IsEnabled:=", true, "ExternalMesh:=", _
false, "UseMaxTetIncrease:=", false, "MaxTetIncrease:=", 100000, "PortAccuracy:=", _
2, "UseABCOnPort:=", false, "SetPortMinMaxTri:=", false)
oModule.InsertDrivenSweep "Setup1", Array("NAME:Sweep1", "IsEnabled:=", true, "Type:=", _
"Interpolating", "InterpTolerance:=", 0.5, "InterpMaxSolns:=", 50, "InterpUseS:=", _
true, "InterpUseT:=", false, "InterpUsePortImped:=", false, "InterpUsePropConst:=", _
false, "UseFullBasis:=", true, "SetupType:=", "LinearStep", "StartFreq:=", _
"8GHz", "StopFreq:=", "10GHz", "StepSize:=", "0.02GHz", "SaveFields:=", false, "ExtrapToDC:=", _
false)
oProject.Save
oDesign.AnalyzeAll
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.CreateFieldPlot Array("NAME:Mag_E1", "SolutionName:=", _
"Setup1 : LastAdaptive", "QuantityName:=", "Mag_E", "PlotFolder:=", "E Field", "UserSpecifyName:=", _
0, "UserSpecifyFolder:=", 0, "IntrinsicVar:=", "Freq=" & Chr(39) & "10GHz" & Chr(39) & " Phase=" & Chr(39) & "0deg" & Chr(39) & "", "PlotGeomInfo:=", Array( _
1, "Surface", "FacesList", 1, "7"), "FilterBoxes:=", Array(0), Array("NAME:PlotOnSurfaceSettings", "Filled:=", _
false, "IsoValType:=", "Tone", "SmoothShade:=", true, "AddGrid:=", false, "MapTransparency:=", _
true, "Transparency:=", 0, Array("NAME:Arrow3DSpacingSettings", "ArrowUniform:=", _
true, "ArrowSpacing:=", 0, "MinArrowSpacing:=", 0, "MaxArrowSpacing:=", 0), "GridColor:=", Array( _
255, 255, 255)))
oProject.Save
相关文章:
- 请教一下DVB-T和普通模拟电视的天线能共用嘛?(05-08)
- 请教一下CST里面VBA的问题(05-08)
- 求CST VBA宏的有关教程或一些简单规则。谢谢(05-08)
- 请问关于dvb-s和dvb-c机顶盒的中频输出(05-08)
- HFSS VB脚本如何调试(05-08)
- 如果VBW比RBW小会怎么样呢(05-08)
射频专业培训教程推荐