HFSS - Scripting 15.0 PDF
HFSS - Scripting 15.0 PDF
Scripting Guide
2013 SAS IP, Inc. All rights reserved. Unauthorized use, distribution or duplication is prohibited.
ANSYS, HFSS, HFSS-IE, and Optimetrics and any and all ANSYS, Inc. brand, product, service and
feature names, logos and slogans are registered trademarks or trademarks of ANSYS, Inc. or its
subsidiaries in the United States or other countries. All other brand, product, service and feature
names or trademarks are the property of their respective owners.
Disclaimer Notice
THIS ANSYS SOFTWARE PRODUCT AND PROGRAM DOCUMENTATION INCLUDE TRADE SECRETS
AND ARE CONFIDENTIAL AND PROPRIETARY PRODUCTS OF ANSYS, INC., ITS SUBSIDIARIES, OR
LICENSORS. The software products and documentation are furnished by ANSYS, Inc., its
subsidiaries, or affiliates under a software license agreement that contains provisions concerning
non-disclosure, copying, length and nature of use, compliance with exporting laws, warranties,
disclaimers, limitations of liability, and remedies, and other provisions. The software products and
documentation may be used, disclosed, transferred, or copied only in accordance with the terms
and conditions of that software license agreement.
For U.S. Government users, except as specifically granted by the ANSYS, Inc. software license
agreement, the use, duplication, or disclosure by the United States Government is subject to
restrictions stated in the ANSYS, Inc. software license agreement and FAR 12.212 (for non-DOD
licenses).
Third-Party Software
See the legal information in the product help files for the complete Legal Notice for ANSYS
proprietary software and third-party software. If you are unable to access the Legal Notice,
please contact ANSYS, Inc.
1. Introduction to VBScript
A Sample HFSS Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
VBScript Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Declaring Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
Array Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
VBScript Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
Operator Precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
Comparison Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
Logical Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6
Controlling Program Execution . . . . . . . . . . . . . . . . . . . . . 1-6
Using If...Then...Else . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6
Using Select Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6
Using a For...Next Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7
Converting Between Data Types . . . . . . . . . . . . . . . . . . . . 1-7
Interacting with a Script . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7
Recommended VBScript References . . . . . . . . . . . . . . . . 1-8
Copyright and Trademark Notices . . . . . . . . . . . . . . . . . . . 1-9
2. HFSS and VBScript
Overview of HFSS Script Variables . . . . . . . . . . . . . . . . . . 2-2
Contents-1
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Contents-2
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
CloseProjectNoForce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3
Count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
EnableAutoSave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
GetActiveProject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5
GetAutoSaveEnabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5
GetDesigns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5
GetDistributedAnalysisMachines . . . . . . . . . . . . . . . . . . . 4-6
GetName [Desktop] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
GetLibraryDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
GetProjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
GetProjectDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7
GetProjectList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7
GetTempDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7
GetVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7
NewProject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
OpenMultipleProjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
OpenProject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
PauseScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
Print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
QuitApplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
RestoreWindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
RunProgram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-10
RunScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-10
SetActiveProject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-11
SetActiveProjectByPath . . . . . . . . . . . . . . . . . . . . . . . . . . 4-11
SetLibraryDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12
SetProjectDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12
SetTempDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12
Sleep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-13
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
DeleteDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
GetActiveDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
GetDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
GetName [Project] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
GetPath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
GetTopDesignList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4
InsertDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4
Paste [Design] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4
Redo [Project Level] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5
Save . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5
SaveAs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5
SetActiveDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6
SimulateAll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6
Undo [Project] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6
Contents-4
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Contents-5
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
RunToolkit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-14
Undo [Design] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-16
Contents-6
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Contents-7
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
GenerateHistory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-43
HealObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-43
Import . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-45
ImportDXF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-46
ImportGDSII . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-47
Intersect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-49
MoveCStoEnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-49
MoveFaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-50
ProjectSheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-51
PurgeHistory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-52
Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-52
SeparateBody . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-52
SetModelUnits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-53
SetWCS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-53
ShowWindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-54
Split . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-54
Subtract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-54
SweepFacesAlongNormal . . . . . . . . . . . . . . . . . . . . . . . 11-55
ThickenSheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-56
UncoverFaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-56
Unite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-57
Other oEditor Commands . . . . . . . . . . . . . . . . . . . . . . . . 11-57
ChangeProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-58
Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-59
GetBodyNamesByPosition . . . . . . . . . . . . . . . . . . . . . . . 11-59
GetEdgeByPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-60
GetEdgeIDsFromFace . . . . . . . . . . . . . . . . . . . . . . . . . . 11-60
GetEdgeIDsFromObject . . . . . . . . . . . . . . . . . . . . . . . . . 11-61
GetFaceArea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-61
GetFaceCenter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-61
GetFaceByPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-61
GetFaceIDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-62
GetModelBoundingBox . . . . . . . . . . . . . . . . . . . . . . . . . 11-62
Contents-8
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
GetObjectsInGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-63
GetObjectIdByName . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-63
GetObjectName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-63
GetObjectNameByFaceID . . . . . . . . . . . . . . . . . . . . . . . 11-64
GetMatchedObjectName . . . . . . . . . . . . . . . . . . . . . . . . 11-64
GetModelUnits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-64
GetNumObjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-65
GetSelections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-65
GetUserPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-65
GetVertexIDsFromEdge . . . . . . . . . . . . . . . . . . . . . . . . . 11-66
GetVertexIDsFromFace . . . . . . . . . . . . . . . . . . . . . . . . . 11-66
GetVertexIDsFromObject . . . . . . . . . . . . . . . . . . . . . . . . 11-67
PageSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-67
RenamePart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-67
Contents-9
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
CreateReportFromTemplate . . . . . . . . . . . . . . . . . . . . . 13-12
DeleteAllReports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-12
DeleteReports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-12
DeleteTraces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-13
ExportPlotImageToFile [Reporter] . . . . . . . . . . . . . . . . . 13-13
ExportToFile [Reporter] . . . . . . . . . . . . . . . . . . . . . . . . . 13-15
FFTOnReport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-15
GetAllReportNames . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-16
GetDisplayType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-17
ImportIntoReport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-18
PasteReports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-18
PasteTraces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-19
RenameReport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-19
RenameTrace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-19
UpdateAllReports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-20
UpdateReports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-20
UpdateTraces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-21
UpdateTracesContextandSweeps . . . . . . . . . . . . . . . . . 13-23
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
GetExcitationsOfType . . . . . . . . . . . . . . . . . . . . . . . . . . 14-7
GetNumBoundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-7
GetNumBoundariesOfType . . . . . . . . . . . . . . . . . . . . . . 14-7
GetNumExcitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-7
GetNumExcitationsOfType . . . . . . . . . . . . . . . . . . . . . . . 14-8
GetPortExcitationCounts . . . . . . . . . . . . . . . . . . . . . . . . 14-8
ReassignBoundary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-8
RenameBoundary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-9
ReprioritizeBoundaries . . . . . . . . . . . . . . . . . . . . . . . . . . 14-9
SetDefaultBaseName . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-9
Script Commands for Creating and Modifying
Boundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-11
AssignCurent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-12
AssignFiniteCond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-13
AssignFloquet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-14
AssignIERegion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-17
AssignImpedance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-17
AssignIncidentWave . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-18
AssignLayeredImp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-19
AssignLumpedPort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-21
AssignLumpedRLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-23
AssignMagneticBias . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-23
AssignMaster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-24
AssignPerfectE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-25
AssignPerfectH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-25
AssignRadiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-26
AssignScreeningImpedance . . . . . . . . . . . . . . . . . . . . . 14-27
AssignSlave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-30
AssignSymmetry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-31
AssignTerminal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-31
AssignVoltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-32
AssignWavePort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-32
EditCurrent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-35
Contents-11
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EditDiffPairs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-35
EditFiniteCond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-36
EditImpedance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-37
EditIncidentWave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-38
EditLayeredImpedance . . . . . . . . . . . . . . . . . . . . . . . . . 14-39
EditMaster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-39
EditPerfectE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-39
EditPerfectH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-39
EditLumpedPort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-40
EditLumpedRLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-41
EditMagneticBias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-41
EditRadiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-41
EditSlave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-42
EditSymmetry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-42
EditTerminal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-43
EditVoltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-43
EditWavePort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-43
SetTerminalReferenceImpedances . . . . . . . . . . . . . . . . 14-44
UnassignIERegions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-44
Script Commands for Creating and Modifying Boundaries
in HFSS-IE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-46
AssignAperature [HFSS-IE] . . . . . . . . . . . . . . . . . . . . . . 14-46
AssignFiniteCond [HFSS-IE] . . . . . . . . . . . . . . . . . . . . . 14-46
AssignImpedance [HFSS-IE] . . . . . . . . . . . . . . . . . . . . . 14-47
AssignInfiniteGroundPlane [HFSS-IE] . . . . . . . . . . . . . . 14-47
AssignLumpedPort [HFSS-IE] . . . . . . . . . . . . . . . . . . . . 14-48
Script Commands for Creating and Modifying PMLs . . . 14-49
CreatePML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-49
ModifyPMLGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-51
PMLGroupCreated . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-51
PMLGroupModified . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-52
RecalculatePMLMaterials . . . . . . . . . . . . . . . . . . . . . . . 14-52
Contents-12
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Contents-13
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
RenameDrivenSweep . . . . . . . . . . . . . . . . . . . . . . . . . . 16-18
RenameSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-18
RenameSweep [HFSS-IE] . . . . . . . . . . . . . . . . . . . . . . . 16-19
RevertAllToInitial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-19
RevertSetupToInitial . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-19
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Contents-15
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
SetPlotFolderSettings . . . . . . . . . . . . . . . . . . . . . . . . . . 19-10
Contents-16
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21-2
DeleteFarFieldSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . 21-2
DeleteNearFieldSetup . . . . . . . . . . . . . . . . . . . . . . . . . . 21-2
GetSetupNames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21-2
RenameSetup [Radiation] . . . . . . . . . . . . . . . . . . . . . . . 21-3
Script Commands for Creating and Modifying Radiation
Setups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21-4
EditFarFieldSphereSetup . . . . . . . . . . . . . . . . . . . . . . . . 21-4
EditNearFieldLineSetup . . . . . . . . . . . . . . . . . . . . . . . . . 21-4
EditNearFieldSphereSetup . . . . . . . . . . . . . . . . . . . . . . 21-5
InsertFarFieldSphereSetup . . . . . . . . . . . . . . . . . . . . . . 21-5
InsertNearFieldLineSetup . . . . . . . . . . . . . . . . . . . . . . . 21-6
InsertNearFieldSphereSetup . . . . . . . . . . . . . . . . . . . . . 21-7
Script Commands for Modifying Antenna Array Setups . 21-8
EditAntennaArraySetup . . . . . . . . . . . . . . . . . . . . . . . . . 21-8
Script Commands for Exporting Antenna Parameters
and Max Field Parameters . . . . . . . . . . . . . . . . . . . . . . . 21-12
ExportRadiationParametersToFile . . . . . . . . . . . . . . . . . 21-12
Contents-17
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Contents-18
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
1 Introduction to VBScript
HFSS uses the Microsoft Visual Basic Scripting Edition (VBScript) scripting
language to record macros. VBScript is based on the Microsoft Visual Basic
programming language.
Using scripts is a fast, effective way to accomplish tasks you want to repeat.
When you execute a script, the commands in the script are performed.
You can write a script using any text editor or you can record a script from
within the HFSS interface. After recording the script from within HFSS, you
can then modify it if necessary using a text editor.
Although HFSS records scripts in VBScript format, it can also execute scripts
in JavaScriptTM format. If you are running a script from a command prompt,
the script can be written in any language that provides the Microsoft COM
methods. The HFSS scripting documentation refers to VBScript format only.
This chapter provides an overview of key VBScript components. For more
details about VBScript, please see the Recommended VBScript References
section at the end of this chapter.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
----------------------------------------------
Script Recorded by Ansoft HFSS Version 10.0
11:03 AM May 3, 2005
----------------------------------------------
Dim oDesign
Dim oEditor
Dim oModule
REM Dim is used to declare variables. Dim means dimension. In VBScript you can use Dim,
REM Public, or Private to declare variables. As VBScript has no built-in data types (like
REM integer, string, etc.), all variables are treated as variants, which can store any type of
REM information. In this example, the three variables will be used as objects. When
REM recording scripts in HFSS, variants that will be used as objects always begin with o.
oDesktop.NewProject
In VBScript, a Sub procedure is a procedure that is called by name, can receive arguments,
and can perform a specific task with a group of statements. Here the Sub procedure
NewProject of the object oDesktop is called. This Sub does not take an input.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
In a Sub or Function procedure call, you can group the input parameters inside
parentheses or without parentheses. Here the four strings are the input parameters of
the Sub procedure InsertDesign of the object oProject.
For additional HFSS script examples, see Chapter 20, Example Scripts.
VBScript Variables
A VBScript variable is a placeholder representing information that may change during the time
your script is running. Use a variable name in a script to view or modify its value.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Declaring Variables
To declare variables explicitly in a script, use the Dim, Public, or Private statements. For
example:
Dim box_xsize
After declaring a variable, you can assign information to it. For example:
box_xsize = "3mm"
Array Variables
Create an array variable when you want to assign more than one related value to a single vari-
able. An array variable contains a series of values. For example:
Dim Primitives(2)
All arrays in VBScript are zero-based, so the array above actually contains 3 elements. You assign
data to each of the arrays elements using an index into the array. Data can be assigned to the
elements of an array as follows:
Primitives(0) = "Box1"
Primitives(1) = "Cone1"
Primitives(2) = "Cylinder1"
Similarly, the data can be retrieved from any element using an index into a particular array ele-
ment. For example:
one_prim = Primitives(1)
You can also use the Array function to assign an array of elements to a variable. For example:
Dim Primitives
Primitives = Array ("Box1", "cone1", "Cylinder1")
Note When using the Array function, do not use parentheses on the variable when it is
declared. For example, use Dim myarray, not Dim myarray().
VBScript Operators
VBScript provides operators, which are grouped into these categories: arithmetic operators,
comparison operators, and logical operators.
Please see the online VBScript Users Guide for more details.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Operator Precedence
When several operations occur in an expression, each part is evaluated and resolved in a pre-
determined order, called operator precedence. You can use parentheses to override the order of
precedence and force some parts of an expression to be evaluated before others. Operations
within parentheses are always performed before those outside the parentheses. Within paren-
theses, however, standard operator precedence is maintained.
When expressions contain operators from more than one category, arithmetic operators are
evaluated first, comparison operators are evaluated next, and logical operators are evaulated
last. Comparison operators all have equal precedence, that is, they are evaluated in the left-to-
right order in which they appear. Arithmetic and logical operators are evaluated in the following
order of precedence.
Arithmetic Operators
Following is a list of VBScripts arithmetic operators.
Symbol Description
^ Exponentiation
- Unary negation
* Multiplication
/ Division
\ Integer division
Mod Modulus arithmetic
+ Addition
- Subtraction
& String concatenation
Comparison Operators
Following is a list of VBScripts comparison operators.
Symbol Description
= Equality
<> Inequality
< Less than
> Greater than
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Logical Operators
Following is a list of VBScripts logical operators:
Symbol Description
Not Logical negation
And Logical conjunction
Or Logical disjunction
Xor Logical exclusion
Eqv Logical equivalence
Imp Logical implication
Using If...Then...Else
Following is an example that demonstrates the If...Then...Else conditional statement:
If obj = "Box1" Then
<statements to execute>
ElseIf obj = "Cylinder1" Then
<statements to execute>
Else
<statements to execute>
End If
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
The InputBox function displays a dialog box with an input field. The value that is typed into
the input field is returned. For example:
Dim users_string
users_string = InputBox ("text prompt", "title of the pop-up dialog _
box", "default text for the input box")
The MsgBox function shows a message and returns a number based on the button the user
presses. For example:
MsgBox ("message text")
Childs, M., Lomax, P., and Petrusha, R. VBScript in a Nutshell: A Desktop Quick Reference.
May 2002. OReilly & Associates. ISBN: 1-56592-720-6.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Maxwell 3D, Maxwell Strata, HFSS, HFSS-IE, Full-Wave Spice, and Optimetrics are registered
trademarks or trademarks of SAS IP Inc. All other trademarks are the property of their respec-
tive owners.
2012 SAS IP Inc., All rights reserved.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
2 HFSS and VBScript
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("AnsoftHfss.HfssScriptInterface")
Set oDesktop = oAnsoftApp.GetAppDesktop()
Set oProject = oDesktop.SetActiveProject("Project1")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
Set oModule = oDesign.GetModule("BoundarySetup")
The lines above define the variables used by HFSS in the script and assign values to the vari-
ables. The variables are used in the following hierarchy:
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
oAnsoftApp
The oAnsoftApp object provides a handle for VBScript to access the AnsoftHfss product.
One example of accessing this object is:
Set oAnsoftApp = CreateObject("AnsoftHfss.HfssScriptInterface")
oDesktop
The oDesktop object is used to perform desktop-level operations, including project manage-
ment.
One example of accessing this object is:
Set oDesktop = oAnsoftApp.GetAppDesktop()
See Chapter 3, Desktop Object Script Commands, for details about script commands recognized
by the oDesktop object.
oProject
The oProject object corresponds to one project open in the product. It is used to manipulate
the project and its data. Its data includes variables, material definitions and one or more
designs. One example of accessing this object is:
Set oProject = oDesktop.GetActiveProject()
See the following chapters for details about the script commands recognized by the oProject
object:
Chapter 4, Project Object Script Commands
Chapter 5, Material Script Commands
Chapter 6, Property Script Commands
Chapter 7, Dataset Script Commands
oDesign
The oDesign object corresponds to an instance of a design in the project. This object is used to
manipulate the design and its data. Its data includes variables, modules, and editors.
One example of accessing this object is:
Set oDesign = oProject.GetActiveDesign()
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
See the following chapters for details about the script commands recognized by the oDesign
object:
Chapter 8, Design Object Script Commands
Chapter 9, Output Variable Script Commands
Chapter 11, Reporter Editor Script Commands
oEditor
The oEditor object corresponds to an editor, such as the 3D Modeler. This object is used to add
and modify data in the editor.
One example of accessing this object is:
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
See Chapter 10, 3D Modeler Editor Script Commands, for details about the script commands rec-
ognized by the oEditor object and Chapter 11, Reporter Editor Script Commands for details
about Reporter editor commands.
oModule
The oModule object corresponds to a module in the design. Modules are used to handle a set of
related functionality.
One example of accessing this object is:
Set oModule = oDesign.GetModule("BoundarySetup")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Recording a Script
Once you start to record a script, your subsequent actions are added to the script. Each inter-
face command has one or more associated script commands that are recorded to the script. The
script is recorded to a text file in .vbs (VBScript) file format.
Running a Script
1 Click Tool>Run Script.
The Open dialog box appears.
2 Use the file browser to locate the folder in which you saved the script, and then double-click
the folders name.
3 Type the name of the script in the File name text box, or click its name, and then click
Open.
HFSS executes the script.
To supply script arguments when running from Tools>Run Script, use the edit field at the
bottom of the file selection dialog. You can access the script arguments using the AnsoftS-
criptHost.arguments collection from vbscript. This is a standard COM collection.
To run a script from a command line (as described in the HFSS Online Help in the Running HFSS
from a Command Line section), use:
-runscriptandexit or -runscript arguments to the HFSS command line syntax.
You can give -scriptargs parameter to the script and specify the arguments described in the
HFSS online help.
If you run the script from DOS prompt as a .vbs file (that is, you don't launch HFSS, but just
launch vbs directly, or use wscript.exe or cscript.exe), the arguments will be in the
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Stopping a Script
On the Tools menu, click Stop Script.
HFSS stops executing the script that has been paused.
Using the line above, the script can be played back in any project.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Syntax Conventions
The following data types will be used throughout this scripting guide:
<string> A quoted string.
<bool> A boolean value. Should be set to either true or false (no quotes).
Example: "SolveInside:=", true
<double> A double precision value.
Example: 1.2
<int> An integer. Example: 1
<value> Can be a number, a VBScript variable, or a quoted string containing a
valid HFSS expression.
Examples:
-"XSize:=", 1
-"XSize:=", "3mm"
-"XSize:=", VBScript_Var
-"XSize:=", "Hfss_Var + 10mm"
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
'At this point, args has the arguments no matter if you are running
'under windows script host or Ansoft script host
msgbox "Count is " & args.Count
for i = 0 to args.Count - 1
msgbox args(i)
next
Named Arguments
Many HFSS script commands use named arguments. The names can appear in three ways:
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
In the first and second examples, the name is formatted as "<Name>:=". This signals HFSS that
this is a name for the next argument in the script command. In the third example, the name is
formatted as "NAME:<name>" and is the first element of the Array.
The names are used both to identify what the data means to you and to inform HFSS which data
is being given. The names must be included or the script will not play back correctly. However, if
you are writing a script, you do not need to pass in every piece of data that the command can
take. For example, if you are modifying a boundary, the script will be recorded to include every
piece of data needed for the boundary, whether or not it was modified. If you are writing a
script by hand, you can just add the data that changed and omit anything that you do not want
to change. HFSS will use the names to determine which data you provided.
For example, when editing an impedance boundary, HFSS records the edit impedance boundary
command as follows:
oModule.EditImpedance "Imped1", Array("NAME:Imped1", _
"Resistance:=", "100", "Reactance:=", "50", _
"InfGroundPlane:=", false)
If you only want to change the resistance, then you can leave out the other data arguments
when you are manually writing a script:
oModule.EditImpedance "Imped1", Array("NAME:Imped1", _
"Resistance:=", "100")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
If the full path to the script is not specified, HFSS searches for the specified script in the follow-
ing locations, in this order:
Personal library directory.
This is the PersonalLib subdirectory in the project directory. The project directory can be
specified in the General Options dialog box (click Tools>Options>General Options to open
this dialog box) under the Project Options tab.
User library directory.
This is the userlib subdirectory in the library directory. The library directory can be specified
in the General Options dialog box (click Tools>Options>General Options to open this dialog
box) under the Project Options tab.
System library directory.
This is the syslib subdirectory in the library directory. The library directory can be specified
in the General Options dialog box (click Tools>Options>General Options to open this dialog
box) under the Project Options tab.
HFSS installation directory.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Editing Properties
Any data that is shown in the dockable Properties dialog box or in the modal Properties pop-up
window is called a property. For example, project and local variables are properties. The XSize
of a box in the Geometry editor is also a property. See Chapter 6, Property Script Commands,
for an explanation of how to manipulate properties in a script.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
3 Ansoft Application Object
Script Commands
The Application object commands permit you to set parameters for RAM and
processor use. Application object commands should be executed by the
oAnsoftApp object.
oAnsoftApp.<CommandName> <args>
GetAppDesktop
GetDesiredRamMBLimit
GetHPCLicenseType
GetMaximumRamMBLimit
GetMPISpawnCmd
GetMPIVendor
GetNumberOfProcessors
GetUseHPCForMP
SetDesiredRamMBLimit
SetHPCLicenseType
SetMaximumRamMBLimit
SetNumberOfProcessors
SetUseHPCForMP
SetMPISpawnCmd
SetMPIVendor
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
GetAppDesktop
Use: GetAppDesktop is a function of oAnsoftApp. This function does not take
an input and it returns an object. The object is assigned to the variable
oDesktop.
Syntax: GetAppDesktop()
Return Value: Object.
Parameters: None
Example:
Set oDesktop = oAnsoftApp.GetAppDesktop()
GetDesiredRamMBLimit
Use: Gets the Desired RAM Limit (MB) value in HFSS. Not used in HFSS-IE.
Syntax: GetDesiredRamMBLimit()
Return Value: Returns the Desired RAM Limit in megabytes (MB).
Type: <int>
Parameters: <ProductName>
Type: String, HFSS (default)
Example:
desired_ram = oAnsoftApp.GetDesiredRamMBLimit()
GetHPCLicenseType
Use: Gets the specified HPC license type.
Syntax: GetHPCLicenseType(BSTR productName, BSTR* type)
Return Value:
Parameters: <ProductName>
Ansoft Product such as HFSS.
<type>
pool or pack
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("AnsoftHfss.HfssScriptInterface")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
GetMaximumRamMBLimit
Use: Gets the Maximum RAM Limit (MB) value in HFSS. Not used in HFSS-IE.
Syntax: GetMaximumRamMBLimit()
Return Value: Returns the Maximum RAM Limit in megabytes (MB).
Type: <int>
Parameters: <ProductName>
Type: String, HFSS (default), HFSSIE
Example:
max_ram = oAnsoftApp.GetMaximumRamMBLimit()
GetMPISpawnCmd
Use: For Linux authentication, gets the remote spawn command, either SSH
(default) or RSH.
Command: Tools>Options>HFSS Options, Solver tab, or Tools>Options>HFSS-IE
Options, Solver tab.
Syntax: GetMPISpawnCmd <product>
Return Value: SSH or RSH
Parameters: <ProductName>
Type: String, HFSS (default), HFSS-IE
Example:
GetMPIVendor
Use: For HFSS or HFSS-IE analysis using distributed memory, get the MPI vendor.
Command: Tools>Options>HFSS Options, Solver tab, or Tools>Options>HFSS-IE
Options, Solver tab
Syntax: GetMPIVendor <product>
Return Value: return <string>, either "PlatformComputing" or "Intel"
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Parameters: <ProductName>
Type: String, HFSS (default), HFSSIE
Example:
"GetMPIVendor HFSS
GetNumberOfProcessors
Use: Gets the Number of Processors value.
Syntax: GetNumberOfProcessors()
Return Value: Returns the Number of Processors.
Type: <int>
Parameters: <ProductName>
Type: String, HFSS (default)
Example:
numprocessors = oAnsoftApp.GetNumberOfProcessors()
GetUseHPCForMP
Use: Gets the Tools>Options>HFSS Options Solver tab selection for Use HPC
licenses for multiprocessing and distributed frequency points, rather
than the MP License.
Syntax: GetUseHPCForMP(BSTR productName, BOOL* flag)
Return Value: None
Parameters: <productName>
Type: String, HFSS (default), or HFSSIE
<Bool>
0 is False, 1 is True.
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("AnsoftHfss.HfssScriptInterface")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
oAnsoftApp.GetUseHPCForMP
oAnsoftApp.GetHPCLicenseType
oAnsoftApp.SetHPCLicenseType("Pool")
oAnsoftApp.SetUseHPCForMP(1)
SetMaximumRamMBLimit
Use: Sets the Maximum RAM Limit (MB) value in HFSS. Not used in HFSS-IE.
Syntax: SetMaximumRamMBLimit(<MaximumRAMLimit> <ProductName>)
Return Value: None
Parameters: <MaximumRAMLimit>
Type: <int>
<ProductName>
Type: String, HFSS (default)
Example:
oAnsoftApp.SetMaximumRamMBLimit(2000)
SetMPISpawnCmd
Use: For Linux authentication, sets the remote spawn command as SSH (default)
or RSH.
Command: Tools>Options>HFSS Options, Solver tab, or Tools>Options>HFSS-IE
Options, Solver tab.
Syntax: SetMPISpawnCmd <cmd>,<product>
Return Value: None
Parameters: <cmd>
Type: String, SSH (default), RSH.
<ProductName>
Type: String, HFSS (default), HFSS-IE
Example:
SetMPIVendor
Use: For using distributed memory processing, set the Vendor.
Command: Tools>Options>HFSS-IE Options, Solver tab or Tools>OptionsHFSS
Options, Solver tab.
Syntax: SetMPIVendor <string>, <product>
Return Value: None
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Parameters: <string>
Type: String, Intel (default), or Platform Computing.
<ProductName>
Type: String, HFSS (default), or HFSSIE
Example:
SetNumberOfProcessors
Use: Sets the Number of Processors value.
Syntax: SetNumberOfProcessors(<NumProcessors> <ProductName>)
Return Value: None
Parameters: <NumProcessors>
Type: <int>
<ProductName>
Type: String, HFSS (default)
Example:
oAnsoftApp.SetNumberOfProcessors(2)
SetUseHPCForMP
Use: Equivalent to Tools>Options>HFSS Options Solver tab selection for Use
HPC licenses for multiprocessing and distributed frequency points, rather
than the MP License.
Syntax: SetUseHPCForMP(BOOL flag, BSTR productName)
Parameters: <flag>
Type: String,
<ProductName>
Type: String, HFSS (default) or HFSSIE
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("AnsoftHfss.HfssScriptInterface")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
4 Desktop Object Script
Commands
CloseAllWindows
CloseProject
CloseProjectNoForce
Count
EnableAutoSave
GetAutoSaveEnabled
GetActiveProject
GetDesigns
GetDistributedAnalysisMachines
GetName
GetLibraryDirectory
GetProjects
GetProjectDirectory
GetProjectList
GetTempDirectory
GetVersion
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
NewProject
OpenMultipleProjects
OpenProject
PauseScript
Print
QuitApplication
RestoreWindow
RunProgram
RunScript
SetActiveProject
SetActiveProjectByPath
SetLibraryDirectory
SetProjectDirectory
SetTempDirectory
Sleep
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
CloseAllWindows
Use: Closes all MDI child windows on the desktop.
Command: From main menu, Window>CloseAll.
Syntax: CloseAllWindows()
Return Value: None
Parameters: None
Example:
Desktop.CloseAllWindows()
CloseProject
Use: Closes a specified project. Changes to the project will not be saved. Save
the project using the Project command Save or SaveAs before closing to
save changes.
Command: File>Close
Syntax: CloseProject <ProjectName>
Return Value: None
Parameters: <ProjectName>
Type: <string>
Example:
oDesktop.CloseProject "Project1"
CloseProjectNoForce
Use: Closes a specified project unless there are simulations ongoing. Changes to
the project will not be saved. Save the project using the Project command
Save or SaveAs before closing to save changes.
Command: File>Close
Syntax: CloseProjectNoForce <ProjectName>
Return Value: None
Parameters: <ProjectName>
Type: <string>
Example:
oDesktop.CloseProjectNoForce "Project1"
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Count
Use: Gets the total number of queried projects or designs obtained by
GetProjects() and GetDesigns() commands. See the example query.
Syntax: Count
Return Value: Returns an integer value.
Parameters: None
Example: set projects = oDesktop.GetProjects()
numprojects = projects.Count
Example:
' iterate through projects and designs using for each
for each prj in oDesktop.GetProjects()
msgbox prj.GetName()
for each design in prj.GetDesigns()
msgbox design.GetName()
next
next
EnableAutoSave
Use: Enable or disable autosave feature.
Syntax: EnableAutoSave(bool)
Return Value: None
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Parameters: None
Example:
oDesktop.EnableAutoSave(true)
GetActiveProject
Use: Returns the project that is active in the desktop.
Command: None
Syntax: GetActiveProject
Return Value: The project that is active in the desktop.
Parameters: None
Example:
Set oProject = oDesktop.GetActiveProject ()
GetAutoSaveEnabled
Use: Checks to see if the autosave feature is enabled.
Command: None
Syntax: GetAutoSaveEnabled
Return Value: Boolean
Parameters: None
Example:
oDesktop.GetAutoSaveEnabled()
GetDesigns
Use: For querying designs within a queried project obtained by the GetProjects()
command. Once you have the designs you can iterate through them using
standard VBScript methods. See the example query.
Syntax: GetDesigns()
Return Value: Returns a COM collection of designs in the given project.
Parameters: None
Example:
set projects = oDesktop.GetProjects()
set designs = projects(0).GetDesigns()
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
GetDistributedAnalysisMachines
Use: Gets a list of machines used for distributed analysis. You can iterate
through the list using standard VBScript methods.
Syntax: GetDistributedAnalysisMachines()
Return Value: Returns a COM collection of machines used for distributed analysis.
Parameters: None
Example:
For each machine in oDesktop.GetDistributedAnalysisMachines()
msgbox machine
next
GetName [Desktop]
Use: Gets names of queried projects or designs obtained by GetProjects() and
GetDesigns() commands. See the example query.
Syntax: GetName()
Return Value: Returns a name of type string.
Parameters: None
Example:
set projects = oDesktop.GetProjects()
project_name = projects(0).GetName()
GetLibraryDirectory
Use: Gets the library directory path.
Syntax: GetLibraryDirectory
Return Value: Returns a directory path.
Type: <string>
Parameters: None
Example:
libdir = oDesktop.GetLibraryDirectory
GetProjects
Use: For querying projects. Once you have the projects you can iterate through
them using standard VBScript methods. See the example query.
Syntax: GetProjects()
Return Value: Returns a COM collection of opened projects.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Parameters: None
Example:
set projects = oDesktop.GetProjects()
GetProjectDirectory
Use: Gets the project directory path.
Syntax: GetProjectDirectory
Return Value: Returns a directory path.
Type: <string>
Parameters: None
Example:
projdir = oDesktop.GetProjectDirectory
GetProjectList
Use: Returns a list of all projects that are open in the desktop.
Command: None
Syntax: GetProjectList()
Return Value: An array of strings, the names of all open projects in the desktop.
Parameters: None
Example:
list_of_projects = oDesktop.GetProjectList()
GetTempDirectory
Use: Gets the temp directory path.
Syntax: GetTempDirectory
Return Value: Returns a directory path.
Type: <string>
Parameters: None
Example:
tempdir = oDesktop.GetTempDirectory
GetVersion
Use: Returns a string representing the version.
Syntax: GetVersion()
Return Value: string
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Parameters: None
Example:
msgbox(oDesktop.GetVersion()), displays "10.0"
NewProject
Use: Creates a new project. The new project becomes the active project.
Command: File>New
Syntax: NewProject
Return Value: An object reference to the newly-added project.
Parameters: None
Example:
Set oProject = oDesktop.NewProject
OpenMultipleProjects
Use: Opens all files of a specified type in a specified directory.
Command: File>Multiple Open
Syntax: OpenMultipleProjects <Directory> <FileType>
Return Value: None
Parameters: <Directory>
Type: <string>
<FileType>
Type: <string>
Example:
oDesktop.OpenMultipleProjects "D:/Projects", "*.hfss"
OpenProject
Use: Opens a specified project.
Command: File>Open
Syntax: OpenProject <FileName>
Return Value: An object reference to the newly-opened project.
Parameters: <FileName>: Full path of the project to open.
Type: <string>
Example:
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
oDesktop.OpenProject "D:/Projects/Project1.hfss"
PauseScript
Use: Pauses the scripts execution and displays a message in a pop-up dialog box
to the user. The script execution will not resume until the user clicks
Tools>Resume Script.
Command: Tools>Pause Script
Syntax: PauseScript <Message>
Return Value: None
Parameters: <Message>
Type: <string>
Example:
oDesktop.PauseScript "Text to display in pop-up dialog box"
Print
Use: Prints the contents of the active view window.
Command: File>Print
Syntax: Print
Return Value: None
Parameters: None
Example:
oDesktop.Print
QuitApplication
Use: Exits the desktop.
Command: File>Exit
Syntax: QuitApplication
Return Value: None
Parameters: None
Example:
oDesktop.QuitApplication
RestoreWindow
Use: Restores a minimized HFSS window.
Command: None
Desktop Object Script Commands 4-9
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Syntax: RestoreWindow
Return Value: None
Parameters: None
Example:
oDesktop.RestoreWindow
RunProgram
Use: Runs an external program.
Command: None
Syntax: RunProgram <ProgName>, <ProgPath>, <WorkPath>, <ArgArray>
Return Value: None
Parameters: <ProgName>
Type: <string>
Name of the program to run.
<ProgPath>
Type: <string>
Location of the program. Pass in an empty string to use the system path.
<WorkPath>
Type: <string>
Working directory in which program will start.
<ArgArray>
Type: Array of strings
Arguments to pass to the program. If no arguments, pass in None.
Example:
oDesktop.RunProgram "winword.exe", _
"C:\Program Files\Microsoft Office\Office10",_
"", None
RunScript
Use: Launches another script from within the script currently being executed.
Command: Tools>Run Script
Syntax: RunScript <ScriptPath>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
SetActiveProject
Use: Returns a specified project as the active project in the desktop.
Command: None
Syntax: SetActiveProject <ProjectName>
Return Value: The specified project becomes active in the desktop.
Parameters: <ProjectName>
Type: <string>
Example:
Set oProject = oDesktop.SetActiveProject ("Project1")
SetActiveProjectByPath
Use: If a user has two projects open with the same name, the result of
SetActiveProject is ambiguous (The first one listed in selected). This
command permits unambiguous specification of the active project.
Syntax: SetActiveProjectByPath()
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
SetLibraryDirectory
Use: Sets the library directory path. The specified directory must already exist
and contain a syslib folder.
Syntax: SetLibraryDirectory <DirectoryPath>
Return Value: None
Parameters: <DirectoryPath>
Type: <string>
Example:
oDesktop.SetLibraryDirectory "c:\libraries"
SetProjectDirectory
Use: Sets the project directory path. The directory will be automatically created
if it does not already exist.
Syntax: SetProjectDirectory <DirectoryPath>
Return Value: None
Parameters: <DirectoryPath>
Type: <string>
Example:
oDesktop.SetProjectDirectory "c:\projects"
SetTempDirectory
Use: Sets the temp directory path. The directory will be automatically created if
it does not already exist.
Syntax: SetTempDirectory <DirectoryPath>
Return Value: None
Parameters: <DirectoryPath>
Type: <string>
Example:
oDesktop.SetTempDirectory "c:\temp"
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Sleep
Use: Suspends execution of HFSS for the specified number of milliseconds, up to
60,000 milliseconds (1 minute).
Command: none
Syntax: Sleep <TimeInMilliseconds>
Return Value: None
Parameters: <TimeInMilliseconds>
Type: <int>
Example:
oDesktop.Sleep 1000
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
5 Project Object Script
Commands
Close
CopyDesign
CutDesign
DeleteDesign
GetActiveDesign
GetDesign
GetName [Project]
GetPath
GetTopDesignList
InsertDesign
Paste
Redo
Save
SaveAs
SetActiveDesign
SimulateAll
Undo
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Close
Use: Closes the active project. Unsaved changes will be lost.
Command: None
Syntax: Close
Return Value: None
Parameters: None
Example:
oProject.Close
CopyDesign
Use: Copies a design.
Command: Edit>Copy
Syntax: CopyDesign <DesignName>
Return Value: None
Example:
oProject.CopyDesign "HFSSDesign1"
CutDesign
Use: Cuts a design from the active project. The design is stored in memory and
can be pasted in any HFSS project.
Command: Edit>Cut
Syntax: CutDesign <DesignName>
Return Value: None
Example:
oProject.CutDesign "HFSSDesign1"
Warning This is a legacy command that is no longer supported and should not be
used as it may have unintended effects on solved designs.
DeleteDesign
Use: Deletes a specified design in the project.
Command: Edit>Delete
Syntax: DeleteDesign <DesignName>
Return Value: None
Example:
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
oProject.DeleteDesign "HFSSDesign2"
GetActiveDesign
Use: Returns the design in the active project.
Command: None
Syntax: GetActiveDesign
Return Value: The active design.
Parameters: None
Example:
Set oDesign = oProject.GetActiveDesign ()
GetDesign
Use: Returns the specified design.
Command: None
Syntax: GetDesign <DesignName>
Return Value: The specified design.
Parameters: <DesignName>
Type: <string>
Name of the design to return.
Example:
Set oDesign = oProject.GetDesign ("HFSSDesign1")
GetName [Project]
Use: Returns the project name.
Command: None
Syntax: GetName
Return Value: The active projects name.
Parameters: None
Example:
name = oProject.GetName ()
GetPath
Use: Returns the location of the project on disk.
Command: None
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Syntax: GetPath
Return Value: The path to the project, which does not include the project name.
Parameters: None
Example:
path = oProject.GetPath ()
GetTopDesignList
Use: Returns a list of the names of the top-level designs.
Command: None
Syntax: GetTopDesignList
Return Value: An array of strings that are the names of the top-level designs.
Parameters: None
Example:
name_list = oProject.GetTopDesignList ()
InsertDesign
Use: Inserts a new design in the project. In HFSS scripts, the last argument will
always be empty.
Command: Project>Insert HFSS Design
Syntax: InsertDesign "HFSS", <DesignName>, <SolutionType>, ""
Return Value: Object
Parameters: <DesignName>
Type: <string>
Name of the new design.
<SolutionType>
Type: <string>
Solution type of the new design. Can be "DrivenModal",
"DrivenTerminal", or "Eigenmode".
Example:
Set oDesign = oProject.InsertDesign("HFSS", "HFSSDesign3",_
"DrivenModal", "")
Paste [Design]
Use: Pastes a design in the active project.
5-4 Project Object Script Commands
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Command: Edit>Paste
Syntax: Paste
Return Value: None
Parameters: None
Example:
oProject.Paste
Save
Use: Saves the active project.
Command: File>Save
Syntax: Save
Return Value: None
Parameters: None
Example:
oProject.Save
SaveAs
Use: Saves the project under a new name.
Command: File>Save As
Syntax: SaveAs <FileName> <OverWrite>
Return Value: None
Parameters: <FileName>
Type: <string>
New name for the file.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<OverWrite>
Type: <bool>
Set to true if an existing project by that name should be overwritten.
Example:
oProject.SaveAs "D:/projects/project1.hfss", true
SetActiveDesign
Use: Sets a new design to be the active design.
Command: None
Syntax: SetActiveDesign <DesignName>
Return Value: The named design becomes active.
Parameters: <DesignName>
Type: <string>
Name of the design to set as the active design.
Example:
Set oDesign = oProject.SetActiveDesign ("HFSSDesign2")
SimulateAll
Use: Runs the SimulateAll project-level script command from the script,
which will simulate all HFSS solution setups and Optimetrics setups for all
design instances in the project.
Command: None
Syntax: None
Return Value: SimulateAll script command.
Parameters: None
Example:
oProject.SimulateAll
Undo [Project]
Use: Cancels the last project level command.
Command: Edit>Undo
Syntax: Undo
Return Value: None
Parameters: None
Example:
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
oProject.Undo
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
6 Material Script Commands
AddMaterial
DoesMaterialExist
EditMaterials
ExportMaterial
RemoveMaterial
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
AddMaterial
Use: Adds a local material.
Command: Add Material command in the material editor.
Syntax: AddMaterial Array("NAME:<MaterialName>",
<MatProperty>, <MatProperty>, ...)
Return Value: None
Parameters: <MatProperty> (simple material)
"<PropertyName>:=", <value>
<PropertyName>
Type: <string>
Should be one of the following: "permittivity",
"permeability", "conductivity"
"dielectric_loss_tangent",
"magnetic_loss_tangent", "saturation_mag",
"lande_g_factor", "delta_H"
property_type
Type: <string>
Should be "AnisoProperty".
unit
Type: <string>
Possible values:
delta_H: "Oe"
saturation_mag: "Gauss", "uGauss", "Tesla", "uTesla"
other properties: "" (empty string)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Example:
Set oDefinitionManager = oProject.GetDefinitionManager()
oDefinitionManager.AddMaterial Array("NAME:Material2",_
"dielectric_loss_tangent:=", "44",
Array("NAME:saturation_mag",_
"property_type:=", "AnisoProperty",_
"unit:=", "Gauss",_
"component1:=", "11", _
"component2:=", "22", _
"component3:=", "33"), _
"delta_H:=", "44Oe")
DoesMaterialExist
Use: Checks for the presence of a material in the library by name
Command: None
Syntax: DoesMaterialExist(<MaterialName>)
Return Value: Boolean
Parameters: <materialName>
Type: <string>
Name of the material to search for in the material database
Example:
Set oProject = oDesktop.SetActiveProject("cir_th")
Set oDesign = oProject.SetActiveDesign("Design1")
Set oDefinitionManager = oProject.GetDefinitionManager()
if(oDefinitionManager.DoesMaterialExist("vacuum")) then
MsgBox("It Exists")
else
MsgBox("It Doesn't Exist...Creating")
oDefinitionManager.AddMaterial Array("NAME:Material5", _
"CoordinateSystemType:=", "Cartesian", _
Array("NAME:AttachedData"), _
Array("NAME:magnetic_coercivity",
"property_type:=", "VectorProperty", _
"Magnitude:=", "-1A_per_meter", _
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"DirComp1:=", "1", _
"DirComp2:=", _
"2", "DirComp3:=", "3"))
end if
EditMaterial
Use: Modifies an existing material.
Command: View/Edit Materials command in the material editor.
Syntax: EditMaterial <OriginalName>, Array("NAME:<NewName>",
<MatProperty>, <MatProperty>, ...)
Return Value: None
Parameters: <OriginalName>
Type: <string>
Name of the material before editing.
<NewName>
Type: <string>
New name for the material.
ExportMaterial
Use: Exports a local material to a library.
Command: Export to Library command in the material editor.
Syntax: ExportMaterial <ExportData>, <Library location>
Return Value: None
Parameters: <ExportData>
Array("NAME:<LibraryName>",
<MaterialName>, <MaterialName>, ...)
Example:
oProject.ExportMaterial Array("NAME:mo0907b",_
"Material1", "Material2", "Material3"),_
"UserLib"
RemoveMaterial
Use: Removes a material from a library.
Command: Remove Material(s) command in the material editor.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<IsProjectMaterial>
Type: <bool>
If true, HFSS assumes the material is a project material. In this case, the last two
parameters will be ignored.
<LibraryName>
Type: <string>
The name of the user or personal library where the material resides.
<LibraryLocation>
Type: <string>
Should be "UserLib" or "PersonalLib".
Example:
oProject.RemoveMaterial "Material1", false, "mo0907", "UserLib"
oProject.RemoveMaterial "Material1", true, "Local", "Project"
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
7 Property Script Commands
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<PropTab>
"ProjectVariableTab"
AnsoftHfss Design
Local Variables:
<PropServer>
"LocalVariables"
<PropTab>
"LocalVariableTab"
AnsoftHfss Modules
<PropServer>
Format is: <ModuleName>:<ItemName>, where <ItemName> is the
boundary name, solution setup name, etc., depending on which module
is being edited.
Example: <PropServer> for the boundary "PerfE1" is
"BoundarySetup:PerfE1"
<PropTab>
Boundary module: "HfssTab"
Mesh Operations module: "MeshSetupTab"
Analysis module: "HfssTab"
Optimetrics module: "OptimetricsTab"
Solutions module: Does not support properties.
Field Overlays module: "FieldsPostProcessorTab"
Radiation module: "RadFieldSetupTab"
<PropTab>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"Geometry3DAttributeTab"
Operation on an object:
<PropServer>
Format is <ObjName>:<OperationName>:<int>
Concatenation of object name, operation name, and the index of the operation.
For example: "Box2:CreateBox:2" refers to the second
"CreateBox" command in Box2s history.
<PropTab>
"Geometry3DCmdTab"
Reporter
Operations on Report properties:
Format is <ReportSetup>
For example, to set the Company Name in the plot header to My Company:
Set oModule = oDesign.GetModule("ReportSetup")
oModule.ChangeProperty Array("NAME:AllTabs",_
Array("NAME:Header",_ Array("NAME:PropServers",_
"XY Plot1:Header"), Array("NAME:ChangedProps",_
Array("NAME:Company Name", "Value:=", "My Company"))))
ChangeProperty
GetProperties
GetPropertyValue
GetArrayVariables
GetVariables
SetPropertyValue
SetVariableValue
Additional Property Scripting Example
Example Use of Record Script and Edit Properties
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ChangeProperty
Use: Changes to properties are scripted using the ChangeProperty command.
This command can be executed by the oEditor to change editor
properites, by the oDesign to change design level properties, and by the
oProject to change project level properties. The command can be used to
create, edit, and/or remove properties. In HFSS, only Variable and
Separator properties can be deleted.
Use the script recording feature and edit a property, and then view the resulting script
entry or use GetPropertyValue for the desired property to see the expected format.
Command: None
Syntax: ChangeProperty Array("Name:AllTabs", <PropTabArray>,
<PropTabArray>, ...)
ChangeProperty(<modulename>:<setup name>:<sweep name>)
Return Value: None
Parameters: <PropTabArray>
Array("Name:<PropTab>",
<PropServersArray>,
<NewPropsArray>,
<ChangedPropsArray>,
<DeletedPropsArray>)
<PropServersArray>
Array("Name:PropServers", <PropServer>,
<PropServer>, ...)
<NewPropsArray>
Array("Name:NewProps", <PropDataArray>,
<PropDataArray>,...)
<ChangedPropsArray>
Array("Name:ChangedProps",<PropDataArray>,
<PropDataArray>, ...)
<DeletedPropsArray>
Array("Name:DeletedProps", <PropName>,
<PropName>, ...)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<PropDataArray>
Array("NAME:<PropName>",
"PropType:=", <PropType>,
"NewName:=", <string>,
"Description:=", <string>,
"NewRowPosition:=", <int>,
"ReadOnly:=", <bool>,
"Hidden:=", <bool>,
<PropTypeSpecificArgs>)
<PropType>
Type: string
Identifies the type of property when a new property is added. In HFSS, only separator
properties and variable properties can be added.
"SeparatorProp"
"VariableProp"
"TextProp"
"NumberProp"
"ValueProp"
"CheckboxProp"
"MenuProp"
"PointProp"
"VPointProp"
"V3DPointProp"
"ButtonProp"
NewName
Specify the new name of a property if the propertys name is being edited. In HFSS,
the name can only be changed for separators and variables.
Description
Specify a description of the property. In HFSS, the description can only be changed
for separators and variables.
NewRowPosition
Used to reorder rows in the Property dialog box. In HFSS, this only applies to the
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ReadOnly
Used to mark a property as "read only" so it can not be modified. In HFSS, this flag
can only be set for variables and separators.
Hidden
Used to hide a property so it can not be viewed outside of the Property dialog box.
In HFSS, this flag can only be set for variables and separators.
<PropTypeSpecificArgs>
SeparatorProp: no arguments
TextProp: "Value:=", <string>
NumberProp: "Value:=", <double>
ValueProp: "Value:=", <value>
CheckboxProp: "Value:=", <bool>
MenuProp: "Value:=", <string>
PointProp"X:=", <double>, "Y:=", <double>
VPointProp: "X:=", <value>, "Y:=", <value>
V3DPointProp: "X:=",<value>, "Y:=",<value>,
"Z:=",<value>
Material Button: "Material:=", <string>
Color Button: "R:=",<int>,"G:=",<int>,"B:=",<int>
Transparency Button:"Value:=", <double>
Parameters:
<OptimizationFlagsArray>
Array("NAME:Optimization",
"Included:=", <bool>,
7-6 Property Script Commands
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"Min:=", <value>,
"Max:=", <value>)
<Tuning flagsArray>
Array("NAME:Tuning",
"Included:=", <bool>,
"Step:=", <value>,
"Min:=", <value>,
"Max:=", <value>)
<SensitivityFlagsArray>
Array("NAME:Sensitivity",
"Included:=", <bool>,
"Min:=", <value>,
"Max:=", <value>,
"IDisp:=", <value> )
<StatisticsFlagsArray>
Array("NAME:Statistical",
"Included:=", <bool>,
"Dist:=", <Distribution>,
"StdD:=", <value>,
"Min:=", <value>,
"Max:=", <value>,
"Tol:=", <string>)
<Distribution>
Type: string
Value should be "Gaussian" or "Uniform"
StdD
Standard deviation.
Min
Low cut-off for the distribution.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Max
High cut-off for the distribution.
Tol
Tolerance for uniform distributions. Format is "<int>%".
Example: "20%".
Example: Adding a new project level variable "$width":
oProject.ChangeProperty Array("NAME:AllTabs",_
Array("NAME:ProjectVariableTab",_
Array("NAME:PropServers", "ProjectVariables"),_
Array("NAME:NewProps",_
Array("NAME:$width",_
"PropType:=", "VariableProp",_
"Value:=", "3mm",_
"Description:=", "my new variable"))))
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
GetProperties
Use: Gets a list of all the properties belonging to a specific PropServer and
PropTab. This can be executed by the oProject, oDesign, or oEditor
variables.
Command: None
Syntax: GetProperties( <PropTab>, <PropServer> )
GetProperties(<modulename>:<setup name>:<sweep name>)
Return Value: Variant array of strings the names of the properties belonging to the prop
server.
Example:
Dim all_props
all_props = oDesign.GetProperties("HfssTab",_
"BoundarySetup:WavePort1")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
GetPropertyValue
Use: Gets the value of a single property. This can be executed by the oProject,
oDesign, or oEditor variables.
Use the script recording feature and edit a property, and then view the resulting script to
see the format for that property.
Command: None
Syntax: GetPropertyValue(<PropTab>, <PropServer>, <PropName>)
GetPropertyValue(<modulename>:<setup name>:<sweep name>)
Return Value: String representing the property value.
Example:
value_string = _
oEditor.GetPropertyValue("Geometry3DCmdTab",_
"Box1:CreateBox:1", "XSize")
GetArrayVariables
Use: Returns a list of array variables. To get a list of indexed Project variables,
execute this command using oProject. To get a list of indexed local
variables, use oDesign.
Syntax: GetArrayVariables()
Return Value: Variant array of strings the names of the array variables.
Example:
Dim var_array
project_var_array = oProject.GetArrayVariables()
local_var_array = oDesign.GetArrayVariables()
GetVariables
Use: Returns a list of all variables. To get a list of non-indexed Project variables,
execute this command using oProject. To get a list of non-indexed local
variables, use oDesign.
Syntax: GetVariables()
Return Value: Variant array of strings the names of the variables.
Example:
Dim var_array
project_var_array = oProject.GetVariables()
local_var_array = oDesign.GetVariables()
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
GetVariableValue
Use: Gets the value of a single variable. To get the value of Project variables,
execute this command using oProject. To get the value of local variables,
use oDesign.
Command: None
Syntax: GetVariableValue( <VarName> )
Return Value: A string representing the value of the variable.
Parameters: <VarName>
Type: string
Name of the variable to access.
Example:
project_var_value_string = oProject.GetVariableValue("var_name")
Example:
local_var_value_string = oDesign.GetVariableValue("var_name")
SetPropertyValue
Use: Sets the value of one property. This is not supported for properties of the
following types: ButtonProp, PointProp, V3DPointProp, and
VPointProp. Only the ChangeProperty command can be used to modify
these properties. This can be executed by the oProject, oDesign, or
oEditor variables.
Use the script recording feature and edit a property, and then view the resulting script
entry or use GetPropertyValue for the desired property to see the expected for-
mat.
Command: None
Syntax: SetPropertyValue <PropTab>, <PropServer>, <PropName>,
<PropValue>
Return Value: None
Parameters: <PropValue>
Type: String
Contains the value to set the property. The formatting is different depending on what
type of property is being edited.
Example: oEditor.SetPropertyValue _
"Geometry3DCmdTab","Box1:CreateBox:1",_
"XSize", "3mm"
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
SetVariableValue
Use: Sets the value of a variable. To set the value of a Project variable, execute
this command using oProject. To set the value of a local variable, use
oDesign.
Syntax: SetVariableValue <VarName>, <VarValue>
Return Value: None
Parameters: <VarValue>
Type: <value>
New value for the variable.
Example:
oProject.SetVariableValue "$Var1", "3mm"
Example:
var_value = "2Ohm"
oDesign.SetVariableValue "Var2", var_value
Example:
Dim all_props
Dim prop
all_props = oEditor.GetProperties("Geometry3DCmdTab",_
"Box1:CreateBox:1")
For Each prop In all_props
val = oEditor.GetPropertyValue("Geometry3DCmdTab",_
"Box1:CreateBox:1", prop)
new_val = InputBox("New Value of " + prop + ":",_
"Current Value of '" + prop + "' is " + val, val)
If new_val <> val Then
oEditor.SetPropertyValue "Geometry3DCmdTab",_
"Box1:CreateBox:1", prop, new_val
val = _
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
oEditor.SetPropertyValue("Geometry3DCmdTab",_
"Box1:CreateBox:1", prop)
MsgBox("Now the value of '" + prop + "' is " + val)
End If
Next
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
8 Dataset Script Commands
AddDataSet
DeleteDataSet
EditDataSet
ImportDataSet
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
AddDataset
Use: Adds a dataset.
Command: Project>Datasets>Add
Syntax: AddDataset <DatasetDataArray>
Return Value: None
Parameters: <DatasetDataArray>
Array("NAME:<DatasetName>",
Array("NAME:Coordinates", <CoordinateArray>,
<CoordinateArray>, ...)
<DatasetName>
Type: <string>
Name of the dataset.
<CoordinateArray>
Array("NAME:Coordinate",
"X:=", <double>, "Y:=", <double>)
Example:
oProject.AddDataset Array("NAME:ds1",_
Array("NAME:Coordinates",_
Array("NAME:Coordinate", "X:=", 1, "Y:=", 2,_
Array("NAME:Coordinate", "X:=", 3, "Y:=", 4),_
Array("NAME:Coordinate", "X:=", 5, "Y:=", 7),_
Array("NAME:Coordinate", "X:=", 6, "Y:=", 20)))
DeleteDataset
Use: Deletes the specified dataset.
Command: Project>Datasets>Remove
Syntax: DeleteDataset <DatasetName>
Return Value: None
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EditDataset
Use: Modifies a dataset. When a dataset is modified, its name as well as its data
can be changed.
Command: Project>Datasets>Edit
Syntax: EditDataset <OriginalName> <DatasetDataArray>
Return Value: None
Parameters: <OriginalName>
Type: <string>
Name of the dataset before editing.
Example:
oProject.EditDataset "ds1" Array("NAME:ds2",_
Array("NAME:Coordinates",_
Array("NAME:Coordinate", "X:=", 1, "Y:=", 2),_
Array("NAME:Coordinate", "X:=", 3, "Y:=", 4)))
ImportDataset
Use: Imports a dataset from a named file.
Command: Project>Dataset...>Import
Syntax: ImportDataset <path>
Return Value: None
Parameters: <Path>
Type: <string>
Path of the dataset.
Example:
Set oProject = oDesktop.SetActiveProject("OptimTee")
oProject.ImportDataset "F:/work/BSR_1_dk.tab"
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
9 Design Object Script
Commands
<ModuleName>
Name used to access one of the following HFSS modules:
Boundary module: "BoundarySetup"
Mesh Operations module: "MeshSetup"
Analysis module: "AnalysisSetup"
Optimetrics module: "Optimetrics"
Solutions module: "Solutions"
Field Overlays module: "FieldsReporter"
Radiation module: "RadField"
ApplyMeshOps
Analyze
AnalyzeDistributed
AssignDCThickness
ConstructVariationString
DeleteLinkedDataVariation
ExportConvergence
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ExportMeshStats
ExportProfile
GetEdit SourcesCount
GetModule
GetName
GetNominalVariation
GetSolutionType
GetSolveInsideThreshold
GetSourceContexts
GetVariationVariableValue
Redo
RenameDesignInstance
SARSetup
SetActiveEditor
SetDesignSettings
SetSolutionType
SetSolveInsideThreshold
SetSourceContexts
Solve
RunToolkit
Undo
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ApplyMeshOps
Use: If there are any mesh operations that were defined and not yet performed
in the current variation for the specified solution setups, they will be
applied to the current mesh. If necessary, an initial mesh will be computed
first. No further analysis will be performed.
Command: HFSS>Analysis Setup>Apply Mesh Operations
Syntax: ApplyMeshOps <SetupNameArray>
Return Value: <SetupNameArray>
Type: <int>
-1: completed with error
0: completed successfully
Example:
status = oDesign.ApplyMeshOps Array("Setup1","Setup2")
Analyze
Use: Solves a single solution setup and all of its frequency sweeps.
Command: Right-click a solution setup in the project tree, and then click Analyze on
the shortcut menu.
Syntax: Analyze(<SetupName>)
Parameters: <setupName>
Return Value: None
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 12.0.0
' 2:54 PM Dec 15, 2008
' ----------------------------------------------
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("Tee")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
AnalyzeDistributed
Use: Perform a distributed analysis.
Command: None
Syntax: AnalyzeDistributed <SetupName>
Return Value: <AnalysisStatus>
Type: <int>
-1: completed with error
0: completed successfully
Parameters: <SetupName>
Example: For frequency sweeps:
oDesign.AnalyzeDistributed "Setup1"
AssignDCThickness
Use: Assign DC Thickness to more accurately compute DC resistance of a thin
conducting object for which Solve Inside is not selected.
Command: HFSS>Assign DC Thickness
Syntax: AssignDCThickness Array(<ObjectName>) Array
(<ThicknessValue>) <string>
Return Value: None
Parameters: <ObjectName>
Type: <string>
Array of object names. Any objects not specified in the arguments are unchanged
after the command is processed.
<ThicknessValue>
Type: <real> or <string>, either Infinite or Effective.
Array of DC thickness values (including units) corresponding to each object name.
You can also specify an infinite thickness or have it calculated automatically.
<string>
Type: <string>
"EnableAuto" is equivalent to checking the checkbox in the second tab of the DC
thickness dialog. "DisableAuto" is equivalent to clearing that checkbox. Omitting the
string means leaves the checkbox unchanged.
Example:
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
The following example includes the use of Automatic and Infinite settings.
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("hfss_uhf_probe")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignDCThickness Array("Arm_1", "Arm_2"), _
Array("" & Chr(34) & "<Effective>" & Chr(34) & "", _
"" & Chr(34) & "<Infinite>" & Chr(34) & "")
ConstructVariationString
Use: Lists and orders the variables and values associated with a design variation.
Command: None
Syntax: ConstructVariationString(<ArrayOfVariableNames>,
<ArrayOfVariableValuesIncludingUnits>)
Return Value: Returns variation string with the variables ordered to correspond to the
order of variables in design variations. The values for the variables are
inserted into the variation string.
Parameters: <ArrayOfVariableNames>
Type: string
<ArrayOfVariableValuesIncludingUnits>
Type: string
Example:
varstring = oDesign.ConstructVariation-
String(Array("x_size", "y_size"), Array("2mm", "1mm"))
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
DeleteLinkedDataVariation
Use: Deletes linked solution data, except field data, for the specified variations.
Syntax: DeleteLinkedDataVariation
Array(<DesignVariationKey>, <DesignVariationKey>, )
Return Value: None
Parameters: <DesignVariationKey>
Type: <string>
Design variation string.
Example:
oDesign.DeleteLinkedDataVariation Array("gap_front=" &
Chr(39) & "0.2mm" & Chr(39) & " gap_up_down=" & Chr(39) &
"0.2mm" & Chr(39) & "")
ExportConvergence
Use: Exports convergence data (max mag delta S, E, freq) to file for the given
variation.
Command: None
Syntax: ExportConvergence <SetupName>, <VariationString>,
<FilePath> <overwriteIfExists>
Return Value: None
Parameters: <SetupName>
Type: <string>
Example: "Setup1"
<VariationString>
Type: <string>
Example: "radius = 3mm"
The empty variation string ("") is interpreted to mean the current nominal variation.
<FilePath>
Type: <string>
Example: "c:\convergence.conv"
overwriteIfExists <Boolean>
If "overwriteIfExists" is TRUE, then the playback of the script overwrites an existing
file. If FALSE, it does not. The default is "TRUE".
Type: <string>
Example: overwriteIfExists=TRUE
9-6 Design Object Script Commands
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Example:
oDesign.ExportConvergence "Setup1", "x_size = 2mm",
"c:\convergence.conv"
ExportMeshStats
Use: Exports the mesh statistics to a file.
Command: None.
Parameters: <SetupName>
Type: <string>
Example: "Setup1"
<VariationString>
Type: <string>
Example: "radius = 3mm"
The empty variation string ("") is interpreted to mean the current nominal variation.
<FilePath>
Type: <string>
Example: "c:\convergence.conv"
overwriteIfExists <Boolean>
If "overwriteIfExists" is TRUE, then the playback of the script overwrites an existing
file. If FALSE, it does not. The default is "TRUE".
Type: <string>
Example: overwriteIfExists=TRUE
Example:
oDesign.ExportMeshStats "Setup1", "offset=" & Chr(39) &
"0.09in" & Chr(39) & "","C:\mydir\meshstats.ms" "tat"
ExportProfile
Use: Exports a solution profile to file.
Syntax: ExportProfile <SetupName>, <VariationString>, <FilePath>,
<overwriteIfExists>
Return Value: None
Parameters: <SetupName>
Type: <string>
Example: "Setup1"
<VariationString>
Design Object Script Commands 9-7
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Type: <string>
Example: "radius = 3mm"
The empty variation string ("") is interpreted to mean the current nominal variation.
<FilePath>
Type: <string>
Example: "c:\profile.prof"
overwriteIfExists <Boolean>
If "overwriteIfExists" is TRUE, then the playback of the script overwrites an existing
file. If FALSE, it does not. The default is "TRUE".
Type: <string>
Example: overwriteIfExists=TRUE
Example:
oDesign.ExportProfile "Setup1", "", "c:\profile.prof"
GetEdit SourcesCount
Use: Returns the number of sources that are listed in the Edit Sources panel.
Command: None
Syntax: GetEditSources
Return Value: <int>
Parameters: None
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 15.0.0
' 7:37:36 AM Jul 27, 2012
' ----------------------------------------------
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.GetActiveProject
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
GetModule
Use: Returns the IDispatch for the specified module.
Command: none
Syntax: GetModule <ModuleName>
Return Value: Module object.
Example:
Set oModule = oDesign.GetModule "BoundarySetup"
GetName
Use: Returns the name of the Design.
Command: none
Syntax: GetName
Return Value: The name of the Design.
Type: <string>
Example:
name_string = oDesign.GetName
GetNominalVariation
Use: Gets the nominal variation string
Command: None
Syntax: GetNominalVariation()
Return Value: Returns a string representing the nominal variation
Parameters: None
Example:
var = oDesign.GetNominalVariation()
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
GetSolutionType
Use: Returns the solution type for the design. This command command does not
apply to HFSS-IE.
Command: none
Syntax: GetSolutionType
Return Value: <SolutionType>
Type: <string>
Possible values are: "DrivenModal", "DrivenTerminal", "Eigenmode",
Transient or Transient Network.
Example:
oDesign.GetSolutionType
GetSolveInsideThreshold
Use: Returns the solve inside threshold. This command command does not apply
to HFSS-IE.
Command: none
Syntax: GetSolveInsideThreshold
Return Value: Double representing the solve inside threshold.
Example:
oDesign.GetSolveInsideThreshold
GetSourceContexts
Use: Obtain sources currently enabled as context in the Edit Sources dialog
Source Context tab.
Command: None
Syntax: GetSource Contexts
Return Value: Array of enabled source names
Parameters: None
Example:
SetoModule = oDesign.GetModule(Solutions)
oModule.GetSourceContexts
GetVariationVariableValue
Use: Finds the value of a variable for a specific variation string.
Command: None
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Syntax: GetVariationVariableValue(<VariationString>,
<VariableName>)
Return Value: Returns a double precision value in SI units, interpreted to mean the value
of the variable contained in the variation string.
Parameters: <VariationString>
Type: string
<VariableName>
Type: string
Example:
Example: varval = _
oDesign.GetVariationVariableValue("x_size = 2mm y_size = 1mm",_
"y_size")
Redo [Design]
Use: Reapplies the last design-level command.
Command: Edit>Redo
Syntax: Redo
Return Value: None
Example:
oDesign.Redo
RenameDesignInstance
Use: Renames a design instance.
Command: Right click a design instance in the project tree, and then click Rename on
the shortcut menu.
Syntax: RenameDesignInstance <OldName>, <NewName>
Return Value: None
Example:
oDesign.RenameDesignInstance "HFSSDesign1", "HFSSDesign2"
SARSetup
Use: Sets up for the specific absorption rate (SAR) computation.This command
command does not apply to HFSS-IE.
Command: HFSS>Fields>SAR Setting
Syntax: SARSetup <TissueMass>, <MaterialDensity>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<MaterialDensity>
Type: <double>
Positive double in gram/cm3.
Example:
oDesign.SARSetup 1, 1
SetActiveEditor
Use: Sets the active editor.
Command: None
Syntax: SetActiveEditor(<EditorName>)
Return Value: Editor object
Example:
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
SetDesignSettings
Use: To set the design settings for materials override.
Command: HFSS>Design Settings
Syntax: SetDesignSettings <MaterialsOverrideArray>
Return Value: None
Parameters: <MaterialsOverrideArray>
Array("NAME:Design Settings Data",
"Allow Material Override:=", <Boolean>,
"Calculate Lossy Dielectrics:=", <Boolean>)
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
SetSolutionType
Use: Sets the solution type for the design. This command command does not
apply to HFSS-IE.
Command: HFSS>Solution Type
Syntax: SetSolutionType <SolutionType>
Return Value: None
Parameters: <SolutionType>
Type: <string>
Possible values are: "DrivenModal", "DrivenTerminal", Transient, Tran-
sient Network, or "Eigenmode"
Example:
oDesign.SetSolutionType "DrivenTerminal"
SetSolveInsideThreshold
Use: Set the solve inside threshold to the supplied double. This command
command does not apply to HFSS-IE.
Command: None
Syntax: SetSolveInsideThreshold(<threshold>)
Return Value: None
Parameters: <threshold>
Type: <double>
Siemens/m
Example:
oDesign.SetSolveInsideThreshold(100000)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
SetSourceContexts
Use: For Near or Far Field projects for Driven Modal or Driven Terminal Network
Analysis Solutions, specify the port name and all modes/terminals of that
port to be enabled as Source Context.
Command: Fields>Edit Sources
Syntax: SetSourceContexts Array(<sourceID>,...)
Return Value: None.
Parameters: <sourceID>
Type: <string>
Example:
SetoModule = oDesign.GetModule(Solutions)
oModule.SetSourceContexts Array(Box1_T1, Box1_T2,
Box1_T3, Current1, IncPWave1)
Solve
Use: Performs a blocking simulation. The next script command will not be
executed until the simulation is complete.
Command: HFSS>Analyze
Syntax: Solve <SetupNameArray>
Return Value: Type: <int>
-1: simulation error
0: normal completion
Parameters: <SetupNameArray>: Array(<SetupName>, <SetupName>, ...)
<SetupName>
Type: <string>
Name of the solution setup to solve.
Example:
return_status = oDesign.Solve Array("Setup1", "Setup2")
RunToolkit
Use: Run a Python toolkit script, applying it to the Active Project. The script
itself may have prerequisites, such as sweeps defined, or specific model
characteristics, such as port definitions.
Command: HFSS>Toolkit><IronPythonScript>
Syntax: RunToolkit "<LibName>", "<IronPythonScriptName>", Array()
Return Value: User Defined Solutions and user Defined Outputs.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Parameters: <LibName>
Type: <string>
Name of the library in which the script is located.
<IronPythonScriptName>
Type: <string>
Name of the IronPython script.
Array(<array>)
Type: <Array>
Additional parameters or files required by the script.
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 16.0.0
' 10:12:18 AM May 14, 2013
' ----------------------------------------------
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("test_HAC")
Set oDesign = oProject.SetActiveDesign("RCS1")
oDesign.RunToolkit "SysLib", "HearingAidCompliance", Array()
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertFrequencySweep "Setup1", Array("NAME:Sweep", "IsEn-
abled:=", true, "SetupType:=", _
"LinearStep", "StartValue:=", "1GHz", "StopValue:=", "10GHz",
"StepSize:=", _
"0.1GHz", "Type:=", "Interpolating", "SaveFields:=", false, "Sav-
eRadFields:=", _
false, "InterpTolerance:=", 0.5, "InterpMaxSolns:=", 250, "Interp-
MinSolns:=", _
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Undo [Design]
Use: Cancels the last design-level command.
Command: Edit>Undo
Syntax: Undo
Return Value: None
Example:
oDesign.Undo
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
10 Model Setup Script
Commands
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Assign Array
Use: Create an array based on a unit cell model.
Command: HFSS>Model>Create Array
Syntax: AssignArray <arrayParameters>
Return Value: None
Parameters: Aray(NAME:<string>",
"Type:=", "Regular",
"Name:=", "<string>",
"UseAirObjects:=", <boolean>,
"RowMasterBnd:=", "Master<n>",
"ColumnMasterBnd:=", "Master<n>",
"RowDimension:=", <value>,
"ColumnDimension:=", <value>,
"PostProcessRow:=", <value>,
"PostProcessCol:=", <value>,
"Active:=", "All" | [<arraycoords>] |"None" )
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 1:42:56 PM Mar 03, 2011
' ----------------------------------------------
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("terminalArray")
Set oDesign = oProject.SetActiveDesign("HFSSDesign")
Set oModule = oDesign.GetModule("ModelSetup")
oModule.AssignArray Array("NAME:A",
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"Type:=", "Regular",
"Name:=", "A",
"UseAirObjects:=", true,
"RowMasterBnd:=", "Master1",
"ColumnMasterBnd:=", "Master2",
"RowDimension:=", 2,
"ColumnDimension:=", 2,
"PostProcessRow:=", 1,
"PostProcessCol:=", 1,
"Active:=", "All")
DeleteArray
Use: Delete an existing array based on a unit cell model.
Command: Delete
Syntax: DeleteArray
Return Value: None
Parameters: None
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 10:22:10 AM Feb 23, 2011
' ----------------------------------------------
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("forcreatearraycube")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("ModelSetup")
oModule.DeleteArray
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EditArray
Use: To edit properties of an existing array.
Command: Properties
Syntax: EditArray <arrayParameters>
Return Value: None
Parameters: Aray(NAME:<string>",
"Type:=", "Regular",
"Name:=", "<string>",
"UseAirObjects:=", <boolean>,
"RowMasterBnd:=", "Master<n>",
"ColumnMasterBnd:=", "Master<n>",
"RowDimension:=", <value>,
"ColumnDimension:=", <value>,
"PostProcessRow:=", <value>,
"PostProcessCol:=", <value>,
"Active:=", "All" | [<arraycoords>] |"None" )
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 1:42:56 PM Mar 03, 2011
' ----------------------------------------------
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("terminalArray")
Set oDesign = oProject.SetActiveDesign("HFSSDesign")
Set oModule = oDesign.GetModule("ModelSetup")
oModule.EditArray Array("NAME:A",
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"Type:=", "Regular",
"Name:=", "A",
"UseAirObjects:=", true,
"RowMasterBnd:=", "Master1",
"ColumnMasterBnd:=", "Master2",
"RowDimension:=", 2,
"ColumnDimension:=", 3,
"PostProcessRow:=", 1,
"PostProcessCol:=", 3,
"Active:=", "[0,0], [0,1], [0,2]")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
11 3D Modeler Editor Script
Commands
<Attributes Array>
Array("NAME:Attributes",
"Name:=", <string>,
"Flags:=", <string>,
"Color:=", <string>,
"Transparency:=", <value>,
"PartCoordinateSystem:=", <string>,
"MaterialName:=", <string>,
"Solveinside:=", <bool>)
Flags
Format is a string containing any of the following flags separated by the # character:
NonModel
Wireframe
Example: "Flags:=", "NonModel#Wireframe"
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Color
Format is a string containing an R,G,B triple formatted as "(R G B)".
Example: "Color:=", "(255 255 255)"
Transparency
Specify a number between 0 and 1.
PartCoordinateSystem
Orientation of the primitive. The name of one of the defined coordinate systems
should be specified.
<SelectionsArray>
Array("NAME:Selections",
"Selections:=", <string>)
Selections
Comma-separated list of parts on which to perform the operation.
Example: "Selections:=", "Rect1, Rect2"
Draw Menu Commands
Edit Menu Commands
Modeler Menu Commands
Other oEditor Commands
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
CreateRectangle
CreateRegion
CreateRegularPolyhedron
CreateRegularPolygon
CreateSphere
CreateSpiral
CreateTorus
EditPolyline
SweepAlongPath
SweepAlongVector
SweepAroundAxis
CreateBondwire
Use: Creates a bondwire primitive.
Command: Draw>Bondwire
Syntax: CreateBondwire <ParametersArray>, <AttributesArray>
Return Value: The name of the newly created object.
Parameters: <ParametersArray>
Array("NAME:BondwireParameters",
"WireType:=", <string>,
"WireDiameter:=", <value>,
"NumSides:=", <value>,
"XPadPos:=", <value>,
"YPadPos:=", <value>,
"ZPadPos:=", <value>,
"XDir:=", <value>,
"YDir:=", <value>,
"ZDir:=", <value>,
"Distance:=", <value>,
"h1:=", <value>,
"h2:=", <value>,
"alpha:=", <value>,
"beta:=", <value>,
"WhichAxis:=", <string>)
WireType
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
WhichAxis
Axis normal to the plane where the wire is drawn. Possible values are: "X", "Y",
"Z"
Example: "WhichAxis:=", "Z" means the bond wire will be drawn on the XY
plane.
CreateBox
Use: Creates a box primitive.
Command: Draw>Box
Syntax: CreateBox <BoxParametersArray>, <AttributesArray>
Return Value: The name of the newly created object.
Parameters: <BoxParametersArray>
Array("NAME:BoxParameters",
"XPosition:=", <value>,
"YPosition:=", <value>,
"ZPosition:=", <value>,
"XSize:=",<value>,
"YSize:=",<value>,
"ZSize:=",<value>)
Example:
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateBox Array("NAME:BoxParameters", _
"CoordinateSystemID:=", -1, "XPosition:=", _
"1mm", "YPosition:=", "1mm", "ZPosition:=", "0mm", _
"XSize:=", "1mm", "YSize:=", "1mm", "ZSize:=", "1mm"),_
Array("NAME:Attributes", "Name:=", "Box1", "Flags:=", "", _
"Color:=", "(132 132 193)", "Transparency:=", 0, _
"PartCoordinateSystem:=", "Global", "MaterialName:=", _
"vacuum", "SolveInside:=", true)_
oEditor.DuplicateAlongLine Array("NAME:Selections",
"Selections:=", "Box1"), _
Array("NAME:DuplicateToAlongLineParameters",_
"CoordinateSystemID:=", -1, "CreateNewObjects:=", true, _
11-4 3D Modeler Editor Script Commands
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
CreateCircle
Use: Creates a circle primitive.
Command: Draw>Circle
Syntax: CreateCircle <CircleParametersArray>, <AttributesArray>
Return Value: The name of the newly created object.
Parameters: <CircleParametersArray>
Array("NAME:CircleParameters",
"XCenter:=", <value>,
"YCenter:=", <value>,
"ZCenter:=", <value>,
"Radius:=", <value>,
"WhichAxis:=", <string>
"NumSegments:=", "<integer>")
WhichAxis
Axis of normal vector to the circle. Possible values are: "X", "Y", "Z"
Example: "WhichAxis:=", "Z" means the circle will be drawn in the
XY plane.
CreateCone
Use: Creates a cone primitive.
Command: Draw>Cone
Syntax: CreateCone <ConeParametersArray>, <AttributesArray>
Return Value: The name of the newly created object.
Parameters: <ConeParametersArray>
Array("NAME:ConeParameters",
"XCenter:=", <value>,
"YCenter:=", <value>,
"ZCenter:=", <value>,
"WhichAxis:=", <string>,
"Height:=", <value>,
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"BottomRadius:=", <value>,
"TopRadius:=", <value>)
WhichAxis
Axis of the cone. Possible values are: "X", "Y", "Z"
Example: "WhichAxis:=", "Z"
CreateCutplane
Use: Creates a cutplane. Only the name and color attributes from
<AttributesArray> are supported.
Command: Draw>Plane
Syntax: CreateCutplane <CutplaneParametersArray>,
<AttributesArray>
Return Value: The name of the newly created object.
Parameters: <CutplaneParametersArray>
Array("NAME:PlaneParameters",
"PlaneBaseX:=", <value>,
"PlaneBaseY:=", <value>,
"PlaneBaseZ:=", <value>,
"PlaneNormalX:=", <value>,
"PlaneNormalY:=", <value>),
"PlaneNormalZ:=", <value>)
CreateCylinder
Use: Creates a cylinder primitive.
Command: Draw>Cylinder
Syntax: CreateCylinder <CylinderParametersArray>,
<AttributesArray>
Return Value: The name of the newly created object.
Parameters: <CylinderParametersArray>
Array("NAME:CylinderParameters",
"XCenter:=", <value>,
"YCenter:=", <value>,
"ZCenter:=", <value>,
"Radius:=", <value>,
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"Height:=", <value>,
"WhichAxis:=", <string>
"NumSides:=", "<integer>")
WhichAxis
Axis of the cylinder. Possible values are: "X", "Y", "Z"
Example: "WhichAxis:=", "Z"
CreateEllipse
Use: Creates an ellipse primitive.
Command: Draw>Ellipse
Syntax: CreateEllipse <EllipseParametersArray>, <AttributesArray>
Return Value: The name of the newly created object.
Parameters: <EllipseParametersArray>
Array("NAME:EllipseParameters",
"XCenter:=", <value>,
"YCenter:=", <value>,
"ZCenter:=", <value>,
"MajRadius:=", <value>,
"Ratio:=", <value>,
"WhichAxis:=", <string>
"NumSegments:=", "<integer>")
WhichAxis
Axis of normal vector to the ellipse. Possible values are: "X", "Y", "Z"
Example: "WhichAxis:=", "Z" means the ellipse will be drawn in the XY
plane.
CreateEquationCurve
Use: Create an equation-based curve.
Command: Draw>Equation Based Curve
Syntax: CreateEquationCurve Array <Parameters> Array<Attributes>
Return Value: None
Parameters:
Array("NAME:EquationBasedCurveParameters",
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"XtFunction:=", "<value>",
"YtFunction:=", "<value>",
"ZtFunction:=", "<value>",
"tStart:=", "<value>",
"tEnd:=", "<value>",
"NumOfPointsOnCurve:=", "<value>",
"Version:=", <ID>),
Array("NAME:Attributes",
"Name:=", "<textn>",
"Flags:=", "",
"Color:=", "(<int> <int> <int>)",
"Transparency:=", <value>,
"PartCoordinateSystem:=", "<id>",
"UDMId:=", "",
"MaterialValue:=", "" & Chr(34)
& "vacuum"
& Chr(34) & "",
"SolveInside:=", <boolean>)
Example:
CreateEquationSurface
Use: Create an equation based surface.
Command: Draw>Create Equation Based Surface
Syntax: CreateEquationSurface Array <parameters> Array
<attributes>
Return Value:
Parameters:
Array("NAME:EquationBasedSurfaceParameters",
"XuvFunction:=", "1",
"YuvFunction:=", "1",
"ZuvFunction:=", "1",
"uStart:=", "2",
"uEnd:=", "2",
"vStart:=", "2",
"vEnd:=", "2",
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"Version:=", 1),
Array("NAME:Attributes", "Name:=", "EquationSurface1",
"Flags:=", "",
"Color:=", "(132 132 193)",
"Transparency:=", 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=", "",
"MaterialValue:=", ""
& Chr(34)
& "vacuum"
& Chr(34)
& "", "SolveInside:=", true)
Example:
CreateHelix
Use: Creates a helix by sweeping the specified 2D objects.
Command: Draw>Helix
Syntax: CreateHelix <SelectionsArray>, <HelixParametersArray>
Return Value: The name of the newly created object.
Parameters: <SelectionsArray>
Array("NAME:Selections",
"Selections:=", <string>)
Selections
Comma-separated list of parts to sweep.
Example: "Selections:=", "Rect1, Rect2"
<HelixParametersArray>
Array("NAME:HelixParameters",
"XCenter:=", <value>,
"YCenter:=", <value>,
"ZCenter:=", <value>,
"XStartDir:=", <value>,
"YStartDir:=", <value>,
"ZStartDir:=", <value>,
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"Thread:=", <value>,
"NumThread:=", <value>,
"RightHand:=", <bool>)
CreatePoint
Use: Creates a point. Only the name and color attributes from
<AttributesArray> are supported.
Command: Draw>Point
Syntax: CreatePoint <PointParametersArray>, <AttributesArray>
Return Value: The name of the newly created object.
Parameters: <PointParametersArray>
Array("NAME:PointParameters",
"PointX:=", <value>,
"PointY:=", <value>,
"PointZ:=", <value>)
CreatePolyline
Use: Creates a polyline primitive.
Command: Draw>Polyline
Syntax: CreatePolyline <PolylineParametersArray>,
<AttributesArray>
Return Value: The name of the newly created object.
Parameters: <PolylineParametersArray>
Array("NAME:PolylineParameters",
"IsPolylineCovered:=", <bool>,
"IsPolylineClosed:=", <bool>,
<PolylinePointsArray>,
<PolylineSegmentsArray>)
<PolylinePointsArray>
Array("NAME:PolylinePoints", <OnePointArray>,
<OnePointArray>, ...)
<OnePointArray>
Array("NAME:PLPoint",
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"X:=", <value>,
"Y:=", <value>,
"Z:=", <value>))
<PolylineSegmentsArray>
Array("NAME:PolylineSegments",
<OneSegmentArray>, <OneSegmentArray>, ...)
<OneSegmentArray>
Array("NAME:PLSegment",
"SegmentType:=", <string>,
"StartIndex:=", <value>,
"NoOfPoints:=", <value>)
SegmentType
Can be "Line", "Arc", "Spline", or "AngularArc"
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 9:49:26 AM Mar 09, 2011
' ----------------------------------------------
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("Project58")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
oEditor.CreatePolyline Array("NAME:PolylineParameters",
"IsPolylineCovered:=", true,
"IsPolylineClosed:=", false,
Array("NAME:PolylinePoints",
Array("NAME:PLPoint", "X:=", "1.4mm",
"Y:=", "-2mm",
"Z:=", "0mm"),
Array("NAME:PLPoint", "X:=", "0mm", "Y:=", "-2mm", "Z:=", "0mm"),
Array("NAME:PLPoint", "X:=", "-0.8mm", "Y:=", "-1.6mm",
"Z:=", "0mm"),
Array("NAME:PLPoint", "X:=", "-1.4mm", "Y:=", "-0.6mm",
"Z:=", "0mm")),
Array("NAME:PolylineSegments", Array("NAME:PLSegment",
"SegmentType:=", "Line",
"StartIndex:=", 0, "NoOfPoints:=", 2),
Array("NAME:PLSegment", "SegmentType:=", "Line",
"StartIndex:=", 1, "NoOfPoints:=", 2),
Array("NAME:PLSegment", "SegmentType:=", "Line", "StartIndex:=", 2,
"NoOfPoints:=", 2)),
Array("NAME:PolylineXSection", "XSectionType:=", "None",
"XSectionOrient:=", "Auto", "XSectionWidth:=", "0mm",
"XSectionTopWidth:=", "0mm", "XSectionHeight:=", "0mm",
"XSectionNumSegments:=", "0", "XSectionBendType:=", "Corner")),
Array("NAME:Attributes", "Name:=", "Polyline2", "Flags:=", "",
"Color:=", "(132 132 193)",
"Transparency:=", 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=", "", "MaterialValue:=", ""
& Chr(34) & "vacuum" & Chr(34) & "", "SolveInside:=", true)
CreateRectangle
Use: Creates a rectangle primitive.
Command: Draw>Rectangle
Syntax: CreateRectangle <RectangleParametersArray>,
<AttributesArray>
Return Value: The name of the newly created object.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Parameters: <RectangleParametersArray>
Array("NAME:RectangleParameters",
"XStart:=", <value>,
"YStart:=", <value>,
"ZStart:=", <value>,
"Width:=", <value>,
"Height:=", <value>,
"WhichAxis:=", <string>)
WhichAxis
Axis of normal vector to the rectangle. Possible values are: "X", "Y", "Z"
Example: "WhichAxis:=", "Z" means the rectangle will be drawn in
the XY plane.
CreateRegion
Use: Defines a region containing the design.
Command: Draw>Create Region
Syntax: CreateRegion <RegionParameters> <RegionAttributes>
Return Value: The name of the newly created object.
Parameters: <RegionParameters>
Array("NAME:RegionParameters", _
"+XPaddingType:=", <Offset_Type>,
"+XPadding:=", "<X_value>", _
"-XPaddingType:=", <Offset_Type>,
"-XPadding:=", "<-X_value>", _
"+YPaddingType:=", <Offset_Type>,
"+YPadding:=", "<Y_value>",
"-YPaddingType:=", <Offset_Type>,
"-YPadding:=", "<-Y_value>", _
"+ZPaddingType:=", <Offset_Type>,
"+ZPadding:=", "<Z_value>", _
"-ZPaddingType:=", <Offset_Type>,
"-ZPadding:=", "<-Z_value>")
<Offset_Type>
Type: String
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Example:
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateRegion Array("NAME:RegionParameters",
"+XPaddingType:=", "Absolute Offset", _
"+XPadding:=", "1um", _
"-XPaddingType:=", "Absolute Offset", _
"-XPadding:=", "1um", _
"+YPaddingType:=", "Absolute Offset", _
"+YPadding:=", "1um",
"-YPaddingType:=", "Absolute Offset", _
"-YPadding:=", "1um", _
"+ZPaddingType:=", "Absolute Offset", _
"+ZPadding:=", "1um", _
"-ZPaddingType:=", "Absolute Offset", _
"-ZPadding:=", "1um"),
Array("NAME:Attributes", "Name:=", _
"Region", "Flags:=", "Wireframe#", _
"Color:=", "(255 0 0)", _
"Transparency:=", 0, _
"PartCoordinateSystem:=", "Global", _
"MaterialValue:=", "" & Chr(34) & "vacuum" & Chr(34) & "", _
"SolveInside:=", true)
11-14 3D Modeler Editor Script Commands
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
CreateRegularPolyhedron
Use: Creates a regular polyhedron primitive.
Command: Draw>Regular Polyhedron
Syntax: CreateRegularPolyhedron <PolyhedronParametersArray>,
<AttributesArray>
Return Value: The name of the newly created object.
Parameters: <PolyhedronParametersArray>
Array("NAME:PolyhedronParameters",
"XCenter:=", <value>,
"YCenter:=", <value>,
"ZCenter:=", <value>,
"XStart:=", <value>,
"YStart:=", <value>,
"ZStart:=", <value>,
"Height:=", <value>,
"NumSides:=", <value>,
"WhichAxis:=", <string>)
NumSides:
Specify a number greater than 2.
WhichAxis
Axis of the polyhedron. Possible values are: "X", "Y", "Z"
Example: "WhichAxis:=", "Z"
CreateRegularPolygon
Use: Creates a regular polygon primitive.
Command: Draw>RegularPolygon
Syntax: CreateRegularPolygon <PolygonParametersArray>,
<AttributesArray>
Return Value: The name of the newly created object.
Parameters: <PolygonParametersArray>
Array("NAME:RegularPolygonParameters",
"XCenter:=",<value>,
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"YCenter:=",<value>,
"ZCenter:=",<value>,
"XStart:=", <value>,
"YStart:=", <value>,
"ZStart:=", <value>,
"NumSides:=", "12",
"WhichAxis:=", <string>)
NumSides
Specify a number greater than 2.
WhichAxis
Axis of normal vector to the polygon. Possible values are: "X", "Y", "Z"
Example: "WhichAxis:=", "Z" means the polygon will be drawn in the XY
plane.
CreateSphere
Use: Creates a sphere primitive.
Command: Draw>Sphere
Syntax: CreateSphere <SphereParametersArray>, <AttributesArray>
Return Value: The name of the newly created object.
Parameters: <SphereParametersArray>
Array("NAME:SphereParameters",
"XCenter:=", <value>,
"YCenter:=", <value>,
"ZCenter:=", <value>,
"Radius:=", <value>)
CreateSpiral
Use: Creates a spiral by sweeping the specified 2D objects.
Command: Draw>Spiral
Syntax: CreateSpiral <SelectionsArray>, <SpiralParametersArray>
Return Value: The name of the newly created object.
Parameters: <SelectionsArray>
Array("NAME:Selections",
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"Selections:=", <string>)
Selections
Comma separated list of parts to sweep.
Example: "Selections:=", "Rect1, Rect2"
<SpiralParametersArray>
Array("NAME:SpiralParameters",
"XCenter:=", <value>,
"YCenter:=", <value>,
"ZCenter:=", <value>,
"XStartDir:=", <value>,
"YStartDir:=", <value>,
"ZStartDir:=", <value>,
"NumThread:=", <value>,
"RightHand:=", <bool>,
"RadiusIncrement:=", <value>)
CreateTorus
Use: Creates a torus primitive.
Command: Draw>Torus
Syntax: CreateTorus <TorusParametersArray>, <AttributesArray>
Return Value: The name of the newly created object.
Parameters: <TorusParametersArray>
Array("NAME:TorusParameters",
"XCenter:=", <value>,
"YCenter:=", <value>,
"ZCenter:=", <value>,
"MajorRadius:=", <value>,
"MinorRadius:=", <value>,
"WhichAxis:=", <string>)
WhichAxis
Axis of the torus. Possible values are: "X", "Y", "Z"
Example: "WhichAxis:=", "Z"
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EditPolyline
Use: Modifies a polyline primitive. Specify the name of the polyline to modify and
the new set of data for the polyline.
Command: Draw>Line Segment>Insert Segment Before>Straight
Draw>Line Segment>Insert Segment Before>Spline
Draw>Line Segment>Insert Segment Before>3 Point Arc
Draw>Line Segment>Insert Segment Before>Center Point Arc
Draw>Line Segment>Insert Segment After>Straight
Draw>Line Segment>Insert Segment After>Spline
Draw>Line Segment>Insert Segment After>3 Point Arc
Draw>Line Segment>Insert Segment After>Center Point Arc
Edit>Delete Start Point
Edit>Delete End Point.
Syntax: EditPolyline <SelectionsArray>,
<PolylineParametersArray>,
Return Value: None
Parameters: <SelectionsArray>
Array("NAME:Selections",
"Selections:=", "string")
Selections
Name of the polyline to modify. The name should be formatted as
"<PolylineName>:CreatePolyline:1".
Example: "Selections:=", "Polyline1:CreatePolyline:1"
InsertPolylineSegment
Use: Inserts a polyline segment either before or after an existing segment of a
polyline primitive.
Command: Draw>Line Segment>Insert Segment Before>Straight
Draw>Line Segment>Insert Segment Before>Spline
Draw>Line Segment>Insert Segment Before>3 Point Arc
Draw>Line Segment>Insert Segment Before>Center Point Arc
Draw>Line Segment>Insert Segment After>Straight
Draw>Line Segment>Insert Segment After>Spline
Draw>Line Segment>Insert Segment After>3 Point Arc
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<PolylinePointsArray>
Array("Name:Polyline Points", <OnePointArray>,
<OnePointArray>, ...)
<OnePointArray>
Array("Name:PLPoint",
"X:=", <value>,
"Y:=", <value>,
"Z:=", <value>)
Selections
Name of the polyline to modify. The name should be formatted as
"<PolylineName>:CreatePolyline:1".
Example: "Selections:=", "Polyline1:CreatePolyline:1"
SegmentType
Can be "Line", "Arc", "Spline", or "AngularArc"
SweepAlongPath
Use: Sweeps the specified 1D or 2D parts along a path. The last 1D object
specified is the path for the sweep.
Command: Draw>Sweep>Along Path
Syntax: SweepAlongPath <SelectionsArray>,
<PathSweepParametersArray>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
DraftType
Possible values are "Extended", "Round", "Natural"
Example: oEditor.SweepAlongPath _
Array("NAME:Selections", "Selections:=",
"Polygon1,Polyline1"),_
Array("NAME:PathSweepParameters", _
"DraftAngle:=", "0deg",_
"DraftType:=", "Round",_
"TwistAngle:=", "30deg")
SweepAlongVector
Use: Sweeps the specified 1D or 2D parts along a vector.
Command: Draw>Sweep>Along Vector
Syntax: SweepAlongVector <SelectionsArray>,
<VecSweepParametersArray>
Return Value: None
Parameters: <VecSweepParametersArray>
Array("NAME:VectorSweepParameters",
"DraftAngle:=", <value>,
"DraftType:=", <string>,
"SweepVectorX:=", <value>, _
"SweepVectorY:=", <value>,
"SweepVectorZ:=", <value)
DraftType
Possible values are "Extended", "Round", "Natural"
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
SweepAroundAxis
Use: Sweeps the specified 1D or 2D parts around an axis.
Command: Draw>Sweep>Around Axis
Syntax: SweepAroundAxis <SelectionsArray>,
<AxisSweepParametersArray>
Return Value: None
Parameters: <AxisSweepParametersArray>
Array("NAME:AxisSweepParameters",
"DraftAngle:=", <value>,
"DraftType:=", <string>,
"SweepAxis:=", <string>,
"SweepAngle:=", <value>)
DraftType
Possible values are "Extended", "Round", "Natural"
SweepAxis
Possible values are "X", "Y", "Z"
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
DeletePolylinePoint
Use: Deletes either a start or end point from an existing polyline segment.
Command: Edit>Delete Start Point
Edit>Delete End Point
Syntax: DeletePolylinePoint <DeletePointArray>
Return Value: None
Parameters: <DeletePointArray>
Array("Name:Delete Point",
"Selections:=", <string>,
"Segment Index:=", <value>,
"At Start:=", <bool>)
Selections
Name of the polyline to modify. The name should be formatted as
"<PolylineName>:CreatePolyline:1".
Example: "Selections:=", "Polyline1:CreatePolyline:1"
DuplicateAlongLine
Use: Duplicates specified parts along line.
Command: Edit>Duplicate>Along Line
Syntax: DuplicateAlongLine <SelectionsArray>,
<DupLineParametersArray> <DupBoundariesArray>
Return Value: None
Parameters: <DupLineParametersArray>
Array("NAME:DuplicateToAlongLineParameters",
"XComponent:=", <value>,
"YComponent:=", <value>,
"ZComponent:=", <value>,
"NumClones:=", <value>)
NumClones
Specify a number greater than 1.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<DupBoundariesArray>
Array("NAME:Options", "DuplicateBoundaries:=", <bool>)
Example:
oEditor.DuplicateAlongLine Array("NAME:Selections", _
"Selections:=", "Box1", _
"NewPartsModelFlag:=", "Model"), _
Array("NAME:DuplicateToAlongLineParameters", _
"CreateNewObjects:=", true, "XComponent:=", "0mm", _
"YComponent:=", "1.2mm", _
"ZComponent:=", "0mm", _
"NumClones:=", "2"), _
Array("NAME:Options", "DuplicateBoundaries:=", false)
DuplicateAroundAxis
Use: Duplicates specified parts around an axis.
Command: Edit>Duplicate>Around Axis
Syntax: DuplicateAroundAxis <SelectionsArray>,
<DupAxisParametersArray> <DupBoundariesArray>
Return Value: None
Parameters: <DupAxisParametersArray>
Array("NAME:DuplicateAroundAxisParameters",
"WhichAxis:=", <string>,
"AngleStr:=", <value>,
"NumClones:=",<value>)
WhichAxis
Axis to duplicate around. Possible values are: "X", "Y", "Z"
Example: "WhichAxis:=", "Z"
NumClones:
Specify a number greater than 1.
<DupBoundariesArray>
Array("NAME:Options", "DuplicateBoundaries:=", <bool>)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Example:
oEditor.DuplicateAroundAxis Array("NAME:Selections", _
"Selections:=", "Box1", _
"NewPartsModelFlag:=", "Model"), _
Array("NAME:DuplicateAroundAxisParameters", _
"CreateNewObjects:=", false, _
"WhichAxis:=", "Z", _
"AngleStr:=", "90deg", _
"NumClones:=", "2"), _
Array("NAME:Options", "DuplicateBoundaries:=", false)
DuplicateMirror
Use: Duplicate specified parts according to a mirror plane.
Command: Edit>Duplicate>Mirror
Syntax: DuplicateMirror <SelectionsArray>,
<DupMirrorParametersArray>
Return Value: None
Parameters: <DupMirrorParametersArray>
Array("NAME:DuplicateToMirrorParameters",
"DuplicateMirrorBaseX:=", <value>,
"DuplicateMirrorBaseY:=", <value>,
"DuplicateMirrorBaseZ:=", <value>,
"DuplicateMirrorNormalX:=", <value>,
"DuplicateMirrorNormalY:=", <value>,
"DuplicateMirrorNormalZ:=", <value>)
<DupBoundariesArray>
Array("NAME:Options", "DuplicateBoundaries:=", <bool>)
Example:
oEditor.DuplicateMirror Array("NAME:Selections", _
"Selections:=", "Box1", _
"NewPartsModelFlag:=", "Model"), _
Array("NAME:DuplicateToMirrorParameters", _
"DuplicateMirrorBaseX:=", "0mm", _
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"DuplicateMirrorBaseY:=", "0mm", _
"DuplicateMirrorBaseZ:=", "0mm", _
"DuplicateMirrorNormalX:=", "0mm", _
"DuplicateMirrorNormalY:=", "-1mm", _
"DuplicateMirrorNormalZ:=", "0mm"), _
Array("NAME:Options", "DuplicateBoundaries:=", false)
Mirror
Use: Mirrors specified parts.
Command: Edit>Arrange>Mirror
Syntax: Mirror <SelectionsArray>, <MirrorParametersArray>
Return Value: None
Parameters: <MirrorParametersArray>
Array("NAME:MirrorParameters",
"MirrorBaseX:=", <value>,
"MirrorBaseY:=", <value>,
"MirrorBaseZ:=", <value>,
"MirrorNormalX:=", <value>,
"MirrorNormalY:=", <value>,
"MirrorNormalZ:=", <value>)
Example:
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.Mirror Array("NAME:Selections", "Selections:=", "Box1", _
"NewPartsModelFlag:=", "Model"), _
Array("NAME:MirrorParameters", _
"MirrorBaseX:=", "-0.8mm", _
"MirrorBaseY:=", "-1mm", _
"MirrorBaseZ:=", "0mm", _
"MirrorNormalX:=", "0.948683298050514mm", _
"MirrorNormalY:=", "-0.316227766016838mm", _
"MirrorNormalZ:=", "0mm")
Move
Use: Moves specified parts.
Command: Edit>Arrange>Move
3D Modeler Editor Script Commands 11-25
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
OffsetFaces
Use: Offsets faces of specified parts.
Command: Edit>Arrange>Offset
Syntax: OffsetFaces <SelectionsArray>, <OffsetParametersArray>
Return Value: None
Parameters: <OffsetParametersArray>
Array("NAME:OffsetParameters",
"OffsetDistance:=", <value>)
Rotate
Use: Rotates specified parts.
Command: Edit>Arrange>Rotate
Syntax: Rotate <SelectionsArray>, <RotateParametersArray>
Return Value: None
Parameters: <RotateParametersArray>
Array("NAME:RotateParameters",
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"RotateAxis:=", <string>
"RotateAngle:=", <value>)
RotateAxis
Possible values are: "X", "Y", "Z"
Scale
Use: Scales specified parts.
Command: Edit>Scale
Syntax: Scale <SelectionsArray>, <ScaleParametersArray>
Return Value: None
Parameters: <ScaleParametersArray>
Array("NAME:ScaleParameters",
"ScaleX:=", <value>,
"ScaleY:=", <value>,
"ScaleZ:=", <value>)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EditObjectCS
EditRelativeCS
Export
Fillet
Generate History
Import
ImportDXF
ImportGDSII
Intersect
MoveCStoEnd
MoveFaces
ProjectSheet
PurgeHistory
Section
SeparateBody
SetModelUnits
SetWCS
ShowWindow
Split
Subtract
SweepFacesAlongNormal
ThickenSheet
UncoverFaces
Unite
AssignMaterial
Use: Assigns a material to the specified objects. Only the MaterialName and
SolveInside parameters of <AttributesArray> are supported.
Command: Modeler>Assign Material
Syntax: AssignMaterial <SelectionsArray>, <AttributesArray>
Return Value: None
Example:
oEditor.AssignMaterial _
Array("NAME:Selections", "Selections:=", "Polygon1"),
Array("NAME:Attributes", _
"MaterialName:=", "tungsten",_
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"SolveInside:=", false)
Chamfer
Use: Creates a chamfer.
Command: Modeler>Chamfer
Syntax: Chamfer (<ObjectName> <ChamferParameters>)
Return Value: None
Parameters: <ObjectName>
Array("NAME:Selections", _
"Selections:=", <string>),
<ChamferParameters>
Array("NAME:Parameters", _
Array("NAME:ChamferParameters", _
"CoordinateSystemID:=", <value>,
"Edges:=", <ArrayOfEdgeIDs>,
"LeftRange:=", <value>))
Example:
oEditor.Chamfer Array("Name:Selections", _
"Selections:=", "Box1"), Array("NAME:Parameters", _
Array("NAME:ChamferParameters", _
"CoordinateSystemID:=", -1, _
"Edges:=", Array(13), "LeftRange:=", "1mm"))
Connect
Use: Connects specified 1D parts to form a sheet.
Command: Modeler>Surface>Connect
Syntax: Connect <SelectionsArray>
Return Value: None
CoverLines
Use: Covers the specified 1D objects to form a sheet.
Command: Modeler>Surface>Cover Lines
Syntax: CoverLines <SelectionsArray>
Return Value: None
3D Modeler Editor Script Commands 11-29
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
CoverSurfaces
Use: Covers the specified objects to form a solid object.
Command: Modeler>Surface>Cover Faces
Syntax: CoverSurfaces <SelectionsArray>
Return Value: None
CreateEntityList
Use: Creates a list of entities. The list can contain objects or faces, but not
both. Only the Name attribute from <AttributesArray> is supported.
Command: Modeler>List>Create>Object List
Modeler>List>Create>Face List
Syntax: CreateEntityList <EntityListParametersArray>,
<AttributesArray>
Return Value: None
Parameters: <EntityListParametersArray>
Array("NAME:GeometryEntityListParameters",
"EntityType:=", <string>,
"EntityList:=", <array>
EntityType
Possible values are "Object", "Face"
EntityList
Array of integers the IDs of the objects or faces to put in the list. To get the IDs, use
GetObjectIDByName
CreateFaceCS
Use: Creates a face coordinate system. Only the Name attribute of the
<AttributesArray> parameter is supported.
Command: Modeler>Coordinate System>Create>Face CS
Syntax: CreateFaceCS <FaceCSParametersArray>, <AttributesArray>
Return Value: None
Parameters: <FaceCSParametersArray>
Array("NAME:FaceCSParameters",
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"FaceID:=", <int>,
"PartID:=", <int>,
Array("NAME:OriginPosn",
"IsAttachedToEntity:=", <bool>,
"EntityID:=", <value>,
"PositionType:=", <string>,
"UParam:=", <value>,
"VParam:=", <value>,
"XPosition:=", <value>,
"YPosition:=", <value>,
"ZPosition:=", <value>)
Array("NAME:AxisPosn",
"IsAttachedToEntity:=", <bool>
"EntityID:=", <value>
"PositionType:=", <string>,
"UParam:=", <value>,
"VParam:=", <value>,
"XPosition:=", <value>,
"YPosition:=", <value>,
"ZPosition:=", <value>)
"WhichAxis:=", <string>)
FaceID
ID of the face on which to create the coordinate system.
PartID
ID of the object on which the face ID lies.
IsAttachedToEntity
Specifies whether the point is anchored (to a vertex, edge, or face).
If IsAttachedToEntity is true, provide the UParam and VParam
parameters. Otherwise, provide the XPosition, YPosition, and
ZPosition parameters.
EntityID
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
PositionType
Place where the point is anchored.
Possible values are: "FaceCenter", "EdgeCenter", "OnVertex",
"OnEdge", "OnFace"
UParam, VParam
Numbers between 0 and 1 representing the relative position of the point on the edge
or face.
Example: UParam = .5, VParam = .5 would be the center of a face.
WhichAxis
Possible values are "X", "Y", "Z"
CreateObjectCS
Use: Creates an Object coordinate system.
Command: Modeler>Coordinate System>Create>Object><Offset | Rotated | Both>
Syntax: CreateObjectCS <ParameterArrays>
Return Value: None
Parameters: Array("NAME:ObjectCSParameters",
"PartID:=", <ID>,
"ReverseXAxis:=", <Boolean>,
"ReverseYAxis:=", <Boolean>,
Array("NAME:Origin",
"IsAttachedToEntity:=", <Boolean>,
"EntityID:=", <ID>,
"PositionType:=", "<OnPositionID>,
String, one of OnVertex, FaceCenter, OnEdge, AbsolutePosition
"UParam:=", <integer>,
"VParam:=", <Integer>,
"XPosition:=", "<Integer>",
"YPosition:=", "<Integer>",
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"ZPosition:=", "<Integer>"),
Array("NAME:xAxis",
"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", <Int>,
"FaceID:=", <Int>,
"xDirection:=", "<int>",
"yDirection:=", "<Int>",
"zDirection:=", "<Int>",
"UParam:=", <int>,
"VParam:=", <Int>),
Array("NAME:yAxis",
"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", <Int>,
"FaceID:=", <int>,
"xDirection:=", "<int>",
"yDirection:=", "<int>",
"zDirection:=", "<int>",
"UParam:=", <int>,
"VParam:=", <int>)),
Array("NAME:Attributes",
"Name:=", "<ObjectCSName>")
Example:
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("coax_bend")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
oEditor.CreateObjectCS Array("NAME:ObjectCSParameters",
"PartID:=", 24,
"ReverseXAxis:=", false,
"ReverseYAxis:=", false,
Array("NAME:Origin",
"IsAttachedToEntity:=",
true, "EntityID:=", 30,
"PositionType:=", "OnVertex",
"UParam:=", 0,
"VParam:=", 0,
"XPosition:=", "0",
"YPosition:=", "0",
"ZPosition:=", "0"),
Array("NAME:xAxis",
"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", -1,
"FaceID:=", -1,
"xDirection:=", "1",
"yDirection:=", "0",
"zDirection:=", "0",
"UParam:=", 0,
"VParam:=", 0),
Array("NAME:yAxis",
"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", -1,
"FaceID:=", -1,
"xDirection:=", "0",
"yDirection:=", "1",
"zDirection:=", "0",
"UParam:=", 0, "VParam:=", 0)),
Array("NAME:Attributes",
"Name:=", "ObjectCS1")
CreateObjectFromEdges
Use: Creates a polyline from the specified object edge.
Command: Modeler>Create Object From Edge
Syntax: CreateObjectFromEdges <SelectionsArray>,
<ObjFromEdgeParametersArray>
Return Value: None
Parameters: <SelectionsArray>
Array("NAME:Selections",
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"Selections:=" <ObjName>)
<ObjFromEdgeParametersArray>
Array("NAME:Parameters",
<EdgeParametersArray>)
<EdgeParametersArray>
Array("Name:BodyFromEdgeToParameters",
"CoordinateSystemID:=", <int>,
"Edges:=", <EdgeIDarray>)
Example:
oEditor.CreateEdgeFromEdges _
Array("NAME:Selections", "Selections:=", "Box1"),_
Array("NAME:Parameters", _
Array("NAME:BodyFromEdgeToParameters", _
"CoordinateSystemID:=", -1, _
"Edges:=", Array(13)))
CreateObjectFromFaces
Use: Creates 2D objects from the specified faces.
Command: Modeler>Surface>Create Object From Face
Syntax: CreateObjectFromFaces <SelectionsArray>,
<ObjFromFaceParametersArray>
Return Value: None
Parameters: <ObjFromFaceParametersArray>
Array("NAME:Parameters",
<FacesOfOneObjToDetach>, <FacesOfOneObjToDetach>,
...)
<FacesOfOneObjToDetach>
Array("Name:BodyFromFaceToParameters",
"FacesToDetach:=", <array>)
FacesToDetach
Array of integers the IDs of the faces to use to create objects.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Example:
oEditor.CreateObjectFromFaces _
Array("NAME:Selections", "Selections:=", "Box1"),_
Array("NAME:Parameters", _
Array("NAME:BodyFromFaceToParameters", _
"FacesToDetach:=", Array(185)))
CreateRelativeCS
Use: Creates a relative coordinate system. Only the Name attribute of the
<AttributesArray> parameter is supported.
Command: Modeler>Coordinate System>Create>Relative CS->Offset
Modeler>Coordinate System>Create>Relative CS->Rotated
Modeler>Coordinate System>Create>Relative CS->Both
Syntax: CreateRelativeCS <RelativeCSParametersArray>,
<AttributesArray>
Return Value: None
Parameters: <RelativeCSParametersArray>
Array("NAME:RelativeCSParameters",
"OriginX:=", <value>,
"OriginY:=", <value>,
"OriginZ:=", <value>,
"XAxisXvec:=", <value>,
"XAxisYvec:=", <value>,
"XAxisZvec:=", <value>,
"YAxisXvec:=", <value>,
"YAxisYvec:=", <value>,
"YAxisZvec:=", <value>)
DeleteLastOperation
Use: Deletes the last operation for specified objects.
Command: Modeler>Delete Last Operation
Syntax: DeleteLastOperation <SelectionsArray>
Return Value: None
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
DetachFaces
Use: Detaches the specified faces.
Command: Modeler>Surface>Detach Faces
Syntax: DetachFaces <SelectionsArray>,
<DetachFacesParametersArray>
Return Value: None
Parameters: <DetachFacesParametersArray>
Array("NAME:Parameters",
<FacesOfOneObjToDetach>,
<FacesOfOneObjToDetach>, ...)
<FacesOfOneObjToDetach>
Array("Name:DetachFacesToParameters",
"FacesToDetach:=", <array>)
FacesToDetach
An array of integers the face IDs of the faces to detach.
Example:
oEditor.DetachFaces _
Array("NAME:Selections", "Selections:=",_
"Box5,Box4"),_
Array("NAME:Parameters", _
Array("NAME:DetachFacesToParameters", _
"FacesToDetach:=", Array(123, 122)),
Array("NAME:DetachFacesToParameters", _
"FacesToDetach:=", Array(94)))
EditEntityList
Use: Modifies an entity list.
Command: Modeler>List>Reassign
Syntax: EditEntityList <SelectionsArray>,
<EntityListParametersArray>
Return Value: None
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EditFaceCS
Use: Recreates an existing face coordinate system. The name of the coordinate
system to modify should be specified in the <AttributesArray>
parameter.
Command: Modeler->Coordinate System->Edit
Syntax: EditFaceCS <FaceCSParametersArray>, <AttributesArray>
Return Value: None
EditObjectCS
Use: Edit an existing Object CS.
Command: Modeler>Coordinate System>Edit
Syntax: EditObjectCS <Array>
Return Value: None
Parameters: Array("NAME:ObjectCSParameters",
"PartID:=", <ID>,
"ReverseXAxis:=", <Boolean>,
"ReverseYAxis:=", <Boolean>,
Array("NAME:Origin",
"IsAttachedToEntity:=", <Boolean>,
"EntityID:=", <ID>,
"PositionType:=", "<OnPositionID>,
String, one of OnVertex, FaceCenter, OnEdge, AbsolutePosition
"UParam:=", <integer>,
"VParam:=", <Integer>,
"XPosition:=", "<Integer>",
"YPosition:=", "<Integer>",
"ZPosition:=", "<Integer>"),
Array("NAME:xAxis",
"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", <Int>,
"FaceID:=", <Int>,
"xDirection:=", "<int>",
"yDirection:=", "<Int>",
"zDirection:=", "<Int>",
"UParam:=", <int>,
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"VParam:=", <Int>),
Array("NAME:yAxis",
"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", <Int>,
"FaceID:=", <int>,
"xDirection:=", "<int>",
"yDirection:=", "<int>",
"zDirection:=", "<int>",
"UParam:=", <int>,
"VParam:=", <int>)),
Array("NAME:Attributes",
"Name:=", "<ObjectCSName>")
Example:
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("Project53")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.SetWCS Array("NAME:SetWCS Parameter",
"Working Coordinate System:=", "ObjectCS1")
oEditor.EditObjectCS Array("NAME:ObjectCSParameters",
"PartID:=", 6,
"ReverseXAxis:=", false,
"ReverseYAxis:=", false,
Array("NAME:Origin", "IsAttachedToEntity:=", false,
"EntityID:=", -1,
"PositionType:=", "AbsolutePosition",
"UParam:=", 0, "VParam:=", 0,
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EditRelativeCS
Use: Modifies a relative coordinate system. Use <AttributesArray> to
indicate the name of the coordinate system to modify.
Command: Modeler>Coordinate System>Edit
Syntax: EditRelativeCS <RelativeCSParametersArray>,
<AttributesArray>
Return Value: None
Parameters: <ParametersArray>
Array("NAME:RelativeCSParameters",
"OriginX:=", <value>,
"OriginY:=", <value>,
"OriginZ:=", <value>,
"XAxisXvec:=", <value>,
"XAxisYvec:=", <value>,
"XAxisZvec:=", <value>,
"YAxisXvec:=", <value>,
"YAxisYvec:=", <value>,
"YAxisZvec:=", <value>)
Export
Use: Exports the model to a file.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Command: Modeler>Export
Syntax: Export <ExportParametersArray>
Return Value: None
Parameters: <ExportParametersArray>
Array("NAME:ExportParameters",
"File Name:=", <string>,
"Major Version:=", <int>,
"Minor Version:=", <int>)
Major Version
Can be 1 or any ACIS major version supported by HFSS software.
Minor Version
Can be 1 or any ACIS minor version supported by HFSS software.
ExportModelImageToFile
Use: Export an image of the model to a file.
Command: Modeler>Export...
Syntax: ExportModelImageToFile "<path>/
<imageName>.<formatsuffix>" 0,0, Array(<SaveImageParams>)
Return Value: None
Parameters: <path>
<imagename>
<formatsuffix>, You can export the following graphics formats:
Extension Contents
0,0,
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Array("NAME:SaveImageParams",
"ShowAxis:=","<string>",
"ShowGrid:=", "<string>",
"ShowRuler:=", "<string>")
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 15.0.0
' 2:28:32 PM Jul 30, 2012
' ----------------------------------------------
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("dra_diel")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.ExportModelImageToFile _
"C:/MyPath/Downloads/dra_example.jpg", 0, 0,
Array("NAME:SaveImageParams", "ShowAxis:=", _
"Default", "ShowGrid:=", "Default", "ShowRuler:=", "Default")
Fillet
Use: Creates a fillet.
Command: Modeler>Fillet
Syntax: Fillet(<ObjectName> <FilletParameters>)
Return Value: None
Parameters: <ObjectName>
Array("NAME:Selections", _
"Selections:=", <string>),
<FilletParameters>
Array("NAME:Parameters", _
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Array("NAME:FilletParameters", _
"CoordinateSystemID:=", <value>,
"Edges:=", <ArrayOfEdgeIDs>,
"Radius:=", <value>,
"Setback:=", <value>))
Example:
oEditor.Fillet Array("Name:Selections", "Selections:=", _
"Box1"), Array("NAME:Parameters", Array("NAME:FilletParameters", _
"CoordinateSystemID:=", -1, "Edges:=", Array(13), "Radius:=", _
"1mm", "Setback:=", "0mm"))
GenerateHistory
Use: Generates the history for specified 1D objects.
Command: Modeler>Generate History
Syntax: GenerateHistory <SelectionsArray>
Return Value: None
HealObject
Use: To heal an imported object.
Command: Modeler>Model Healing>Heal
Syntax: HealObject <parameters>
Return Value: None
Parameters: Array("NAME:Selections",
"Selections:=", "<objectID>",
"NewPartsModelFlag:=", "Model"),
Array("NAME:ObjectHealingParameters",
"Version:=", 1,
"AutoHeal:=", <boolean>,
"TolerantStitch:=", <boolean>,
"SimplifyGeom:=", <boolean>,
"TightenGaps:=", <boolean>,
"StopAfterFirstStitchError:=", <boolean>,
"MaxStitchTol:=", <smallvalue>,
"ExplodeAndStitch:=", <boolean>,
3D Modeler Editor Script Commands 11-43
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"GeomSimplificationTol:=", <value>,
"MaximumGeneratedRadiusForSimplification:=", <value>,
"SimplifyType:=", 2,
"TightenGapsWidth:=", <value>,
"RemoveSliverFaces:=", <boolean>,
"RemoveSmallEdges:=", <boolean>,
"RemoveSmallFaces:=", <boolean>,
"SliverFaceTol:=", <value>,
"SmallEdgeTol:=", <value>,
"SmallFaceAreaTol:=", <value>,
"BoundingBoxScaleFactor:=", <value>,
"RemoveHoles:=", <boolean>,
"RemoveChamfers:=", <boolean>,
"RemoveBlends:=", <boolean>,
"HoleRadiusTol:=", <value>,
"ChamferWidthTol:=", <value>,
"BlendRadiusTol:=", <value>,
"AllowableSurfaceAreaChange:=", <value>,
"AllowableVolumeChange:=", <value>)
Example:
oEditor.HealObject Array("NAME:Selections",
"Selections:=", "Box1",
"NewPartsModelFlag:=", "Model"),
Array("NAME:ObjectHealingParameters",
"Version:=", 1,
"AutoHeal:=", false,
"TolerantStitch:=", true,
"SimplifyGeom:=", true,
"TightenGaps:=", true,
"StopAfterFirstStitchError:=", false,
"MaxStitchTol:=", 0.001,
"ExplodeAndStitch:=", true,
"GeomSimplificationTol:=", -1,
"MaximumGeneratedRadiusForSimplification:=", -1,
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"SimplifyType:=", 2,
"TightenGapsWidth:=", 1E-006,
"RemoveSliverFaces:=", true,
"RemoveSmallEdges:=", true,
"RemoveSmallFaces:=", true,
"SliverFaceTol:=", 0,
"SmallEdgeTol:=", 0.1,
"SmallFaceAreaTol:=", 0.1,
"BoundingBoxScaleFactor:=", 1250,
"RemoveHoles:=", true,
"RemoveChamfers:=", true,
"RemoveBlends:=", true,
"HoleRadiusTol:=", 0.1,
"ChamferWidthTol:=", 0.1,
"BlendRadiusTol:=", 0.1,
"AllowableSurfaceAreaChange:=", 5,
"AllowableVolumeChange:=", 5)
Import
Use: Imports a 3D model file.
Command: Modeler>Import
Syntax: Import <ImportParametersArray>
Return Value: None
Parameters: <ImportParametersArray>
Array("NAME:NativeBodyParameters",
"CoordinateSystemID:=", <ID>,
"HealOption:=", <integer>,
"CheckModel:=", <boolean>,
"Options:=", "",
"FileType:=", "UnRecognized",
"MaxStitchTol:=", <value>,
"SourceFile:=", "string")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ImportDXF
Use: Imports an AutoCAD model file and a tech file. The tech file is an ASCII file
that lists the units, the layer name followed by tab delimited color,
elevations and thickness.
Command: Modeler>Import
Syntax: ImportDXF <ImportParametersArray>
Return Value: None
Parameters: <ImportParametersArray>
Array("NAME:options",
"FileName:=", <path>,
"Scale:=", <real>,
"UnionOverlapping:=", <boolean>,
"AutoDetectClosed:=", <boolean>,
"SelfStitch:=", <boolean>,
"DefeatureGeometry:=", <boolean>,
"DefeatureDistance:=", <real>,
"RoundCoordinates:=", <boolean>,
"RoundNumDigits:=", <integer>,
"WritePolyWithWidthAsFilledPoly:=", <boolean>,
"ImportMethod:=", <integer>,
"2DSheetBodies:=", <boolean>,
Array("NAME:LayerInfo",
Array("NAME:<layerName>",
"source:=", "<integer>",
"display_source:=", "<integer>",
"import:=", <boolean>,
"dest:=", "<integer>",
"dest_selected:=", <boolean>,
"layer_type:=", "<string>",
"paint:=", <boolean>),
Array("NAME:TechFileLayers", "layer:=",
Array("name:=", "ground",
"color:=", "purple",
"elev:=", 0,
"thick:=", 0.0001),
)))
11-46 3D Modeler Editor Script Commands
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
oEditor.Import Array("NAME:NativeBodyParameters",
"CoordinateSystemID:=", -1,
"HealOption:=", <integer>,
"CheckModel:=", <boolean>,
"Options:=", "",
"FileType:=", "UnRecognized",
"MaxStitchTol:=", <real>,
"SourceFile:=", "<path>" & ".sm3")
Example:
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.ImportDXF Array("NAME:options", "FileName:=", _
"C:/mymodel.dxf", ...
Array("NAME:TechFileLayers", ...
"layer:=", Array("name:=", "BOTTOMLAYER",
"color:=", "purple",
"elev:=", 0,
"thick:=", 200),
)))
oEditor.Import Array("NAME:NativeBodyParameters",
"CoordinateSystemID:=", -1,
"HealOption:=", 0,
"CheckModel:=", true,
"Options:=", "",
"FileType:=", "UnRecognized",
"MaxStitchTol:=", 0.001,
"SourceFile:=", "C:design." & ".sm3")
ImportGDSII
Use: Imports a GDSII 3D model file.
Command: Modeler>Import
Syntax: ImportGDSII <ImportParametersArray>
Return Value: None
Parameters:
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"FileName:=", "<string>",
"NodeConversionType:=", "<string>",
"MaxLayerNumber:=", <integer>,
"ApproxPolyToCircle:=", <boolean>,
"FlattenHierarchy:=", <boolean>,
"ImportMethod:=", <integer>,
Array("NAME:LayerMap",
Array("NAME:LayerMapInfo",
"LayerNum:=", <integer>,
"Import:=", <booleaninteger>,
"IsVIA:=", <booleaninteger>,
"IsLayerNew:=", <booleanInteger>,
"DestLayer:=", "<string>",
"layer_type:=", "<string>",
"IsPresentInLayout:=", <boolean>),
"OrderMap:=", Array("entry:=",
Array("order:=", <integer>,
"layer:=", "<string>"),
"entry:=", Array("order:=",
<integer>, "layer:=", "Signal25"),
"entry:=", Array("order:=", <integer+1>,
"layer:=", "Signal30"),
...),
Array("NAME:Structs",
Array("NAME:GDSIIStruct", "ImportStruct:=", <boolean>,
"CreateNewCell:=", <boolean>,
"StructName:=", "string>",
Array("NAME:Elements")),
Array("NAME:GDSIIStruct", "ImportStruct:=",<boolean>,
"CreateNewCell:=", <boolean>,
"StructName:=", "<string>",
Array("NAME:Elements"))))
oEditor.Import Array("NAME:NativeBodyParameters",
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"CoordinateSystemID:=", <ID>,
"HealOption:=", <integer>,
"CheckModel:=", <boolean>,
"Options:=", "",
"FileType:=", "UnRecognized",
"MaxStitchTol:=", <value>,
"SourceFile:=", "string")
Example:
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.ImportGDSII Array("NAME:options", ...
Intersect
Use: Intersects specified objects.
Command: Modeler>Boolean>Instersect
Syntax: Intersect <SelectionsArray>, <IntersectParametersArray>
Return Value: None
Parameters: <IntersectParametersArray>
Array("NAME:IntersectParameters",
"KeepOriginals:=", <bool>)
MoveCStoEnd
Use: Moves the named ObjectCS to the end of the History tree.
Command: Modeler>Coordinate System>Move CS to End
Syntax: MoveCSToEnd Array("NAME:Selections",
"Selections:=", "<ObjectCSName>")
Return Value: None
Parameters: <ObjectCSName>
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Dim oModule
Set oAnsoftApp = CreateObject("AnsoftHfss.HfssScriptInterface")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("coax_bend")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.MoveCSToEnd Array("NAME:Selections",
"Selections:=", "ObjectCS1")
MoveFaces
Use: Moves the specified faces along normal or along a vector.
Command: Modeler>Surface>Move Faces>Along Normal
Modeler>Surface>Move Faces>Along Vector
Syntax: MoveFaces <SelectionsArray>, <MoveFacesParametersArray>
Return Value: None
Parameters: <MoveFacesParametersArray>
Array("NAME:Parameters",
<FacesOfOneObjToMove>, <FacesOfOneObjToMove>, ...)
<FacesOfOneObjToMove>
Array("Name:MoveFacesParameters",
"MoveAlongNormalFlag:=", <bool>,
"OffsetDistance:=", <value>,
"MoveVectorX:=", <value>,
"MoveVectorY:=", <value>,
"MoveVectorZ:=", <value>,
"FacesToMove:=", <array>)
MoveAlongNormalFlag
Specifies whether to move along the face normal or along a vector.
If false, provide the MoveVectorX, MoveVectorY, and MoveVectorZ parame-
ters.
FacesToMove
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ProjectSheet
Use: Project planar sheet object, typically for modeling thin conformal deposits.
Typically followed by Thicken Sheet.
Command: Modeler>Surface>Project Sheet
Syntax: ProjectSheet
(Array("NAME:Selections",Selections:="...,...,""),
Array("NAME:ProjectSheetParameters")
Return Value: None
Parameters: None
Example:
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.ProjectSheet Array("NAME:Selections", "Selections:=",
"Box1,Box2,Polyline1"),
array("NAME:ProjectSheetParameters")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
PurgeHistory
Use: Purges the construction history of the selected object. For complex objects
this simplifies the object and can improve modeler speed.
Command: Modeler>Purge History
Syntax: PurgeHistory <PurgeHistoryArray>
Return Value: None
Parameters: <PurgeHistoryArray>
Array(Name:Selections,
Selections:=, <string>,
NewPartsModelFlag:=, <string>)
Selections
Name of the object to purge.
NewPartsModelFlag
Flag to indicate model properties, Model or NonModel.
Example:
oEditor.PurgeHistory Array("NAME:Selections", _
"Selections:=", "Polygon1", "NewPartsModelFlag:=", "Model")
Section
Use: Creates a 2D cross-section of the selection in the specified plane.
Command: Modeler>Surface>Section
Syntax: Section <SelectionsArray>, <SectionParametersArray>
Return Value: None
Parameters: <SectionParametersArray>
Array("NAME:SectionToParameters",
"SectionPlane:=", <string>)
Section Plane
Possible values are "XY", "YZ", "ZX"
SeparateBody
Use: Separates bodies of specified multi-lump objects.
Command: Modeler>Boolean>Separate Bodies
Syntax: SeparateBody <SelectionsArray>
Return Value: None
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Parameters: <SelectionsArray>
Selections:=",<objectNames>"
"NewPartsModelFlag:=", "Model"
Example:
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.SeparateBody Array("NAME:Selections",
"Selections:=", "Rectangle1,Circle1",
"NewPartsModelFlag:=", "Model")
SetModelUnits
Use: Sets the model units.
Command: Modeler>Units
Syntax: SetModelUnits <ModelUnitsParametersArray>
Return Value: None
Parameters: <ModelUnitsParametersArray>
Array("NAME:Units Parameter",
"Units:=", <string>,
"Rescale:=", <bool>)
Units
Possible values are: "cm", "ft", "in", "meter", "mil", "mm", "nm",
"uin", "um"
SetWCS
Use: Sets the working coordinate system.
Command: Modeler>Coordinate System>Set Working CS
Syntax: SetWCS <WCSParametersArray>
Return Value: None
Parameters: <WCSParametersArray>
Array("NAME:SetWCS Parameter",
"Working Coordinate System:=", <string>)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ShowWindow
Use: Opens the selected 3D model editor window.
Syntax: ShowWindow
Return Value: None
Parameters: None
Example:
Set oDesign = oProject.GetActiveDesign
Set oModeler = oDesign.SetActiveEditor("3D Modeler")
oEditor.ShowWindow
Split
Use: Splits specified objects along a plane.
Command: Modeler->Boolean->Split
Syntax: Split <SelectionsArray>, <SplitParametersArray>
Return Value: None
Parameters: <SplitParametersArray>
Array("NAME:SplitToParameters",
"SplitPlane:=", <string>,
"WhichSide:=", <string>)
SplitPlane
Possible values are "XY", "YZ", "ZX"
WhichSide
Side to keep. Possible values are "Both", "PositiveOnly", "NegativeO-
nly"
Subtract
Use: Subtracts specified objects.
Command: Modeler->Boolean->Subtract
Syntax: Subtract <SubtractSelectionsArray>,
<SubtractParametersArray>
Return Value: None
Parameters: <SubtractSelectionsArray>
Array("NAME:Selections",
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Blank Parts
Comma-separated list of parts to use as the blank in the subtract operation.
Example: "Blank Parts:=", "Box1, Box2"
Tool Parts
Comma-separated list of parts to use as the tool in the subtract operation.
Example: "Blank Parts:=", "Box3, Box4"
<SubtractParametersArray>
Array("NAME:SubtractParameters",
"KeepOriginals:=", <bool>)
Example:
oEditor.Subtract _
Array("NAME:Selections", _
"Blank Parts:=", "Polygon1",_
"Tool Parts:=", "Box1"),_
Array("NAME:SubtractParameters", _
"KeepOriginals:=", false)
SweepFacesAlongNormal
Use: Sweep a face along normal.
Command: Modeler>Sweep Faces Along Normal
Syntax: SweepFacesAlongNormal <selection> <parameters>
Return Value: None
Parameters: Array("NAME:Selections",
"Selections:=", "<faceID>",
"NewPartsModelFlag:=", "Model"),
Array("NAME:Parameters",
Array("NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=", Array( <faceID>),
"LengthOfSweep:=", "<value><units>")
)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Example:
oEditor.SweepFacesAlongNormal
Array("NAME:Selections",
"Selections:=", "Rectangle1",
"NewPartsModelFlag:=", "Model"),
Array("NAME:Parameters",
Array("NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=",
Array( 57),
"LengthOfSweep:=", "0.5mm")
)
ThickenSheet
Use: Thicken a sheet object to convert it to a 3D object.
Command: Modeler>Surface>Thicken Sheet
Syntax: Thicken Sheet <SelectionParameters>
<SheetThickenParameters>
Return Value: None
Parameters: Array("NAME:Selections",
"Selections:=", "<objectID>",
"NewPartsModelFlag:=", "Model"),
Array("NAME:SheetThickenParameters",
"Thickness:=", "<value><units>",
"BothSides:=", <boolean>)
Example:
oEditor.ThickenSheet Array("NAME:Selections",
"Selections:=", "Rectangle1",
"NewPartsModelFlag:=", "Model"),
Array("NAME:SheetThickenParameters",
"Thickness:=", "1.01mm",
"BothSides:=", false)
UncoverFaces
Use: Uncovers specified faces.
Command: Modeler>Surface>Uncover Faces
Syntax: UncoverFaces <SelectionsArray>, <UncoverParametersArray>
Return Value: None
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Parameters: <UncoverParametersArray>
Array("NAME:Parameters",
<FacesOfOneObjToUncover>,
<FacesOfOneObjToUncover>,...)
<FacesOfOneObjToUncover>
Array("Name:UncoverFacesParameters",
"FacesToUncover:=", <array>)
FacesToUncover
An array of integers the face IDs of the faces to uncover.
Example:
oEditor.UncoverFaces _
Array("NAME:Selections", "Selections:=", _
"Box3,Box2"),_
Array("NAME:Parameters", _
Array("NAME:UncoverFacesParameters", _
"FacesToUncover:=", Array(69)),
Array("NAME:UncoverFacesParameters", _
"FacesToUncover:=", Array(36)))
Unite
Use: Unites the specified objects.
Command: Modeler>Boolean>Unite
Syntax: Unite <SelectionsArray>, <UniteParametersArray>
Return Value: None
Parameters: <UniteParametersArray>
Array("NAME:UniteParameters",
"KeepOriginals:=", <bool>)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
GetEdgeByPosition
GetEdgeIDsFromObject
GetEdgeIDsFromFace
GetFaceArea
GetFaceByPosition
GetFaceCenter
GetFaceIDs
GetModelBoundingBox
GetObjectsInGroup
GetObjectIDByName
GetObjectName
GetObjectNameByFaceID
GetMatchedObjectName
GetModelUnits
GetNumObjects
GetSelections
GetVertexIDsFromEdge
GetVertexIDsFromFace
GetVertexIDsFromObject
GetUserPosition
PageSetup
RenamePart
ChangeProperty
Use: Change the properties used to create an object in the history tree
Command: Select a command in the History Tree and select Properties.
Syntax: ChangeProperty <array>
Return Value: None
Parameters: Varies, depending on the properties associated with the
select object command.
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 9:49:26 AM Mar 09, 2011
' ----------------------------------------------
Dim oAnsoftApp
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
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("Project58")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:Geometry3DC-
mdTab",
Array("NAME:PropServers", "Polyline2:CreatePolyline:1"),
Array("NAME:ChangedProps",
Array("NAME:Type", "Value:=", "Isosceles Trapezoid"),
Array("NAME:Width/Diameter", "Value:=", "0.1mm"),
Array("NAME:Top Width", "Value:=", "0.05mm"),
Array("NAME:Height", "Value:=", "0.02mm"))))
oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:Geometry3DC-
mdTab", Array("NAME:PropServers", "Polyline2:CreatePolyline:1"),
Array("NAME:ChangedProps",
Array("NAME:Bend Type", "Value:=", "Corner"))))
Delete
Use: Deletes specified objects, coordinate systems, points, planes, etc.
Command: None
Syntax: Delete <SelectionsArray>
Return Value: None
GetBodyNamesByPosition
Use: Gets the IDs of objects that contact the given point.
Command: None.
Syntax: GetBodyNamesByPosition(<positionParameters>).
Return Value: Retuurns a list of IDs.
Parameters: <PositionParameters>
Array("NAME:Parameters", _
3D Modeler Editor Script Commands 11-59
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"Xposition:=", <value>,
"YPosition:=", <value>,
"ZPosition:=", <value>)
Example:
bodyNames = oEditor.GetBodyNamesByPosition(Array("NAME:Parameters", _
"XPosition:=", "a", _
"YPosition:=", "0mm", _
"ZPosition:=", "0mm"))
GetEdgeByPosition
Use: Gets the edge IDcorresponding to position input.
Syntax: GetEdgeByPosition(<PositionParameters>)
Return Value: Returns an integer edge ID.
Parameters: <PositionParameters>
Array("NAME:EdgeParameters", _
"BodyName:=", <string>,
"Xposition:=", <value>,
"YPosition:=", <value>,
"ZPosition:=", <value>)
Example:
edgeid = oEditor.GetEdgeByPosition(Array("NAME:EdgeParameters", _
"BodyName:=", "Box1", "XPosition:=", "3.4mm", _
"YPosition:=", "2.8mm", "ZPosition:=", "0.4mm"))
GetEdgeIDsFromFace
Use: Get the edge IDs of given a face ID.
Command: None
Syntax: GetEdgeIDsFromFace <Face ID>
Return Value: An array of edge IDs
Parameters: <FaceID>
ID of the face
Example:
Dim oEdgeIDs
oEdgeIDs = Array()
oEdgeIDs = oEditor.GetEdgeIDsFromFace(10)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
GetEdgeIDsFromObject
Use: Get the edge IDs of given an object name
Command: None
Syntax: GetEdgeIDsFromObject <Object Name>
Return Value: An array of edge IDs
Parameters: <ObjectName>
Name of the object
Example: Example:
Dim oEdgeIDs
oEdgeIDs = Array()
oEdgeIDs = oEditor.GetEdgeIDsFromObject(Box1)
GetFaceArea
Use: Get area of given face ID.
Command: None.
Syntax: GetFaceArea <face ID>
Return Value: Double value for face area.
Parameters: <FaceID>
Face ID
Example:
Dim oArea
oArea = oEditor.GetFaceArea(10)
GetFaceCenter
Use: Given a face ID, return the center position
Command: none
Syntax: GetFaceCenter <FaceID>
Return Value: An array containing face center position
Parameters: <FaceID>
Example:
Dim oFaceCenter
oFaceCenter = oEditor.GetFaceCenter(oFaceID)
GetFaceByPosition
Use: Gets the face id corresponding to position input.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Syntax: GetFaceByPosition(<FaceByPositionParametersArray>)
Return Value: Returns an integer face id
Parameters: (<FaceByPositionParametersArray>)
Array("NAME:FaceParameters",
"BodyName:=", <string>,
"XPosition:=", <value>,
"YPosition:=", <value>,
"ZPosition:=", <value>)
BodyName
Name of the body on which the point lies.
Example:
Dim faceid
faceid = oEditor.GetFaceByPosition(Array("NAME:Parameters", _
"BodyName:=" "Box1", "XPosition:=", "3.4mm", "YPosition:=, _
"2.8mm", "ZPosition:=", "0.4mm"))
GetFaceIDs
Use: Get the face IDs of given an object name
Command: None.
Syntax: GetFaceIDs <Object Name>
Return Value: An array of face IDs
Parameters: <ObjectName>
Name of the object
Example:
Dim oFaceIDs
oFaceIDs = Array()
oFaceIDs = oEditor.GetFaceIDs(Box1)
GetModelBoundingBox
Use: Gets the bounding box of the current model.
Syntax: GetModelBoundingBox()
Return Value: Returns the Xmin, Ymin, Zmin, Xmax, Ymax, Zmax values that define the
bounding box.
Parameters: None
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Example:
Dim oBoundingBox
oBoundingBox = oEditor.GetModelBoundingBox()
GetObjectsInGroup
Use: Returns the objects for the specified group.
Syntax: GetObjectsInGroup(<GroupName>)
Return Value: The objects in the group.
Parameters: <groupName>
Type: <string>
One of <materialName>, <assignmentName>, "Non Model", "Solids", "Unclassi-
fied", "Sheets", "Lines"
Example:
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
Dim oObject
Dim oObjects
Set oObjects = oEditor.GetObjectsInGroup( "Sheets" )
For Each oObject in oObjects
MsgBox oObject
Next
GetObjectIdByName
Use: Get Object IDs to provide for CreateEntityList.
Syntax: GetObjectIDByName("<objectName>")
Return Value: <Object ID>
Parameters: <objectName>
Type: <string>
Example:
oObjectID = oEditor.GetObjectIDByName("Box2")
GetObjectName
Use: Gets an object name corresponding to the 0 base index of the creation
order.
Syntax: GetObjectName(<Index>)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
GetObjectNameByFaceID
Use: Gets an object name corresponding to the input face id.
Syntax: GetObjectName(<FaceID>)
Return Value: Returns the name of the corresponding object.
Parameters: <FaceID>
Type: <string>
Example:
objectname = oEditor.GetObjectNameByFaceID(Face10)
GetMatchedObjectName
Use: Gets all object names containing the input text string.
Syntax: GetMatchedObjectName(<ObjectNameWildcardText>)
Return Value: Array of object names containing wildcard text.
Parameters: <ObjectNameWildcardText>
Type: <string>
Text to be used for object name matching.
Example:
objectnames = oEditor.GetMatchedObjectName("Box*")
GetModelUnits
Use: Get the model units.
Command: None.
Syntax: GetModelUnits
Return Value: A string contains current model units.
Parameters: None.
Example:
Dim oUnit
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
oUnit = oEditor.GetModelUnits()
GetNumObjects
Use: Gets the number of objects in a design.
Syntax: GetNumObjects
Return Value: Returns the number of objects.
Type: <int>
Parameters: None
Example:
totalobjects = oEditor.GetNumObjects
GetSelections
Use: Informational.
Syntax: GetSelections
Return Value: Array of IDs.
Parameters: None
Example:
Set oProject = oDesktop.SetActiveProject("Project6")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
Dim A
A = Array()
A = oEditor.GetSelections
Dim B
B = Join(A,",")
'Debug.Write "The Selections are " &B
MsgBox(B)
Dim C
C = Array("NAME:Selections", "Selections:=", B)
oEditor.Delete C
GetUserPosition
Use: Returns the coordinates of an interactive position input in the 3D model
window.
Syntax: GetUserPosition(<PositionInputPrompt>)
3D Modeler Editor Script Commands 11-65
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
GetVertexIDsFromEdge
Use: Get the vertex IDs of given a edge ID.
Command: None.
Syntax: GetVertexIDsFromEdge <Edge ID>
Return Value: An array of edge IDs.
Parameters: <EdgeID>
ID of the edge.
Example:
Dim oVertexIDs
oVertexIDs = Array()
oVertexIDs = oEditor.GetVertexIDsFromEdge(10)
GetVertexIDsFromFace
Use: Get the vertex IDs of given a face ID.
Command: None.
Syntax: GetVertexIDsFromFace <Face ID>
Return Value: An array of vertex IDs
Parameters: <FaceID>
ID of the face
Example:
Dim oVertexIDs
oVertexIDs = Array()
oVertexIDs = oEditor.GetVertexIDsFromFace(10)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
GetVertexIDsFromObject
Use: Get the vertex IDs of given an object name
Command: None.
Syntax: GetVertexIDsFromObject <Object Name>
Return Value: An array of edge IDs
Parameters: <ObjectName>
Name of the object
Example:
Dim oVertexIDs
oVertexIDs = Array()
oVertexIDs = oEditor.GetVertexIDsFromObject(Box1)
PageSetup
Use: Specifies the page settings for printing.
Command: File>Page Setup
Syntax: PageSetup <PageSetupParametersArray>
Return Value: None
Parameters: <PageSetupParametersArray>
Array("NAME:PageSetupData",
"margins:=",
Array("left:=", <value>,
"right:=", <value>,
"top:=", <value>,
"bottom:=", <value>))
RenamePart
Use: Renames an object.
Command: None
Syntax: RenamePart <RenameParametersArray>
Return Value: None
Parameters: <RenameParametersArray>
Array("NAME:Rename Data",
"Old Name:=", <string>,
"New Name:=", <string>)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
12 Output Variable Script
Commands
CreateOutputVariable
DeleteOutputVariable
EditOutputVariable
GetOutputVariables
GetOutputVariableValue
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
CreateOutputVariable
Use: Add a new output variable to the output variable list. Output variables are
associated with a name and an expression. The name of an output variable
is not permitted to collide with design variables or Sim values or with other
output variable names. It cannot have spaces or any arithmetic and other
operators in it. The definitions can not be cyclic. For example, A = 2*B,
B=3*A is not allowed.
Command: HFSS>Results>Output Variable
Syntax: CreateOutputVariable <OutputVarName>, <Expression>,
<Solution Name>, <reportTypeName>, <ContextArray>
Return Value: None.
Parameters: <OutputVarName>
Type: <string>
Name of the output variable
<Expression>
Type: <value>
Value to assign to the variable
<SolutionName>
Type: <string>
The name of the solution as seen in the output variable UI.
<reportTypeName >
Type: <string>
The name of the report type as seen in the output variable UI.
<ContextArray>
Type: <variant>
Context for which the output variable expression is being evaluated.
Example:
Set oModule = oDesign.GetModule("OutputVariable")
oModule.CreateOutputVariable "test","mag(S(WavePort1,WavePort1))", _
"Setup1 : LastAdaptive", "Modal Solution Data", _
Array("Domain:=", "Sweep")
DeleteOutputVariable
Use: Deletes an existing output variable. The variable can only be deleted if it is
not in use by any traces.
Command: HFSS>Output Variables, dialog Delete Button
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EditOutputVariable
Use: Changes the name or expression of an existing output variable.
Syntax: EditOutputVariable <OrigVarName>, <NewExpression>,
<NewVarName>, <SolutionName>, <reportTypeName>,
<ContextArray>
Provide empty quotes "" as the NewVarName or NewExpression if it should not be
changed.
Return Value: None
Parameters: <OrigVarName>
Type: <string>
Name of the original output variable.
<NewExpression>
Type: <string>
New value to assign to the variable.
<NewVarName>
Type: <string>
New name of the variable if any, else pass empty string.
<SolutionName>
Type: <string>
Name of the solution as seen in the output variable UI.
For example: "Setup1 : Last Adaptive"
<ReportTypeName>
Type: <string>
The name of the report type as seen in the output variable UI.
<ContextArray>
Type: <variant>
Context for which the output variable expression is being evaluated
Output Variable Script Commands 12-3
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Array(Context:=, <Context>)
Example:
Set oModule = oDesign.GetModule("OutputVariable")
oModule.EditOutputVariable "test", "dB(S(WavePort1,WavePort1)) ", _
"testNew", "Setup1 : LastAdaptive", "Modal Solution Data", _
Array("Domain:=", "Sweep")
GetOutputVariables
Use: Gets a list of output variables.
Command: None
Syntax: GetOutputVariables
Return Value: Array of output variable names
Parameters: None.
Example:
Set oAnsoftApp = CreateObject("AnsoftMaxwell.HfssScriptInterface")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("iris")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("OutputVariable")
Dim vec
Set vec = oModule.GetOutputVariables
MsgBox(vec.Count)
For i = 0 to vec.Count - 1
MsgBox(vec.Item(i))
Next
GetOutputVariableValue
Use: Gets the double value of an output variable. Only those expressions that
return a double value are supported. The expression is evaluated only for a
single point.
Syntax: GetOutputVariableValue(<OutputVarName>,
<IntrinsicVariation>, <SolutionName>, <ReportTypeName>,
<ContextArray>)
Return Value: Double value of the output variable.
Parameters: <OutputVarName>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Type: <string>
Name of the output variable.
<IntrinsicVariation>
Type: <string>
A set of intrinsic variable value pairs to use when evaluating the output expression.
Example: "Freq='20GHz' Theta='20deg' Phi='30deg' in HFSS
"" in Q3D Extractor
<SolutionName>
Type: <string>
Name of the solution as listed in the output variable UI.
For example: "Setup1 : Last Adaptive"
<ReportTypeName>
Type: <string>
The name of the report type as seen in the output variable UI. Possible values are:
"Modal Solution Data" - Only for Driven Modal solution-type problems with
ports.
"Terminal S Parameters" - Only for Driven Terminal solution-type problems
with ports.
"Eigenmode Parameters" - Only for Eigenmode solution-type problems.
"Fields"
"Far Fields" - Only for problems with radiation or PML boundaries.
"Near Fields" - Only for problems with radiation or PML boundaries.
Emission Test
<Context>
Type: Array
Context for which the output variable expression is being evaluated. This can be
empty if there is no context (for example, for S- parameters). The Reporter uses inter-
polation to evaluate the values at the given special sweeps. If a requested special-
sweep value is outside the range the Reporter does not do extrapolation. Rather it
issues an error message indicating values outside the available range for a primary
sweep.
Example:
Array("Context:=","Infinite Sphere1")
or Array("Context:=","Polyline1")
or Array()
Example:
' -----------------------------------------------------------
Output Variable Script Commands 12-5
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
' -----------------------------------------------------------
' Now, look at the original output variable in a different design
' variation
' -----------------------------------------------------------
val = oModule.GetOutputVariableValue ( "fieldOV", _
"Distance='0' _
Freq='1GHz' xsize='0.4mm' ysize='4.1mm'", _
"Setup1 : LastAdaptive", "Fields", _
Array("Context:=", "Polyline1", "PointCount:=", 1 ) )
' -----------------------------------------------------------
' Look at the same variable at a position 1mm along the line
' -----------------------------------------------------------
val = oModule.GetOutputVariableValue ( "fieldOV", _
"Distance='1mm'
Freq='1GHz'", _
"Setup1 : LastAdaptive", _
"Fields", _
Array("Context:=", "Polyline1", "PointCount:=", 3 ) _
)
MsgBox( "2 val " & FormatNumber(val) )
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
13 Reporter Editor Script
Commands
All Report and Trace properties can be edited using the ChangeProperty
commands. This includes Title properties, General properties, and Back-
ground properties such as border color, fonts, X and Y axis scaling, and num-
ber display.
Note: HFSS version 11 and above supports Reporter scripting. When you exe-
cute Tools>Record Script, HFSS Operations performed in the Reporter are
automatically recorded.
AddCartesianXMarker
AddDeltaMarker
AddMarker
AddNote
AddTraces
ClearAllMarkers
CopyTracesData
CopyReportData
CopyReportDefinitions
CopyTraceDefinitions
CreateReport
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
CreateReportFromTemplate
DeleteAllReports
DeleteReports
DeleteTraces
FFTOnReport
ExportPlotImageToFile
ExportToFile
GetAllReportNames
GetDisplayType
ImportIntoReport
PasteReport
PasteTraces
RenameReport
RenameTrace
UpdateAllReports
UpdateReports
UpdateTrace
UpdateTracesContextandSweeps
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
AddCartesianXMarker
Use: Adds a marker to a report on the X axis.
Command: Report2D>Marker>Add X Marker
Syntax: AddCartesianXMarker <ReportName>, <MarkerID>, <Xcoord>
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.
<MarkerID>
Type: <string>
ID of the marker, for example: M1.
<XCoord>
Type: <real>
X location for the marker.
Example:
oModule.AddCartesianXMarker "XY Plot1", "MX1", 0
AddDeltaMarker
Use: Add markers to calculate differences between two trace points on a plot.
Command: Report2D>Marker>Add Delta Marker
Syntax: AddDeltaMarker <ReportName>, <MarkerID_1>, <TraceID_1>,
<Xcoord_1>, <MarkerID_2>, <TraceID_2> <Xcoord_2>
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.
<MarkerID>
Type: <string>
ID for the markers.
<TraceID>
Type: <string>
Typically given by expression plus solution name plus coordinate system type.
<XCoord>
Type: <real>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
AddMarker
Use: Adds a marker to a trace on a report.
Command: Report2D>Marker>Add Marker
Syntax: AddMarker <ReportName>, <MarkerID>, <TraceID>, <Xcoord>,
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.
<MarkerID>
Type: <string>
ID for the marker.
<TraceID>
Type: <string>
Typically given by expression plus solution name plus coordinate system type.
<XCoord>
Type: <real>
X location for the marker.
Example:
Set oModule = oDesign.GetModule("ReportSetup")
oModule.AddMarker "XY Plot1", "m1", _
"mag(S(Port1 Port1)) : Setup1 : LastAdaptive : Cartesian", "0.3in"
AddNote
Use: Adds a note at a specified location to a given report.
Command: Right-click on the plot and select Add Note
Syntax: AddNote <ReportName> <NoteDataArray>)
Return Value: None
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Parameters: <ReportName>
Type: <string>
Name of report.
<NoteDataArray>
Type: Array
Array(NAME:<NoteDataName>, <NoteArray>)
<NoteDataName>
Type: String
<NoteArray>
Array(NAME:<NoteDataSourceName>,
SourceName:=, <SourceName>,
"HaveDefaultPos:=", <boolean>,
"DefaultXPos:=", <XPos>,
"DefaultYPos:=", <YPos>,
String:=, <Note>))
Example:
Set oModule = oDesign.GetModule("ReportSetup")
oModule.AddNote "XY Plot1", Array("NAME:NoteDataSource",
Array("NAME:NoteDataSource", "SourceName:=", "Note1",
"HaveDefaultPos:=", true, "DefaultXPos:=", 1996, "DefaultYPos:=", _
3177, "String:=", "This is a note"))
AddTraces
Use: Creates a new trace and adds it to the specified report.
Command: Modify Report>Add Trace
Syntax: Add Traces <ReportName> <SolutionName> <ContextArray
<FamiliesArray> <ReportDataArray>
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.
<SolutionName>
Type: <string>
Name of the solution as listed in the Modify Report dialog box.
Reporter Editor Script Commands 13-5
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<ContextArray>
Type: Array of strings
Context for which the expression is being evaluated. This can be an empty string if
there is no context.
Array(Domain:=, <DomainType>)
<DomainType>
ex. Sweep or Time
Array(Context:=, <GeometryType>)
<GeometryType>
ex. Infinite Spheren, Spheren, Polylinen
<FamiliesArray>
Type: Array of strings
Contains sweep definitions for the report.
Array(<VariableName>:= , <ValueArray>)
<ValueArray>
Array(All) or Array(Value1, Value2, ...Valuen)
examples of <VariableName>
Freq, Theta, Distance
<ReportDataArray>
Type: Array of strings
This array contains the report quantity and X, Y, and (Z) axis definitions.
Array(X Component:=, <VariableName>, Y Component:=, <VariableName> |
<ReportQuantityArray>)
<ReportQuantityArray>
ex. Array(dB(S(Port1, Port1)))
Example:
oModule.AddTraces "XY Plot1", "Setup1 : Sweep1", _
Array("Domain:=", "Time", "HoldTime:=", 1, "RiseTime:=", 0, _
13-6 Reporter Editor Script Commands
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ClearAllMarkers
Use: Clears all markers from a report.
Command: Report2d>Markers>ClearAllMarkers
Syntax: ClearAllMarkers <ReportName>
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.
Example:
Set oProject = oDesktop.SetActiveProject("dra_antenna")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("ReportSetup")
oModule.ClearAllMarkers "XY Plot 1"
CopyTracesData
Use: Copy trace data for a paste operation.
Command: Select a trace in the Project tree, right-click and select Copy Data
Syntax: CopyTracesData <ReportName> <TracesArray>)
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.
<TracesArray>
Type: Array of Strings
Trace definitions from which to copy corresponding data.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Example:
oModule.CopyTracesData "Transmission", Array("mag(S(Port1,Port2))")
CopyReportData
Use: Copy all data corresponding to the specified reports.
Command: Select a report in the Project tree, right-click and select Copy Data
Syntax: CopyReportData <ReportsArray>
Return Value: None
Parameters: <ReportsArray>
Type: Array of strings
Names of reports from which to copy data.
Example:
oModule.CopyReportData Array("Transmission, Reflection")
CopyReportDefinitions
Use: Copy the definition of a report for paste operations.
Command: Select a report in the Project tree, right-click and select Copy Definition
Syntax: CopyReportDefinitions <ReportsArray>
Return Value: None
Parameters: <ReportsArray>
Type: Array of strings
Names of reports from which to copy the definitions.
Example:
oModule.CopyReportDefinitions Array("Transmission, Reflection")
CopyTraceDefinitions
Use: Copy trace definitions for a paste operation.
Command: Select a trace in the Project tree, right-click and select Copy Definition
Syntax: CopyTraceDefinitions <ReportName> <TracesArray>
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.
<TracesArray>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
CreateReport
Use: Creates a new report with a single trace and adds it to the Results branch in
the project tree.
Command: HFSS>Results>Create <type> Report
Syntax: CreateReport <ReportName> <ReportType> <DisplayType>
<SolutionName> <ContextArray> <FamiliesArray>
<ReportDataArray>
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.
<ReportType>
Type: <string>
Possible values are:
"Modal S Parameters" - Only for Driven Modal solution-type problems with
ports.
"Terminal S Parameters" - Only for Driven Terminal solution-type problems
with ports.
"Eigenmode Parameters" - Only for Eigenmode solution-type problems.
"Fields"
"Far Fields" - Only for problems with radiation or PML boundaries.
"Near Fields" - Only for problems with radiation or PML boundaries.
Emission Test
<DisplayType>
Type: <string>
If ReportType is "Modal S Parameters", "Terminal S Parame-
ters", or "Eigenmode Parameters", then set to one of the following:
"Rectangular Plot", "Polar Plot", "Radiation Pattern",
"Smith Chart", "Data Table", "3D Rectangular Plot", or
"3D Polar Plot".
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<SolutionName>
Type: <string>
Name of the solution as listed in the Modify Report dialog box.
For example: "Setup1 : Last Adaptive"
<ContextArray>
Type: Array of strings
Context for which the expression is being evaluated. This can be an empty string if
there is no context.
Array(Domain:=, <DomainType>)
<DomainType>
ex. Sweep or Time
Array(Context:=, <GeometryType>)
<GeometryType>
ex. Infinite Spheren, Spheren, Polylinen
<FamiliesArray>
Type: Array of strings
Contains sweep definitions for the report.
Array(<VariableName>:= , <ValueArray>)
<ValueArray>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<ReportDataArray>
Type: Array of strings
This array contains the report quantity and X, Y, and (Z) axis definitions.
Array(X Component:=, <VariableName>, Y Component:=, <VariableName> |
<ReportQuantityArray>)
<ReportQuantityArray>
ex. Array(dB(S(Port1, Port1)))
Example:
oModule.CreateReport Rept2DRectFreq",_
"Modal Solution Data", XY Plot", _
"Setup1 : Sweep1",_
Array("Domain:=", "Sweep"), _
Array("Freq:=", Array("All")), _
Array("X Component:=", "Freq",
"Y Component:=", _ Array("dB(S(LumpPort1,Lump-
Port1))")), _
Array()
Example:
Set oModule = oDesign.GetModule("ReportSetup")
oModule.CreateReport "3D Cartesian Plot1", "Far Fields",_
"3D Cartesian Plot", "Setup1 : LastAdaptive", _
Array("Context:=", "Infinite Sphere1", "Domain:=", "Sweep"),
Array("Theta:=", Array("All"), "Phi:=", Array("All"), _
"Freq:=", Array("10GHz")), _
Array("X Component:=", "Theta", _
"Y Component:=", "Phi", _
"Z Component:=", Array("rETotal")), _
Array()
Example:
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
oModule.CreateReport "ReptSmithFreq",_
"Modal Solution Data", "Smith Plot", "Setup1 : Sweep1", _
Array("Domain:=", "Sweep"), _
Array("Freq:=", Array("All")),_
Array("Polar Component:=", _
Array("ln(Y(LumpPort1,LumpPort1))")), _
Array()
CreateReportFromTemplate
Use: Create a report from a saved template.
Command: HFSS>Results>PersonalLib><TemplateName>
Syntax: CreateReportFromTemplate <TemplatePath>
Return Value: A new report.
Parameters: <TemplatePath>
Type: <string>
Path to report template.
Example:
Set oProject = oDesktop.SetActiveProject("wg_combiner")
Set oDesign = oProject.SetActiveDesign("wg_combiner")
Set oModule = oDesign.GetModule("ReportSetup")
oModule.CreateReportFromTemplate _
"C:\MyHFSS11Projects\PersonalLib\" & _
"ReportTemplates\TestTemplate.rpt"
DeleteAllReports
Use: Deletes all existing reports.
Command: Right-click the report to delete in the project tree, and then click Delete
All Reports on the shortcut menu.
Syntax: DeleteAllReports
Return Value: None
Example:
oModule.DeleteAllReports
DeleteReports
Use: Deletes an existing report or reports.
13-12 Reporter Editor Script Commands
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Command: Right-click the report to delete in the project tree, and then click Delete on
the shortcut menu.
Syntax: DeleteReports(<ReportNameArray>)
Return Value: None
Parameters: <ReportNameArray>
Type: Array of strings
Example:
oModule.DeleteReports Array(Rept2DRectFreq)
DeleteTraces
Use: Deletes an existing traces or traces.
Command: Right-click the report to delete in the project tree, and then click Delete on
the shortcut menu.
Syntax: DeleteTraces(<TraceSelectionArray>)
Return Value: None
Parameters: <TraceSelectionArray>
Type: Array of strings
Array(<ReportName>:=, <TracesArray>, <TracesArray>,... )
<ReportName>
Type: <string>
Name of Report.
<TracesArray>
Type: Array of strings
This array contains the traces to delete within a report.
Array(<Trace>, <Trace>, ...)
<Trace>
Type: string
Example:
oModule.DeleteTraces Array("XY Plot 1:=", Array("dB(S(LumpPort1,Lump-
Port1))"), XY Plot 2:=, Array(Mag_E))
ExportPlotImageToFile [Reporter]
Use: Create field plot exports of existing field plots from a given view points, and
with the model being auto-sized automatically for each view.
Command: None.
Reporter Editor Script Commands 13-13
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Example:
This example demonstrates the creation of E-field plots of three different orientations:
Mag_E1 created in-plane with the XY-plane of the Global coordinate system
Mag_E2 created in-plane with the XY-plane of the RelativeCS1 coordinate system
Mag_E3 created in-plane with the XY-plane of the RelativeCS2 coordinate system
Dim oAnsoftApp, oDesktop, oProject, oDesign, oEditor, oModule
Set oAnsoftApp = CreateObject("AnsoftHfss.HfssScriptInterface")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject()
Set oDesign = oProject.GetActiveDesign()
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ExportToFile [Reporter]
Use: From a data table or plot, generates text format, comma delimited, tab
delimited, or .dat type output files.
Command: Right-click on report name in the Project tree and select Export Data.
Syntax: ExportToFile <ReportName>, <FileName>
Return Value: None
Parameters: <ReportName>
Type: string
<FileName>
Type: string
Path and file name.
FFTOnReport
Use: Perform an FFT on a selected report.
Command: HFSS>Results>Perform FFT on Report
Syntax: FFTOnReport <plotName>, <FFTWindowType>, <function>
Return Value: Creates a plot named FFT PlotName
Parameters: <PlotName>
Type: string
<FFTWindowType>
Type: string
Rectangular, Tri, Van Hann, Hamming, Blackman,Lanczos, Weber, Welch.
<function>
Type: string
<none>, ang_deg, ang_rad, arg, cang_deg, cang_rad, dB, dB1 normalize, dB20nor-
malize, dBc, im, mag, normalize, re.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 3:39:35 PM Mar 16, 2011
' ----------------------------------------------
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("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
Set oModule = oDesign.GetModule("Solutions")
oModule.FFTOnReport "XY Plot 1", "Rectangular", "dB"
GetAllReportNames
Use: Gets the names of existing reports in a design.
Syntax: GetAllReportNames()
Return Value: Array of report names.
Parameters: None
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("AnsoftHFSS.HFSSScriptInterface")
Set oDesktop = oAnsoftApp.GetAppDesktop()
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject
Set oDesign = oProject.GetActiveDesign
Set oReportModule = oDesign.GetModule("ReportSetup")
Dim names
names = oReportModule.GetAllReportNames
For index = 0 to UBound(names)
MsgBox(names(index))
Next
Set oFieldReportModule = oDesign.GetModule("FieldsReporter")
Set collection = oFieldReportModule.GetFieldPlotNames
For index = 0 to collection.Count-1
MsgBox(collection.Item(index))
Next
GetDisplayType
Use: Get the display type of a report.
Command: None
Syntax: GetDisplayType <reportName>
Return Value: Report <displaytype> of a report.
<DisplayType>
Type: <string>
If ReportType is "Modal S Parameters", "Terminal S Parame-
ters", or "Eigenmode Parameters", then returns one of the following:
"Rectangular Plot", "Polar Plot", "Radiation Pattern",
"Smith Chart", "Data Table", "3D Rectangular Plot", or
"3D Polar Plot".
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Parameters: <ReportName>
Type: <string>
Report name.
Example:
Set oDesign = oProject.SetActiveDesign("wg_combiner")
Set oModule = oDesign.GetModule("ReportSetup")
MyPlotDisplayType = oModule.GetDisplayType "XY Plot1"
ImportIntoReport
Use: Imports .tab, .csv, and .dat format files into a report.
Command: Right-click on report name in the Project tree and select Export Data.
Syntax: ImportIntoReport <ReportName>, <FileName>
Return Value: None
Parameters: <ReportName>
Type: string
<FileName>
Type: string
Path and file name.
PasteReports
Use: Paste copied reports to results in the current project.
Command: Paste
Syntax: PasteReports
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
PasteTraces
Use: To paste copied traces to a named plot.
Command: Paste
Syntax: PasteTraces <plotName>
Return Value: None
Parameters: <plotName>
Type: <string>
Name of plot.
Example:
oModule.PasteTraces "XY Plot1"
RenameReport
Use: Renames an existing report.
Command: Select a report on the Project tree, right-click and select Rename
Syntax: RenameReport <OldReportName>, <NewReportName>
Return Value: None
Parameters: <OldReportName>
Type: string
<NewReportName>
Type: string
Example:
oModule.RenameReport "XY Plot1", "Reflection"
RenameTrace
Use: To rename a trace in a plot
Command: None
Syntax: RenameTrace <plotName> <traceID> <newName>
Return Value: None
Parameters: <plotName>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Type: <string>
Name of plot.
<traceID>
Type: <string>
Name of trace.
<newName>
Type: <string>
New trace name.
Example:
oModule.RenameTrace "XY Plot1", "dB(S(WavePort1,WavePort1))1",_
Port1dbS"
UpdateAllReports
Use: Updates the specified reports in the Results branch in the project tree.
Command: HFSS>Results>Update All Reports
Syntax: UpdateReports Array("<plotname>")
Return Value: None.
Parameters: <plotname>
Type: <string>
Name of plot.
Example:
Set oModule = oDesign.GetModule("ReportSetup")
oModule.UpdateAllReports
UpdateReports
Use: Updates the specified reports in the Results branch in the project tree.
Command: Update Report
Syntax: UpdateReports Array("<plotname>")
Return Value: None.
Parameters: <plotname>
Type: <string>
Name of plot.
Example:
Set oModule = oDesign.GetModule("ReportSetup")
oModule.UpdateReports Array("XY Plot 1")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
UpdateTraces
Use: Update the traces in a report for which traces are not automatically
updated by the Report Traces dialog, Update Report, Real Time selection.
Command: Report dialogue, Apply Traces button
Syntax: UpdateTraces <plotName> Array(<TraceDef>) Array()
Return Value:
Parameters: <ReportName>
Type: <string>
Name of Report.
<SolutionName>
Type: <string>
Name of the solution as listed in the Modify Report dialog box.
For example: "Setup1 : Last Adaptive"
<ContextArray>
Type: Array of strings
Context for which the expression is being evaluated. This can be an empty string if
there is no context.
Array(Domain:=, <DomainType>)
<DomainType>
ex. Sweep or Time
Array(Context:=, <GeometryType>)
<GeometryType>
ex. Infinite Spheren, Spheren, Polylinen
<FamiliesArray>
Type: Array of strings
Contains sweep definitions for the report.
Array(<VariableName>:= , <ValueArray>)
<ValueArray>
Array(All) or Array(Value1, Value2, ...Valuen)
examples of <VariableName>
Freq, Theta, Distance
Reporter Editor Script Commands 13-21
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<ReportDataArray>
Type: Array of strings
This array contains the report quantity and X, Y, and (Z) axis definitions.
Array(X Component:=, <VariableName>, Y Component:=, <VariableName> |
<ReportQuantityArray>)
<ReportQuantityArray>
ex. Array(dB(S(Port1, Port1)))
Array()
Type: Empty array.
Denotes the end of the UpdateTraces command.
Example:
Set oModule = oDesign.GetModule("ReportSetup")
oModule.UpdateTraces "XY Plot1", _ Array("dB(S(WavePort1,Wave-
Port1))"), _
"Setup1 : Sweep1", _
Array("Domain:=", "Sweep"), _
Array("Freq:=", Array("All")), _
Array("X Component:=", "Freq", _
"Y Component:=", Array("dB(S(WavePort1,WavePort1))")), _
Array()
Example:
oModule.UpdateTraces "XY Plot 1", Array("dB(S(WavePort1,Wave-
Port1))"), _
"Setup1 : Sweep1", _
Array("Domain:=", "Time", "HoldTime:=", 1, _
"RiseTime:=", 0, "StepTime:=", 0, "Step:=", false, _
"WindowWidth:=", 1, _
"WindowType:=", 0, "KaiserParameter:=", 1, _
"MaximumTime:=", 0), _
Array("Time:=", Array("All")), _
Array("X Component:=", "Time", _
"Y Component:=", Array("dB(S(WavePort1,WavePort1))")), _
Array()
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
UpdateTracesContextandSweeps
Use: Use this command to edit sweeps and context of multiple traces without
affecting their component expressions.
Command: Modify Report with multiple traces selected.
Syntax: UpdateTracesContextandSweeps
Return Value: None.
Parameters: <ReportName>
Type: <string>
Name of Report.
Array(<traceIDs>)
<traceID>
Type: <string>
Name of trace.
<SolutionName>
Type: <string>
Name of the solution as listed in the Modify Report dialog box.
For example: "Setup1 : Last Adaptive"
<ContextArray>
Type: string.
Context for which the expression is being evaluated. This can be an empty string if
there is no context.
ex. Sweep or Time
Array<pointSet>
Type: <string>
Point set for the selected traces, for example, X and Y values for the plot.
Example:
Set oProject = oDesktop.SetActiveProject("Tee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
Set oModule = oDesign.GetModule("ReportSetup")
oModule.UpdateTracesContextAndSweeps _
"Active S Parameter Quick Report", _
Array( _
Reporter Editor Script Commands 13-23
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"dB(ActiveS(Port1:1))", "dB(ActiveS(Port2:1))"), _
"Setup1 : Sweep1", Array(), _
Array("Freq:=", _
Array( _
"9GHz", "9.05GHz", "9.1GHz", "9.15GHz", "9.2GHz", _
"9.25GHz", "9.3GHz", "9.35GHz", _
"9.4GHz", "9.45GHz", "9.5GHz", "9.55GHz", _
"9.6GHz", "9.65GHz", "9.7GHz", _
"9.75GHz", "9.8GHz", "9.85GHz", "9.9GHz", "9.95GHz", "10GHz"),_
"offset:=", Array("All"))
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
14 Boundary and Excitation
Module Script Commands
<AssignmentObjects>
Type: Array of strings.
An array of object names.
<AssignmentFaces>
Type: Array of integers.
An array of face IDs. The ID of a face can be determined through the user interface
using the 3D Modeler>Measure>Area command. The face ID is given in the Mea-
sure Information dialog box.
<LineEndPoint>
Array(<double>, <double>, <double>)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
GetNumBoundaries
GetNumBoundariesOfType
GetNumExcitations
GetNumExcitationsOfType
GetPortExcitationsCount
ReassignBoundary
RenameBoundary
ReprioritizeBoundaries
SetDefaultBaseName
AutoIdentifyPorts
Use: Automatically assign ports and terminals in a terminal design.
Command: HFSS>Excitations>Assign>Wave Port|Lumped Port
Syntax: AutoIdentifyPorts <FaceIDArray> <IsWavePort>,
<ReferenceConductorsArray> <BaseNameforCreatedPorts>
<UseConductorNamesAsBaseNameforTerminals>
Return Value: None.
Parameters: <FaceIDArray>
Array(NAME:Faces, <FaceID>, <FaceID>, ...)
<IsWavePort>
Type: Boolean
true = waveport, false = lumped port
<ReferenceConductorsArray>
Array(NAME:ReferenceConductors, <ConductorName>, <ConductorName>, ...)
<BaseNameforCreatedPorts>
Type: <string>
<empty string> = default name for the wave or lumped port, <string> = base name to
use for created ports
<UseConductorNamesAsBaseNameforTerminals>
Type: Boolean
true = use conductor names, false = use port object name as base name
Example:
Set oModule = oDesign.GetModule("BoundarySetup"
oModule.AutoIdentifyPorts Array("NAME:Faces", 52), true, _
Array("NAME:ReferenceConductors", Conductor1) true
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
AutoIdentifyTerminals
Use: Automatically identify the terminals within the given ports.
Command: HFSS>Excitations>Assign>Auto Assign Terminals
Syntax: AutoIdentifyTerminals <ReferenceConductorsArray>,
<PortNames> <UseConductorNamesAsBaseNameforTerminals>
Return Value: None
Parameters: <ReferenceConductors>
Array(NAME:ReferenceConductors, <ConductorName>, <ConductorName>, ...)
<portNames>
List of names.
<UseConductorNamesAsBaseNameforTerminals>
Type: Boolean
true = use conductor names, false = use port object name as base name
Example:
Set oModule = oDesign.GetModule("BoundarySetup"
oModule.AutoIdentifyTerminals Array("NAME:ReferenceConductors", Con-
ductor1), WavePort1 true
ChangeImpedanceMult
Use: Modifies the port impedance multiplier.
Command: HFSS>Excitations>Edit Impedance Mult
Syntax: ChangeImpedanceMult <MultVal>
Return Value: None
Parameters: <MultVal>
Type: <value>
New value for the impedance multiplier.
Example:
oModule.ChangeImpedanceMult 0.5
DeleteAllBoundaries
Use: Deletes all boundaries.
Command: HFSS>Boundaries>Delete All
Syntax: DeleteAllBoundaries
Return Value: None
Example: oModule.DeleteAllBoundaries
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
DeleteAllExcitations
Use: Deletes all excitations.
Command: HFSS>Excitations>Delete All
Syntax: DeleteAllExcitations
Return Value: None
Example:
oModule.DeleteAllExcitations
DeleteBoundaries
Use: Deletes the specified boundaries and excitations.
Command: Delete command in the List dialog box. Click HFSS>List to open the List
dialog box.
Syntax: DeleteBoundaries <NameArray>
Return Value: None
Parameters: <NameArray>
Type: Array of strings
An array of boundary names.
Example:
oModule.DeleteBoundaries Array("PerfE1", "WavePort1")
GetBoundaryAssignment
Use: Gets a list of face IDs associated with the given boundary or excitation
assignment.
Syntax: GetBoundaryAssignment(<BoundaryName>)
Return Value: Returns integer array of face IDs.
Parameters: <BoundaryName>
Type: <string>
Previously defined boundary or excitation name.
Example:
list = oModule.GetBoundaryAssignment("Rad1")
GetBoundaries
Use: Gets boundary names for a project.
Syntax: GetBoundaries()
Return Value: Array of boundary names.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Parameters: None
Example:
bndinfo_array = oModule.GetBoundaries()
GetBoundariesOfType
Use: Gets boundary names of the given type.
Syntax: GetBoundariesOfType(<BoundaryType>)
Return Value: Array of boundary names of the given type.
Parameters: <BoundaryType>
Type:<string>
Name of legal boundary type.
For example: "Radiation".
Example:
bndname_array = oModule.GetBoundariesOfType("Perfect E")
GetDefaultBaseName
Use: Gets the default base name for boundaries for a project.
Syntax: GetDefaultBaseName <BoundaryType>
Return Value: String of boundary default base name.
Parameters: <BoundaryType>
Type:<string>
Name of legal boundary type.
For example: "Radiation".
Example:
bnddefault_BaseName = oModule.GetDefaultBaseName "Radiation"
GetExcitations
Use: Gets excitation port and terminal names for a model.
Syntax: GetExcitations()
Return Value: Pairs of strings. The first is the name of the excitation (e.g. "port1:1") and
the second is its type ("Wave Port")
Parameters: None
Example:
excite_name_array = oModule.GetExcitations()
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
GetExcitationsOfType
Use: Gets excitation names of the given type.
Syntax: GetExcitationsOfType(<ExcitationType>)
Return Value: Array of excitation names of the given type.
Parameters: <ExcitationType>
Type: <string>
Name of legal excitation type.
For example: "Plane Incident Wave.
Example:
excite_name_array = _
oModule.GetExcitationsOfType("Wave Port")
GetNumBoundaries
Use: Gets the number of boundaries in a design.
Syntax: GetNumBoundaries()
Return Value: Integer count
Parameters: None
Example:
numbound = oModule.GetNumBoundaries()
GetNumBoundariesOfType
Use: Gets the number of boundaries of the given type.
Syntax: GetNumBoundariesOfType(<BoundaryType>)
Return Value: Integer count
Parameters: <BoundaryType>
Type: <string>
Example:
numbound = oModule.GetNumBoundariesOfType("Perfect E")
GetNumExcitations
Use: Gets the number of excitations in a design, including all defined modes and
terminals of ports.
Syntax: GetNumExcitations()
Return Value: Integer count
Parameters: None
Boundary and Excitation Module Script Commands
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Example:
numexcite = oModule.GetNumExcitations()
GetNumExcitationsOfType
Use: Gets the number of excitations of the given type, including all defined
modes and terminals of ports.
Syntax: GetNumExcitationsOfType(<ExcitationType>)
Return Value: Integer count
Parameters: <ExcitationType>
Type: <string>
Example:
numexcite = oModule.GetNumExcitationsOfType("Voltage")
GetPortExcitationCounts
Use: Gets all port names and corresponding number of modes/terminals for each
port excitation.
Syntax: GetPortExcitationCounts()
Return Value: Array of port names (Type: <string>) and corresponding mode/terminal
counts (Type: <integer>).
Parameters: None
Example:
portinfo = oModule.GetPortExcitationCounts()
ReassignBoundary
Use: Specifies a new geometry assignment for a boundary.
Command: HFSS>Boundaries>Reassign or HFSS>Excitations>Reassign
Syntax: ReassignBoundary Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Return Value: None
Example:
oModule.ReassignBoundary Array("NAME:PerfE1",_
"Objects:=", Array("Box2", "Box3"),_
"Faces:=", Array(12, 11))
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
RenameBoundary
Use: Renames a boundary or excitation.
Command: Right-click a boundary in the project tree, and then click Rename on the
shortcut menu.
Syntax: RenameBoundary <OldName>, <NewName>
Return Value: None
Parameters: <OldName>
Type: <string>
<NewName>
Type: <string>
Example:
oModule.RenameBoundary "PerfE1" "PerfE"
ReprioritizeBoundaries
Use: Specifies the order in which the boundaries and excitations are recognized
by the solver. The first boundary in the list has the highest priority. Note:
this command is only valid if all defined boundaries and excitations appear
in the list. All ports must be listed before any other boundary type.
Command: HFSS>Boundaries>Reprioritize
Syntax: ReprioritizeBoundaries <NewOrderArray>
Return Value: None
Parameters: <NewOrderArray>
Array("NAME:NewOrder", <BoundName>, <BoundName>, ...)
Example:
oModule.ReprioritizeBoundaries Array("NAME:NewOrder", _
"Imped1", "PerfE1", "PerfH1")
SetDefaultBaseName
Use: Sets the default base name for boundaries for a project.
Syntax: SetDefaultBaseName <BoundaryType>, <DefaultName>
Return Value: String of boundary default base name.
Parameters: <BoundaryType>
Type:<string>
Name of legal boundary type.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EditMagneticBias
EditRadiation
EditSlave
EditSymmetry
EditTerminal
EditVoltage
EditWavePort
SetTerminalReferenceImpedances
UnassignIERegions
AssignCurent
Use: Creates a current source.
Command: HFSS>Excitations>Assign>Current
Syntax: AssignCurrent <CurrentArray>
Return Value: None
Parameters: <CurrentArray>
Array("NAME:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Current:=", <value>,
<DirectionArray>,
"Faces:=", <AssignmentFaces>)
<DirectionArray>
Array("NAME:Direction",
"Start:=", <LineEndPoint>,
"End:=", <LineEndPoint>)
Example:
oModule.AssignCurrent Array("NAME:Current1",_
"Current:=", "1000mA",_
Array("NAME:Direction",_
"Start:=", Array(-0.4, 0.4, -1.6),_
"End:=", Array(-0.4, 0.4, 0)), _
"Faces:=", Array(12))
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
AssignFiniteCond
Use: Creates a finite conductivity boundary.
Command: HFSS>Boundaries>Assign>Finite Conductivity
Syntax: AssignFiniteCond <FiniteCondArray>
Return Value: None
Parameters: <FiniteCondArray>
Array("NAME:<BoundName>",
"UseMaterial:=",<bool>,
"Material:=", <string>,
"Conductivity:=", <value>,
"Permeability:=", <value>,
"Roughness:=" <value>,
"InfGroundPlane:=", <bool>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>
Radius:=", "<value>", "Ratio:=", "<value>"))
UseMaterial
If True, provide Material parameter.
If False, provide Conductivity and Permeability parameters.
For Huray Roughness, use Radius and Ratio. For Groisse roughness model, use Rough-
ness.
Example:
oModule.AssignFiniteCond Array("NAME:FiniteCond1",_
"UseMaterial:=", false,_
"Conductivity:=", "58000000",_
"Permeability:=", "1",_
"InfGroundPlane:=", false,_
"Faces:=", Array(12))
Example:
oModule.AssignFiniteCond Array("NAME:FiniteCond1",_
"UseMaterial:=", true, _
"Material:=", "copper",_
"InfGroundPlane:=", false,_
"Faces:=", Array(12)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"PhiStop:=", "<num>deg",
"PhiStep:=", "<num>deg",
"ThetaStart:=", "<num>deg",
"ThetaStop:=", "<num>deg",
"ThetaStep:=", "<num>deg"),
Array("NAME:ModesList",
Array("NAME:Mode",
"ModeNumber:=", <ModeID>,
"IndexM:=", <Index>,
"IndexN:=", <Index>,
"KC2:=", <value>,
"PropagationState:=", "Propagating",
"Attenuation:=", 0,
"PolarizationState:=", "TE",
"AffectsRefinement:=", <Boolean>),
Array("NAME:Mode",
"ModeNumber:=", <ModeID>,
"IndexM:=", <Index>,
"IndexN:=", <Index>,
"KC2:=", <value>,
"PropagationState:=", "<Propagating>",
"Attenuation:=", <value>,
"PolarizationState:=", "<TE or TM>",
"AffectsRefinement:=", <Boolean>)))
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 13.0.0
' 1:54:11 PM Jun 15, 2010
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Dim oModule
Set oAnsoftApp = CreateObject("AnsoftHfss.HfssScriptInterface")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project44")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignFloquetPort Array("NAME:FloquetPort1",
"Faces:=", Array(7),
"NumModes:=", 2,
"RenormalizeAllTerminals:=", true,
"DoDeembed:=", false,
Array("NAME:Modes", Array("NAME:Mode1", "ModeNum:=", 1,
"UseIntLine:=", false),
Array("NAME:Mode2", "ModeNum:=", 2, "UseIntLine:=", false)),
"ShowReporterFilter:=", false,
"UseScanAngles:=", true, "Phi:=", "0deg", "Theta:=", "0deg",
Array("NAME:LatticeAVector", "Start:=", Array("0mm", "0mm", "0.8mm"),
"End:=", Array( "0mm", "0.6mm", "0.8mm")),
Array("NAME:LatticeBVector", "Start:=", Array("0mm", "0mm", "0.8mm"),
"End:=", Array("0.8mm", "0mm", "0.8mm")),
Array("NAME:ModesCalculator", "Frequency:=", "1GHz",
"FrequencyChanged:=", false,
"PhiStart:=", "0deg", "PhiStop:=", "0deg", "PhiStep:=", "0deg", "The-
taStart:=", "0deg", "ThetaStop:=", "0deg", "ThetaStep:=", "0deg"),
Array("NAME:ModesList", Array("NAME:Mode", "ModeNumber:=", 1,
"IndexM:=", 0, "IndexN:=", 0, "KC2:=", 0,
"PropagationState:=", "Propagating",
"Attenuation:=", 0,
"PolarizationState:=", "TE",
"AffectsRefinement:=", false),
Array("NAME:Mode", "ModeNumber:=", 2,
"IndexM:=", 0, "IndexN:=", 0,
"KC2:=", 0,
"PropagationState:=", "Propagating",
"Attenuation:=", 0,
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
AssignIERegion
Use: Assign an IE Region to a conductor contained within a FEBI Radiation
boundary.
Command: Assign IE Region
Syntax: AssignIERegion <"geometryName">
Return Value: None
Parameters: <GeometryName>
Type: String
Name of the geometry assigned as an IE Region.
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 2:26:27 PM Mar 07, 2011
' ----------------------------------------------
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("Project58")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignIERegion "Box1"
AssignImpedance
Use: Creates an impedance boundary for an HFSS design.
Command: HFSS>Boundaries>Assign>Impedance
Syntax: AssignImpedance <ImpedanceArray>
Return Value: None
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Parameters: <ImpedanceArray>
Array("NAME:<BoundName>",
"Resistance:=", <value>,
"Reactance:=", <value>,
"InfGroundPlane:=", <bool>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Example:
oModule.AssignImpedance Array("NAME:Imped1",_
"Resistance:=", "50",_
"Reactance:=", "50",_
"InfGroundPlane:=", false,_
"Faces:=", Array(12))
AssignIncidentWave
Use: Creates an incident wave excitation.
Command: HFSS>Excitations>Assign>IncidentWave
Syntax: AssignIncidentWave <IncidentWaveArray>
Return Value: None
Parameters: <IncidentWaveArray>
Array("NAME:<BoundName>",
"IsCartesian:=",<bool>
"EoX:=", <value>,
"EoY:=", <value>,
"EoZ:=", <value>,
"kX:=", <value>,
"kY:=", <value>,
"kZ:=", <value>
"PhiStart:=",<value>,
"PhiStop:=", <value>,
"PhiPoints:=", <int>,
"ThetaStart:=", <value>,
"ThetaStop:=", <value>,
"ThetaPoints:=", <int>,
"EoPhi:=", <value>,
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"EoTheta:=", <value>)
IsCartesian
If true, provide the EoX, EoY, EoZ, kX, kY, kZ parameters.
If false, provide the PhiStart, PhiStop, PhiPoints, ThetaStart, Thet-
Stop, ThetaPoints, EoPhi, EoTheta parameters.
Example:
oModule.AssignIncidentWave Array("NAME:IncWave1",_
"IsCartesian:=", true,_
"EoX:=", "1", "EoY:=", "0", "EoZ:=", "0",_
"kX:=", "0", "kY:=", "0", "kZ:=", "1")
Example:
oModule.AssignIncidentWave Array("NAME:IncWave2",_
"IsCartesian:=", false,_
"PhiStart:=","0deg",_
"PhiStop:=", "90deg",_
"PhiPoints:=", 2,_
"ThetaStart:=", "0deg",_
"ThetaStop:=", "180deg",_
"ThetaPoints:=", 3, _
"EoPhi:=", "1", "EoTheta:=", "0")
AssignLayeredImp
Use: Creates a layered impedance boundary.
Command: HFSS>Boundaries>Assign>Layered Impedance
Syntax: AssignLayeredImp <LayeredImpArray>
Return Value: None
Parameters: <LayeredImpArray>
Array("NAME:<BoundName>",
"Frequency:=", <value>,
"Roughness:=", <value>,
"IsInternal:=", <bool>,
<LayersArray>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<LayersArray>
Array("NAME:Layers",
<OneLayerArray>, <OneLayerArray>, ...)
<OneLayerArray>
Array("NAME:<LayerName>",
"LayerType:=", <LayerType>,
"Thickness:=",<value>,
"Material:=", <string>)
<LayerName>
Type: <string>
Specifies the layer number, such as "Layer1" or "Layer2"
<LayerType>
Type: <string>
Should be specified for the last layer only.
Possible values: "Infinite", "PerfectE", or "PerfectH"
Thickness
Thickness of the layer. Should be specified for all layers except the last layer.
Material
Material assigned on the layer. For the last layer, do not specify a material if the
LayerType is "PerfectE" or "PerfectH".
InfGroundPlane <boolean>
For HFSS designs, you can specify whether one layer is an infinite ground plane.
Example:
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignLayeredImp Array("NAME:Layered1",
"Objects:=", Array("Rectangle1"),
"Frequency:=", "10GHz",
"Roughness:=", "0um",
"IsInternal:=", false,
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Array("NAME:Layers",
Array("NAME:Layer1",
"Thickness:=", "1um",
"Material:=", "vacuum"),
Array("NAME:Layer2",
"LayerType:=", "Infinite",
"Thickness:=", "1um",
"Material:=", "vacuum")),
"InfGroundPlane:=", true)
AssignLumpedPort
Use: Creates a lumped port.
Command: HFSS>Excitations>Assign>Lumped Port
Syntax: AssignLumpedPort <LumpedPortArray>
Return Value: None
Parameters: <LumpedPortArray>
Array("NAME:<BoundName>",
"Faces:=", <FaceIDArray>,
"RenormalizeAllTerminals:=", <boolean>
"DoDeembed:=" <boolean"
<ModesArray>,
TerminalIDList:=, <TerminalsArray>,
"FullResistance:=", <value>,
"FullReactance:=", <value>,
)
Example:
oModule.AssignLumpedPort Array("NAME:LumpPort1",_
Array("NAME:Modes",_
"Resistance:=", "50Ohm",_
"Reactance:=","0Ohm",_
Array("NAME:Mode1",_
"ModeNum:=",1,_
"UseIntLine:=", true,_
Array("NAME:IntLine",_
"Start:=", Array(-0.4, 0.4, -1.6),_
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
AssignLumpedRLC
Use: Creates a lumped RLC boundary.
Command: HFSS>Boundaries>Assign>Lumped RLC
Syntax: AssignLumpedRLC <LumpedRLCArray>
Return Value: None
Parameters: <LumpedRLCArray>
Array("NAME:<BoundName>",
"UseResist:=",<bool>,
"Resistance:=", <value>,
"UseInduct:=", <bool>,
"Inductance:=", <value>,
"UseCap:=", <bool>,
"Capacitance:=", <value>,
<CurrentLineArray>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
<CurrentLineArray>
Array("NAME:CurrentLine", _
"Start:=", <LineEndPoint>,
"End:=", <LineEndPoint>)
Example:
oModule.AssignLumpedRLC Array("NAME:LumpRLC1",_
"UseResist:=", true,_
"Resistance:=", "10Ohm",_
"UseInduct:=", true,_
"Inductance:=", "10nH",_
"UseCap:=", true,_
"Capacitance:=","10pF",_
Array("NAME:CurrentLine", _
"Start:=", Array(-0.4, -1.2, -1.6),_
"End:=", Array(-0.4, -1.2, 0)),
"Faces:=", Array(12))
AssignMagneticBias
Use: Creates a magnetic bias source.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
IsUniformBias
If true, supply the Bias, XAngle, YAngle, and ZAngle parameters.
If false, supply the Project parameter.
Example:
oModule.AssignMagneticBias Array("NAME:MagBias1",_
"IsUniformBias:=", true,_
"Bias:=", "1",_
"XAngle:=", "10deg",_
"YAngle:=", "10deg",_
"ZAngle:=", "10deg",_
"Objects:=", Array("Box2"))
Example:
oModule.AssignMagneticBias Array("NAME:MagBias2",_
"IsUniformBias:=", false,_
"Project:=","D:/Maxwell/testing/m3dfs.pjt",_
"Objects:=", Array("Box2"))
AssignMaster
Use: Creates a master boundary.
Command: HFSS>Boundaries>Assign>Master
Syntax: AssignMaster <MasterArray>
Return Value: None
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Parameters: <MasterArray>
Array("NAME:<BoundName>",
<CoordSysArray>,
"ReverseV:=", <bool>,
"Faces:=", <AssignmentFaces>)
<CoordSysArray>
Array("NAME:CoordSysVector",
"Origin:=", <CoordSysPoint>,
"UPos:=", <LineEndPoint>)
Example:
oModule.AssignMaster Array("NAME:Master1",_
Array("NAME:CoordSysVector",_
"Origin:=", Array(-1.4, -1.4, -0.8),_
"UPos:=", Array(-1.4, -1.4, 0)),_
"ReverseV:=", false,_
"Faces:=", Array(12))
AssignPerfectE
Use: Creates a perfect E boundary.
Command: HFSS>Boundaries>Assign>Perfect E
Syntax: AssignPerfectE <PerfectEArray>
Return Value: None
Parameters: <PerfectEArray>
Array("NAME:<BoundName>",
"InfGroundPlane:=", <bool>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Example:
oModule.AssignPerfectE Array("NAME:PerfE1",_
"InfGroundPlane:=", false,_
"Faces:=", Array(12))
AssignPerfectH
Use: Creates a perfect H boundary.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Command: HFSS>Boundaries>Assign>PerfectH
Syntax: AssignPerfectH <PerfectHArray>
Return Value: None
Parameters: <PerfectHArray>
Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Example:
oModule.AssignPerfectH Array("NAME:PerfH1",_
"Faces:=", Array(12))
AssignRadiation
Use: Creates a radiation boundary.
Command: HFSS>Boundaries>Assign>Radiation
Syntax: AssignRadiation <RadiationArray>
Return Value: None
Parameters: <RadiationArray>
Array("NAME:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>
"IsIncidentField:=", <boolean>, _
"IsEnforcedHField:=", <boolean>, _
"IsEnforcedEField:=", <boolean>, _
"IsFssReference:=", <boolean>, _
"IsForPML:=", <boolean>, _
"UseAdaptiveIE:=", <boolean>, _
"IncludeInPostproc:=", <boolean>))
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 2:27:20 PM Sep 13, 2011
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("AnsoftHfss.HfssScriptInterface")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project59")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignRadiation Array("NAME:Rad1", _
"Objects:=", Array("Box1"), _
"IsIncidentField:=", false, _
"IsEnforcedField:=", false, _
"IsFssReference:=", false, _
"IsForPML:=", false, _
"UseAdaptiveIE:=", true, _
"IncludeInPostproc:=", true)
AssignScreeningImpedance
Use: Creates a screening impedance boundary.
Command: HFSS>Boundaries>Assign>Screening Impedance
Syntax: AssignScreeningImpedance <ScreeningArray>
Return Value: None.
Parameters: <ScreeningArray>
Array("NAME:<name>",
"Objects:=", Array( "<name>"),
"IsAnisotropic:=", <Boolean>,
If true, you need to specify the coordinate system
"CoordSystem:=", <integer or name>,
"HasExternalLink:=", <Boolean>,
true or false. If False, specify XResistence and XReactance values. Also see the first
example.
"XResistance:=", "<value>",
"XReactance:=", "<value>"
If true, then specify the external link array with the project and solution to use. Also
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 13.0.0
' 4:17:23 PM Oct 29, 2010
' ----------------------------------------------
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("Project53")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignScreeningImpedance Array("NAME:Screening1",
"Objects:=", Array( "Rectangle1"),
"IsAnisotropic:=", true,
"CoordSystem:=", 1,
"HasExternalLink:=", true,
Array("NAME:XLink",
"Project:=", "mydesign.hfss",
"Design:=", "HFSSDesign1",
"Soln:=", "Setup1 : LastAdaptive",
Array("NAME:Params", "bend_angle:=", "50deg"),
"ForceSourceToSolve:=", false,
"PreservePartnerSoln:=", false,
"PathRelativeTo:=", "TargetProject"),
Array("NAME:YLink", "Project:=", "mydesign.hfss",
"Design:=", "HFSSDesign1",
"Soln:=", "Setup1 : LastAdaptive",
Array("NAME:Params", "bend_angle:=", "50deg"),
"ForceSourceToSolve:=", true,
"PreservePartnerSoln:=", true,
"PathRelativeTo:=", "TargetProject"))
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
AssignSlave
Use: Creates a slave boundary.
Command: HFSS>Boundaries>Assign>Slave
Syntax: AssignSlave <SlaveArray>
Return Value: None
Parameters: <SlaveArray>
Array("NAME:<BoundName>",
<CoordSysArray>,
"ReverseV:=", <bool>,
"Master:=", <string>,
"UseScanAngles:=", <bool>,
"Phi:=", <value>,
"Theta:=", <value>,
"Phase:=", <value>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
<UseScanAngles>
If UseScanAngles is True, then Phi and Theta should be specified.
If it is False, then Phase should be specified.
Example:
oModule.AssignSlave Array("NAME:Slave1",_
Array("NAME:CoordSysVector", _
"Origin:=", Array(-1, 0, 0.2),_
"UPos:=", Array(-1, 0, 0)),_
"ReverseV:=", false,_
"Master:=", "Master1",_
"UseScanAngles:=", true,_
"Phi:=", "10deg",_
"Theta:=", "0deg",_
"Faces:=", Array(12))
Example:
oModule.AssignSlave Array("NAME:Slave2",_
Array("NAME:CoordSysVector",_
"Origin:=", Array(-1, 0, 0.2),_
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
AssignTerminal
Use: Assigning terminals to a port.
Command: HFSS>Excitations>Assign>Terminal
Syntax: AssignTerminal <TerminalArray>
Return Value: None
Parameters: <TerminalArray>
Array(NAME: <TerminalName>, Edges:, <EdgeIDArray>, ParentBndID:= ,
<PortName>, TeminalResistance:=, <value>)
<TerminalName>
Type: String
<EdgeIDArray>
Type: Array of strings
<PortName>
Type: String
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Name of Port.
<value>
Type: string
Value and units for the resistance.
Example:
oModule.AssignTerminal Array("NAME:Rectangle1_T1", _
"Edges:=", Array(36), "ParentBndID:=", _
"WavePort1", "TerminalResistance:=", "50ohm")
AssignVoltage
Use: Creates a voltage source.
Command: HFSS>Excitations>Assign>Voltage
Syntax: AssignVoltage <VoltageArray>
Return Value: None
Parameters: <VoltageArray>
Array("NAME:<BoundName>",
"Voltage:=", <value>,
<DirectionArray>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
<DirectionArray>
Array("NAME:Direction",_
"Start:=",<LineEndPoint>,
"End:=", <LineEndPoint>)
Example:
oModule.AssignVoltage Array("NAME:Voltage1",_
"Voltage:=", "1000mV",_
Array("NAME:Direction",_
"Start:=", Array(-0.4, -1.2, 0),_
"End:=", Array(-1.4, -1.2, 0)),_
"Faces:=", Array(7))
AssignWavePort
Use: Creates a wave port.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<ModesArray>
Specify for modal problems.
Array("NAME:Modes",
<OneModeArray>, <OneModeArray>, ...)
<OneModeArray>
Array("NAME:<ModeName>",
"ModeNum:=", <int>,
"UseIntLine:=", <bool>,
<IntLineArray>)
<ModeName>
Type: <string>
Name of the mode. Format is "Mode<int>". For example "Mode1".
<IntLineArray>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Array("NAME:IntLine",
"Start:=", <LineEndPoint>,
"End:=", <LineEndPoint>,
"CharImp:=", <string>)
CharImp
Characteristic impedance of the mode. Possible values are "Zpi", "Zpv", or
"Zvi"
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
TeminalIDList:=, Array()
)
EditCurrent
Use: Modifies a current source.
Command: Double-click the excitation in the project tree to modify its settings.
Syntax: EditCurrent <BoundName> <CurrentArray>
Return Value: None
EditDiffPairs
Use: Edits the properties of differential pairs defined from terminal excitations
on wave ports.
Command: HFSS>Excitations>Differential Pairs
Syntax: EditDiffPairs <DifferentialPairsArray>
Return Value: None
Parameters: <DifferentialPairsArray>
Array("NAME:EditDiffPairs",
<OneDiffPairArray>, <OneDiffPairArray>,...)
<OneDiffPairArray>
Array("NAME:Pair1",_
"PosBoundary:=", <string>,
"NegBoundary:=", <string>,
"CommonName:=", <string>,
"CommonRefZ:=", <value>,
"DiffName:=", <string>,
"DiffRefZ:=", <value>,
IsActive:=, <boolean>)
PosBoundary
Name of the terminal to use as the positive terminal.
NegBoundary
Name of the terminal to use as the negative terminal.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
CommonName
Name for the common mode.
CommonRefZ
Reference impedance for the common mode.
DiffName
Name for the differential mode.
DiffRefZ
Reference impedance for the differential mode.
Example:
oModule.EditDiffPairs Array("NAME:EditDiffPairs", Array("NAME:Pair1",
"PosBoundary:=", _
"Rectangle1_T1", "NegBoundary:=", "Rectangle2_T1", _
"CommonName:=", "Comm1", "CommonRefZ:=", "25ohm", _
"DiffName:=", "Diff1", "DiffRefZ:=", "100ohm", "IsActive:=", true))
EditFiniteCond
Use: Modifies a finite conductivity boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditFiniteCond <BoundName> <FiniteCondArray>
Return Value: None
Parameters: <FiniteCondArray>
Array("NAME:<BoundName>",
"UseMaterial:=",<bool>,
"Material:=", <string>,
"Conductivity:=", <value>,
"Permeability:=", <value>,
"Roughness:=" <value>,
"InfGroundPlane:=", <bool>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>
Radius:=", "<value>", "Ratio:=", "<value>"))
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
UseMaterial
If True, provide Material parameter.
If False, provide Conductivity and Permeability parameters.
For Huray Roughness, use Radius and Ratio. For Groisse roughness model, use Rough-
ness.
Parameters:
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 2:12:43 PM May 20, 2011
' ----------------------------------------------
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("Project56")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.EditFiniteCond "FiniteCond1", Array("NAME:FiniteCond1",
"UseMaterial:=", true,
"Material:=", "copper",
"UseThickness:=", false,
"Radius:=", "0.4um",
"Ratio:=", "2.9",
"InfGroundPlane:=", true)
EditImpedance
Use: Modifies an impedance boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditImpedance <BoundName> <ImpedanceArray>
Return Value: None
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EditIncidentWave
Use: Modifies an incident wave excitation.
Command: Double-click the excitation in the project tree to modify its settings.
Syntax: EditIncidentWave <BoundName> <IncidentWaveArray>
Return Value: None
Parameters:
Example:
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("Cube_RCS_00a")
Set oDesign = oProject.SetActiveDesign("PEC_d1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.EditIncidentWave "IncPWave1",
Array("NAME:IncPWave1", "IsCartesian:=", false,
"PhiStart:=", "$phi_inc",
"PhiStop:=", "$phi_inc",
"PhiPoints:=", 1,
"ThetaStart:=", "$theta_inc",
"ThetaStop:=", "$theta_inc",
"ThetaPoints:=", 1, "EoPhi:=", "$phi_pol",
"EoTheta:=", "$theta_pol",
"OriginX:=", "0mm",
"OriginY:=", "0mm",
"OriginZ:=", "0mm",
"TransientActive:=", 1,
"TimeProfile:=", "Broadband Pulse",
"HfssFrequency:=", "1GHz",
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"MinFreq:=", "100MHz",
"MaxFreq:=", "1GHz",
"Delay:=", "0.2s",
"NumFreqsExtracted:=", 401,
"SweepMinFreq:=", "100MHz",
"SweepMaxFreq:=", "1GHz",
"IsPropagating:=", true,
"IsEvanescent:=", false, "IsEllipticallyPolarized:=", false)
EditLayeredImpedance
Use: Modifies a layered impedance boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditLayeredImp <BoundName> <LayeredImpArray>
Return Value: None
EditMaster
Use: Modifies a master boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: Edit <BoundName> <MasterArray>
Return Value: None
EditPerfectE
Use: Modifies a perfect E boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditPerfectE <BoundName>, <PerfectEArray>
Return Value: None
EditPerfectH
Use: Modifies a perfect H boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditPerfectH <BoundName> <PerfectHArray>
Return Value: None
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EditLumpedPort
Use: Modifies a lumped port.
Command: Double-click the excitation in the project tree to modify its settings.
Syntax: EditLumpedPort <BoundName> <LumpedPortArray>
Parameters: <LumpedPortArray>
Array("NAME:<BoundName>",
"Faces:=", <FaceIDArray>,
"RenormalizeAllTerminals:=", <boolean>
"DoDeembed:=" <boolean"
<ModesArray>,
TerminalIDList:=, <TerminalsArray>,
"FullResistance:=", <value>,
"FullReactance:=", <value>,
)
Return Value: None
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 2:18:20 PM May 20, 2011
' ----------------------------------------------
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("calib_modal_test")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.EditLumpedPort "lp2", Array("NAME:lp2", "RenormalizeAllTerminals:=", true, "DoDeem-
bed:=", _
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EditLumpedRLC
Use: Modifies a lumped RLC boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditLumpedRLC <BoundName> <LumpedRLCArray>
Return Value: None
EditMagneticBias
Use: Modifies a magnetic bias excitation.
Command: Double-click the excitation in the project tree to modify its settings.
Syntax: EditMagneticBias <BoundName> <MagneticBiasArray>
Return Value: None
Parameters:
EditRadiation
Use: Modifies a radiation boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditRadiation <BoundName> <RadiationArray>
Return Value: None
Parameters: <RadiationArray>
Array("NAME:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>
"IsIncidentField:=", <boolean>, _
"IsEnforcedHField:=", <boolean>, _
"IsEnforcedEField:=", <boolean>, _
"IsFssReference:=", <boolean>, _
"IsForPML:=", <boolean>, _
"UseAdaptiveIE:=", <boolean>, _
"IncludeInPostproc:=", <boolean>))
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 2:34:08 PM Sep 13, 2011
' ----------------------------------------------
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("Project59")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.EditRadiation "Rad1", _
Array("NAME:Rad1", _
"IsIncidentField:=", true, _
"IsEnforcedField:=", false, _
"IsFssReference:=", false, _
"IsForPML:=", false, _
"UseAdaptiveIE:=", false, _
"IncludeInPostproc:=", true)
EditSlave
Use: Modifies a slave boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditSlave <BoundName> <SlaveArray>
Return Value: None
EditSymmetry
Use: Modifies a symmetry boundary.
Command: Double-click the boundary in the project tree to modify its settings.
14-42 Boundary and Excitation Module Script
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EditTerminal
Use: Modifies properties of a terminal
Command: Edit Properties for a selected terminal
Syntax: EditTerminal <TerminalArray>)
Return Value: None
Parameters: <TerminalArray>
Array(NAME: <TerminalName>, ParentBndID:=, <PortName>, Terminal-
Resistance:=, <value>)
<TerminalName>
Type:String
<PortName>
Type: String
<value>
Type: <string>
Value and units of resistance.
Example:
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.EditTerminal "Rectangle2_T1", Array("NAME:Rectangle2_T1", _
"ParentBndID:=", "WavePort1", "TerminalResistance:=", "75ohm")
EditVoltage
Use: Modifies a voltage source.
Command: Double-click the excitation in the project tree to modify its settings.
Syntax: EditVoltage <BoundName> <VoltageArray>
Return Value: None
EditWavePort
Use: Modifies a wave port.
Command: Double-click the excitation in the project tree to modify its settings.
Syntax: EditWavePort <BoundName> <WavePortArray>
Return Value: None
Example:
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
SetTerminalReferenceImpedances
Use: To set the reference impedance for all terminals within a specified port.
Command: HFSS>Excitations>Set Terminal Reference Impedances or HFSS-
IE>Excitations>Set Terminal Reference Impedances
Syntax: SetTerminalReferenceImpedances <value>, <PortName>
Return Value: None
Parameters: <value>
Type: <string>
The value and units for the the impedance
<PortName>
Type: <string>
The name of the port.
Example:
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.SetTerminalReferenceImpedances "75ohm", "WavePort1"
UnassignIERegions
Use: Unassign one or more IE Regions assigned to conducting objects.
Command: Unassign IE Regions
Syntax: UnassignIERegion Array (<"geometryName">)
Return Value: None
Parameters: <GeometryName>
Type: String
Name of one or more geometries assigned as an IE Region.
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 2:51:43 PM Mar 07, 2011
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("AnsoftHfss.HfssScriptInterface")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project58")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.UnassignIERegions Array("Box1")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
AssignFiniteCond [HFSS-IE]
Use: Creates a finite conductivity boundary.
Command: HFSS-IE>Boundaries>Assign>Finite Conductivity
Syntax: AssignFiniteCond <FiniteCondArray>
Return Value: None
Parameters: <FiniteCondArray>
Array("NAME:<BoundName>",
"Objects:=", <AssignmentObjects>,
"UseMaterial:=",<bool>,
"Material:=", <string>,
14-46 Boundary and Excitation Module Script
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"Conductivity:=", <value>,
"Permeability:=", <value>,
"InfGroundPlane:=", <bool>,
"Faces:=", <AssignmentFaces>)
UseMaterial
If True, provide Material parameter.
If False, provide Conductivity and Permeability parameters.
Example:
oModule.AssignFiniteCond Array("NAME:FiniteCond1",_
"Objects:=", Array("Rectangle2"), _
"UseMaterial:=", false, _
"Conductivity:=", "58000000", _
"Permeability:=", "1", _
"Roughness:=", "0um", _
"UseThickness:=", false)
AssignImpedance [HFSS-IE]
Use: Creates an impedance boundary for an HFIE design.
Command: HFSS-IE>Boundaries>Assign>Impedance
Syntax: AssignImpedance <ImpedanceArray>
Return Value: None
Parameters: <ImpedanceArray>
Array("NAME:<BoundName>",
"Resistance:=", <value>,
"Reactance:=", <value>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Example:
oModule.AssignImpedance Array("NAME:Imped1",_
"Resistance:=", "50",_
"Reactance:=", "50",_
"Faces:=", Array(12))
AssignInfiniteGroundPlane [HFSS-IE]
Use: Creates an infinite ground plane in HFIE.
Command: HFSS-IE>Boundaries>Assign>Infinite Ground Plane
Boundary and Excitation Module Script Commands
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
AssignLumpedPort [HFSS-IE]
Use: Creates a lumped port.
Command: HFSS>Excitations>Assign>Lumped Port
Syntax: AutoIdentifyPorts <LumpedPortArray>
Return Value: None
Parameters: Array
Example:
Set oDesign = oProject.SetActiveDesign("HFSSIEDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AutoIdentifyPorts Array("NAME:Faces", 12), _
Array("NAME:ReferenceConductors", "Box1"), _
"LumpPort1", true
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"RadDist:=", <value>,
"UseFreq:=", <bool>,
"MinFreq:=", <value>,
"MinBeta:=", <double>)
"RadIncidentField:=", <bool>
"RadFssReference:=", <bool>
Parameters: PMLObj
Name of the object to use as the PML cover.
BaseObj
Name of the base object touching the PML cover object.
Orientation
String representing the orientation of the PML.
Possible values are: "XAxis", "YAxis", and "ZAxis"
UseFreq
If true, provide the MinFreq parameter.
If false, provide the MinBeta parameter.
Example:
oModule.CreatePML Array("UserDrawnGroup:=", false,_
"PMLFaces:=", Array(120), "CreateJoiningObjs:=",_
true,_
"Thickness:=", "0.33mm", "RadDist:=", "1.6mm",_
"UseFreq:=", true, "MinFreq:=", "1GHz")
Example:
oModule.CreatePML Array("UserDrawnGroup:=", true,_
"PMLObj:=", "Box1", "BaseObj:=", "Box2", _
"Thickness:=", "0.3mm", "Orientation:=", "ZAxis", _
"RadDist:=", "1.6mm", "UseFreq:=", false, _
"MinBeta:=", "2")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ModifyPMLGroup
Use: Command to modify a PML group. Note: This is the scripting equivalent to
clicking Update in the PML Setup wizard. This does not actually modify the
materials. It only modifies the data stored by the PML Setup wizard.
Command: None
Syntax: ModifyPMLGroup Array("NAME:<GroupName>",
"RadDist:=", <value>,
"UseFreq:=", <bool>,
"MinFreq:=", <value>,
"MinBeta:=", <double>)
Return Value: None
Parameters: <GroupName>
Name of the PML group to modify.
UseFreq
If true, provide the MinFreq argument.
If false, provide the MinBeta argument.
Example:
oModule.ModifyPMLGroup Array("NAME:PMLGroup1",
"RadDist:=", "1.166666667mm",
"UseFreq:=", false, "MinBeta:=", 2)
PMLGroupCreated
Use: Command added by HFSS after a PML has been created. It is not responsible
for creating the PML objects and materials. It just contains the information
needed by the PML Setup wizard for future modification of the PML. This
script command is not intended to be modified by you. Removing this
command from the script will prevent future modification of the PML
through the user interface after the script is played back.
Command: HFSS>Boundaries>Assign>PML Setup Wizard
Syntax: PMLGroupCreated <args>
Return Value: None
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
PMLGroupModified
Use: Command added by HFSS after a PMLs parameters are modified. This
updates the PML Setup wizards data. This script command is not intended
to be modified by you. Removing this command from the script will prevent
future modification of the PML through the user interface after the script is
played back.
Command: Modify existing PML in the PML Setup wizard.
Syntax: PMLGroupModified <args>
Return Value: None
RecalculatePMLMaterials
Use: Scripting equivalent to clicking Recalculate Materials in the PML Setup
wizard. This will update the PML materials to match the current state of the
PML Setup wizard data.
Command: None
Syntax: RecalculatePMLMaterials
Return Value: None
Example:
oModule.RecalculatePMLMaterials
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
15 Mesh Operations Module
Script Commands
<OpName>
Type: <string>
Name of a mesh operation.
<AssignmentObjects>
Type: Array of strings
An array of object names.
<AssignmentFaces>
Type: Array of integers.
An array of face IDs. The ID of a face can be determined through the user interface
using the 3D Modeler>Measure>Area command. The face ID is given in the Mea-
sure Information dialog box.
General Commands Recognized by the Mesh Operations Module
Script Commands for Creating and Modifying Mesh Operations
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
GetOperationNames
Use: Gets the names of mesh operations defined in a design.
Syntax: GetOperationNames(<OperationType>)
Return Value: Array of mesh operation names.
Parameters: <OperationType>
Type: <string>
For example: "Skin Depth Based"
Example:
Set opnames = oModule.GetOperationNames("Length Based")
For Each name in opnames
Msgbox name
Next
RenameOp
Use: Renames a mesh operation.
Command: Right-click the mesh operation in the project tree, and then click Rename
on the shortcut menu.
Syntax: RenameOp <OldName>, <NewName>
15-2 Mesh Operations Module Script Commands
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<NewName>
Type: <string>
New name for the mesh operation.
Example:
oModule.RenameOp "SkinDepth1", "NewName"
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
RefineInside
If true, Objects should be specified. Implies apply restrictions to tetrahedra inside
the object.
If false, Faces and/or Objects can be specified. Implies apply restrictions to trian-
gles on the surface of the face or object.
RestrictElem
If true, NumMaxElem should be specified.
RestrictLength
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
AssignModelResolutionOp
Use: Assigns a model resolution name, value and unit for mesh operations, or
specify to UseAutoFeaturelength. If UseAutoFeature length is true, the
Defeature length is not used.
Command: HFFS>Mesh Operations>Assign>Model Resolution
Syntax: AssignModelResolutionOp Array(<ModelResParams>)
Return Value: None
Parameters: Array("NAME:<string>",
"Objects:=", Array( "<modelname>"), _
"UseAutoLength:=", <Boolean>, _
"DefeatureLength:=", "<value><units>")
Example:
Set oDesign = oProject.SetActiveDesign("wg_combiner")
Set oModule = oDesign.GetModule("MeshSetup")
oModule.AssignModelResolutionOp Array("NAME:ModelResolution1",
"Objects:=", Array( "waveguide"), _
"UseAutoLength:=", true, _
"DefeatureLength:=", "71.5891053163818mil")
AssignSkinDepthOp
Use: Assigns a skin-depth based operations to the selection.
Command: HFSS>Mesh Operations>Assign>On Selection>Skin Depth Based
Syntax: AssignSkinDepthOp <SkinDepthOpParams>
Return Value: None
Parameters: <SkinDepthOpParams>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Array("NAME:<OpName>",
"Faces:=", <AssignmentFaces>,
"RestrictElem:=", <bool>,
"NumMaxElem:=", <int>,
"SkinDepth:=", <value>,
"SurfTriMaxLength:=", <value>,
"NumLayers:=", <int>)
RestrictElem
If true, NumMaxElem should be specified.
Example:
oModule.AssignSkinDepthOp Array("NAME:SkinDepth1", _
"Faces:=", Array(7), _
"RestrictElem:=", true, _
"NumMaxElem:=", 1000, _
"SkinDepth:=", "1mm", _
"SurfTriMaxLength:=", "1mm", _
"NumLayers:=", 2)
AssignTrueSurfOp
Use: Assigns a true surface-based mesh operation on the selection.
Command: HFSS>Mesh Operations>Assign>Surface Approximation
Syntax: AssignTrueSurfOp <TrueSurfOpParams>
Return Value: None
Parameters: <TrueSurfOpParams>
Array("NAME:<OpName>",
"Faces:=", <AssignmentFaces>,
"SurfDevChoice:=", <RadioOption>,
"SurfDev:=", <value>,
"NormalDevChoice:=", <RadioOption>,
"NormalDev:=", <value>,
"AspectRatioChoice:=", <RadioOption>,
"AspectRatio:=", <double>)
<RadioOption>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Type: <int>
0: Ignore
1: Use defaults
2: Specify the value
Example:
oModule.AssignTrueSurfOp Array("NAME:TrueSurf1",
"Faces:=", Array(9), _
"SurfDevChoice:=", 2, _
"SurfDev:=", "0.04123105626mm", _
"NormalDevChoice:=", 2, _
"NormalDev:=", "15deg", _
"AspectRatioChoice:=", 1)
EditLengthOp
Use: Edits an existing length-based operation. This can not be used to modify
assignments. Instead, the mesh operation should be deleted and a new one
created.
Command: Double-click the operation in the project tree to modify its settings.
Syntax: EditLengthOp <OpName>, <LengthOpParams>
Return Value: None
Example:
oModule.EditLengthOp "Length1", Array("NAME:Length1", _
"RefineInside:=", false, _
"RestrictElem:=", false, _
"RestrictLength:=", true, _
"MaxLength:=", "2mm")
EditModelResolutionOp
Use: Assigns a model resolution name, value and unit for mesh operations. If
UseAutoLength is true, the Defeature length is not used.
Command: Double-click the operation in the project tree to modify its settings.
Syntax: EditModelResolutionOp Array(<ModelResParams>)
Return Value:
Parameters: Array("NAME:<string>",
"Objects:=", Array( "<modelname>"), _
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"UseAutoLength:=", <Boolean>, _
"DefeatureLength:=", "<value><units>")
Example:
Set oDesign = oProject.SetActiveDesign("wg_combiner")
Set oModule = oDesign.GetModule("MeshSetup")
oModule.EditModelResolutionOp "ModelResolution1", _ Array("NAME:Mod-
elResolution1", "UseAutoLength:=", false, _
"DefeatureLength:=", "71.5891053163818mil")
EditSkinDepthOp
Use: Modifies an existing skin-depth based mesh operation. Assignments cannot
be changed using this command. To change the assignment, you must delete
operation and create it using a new assignment.
Command: Double-click the operation in the project tree to modify its settings.
Syntax: EditSkinDepthOp <OpName>, <SkinDepthOpParams>
Return Value: None
Example:
oModule.EditSkinDepthOp "SkinDepth1",
Array("NAME:SkinD",_
"RestrictElem:=", false, _
"SkinDepth:=", "2mm", _
"SurfTriMaxLength:=", "1mm", _
"NumLayers:=", 2)
EditTrueSurfOp
Use: Modifies an existing true surface approximation-based mesh operation.
Assignments cannot be changed using this command. To change the
assignment, delete this operation and create it using a new assignment.
Command: Double-click the operation in the project tree to modify its settings.
Syntax: EditTrueSurfOp <OpName>, <TrueSurfOpParams>
Return Value: None
Example:
oModule.EditTrueSurfOp "TrueSurf2",
Array("NAME:trusurf", _
"SurfDevChoice:=", 2, _
"SurfDev:=","0.03mm", _
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"NormalDevChoice:=", 1, _
"AspectRatioChoice:=", 2, _
"AspectRatio:=", 10)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
16 Analysis Setup Module
Script Commands
DeleteDrivenSweep
DeleteSetups
DeleteSweep [HFSS-IE]
EditFrequencySweep
EditSetup
EditSweep [HFSS-IE]
GetSetupCount
GetSetups
GetSweepCount
GetSweeps
InsertFrequencySweep
InsertSweep [HFSS-IE]
InsertSetup
InsertSetup [HFSS-IE]
InsertSetup [Transient]
RenameDrivenSweep
RenameSetup
RenameSweep [HFSS-IE]
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
RevertAllToInitial
RevertSetupToInitial
DeleteDrivenSweep
Use: Deletes a frequency sweep. For HFSS-IE use DeleteSweep.
Command: Right-click a frequency sweep in the project tree, and then click Rename on
the shortcut menu.
Syntax: DeleteDrivenSweep <SetupName>, <SweepName>
Return Value: None
DeleteSetups
Use: Deletes one or more solution setups, which are specified by an array of
solution setup names.
Command: Right-click a solution setup in the project tree, and then click Delete on the
shortcut menu, or delete selected solution setups in the List dialog box.
Syntax: DeleteSetups <SetupArray>
Return Value: None
Parameters: <SetupArray>
Array(<name1>, <name2>, ...)
Example:
oModule.DeleteSetups Array("Setup1", "Setup2")
DeleteSweep [HFSS-IE]
Use: Deletes a frequency sweep.
Command: Right-click a frequency sweep in the project tree, and then click Rename on
the shortcut menu.
Syntax: DeleteSweep <SetupName>, <SweepName>
Return Value: None
EditFrequencySweep
Use: Modifies an existing frequency sweep. For HFSS-IE use EditSweep [HFSS-IE]
Command: Double-click a frequency sweep in the project tree to modify its settings.
Syntax: EditFrequencySweep <SetupName>, <SweepName>,
<AttributesArray>
Return Value: None
Parameters: <SetupName>
Type: <string>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<SweepName>
Type: <string>
Name of the sweep to be edited.
<Attributes Array>
Array("NAME:<SweepName>",
"IsEnabled:=", <boolean>,
"SetupType:=", <SetupType>,
<FrequencyInformation>,
"Type:=", <SweepType>,
<SaveFieldsList>
<DCExtrapInfo>)
See the InsertFrequencySweep command for details.
Example:
oModule.EditFrequencySweep "Setup1", "Sweep3", _
Array("NAME:Sweep3", "IsEnabled:=", true, _
"SetupType:=", "SinglePoints", _
"ValueList:=", Array("1GHz", "2GHz", "3GHz"), _
"Type:=", "Discrete", _
"SaveFieldsList:=", Array(false, false, false), _
"ExtrapToDC:=", false)
EditSetup
Use: Modifies an existing solution setup.
Command: Double-click a solution setup in the project tree to modify its settings.
Syntax: EditSetup <SetupName>, <AttributesArray>
Return Value: None
Parameters: <SetupName>
Type: <string>
Name of the solution setup being edited.
<AttributesArray>
Array("NAME:<NewSetupName>", <NamedParameters>)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EditSweep [HFSS-IE]
Use: Modifies an existing sweep in HFSS-IE.
Command: Double-click a frequency sweep in the project tree to modify its settings.
Syntax: EditSweep <SetupName>, <SweepName>, <AttributesArray>
Return Value: None
Parameters: <SetupName>
Type: <string>
Name of the solution setup containing the sweep to be edited.
<SweepName>
Type: <string>
Name of the sweep to be edited.
<Attributes Array>
Array("NAME:<SweepName>",
"IsEnabled:=", <boolean>,
"SetupType:=", <SetupType>,
<FrequencyInformation>,
"Type:=", <SweepType>,
<SaveFieldsList>
<DCExtrapInfo>)
See the InsertFrequencySweep command for details.
Example:
oModule.EditSweep "Setup1", "Sweep3", _
Array("NAME:Sweep3", "IsEnabled:=", true, _
"SetupType:=", "SinglePoints", _
"ValueList:=", Array("1GHz", "2GHz", "3GHz"), _
"Type:=", "Discrete", _
"SaveFieldsList:=", Array(false, false, false), _
"ExtrapToDC:=", false)
GetSetupCount
Use: Gets the number of analysis setups in a design.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Syntax: GetSetups()
Return Value: Number of setups.
Parameters: None
Example:
setupcount = oModule.GetSetupCount()
GetSetups
Use: Gets the names of analysis setups in a design.
Syntax: GetSetups()
Return Value: Array of analysis setup names.
Parameters: None
Example:
setupnames = oModule.GetSetups()
GetSweepCount
Use: Gets the number of sweeps in a given analysis setup.
Syntax: GetSweepCount(<SetupName>)
Return Value: Number of sweeos for the named setup.
Parameters: <SetupName>
Type: <string>
Name of the setup.
Example:
sweepcount = oModule.GetSweepCount("Setup1")
GetSweeps
Use: Gets the names of all sweeps in a given analysis setup.
Syntax: GetSweeps(<SetupName>)
Return Value: Array of sweep names.
Parameters: <SetupName>
Type: <string>
Name of the setup.
Example:
sweepnames = oModule.GetSweeps("Setup1")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
InsertFrequencySweep
Use: Adds a frequency sweep to a Driven solution-type setup.
Command: HFSS>Analysis Setup>Add Sweep
Syntax: InsertFrequencySweep <SetupName>, <AttributesArray>
Return Value: None
Parameters: <SetupName>
Type: <string>
Name of the solution setup into which the sweep will be inserted.
<Attributes Array>
Array("NAME:<SweepName>",
"IsEnabled:=", true,
"SetupType:=", <SetupType>,
"Type:=", <SweepType>,
<FrequencyInformation>,
<SaveFieldsList>
<DCExtrapInfo>)
<SweepType>
Type: <string>
Ex. "Discrete", "Fast", or "Interpolating".
<SetupType>
Type: <string>
Ex. "LinearSetup", "LinearCount", or "SinglePoints".
<FrequencyInformation>
This will vary based on the sweep and solution type. See the examples below.
<DCExtrapInfo>
Information about whether and how to perform DC extrapolation. This parameter is
not used for Discrete sweeps. See the examples below.
Example: Discrete Sweep
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"SetupType:=", "LinearStep", _
"StartValue:=", "19.5GHz", _
"StopValue:=", "20.4GHz", _
"StepSize:=", "0.1GHz", _
"Type:=", "Discrete", _
"SaveFields:=", false, "ExtrapToDC:=", false)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Example: A Fast sweep, specified using the starting and stopping frequencies and the
step count:
oModule.InsertFrequencySweep "Setup1", Array("NAME:Sweep4", _
"IsEnabled:=", true, "SetupType:=", "LinearCount", _
"StartValue:=", "1GHz", _
"StopValue:=", "10GHz", _
"Count:=", 3, _
"Type:=", "Fast", _
"SaveFields:=", true, "ExtrapToDC:=", false)
InsertSetup
Use: Adds a new solution setup.
Command: HFSS>Analysis Setup>Add Solution Setup
Syntax: InsertSetup <SetupType>, <AttributesArray>
Return Value: None
Parameters: <SetupType>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Type: <string>
"HfssDriven" or "HfssEigen". Must match the HFSS solution type.
<AttributesArray>
Array("NAME:<SetupName>", <Named Parameters>)
<Named Parameters>
The named parameters will vary according to the solution type. To see the required
parameters for a specific set of parameters and their format, use the record script
function, and view the resulting script in a text edtor. See the examples below.
Example: A Driven solution type with a mesh link. References to dependent solve in
old scripts are converted to mesh link form.
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup "HfssDriven",
Array("NAME:Setup1",
"Frequency:=", "1GHz",
"MaxDeltaE:=", 0.1,
"MaximumPasses:=", 6,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"IsEnabled:=", true,
Array("NAME:MeshLink",
"Project:=", "Tee.hfss",
"Design:=", "TeeModel",
"Soln:=", "Setup1 : LastAdaptive",
Array("NAME:Params", "offset:=", "0in"),
"ForceSourceToSolve:=", false,
"PreservePartnerSoln:=", false,
"PathRelativeTo:=", "SourceProduct",
"ApplyMeshOp:=", true),
"BasisOrder:=", 1,
"UseIterativeSolver:=", false,
"DoLambdaRefine:=", false,
"DoMaterialLambda:=", true,
"SetLambdaTarget:=", false,
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"Target:=", 0.3333,
"UseMaxTetIncrease:=", false,
"MaxTetIncrease:=", 1000000,
"EnableSolverDomains:=", false,
"ThermalFeedback:=", false,
"UsingConstantDelta:=", 0,
"ConstantDelta:=", "0s",
"NumberSolveSteps:=", 1)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"ThermalFeedback:=", false,
"UsingConstantDelta:=", 0,
"ConstantDelta:=", "0s",
"NumberSolveSteps:=", 1)
Example: An Eigenmode solution type:
Set oProject = oDesktop.SetActiveProject("cavity")
Set oDesign = oProject.SetActiveDesign("HFSSModel1")
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup "HfssEigen",
Array("NAME:Setup2",
"MinimumFrequency:=", "1.77347GHz",
"NumModes:=", 1,
"MaxDeltaFreq:=", 10,
"ConvergeOnRealFreq:=", true,
"MaximumPasses:=", 3,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"IsEnabled:=", true,
"BasisOrder:=", 1,
"UseIterativeSolver:=", false,
"DoLambdaRefine:=", true,
"DoMaterialLambda:=", true,
"SetLambdaTarget:=", false,
"Target:=", 0.2,
"UseMaxTetIncrease:=", false,
"MaxTetIncrease:=", 1000000,
"UsingConstantDelta:=", 0,
"ConstantDelta:=", "0s",
"NumberSolveSteps:=", 1)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Array("NAME:Setup2",
"Frequency:=", "1GHz",
"PortsOnly:=", false,
"MaxDeltaS:=", 0.02,
"UseMatrixConv:=", true,
Array("NAME:ConvergenceMatrix",
"AllDiagEntries:=", true,
"MagMinThreshold:=", 0.01,
"Entry:=", Array("Port1:=", "abc", "ModeNum1:=", 1)),
"MaximumPasses:=", 6,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"IsEnabled:=", true,
"BasisOrder:=", 1,
"UseIterativeSolver:=", false,
"DoLambdaRefine:=", true,
"DoMaterialLambda:=", true,
"SetLambdaTarget:=", false,
"Target:=", 0.3333,
"UseMaxTetIncrease:=", false,
"MaxTetIncrease:=", 1000000,
"PortAccuracy:=", 2,
"UseABCOnPort:=", true,
"SetPortMinMaxTri:=", false,
"EnableSolverDomains:=", false,
"ThermalFeedback:=", false,
"UsingConstantDelta:=", 0,
"ConstantDelta:=", "0s",
"NumberSolveSteps:=", 1)
InsertSetup [HFSS-IE]
Use: Adds a new HFSS-IE solution setup.
Command: HFSS>Analysis Setup>Add Solution Setup
Syntax: InsertSetup <SetupType>, <AttributesArray>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<AttributesArray>
Array("NAME:<SetupName>", <Named Parameters>)
<Named Parameters>
The named parameters will vary according to the solution type. To see the required
parameters for a specific set of parameters and their format, use the record script
function, and view the resulting script in a text edtor. See the HFSS-IE example
below.
Example:
oModule.InsertSetup "HFIESetup", Array("NAME:Setup3",
"MaximumPasses:=", 6,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"Enabled:=", true,
"AdaptiveFreq:=", "1GHz",
"DoLambdaRefine:=", true,
"UseDefaultLambdaTarget:=", true,
"Target:=", 0.25,
"DoMaterialLambda:=", true,
"MaxDeltaS:=", 0.02,
"MaxDeltaE:=", 0.1,
"UsePOSolver:=", true)
InsertSetup [Transient]
Use: Add a new solution setup to a Transient design
Command: FSS>Analysis Setup>Add Solution Setup
Syntax: InsertSetup <SetupType>, <AttributesArray>
Return Value: None
Parameters: <SetupType>
Type: <string>
"HfssTransient". Must match the HFSS solution type.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<AttributesArray>
Array("NAME:<SetupName>", <Named Parameters>)
<Named Parameters>
The named parameters will vary according to the solution type. To see the required
parameters for a specific set of parameters and their format, use the record script
function, and view the resulting script in a text edtor. See the examples below.
Example: Transient Solution Type
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup "HfssTransient",
Array("NAME:Setup1",
"Frequency:=", "1GHz",
"MaxDeltaE:=", 0.1,
"MaximumPasses:=", 20,
"IsEnabled:=", true,
"BasisOrder:=", -1,
"NoAdditionalRefinementOnImport:=", true,
Array("NAME:Transient",
"UseAutoTermination:=", 1,
"SteadyStateCriteria:=", 0.001,
"UseMinimumDuration:=", 0,
"TerminateOnMaximum:=", 1,
"UseMaxTime:=", 1,
"MaxTime:=", "20000ps"))
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
InsertSweep [HFSS-IE]
Use: Adds a frequency sweep to a Driven solution-type setup in HFSS-IE.
Command: HFSS-IE>Analysis Setup>Add Sweep
Syntax: InsertSweep <SetupName>, <AttributesArray>
Return Value: None
Parameters: <SetupName>
Type: <string>
Name of the solution setup into which the sweep will be inserted.
<Attributes Array>
Array("NAME:<SweepName>",
"IsEnabled:=", true,
"SetupType:=", <SetupType>,
"Type:=", <SweepType>,
<FrequencyInformation>,
<SaveFieldsList>
<DCExtrapInfo>)
<SweepType>
Type: <string>
Ex. "Discrete", "Fast", or "Interpolating".
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<SetupType>
Type: <string>
Ex. "LinearSetup", "LinearCount", or "SinglePoints".
<FrequencyInformation>
This will vary based on the sweep and solution type. See the examples below.
<DCExtrapInfo>
Information about whether and how to perform DC extrapolation. This parameter is
not used for Discrete sweeps. See the examples below.
Example: Discrete Sweep
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Example: A Fast sweep, specified using the starting and stopping frequencies and the
step count:
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
RenameDrivenSweep
Use: Renames an existing frequency sweep in HFSS. For HFSS-IE use
RenameSweep.
Command: Right-click a frequency sweep in the project tree, and then click Rename on
the shortcut menu.
Syntax: RenameDrivenSweep <SetupName>, <OldSweepName>,
<NewSweepName>
Return Value: None
Example:
oModule.RenameDrivenSweep "Setup1", "Sweep1", _
"MySweep"
RenameSetup
Use: Renames an existing solution setup.
Command: Right-click a solution setup in the project tree, and then click Rename on
the shortcut menu.
Syntax: RenameSetup <OldName>, <NewName>
Return Value: None
Parameters: <OldName>
Type: <string>
Name of the solution setup being renamed.
<NewName>
Type: <string>
New name for the solution setup.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
RenameSweep [HFSS-IE]
Use: Renames an existing frequency sweep in HFSS-IE.
Command: Right-click a frequency sweep in the project tree, and then click Rename on
the shortcut menu.
Syntax: RenameSweep <SetupName>, <OldSweepName>,
<NewSweepName>
Return Value: None
Example:
oModule.RenameSweep "Setup1", "Sweep1", _
"MySweep"
RevertAllToInitial
Use: Marks the current mesh for all solution setups as invalid. This will force the
next simulation to begin with the initial mesh.
Command: HFSS>Analysis Setup>Revert to Initial Mesh
Syntax: RevertAllToInitial
Return Value: None
RevertSetupToInitial
Use: Marks the current mesh for a solution setup as invalid. This will force the
next simulation to begin with the initial mesh.
Command: Right-click a setup in the project tree, and then click Revert to Initial Mesh
on the shortcut menu.
Syntax: RevertSetupToInitial <SetupName>
Return Value: None
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
17 Optimetrics Module Script
Commands
<VarName>
Type: <string>
Name of a variable.
<VarValue>
Type: <string>
Value with unit (i.e., <value>, but cannot be an expression).
<StartV>
Type: <VarValue>
The starting value of a variable.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<StopV>
Type: <VarValue>
The stopping value of a variable.
<MinV>
Type: <VarValue>
The minimum value of a variable.
<MaxV>
Type: <VarValue>
The maximum value of a variable.
<IncludeVar>
Type: <bool>
Specifies whether the variable is included in the analysis.
<StartingPoint>
Array("NAME:StartingPoint", "<VarName>:=",
<VarValue>, .... "<VarName>:=", <VarValue>)
<SaveField>
Type: <bool>
Specifies whether HFSS will remove the non-nominal field solution.
<MaxIter>
Type: <int>
Maximum iteration allowed in an analysis.
<PriorSetup>
Type: <string>
The name of the embedded parametric setup.
<Precede>
Type: <bool>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<Constraint>
Array("NAME:LCS",
"lc:=", Array("<VarName>:=",
<Coeff>, "<VarName>:=", <Coeff>, "rel:=",
<Cond>, "rhs:=", <Rhs>), ...
"lc:=", Array("<VarName>:=", <Coeff>, ..."
<VarName>:=", <Coeff>, "rel:=", <Cond>, "rhs:=",
<Rhs>))
<Coeff>
Type: <double>
Coefficient for a variable in the linear constraint.
<Cond>
Type: <string>
Inequality condition.
<Rhs>
Type: <double>
Inequality value.
<OptiGoalSpec>
"Solution:=", <Soln>, "Calculation:=", <Calc>,
"Context:=, <Geometry>
Array("NAME:Ranges",
"Range:", Array("Var:=",
<VarName>, "Type:=", <RangeType>, "Start:=",
<StartV>, "Stop:=", <StopV>), ...
"Range:", Array("Var:=", <VarName>, "Type:=",
<RangeType>, "Start:=", <StartV>, "Stop:=",
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<StopV>))
<Soln>
Type: <string>
Name of the HFSS solution.
<Calc>
Type: <string>
An expression that is composed of a basic solution quantity and an
output variable.
<Geometry>
Type: <string>
Name of geometry needed in the evaluation of <Calc>.
<RangeType>
Type: <string>
if "r", start and stop values specify a range for the variable.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
DeleteSetups [Optimetrics]
Use: Deletes the specified Optimetrics setups.
Command: Right-click the setup in the project tree, and then click Delete on the
shortcut menu.
Syntax: DeleteSetups <NameArray>
Return Value: None
Parameters: <NameArray>
Type: Array of strings.
An array of setup names.
Example:
oModule.DeleteSetups Array("OptimizationSetup1")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
DistributedAnalyzeSetup
Use: Distributes all variable value instances within a parametric sweep to
different machines already specified from within the user interface
Command: Right-click the parametric setup name in the project tree and select
Distribute Analysis.
Syntax: DistributedAnalyzeSetup <ParametricSetupName>
Return Value: None
Parameters: <ParametricSetupName>
Type: <string>
Example:
oModule.DistributedAnalyzeSetup "ParametricSetup1"
ExportDXConfigFile
Use: Create an xml file with the setup information for Design Xplorer.
Command: Right click on the Design Xplorer setup in the project tree and choose
Export External Connector Addin Configuration
Syntax: ExportDXConfigFile <SetupName>, <FileName>
Return Value: None
Parameters: <SetupName>
Type: <string>
Must be one of existing DesignExplorer setup names.
<FileName>
Type : <string: file path>
Must be a valid file path and name.
Example: oModule.ExportDXConfigFile "DesignXplorerSetup1",
"c:/exportdir/DXSetup1.xml")
ExportOptimetricsProfile
Use: Export Optimetrics profile data.
Command: Right click on the Optimetrics setup in the project tree and choose View
Analysis Result On the Post Analysis Display dialog, click the Profile tab
and click on the Export button.
Syntax: ExportOptimetricsProfile <SetupName>, <FileName>,
[profileNum]
Return Value: None
Parameters: <SetupName>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Type: <string>
Must be one of the existing Parametric, Optimization, Sensitivity, Statistical or
DesignXplorer setup names.
<FileName>
Type : <string: file path>
Must be a valid file path and name with extension of csv, tab, dat, or txt..
[profileNum]
Type : <string>
Must be a numeric string. Optional: defaulted to last profile number. It should be a
zero indexed profile number.
Example: oModule.ExportOptimetricsProfile "StatisticalSetup1",
"c:/exportdir/test.csv"
ExportOptimetricsResult
Use: Export an existing Optimization, Sensitivity, Statistical or DesignXplorer
result. (Does not export Parametric results.)
Command: Right click on the desired Optimetrics setup in the project tree and choose
View Analysis Result On the Post Analysis Display dialog, click the Result
tab, then select Table view, and click on the Export button.
Syntax: ExportOptimetricsProfile <SetupName>, <FileName>,
[useFullOutputName]
Return Value: None
Parameters: <SetupName>
Type: <string>
Must be one of the existing Optimization, Sensitivity, Statistical, or DesignXplorer
setup names.
<FileName>
Type : <string: file path>
Must be a valid file path and name with extension of csv, tab, dat, or txt..
[useFullOutputName]
Type : <boolean>
Optional: defaulted to false. If set to true values will be printed with units. This
parameter is ignored for Optimization and Statistical results.
Example: oModule. ExportOptimetricsResult "StatisticalSetup1",
"c:/exportdir/test.csv", false
ExportParametricResults
Use: Export existing Parametric results.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Command: Right click on the desired Parametric setup in the project tree and choose
View Analysis Result On the Post Analysis Display dialog, click the Result
tab, then select Table view, and click on the Export button.
Syntax: ExportParametricResults <SetupName>, <FileName>,
<bOutputUnits>
Return Value: None
Parameters: <SetupName>
Type: <string>
Must be one of the existing Parametric setup names.
<FileName>
Type : <string: file path>
Must be a valid file path and name with extension of csv, tab, dat, or txt..
<bOutputUnits>
Type : <boolean>
If set to true values will be printed with units.
Example: oModule. ExportParametricResults "ParametricSetup1", "c:/
exportdir/test.csv", false
GetSetupNames [Optimetrics]
Use: Gets a list of Optimetrics setup names.
Syntax: GetSetupNames()
Return Value: Collection of Optimetrics setup names
Parameters: None
Example: For each name in
oModule.GetSetupNames()
Msgbox name
Next
GetSetupNamesByType [Optimetrics]
Use: Gets a list of Optimetrics setup names by type.
Syntax: GetSetupNamesByType(<Optimetrics type>)
Return Value: Collection of Optimetrics setup names of the given type.
Parameters: <Optimetrics type>
Type: String
Examples: parametric, optimization, statistical, sensitivity
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ImportSetup
Use: Import an Optimetric setup from a file.
Command: None
Syntax: ImportSetup <SetupTypeName>, <SetupInfo>
Return Value: None
Parameters: SetupTypeName
Type: <string>
Must be one of "OptiParametric" , "OptiOptimization", "OptiSensitivity", "OptiSta-
tistical", or "OptiDesignExplorer".
<SetupInfo>
Array("NAME:<SetupName>", "FilePath")
<SetupName>
Type: <string>
Name of the setup.
FilePath
Type : <string: file path>
Must be a valid file path and name.
Example: oModule.ImportSetup "OptiStatistical",
Array("NAME:StatisticalSetup1",
"c:/importdir/mySetupInfoFile")
RenameSetup [Optimetrics]
Use: Renames the specified Optimetrics setup.
Command: Right-click the setup in the project tree, and then click Rename on the
shortcut menu.
Syntax: RenameSetup <OldName> <NewName>
Return Value: None
Parameters: <OldName>
Type: <string>
<NewName>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Type: <string>
Example:
oModule.RenameSetup "OptimizationSetup1" "MyOptimization"
SolveSetup [Optimetrics]
Use: Solves the specified Optimetrics setup.
Command: Right-click the setup in the project tree, and then click Analyze on the
shortcut menu.
Syntax: SolveSetup <SetupName>
Return Value: None
Parameters: oModule.SolveSetup "OptimizationSetup1"
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EditSetup [Parametric]
Use: Modifies an existing parametric setup.
Command: Right-click the setup in the project tree, and then click Properties on the
shortcut menu.
Syntax: EditSetup <SetupName>, <ParametricParams>
Return Value: None
GenerateVariationData (Parametric)
Use: Generate variation data before parametric solve for CAD integrated project
Command: Right click on the parametric setup in the project tree and choose
"Generate Variation Data"
Syntax: GenerateVariationData <SetupName>
Return Value: None
Parameters: <SetupName>
Name of th esetup.
Example:
oModule.GenerateVariationData "ParametricSetup1"
InsertSetup [Parametric]
Use: Inserts a new setup.
Command: Right-click the Optimetrics folder in the project tree, and then click Add>
Parametric on the shortcut menu.
Syntax: InsertSetup "OptiParametric", <ParametricParams>
Return Value: None
Parameters: <Parametric Params>
Array("NAME:<SetupName>", "SaveFields:=",
<SaveField>, <StartingPoint>, "Sim. Setups:=",
<SimSetups>,
<SweepDefs>, <SweepOps>,
Array("NAME:Goals", Array("NAME:Goal",
Optimetrics Module Script Commands 17-11
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<SetupName>
Type: <string>
Name of the parametric setup.
<SimSetups>
Type: Array of strings.
An array of HFSS solution setup names.
<SweepDefs>
Array("NAME:Sweeps",
Array("NAME:SweepDefinition", "Variable:=",
<VarName>, "Data:=", <SweepData>,
"Synchronize:=", <SyncNum>), ...
Array("NAME:SweepDefinition", "Variable:=",
<VarName>, "Data:=", <SweepData>,
"Synchronize:=", <SyncNum>))
<SweepData>
"<SweepType>, <StartV>, <StopV>, <StepV>"
<SweepType>
Type: <string>
The type of sweep data.
<SyncNum>
Type: <int>
SweepDatas with the same value are synchronized.
<SweepOps>
Array("NAME:Sweep Operations", "<OpType>:=,
Array(<VarValue>, , <VarValue>), ...
<OpType>:=, Array(<VarValue>, , <VarValue>))
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<OpType>
Type: <string>
The sweep operation type.
Example:
oModule.InsertSetup "OptiParametric",
Array("NAME:ParametricSetup1", _
"SaveFields:=", true, _
Array("NAME:StartingPoint"), _
"Sim. Setups:=", Array("Setup1"),_
Array("NAME:Sweeps", _
Array("NAME:SweepDefinition", _
"Variable:=", "$width", _
"Data:=", "LIN 12mm 17mm 2.5mm", _
"OffsetF1:=", false, _
"Synchronize:=", 0),
Array("NAME:SweepDefinition", _
"Variable:=", "$length", _
"Data:=", "LIN 8mm 12mm 2mm", _
"OffsetF1:=", false, _
"Synchronize:=", 0)),
Array("NAME:Sweep Operations"), _
Array("NAME:Goals", _
Array("NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "returnloss", _
"Context:=", "",_
Array("NAME:Ranges", _
"Range:=", Array("Var:=", "Freq", "Type:=", "s", _
"Start:=", "8GHz", "Stop:=", "8GHz"))), _
Array("NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect", _
"Context:=", "", _
Array("NAME:Ranges", _
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EditSetup [Optimization]
Use: Modifies an existing optimization setup.
Command: Right-click the setup in the project tree, and then click Properties on the
shortcut menu.
Syntax: EditSetup <SetupName>, <OptimizationParams>
Return Value: None
InsertSetup [Optimization]
Use: Inserts a new optimization setup.
Command: Right-click the Optimetrics folder in the project tree, and then click
Add>Optimization on the shortcut menu.
Syntax: InsertSetup "OptiOptimization", <OptimizationParams>
Return Value: None
Parameters: <OptimizationParams>
Array("NAME:<SetupName>", "SaveFields:=",
<SaveField>, <StartingPoint>, "Optimizer:=",
<Optimizer>,
"MaxIterations:=", <MaxIter>, "PriorPSetup:=",
<PriorSetup>, "PreSolvePSetup:=", <Preceed>,
<OptimizationVars>, <Constraint>,
Array("NAME:Goals", Array("NAME:Goal",
<OptiGoalSpec>, <OptimizationGoalSpec>), ...
Array("NAME:Goal", <OptiGoalSpec>,
<OptimizationGoalSpec>)),
"Acceptable_Cost:=", <AcceptableCost>, "Noise:=",
<Noise>, "UpdateDesignWhenDone:=", <UpdateDesign"
<OptimizationVars>
Array("NAME:Variables", "VarName:=", Array("i:=",
<IncludeVar>, "Min:=", <MinV>, "Max:=", <MaxV>,
"MinStep:=", <MinStepV>, "MaxStep:=", <MaxStepV>),
Optimetrics Module Script Commands 17-15
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<MinStepV>
Type : <VarValue>
The minimum step of the variable.
<MaxStepV>
Type: <VarValue>
The maximum step of the variable.
<AcceptableCost>
Type: <double>
The acceptable cost value for the optimizer to stop.
<Noise>
Type: <double>
The noise of the design.
<UpdateDesign>
Type: <bool>
Specifies whether or not to apply the optimal variation to the design after the optimi-
zation is done.
<OptimizationGoalSpec>
"Condition:=", <OptimizationCond>,
Array("NAME:GoalValue", "GoalValueType:=",
<GoalValueType>,
"Format:=", <GoalValueFormat>, "bG:=",
Array("v:=", <GoalValue>)), "Weight:=", <Weight>)
<OptimizationCond>
Type: <string>
Either "<=", "==", or ">="
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<GoalValueType>
Type: <string>
Either "Independent" or "Dependent"
<GoalValueFormat>
Type:<string>
Either "Real/Imag" or "Mag/Ang".
<GoalValue>
Type: <string>
Value in string. Value can be a real number, complex number, or expression.
Example:
oModule.InsertSetup "OptiOptimization",_
Array("NAME:OptimizationSetup1", _
"SaveFields:=", false, _
Array("NAME:StartingPoint", "$length:=", "8mm", _
"$width:=", "14.5mm"), _
"Optimizer:=", "Quasi Newton", _
"MaxIterations:=", 100, _
"PriorPSetup:=", "ParametricSetup1", _
"PreSolvePSetup:=", true, _
Array("NAME:Variables", _
"$length:=", Array("i:=", true, "Min:=", "6mm", _
"Max:=", "18mm", _
"MinStep:=", "0.001mm", "MaxStep:=", _
"1.2mm"), _
"$width:=", Array("i:=", true, "Min:=", _
"6.5mm", "Max:=", "19.5mm", _
"MinStep:=", "0.001mm", "MaxStep:=", _
"1.3mm")), _
Array("NAME:LCS"), _
Array("NAME:Goals", _
Array("NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "reflect", _
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"Context:=", "", _
Array("NAME:Ranges", _
"Range:=", Array("Var:=", "Freq", _
"Type:=", "s", _
"Start:=", "8GHz", "Stop:=", "8GHz")), _
"Condition:=", "<=", _
Array("NAME:GoalValue", _
"GoalValueType:=", "Independent", _
"Format:=", "Real/Imag", _
"bG:=", Array("v:=", "[0.0001]")), _
"Weight:=", "[1]")),
"Acceptable_Cost:=", 0.0002, _
"Noise:=", 0.0001, _
"UpdateDesign:=", true, _
"UpdateIteration:=", 5, _
"KeepReportAxis:=", true, _
"UpdateDesignWhenDone:=", true)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EditSetup [Sensitivity]
Use: Modifies an existing sensitivity setup.
Command: Right-click the setup in the project tree, and then click Properties on the
shortcut menu.
Syntax: EditSetup <SetupName>, <SensitivityParams>
Return Value: None
InsertSetup [Sensitivity]
Use: Inserts a new sensitivity setup.
Command: Right-click Optimetrics in the project tree, and then click Add>Sensitivity
on the shortcut menu.
Syntax: InsertSetup "OptiSensitivity", <SensitivityParams>
Return Value: None
Parameters: <SensitivityParams>
Array("NAME:<SetupName>",
"SaveFields:=", <SaveField>,
<StartingPoint>,
"MaxIterations:=", <MaxIter>,
"PriorPSetup:=", <PriorSetup>,
"PreSolvePSetup:=", <Preceed>, <SensitivityVars>,
<Constraint>,
Array("NAME:Goals",
Array("NAME:Goal", <OptiGoalSpec>), ...,
Array("NAME:Goal", <OptiGoalSpec>)),
"Master Goal:=". <MasterGoalID>,
"MasterError:=", <MasterError>)
<SensitivityVars>
Array("NAME:Variables",
"VarName:=", Array("i:=", <IncludeVar>,
"Min:=", <MinV>, "Max:=", <MaxV>,
Optimetrics Module Script Commands 17-19
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"IDisp:=", <InitialDisp>),...
"VarName:=", Array("i:=", <IncludeVar>,
"Min:=", <MinV>, "Max:=", <MaxV>,
"IDisp:=", <InitialDisp>))
<InitialDisp>
Type : <VarValue>
The initial displacement of the variable.
<MasterGoalID>
Type: <int>
Index of the master goal. Index starts from zero.
<MasterError>
Type: <double>
Error associated with the master goal.
Example:
oModule.InsertSetup "OptiSensitivity", _
Array("NAME:SensitivitySetup1",_
"SaveFields:=", true,_
Array("NAME:StartingPoint"), _
"MaxIterations:=", 20,_
"PriorPSetup:=", "",_
"PreSolvePSetup:=", true, _
Array("NAME:Variables"), _
Array("NAME:LCS"),_
Array("NAME:Goals",_
Array("NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "returnloss",_
"Context:=", "",_
Array("NAME:Ranges",_
"Range:=", Array("Var:=", "Freq", "_
Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz"))),_
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Array("NAME:Goal",_
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect",_
"Context:=", "",_
Array("NAME:Ranges",_
"Range:=", Array("Var:=","Freq",_
"Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz")))),_
"Master Goal:=", 1,_
"MasterError:=", 0.001)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Array("NAME:Variables",
"$length:=", Array("i:=", true,
"int:=", false,
"Dist:=", "Uniform",
"Tol:=", "10%", "StdD:=", "0.2mm", "Min:=", "-3",
"Max:=", "3", "Shape:=", "1", "Scale:=", "0.04mm",
"Location:=", "0.4mm",
"Dataset:=", "", "LatinHypercube:=", "true", "VarMin:=", "0.2mm",
"VarMax:=", "0.6mm", "Prob:=", "0.01",
"Mean:=", "0.4mm"),
Array("NAME:Goals", Array("NAME:Goal",
"ReportType:=", "Modal Solution Data",
"Solution:=", "Setup1 : PortOnly",
Array("NAME:SimValueContext", "Domain:=", "Sweep"),
"Calculation:=", "returnloss",
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"Name:=", "returnloss",
Array("NAME:Ranges",
"Range:=", Array("Var:=", "Freq",
"Type:=", "s",
"Start:=", "8.2GHz", "Stop:=", "0"))),
Array("NAME:Goal",
"ReportType:=", "Modal Solution Data",
"Solution:=", "Setup1 : PortOnly",
Array("NAME:SimValueContext",
"Domain:=", "Sweep"),
"Calculation:=", "reflect",
"Name:=", "reflect",
Array("NAME:Ranges",
"Range:=", Array("Var:=", "Freq",
"Type:=", "s",
"Start:=", "8.2GHz", "Stop:=", "0")))))
InsertSetup [Statistical]
Use: Inserts a new statistical setup.
Command: Right-click Optimetrics in the project tree, and then click Add>Statistical
on the shortcut menu.
Syntax: InsertSetup "OptiStatistical", <StatisticalParams>
Return Value: None
Parameters: <StatisticalParams>
Array("NAME:<SetupName>",
"SaveFields:=", <SaveField>,
<StartingPoint>,
"MaxIterations:=",
<MaxIter>,
"PriorPSetup:=", <PriorSetup>,
"PreSolvePSetup:=", <Preceed>,
<StatisticalVars>,
Array("NAME:Goals",
Array("NAME:Goal", <OptiGoalSpec>), ,
Array("NAME:Goal", <OptiGoalSpec>))),
<StatisticalVars>
Array("NAME:Variables",
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<DistType>
Type : <string>
Distrbution can be "Gaussian","Uniform", LogNormal or UserDefined.
<Tolerance>
Type: <VarValue>
The tolerance for the variable when distribution is Uniform.
<StdD>
Type: <VarValue>
The standard deviation for the variable when distribution is Gaussian.
<MinCutoff>
Type: <double>
Formerly the minimum cut-off for the variable when distribution is Gaussian. Leg-
acy.
<MaxCutoff>
Type: <double>
Formerly the maximum cut-off for the variable when distribution is Gaussian. Leg-
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
acy.
<Prob>
Type: <double>
Probability for Gaussian distribution. A value >= 0 and < 0.1.
<Mean>
Type: <double>
Mean for Gaussian distribution.
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 13.0.0
' 3:29:39 PM May 18, 2010
' ----------------------------------------------
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("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
oDesign.ChangeProperty Array("NAME:AllTabs",
Array("NAME:LocalVariableTab",
Array("NAME:PropServers", "LocalVariables"),
Array("NAME:ChangedProps",
Array("NAME:offset",
Array("NAME:Statistical", "Included:=", true)))))
Set oModule = oDesign.GetModule("Optimetrics")
oModule.InsertSetup "OptiStatistical", Array("NAME:StatisticalSet-
up1",
Array("NAME:ProdOptiSetupData",
"SaveFields:=", false, "CopyMesh:=", false),
Array("NAME:StartingPoint", "offset:=", "0in"),
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Array("NAME:Variables",
Array("NAME:Goals", Array("NAME:Goal",
"ReportType:=", "Modal Solution Data",
"Solution:=", "Setup1 : LastAdaptive", Array("NAME:SimValueContext"),
"Calculation:=", "Power11",
"Name:=", "Power11",
Array("NAME:Ranges",
"Range:=", Array("Var:=", "Freq", "Type:=", "d",
"DiscreteValues:=", "10GHz")))))
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
18 Solutions Module Script
Commands
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
IsFieldAvailableAt
ListMatchingVariations
ListValuesOfVariables
ListVariations
DeleteImportData
Use: Deletes imported solution or table data in HFSS. Not in HFSS-IE
Command: HFSS>Results>Import Solutions
Syntax: DeleteImportData <ImportSpecArray>
Return Value: None
Parameters: <ImportSpecArray>
Array(<ImportSpec>, ...)
<ImportSpec>
Type: <string>
Format of string is "importname:solnnameORtablename".
Example:
oModule.DeleteImportData _
Array("Import1:Adaptive_1", "Import2:DataTable")
EditSources
Use: Indicates which source excitations should be used for fields post processing.
Command: HFSS>Fields>Edit Sources
Syntax: EditSources<FieldType>, <SourceArray>,
<MultiplicityArray>, <MagnitudeArray>,
<PhaseArray>, <TerminatedArray>,
<ImpedanceArray>, <IncludePostProcessing>
Return Value: None
Parameters: <FieldType>
Type: <string>
Possible values are:
"NoIncidentWave", "ScatteredFields", "TotalFields",
"IncidentFields", "EigenStoredEnergy", or "EigenPeakElec-
tricField"
<SourceArray>
Array("NAME:SourceNames", <Source1Name>,
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<Source2Name>, ...)
A source name is typically the name of the associated excitation.
<MultiplicityArray>
Array("NAME:Modes", <port1NumModes>, <port2NumModes>,
...)
or
Array("NAME:Terminals", <port1NumTerminals>, ...)
A non-port source should indicate multiplicity of 1.
<MagnitudeArray>
Array("NAME:Magnitudes", <Source1Mag>, <Source2Mag>,
...)
This gives the Mag of the complex excitation for each source.
<PhaseArray>
Array("NAME:Phases", <Source1Phase>, <Source2Phase>,
...)
This gives the Phase in degrees of the complex excitation for each source. For Eigen-
moded stored energy problems, phase array is not recorded by Tools>Record Script
to File, , and is not needed when running scripts for such problems.
<TerminatedArray>
Array("NAME:Terminated", <IsSource1Terminated>, ...)
Only used for a Driven Terminal solution-type problem.
If it is Driven Terminal, then each source must have an entry, but
entries for non port sources are ignored.
<ImpedanceArray>
Array("NAME:Impedances", <Source1ComplexImped>, ...)
Only for a Driven Terminal solution-type problem.
If it is Driven Terminal, there must be an entry for each terminated
source. Complex format is a string representation as "re + im j".
<IncludePostProcessing>
Type: <bool>
Specifies whether to include post processing effects.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<useIncidentVoltage>
Type: <bool>
For driven terminal projects, this specifies whether to use incident voltage. The
default for this argument if missing is "false", so that legacy driven terminal projects
behave as if using total voltage.
Example:
oModule.EditSources "NoIncidentWave", _
Array("NAME:SourceNames", "WavePort1", _
"WavePort2"), Array("NAME:Terminals", 2, 2), _
Array("NAME:Magnitudes", 1, 0), _
Array("NAME:Phases", 0, 0),_
Array("NAME:Terminated", false, true, true, false), _
Array("NAME:Impedances", "50 + 80 j", "50 + 90 j")
Example:
oModule.EditSources "NoIncidentWave", _
Array("NAME:SourceNames", "EigenMode"), _
Array("NAME:Modes", 2), Array("NAME:Magnitudes", _
0, 1), Array("NAME:Phases", 0, 45), _
Array("NAME:Terminated"), Array("NAME:Impedances")
Example:
oModule.EditSources "TotalFields", _
Array("NAME:SourceNames", "WavePort1", _
"LumpPort1", "IncWave1", "Voltage1", "Current1"),_
Array("NAME:Modes", 1, 1, 6, 1, 1), _
Array("NAME:Magnitudes", _
17, 19, 1, 3, 5, 7, 9, 11, 13, 15), _
Array("NAME:Phases", 0, 20, 2, 4, _
6, 8, 10, 12, 14, 16), Array("NAME:Terminated"),_
Array("NAME:Impedances")
Example:
oModule.EditSources "NoIncidentWave",
Array("NAME:Names", "P01__NET179_", _
"P02__NET178_", "P03__NET178_", "P04__NET179_"),
Array("NAME:Terminals", 1, 1, 1, 1),
Array("NAME:Magnitudes", "1", "0", "0", "0"),
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
DeleteFullVariation
Use: Use to selectively make deletions or delete all solution data.
Command: HFSS>Results>Clean Up Solutions...
Syntax: DeleteFullVariation Array(<parameters>), boolean
Parameters: <DataSpecifierArray>
Array(<DesignVariationKey>, )
<DesignVariationKey>
Type: <string>
Design variation string.
<Boolean>
Type: boolean
Whether to also delete linked data.
Example:
Set oDesign = oProject.SetActiveDesign("HFSSModel1")
oDesign.DeleteFullVariation Array(""), false
Example:
Solutions Module Script Commands 18-5
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Dim oModule
Set oAnsoftApp = CreateObject("AnsoftHfss.HfssScriptInterface")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("ogive")
Set oDesign = oProject.SetActiveDesign("IEDesign1")
oDesign.DeleteFullVariation Array(""), true
Example:
Dim oModule
Set oAnsoftApp = CreateObject("AnsoftHfss.HfssScriptInterface")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Tee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
oDesign.DeleteFullVariation Array("offset=" &Chr(39) & "0.2in" _
& Chr(39) & "", "offset=" & Chr(39) & "0in" & Chr(39) & ""), false
DeleteSolutionVariation
Use: Deletes all solution data for specific solutions and design variations. This is
supported for backward compatibility. You should use DeleteFullVariation.
Command: HFSS>Results>Clean Up Solutions
Syntax: DeleteSolutionVariation
Array(<DataSpecifierArray>, ...)
Return Value: None
Parameters: <DataSpecifierArray>
Array(<DesignVariationKey>, <SetupName>, <SolnName>)
<DesignVariationKey>
Type: <string>
Design variation string.
<SetupName>
Type: <string>
Name of the solution setup.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<SolnName>
Type: <string>
Name of the solutions within the solution setup.
Example:
oModule.DeleteSolutionVariation Array( _
Array("width=2in", "Setup1", "Adaptive_1") _
Array("width=2in", "Setup1", "Sweep1") )
DeleteVariation
Use: Deletes matrix, field, and/or mesh solution data for specific variations,
across all solutions.
Command: HFSS>Results>Browse Solutions
Syntax: DeleteVariation <VariationArray>, <FullVariations>,
<MeshAndFieldsOnly>, <FieldsOnly>
Return Value: None
Parameters: <VariationArray>
Array(<DesignVariationKey>, <DesignVariationKey>,...)
<FullVariations>
Type: <bool>
Specifies whether to delete meshes, fields, matrix data, profile, and convergence data.
<MeshAndFieldsOnly>
Type: <bool>
Specifies whether to delete only meshes and fields.
<FieldsOnly>
Type: <bool>
Specifies whether to delete fields only.
Example:
oModule.DeleteVariation _
Array("width=2in", "width=2.5in"), _
TRUE, FALSE, FALSE
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ExportForSpice
Use: Exports matrix solution data to a file in a format suitable for Spice analysis.
Available only for Driven Terminal solution types with ports. Output in an
appropriate format will be generated for each of the non-empty file names
provided.
Command: None
Syntax: ExportForSpice
<DesignVariationKey>, <SolnSelectionArray>, <SpiceType>,
<BandWidth>, <FWSFile>, <LumpedElementFile>,
<PoleZeroSpiceFile>, <PoleZeroMatlabFile>,
<PartialFractionFile>, <FittingErrorInPercent>,
<MaximumOrder>,
<UseCommonGround>,
<EnforcePassivity>
<BandWidth>
Type: <int>
Possible values are:
0: Low (narrow) band width
<FWSFile>
Type: <string>
<LumpedElementFile>
Type: <string>
<PoleZeroSpiceFile>
Type: <string>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<PoleZeroMatlabFile>
Type: <string>
<PartialFractionFile>
Type: <string>
<FittingErrorInPercent>
Type: <Float>
<MaximumOrder>
Type: <Integer>
<UseCommonground>
Type: 0/1
<EnforcePassivity>
Type: 0/1
Example:
oModule.ExportForSpice "width=2in", _
Array("Setup1:Sweep1"), 2, 0, _
"c:\mydir\Sweep1.fws", "", "", "", ""
ExportEigenmodes
Use: Exports a tab delimited table of Eigenmodes in HFSS. Not in HFSS-IE.
Command: None
Syntax: ExportEigenmodes
<setupName> <solutionName> <DesignVariationKey>
<filename>
Return Value: None
Parameters:
<SolutionName>
Type: <string>
Name of the solutions within the solution setup.
<DesignVariationKey>
Type: <string>
Design variation string.
Example:
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ExportForHSpice
Use: Exports matrix solution data to a file in a format suitable for HSpice
analysis. Available only for Driven Terminal solution types with ports.
Output in an appropriate format will be generated for each of the non-
empty file names provided.
Command: None
Syntax: ExportForHSpice
<DesignVariationKey>, <SolnSelectionArray>, <SpiceType>,
<BandWidth>, <FWSFile>, <LumpedElementFile>,
<PoleZeroSpiceFile>, <PoleZeroMatlabFile>,
<PartialFractionFile>,
<FittingErrorInPercent>, <MaximumOrder>, <MinimumOrder>,
<EnforcePassivity>
Return Value: None
Parameters: <SpiceType>
Type: <int>
Possible value is:
1: HSpice
<BandWidth>
Type: <int>
Possible value is:
0: Low (narrow) band width
<FWSFile>
Type: <string>
<LumpedElementFile>
Type: <string>
<PoleZeroSpiceFile>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Type: <string>
<PoleZeroMatlabFile>
Type: <string>
<PartialFractionFile>
Type: <string>
<FittingErrorInPercent>
Type: <float>
The accuracy to use in fitting the pole zero model.
<MaximumOrder>
Type: <int>
Maximum number of poles in rational function expansion.
<UseCommonGround>
Type:<init>
0/1
<EnforcePassivity>
Type: : <int>
0/1
Example:
oModule.ExportForHSpice "width=2in", _
Array("Setup1:Sweep1"), 1, 0, _
"c:\mydir\Sweep1.fws", "", "", "", "", _
.005, 20, 200
ExportNetworkData
Use: Exports matrix solution data to a file. Available only for Driven solution
types with ports.
Command: None
Syntax: ExportNetworkData
<DesignVariationKey>, <SolnSelectionArray>, <FileFormat>,
<OutFile>,<FreqsArray>, <DoRenorm>, <RenormImped>
<dataType> <pass> <complexFormat>
Return Value: None
Parameters: <SolnSelectionArray>
Solutions Module Script Commands 18-11
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<OutFile>
Type: <string>
Full path to the file to write out.
<FreqsArray>
Type: Array of doubles.
The frequencies to export. To export all frequencies, use Array("all").
<DoRenorm>
Type: <bool>
Specifies whether to renormalize the data before export.
<RenormImped>
Type: <double>
Real impedance value in ohms, for renormalization. Required in syntax,
but ignored if DoRenorm is false.
<DataType>
Type: "S", "Y", or "Z"
The matrix to export.
<Pass>
Type: string, from 1 to N.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
The pass to export. This is ignored if the sourceName is a frequency sweep. Leaving
out this value or specifying -1 gets all passes.
<ComplexFormat>
Type: "0", "1", or "2"
The format to use for the exported data.
0 = Magnitude/Phase.
1= Real/Imaginary.
2= db/Phase.
<TouchstonePrecision>
Type: <int>
Default if not specified is 15.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Example:
oModule.ExportNMFData Array("Setup1:Sweep1"), _
"c:\mydir\out.nmf", Array("all"), "", FALSE, 0
GetAdaptiveFreq
Use: To obtain an adaptive frequency for a specified setup.
Syntax: GetAdaptiveFreq(<SetupName>)
Return Value: Returns a frequency value.
Type: <double>
Example: "15500000000.0"
Parameters: <SetupName>
Type: <string>
Example:
set oModule = oDesign.GetModule("Solutions")
adaptfreq = oModule.GetAdaptiveFreq("Setup1")
GetISolutionVersionID
Use: To obtain the solution ID to help track solution validity.
Syntax: GetISolutionVersionID(BSTR fullSolutionName)
Return Value: Returns a solution ID.
Parameters: None
Example:
versionID = oModule.GetISolutionVersionID(BSTR fullSolutionName)
GetSolveRangeInfo
Use: To determine the frequency range of a particular simulation setup. For fast
sweeps and interpolating sweeps this command returns the start and stop
frequencies. For discrete sweeps, it returns a list of frequencies. For an
adaptive solution, it returns the adaptive frequency.
Syntax: GetSolveRangeInfo(<SolutionName>)
Return Value: An array of frequencies.
Parameters: <SolutionName>
Type: <string>
Example:
set oModule = oDesign.GetModule("Solutions")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
freqrange = oModule.GetSolveRangeInfo("Setup1:Sweep1")
GetValidISolutionList
Use: Gets all available solution names that exist in a design.
Syntax: GetValidISolutionList(<IncludeImportedSolutions>)
Return Value: Array of names
Parameters: <IncludeImportedSolutions>
Type: <Boolean>
If no parameter is given the default is False.
Example:
solution = oModule.GetValidISolutionList(True)
HasFields
Use: To determine if fields exist for a particular solution.
Syntax: HasFields(<SolutionName>, <DesignVariation>)
Return Value: Returns 1 or 0 ( 1= true, 0 = false)
Type: Boolean
Parameters: <SolutionName>
Type: <string>
Example: "Setup1:LastAdaptive"
<DesignVariation>
Type: <string>
Example: "x_size = 2mm"
Example:
set oModule = oDesign.GetModule("Solutions")
fieldsExist = oModule.HasFields("Setup1:Sweep1", _
"x_size=2mm")
HasMatrixData
Use: To determine if matrix data exists for a particular solution.
Syntax: HasMatrixData(<SolutionName>, <DesignVariation>)
Return Value: Returns 1 or 0 ( 1= true, 0 = false)
Type: Boolean
Parameters: <SolutionName>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Type: <string>
Example: "Setup1:LastAdpative"
<DesignVariation>
Type: <string>
Example: "radius = 4in"
Example:
set oModule = oDesign.GetModule("Solutions")
matrixExist = 0Module.HasMatrixData("Setup1:Adaptive_1",_
"radius = 4in")
HasMesh
Use: To determine if a current mesh exists for a particular simulation setup, not
including the initial mesh.
Syntax: HasMesh(<SetupName>, <DesignVariation>)
Return Value: Returns 1 or 0 ( 1= true, 0 = false)
Type: Boolean
Parameters: <SetupName>
Type: <string>
<DesignVariation>
Type: <string>
Example:
set oModule = oDesign.GetModule("Solutions")
meshexist = oModule.HasMesh("Setup1", "x_size = 2in _
y_size = 1in")
ImportSolution
Use: Imports a matrix solution in HFSS, which can then be used in creating
reports or in the display of matrix data. The imported solution need not
have the same characteristics as the current design. Imported terminal data
that meets the required criteria can be used for full-wave Spice export. Not
used in HFSS-IE.
Command: HFSS>Results>Import Solutions
Syntax: ImportSolution <FileName>, <ImportName>, <SolnArray>
Return Value: None
Parameters: <FileName>
Type: <string>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Location of the source data. The type of the data file will be determined strictly by its
file extension. Supported types are Touchstone (.sNp or .yNp or .zNp or .tou), and
Ansoft Designer (.flp).
<ImportName>
Type: <string>
Identifying name to use for the import, analogous to solution setup name.
<SolnArray>
Type: Array of strings
The names of the solutions selected for import from the file. The only import format
supporting multiple solutions in one file is HFSS8.x format.
Example:
oModule.ImportSolution "c:\mydir\in.s2p", _
"MeasuredData", Array("Sweep1")
ImportTable
Use: Imports a data table for use in plotting reports in HFSS. Not used in HFSS-IE.
The table can have multiple independent real-valued columns of data, and
multiple dependent real- or complex-valued columns of data. The data
supported imports are either tab delimited format (.tab) or comma
delimited format (.csv). The first row may contain column names. Complex
data columns are inferred from the column data format. In tab delimited
format, "(double, double)" denotes a complex number. In comma
delimited format, "(double, double)" denotes a complex number.
Command: HFSS>Results>Import Solutions
Syntax: ImportTable
<FileName>, <ImportName>, <TableName>,
<ComplexIsRealImag>, <IsMatrixData>,
<ColNames>, <ColIndependentFlags>
Return Value: None
Parameters: <FileName>
Type: <string>
Location of the source data.
<ImportName>
Type: <string>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Identifying name to use for the import, analogous to solution setup name.
<TableName>
Type: <string>
Identifying name for the table, analogous to solution name.
<ComplexIsRealImag>
Type: <bool>
Whether to use real/imag to interpret data for any complex column.
If false, then use mag/phase(degrees).
<IsMatrixData>
Type: <bool>
Controls whether the table data can be used in matrix data reports or in field data
reports.
<ColNames>
Array("ColName1", ...)
Non-empty array used only if you want to override the column names obtained from
the table data file, in which case all column names are required.
<ColIndependentFlags>
Array(<bool>, ...)
Indicates which columns are independent. If this is the empty array, the default is that
only the first column is independent. If this is the non- empty array, a flag must be
present for every column.
Example:
oModule.ImportTable "c:\mydir\mytable.tab", _
"ImportData", "Measurements", TRUE, TRUE, _
Array(), Array(TRUE, TRUE, FALSE, FALSE, FALSE)
IsFieldAvailableAt
Use: To determine if a field solution exists for a particular frequency in a
simulation.
Syntax: IsFieldAvailableAt(<SolutionName>, <DesignVariation>,
<Freq>)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ListMatchingVariations
Use: Gets a list of solved variations that include the specified variable values.
Command: None
Syntax: ListMatchingVariations
(<FullSolutionName>, <ArrayOfMatchingVariableNames>,
<ArrayOfMatchingVariableValueStringsIncludingUits>)
Return Value: An array of strings corresponding to solved variations. The match variables
may be a partial set of design variables and the match values are one per
variable in the same order as the variables.
Parameters: <FullSolutionName>
Type: String
<ArrayOfMatchingVariableNames>
Type: String
<ArrayOfMatchingVariableValueStringsIncludingUnits>
Type: String
Example:
list = oModule.ListMatchingVariations("Setup1 : LastAdaptive",_
Array("x_size", "y_size"), Array("2mm", "1mm"))
ListValuesOfVariable
Use: Gets the values of a specified variable corresponding to the solved
variations.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Command: None
Syntax: ListValuesOfVariable(<FullSolutionName>, <VariableName>)
Return Value: An array of double precision values in SI units interpreted as the specified
variable corresponding to the solved variations.
Parameters: <FullSolutionVariableName>
Type: String
<VariableName>
Type: String
Example:
list = oModule.ListValuesOfVariable("Setup1 : _LastAdap-
tive", "x_size")
ListVariations
Use: Get a list of solved variations.
Command: None
Syntax: ListVariations(<FullSolutionName>)
Return Value: An array of strings corresponding to solved variations.
Parameters: <FullSolutionName>
Type: String
Example:
list = oModule.ListVariations("Setup1 : LastAdaptive")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
19 Field Overlays Module
Script Commands
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
CreateFieldPlot
Use: Creates a field/mesh plot.
Command: HFSS>Fields>Plot Fields>Mag_E
Syntax: CreateFieldPlot <PlotParameterArray>
Return Value: None
Parameters: <PlotParameterArray>
Array("NAME:<PlotName>",
"SolutionName:=", <string>,
"QuantityName:=", <string>,
"PlotFolder:=", <string>,
"UserSpecifyName:=", <int>,
"UserSpecifyFolder:=", <int>,
"IntrinsicVar:=", <string>,
"PlotGeomInfo:=", <PlotGeomArray>,
"FilterBoxes:=", <FilterBoxArray>,
<PlotOnPointsSettings>,
<PlotOnLineSettings>,
<PlotOnSurfaceSettings>,
<PlotOnVolumeSettings>)
SolutionName
Name of the solution setup and solution formatted as:
"<SolveSetupName> : <WhichSolution>",
where <WhichSolution> can be "Adaptive_<n>",
"LastAdaptive", or "PortOnly".
For example: "Setup1 : Adaptive_2"
HFSS requires a space on either side of the : character. If it is
missing, the plot will not be created.
QuantityName
Type of plot to create. Possible values are:
Mesh plots: "Mesh"
Field plots: "Mag_E", "Mag_H", "Mag_Jvol", "Mag_Jsurf",
"ComplexMag_E", "ComplexMag_H", "ComplexMag_Jvol",
"ComplexMag_Jsurf", "Vector_E", "Vector_H",
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
PlotFolder
Name of the folder to which the plot should be added. Possible values
are: "E Field", "H Field", "Jvol", "Jsurf", "SAR
Field", and "MeshPlots".
UserSpecifyName
0 if default name for plot is used, 1 otherwise.
Not needed. <PlotName> will be respected regardless of whether this
flag is set.
UserSpecifyFolder
0 if default folder for plot is used, 1 otherwise.
Not needed. The specified PlotFolder will be respected regardless of
whether this flag is set.
IntrinsicVar
Formatted string that specifies the frequency and phase at which to make the plot.
For example: "Freq='1GHz' Phase='30deg'"
<PlotGeomArray>
Array(<NumGeomTypes>, <GeomTypeData>,
<GeomTypeData>, ...)
For example: Array(4, "Volume", "ObjList", 1, "Box1",
"Surface", "FacesList", 1, "12", "Line", 1,
"Polyline1", "Point", 2, "Point1", "Point2")
<NumGeomTypes>
Type: <int>
Number of different geometry types (volume, surface, line, point)
plotted on at the same time.
<GeomTypeData>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<GeomType>
Type: <string>
Possible values are "Volume", "Surface", "Line", "Point".
<ListType>
Type: <string>
Possible values are "ObjList", or "FacesList".
These are used for the GeomType of "Line" or "Point".
<NumIDs>
Type: <int>
Number of IDs or object names that will follow.
<ID>
Type: <int> or <string>
ID of a face or name of an object, line, or point on which to plot.
<FilterBoxArray>
Array of names of objects to use to restrict the plot range.
Array(<NumFilters>, <ObjName>, <ObjName>, ...)
Example: Array(1, "Box1")
Example: Array(0) no filtering
<PlotOnPointSettings>
Array("NAME:PlotOnPointSettings",
"PlotMarker:=", <bool>,
"PlotArrow:=", <bool>)
<PlotOnLineSettings>
Array("NAME:PlotOnLineSettings",
Array("NAME:LineSettingsID",
"Width:=", <int>,
"Style:=", <string>),
"IsoValType:=", <string>,
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"ArrowUniform:=", <bool>,
"NumofArrow:=", <int>)
Style
Possible values are "Cylinder", "Solid", "Dashdash",
"Dotdot", "Dotdash"
IsoValType
Possible values are "Tone", "Fringe", "Gourard"
<PlotOnSurfaceSettings>
Array("NAME:PlotOnSurfaceSettings",
"Filled:=", <bool>,
"IsoValType:=", <string>,
"SmoothShade:=", <bool>,
"AddGrid:=", <bool>,
"MapTransparency:=", <bool>,
"Transparency:=", <doubl.e>,
"ArrowUniform:=", <bool>
"ArrowSpacing:=", <double>
"GridColor:=", Array(<int>, <int>, <int>)
IsoValType
Possible values are: "Tone", "Line", "Fringe", "Gourard"
GridColor
Array containing the R, G, B components of the color. Components
should be in the range 0 to 255.
<PlotOnVolumeSettings>
Array("NAME:PlotOnVolumeSettings",
"PlotIsoSurface:=", <bool>,
"CloudDensity:=", <double>,
"PointSize:=", <int>,
"ArrowUniform:=", <bool>,
"ArrowSpacing:=", <double>)
Field Overlays Module Script Commands 19-5
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Example:
oModule.CreateFieldPlot Array("NAME:Mag_E1", _
"SolutionName:=", "Setup1 : LastAdaptive", _
"QuantityName:=", "Mag_E", _
"PlotFolder:=", "E Field1", _
"UserSpecifyName:=", 0, _
"UserSpecifyFolder:=", 0, _
"IntrinsicVar:=", "Freq='1GHz' Phase='0deg'",_
"PlotGeomInfo:=", Array( 1, "Surface",_
"FacesList", 1, "7"),_
"FilterBoxes:=", Array(0),
Array("NAME:PlotOnSurfaceSettings", _
"Filled:=", false, _
"IsoValType:=", "Fringe", _
"SmoothShade:=", true, _
"AddGrid:=", false, _
"MapTransparency:=", true, _
"Transparency:=", 0, _
"ArrowUniform:=", true, _
"ArrowSpacing:=", 0.100000001490116, _
"GridColor:=", Array(255, 255, 255)))
DeleteFieldPlot
Use: Deletes one or more plots.
Command: HFSS>Fields>Delete Plot
Syntax: DeleteFieldPlot <NameArray>
Return Value: None
Parameters: <NameArray>
Array of strings the names of the plots to delete.
Example:
oModule.DeleteFieldPlot Array("Mag_E1", "Vector_E1")
GetFieldPlotNames
Use: Gets the names of field overlay plots defined in a design.
Syntax: GetFieldPlotNames()
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ModifyFieldPlot
Use: Modifies a plot definition.
Command: HFSS>Fields>Modify Plot
Syntax: ModifyFieldPlot <OriginalName> <PlotParameterArray>
Return Value: None
Example:
oModule.ModifyFieldPlot "Vector_E1",_
Array("NAME:Vector_E2", _
"SolutionName:=", "Setup1 : LastAdaptive", _
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"QuantityName:=", "Vector_E", _
"PlotFolder:=", "E Field1", _
"UserSpecifyName:=", 0, _
"UserSpecifyFolder:=", 0, _
"IntrinsicVar:=","Freq='1GHz' Phase='30deg'", _
"PlotGeomInfo:=", Array(1,_
"Surface","FacesList", 1, "7"), _
"FilterBoxes:=", Array(0), _
Array("NAME:PlotOnSurfaceSettings", _
"Filled:=", false, _
"IsoValType:=", "Fringe", _
"SmoothShade:=", true, _
"AddGrid:=", false, _
"MapTransparency:=", true, _
"Transparency:=", 0, _
"ArrowUniform:=", true, _
"ArrowSpacing:=", 0.100000001490116, _
"GridColor:=", Array(255, 255, 255)))
RenameFieldPlot
Use: Renames a plot.
Command: Right-click the plot you want to rename in the project tree, and then click
Rename on the shortcut menu.
Syntax: RenameFieldPlot <OldName> <NewName>
Return Value: None
Parameters: <OldName>
Type: <string>
Original name of the plot.
<NewName>
Type: <string>
New name of the plot.
Example:
oModule.RenameFieldPlot "Vector_E1", "Vector_E2"
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
RenamePlotFolder
Use: Renames a plot folder.
Command: Right-click a plot folder in the project tree, and then click Rename on the
shortcut menu.
Syntax: RenamePlotFolder <OldName> <NewName>
Return Value: None
Parameters: <OldName>
Type: <string>
Original name of the folder.
<NewName>
Type: <string>
New name of the folder.
Example:
oModule.RenamePlotFolder "E Field", "Surface Plots"
SetFieldPlotSettings
Use: Sets plot attributes.
Command: HFSS>Fields>Modify Plot Attributes, under the Plots tab.
Syntax: SetFieldPlotSettings <PlotName> <PlotItemAttributes>
Return Value: None
Parameters: <PlotName>
Type: <string>
Name of the plot to modify.
<PlotItemAttributes>
Array("NAME:FieldsPlotItemSettings",
<PlotOnPointsSettings>,
<PlotOnLineSettings>,
<PlotOnSurfaceSettings>,
<PlotOnVolumeSettings>)
See description of CreateFieldPlot command for details.
Example:
oModule.SetFieldPlotSettings "Mag_E2", _
Array("NAME:FieldsPlotItemSettings", _
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Array("NAME:PlotOnLineSettings", _
Array("NAME:LineSettingsID", _
"Width:=", 4,
"Style:=", "Cylinder"), _
"IsoValType:=", "Tone", _
"ArrowUniform:=", true, _
"NumofArrow:=", 100), _
Array("NAME:PlotOnSurfaceSettings", _
"Filled:=", false, _
"IsoValType:=", "Tone", _
"SmoothShade:=", true, _
"AddGrid:=", false, _
"MapTransparency:=", true, _
"Transparency:=", 0, _
"ArrowUniform:=", true, _
"ArrowSpacing:=", 0.100000001490116, _
"GridColor:=", Array(255, 255, 255)))
SetPlotFolderSettings
Use: Sets the attributes of all plots in the specified folder.
Command: HFSS>Fields>Modify Plot Attributes
Syntax: SetPlotFolderSettings <PlotFolderName>
<PlotFolderAttributes>
Return Value: None
Parameters: <PlotFolderName>
Type: <string>
Name of the folder with the attributes to modify.
<PlotFolderAttributes>
Array("NAME:FieldsPlotSettings",
"Real time mode:=", <bool>,
<ColorMapSettings>,
<Scale3DSettings>,
<Marker3DSettings>,
<Arrow3DSettings>)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<ColorMapSettings>
Array("NAME:ColorMapSettings",
"ColorMapType:=", <string>,
"SpectrumType:=", <string>,
"UniformColor:=", Array(<int>, <int>, <int>),
"RampColor:=", Array(<int>, <int>, <int>)
ColorMapType
Possible values are "Uniform", "Ramp", "Spectrum"
SpectrumType
Possible values are "Rainbow", "Temperature", "Magenta", "Gray"
UniformColor, RampColor
Array containing the R, G, B components of the color. Components should be in the
range 0 to 255.
<Scale3DSettings>
Array("NAME:Scale3DSettings",
"m_nLevels:=", <int>,
"m_autoScale:=", <bool>,
"minvalue:=", <double>,
"maxvalue:=", <double>,
"log:=", <bool>,
"IntrinsicMin:=", <double>,
"IntrinsicMax:=", <double>)
<Marker3DSettings>
Array("NAME:Marker3DSettings",
"MarkerType:=", <int>,
"MarkerMapSize:=", <bool>,
"MarkerMapColor:=", <bool>,
"MarkerSize:=", <double>)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
MarkerType
9: Sphere
10: Box
11: Tetrahedron
12: Octahedron
default: Sphere
<Arrow3DSettings>
Array("NAME:Arrow3DSettings",
"ArrowType:=", <int>,
"ArrowMapSize:=", <bool>,
"ArrowMapColor:=", <bool>,
"ShowArrowTail:=", <bool>,
"ArrowSize:=", <double>)
ArrowType
0: Line
1: Cylinder
2: Umbrella
default: Line
Example:
oModule. SetPlotFolderSettings "E Field1", _
Array("NAME:FieldsPlotSettings", _
"Real time mode:=", true, _
Array("NAME:ColorMapSettings", _
"ColorMapType:=", "Spectrum", _
"SpectrumType:=", "Rainbow", _
"UniformColor:=", Array(127, 255, 255), _
"RampColor:=", Array(255, 127, 127)), _
Array("NAME:Scale3DSettings", _
"m_nLevels:=", 27, _
"m_autoScale:=", true, _
"minvalue:=", 9.34379863739014, _
"maxvalue:=", 13683.755859375, _
"log:=", false, _
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"IntrinsicMin:=", 9.34379863739014, _
"IntrinsicMax:=", 13683.755859375), _
Array("NAME:Marker3DSettings", _
"MarkerType:=", 0, _
"MarkerMapSize:=", true, _
"MarkerMapColor:=", false, _
"MarkerSize:=", 0.25), _
Array("NAME:Arrow3DSettings", _
"ArrowType:=", 1, _
"ArrowMapSize:=", true, _
"ArrowMapColor:=", true, _
"ShowArrowTail:=", true, _
"ArrowSize:=", 0.25))
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
20 Fields Calculator Script
Commands
The command associated with each of the following scripting commands will
be a button pressed in the Fields Calculator.
AddNamedExpression
AddNamedExpr
CalcOp
CalculatorRead
CalcStack
CalculatorWrite
ChangeGeomSettings
ClcEval
ClcMaterial
ClearAllNamedExpr
CopyNamedExprToStack
DeleteNamedExpr
EnterComplex
EnterComplexVector
EnterLine
EnterPoint
Fields Calculator Script Commands 20-1
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EnterQty
EnterScalar
EnterScalarFunc
EnterSurf
EnterVector
EnterVectorFunc
EnterVol
ExportOnGrid
ExportToFile
GetTopEntryValue
LoadNamedExpressions
SaveNamedExpressions
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
AddNamedExpression
Use: Creates a named expression using the expression at the top of the stack.
Command: Click Add.
Syntax: AddNamedExpression <Name>
Return Value: None
Parameters: <ExpressionName> and <FieldType>.
Type: <string>
Name for the new named expression.
<FieldType>
Type: <string>
Example:
oModule.AddNamedExpression "Mag_JxE", "Fields"
AddNamedExpr
Use: Creates a named expression using the expression at the top of the stack.
Command: Click Add.
Syntax: AddNamedExpr <Name>
Return Value: None
Parameters: <ExpressionName>
Type: <string>
Name for the new named expression.
<FieldType>
Type: <string>
Example:
oModule.AddNamedExpr "Mag_JxE", "Fields"
CalcOp
Use: Performs a calculator operation.
Command: Operation commands like Mag, +, etc.
Syntax: CalcOp <OperationString>
Return Value: None
Parameters: <OperationString>
Type: String
The text on the corresponding calculator button.
Examples: Mag, +
Fields Calculator Script Commands 20-3
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
CalculatorRead
Use: Gets a register file and applies it to the calculator stack.
Command: Click Read
Syntax: CalculatorRead <InputFilePath>, <SolutionName>,
<FieldType>, <VariablesArray>
Return Value: None
Parameters: <InputFilePath>
Path to and including name of input register file.
<SolutionName>
Type: <string>
Example: "Setup1 : LastAdaptive"
<FieldType>
Type: <string>
<VariablesArray>
Array of variable names, value pairs.
Example:
oModule.CalculatorRead "c:\test.reg", _
"Setup1 : LastAdaptive", "Fields", _
Array("Freq:=", "1GHz", "Phase:=", "0deg")
CalcStack
Use: Performs an operation on the stack.
Command: Stack operation buttons such as Push and Pop.
Syntax: CalcStack <OperationString>
Return Value: None
Parameters: <Operation String>
Type: <string>
The text on the corresponding calculator button.
Example:
oModule.CalcStack "push"
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
CalculatorWrite
Use: Writes contents of top register to file.
Command: Click Write
Syntax: CalculatorWrite <OutputFilePath>, <SolutionNameArray>,
<VariablesArray>
Return Value: None
Parameters: <OutputFilePath>
Path to and including name of output register file.
<SolutionNameArray>
Array("Solution:=", <string>)
<VariablesArray>
Array of variable names, value pairs.
Example:
oModule.CalculatorWrite "c:\test.reg", _
Array("Solution:=", "Setup1 : LastAdaptive"), _
Array("Freq:=", "1GHz", "Phase:=", "0deg")
ChangeGeomSettings
Use: Changes the line discretization setting.
Command: Geom Settings
Syntax: ChangeGeomSettings <int>
Return Value: None
Parameters: The line discretization setting.
ClcEval
Use: Evaluates the expression at the top of the stack using the provided solution
name and variable values.
Command: Click Eval.
Syntax: ClcEval <SolutionName> <VariablesArray>
Return Value: None
Parameters: <SolutionName>
Type: <string>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<VariablesArray>
Array of variable name, value pairs.
Example:
oModule.ClcEval "Setup1: LastAdaptive", _
Array ("Freq:=", "10GHz",_
"Phase:=", "0deg")
ClcMaterial
Use: Performs a material operation on the top stack element.
Command: Click Matl.
Syntax: ClcMaterial <MaterialString>, <OperationString>
Return Value: None
Parameters: <Material String>
Type: <string>
The material property to apply.
<OperationString>
Type: <string>
Possible values are "mult", or "div".
Example:
oModule.ClcMaterial "Permeability (mu)" "mult"
ClearAllNamedExpr
Use: Clears all user-defined named expressions from the list.
Command: Click ClearAll.
Syntax: ClearAllNamedExpr
Return Value: None
Parameters: None
CopyNamedExprToStack
Use: Copies the named expression selected to the calculator stack.
Command: Select a named expression and then click Copy to stack.
Syntax: CopyNamedExprToStack <Name>
Return Value: None
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Parameters: <Name>
Type: <string>
The name of the expression to be copied to the top of the stack.
Example:
oModule.CopyNamedExprToStack "Mag_JxE"
DeleteNamedExpr
Use: Deletes the selected named expression from the list.
Command: Select a named expression and then click Delete.
Syntax: DeleteNamedExpr <Name>
Return Value: None
Parameters: <Name>
Type: <string>
The name of the named expression to be deleted.
Example:
oModule.DeleteNamedExpr "Mag_JxE"
EnterComplex
Use: Enters a complex number onto the stack.
Command: Click Number, and then click Scalar. Complex option is selected.
Syntax: EnterComplex "<Real> + <Imaginary> j"
Return Value: None
Parameters: <Real>
Type: <double>
Real component of the scalar.
<Imaginary>
Type: <double>
Imaginary component of the scalar.
Example:
oModule.EnterComplex "1 + 2 j"
EnterComplexVector
Use: Enters a complex vector onto the stack.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Command: Click Number, and then click Vector. Complex option is selected.
Syntax: EnterComplexVector Array ("<X Re> + <X Im> j",
"<Y Re> + <Y Im> j", "<Z Re> + <Z Im> j")
Return Value: None
Parameters: <X Re>, <YRe>, <ZRe>
Type: <double>
Real components of the X, Y, and Z values respectively.
EnterLine
Use: Enters a line defined in the 3D Modeler editor.
Command: Click Geometry and then select Line.
Syntax: EnterLine <LineName>
Return Value: None
Parameters: <LineName>
Type: <string>
Name of a line defined in the 3D Modeler editor.
Example:
oModule.EnterLine "Line1"
EnterPoint
Use: Enters a point defined in the 3D Modeler editor.
Command: Click Geometry and then select Point.
Syntax: EnterPoint <PointName>
Return Value: None
Parameters: <PointName>
Type: <string>
Name of a point defined in the 3D Modeler editor.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Example:
oModule.EnterPoint "Point1"
EnterQty
Use: Enters a field quantity.
Command: Click Quantity, and then select from the list.
Syntax: EnterQty <FieldQuantityString>
Return Value: None
Parameters: <Field Quantity String>
Type: <string>
The field quantity to be entered onto the stack.
Example:
oModule.EnterQty "E"
EnterScalar
Use: Enters a scalar onto the stack.
Command: Click Number and then click Scalar. Complex option not selected.
Syntax: EnterScalar <Scalar>
Return Value: None
Parameters: <Scalar>
Type: <double>
The real number to enter onto the stack.
EnterScalarFunc
Use: Enters a scalar function.
Command: Click Function and then select Scalar.
Syntax: EnterScalarFunc <VarName>
Return Value: None
Parameters: <VarName>
Type: <string>
Name of a variable to enter as a scalar function onto the stack.
Example:
oModule.EnterScalarFunc "Phase"
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EnterSurf
Use: Enters a surface defined in the 3D Modeler editor.
Command: Click Geometry and then select Surface.
Syntax: EnterSurf <SurfaceName>
Return Value: None
Parameters: <SurfaceName>
Type: <string>
Name of a surface defined in the 3D Modeler editor.
Example:
oModule.EnterSurf "Rectangle1"
EnterVector
Use: Enters a vector onto the stack.
Command: Click Number, and then click Vector. Complex option not selected.
Syntax: EnterVector Array (<X>, <Y>, <Z>)
Return Value: None
Parameters: <X>
Type: <double>
X component of the vector.
<Y>
Type: <double>
Y component of the vector.
<Z>
Type: <double>
Z component of the vector.
Example:
oModule.EnterVector Array (1.0, 1.0, 1.0)
EnterVectorFunc
Use: Enters a vector function.
Command: Click Function and then select Vector.
Syntax: EnterVectorFunc Array(<XVarName>, <YVarName>,
<ZVarName>)
20-10 Fields Calculator Script Commands
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EnterVol
Use: Enters a volume defined in the 3D Modeler editor.
Command: Click Geometry and then select Volume.
Syntax: EnterVol <VolumeName>
Return Value: None
Parameters: <VolumeName>
Type: <string>
Name of a volume defined in the 3D Modeler editor.
Example:
oModule.EnterVol "Box1"
ExportOnGrid
Use: Evaluates the top stack element at a set of points specified by a grid and
exports the data to a file.
Command: Click Export, and then click On Grid.
Syntax: ExportOnGrid <OutputFile> <MinArray> <MaxArray>
<SpacingsArray>, <setup>, <Boolean>, <coordinate system>
[<CS Offset Array>]
Return Value: None
Parameters: <OutputFile>
Type: <string>
Name of the output file.
<MinArray>, <MaxArray>, <SpacingsArray>
Type: Array<double, double, double>
Min, Max, and Spacing for the coordinate components of the grid system, Cartesian
(default), Cylindrical or Spherical.
<setup>
Type: <string>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ExportToFile
Use: Evaluates the top stack element at a set of points specified in an external
file and exports the data to a file.
Command: Click Export, and then click To File.
Syntax: ExportToFile <OutputFile> <PtsFile>
Return Value: None
Parameters: <OutputFile>
Type: <string>
Name of the output file.
<PtsFile>
Type: <string>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Name of the file containing the points at which to evaluate the top stack element. The
file should contain tab- or space-separated x,y,z values of data points.
GetTopEntryValue
Use: Gets the value of the top entry of the calculator stack.
Syntax: GetTopEntryValue(<SolutionName>, <VariablesArray>)
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: <SolutionName>
Type: <string>
Example: "Setup1: LastAdaptive"
<VariablesArray>
Array of variable name, value pairs.
Example:
dim topvalue
topvalue = _
oModule.GetTopEntryValue("Setup1:LastAdaptive", _
Array("Freq:=", "1GHz", "Phase:=", "0deg", _
"x_size:=", "2mm"))
If cdbl(topvalue(0)) <- 180.0 then ...
LoadNamedExpressions
Use: Loads a named expression definition from a saved file.
Command: In the Fields Calculator, click Load From... in the Library area.
Syntax: LoadNamedExpressions <FileName>, <FieldType>,
<NamedExpressions>
Return Value: None
Parameters: <FileName>
Type:<String>
Filename and full path to the file to hold the named expression definition.
<FieldType>
Type:<String>
For products with just one filed type, it is set to "Fields".
<NamedExpressions>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
SaveNamedExpressions
Use: Saves a named expression definition to a file.
Command: In the Fields Calculator, click Save To... in the Library area.
Syntax: SaveNamedExpressions <FileName>, <NamedExpressions>,
<BooleanFlag>
Return Value: None
Parameters: <FileName>
Type:<String>
Filename and full path to the file to hold the named expression definition.
<NamedExpressions>
Type: Array<string, string,...>
Array of strings containing the names of expression definitions to load from the file.
<BooleanFlag>
Type:<Boolean>
True: Overwrite the file.
False: Append to the file.
Example:
oModule.SaveNamedExpressions "C:\Ansoft\Personal-
Lib\smth.clc", Array("smoothedtemp"), true
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
21 Radiation Module Script
Commands
<SetupName>
Type: <string>
Name of a radiation setup.
<FaceListName>
Type: <string>
Name of a qualifying face list. Used for specifying custom radiation surfaces. In order
to be valid for use in a radiation surface, the face list should not contain any faces on
PML objects and should contain only model faces.
<CSName>
Type: string
Name of a coordinate system.
General Commands Recognized by the Radiation Module
Script Commands for Creating and Modifying Radiation Setups
Script Commands for Modifying Antenna Array Setups
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Script Commands for Exporting Antenna Parameters and Max Field Parameters
DeleteFarFieldSetup
Use: Deletes an existing far-field setup.
Command: Delete command in the List dialog box. Click HFSS>List to access the List
dialog box.
Syntax: DeleteFarFieldSetup <NameArray>
Return Value: None
Parameters: <NameArray>
Type: Array of strings.
An array of radiation setup names.
Example:
oModule.DeleteFarFieldSetup Array("Infinite Sphere1")
DeleteNearFieldSetup
Use: Deletes an existing near-field setup (line and sphere).
Command: Delete command in the List dialog box. Click HFSS>List to access the List
dialog box.
Syntax: DeleteNearFieldSetup <NameArray>
Return Value: None
Parameters: <NameArray>
Type: Array of strings.
An array of radiation setup names.
Example:
oModule.DeleteNearFieldSetup Array("Line1", "Sphere1")
GetSetupNames
Use: Gets the names of far field and near field radiation setups in a design.
Syntax: GetSetupNames(<RadiationType>)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<NewName>
Type: <string>
Example:
oModule.RenameSetup "Sphere1", "MyNearSphere"
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
EditFarFieldSphereSetup
Use: Modifies an existing far-field infinite sphere setup.
Command: Double-click a radiation setup in the project tree to modify its settings.
Syntax: EditFarFieldSphereSetup <InfSphereParams>
Return Value: None
Example:
oModule.EditFarFieldSphereSetup Array("NAME:InfSphere",_
"UseCustomRadiationSurface:=", true, _
"CustomRadiationSurface:=", "FaceList1", _
"ThetaStart:=", "0deg", _
"ThetaStop:=", "180deg", _
"ThetaStep:=", "10deg", _
"PhiStart:=", "15deg", _
"PhiStop:=", "36deg", _
"PhiStep:=", "10deg", _
"UseLocalCS:=", false)
EditNearFieldLineSetup
Use: Modifies an existing near-field line setup.
Command: Double-click the radiation setup in the project tree to modify its settings.
Syntax: EditNearFieldLineSetup <LineParams>
Return Value: None
Example:
oModule.EditNearFieldLineSetup Array("NAME:MyLine", _
"UseCustomRadiationSurface:=", false, _
"Line:=", "Polyline2", _
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"NumPts:=", "100")
EditNearFieldSphereSetup
Use: Modifies an existing near-field sphere setup.
Command: Double-click a radiation setup in the project tree to modify its settings.
Syntax: EditNearFieldSphereSetup <SphereParams>
Return Value: None
Example:
oModule.EditNearFieldSphereSetup Array("NAME:MySphere", _
"UseCustomRadiationSurface:=", true, _
"CustomRadiationSurface:=", "FaceList1", _
"Radius:=", "35mm", _
"ThetaStart:=", "0deg", "ThetaStop:=", "180deg", _
"ThetaStep:=", "10deg", "PhiStart:=", "15deg", _
"PhiStop:=", "36deg", "PhiStep:=", "10deg", _
"UseLocalCS:=", false)
Example: Partial values can be specified, in which case default values will be used to
populate the rest of the fields:
oModule.EditNearFieldSphereSetup "NAME:MyInfSphere", _
Array("NAME:MySphere", _
"UseCustomRadiationSurface:=", true, _
"CustomRadiationSurface:=", "FaceList1", _
"Radius:=", "45mm")
This will cause default values to be used for the rest of the fields such as
ThetaStop, ThetaStart, ThetaStep, PhiStep, PhiStart, and
PhiStop;however, the value for the key CustomRadiationSurface has
to be specified if custom radiation surfaces are used.
InsertFarFieldSphereSetup
Use: Creates/inserts a far-field infinite sphere radiation setup.
Command: HFSS>Radiation>Insert Far Field Setup>Infinite Sphere
Syntax: InsertFarFieldSphereSetup <InfSphereParams>
Return Value: None
Parameters: <InfSphereParams>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Array("NAME:<SetupName>",
"UseCustomRadiationSurface:=", <bool>,
"CustomRadiationSurface:=", <FaceListName>,
"ThetaStart:=", <value>,
"ThetaStop:=", <value>,
"ThetaStep:=", <value>,
"PhiStart:=", <value>,
"PhiStop:=", <value>,
"PhiStep:=", <value>,
"UseLocalCS:=", <bool>,
"CoordSystem:=", <CSName>)
UseCustomRadiationSurface
If true, provide CustomRadiationSurface parameter.
If false, radiation boundary/PML boundaries will be used as radiation surfaces.
UseLocalCS
If true, provide CoordSystem parameter.
If false, global coordinate system will be used.
Example:
oModule.InsertFarFieldSphereSetup
Array("NAME:InfiniteSphere1",_
"UseCustomRadiationSurface:=", false, _
"ThetaStart:=", "0deg",_
"ThetaStop:=", "180deg",_
"ThetaStep:=", "10deg",_
"PhiStart:=", "0deg",_
"PhiStop:=", "36deg",_
"PhiStep:=", "10deg",_
"UseLocalCS:=", true,_
"CoordSystem:=", "RelativeCS1")
InsertNearFieldLineSetup
Use: Inserts a near-field line setup. Requires the presence of lines in the model.
Command: HFSS>Radiation>Insert Near Field Setup>Sphere
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<PolyLineName>
Type: String.
Name of the polyline as determined by name in the history tree.
UseCustomRadiationSurface
If true, provide CustomRadiationSurface parameter.
If false, radiation boundary/PML boundaries will be used as radiation surfaces.
Example:
oModule.InsertNearFieldLineSetup Array("NAME:MyLine", _
"UseCustomRadiationSurface:=", false, _
"Line:=", "Polyline1", _
"NumPts:=", "100")
InsertNearFieldSphereSetup
Use: Creates/inserts a near-field sphere radiation setup.
Command: HFSS>Radiation>Insert Near Field Setup>Sphere
Syntax: InsertNearFieldSphereSetup <SphereParams>
Return Value: None
Parameters: <SphereParams>
Array("NAME:<SetupName>",
"UseCustomRadiationSurface:=", <bool>,
"CustomRadiationSurface:=", <FaceListName>,
"Radius:=", <value>,
"ThetaStart:=", <value>,
"ThetaStop:=", <value>,
"ThetaStep:=", <value>,
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"PhiStart:=", <value>,
"PhiStop:=", <value>,
"PhiStep:=", <value>,
"UseLocalCS:=", <bool>,
"CoordSystem:=", <CSName>)
UseCustomRadiationSurface
If true, provide CustomRadiationSurface parameter.
If false, radiation boundary/PML boundaries will be used as radiation surfaces.
UseLocalCS
If true, provide CoordSystem parameter.
If false, global coordinate system will be used.
Example:
oModule.InsertNearFieldSphereSetup _
Array("NAME:MySphere", _
"UseCustomRadiationSurface:=", true, _
"CustomRadiationSurface:=", "FaceList1", _
"ThetaStart:=", "0deg", "ThetaStop:=", "180deg", _
"ThetaStep:=", "10deg", "PhiStart:=", "0deg", _
"PhiStop:=", "360deg", "PhiStep:=", "10deg", _
"UseLocalCS:=", true, _
"CoordSystem:=", "FaceCS1")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"UseOption:=", <ArrayOption>,
<RegularArrayParams>,
<CustomArrayParams>)
<ArrayOption>
Type: <string>
Can be one of three strings: "NoArray", or "RegularArray",
"CustomArray".
If "RegularArray" is specified, then <RegularArrayParams> must
be specified. If "CustomArray" is specified, <CustomArrayParams>
must be specified. You can also supply both the custom and regular
array specifications and switch between them by setting this flag to the
option you want to use.
<RegularArrayParams>
Array("NAME:RegularArray",
"NumUCells:=", <value>,
"NumVCells:=", <value>,
"CellUDist:=", <value>,
"CellVDist:=", <value>,
"UDirnX:=", <value>,
"UDirnY:=", <value>,
"UDirnZ:=", <value>,
"VDirnX:=", <value>,
"VDirnY:=", <value>,
"VDirnZ:=", <value>,
"FirstCellPosX:=", <value>,
"FirstCellPosY:=", <value>,
"FirstCellPosZ:=", <value>,
"UseScanAngle:=", <bool>,
"ScanAnglePhi:=", <value>,
"ScanAngleTheta:=", <value>,
"UDirnPhaseShift:=", <value>,
"VDirnPhaseShift:=", <value>)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
UseScanAngle
If true, the values of the ScanAnglePhi and ScanAngleTheta
parameters will be used and need to be specified.
If false, the values of the UDirnPhaseShift and VDirnPhaseShift
parameters will be used and must be specified.
<CustomArrayParams>
Array("NAME:CustomArray",
"NumCells:=", <int>,
<CellsParamsArray
<CellsParamsArray>
Array("NAME:Cell",
<CellParams>, <CellParams>, ...)
<CellParams>
Array("Name:<CellName>",
"XCoord:=", <double>,
"YCoord:=", <double>,
"ZCoord:=", <double>,
"Amplitude:=", <double>,
"Phase:=", <double>)
The <double> values above should be in SI units.
<CellName>
Type: <string>
Format is: "Cell_n"
Replace n with the index number of the cell, for example: "Cell_1"
Example: Using the "NoArray" option:
oModule.EditAntennaArraySetup _
Array("NAME:ArraySetupInfo", "UseOption:=", "NoArray")
Example: Using the "RegularArray" option:
oModule.EditAntennaArraySetup _
Array("NAME:ArraySetupInfo",_
"UseOption:=", "RegularArray", _
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Array("NAME:RegularArray", _
"NumUCells:=", "10", "NumVCells:=", "10",_
"CellUDist:=", "10mm", "CellVDist:=", "10mm", _
"UDirnX:=", "1", "UDirnY:=", "0", "UDirnZ:=", _
"0", _
"VDirnX:=", "0", "VDirnY:=", "1", "VDirnZ:=",_
"0", _
"FirstCellPosX:=", "0mm", _
"FirstCellPosY:=", "0mm", _
"FirstCellPosZ:=", "0mm",
"UseScanAngle:=", true, _
"ScanAnglePhi:=","45deg", _
"ScanAngleTheta:=", "45deg"))
Example: Using the "CustomArray" option:
oModule.EditAntennaArraySetup _
Array("NAME:ArraySetupInfo",
"UseOption:=", "CustomArray",_
Array("NAME:CustomArray", _
"NumCells:=", 3,_
Array("NAME:Cell", _
Array("NAME:Cell_1", _
"XCoord:=", 0, "YCoord:=", 0, "ZCoord:=",0,_
"Amplitude:=", 1, "Phase:=", 0), _
Array("NAME:Cell_2", _
"XCoord:=",0.06729,"YCoord:=","ZCoord:=",0,_
"Amplitude:=", 1, "Phase:=", 0), _
Array("NAME:Cell_3", _
"XCoord:=",0.13458,"YCoord:=",0,"ZCoord:=",0,_
"Amplitude:=", 1, "Phase:=", 0))))
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
<FilePath>
Type: String.
Specifies the file to export to, for example: "C:\projects\exportantparams.txt".
IntrinsicVariationKey
Specifies the frequency at which to extract the parameters. Example:
"Freq='10GHz'"
DesignVariationKey
Specifies the design variations at which to extract the parameters. Example:
"width=5mm"
Example:
oModule.ExportRadiationParametersToFile _
Array("ExportFileName:=", _
"C:\projects\exportantparams.txt",_
"SetupName:=", "Infinite Sphere1", _
"IntrinsicVariationKey:=", "Freq='10GHz'", _
"DesignVariationKey:=", "",
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
"SolutionName:=", "LastAdaptive")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
22 User Defined Solutions
Commands
CreateUserDefinedSolution
DeleteUserDefinedSolutions
EditUserDefinedSolution
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
CreateUserDefinedSolution
Use: Creates a new user defined solution.
Command: Create User Defined Solution popup menu is available in the Result folder
context menu when applicable.
Syntax: CreateUserDefinedSolution <SolutionName>,
<PluginFileLocation>, <PluginFileRelativePathName>,
<PropertyValuesArray>, <ProbeSelectionArray>,
<DynamicProbesArray>
Return Value: The name of the user defined solution that was created. Note: if the
requested user defined solution name is not available because it is already
in use, the user defined solution will be created with a different name
which will be returned.
Parameters: <SolutionName>
Type: String
Requested name of new user defined solution.
<PluginFileLocation>
Type: String
Indicates the library where the UDS plugin file is located. This parameter must be one
of the following values: "SysLib", "UserLib", "PersonalLib".
<PluginFileRelativePathName>
Type: String
The path of the UDS plugin file relative to the "UserDefinedOutputs"subdirectory of
the library specified by <PluginFileLocation>.
<PropertyValuesArray>
Type: Array of strings
Strings specify name-value pairs corresponding to the UDS properties specified in the
plugin file.
For example:
Array("multiply_factor:=", "2.0", "component_name:=", "resistor1")
<ProbeSelectionArray>
Type: Array of <ProbeSelection>'s (see below)
The probe specification array specifies how UDS probes are defined and mapped to
traces in the design.
<ProbeSelection>
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Type: Array of strings representing how a single probe is defined by a trace. The
array contains the below items:
<ReportType>
Type: String
See the CreateReport command for more information.
<ProbeName>
Type: String
Name of the probe being specified. Note: this must match a probe name specified in
the UDS plugin file.
<SolutionName>
Type: String
See the CreateReport command for more information.
<SimulatedValueContexArray>
Type: Array of strings
See the CreateReport command for more information.
<PointSetDefinitionArray>
Type: Array of values with optional overriding values and optional
variable values.
See the CreateReport command for more information.
<TraceExpressionArray>
Type: Array of strings and values.
This is similar to the TracesExpressionsArray used in the CreateReport command, but
there will only be a single component expression named "Probe Component." See the
CreateReport command for more information.
<ExtendedTraceInformationArray>
Type: Array of strings and values
See the CreateReport command for more information.
<DynamicProbesArray>
Type: Array of <ProbeSelection>'s, representing the probes that are used by dynamic-
probes.
Example:
oModule.CreateUserDefinedSolution "User Defined Solution 1", _
"SysLib", "Example",
Array("multiplication_factor:=", "1.2"),
Array(Array("Modal Solution Data",
"Probe 1", "Setup1 : LastAdaptive",
Array(),
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
DeleteUserDefinedSolutions
Use: Deletes one or more user defined solutions
Command: 'Delete' button from the "User Defined Solutions" dialog.
Syntax: DeleteUserDefinedSolutions <UserDefinedSolutionNames>
Return Value: None
Parameters:
<UserDefinedSolutionNames>
Type: Array of strings
Name of User Defined Solutions to be deleted.
Example: Example:
oModule.DeleteUserDefinedSolutions Array("Solution1", "Solution2")
EditUserDefinedSolution
Use: Updates an existing user defined solution
Command: Command: 'Edit' button in the User Defined Solutions dialog
Syntax: Syntax: EditUserDefinedSolution <ExistingSolutionName>,
<NewSolutionName>, <PluginFileLocation>,
<PluginFileRelativePathName>, <PropertyValuesArray>,
<ProbeSelectionArray>, <DynamicProbesArray>
Return Value: Return Value: the name of the user defined solution after being updated.
Note: if the requested user defined solution name is not available because
it is already in use, the user defined solution will be created with a different
name which will be returned.
Parameters:
<ExistingSolutionName>
Type: String
Name of the existing user defined solution
<NewSolutionName>
22-4 User Defined Solutions Commands
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Type: String
Requested name for the updated user defined solution.
<PluginFileLocation>
See CreateUserDefinedSolution for more information.
<PluginFileRelativePathName>
See CreateUserDefinedSolution for more information.
<PropertyValuesArray>
See CreateUserDefinedSolution for more information.
<ProbeSelectionArray>
See CreateUserDefinedSolution for more information.
<DynamicProbesArray>
See CreateUserDefinedSolution for more information.
Example:
oModule.EditUserDefinedSolution "User Defined Solution 1", _
"User Defined Solution 2",
"SysLib", "Example", Array("multiplication_factor:=", "1.2"),
Array(Array("Modal Solution Data", "Probe 1",
"Setup1 : LastAdaptive", Array(),
Array("Freq:=", Array("All")),
Array("Probe Component:=", Array("dB(S(1,1))")), Array()),
Array( "Modal Solution Data", "Probe 2",
"Setup1 : LastAdaptive", Array(),
Array("Freq:=", Array( "All")),
Array("Probe Component:=", Array("mag(S(1,1))")), Array())),
Array(Array("Modal Solution Data",
"Dynamic Probe 1",
"Setup1 : LastAdaptive", Array(),
Array("Freq:=", Array("All")),
Array("Probe Component:=", Array("Freq")), Array()))
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
23 NdExplorer Script
Commands
The definition manager controls the use of NdExplorer for HFSS scripts.
Set oProject = oDesktop.SetActiveProject("Project1")
Set oDefinitionManager = oProject.GetDefinitionManager()
ExportFullWaveSpice [NdExplorer]
NdeExportFullWaveSpice
Use: Export FullWaveSpice data in a format of your choice.
Command: File > Export MacroModel > Broadband (SYZ, FWS.)
Syntax: ExportFullWaveSpice
"DesignName", // Design name. Can be left blank, if loading solution from a file.
true/false, // true - solution loaded from file, false- loaded from design
"Name", // If loading from design this is the solution name, else this is the
// full path of the file from which the solution is loaded
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
"variation", // Pick a particular variation. Leave blank if no variation.
Array("NAME:Frequencies"), // Optional; if none defined all frequencies are used
Array("NAME:SpiceData", // Spice export options object
"SpiceType:=", "SSS", // SpiceType can be "PSpice", "HSpice", "Spec-
tre", "SSS",
// "Simplorer", "TouchStone1.0", "TouchStone2.0"
"EnforcePassivity:=", false, // Enforce Passivity true/false
"EnforceCausality:=", false, // Enforce Causality true/false
"UseCommonGround:=", false, // Use common ground true/false
"FittingError:=", 0.5, // Fitting error
"MaxPoles:=", 400, // Maximum Order
"PassivityType:=", "ConvexOptimization", // Passivity Type can be "ConvexOptimi-
zation",
// "PassivityByPerturbation", or "IteratedFittingOfPV"
"ColumnFittingType:=", "Column", // Column FittingType can be "Column",
"Entry", "Matrix"
"SSFittingType:=", "TWA", // SS Fitting Type can be "TWA", "IterativeRational"
"RelativeErrorToleranc:=", false, // Relative error tolerance true/false
"TouchstoneFormat:=", "MA", // Touchstone Format "MA", "RI", "DB"
"TouchstoneUnits:=", "Hz", // Touchstone Units "Hz", "KHz", "MHz",
"MHz"
"TouchStonePrecision:=", 8, // Touchstone precision
"ExportDirectory:=", "C:/Examples/LNA/", // Directory to export to
"ExportSpiceFileName:=", "Linckt_HBTest_2.sss", // Spice export file
"FullwaveSpiceFileName:=", "Linckt_HBTest.sss", // FWS file
"CreateNPortModel:=", true // Create a model based on the exported file true/false
)
ExportNetworkData [NdExplorer]
NdeExportNetworkData
Use: Export the solution in a format of your choice (Citifile, Spreadsheet, Matlab)
Command: File > Export SYZ Data
Syntax: ExportNetworkData
"DesignName", // Design name. Can be left blank, if loading solution from a file.
true/false, // true - solution loaded from file, false- loaded from design
"Name", // If loading from design this is the solution name, else this is the
-2 NdExplorer Script Commands
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
// full path of the file from which the solution is loaded
"ExportFile", // full path of file to export to
"variation", // Pick a particular variation. Leave blank if no variation
Array("NAME:Frequencies"), // optional, if none defined all frequencies are used
Array("NAME:Options", // Export options object
"DataTypes:=", Array("S"), // DataTypes can be "S", "Y","Z", "G", and "Z0",
// for S , Y, Z matrix, Gamma and Z0 (zero)
"DisplayFormat:=", "MA", // DisplayFormat "MA", "RI", "DB"
"FileType:=", "", // Export File Type
// 2 - Spreadsheet(*.tab)
// 3 - Touchstone(*.sNp)
// 4 - Citifile(*.cit)
// 6 - Neutral format(*.nmf)
// 7 - Matlab format(*.m)
"Renormalize:=", false, // Renormalize true/false
"RefImpedance:=",50, // Reference Impedance
"Precision:=", 8, // Number of digits Precision
"CreateNPortModel:=", true // Create a model based on the exported file true/false
)
ExportNMFData [NdExplorer]
NdeExportNMFData
Use: Export the solution in NMF format.
Command: File > Export SYZ Data
Syntax: ExportNMFData
"DesignName", // Design name. Can be left blank, if loading solution from a file.
true/false, // true - solution loaded from file, false- loaded from design
"Name", // If loading from design this is the solution name, else this is the
// full path of the file from which the solution is loaded
"ExportFile", // full path of file to export to
Array("NAME:Frequencies"), // optional, if none defined all frequencies are used
Array("NAME:NMFOptions", // Export NMF options object
"DataTypes:=", Array("S"), // DataTypes can be "S", "Y","Z", "G", and "Z0",
// for S , Y, Z matrix, Gamma and Z0 (zero)
"DisplayFormat:=", "MA", // DisplayFormat "MA", "RI", "DB"
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
"FileType:=", "", // Export File Type
// 2 - Spreadsheet(*.tab)
// 3 - Touchstone(*.sNp)
// 4 - Citifile(*.cit)
// 6 - Neutral format(*.nmf)
// 7 - Matlab format(*.m)
"Renormalize:=", false, // Renormalize true/false
"RefImpedance:=",50, // Reference Impedance
"Precision:=", 8, // Number of digits Precision
"Variables:=", ARRAY("FF", "cap", "Rs") // Array of variables
"Variations:=", ARRAY("", "", "") // Array of variations to export solutions for
Array("NAME:ConstantVars") // Array of variables that are constant, can be
empty
Array("NAME: DependentVars") // Array of variables that are dependent, can be
empty
"MatrixSize:=", 2, // Matrix size, optional (used in nmf file header)
"CreateNPortModel:=", true // Create a model based on the exported file true/false
)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
23 Example Scripts
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("AnsoftHfss.HfssScriptInterface")
Set oDesktop = oAnsoftApp.GetAppDesktop()
Set oProject = oDesktop.GetActiveProject()
Set oDesign = oProject.GetActiveDesign()
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
Declare the arrays and variables needed for building the polyline.
Dim points(), segments()
Dim NumPoints, R(2), P(2), PointsPerTurn, Turns, Units
Establish the constant Pi.
Pi = 4*Atn(1)
Retrieve the variable helix parameters from the user.
Start with the input for unit selection.
Units = InputBox("Select the units:"&Chr(13)& _
"(cm,mm,um,in,mil)", "Variable Helix","mil",50,50)
Check to make sure it is a valid unit.
Select Case Units
Case "m"
Units = ""
Case "cm"
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Case "mm"
Case "um"
Case "in"
Case "mil"
Case Else
MsgBox("Invalid Units - defaults to m")
Units = ""
End Select
Redim points(NumPoints+1)
Redim segments(NumPoints)
points(0) = "NAME:PolylinePoints"
segments(0) = "NAME:PolylineSegments"
Build the Point and Segment Arrays needed in the HFSS polyline call.
For n = 1 To (NumPoints+1)
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Angle = (n-1)*2*Pi/PointsPerTurn
Radius = R(0) + ((n-1)/NumPoints)*(R(1)-R(0))
Pitch = P(0) + ((n-1)/NumPoints)*(P(1)-P(0))
Rise = (n-1)*Pitch/PointsPerTurn
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
oEditor.SweepAlongPath _
Array("NAME:Selections", "Selections:=", _
"Circle_Helix,Line_Helix"),
Array("NAME:PathSweepParameters", "DraftAngle:=", "0deg", _
"DraftType:=", "Round", "TwistAngle:=", "0deg")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("AnsoftHfss.HfssScriptInterface")
Set oDesktop = oAnsoftApp.GetAppDesktop()
set oProject = oDesktop.GetActiveProject
set oDesign = oProject.GetActiveDesign()
Dim oFS,ofile,x,y,z,path,range,
Dim arr2,del_f,freq,cfreq,val,temp,stn,stw,i,line
Input the desired file name.
path = inputbox("Input the file name" &chr(13) & _
"Note: If you do not specify a path the file will " & _
"be placed in the script directory", _
"File","C:\hfss_export.txt",50,50)
If the user clicks Cancel, the path will be blank, in which case the script should just exit.
If path <>"" then
Create the file, open it for data entry, and output the column labels.
Set oFS = CreateObject("Scripting.FileSystemObject")
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
Input the needed freq, solution, and sweep data and clean it up.
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction to Scripting in HFSS
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
Index
CreatePolyline 11-10
Numbers CreateRectangle 11-12
CreateRegion 11-13
3D Modeler editor commands CreateRegularPolygon 11-15
AssignMaterial 11-28 CreateRegularPolyhedron
Chamfer 11-29 11-15
ChangeProperty 11-58 CreateRelativeCS 11-36
Connect 11-29 CreateSphere 11-16
Copy 11-21 CreateSpiral 11-16
CoverLines 11-29 CreateTorus 11-17
CoverSurfaces 11-30 Delete 11-59
CreateBondwire 11-3 DeleteLastOperation 11-36
CreateBox 11-4 DeletePolylinePoint 11-22
CreateCircle 11-5 DetachFaces 11-37
CreateCone 11-5 DuplicateAlongLine 11-22
CreateCutplane 11-6 DuplicateAroundAxi 11-23
CreateCylinder 11-6 DuplicateMirror 11-24
CreateEllipse 11-7 EditEntityList 11-37
CreateEntityList 11-30 EditFaceCS 11-38
CreateEquationCurve 11-7 EditObjectCS 11-38
CreateEquationSurface 11- EditPolyline 11-18
8 EditRelativeCS 11-40
CreateFaceCS 11-30, 11-32 Export 11-40
CreateHelix 11-9 ExportModelImagetoFile
CreateObjectFromdges 11-34 11-41
CreateObjectFromFaces 11- Fillet 11-42
35 GenerateHistory 11-43
CreatePoint 11-10 GetBodyNamesByPosition
Index-1
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
11-59 AddDeltaMarker 13-3
GetEdgeByPosition 11-60 AddMarker 13-4
GetEdgeIDsfromFace 11-60 AddMaterial 6-2, 6-3
GetEdgeIDsfromObject 11-61 AddNamedExpr 20-3
GetFaceArea 11-61 AddNamedExpression 20-3
GetFaceByPosition 11-61 AddNote 13-4
GetFaceCenter 11-61 AddTraces 13-5, 13-7
GetFaceIDs 11-62 Analysis module commands
GetModelBoundingBox 11-62 Analyze 9-3
Import 11-45 DeleteDrivenSweep 16-2
ImportDXF 11-46 DeleteSetups 16-2
ImportGDSII 11-47 EditFrequencySweep 16-2, 16-4
InsertPolylineSegment 11-18 EditSetup 16-3
Intersect 11-49 GetSetupCount 16-4
Mirror 11-25 GetSetups 16-5
Move 11-25 GetSweepCount 16-5
MoveCSToEnd 11-49 GetSweeps 16-5
MoveFaces 11-50 InsertFrequencySweep 16-6, 16-15
OffsetFaces 11-26 InsertSetup 16-8
PageSetup 11-67 InsertSetup HFSS-IE 16-12
ProjectSheet 11-51 InsertSetup Transient 16-13
RenamePart 11-67 RenameDrivenSweep 16-18
Rotate 11-26 RenameSetup 16-18
Scale 11-27 RevertAllToInitial 16-19
Section 11-52 RevertSetupToInitial 16-19
SeparateBody 11-52 Analyze
SetModelUnits 11-53 Analysis module command 9-3
SetWCS 11-53 AnalyzeDistributed 9-4
Split 11-54 Ansoft Application Object commands 3-1
Subtract 11-54 Ansoft Application object commands
SweepAlongPath 11-19 GetAppDesktop 3-2
SweepAlongVector 11-20 SetDesiredRamMBLimit 3-5
SweepAroundAxis 11-21 ApplyMeshOps 9-3
SweepFacesAlongNormal 11-55 arithmetic operators 1-5
ThickenSheet 11-56 array variables 1-4
UncoverFaces 11-56 AssignAperature 14-46
Unite 11-57 AssignArray 10-2
AssignCurrent 14-12
AssignDCThickness 9-4
A AssignFiniteCond 14-13, 14-46
AddCartesianXMarker 13-3 AssignFloquet 14-14
AddDataset 8-2 AssignIERegion 14-17
AssignImpedance 14-17, 14-47
Index-2
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
AssignIncidentWave 14-18 AssignSlave 14-30
AssignLayeredImp 14-19 AssignSymmetry 14-31
AssignLengthOp 15-4 AssignTerminal 14-31
AssignLumpedPort 14-21 AssignVoltage 14-32
AssignLumpedRLC 14-23 AssignWavePort 14-32
AssignMagneticBias 14-23 AutoIdentifyPorts 14-3
AssignMaster 14-24 AutoIdentifyTerminals 14-4
AssignMaterial 11-28 ChangeImpedanceMult 14-4
AssignModelResolutionOp 15-5 CreatePML 14-49
AssignPerfectE 14-25 DeleteAllBoundaries 14-4
AssignPerfectH 14-25 DeleteAllExcitations 14-5
AssignRadiation 14-26 DeleteBoundaries 14-5
AssignScreeningImpedance 14-27 EditCurrent 14-35
AssignSkinDepthOp 15-5 EditFiniteCond 14-36
AssignSlave 14-30 EditImpedance 14-37
AssignSymmetry 14-31 EditIncidentWave 14-38
AssignTerminal 14-31 EditLayeredImpedance 14-39
AssignTrueSurfOp 15-6 EditLumpedPort 14-40
AssignVoltage 14-32 EditLumpedRLC 14-41
AssignWavePort 14-32 EditMagneticBias 14-41
AutoIdentifyPorts 14-3 EditMaster 14-39
AutoIdentifyTerminals 14-4 EditPerfectE 14-39
EditPerfectH 14-39
EditRadiation 14-41
B EditSlave 14-42
Boundary/Excitation module commands EditSymmetry 14-42
AssignAperature 14-46 EditTerminal 14-43
AssignCurrent 14-12 EditVoltage 14-43
AssignFiniteCond 14-13, 14-46 EditWavePort 14-43
AssignFloquet 14-14 GetBoundaries 14-5
AssignIERegion 14-17 GetBoundariesofType 14-6
AssignImpedance 14-17, 14-47 GetBoundaryAssignment 14-5
AssignIncidentWave 14-18 GetDefaultBaseName 14-6
AssignLayeredImp 14-19 GetExcitations 14-6
AssignLumpedPort 14-21 GetExcitationsOfType 14-7
AssignLumpedRLC 14-23 GetNumBoundaries 14-7
AssignMagneticBias 14-23 GetNumBoundariesofType 14-7
AssignMaster 14-24 GetNumExcitations 14-7
AssignPerfectE 14-25 GetNumExcitationsOfType 14-8
AssignPerfectH 14-25 GetPortExcitationsCounts 14-8
AssignRadiation 14-26 ModifyPMLGroup 14-51
AssignScreeningImpedance 14-27 PMLGroupCreated 14-51
PMLGroupModified 14-52
Index-3
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
ReassignBoundaries 14-8 CopyNamedExprToStack 20-6
RecalculatePMLMaterials 14-52 CopyReportData 13-8
RenameBoundary 14-9 CopyReportDefinition 13-8
ReprioritizeBoundary 14-9 copyright notices 1-9
SetDefaultBaseName 14-9 CopySetup
SetTerminalReferenceImpedances 14- Optimetrics module command 17-5
44 CopyTracesDefinitions 13-8
UnassignIERegions 14-44 Count 4-4
CoverLines 11-29
CoverSurfaces 11-30
C CreateBondwire 11-3
CalcOp 20-3 CreateBox 11-4
CalcStack 20-4 CreateCircle 11-5
CalculatorRead 20-4 CreateCone 11-5
CalculatorWrite 20-5 CreateCutplane 11-6
Chamfer 11-29 CreateCylinder 11-6
ChangeGeomSettings 20-5 CreateEllipse 11-7
ChangeImpedanceMult 14-4 CreateEntityList 11-30
ChangeProperty 7-4, 11-58 CreateEquationCurve 11-7
ClcEval 20-5 CreateEquationSurface 11-8
ClcMaterial 20-6 CreateFaceCS 11-30, 11-32
ClearAllMarkers 13-7 CreateFieldPlot 19-2
ClearAllNamedExpr 20-6 CreateHelix 11-9
Close 5-2 CreateObjectFromEdges 11-34
CloseAllWindows 4-3 CreateObjectFromFaces 11-35
CloseProject 4-3 CreateOutputVariable 12-2
CloseProjectNoForce 4-3 CreatePML 14-49
comment lines 1-2 CreatePoint 11-10
comparison operators 1-5 CreatePolyline 11-10
conditional statements CreateRectangle 11-12
If...Then... Else 1-6 CreateRegion 11-13
Select Case 1-6 CreateRegularPolygon 11-15
types of 1-6 CreateRegularPolyhedron 11-15
Connect 11-29 CreateRelativeCS 11-36
ConstructVariationString 9-5 CreateReport 13-9
conventions CreateReportFromTemplate 13-12
command syntax 2-8 CreateSphere 11-16
data types 2-8 CreateSpiral 11-16
script command 2-8 CreateTorus 11-17
converting data types 1-7 CreateUserDefinedSolution 22-2
Copy 11-21 CutDesign 5-2
CopyDesign 5-2
Index-4
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
AnalyzeDistributed 9-4
D ApplyMeshOps 9-3
AssignDCThickness 9-4
dataset commands CalculatorRead 20-4, 20-5
AddDataset 8-2 ClearAllMarkers 13-7
DeleteDataset 8-2 CloseAllWindows 4-3
EditDataset 8-3 CopyReportData 13-8
ImportDataset 8-3 CopyReportDefinition 13-8
Delete 11-59 CopyTracesData 13-8
DeleteAllBoundaries 14-4 CreateOutputVariable 12-2
DeleteAllExcitations 14-5 CreateReport 13-9
DeleteAllReports 13-12 CreateReportFromTemplate 13-12
DeleteArray 10-3 DeleteAllReports 13-12
DeleteBoundaries 14-5 DeleteOutputVariable 12-2
DeleteDataset 8-2 DeleteReport 13-12
DeleteDesign 5-2 DeleteTraces 13-13
DeleteDrivenSweep 16-2 EditOutputVariable 12-3
DeleteFarFieldSetup 21-2 ExportConvergence 9-6
DeleteFieldPlot 19-6 ExportMeshStats 9-7
DeleteFullVariation 18-5 ExportPlotImageToFile 13-13
DeleteImportData 18-2 ExportProfile 9-7
DeleteLastOperation 11-36 ExportToFile 13-15
DeleteLinkedDataVariation 9-6 FFTOnReport 13-15
DeleteNamedExpr 20-7 GetDesiredRamMBLimit 3-2
DeleteNearFieldSetup 21-2 GetDisplayType 13-17
DeleteOp 15-2 GetEditSourcesCount 9-8
DeleteOutputVariable 12-2 GetHPCLicenseType 3-2
DeletePolylinePoint 11-22 GetLibraryDirectory 4-6
DeleteReport 13-12 GetMatchedObjectName 11-64
DeleteSetups GetMaximumRamMBLimit 3-3
Analysis module command 16-2 GetModelUnits 11-64
Optimetrics module command 17-5 GetModule 9-9
DeleteSolutionVariation 18-6 GetMPIVendor 3-3
Deletetraces 13-13 GetName 9-9
DeleteUserDefinedSolution 22-4 GetNominalVariation 9-9
DeleteVariation 18-7 GetNumberOfProcessors 3-4
Design object commands GetNumObjects 11-65
13-16 GetObjectIDByName 11-63
AddCartesianXMarker 13-3 GetObjectName 11-63, 11-64
AddDeltaMarker 13-3 GetObjectsInGroup 11-63
AddMarker 13-4 GetOutputVariables 12-4
AddNote 13-4 GetOutputVariableValue 12-4
AddTraces 13-5, 13-7 GetProjectDirectory 4-7
Index-5
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
GetSelections 11-65 Count 4-4
GetSolutionType 9-10 EnableAutosave 4-4
GetSolveInsideThreshold 9-10 GetActiveProject 4-5
GetSourceContexts 9-10 GetAutosaveEnabled 4-5
GetTempDirectory 4-7 GetDesigns 4-5
GetUseHPCforMP 3-4 GetDistributedAnalysisMachines 4-6
GetUser Position 11-65 GetName 4-6
GetVariationVariableValue 9-10 GetProjectList 4-7
GetVersion 4-7 GetProjects 4-6
GetVertexIDsFromEdge 11-66 NewProject 4-8
GetVertexIDsFromFace 11-66 OpenMultipleProjects 4-8
GetVertexIDsFromObject 11-67 OpenProject 4-8
ImportIntoReport 13-18 PauseScript 4-9
PasteReports 13-18 Print 4-9
PasteTraces 13-19 QuitApplication 4-9
Redo 9-11 RestoreWindow 4-9
RenameDesignInstance 9-11 RunProgram 4-10
RenameReport 13-19 RunScript 4-10
RenameTraces 13-19 SetActiveProject 4-11
RunToolkit 9-14 SetActiveProjectByPath 4-11
SARSetup 9-11 Sleep 4-13
SetActiveEditor 9-12 DetachFaces 11-37
SetDesignSettings 9-12 DistributedAnalyzeSetup
SetHPCLicenseType 3-5 Optimetrics module command 17-6
SetLibraryDirectory 4-12 DuplicateAlongLine 11-22
SetMaximumRamMBLimit 3-6 DuplicateAroundAxis 11-23
SetMPIVendor 3-6 DuplicateMirror 11-24
SetNumberOfProcessors 3-7
SetProjectDirectoryVBCommand> 4-12
SetSolutionType 9-13 E
SetSolveInsideThreshold 9-13 EditAntennaArraySetup 21-8
SetSourceContexts 9-14 EditArray 10-4
SetTempDirectory 4-12 EditCurrent 14-35
SetUseHPCforMP 3-7 EditDataset 8-3
ShowWindow 11-54 EditEntityList 11-37
Solve 9-14, 9-16 EditFaceCS 11-38
UpdateAllReports 13-20 EditFarFieldSphereSetup 21-4
UpdateReports 13-20 EditFiniteCond 14-36
UpdateTraces 13-21 EditFrequencySweep 16-2, 16-4
UpdateTracesContextandSweeps 13-23 EditImpedance 14-37
Desktop object commands EditIncidentWave 14-38
CloseProject 4-3 EditLayeredImpedance 14-39
CloseProjectNoForce 4-3
Index-6
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
EditLengthOp 15-7 Export 11-40
EditLumpedPort 14-40 ExportConvergence 9-6
EditLumpedRLC 14-41 ExportDXConfigFile
EditMagneticBias 14-41 Optimetrics module command 17-6
EditMaster 14-39 ExportEignemodes 18-9
EditMaterial 6-4 ExportForHSpice 18-10
EditModelResolutionOp 15-7 ExportForSpice 18-8
EditNearFieldLineSetup 21-4 ExportFullWaveSpice 23-1
EditNearFieldSphereSetup 21-5 ExportMaterial 6-4
EditObjectCS 11-38 ExportMesh Stats 9-7
EditOutputVariable 12-3 ExportModelImagetoFile 11-41
EditPerfectE 14-39 ExportNetworkData 23-2
EditPerfectH 14-39 ExportNetworkData 18-11
EditPolyline 11-18 ExportNMFData 23-3
EditRadiation 14-41 ExportNMFData 18-13
EditRelativeCS 11-40 ExportOnGrid 20-11
EditSetup ExportOptimetricsProfile
Analysis module command 16-3 Optimetrics module command 17-6
optimization command 17-15 ExportOptimetricsResults
parametric command 17-11 Optimetrics module command 17-7
sensitivity command 17-19 ExportParametricResults
statistical command 17-21 Optimetrics module command 17-7
EditSkinOp 15-8 ExportPlotImageToFile 13-13
EditSlave 14-42 ExportProfile 9-7
EditSources 18-2 ExportRadiationParametersToFile 21-12
EditSymmetry 14-42 ExportToFile 13-15, 20-12
EditTerminal 14-43
EditTrueSurfOp 15-8
EditUserDefinedSolution 22-4 F
EditVoltage 14-43 FFTONReport 13-15
EditWavePort 14-43 Field Overlay module commands
EnableAutoSave 4-4 GetFieldPlotNames 19-6
EnterComplex 20-7 Field Overlays module commands
EnterComplexVector 20-7 AddNamedExpr 20-3
EnterLine 20-8 AddNamedExpression 20-3
EnterPoint 20-8 CalcOp 20-3
EnterQty 20-9 CalcStack 20-4
EnterScalar 20-9 ChangeGeomSettings 20-5
EnterScalarFunc 20-9 ClcEval 20-5
EnterSurf 20-10 ClcMaterial 20-6
EnterVector 20-10 ClearAllNamedExpr 20-6
EnterVectorFunc 20-10 CopyNamedExprToStack 20-6
EnterVol 20-11
Index-7
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
CreateFieldPlot 19-2 Fillet 11-42
DeleteFieldPlot 19-6 For...Next loop 1-7
DeleteNamedExpr 20-7
EnterComplex 20-7
EnterComplexVector 20-7 G
EnterLine 20-8 GenerateHistory 11-43
EnterPoint 20-8 GenerateVariationData Parametric
EnterQty 20-9 parametric command 17-11
EnterScalar 20-9 GetActiveDesign 5-3
EnterScalarFunc 20-9 GetActiveProject 4-5
EnterSurf 20-10 GetAdaptiveFrq 18-14
EnterVector 20-10 GetAllReportNames 13-16
EnterVectorFunc 20-10 GetArrayVariables 7-10
EnteVol 20-11 GetAutoSaveEnabled 4-5
ExportOnGrid 20-11 GetBodyNamesByPosition 11-59
ExportToFile 20-12 GetBoundaries 14-5
ModifyFieldPlot 19-7 GetBoundariesOfType 14-6
RenameFieldPlot 19-8 GetBoundaryAssignment 14-5
RenamePlotFolder 19-9 GetDefaultBaseName 14-6
SetFieldPlotSettings 19-9 GetDesign 5-3
SetPlotFolderSettings 19-10 GetDesigns 4-5
Fields Calculator commands GetDesiredRamMBLimit 3-2
AddNamedExpr 20-3, 20-6 GetDisplayType 13-17
CalcOp 20-3 GetDistributedAnalysisMachines 4-6
CalcStack 20-4 GetEdgeByPosition 11-60
ChangeGeomSettings 20-5 GetEdgeIDsFromFace 11-60
ClcEval 20-5 GetEdgeIDsFromObject 11-61
ClcMaterial 20-6 GetEditSourcesCount 9-8
CopyNamedExprToStack 20-6 GetExcitations 14-6
DeleteNamedExpr 20-7 GetExcitationsOfType 14-7
EnterComplex 20-7 GetFaceArea 11-61
EnterComplexVector 20-7 GetFaceByPosition 11-61
EnterLine 20-8 GetFaceCenter 11-61
EnterPoint 20-8 GetFaceIDs 11-62
EnterQty 20-9 GetFieldPlotNames
EnterScalar 20-9 Field Overlay module command 19-6
EnterScalarFunc 20-9 GetHPCLicenseType 3-2
EnterSurf 20-10 GetLibraryDirectory 4-6
EnterVector 20-10 GetMatchedObjectName 11-64
EnterVectorFunc 20-10 GetMaximumRamMBLimit 3-3
EnterVol 20-11 GetModelBoundingBox 11-62
ExportOnGrid 20-11 GetModelUnits 11-64
ExportToFile 20-12
Index-8
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
GetModule 9-9 GetTempDirectory 4-7
GetMPVendor 3-3 GetTopDesignList 5-4
GetName 4-6, 5-3, 9-9 GetTopEntryValue 20-13
GetNominalVariation 9-9 GetUseHPCforMP 3-4
GetNumberOfProcessors 3-4 GetUserPosition 11-65
GetNumBoundaries 14-7 GetValidISolutionList 18-15
GetNumBoundariesOfType 14-7 GetVariables 7-10
GetNumExcitations 14-7 GetVariableValue 7-11
GetNumExcitationsOfType 14-8 GetVariationVariableValue 9-10
GetNumObjects 11-65 GetVersion 4-7
GetObjectIDByName 11-63 GetVertexIDsFromEdge 11-66
GetObjectName 11-63, 11-64 GetVertexIDsFromFace 11-66
GetObjectsIngroup 11-63 GetVertexIDsFromObject 11-67
GetOperationNames
Mesh Operations module command 15-2
GetOutputVariable 12-4 H
GetOutputVariableValue 12-4 HasFields 18-15
GetPath 5-3 AssignLumpedPort 14-48
GetPortExcitationsCounts 14-8 Boundary/Excitation module commands
GetProjectDirectory 4-7 AssignLumpedPort 14-48
GetProjectList 4-7 Analysis module commands
GetProjects 4-6 RenameSweep 16-19
GetProperties 7-9 RenameSweep 16-19
GetPropertyValue 7-10 hierarchy of variables in HFSS 2-2
GetSelections 11-65
GetSetupCount
Analysis module command 16-4 I
GetSetupNames 21-2 If...Then... Else statement 1-6
GetSetupNames (Optimetrics) Import 11-45
Optimetrics module command 17-8 ImportDataset 8-3
GetSetupNamesByType (Optimetrics) ImportDXF 11-46
Optimetrics module command 17-8 ImportGDSII 11-47
GetSetups ImportINtoReport 13-18
Analysis module command 16-5 ImportSetup
GetSolutionType 9-10 Optimetrics module command 17-9
GetSolutionVesrionID 18-14 ImportSolution 18-16
GetSolveInsideThreshold 9-10 ImportTable 18-17
GetSolveRangeInfo 18-14 InputBox function 1-7
GetSourceContexts 9-10 InsertDesign 5-4
GetSweepCount InsertFarFieldSphereSetup 21-5
Analysis module command 16-5 InsertFrequencySweep 16-6, 16-15
GetSweeps InsertNearFieldLineSetup 21-6
Analysis module command 16-5
Index-9
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
InsertNearFieldSphereSetup 21-7 DeleteOp 15-2
InsertPolylineSegment 11-18 EditLengthOp 15-7
InsertSetup EditModelResolutionOp 15-7
Analysis module command 16-8 EditSkinOp 15-8
optimization command 17-15 EditTrueSurfOp 15-8
parametric command 17-11 GetOperationNames 15-2
sensitivity command 17-19 RenameOp 15-2
statistical command 17-23 Microsoft
InsertSetup HFSS-IE VBScript users guide 1-8
Analysis module command 16-12 Visual Basic 1-1
InsertSetup Transient Mirror 11-25
Analysis module command 16-13 Model Setup commands
Intersect 11-49 AssignArray 10-2
IsFieldAvailableAt 18-18 DeleteArray 10-3
EditArray 10-4
ModifyFieldPlot 19-7
J modifying a script 2-7
JavaScript, script format 1-1 ModifyPMLGroup 14-51
ModuleHasMatrixData 18-15
ModuleHasMesh 18-16
K modules in HFSS scripting 2-4
keywords, VBScript 1-2 Move 11-25
MoveCSToEnd 11-49
MoveFaces 11-50
L MsgBox function 1-8
ListMatchingVariations 18-19
ListValuesOfVariable 18-19 N
ListVariations 18-20
logical operators 1-6 ndExplorer Manager Script Commands 23-1
NewProject 4-8
M
O
material commands
AddMaterial 6-2, 6-3 oAnsoftApp object 2-3
EditMaterial 6-4 oDesign object 2-3
ExportMaterial 6-4 oDesktop object 2-3
RemoveMaterial 6-4 oEditor object 2-4
Mesh Operations module commands OffsetFaces 11-26
AssignLengthOp 15-4 oModule object 2-4
AssignModelResolutionOp 15-5 OpenMultipleProjects 4-8
AssignSkinDepthOp 15-5 OpenProject 4-8
AssignTrueSurfOp 15-6 operators
Index-10
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
arithmetic 1-5 PMLGroupModified 14-52
categories in VBScript 1-4 Print 4-9
comparison 1-5 Project object commands
logical 1-6 AddDataset 8-2
precedence of 1-5 AddMaterial 6-2, 6-3
oProject object 2-3 ChangeProperty 7-4
Optimetrics module commands Close 5-2
DeleteSetups 17-5 CopyDesign 5-2
DistributeAnalyzeSetup 17-6 CutDesign 5-2
ExportDXConfigFile 17-6 DeleteDataset 8-2
ExportOptimetricsProfile 17-6 DeleteDesign 5-2
ExportOptimetricsResults 17-7 EditDataset 8-3
ExportParametricResults 17-7 EditMaterial 6-4
GetSetupNames 17-8 ExportMaterial 6-4
GetSetupNamesByType 17-8 GetActiveDesign 5-3
ImportSetup 17-9 GetArrayVariables 7-10
RenameSetup 17-9 GetDesign 5-3
SolveSetup 17-5, 17-10 GetName 5-3
optimization commands GetPath 5-3
EditSetup 17-15 GetProperties 7-9
InsertSetup 17-15 GetPropertyValue 7-10
output variable commands GetTopDesignList 5-4
CreateOutputVariable 12-2 GetTopEntryValue 20-13
DeleteOutputVariable 12-2 GetVariables 7-10
EditOutputVariable 12-3 GetVariableValue 7-11
GetOutputVariables 12-4 InsertDesign 5-4
GetOutputVariableValue 12-4 Paste 5-4
Redo 5-5
RemoveMaterial 6-4
P Save 5-5
PageSetup 11-67 SaveAs 5-5
parametric commands SetActiveDesign 5-6
EditSetup 17-11 SetPropertyValue 7-11
GenerateVariationData Parametric SetVariableValue 7-12
17-11 SimulateAll 5-6
InsertSetup 17-11 Undo 5-6
Paste 5-4 ProjectSheet 11-51
PasteReports 13-18 property commands
PasteTraces 13-19 ChangeProperty 7-4
PauseScript 4-9 GetArrayVariables 7-10
pausing a script 2-7 GetProperties 7-9
PMLGroupCreated 14-51 GetPropertyValue 7-10
GetTopEntryValue 20-13
Index-11
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
GetVariables 7-10 Analysis module command 16-18
GetVariableValue 7-11 Optimetrics module command 17-9
SetPropertyValue 7-11 Radiation module command 21-3
SetVariableValue 7-12 RenameTraces 13-19
Reporter editor commands
AddCartesianXMarker 13-3
Q AddDeltaMarker 13-3
QuitApplication 4-9 AddMarker 13-4
AddNote 13-4
AddTraces 13-5, 13-7
R ClearAllMarkers 13-7
Radiation module commands CopyReportDefinition 13-8
DeleteFarFieldSetup 21-2 CopyTracesData 13-8
DeleteNearFieldSetup 21-2 CreateReport 13-9
EditAntennaArraySetup 21-8 CreateReportFromTemplate 13-12
EditFarFieldSphereSetup 21-4 DeleteAllReports 13-12
EditNearFieldSphereSetup 21-5 DeleteReport 13-12
EditNearLineSetup 21-4 DeleteTraces 13-13
ExportRadiationParametersToFile ExportPlotImageToFile 13-13
21-12 ExportToFile 13-15, 13-18
GetSetupNames 21-2 FFTOnReport 13-15
InsertFarFieldSphereSetup 21-5 GetAllReportNames 13-16
InsertNearFieldLineSetup 21-6 GetDisplayType 13-17
InsertNearFieldSphereSetup 21-7 PasteReports 13-18
RenameSetup 21-3 PasteTraces 13-19
ReassignBoundaries 14-8 RenameReport 13-19
RecalculatePMLMaterials 14-52 RenameTraces 13-19
recording a script 2-6 UpdateAllReports 13-20
Redo UpdateReports 13-20
design-level command 9-11 UpdateTraces 13-21
project-level command 5-5 UpdateTracesContextandSweeps 13-23
references, for VBScript 1-8 ReprioritizeBoundary 14-9
RemoveMaterial 6-4 RestoreWindow 4-9
RenameBoundary 14-9 resuming a script 2-7
RenameDesignInstance 9-11 RevertAllToInitial 16-19
RenameDrivenSweep 16-18 RevertSetupToInitial 16-19
RenameFieldPlot 19-8 Rotate 11-26
RenameOp 15-2 running a script 2-6
RenamePart 11-67 RunProgram 4-10
RenamePlotFolder 19-9 RunScript 4-10
RenameReport 13-19 RunToolkit 9-14
RenameSetup
Index-12
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
SetPropertyValue 7-11
S SetSolutionType 9-13
SetSolveInsideThreshold 9-13
sample scripts SetSourceContexts 9-14
data export 24-6 SetTempDirectory 4-12
simple HFSS 1-2 SetTerminalReferenceImpedances 14-44
variable helix 24-2 SetUseHPCforMP 3-7
SARSetup 9-11 SetVariableValue 7-12
Save 5-5 SetWCS 11-53
SaveAs 5-5 SGetAppDesktop 3-2
Scale 11-27 ShowlWindow 11-54
scripts SimulateAll 5-6
in JavaScript format 1-1 Sleep 4-13
modifying for easier playback 2-7 Solutions module commands
pausing 2-7 ConstructVariationString 9-5
recording 2-6 DeleteFullVariation 18-5
resuming 2-7 DeleteImportData 18-2
running 2-6 DeleteLinkedDataVariation 9-6
running from command prompt 1-1 DeleteSolutionVariation 18-6
stop recording 2-6 DeleteVariation 18-7
stopping execution of 2-7 EditSources 18-2
Section 11-52 ExportEigenmodes 18-9
Select Case statement 1-6 ExportForHSpice 18-10
sensitivity commands ExportForSpice 18-8
EditSetup 17-19 ExportNetworkData 18-11
InsertSetup 17-19 ExportNMF 18-13
SeparateBody 11-52 GetAdaptiveFreq 18-14
SetActiveDesign 5-6 GetSolutionVersionID 18-14
SetActiveEditor 9-12 GetSolveRangeInfo 18-14
SetActiveProject 4-11 GetValidISolutionLIst 18-15
SetActiveProjectByPath 4-11 HasFields 18-15
SetDefaultBaseName 14-9 ImportSolution 18-16
SetDesignSettings 9-12 ImportTable 18-17
SetDesiredRamMBLimit 3-5 IsFieldAvailableAt 18-18
SetFieldPlotSettings 19-9 ListMatchingVariations 18-19
SetHPCLicenseType 3-5 ListValuesOfVariable 18-19
SetLibraryDirectory 4-12 ListVariations 18-20
SetMaximumRAMMBLimit 3-6 ModuleHasMatrixData 18-15
SetModelUnits 11-53 ModuleHasMesh 18-16
SetMPVendor 3-6 Solve 9-14
SetNumberOfProcessors 3-7 SolveSetup
SetPlotFolderSettings 19-10 Optimetrics module command 17-10
SetProjectDirectory 4-12 Split 11-54
Index-13
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.
statistical commands used as objects 1-2
EditSetup 17-21 used in HFSS scripts 2-2
InsertSetup 17-23 .vbs file format 2-6
stopping a script 2-7 VBScript
stopping script recording 2-6 Microsoft users guide 1-8
Sub procedures 1-2 operators 1-4
Subtract 11-54 overview 1-1
SweepAlongPath 11-19 references 1-8
SweepAlongVector 11-20 Sub procedures 1-2
SweepAroundAxis 11-21 .vbs file format 2-6
SweepFacesAlongNormal 11-55
T
ThickenSheet 11-56
trademark notices 1-9
U
UnassignIERegions 14-44
UncoverFaces 11-56
underscore ( _ ) character 1-3
Undo
design-level command 9-16
project-level command 5-6
Unite 11-57
UpdateAllReports 13-20
UpdateReports 13-20
UpdateTraces 13-21
UpdateTracesContextandSweeps 13-23
UserDefinedSolutions module commands
CreateUserDefinedSolution 22-2
DeleteUserDefinedSolution 22-4
EditUserDefinedSolution 22-4
V
variables
array 1-4
assigning information 1-4
declaring 1-4
hierarchy in HFSS 2-2
Index-14
ANSYS Electromagnetics Suite 15.0 - SAS IP, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates.