0% found this document useful (0 votes)
14 views2,663 pages

HF Ss Scripting Guide

Uploaded by

dzcbuaa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2,663 pages

HF Ss Scripting Guide

Uploaded by

dzcbuaa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2663

HFSS Scripting Guide

Release 2023 R1
ANSYS, Inc. January 2023
Southpointe
2600 Ansys Drive ANSYS, Inc. and
Canonsburg, PA 15317 ANSYS Europe,
[email protected] Ltd. are UL
https://www.ansys.com registered ISO
9001:2015 com-
(T) 724-746-3304 panies.
(F) 724-514-9494
HFSS Scripting Guide

Copyright and Trademark Information


© 1986-2023 ANSYS, Inc. Unauthorized use, distribution or duplication is prohibited.
ANSYS, Ansys Workbench, AUTODYN, CFX, FLUENT 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 located in the United States or other countries. ICEM CFD is a
trademark used by ANSYS, Inc. under license. All other brand, product, service and feature
names or trademarks are the property of their respective owners. FLEXlm and FLEXnet are
trademarks of Flexera Software LLC.
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 export-
ing 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.
ANSYS, Inc. and ANSYS Europe, Ltd. are UL registered ISO 9001: 2015 companies.
U.S. Government Rights
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-PartySoftware
See the legal information in the product help files for the complete Legal Notice for Ansys pro-
prietary software and third-party software. If you are unable to access the Legal Notice, please
contact ANSYS, Inc.

2
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Table of Contents
Table of Contents Contents-1
1 - Introduction to Scripting 1-1
Scripting Help Conventions 1-1
Variable Types 1-2
Introduction to VBScript 1-2
Simple and Composite Names 1-3
VBScript Variables 1-3
Declaring Variables 1-3
Declaring Variables in Python 1-4
Variable Naming Conventions 1-4
Scope and Lifetime of Variables 1-4
Array Variables 1-4
VBScript Operators 1-5
Operator Precedence 1-6
Arithmetic Operators 1-6
String Concatenation Operator 1-7
Comparison Operators 1-7
Logical Operators 1-8
Controlling Program Execution 1-8
Using If...Then...Else 1-8
Using Select Case 1-8
Looping Through Code 1-9
Using a For...Next Loop 1-9
Using a Do Loop 1-9
Repeating Statements While a Condition is True 1-9
Repeating a Statement Until a Condition Becomes True 1-10
VBScript Procedures 1-10
Function Procedures 1-10

Contents-1
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Sub Procedures 1-10


Converting Between Data Types 1-10
Including Scripts 1-11
Aborting Scripts 1-11
Interacting with a Script 1-11
Recommended VBScript References 1-12
Sample HFSS Script 1-12
Sample Q3D Extractor Script 1-14
Introduction to IronPython 1-16
Scope 1-16
Python compatibility 1-16
Advantages of IronPython 1-16
IronPython Mini Cookbook 1-17
Comments 1-18
Assigning/Creating Variables 1-18
Create Lists/Arrays 1-18
Create Dictionaries/Maps 1-19
Boolean Values 1-19
Converting Numbers to Strings and Vice Versa 1-19
String Formatting/Concatenation 1-20
Looping over Lists 1-20
Looping over a Range 1-20
Indentation in IronPython 1-21
Indenting Functions 1-21
Indenting If Conditions 1-21
Methods in IronPython 1-22
Finding Methods 1-22
Help 1-22
Translating Script Commands from VBScript to IronPython 1-22
Script Method Argument 1-22

Contents-2
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Primitive Types 1-23


Named Arrays 1-23
Named Functions 1-23
VBScript Method Call Types 1-23
Converting VBScript Function calls to IronPython Syntax 1-24
Return Values 1-25
Primitive Method Arguments 1-25
Named Array Arguments 1-25
Named Array Values with All Key Value Pairs 1-25
Named Arrays with Nested Named Arrays 1-26
Function Blocks 1-27
Scripting Using Iron Python 1-27
Translating a script in VBScript to IronPython 1-27
Writing an IronPython script from scratch 1-27
IronPython Script Execution Environment 1-28
Script Argument for IronPython 1-29
Scripting using Embedded VBScript or JavaScript 1-29
Scripting with IronPython 1-32
Standalone IronPython 1-33
Running Standalone IronPython 1-33
Using a Recorded Script 1-34
Creating an External Script 1-34
Example Script 1-35
IronPython Samples 1-36
Change property 1-36
Create a Cone using IronPython 1-37
Creating User Defined Primitives and User Defined Models in Python Scripts 1-41
Advantages Compared to C++ 1-41
Changes compared to C 1-41
Structures 1-41

Contents-3
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Values for UDM and UDP Functions 1-42


Constants 1-42
Methods 1-42
Output Parameters 1-42
Comparison with C function: 1-43
'List Size' Parameters 1-43
Comparison with C function: 1-44
Added Parameters 1-45
Developing a UDM/UDP 1-46
Creation 1-46
Location 1-46
Organize 1-46
Edit/Reload 1-47
UDPExtension 1-47
Import 1-47
Main class: UDPExtension 1-47
IUDPExtension methods 1-47
Mandatory methods. 1-47
GetLengthParameterUnits() 1-47
GetPrimitiveTypeInfo() 1-47
GetPrimitiveParametersDefinition2() 1-47
AreParameterValuesValid2(errorMsg, udpParams) 1-48
CreatePrimitive2(funcLib, udpParams) 1-48
Optional methods 1-48
GetPrimitiveParameters() 1-48
GetRegisteredFaceNames() 1-48
GetRegisteredEdgeNames() 1-48
GetRegisteredVertexNames() 1-48
MapParametersDefinitionVersions2(oldVersion, oldUDPParams) 1-49
GetOldPrimitiveParametersDefinition2(version ) 1-49

Contents-4
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Example UDP 1-49


UDMExtension 1-49
Import 1-49
Main class: UDMExtension 1-50
IUDMExtension methods 1-50
Mandatory methods. 1-50
GetInfo() 1-50
IsAttachedToExternalEditor() 1-50
CreateInstance(funcLib) 1-50
GetUnits(instanceId) 1-50
ReleaseInstance(instanceId) 1-51
GetAttribNameForEntityId() 1-51
GetAttribNameForPartId() 1-51
Optional methods 1-51
GetInstanceSourceInfo(instanceId) 1-52
ShouldAttachDefinitionFilesToProject() 1-52
Example UDM 1-52
UDMFunctionLibrary 1-53
Functions list: 1-54
UDM/UDP Functions 1-55
Return Values for Each UDM and UDP Function 1-55
UDP/UDM Structures and Constants 1-58
UDP/UDM Structures 1-58
List of structures 1-59
UDP/UDM Constants 1-65
Enum constants: 1-65
UDP Python Example 1-67
Introduction to CPython (Beta) 1-72
Ansys Electronics Desktop Scripting 1-76
Overview of Electronics Desktop Scripting Objects 1-76

Contents-5
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oAnsoftApp 1-77
oDesktop 1-77
oProject 1-77
oDesign 1-77
oEditor 1-78
oModule 1-78
Example Script Opening 1-79
GetActiveProject and GetActiveDesign for Wider Use 1-80
Running a Script 1-80
Within Electronics Desktop 1-80
From the Command Line 1-81
Direct Launch 1-81
Recording a Script 1-82
Recording a Script to File 1-82
Recording a Script to a Project 1-83
Working with Project Scripts 1-84
Executing a Script from Within a Script 1-85
Electronics Desktop Scripting Conventions 1-85
Named Arguments 1-86
VBscript Example 1-86
IronPython Example 1-87
Setting Numerical Values 1-88
Layout Scripts and the Active Layer 1-89
Scripts and Locked Layers 1-89
Event Callback Scripting 1-89
2 - Application Object Script Commands 2-1
GetAppDesktop 2-2
3 - Desktop Object Script Commands 3-1
AddMessage 3-6
ClearMessages 3-7

Contents-6
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CloseAllWindows 3-8
CloseProject 3-8
CloseProjectNoForce 3-9
Count 3-10
DeleteProject 3-11
DownloadJobResults 3-12
DeleteRegistryEntry 3-13
DoesRegistryValueExist 3-14
EnableAutoSave 3-15
ExportOptionsFiles 3-16
GetActiveProject 3-16
GetActiveScheduler 3-17
GetActiveSchedulerInfo 3-18
GetAutoSaveEnabled 3-19
GetBuildDateTimeString 3-20
GetCustomMenuSet 3-21
GetDefaultUnit 3-21
GetDesktopConfiguration 3-24
GetDistributedAnalysisMachines 3-24
GetDistributedAnalysisMachinesForDesignType 3-25
GetExeDir 3-26
GetGDIObjectCount 3-27
GetLibraryDirectory 3-27
GetLocalizationHelper 3-29
GetMessages 3-29
GetPersonalLibDirectory 3-31
GetPPELicensingEnabled 3-31
GetProcessID 3-32
GetProjectDirectory 3-33
GetProjectList 3-33

Contents-7
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetProjects 3-34
GetRegistryInt 3-35
GetRegistryString 3-36
GetRunningInstancesMgr 3-36
GetSchematicEnvironment 3-37
GetScriptingToolsHelper 3-38
GetSysLibDirectory 3-39
GetTempDirectory 3-39
GetUserLibDirectory 3-40
GetVersion 3-41
IsFeatureEnabled 3-41
KeepDesktopResponsive 3-43
LaunchJobMonitor 3-43
NewProject 3-44
OpenAndConvertProject 3-45
OpenMultipleProjects 3-46
OpenProject 3-47
OpenProjectWithConversion 3-47
PageSetup (Layout Editor) 3-48
PauseRecording 3-49
PauseScript 3-49
Print 3-50
QuitApplication 3-51
RefreshJobMonitor 3-51
ResetLogging 3-52
RestoreProjectArchive 3-53
RestoreWindow 3-54
ResumeRecording 3-55
RunACTWizardScript 3-56
RunProgram 3-56

Contents-8
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

RunScript 3-57
RunScriptWithArguments 3-59
SelectScheduler 3-60
SetActiveProject 3-61
SetActiveProjectByPath 3-62
SetCustomMenuSet 3-63
SetDesktopConfiguration 3-64
SetLibraryDirectory 3-65
SetProjectDirectory 3-66
SetRegistryFromFile 3-67
SetRegistryInt 3-67
SetRegistryString 3-68
SetSchematicEnvironment 3-69
SetTempDirectory 3-70
ShowDockingWindow 3-70
Sleep 3-71
SubmitJob 3-72
TileWindows 3-73
Desktop Commands For Registry Values 3-74
DeleteRegistryEntry 3-75
DoesRegistryValueExist 3-76
GetRegistryInt 3-77
GetRegistryString 3-77
SetRegistryFromFile 3-78
SetRegistryInt 3-79
SetRegistryString 3-80
ImportExport Tool Commands 3-81
ImportANF 3-81
ImportANFv2 3-83
ImportAutoCAD 3-85

Contents-9
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ImportAWRMicrowaveOffice 3-85
ImportEDB 3-87
ImportExtracta 3-88
ImportGDSII 3-89
ImportGerber 3-90
ImportIDF 3-91
ImportIDFandMerge 3-94
ImportIDX 3-95
ImportIPC 3-98
ImportODB 3-99
ImportXFL 3-100
4 - Running Instances Manager Script Commands 4-1
GetAllRunningInstances 4-1
GetRunningInstanceByProcessID 4-2
GetRunningInstancesMgr 4-2
5 - Project Object Script Commands 5-1
AddDataset 5-3
AddMaterial 5-6
AnalyzeAll [project] 5-10
ChangeProperty (3D Modeler Layout Component Visualisation) 5-11
ChangeProperty (Symbol Editor) 5-15
ClearMessages 5-28
CloneMaterial 5-29
Close 5-30
CopyDesign 5-31
CutDesign 5-31
DeleteDataset 5-32
DeleteDesign 5-33
DeleteToolObject 5-34
EditDataset 5-35

Contents-10
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditMaterial 5-37
ExportDataset 5-47
ExportMaterial 5-47
GetActiveDesign 5-48
GetArrayVariables 5-49
GetChildNames [Project] 5-50
GetChildObject [Project] 5-51
GetChildTypes [Project] 5-52
GetConfigurableData (Project) 5-52
GetDefinitionManager 5-53
GetDependentFiles 5-53
GetDesign 5-54
GetDesigns 5-55
GetEDBHandle 5-56
GetLegacyName 5-56
GetName [Project] 5-57
GetObjPath [Project] 5-58
GetPath 5-59
GetPropNames [Project] 5-59
GetPropValue [Project] 5-60
GetProperties 5-61
GetPropertyValue 5-62
GetTopDesignList 5-64
GetVariableValue 5-65
GetVariables 5-65
ImportDataset 5-66
InsertDesign 5-68
InsertDesign [HFSS 3D Layout] 5-69
InsertDesignWithWorkflow 5-69
InsertToolObject 5-71

Contents-11
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Paste (Project Object) 5-71


Redo [Project Level] 5-72
RemoveAllUnusedDefinitions 5-72
RemoveMaterial 5-73
RemoveUnusedDefinitions 5-74
Rename 5-75
Save 5-76
SaveAs 5-77
SaveAsStandAloneProject 5-79
SaveProjectArchive 5-80
SetActiveDefinitionEditor 5-81
SetActiveDesign 5-82
SetPropValue [Project] 5-82
SetPropertyValue 5-83
SetVariableValue 5-85
SimulateAll 5-86
Undo [Project] 5-87
UpdateDefinitions 5-87
6 - Object Oriented Property Scripting 6-1
Object-Oriented Scripting 6-1
Material Properties and Examples 6-9
Body Properties and Modification 6-11
Retrieving Variables 6-11
Retrieve Datasets and Values 6-12
GetSolutionData API 6-14
Summary 6-14
Additional Details Specific to AEDT Solvers 6-18
Additional details on Boundaries/Excitations 6-20
3D component encapsulation 6-21
Additional details on Solve setup 6-22

Contents-12
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Materials Scripting Support 6-23


Object Oriented Scripting for Materials 6-27
Examples showing change to material property type: 6-28
Examples showing change to a vector component value 6-28
Change choice property value 6-29
Change choice property value 6-30
7 - Property Script Commands 7-1
Object Script Property Function Summary 7-3
Object Path 7-3
Property Object 7-4
Project Object 7-5
Design Object 7-6
3D Modeler Object 7-7
Variable Object 7-7
Optimetrics Module Object: 7-9
Optimetrics Setup Object 7-9
ReportSetup(Results) Module Object: 7-10
ReportSetup(Results) Module Child Objects: 7-11
Radiation Module Object: 7-12
Radiation Module Child Objects: 7-12
Conventions Used in this Chapter 7-13
GetArrayVariables 7-25
GetProperties 7-26
GetPropertyValue 7-27
GetVariables 7-29
GetVariableValue 7-30
SetPropertyValue 7-31
SetVariableValue 7-32
Example Use of Record Script and Edit Properties 7-33
Additional Property Scripting Examples 7-34

Contents-13
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

8 - Dataset Script Commands 8-1


AddDataset 8-1
DeleteDataset 8-4
EditDataset 8-5
ExportDataset 8-7
HasDataset 8-8
ImportDataset 8-9
9 - Design Object Script Commands 9-1
AddDataset 9-5
AddDesignVariablesForDynamicLink 9-8
AddModelingProperties 9-9
Analyze 9-9
AnalyzeAll [design] 9-10
AnalyzeAllNominal 9-11
AnalyzeDistributed 9-12
ApplyMeshOps 9-12
AssignDCThickness 9-13
ChangeProperty[ReportSetup] 9-16
ClearLinkedData (Design) 9-20
ConstructVariationString 9-20
CopyItemCommand 9-21
CreateEMLossTarget 9-22
CreateReport 9-23
DeleteDataset 9-38
DeleteFieldVariation 9-38
DeleteFullVariation 9-39
DeleteLinkedDataVariation 9-40
DeleteOutputVariable 9-41
DeleteSolutionVariation 9-42
DeleteOutputVariable 9-43

Contents-14
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

DistributeAnalysis 9-44
EditCoSimulationOptions 9-44
EditDesignSettings 9-45
EditImportData 9-49
EditInfiniteArray 9-49
Edit (Layout Editor) 9-50
EditLayoutForLayoutComponent 9-51
EditNotes 9-52
EditNotes [HFSS 3D Layout] 9-53
EditOptions [HFSS 3D Layout] 9-53
EMDesignOptions 9-54
ExportConvergence 9-56
ExportDataset 9-57
ExportForHSpice 9-57
ExportForHSpice [HFSS 3D Layout] 9-59
ExportForSpice [HFSS 3D Layout] 9-61
ExportMatrixData 9-62
ExportMeshStats 9-66
ExportNetworkData 9-66
ExportNetworkData 9-69
ExportNMFData 9-72
ExportProfile 9-77
Generate Mesh 9-78
GetActiveEditor [HFSS 3D Layout] 9-79
GetChildNames [Design] 9-79
GetChildObject [Design] 9-80
GetChildTypes [Design] 9-81
GetConfigurableData 9-81
GetData 9-82
GetDesignID 9-83

Contents-15
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetDesignName 9-83
GetDesignType 9-84
GetDesignValidationInfo 9-85
GetEdgePositionAtNormalizedParameter 9-86
GetEditSourcesCount 9-87
GetEditor [HFSS 3D Layout] 9-87
GetManagedFilesPath 9-88
GetModule 9-88
GetModule [HFSS 3D Layout] 9-90
GetModule (RadiationSetupMgr) 9-90
GetName 9-91
GetName [HFSS 3D Layout] 9-92
GetNominalVariation 9-92
GetNoteText 9-93
GetObjPath [Design] 9-94
GetOutputVariableValue 9-94
GetOutputVariables 9-96
GetPostProcessingVariables 9-97
GetProperties 9-97
GetPropertyValue 9-99
GetPropNames [Design] 9-100
GetPropValue [Design] 9-101
GetSelections [Design] 9-102
GetSolutionType 9-102
GetSolveInsideThreshold 9-103
GetVariables 9-103
GetVariableValue 9-104
GetVariationVariableValue 9-105
ImportDataset 9-106
InsertDesign 9-108

Contents-16
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

OverlayCurrents [HFSS 3D Layout] 9-109


OverlayFarField [HFSS 3D Layout] 9-109
OverlayMesh [HFSS 3D Layout] 9-110
OverlayNearField [HFSS 3D Layout] 9-110
PasteDesign (Design Object) 9-111
PasteItemCommand [HFSS 3D Layout] 9-112
PushExcitations 9-112
Redo [Design] 9-115
Redo [HFSS 3D Layout] 9-116
RemoveImportData [HFSS 3D Layout] 9-116
RemoveModelingProperties [HFSS 3D Layout] 9-117
RenameDesignInstance 9-117
RenameDesignInstance [HFSS 3D Layout] 9-118
RenameImportData [HFSS 3D Layout] 9-118
RenameSource [Interface Source] 9-119
ReportTemplates [HFSS 3D Layout] 9-119
RunToolkit 9-120
SARSetup 9-121
SetActiveEditor 9-121
SetActiveEditor [HFSS 3D Layout] 9-122
SetAllowMaterialOverride 9-123
SetBackgroundMaterial 9-123
SetDesignMode 9-124
SetDesignSettings 9-125
SetDoMeshAssembly 9-129
SetFastTransformationForLayoutComponent 9-132
SetLengthSettings 9-132
SetObjectAttributesForLayoutComponent 9-133
SetObjectDeformation 9-136
SetObjectTemperature 9-136

Contents-17
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetPhaseCenterPerPort 9-138
SetPropValue [Design] 9-139
SetPropertyValue 9-140
SetShowLayoutForLayoutComponent 9-142
SetSinglePhaseCenter 9-142
SetSolutionType 9-143
SetSolveInsideThreshold 9-145
SetSourceContexts 9-146
SetVariableValue 9-147
SimulateLink 9-147
Solve 9-148
StartAnalysis [HFSS 3D Layout] 9-149
StopSimLink 9-149
Undo [Design] 9-150
Undo [HFSS 3D Layout] 9-151
ValidateLink 9-151
ValidateDesign 9-152
ValidateLink 9-152
10 - Model Setup Script Commands 10-1
Assign Array 10-1
CreateArrayAirbox 10-4
CreateOpenRegion 10-6
DeleteArray 10-7
EditArray 10-8
GetArrayNames 10-12
GetLatticeVectors 10-12
IsArrayDefined 10-13
UpdateArrayAirbox 10-14
UpdateOpenRegionPadding 10-16
11 - 3D Modeler Editor Script Commands 11-1

Contents-18
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Conventions Used in this Chapter: 11-1


<AttributesArray> 11-1
<SelectionsArray> 11-2
Edit Menu Commands 11-4
Copy 11-4
DeletePolylinePoint 11-5
DuplicateAlongLine 11-6
DuplicateAroundAxis 11-9
DuplicateMirror 11-12
Mirror 11-15
Move 11-17
OffsetFaces 11-18
Paste (Model Editor) 11-20
Rotate 11-20
Scale 11-22
Modeler Menu Commands 11-24
AlignFaces 11-26
AssignMaterial 11-27
Chamfer 11-30
CleanUpModel 11-32
Connect 11-33
CoverLines 11-34
CoverSurfaces 11-35
CreateEntityList 11-36
CreateFaceCS 11-37
CreateGroup 11-42
CreateObjectCS 11-43
CreateObjectFromEdges 11-50
CreateObjectFromFace 11-52
CreateObjectFromFaces 11-54

Contents-19
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CreateRelativeCS 11-55
DeleteEmptyGroups 11-57
DeleteLastOperation 11-58
DeleteOperation 11-59
DetachEdges 11-61
DetachFaces 11-62
EditEntityList 11-64
EditFaceCS 11-65
EditObjectCS 11-71
EditRelativeCS 11-78
Export 11-80
ExportModelImageToFile 11-82
ExportModelMeshToFile 11-85
Fillet 11-86
FlattenGroup 11-88
GenerateHistory 11-89
GetActiveCoordinateSystem 11-90
GetActiveCoordinateSystemTransform 11-90
GetCoordinateSystems 11-91
HealObject 11-92
Import 11-96
ImportDXF [Modeler] 11-100
ImportFromClipboard 11-104
ImportGDSII [Modeler] 11-105
Imprint 11-108
ImprintProjection 11-109
Intersect 11-111
MoveCStoEnd 11-113
MoveEntityToGroup 11-114
MoveFaces 11-115

Contents-20
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ProjectSheet 11-117
PurgeHistory 11-118
ReplaceWith3DComponent 11-119
Section 11-122
SeparateBody 11-124
SetModelUnits 11-125
SetWCS 11-126
ShowWindow 11-127
Simplify 11-128
Split 11-131
Stitch 11-133
Subtract 11-135
SweepFacesAlongNormal 11-136
ThickenSheet 11-138
UncoverFaces 11-140
Unite 11-141
Ungroup 11-142
WrapSheet 11-143
Other oEditor Commands 11-144
AddDefinitionFromBlock 11-147
AddDefinitionFromLibFile 11-152
AddViewOrientation 11-156
AssignSurfaceMaterial 11-164
BreakUDMConnection 11-166
ChangeProperty 11-167
CloseAllWindows[Editor] 11-170
Defeature 11-171
Delete 11-172
FitAll 11-173
GenerateAllUserDefinedModels 11-173

Contents-21
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GenerateUserDefinedModel 11-174
GeometryCheckAndAutofix 11-175
GetBodyNamesByPosition 11-177
GetChildNames [Modeler] 11-178
GetChildObject [Modeler] 11-182
GetChildTypes [Modeler] 11-185
GetEdgeByPosition 11-187
GetEdgeIDFromNameForFirstOperation 11-189
GetEdgeIDsFromFace 11-189
GetEdgeIDsFromObject 11-190
GetEdgeLength 11-191
GetEntityListIDByName 11-191
GetExtendedDefinitionObject 11-192
GetFaceArea 11-193
GetFaceCenter 11-194
GetFaceByPosition 11-195
GetFaceIDFromNameForFirstOperation 11-196
GetFaceIDs 11-197
GetFaceIDsOfSheet 11-198
GetGeometryModelerMode 11-198
GetGroupSubmodelNames 11-199
GetMatchedObjectName 11-200
GetModelBoundingBox 11-200
GetModelUnits 11-201
GetNumObjects 11-202
GetObjectIDByName 11-202
GetObjectName 11-203
GetObjectNameByEdgeID 11-204
GetObjectNameByFaceID 11-204
GetObjectNameByID 11-205

Contents-22
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetObjectNameByVertexID 11-206
GetObjectsByMaterial 11-206
GetObjectShapeType 11-207
GetObjectsInGroup 11-208
GetObjectVolume 11-209
GetObjPath [Editor] 11-209
GetPartsForUserDefinedModel 11-210
GetPoints [3D Modeler Editor] 11-211
GetPropEvaluatedValue 11-211
GetPropertyValue 11-212
GetPropNames [Modeler] 11-214
GetPropSIValue 11-215
GetPropValue [Modeler] 11-216
GetRelativeCoordinateSystems 11-217
GetSelections [Model Editor] 11-218
GetSubGroupsInGroup 11-218
GetUserPosition 11-219
GetVertexIDFromNameForFirstOperation 11-220
GetVertexIDsFromEdge 11-221
GetVertexIDsFromFace 11-221
GetVertexIDsFromObject 11-222
GetVertexPosition 11-223
GetWireBodyNames 11-223
OpenExternalEditor 11-224
PageSetup 11-225
RemoveBadEdges 11-227
RemoveBadFaces 11-227
RemoveBadVertices 11-228
RenamePart 11-229
SetPropValue [Modeler] 11-230

Contents-23
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetTopDownViewDirectionForActiveView 11-231
SetTopDownViewDirectionForAllViews 11-232
UpdatePriorityList 11-232
UpgradeVersion 11-233
Validate3DComponent 11-235
WriteHistoryTreeLayoutForTest 11-235
Cable Modeling Commands 11-237
AddCableToBundle 11-238
CreateCableBundle 11-239
CreateCableHarness 11-241
CreateClockSource 11-243
CreatePWLSource 11-245
CreateStraightWireCable 11-247
CreateTwistedPairCable 11-248
ExportCableLibrary 11-250
ImportCableLibrary 11-251
RemoveCable 11-251
UpdateCableHarness 11-252
12 - Output Variable Script Commands 12-1
CreateOutputVariable 12-1
DeleteOutputVariable 12-3
DoesOutputVariableExist 12-4
EditOutputVariable 12-5
ExportOutputVariables 12-6
GetOutputVariables 12-7
GetOutputVariableValue 12-8
ImportOutputVariables 12-9
SimValueContext 12-10
13 - Reporter Editor Script Commands 13-1
AddAllEyeMeasurements 13-4

Contents-24
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AddCartesianLimitLine 13-5
AddCartesianLimitLineFromCurve 13-7
AddCartesianLimitLineFromEquation 13-9
AddCartesianXMarker 13-10
AddCartesianYMarker 13-11
AddCartesianYMarkerToStack 13-12
AddDeltaMarker 13-13
AddMarker 13-14
AddNote 13-15
AddTraceCharacteristics 13-17
AddTraces 13-19
ApplyReportTemplate 13-21
ChangeProperty[ReportSetup] 13-22
ClearAllMarkers 13-26
ClearAllTraceCharacteristics 13-26
CloneReportsFromDatasetSolution 13-27
CopyPlotSettings 13-28
CopyReportDefinitions 13-29
CopyReportsData 13-29
CopyTraceDefinitions 13-30
CopyTracesData 13-31
CreateReport 13-32
CreateReport [Designer] 13-47
CreateReportFromFile 13-52
CreateReportFromTemplate 13-53
CreateReportOfAllQuantities 13-54
DeleteMarker 13-55
DeleteAllReports 13-56
DeleteReports 13-57
DeleteTraceCharacteristics 13-57

Contents-25
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

DeleteTraces 13-58
DoesSupportTraceCharacteristics 13-59
DumpAllReportsData 13-60
EditCartesianXMarker 13-61
EditCartesianYMarker 13-61
EditMarker 13-62
ExportEyeMaskViolation 13-63
ExportImageToFile [Reporter] 13-64
ExportModelImageToFile 13-65
ExportModelMeshToFile 13-68
ExportPlot3DToFile [Reporter] 13-69
ExportReport 13-70
ExportReportDataToFile 13-72
ExportTableToFile 13-72
ExportToFile [Reporter] 13-73
ExportUniformPointsToFile 13-74
GetAllCategories 13-76
GetAllQuantities 13-77
GetAllReportNames 13-78
GetAvailableDisplayTypes 13-79
GetAvailableReportTypes 13-80
GetAvailableSolutions 13-80
GetChildNames [Report Setup] 13-81
GetChildObject [Report Setup] 13-82
GetChildTypes [ReportSetup] 13-83
GetCurvePropServerName 13-83
GetDisplayType 13-84
GetDynLinkIntrinsicVariables 13-85
GetDynLinkQtyValueState 13-85
GetDynLinkTraces 13-86

Contents-26
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetDynLinkVariableValues 13-87
GetName 13-87
GetObjPath [Design] 13-88
GetPropertyValue 13-89
GetPropNames [Reporter] 13-90
GetPropValue [Report Setup] 13-91
GetQtyExpressionsForSourceTrace 13-92
GetReportTraceNames 13-92
GetReportSummaryForRegressionTesting 13-93
GetSolutionContexts 13-94
GetSolutionDataPerVariation 13-95
GetDataExpressions 13-97
GetDataUnits 13-98
GetDesignVariableNames 13-99
GetDesignVariableUnits 13-100
GetDesignVariableValue 13-101
GetDesignVariationKey 13-102
GetImagDataValues 13-102
GetPerQuantityPrimarySweepValues 13-103
GetRealDataValues 13-104
GetSweepNames 13-105
GetSweepUnits 13-106
GetSweepValues 13-107
IsDataComplex 13-108
IsPerQuantityPrimarySweep 13-109
Release Data 13-110
GroupPlotCurvesByGroupingStrategy 13-111
ImportIntoReport 13-112
ImportReportDataIntoReport 13-113
MovePlotCurvesToGroup 13-113

Contents-27
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

MovePlotCurvesToNewGroup 13-114
OpenWindowForAllReports 13-115
OpenWindowForReports 13-116
PastePlotSettings 13-117
PasteReports 13-117
PasteReportsWithLegacyNames 13-118
PasteTraces 13-119
PasteTracesWithLegacyNames 13-119
RenameReport 13-120
RenameTrace 13-121
ResetPlotSettings 13-122
SavePlotSettingsAsDefault 13-122
SetLinkOutputTraces 13-123
SetPropValue [Report Setup] 13-124
UnGroupPlotCurvesInGroup 13-125
UpdateAllReports 13-126
UpdateReports 13-126
UpdateTraces 13-127
UpdateTracesContextAndSweeps 13-130
14 - Boundary and Excitation Module Script Commands 14-1
General Commands Recognized by the Boundary/Excitations Module 14-3
AddAssignmentToBoundary 14-5
AutoIdentifyLatticePair 14-6
AutoIdentifyNets 14-7
AutoIdentifyPorts 14-7
AutoIdentifyTerminals 14-8
ChangeImpedanceMult 14-10
ConvertNportCircuitElementsToPorts 14-10
CreateNportCircuitElements 14-11
DeleteAllBoundaries 14-13

Contents-28
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

DeleteAllExcitations 14-14
DeleteBoundaries 14-15
EditNportCircuitElement 14-15
GetBoundaries 14-17
GetBoundariesOfType 14-17
GetBoundaryAssignment 14-18
GetDefaultBaseName 14-19
GetDiffPairs 14-19
GetExcitations 14-20
GetExcitationsOfType 14-21
GetHybridRegions 14-21
GetHybridRegionsOfType 14-22
GetNumBoundaries 14-23
GetNumBoundariesOfType 14-23
GetNumExcitations 14-24
GetNumExcitationsOfType 14-25
GetNumHybridRegions 14-25
GetNumHybridRegionsOfType 14-26
GetPortExcitationCounts 14-27
IdentifyNets 14-27
ListNets 14-28
ReassignBoundary 14-29
RemoveAssignmentFromBoundary 14-30
RenameBoundary 14-31
ReprioritizeBoundaries 14-31
SetDefaultBaseName 14-33
SetPhaseCenterPerPort 14-33
SetSinglePhaseCenter 14-35
Script Commands for Creating and Modifying Boundaries 14-35
AssignAnisotropicImpedance 14-38

Contents-29
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AssignAperture 14-41
AssignCircuitPort 14-42
AssignCurrent 14-44
AssignCylindricalWave 14-45
AssignDielectricCavity 14-48
AssignFarFieldWave 14-49
AssignFEBI 14-52
AssignFiniteCond 14-53
AssignFloquet 14-56
AssignFresnel 14-63
AssignGaussianBeam 14-64
AssignHalfSpace 14-68
AssignHertzianDipoleWave 14-69
AssignHybridRegion 14-71
AssignIERegion 14-73
AssignImpedance 14-73
AssignIncidentWave 14-75
AssignLatticePair 14-79
AssignLayeredImp 14-81
AssignLinearAntennaWave 14-84
AssignLinkedImpedance 14-88
AssignLinkedRegion 14-91
AssignLumpedPort 14-92
AssignLumpedRLC 14-95
AssignMagneticBias 14-98
AssignMultipactionChargeRegion 14-100
AssignMultipactionDCBias 14-102
AssignMultipactionSEE 14-106
AssignNearFieldWave 14-107
AssignPerfectE 14-111

Contents-30
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AssignPerfectH 14-112
AssignPlaneWave 14-113
AssignPrimary 14-117
AssignRadiation 14-119
AssignRFDischargeDCBias 14-120
AssignScreeningImpedance 14-122
AssignSecondary 14-125
AssignSymmetry 14-129
AssignTerminal 14-130
AssignVoltage 14-131
AssignWavePort 14-133
AutoCreatePECCapforWavePort 14-136
CircuitPortToLumpedPort 14-138
EditAnisotropicImpedance 14-139
EditAperture 14-141
EditCircuitPort[HFSS] 14-142
EditCurrent 14-144
EditDielectricCavity 14-146
EditDiffPairs 14-147
EditFEBI 14-149
EditFiniteCond 14-150
EditFloquetPort 14-151
EditFresnel 14-158
EditGlobalMatEnv 14-159
EditHalfSpace 14-160
EditHybridRegion 14-161
EditImpedance 14-162
EditIncidentWave 14-163
EditLatticePair 14-166
EditLayeredImp 14-167

Contents-31
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditLinkedImpedance 14-170
EditLinkedRegion 14-173
EditLumpedPort 14-174
EditLumpedRLC 14-177
EditMagneticBias 14-179
EditMultipactionChargeRegion 14-181
EditMultipactionDCBias 14-183
EditMultipactionSEE 14-186
EditRFDischargeDCBias 14-188
EditPerfectE 14-189
EditPerfectH 14-191
EditPrimary 14-191
EditRadiation 14-193
EditSecondary 14-195
EditSymmetry 14-197
EditTerminal 14-198
EditVoltage 14-199
EditVoltageDrop 14-201
EditWavePort 14-201
LumpedPortToCircuitPort 14-205
SetAllHybridRegionsToOneWayCoupled 14-206
SetAllHybridRegionsToTwoWayCoupled 14-206
SetHybridRegionCoupledGroup 14-207
SetHybridRegionsCoupling 14-210
SetScatteredFieldFormulation 14-211
SetSBRCreepingWaveSettings 14-211
SetSBRSources 14-213
SetSBRSourcesBlockage 14-216
SetSBRTxRxSettings 14-217
SetSBRWedgeSettings 14-219

Contents-32
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetTerminalReferenceImpedances 14-222
SetTotalFieldFormulation 14-223
SwapCircuitPortDirection 14-223
SwapLatticePair 14-224
UnassignIERegions 14-225
Script Commands for Creating and Modifying PMLs 14-226
CreatePML 14-226
ModifyPMLGroup 14-229
PMLGroupCreated 14-231
PMLGroupModified 14-232
RecalculatePMLMaterials 14-234
AssignMultiFloatingLine 14-235
AssignMultiSignalLine 14-236
AssignMultiNonIdealGround 14-237
ToggleConductor 14-239
EditSignalLine 14-239
EditSurfaceGround 14-240
EditFloatingLine 14-241
AssignFiniteCond 14-242
EditFiniteCond 14-245
AssignThinConductor 14-246
ToggleTerminal 14-248
15 - Mesh Operations Module Script Commands 15-1
General Commands Recognized by the Mesh Operations Module 15-2
DeleteOp 15-2
GetMeshOpAssignment 15-3
GetOperationNames 15-3
ReassignOp 15-4
RenameOp 15-5
Script Commands for Creating and Modifying Mesh Operations 15-6

Contents-33
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AssignApplyCurvilinearElementsOp 15-7
AssignCloneOp 15-8
AssignCurvatureExtractionOp (Beta) 15-10
AssignCylindricalGapOp 15-11
AssignDensityControlOp 15-13
AssignEdgeCutLayerOp 15-16
AssignLengthOp 15-17
AssignMeshRegion 15-19
AssignModelResolutionOp 15-21
AssignRotationalLayerOp 15-22
AssignSkinDepthLayerSetting 15-23
AssignSkinDepthOp 15-25
AssignSurfPriorityForTauOp 15-26
AssignTrueSurfOp 15-28
EditApplyCurvilinearElementsOp 15-30
EditCloneOp 15-31
EditCurvatureExtractionOp (Beta) 15-33
EditCylindricalGapOp 15-34
EditDensityControlOp 15-36
EditEdgeCutLayerOp 15-38
EditLengthOp 15-39
EditMeshRegion 15-41
EditModelResolutionOp 15-42
EditRotationalLayerOp 15-43
EditSBRCurvatureExtractionOp (Beta) 15-45
EditSkinDepthOp 15-46
EditSurfPriorityOp 15-47
EditTrueSurfOp 15-48
InitialMeshSettings 15-50
16 - Analysis Setup Module Script Commands 16-1

Contents-34
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ClearLinkedData (Module) 16-2


CopySetup 16-3
CopyDrivenSetup 16-3
CopyEigenSetup 16-4
CopySweep 16-5
DeleteDrivenSweep 16-5
DeleteSetups 16-6
DoesSweepSetupExists 16-7
EditCircuitSettings 16-8
EditDrivenSweep 16-9
EditFrequencySweep 16-10
EditSetup 16-12
ExportCircuit 16-24
GetSetupCount 16-29
GetSetups 16-29
GetSetups [HFSS 3D Layout] 16-30
GetSetupNames 16-31
GetSweepCount 16-31
GetSweeps 16-32
GetSweeps [HFSS 3D Layout] 16-33
InsertDrivenSweep 16-33
InsertFrequencySweep 16-40
InsertSetup 16-47
InsertSetup [Transient] 16-82
PasteDrivenSetup 16-90
PasteEigenSetup 16-90
PasteSetup 16-91
PasteSweep 16-91
RenameDrivenSweep 16-92
RenameSetup 16-93

Contents-35
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ResetToTimeZero 16-93
RevertAllToInitial 16-94
RevertAllToInitialTemperature 16-95
RevertAllToZeroDisplacement 16-95
RevertSetupToInitial 16-96
RevertSetupToInitialTemperature 16-97
RevertSetupToZeroDisplacement 16-97
SetMPIVendor 16-98
SolveSetup 16-99
17 - Optimetrics Module Script Commands 17-1
CopySetup 17-6
DeleteSetups [Optimetrics] 17-7
DistributedAnalyzeSetup 17-7
EditSetup 17-8
EnableSetup 17-20
ExportDXConfigFile 17-21
ExportOptimetricsProfile 17-22
ExportOptimetricsResult 17-23
ExportParametricResults 17-24
ExportParametricSetupTable 17-25
ExportRespSurfaceMinMaxTable 17-26
ExportRespSurfaceRefinePoints 17-27
ExportRespSurfaceResponsePoints 17-27
ExportRespSurfaceVerificationPoints 17-28
GenerateVariationData [Parametric] 17-29
GetChildNames [Optimetrics] 17-30
GetChildObject [Optimetrics] 17-30
GetChildTypes [Optimetrics] 17-31
GetName 17-32
GetObjPath [Design] 17-32

Contents-36
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetOptimetricResult 17-33
GetOptimetricsResult 17-34
GetPropNames [Optimetrics] 17-35
GetPropValue [Optimetrics] 17-36
GetSetupNames [Optimetrics] 17-36
GetSetupNamesByType [Optimetrics] 17-37
ImportSetup 17-38
InsertSetup 17-39
PasteSetup [Optimetrics] 17-74
RenameSetup [Optimetrics] 17-75
SetPropValue [Optimetrics] 17-76
SolveAllSetup 17-77
SolveSetup [Optimetrics] 17-77
ValidateSetup [Parametric] 17-78
General Commands Recognized by the Optimetrics Module 17-79
CopySetup 17-80
DeleteSetups [Optimetrics] 17-81
DistributedAnalyzeSetup 17-81
EditSetup 17-82
EnableSetup 17-94
ExportDXConfigFile 17-95
ExportOptimetricsProfile 17-96
ExportOptimetricsResult 17-97
ExportParametricResults 17-98
ExportParametricSetupTable 17-99
ExportRespSurfaceMinMaxTable 17-100
ExportRespSurfaceRefinePoints 17-100
ExportRespSurfaceResponsePoints 17-101
ExportRespSurfaceVerificationPoints 17-102
GenerateVariationData [Parametric] 17-103

Contents-37
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetChildNames [Optimetrics] 17-104


GetChildObject [Optimetrics] 17-104
GetChildTypes [Optimetrics] 17-105
GetName 17-105
GetObjPath [Design] 17-106
GetOptimetricResult 17-107
GetPropNames [Optimetrics] 17-108
GetPropValue [Optimetrics] 17-108
GetSetupNames [Optimetrics] 17-109
GetSetupNamesByType [Optimetrics] 17-110
ImportSetup 17-111
InsertSetup 17-112
PasteSetup [Optimetrics] 17-147
RenameSetup [Optimetrics] 17-148
SetPropValue [Optimetrics] 17-149
SolveAllSetup 17-150
SolveSetup [Optimetrics] 17-150
ValidateSetup [Parametric] 17-151
Parametric Script Commands 17-152
EditSetup [Parametric] 17-152
ExportParametricSetupTable 17-153
GenerateVariationData [Parametric] 17-154
InsertSetup [Parametric] 17-154
ValidateSetup [Parametric] 17-159
Optimization Script Commands 17-160
EditSetup [Optimization] 17-160
InsertSetup [Optimization] 17-165
Sensitivity Script Commands 17-176
EditSetup [Sensitivity] 17-177
InsertSetup [Sensitivity] 17-184

Contents-38
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Statistical Script Commands 17-188


EditSetup [Statistical] 17-188
InsertSetup [Statistical] 17-191
18 - Solutions Module Script Commands 18-1
DeleteImportData 18-2
DeleteSolutionVariation 18-3
DeleteVariation [HFSS] 18-4
EditSources 18-4
ExportEigenmodes 18-6
ExportForHSpice 18-7
ExportNetworkData 18-9
ExportNMFData [HFSS] 18-11
ExportTransientData 18-12
FFTOnReport 18-13
GetAdaptiveFreq 18-14
GetAdaptiveSettings 18-15
GetAllSourceMagnitudes 18-16
GetAllSourceModes 18-16
GetAllSourcePhases 18-17
GetAllSources 18-18
GetAntennaParameters 18-18
GetAvailableVariations 18-19
GetEditSourcesCount 18-20
GetExcitationScaling 18-20
GetFieldType 18-21
GetIncludePortPostProcessing 18-22
GetMultipactionBreakdown 18-22
GetNetworkDataSolution 18-23
GetNetworkDataSolutionDefinition 18-24
GetNetworkPostprocSetup 18-25

Contents-39
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetISolutionVersionID 18-25
GetSolveRangeInfo 18-26
GetSourceContexts 18-26
GetSourceData [HFSS 3D Layout] 18-27
GetTerminalExcitationType 18-27
GetTransientSolveTimes 18-28
GetValidISolutionList 18-29
HasFields 18-30
HasMatrixData 18-30
HasMesh 18-31
ImportSolution 18-32
ImportTable 18-33
IsFieldAvailableAt 18-34
ListMatchingVariations 18-35
ListValuesOfVariable 18-36
ListVariations 18-37
SetSourceContexts 18-37
TDROnReport 18-38
19 - Fields Calculator Script Commands 19-1
AddNamedExpression 19-2
AddNamedExpr 19-3
CalcOp 19-4
CalcRead(deprecated) 19-4
CalculatorRead 19-5
CalcStack 19-6
CalculatorWrite 19-7
CalcWrite 19-8
ChangeGeomSettings 19-9
ClcEval 19-10
ClcMaterial 19-11

Contents-40
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ClcMaterialValue 19-11
ClearAllNamedExpr 19-12
CopyNamedExprToStack 19-13
DeleteNamedExpr 19-13
DoesNamedExpressionExists 19-14
EnterComplex 19-15
EnterComplexVector 19-16
EnterCoord 19-17
EnterEdge 19-17
EnterLine 19-18
EnterOutputVar 19-19
EnterPoint 19-19
EnterQty 19-20
EnterScalar 19-21
EnterScalarFunc 19-22
EnterSurf 19-22
EnterVector 19-23
EnterVectorFunc 19-24
EnterVol 19-24
ExportOnGrid [Fields Calculator] 19-25
ExportToFile [Fields Calculator] 19-28
GetTopEntryValue 19-31
LoadNamedExpressions 19-32
SaveNamedExpressions 19-33
20 - Radiation Module Script Commands 20-1
General Commands Recognized by the Radiation Module 20-2
CopyRadFieldSetup 20-2
DeleteFarFieldSetup 20-3
DeleteNearFieldSetup 20-4
DeleteSetup 20-4

Contents-41
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditRadiatedPowerCalculationMethod 20-5
GetChildNames [Radiation] 20-6
GetChildObject [Radiation] 20-6
GetChildTypes [Radiation] 20-7
GetPropNames [Radiation] 20-7
GetPropValue [Radiation] 20-7
GetSetupNames 20-8
PasteRadFieldSetup 20-9
RenameSetup [Radiation] 20-9
SetPropValue [Radiation] 20-10
Script Commands for Creating and Modifying Radiation Setups 20-11
AddAntennaOverlay 20-11
AddRadFieldSourceGroup 20-13
EditAntennaOverlay 20-15
EditBoxSetup 20-17
EditFarFieldSphereSetup 20-19
EditInfiniteSphereSetup 20-21
EditLineSetup 20-23
EditNearFieldBoxSetup 20-25
EditNearFieldLineSetup 20-27
EditNearFieldRectangleSetup 20-28
EditNearFieldSphereSetup 20-30
EditRadFieldSourceGroup 20-32
EditRectangleSetup 20-33
EditSphereSetup 20-35
InsertBoxSetup 20-37
InsertFarFieldSphereSetup 20-39
InsertInfiniteSphereSetup 20-41
InsertLineSetup 20-44
InsertNearFieldBoxSetup 20-45

Contents-42
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

InsertNearFieldLineSetup 20-47
InsertNearFieldRectangleSetup 20-48
InsertNearFieldSphereSetup 20-50
InsertRectangleSetup 20-52
InsertSphereSetup 20-54
Script Commands for Modifying Antenna Array Setups 20-56
EditAntennaArraySetup 20-56
Script Commands for Exporting Antenna Parameters and Max Field Parameters 20-61
ExportElementPatternToFile 20-62
ExportFieldsToFile 20-63
ExportParametersToFile 20-65
ExportRadiationFieldsToFile 20-67
ExportRadiationParametersToFile 20-69
21 - Radiation Setup Manager Module Script Commands 21-1
Add (Infinite Sphere) 21-1
Edit (RadiationSetupMgr for Infinite Sphere) 21-5
Add (Near Field Line) 21-8
Edit (RadiationSetupMgr for Near Field Line) 21-10
Add (Near Field Plane) 21-12
Edit (RadiationSetupMgr for Near Field Plane) 21-15
Add (Near Field Sphere) 21-18
Edit (RadiationSetupMgr for Near Field Sphere) 21-22
22 - User Defined Document Script Commands 22-1
AddDocument 22-1
DeleteAllDocuments 22-4
DeleteDocument 22-5
EditDocument 22-5
GetDocumentDefinitionNames 22-7
GetDocumentNames 22-8
RenameDocument 22-8

Contents-43
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SaveHtmlDocumentAs 22-9
SavePdfDocumentAs 22-10
UpdateAllDocuments 22-10
UpdateDocument 22-11
ViewHtmlDocument 22-12
ViewPdfDocument 22-13
Explication of a Sample UDD Script 22-13
Example Python Script: Defining a Document 22-15
23 - User Defined Solutions Commands 23-1
CreateUserDefinedSolution 23-1
DeleteUserDefinedSolutions 23-3
EditUserDefinedSolution 23-4
GetUserDefinedSolutionNames 23-6
GetUserDefinedSolutionProperties 23-6
24 - Network Data Explorer Script Commands 24-1
AddDiffPair 24-4
Cascade (SPISim) 24-5
ClearDiffPairs 24-6
Clone 24-7
Close 24-8
Combine (SPISim) 24-9
Deembed (SPISim) 24-10
DeembedBack (SPISim) 24-11
DeembedFront (SPISim) 24-13
DisableDiffPairs 24-14
EnableDiffPairs 24-15
ExportCitiFile 24-16
ExportFullWaveSpice 24-18
ExportMatlab 24-19
ExportNMFData 24-21

Contents-44
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ExportNetworkData 24-26
ExportSpreadsheet 24-29
ExportTouchstone 24-31
ExportTouchstone2 24-34
Extract (SPISim) 24-36
GetFrequencies 24-37
GetFrequencyCount 24-38
GetName 24-39
GetPortCount 24-40
GetPortNumber 24-41
GetPostProcSettings 24-42
GetSolutionVariation 24-43
GetVariation 24-44
HasSameData 24-45
LoadSolution 24-47
Open 24-48
Rename (SPISim) 24-49
Renormalize (SPISim) 24-50
Reorder 24-51
Reorder (SPISim) 24-52
Reset 24-53
SetAllPortImpedances 24-54
SetPortDeembedDistance 24-56
SetPortImpedance 24-57
SetPostProcSettings 24-58
Smooth 24-59
Stretch (SPISim) 24-60
Terminate 24-61
25 - CompInstance Script Commands (multiple)
Callback Scripting Using CompInstance Object (multiple)

Contents-45
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CompInstance Functions 64
GetComponentName 64
GetInstanceID [Component Instance] 65
GetInstanceName [Component Instance] 66
GetParentDesign 66
GetPropServerName 67
26 - Simulation Setup Commands 26-1
AddSetup [HFSS 3D Layout] 26-2
AddSweep [HFSS 3D Layout] 26-2
Analyze [HFSS 3D Layout] 26-3
AnalyzeSweep [HFSS 3D Layout] 26-3
Delete [HFSS 3D Layout] 26-3
DeleteSweep [HFSS 3D Layout] 26-4
DynamicMeshOverlays [HFSS 3D Layout] 26-4
Edit [HFSS 3D Layout] 26-4
EditSweep [HFSS 3D Layout] 26-4
ExportToHFSS [HFSS 3D Layout] 26-5
ExportToQ3D [HFSS 3D Layout] 26-5
GetAllSolutionNames [HFSS 3D Layout] 26-5
GetSetupData [HFSS 3D Layout] 26-5
LayoutMeshOverlay [HFSS 3D Layout] 26-6
Layout3DMeshOverlay [HFSS 3D Layout] 26-6
ListVariations [HFSS 3D Layout] 26-6
RefreshMeshOverlays [HFSS 3D Layout] 26-7
RenameSweep [HFSS 3D Layout] 26-7
27 - Excitations Commands 27-1
Add [Excitation HFSS 3D Layout] 27-2
AddRefPort [HFSS 3D Layout] 27-2
AddRefPortUsingEdges [HFSS 3D Layout] 27-3
ConvertPlaneToTrace [HFSS 3D Layout] 27-5

Contents-46
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ConvertTraceToPlane [HFSS 3D Layout] 27-5


CoupleEdgePorts 27-5
CreateGroundPortComponent [HFSS 3D Layout] 27-6
CreateInterfaceGround [HFSS 3D Layout] 27-6
CreateInterfacePort [HFSS 3D Layout] 27-6
CreateInterfacePortComponent [HFSS 3D Layout] 27-7
DecoupleEdgePorts 27-7
Delete[Excitation HFSS 3D Layout] 27-7
Delete [Interface Port] 27-8
Delete[Excitation HFSS 3D Layout] 27-8
DeleteProbePortAndVia [HFSS 3D Layout] 27-8
DeleteSource [Interface Source] 27-8
Edit [HFSS 3D Layout] 27-9
EditCircuitExcitations [HFSS 3D Layout] 27-9
EditCircuitPort [Interface Port] 27-9
EditExcitations [HFSS 3D Layout] 27-10
GetAllBoundariesList [HFSS 3D Layout] 27-12
GetAllPortsList [HFSS 3D Layout] 27-12
Rename [Interface Port] 27-12
RenameSource [Interface Source] 27-13
Rename [HFSS 3D Layout] 27-13
RemoveRefPort [HFSS 3D Layout] 27-13
SelectInLayout [HFSS 3D Layout] 27-13
28 - 2.5D Via Commands 28-1
29 - Cavity Commands 29-1
30 - Layout Scripting 30-1
Object Identifiers and Script Recording 30-2
Create Primitives 30-2
CreateCircle (Layout Editor) 30-3
CreateLine (Layout Editor) 30-4

Contents-47
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CreateRectangle (Layout Editor) 30-7


CreatePolygon (Layout Editor) 30-8
CreateText (Layout Editor) 30-9
Create Voids in Primitives 30-12
CreateCircleVoid (Layout Editor) 30-13
CreateLineVoid (Layout Editor) 30-14
CreatePolygonVoid (Layout Editor) 30-15
CreateRectangleVoid (Layout Editor) 30-16
Other Creation Methods 30-17
CreateComponent (Layout Editor) 30-18
CreateHole (Layout Editor) 30-19
CreateMeasure (Layout Editor) 30-21
CreatePin (Layout Editor) 30-23
CreatePinGroup (Layout Editor) 30-24
CreatePinGroupPort (Layout Editor) 30-24
CreateTrace (Layout Editor) 30-24
CreateVia (Layout Editor) 30-30
DeletePinGroup (Layout Editor) 30-31
Object Movement and Modification Methods 30-31
Connect (Layout Editor) 30-32
Copy (Layout Editor) 30-32
Delete (Layout Editor) 30-33
Disconnect (Layout Editor) 30-33
Edit (Layout Editor) 30-34
Expand (Layout Editor) 30-35
ExpandWithPorts (Layout Editor) 30-36
FlipHorizontal (Layout Editor) 30-37
FlipVertical (Layout Editor) 30-38
Move(Layout Editor) 30-38
Paste (Layout Editor) 30-38

Contents-48
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Rotate (Layout Editor) 30-39


Activation and Deactivation Methods 30-39
Activate (Layout Editor) 30-39
DeactivateOpen (Layout Editor) 30-40
DeactivateShort (Layout Editor) 30-40
Delete (Layout Editor) 30-41
Layout and Geometry Interrogation Methods 30-41
Layout Interrogation (Layout Editor) 30-41
Point (Layout Editor) 30-42
Polygon (Layout Editor) 30-42
FindObjects (Layout Editor) 30-43
FilterObjectList (Layout Editor) 30-44
GetCSObjects (Layout Editor) 30-45
GetPolygon (Layout Editor) 30-45
GetPolygonDef (Layout Editor) 30-46
GetBBox (Layout Editor) 30-46
FindObjectsByPolygon (Layout Editor) 30-46
FindObjectsByPoint (Layout Editor) 30-47
CreateObjectFromPolygon (Layout Editor) 30-47
CreateLineFromPolygon (Layout Editor) 30-48
Point Object (Layout Editor) 30-48
Set (Layout Editor) 30-49
SetX (Layout Editor) 30-49
GetX (Layout Editor) 30-50
SetY (Layout Editor) 30-50
GetY (Layout Editor) 30-50
SetArc (Layout Editor) 30-51
IsArc (Layout Editor) 30-51
IsEqual (Layout Editor) 30-51
Mag (Layout Editor) 30-52

Contents-49
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Distance (Layout Editor) 30-52


Cross (Layout Editor) 30-52
Move(Layout Editor) 30-52
Rotate (Layout Editor) 30-53
Normalize (Layout Editor) 30-53
DistanceFromLine (Layout Editor) 30-53
ClosestPointOnLine (Layout Editor) 30-53
Polygon Object (Layout Editor) 30-54
AddPoint (Layout Editor) 30-56
SetClosed (Layout Editor) 30-56
IsClosed (Layout Editor) 30-56
Move(Layout Editor) 30-57
Rotate (Layout Editor) 30-57
Scale (Layout Editor) 30-57
MirrorX (Layout Editor) 30-58
GetPoints (Layout Editor) 30-58
AddHole (Layout Editor) 30-58
HasHoles (Layout Editor) 30-59
GetHoles (Layout Editor) 30-59
HasArcs (Layout Editor) 30-59
HasSelfIntersections (Layout Editor) 30-60
BBoxLL (Layout Editor) 30-60
BBoxUR (Layout Editor) 30-60
IsParametric (Layout Editor) 30-60
IsConvex (Layout Editor) 30-61
IsPoint (Layout Editor) 30-61
IsSegment (Layout Editor) 30-61
IsArc (Layout Editor) 30-61
IsBox (Layout Editor) 30-62
IsCircle (Layout Editor) 30-62

Contents-50
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetBoundingCircleCenter (Layout Editor) 30-62


GetBoundingCircleRadius (Layout Editor) 30-62
Area (Layout Editor) 30-63
PointInPolygon (Layout Editor) 30-63
CircleIntersectsPolygon (Layout Editor) 30-63
GetIntersectionType (Layout Editor) 30-63
GetClosestPoint (Layout Editor) 30-64
GetClosestPoints (Layout Editor) 30-64
Unite (Layout Editor) 30-65
Intersect (Layout Editor) 30-65
Subtract (Layout Editor) 30-65
Xor (Layout Editor) 30-66
Boolean Operations on Primitives 30-66
Unite (Layout Editor) 30-66
Intersect (Layout Editor) 30-67
Subtract (Layout Editor) 30-67
Coordinate System Methods 30-68
CreateCS (Layout Editor) 30-68
ClearRelative (Layout Editor) 30-72
Create3DStructure (Layout Editor) 30-73
Group (Layout Editor) 30-73
CreateGroupSelected (Layout Editor) 30-73
PositionRelative (Layout Editor) 30-74
GetCSObjects (Layout Editor) 30-77
SetCS (Layout Editor) 30-77
Ungroup (Layout Editor) 30-77
Layers Methods 30-78
ClearLayerMappings (Layout Editor) 30-78
CreateBoardBend (Layout Editor) 30-79
DuplicateAcrossLyrs (Layout Editor) 30-81

Contents-51
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetAllLayerNames (Layout Editor) 30-82


GetLayerInfo (Layout Editor) 30-82
GetStackupLayerNames (Layout Editor) 30-84
ProcessBentModelCmd (Layout Editor) 30-85
RemoveLayer (Layout Editor) 30-85
SetLayerMapping (Layout Editor) 30-86
Net and NetClass Methods 30-86
CreateNetClass 30-87
DeleteNets 30-87
DelNetClass 30-88
GetNetClasses 30-89
GetNetClassNets 30-89
GetNetConnections (Layout Editor) 30-89
HighlightNet (Layout Editor) 30-90
ModifyNetClass 30-92
SetNetVisible [HFSS 3D Layout] 30-92
Port Methods 30-94
AddCircuitRefPort (Layout Editor) 30-95
AddPortsToAllNets (Layout Editor) 30-97
AddPortsToNet (Layout Editor) 30-97
AddRefPort (Layout Editor) 30-98
AlignPorts (Layout Editor) 30-100
AssignCircuitRefPort (Layout Editor) 30-101
AssignRefPort (Layout Editor) 30-103
ClearRefPort (Layout Editor) 30-105
CreateCircuitPort (Layout Editor) 30-106
CreateEdgePort (Layout Editor) 30-108
CreateNPort (Layout Editor) 30-111
CreatePortInstancePorts (Layout Editor) 30-113
CreatePortsOnComponents (Layout Editor) 30-113

Contents-52
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetPortInfo (Layout Editor) 30-114


RemovePortsFromAllNets (Layout Editor) 30-117
RemovePortsFromNet (Layout Editor) 30-117
RemovePortsOnComponents (Layout Editor) 30-118
Miscellaneous Methods 30-119
AlignObjects (Layout Editor) 30-121
ChangeOptions (Layout Editor) 30-122
ClipPlane 30-128
CopyToHFSS 3D Layout (Layout Editor) 30-128
CutOutSubDesign (Layout Editor) 30-129
Defeature Objects (Layout Editor) 30-134
Duplicate (Layout Editor) 30-135
Edit3DComponentDefinition 30-136
EraseMeasurements (Layout Editor) 30-137
ExportDXF (Layout Editor) 30-137
ExportGDSII (Layout Editor) 30-140
ExportGerber (Layout Editor) 30-142
ExportNCDrill (Layout Editor) 30-145
GetComponentInfo (Layout Editor) 30-147
GetCompInstanceFromRefDes (Layout Editor) 30-148
GetComponentPins (Layout Editor) 30-149
GetComponentPinInfo (Layout Editor) 30-150
GetEditorName (Layout Editor) 30-151
GetMaterialList (Layout Editor) 30-151
GetProperties (Layout Editor) 30-152
GetPropertyValue (Layout Editor) 30-152
GetSelections (Layout Editor) 30-152
Heal (Layout Editor) 30-153
PageSetup (Layout Editor) 30-156
PushExcitations 30-157

Contents-53
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SelectAll (Layout Editor) 30-160


SetPropertyValue (Layout Editor) 30-161
StitchLines (Layout Editor) 30-161
UnselectAll (Layout Editor) 30-162
ZoomToFit (Layout Editor) 30-162
31 - Schematic Scripting 31-1
Method Format 31-2
Editor Scripting IDs 31-4
Format of IDs for different schematic objects: 31-4
Format for Components 31-5
Create Method List 31-6
CreateArc (Schematic Editor) 31-7
CreateCircle (Schematic Editor) 31-10
CreateComponent (Schematic Editor) 31-13
CreateGlobalPort (Schematic Editor) 31-15
CreateGround (Schematic Editor) 31-19
CreateLine (Schematic Editor) 31-22
CreateNPort (Schematic Editor) 31-25
CreatePagePort (Schematic Editor) 31-27
CreateIPort (Schematic Editor) 31-30
CreatePolygon (Schematic Editor) 31-34
CreateRectangle (Schematic Editor) 31-37
CreateText (Schematic Editor) 31-40
CreateWire (Schematic Editor) 31-44
General Method List 31-48
Activate (Schematic Editor) 31-50
AddPinGrounds (Schematic Editor) 31-51
AddPinIPorts (Schematic Editor) 31-53
AddPinPageConnectors (Schematic Editor) 31-55
AlignHorizontal (Schematic Editor) 31-56

Contents-54
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AlignVertical (Schematic Editor) 31-57


BringToFront (Schematic Editor) 31-58
CloseEditor (Schematic Editor) 31-60
Copy (Schematic Editor) 31-60
CopyData [Schematic Editor] 31-61
CopySubdesign [Schematic Editor] 31-62
CreatePage (Schematic Editor) 31-63
Cut (Schematic Editor) 31-64
DeactivateOpen (Schematic Editor) 31-65
DeactivateShort (Schematic Editor) 31-66
Delete (Schematic Editor) 31-67
DeletePage (Schematic Editor) 31-68
ElectricRuleCheck (Schematic Editor) 31-69
ExportImage (Schematic Editor) 31-70
FindElements (Schematic Editor) 31-71
FitToBorder [Schematic Editor] 31-74
FlipHorizontal (Schematic Editor) 31-74
FlipVertical (Schematic Editor) 31-76
GridSetup (Schematic Editor) 31-77
Move (Schematic Editor) 31-80
NameNets (Schematic Editor) 31-81
PageBorders (Schematic Editor) 31-83
Pan (Schematic Editor) 31-84
Paste (Schematic Editor) 31-85
PasteData [Schematic Editor] 31-86
PasteDesign (Schematic Editor) 31-87
PushExcitations 31-89
Rotate (Schematic Editor) 31-92
SelectAll (Schematic Editor) 31-94
SelectPage (Schematic Editor) 31-95

Contents-55
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SendToBack 31-96
SetPageData [Schematic Editor] 31-97
ShowVariableBlock (Schematic Editor) 31-100
SortComponents (Schematic Editor) 31-100
Wire (Schematic Editor) 31-101
ZoomArea (Schematic Editor) 31-102
ZoomIn (Schematic Editor) 31-103
ZoomOut (Schematic Editor) 31-104
ZoomPrevious (Schematic Editor) 31-105
ZoomToFit (Schematic Editor) 31-106
Property Method List 31-107
ChangeProperty (Schematic Editor) 31-107
GetEvaluatedPropertyValue (Schematic Editor) 31-108
GetProperties (Schematic Editor) 31-109
GetPropertyAttribute [Schematic Editor] 31-111
GetPropertyValue (Schematic Editor) 31-112
SetPropertyValue (Schematic Editor) 31-113
Information Method List 31-114
GetAllPorts 31-115
GetCompInstanceFromRefDes (Schematic Editor) 31-115
GetComponentInfo (Schematic Editor) 31-116
GetComponentPins (Schematic Editor) 31-118
GetComponentPinInfo (Schematic Editor) 31-119
GetComponentPinLocation [Schematic Editor] 31-120
GetEditorName (Schematic Editor) 31-121
GetNetConnections (Schematic Editor) 31-122
GetNumPages [Schematic Editor] 31-123
GetPortInfo (Schematic Editor) 31-124
GetSelections (Schematic Editor) 31-125
GetSignals (Schematic Editor) 31-126

Contents-56
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetWireConnections (Schematic Editor) 31-128


GetWireInfo (Schematic Editor) 31-130
GetWireSegments (Schematic Editor) 31-132
32 - Definition Manager Script Commands 32-1
Add [component manager] 32-2
AddDataset 32-21
AddDefinitionFromBlock 32-24
AddMaterial 32-29
Add [padstack manager] 32-33
Add [symbol manager] 32-40
AreMaterialPropertiesEqual 32-50
AreSurfaceMaterialPropertiesEqual 32-51
ChangeProperty (Symbol Editor) 32-52
CloneMaterial 32-65
DeleteDataset 32-66
DoesMaterialExist 32-67
Edit [component manager] 32-68
EditDataset 32-95
EditMaterial 32-97
Edit [padstack manager] 32-107
ExportDataset 32-113
Export [footprint manager] 32-114
ExportMaterial 32-115
Export [padstack manager] 32-116
ExportScript 32-117
Export [symbol manager] 32-118
GetProjextMaterialNames 32-119
GetPropertyValue 32-120
ImportDataset 32-121
Remove [component manager] 32-124

Contents-57
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Remove [footprint manager] 32-125


RemoveMaterial 32-126
Remove [padstack manager] 32-127
RemoveScript 32-129
Remove [symbol manager] 32-130
RemoveUnusedDefinitions 32-131
SetPropertyValue 32-132
UpdateDefFromBlock 32-134
Component Manager Script Commands 32-136
Add [component manager] 32-137
AddDynamicNPortData [component manager] 32-155
AddNPortData [component manager] 32-159
AddSolverOnDemandModel 32-164
ClearSolutionCache [component manager] 32-165
Edit [component manager] 32-165
EditSolverOnDemandModel 32-192
EditWithComps [component manager] 32-192
Export [component manager] 32-204
GetData [component manager] 32-205
GetNames [component manager] 32-206
GetNPortData [component manager] 32-207
GetSolverOnDemandData 32-210
GetSolverOnDemandModelList 32-210
IsUsed [component manager] 32-210
Remove [component manager] 32-211
RemoveSolverOnDemandModel 32-212
RemoveUnused [component manager] 32-212
Update Dynamic Link [component manager] 32-213
Footprint Manager Script Commands 32-214
Add [footprint manager] 32-215

Contents-58
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Edit [footprint manager] 32-237


EditWithComps [footprint manager] 32-238
Export [footprint manager] 32-255
GetData [footprint manager] 32-256
GetNames [footprint manager] 32-257
IsUsed [footprint manager] 32-258
Remove [footprint manager] 32-258
RemoveUnused [footprint manager] 32-259
Material Manager Script Commands 32-260
GetData [material manager] 32-261
GetNames [material manager] 32-261
GetProperties [material manager] 32-263
IsUsed [material manager] 32-263
RemoveUnused [material manager] 32-264
Model Manager Script Commands 32-265
Add [model manager] 32-265
ConvertToDynamic 32-276
ConvertToParametric 32-276
Edit [deprecated] 32-277
EditWithComps [model manager] 32-277
Export [model manager] 32-289
GetData [model manager] 32-290
GetNames [model manager] 32-291
IsUsed [model manager] 32-291
Remove [model manager] 32-292
RemoveUnused [model manager] 32-293
Network Data Explorer Manager Script Commands 32-294
ExportFullWaveSpice 32-295
ExportNetworkData 32-296
ExportNMFData 32-299

Contents-59
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Padstack Manager Script Commands 32-304


Add [padstack manager] 32-305
Edit [padstack manager] 32-311
EditWithComps [padstack manager] 32-318
Export [padstack manager] 32-326
GetData [padstack manager] 32-327
GetNames [padstack manager] 32-327
IsUsed [padstack manager] 32-328
Remove [padstack manager] 32-328
RemoveUnused [padstack manager] 32-329
Script and Library Scripts 32-330
AddScript 32-331
EditScript 32-332
ExportScript 32-333
ModifyLibraries 32-334
RemoveScript 32-335
Symbol Manager Script Commands 32-336
Add [symbol manager] 32-337
BringToFront [symbol manager] 32-347
Edit [deprecated] 32-348
EditWithComps [symbol manager] 32-348
Export [symbol manager] 32-360
GetData [symbol manager] 32-361
GetNames [symbol manager] 32-362
IsUsed [symbol manager] 32-362
Remove [symbol manager] 32-363
RemoveUnused [symbol manager] 32-364
33 - Design Verification Script Commands 33-1
AddRuleSet 33-1
AddRun 33-2

Contents-60
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

DeleteRuleSet 33-5
DeleteRun 33-5
EditRuleSet 33-5
EditRun 33-7
RenameRuleSet 33-9
RenameRun 33-10
RunAllDV 33-10
RunAllRuleSetDV 33-11
RunDV 33-11
34 - Core Global Script Context Commands 34-1
AddErrorMessage 34-1
AddFatalMessage 34-2
AddInfoMessage 34-2
AddWarningMessage 34-3
LogDebug 34-3
LogError 34-4
35 - Example Scripts 35-1
VBScript Example Scripts 35-1
Data Export Script 35-1
Variable Helix Script 35-4
GetPropNames and GetPropValues for Layered Impedance Boundary Script 35-8
IronPython Example Scripts 35-11
BH Coordinates Python Script 35-11
Script Contents 35-11
Posco_BH_Curve.tab Contents 35-13
Equation Based Curve Python Script 35-16
HFSS Waveguide Array Python Script 35-19
Index Index-1

Contents-61
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Contents-62
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

1 - Introduction to Scripting
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 in the order in which they appear.
Electronics Desktop can record scripts in VBScript or IronPython, and can run external scripts
written in VBScript, IronPython, CPython, or JavaScript. Additionally, it contains an IronPython
command shell for executing scripts.
When running Ansys Electronics Desktop from the command line, scripts can be written in any
language that provides Microsoft COM methods.
The following sections contain more information about scripting:
l Scripting Help Conventions – explains the layout of the scripting help.
l Introduction to VBscript – provides a broad overview of VBscript
l Introduction to IronPython – provides a broad overview of IronPython.
l Introduction to C-Python – provides guidance on using C-Python for Ansys Electronics
Desktop scripts.
l Ansys Electronics Desktop Scripting – details instructions and tips for running, recording,
and working with scripts in Electronics Desktop.

Scripting Help Conventions


The majority of this guide lists individual script commands using the following format.
[ScriptName]
[Description of script use.]

UI Access [UI commands corresponding to the script command, if any.]

Parameters
[List of arguments taken by the script command, if any. Includes argument
types and brief descriptions.]
Return Value [The script's return value, if any.]

Python Syn- [Correct syntax for the command in Python. Arguments are enclosed in angle
tax brackets (<>).]
Python [Sample script]
Example

Introduction to Scripting 1-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[Correct syntax for the command in VBscript. Arguments are enclosed in


VB Syntax
angle brackets (<>)
VB Example [Sample script]

Variable Types
The following data types are used throughout the help:
l <string> – use within quotation marks.
l <bool> – boolean value; should be set to either True or False.
l <int> – an integer. For example, 1.
l <double> – a double precision value. For example, 1.2.
l <array> – in VBscript, an array; in IronPython, a list contained in square brackets.
l <value> – can be an integer, string, or VBscript variable, depending on context.

Introduction to VBScript
Ansys Electronics Desktop can use Microsoft® Visual Basic® Scripting (VBScript) to record mac-
ros. VBScript is based on the Microsoft Visual Basic programming language.
This chapter provides an overview of key VBScript components.
Simple and Composite Names
VBScript Variables
VBScript Operators
Controlling Program Execution
Looping Through Code
VBScript Procedures
Converting Between Data Types
Including Scripts
Aborting Scripts
Interacting with a Script
Recommended VBScript References
Sample HFSS Script
Sample Circuit Script
Sample Q3D Script

Introduction to Scripting 1-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

For more details about VBScript, please see the Recommended VBScript References section at
the end of this chapter.
Simple and Composite Names
Components, symbols, footprints, models, and padstacks possess either "simple" names or
"composite" names. Composite names are used to distinguish items from libraries that may pos-
sess the same simple name. A composite name is created by combining an item’s library name
with its simple name. Composite names for definitions are unique, but simple names are not.
l Composite names are used by definition manager script commands to uniquely identify
script definitions.
l Materials and scripts do not have composite names, so project definitions for these items
must possess a unique simple name.
l The format of a composite name is LibraryName:SimpleDefinitionName. For example, the
composite name for the component "CAP_ in" the system library Nexxim Circuit Ele-
ments\Capacitors is "Nexxim Circuit Elements\Capacitors:CAP_in."
l The format of a composite name in a project is OriginLibraryName:SimpleDefinitionName.
For example, the composite name for the project component "CAP_" that was originally
from the system library Nexxim Circuit Elements\Capacitors is "Nexxim Circuit Ele-
ments\Capacitors:CAP_".
l Not all definitions in a project have a library of origin. Newly added definitions do not have
a library of origin, and project definitions whose names are changed do not have a library
of origin (even if they did before the name change). As a result, the composite name for
items without a library of origin is the item’s simple name itself. For example, the com-
posite name for the project component "CAP_" that came from a system library and was
renamed to "MyCAP_" is "MyCAP_".

To construct a composite name, select Tools > Edit Configured Libraries > Components to
open the Edit Libraries dialog box. The subnames used to construct a composite name can be
found in the Name and Origin columns that correspond to a particular component. The Origin
column contains the library portion of the composite name, while the Name column contains the
simple portion of the composite name.
VBScript Variables
A VBScript variable is a placeholder representing information that may change during the time
your script is running. Variables are useful because they let you assign a short and easy to
remember name to each piece of data you plan to use. Use a variable name in a script to view or
modify its value.
Declaring Variables
To declare variables explicitly in a script, use the Dim, Public, or Private statements. For
example:

Introduction to Scripting 1-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Dim box_xsize
After declaring a variable, you can assign information to it. For example:
box_xsize = "3mm"
You can declare multiple variables by separating each variable name with a comma. For
example:
Dim Top, Bottom, Left, Right
You can also declare a variable implicitly by simply using its name in your script. Doing so is not
generally a good practice because you could misspell the variable name in one or more places,
causing unexpected results when your script is run. For that reason, the Option Explicit state-
ment is available to require explicit declaration of all variables. The Option Explicit statement
should be the first statement in your script.
Declaring Variables in Python

Python does not require you to declare variables before you assign a value to them.
You can directly assign information to it. For example:
box_xsize = "3mm"
Variable Naming Conventions
You should use names that are short but intuitive and easy to remember. Use the following con-
ventions for naming variables in VBScript:
l Begin with an alphabetic character.
l Cannot contain an embedded period.
l Must not exceed 255 characters.
l Must be unique in the scope in which it is declared.
l Do not use VBScript keywords.

Scope and Lifetime of Variables


Variables at the script level are available to all procedures within the script. At the procedure
level, variables are available only within the procedure. It has local scope and is a procedure-
level variable.
The lifetime of a variable depends on how long it exists. The script-level variables exist from
declaration until the end of the script. A procedure-level variable exists only as long as you are in
the procedure and is destroyed when the procedure exits.
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)

Introduction to Scripting 1-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

All arrays in VBScript are zero-based, so the array above actually contains 3 elements. You
assign data to each of the array’s 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().

If you do not know the size of the array at declaration or the size changes during the time your
script is running, you can use dynamic arrays. They are declared without size or number of
dimensions inside the parentheses. For example:
Dim FirstArray()
ReDim SecondArray()
To use a dynamic array, you must subsequently use ReDim to determine the number of dimen-
sions and the size of each dimension. You can also use the Preserve keyword to preserve the
contents of the array as the resizing takes place.
ReDim FirstArray(25)
ReDim Preserve FirstArray(30)
VBScript Operators
VBScript provides operators, which are grouped into these categories: arithmetic operators,
comparison operators, and logical operators.
Please see the online VBScript User’s Guide for more details.

Introduction to Scripting 1-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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 par-
entheses, however, standard operator precedence is maintained.
When an expression contains operators from more than one category, they are evaluated in the
following order:

1. Arithmetic Operators
2. String Concatenation Operator (&)
3. Comparison Operators
4. Logical Operators

Arithmetic operators within a single expression are evaluated in the following order of pre-
cedence:

1. Exponentiation (^)
2. Multiplication and Division (*,/): These two operators are of equal precedence and are eval-
uated in the left-to-right order in which they appear within the expression.
3. Integer Division (\)
4. Modulus Arithmetic (Mod)
5. Addition and Subtraction (+,-): These two operators are of equal precedence and are eval-
uated in the order in which they appear within the expression.

If the same arithmetic operator appears multiple times within a single expression, they are eval-
uated in the left-to-right order in which they appear.
Comparison operators all have equal precedence and are evaluated in the left-to-right order in
which they appear within the expression.
Logical operators all have equal precedence and are evaluated in the left-to-right order in which
they appear within the expression.
Arithmetic Operators
Following is a list of VBScript’s arithmetic operators:

Symbol Description
^ Exponentiation
- Unary negation
* Multiplication
/ Division

Introduction to Scripting 1-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

\ Integer division
Mod Modulus arithmetic
+ Addition
- Subtraction

Note:

For the order of precedence for these operators, see Operator Precedence.

String Concatenation Operator


The ampersand symbol (&) is used to perform string concatenation. This operator appends the
second string to the first string.
Example:
"Hello," & " isn't it a lovely day?"
produces the following resultant string:
"Hello, isn't it a lovely day?"
Comparison Operators
Following is a list of VBScript’s comparison operators:

Symbol Description
= Equality
<> Inequality
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
Is Object equivalence

Note:

All comparison operators have the same precedence. When multiple comparisons
exist in a single expression, evaluate them in the left-to-right order in which they
appear.

Introduction to Scripting 1-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Logical Operators
Following is a list of VBScript’s logical operators:

Symbol Description
Not Logical negation
And Logical conjunction
Or Logical disjunction
Xor Logical exclusion
Eqv Logical equivalence
Imp Logical implication

Note:

All logical operators have the same precedence. When multiple logical operators exist
in a single expression, evaluate them in the left-to-right order in which they appear.

Controlling Program Execution


You can use conditional statements to control the flow of a script. There are two types of con-
ditional statements in VBScript:
l If...Then...Else
l Select Case

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
Using Select Case
Following is an example that demonstrates the Select Case conditional statement:

Introduction to Scripting 1-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Select Case primitive_name


Case "Box1"
<statements to execute>
Case "Cylinder1"
<statements to execute>
Case Else
<statements to execute>
End Select
Looping Through Code
Looping allows you to run a group of statements repeatedly. There are two types of loops:
l For...Next: Uses a counter to run statements a specified number of times.
l Do...Loop: Loops while or until a condition is True.

When using conditional statements that test for zero voltage/current, it is important to note that a
real voltage or current should not be trusted to be exactly zero, even when it should be. Typ-
ically, the voltage or current is often on the order of 'epsilon' (1e-16) or smaller; hence, it is
nonzero in value.
Using a For...Next Loop
The For...Next type of loop allows you to run a group of statements repeatedly. It uses a counter
to run statements a specified number of times. Following is an example that demonstrates the
For...Next loop:
For variable = start To end
<statements to execute>
Next
You can exit early from a For...Next loop with the Exit For statement.
Using a Do Loop
You can use Do...Loop statements to run a block of statements until (or while) a condition is
true.
Repeating Statements While a Condition is True
Use the While keyword to check a condition in a Do...Loop statement. The syntax is as follows:
Do While condition
<statements to execute>
Loop

Introduction to Scripting 1-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Repeating a Statement Until a Condition Becomes True


Following is the syntax:
Do Until condition
<statements to execute>
Loop
You can exit early from a loop by using the Exit For statement.
VBScript Procedures
In VBScript, there are two kinds of procedures, Sub and Function. These procedures are called
by name, they can receive arguments, and each performs a specific task with a group of
VBScript statements. If there is no argument, then the Sub or Function statement must include
an empty set of parentheses.
Function Procedures
A Function returns a value by assigning a value to its name in one or more statements. Following
is the syntax of a Function:
Function FunctionName([arguments])
<Function statements>
End Function
Sub Procedures
A Sub procedure is like a function procedure, except that it does not return a value through its
name. Following is the syntax of a Sub:
Sub ProcedureName([arguments])
<Procedure statements>
End Sub
Converting Between Data Types
To convert data from one subtype to another, use the following VBScript functions:

CStr Syntax: CStr(variablename).


Converts variablename to a string. For example, it can be used to convert the number
2.5 to the string "2.5".
CBool Syntax: CBool(variablename).
Converts variablename to a boolean. If variablename is 0 or "0", CBool returns False.
Otherwise it returns True.
CDbl Syntax: CDbl(variablename).

Introduction to Scripting 1-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Converts variablename to a double precision number. For example, it can be used to


convert the string "2.5" to the number 2.5.
CInt Syntax: CInt(variablename).
Converts variablename to an integer.

Including Scripts
You can include one script within another using the following command:
#include "<scriptfilename>"
Where scriptfilename is the full path name to a file that contains script text, or is the name of a
script in the project library or script library (listed in the project window under the Defin-
itions/Scripts directory).
The command works for VBScript, JScript, and for the following:
l Scripts in the project library that are run by right-clicking the script icon in the project win-
dow and choosing Run Script
l Scripts in files that are external are run by choosing Tools> Run Script
l Scripts that are specified as callbacks in the Property dialog box
l Scripts that are run to draw parameterized footprints in layout

An include command can be placed anywhere in a script, but for readability it is recommended
that commands be placed at the beginning of a file. The same script can be included multiple
times without error, and circular inclusions will be ignored.
Aborting Scripts
You can abort a script that is running in the desktop simply by pressing the ESC key. Ter-
minating a script in this manner works for each of the following:
l Scripts in the project library that are run by right-clicking the script icon in the project win-
dow and choosing Run Script.
l Scripts in files that are external can be run by choosing Tools > Run Script.
l Scripts that are specified as callbacks in the Property dialog box.
l Scripts that are run to draw parameterized footprints in layout.

Interacting with a Script


VBScript provides two functions that enable you to interact with a script while it is running:
the InputBox function and the MsgBox function.
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

Introduction to Scripting 1-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

users_string = InputBox ("text prompt", "title of the pop-up dialog _


box", "default text for the input box")

The last two arguments to the function are optional.

The MsgBox function shows a message and returns a number based on the button the user
presses. For example:
MsgBox ("message text")
Recommended VBScript References
Microsoft Corporation. VBScript User’s Guide.
Available http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/htm-
l/vbstutor.asp.
Childs, M., Lomax, P., and Petrusha, R. VBScript in a Nutshell: A Desktop Quick Reference.
May 2002. O’Reilly & Associates. ISBN: 1-56592-720-6.
Sample HFSS Script
Following is an example of an Ansys Electronics Desktop script. It includes comment lines,
which are preceded by either an apostrophe ( ’) or the word REM, that offer explanations for
each preceding line or lines. VBScript keywords appear in bold font.

’ ----------------------------------------------
’ 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,
REMPublic, or Private to declare variables. As VBScript has no built-in data types (like
REMinteger, string, etc.), all variables are treated as variants, which can store any type of
REMinformation. In this example, the three variables will be used as objects. When
REMrecording scripts in HFSS, variants that will be used as objects always begin with o.

Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")

Introduction to Scripting 1-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

’ You can use Set to assign an object reference to a variable. A copy of the object is not
’ created for that variable. Here CreateObject is a function that takes a string as input
’ and returns an object. The object is assigned to the variable oAnsoftApp.

Set oDesktop = oAnsoftApp.GetAppDesktop()


’ 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.

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.

Set oProject = oDesktop.GetActiveProject


oProject.InsertDesign "Hfss", "HFSSDesign1", "DrivenModal", ""
’ 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.

Set oDesign = oProject.SetActiveDesign("HFSSDesign1")


Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateBox Array("NAME:BoxParameters", "XPosition:=", _
"0mm", "YPosition:=", "0mm", "ZPosition:=", "0mm", _
"XSize:=", "1.6mm", "YSize:=", "1.2mm", "ZSize:=", _
"0.8mm"), Array("NAME:Attributes", "Name:=", "Box1", "Flags:=", _
"", "Color:=", "(132 132 193)", "Transparency:=", _
0.400000005960464, "PartCoordinateSystem:=", _
"Global", "MaterialName:=", "vacuum", "SolveInside:=", true)
’ oEditor.CreateBox is a Sub procedure that takes two array variables as input. The
’ first array is for the box’s geometric parameters and the second array is for the box’s

Introduction to Scripting 1-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

’ attributes. You can modify the italicized entries to create a different box. In VBScript,
’ Array is a function that returns a variant containing an array. The underscore
’ character ( _ ) here indicates that the statement continues to the next line. The
’ underscore character must be placed outside of string constants, or else VBScript will
’ recognize the character as part of the string constant rather than an indication that the
’ string continues on the next line. Following is an example of proper use of the underscore
’ character:
’ Msgbox("Please include units when creating variables " & _
’ "that require dimensions."
’ Following is an example of improper use of the underscore character:
’ Msgbox("Please include units when creating variables _
’ that require dimensions."

For additional Ansys Electronics Desktop script examples, see Example Scripts.
Sample Q3D Extractor Script
Following is an example Q3D Extractor script. It includes comment lines, preceded by either an
apostrophe or the word REM, that offer explanations for each preceding line or lines. VBScript
keywords appear in bold.
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
REM Dim is used to declare variables and means dimension. In VBScript you can use Dim,
REMPublic, or Private to declare variables. As VBScript has no built-in data types (like
REMinteger, 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 Q3D Extractor, variants that will be used as objects always begin with o.
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
’ You can use Set to assign an object reference to a variable. A copy of the object is not ’ created
for that variable. Here CreateObject is a function that takes a string as input ’ and returns an
object. The object is assigned to the variable oAnsoftApp.

Introduction to Scripting 1-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Set oDesktop = oAnsoftApp.GetAppDesktop()


’ 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.

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 ’ NewPro-
ject of the object oDesktop is called. This Sub does not take an input.

Set oProject = oDesktop.GetActiveProject


oProject.InsertDesign "Q3D Extractor", "Q3DDesign1", "", ""
’ 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 Inser-
tDesign of the object oProject.

Set oDesign = oProject.SetActiveDesign("Q3DDesign1")


Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateBox Array("NAME:BoxParameters", "XPosition:=", _
"0mm", "YPosition:=", "0mm", "ZPosition:=", "0mm", _
"XSize:=", "1.6mm", "YSize:=", "1.2mm", "ZSize:=", _
"0.8mm"), Array("NAME:Attributes", "Name:=", "Box1", "Flags:=", _
"", "Color:=", "(132 132 193)", "Transparency:=", _
0.400000005960464, "PartCoordinateSystem:=", _
"Global", "MaterialName:=", "vacuum", "SolveInside:=", true)
’ oEditor.CreateBox is a Sub procedure that takes two array variables as input. The ’ first array is
for the box’s geometric parameters, and the second array is for the box’s ’ attributes. You can
modify the italicized entries to create a different box. In VBScript, ’ Array is a function that
returns a variant containing an array. The underscore ’ character ( _ ) here indicates that the
statement continues to the next line. The ’ underscore character must be placed outside of string
constants, or else VBScript ’ recognizes the character as part of the string constant rather than
an indication that the ’ string continues on the next line. Following is an example of proper use of
the underscore ’ character:
’ Msgbox("Please include units when creating variables " & _
’ "that require dimensions."

Introduction to Scripting 1-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

’ Following is an example of improper use of the underscore character:


’ Msgbox("Please include units when creating variables _
’ that require dimensions."

For additional Ansys Electronics Desktop script examples, see Example Scripts.

Introduction to IronPython
IronPython is an implementation of the Python programming language targeting the .NET
runtime. What this means in practical terms is that IronPython uses the Python programming lan-
guage syntax and standard python libraries and can additionally use .NET classes and objects
to give one the best of both worlds. This usage of .NET classes is fairly seamless in that a class
defined in a .NET assembly can be used as a base class of a python class.

Scope
Functioning as a tutorial on Python or IronPython is way out of the scope of this document.
There are several excellent resources online that do a very good job in that regard. This doc-
ument only attempts to provide a limited introduction to IronPython as used to script Ansys EM
products.
This document is also not a tutorial on the scripting of Ansys EM products. It complements the
existing scripting guide (available from a product's Help menu) and provides a pythonic inter-
pretation of that information. The reader might have to refer to either the scripting guide or recor-
ded samples of VBScript to follow some of the sections.

Python compatibility
The version of IronPython in use is 2.7 and built on the .NET framework version 4.0: this version
targets Python 2.7 language compatibility. While most python files will execute under
IronPython with no changes, python libraries that make use of extensions written in the C pro-
gramming language (NumPy or SciPy for instance), are not expected to work under IronPython.
In such cases, it might be possible to locate .NET implementation of such libraries or explore the
use of IronClad.
(http://code.google.com/p/ironclad/).

Advantages of IronPython
The advantages that IronPython use provides are significant:
l Python has a large eco-system with plenty of supporting libraries, Visual IDEs and debug-
gers. It is actively developed and enhanced.
l IronPython, in addition, has access to the entire .NET eco system. This allows us, for
instance, to create a modern GUI using the System.Windows.Forms assembly from
IronPython code and call any other .NET assembly for that matter.

Introduction to Scripting 1-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l The use of IronPython's technologies enables the ability to interactively script Desktop
(feature in development). This allows better discovery of the scripting APIs as well as dir-
ectly programming to the scripting API in python, a language more tractable and platform
independent compared with VBScript.
l The Python syntax of dictionaries is somewhat easier to read and write when supplying
arguments to the scripting methods.

This document describes IronPython briefly and then goes on to describe the desktop provided
IronPython scripting console and scripting with IronPython. You can open an IronPython Com-
mand Window by clicking Tools > Open Command Window.

The document assumes that you know how desktop scripting works using VBScript or Javas-
cript.
Introduction to IronPython
IronPython Mini Cookbook
Translating Script Commands from VBScript to IronPython
Scripting Using Iron Python
Standalone IronPython and Desktop IronPython
IronPython Examples
Creating User Defined Primitives and User Defined Models in Python Scripts
IronPython Mini Cookbook
This topic presents simple counterparts between IronPython and VBScript. It does not provide a
full tutorial on IronPython syntax. Because IronPython is a Python implementation, you can

Introduction to Scripting 1-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

consult Python documentation for additional information.


Comments

VBScript IronPython
Comments start with a single quote: Comments start with a hash:
' comment # comment

Assigning/Creating Variables

VBScript IronPython
Declare with a Dim: No Set syntax. Simply create and assign:
Dim doc doc = app.GetActiveProject()
Assignment then needs a Set instruction:
Set doc = app.GetActiveProject()

Create Lists/Arrays

VBScript IronPython
Declare as array of String with 11 indices, Declare an empty array:
from 0 through 10:
myEmptyArray = []
Dim myArray(0 to 10) as String
Declare an array and initialize it with 5 ints:
myArray(0) = "Hello"
myInitedArray = [ 1, 2, 3, 4, 5]
myArray(1) = "bye"
Python lists can have items of any type and
Declare an array with no size: there is no pre-declaration. Declare an array
and init with mixed types:
Dim array2() as String
mixed = ["hello", 1 ,2 ["nested"]]
Re-dimension an array once size is known:
Append to an array:
ReDim array2(0 to 2) as String
mixed.append( 3.5 )
array2(0) = "this"
array2(1) = "also"

Introduction to Scripting 1-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Create Dictionaries/Maps

VBScript IronPython
Declare with a Dim: An IronPython dictionary is a collection of
name value pairs. Just like arrays, there is no
Dim dict restriction on the keys or the values. For pur-
Use the CreateObject function with ProgID poses of Ansys EM scripting, however, all
Scripting.Dictionary: keys must be strings

Set dict = CreateObject _ Delimiters are curly braces. Use a colon


between the key and the value. Separate key
("Scripting.Dictionary") value pairs with a comma:
Add items using the object, key, item syntax: myDict = {
dObject.Add key, item "a" : 1,
"b" : "hello there",
"c" : [ 1, 2, "abc"]
}

Boolean Values

VBScript IronPython
Boolean literals are in lower case: The first letter is capitalized:
true True
false False

Converting Numbers to Strings and Vice Versa

VBScript IronPython
Use CInt, CDbl, CBool, CLng to convert the Use integer() or float() or double() functions to
string representation to the number rep- cast a string CONTAINING the string rep-
resentation. Use IsNumber to check before resentation of whatever you are casting to:
conversion:
strInt = "3"
Dim nStr = "100"
intVal = int(strVal)
Dim n = CInt(nStr)
floatVal = float(strVal)
Use CStr to convert a number to its string rep-
resentation: Invoke the str() function with the int/float values
as needed. You can alternately use the string
Dim v, vStr formatting method listed below:
v = 100 strVal = str(42)
vStr = CStr(v) strVal = str(42.345)

Introduction to Scripting 1-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

String Formatting/Concatenation

VBScript IronPython
String concatenation uses the & operator: If you have two strings, you can always con-
catenate them using the '+' operator:
Dim allStr, str1
str1 = "hello"
str1 = " how are you"
str2 = "world"
allStr = "Hello " & " There" & str1
str12 = str1 + " " + str2
There seems to be no direct string formatting
function in VBScript. Ssing string con- If you have different types (for instance a string
catenation or using Replace are the two built-in and an int), you must use the string formatting
options: commands. When formatting multiple argu-
ments, they must be entered as a tuple ( item1,
Dim fmt = "{1} climbs stalk {2}" item2, ):
Dim str = Replace(fmt, "{1}", "jack") num = 10
str = Replace(str, "{2"}, 10) str3 = "%s climbs stalk %d" % ("jack", num)
str4 = "%d stalks" % num

Looping over Lists

VBScript IronPython
Dim myArray(0 to 2) as String vals = [1, 3, 3.456]
myArray(0) = "alpha"
myArray(1) = "bravo" def process(val):
myArray(2) = "charlie" return 2*val

For Each i in myArray for i in vals:


Print i print i
Next print " -> " process(i)

Looping over a Range

VBScript IronPython
To loop over a range, specify start, end, and for i in range(0, 10):
step:
print i
For i = 0 To 10 Step 1
Print i
Next

Introduction to Scripting 1-20


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Related Topics:

Indentation in IronPython

Methods in IronPython

Introduction to IronPython

Translating Script commands from VBScript to IronPython

Scripting Using Iron Python

IronPython Samples

Indentation in IronPython
Python is a language where white space (spaces and tabs) is syntactically significant. You must
understand the basics of indentation before scripting in python.
Any statement that introduces a block of code should be written so that every line of the block
has the same indent (leading spaces or tabs) and the indent should be at least one more than
the indent of the introducing statement.

Note:

Python recommends the use of spaces over tabs.

Indenting Functions

Define a function that starts at 0 indentation:


def multInt(a,b):
Every line following def multInt that is expected to be a part of the function, must be indented
to line up with the function.
def multInt(a,b):
return a
Indenting If Conditions

Each line that belongs to the body of this function should have an indent that is more than the
indent used by the if statement.
def multInt(a,b):
If a%2 == 0:
return (a * b) + 100
else:
return (a * b) + 1000

Introduction to Scripting 1-21


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Methods in IronPython
Finding Methods

To list all methods available in the string module,import the module:


import string
Then get the directory listing:
dir(string)
This returns a list of all the methods available (as well as some __somename__ internal names
that can be ignored).
Help

Once you know a function name, you can get more help on it using the built-in help method.

Related Topics
Introduction to IronPython
Translating Script commands from VBScript to IronPython
Scripting Using Iron Python: Putting it all Together
IronPython Samples
Translating Script Commands from VBScript to IronPython
This topic briefly describes scripting methods and arguments via VBScript samples. The dis-
tinctions made here are significant and useful when translating scripts written in VBScript to
IronPython.

Related Topics
Script Method Argument
VBscript Method Call Types
Converting VBScript Function calls to IronPython Syntax
Introduction to IronPython
IronPython Mini Cookbook
Scripting Using Iron Python
IronPython Samples
Script Method Argument
Script method calls in VBscript generally take the form:
objectName .methodName ( arg1, arg2, ...)

Introduction to Scripting 1-22


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

The function call syntax is a standard followed by several programming languages. However,
the argument types in VBScript objects used for product scripting are restricted to the following:
l Primitive Types
l Named Arrays
l Named Functions
Primitive Types

Primitive types are the standard bool, int, float, double, and string.
Named Arrays

Named arrays are a special construct used very commonly and can be found in many recorded
script samples.
A named array begins with Array("NAME:someName" followed by a collection of comma sep-
arated values which can be:
l Primitive values
l Arrays of primitive values
l Additional named arrays
l Keys, in the form "keyName:=" followed by a primitive value or function
Named Functions

Named functions are arrays which start with Array( and do not have a leading "NAME:name"
item. They are always introduced by a key and can contain comma separated values of the
following type:
l A primitive value
l A key (of the form "keyName:=") followed by
o A primitive value
o Another function (nested function)

Related Topics
Translating Script commands from VBScript to IronPython
VBScript Method Call Types
VBScript method calls fall into two categories and the distinction between the two results in syn-
tax differences. These syntax differences are significant when converting VBScript to
IronPython.
VBScript Functions

Introduction to Scripting 1-23


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

In VBScript terminology, functions return values. The syntax for this is one shared with prac-
tically all programming languages:
Set oDesktop = oAnsoftApp.GetAppDesktop()
Set oProject = oDesktop.NewProject

Note:

If there are arguments, the method name is always followed by an argument list
enclosed in parentheses. If the argument list is empty, as shown above for the NewPro-
ject call, the parentheses can be omitted.

VBScript Sub-Routines
VBScript subroutines are those that do not have any return value. VBScript allows these to be
written without any parentheses even if they have a non-empty argument list.
oModule.CreateReport "XY Plot1", "Standard", "XY Plot", "optimtee
: optimtee", _
Array("Domain:=", "Sweep"), Array("Freq:=", Array("All"), "off-
set:=",_
Array("0uin")), Array("X Component:=", "Freq", "Y Component:=", _
Array("dB20(S(1,1))", "dB20(S(1,2))", "dB20(S(1,3))", _
"dB20(S(2,1))", "dB20(S(2,2))", "dB20(S(2,3))", "dB20(S(3,1))",
"dB20(S(3,2))", "dB20(S(3,3))")), Array()

Related Topics
Translating Script commands from VBScript to IronPython
Converting VBScript Function calls to IronPython Syntax
When used for scripting, IronPython function names are always followed by parentheses.
So:
l If you see a VBScript snippet that looks like a VBScript subroutine, remember to add par-
entheses.
l If you see a VBScript function that has no arguments and no parentheses, remember to
add them around an empty argument list.

The parentheses change is the only one to keep in mind when converting VBScript function calls
syntax to IronPython.

Introduction to Scripting 1-24


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Values

VBscript return values are sometimes assigned via the Set declaration. IronPython return values
are simple assignment (See: Iron Python Mini Cookbook).
Primitive Method Arguments

Replace each VBScript primitive with an equivalent IronPython primitive.


Boolean values in IronPython have their first letter capitalized (True instead of true and False
instead of false).
For arrays, the recommended approach is to simply replace a VBScript array with a Python
array. The mapping is simple:
l Change Array( to a square bracket [ and close with another square bracket ] instead of
a parenthesis )
l Remove the line continuation underscore symbol: _
l Map Boolean values correctly
Named Array Arguments

Formatting helps readability immensely but is not required.


All that must be done is:
l Add the parentheses, since the VBScript subroutine omits them
l Replace the Array( ) delimiters with [ ]
l Remove the Char(34) function (which introduced a double quote) and replace it with the
escaped double quote literal: \"
l Replace true with True
l Remove the line continuation symbol: _
Named Array Values with All Key Value Pairs

While it is generally not allowed to replace arrays and nested arrays with Python dictionaries, in
the case where the named array consists entirely of key value pairs, you can use a dictionary
and avoid typing the trailing := symbols after the keys. This further aids readability of the script.
l If all key value pairs
l Remove the trailing := after each key
l Replace the , after the key with a :
l If the named array is the top level argument, ensure that the NAME:name is present and is
split into NAME : name as a key value pair
l Enclose the converted array in a { } pair to declare the dictionary.

Introduction to Scripting 1-25


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Named Arrays with Nested Named Arrays

l Split the NAME:name field into a key value pair


l Translate array key value pair to a dictionary key value pair.
l Create a new key with the name of the nested array and keep the nested array (as an
array or as a dictionary) as its value. If the nested array is being retained as an array, the
NAME:name field should be retained in the array. If the nested array is being converted to
a dictionary, the name is optional: if also retained in the nested array, it must match the
outer key.

[ "NAME:name",
"key1:=" , 1,
"key2:=" , 2,
["NAME:name2", "R:=", 255]
]
Sample Script: Named array with nested named array in array syntax
The above named array with a nested named array (after conversion to IronPython as named
array) can be converted to a dictionary as well. The dictionary can take any of the following forms
{ "NAME" : "name",
"key1" : 1,
"key2" : 2,
"name2" : ["NAME:name2", "R:=", 255]
}
Sample Script: Named array with nested named array as mixed dictionary + array
{ "NAME" : "name",
"key1" : 1,
"key2" : 2,
"name2" : {"R" : 255}
}
Sample Script: Named array with nested named array in all dictionary syntax
{ "NAME" : "name",
"key1" : 1,
"key2" : 2,

Introduction to Scripting 1-26


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"name2" : {
"NAME" : "name2",
"R" : 255
}
}
Function Blocks

Function blocks in VBScript argument syntax are represented as arrays without the "NAME:.."
field. However, functions are always introduced by a key in a parent structure. Function blocks
can therefore never exist as a top-level argument. They are only found as the value pairs inside
a named array or inside another function block.

Important:

Function blocks and their items cannot be converted to dictionaries even though they
might be composed entirely of key value pairs.

The reason for this is the need to main the user-entered order. Every item in a function block is
expect to be transmitted to the script method in exactly the same order as typed out and this is
impossible to achieve when a dictionary is used (as the keys get reordered according to the dic-
tionary's internal tree/key sorting scheme).
When you see a function block, simply replace the Array( ) delimiters with python array delim-
iters [ ]
Scripting Using Iron Python
If you have existing VBScript/Javascript scripts use existing scripts them as much as possible by
either embedding the test into the IronPython script or invoking them.
Translating a script in VBScript to IronPython
Read the chapter on translation and study the samples in that chapter as well as those in the
appendix. For python syntax and the differences, the mini-cookbook chapter will also be useful.
Writing an IronPython script from scratch
Read through the scripting guide available from the product's help menu and translate the
VBScript methods described to IronPython using the information provided in the chapter on
translation. Studying the samples in the document will also prove helpful.
For python syntax and the differences, the mini-cookbook chapter will also be useful.
IronPython Script Execution Environment
Scripting using Embedded VBScript or JavaScript
Scripting with IronPython

Introduction to Scripting 1-27


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Standalone IronPython and Desktop IronPython

Related Topics
Introduction to IronPython
IronPython Mini-cookbook
Translating Script commands from VBScript to IronPython
Appendix: IronPython Samples
IronPython Script Execution Environment
Scripts written in IronPython are executed by desktop in four different ways:
l Tools > Open Command Window, to open the IronPython Command Window:

l Tools > Run Script menu item, select "IronPython" from the file type drop-down list.
l Launch the product with a script argument.
o HFSS -runscript someScript.py to keep HFSS GUI open after completing script exe-
cution.
o HFSS -features=beta -ng -runscriptandexit someScript.py to run HFSS in a non-
graphical mode and exit after script completion. Note that this is a beta feature sup-
ported for the HFSS and 3D Layout design types.
l Register an IronPython script as an external tool using the Tools > External Tools menu
item.

Introduction to Scripting 1-28


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

When desktop executes a script, it does so in an execution environment setup with predefined
variables and functions. These predefined variables and functions are how the script com-
municates with the desktop, and they come in four flavors addressed in the following subtopics:
Script Argument for IronPython
Script Argument for IronPython

When scripts are launched using the Tools > Run Script menu item, the dialog that pops up
allows the user to specify arguments.

Figure 1: Run Script dialog and script arguments


Any argument specified here is communicated to the script being executed as the predefined
variable ScriptArgument.

Related Topics
IronPython Script Execution Environment
Scripting using Embedded VBScript or JavaScript
Since script recording is still done in VBScript and users are expected to have a significant col-
lection of VBScript or JavaScript assets, it is useful to continue to use existing script files and
snippets even when scripting in IronPython. The various Run<*>Command methods have been
designed for this purpose.
For instance: one can create a parameterized cone in HFSS by executing the following
IronPython script from the Tools > Run Script menu.
# assign the VBScript snippet obtained from a script recording from
HFSS to
# coneScript and replace the BottomRadius recorded value with botRa-
dius
coneScript = """Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor

Introduction to Scripting 1-29


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject()
oProject.InsertDesign "HFSS", "HFSSPyTestDesign", "DrivenModal", ""
Set oDesign = oProject.SetActiveDesign("HFSSPyTestDesign")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateCone Array("NAME:ConeParameters", _
"XCenter:=", "0mm", "YCenter:=", "0mm", "ZCenter:=", "0mm",_
"WhichAxis:=", "Z", "Height:=", "2mm", _
"BottomRadius:=", "3mm", _
"TopRadius:=", "0mm"), Array("NAME:Attributes", "Name:=", _
"Cone1", "Flags:=", "", "Color:=", "(132 132 193)", "Trans-
parency:=", 0, _
"PartCoordinateSystem:=", "Global", "UDMId:=", "", "Mater-
ialValue:=", _
"" & Chr(34) & "vacuum" & Chr(34) & "", "SolveInside:=", _
true)
"""

SetScriptingLanguageToVBScript()
RunScriptCommand(coneScript)
Sample Script 11: Hybrid VBScript + IronPython scripting: parameterized Cone Creation
Even though recorded VBScript is used for scripting, the incremental functionality that is
provided using IronPython is the ability to write a GUI using IronPython/.NET, collect information
from the user and then modify or generate the VBScript commands to actually script the Ansys
EM desktop. This GUI functionality is cross platform and a significant positive. The following
example demonstrates a contrived use of a .NET window form to display the argument supplied
to the IronPython script (via the ScriptArgument variable).

#import the CLR references


import clr

Introduction to Scripting 1-30


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

clr.AddReference("System.Windows.Forms")

from System.Windows.Forms import Application, Form, Label, Button,


DockStyle

# the GUI form to show some text


# the class below derives from From (System.Windows.Forms.Form)
# imported above from the .NET assembly.
class ShowPropertiesForm(Form):
def __init__(self, name, text):
self.Name = name
self._label = Label()
self._label.Text = text
self._label.Dock = DockStyle.Fill

_button = Button()
_button.Text = "Close"
_button.Dock = DockStyle.Bottom
_button.Click += self._buttonPressed

self.Controls.Add(self._label)
self.Controls.Add(_button)

def _buttonPressed(self,sender,args):
self.Close()

#----------------------------------------------------
# Main script code
#----------------------------------------------------
#display the ScriptArgument variable as the text label

Introduction to Scripting 1-31


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

# in the form.
gui = ShowPropertiesForm("Sample Form", ScriptArgument)

# This makes it a modal dialog.


gui.ShowDialog()

# the following will make it a non-modal dialog


#Application.Run(gui)
Sample Script 12: Demonstrates the use of a .NET form from IronPython
While creating cross platform user interfaces from scripts is one of the main motivations driving
the adoption of IronPython, any .NET assembly can be used with the caveat that Linux use
requires Mono compatibility of any used assemblies.
While this hybrid approach is useful when you have existing VBScript commands that you want
to reuse or when you want to quickly parameterize a recorded sample, the one significant lim-
itation of this approach is the inability to capture return values from VBScript or JavaScript calls
that do return something. Full two way communication with the product requires the use of pure
IronPython to directly invoke the script objects as described below.

Related Topics
IronPython Script Execution Environment
Scripting with IronPython
While this section talks about directly interacting with the script objects, note that you can
execute VBScript or Javascript at any point using any of the available Run*Command functions.
using your existing script assets in this fashion and mixing with IronPython code for new func-
tionality as needed is a viable and option.
Access to the application scripting objects is provided via the predefined oDesktop object (as lis-
ted in Script Objects). Interacting with the script objects is very natural, method calls are made
just like in VBScript except that the argument syntax is somewhat simplified to follow natural
Python syntax. All primitive types (string, integer, double) map to the natural primitive types in
python. The only differences from the VBScript syntax are seen when specifying array type argu-
ments. The differences are described in earlier chapters.

Introduction to Scripting 1-32


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note:

The typical VBScript calls to obtain the registered COM scripting interface via
CreateObject calls and then obtain the oDesktop object from it using the GetAp-
pDesktop() is not needed (or even supported on all platforms). Since all scripting
occurs in the context of a running workbench, the available Desktop object is always
provided and expected to be used directly.

Scripting using the IronPython scripting API is very much like scripting with VBScript except that
l Any argument is supplied via the built in ScriptArgument variable
l The oDesktop object is always available
l The scripting method names are identical to the ones used with VBScript
l Method calls, while the name is the same have to adhere to the rule of ensuring trailing
parentheses irrespective of whether the function returns anything or has any arguments.
l Any compound/block arguments should be translated to the appropriate IronPython array
or dictionary syntax.

The samples section lists a collection of pure IronPython snippets: these, along with the various
script snippets listed in this document should serve as a guide and reference.

Related Topics
IronPython Script Execution Environment
Standalone IronPython and Desktop IronPython
Standalone IronPython
In general, it is easier to run a script directly from Electronics Desktop. Standalone IronPython
does not implement all the functionality available when a script is run from Electronics Desktop.
It only implements full support for COM functions.
Running Standalone IronPython

Standalone IronPython uses COM to get the handle to the AnsysEDT app. To run standalone
IronPython, you’ll need to call the IronPython interpreter ipy64.exe.
It is located in:
\\<AnsysEDTInstallationPath>\common\IronPython\ipy64.exe
For example, to run myScript.py, type the following in the command line:
"C:\Program Files\AnsysEM\v231\Win64\common\IronPython\ipy64.exe"
"<filePath>\myScript.py"

Introduction to Scripting 1-33


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

You can set the interpreter to be the default program when double-clicking the .py script. You
can use any recorded script as the basis for a standalone script and simply add an installation-
internal path to the python module search path (as shown below) and end the script with a new
shutdown call.
Using a Recorded Script

A python script recorded in AnsysEDT already has the required lines to be run as a standalone,
except for the first two lines (path settings) and the final Shutdown() call. See the example
script below.
Creating an External Script

When creating a script outside of Electronics Desktop, the following lines should be included at
the beginning of your script:
l import sys

# Imports the sys module containing system-specific functions native to IronPython.

l sys.path.append("<InstallationPath>")

# Adds the Electronics Desktop installation path to the list of directories Python searches
for modules and files.

l sys.path.append("<InstallationPath>/PythonFiles/DesktopPlugin")

# Adds the PythonFiles/DesktopPlugin subfolder to the list of directories Python searches


for modules and files.

l import ScriptEnv

# This imports ScriptEnv.py from the installation path specified above. ScriptEnv.py per-
forms an operating system check and defines functions used in Electronics Desktop
scripts. See the annotations in the ScriptEnv.py file for more information.

l ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")

or ScriptEnv.InitializeNew(NonGraphical=True)

# Initialize and InitializeNew are functions within ScriptEnv.py. The first option
launches Electronics Desktop. The second allows you to run a script without launching
Electronics Desktop. See the annotations in the ScriptEnv.py file for more information.

You must end the script with:

Introduction to Scripting 1-34


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l ScriptEnv.Shutdown()

# This stops ScriptEnv.py. If you are running multiple scripts, include this only at the end of
the last script.
Example Script

import sys
sys.path.append(r"C:\Program Files\AnsysEM\v231\Win64")
sys.path.append(r"C:\Program Files\An-
sysEM\v231\Win64\PythonFiles\DesktopPlugin")

import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oProject = oDesktop.NewProject()
oProject.InsertDesign("HFSS", "HFSSDesign1", "DrivenModal", "")
oDesign = oProject.SetActiveDesign("HFSSDesign1")
oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateRectangle(
[
"NAME:RectangleParameters",
"IsCovered:= ", True,
"XStart:= ", "-0.2mm",
"YStart:= ", "-3mm",
"ZStart:= ", "0mm",
"Width:= ", "0.8mm",
"Height:= ", "1.2mm",
"WhichAxis:= ", "Z"
],
[
"NAME:Attributes",
"Name:= ", "Rectangle1",

Introduction to Scripting 1-35


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Flags:= ", "",


"Color:= ", "(132 132 193)",
"Transparency:= ", 0,
"PartCoordinateSystem:=", "Global",
"UDMId:= ", "",
"MaterialValue:= ", "\"vacuum\"",
"SolveInside:= ", True
])
oDesign.SetDesignSettings(['NAME:Design Settings Data', 'Allow Mater-
ial Override:=', True, 'Calculate Lossy Dielectrics:=', True])
oEditor.SetModelUnits(['NAME:Units Parameter', 'Units:=', 'mil', 'Res-
cale:=' , False ])
ScriptEnv.Shutdown()
IronPython Samples

Change property

The following snippets show how a change property command (in this case, to change the color
of a cone) looks in VBScript and its two possible IronPython variants.
oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:Geo-
metry3DAttributeTab",_
Array("NAME:PropServers", "Cone1"), _
Array("NAME:ChangedProps", _
Array("NAME:Color", "R:=", 255, "G:=", 255, "B:=", 0))))
Sample Script 13: ChangeProperty command to change color of a cone in VBScript
oEditor.ChangeProperty(
["NAME:AllTabs",
["NAME:Geometry3DAttributeTab",
["NAME:PropServers", "Cone1"],
["NAME:ChangedProps",
["NAME:Color", "R:=", 0, "G:=", 0, "B:=", 64]
]
]

Introduction to Scripting 1-36


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

])
Sample Script 14: ChangeProperty command to change color of cone using Python
arrays
Any time there are named arrays composed purely of key-value pairs, they can always be rep-
resented using a Python dictionary, irrespective of the nesting of said named array.
oEditor.ChangeProperty(
["NAME:AllTabs",
["NAME:Geometry3DAttributeTab",
["NAME:PropServers", "Cone1"],
["NAME:ChangedProps",
{
"NAME":"Color",
"R" : 0,
"G" : 64,
"B" : 0
}]]
])
Sample Script 15: ChangeProperty command to change the color of a cone using
Python arrays and dictionaries

Create a Cone using IronPython

Most scripting tasks using IronPython are expected to be formatted as the following example.
One starts with the predefined oDesktop object and drills down to the design, editors, modules
etc and issues any required commands on the object while formatting the script command argu-
ments in natural python syntax.
oProject = oDesktop.GetActiveProject()
oDesign = oProject.InsertDesign("HFSS","Random","DrivenModal","")
oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateCone(
{
"NAME" : "ConeParameters",
"XCenter" : "0mm",
"YCenter" : "0mm",

Introduction to Scripting 1-37


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ZCenter" : "0mm",
"WhichAxis" : "Z",
"Height" : "2mm",
"BottomRadius" : "1.56204993518133mm",
"TopRadius" : "0mm"
},
{
"NAME" : "Attributes",
"Name" : "Cone1",
"Flags" : "",
"Color" : "(132 132 193)",
"Transparency" : 0,
"PartCoordinateSystem": "Global",
"UDMId" : "",
"MaterialValue" : "\"vacuum\"",
"SolveInside" : True
}
)
Sample Script 16: IronPython script to create a cone
Create geometry and then create a grid from it using copy/paste/move
The following script demonstrates slightly more advanced use of scripting and the use of return
values from script methods. It creates a 5x5 grid of cones and also demonstrates the adding of
information messages to the application's message window.
oProject = oDesktop.GetActiveProject()
oDesign = oProject.InsertDesign("HFSS","Hersheys Kis-
ses","DrivenModal","")
oEditor = oDesign.SetActiveEditor("3D Modeler")

# create the first cone


AddInfoMessage("Creating first cone")
firstConeName = "firstCone"

Introduction to Scripting 1-38


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

coneBotRad = "1.5mm"
oEditor.CreateCone(
{
"NAME" : "ConeParameters",
"XCenter" : "0mm",
"YCenter" : "0mm",
"ZCenter" : "0mm",
"WhichAxis" : "Z",
"Height" : "2mm",
"BottomRadius": coneBotRad,
"TopRadius" : "0mm"
},
{
"NAME" : "Attributes",
"Name" : firstConeName,
"Flags" : "",
"Color" : "(132 132 193)",
"Transparency" : 0,
"PartCoordinateSystem": "Global",
"UDMId" : "",
"MaterialValue" : "\"vacuum\"",
"SolveInside" : True
}
)

# Now replicate this a few times and create an array out of it


AddInfoMessage("Replicating it 24 times")
for x in range(5):
for y in range(5):
# leave the first one alone in it's created

Introduction to Scripting 1-39


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

# position
if x == 0 and y == 0:
continue

# all other grid positions, replicate from the


# first one

# copy first
oEditor.Copy(
{
"NAME" : "Selections",
"Selections" : firstConeName
}
)

# paste it and capture the pasted name


# the pasted names come in an array as we could
# be pasting a selection cmposed of multiple objects
pasteName = oEditor.Paste()[0]

# now move the pasted item to it's final position


oEditor.Move(
{
"NAME" : "Selections",
"Selections" : pasteName
},
{
"NAME" : "TransalateParameters",
"CoordinateSystemID" : -1,
"TranslateVectorX" : "%d * 3 * %s" % (x, coneBotRad),

Introduction to Scripting 1-40


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"TranslateVectorY" : "%d * 3 * %s" % (y, coneBotRad),


"TranslateVectorZ" : "0mm"
}
)

# Now fit the display to the created grid


oEditor.FitAll()
Sample Script 17: Sample script to create a cone and then use copy/paste/move to rep-
licate it.

Related Topics
Introduction to IronPython
IronPython Mini-cookbook
Translating Script commands from VBScript to IronPython
Scripting Using Iron Python: Putting it all Together
Creating User Defined Primitives and User Defined Models in Python
Scripts
You can create User Defined Primitives and User Defined Models in Python scripts (based on
the IronPython implementation).
Advantages Compared to C++

l No need to create and build project; all you need to do is create a Python script
l Python script is platform independent
l Scripts can inherit functionality from existing scripts
l Garbage collector - no need to free memory
l Easy debugging
Changes compared to C

Though methods, constants and structures are kept as close to the C implementation as pos-
sible, some changes had to be made to make code Python-compatible.
Structures

l Structures have the same names as in C implementation.


l Structures fields names are capitalized.
l Arrays in structures become lists in Python (Technically a.NET IList container)

Introduction to Scripting 1-41


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l Structure instances are created using the supplied constructors and members are
accessed using the provided access methods.

For a complete list of structures and examples please see UDP/UDM Structures.
Return Values for UDM and UDP Functions

For information on return values for each UDM and UDP function, see the Return Values sec-
tion.

Constants

Enumeration/Enum constants have almost the same names as in C but the enum must be qual-
ified by the type. Additionally, redundant "UDP", "UDM" or type prefixes have been removed.
This allows for better human-readability.
# Example of specifying the LengthUnit enum by qualifying it
# with the type of the enum: UnitType
unitType = UnitType.LengthUnit
For a complete list of enum constants please see UDP/UDM Constants.
Methods

Methods are described in IUDPExtension methods, IUDMExtension methods, and UDMFunc-


tionLibrary listed further in this document. A separate chapter includes a UDP IronPython
example of fillet and chamfer.
The main differences in functions parameters (from C implementation):
l functions names in UDPFunctionLibrary and UDMFunctionLibrary are capitalized
l arrays become a python list of objects
l void * callback parameter is dropped from the parameter list
l output parameters (pointer types that are filled during the function call) usually become
return values
l 'list size' parameter usually will be omitted as redundant
Output Parameters

The rule for the output parameters is as follows:


l If the function has one output parameter variable and no return value, the variable will
become function's return value.The same will happen if the return value is a 'suc-
cess/failure' boolean ('None' will be returned on failure and parameter variable - on suc-
cess).
l If the function has one output parameter and a return value, the function will return a
Python tuple where function return value will be the first one in the tuple.

Introduction to Scripting 1-42


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l If there is more than one out variable, the function will return a Python tuple with all output
parameters in the specified order. If function has a return value, it must always be the first
in the tuple.
# one output parameter; return value is ignored
udmDefinition = udmFunctionLibrary.GetDefinition()

# one output parameter; return value must be preserved. return


# and output values are packed into the return tupe, in order
(lRet, partIdsList) = udpFunctionLibrary.DetachFaces(nPartIds, faceId-
sList)
# Two output parameter; return value must be preserved
# the return tuple is (returnVal, output1, output2)
(bRet, udpPositionLow, udpPositionHigh) = udmFunc-
tionLibrary.GetBoundingBox(partId,exact);
Comparison with C function:

C Python
bool getDefinition(UDMDefinition* udmDefinition = udmFunctionLibrary.GetDefinition()
udmDefinition,
void* callbackData );
(Note: callbackData is omitted in py interface)

where udmDefinition is an output


parameter

long detachlFaces( int (bRet, partIds) = udmFunctionLibrary.DetachlFaces


nFacesAndPartIds, (nFacesAndPartIds, faceIds)
long* faceIds,
long* partIds, (Note: callbackData is omitted in py interface)
void* callbackData);

where partIds is an output para-


meter

'List Size' Parameters

The rule for the 'list size' is as follows:

Introduction to Scripting 1-43


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l If function has input 'List' parameter and input 'list size' parameter, 'list size' parameter will
be omitted.
l If function has output 'List' parameter and output 'list size' parameter, 'list size' parameter
will be omitted.
l If function has output 'List' parameter and input 'list size' parameter, 'list size' parameter
won't be omitted as it's needed for memory allocation in the corresponding C++ function
from the UDP/UDM function library.

Example:
# input list, input list size
lret = udpFunctionLibrary.Unite(objectIds)

# output list, output list size


faceIdList = udmFunctionLibrary.GetAllFaces(PartId)

# output list, input list size


(lret, partIdList) = udpFunctionLibrary.DetachFaces(listSize,
faceIdList)
Comparison with C function:

C Python
bool getAllFaces( long partId, faceIds = udmFunc-
tionLibrary.GetAllFaces(partId)
long* numFaces,
long** faceIds,
void* callbackData);
(ignore numFaces as redundant: fol-
ded into faceIds,
where numFaces and faceIds are output parameters return value is omitted: folded into the
and numFaces is the size of faceId. faceIds is None check
callbackData is omitted)
long unite( long numObjects, lret = udpFunctionLibrary.Unite
(objectIds)
long* objectIds,
void* callbackData);

(ignore numObjects as redundant: fol-


where numObjects and objectIds are input parameters ded into objectIds

Introduction to Scripting 1-44


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

C Python
and numObjects is the size of objectIds. callbackData is omitted)
long detachFaces( long nSize, (lret, partIdList) = udpFunc-
tionLibrary.DetachFaces(nSize,
long* faceIds, faceIds)
long* partIds,
void* callbackData);

(nSize is not ignored,


where partIds is and output list and nSize is an input callbackData is omitted)
parameters and nSize is the size of partIds.

Added Parameters

There is a special case in UDPFunctionLibrary: two functions - DuplicateAlongLine and Duplic-


ateAroundAxis - have new integer listSize parameter added to their signatures.
This parameter defines the size of the output List. This is done for compliance with C++ geo-
metry library as the size of the List must be predefined and this size is different from the existing
parameter’s values.
Example:
(ret, cloneIDs) = funcLib.DuplicateAlongLine(partID, transVec,
numCubes, cloneIdsSize)
(ret, cloneIDs) = funcLib.DuplicateAroundAxis(partID, axis, angle,
nClones, cloneIdsSize)
Here cloneIdsSize is a new integer parameter.
Comparison with C function:

C Python
long duplicateAlongLine( (lret, cloneIds) = udmFunctionLibrary.DuplicateAlongLine(partId,
long partId, transVec, nClones, cloneIdsSize)
UDPVector transVector,
int nClones,
long* nClones, (callbackData is omitted
void* callbackData); cloneIdsSize is a new parameter)
long duplicateAroundAxis( (lret, cloneIds) = udmFunctionLibrary.DuplicateAroundAxis
(partId, axis, angle, nClones, cloneIdsSize)
long partId,
UDPCoordinateSystemAxis
axis,

Introduction to Scripting 1-45


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

C Python
double angle, (callbackData is omitted
int nClones, cloneIdsSize is a new parameter)
long* nClones,
void* callbackData);

Developing a UDM/UDP

Creation

To create a User Defined Primitive in Python you write a Python script that implements UDPEx-
tension class. To create a User Defined Model in Python you write a Python script that imple-
ments UDMExtension class (see links for full description).

Location

The scripts are located the same way the C based UDM/UDP are. They are expected to be
under the UserDefinedParts or UserDefinedModels sub-directories of one of the library folders
(SysLib, UserLib or PersonalLib). They will then appear under the appropriate menu items:
Draw > User Defined Primitives for UDP or Draw > User Defined Model for UDM.
The sub-directories structure created in one of the specified directory will be displayed in the
UDP/UDM menu.
Keep in mind that there is no difference between the menu display for C and Python imple-
mentations of UDM or UDP - only the file names without extensions are displayed

Organize

"Lib" sub-directory is a special directory. The contents of this directory is not shown in the menu.
In the "Lib" directory you can create Python scripts with base classes and utilities to be used in
UDP/UDM Python scripts. All the Lib directories upstream of a script (till the UserDefinedModels
or UserDefinedPrimitives) are included in the Python search path and this allows for easy import
of helper modules in such directories.
To use UDM data structures, constants, and/or classes in your Lib sub-directory scripts you
have to add import statement to the scripts:
For UDM:extension:
from UDM import *
For UDP:extension:
from UDP import *

Introduction to Scripting 1-46


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Edit/Reload

Python is a scripting language, so if you have errors in your script, you will see them at the time
you try to run the script. The errors will be displayed in the Message Manager Window. If you
need more information, you might be able to get it from log files. See: Debug Logging.
You can always change your script, call Update Menu command from Draw > User Defined
Model > menu or Draw > User Defined Primitives > menu and run the script again. If you
delete script you might want to restart the application instead of calling Update Menu.
UDPExtension

Import

You do not have to add import statements for the predefined classes, structures, and constants -
it is done for you and all data types described in this document can be used in your Python script.
However you have to add import statements to your helper scripts in your Lib sub-directory.
from UDP import *

Main class: UDPExtension

You must write a class derived from IUDPExtension with a mandatory name UDPExtension:
class UDPExtension(IUDPExtension):
The class should implement IUDPextension methods described below.
IUDPExtension methods

All methods are same as the methods in the C UDP implementation. The changes to the meth-
ods signatures are just to conform to the Python style.

Mandatory methods.

These methods must be implemented in the UDP Python script as methods of UDPExtension
class.

GetLengthParameterUnits()

l returns string.

GetPrimitiveTypeInfo()

l returns UDPPrimitiveTypeInfo.

GetPrimitiveParametersDefinition2()

l returns a list of UDPPrimitiveParameterDefinition2 or None on failure

Introduction to Scripting 1-47


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AreParameterValuesValid2(errorMsg, udpParams)

l errorMsg is a c# list of strings


l udpParams is a c# list of UDPParam
l returns True if udpParams are valid, False otherwise.

CreatePrimitive2(funcLib, udpParams)

l funcLib is UDMFunction library


l udpParams is a c# list of UDPParam
l returns True on success, False on failure.

Optional methods

These methods, which have default implementations, can be implemented as methods of


UDPExtension class as needed. Default methods will return NULL or FALSE depending on the
return type.

GetPrimitiveParameters()

l returns Python list of strings or NULL

GetRegisteredFaceNames()

l returns Python list of strings or NULL

GetRegisteredEdgeNames()

l returns Python list of strings or NULL

GetRegisteredVertexNames()

l returns Python list of strings or NULL

ProjectParametersOnToValidPlane2(currentUDPParams, projectedUDPParams)
l currentUDPParams is a list of UDPParam
l projectedUDPParams is a list of UDPParam
l returns True on success, False on failure.

Introduction to Scripting 1-48


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

MapParametersDefinitionVersions2(oldVersion, oldUDPParams)

l oldVersion is a string
l oldUDPParamsis a list of UDPParam
l returns Python list of UDPParam or NULL

GetOldPrimitiveParametersDefinition2(version )

l version is a string
l returns a list of UDPPrimitiveParameterDefinition2 or None on failure.
Example UDP

import sys
class UDPExtension(IUDPExtension):

def GetLengthParameterUnits(self):
return "mm"

def GetPrimitiveTypeInfo(self)
typeInfo = UDPPrimitiveTypeInfo(
name = "SampleUDP",
purpose = "example",
company="Ansys",
date="12.21.12",
version = "1.0")

return typeInfo
...
...
UDMExtension
Import

You do not have to add import statements for the predefined classes and structures - it is done
for you, and all data types described in this document can be used in your Python script.
However you have to add import statements to your helper scripts in your Lib sun-directory.

Introduction to Scripting 1-49


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

from UDM import *


Main class: UDMExtension

You must write a class derived from IUDMExtension with a mandatory name UDMExtension:
class UDMExtension(IUDMExtension):
The class should implement IUDMExtension methods described below.
IUDMExtension methods

All methods are the same as the methods in the C UDM implementation. The changes to the
methods signatures are just to conform to the Python style.

Mandatory methods.

These methods must be implemented in the UDM Python script as methods of UDMExtension
class.

GetInfo()

l returns UDMInfo object populated with appropriate UDM information.

IsAttachedToExternalEditor()

l returns True if UDM dll is attached to external editor.


l In case of python UDMs, this should typically return False

CreateInstance(funcLib)

l funcLib is UDMFunctionLibrary
l returns UDMParameters.

GetUnits(instanceId)

l instanceId is a long
l returns string containing units for the instance.

Refresh(funcLib, udmInParams, updatedParams, refreshModifiedPartsOnly,


nonEditedPartRefIds )
This Method is called every time a UDM is refreshed. Geometry creation/refresh should happen
in this method.
l funcLib is UDMFunctionLibrary
l udmInParams is a list of UDMParameters that comes from desktop

Introduction to Scripting 1-50


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l updatedParams: UDM script can change the UDM parameters it receives. Updated para-
meters need to be sent back to desktop. If the UDM script is not going to change any of
the parameters that it received, it needs to copy udmInParams to updatedParams.
l refreshModifiedPartsOnly is a boolean

Supporting this flag is optional. For UDMs where the refresh performance is not an issue,
it is recommended to ignore this flag and update all parts every time.
This flag can be used to optimize performance of Refresh method when the model created
by UDM is large. If the UDM consists of multiple parts, and new parameters change only a
few parts amongst them, UDM script can only modify parts that are changed by the new
parameters.
l nonEditedPartRefIds: If RefreshModifiedPartsOnly is true and the UDM script supports
partial update, Refresh method needs to return ids of parts that are unchanged.

returns True on success, False on failure.

ReleaseInstance(instanceId)

l instanceId is a long
l This should release any resources assigned to this particular instance of UDM.
l returns True on success, False on failure.

GetAttribNameForEntityId()

l Returns string that acts as a the name of the attribute containing entity IDs.
l For example, it can return a unique string such as "ATTRIB_XACIS_ID"
l Python UDMs should implement this method.

GetAttribNameForPartId()

l Returns string that acts as a the name of the attribute containing entity IDs.
l For example, it can return a unique string such as "ATTRIB_XACIS_ID" (Can be same as
GetAttribNameForEntityId())
l Python UDMs should implement this method.

Optional methods

These methods have default implementations (default is to return NULL or FALSE depending on
the return type) but can be overridden by the user as needed as methods of UDMExtension
class.
DialogForDefinitionOptionsAndParams(self, defData, optData, params):

Introduction to Scripting 1-51


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Replaces the old UDMDialogForDefinitionAndOptions method, which is still supported, but


users are urged to use UDMDialogForDefinitionOptionsAndParams. If both methods are
present, application will use UDMDialogForDefinitionOptionsAndParams.
l UDM can pop up dialog for UDM definition, options, parameters in this method. Definition,
options, and parameters are set/modified by user and returned to application. Dll can also
just give default definition, options and parameters.
l Returns two booleans and a string
l First boolean returns whether the method was successful or not.
l Second boolean returns whether the application should popup a dialog box. If it is True,
application will populate a dialog with definition, options, parameters that are returned.
l String returned contains length units for parameters.
DialogForDefinitionAndOptions(self, defData, optData) [Deprecated]
UDM can pop up dialog for UDM definition and options in this method. Definition, and options
are set/modified by user and returned to application. Dll can also just give default definition and
options.
l Returns two booleans.
l First boolean provides whether the call to this method was successful or not.
l Second boolean determines whether the application should pop up a dialog box. If this is
true, application will populate the dialog with the definitions and options that are returned.
As no parameters are returned, no parameters are shown in this dialog.
GetInstanceSourceInfo(instanceId)

l instanceId is a long
l returns string containing source information of UDM instance. It is used to create initial
name for UDM instance.
ShouldAttachDefinitionFilesToProject()

l returns true if any of definition files needs to be attached to project


l returns python list of string containing definition names of files or NULL
Example UDM

class UDMExtension(IUDMExtension):

def IsAttachedToExternalEditor(self):
return False

Introduction to Scripting 1-52


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

def GetInfo(self)
udmInfo = UDMInfo(
name = "SampleUDM",
purpose = "udm example",
company="Ansys",
date="12.21.12",
version = "1.0")

return udmInfo
...
...
UDMFunctionLibrary
UDMFunctionLibrary implements IUDMFunctionLib interface. The IUDMFunctionLib object is
passed as a parameter to Python script in the following functions
l CreateInstance
l Refresh

You can call any of the functions from the functions list (shown below).
partRefId = udmFunctionLib.GetPartRefId(partId)
For example sample code that calls GetBoundingBox in Python script can look like this:
partId = 10
exact = True
udpPosition = UDPPosition(0,0,0)

(bret, udpPositionLow, udpPositionHigh) = udmFunc-


tionLibrary.GetBoundingBox(partId, exact);

if bret:
udpPosition.X = udpPositionLow.X
As you can see udpPositionLow and udpPositionHigh output parameters are defined in the call
to GetBoundingBox function. There is no need to define them before the function call.

Introduction to Scripting 1-53


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Functions list:

1. List_of_UDMDefinition: udmDefinitionList = GetDefinition()


2. List_of_UDMOption: udmOptionList = GetOptions()
3. bool: bret = SetMaterialName(string: matName, int: partId)
4. bool: bret = SetMaterialName2(string: matName, string: partName)
5. bool: bret = SetPartName(string: partName, int: partId)
6. int: iret = GetInstanceId()
7. string: str = GetPartRefId(int: partId)
8. bool: bret = SetPartRefId(int: partId, string: refId)
9. List_of_int: faceIds = GetAllFaces(int: partId)
10. List_of_int: edgeIds = GetAllEdges(int: partId)
11. List_of_int: vertexIds = GetAllVertices(int: partId)
12. bool: bret = SetFaceAttribs(List_of_int: faceIds, List_of_string: attribs)
13. bool: bret = SetEdgeAttribs(List_of_int: edgeIds, List_of_string: attribs)
14. bool: bret = SetVertexAttribs(List_of_int: vertexIds, List_of_string: attribs)
15. string: str = GetModelerUnit()
16. string: str = GetCacheFileForUDMResume()
17. bool: bret = SetPartColor(int: partId, int: nColor)
18. bool: bret = SetPartFlags(int: partId, int: nFlags)
19. (bool: bret, UDPPosition: low, UDPPosition: high) = GetBoundingBox(int: partId,
bool: exact)
20. bool: bret = IsParametricUpdate()
21. bool: bret = SetMaterialNameByRefId(string: partRefID, string: matName)
22. bool: bret = SetPartNameByRefId(string: partRefId, string: partName)
23. bool: bret = SetPartColorByRefId(string: partRefId, int: nColor)
24. bool: bret = SetPartFlagsByRefId(string: partRefId, int: nFlags)

In addition to the above functions all functions defined in the UDPFunctionLib are available in the
IUDMFunctionLib and can be called directly exactly the same way as the IUDMFunctionLib func-
tions.
Example:
udmFunctionLib.CreateCircle(center,radius,ratio,isCovered)

Introduction to Scripting 1-54


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UDM/UDP Functions
Return Values for Each UDM and UDP Function

ID – ID of created Object
SI – Success Indicator. Identifies whether or not operation was successful.
Functions list:

1. bool: SI = AddMessage(MessageSeverity: messageSeverity, string: message)


2. bool: SI = NameAFace(UDPPosition: pointOnFace, string: faceName)
3. bool: SI = NameAEdge(UDPPosition: pointOnEdge, string: edgeName)
4. bool: SI = NameAVertex(UDPPosition: pointOnVertex, string: vertexName)
5. int: ID = GetFaceIDFromPosition(UDPPosition: pointOnFace)
6. int: ID = GetEdgeIDFromPosition(UDPPosition: pointOnEdge)
7. int: ID = CreatePolyline(UDPPolylineDefinition: polylineDefinition)
8. int: ID = CreateRectangle(CoordinateSystemPlane: whichPlane, UDPPosition: center-
Point, List_of_double: widthAndHeight, int: isCovered)
9. int: ID = CreateArc(CoordinateSystemPlane: whichPlane, UDPPosition: centerPoint,
UDPPosition: startPoint, double: fAngle)
10. int: ID = CreateCircle(CoordinateSystemPlane: whichPlane, UDPPosition: center-
Point, double: fRadius, int: isCovered)
11. int: ID = CreateEllipse(CoordinateSystemPlane: whichPlane, UDPPosition: center-
Point, double: fMajorRadius, double: fRadiusRatio, int: isCovered)
12. int: ID = CreateRegularPolygon(CoordinateSystemPlane: whichPlane, UDPPosition:
centerPoint, UDPPosition: startPoint, int: numOfSides, int: isCovered)
13. int: ID = CreateEquationBasedCurve(UDPEquationBasedCurveDefinition:
curveDefinition)
14. int: ID = CreateEquationBasedSurface(UDPEquationBasedSurfaceDefinition: sur-
faceDefinition)
15. int: ID = CreateSpiral(UDPSpiralDefinition: spiralDefinition)
16. int: ID = CreateBox(UDPPosition: startPoint, List_of_double: boxXYZsize)
17. int: ID = CreateSphere(UDPPosition: centerPoint, double: fRadius)
18. int: ID = CreateCylinder(CoordinateSystemAxis: whichAxis, UDPPosition: center-
Point, double: fRadius, double: fHeight)
19. int: ID = CreateCone(CoordinateSystemAxis: whichAxis, UDPPosition: centerPoint,
double: fBottomRadius, double: fTopRadius, double: fHeight)

Introduction to Scripting 1-55


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

20. int: ID = CreateTorus(CoordinateSystemAxis: whichAxis, UDPPosition: centerPoint,


double: fMajorRadius, double: fMinorRadius)
21. int: ID = CreatePolyhedron(CoordinateSystemAxis: whichAxis, UDPPosition: center-
Point, UDPPosition: startPosition, int: numOfSides, double: fHeight)
22. int: ID = CreateHelix(UDPHelixDefinition: helixDefinition)
23. bool: SI = Unite(List_of_int: pObjectIDArray)
24. bool: SI = Subtract(List_of_int: pBlankObjectIDArray, List_of_int: pToolObjectIDArray)
25. bool: SI = Intersect(List_of_int: pObjectIDArray)
26. bool: SI = Imprint(List_of_int: pBlankObjectIDArray, List_of_int: pToolObjectIDArray)
27. bool: SI = SweepAlongVector(int: profileID, UDPVector: sweepVector, UDPSweep-
Options: sweepOptions)
28. bool: SI = SweepAroundAxis(int: profileID, CoordinateSystemAxis: whichAxis,
double: sweepAngle, UDPSweepOptions: sweepOptions)
29. bool: SI = SweepAlongPath(int: profileID, int: pathID, UDPSweepOptions: sweep-
Options)
30. bool: SI = Translate(int: partID, UDPVector: translateVector)
31. bool: SI = Rotate(int: partID, CoordinateSystemAxis: whichAxis, double: rotateAngle)
32. bool: SI = Mirror(int: partID, UDPPosition: mirrorPlaneBasePosition, UDPVector: mir-
rorPlaneNormalVector)
33. bool: SI = Transform(int: partID, List_of_double: rotationMatrix, UDPVector: trans-
lateVector)
34. bool: SI = Scale(int: partID, double: xScale, doublev: yScale, double: zScale)
35. (bool: SI, List_of_int: cloneIDs) = DuplicateAlongLine(int: partID, UDPVector: trans-
lateVector, int: numTotalObjs, int: cloneIDsListSize)
36. (bool: SI, List_of_int: cloneIDs) = DuplicateAroundAxis(int: partID, Coordin-
ateSystemAxis: whichAxis, double: rotateAngle, int: numTotalObjs, int: cloneIDsListS-
ize)
37. int: ID = DuplicateAndMirror(int: partID, UDPPosition: mirrorPlaneBasePosition,
UDPVector: mirrorPlaneNormalVector)
38. bool: SI = Connect(List_of_int: objectIDArray)
39. bool: SI = Offset(int: partID, double: offsetDistance)
40. int: ID? = Section(int: partID, CoordinateSystemPlane: sectionPlane)
41. (bool: SI , int: ID) = Split(int: partID, CoordinateSystemPlane: splitPlane,
SplitWhichSideToKeep: whichSideToKeep, bool: bSplitCrossingObjectsOnly)

Introduction to Scripting 1-56


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

42. (bool: SI , List_of_int: importedObjectIDs) = ImportNativeBody2(string:


fileNameWithFullPath)
43. (bool: SI, List_of_int: importedObjectIDs) = ImportAnsoftGeometry(string:
fileNameWithFullPath, List_of_string: overridingParamsNameArray, List_of_
UDPParam: overridingParamsArray)
44. int:ID = Clone(int: partID)
45. bool: SI = DeletePart(int: partID)
46. int: ID = CreateObjectFromFace(int: faceID)
47. bool: SI = Fillet(UDPBLNDElements: entitiesToFillet, UDPBLNDFilletOptions: fil-
letOptions)
48. bool: SI = Chamfer(UDPBLNDElements: entitiesToChamfer, UDPBLNDCham-
ferOptions: chamferOptions)
49. (bool: SI, List_of_int: newPartIDs) = DetachFaces(int: newPartIDArraySize, List_of_
int: faceIDs)
50. (bool: SI, List_of_int: newPartIDs) = DetachEdges(int: newPartIDArraySize, List_of_
int: edgeIDs)
51. int: ID = CreateObjectFromEdge(int: edgeID)
52. bool: SI = SheetThicken(int: partID, double: fThickness, bool: bThickenBothSides)
53. (bool: SI , List_of_int: newPartIDArray) = SweepFaceAlongNormal(int: newPartIDAr-
raySize, List_of_int: faceIDArray, double: sweepLength)
54. bool: SI = CoverLine(int: partID)
55. bool: SI = CoverSurface(int: partID)
56. bool:SI= UncoverFaces(List_of_int: faceIDArray)
57. (bool: SI , int: numPartsCreated, List_of_int: faceIDArray) = SeparateBodies(int:
partID, int: numPartsCreated)
58. bool: SI = MoveFaces(List_of_int: faceIDArray, bool: bMoveAlongNormal, double: fOff-
setDistance, UDPVector: moveVector)
59. bool: SI = WrapSheet(int: sheetBodyID, int: targetBodyID)
60. bool: SI = ImprintProjection(int: blankBodyID, List_of_int: toolBodyIDArray, bool:
bNormalProjection, UDPVector: projectDirection, double: projectDistance)
61. string: path = GetTempDirPath()
62. string: path = GetSysLibDirPath()
63. string: path = GetUserLibDirPath()
64. string: path = GetPersonalLibDirPath()

Introduction to Scripting 1-57


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

65. string: path = GetInstallDirPath()


66. string: path = GetProjectPath()
67. (bool: SI, bool: abort) = SetProgress(UDPProgress: progress)

UDP/UDM Structures and Constants


The following sections describe:
l UDP/UDM Structures
l UDP/UDM Constants

UDP/UDM Structures

Differences compared to C API


l UDMDefinition
l UDMOptions
l UDMParameters

Instead of containing arrays of data, the structures contain single fields where each field
corresponds to an item in a different array from the original C API. The structure objects
thus constructed are added to the Python list. Alternately the Python list can be initialized
using the structure objects.

Example (creating UDMParameter list):

udmParamList = [

UDMParameter(

"cubeSizeName", UnitType.LengthUnit,

UDPParam(ParamDataType.Double, cubeSize),

ParamPropType.Value,

ParamPropFlag.MustBeReal),

UDMParameter(

"cubeDistanceName", UnitType.LengthUnit,

UDPParam(ParamDataType.Double, cubeDistance),

ParamPropType.Value,

ParamPropFlag.MustBeReal),

Introduction to Scripting 1-58


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UDMParameter("numCubesName", UnitType.LengthUnit,

UDPParam(ParamDataType.Int, numCubes),

ParamPropType.Number,

ParamPropFlag.MustBeInt]

l UDPParam
l UDPParamData

Data field in UDPParam is now an object - the same for all types of data used - as Python
can work with any type of data.

UDPParamData is obsolete, thus not implemented. Be sure to set proper data type to
UDPParam.DataType when setting UDPParam.Data.

Example:

nCubesParam = UDPParam(ParamDataType.Int, numCubes)

nCubes = nCubesParam.Data

distanceParam = UDPParam()

distanceParam.setDouble(10.5)

doubleDistance = distanceParam.Data * 2

l UDP3x3Matrix

The structure is not implemented. Use size 9 Python List of doubles instead.

Example:

rotationMatrix =[0,0,1, 1,0,0, 0,0,1]

udpFunctionLib.Transform(partId, rotationMatrix, trans-


lationVector)

List of structures

You can use constructors to create a structure. You can also modify fields - directly or by
provided methods.
Example:

Introduction to Scripting 1-59


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

pos1 = UDPPosition(1,2,3)
pos2 = UDPPosition(x=1,y=10,z=0)
pos2.Z = pos1.Z
udpParam = UDPParam(ParamDataType.Double,1)
value = udpParam.Data

Structure Construction Members


UDPPrimitiveTypeInfo UDPPrimitiveTypeInfo( string Name
string name, string Purpose
string purpose, string Company
string company, string Date
string date, string Version
string version)
UDPPrim- UDPPrim- string Name
itiveParameterDefinition itiveParameterDefinition(
string Description
string name,
UnitType UnitType
string description,
double DefaultValue
UnitType unitType,
double defaultValue)
UDPParam UDPParam() ParamDataType DataType
object Data
UDPParam( object can be int, double , string,
bool or UDPPosition
ParamDataType dataType,
object data)
object can be int, double,
string, bool or UDPPosition

methods:
setInt(int val)
setBool(bool val)
setString(string val)
setDouble(double val)

Introduction to Scripting 1-60


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Structure Construction Members


setPosition(UDPPosition
val)

UDPPrim- UDPPrim- string Name


itiveParameterDefinition2 itiveParameterDefinition2(
string Description
string name,
UnitType UnitType
string description,
ParamPropType PropType
UnitType unitType,
ParamPropFlag PropFlag
ParamPropType propType,
UDPParam DefaultValue
ParamPropFlag propFlag,
UDPParam defaultValue)
UDPPosition UDPPosition( double X
double x, double Y
double y, double Z
double z)
UDPVector UDPVector( double X
double x, double Y
double y, double Z
double z)
UDPSweepOptions UDPSweepOptions( SweepDraftType DraftType
SweepDraftType draftType, double DraftAngle
double draftAngle, double TwistAngle
double twistAngle)
UDPPolylineSeg- UDPPolylineSeg- PolylineSegmentType Seg-
mentDefinition mentDefinition( mentType
PolylineSegmentType seg- int segmentStartIndex,
mentType,
int numberOfPoints,
int segmentStartIndex,
double angle,
int numberOfPoints,
UDPPosition centerPoint,
double angle,
CoordinateSystemPlane
UDPPosition centerPoint, arcPlane)

Introduction to Scripting 1-61


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Structure Construction Members


CoordinateSystemPlane
arcPlane)
UDPPolylineDefinition UDPPolylineDefinition() int IsClosed
UDPPolylineDefinition( int IsCovered
List_of_UDPPosition pos- List_of_UDPPosition ArrayOfPos-
itions, ition
List_of_UDPPolylineSeg- List_of_UDPPolylineSeg-
mentDefinition segDefs, mentDefinition ArrayOfSeg-
mentDefinition
int closed,
int covered)
UDPEqua- UDPEqua- string FunctionXt
tionBasedCurveDefinition tionBasedCurveDefinition(
string FunctionYt
string functionXt,
string FunctionZt
string functionYt,
double TStart
string functionZt,
double TEnd
double tStart,
int NumOfPointsOnCurve
double tEnd,
int numOfPointsOnCurve)
UDPEqua- UDPEqua- string FunctionXuv
tionBasedSurfaceDefinition tionBasedSurfaceDefinition(
string FunctionYuv
string functionXuv,
string FunctionZuv
string functionYuv,
double UStart
string functionZuv,
double UEnd
double uStart,
double VStart
double uEnd,
double VEnd
double vStart,
two integer arguments that are
double vEnd reserved for future use. They need
to be provided, for example as 0.
int reserved1 For example:
int reserved2) theSurfaceDefinition =
UDPEqua-
tionBasedSur-
faceDefinition
("u","v","1",0,1,0,1,0,0)

Introduction to Scripting 1-62


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Structure Construction Members


UDPHelixDefinition UDPHelixDefinition( int ProfileID
int profileID, UDPPosition PtOnAxis
UDPPosition ptOnAxis, UDPPosition AxisDir
UDPPosition axisDir, double NoOfTurns
double noOfTurns, bool IsRightHanded
bool isRightHanded, double RadiusChangePerTurn
double radi- double Pitch
usChangePerTurn,
double pitch)
UDPSpiralDefinition UDPSpiralDefinition( int ProfileID
int profileID, UDPPosition PtOnAxis
UDPPosition ptOnAxis, UDPPosition AxisDir
UDPPosition axisDir, double NoOfTurns
double noOfTurns, bool IsRightHanded
bool isRightHanded, double RadiusChangePerTurn
double radi-
usChangePerTurn)
UDPBLNDElements UDPBLNDElements( UDPBLNDElements can hold
either edges or vertices, but not
int partID, both at the same time. Edges
int noOfEdges; should be applied to solids, and
vertices should be applied to
int* listOfEdges; ) sheets.
int PartID /* part to be blended i.e.
filleted/chamfered */
UDPBLNDElements(
int noOfEdges;
int partID,
int* listOfEdges; /* edges to be
int noOfVertices; blended */
int* listOfVertices; int noOfVertices;
) int* listOfVertices; /* vertices to be
blended */

UDPBLNDFilletOptions UDPBLNDFilletOptions( bool SupressFillet /* Reserved for


future */

Introduction to Scripting 1-63


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Structure Construction Members


bool supressFillet, BLNDFilletRadiusLaw Fil-
letRadiusLaw
BLNDFilletRadiusLaw fil-
letRadiusLaw, double FilletStartRadius
double filletStartRadius, double FilletEndRadius
double filletEndRadius, bool Fol-
lowSmoothEdgeSequence /*
bool fol- Reserved for future */
lowSmoothEdgeSequence,
BLNDFilletType FilletType
BLNDFilletType filletType,
double SetbackDistance
double setbackDistance,
double BulgeFactor /* Reserved
double bulgeFactor) for future */
UDPBLNDChamferOptions UDPBLNDChamferOptions( bool SupressChamfer
bool supressChamfer, BLNDChamferRangeLaw Cham-
ferRangeLaw
BLNDChamferRangeLaw
chamferRangeLaw, double ChamferLeftRange
double chamferLeftRange, double ChamferRightRange
double chamferRightRange)
UDPProgress UDPProgress( int Prog
int prog, int SubProg
int subProg, string Mesg
string mesg, string SubMesg
string subMesg)
UDMInfo UDMInfo( string Name
string name, string Purpose
string purpose, string Company
string company, string Date
string date, string Version
string version)
UDMDefinition UDMDefinition() string DefName
UDPParam DefValue
UDMDefinition( ParamPropType PropType
string name, ParamPropFlag PropFlag

Introduction to Scripting 1-64


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Structure Construction Members


UDParam value,
ParamPropType propType,
ParamPropFlag propFlag)
UDMOption UDMOption() string OptName
UDPParam OptValue
UDMOption( ParamPropType PropType
string name, ParamPropFlag PropFlag
UDParam value,
ParamPropType propType,
ParamPropFlag propFlag)
UDMParameter UDMParameter() string ParamName
UDPParam ParamValue
UDMParameter( UnitType UnitType
string name, ParamPropType PropType
UDParam value, ParamPropFlag PropFlag
UnitType unitType,
ParamPropType propType,
ParamPropFlag propFlag)

UDP/UDM Constants

Full names of enum constants must be used in scripts.


Example:
unitType = UnitType.LengthUnit
dataType = ParamDataType.Int
Enum constants:

enum Constant Parameters


UnitType NoUnit
LengthUnit
AngleUnit
ParamDataType Int

Introduction to Scripting 1-65


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

enum Constant Parameters


Double
String
Bool
Position
Unknown
ParamPropType Text
Menu
Number
Value
FileName
Checkbox
Position
Unknown
ParamPropFlag NoFlag
ReadOnly
MustBeInt
MustBeReal
Hidden
Unknown
CoordinateSystemAxis XAxis
YAxis
ZAxis
CoordinateSystemPlane XYPlane
YZPlane
ZXPlane
SweepDraftType ExtendedDraft
RoundDraft
NaturalDraft
MixedDraft
SplitWhichSideToKeep SplitKeepBoth

Introduction to Scripting 1-66


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

enum Constant Parameters


SplitKeepPositiveOnly
SplitKeepNegativeOnly
PolylineSegmentType LineSegment
ArcSegment
SplineSegment
AngularArcSegment
MessageSeverity WarningMessage
ErrorMessage
InfoMessage
IncompleteMessage
FatalMessage
BLNDFilletRadiusLaw BLNDConstantRadius
BLNDVariableRadius
BLNDFilletType BLNDRound /* The outward surface of the fillet is curved.*/
BLNDMitered /* The outward surface of the fillet is flat and cut at an
angle.*/
BLNDChamferRangeLaw BLNDConstantRange
BLNDVariableRange
PartPropertyFlags PropNonModel
PropDisplayWireFrame
PropReadOnly
PostprocessingGeometry
PropInvisible
PropShowDirection
PropDummy

UDP Python Example


This Python script example demonstrates how to use the UDPBLNDElements structure and the
UDP chamfer and fillet functions.
import sys
primitive_info = UDPPrimitiveTypeInfo(
name="Fillet_Chamfer",

Introduction to Scripting 1-67


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

purpose="Fillet Chamfer Example",


company="Ansys",
date="09/11/2020",
version="1.0")
primitive_param_definitions = [
UDPPrimitiveParameterDefinition2(
"x_size",
"",
UnitType.LengthUnit,
ParamPropType.Value,
ParamPropFlag.MustBeReal,
UDPParam(ParamDataType.Double, 10)),
UDPPrimitiveParameterDefinition2(
"y_size",
"",
UnitType.LengthUnit,
ParamPropType.Value,
ParamPropFlag.MustBeReal,
UDPParam(ParamDataType.Double, 5)),
UDPPrimitiveParameterDefinition2(
"z_size",
"",
UnitType.LengthUnit,
ParamPropType.Value,
ParamPropFlag.MustBeReal,
UDPParam(ParamDataType.Double, 2))
]
length_units = "mm"

##############################################################

Introduction to Scripting 1-68


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

# Class Implementation
##############################################################
class UDPExtension(IUDPExtension):
def CreatePrimitive2(self, func_lib, param_values):
"""
Inbuilt function that is called to generate a UDP after suc-
cessful validation
:param func_lib: drawing inbuilt class, see in Help: UDMFunc-
tionLibrary
:param param_values: list of udp parameter values (user
input) generated by UDP Core
:return: None
"""
param_dict = self.get_param_dict(param_values)

start_point = UDPPosition(0, 0, 0)
box = func_lib.CreateBox(start_point, [
param_dict["x_size"],
param_dict["y_size"],
param_dict["z_size"]
])

# points on the middle of 4 vertical edges


points = [
[0, 0, param_dict["z_size"]/2],
[param_dict["x_size"], 0, param_dict["z_size"]/2],
[param_dict["x_size"], param_dict["y_size"], param_dict
["z_size"]/2],s
[0, param_dict["y_size"], param_dict["z_size"]/2]
]

Introduction to Scripting 1-69


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

edges = [func_lib.GetEdgeIDFromPosition(UDPPosition(point
[0], point[1], point[2])) for point in points]

fillet_rad = 0.1 * param_dict["x_size"] # 10% of X size


fillet_opt = UDPBLNDFilletOptions(True, BLNDFil-
letRadiusLaw.BLNDConstantRadius, fillet_rad, 0.0, True, BLNDFil-
letType.BLNDRound, 0.0, 0.0)

chamfer_length = 0.1 * param_dict["x_size"] # 10% of X size


chamfer_opt = UDPBLNDChamferOptions(False, BLNDCham-
ferRangeLaw.BLNDConstantRange, chamfer_length, 0.0)

# select your geometry to which to apply operations


blend_element = UDPBLNDElements(box)

# specify attribute ListOfEdges to which edges to apply fil-


let operation
blend_element.ListOfEdges = edges[0:2]
func_lib.Fillet(blend_element, fillet_opt)

# redeclare attribute ListOfEdges to which edges to apply


chamfer operation
blend_element = UDPBLNDElements(box)
blend_element.ListOfEdges = edges[2:4]
func_lib.Chamfer(blend_element, chamfer_opt)

# Provide to the user Info message indicating success


func_lib.AddMessage(MessageSeverity.InfoMessage, "Com-
pleted!")

def GetPrimitiveTypeInfo(self):
return primitive_info

Introduction to Scripting 1-70


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

def GetLengthParameterUnits(self):
return length_units

def GetPrimitiveParametersDefinition2(self):
return primitive_param_definitions

def AreParameterValuesValid2(self, error, udp_params):


return True

# Custom Functions
def get_param_value_by_name(self, param_values, param_name):
"""
Function to get a value of a single parameter accessing it
by name
:param param_values: list of udp parameter values (user
input) generated by UDP Core
:param param_name: name of the parameter as specified in
definition list
:return: Value of the parameter or None if parameter does
not exist
"""
param_dict = self.get_param_dict(param_values)
value = param_dict.get(param_name, None)
return value

def get_param_dict(self, param_values):


"""
Function to return a dictionary of UDP parameter name and
value (key: value) pairs
:param param_values: list of udp parameter values (user
input) generated by UDP Core
:return: dict of parameter name and values

Introduction to Scripting 1-71


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"""
udm_param_def = self.GetPrimitiveParametersDefinition2()
param_dict = {}
for i, param in enumerate(udm_param_def):
param_value = param_values[i].Data
if str(param.PropType) != "Menu":
param_dict[param.Name] = param_value
else:
param_dict[param.Name] = param_value.replace('"',
'').split(",")[0]
return param_dict

Introduction to CPython (Beta)


An Ansys Electronics Desktop Beta feature allows CPython to be used for standalone scripting,
as an alternative to IronPython, to:
l Launch Ansys Electronics Desktop (InitializeNew)
l Connect with a running instance of Ansys Electronics Desktop (Initialize)
l Execute Ansys Electronics Desktop script functions

One advantage of CPython is the large set of libraries and tools that are available. See below for
instructions on modifying a script so that it can be launched with CPython interpreters.

Important:

Launching Ansys Electronics Desktop on a remote machine is not supported in this


release. Initialize() will connect to a remote instance that is already running on the
remote machine, but cannot launch a new instance on the remote machine.

Important:

CPython client scripting is not yet supported on Linux, though ansysedt -grpcsrv can be
used to launch an Electronics Desktop instance on Linux, which can be connected to or
from a Windows machine via Initialize().

Creating an External Script


While the same as IronPython when run externally, a CPython recorded script must be modified
by adding the following lines to the beginning of your script before import ScriptEnv

Introduction to Scripting 1-72


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

import sys
# Imports the sys module containing system-specific func-
tions native to Python.
sys.path.append(r"<InstallationPath>/PythonFiles/DesktopPlugin")
# Adds the PythonFiles/DesktopPlugin subfolder to the list
of directories Python searches for modules and files.
Those lines are followed by:
import ScriptEnv
# This imports ScriptEnv.py from the installation path spe-
cified above.
Follow that with:
l Either InitializeNew() or Initialize(), as described below.
l Any desired Electronics Desktop scripting commands.
l Closing command, as described below.

Launching Electronics Desktop


To launch a new instance of Electronics Desktop and connect oApplication and oDesktop to it:
InitializeNew(NonGraphical = <True|False>, Module = None, Machine
= "", Port = <Port#>)
Where:
l NonGraphical – Specifies whether to launch Electronics Desktop in non-graphical mode.
l Module – Behavior remains unchanged from Iron Python and should be left defaulted to
"None." See the code in ScriptEnv.py for more details.
l Machine – Currently an empty string, as InitializeNew() will only launch Electronics
Desktop on the current machine.
l Port – Electronics Desktop will launch using the first unused port it finds starting at
<Port#>. If Port = 0, the starting port will be 50051.

Note:

InitializeNew() will always launch a new instance of Electronics Desktop. Please use Ini-
tialize() to connect to an existing instance. See below.

Connecting with a Running Instance of Electronics Desktop

Introduction to Scripting 1-73


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

To connect oApplication and oDesktop to an existing Electronics Desktop instance, or launch a


new instance and connect to it if necessary:
Initialize(name, NG = <True|False>, machine = "", port = <Port#>)
Where:
l Name – Ignored.
l NG – If launch is necessary, specifies whether to launch Electronics Desktop in non-graph-
ical mode.
l Machine – The machine on which to launch/connect. For current machine, pass empty
string or use localhost.
l Port – If port is nonzero, the script tries to connect to an existing instance on <port#> run-
ning on <machine>. If there is no instance running on that <port>, a new instance of Elec-
tronics Desktop launches on that port and then connects to it. If port = 0, the new instance
is launched on the first free port, starting at 50051.

Closing Electronics Desktop/Ending the Script


To close Electronics Desktop, add the following line to the end of the script:
ScriptEnv.Shutdown()
# This stops ScriptEnv.py. If you are running multiple
scripts, include this only at the end of the last script.
-grpcsrv Flag
This flag will launch the application in a mode where the executable serves as a scripting server
that can be used for CPython scripting in conjunction with the CPython stand alone scripting
instructions that were mentioned earlier. The -ng flag can be combined with -grpcsrv.
On Windows:
ansysedt.exe -grpcsrv <optional port number>.
On Linux:
ansysedt -grpcsrv <optional port number>.
If the port number is omitted, the default of 50051 will be used.
With -grpcsrv, a message will be displayed in the Messages window indicating that the server
was started. If the requested port is in use by another application, starting the sever may fail.

Related Topics:

Standalone Scripting in Iron Python

Introduction to Scripting 1-74


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

1-75
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Ansys Electronics Desktop Scripting


This chapter provides an overview of scripting in Ansys Electronics Desktop.
Overview of Ansys Electronics Desktop Scripting Objects
Running a Script
Recording a Script
Working with Project Scripts
Executing a Script from Within a Script
Ansys Electronics Desktop Scripting Conventions
Overview of Electronics Desktop Scripting Objects
When you record a script using Ansys Electronics Desktop, the beginning of the script must con-
tain some standard commands, as illustrated in the following chart. The commands in the chart
define the objects used by Electronics Desktop in the script and assign values to these objects.
The objects are used in the hierarchical order shown.

The commands are described below, followed by examples.

Introduction to Scripting 1-76


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oAnsoftApp
The oAnsoftApp object provides a handle for Iron Python or VBscript to access the
Ansoft.ElectronicsDesktop product.
In Iron Python, for example:
oAnsoftApp = CreateObject('Ansoft.ElectronicsDesktop')
In VBscript, for example:
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
oDesktop
The oDesktop object is used to perform desktop-level operations, including project man-
agement.
In Iron Python, for example:
oDesktop = oAnsoftApp.GetAppDesktop()
In VBscript, for example:
Set oDesktop = oAnsoftApp.GetAppDesktop()
For script commands recognized by the oDesktop object, consult: Desktop Object Script Com-
mands.
oProject
The oProject object corresponds to one project open in Electronics Desktop. It is used to
manipulate the project and its data. Its data includes variables, material definitions, and one or
more designs.
In Iron Python, for example:
oProject = oDesktop.GetActiveProject()
In VBscript, for example:
Set oProject = oDesktop.GetActiveProject()
Consult the following for details about script commands recognized by oProject:
l Project Object Script Commands
l Property Script Commands
l Dataset Script Commands

oDesign
The oDesign object corresponds to a design in the project. This object is used to manipulate
the design and its data, including variables, modules, and editors.
In Iron Python, for example:

Introduction to Scripting 1-77


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDesign = oProject.GetActiveDesign()
In VBscript, for example:
Set oDesign = oProject.GetActiveDesign()
Consult the following for details about script commands recognized by oDesign:
l Design Object Script Commands
l Output Variable Script Commands
l Reporter Editor Script Commands

oEditor
The oEditor object corresponds to an editor, such as the 3D Modeler, Layout, or Schematic
editor. This object is used to add and modify data in the editor.
In Iron Python, for example:
oEditor = oDesign.SetActiveEditor('3D Modeler')
In VBscript, for example:
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
Consult the following for details about script commands recognized by oEditor:
l 3D Modeler Editor Script Commands
l Schematic Editor Script Commands

Important:

There is no Reporter Editor object for oEditor. Reporter Editor commands are
executed by oDesign.

See: Reporter Editor Script Commands.

oModule
The oModule object corresponds to a module in the design. Modules are used to handle a set of
related functionalities.
In IronPython, for example:
oModule = oDesign.GetModule('BoundarySetup')
In VBscript, for example:
Set oModule = oDesign.GetModule("BoundarySetup")
Consult the following for details about script commands recognized by oModule:

Introduction to Scripting 1-78


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l Analysis Module Script Commands


l Boundary and Excitation Module Script Commands
l Field Overlays Module Script Commands
l Mesh Operations Module Script Commands
l Optimetrics Module Script Commands
l Radiation Module Script Commands
l Reduce Matrix Module Script Commands
l Solutions Module Script Commands

Example Script Opening


Combining the above objects, a script in Iron Python could begin like the following:
oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
oDesktop = oAnsoftApp.GetAppDesktop()
oProject = oDesktop.SetActiveProject("Project1")
oDesign = oProject.SetActiveDesign("Design1")
oEditor = oDesign.SetActiveEditor("3D Modeler")
oModule = oDesign.GetModule("BoundarySetup")
In VBscript, this would be:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
Set oProject = oDesktop.SetActiveProject("Project1")
Set oDesign = oProject.SetActiveDesign("Design1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
Set oModule = oDesign.GetModule("BoundarySetup")

Introduction to Scripting 1-79


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetActiveProject and GetActiveDesign for Wider Use


The sample script above only works for "Design1" within "Project1". To create a script that is
usable for any open project, you can use one or both of GetActiveProject and GetAct-
iveDesign.
In IronPython:
oProject = oDesktop.GetActiveProject()
oDesign = oProject.GetActiveDesign()
In VBscript:
Set oProject = oDesktop.GetActiveProject()
Set oDesign = oProject.GetActiveDesign()
Running a Script
Electronics Desktop scripts can be run from within the software or from the command line.
Within Electronics Desktop
To run scripts in Electronics Desktop:

1. Click Tools > Run Script, or select the Automation tab and click the Run Script icon:

The Run Script file browser appears.

2. Use the file browser to locate the script file (*.vbs, *.py, or *.js).
3. If desired, type script arguments in the Script Arguments field:

Introduction to Scripting 1-80


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

You can access script arguments using the AnsoftScriptHost.arguments collection from
VBScript. This is a standard COM collection.

4. Click Open.

Electronics Desktop executes the script.

While script execution is in progress, the Run Script button transforms into a Stop Script
button. Click Stop Script to stop the script execution.

To temporarily pause a running script, click Pause Script. This button transforms into a
Resume Script button, which you can click to resume script execution.

From the Command Line


To run a script from a command line, add the -runscriptandexit or -runscript argument
to the Electronics Desktop command line syntax.
To use script arguments, add the -scriptargs parameter and specify the arguments. For
example:
ansysedt.exe -scriptargs "hello there"
In Iron Python, the command line parameter following -scriptargs is passed without modi-
fication as a single string in the ScriptArgument python variable.
In VBscript, the command line parameter following -scriptargs is split into multiple strings
and converted to a VBscript collection which is accessible via the AnsoftScript.Arguments
collection. To access these arguments, for example:
msgbox AnsoftScript.Arguments(0) // Returns 'hello'
msgbox AnsoftScript.Arguments(1) // Returns 'there'
For more information about running a script from the command line, consult the HFSS help topic
"Running Ansys Electronics Desktop from the Command Line".
Direct Launch
If you run a script directly from the command line without launching Electronics Desktop, script
arguments will be in the WSH.arguments collection instead of the AnsoftScriptHost.ar-
guments collection. The following script ensures the arguments are accessed regardless of the
collection in which they reside:
on error resume next
dim args
Set args = AnsoftScript.arguments
if(IsEmpty(args)) then
Set args = WSH.arguments

Introduction to Scripting 1-81


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

End if
on error goto 0
// At this point, args has the arguments regardless of col-
lection
msgbox "Count is " & args.Count
for i = 0 to args.Count - 1
msgbox args(i)
next
Recording a Script
Electronics Desktop can record a script based on UI actions and save this script in either
IronPython (*.py) or VBscript (*.vbs) format.
Scripts can be saved to an external file, or to the project.

Important:

When you record a script, every subsequent action you take is recorded. You must
manually stop recording.

Recording a Script to File


To record a script to file:

1. Click Tools > Record Script to File, or select the Automation tab and click the Record
Script icon:

A Save As file browser appears.

2. Navigate to the location where you want to save the script.


3. In the File Name field, type a name for the script file.
4. Use the Save as Type drop-down menu to select either IronPython or VBscript.

Introduction to Scripting 1-82


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

5. Click Save.

The Record Script button transforms into a Stop Recording button, and Electronics
Desktop begins recording your actions.

6. Perform the steps you want to record.


7. When you have finished recording the script, click Stop Recording, or select Tools >
Stop Script Recording.

The recorded script is saved to the folder you specified.

Recording a Script to a Project


To record a script to a project:

1. Click Tools > Record Script to Project, or select the Automation tab and use the
Record Script drop-down menu to select Record Script to Project.

The Save Script to Project dialog box appears:

Introduction to Scripting 1-83


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

2. Enter a name for the script in the text box, then click OK.
3. Perform the steps you want to record.
4. When you have finished, click Stop Recording, or select Tools > Stop Script Record-
ing.

The recorded script is saved to scriptname.vbs in the Scripts library and can be accessed
from the Project Manager. See: Working with Project Scripts.

Working with Project Scripts


Scripts can be recorded to a project.
Once a script has been recorded to the project, you can manage it in the Project Manager from
the Definitions folder:

Individual scripts appear in this folder. Right-click a script to edit or run it:

Introduction to Scripting 1-84


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

You can also run project scripts from the Automation tab by selecting Run Script > Project
Scripts > [Script Name].

Note:

Project scripts are stored in the project scripts library. Refer to the topic "Managing
Library Contents" for information on working with libraries.

Executing a Script from Within a Script


Electronics Desktop provides a script command that enables you to launch another script from
within the script that is being executed.
In IronPython:
oDesktop.RunScript(<ScriptName>)
In VBscript:
oDesktop.RunScript <ScriptName>
If the full path to the script is not specified, Electronics Desktop searches for the specified script
in the following locations, in order:

1. Personal Library Directory (PersonalLib)


2. User Library Directory (UserLib)
3. System Library Directory (SysLib)
4. Installation Directory

Each of the library directories can be specified in Electronics Desktop under Tools > Options
> General Options, on the Project Options tab.
Electronics Desktop Scripting Conventions
A number of scripting conventions exist for Electronics Desktop regarding syntax, arguments,
and numerical values.
Consult the following topics:
l Named Arguments
l Setting Numerical Values

Introduction to Scripting 1-85


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l Layout Scripts and the Active Layer


l Scripts and Locked Layers
l Event Callback Scripting

Named Arguments
Many Electronics Desktop script commands use named arguments. The names can appear in
three ways:

1. Named data, where name precedes data.

For example:

..., "SolveInside:=", true, ...

2. Named Array, where name precedes array.

For example:

..., "Attributes:=", Array(...),...

3. Named Array, where name is inside an array.

For example:

..., Array("NAME:Attributes",...),...

In the first and second examples, the name is formatted as "<Name>:=". This signals to Elec-
tronics Desktop 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 Electronics
Desktop 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 add only the data that changed and omit anything that you do
not want to change. Electronics Desktop will use the names to determine which data you
provided.
VBscript Example
For example, when editing an impedance boundary, Electronics Desktop records the EditIm-
pedance command as follows in VBscript:
oModule.EditImpedance "Imped1", Array("NAME:Imped1",
"Resistance:=", "100", "Reactance:=", "50",
"InfGroundPlane:=", false)

Introduction to Scripting 1-86


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

If you only wish to change the resistance, you can leave out the other data arguments when
manually writing a script:
oModule.EditImpedance "Imped1", Array("NAME:Imped1",
"Resistance:=", "100")
IronPython Example
When editing a port excitation, Electronics Desktop records the Edit command as follows
in IronPython:
oModule.Edit("Port1",
["NAME:Port1",
["NAME:Properties",
"PortSolver:=", "true",
"Phase:=", "0deg",
"Magnitude:=", "2mA",
"Impedance:=", "50Ohm",
"Theta:=", "0deg",
"Phi:=", "0deg",
"PostProcess:=", "false",
"Renormalize:=", "50Ohm + 0i Ohm",
"Deembed:=", "0mm",
"RefToGround:=", "false"
],
"Type:=", "EdgePort",
"IsGapSource:=", true,
"UpperProbe:=", false,
"LayoutObject:=", "Port1",
"Pin:=", "",
"ReferencePort:=", ""
]
)
If you only wish to change the magnitude, you can leave out the other data arguments when
manually writing a script:

Introduction to Scripting 1-87


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.Edit("Port1",
["NAME:Port1",
["Magnitude:=", "1mA"]
]
)
Setting Numerical Values
For script arguments that expect a number, the following options are possible:
l Pass in the number directly.

In IronPython:

oModule.EditVoltage('Voltage1', ['NAME:Voltage1',
'Voltage:=', 3.5])

In VBscript:

oModule.EditVoltage "Voltage1", Array("NAME:Voltage1",


"Voltage:=", 3.5)

l Pass in a string containing the number with units.

In IronPython:

oModule.EditVoltage('Voltage1', ['NAME:Voltage1',
'Voltage:=', '3.5V'])

In VBscript:

oModule.EditVoltage "Voltage1", Array("NAME:Voltage1",


"Voltage:=", "3.5V" )

l Pass in a variable name.

In IronPython:

var = 3.5

oModule.EditVoltage('Voltage1', ['NAME:Voltage1',
'Voltage:=', var]

In VBscript:

dim var

Introduction to Scripting 1-88


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

var = "3.5V"

oModule.EditVoltage "Voltage1", Array("NAME:Voltage1",


"Voltage:=", var)

Layout Scripts and the Active Layer


A design's active layer is the layer that is used for object creation and placement during adding
operations in the user interface. Adding operations include paste and placement of instances, as
well as object creation. Usually there is an active layer, but it is not required and cannot be
assumed. Adding operations are responsible for ensuring that the active layer exists and meets
any particular requirements (such as layer type) for the operation. Adding operations may
change the active layer to a different layer that meets requirements. If the active layer is
changed, Electronics Desktop generates an alert. If no layer is available to be active, the oper-
ation is not done.
The active layer is not used during script adding operations. Script adding operations are
responsible for ensuring that the specified layer exists and meets the particular requirements
(such as layer type) for the operation. If there is a problem with using the specified layer, the
operation is not done. The active layer is always visible and selectable. These attributes are
reset, if needed, when a layer is made active. The current active layer is indicated by a combo
box display in the toolbar. The list for the combo box contains all layers that may be set active.
The active text style is related to the active layer. If there is no active layer, there is no active text
style. Objects on the active layer have priority during snapping.
Scripts and Locked Layers
The locked attribute of a layer is defined to mean that you may not edit, delete, or add objects on
the layer, either directly or with scripts (i.e., scripts run on layout or footprint definitions). This
includes not being able to change properties of objects on the layer. Note, however, that para-
meter changes can alter objects on locked layers.
The locked attribute of a layer is configurable using script commands and is user-editable via the
Edit Layers Dialog in the Layout Editor.
Event Callback Scripting
Event Callback scripting allows you to define custom JavaScript and VBScript routines that will
run automatically after detecting a triggering event, such as placing a component or running a
simulation. When defining an Event Callback script, specify one or more scripts that will be run
after a particular event is detected.
A callback script can only access functions and other scripts defined by its callback definition.
For example, a Simplorer callback script can call PropHost.GetValue — and all other PropHost
functions — but only from scripts defined in the Property Dialog callback. As a result, "PropHost"
is a Simplorer script item that is only visible in "Property" callback scripts. For more information,
see Callback Scripting Using PropHost Object and Callback Scripting Using CompInstance
Object.
The following table lists allowable callback events, items that are visible from the associated call-
back script, and the set of accessible functions that can be called.

Introduction to Scripting 1-89


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Scripts Vis-
Callback ible from the Functions Callable
Event Event Call- from the Visible Script
back Script
Place Com- CompInstance CompInstance.GetParentDesign() — Returns a oDesign item
ponent that can be used to call Design functions.

CompInstance.GetPropserverName() – Returns a Com-


pInstance identification name that can be used in oEditor prop-
erty-method scripts, such as GetPropertyValue(),
SetPropertyValue(), etc.

CompInstance.GetComponentName() — Returns the com-


ponent name, e.g. "MS_TRL".
Simulate CompInstance CompInstance.GetDesign() — Returns the interface to the spe-
Component cified design simulation.

CompInstance.GetProgress() – Returns the completion per-


centage (from 0 to 100) of the specified design simulation.

CompInstance.GetRunStatus() — Returns the status number


of the specified design simulation.

CompInstance.Abort() — Aborts the specified design sim-


ulation.

The function, ExecuteAnsoftScript(<ScriptName>), searches the configured Ansys Elec-


tronics Desktop script libraries by name for the script passed to it, and invokes the found
ScriptName. The invoked script will run with the same set of visible script items as the originally
called script. That is, CompInstance is visible from the invoked sub-script, ScriptName, and
CompInstance’s functions can be called from ScriptName.

Introduction to Scripting 1-90


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

1-91
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

2 - Application Object Script Commands


The Application object commands permit you to get the AppDesktop. Application object commands should be executed by the oAn-
softApp object.
oAnsoftApp.<CommandName> <args>
General Application Script Commands
The following are general script commands recognized by the oAnsoftApp object:
l GetAppDesktop

The following deprecated commands are no longer supported and produce an error if used.
l GetDesiredRamMBLimit (deprecated)
l GetHPCLicenseType (deprecated)
l GetMaximumRamMBLimit (deprecated)
l GetMPISpawnCmd(deprecated)
l GetMPIVendor (deprecated)
l GetNumberOfProcessors (deprecated)
l GetUseHPCForMP (deprecated)
l SetDesiredRamMBLimit (deprecated)
l SetHPCLicenseType (deprecated)
l SetMaximumRamMBLimit (deprecated)
l SetMPISpawnCmd (deprecated)
l SetMPIVendor (deprecated)

Application Object Script Commands 2-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l SetNumberOfProcessors (deprecated)
l SetUseHPCForMP (deprecated)

GetAppDesktop
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.

UI Access NA

Name Type Description


Parameters
None

Return Value Object

Python Syntax GetAppDesktop()


Python Example oDesktop = oAnsoftApp.GetAppDesktop()

VB Syntax GetAppDesktop()
VB Example Set oDesktop = oAnsoftApp.GetAppDesktop()

Application Object Script Commands 2-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

3 - Desktop Object Script Commands


Desktop commands should be executed by the oDesktop object. Some new commands permit you to query objects when you do not
know the names.
Set oDesktop =
CreateObject("Ansoft.ElectronicsDesktop")
oDesktop.CommandName <args>
AddMessage
ClearMessages
CloseAllWindows
CloseProject
CloseProjectNoForce
Count
DeleteProject
DownloadJobResults
EnableAutoSave
ExportOptionsFiles
GetActiveProject
GetActiveScheduler
GetActiveSchedulerInfo
GetAutoSaveEnabled
GetBuildDateTimeString

Desktop Object Script Commands 3-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetCustomMenuSet
GetDefaultUnit
GetDesktopConfiguration
GetDistributedAnalysisMachines
GetDistributedAnalysisMachinesForDesignType
GetExeDir
GetGDIObjectCount
GetLibraryDirectory
GetLocalizationHelper
GetMessages
GetPersonalLibDirectory
GetPPELicensingEnabled
GetProcessID
GetProjectDirectory
GetProjectList
GetProjects
GetRegistryInt
GetRegistryString
GetRunningInstancesMgr
GetSchematicEnvironment

Desktop Object Script Commands 3-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetScriptingToolsHelper
GetSysLibDirectory
GetTempDirectory
GetUserLibDirectory
GetVersion
IsFeatureEnabled
KeepDesktopResponsive
LaunchJobMonitor
NewProject
OpenAndConvertProject
OpenMultipleProjects
OpenProject
OpenProjectWithConversion
PauseRecording
PauseScript
Print
QuitApplication
RefreshJobMonitor
ResetLogging
RestoreProjectArchive
RestoreWindow

Desktop Object Script Commands 3-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ResumeRecording
RunACTWizardScript
RunProgram
RunScript
RunScriptWithArguments
SelectScheduler
SetActiveProject
SetActiveProjectByPath
SetCustomMenuSet
SetDesktopConfiguration
SetLibraryDirectory
SetProjectDirectory
SetRegistryFromFile
SetRegistryInt
SetRegistryString
SetSchematicEnvironment
SetTempDirectory
ShowDockingWindow
Sleep
SubmitJob

Desktop Object Script Commands 3-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Tile Windows

Related Topics:

Desktop Commands For Registry Values

ImportExport Tool Commands

Desktop Object Script Commands 3-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AddMessage
Add a message with severity and context to message window.

UI Access N/A

Name Type Description


<projectName> String Project name. Passing an empty string adds the message as the desktop
global message.
<designName> String Design name. Ignored if project name is empty. Passing an empty string adds
the message to project node in the message tree.
<severity> Integer One of "Error", "Warning" or "Info". Anything other than the first two is treated
as "Info"
Parameters
0 = Informational, 1 = Warning, 2 = Error, 3 = Fatal
<msg> String The message for the message window.
<category> String Optional. The category is created with the message under the design tree node
if the category does not exist. If the category already exists, the new message
is added to the end of the existing category. It is ignored if the project or design
is empty. If missing or empty, the message is added to the Design node in the
message tree.

Return Value None.

Python Syntax AddMessage( <projectName>, <designName>, <severity>, <msg>, <category>)


Python Example oDesktop.AddMessage("Project1", "HFSS", 0, "This is a test message", "")

Desktop Object Script Commands 3-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax AddMessage <projectName>, <designName>, <severity>, <msg>, <category>


VB Example oDesktop.AddMessage "Project1", "HFSS1", 0, "This is a test message", ""

ClearMessages
Clears messages, optionally specifying severity and design.

UI Access In Message Manager, right-click the project name and click Clear messages for Project#

Name Type Description


<projectName> String Project name, an empty string clears all project messages.
<designName> String Design name; ignored if project name is empty; an empty string clears mes-
sages in all designs.
Parameters <severity> Integer 0 - clear all info messages
1 - clear all info and warning messages
2 - clear all info, warning and error messages
3 - clear all messages included info, warning, error, and fatal-error

Return Value None

Python Syntax ClearMessages(<projectName>, <designName>, <severity>)


Python Example oDesktop.ClearMessages("", "",3)

VB Syntax ClearMessages <projectName>, <designName>, <severity>

Desktop Object Script Commands 3-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")


VB Example Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.ClearMessages "", "", 3

CloseAllWindows
Closes all MDI child windows on the desktop.

UI Access From main menu, Window > CloseAll.


Parameters None.
Return Value None.

Python Syntax CloseAllWindows()


Python Example oDesktop.CloseAllWindows()

VB Syntax CloseAllWindows
VB Example oDesktop.CloseAllWindows

CloseProject
Closes a specified project. Changes to the project are not saved. Save the project using the Project command Save or Save As
before closing to save changes.

Desktop Object Script Commands 3-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access File > Close

Name Type Description


Parameters <ProjectName> String The name of the project already in the Desktop that is to be closed, without
path or extension

Return Value None

Python Syntax CloseProject (<ProjectName>)


oDesktop.CloseProject("MyProject")
Python Example

VB Syntax CloseProject <ProjectName>


VB Example oDesktop.CloseProject "MyProject"

CloseProjectNoForce
Use: Close a named project currently open in the Desktop, unless a simulation is running. Changes to the project will not be saved.
Save the project using the Project command Save or Save As before closing to save changes. To determine if the project has been
closed, use GetProjectList and see if the named project is present.

UI Access File > Close

Name Type Description


Parameters <ProjectName> String The name of the project already on the Desktop that is to be closed, without
path or extension

Return Value None

Desktop Object Script Commands 3-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax CloseProjectNoForce (<ProjectName>)


oDesktop.CloseProjectNoForce("MyProject")
Python Example

VB Syntax CloseProjectNoForce <ProjectName>


VB Example oDesktop.CloseProjectNoForce "MyProject"

Count
Gets the total number of queried projects or designs obtained by GetProjects() and GetDesigns() commands.

UI Access N/A
Parameters None.
Return Value Integer

Python Syntax Count


projects = oDesktop.GetProjects()
Python Example
numprojects = projects.Count

VB Syntax Count
VB Example Dim oAnsoftApp

Desktop Object Script Commands 3-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Dim projects
set projects = oDesktop.GetProjects()
for i = 0 to projects.Count - 1
msgbox projects(i).GetName()
dim designs
set designs = projects(i).GetDesigns()
for j = 0 to designs.Count - 1
msgbox designs(j).GetName()
next
next

DeleteProject
Deletes a project from disk.

Desktop Object Script Commands 3-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Edit > Delete

Name Type Description


Parameters
<ProjectName> String Name of the project

Return Value None

Python Syntax DeleteProject (<ProjectName>)


oDesktop.DeleteProject("MyProject")
Python Example

VB Syntax DeleteProject <ProjectName>


VB Example oDesktop.DeleteProject "MyProject"

DownloadJobResults
This command is for downloading results from Ansys Cloud. Before using this script command, the command SelectScheduler() must
be used first to select “ansys cloud” scheduler. This makes sure that current scheduler is Ansys Cloud, and user is logged in. Then,
either a valid .q file or .q.completed file must be in the project folder, or, a valid job ID and a “batchinfo” folder containing the cor-
responding .jobid file are required in the project folder. When the download requirements are met, the command downloads results
from Ansys Cloud using the specified filters to the given folder.

UI Access Select Scheduler

Name Type Description


Parameters
<jobID> String Provide the job ID of the target job. The job ID must be able to be found in cur-

Desktop Object Script Commands 3-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

rent .q (or .q.completed) file, or inside the “batchinfo” folder in projectPath. If the
job ID is empty, the job ID in current .q (or .q.completed) file will be used.
<projectPath> String A string of path to locate the project folder. The project file may be not neces-
sary, but .q (or .q.completed) file or “batchinfo” folder with valid .jobid files are
required.
<resultPath> String A string giving the folder path for the download to save to.
<Filters> (optional) String A string containing filters to download. The delimiter of file types is “;”. If no filter
specified, the default filter “*” will be applied, which requests all files for down-
load.

Return Value A Boolean result about download complete or not

Python Syntax DownloadJobResults(jobID, projectPath, resultsPath, filters)


boolDownloadCompleted = oDesktop.DownloadJobResults("012345678901234567890",
Python Example
"C:\\projects\\basic.aedt", "C:\\projects\\DownloadResults\\", "*")

VB Syntax DownloadJobResults(jobID, projectPath, resultsPath, filters)


boolDownloadCompleted = oDesktop. DownloadJobResults ("012345678901234567890",
VB Example
"C:\\projects\\basic.aedt", "C:\\projects\\DownloadResults\\", "*")

DeleteRegistryEntry
Deletes a registry entry from a registry key. Returns true if deletion succeeded.

UI Access N/A

Name Type Description


Parameters
<pathToRegistry> String Path to Registry entry.

Desktop Object Script Commands 3-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Boolean:
Return Value l True – Key has been deleted.
l False – Key does not exist.

Python Syntax DeleteRegistryEntry(<pathToRegistry>)


res = oDesktop.DeleteRegistryEntry("Desktop/ColorScheme")
Python Example

VB Syntax DeleteRegistryEntry <pathToRegistry>


VB Example res = oDesktop.DeleteRegistryEntry "Desktop/ColorScheme"

DoesRegistryValueExist
Determines whether a registry value exists.

UI Access N/A

Name Type Description


Parameters
<KeyName> String Full name of registry key, including path.

Boolean:
Return Value l True – Key exists.
l False – Key does not exist.

Desktop Object Script Commands 3-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax DoesRegistryValueExist(<KeyName>)


Python Exist = oDesktop.DoesRegistryValueExist('Desktop/ActiveDSOConfigurations/HFSS')
Example

VB Syntax DoesRegistryValueExist(<KeyName>)
VB Example bExist = oDesktop.DoesRegistryValueExist("Desktop/ActiveDSOConfigurations/HFSS")

EnableAutoSave
Enable or disable autosave feature.

UI Access N/A

Name Type Description


Parameters
<enable> Boolean True to enable autosave; False disables it.

Return Value None.

Python Syntax EnableAutoSave(<enable>)


oDesktop.EnableAutoSave(True)
Python Example

VB Syntax EnableAutoSave <enable>

Desktop Object Script Commands 3-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oDesktop.EnableAutoSave True

ExportOptionsFiles
Copies the options config files to the DestinationDirectory.

UI Access Tools > Options > Export Options Files ...

Name Type Description


Parameters
<DestinationDirectory> String The path to the destination directory.

Return Value None

Python Syntax ExportOptionsFiles( <DestinationDirectory>)


Python Example oDesktop.ExportOptionsFiles("D:/test/export/")

VB Syntax ExportOptionsFiles <DestinationDirectory>


VB Example oDesktop.ExportOptionsFiles"D:/test/export/"

GetActiveProject
Obtains the project currently active in the Desktop, as an object.

Desktop Object Script Commands 3-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note:

GetActiveProject returns normally if there are no active objects.

UI Access N/A
Parameters None.
Return Value Object: the project that is currently active in the desktop.

Python Syntax GetActiveProject()


oProject = oDesktop.GetActiveProject()
Python Example

VB Syntax GetActiveProject
VB Example Set oProject = oDesktop.GetActiveProject

GetActiveScheduler
Obtains the name of the scheduler active in the Desktop.

Note:

GetActiveScheduler returns normally if there are no active objects.

Desktop Object Script Commands 3-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A
Parameters None.
Name of the scheduler that is currently active in the desktop. Gets results such as "RSM", "Remote RSM",
Return Value
"Ansys Cloud", "SLURM", "LSF", "PBS", "SGE", "Windows HPC", etc. (User-friendly scheduler names.)

Python Syntax GetActiveScheduler()


oSchedulerName = oDesktop.GetActiveScheduler()
Python Example

VB Syntax GetActiveScheduler
VB Example Set oSchedulerName = oDesktop.GetActiveScheduler

GetActiveSchedulerInfo
Obtains info for the scheduler active in the Desktop.

Note:

GetActiveSchedulerInfo returns normally if there are no active objects.

UI Access N/A
Parameters None.

Desktop Object Script Commands 3-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Info for the scheduler that is currently active in the desktop or a remote scheduler. Gets results such as "RSM",
"Remote RSM", "Ansys Cloud", "SLURM", "LSF", "PBS", "SGE", "Windows HPC", as well as server info used to
Return Value select a server. For a local scheduler, the return format resembles '{"Selected Scheduler":"RSM","Scheduler
Name":"RSM","Server":""}'. For a remote scheduler, the return format resembles '{"Selected Sched-
uler":"Remote RSM","Scheduler Name":"SLURM","Server":"<server>"}'

Python Syntax GetActiveSchedulerInfo()


oSchedulerInfo = oDesktop.GetActiveSchedulerInfo()
Python Example

VB Syntax GetActiveScheduler
VB Example Set oSchedulerInfo = oDesktop.GetActiveSchedulerInfo

GetAutoSaveEnabled
Checks whether the autosave feature is enabled.

UI Access N/A
Parameters None.
Integer:
Return Value l 1 – Autosave is enabled.
l 0 – Autosave is not enabled.

Desktop Object Script Commands 3-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetAutoSaveEnabled()


Enabled = oDesktop.GetAutoSaveEnabled()
Python Example

VB Syntax GetAutoSaveEnabled
VB Example Enabled = oDesktop.GetAutoSaveEnabled()

GetBuildDateTimeString
Returns a string representing the build date and time of the product;

UI Access N/A
Parameters None.
String build date and time, in the format: year-month-day hour:minute:second.
Return Value
Example: 2019-01-18 21:59:33

Python Syntax GetBuildDateTimeString()


oDesktop.GetBuildDateTimeString()
Python Example

VB Syntax GetBuildDateTimeString

Desktop Object Script Commands 3-20


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example dnt = oDesktop.GetBuildDateTimeString

GetCustomMenuSet
Returns the name of the current selected menu set in Tools > Options > General Options > General > Desktop Configuration.

UI Access N/A
Parameters None.
Return Value String containing current menu set. For example, 'Default', 'EM', ‘Twin Builder’.

Python Syntax GetCustomMenuSet ()


oDesktop.GetCustomMenuSet()
Python Example

VB Syntax GetCustomMenuSet
VB Example Set oProject = oDesktop.GetCustomMenuSet

GetDefaultUnit
Returns the default unit for a physical quantity.

Tools > Options > General Options > Default Units. Note that this menu only displays units that can be
UI Access
changed, while the script can be used to view additional default units.

Name Type Description


Parameters
<type> String String containing a type of measurement.

Desktop Object Script Commands 3-21


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Valid strings are (case insensitive):


l "Acceleration"
l "Angle"
l "AngularAcceleration"
l "AngularDamping"
l "AngularSpeed"
l "Capacitance"
l "Conductance"
l "Current"
l "CurrentChangeRate"
l "DataRate"
l "DeltaH" (Magnetic Field Strength)
l "Density"
l "Flux"
l "Force"
l "Frequency"
l "Inductance"
l "Length"
l "MagneticReluctance"
l "Mass"
l "MassFlowRate"

Desktop Object Script Commands 3-22


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l "MomentInertia"
l "Power"
l "Pressure"
l "PressureCoefficient"
l "Resistance"
l "SaturateMagnetization" (Magnetic Inductance)
l "Speed"
l "Temperature"
l "Time"
l "Torque"
l "Voltage"
l "VoltageChangeRate"
l "Volume"
l "VolumeFlowPerPressureRoot"
l "VolumeFlowRate"

Return Value String containing the default unit (for example, "mm").

Python Syntax GetDefaultUnit(<type>)


Python Example oDesktop.GetDefaultUnit("Length")

VB Syntax GetDefaultUnit <type>

Desktop Object Script Commands 3-23


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oDesktop.GetDefaultUnit("Length")

GetDesktopConfiguration
Returns the name of the current selected configuration in Tools > Options > General Options > General > Desktop Configuration.

UI Access N/A
Parameters None.
Return Value String containing current Desktop configuration. For example, 'All', ‘Twin Builder’.

Python Syntax GetDesktopConfiguration()


oDesktop.GetDesktopConfiguration()
Python Example

VB Syntax GetDesktopConfiguration
VB Example Set oProject = oDesktop.GetDesktopConfiguration

GetDistributedAnalysisMachines
Gets a list of machines used for distributed analysis. You can iterate through the list using standard VBScript methods.

UI Access N/A
Parameters None.

Desktop Object Script Commands 3-24


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value Returns a collection of names of machines used for distributed analysis.

Python Syntax GetDistributedAnalysisMachines()


oDesktop.GetDistributedAnalysisMachines()
Python Example

VB Syntax GetDistributedAnalysisMachines
VB Example oDesktop.GetDistributedAnalysisMachines()

GetDistributedAnalysisMachinesForDesignType
To obtain a list of the machines set up for analysis of the specified design type.

UI Access NA

Name Type Description


Parameters <designTypeName> String The name of the type of design, such as "Twin Builder", "HFSS", HFSS-IE",
"Maxwell 3D" , "Maxwell 2D", "RMxprt", "EM Design", "Circuit", "System",
"Q3D Extractor", "2D Extractor"

Return Value Object; returns a collection of machine names.

Python Syntax GetDistributedAnalysisMachinesForDesignType (<designTypeName>)


machineNames =oDesktop.
Python Example
GetDistributedAnalysisMachinesForDesignType

Desktop Object Script Commands 3-25


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

("HFSS")

VB Syntax GetDistributedAnalysisMachinesForDesignType <designTypeName>


Set machineNames =oDesktop.
VB Example GetDistributedAnalysisMachinesForDesignType
("HFSS")

GetExeDir
Returns the path where the executable is located.

UI Access N/A
Parameters None.
String path where executable is located.
Return Value
Example: 'C:/Program Files/AnsysEM/v231/Win64/'

Python Syntax GetExeDir()


Python Example oDesktop.GetExeDir()

VB Syntax GetExeDir

Desktop Object Script Commands 3-26


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oDesktop.GetExeDir

GetGDIObjectCount

Note:
This command is for internal Ansys use only.

Python Syntax GetGDIObjectCount()


Python Example oDesktop.GetGDIObjectCount()

VB Syntax GetGDIObjectCount()
VB Example oDesktop.GetGDIObjectCount()

GetLibraryDirectory
Get the path to the SysLib directory.

UI Access NA

Name Type Description


Parameters
None

String
Return Value
The path to the SysLib directory.

Desktop Object Script Commands 3-27


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetLibraryDirectory()


AddInfoMessage(str(oDesktop.GetLibraryDirectory()))
Python Example

VB Syntax GetLibraryDirectory
VB Example MsgBox oDesktop.GetLibraryDirectory

VB Example:
------------------------------------------------------
message box returns the path in this example
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
libdir = oDesktop.GetLibraryDirectory

Desktop Object Script Commands 3-28


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

msgbox(oDesktop.GetLibraryDirectory())

GetLocalizationHelper

Note:
This command is for internal Ansys use only.

Returns the object for the localization helper.

UI Access NA

Name Type Description


Parameters
None

Object
Return Value
Localization helper object, such as "IDispatch(ILocalizationHelper)"

Python Syntax GetLocalizationHelper()


Python Example oDesktop.GetLocalizationHelper()

VB Syntax GetLocalizationHelper
VB Example oDesktop.GetLocalizationHelper()

GetMessages
Get the messages from a specified project and design.

Desktop Object Script Commands 3-29


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access NA

Name Type Description


<ProjectName> String Name of the project for which to collect messages. An incorrect project
name results in no messages (design is ignored). An empty project name
results in all messages (design is ignored)
<DesignName> String Name of the design in the named project for which to collect messages. An
incorrect design name results in no messages for the named project. An
empty design name results in all messages for the named project
Parameters
<Severity> Integer Severity is 0-3, and is tied in to info/warning/error/fatal types as follows:
l 0 – info and above
l 1 – warning and above
l 2 – error and fatal
l 3 – fatal only (rarely used)

Return Value Array of string messages.

Python Syntax GetMessages (<ProjectName>, <DesignName>, <Severity>)


Messages = oDesktop.GetMessages("MyProject", "HFSS1", 1)
Python Example

VB Syntax GetMessages <ProjectName>, <DesignName>, <Severity>


Messages = oDesktop.GetMessages "MyProject", "HFSS1", 1
VB Examples

Desktop Object Script Commands 3-30


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetPersonalLibDirectory
Get the path to the PersonalLib directory.

UI Access N/A
Parameters None.
Return Value String path to the PersonalLib directory.

Python Syntax GetPersonalLibDirectory()


oDesktop.GetPersonalLibDirectory()
Python Example

VB Syntax GetPersonalLibDirectory
VB Example oDesktop.GetPersonalLibDirectory

GetPPELicensingEnabled
Returns whether the PPE licensing is enabled.

UI Access N/A
Parameters None.
Boolean:
Return Value
l True – PPE licensing is enabled.

Desktop Object Script Commands 3-31


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l False – PPE licensing is not enabled.

Python Syntax GetPPELicensingEnabled()


oDesktop.GetPPELicensingEnabled()
Python Example

VB Syntax GetPPELicensingEnabled
VB Example oDesktop.GetPPELicensingEnabled

GetProcessID
Returns the process ID of ansysedt.exe.

UI Access N/A
Parameters None.
Return Value Integer process ID of ansysedt.exe. For example, 12716.

Python Syntax GetProcessID ()


Python Example oDesktop.GetProcessID()

Desktop Object Script Commands 3-32


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetProcessID
VB Example oDesktop.GetProcessID

GetProjectDirectory
Gets the path to the Project directory.

UI Access N/A
Parameters None.
Return Value String path to the Project directory.

Python Syntax GetProjectDirectory()


oDesktop.GetProjectDirectory()
Python Example

VB Syntax GetProjectDirectory
VB Example oDesktop.GetProjectDirectory

GetProjectList
Returns a list of all projects that are open in Electronics Desktop.

UI Access N/A
Parameters None.

Desktop Object Script Commands 3-33


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value Array of strings containing the names of all open projects in Electronics Desktop.

Python Syntax GetProjectList()


list_of_projects = oDesktop.GetProjectList()
Python Example

VB Syntax GetProjectList
VB Example list_of_projects = oDesktop.GetProjectList

GetProjects
Returns a list of all the projects that are currently open in Electronics Desktop. Once you have the projects, you can iterate through
them using standard VBScript methods.

UI Access N/A
Parameters None.
Return Value Returns a collection containing objects for all open projects in Electronics Desktop.

Python Syntax GetProjects()


oDesktop.GetProjects()
Python Example

Desktop Object Script Commands 3-34


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetProjects
VB Example oDesktop.GetProjects

GetRegistryInt
Obtains registry key integer value.

UI Access N/A

Name Type Description


Parameters
<KeyName> String Full name of registry key, including path.

Integer if the integer value is found. Return as Bad-Argument-Value if registry key does not exist or it is not an
Return Value
integer value.

Python GetRegistryInt(<KeyName>)
Syntax

num = oDesktop.GetRegistryInt('Desktop/Settings/ProjectOptions/HFSS/Up-
Python
dateReportsDynamicallyOnEdits')
Example

VB Syn- GetRegistryInt(<KeyName>)
tax

VB num = oDesktop.GetRegistryInt("Desktop/Settings/ProjectOptions/HFSS/Up-
Example dateReportsDynamicallyOnEdits")

Desktop Object Script Commands 3-35


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetRegistryString
Obtains registry key string value.

UI Access N/A

Name Type Description


Parameters
<KeyName> String Full name of registry key, including path.

String if the string value is found. Return as Bad-Argument-Value if registry key does not exist or it is not a string
Return Value
value.

Python Syntax GetRegistryString(<KeyName>)


activeDSO = oDesktop.GetRegistryString('Desktop/ActiveDSOConfigurations/HFSS')
Python Example

VB Syntax GetRegistryString(<KeyName>)
VB Example activeDSO = oDesktop.GetRegistryString("Desktop/ActiveDSOConfigurations/HFSS")

GetRunningInstancesMgr
Returns the object of the Running Instances Manager.

UI Access N/A

Parameters Name Type Description

Desktop Object Script Commands 3-36


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

None

Object
Return Value
Running instances manager object

Python Syntax GetRunningInstancesMgr()


Python Example oRunningInstances = oDesktop.GetRunningInstancecMgr()

VB Syntax GetRunningInstancesMgr()
VB Example Set oRunningInstances = oDesktop.GetRunningInstancesMgr()

GetSchematicEnvironment
Returns the name of the current schematic environment set in Tools > Options > General Options > General > Desktop Con-
figuration.

UI Access N/A
Parameters None.
Integer representing a schematic environment:
l 0 = Circuit
Return Value
l 1 = Twin Builder
l 2 = Maxwell Circuit

Desktop Object Script Commands 3-37


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetSchematicEnvironment()


oDesktop.GetSchematicEnvironment()
Python Example

VB Syntax GetSchematicEnvironment
VB Example Set oProject = oDesktop.GetSchematicEnvironment

GetScriptingToolsHelper

Note:
This command is for internal Ansys use only.

Returns the object for the scripting tools helper.

UI Access NA

Name Type Description


Parameters
None

Object
Return Value
ScriptingTools helper object

Python Syntax GetScriptingToolsHelper()

Desktop Object Script Commands 3-38


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Example oDesktop.GetScriptingToolsHelper()

VB Syntax GetScriptingToolsHelper
VB Example oDesktop.GetScriptingToolsHelper()

GetSysLibDirectory
Get the path to the SysLib directory.

UI Access N/A
Parameters None.
Return Value String path to the SysLib directory.

Python Syntax GetSysLibDirectory()


oDesktop.GetSysLibDirectory()
Python Example

VB Syntax GetSysLibDirectory
VB Example oDesktop.GetSysLibDirectory

GetTempDirectory
Gets the path to the Temp directory.

Desktop Object Script Commands 3-39


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A
Parameters None.
Return Value String path to the Temp directory.

Python Syntax GetTempDirectory()


oDesktop.GetTempDirectory()
Python Example

VB Syntax GetTempDirectory
VB Example oDesktop.GetTempDirectory

GetUserLibDirectory
Gets the path to the UserLib directory.

UI Access N/A
Parameters None.
Return Value Stringpath to the UserLib directory.

Python Syntax GetUserLibDirectory()

Desktop Object Script Commands 3-40


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDesktop.GetUserLibDirectory()
Python Example

VB Syntax GetUserLibDirectory
VB Example oDesktop.GetUserLibDirectory

GetVersion
Returns a string representing the version.

UI Access N/A
Parameters None.
Return Value String containing version of the product.

Python Syntax GetVersion()


oDesktop.GetVersion()
Python Example

VB Syntax GetVersion()
VB Example oDesktop.GetVersion

IsFeatureEnabled
Returns a Boolean for whether a queried feature is enabled.

Desktop Object Script Commands 3-41


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A
Parameters <FeatureID>.
Return Value Boolean for named feature.

Pytho- IsFeatureEnabled()
n Syn-
tax

import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
feature_strs = ["SF3519", "F195709_EXPORT_TO_EMIT", "F362235_EMIT_RESULTS_WINDOW_
IMPROVEMENTS",_
"F136736_SBR_Rough_Surface", "F353006_VOLUMETRIC_SBR", "F359673_SBR_MULTISTATE_ARRAY",
Pytho- "F393115_SWE_ANTENNA",_
n
"S196592_SBR_Directivity", "F432541_VSBR_IMPROVEMENTS", "F353007_VRT_FILTERS_ENHANCE",
Exam-
ple
"S540337_SBR_REGION_LOSS_DIRECTIVITY",_
"F11941_VRT_CURRENT_DENSITY", "S544593_SBR_3D_COMPONENT_ARRAY", "F539850_SBR_GO_
BLOCKAGE", "F540275_SBR_RAYSTATS"]
results = [oDesktop.IsFeatureEnabled(str) for str in feature_strs]
result_txt = open("C:/Users/MyResults/Downloads/results.txt", "w")
for i in range(len(feature_strs)):
result_txt.write('%s : %s\n' % (feature_strs[i], results[i]))

Desktop Object Script Commands 3-42


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

result_txt.close()

VB Syntax GetVersion()
VB Example results = oDesktop.IsFeatureEnabled(SF3519)

KeepDesktopResponsive
Specifies the minimum number of milliseconds to keep the desktop from showing hung.

UI Access N/A

Name Type Description


Parameters <MinTimeInMilliseconds> Integer The minimum number of milliseconds to keep the desktop win-
dow from showing hung, that is, not responding.

Return Value Boolean True for success and to keep running; False to indicate that the calling script should shut down.

Python Syntax KeepDesktopResponsive (<TimeInMilliseconds>)


oDesktop.KeepDesktopResponsive(10000)
Python Example

VB Syntax KeepDesktopResponsive <TimeInMilliseconds>


VB Example oDesktop.KeepDesktopResponsive 10000

LaunchJobMonitor
Use: For use in starting job monitoring. This brings up the Monitor Job dialog box.

Desktop Object Script Commands 3-43


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Launch Job Monitor

Name Type Description


Parameters
<projectPath> String Path to the project file to be monitored

Return Value None

Python Syntax LaunchJobMonitor()


Python Example oDesktop.LaunchJobMonitor("C:\\projects\\basic.aedt")

VB Syntax LaunchJobMonitor()
VB Example oDesktop.LaunchJobMonitor("C:\\projects\\basic.aedt")

NewProject
Creates a new project. The new project becomes the active project.

UI Access File > New.


Parameters None.
Return Value Object, the project that is added.

Python Syntax NewProject()

Desktop Object Script Commands 3-44


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oProject = oDesktop.NewProject()
Python Example

VB Syntax NewProject
VB Example Set oProject = oDesktop.NewProject

OpenAndConvertProject
Opens a legacy project and converts or copies it to .aedt format.

UI Access Click File > Open, and choose a legacy project

Name Type Description


<itemPath> String full project path of the legacy project
<legacyChoice> Integer 0: show conversion dialog box, (same as File > Open of a legacy file)
Parameters 1: rename (changes extension to .aedt, the original file and results are
renamed)
2: copy (creates new file with .aedt extension, and the original file and results
remain available)

Return Value An object reference to the newly opened project which has the .aedt extension

Warning: If project file/results with the same name and .aedt extension already exist in the same directory, they will be overwritten.

Python Syntax OpenAndConvertProject(filePath, legacyChoice)


oProject = oDesktop.OpenAndConvertProject("c:\files\optimtee.hfss", 1)
Python Example Note: optimtee.hfss is gone after this code executes
oProject = oDesktop.OpenAndConvertProject("c:\files\optimtee.hfss", 2)

Desktop Object Script Commands 3-45


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note: optimtee.hfss remains after this code executes

VB Syntax OpenAndConvertProject(filePath, legacyChoice)


Set oProject = oDesktop.OpenAndConvertProject("c:\files\optimtee.hfss", 1)
VB Example
Note: optimtee.hfss is gone after this code executes

OpenMultipleProjects
Opens all files of a specified type in a specified directory.

UI Access N/A

Name Type Description


Parameters <directory> String Path to the projects.
<fileType> String Type of projects to open.

Return Value None.

Python Syntax OpenAndConvertProject(<filePath>, <legacyChoice>)


Python Example oProject = oDesktop.OpenAndConvertProject("c:\files\optimtee.hfss", "*.aedt")

VB Syntax OpenAndConvertProject <filePath>, < legacyChoice>

Desktop Object Script Commands 3-46


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example Set oProject = oDesktop.OpenAndConvertProject "c:\files\optimtee.hfss", "*.aedt"

OpenProject
Opens a specified project.

UI Access Click File > Open.

Name Type Description


Parameters
<FileName> String Full path of the project to open.

Return Value An object reference to the newly opened project.

Python Syntax OpenProject(<FileName>)


Python Example oDesktop.OpenProject("D:/Projects/Project1.aedt")

VB Syntax OpenProject <FileName>


VB Example oDesktop.OpenProject "D:/Projects/Project1.aedt"

OpenProjectWithConversion

Note:
This command is for internal Ansys use only.

Desktop Object Script Commands 3-47


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax OpenProjectWithConversion()


Python Example oDesktop.OpenProjectWithConversion()

PageSetup (Layout Editor)


Use: Specifies page setup for printing.
Command: File>Page Setup
Syntax: PageSetup <ArgArray>
Return Value: None.
Parameters: <Margins>: Page margins in implicit units of inches.
<Border>: Integer value indicating to draw border (1) or not to draw (0).
<DesignVars>: Integer value indicating to draw design vars (1) or not to draw (0).
VB Example: Set oProject = oDesktop.GetActiveProject()
Set oDesign = oProject.GetActiveDesign()
Set oEditor = oDesign.GetActiveEditor()
oEditor.PageSetup Array("NAME:PageSetupData", "margins:=", Array("left:=", 550, "right:=", _
550, "top:=", 500, "bottom:=", 500), "border:=", 1, "DesignVars:=", 0)

Desktop Object Script Commands 3-48


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

PauseRecording
Temporarily stop script recording.

UI Access NA

Name Type Description


Parameters
None

Return Value None

Python Syntax PauseRecording()


oDesktop.PauseRecording()
Python Example

VB Syntax PauseRecording
VB Example oDesktop.PauseRecording

PauseScript
Pause the execution of the script and pop up a message to the user. The script execution will not resume until the user chooses.

UI Access Tools > Pause Script

Name Type Description


Parameters
<Message> String Any Text.

Return Value None

Desktop Object Script Commands 3-49


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax PauseScript (<Message>)


oDesktop.PauseScript("Text to display in pop-up dialog box.")
Python Example

VB Syntax PauseScript <Message>


VB Example oDesktop.PauseScript "Text to display in pop-up dialog box."

Print
Prints the contents of the active view window.

UI Access File > Print.


Parameters None.
Return Value None.

Python Syntax Print()


oDesktop.Print()
Python Example

VB Syntax Print

Desktop Object Script Commands 3-50


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oDesktop.Print

QuitApplication
Exits the desktop.

UI Access File > Exit.


Parameters None.
Return Value None.

Python Syntax QuitApplication()


oDesktop.QuitApplication()
Python Example

VB Syntax QuitApplication
VB Example oDesktop.QuitApplication

RefreshJobMonitor
For use in monitoring a job.

UI Access Tools > Job Management > Monitor Jobs.


Parameters None.
Return Value A string specifing the job state.

Desktop Object Script Commands 3-51


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

The result can be any of the following strings:


l "Monitor Not Visible"
l "Queued"
l "Running"
l "Shutting Down"
l "Unknown"
l "Completed"
l "Not Monitoring"
l "Starting Monitoring"

Python Syntax RefreshJobMonitor()


Python Example oDesktop.RefreshJobMonitor()

VB Syntax RefreshJobMonitor
VB Example oDesktop.RefreshJobMonitor

ResetLogging
Redirects simulation log file to a specified directory and log level.

Desktop Object Script Commands 3-52


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A

Name Type Description


Parameters <logFile> String Path to log file.
<logLevel> Integer Specified log level.

Return Value None.

Python Syntax ResetLogging(<logFile>, <logLevel>)


Python Example oDesktop.ResetLogging("C:/Project1.aedtresults/", 1)

VB Syntax ResetLogging <logFile>, <logLevel>

VB Examples oDesktop.ResetLogging "C:/Project1.aedtresults/", 1

RestoreProjectArchive
Restores a previously archived project to a specified path.

UI Access File > Restore Archive.

Name Type Description


<ArchiveFilePath> String Path to archived file
Parameters
<ProjectFilePath> String Path to restore location
<OverwriteExistingFiles> Boolean True to overwrite an existing file of the same name; else False.
<OpenPro- Boolean True to open the project after it is restored; else False.
jectAfterRestore>

Return Value None.

Desktop Object Script Commands 3-53


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python RestoreProjectArchive (<Archivefilepath>, <ProjectFilePath>, <OverwriteExistingFiles>, <OpenProjectAfterRestore>)


Syntax

Python oDesktop.RestoreProjectArchive("C:\Users\jdoe\Documents\OptimTee.aedtz", "C:\Docu-


Examp- ments\OptimTee.aedt", False, True)
le

RestoreProjectArchive <Archivefilepath>, <ProjectFilePath>, <OverwriteExistingFiles>, <OpenPro-


VB Syntax
jectAfterRestore>
oDesktop.RestoreProjectArchive "C:\Users\jdoe\Documents\OptimTee.aedtz", _
VB Example
"C:\Documents\OptimTee.aedt", false, true

RestoreWindow
Restores a minimized Desktop window.

UI Access N/A
Parameters None.
Return Value None.

Python Syntax RestoreWindow()


Python Example oDesktop.RestoreWindow()

Desktop Object Script Commands 3-54


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax RestoreWindow
VB Example oDesktop.RestoreWindow

ResumeRecording
Resume recording a script.

UI Access N/A
Parameters None.
Return Value None

Python Syntax ResumeRecording()


oDesktop.ResumeRecording()
Python Example

VB Syntax ResumeRecording
VB Example oDesktop.ResumeRecording

Desktop Object Script Commands 3-55


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

RunACTWizardScript

Note:
This command is for internal Ansys use only.

Python Syntax RunACTWizardScript()


Python Example oDesktop.RunACTWizardScript()

RunProgram
Runs an external program.

UI Access NA

Name Type Description


<ProgName> String Name of the program to run.
<ProgPath> String Location of the program. Pass in an empty string to use the system path.
Parameters
<WorkPath> String Working directory in which program will start.
<ArgArray> Array of Arguments to pass to the program. If no arguments, pass in None
Strings

Return Value None

Desktop Object Script Commands 3-56


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax RunProgram (<ProgName>, <ProgPath>, <WorkPath>, <ArgArray>)


oDesktop.RunProgram("winword.exe", _
Python Example "C:\Program Files\Microsoft Office\Office10",_
"", None)

VB Syntax RunProgram <ProgName>, <ProgPath>, <WorkPath>, <ArgArray>


oDesktop.RunProgram "winword.exe", _
VB Example "C:\Program Files\Microsoft Office\Office10",_
"", None

RunScript
Launches another script from within the script currently being executed.

UI Access Tools>Run Script

Name Type Description


<SCriptPath> String Name or full path of the script to execute.
If the full path to the script is not specified, Twin Builder searches for the
specified script in the following locations, in this order:
Parameters
1. Personal library directory.

This is the PersonalLib subdirectory in the project directory. The project dir-
ectory can be specified in the General Options dialog box (click Tools>Op-
tions>General Options to open this dialog box) under the Project Options
tab.

Desktop Object Script Commands 3-57


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

2. User library directory.

This is the userlib subdirectory in the library directory. The library directory can
be spec-ified in the General Options dialog box (click Tools>Op-
tions>General Options to open this dialog box) under the Project Options
tab.

3. System library directory.

This is the syslib subdirectory in the library directory. The library directory can
be speci-fied in the General Options dialog box (click Tools>Op-
tions>General Options to open this dialog box) under the Project Options
tab.

4. HFSS installation directory.

Long
Return Value
the return code for the script method.

Python Syntax RunScript (<ScriptPath>)


oDesktop.RunScript("C:/Project/test1.vbs")
Python Example

VB Syntax RunScript <ScriptPath>


VB Example oDesktop.RunScript ("C:/Project/test1.vbs")

Desktop Object Script Commands 3-58


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

RunScriptWithArguments
Similar to RunScript, launch another script from within the currently executing script, but with arguments.

UI Access NA

Name Type Description


<ScriptPath> String The name or full path of the script to execute. If the full path to the script
is not specified, the software looks for the script in the following loc-
ations:
l Personal library directory: "PersonalLib". The PersonalLib directory can
be specified in Tools>Options>General Options on the 'Project Options'
tab.
Parameters l User library directory: directory "userlib". The UserLib directory can be
specified in Tools>Options>General Options on the 'Project Options'
tab.
l System library directory: directory "syslib". The SysLib directory can be
specified in Tools>Options>General Options on the 'Project Options'
tab.
Software installation directory
l

<Arguments> String The arguments to supply to the specified script.

Long
Return Value
the return code for the script method.

Python Syntax RunScriptWithArguments (<ScriptPath>, <Arguments>)

Desktop Object Script Commands 3-59


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDesktop.RunScriptWithArguments
Python Example
("C:/Project/test2.py", "foo")

VB Syntax RunScriptWithArguments <ScriptPath>, <Arguments>


oDesktop.RunScriptWithArguments
VB Example
"C:/Project/test2.vbs", "foo"

SelectScheduler
Selects the scheduler used for batch job submission. It tries non-graphical selection of the scheduler, attempting to get version inform-
ation from the scheduler in order to check for successful selection. If unable to get the information, it displays the Select Scheduler
window and waits for the user to complete the settings.

UI Access Tools > Job Management > Select Scheduler.

Name Type Description


<option> String One of the following options (not case sensitive):
l Empty string for remote RSM service
l "RSM" for local RSM
Parameters l "Windows HPC" for Windows HPC
l "LSF" for Load-Sharing Facility
l "SGE" for Grid Engine (GE, OGE, SGE, UGE, etc.)
l "PBS" for Portable Batch Scheduler/System (PBSPro, Torque, Maui,
etc.)

Desktop Object Script Commands 3-60


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l"Ansys Cloud" for Ansys Cloud


<address (optional)> String String specifying the IP address or hostname of the head node or for the
remote host running the RSM service.
<username (optional)> String Username string to use for remote RSM service (or blank to use username
stored in current submission host user settings). If the (non-blank) user-
name doesn't match the username stored in current submission host user
settings, then the Select Scheduler dialog is displayed to allow for pass-
word entry prior to job submission.
<forcePasswordEntry String Boolean used to force display of the Select Scheduler GUI to allow for pass-
(optional)> word entry prior to job submission.

The selected scheduler (if selection was successful, this string should match the input option string, although it
Return Value
could differ in upper/lowercase).

Python Syntax Select Scheduler(<option>, <address>, <username>, <forcePasswordEntry>)


result = oDesktop.SelectScheduler("Windows HPC",
Python Example
"headnode.win.example.com")

VB Syntax Select Scheduler <option>, <address>, <username>, <forcePasswordEntry>


result = oDesktop.SelectScheduler "Windows HPC", _
VB Example
"headnode.win.example.com"

SetActiveProject
Specifies the name of the project that should become active in the desktop. Returns that project.

Desktop Object Script Commands 3-61


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A

Name Type Description


Parameters
<ProjectName> String The name of the project already in the Desktop that is to be activated.

Return Value Object, the project that is activated.

Python Syntax SetActiveProject (<ProjectName>)


oProject = oDesktop.SetActiveProject("Project1")
Python Example

VB Syntax SetActiveProject <ProjectName>


VB Example Set oProject = oDesktop.SetActiveProject "Project1"

SetActiveProjectByPath
Specifies the name of the project that should become active in the desktop. Returns that project. 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 unam-
biguous specification of the active project.

UI Access N/A

Name Type Description


Parameters
<ProjectName> String The full path name of the project already in the Desktop that is to be activated.

Return Value Object, the project that is activated.

Desktop Object Script Commands 3-62


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax SetActiveProjectByPath(<ProjectName>)


oProject = oDesktop.SetActiveProjectByPath("c:\Projects\MyProject.aedt")
Python Example

VB Syntax SetActiveProjectByPath <ProjectName>


VB Example Set oProject = oDesktop.SetActiveProjectByPath "c:\Projects\MyProject.aedt"

SetCustomMenuSet
Sets the custom menu set for Electronics Desktop.

Navigate to Tools > Options > General Options > General > Desktop Configuration. Select a configuration
UI Access
using the Custom Menu Set drop-down menu.

Name Type Description


<customMenuSet> String Name of desired menu set. Can be one of:
l 'Default'
l 'EM'

Parameters
l 'RF'
l 'RF.0'
l 'SI'
l 'SI1.0'
l 'SI2.0'

Desktop Object Script Commands 3-63


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l 'Twin Builder'

Return Value None

Python Syntax SetCustomMenuSet(<customMenuSet>)


oDesktop.SetCustomMenuSet('Default')
Python Example

VB Syntax SetCustomMenuSet(<customMenuSet>)
VB Example Set oProject = oDesktop.SetCustomMenuSet "EM"

SetDesktopConfiguration
Sets the desktop configuration.

Navigate to Tools > Options > General Options > General > Desktop Configuration. Select a configuration
UI Access
using the Set targeted configuration drop-down menu.

Name Type Description


<configName> String Name of desired Desktop configuration. Can be one of:
Parameters
l 'All'
l 'EM'
l 'RF'

Desktop Object Script Commands 3-64


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l 'SI'
l 'Twin Builder'

Return Value None

Python Syntax SetDesktopConfiguration (<configName>)


oDesktop.SetDesktopConfiguration('RF')
Python Example

VB Syntax SetDesktopConfiguration(<configName>)
VB Example Set oProject = oDesktop.SetDesktopConfiguration "SI"

SetLibraryDirectory
Sets the library directory path. The specified directory must already exist and contain a syslib folder.

UI Access NA

Name Type Description


Parameters
<DirectoryPath> String The path to the SysLib Directory

Return Value None

Python Syntax SetLibraryDirectory (<DirectoryPath>)


Python Example oDesktop.SetLibraryDirectory("c:\libraries")

Desktop Object Script Commands 3-65


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax SetLibraryDirectory <DirectoryPath>


VB Example oDesktop.SetLibraryDirectory"c:\libraries"

SetProjectDirectory
Sets the project directory path.

UI Access N/A

Name Type Description


Parameters
<DirectoryPath> String The path to the project directory. This should be writeable by the user.

Return Value None.

Python Syntax SetProjectDirectory (<DirectoryPath>)


oDesktop.SetProjectDirectory("c:\projects")
Python Example

VB Syntax SetProjectDirectory <DirectoryPath>


VB Example oDesktop.SetProjectDirectory "c:\projects"

Desktop Object Script Commands 3-66


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetRegistryFromFile
Configures registry by specifying an Analysis Configuration file which must have been exported from the HPC and Analysis panel.

UI Access N/A

Name Type Description


Parameters
<filePath> String Full file path of registry file.

Success if configuration is imported. Bad argument value if the file is not found or does not contain valid analysis
Return Value
configuration data.

Python Syntax SetRegistryFromFile(<filePath>)


oDesktop.SetRegistryFromFile('c:/temp/test.acf')
Python Example

VB Syntax SetRegistryFromFile <filePath>


VB Example oDesktop.SetRegistryFromFile "c:/temp/test.acf"

SetRegistryInt
Sets registry key to an integer value.

UI Access N/A

Name Type Description


Parameters <KeyName> String Full name of registry key, including path.
<int> Integer Integer value to be assigned to registry key.

Desktop Object Script Commands 3-67


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Success if the key is defined as an integer. Bad argument value if a key is not defined, or if the value is a text
Return Value
string.

Python SetRegistryInt(<KeyName>, <int>)


Syntax

Python oDesktop.SetRegistryInt('Desktop/Settings/ProjectOptions/HFSS/Up-
Example dateReportsDynamicallyOnEdits', 0)

VB Syn- SetRegistryInt <KeyName> <int>


tax

VB oDesktop.SetRegistryInt "Desktop/Settings/ProjectOptions/HFSS/Up-
Example dateReportsDynamicallyOnEdits", 0

SetRegistryString
Sets registry key to a string value.

UI Access N/A

Name Type Description


Parameters <KeyName> String Full name of registry key, including path.
<value> String String value to be assigned to registry key.

Success if the key is defined as a text string. Bad argument value if the key is not defined or requires an integer
Return Value
value.

Desktop Object Script Commands 3-68


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax SetRegistryString(<KeyName>, <value>)


oDesktop.SetRegistryString('Desktop/ActiveDSOConfigurations/HFSS', 'Local')
Python Example

VB Syntax SetRegistryString <KeyName>, <value>


VB Example oDesktop.SetRegistryString "Desktop/ActiveDSOConfigurations/HFSS", "Local"

SetSchematicEnvironment
Sets the schematic environment for Electronics Desktop.

Navigate to Tools > Options > General Options > General > Desktop Configuration. Select a schematic
UI Access
environment using the Custom Menu Set drop-down menu.

Name Type Description


<schEnv> Integer Desired schematic environment. Can be one of:
Parameters
l 0 (Circuit)
l 1 (Twin Builder)
l 2 (Maxwell Circuit)

Return Value None

Python Syntax SetSchematicEnvironment(<schEnv>)


oDesktop.SetSchematicEnvironment(1)
Python Example

Desktop Object Script Commands 3-69


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax SetSchematicEnvironment(<schEnv>)
VB Example Set oProject = oDesktop.SetSchematicEnvironment 2

SetTempDirectory
Sets the temp directory path. The directory will be automatically created if it does not already exist.

UI Access N/A

Name Type Description


Parameters
<DirectoryPath> String The path to the Temp directory. This should be writeable by the user.

Return Value None.

Python Syntax SetTempDirectory (<DirectoryPath>)


oDesktop.SetTempDirectory("c:\tmp")
Python Example

VB Syntax SetTempDirectory <DirectoryPath>


VB Example oDesktop.SetTempDirectory "c:\tmp"

ShowDockingWindow
Shows or hides a docking window.

Desktop Object Script Commands 3-70


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Right click docking window > Show/Hide.

Name Type Description


Parameters
<windowName> String The window name (for example, "Message Manager", "Component Libraries",
"Properties")
<show> Boolean True to show; False to hide.

Return Value None.

Python Syntax ShowDockingWindow (<windowName>, <show>)


oDesktop.ShowDockingWindow('Message Manager',False)
Python Example

VB Syntax ShowDockingWindow <windowName> <show>


VB Example oDesktop.ShowDockingWindow "Message Manager" False

Sleep
Suspends execution of HFSS for the specified number of milliseconds, up to 60,000 milliseconds (1 minute).

UI Access NA

Name Type Description


Parameters <TimeInMil- Integer The time that the execution should be suspended in milliseconds
liseconds>

Return Value None

Desktop Object Script Commands 3-71


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax Sleep (<TimeInMilliseconds>)


oDesktop.Sleep(1000)
Python Example

VB Syntax Sleep <TimeInMilliseconds>


VB Example oDesktop.Sleep 1000

SubmitJob
Submits a batch job to a scheduler. When submitting the same project file multiple times, you should have the script wait for each job
(or jobs for multi-step) to finish, which can be done via the monitoring functions LaunchJobMonitor() and RefreshJobMonitor(), check-
ing the result of RefreshJobMonitor() in a loop until it returns completed ("Monitor Not Visible") status.

UI Access Tools > Job Management > Submit Job.

Name Type Description


<settingsPath> String Path to the settings file (exported from the Submit Job GUI) to use for sub-
mission.
Parameters <projectPath> String Path to the project file to use in the batch job. This could be an archive (.ae-
dtz file) or an un-archived project.
<design (optional)> String Name of the design to use for batch solve.
<setup (optional)> String Name of the specific setup to solve.

Return Value Array of job ID strings (empty if no jobs submitted).

Desktop Object Script Commands 3-72


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax SubmitJob(<settingsPath>, <projectPath>, <design>, <setup>)


jobIDs = oDesktop.SubmitJob("C:\\hpc-settings\\Submit_
Job_Settings.areg", "C:\\projects\\basic.aedt"))
Python Example moreIDs = oDesktop.SubmitJob("C:\\hpc-settings\\Submit_
Job_Settings.areg", "C:\\projects\\basic.aedt",
"Design1", "Setup1")

VB Syntax SubmitJob <settingsPath>, <projectPath>, <design>, <setup>


jobIDs = oDesktop.SubmitJob "C:\\hpc-settings\\Submit_
Job_Settings.areg", "C:\\projects\\basic.aedt"
VB Example moreIDs = oDesktop.SubmitJob "C:\\hpc-settings\\Submit_
Job_Settings.areg", "C:\\projects\\basic.aedt",
"Design1", "Setup1"

TileWindows
Arrange all open windows in a tiled format.

UI Access From main menu, Window >Tile Horizontally or Window >Tile Vertically.

Name Type Description


Parameters <TilingFlag> Integer l 0 – Tile vertically.

l 1 – Tile horizontally.

Return Value None.

Desktop Object Script Commands 3-73


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax TileWindows(<TilingFlag>)


Python Example oDesktop.TileWindows(0)

VB Syntax TileWindows <TilingFlag>


VB Example oDesktop.TileWindows 0

Desktop Commands For Registry Values


The Ansys Registry is stored as XML format file. By default it is located at C:\User-
s\<UserName>\Documents\Ansoft\<AnsysProductNameversion>\config\<PC_NAME>_user.XML. Most of the Ansys product con-
figuration information is stored in this XML file. These methods allow you to change the product configuration in VB or Python.
For example, to set the DSO & HPC analysis setup for HFSS using a Python script:

1. Start HFSS.
2. Go to the DSO and HPC options and create a setup named "test".
3. Export the setup to a file (for example, c:\temp\test.acf).
4. Copy the exported file to a target PC (for example, f:\temp\test.acf).
5. Run the following script:

#import the setup

oDesktop.SetRegistryFromFile("f:\\temp\\test.acf")

# Set Active Setup to "test"

Desktop Object Script Commands 3-74


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDesktop.SetRegistryString("Desktop/ActiveDSOConfigurations/HFSS", "test")

See the following subtopics:


DeleteRegistryEntry
DoesRegistryValueExist
GetRegistryInt
GetRegistryString
SetRegistryFromFile
SetRegistryInt
SetRegistryString
DeleteRegistryEntry
Deletes a registry entry from a registry key. Returns true if deletion succeeded.

UI Access N/A

Name Type Description


Parameters
<pathToRegistry> String Path to Registry entry.

Boolean:
Return Value l True – Key has been deleted.
l False – Key does not exist.

Python Syntax DeleteRegistryEntry(<pathToRegistry>)


Python Example res = oDesktop.DeleteRegistryEntry("Desktop/ColorScheme")

Desktop Object Script Commands 3-75


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax DeleteRegistryEntry <pathToRegistry>


VB Example res = oDesktop.DeleteRegistryEntry "Desktop/ColorScheme"

DoesRegistryValueExist
Determines whether a registry value exists.

UI Access N/A

Name Type Description


Parameters
<KeyName> String Full name of registry key, including path.

Boolean:
Return Value l True – Key exists.
l False – Key does not exist.

Python Syntax DoesRegistryValueExist(<KeyName>)


Python Exist = oDesktop.DoesRegistryValueExist('Desktop/ActiveDSOConfigurations/HFSS')
Example

VB Syntax DoesRegistryValueExist(<KeyName>)

Desktop Object Script Commands 3-76


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example bExist = oDesktop.DoesRegistryValueExist("Desktop/ActiveDSOConfigurations/HFSS")

GetRegistryInt
Obtains registry key integer value.

UI Access N/A

Name Type Description


Parameters
<KeyName> String Full name of registry key, including path.

Integer if the integer value is found. Return as Bad-Argument-Value if registry key does not exist or it is not an
Return Value
integer value.

Python GetRegistryInt(<KeyName>)
Syntax

num = oDesktop.GetRegistryInt('Desktop/Settings/ProjectOptions/HFSS/Up-
Python
dateReportsDynamicallyOnEdits')
Example

VB Syn- GetRegistryInt(<KeyName>)
tax

VB num = oDesktop.GetRegistryInt("Desktop/Settings/ProjectOptions/HFSS/Up-
Example dateReportsDynamicallyOnEdits")

GetRegistryString
Obtains registry key string value.

Desktop Object Script Commands 3-77


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A

Name Type Description


Parameters
<KeyName> String Full name of registry key, including path.

String if the string value is found. Return as Bad-Argument-Value if registry key does not exist or it is not a string
Return Value
value.

Python Syntax GetRegistryString(<KeyName>)


activeDSO = oDesktop.GetRegistryString('Desktop/ActiveDSOConfigurations/HFSS')
Python Example

VB Syntax GetRegistryString(<KeyName>)
VB Example activeDSO = oDesktop.GetRegistryString("Desktop/ActiveDSOConfigurations/HFSS")

SetRegistryFromFile
Configures registry by specifying an Analysis Configuration file which must have been exported from the HPC and Analysis panel.

UI Access N/A

Name Type Description


Parameters
<filePath> String Full file path of registry file.

Success if configuration is imported. Bad argument value if the file is not found or does not contain valid analysis
Return Value
configuration data.

Desktop Object Script Commands 3-78


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax SetRegistryFromFile(<filePath>)


oDesktop.SetRegistryFromFile('c:/temp/test.acf')
Python Example

VB Syntax SetRegistryFromFile <filePath>


VB Example oDesktop.SetRegistryFromFile "c:/temp/test.acf"

SetRegistryInt
Sets registry key to an integer value.

UI Access N/A

Name Type Description


Parameters <KeyName> String Full name of registry key, including path.
<int> Integer Integer value to be assigned to registry key.

Success if the key is defined as an integer. Bad argument value if a key is not defined, or if the value is a text
Return Value
string.

Python SetRegistryInt(<KeyName>, <int>)


Syntax

Python oDesktop.SetRegistryInt('Desktop/Settings/ProjectOptions/HFSS/Up-
Example dateReportsDynamicallyOnEdits', 0)

Desktop Object Script Commands 3-79


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syn- SetRegistryInt <KeyName> <int>


tax

VB oDesktop.SetRegistryInt "Desktop/Settings/ProjectOptions/HFSS/Up-
Example dateReportsDynamicallyOnEdits", 0

SetRegistryString
Sets registry key to a string value.

UI Access N/A

Name Type Description


Parameters <KeyName> String Full name of registry key, including path.
<value> String String value to be assigned to registry key.

Success if the key is defined as a text string. Bad argument value if the key is not defined or requires an integer
Return Value
value.

Python Syntax SetRegistryString(<KeyName>, <value>)


oDesktop.SetRegistryString('Desktop/ActiveDSOConfigurations/HFSS', 'Local')
Python Example

VB Syntax SetRegistryString <KeyName>, <value>


VB Example oDesktop.SetRegistryString "Desktop/ActiveDSOConfigurations/HFSS", "Local"

Desktop Object Script Commands 3-80


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ImportExport Tool Commands


These oDesktop commands are run by using the GetTool script to call the ImportExport Tool.
oTool = oDesktop.GetTool("ImportExport")
Scripts run via the ImportExport Tool include:
ImportANF
ImportANFV2
ImportAutoCAD
ImportAWRMicrowaveOffice
ImportEDB
ImportExtracta
ImportGDSII
ImportGerber
ImportIDF
ImportIDFandMerge
ImportIPC
ImportODB
ImportXFL
ImportANF
Imports an ANF file into a new project. For older ANFv2 files, use ImportANFv2.

UI Access File > Import > ANF.

Desktop Object Script Commands 3-81


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


Parameters
<ANFfilename> String Full path of ANF file.

Return Value None.

Python Syntax ImportANF(<ANFfilename>)


oDesktop.RestoreWindow()
Python Example Set oTool = oDesktop.GetTool('ImportExport')
oTool.ImportANF('C:\\AnsTranslator\\results\\package4.anf')

VB Syntax ImportANF <ANFfilename>


Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
VB Example Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Dim oTool

Desktop Object Script Commands 3-82


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")


Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oTool = oDesktop.GetTool("ImportExport")
oTool.ImportANF("%UserProfile%\Documents\HFSS Examples\package.anf")

ImportANFv2
Imports an ANFv2 file into a new project. For newer ANF files, use ImportANF.

UI Access File > Import > ANF.

Name Type Description


<ANFfilename> String Full path of ANF file.
Parameters <outputPathName> String Full path of *.aedb output file.
<controlFileName> String Full path of XML control file.
<cmpFileName> String Full path of CMP file. Pass empty string if none.

Return Value None.

Python Syntax ImportANFv2 (<ANFfilename>, <outputPathName>, <controlFileName>, <cmpFileName>)


oDesktop.RestoreWindow()
Set oTool = oDesktop.GetTool('ImportExport')
Python Example oTool.ImportANFV2("C:/Users/jdoe/Documents/SAMPLEFILES/my_model.anf",
"C:/Users/jdoe/Documents/Ansoft/my_model.aedb",
"C:/Users/jdoe/Documents/Ansoft/my_model.xml", "")

Desktop Object Script Commands 3-83


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax ImportANFv2 <ANFfilename>, <outputPathName>, <controlFileName>, <cmpFileName>


Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
VB Example
Dim oTool
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oTool = oDesktop.GetTool("ImportExport")
oTool.ImportANFV2 "C:/Users/jdoe/Documents/SAMPLEFILES/my_model.anf", _
"C:/Users/jdoe/Documents/Ansoft/my_model.aedb", _
"C:/Users/jdoe/Documents/Ansoft/my_model.xml", ""

Desktop Object Script Commands 3-84


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ImportAutoCAD
Imports an AutoCAD file into a new project.

UI Access File > Import > AutoCAD.

Name Type Description


<dxfFileName> String Full path of DXF file.
Parameters
<outputPathFileName> String Full path of EDB file to create during import.
<controlFileName> String Full path of XML control file. Pass empty string if none.

Return Value None.

Python Syntax ImportAutoCAD (<dxfFileName>, <outputPathFileName>, <controlFileName>)


Set oTool = oDesktop.GetTool('ImportExport')
Python Example oTool.ImportAutoCAD('C:/MyPath/a4lines.dxf', 'C:/MyPath/a4lines.aedb.edb',
'C:/MyPath/a4lines.xml')

VB Syntax ImportAutoCAD <dxfFileName>, <outputPathFileName>, <controlFileName>


Set oTool = oDesktop.GetTool("ImportExport")
VB Example oTool.ImportAutoCAD "C:/MyPath/a4lines.dxf", "C:/MyPath/a4lines.aedb.edb",
"C:/MyPath/a4lines.xml"

ImportAWRMicrowaveOffice
Imports an AWRMicrowaveOffice file into a new project.

Desktop Object Script Commands 3-85


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access File > Import > AWRMicrowaveOffice.

Name Type Description


<xmlFileName> String Full path of XML file.
Parameters
<outputPathName> String Full path of output file.
<logFileName> String Full path of log file.

Return Value None.

Python ImportAWRMicrowaveOffice (<xmlFileName>, <outputPathName>, <logFileName>)


Syntax

oDesktop.RestoreWindow()
Set oTool = oDesktop.GetTool('ImportExport')
Python
Example oTool.ImportAWRMicrowaveOffice('C:/MyFiles/package4.xml', 'C:/MyFiles/package4.aedb',
'C:/MyFiles/package4.log')

VB Syn- ImportAWRMicrowaveOffice <xmlFileName>, <outputPathName>, <logFileName>


tax

Dim oAnsoftApp

VB Dim oDesktop
Example Dim oProject
Dim oDesign

Desktop Object Script Commands 3-86


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Dim oTool
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oTool = oDesktop.GetTool("ImportExport")
oTool.ImportAWRMicrowaveOffice "C:/MyFiles/package4.xml", "C:/MyFiles/package4.aedb",
_
"C:/MyFiles/package4.log"

ImportEDB
Imports an EDB file into a new project.

UI Access File > Import > EDB.

Name Type Description


Parameters
<edbFileName> String Full path of EDB file.

Return Value None.

Python Syntax ImportEDB (<edbFileName>)

Desktop Object Script Commands 3-87


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDesktop.RestoreWindow()
Python Example Set oTool = oDesktop.GetTool('ImportExport')
oTool.ImportEDB('C:/MyFiles/projectforimport.aedb/edb.def')

VB Syntax ImportEDB <edbFileName>


Set oTool = oDesktop.GetTool("ImportExport")
VB Example
oTool.ImportEDB "C:/MyFiles/projectforimport.aedb/edb.def"

ImportExtracta
Imports a Cadence Extracta file into a new project.

Note:

In order for this script to work, you must have the Cadence-supplied executable Extracta.exe installed on your machine.

UI Access File > Import > Cadence APD / Allegro / SiP.

Name Type Description


<extractaFileName> String Full path of Extracta file.
Parameters
<outputPathName> String Full path of output file to be created.
<controlFileName> String Optional. Full path to XML control file.

Return Value None.

Desktop Object Script Commands 3-88


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python ImportExtracta (<extractaFileName>, <outputPathName>, <controlFileName>)


Syntax

oDesktop.RestoreWindow()
Python
Set oTool = oDesktop.GetTool('ImportExport')
Example
oTool.ImportExtracta('C:/MyFiles/projectforimport.brd', 'C:/MyFiles/project.edb', '')

VB Syn- ImportExtracta <extractaFileName>, <outputPathName>, <controlFileName>


tax

VB
Set oTool = oDesktop.GetTool("ImportExport")
Example oTool.ImportExtracta "C:/MyFiles/projectforimport.brd", "C:/MyFiles/project.edb", "")

ImportGDSII
Imports a GDSII file into a new project.

UI Access File > Import > GDSII.

Name Type Description


<gdsiiFileName> String Full path of GDSII file.
Parameters <outputPathName> String Full path of EDB file to create during import.
<controlFileName> String Optional. Full path of XML control file. Pass empty string if none.
<propertyFileName> String Optional. Full path to property mapping file. Pass empty string if none.

Return Value None.

Desktop Object Script Commands 3-89


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ImportGDSII(<gdsiiFileName>, <outputPathName>, <controlFileName>, <propertyFileName>)


oDesktop.RestoreWindow()
Set oTool = oDesktop.GetTool('ImportExport')
Python Example
oTool.ImportGDSII('C:/Files/test.gds', 'C:/Files/test.aedb.edb',
'C:/Files/test.xml', 'C:/Files/test.txt')

VB Syntax ImportGDSII <gdsiiFileName>, <outputPathName>, <controlFileName>, <propertyFileName>


Set oTool = oDesktop.GetTool("ImportExport")
VB Example oTool.ImportGDSII "C:/Files/test.gds", "C:/Files/test.aedb.edb", _
"C:/Files/test.xml", "C:/Files/test.txt"

ImportGerber
Imports a GERBER file into a new project.

UI Access File > Import > GERBER.

Name Type Description


<gerberFileName> String Full path of GERBER file.
Parameters
<outputPathName> String Full path of EDB file to create during import.
<controlFileName> String Optional. Full path of XML control file. Pass empty string if none.

Return Value None.

Desktop Object Script Commands 3-90


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ImportGerber(<gerberFileName>, <outputPathName>, <controlFileName>)


oDesktop.RestoreWindow()
Set oTool = oDesktop.GetTool('ImportExport')
Python Example
oTool.ImportGERBER('C:/Files/test.gbr', 'C:/Files/test.aedb.edb',
'C:/Files/test.xml')

VB Syntax ImportGerber <gerberFileName>, <outputPathName>, <controlFileName>


Set oTool = oDesktop.GetTool("ImportExport")
VB Example oTool.ImportGERBER "C:/Files/test.gbr", "C:/Files/test.aedb.edb", _
"C:/Files/test.xml"

ImportIDF
Imports an IDF file into a new project. To merge with an existing design, use ImportIDFandMerge.

UI Access placeholder

Name Type Description


<NAME> string Settings
<Board> bool Full path of board file
Parameters <Library> int Full path of library file
<Control> int Full path of control file
<Filters> list ["Cap","Height","HeightExclude2D","Ind","Power","Res"]
<CreateFilteredAsNonModel> bool True or False

Desktop Object Script Commands 3-91


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<NAME> string definitionOverridesMap


<NAME> string instanceOverridesMap
<HighSurfThickness> string High side surface thickness and unit
<LowSurfThickness> string Low side surface thickness and unit
<InternalLayerThickness> string Internal layer thickness and unit
<NumInternalLayer> int Number of internal layers
<HighSurfaceCopper> int High side surface coverage percentage
<LowSurfaceCopper> int Low side surface coverage percentage
<InternalLayerCopper> int Internal layer coverage percentage
<TraceMaterial> string Trace material name
<SubstrateMaterial> int Substrate material name
<CreateBoard> bool True or False
<ModelBoardAsRect> bool True or False
<ModelDeviceAsRect> bool True or False
<Cutoff> bool True or False
<IncludeDrilledHoles> bool True or False
<ReplaceDevices> bool True or False

Return Value None.

ImportIDF_1 (<NAME>, <Board>, <Library>, <Control>, <Filters>, <CreateFilteredAsNonModel>, <NAME>,


<NAME>, <HighSurfThickness>, <LowSurfThickness>, <InternalLayerThickness>, <NumInternalLayer>,
Python Syntax <HighSurfaceCopper>, <LowSurfaceCopper>, <InternalLayerCopper>, <TraceMaterial>, <SubstrateMaterial>,
<CreateBoard>, <ModelBoardAsRect>, <ModelDeviceAsRect>, <Cutoff>, <IncludeDrilledHoles>,
<ReplaceDevices>)

Desktop Object Script Commands 3-92


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDesign.ImportIDF(
[
"NAME:Settings",
"Board:=" , "C:\\Users\\Model Files\\brd_board.emn",
"Library:=" , "C:\\Users\\Model Files\\brd_board.emp",
"Control:=" , "C:\\Users\\Model Files\\brd_board.xml",
"Filters:=" , ["HeightExclude2D"],
"CreateFilteredAsNonModel:=", False,
[
"NAME:definitionOverridesMap"
],
[
"NAME:instanceOverridesMap"
],
"HighSurfThickness:=" , "0.07mm",
Python Example
"LowSurfThickness:=" , "0.07mm",
"InternalLayerThickness:=", "0.07mm",
"NumInternalLayer:=" , 2,
"HighSurfaceCopper:=" , 30,
"LowSurfaceCopper:=" , 30,
"InternalLayerCopper:=" , 30,
"TraceMaterial:=" , "Cu-Pure",
"SubstrateMaterial:=" , "FR-4",
"CreateBoard:=" , True,
"ModelBoardAsRect:=" , True,
"ModelDeviceAsRect:=" , False,
"Cutoff:=" , False,
"IncludeDrilledHoles:=" , True,
"ReplaceDevices:=" , False
])

Desktop Object Script Commands 3-93


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syn- ImportIDF <idfFileName>, <outputPathName>, <controlFileName>, <libFileName>


tax

oDesign.ImportIDF Array("NAME:Settings", "Board:=", _"C:\Users\Model Files" "\brd_


board.emn",
"Library:=", _"C:\Users\Model Files" "\brd_board.emp", "Control:=", _"C:\Users\Model
Files"
"\brd_board.xml", "Filters:=", Array("HeightExclude2D"), "CreateFilteredAsNonModel:=",
_false,
Array("NAME:definitionOverridesMap"), Array("NAME:instanceOverridesMap"),
VB "HighSurfThickness:=",
Example
_"0.07mm", "LowSurfThickness:=", "0.07mm", "InternalLayerThickness:=", "0.07mm",
"NumInternalLayer:=", _2, "HighSurfaceCopper:=", 30, "LowSurfaceCopper:=", 30,
"InternalLayerCopper:=", _30, "TraceMaterial:=", "Cu-Pure", "SubstrateMaterial:=",
"FR-4",
"CreateBoard:=", _true, "ModelBoardAsRect:=", true, "ModelDeviceAsRect:=", false,
"Cutoff:=",
_false, "IncludeDrilledHoles:=", true, "ReplaceDevices:=", false)

ImportIDFandMerge
Imports an IDF file into a new project. To import without merging, use ImportIDF.

UI Access File > Import > IDF. Enable Merge with existing and select a project/design.

Parameters Name Type Description

Desktop Object Script Commands 3-94


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<idfFileName> String Full path of GERBER file.


<libFileName> String Optional. Full path of library file. Pass empty string if none.
<controlFileName> String Optional. Full path of XML control file. Pass empty string if none.
<project> String Name of project to merge with.
<design> String Name of design to merge with.

Return Value None.

Python Syntax ImportIDFandMerge(<idfFileName>, <libPathName>, <controlFileName>, <project>, <design>)


oDesktop.RestoreWindow()
Set oTool = oDesktop.GetTool('ImportExport')
Python Example
oTool.ImportIDFandMerge('C:/Files/test.brd', 'C:/Files/test.aedb.lib',
'C:/Files/test.xml', 'Project1', 'Design12')

VB Syntax ImportIDFandMerge<idfFileName>, <libPathName>, <controlFileName>, <project>, <design>


Set oTool = oDesktop.GetTool("ImportExport")
VB Example oTool.ImportIDFandMerge "C:/Files/test.brd", "C:/Files/test.lib", _
"C:/Files/test.xml", "Project1", "Design12"

ImportIDX
Imports and IDX model into a new Icepak project.

UI Access Icepak > Import IDX

Desktop Object Script Commands 3-95


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<NAME> string Settings
<Board> bool Full path of .idx file
<Library> string NA
<Control> string NA
<Filters> list HeightExclude2D
<CreateFilteredAsNonModel> bool True or False
<NAME> string definitionOverridesMap
<NAME> string instanceOverridesMap
<HighSurfThickness> string High surface layer thickness value and unit
<LowSurfThickness> string Low surface layer thickness value and unit
Parameters <InternalLayerThickness> string Internal surface layer thickness value and unit
<NumInternalLayer> int Number of internal layers value
<HighSurfaceCopper> int High surface percent coverage value
<LowSurfaceCopper> int Low surface percent coverage value
<InternalLayerCopper> int Internal layer percent coverage value
<TraceMaterial> string Trace material name
<SubstrateMaterial> int Substrate material name
<CreateBoard> bool True or False
<ModelBoardAsRect> bool True or False
<ModelDeviceAsRect> bool True or False
<Cutoff> bool True or False
<ReplaceDevices> bool True or False

Return Value None

ImportIDX (<NAME>, <Board>, <Library>, <Control>, <Filters>, <CreateFilteredAsNonModel>, <NAME>,


Python Syntax
<NAME>, <HighSurfThickness>, <LowSurfThickness>, <InternalLayerThickness>, <NumInternalLayer>,

Desktop Object Script Commands 3-96


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<HighSurfaceCopper>, <LowSurfaceCopper>, <InternalLayerCopper>, <TraceMaterial>, <SubstrateMaterial>,


<CreateBoard>, <ModelBoardAsRect>, <ModelDeviceAsRect>, <Cutoff>, <ReplaceDevices>)
oDesign.ImportIDX(
[
"NAME:Settings",
"Board:=" , "C:\\Users\\Model files\\PCB-00278_A.idx",
"Library:=" , "",
"Control:=" , "",
"Filters:=" , ["HeightExclude2D"],
"CreateFilteredAsNonModel:=", False,
[
"NAME:definitionOverridesMap"
],
[
"NAME:instanceOverridesMap"
],
Python Example "HighSurfThickness:=" , "0.07mm",
"LowSurfThickness:=" , "0.07mm",
"InternalLayerThickness:=", "0.07mm",
"NumInternalLayer:=" , 2,
"HighSurfaceCopper:=" , 30,
"LowSurfaceCopper:=" , 30,
"InternalLayerCopper:=" , 30,
"TraceMaterial:=" , "Cu-Pure",
"SubstrateMaterial:=" , "FR-4",
"CreateBoard:=" , True,
"ModelBoardAsRect:=" , False,
"ModelDeviceAsRect:=" , False,
"Cutoff:=" , False,
"ReplaceDevices:=" , False
])

Desktop Object Script Commands 3-97


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ImportIDX (<NAME>, <Board>, <Library>, <Control>, <Filters>, <CreateFilteredAsNonModel>, <NAME>, <NAME>,


VB Syn- <HighSurfThickness>, <LowSurfThickness>, <InternalLayerThickness>, <NumInternalLayer>, <HighSurfaceCopper>,
tax <LowSurfaceCopper>, <InternalLayerCopper>, <TraceMaterial>, <SubstrateMaterial>, <CreateBoard>,
<ModelBoardAsRect>, <ModelDeviceAsRect>, <Cutoff>, <ReplaceDevices>)
oDesign.ImportIDX Array("NAME:Settings", "Board:=", _"C:\Users\Model files" _
"\PCB-00278_A.idx", "Library:=", "", "Control:=", "", "Filters:=",
Array( _"HeightExclude2D"), "CreateFilteredAsNonModel:=", false,
Array("NAME:definitionOverridesMap"), Array("NAME:instanceOverridesMap"),
"HighSurfThickness:=", _0.07mm", "LowSurfThickness:=", "0.07mm",
VB
Example "InternalLayerThickness:=", "0.07mm", "NumInternalLayer:=", _2, "HighSur-
faceCopper:=",
30, "LowSurfaceCopper:=", 30, "InternalLayerCopper:=", _30, "TraceMaterial:=",
"Cu-Pure", "SubstrateMaterial:=", "FR-4", "CreateBoard:=", _true,
"ModelBoardAsRect:=",
false, "ModelDeviceAsRect:=", false, "Cutoff:=", _false, "ReplaceDevices:=", false)

ImportIPC
Imports an IPC2581 file into a new project.

UI Access File > Import > IPC2581.

Name Type Description


<ipcFileName> String Full path of IPC2581 file.
Parameters
<outputPathName> String Full path of EDB file to create during import.
<controlFileName> String Optional. Full path of XML control file. Pass empty string if none.

Desktop Object Script Commands 3-98


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax ImportIPC(<ipcFileName>, <outputPathName>, <controlFileName>)


oDesktop.RestoreWindow()
Set oTool = oDesktop.GetTool('ImportExport')
Python Example
oTool.ImportIPC('C:/Files/test.cvg', 'C:/Files/test.aedb',
'C:/Files/test.xml', 'C:/Files/test.txt')

VB Syntax ImportIPC <ipcFileName>, <outputPathName>, <controlFileName>


Set oTool = oDesktop.GetTool("ImportExport")
VB Example oTool.ImportIPC "C:/Files/test.cvg", "C:/Files/test.aedb", _
"C:/Files/test.xml

ImportODB
Imports an ODB++ file into a new project.

UI Access File > Import > ODB++.

Name Type Description


<odbFileName> String Full path of ODB++ file.
Parameters
<outputPathName> String Full path of EDB file to create during import.
<controlFileName> String Optional. Full path of XML control file. Pass empty string if none.

Return Value None.

Desktop Object Script Commands 3-99


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ImportODB(<odbFileName>, <outputPathName>, <controlFileName>)


oDesktop.RestoreWindow()
Set oTool = oDesktop.GetTool('ImportExport')
Python Example
oTool.ImportODB('C:/Files/test.odb', 'C:/Files/test.aedb',
'C:/Files/test.xml')

VB Syntax ImportODB <odbFileName>, <outputPathName>, <controlFileName>


Set oTool = oDesktop.GetTool("ImportExport")
VB Example oTool.ImportODB "C:/Files/test.odb", "C:/Files/test.aedb", _
"C:/Files/test.xml

ImportXFL
Imports an XFL file into a new project.

UI Access File > Import > XFL.

Name Type Description


<xflFileName> String Full path of XFL file.
Parameters
<outputPathName> String Full path of EDB file to create during import.
<controlFileName> String Optional. Full path of XML control file. Pass empty string if none.

Desktop Object Script Commands 3-100


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax ImportXFL(<xflFileName>, <outputPathName>, <controlFileName>)


oDesktop.RestoreWindow()
Set oTool = oDesktop.GetTool('ImportExport')
Python Example
oTool.ImportXFL('C:/Files/test.xfl', 'C:/Files/test.aedb',
'C:/Files/test.xml')

VB Syntax ImportXFL <xflFileName>, <outputPathName>, <controlFileName>


Set oTool = oDesktop.GetTool("ImportExport")
VB Example oTool.ImportXFL "C:/Files/test.xfl", "C:/Files/test.aedb", _
"C:/Files/test.xml

Desktop Object Script Commands 3-101


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

3-102
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

4 - Running Instances Manager Script Commands


The Running Instances Manager is a scripting object that lets you identify and connect to all running instances of Electronics Desktop.
oDesktop objects that are returned provide full scripting functionality. Running Instances Manager commands should be executed by
the oDesktop object. For example:
Set oRunningInstances = oDesktop.GetRunningInstancesMgr()
GetAllRunningInstances
GetRunningInstanceByProcessID
GetRunningInstanceByProject

GetAllRunningInstances
Returns a list of running instances of Ansys Electronics Desktop.

UI Access N/A
Parameters None.
Return Value Array containing list of Ansys Electronics Desktop instances.

Python Syntax GetAllRunningInstances()


Python Example obj = oRunningInstances.GetAllRunningInstances()

VB Syntax GetAllRunningInstances
VB Example set obj = oRunningInstances.GetAllRunningInstances()

Running Instances Manager Script Commands 4-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetRunningInstanceByProcessID
Returns the instance of Ansys Electronics Desktop that is running a specified process.

UI Access N/A

Name Type Description


Parameters
<processID> Integer Process ID

Return Value String of the returned instance.

Python Syntax GetRunningInstanceByProcessID(<processID>)


Python Example obj = oRunningInstances.GetRunningInstanceByProcessID(12345)

VB Syntax GetRunningInstanceByProcessID <processID>


VB Example set obj = oRunningInstances.GetRunningInstanceByProcessID(12345)

GetRunningInstancesMgr
Returns the object of the Running Instances Manager.

UI Access N/A

Name Type Description


Parameters
None

Running Instances Manager Script Commands 4-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Object
Return Value
Running instances manager object

Python Syntax GetRunningInstancesMgr()


Python Example oRunningInstances = oDesktop.GetRunningInstancecMgr()

VB Syntax GetRunningInstancesMgr()
VB Example Set oRunningInstances = oDesktop.GetRunningInstancesMgr()

Running Instances Manager Script Commands 4-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

4-4
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

5 - Project Object Script Commands


Project commands should be executed by the oProject object. One example of accessing this object is:
Set oProject = oDesktop.GetActiveProject()
AddMaterial
AnalyzeAll
ClearMessages
Close
CopyDesign
CutDesign
DeleteDesign
DeleteToolObject
GetActiveDesign
GetChildNames [Project]
GetChildObject [Project]
GetChildTypes [Project]
GetConfigurableData
GetDefinitionManager
GetDependentFiles
GetDesign
GetDesigns

Project Object Script Commands 5-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetEDBHandle
GetLegacyName
GetName [Project]
GetObjPath [Project]
GetPath
GetPropEvaluatedValue
GetPropNames [Project]
GetPropSIValue
GetPropValue [Project]
GetProperties
GetPropertyValue
GetTopDesignList
InsertDesign
InsertDesignWithWorkflow
InsertToolObject
Paste [Project Object]
Redo [Project Level]
Rename
RunToolkit
Save

Project Object Script Commands 5-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SaveAs
SaveAsStandAloneProject
SaveProjectArchive
SetActiveDefinitionEditor
SetActiveDesign
SetPropValue [Project]
SimulateAll
Undo [Project]
UpdateDefinitions

AddDataset
Adds a dataset. This can be executed by the oProject, or oDesign variables.

UI Access Project > Datasets > Add.

Name Type Description


< Array Array("NAME:<DatasetName>",
DatasetDataArray>
Array("NAME:Coordinates", <CoordinateArray>,
Parameters
<CoordinateArray>, ...)
<DatasetName> String Name of the dataset.
<CoordinateArray> Array Array("NAME:Coordinate", "X:=", <double>, "Y:=",<double>)

Return Value None.

Project Object Script Commands 5-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax AddDataset <DatasetDataArray>


oProject.AddDataset(
[
"NAME:$ds1",
[
"NAME:Coordinates",
[
"NAME:Coordinate",
"X:=", 2,
"Y:=", 4
Python Example ],
[
"NAME:Coordinate",
"X:=", 6,
"Y:=", 8
]
]
]
)
oDesign.AddDataset(

Project Object Script Commands 5-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:$ds1",
[
"NAME:Coordinates",
[
"NAME:Coordinate",
"X:=", 2,
"Y:=", 4
],
[
"NAME:Coordinate",
"X:=", 6,
"Y:=", 8
]
]
]
)

VB Syntax AddDataset <DatasetDataArray>


oProject.AddDatasetArray("NAME:ds1",
VB Example
Array("NAME:Coordinates",

Project Object Script Commands 5-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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)))
oDesign.AddDatasetArray("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)))

AddMaterial
Adds a local material.

UI Access Add Material in the material editor.

Name Type Description

<MaterialParams> Array [
Parameters
"NAME: <name of the material to be added>",
<MatProperty>, <MatProperty>, ...
]

Project Object Script Commands 5-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<MatProperty> Array For simple material:


"<PropertyName>:=", <value>

For anisotropic material:


[
"NAME:<PropertyName>",
"property_type:=", "AnisoProperty",
"unit:=", <Unit>",
"component1:=", <value>,
"component2:=", <value>,
"component3:=", <value>))
]

<PropertyName> String Should be one of the following (depending on the material, design, and solution
types):
Electromagnetic (Maxwell-exclusive material properties omitted, see Max-
well Scripting help):
"permittivity", "permeability", "conductivity", "dielectric_loss_tan-
gent",
"magnetic_loss_tangent", "electric_coercivity", "magnetic_coer-
civity",
"saturation_mag", "lande_g_factor", "delta_H", "delta_h_freq",
"mass_density"

Project Object Script Commands 5-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Thermal (including solids, Icepak fluid flow, and Mechanical rotating fluid
modeling):
"thermal_conductivity", "mass_density", "specific_heat",
"thermal_expansion_coefficient", "thermal_material_type", "vis-
cosity",
"diffusivity", "molecular_mass", "clarity_type"
Structural:
"mass_density", "youngs_modulus", "poissons_ratio",
"thermal_expansion_coefficient"

<Unit> String Possible values (Maxwell-exclusive properties omitted, see Maxwell Scripting
Help; other missing entries are unitless):
conductivity: "siemens/m"
saturation_mag: "uTesla", "mTesla", "tesla", "kTesla", "uGauss",
"mGauss", "gauss", "kGauss"
delta_H: "A_per_meter", "kA_per_meter", "Oe", "kOe"
delta_h_frequency: "Hz", "kHz", "MHz", "GHz", "THz", "rps", "per_sec"
mass_density: "kg/m^3"
thermal_conductivity: "W/m-C"
specific_heat: "J/kg-C"
youngs_modulus: "N/m^2"
thermal_expansion_coefficient: "1/C"

Project Object Script Commands 5-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None

AddMaterial (["NAME:<MaterialName>",
Python Syntax
<MatProperty>, <MatProperty>, ...])

oDefinitionManager.AddMaterial(
["permittivity:=", "2.2", "0.002"])

oDefinitionManager.AddMaterial [("NAME:Material2",_
"dielectric_loss_tangent:=", "44",
Array("NAME:saturation_mag",_
Python Example
"property_type:=", "AnisoProperty",_
"unit:=", "Gauss",_
"component1:=", "11", _
"component2:=", "22", _
"component3:=", "33"), _
"delta_H:=", "44Oe")]

AddMaterial Array("NAME:<MaterialName>",
VB Syntax
<MatProperty>, <MatProperty>, ...)

Project Object Script Commands 5-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDefinitionManager.AddMaterial Array(
"permittivity:=", "2.2", "0.002")

oDefinitionManager.AddMaterial Array("NAME:Material2",_
"dielectric_loss_tangent:=", "44", Array("NAME:saturation_mag",_
VB Example
"property_type:=", "AnisoProperty",_
"unit:=", "Gauss",_
"component1:=", "11", _
"component2:=", "22", _
"component3:=", "33"), _
"delta_H:=", "44Oe")

AnalyzeAll [project]
Runs the project-level script command from the script, which simulates all solution setups and Optimetrics setups for all design
instances in the project. The UI waits until simulation is finished before continuing with the script.

UI Access Project > Analyze All.


Parameters None.
Return Value None.

Project Object Script Commands 5-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax AnalyzeAll()


oProject.AnalyzeAll()
Python Example

VB Syntax AnalyzeAll
VB Example oProject.AnalyzeAll

ChangeProperty (3D Modeler Layout Component Visualisation)


Changes the visualization properties of a a 3D Layout Component object HFSS Modeler window in the history tree.

UI Access Right-click an object in the History Tree and select Properties.

Name Type Description


<propertyArgs> Array Structured array. The properties vary depending on the
object. Due to the number of potential configurations, it is
recommended that you generate this script using the UI's
Automation tab.
Below is an example script to set the visualization attributes of
Parameters
a layout component. The arguments for “DisplayMode” are 0
(for layout mode), 1 (for net mode), and 2 (for object mode).
The three arguments for each object in “ObjectAt-
tributesInLayerMode”, “ObjectAttributesInNetMode”, or
“ObjectAttributesInObjectMode” represents the option in the
“Show”, “Wire Frame”, “and “Transparency” column of the
“Object Attributes” dialog.

Return Value None.

Project Object Script Commands 5-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ChangeProperty(<propertyArgs>)


oProject = oDesktop.SetActiveProject("MyTest")
oDesign = oProject.SetActiveDesign("HFSSDesign1")
oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Visualization",
[
Python Example "NAME:PropServers",
"LC1_1"
],
[
"NAME:ChangedProps",
[
"NAME:Show Layout",
"Value:=" , True
]
]

Project Object Script Commands 5-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

]
])
oEditor.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Visualization",
[
"NAME:PropServers",
"LC1_1"
],
[
"NAME:ChangedProps",
[
"NAME:Object Attributes",
"ShowDielectric:=" , False,
"DisplayMode:=" , 0,
[
"NAME:ObjectAttributesInLayerMode",
"GND_1_L2:=" , [True,True,0],
"GND_2_L4:=" , [True,True,0],

Project Object Script Commands 5-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"GND_3_L6:=" , [True,True,0],
"GND_4_L9:=" , [True,True,0],
"GND_5_L11:=" , [True,True,0],
"Inner_Layer_3_L10:=" , [True,True,0],
"Top_L1:=" , [True,True,0],
"VCC1_L7:=" , [True,True,0],
"VCC2_L8:=" , [True,True,0]
],
[
"NAME:ObjectAttributesInNetMode",
"GND:=" , [True,True,52],
"VCC:=" , [True,True,52],
"neg:=" , [True,True,52],
"pos:=" , [True,True,52]
],
[
"NAME:ObjectAttributesInObjectMode",
"line_1:=" , [True,True,20],
"line_2:=" , [True,True,20],
"line_3:=" , [True,True,20],

Project Object Script Commands 5-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"line_4:=" , [True,True,53],
"rect_6:=" , [True,False,30],
"rect_17:=" , [True,True,53],
"rect_18:=" , [True,True,53],
"rect_19:=" , [True,False,53],
"rect_20:=" , [True,False,53],
"rect_21:=" , [True,False,30],
"rect_22:=" , [True,False,30],
"via_0:=" , [False,False,30],
"via_1:=" , [False,False,30],
"via_2:=" , [False,False,30],
"via_3:=" , [False,False,30]
]
]
]
]
])

ChangeProperty (Symbol Editor)


Use: Changes to properties are scripted using the ChangeProperty command. This command can be executed by the oEditor to
change editor properties, by the oDesign to change design level properties, and by the oProject to change project level properties.

Project Object Script Commands 5-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

The command can be used to create, edit, and/or remove properties. In Circuit, only Variable and Separator properties can be
deleted.
Command: None
Syntax: ChangeProperty Array("Name:AllTabs", <PropTabArray>, <PropTabArray>, ...)
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>

Project Object Script Commands 5-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("Name:ChangedProps",<PropDataArray>,
<PropDataArray>, ...)

<DeletedPropsArray>
Array("Name:DeletedProps", <PropName>,
<PropName>, ...)
OR (for PropDisplay deletions only)
Array("Name:DeletedProps",<PropDataArray>,
<PropDataArray>, ...)

<PropDataArray>
Array("NAME:<PropName>",
"PropType:=", <PropType>,
"NewName:=", <string>,
"Description:=", <string>,
"Callback:=", <string>,
"NewRowPosition:=", <int>,
"ReadOnly:=", <bool>,
"Hidden:=", <bool>,
<PropTypeSpecificArgs>)OR (for PropDisplays only)

Project Object Script Commands 5-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("Name:<PropName>",<PropDisplayData>)

<PropDisplayData>
for adding, changing, deleting PropDisplays
<PropDisplayAttributes>
for changing PropDisplays only
<PropDisplayNewAttributes>

<PropDisplayAttributes>
Layer & Location only used for PropDisplays in layout

For adding PropDisplays, this will add a single PropDisplay with attributes as shown; if an attribute is missing, a default
value will be assigned. Adding PropDisplay to schematic with attributes that are identical to one already existing there will
fail without an error message.
For deleting PropDisplays, these attributes are used to identify an existing PropDisplay to delete. If there doesn't exist a
PropDisplay that matches the given attributes, then nothing will be deleted. If multiple PropDisplays match the given attrib-
utes, then all of them will be deleted. If an attribute is missing, then all PropDisplays match that missing attribute. For
example, if Layer is missing, then PropDisplays on all layers that match the remaining given attributes will be deleted.
For changing PropDisplays, these attributes are used to identify an existing PropDisplay to change. If no PropDisplay match-
ing the attributes is found, no changes will be made. If multiple PropDisplays match the attributes, all of them will be
changed. If an attribute is missing, it matches all PropDisplays. For example, to change the format of PropDisplays that are
on the bottom, but have any layer, style or format to show the name only, this command should have Location set to "Bot-
tom" and all other attributes omitted.
"Format:=", <PropDisplayType>,

Project Object Script Commands 5-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Location:=", <PropDisplayLocation>,
"Layer:=", <string>,
"Style:=", <string>

<PropDisplayNewAttributes>

NewLayer & NewLocation only used for PropDisplays in layout


For changing PropDisplays, these attributes are used to identify which attributes to change and what the new value is. If the
attribute should not be changed, the corresponding entry should be omitted.
"NewName:=", <string>,
"NewFormat:=", <PropDisplayType>,
"NewLocation:=", <PropDisplayLocation>,
"NewLayer:=", <string>,
"NewStyle:=", <string>

<PropDisplayType>
Type: string
Identifies the format of PropDisplay.
"Name"
"Value"
"NameAndValue"
"EvaluatedValue"

Project Object Script Commands 5-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NameAndEvaluatedValue"

<PropDisplayLocation>
Type: string
Identifies where PropDisplay is located with respect to object
"Left"
"Top"
"Right"
"Bottom"
"Custom"

<PropType>
Type: string
Identifies the type of property when a new property is added. In Circuit, only separator properties and variable properties
can be added.
"SeparatorProp"
"VariableProp"
"TextProp"
"NumberProp"
"ValueProp"
"CheckboxProp"

Project Object Script Commands 5-20


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MenuProp"
"PointProp"
"VPointProp"
"ButtonProp"

NewName
Specify the new name of a property if the property’s name is being edited. In Circuit, the name can only be changed for sep-
arators and variables.

Description
Specify a description of the property. In Circuit, the description can only be changed for separators and variables.

Callback
Specify the name of the script callback to be run when the property value is changed.

NewRowPosition
Used to reorder rows in the Property dialog box. In Circuit, this only applies to the Project>Project Variables panel and
the Designer>DesignProperties panel. Specify the new zero-based row index of the variable or separator.

ReadOnly
Used to mark a property as "read only" so it can not be modified. In Circuit, this flag can only be set for variables and sep-
arators.

Project Object Script Commands 5-21


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Hidden
Used to hide a property so it can not be viewed outside of the Property dialog box. In Circuit, this flag can only be set for vari-
ables 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>
Material Button: "Material:=", <string>
Color Button: "R:=",<int>,"G:=",<int>,"B:=",<int>
Transparency Button: "Value:=", <double>

<PropTypeSpecificArgs> for MenuProps


Syntax for NewProps array: "AllChoices:=",
<"choice1,choice2,..."> or <Array("choice1" "choice2", ... )>,
"Value:=", <string>

Project Object Script Commands 5-22


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax for ChangedProps array: "Value:=", <string>

<PropTypeSpecificArgs> for VariableProps


Syntax:
"Value:=", <value>, <OptimizationFlagsArray>,
<TuningFlagsArray>, <SensitivityFlagsArray>,
<StatisticsFlagsArray>

Parameters:
<OptimizationFlagsArray>
Array("NAME:Optimization",
"Included:=", <bool>,
"Min:=", <value>,
"Max:=", <value>)

<TuningFlagsArray>
Array("NAME:Tuning",
"Included:=", <bool>,
"Step:=", <value>,
"Min:=", <value>,
"Max:=", <value>)

Project Object Script Commands 5-23


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<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"

Project Object Script Commands 5-24


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

StdD
Standard deviation.

Min
Low cut-off for the distribution.

Max
High cut-off for the distribution.

Tol
Tolerance for uniform distributions. Format is "<int>%".
Example: "20%".

VB 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",_

Project Object Script Commands 5-25


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Value:=", "3mm",_
"Description:=", "my new variable"))))

VB Example: Deleting the design level variable "height":


oDesign.ChangeProperty Array("NAME:AllTabs",_
Array("NAME:LocalVariableTab",_
Array("NAME:PropServers", "DefinitionParameters"),_
Array("NAME:DeletedProps", "height"))

Changing a property’s value. If the following command were executed, then the value of the prop-
erty "XSize" of the PropServer
"Box1:CreateBox:1" on the "Geometry3DCmdTab" tab would be changed. (oEditor is the Geometry3D
editor in Circuit.)
oEditor.ChangeProperty Array("NAME:AllTabs",_
Array("NAME:Geometry3DCmdTab",_
Array("NAME:PropServers","Box1:CreateBox:1"),_
Array("NAME:ChangedProps",_
Array("NAME:XSize", "Value:=", "1.4mil"))))

VB Example: Changing a property’s value. If the following command were executed, then the values
of Callback and L on the PassedParameterTab would be changed.

Project Object Script Commands 5-26


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.ChangeProperty Array("NAME:AllTabs", _
Array("NAME:PassedParameterTab", _
Array("NAME:PropServers", "CHOKE2"), _
Array("NAME:ChangedProps", _
Array("NAME:L", "Callback:=", "ac", "OverridingDef:=", true), _
Array("NAME:L", "Value:=", "1nH"))))

VB Example: Changing the Company Name, Design Name, the background color, and the Axis scaling
in a Report.

Set oProject = oDesktop.SetActiveProject("wgcombiner")


Set oDesign = oProject.SetActiveDesign("CircuitDesign2")
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"))))
oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:Header",_ Array("NAME:PropServers", "XY
Plot1:Header"), _
Array("NAME:ChangedProps", Array("NAME:Design Name", _
"Value:=", "WG Combiner"))))

Project Object Script Commands 5-27


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:General",_ Array("NAME:PropServers", "XY


Plot1:General"), _
Array("NAME:ChangedProps", Array("NAME:Back Color", _
"R:=", 128, "G:=", 255, "B:=", 255))))
oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:Axis", _ Array("NAME:PropServers", "XY
Plot1:AxisX"), _
Array("NAME:ChangedProps", Array("NAME:Axis Scaling", _
"Value:=", "Log"))))

VB Example: Changing a property’s value. Note that the AllChoices parameter is only used when the
MenuProp is being added. Also note that either a string of choices separated by commas or an
Array("choice1", "choice2", "choice3") works for the AllChoices parameter.

Set oEditor = oDesign.SetActiveEditor("SchematicEditor")


oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:PassedParameterTab", Array
("NAME:PropServers", _
"CompInst@CAP_;2"), Array("NAME:NewProps", Array("NAME:xxxx", "PropType:=", _
"MenuProp", "AllChoices:=", Array("aa", "bb", "cc", "dd"), "Value:=", "bb"))))

ClearMessages
Clears information in the Messages window.

Project Object Script Commands 5-28


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A
Parameters None.
Return Value None.

Python Syntax ClearMessages()


Python Example oProject.ClearMessages()

VB Syntax ClearMessages
VB Example oProject.ClearMessages

CloneMaterial
Clones a local material.

UI Access N/A

Name Type Description


Parameters <matName> String Name of existing material.
<newName> String Name for newly cloned material.

Boolean:
Return Value l 1 - Material is cloned.
l 0 - Existing material not found or a conflict with the new material name.

Project Object Script Commands 5-29


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax CloneMaterial (<matName>, <newName>)


Python Example oDefinitionManager.CloneMaterial("copper1", "copper3")

VB Syntax CloneMaterial <matName>, <newName>


VB Example oDefinitionManager.CloneMaterial "copper1", "copper3"

Close
Closes the active project.

Warning:

Unsaved changes will be lost.

UI Access N/A
Parameters None.
Return Value None.

Python Syntax Close()


Python Example oProject.Close()

Project Object Script Commands 5-30


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax Close
VB Example oProject.Close

CopyDesign
Copies a specified design.

UI Access Edit > Copy.

Name Type Description


Parameters
<DesignName> String Name of the design to copy from.

Return Value None.

Python Syntax CopyDesign (<DesignName>)


oProject.CopyDesign ("HFSSDesign1")
Python Example

VB Syntax CopyDesign <DesignName>


VB Example oProject.CopyDesign "HFSSDesign1"

CutDesign
Cuts a design from the active project. The design is stored in memory and can be pasted.

Project Object Script Commands 5-31


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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.

UI Access Edit > Cut.

Name Type Description


Parameters
<DesignName> String Name of the design.

Return Value None.

Python Syntax CutDesign (<DesignName>)


oProject.CutDesign("SimplorerDesign1")
Python Example

VB Syntax CutDesign <DesignName>


VB Example oProject.CutDesign "SimplorerDesign1"

DeleteDataset
Deletes a specified dataset. This can be executed by the oProject, or oDesign variables.

UI Access Project > Datasets > Remove.

Project Object Script Commands 5-32


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


Parameters
<DatasetName> String Name of the dataset found in the project.

Return Value None.

Python Syntax DeleteDataset (<DatasetName>)


oProject.DeleteDataset('$ds1')
Python Example
oDesign.DeleteDataset('$ds1')

VB Syntax DeleteDataset <DatasetName>


oProject.DeleteDataset "$ds1"
VB Example
oDesign.DeleteDataset "$ds1"

DeleteDesign
Deletes a specified design in the project.

UI Access Edit > Delete, or Delete in the ribbon.

Name Type Description


Parameters
<DesignName> String Name of the design.

Return Value None.

Project Object Script Commands 5-33


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax DeleteDesign (<DesignName>)


oProject.DeleteDesign("HFSSDesign2")
Python Example

VB Syntax DeleteDesign <DesignName>


VB Example oProject.DeleteDesign "HFSSDesign2"

DeleteToolObject

Note:
This command is for internal Ansys use only.

UI Access N/A

Name Type Description


Parameters
<ObjectName> String Name of the tool object.

Return Value None.

Python Syntax DeleteToolObject(<ObjectName>)


Python Example oProject.DeleteToolObject("object1")

Project Object Script Commands 5-34


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax DeleteToolObject <ObjectName>


VB Example oProject.DeleteToolObject "object1"

EditDataset
Modifies a dataset. This can be executed by the oProject, or oDesign variables.

UI Access Project > Datasets > Edit.

Name Type Description


Parameters <OriginalName> String Name of the original dataset.
<DatasetDataArray> Array Data for the modified dataset.

Return Value None.

Python Syntax EditDataset (<OriginalName> <DatasetDataArray>)


oProject.EditDataset ("ds1"
["NAME:ds2",
["NAME:Coordinates",
[
Python Example "NAME:Coordinate",
"X:=", 1, "Y:=", 2
],
[
"NAME:Coordinate",

Project Object Script Commands 5-35


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"X:=", 3, "Y:=", 4
]
]
]
)
oDesign.EditDataset ("ds1"
["NAME:ds2",
["NAME:Coordinates",
[
"NAME:Coordinate",
"X:=", 1, "Y:=", 2
],
[
"NAME:Coordinate",
"X:=", 3, "Y:=", 4
]
]
]
)

Project Object Script Commands 5-36


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax EditDataset <OriginalName> <DatasetDataArray>


oProject.EditDataset "ds1" Array("NAME:ds2",_
Array("NAME:Coordinates",Array("NAME:Coordinate",
"X:=", 1, "Y:=", 2), Array("NAME:Coordinate",
"X:=", 3, "Y:=", 4)))
VB Example
oDesign.EditDataset "ds1" Array("NAME:ds2",_
Array("NAME:Coordinates",Array("NAME:Coordinate",
"X:=", 1, "Y:=", 2), Array("NAME:Coordinate",
"X:=", 3, "Y:=", 4)))

EditMaterial
Modifies an existing material.

UI Access View/Edit Materials command in the material editor

Name Type Description


<OriginalName> String Name of the material before editing.
<MatProperties> Array Structured array containing material properties:
[
"NAME:<New material name>",
Parameters
"CoordinateSystemType:=", <string>,
"BulkOrSurfaceType:=" , <integer>,
[
"NAME:PhysicsTypes",

Project Object Script Commands 5-37


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"set:=" , <array containing string physics


types>
],
<Optional ModifierDataArray>,
"permeability:=" , <string containing value>,
"conductivity:=" , <string containing value>,
"thermal_conductivity:=", <string containing value>,
"mass_density:=" , <string containing value>,
"specific_heat:=" , <string containing value>,
"youngs_modulus:=" , <string containing value>,
"poissons_ratio:=" , <string containing value>,
"thermal_expansion_coefficient:=", <string con-
taining value>
]
<Modi- Array Optional structured array containing thermal or spatial modifiers:
fierDataArray>
[
"NAME:ModifierData",
[
"NAME:<ThermalModifierData or SpatialModifierData>",
"modifier_data:=" , <"thermal_modifier_data" or "spa-
tial_modifier_data">,

Project Object Script Commands 5-38


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:<all_thermal_modifiers or all_spatial_mod-
ifiers>",
[
"NAME:<modifierName>",
"Property::=" , <string property being mod-
ified>,
"Index::=" , <integer>,
"prop_modifier:=" , <"thermal_modifier" or
"spatial_modifier">,
"use_free_form:=" , <Boolean>,
"free_form_value:=" , <string modifier
value>,
]
]
]
]

Return Value None.

Python EditMaterial (<OriginalName>, <MatProperties>)


Syntax

Python Without Modifiers:


Example

Project Object Script Commands 5-39


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDefinitionManager.EditMaterial("alumina_92pct",
[
"NAME:alumina_92pct",
"CoordinateSystemType:=" , "Cartesian",
"BulkOrSurfaceType:=" , 1,
[
"NAME:PhysicsTypes",
"set:=" , ["Electromagnetic","Thermal","Structural"]
],
"permittivity:=" , "9.3",
"dielectric_loss_tangent:=" , "0.008",
"thermal_conductivity:=" , "26",
"mass_density:=" , "3720",
"specific_heat:=" , "790",
"youngs_modulus:=" , "267000000000",
"poissons_ratio:=" , "0.26",
"thermal_expansion_coeffcient:=", "7.2e-006"
]
)
With Thermal Modifier:

Project Object Script Commands 5-40


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDefinitionManager.EditMaterial("copper",
[
"NAME:copper",
"CoordinateSystemType:=", "Cartesian",
"BulkOrSurfaceType:=" , 1,
[
"NAME:PhysicsTypes",
"set:=" , ["Electromagnetic","Thermal","Structural"]
],
[
"NAME:ModifierData",
[
"NAME:ThermalModifierData",
"modifier_data:=" , "thermal_modifier_data",
[
"NAME:all_thermal_modifiers",
[
"NAME:one_thermal_modifier",
"Property::=" , "permittivity",
"Index::=" , 0,
"prop_modifier:=" , "thermal_modifier",

Project Object Script Commands 5-41


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"use_free_form:=" , True,
"free_form_value:=" , "if(Temp > 1000cel, 1, if(Temp < -273.15cel,
1, 1))"
]
]
]
],
"permeability:=" , "0.999991",
"conductivity:=" , "58000000",
"thermal_conductivity:=" , "400",
"mass_density:=" , "8933",
"specific_heat:=" , "385",
"youngs_modulus:=" , "120000000000",
"poissons_ratio:=" , "0.38",
"thermal_expansion_coefficient:=" , "1.77e-05"
])
Transient Solve, Non-linear Drude Data Plasma
# ----------------------------------------------
# Script Recorded by Ansys Electronics Desktop Version 2023.1.0
# 14:23:56 Jun 17, 2022

Project Object Script Commands 5-42


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

# ----------------------------------------------
import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oProject = oDesktop.SetActiveProject("Drude_plasma_parameters_r231")
oDefinitionManager = oProject.GetDefinitionManager()
oDefinitionManager.EditMaterial("Drude",
[
"NAME:Drude",
"CoordinateSystemType:=", "Cartesian",
"BulkOrSurfaceType:=" , 1,
[
"NAME:PhysicsTypes",
"set:=" , ["Electromagnetic"]
],
[
"NAME:AttachedData",
[
"NAME:MatNonLinearDrudeFreqDepData",
"property_data:=" , "nonlinear_drude_data",
"EpsilonInfinity:=" , "1",

Project Object Script Commands 5-43


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PlasmaFrequency:=" , "4.62348462366278GHz",
"CollisionFrequency:=" , "0.00054491190162662GHz",
"FieldBreakdown:=" , "10000V_per_meter",
"PlasmaMaintainFrequency:=", "2.31174231183139GHz",
"NeutralDensity:=" , 2.65164580488373E+20,
"ElectronDensity:=" , 2.65164580488373E+17,
"CollisionRateConstant:=", 2.05499505485618E-15
]
]
])

VB Syn- EditMaterial <OriginalName>, <MatProperties>


tax

Without Modifiers:
oDefinitionManager.EditMaterial "alumina_92pct",
Array(
VB
"NAME:alumina_92pct",
Example
"CoordinateSystemType:=", "Cartesian",
"BulkOrSurfaceType:=", 1,
Array("NAME:PhysicsTypes",

Project Object Script Commands 5-44


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"set:=", Array("Electromagnetic","Thermal","Structural")),
"permittivity:=", "9.3",
"dielectric_loss_tangent:=", "0.008",
"thermal_conductivity:=", "26",
"mass_density:=", "3720",
"specific_heat:=", "790",
"youngs_modulus:=", "267000000000",
"poissons_ratio:=", "0.26",
"thermal_expansion_coeffcient:=", "7.2e-006"
)
With Thermal Modifier:
oDefinitionManager.EditMaterial "copper",
Array("NAME:copper",
"CoordinateSystemType:=", "Cartesian",
"BulkOrSurfaceType:=" , 1,
Array("NAME:PhysicsTypes",
"set:=" , Array("Electromagnetic","Thermal","Structural")),
Array("NAME:ModifierData",
Array("NAME:ThermalModifierData",
"modifier_data:=" , "thermal_modifier_data",
Array("NAME:all_thermal_modifiers",

Project Object Script Commands 5-45


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:one_thermal_modifier",
"Property::=" , "permittivity",
"Index::=" , 0,
"prop_modifier:=" , "thermal_modifier",
"use_free_form:=" , True,
"free_form_value:=" , "if(Temp > 1000cel, 1, if(Temp < -273.15cel,
1, 1))"
)
)
)
),
"permeability:=" , "0.999991",
"conductivity:=" , "58000000",
"thermal_conductivity:=" , "400",
"mass_density:=" , "8933",
"specific_heat:=" , "385",
"youngs_modulus:=" , "120000000000",
"poissons_ratio:=" , "0.38",
"thermal_expansion_coefficient:=" , "1.77e-05"
)

Project Object Script Commands 5-46


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ExportDataset
Exports a dataset to a named file. This can be executed by the oProject, or oDesign variables.

UI Access Project > Datasets > Export.

Name Type Description


Parameters
<datasetFileFullPath> String The full path to the file.

Return Value None.

Python Syntax ExportDataset (<datasetFileFullPath>)


oProject.ExportDataset('e:/tmp/dsdata.txt')
Python Example
oDesign.ExportDataset('e:/tmp/dsdata.txt')

VB Syntax ExportDataset <datasetFileFullPath>


oProject.ExportDataset "e:/tmp/dsdata.txt"
VB Example
oDesign.ExportDataset "e:/tmp/dsdata.txt"

ExportMaterial
Exports a local material to a library.

UI Access Export to Library command in the material editor.

Name Type Description


Parameters
<ExportData> Array ["NAME:<LibraryName>",

Project Object Script Commands 5-47


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<MaterialName>, <MaterialName>, ...]


<LibraryName> String Name of the exported library.
<MaterialName> String Name of the material to be exported.
<LibraryLocation> String Location to save the library. Only "PersonalLib" and "UserLib" are
allowed.

Return Value None.

Python Syntax ExportMaterial (<ExportData>, <LibraryLocation>)


oDefinitionManager.ExportMaterial (["NAME:mylib",_
Python Example
"Material1", "Material2", "Material3"], "PersonalLib")

VB Syntax ExportMaterial <ExportData>, <LibraryLocation>


oDefinitionManager.ExportMaterial Array("NAME:mylib",_
VB Example
"Material1", "Material2", "Material3"), "PersonalLib"

GetActiveDesign
Returns the design in the active project

Note: GetActiveDesign will return normally if there are no active objects.

UI Access N/A

Project Object Script Commands 5-48


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters None.
Return Value Object of the active design.

Python Syntax GetActiveDesign()


oDesign = oProject.GetActiveDesign()
Python Example

VB Syntax GetActiveDesign
VB Example Set oDesign = oProject.GetActiveDesign

GetArrayVariables
Returns a list of array variables. To get a list of indexed project variables, execute with oProject. To get a list of indexed local vari-
ables, use oDesign.

UI Access N/A
Parameters None.
Return Value Array of strings containing names of variables.

Python Syntax GetArrayVariables()


oProject.GetArrayVariables()
Python Example
oDesign.GetArrayVariables()

VB Syntax GetArrayVariables

Project Object Script Commands 5-49


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oProject.GetArrayVariables
VB Example
oDesign.GetArrayVariables

GetChildNames [Project]
Returns the names of the project's child objects.

UI Access N/A

Name Type Description


Parameters <type> String (Optional) Default is "design"; Any value returned by GetChildTypes() can be
used.

Return Value Array of names of children for the queried object.

Python Syntax GetChildNames (<type>)


arrDesignNames = oProject.GetChildNames()
Python Example
arrVarbleNames = oProject.GetChildNames("Variable")

VB Syntax GetChildNames (<type>)


arrDesignNames = oProject.GetChildNames()
VB Example
arrVarbleNames = oProject.GetChildNames ("Variable")

Project Object Script Commands 5-50


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetChildObject [Project]
Returns the project's child objects.

Note:

GetChildObject will return normally if there are no active objects.

UI Access N/A

Name Type Description


Parameters <path> String The path may include multiple generations (for example, "designOb-
ject/moduleObj/SetupObject"). See Object Path.

Return Value Object of a found child.

Python Syntax GetChildObject(<path>)


oProject = oDeskop.GetActiveProject()
oDesign = oProject.GetChildObject(“TeeModel”)
Python Example
oVariable = oProject.GetChildObject("VariableName")
oReport = oProject.GetChildObject("TeeModel/Results/S Parameter Plot 1")

VB Syntax GetChildObject(<path>)
Set oProject = oDesktop.GetActiveproject()
VB Example
Set oDesign = oProject.GetChildObject(“TeeModel”)

Project Object Script Commands 5-51


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Set oVariable = oProject.GetChildObject("VariableName")


Set oReport = oProject.GetChildObject("TeeModel/Results/S Parameter Plot 1")

GetChildTypes [Project]
Returns the types of the project's child objects.

UI Access N/A
Parameters None.
Return Value Array of string represents types of the child objects.

Python Syntax GetChildTypes()


Python Example oProject.GetChildTypes()

VB Syntax GetChildTypes
VB Example oProject.GetChildTypes

GetConfigurableData (Project)

Note:
This command is for internal Ansys use only.

Project Object Script Commands 5-52


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetConfigurableData()


Python Example oProject.GetConfigurableData()

GetDefinitionManager
Gets the DefinitionManager object.

UI Access N/A
Parameters None.
Return Value DefinitionManager object.

Python Syntax GetDefinitionManager()


Python Example oDefinitionManager = oProject.GetDefinitionManager()

VB Syntax GetDefinitionManager
VB Example Set oDefinitionManager = oProject.GetDefinitionManager

GetDependentFiles
Provides a list of the external files referenced in the project, including characteristic (for example, MDX) and coupled project files.

UI Access N/A

Project Object Script Commands 5-53


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters None.
Return Value List of referenced files.

Python Syntax GetDependentFiles()


files = oProject.GetDependentFiles()
Python Example

VB Syntax GetDependentFiles
VB Example files = oProject.GetDependentFiles

GetDesign
Returns the interface to a specific design in a given project.

UI Access N/A

Name Type Description


Parameters
<designName> String Name of the design.

Return Value Object of the specified design.

Python Syntax GetDesign (<designName>)


Python Example oProject.GetDesign("HFSSDesign1")

Project Object Script Commands 5-54


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetDesign <designName>


VB Example oProject.GetDesign "HFSSDesign1"

GetDesigns
Obtains all designs in the current project.

UI Access N/A
Parameters None.
Return Value List of objects for all designs in the project.

Python Syntax GetDesigns()


oProject.GetDesigns()
Python Example

VB Syntax GetDesigns
VB Example oProject.GetDesigns

Project Object Script Commands 5-55


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetEDBHandle
Returns the EDB handle for the project.

Important:

This script is for internal Ansys use only.

UI Access N/A
Parameters None.
Return Value String indicating the EDB handle for the project.

Python Syntax GetEDBHandle()


Python Example oProject.GetEDBHandle()

VB Syntax GetEDBHandle
VB Example oProject.GetEDBHandle

GetLegacyName
Obtains the legacy name of a project.

Project Object Script Commands 5-56


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note:
This command is for internal Ansys use only.

UI Access N/A
Parameters None.
Return Value String containing the legacy project name.

Python Syntax GetLegacyName()


Python Example oProject.GetLegacyName()

VB Syntax GetLegacyName
VB Example oProject.GetLegacyName

GetName [Project]
Obtains the project name

UI Access N/A
Parameters None.
Return Value String containing the project name, not including the path or extension.

Project Object Script Commands 5-57


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetName()


oProject.GetName()
Python Example

VB Syntax GetName
VB Example oProject.GetName

GetObjPath [Project]
Obtains the project name from the full path.

UI Access N/A
Parameters None.
Return Value String containing only the project name.

Python Syntax GetObjPath()


Python Example oProject.GetObjPath()

VB Syntax GetObjPath

Project Object Script Commands 5-58


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oProject.GetObjPath

GetPath
Returns the location of the project on disk.

UI Access N/A
Parameters None.
Return Value String containing the path to the project, not including the project name.

Python Syntax GetPath()


oProject.GetPath()
Python Example

VB Syntax GetPath
VB Example oProject.GetPath

GetPropNames [Project]
Obtains the property name of the object. At the project level, GetPropNames always returns empty because the project is not asso-
ciated with any property.

UI Access N/A

Name Type Description


Parameters
<includeReadOnly> Boolean (Optional)

Project Object Script Commands 5-59


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l True – Include read only props.


l False – Do not include read only props.

Return Value Empty array.

Python Syntax GetPropNames ()


Python Example oProject.GetPropNames()

VB Syntax GetPropNames
VB Example oProject.GetPropNames

GetPropValue [Project]
Returns the property value for the active project object, or specified property values.

UI Access N/A

Name Type Description


Parameters
<propPath> String A child object's property path. See: Property Function Summary.

Return Value String of property value.

Python Syntax GetPropValue(<propPath>)

Project Object Script Commands 5-60


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Example oProject.GetPropValue("TeeModel/offset")

VB Syntax GetPropValue <propPath>


VB Example oProject.GetPropValue "TeeModel/offset"

GetProperties
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.

UI Access N/A

Name Type Description


<PropTab> String One of the following, where tab titles are shown in parentheses:
l PassedParameterTab ("Parameter Values")
l DefinitionParameterTab (Parameter Defaults")
l LocalVariableTab ("Variables" or "Local Variables")
l ProjectVariableTab ("Project variables")

Parameters l ConstantsTab ("Constants")


l BaseElementTab ("Symbol" or "Footprint")
l ComponentTab ("General")
l Component("Component")
l CustomTab ("Intrinsic Variables")
l Quantities ("Quantities")
l Signals ("Signals")

Project Object Script Commands 5-61


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<PropServer> String An object identifier, generally returned from another script method, such as
Comp-Inst@R;2;3

Return Value Array of strings containing the names of the appropriate properties.

Python Syntax GetProperties( <PropTab>, <PropServer> )


Python Example oEditor.GetProperties('PassedParameterTab', 'k')

VB Syntax GetProperties <PropTab>, <PropServer>


VB Example oEditor.GetProperties "PassedParameterTab", "k"

GetPropertyValue
Returns the value of a single property belonging to a specific <PropServer> and <PropTab>. This function is available with the Project,
Design or Editor objects, including definition editors.

Tip:

Use the script recording feature and edit a property, and then view the resulting script to see the format for that property.

UI Access N/A

Name Type Description


Parameters <PropTab> String One of the following, where tab titles are shown in parentheses:
l PassedParameterTab ("Parameter Values")

Project Object Script Commands 5-62


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l DefinitionParameterTab (Parameter Defaults")


l LocalVariableTab ("Variables" or "Local Variables")
l ProjectVariableTab ("Project variables")
l ConstantsTab ("Constants")
l BaseElementTab ("Symbol" or "Footprint")
l ComponentTab ("General")
l Component("Component")
l CustomTab ("Intrinsic Variables")
l Quantities ("Quantities")
Signals ("Signals")
l

<PropServer> String An object identifier, generally returned from another script method, such as
Comp-Inst@R;2;3
<PropName> String Name of the property.

Return Value String value of the property.

Python Syntax GetPropertyValue (<PropTab>, <PropServer>, <PropName>)


selectionArray = oEditor.GetSelections()
for k in selectionArray:
Python Example
val = oEditor.GetPropertyValue("PassedParameterTab", k, "R")
...

Project Object Script Commands 5-63


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetPropertyValue (<PropTab>, <PropServer>, <PropName>)


selectionArray = oEditor.GetSelections
for k in selectionArray:
VB Example
val = oEditor.GetPropertyValue("PassedParameterTab", k, "R")
...

GetTopDesignList
Returns a list of top-level design names.

UI Access N/A
Parameters None.
Return Value List of strings containing name of top-level designs.

Python Syntax GetTopDesignList()


oProject.GetTopDesignList()
Python Example

VB Syntax GetTopDesignList
VB Example oProject.GetTopDesignList

Project Object Script Commands 5-64


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetVariableValue
Gets the value of a single specified variable. To get the value of project variables, execute this command using oProject. To get the
value of local variables, use oDesign.

UI Access N/A

Name Type Description


Parameters
<VarName> String Name of the variable to access.

Return Value String represents the value of the variable.

Python Syntax GetVariableValue( <VarName> )


oProject.GetVariableValue("var_name")
Python Example

VB Syntax GetVariableValue <VarName>


VB Example oProject.GetVariableValue "var_name"

GetVariables
Returns a list of all defined variables. To get a list of project variables, execute this command using oProject. To get a list of local
variables, use oDesign.

UI Access N/A
Parameters None.

Project Object Script Commands 5-65


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value Array of strings containing the variables.

Python Syntax GetVariables ()


oProject.GetVariables()
Python Example
oDesign.GetVariables()

VB Syntax GetVariables
oProject.GetVariables
VB Example
oDesign.GetVariables

ImportDataset
Imports a dataset from a named file. This can be executed by the oProject, or oDesign variables. The name of the dataset is file-
name+index number (e.g., dsdata1) unless the filename ends with a trailing number. When there is a trailing number at the end, we
will remove the number and use first unused index.

UI Access Project > Datasets > Import.

Name Type Description


Parameters
<datasetFileFullPath> String The full path to the file containing the dataset values.

Return Value None.

Tab-delimited or space-delimited files with the extension ".tab" is the recommended file type to be used.
For importing datasets at the Design level, this is the only file type supported.

Project Object Script Commands 5-66


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

At the Project level, other file types (e.g., ".csv") are supported. However, after calling the command, you must configure the file import
format manually through the GUI as shown in the figure below.

Python Syntax ImportDataset (<datasetFileFullPath>)

Project Object Script Commands 5-67


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oProject.ImportDataset('e:\tmp\dsdata.tab')
Python Example
oDesign.ImportDataset('e:\tmp\dsdata.tab')

VB Syntax ImportDataset <datasetFileFullPath>


oProject.ImportDataset "e:\tmp\dsdata.tab"
VB Example
oDesign.ImportDataset "e:\tmp\dsdata.tab"

InsertDesign
Inserts a new design in the project. For HFSS scripts, the last argument will always be empty.

UI Access Project > Insert HFSS Design.

Name Type Description


<DesignType> String Design type. Use "HFSS".
Parameters <DesignName> String Design name.
<SolutionType> String Solution type. Valid types: "DrivenModal", "DrivenTerminal", or "Eigenmode".
"" None Empty argument.

Return Value None.

Python Syntax InsertDesign (<DesignType>, <DesignName>, <SolutionType>,'')


Python Example oProject.InsertDesign('HFSS', 'HFSSDesign3', 'DrivenModal', '')

Project Object Script Commands 5-68


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax InsertDesign <DesignType>, <DesignName>, <SolutionType>, ""


VB Example oProject.InsertDesign "HFSS", "HFSSDesign3", "DrivenModal", ""

InsertDesign [HFSS 3D Layout]


Insert a design
Command: None
Syntax: InsertDesign <type>, <name>, <stationerypath>, <parentname>
Return Value: None
Parameters: <type>
Type: string
<name>
Type: string
<stationerypath>
Type: string
<parentname>
Type: string
VB Example: oDesign.InsertDesign <type>, <name>, <stationerypath>, <parentname>
where, <type> is NULL for top-level design

InsertDesignWithWorkflow
Inserts a design with a named workflow and returns an IDispatch string.

UI Access N/A

Project Object Script Commands 5-69


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<type> String Type of design.
<workflowName> String Name of the workflow.
Parameters <specName> String Name of the spec.
<fileName> String Name of the file.
<libLoc> String Type of library, such as SysLib.
<stationaryPath> String Path.

Return Value IDispatch string, such as 'IDispatch(IAltraSimScript)'

Python Syntax InsertDesignWithWorkflow(<type>, <workflowName>, <specName>, <fileName>, <libLoc>, <stationaryPath>)


oProject.InsertDesignWithWorkflow ("Circuit Design", "Serial Design",

Python "PCIe3 Stressed", "LongChannel", "SysLib",


Example "C:\\Program Files\\AnsysEM\\v231\\Win64\\syslib\\MS - RT_duroid 6010 (Er=10.2)
0.010 inch, 0.5 oz copper.asty")

VB Syntax InsertDesignWithWorkflow <type>, <workflowName>, <specName>, <fileName>, <libLoc>, <stationaryPath>


oProject.InsertDesignWithWorkflow "Circuit Design", "Serial Design", _
"PCIe3 Stressed", "LongChannel", "SysLib", _
VB Example
"C:\Program Files\AnsysEM\v231\Win64\syslib\MS - RT_duroid 6010" & _
" (Er=10.2) 0.010 inch, 0.5 oz copper.asty"

Project Object Script Commands 5-70


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

InsertToolObject

Note:
This command is for internal Ansys use only.

Python Syntax InsertToolObject()


Python Example oProject.InsertToolObject()

Paste (Project Object)


Pastes a design in the active project.

UI Access Edit > Paste.


Parameters None.
Return Value None

Python Syntax Paste()


Python Example oProject.Paste()

VB Syntax Paste
VB Example oProject.Paste

Project Object Script Commands 5-71


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Redo [Project Level]


Reapplies the last project-level command.

UI Access Edit > Redo.


Parameters None.
Return Value None.

Python Syntax Redo()


Python Example oProject.Redo()

VB Syntax Redo
VB Example oProject.Redo

RemoveAllUnusedDefinitions
Removes all unused project definitions.

UI Access N/A
Parameters None.
Return Value None.

Project Object Script Commands 5-72


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax RemoveAllUnusedDefinitions()


Python Example oProject.RemoveAllUnusedDefinitions()

VB Syntax RemoveAllUnusedDefinitions
VB Example oProject.RemoveAllUnusedDefinitions

RemoveMaterial
Removes a material from a library.

UI Access Remove Material(s) command in the material editor

Name Type Description


<MaterialName> String Name of the material to be removed.
<IsProjectMaterial> Boolean If True, HFSS assumes the material is a project material. The last
Parameters two parameters will be ignored.
If False, the material is not a project material.
<LibraryName> String Name of the user or personal library where the material resides.
<LibraryLocation> String Location of library. Valid options:"UserLib" or "PersonalLib".

Return Value None.

RemoveMaterial (<MaterialName>, <IsProjectMaterial>,


Python Syntax
<LibraryName>, <LibraryLocation>)
Python Example oDefinitionManager.RemoveMaterial ([

Project Object Script Commands 5-73


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Material1", false, "mo0907","UserLib"])

RemoveMaterial <MaterialName>, <IsProjectMaterial>,


VB Syntax
<LibraryName>, <LibraryLocation>
oDefinitionManager.RemoveMaterial
VB Example
"Material1", false, "mo0907","UserLib"

RemoveUnusedDefinitions
Removes any unused project definitions.

UI Access Tools > Project Tools > Remove Unused Definitions.

Name Type Description


Parameters
<Definitions> Array Definitions to be removed, such as materials and surface materials.

Return Value None.

Python Syntax RemoveUnusedDefinitions(<Definitions>)


oProject.RemoveUnusedDefinitions(
[
Python Example
[
"NAME:Materials",

Project Object Script Commands 5-74


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Al-Extruded"
],
[
"NAME:SurfaceMaterials",
"Steel-oxidised-surface"
]
])

VB RemoveUnusedDefinitions <Definitions>
Syntax

VB
oProject.RemoveUnusedDefinitions Array(Array("NAME:Materials", "Al-Extruded"), Array
Exampl- ("NAME:SurfaceMaterials", _
e "Steel-oxidised-surface"))

Rename
Renames the project and saves it. Similar to SaveAs().

UI Access Edit > Rename.

Name Type Description


<NewName> String Desired name of the project. The path is optional.
Parameters <OverWriteOk> Boolean l True - overwrite the file on disk if it exists.

l False - prevent overwrite.

Return Value None.

Project Object Script Commands 5-75


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax Rename(<NewName>,<OverWriteOK>)


oProject.Rename("c:\projects\MyProject.aedt", True)
Python Example

VB Syntax Rename <NewName>,<OverWriteOK>


VB Example oProject.Rename "c:\projects\MyProject.aedt", true

Save
Saves the active project.

UI Access File > Save.


Parameters None.
Return Value None.

Python Syntax Save()


oProject.Save()
Python Example

VB Syntax Save

Project Object Script Commands 5-76


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oProject.Save

SaveAs
Saves the project under a new name. Requires a full path.

Note:

This script takes two parameters for non-schematic/layout designs and four parameters for schematic/layout designs.

UI Access File > Save As.

Name Type Description


<NewName> String The desired name of the project, with directory and extension.
<OverWriteOK> Boolean True to overwrite the file of the same name, if it exists. False to prevent over-
write.
<DefaultAction> String For Schematic/Layout projects only. Otherwise omit. See note below.

Parameters Valid actions: ef_overwrite , ef_copy_no_overwrite, ef_make_path_abso-


lute, or empty string.
<OverwriteActions> Array For Schematic/Layout projects only. Otherwise omit. See note below.
Structured array: Array("Name: <Action>", <FileName>, <FileName>, ...)
Valid actions: ef_overwrite , ef_copy_no_overwrite, ef_make_path_abso-
lute, or empty string.

Return Value None.

Pytho- For non-Schematic/Layout project: SaveAs ( <NewName> <OverWriteOK>)


n Syn-
tax For Schematic/Layout project: SaveAs (<NewName> <OverWriteOK> <DefaultAction> <OverrideActions>)

Project Object Script Commands 5-77


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oProject.SaveAs('D:/projects/project1.aedt', True)

Pytho- ----
n oProject.SaveAs('D:/Projects/Project1.aedt', True, 'ef_overwrite', ['NAME:Over-
Exam- rideActions', ['NAME:ef_copy_no_overwrite', ['NAME:Files',
ple
'$PROJECTDIR/circuit_models.inc']], ['NAME:ef_make_path_absolute', ['NAME:Files',
'$PROJECTDIR/SL_6s.sp']]])

VB Syn- For non-Schematic/Layout project: SaveAs <NewName> <OverWriteOK>


tax For Schematic/Layout project: SaveAs <NewName> <OverWriteOK> <DefaultAction> <OverrideActions>
oProject.SaveAs "D:/projects/project1.aedt", true
----
oProject.SaveAs
VB
Exampl- "F:\Designer Projects\TA33097\HighSpeedChannel.aedt", true, "ef_overwrite", Array
es ("NAME:OverrideActions",
Array("NAME:ef_copy_no_overwrite", Array("NAME:Files","$PROJECTDIR/circuit_mod-
els.inc")),
Array("NAME:ef_make_path_absolute", Array("NAME:Files","$PROJECTDIR\SL_6s.sp")))

Project Object Script Commands 5-78


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Important:

The DefaultAction and OverrideActions strings correspond to the following actions:

l ef_overwrite – Copy file to new project directory and overwrite.


l ef_copy_no_overwrite – Copy file to new project directory and don't overwrite.
l ef_make_path_absolute – Change reference to point to file in old project directory.
l Empty String – Do nothing.

The DefaultAction is applied to all files that are NOT explicitly listed in the OverrideActions array. Those in the Over-
rideActions array are separate arrays for actions that are different from the default action; those actions are applied to the
files listed in the same array:

l If OverrideActions are not specified, DefaultAction is applied to ALL files in project directory.

SaveAsStandAloneProject
Saves the project as a standalone copy.

Note:

This script is not supported when the application is being controlled by Ansys Workbench.

UI Access N/A

Name Type Description


Parameters
<projectName> String The desired name of the project, with directory and extension.

Return Value None.

Project Object Script Commands 5-79


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax SaveAsStandAloneProject( <projectName>)


Python Example oProject.SaveAsStandAloneProject('D:/projects/project1.aedt')

VB Syntax SaveAsStandAloneProject <projectName>

VB Examples oProject.SaveAsStandAloneProject "D:/projects/project1.aedt"

SaveProjectArchive
Saves the active project as an archive to the specified file path.

UI Access File > Archive.

Name Type Description


<archiveFilePath> String Path to archived file.
<IncludeExternalFiles> Boolean True to include external files; False to exclude.
Parameters <IncludeResultsFiles> Boolean True to include simulation files associated with the project; False to
exclude.
<AdditionalFiles> Array Additional specified files to include.
<ArchiveNotes> String String describe the archive.

Return Value None.

Python SaveProjectArchive(<archivefilepath>, <IncludeExternalFiles>, <IncludeResultsFiles>, <AdditionalFiles>,


Syntax <ArchiveNotes>)
Python oProject.SaveProjectArchive("C:\\Users\\Documents\\Ansoft\\Project27.aedtz", True,

Project Object Script Commands 5-80


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Example False, [], "")

VB Syn- SaveProjectArchive <archivefilepath>, <IncludeExternalFiles>, <IncludeResultsFiles>, <AdditionalFiles>,


tax <ArchiveNotes>

VB oProject.SaveProjectArchive "C:\Documents\OptimTee.aedtz", true, false, Array(), "My


Example notes"

SetActiveDefinitionEditor
Obtains a specified definition editor.

UI Access N/A

Name Type Description


<EditorName> String Name of the definition editor to set active, one of "SymbolEditor",
Parameters "FootprintEditor".
<DefinitionName> String The combination name for the symbol or footprint, <libname>:<def-
name>

Return Value Object for the definition to be edited.

Python Syntax SetActiveDefinitionEditor(<EditorName>, <DefinitionName>)


oProject.SetActiveDefinitionEditor("SymbolEditor",
Python Example "Simplorer Elements\Basic Elements\Circuit\Passive Elements:R")

Project Object Script Commands 5-81


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax SetActiveDefinitionEditor <EditorName>, <DefinitionName>


oProject.SetActiveDefinitionEditor "SymbolEditor",_
VB Example
"Simplorer Elements\Basic Elements\Circuit\Passive Elements:R"

SetActiveDesign
Sets a design to be the active design.

UI Access N/A

Name Type Description


Parameters
<DesignName> String Name of the design to set as the active design.

Return Value None.

Python Syntax SetActiveDesign (<DesignName>)


Python Example oDesign = oProject.SetActiveDesign("SimplorerDesign2")

VB Syntax SetActiveDesign <DesignName>


VB Example Set oDesign = oProject.SetActiveDesign "SimplorerDesign2"

SetPropValue [Project]
Sets a property value for an active project's child object.

Project Object Script Commands 5-82


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Edit Properties on ProjectTree objects.

Name Type Description


Parameters <propPath> String A child object's property path. See: Property Function.
<newValue> String New property value.

Boolean:
Return Value l True – property found.
l False – property not found.

Python SetPropValue(<propPath>, <newValue>)


Syntax

oProject.SetPropValue("TeeModel/offset", "2mm")
Python
Example oProject.SetPropValue("TeeModel/Results/S Parameter Plot 1/Display Type", "Data
Table")

VB Syn- SetPropValue <propPath>, <newValue>


tax

VB oProject.SetPropValue "TeeModel/offset", "2mm"


Example oProject.SetPropValue "TeeModel/Results/S Parameter Plot 1/Display Type", "Data Table"

SetPropertyValue
Sets the value of a single propertybelonging to a specific PropServer and PropTab. This function is available with the Project, Design
or Editor objects, including definition editors.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.

Project Object Script Commands 5-83


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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.

UI Access N/A

Name Type Description


<propTab> String One of the following, where tab titles are shown in parentheses:
l PassedParameterTab ("Parameter Values")

l DefinitionParameterTab (Parameter Defaults")

l LocalVariableTab ("Variables" or "Local Variables")

l ProjectVariableTab ("Project variables")

l ConstantsTab ("Constants")

Parameters l BaseElementTab ("Symbol" or "Footprint")

l ComponentTab ("General")

l Component("Component")

l CustomTab ("Intrinsic Variables")

l Quantities ("Quantities")

l Signals ("Signals")
<propServer> String An object identifier, generally returned from another script method, such as
Comp-Inst@R;2;3
<propName> String Name of the property.

Project Object Script Commands 5-84


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<propValue> String The value for the property

Return Value None.

Python Syntax SetPropertyValue(<propTab>, <propServer>, <propName>, <propValue>)


Python Example oEditor.SetPropertyValue("PassedParameterTab", "k", "R", "2200")

VB Syntax SetPropertyValue <propTab>, <propServer>, <propName>, <propValue>


VB Example oEditor.SetPropertyValue "PassedParameterTab", "k", "R", "2200"

SetVariableValue
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.

UI Access N/A

Name Type Description


Parameters <VarName> String Variable name.
<VarValue> Value New value for the variable.

Return Value None.

Python Syntax SetVariableValue (<VarName>, <VarValue>)

Project Object Script Commands 5-85


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Example oProject.SetVariableValue('$Var1', '3mm')

VB Syntax SetVariableValue <VarName>, <VarValue>


VB Example oProject.SetVariableValue "$Var1", "3mm"

SimulateAll
Simulates all solution setups and Optimetrics setups for all design instances in the project. Script processing only continues when all
analyses are finished.

UI Access N/A
Parameters None.
Return Value None.

Python Syntax SimulateAll()


oProject.SimulateAll()
Python Example

VB Syntax SimulateAll
VB Example oProject.SimulateAll

Project Object Script Commands 5-86


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Undo [Project]
Cancels the last project-level command.

UI Access Edit > Undo.


Parameters None.
Return Value None.

Python Syntax Undo()


oProject.Undo()
Python Example

VB Syntax Undo
VB Example oProject.Undo

UpdateDefinitions
Updates all definitions. The Messages window reports when definitions are updated, or warns when definitions cannot be found.

UI Access Tools > Project Tools > Update Definitions. Click Select All, then Update.
Parameters None.
Return Value None.

Project Object Script Commands 5-87


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax UpdateDefinitions()


oProject.UpdateDefinitions()
Python Example

VB Syntax UpdateDefinitions
VB Example oProject.UpdateDefinitions

Project Object Script Commands 5-88


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

6 - Object Oriented Property Scripting


Scripting in AEDT has been markedly enhanced via the convenient use of Object-Oriented access to retrieve or modify properties of
objects in AEDT. This feature allows for much less code to be written to access object properties and enables much more readable
code for our users, avoiding complex array input.
The primary gains of the use of Object-Oriented scripting are the ease with which properties of various existing objects in an Ansys
Electronics DesktopProject/Design can be read, modified, and set. Along with this ease of implementation comes much more ‘read-
able’ code to aid in others’ interpretation of custom scripts.
This App Note will discuss the following: The logic for syntax of access, Basic Attributes of Project and Design properties and
examples of use.

Object-Oriented Scripting
There are five basic functions that you use in Object Oriented scripting to retrieve and set properties:

1. GetChildNames()

2. GetChildObjects()

3. GetPropNames()

4. GetPropValue()

5. SetPropValue()

At a high level, use GetChildNames() to determine what object instances exist for a given object. An example is shown below to
demonstrate for an AEDT Project shown that has two Designs.

Object Oriented Property Scripting 6-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

If you open the Command Window that allows for executing python code, you first define the Project Object, oProject, and the Design
Object, oDesign, as shown:

Once the objects have been defined, you can use GetChildNames() to learn what object instances exist for each. As an example,
observe the Child Names of oProject, and you see a list of the Designs in the AEDT Project, per the GUI.

As another example, retrieve the names of the Object Instances available in oDesign, to see the various objects associated with a
Design setup:

Object Oriented Property Scripting 6-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

These names are what you would expect based on the Project Manager Layout:

In the Project Manager above, any object that has the ‘+’ symbol is populated with children that you can query. Once you know the
name of the object you want, you can instance it via the GetChildObject() command. This defines the instance to the desired object.
As an example, set an instance for the Excitations:

Object Oriented Property Scripting 6-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

You now have an object, oExcitations defined to be the oDesign Child Object ‘Excitations’. What does this mean? If you expand the
Excitations dialogue in the Project Manager, you expect that the Child Names of this object would be the names of the Excitations as
defined, in this case six ports:

Object Oriented Property Scripting 6-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Object Oriented Property Scripting 6-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

There is clear logic to the Object Child Names as the children of the oExcitations object as the ports that have been defined in HFSS.
Looking at the Project tree can help you to conceive and retrieve desired information.
Expand the first port to see its expected Child Object, its Terminal, in the Project Manager Window:

Through scripting, first define the Port Object (in this example, oPort) using the ‘GetChildObject()’ command for the first port, ‘BAW_
module1_SE1.’ Then determine its Object Child Name, the terminal definition:

Object Oriented Property Scripting 6-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

As the use and logic for GetChildNames() and GetChildObject() have been demonstrated, you can now explore the properties of each
of these objects, if they exist. The function to determine what properties exist is GetPropNames(). Use this to determine what prop-
erties exist to be retrieved or modified for a given object. The properties available are readily identifiable in the Property window, by
default located beneath the Project Manager window. For example, if you select a given port object, ‘BAW_module1_SE1’ the Prop-
erty window populates as shown:

If you execute the GetPropNames() function on the previously defined object, oPort, you see the same Property Names as available
in the Properties window:

Object Oriented Property Scripting 6-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Once you identify the desired object and you know the desired property, you can access the value via GetPropValue(). For example, if
you want to retrieve the name of the object oPort:

To change the value of the property, use the SetPropValue() function. The arguments for this function are (‘Property Name’,’New
Value’). For example, to change the name of the port to ‘Bob’:

This function returns a Boolean ‘True’ if successful. The Project Manager window updates accordingly:

Object Oriented Property Scripting 6-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

This approach for retrieving and setting properties is general and can be used for many aspects of an Ansys Electronics Desktop sim-
ulation. This Object-Oriented method of property identification and modification operates only on existing objects. Object-Oriented
scripting cannot create new instances; you must revert to the functions in a given Module to do that. Not all Children of a given object
may be accessible via the GetChildNames() command just yet. An example is given for Material property modification later in this App
Note. However, if you need specific objects you can reference details in the Scripting Help or reach out to an Application Engineer.

Material Properties and Examples


This section discusses the material properties and how to access and modify them. Because materials are globally defined, the
objects are children of the Project, oProject, as shown below:

Object Oriented Property Scripting 6-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

All materials with a Project Definition, or assigned to an object, in the Project are accessible. For example, assume you want to see the
conductivity of ‘copper.’ Follow the same flow as in the previous section:

The Material Property of interest is "Bulk Conductivity." So you create a "Cond" object to store the value and use the GetPropValue
function to obtain in. Then name the Cond object to see the value:

Object Oriented Property Scripting 6-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

To change the conductivity, use the SetPropValue() function as shown below:

Body Properties and Modification


The following example shows how to retrieve the properties of a Body in the model, in this case a Region object. Once you identity the
desired property, you can modify it as needed.

Retrieving Variables
Retrieving defined variables in a Design or Project is a common effort for automation. There are two types of variables, Design and
Project. Project variables are preceded with a ‘$’ symbol and are retrieved in the Project object as it is globally defined to all Designs.
Design variables do not have any preceding symbols and are retrieved in the Design object as their scope is limited to a given Design.
The following example demonstrates the retrieval of Project Variable names and values, and then Design variable names and val-
ues.:

Object Oriented Property Scripting 6-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Retrieve Datasets and Values


The GetChildObject, GetChildTypes and GetChildNames functions operate on the oDesktop objects. This allows you to retrieve and
view datasets and values. The dataset script wrapper store all values internally in SI units, and converts them back to user-supplied
units when you request non-SI property values.For example, if you assigned a dataset to the example OptimTee project in HFSS, you
could use these functions in the command window:
>>>oDesktop.GetChildTypes()
['Projects']
>>>oDesktop.GetChildNames()
['OptimTee']
>>>arrProjectNames = oDesktop.GetChildNames()
>>>tp = oDesktop.GetChildObject('OptimTee')
>>>tp.GetChildTypes()

Object Oriented Property Scripting 6-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

['Design', 'Project Data']


>>>tp.GetChildNames('Project Data')
['Variables', 'Materials', 'Surface Materials', 'Datasets']
>>>ds = tp.GetChildObject('datasets')
>>>ds.GetChildNames()
['$ds1']
>>>ds1=ds.GetChildObject('$ds1')
>>>ds1.GetPropValue('[:,:]')
[[1.0, 4.0], [2.0, 5.0], [3.0, 6.0]]
>>>ds1.GetPropSIValue()
[[1.0, 4.0], [2.0, 5.0], [3.0, 6.0]]
>>>ds1.DimUnits
>>>ds1.DimUnits = ['mm','mm']
>>>ds1.DimUnits
['mm', 'mm']
>>>ds1.GetPropSIValue()
[[0.001, 0.0040000000000000001], [0.002, 0.0050000000000000001], [0.0030000000000000001,
0.0060000000000000001]]
>>>ds1.GetPropValue('[:,:]')
[[1.0, 4.0], [2.0, 5.0], [3.0, 6.0]]

Object Oriented Property Scripting 6-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetSolutionData API
Many users want to use scripts to extract solution data from Ansys Electronics Desktop for custom Post Processing. Scripting includes
a new method to do this without having to export data to a file and then re-import it for use in a script. The new function is accessible
via the “ReportSetup” Module. The function call is “GetSolutionDataPerVariation()”. A code snippet to extract Terminal S Parameter
data is shown:

The above code shows how you can extract the Dependent and Independent data to variables for easy manipulation. For more inform-
ation on other functions available for this, see GetSolutionDataPerVariation.

Summary
Scripting has been advancing in Ansys Electronics Desktop to better allow you to customize and automate their repetitive or complex
simulations. The ability to easily retrieve and set property values via the Object-Oriented scripting allows for ease or both writing and

Object Oriented Property Scripting 6-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

reading. The ability to extract solution data within a script execution is a new functionality that markedly enables more advanced post
processing.
Object oriented property scripting presents an easy to use, intuitive and object oriented representation of the data model. The frame-
work supports query of objects and their properties including the edits of the data model in an object oriented fashion. With the new
scripting framework, data exposure is intuitive and provides maximum coverage.
Each exposed script object supports the following COM functions:
l GetName
o Return name of the object as text string
o e.g. name of a design, solve setup, boundary, etc
l GetChildTypes
o An object can have different types of children.
o Return array of text string. Can be empty if the object’s children are NOT categorized into different types.

For example, a design object has 3 children types. The following examples show how the commands run in the Tools > Open
Command Window for IronPython.
>>> design.GetChildTypes()
['Module', 'Editor', ‘Design Data’]

l GetChildNames
o Input: [String – Type]. Default = “Module” and “Editor” for design script object. ‘All’ for other script objects.
o Return an array of immediate children’s names, of a given type if specified

For example, a Mechanical design object has these children.


>>> design.GetChildNames()
['Boundaries', 'Excitations', 'Optimetrics', 'Results', '3D Modeler']
Four of the children are of “Module” type

Object Oriented Property Scripting 6-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

>>> design.GetChildNames("module")
['Boundaries', 'Excitations', 'Optimetrics', 'Results']

l GetChildObject
o Input: String -- Object path. The path may include multiple generations.
o Return the child object if found

For example,
>>> d = project.GetChildObject("hfss")
>>> d.GetChildObject("3d modeler").GetChildNames()
['Box1', 'Box1_1', 'Box1_1_1']
>>> project.GetChildObject("hfss/3d modeler").GetChildNames()
['Box1', 'Box1_1', 'Box1_1_1']

l GetPropNames
o Input: [BOOL - IncludeReadOnly] -- default to true
o Return an array of the object’s properties

For example,
>>> geom = project.GetChildObject("hfss/3d modeler").GetChildObject("Box1")
>>> geom.GetPropNames()
['Name', 'Material', 'Material/SIValue', 'Material/EvaluatedValue', 'Solve Inside', 'Ori-
entation', 'Orientation/Choices', 'Model', 'Group', 'Display Wireframe', 'Material Appearance',
'Color', 'Color/Red', 'Color/Green', 'Color/Blue', 'Transparent']

Object Oriented Property Scripting 6-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l GetPropValue
o Input: String – Property Path. The path may include multiple generations.
o Return the property value as VARIANT

For example,
>>> geom.GetPropValue("material")
'"vacuum"’
>>> geom.GetPropValue("xsize")
'3mm'
>>> op.GetPropValue("attach to original object")
False

l • SetPropValue
o Input: String – Property Path. The path may include multiple generations.
o Input: String – Data. New value of the property.
o Return -- True if property data is updated successfully. False if failed to assign the new value.

For example,
>>> geom.SetPropValue("model", False)
>>> boxcmd.SetPropValue("ysize", "4mm")

l GetPropEvaluatedValue (<PropName>)

For example,
oVar = oDesign.GetChildObject(" Variables/var")
oVar.GetPropEvaluatedValue()

Object Oriented Property Scripting 6-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l GetPropSIValue (<PropName>

For example,
oCreateBox = oDesign.GetChildObject("3D Modeler/Box1/CreateBox:1")
oCreateBox.GetPropValue("xSize")
return "length / 2"
oCreateBox.GetPropEvaluatedValue("xSize")
return '0.4mm'
oCreateBox.GetPropSIValue("xSize")
return 0.0004

Additional Details Specific to AEDT Solvers


“3D Modeler” of 3D products and “Machine” of RMxprt are exposed as “Editor” type children of a design script object.
“Variables” and “Design Settings” are exposed as “Design Data” type children of a design script object.
The following “Module” types are exposed as “Module” type children of a design script object.
HFSS
l Boundaries, Excitations, Circuit Elements, Hybrid Regions, Analysis, Radiation, Field Overlays, Optimetrics, Results

HFSS 3D Layout
l Boundaries, Excitations, Circuit Elements, Analysis, Radiation, Field Overlays, Optimetrics, Results

Maxwell 3D/2D
l Boundaries, Excitations, Analysis, Field Overlays, Optimetrics, Results

Object Oriented Property Scripting 6-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

RMxprt
l Analysis, Field Overlays, Optimetrics, Results

Q3D
l Boundaries, Nets, Analysis, Optimetrics,

Q2D
l Boundaries, Conductors, Analysis, Field Overlays, Optimetrics,

Icepak
l Thermal, Monitor, Mesh, Analysis, Field Overlays, Optimetrics, Results

Mechanical
l Boundaries, Excitations, Analysis, Field Overlays, Optimetrics, Results

Circuit
l Optimetrics, Results

Circuit Netlist
l Results

EMIT
l Coupling

Simplorer/Twin Builder
l Analysis, Optimetrics, Results

Object Oriented Property Scripting 6-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Additional details on Boundaries/Excitations


Each design type presents its boundaries/excitations data in the project tree as different groups. For example, an HFSS design has
Boundaries, Excitations, Circuit Elements and Hybrid Regions while a Icepak design has just a “Thermal” project tree folder.
These module script objects do not have properties
>>> project.GetChildObject("icepak/thermal").GetPropNames()
[]
GetChildTypes of these module script objects returns the types of its immediate children
>>> d = p.GetChildObject("q2d")
>>> d.GetChildObject("conductors").GetChildTypes()
['NonIdealGround', 'SignalLine']
GetChildNames of these module object returns its immediate children
>>> p.GetChildObject("icepak/thermal").GetChildNames()
['Source1', 'Resistance1', 'ConductingPlate1', 'Source2', 'Resistance2', 'ConductingPlate2',
'Source3', 'Resistance3', 'ConductingPlate3']
GetChildNames can be invoked with a “type” and the returns will be filtered by that given type.
>>> p.GetChildObject("icepak/thermal").GetChildNames("resistance")
['Resistance1', 'Resistance2', 'Resistance3']
Children of a module object are scriptable objects and have properties.
>>> port = p.GetChildObject("hfss/excitations/1")
>>> port.GetPropNames(False)
['Name', 'Deembed', 'Deembed Dist', 'Renorm All Terminals']

Object Oriented Property Scripting 6-20


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

You can query/edit these properties


>>> port.GetPropValue("deembed")
False
>>> port.SetPropValue("deembed", True)
True
>>> port.GetPropValue("deembed")
True
A boundary/excitation script object can also have children. For example, HFSS terminal is a child of its port. Q3D source/sink can be
children of a net.
>>> port.GetChildNames()
['Box1_T1']
>>> port.GetChildTypes()
['Terminal']
>>> p.GetChildObject("q3d/nets/s2").GetChildNames()
['Source2', 'Sink2']
>>> p.GetChildObject("q3d/nets/s2").GetChildTypes()
['Sink', 'Source']

3D component encapsulation
These script interfaces are compliant with encapsulation. For example,

Object Oriented Property Scripting 6-21


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l Design.GetChildObject(“boundaries”).GetChildNames() will not return component boundaries


l SetPropValues of component excitations can only be used to edit post processing settings such as 'Deembed', 'Deembed Dist'
of a HFSS port.

Additional details on Solve setup


All solve setups are children of the “Analysis” script object. This parent script object is also of the type “Module”.
>>> d = oDesktop.GetActiveProject().GetChildObject("hfss")
>>> d.GetChildNames()
['Boundaries', 'Excitations', 'Hybrid Regions', 'Circuit Elements', 'Analysis', 'Opti-
metrics', 'RadField', 'Results', '3D Modeler']
>>> setups = d.GetChildObject("analysis")
This module script object has no property
>>> setups.GetPropNames()
[]
The children of this module script object in a 3D design is not categorized into different types because the solve setup type is one-to-
one to the solution type of a 3D design.
>>> setups.GetChildTypes()
[]
The children of this module script object in a 3DLayout and Simplorer/TwinBuilder design is categorized into different solve setup
types, such as “Transient”, “AC” and “DC” in a Simplorer/TwinBuilder design and “HFSS”, “PlanarEM”, “SIwave” in a 3D layout design.
A solve setup script object can also have children. Children are typically frequency sweeps.
>>> setup.GetChildNames()

Object Oriented Property Scripting 6-22


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

['Sweep', 'Sweep1', 'Sweep2']


>>> setup.GetChildTypes()
['Discrete', 'Interpolating']
>>> sweep1 = setup.GetChildObject("sweep")

Related Topics
ExampleGetLayeredImpedanceBoundaryPropertyNamesandValues.htm

Materials Scripting Support


Supported material properties are shown in a Property window for the material item.

Object Oriented Property Scripting 6-23


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Some Material Properties like Relatively Permittivity may have values assigned as BH Curves or Tensors, as discussed in the Assign-
ing Materials chapter of the online help.

Object Oriented Property Scripting 6-24


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Object Oriented Property Scripting 6-25


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

With this feature enabled you can then:


l Get/Set Simple material property
l Get/Set Anisotropic material property
l Get/Set Nonlinear material property
l Get/Set Vector material property
l Components hide/shown as needed
l Get/Set Tensor material property
l Get/Set Choice material property
l AddDefinitionFromBlock
l AddDefiniitonFromLibFile
l GetExtendedDefinitionObect

A new Toolkit allows you to select materials from the Granta materials gateway, such that project materials will automatically be added
when you select a material from the gateway, and that the gateway itself is easily accessed from the materials.

Object Oriented Property Scripting 6-26


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

What is not supported:


l Change of property type
l Custom material property, due to its complexity

Object Oriented Scripting for Materials


Materials are Child objects of the Active Project. In the IronPython command window, you can execute GetPropNames() for a spe-
cified material as follows:
>>> omats = oDesktop.GetActiveProject().GetChildObject("Materials")
>>> omat = omats.GetChildObject("vacuum")
>>> omat.GetPropNames()
['Coordinate System Type', 'Coordinate System Type/Choices', 'Relative Permeability Type',
'Relative Permeability Type/Choices', 'Relative Permeability', 'Relative Permeability/SIValue',

Object Oriented Property Scripting 6-27


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

'Relative Permeability/EvaluatedValue', 'Bulk Conductivity Type', 'Bulk Conductivity


Type/Choices', 'Bulk Conductivity', 'Bulk Conductivity/SIValue', 'Bulk Con-
ductivity/EvaluatedValue', 'Magnetic Coercivity Type', 'Magnetic Coercivity Magnitude', 'Magnetic
Coercivity Magnitude/SIValue', 'Magnetic Coercivity Magnitude/EvaluatedValue', 'Composition',
'Composition/Choices', "Young's Modulus Type", "Young's Modulus Type/Choices", "Young's Modulus",
"Young's Modulus/SIValue", "Young's Modulus/EvaluatedValue", "Poisson's Ratio Type", "Poisson's
Ratio Type/Choices", "Poisson's Ratio", "Poisson's Ratio/SIValue", "Poisson's Ratio/E-
valuatedValue"]

Examples showing change to material property type:


>>> omat.GetPropValue("Relative Permeability Type/Choices")
['Simple', 'Anisotropic', 'Tensor', 'Nonlinear']
>>> omat.GetPropValue("Relative Permeability Type")
'Nonlinear'
>>> omat.SetPropValue("Relative Permeability Type", "Simple")
True
>>> omat.GetPropValue("Relative Permeability Type")
'Simple'
>>> omat.SetPropValue("Relative Permeability", 10)
True

Examples showing change to a vector component value


>>> omat.GetPropValue("Magnetic Coercivity Magnitude")
'0A_per_meter'
>>> omat.SetPropValue("Magnetic Coercivity Magnitude", "-1A_per_meter")

Object Oriented Property Scripting 6-28


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

True
>>> omat.GetPropNames()
['Coordinate System Type', 'Coordinate System Type/Choices', 'Relative Permeability Type',
'Relative Permeability Type/Choices', 'Relative Permeability', 'Relative Permeability/SIValue',
'Relative Permeability/EvaluatedValue', 'Bulk Conductivity Type', 'Bulk Conductivity
Type/Choices', 'Bulk Conductivity', 'Bulk Conductivity/SIValue', 'Bulk Con-
ductivity/EvaluatedValue', 'Magnetic Coercivity Type', 'Magnetic Coercivity Magnitude', 'Mag-
netic Coercivity Magnitude/SIValue', 'Magnetic Coercivity Magnitude/EvaluatedValue', 'Magnetic
Coercivity Components', 'Magnetic Coercivity Components/Component1', 'Magnetic Coercivity Com-
ponents/Component2', 'Magnetic Coercivity Components/Component3', 'Composition', 'Com-
position/Choices', '- Stacking Factor Type', '- Stacking Factor', '- Stacking Factor/SIValue',
'- Stacking Factor/EvaluatedValue', '- Stacking Direction', '- Stacking Direction/Choices',
"Young's Modulus Type", "Young's Modulus Type/Choices", "Young's Modulus", "Young's Mod-
ulus/SIValue", "Young's Modulus/EvaluatedValue", "Poisson's Ratio Type", "Poisson's Ratio
Type/Choices", "Poisson's Ratio", "Poisson's Ratio/SIValue", "Poisson's Ratio/EvaluatedValue"]
>>> omat.SetPropValue("Magnetic Coercivity Components/Component2", 2)
True
>>> omat.GetPropValue("Magnetic Coercivity Components")
['Component1:=', '2', 'Component2:=', '2', 'Component3:=', '0']

Change choice property value


>>> omat.GetPropValue("Composition/Choices")
['Solid', 'Lamination', 'Litz Wire']
>>> omat.SetPropValue("Composition", "Lamination")
True
>>> omat.GetPropNames()

Object Oriented Property Scripting 6-29


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

['Coordinate System Type', 'Coordinate System Type/Choices', 'Relative Permeability Type',


'Relative Permeability Type/Choices', 'Relative Permeability', 'Relative Permeability/SIValue',
'Relative Permeability/EvaluatedValue', 'Bulk Conductivity Type', 'Bulk Conductivity
Type/Choices', 'Bulk Conductivity', 'Bulk Conductivity/SIValue', 'Bulk Con-
ductivity/EvaluatedValue', 'Magnetic Coercivity Type', 'Magnetic Coercivity Magnitude', 'Magnetic
Coercivity Magnitude/SIValue', 'Magnetic Coercivity Magnitude/EvaluatedValue', 'Magnetic Coer-
civity Components', 'Magnetic Coercivity Components/Component1', 'Magnetic Coercivity Com-
ponents/Component2', 'Magnetic Coercivity Components/Component3', 'Composition',
'Composition/Choices', '- Stacking Factor Type', '- Stacking Factor', '- Stacking Fact-
or/SIValue', '- Stacking Factor/EvaluatedValue', '- Stacking Direction', '- Stacking Dir-
ection/Choices', "Young's Modulus Type", "Young's Modulus Type/Choices", "Young's Modulus",
"Young's Modulus/SIValue", "Young's Modulus/EvaluatedValue", "Poisson's Ratio Type", "Poisson's
Ratio Type/Choices", "Poisson's Ratio", "Poisson's Ratio/SIValue", "Poisson's Ratio/E-
valuatedValue"]
>>> omat.SetPropValue("Magnetic Coercivity Components/Component2", 2)
True
>>> omat.GetPropValue("Magnetic Coercivity Components")
['Component1:=', '2', 'Component2:=', '2', 'Component3:=', '0']

Change choice property value


>>> omat.GetPropValue("Composition/Choices")
['Solid', 'Lamination', 'Litz Wire']
>>> omat.SetPropValue("Composition", "Lamination")
True
>>> omat.GetPropNames()

Object Oriented Property Scripting 6-30


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

['Coordinate System Type', 'Coordinate System Type/Choices', 'Relative Permeability Type',


'Relative Permeability Type/Choices', 'Relative Permeability', 'Relative Permeability/SIValue',
'Relative Permeability/EvaluatedValue', 'Bulk Conductivity Type', 'Bulk Conductivity
Type/Choices', 'Bulk Conductivity', 'Bulk Conductivity/SIValue', 'Bulk Con-
ductivity/EvaluatedValue', 'Magnetic Coercivity Type', 'Magnetic Coercivity Magnitude', 'Mag-
netic Coercivity Magnitude/SIValue', 'Magnetic Coercivity Magnitude/EvaluatedValue', 'Magnetic
Coercivity Components', 'Magnetic Coercivity Components/Component1', 'Magnetic Coercivity Com-
ponents/Component2', 'Magnetic Coercivity Components/Component3', 'Composition', 'Com-
position/Choices', '- Stacking Factor Type', '- Stacking Factor', '- Stacking Factor/SIValue',
'- Stacking Factor/EvaluatedValue', '- Stacking Direction', '- Stacking Direction/Choices',
"Young's Modulus Type", "Young's Modulus Type/Choices", "Young's Modulus", "Young's Mod-
ulus/SIValue", "Young's Modulus/EvaluatedValue", "Poisson's Ratio Type", "Poisson's Ratio
Type/Choices", "Poisson's Ratio", "Poisson's Ratio/SIValue", "Poisson's Ratio/EvaluatedValue"]
>>>

Object Oriented Property Scripting 6-31


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

6-32
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

7 - Property Script Commands


Property script commands allow you to navigate through all objects and properties in a project. You can get and set all properties for
all objects in the Project tree with simple data types.
Property Object is the base class defined for all script objects that support the properties Get and Set.
GetName()

l Returns the name of the object.


GetChildTypes()

l An object may have different types of children. For example, a design may have variables, modules, and editors.
l Returns an array of text strings; may be empty if the children are not divided into different types.
GetChildNames(<type>)

l <type> – Child type name. By default, returns all children names for all types.
l Returns an array of immediate children names, belonging to a type if specified.
GetChildObject(<objPath>)

l <objPath> – A child object path; can contain multiple generations (for example, designObject/moduleObject/SetupObject).
l Returns a child property object if the object is found.
GetPropNames(<bIncludeReadOnly>)

l <bIncludeReadOnly) – Optional; defaults to true. True includes read-only properties; False excludes read-only properties.
l Returns an array of the object's property names.
GetPropValue(<propertyPath>)

Property Script Commands 7-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l <propertyPath> – The property's path; may be a child object's path appended with a property name (for example, TeeModel/Off-
set/SIValue).
l Returns the property value if found. Otherwise causes script error.
SetPropValue(<propertyPath>, <data>)

l <propertyPath> – The property's path; may be a child object's path appended with a property name (for example, TeeModel/Off-
set/SIValue).
l <data> – New data; type depends on property type.
l Returns True if updated successfully; False if new data is invalid.

For a detailed summary of how Property script commands are used in a range of contexts, including Variable objects, see: Object
Script Property Function Summary. Additional examples for these commands are listed under Project Objects, Design Objects, 3D
Modeler, Optimetrics, Radiation Module and Reporter.

Note:

Older property commands should be executed by the oProject object.

Set oProject = oDesktop.SetActiveProject("Project1")

oProject.CommandName <args>

Some of the topics covered in this chapter are as follows:


Conventions Used in this Chapter
ChangeProperty
GetArrayVariables
GetProperties

Property Script Commands 7-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetPropertyValue
GetVariables
GetVariableValue
SetPropertyValue
SetVariableValue
Additional Property Scripting Example
Example Use of Record Script and Edit Properties

Object Script Property Function Summary


Object Path
The Object path can be used to navigate through objects and properties in an Ansys EM project.
l An Object path consisted of one or multiple Object-ID-Nodes separated by "/" . In the HFSS-Optimtee example, the Optim-
ization Max value of variable "offset" is represented by the path "TeeModel/offset/Optimization/max" or "TeeModel/Variable[off-
set]/Optimization[max]"
l Object-ID-Node; may exist in the following forms:
l A simple object name or property name.
l Type[Name] for object; Tab[name] for property.
l Name[attr1="v1", attr2 = "v2", ...]. When more than one child object have the same name, use attributes to specify the dif-
ference.
l ArrayName[index]. For example, in an Optimetric setup with multiple calculations, "Calculation[0]" could be used to
identify the first calculation.
l Name beginning with '@' character denoted as a property name, when an object has a child and property with the same
name.

Property Script Commands 7-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Property Object
The Property Object is the base class defined for all script object that support property Get & Set.
l GetName()
l Returns the name of the object.
l GetChildTypes()
l An object may have different type of children. For example, a design may have variables, modules, and editors.
l Returns array of text strings; may be empty if the children are not divided to different types.
l GetChildNames(<type>)
l <type> – children type name; default returns all children names for all types.
l Returns an array of immediate children names, belonging to the type if specified.
l GetChildObject(<objPath>)
l <objPath> – A child object path. The path may include multiple generations, such as (designOb-
ject/moduleObj/SetupObject).
l Returns a child property object if the object found.
l GetPropEvaluatedValue(<propName>)
l Return the Evaluated-Value for Value-Property and Variable.
l Return the Property-value as text string for other property types.
l GetPropSIValue(<propName>)
l Return the SI-Value for Value-Property and Variable.
l Return NAN for other property type if its value is cannot be converted to a double-floating point value.

Property Script Commands 7-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l GetPropNames(<bIncludeReadOnly>);
l <bIncludeReadOnly> – optional, default to true; True will include read-only properties, False will exclude read-only prop-
erties.
l Returns an array of the object’s property names.
l GetPropValue(<propertyPath>)
l <propertyPath> – the property's full path. A property name or child object’s path appended with a property name, like
“TeeModel/Offset/SIValue”
l Returns the property value if the property is foun; otherwise causes script error.
l SetPropValue(<propertyPath>, <data>)
l <propertyPath> – the property's full path. A property name or child object’s path appended with a property name, like
“TeeModel/Offset/Value”
l <data> – new data, type is dependent on property type.
l Returns True if property data is updated successfully; False if the new data is invalid.

Project Object
Project Object inherited all functions defined in the Property Object. But it doesn't have property, GetPropValue() & SetPropValue()
function can be used to set its child object's property.
l GetChildTypes() always return [“Design”, “Variable”].
l GetChildNames(type)
GetChildNames() & GetChildName(“Design”) will return all Design names of the project.
GetChildNames(“Variable”) return all project variable names.
l GetChildObject(objPath)

oDesign = oProject("TeeModel")

oVariable = oProject.GetChildObject("VariableName")

Property Script Commands 7-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oReport = oProject.GetChildObject("TeeModel/Results/S Parameter Plot 1")

l GetPropNames(bIncludeReadOnly) always return empty array since the project has no property.
l GetPropValue(propertyPath)

oProject.GetPropValue("TeeModel/offset") //get the offset variable value in the TeeModel Design


oProject.GetPropValue("TeeModel/Results/S Parameter Plot 1/Display Type") // Get the report display type.

l SetPropValue(propertyPath, newValue)

oProject.SetPropValue("TeeModel/offset", "2mm") //Set the offset variable value to "2mm" in the TeeModel Design
oProject.SetPropValue("TeeModel/Results/S Parameter Plot 1/Display Type", "Data Table) // Set the report display type to data
table.

Design Object
Design Object inherited all functions defined in the Property Object. But it doesn't have property, GetPropValue() & SetPropValue()
function can be used to set its child object's property..
l GetChildTypes() always return ['Module', 'Editor', 'Variable'].
l GetChildNames(type)
GetChildNames() will return modules & editor child names.
GetChildNames(“Variable”) will return all variable names
GetChildNames(“Module”) will return all module names that support property-object-script like ['Optimetrics', 'RadField', 'Res-
ults']
GetChildNames(“Editor”) will return a 3D editor name for all 3D Designs
l GetChildObject()
oVariable = oDesign.GetChildObject("VariableName")

Property Script Commands 7-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oReport = oDesign.GetChildObject("Results/S Parameter Plot 1")


oRptModule = oDesign.GetChildObject("ReportSetup")
l GetPropNames(bIncludeReadOnly) always return empty array since the design has no property.
l GetPropValue()
oDesign GetPropValue("offset/SIValue") //get the offset variable SI value in the DesignoDesign GetPropValue("off-
set/SIValue") //get the offset variable SI value in the Design
oDesign.GetPropValue("Results/S Parameter Plot 1/Display Type") // Get the report display type
l SetPropValue()
oDesign.SetPropValue("offset", "2mm") //Set the offset variable value to "2mm" in the Design
oDesign.SetPropValue("Results/S Parameter Plot 1/Display Type", "Data Table) // Set the report display type to data table.

3D Modeler Object
GetChild commands returns the appropriate properties for modeler objects. For 3D Components and UDMs, these commands do not
return parts, coordinate systems, plans, as top-level modeler children.
oModeler = oDesktop.GetActiveProject().GetActiveDesign().GetChildObject("3D Modeler")
oModeler.GetChildNames()
oModeler.GetChildNames("ModelParts")
oModeler.GetChildNames("AllParts")
oModeler.GetChildNames("NonModelParts")
oModeler.GetChildNames("Planes")
oModeler.GetChildNames("CoordinateSystems")

Variable Object
Is a Property Object that has no child. It also provides quick function call to get/set it properties by adding functions with property name
appended to Get_ & Set_ prefix. To find what functions it provided enter dir(oVar) the command window. It can accessed by the pro-
ject or design object’s GetChildObject(VariableName) function.
oProjVar = oProject.GetChildObject(“$VarName”)
oVar = oProject.GetChildObject(“DesignName/VarName”)
oVar = oDesign.GetChildObject(“variableName”)

Property Script Commands 7-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oProject..GetChildNames(“Variable”) will return all project variable names.


oDesign.GetChildNames(Variable”) will return all Design Variable names.
l GetChildTypes() always return empty array.
l GetChildNames() always return empty array , since variable has no child.
l GetChildObject(objPath) it has no child.
l GetPropNames(bIncludeReadOnly) ['EvaluatedValue', 'SIValue'] are read-only properties
l Independent variable :['Value', 'EvaluatedValue', 'SIValue', 'Description', 'ReadOnly', 'Hidden', 'Sweep', 'Optim-
ization/Included', 'Optimization/Min', 'Optimization/Max', 'Sensitivity/Included', 'Sensitivity/Min', 'Sensitivity/Max', 'Sens-
itivity/IDisp', 'Statistical', 'Statistical/Included', 'Tuning/Included', 'Tuning/Step', 'Tuning/Min', 'Tuning/Max'].
l Dependent variable ['Value', 'EvaluatedValue', 'SIValue', 'Description', 'ReadOnly', 'Hidden', 'Sweep']
l GetPropValue(propName)
oVar.GetPropValue() return the variable value as text string.
oVar.GetPropValue(“Value”) return the variable value as text string.
oVar.GetPropValue(“SIValue”) return the SI-value of variable as number.
oVar.Get_SIValue()also return the SI value.
l SetPropValue(propName, newValue)
oVar.SetPropValue(“Value", 888)
oVar.SetPropValue("Sensitivity'/Included", True)
oVar.SetPropValue("Sensitivity/Max”, '1.8pF'])
oVar.Set_Sensitivity_Max( '1.8pF') also works as last call.
oVar.SetPropValue("Sensitivity", ['Min:=', '0.8pF', 'Max:=', '1.8pF'])
//set multiple attributes at one call:
oVar.SetPropValue("@", ['Value:=',288, 'Sensitivity', ['Included', True,'Min', '0.0']])
oVar.SetPropValue("", ['Value:=',288, 'Sensitivity', ['Included', True,'Min', '0.0']])

Property Script Commands 7-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Optimetrics Module Object:


Optimetrics Module Object inherited all functions defined in the Property Object. But it doesn't have property, GetPropValue() &
SetPropValue() function can be used to set its child object's property..
l GetChildTypes() there are six type of children, they are ['OptiParametric', 'OptiOptimization', 'OptiSensitivity', 'OptiStatistical',
'OptiDesignExplorer', 'OptiDXDOE']. But the return array only included those that have setup defined, so it may be an empty
array if no optimetrics setup is defined. The GetChildNames(type) function also recognized the type name without the prefix
“Opti”.
l GetChildNames(type)
GetChildNames() will return all setup for all types.
GetChildNames(“OptiOptimization”) & GetChildNames(“Optimization”) will return all Optimization setup.
l GetChildObject()
oParamSetup = oOptModule.GetChildObject('ParametricSetup1') get the
oOptSetup = oOptModule.GetChildObject('OptimizationSetup1')
l GetPropNames(bIncludeReadOnly) always return empty array since the it has no property.
l GetPropValue(propPath) may be used to get its child’s property value
oOptModule.GetPropValue("OptimizationSetup1\Optimizer") get the optimizer name for OptimizationSetup1
l SetPropValue(propPath, newValue) may be used to set its child’s property value
oOptModule.SetPropValue(ParametricSetup1\Enabled", False) //disable ParametricSetup1

Optimetrics Setup Object


This is a new Object inherited all functions defined in the Property Object. But it doesn't have child. It is accessible through its parents.
oOptSetup = oOptModule.GetChildObject('OptimizationSetup1')
oOptSetup = oDesign.GetChildObject('Optimetrics\OptimizationSetup1')
oOptSetup = oProject.GetChildObject('TeeModel\Optimetrics\OptimizationSetup1')

Property Script Commands 7-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l GetChildTypes() always return empty array.


l GetChildNames(type) always return empty array
l GetChildObject()
l GetPropNames(bIncludeReadOnly) will return the property names listed in the property window when the setup is selected.
l GetPropValue(propName)
oOptSetup.GetPropValue("Optimizer") return the selected optimizer name.
oOptSetup.GetPropValue("Optimizer/Choices") return all optimizer names.
l SetPropValue(propName, newValue)
oOptSetup.SetPropValue("Optimizer", “NotAnOptimzerName”; will return false.
oOptSetup.SetPropValue("Optimizer", “Quasi Newton”; return true, since “Quasi Newton” is one of the optimizer name returned
as the Optimizer Choices.
l HasResult() return true if the setup is solved. Otherwise return false.
l Validate() return true if the setup is valid for analyze. Otherwise return false. Calling the SetPropValue() function to change the
property may invalid the setup.

ReportSetup(Results) Module Object:


ReportSetup module Object inherited all functions defined in the Property Object. But it doesn't have property, GetPropValue() &
SetPropValue() function can be used to get/set its child object's property..
l GetChildTypes() always empty array.
l GetChildNames(type)
GetChildNames() return all report names
l •GetChildObject(objPath)
oRpt = oRptModule.GetChildObject("S Parameter Plot 1") return the report property object

Property Script Commands 7-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oTrace = oRptModule.GetChildObject("S Parameter Plot 1/dB(S(Port1,Port1))") return the trace property object
oAxisX = oRptModule.GetChildObject("S Parameter Plot 1/AxisX") return the axis X property object
l GetPropNames(bIncludeReadOnly) always return empty array since the it \has no property.
l GetPropValue()
oRptModule.GetPropValue(“S Parameter Plot 1/Display Type”)
l SetPropValue()
oRptModule.SetPropValue(“S Parameter Plot 1/Display Type”, “DataTable”)

ReportSetup(Results) Module Child Objects:


These are Property Objects. Its first level of child object is report. Report has trace, axis, header, Legend, and more children. Trace
has curve as child etc.
Those child objects can be accessed by calling all levels of parent object’s GetChildObject(path) function.
oRpt = oRptModule.GetChildObject(reportName)
oRpt = oDesign.GetChildObject(“Results/reportName”)
oTrace = oRpt.GetChildObject(traceName)
oTrace = oRptModule.GetChildObject(ReportName/TraceName)
l GetChildTypes() always return empty array.
l GetChildNames() get the object’s child names. What will be returned will depended on the object instance.
l GetChildObject(objPath)
l GetPropNames(bIncludeReadOnly) will return the property names listed in the property window when the object is selected.
l GetPropValue(propName)
oRpt.GetPropValue("Display Type") return the report’s display type.
oOptSetup.GetPropValue("Display Type/Choices") return all optimizer names.
oTrace.GetPropValue(“X Component”)

Property Script Commands 7-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l SetPropValue(propName, newValue)
oTrace.SetPropValue(“Primary sweep”, “Freq”)

Radiation Module Object:


This inherited all functions defined in the Property Object. But it doesn't have property, GetPropValue() & SetPropValue() function can
be used to set its child object's property.
l GetChildTypes() always return empty array, now its children
l GetChildNames(type)
GetChildNames() return all setup names.
l GetChildObject(setupName) return the setup object as Property object.
oOverlay= oRadModule.GetChildObject('Antenna Parameter Overlay1')
oSphere = oRadModule.GetChildObject('Infinite Sphere1')
l GetPropNames() return empty array; it has no property.
l GetPropValue()
oRadModule.GetPropValue('Line1/Num Points') //Get the the Line1 setups’ “Num Points” property value.
l SetPropValue()
oRadModule.SetPropValue('Line1/Num Points', 100) ; Set the Line1 setups’ “Num Points” property to 100.

Radiation Module Child Objects:


These are Property Objects. It also provides quick function call to get/set its properties by adding functions with property name appen-
ded to Get_ & Set_ prefix. To find what functions it provides enter dir(oVar) the command window.
Those child objects can be access by call all levels of parent object’s GetChildObject(path) function.
oRadSetup = oRadModule.GetChildObject(setupName)
oRadSetup = oDesign.GetChildObject(RadField/setupName)

Property Script Commands 7-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l GetChildTypes() always return empty array.


l GetChildNames() always return empty array , since Radiation setup has no child.
l GetChildObject(objPath) it has no child.
l GetPropNames(bIncludeReadOnly) will return the property names listed in the property window when the setup is selected.
l GetPropValue(propName)
oRadSetup.GetPropValue(”Num Points") return the line setup’s “Num Points” property value.
oRadSetup.Get_NumPoints() will also get the same value.
l SetPropValue(propName, newValue)
oRadSetup.SetPropValue('Num Points', 888)
oRadSetup.Set_NumPoints(888)

Conventions Used in this Chapter


General Definitions:

Property A single item that can be modified in the Properties window or in the modal Properties pop-up window.
The item whose properties are being modified. This is usually a compound name, giving all information needed
<PropServer>
by the editor, design, or project in order to locate the item.
<PropTab> Corresponds to one tab in the Properties window, the one under which properties are being edited.
<PropName> The name of a single property.

The following tables list specific <PropServer> and <PropTab> values for different property types.
For Project Variables:

<PropServer> "ProjectVariables"
<PropTab> "ProjectVariableTab"

For Local Variables:

<PropServer> "LocalVariables"

Property Script Commands 7-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<PropTab> "LocalVariableTab"

For Passed Parameters:

<PropServer> "Instance:<Name of Circuit Instance>"


<PropTab> "PassedParameter Tab"

For Definition Parameters:

<PropServer> "DefinitionParameters"
<PropTab> "DefinitionParameters"

For Modules and Editors:

<ModuleName>:<ItemName> where <ItemName is the boundary name, solution setup name, etc.
<PropServer>
For example, "BoundarySetup:PerfE1"
Boundary Module: "HfssTab"
Mesh Operations Module: "MeshSetupTab"
Analysis Module: "HfssTab"
Optimetrics Module: "OptimetricsTab"
Solutions Module: Does not support properties.
<PropTab>
Field Overlays Module: "FieldsPostProcessorTab"
Radiation Module: "RadFieldSetupTab"
Circuit Module: "CCircuitTab"
System Module: "SystemTab"
HFSS 3D Layout Module: "HFSS 3D LayoutTab"

Property Script Commands 7-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Nexxim Module: "NexximTab"


Layout elements: "BaseElementTab"
Schematic elements: "ComponentTab"
Optimetrics Module: "OptimetricsTab"

For 3D Model Editor objects:

<PropServer> Name of the object. For example, "Box1".


<PropTab> "Geometry3DAttributeTab"

For 3D Model Editor operations:

<ObjName>:<OperationName>:<int> where <int> is the operation's history index.


<PropServer>
For example, "Box2:CreateBox:2" refers to the second "CreateBox" operation in Box2's history.
<PropTab> "Geometry3DCmdTab"

For Reporter operations on Report properties:

<PropServer> <ReportSetup>
Array. For example, to set the company name in a plot header to "My Company":
Set oModule = oDesign.GetModule("ReportSetup")

<ChangeProperty> oModule.ChangeProperty Array("NAME:AllTabs",_ Array("NAME:Header",_ Array


("NAME:PropServers",_
"XY Plot1:Header"), Array("NAME:ChangedProps",_ Array("NAME:Company Name",
"Value:=", "My Company"))))

Property Script Commands 7-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note:

For scripted property changes in the various modules and editors, refer to the chapters on the System, HFSS 3D Layout,
and Nexxim tools, as well as the Layout and Schematic editors.

ChangeProperty (HFSS and Maxwell)


Use: Changes to properties are scripted using the ChangeProperty command. This command can be executed by the oEditor to
change editor properties, 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 and Maxwell, 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>)

Property Script Commands 7-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<PropServersArray>
Array("Name:PropServers", <PropServer>,
<PropServer>, ...)

<NewPropsArray>
Array("Name:NewProps", <PropDataArray>,
<PropDataArray>,...)

<ChangedPropsArray>
Array("Name:ChangedProps",<PropDataArray>,
<PropDataArray>, ...)

<DeletedPropsArray>
Array("Name:DeletedProps", <PropName>,
<PropName>, ...)

<PropDataArray>
Array("NAME:<PropName>",
"PropType:=", <PropType>,
"NewName:=", <string>,
"Description:=", <string>,

Property Script Commands 7-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NewRowPosition:=", <int>,
"ReadOnly:=", <bool>,
"Hidden:=", <bool>,
<PropTypeSpecificArgs>)

<PropType>
Type: string
Identifies the type of property when a new property is added. In HFSS and Maxwell, only separator properties and variable prop-
erties can be added.
"SeparatorProp"
"VariableProp"
"TextProp"
"NumberProp"
"ValueProp"
"CheckboxProp"
"MenuProp"
"PointProp"
"VPointProp"
"V3DPointProp"
"ButtonProp"

Property Script Commands 7-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

NewName
Specify the new name of a property if the property’s name is being edited. In HFSS and Maxwell, the name can only be
changed for separators and variables.

Description
Specify a description of the property. In HFSS and Maxwell, the description can only be changed for separators and vari-
ables.

NewRowPosition
Used to reorder rows in the Property dialog box.
In HFSS, this only applies to the Project>Project Variables panel and the Hfss>DesignProperties panel.
In Maxwell, this only applies to the Project>Project Variables panel and the Maxwell3D>DesignProperties, Max-
well2D>Design Properties, or RMxprt>Design Properties panels.
Specify the new zero-based row index of the variable or separator.

ReadOnly
Used to mark a property as "read only" so it can not be modified. In HFSS and Maxwell, this flag can only be set for vari-
ables and separators.

Hidden
Used to hide a property so it can not be viewed outside of the Property dialog box. In HFSS and Maxwell, this flag can only
be set for variables and separators.

Property Script Commands 7-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<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>

<PropTypeSpecificArgs> for VariableProps


Syntax:
"Value:=", <value>, <OptimizationFlagsArray>,
<TuningFlagsArray>, <SensitivityFlagsArray>,
<StatisticsFlagsArray>

Property Script Commands 7-20


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters:
<OptimizationFlagsArray>
Array("NAME:Optimization",
"Included:=", <bool>,
"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> )

Property Script Commands 7-21


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<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.

Max

Property Script Commands 7-22


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

High cut-off for the distribution.

Tol
Tolerance for uniform distributions. Format is "<int>%".
Example: "20%".

VB 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"))))

VB Example: Deleting the design level variable "height":


oDesign.ChangeProperty Array("NAME:AllTabs",_
Array("NAME:LocalVariableTab",_

Property Script Commands 7-23


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:PropServers", "DefinitionParameters"),_
Array("NAME:DeletedProps", "height"))

VB Example: Changing a property’s value. If the following command were executed, then the value
of the property "XSize" of the PropServer "Box1:CreateBox:1" on the "Geometry3DCmdTab" tab would
be changed. (oEditor is the Geometry3D editor in HFSS.)
oEditor.ChangeProperty Array("NAME:AllTabs", _
Array("NAME:Geometry3DCmdTab", _
Array("NAME:PropServers","Box1:CreateBox:1"), _
Array("NAME:ChangedProps", _
Array("NAME:XSize", "Value:=", "1.4mil"))))

VB Example: Changing the Company Name, Design Name, the background color, and the Axis scaling in
a Report.
Set oProject = oDesktop.SetActiveProject("wgcombiner")
Set oDesign = oProject.SetActiveDesign("HFSSDesign2")
Set oModule = oDesign.GetModule("ReportSetup")
oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:Header", _
Array("NAME:PropServers", "XY Plot1:Header"), _

Property Script Commands 7-24


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:ChangedProps", Array("NAME:Company Name", _


"Value:=", "My Company"))))
oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:Header", _
Array("NAME:PropServers", "XY Plot1:Header"), _
Array("NAME:ChangedProps", Array("NAME:Design Name", _
"Value:=", "WG Combiner"))))
oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:General", _
Array("NAME:PropServers", "XY Plot1:General"), _
Array("NAME:ChangedProps", Array("NAME:Back Color", _
"R:=", 128, "G:=", 255, "B:=", 255))))
oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:Axis", _
Array("NAME:PropServers", "XY Plot1:AxisX"), _
Array("NAME:ChangedProps", Array("NAME:Axis Scaling", _
"Value:=", "Log"))))

GetArrayVariables
Returns a list of array variables. To get a list of indexed project variables, execute with oProject. To get a list of indexed local vari-
ables, use oDesign.

UI Access N/A
Parameters None.
Return Value Array of strings containing names of variables.

Property Script Commands 7-25


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetArrayVariables()


oProject.GetArrayVariables()
Python Example
oDesign.GetArrayVariables()

VB Syntax GetArrayVariables
oProject.GetArrayVariables
VB Example
oDesign.GetArrayVariables

GetProperties
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.

UI Access N/A

Name Type Description


<PropTab> String One of the following, where tab titles are shown in parentheses:
l PassedParameterTab ("Parameter Values")

Parameters l DefinitionParameterTab (Parameter Defaults")


l LocalVariableTab ("Variables" or "Local Variables")
l ProjectVariableTab ("Project variables")
l ConstantsTab ("Constants")

Property Script Commands 7-26


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l BaseElementTab ("Symbol" or "Footprint")


l ComponentTab ("General")
l Component("Component")
l CustomTab ("Intrinsic Variables")
l Quantities ("Quantities")
Signals ("Signals")
l

<PropServer> String An object identifier, generally returned from another script method, such as
Comp-Inst@R;2;3

Return Value Array of strings containing the names of the appropriate properties.

Python Syntax GetProperties( <PropTab>, <PropServer> )


Python Example oEditor.GetProperties('PassedParameterTab', 'k')

VB Syntax GetProperties <PropTab>, <PropServer>


VB Example oEditor.GetProperties "PassedParameterTab", "k"

GetPropertyValue
Returns the value of a single property belonging to a specific <PropServer> and <PropTab>. This function is available with the Pro-
ject, Design or Editor objects, including definition editors.

Tip:

Use the script recording feature and edit a property, and then view the resulting script to see the format for that property.

Property Script Commands 7-27


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A

Name Type Description


<PropTab> String One of the following, where tab titles are shown in parentheses:
l PassedParameterTab ("Parameter Values")
l DefinitionParameterTab (Parameter Defaults")
l LocalVariableTab ("Variables" or "Local Variables")
l ProjectVariableTab ("Project variables")
l ConstantsTab ("Constants")

Parameters
l BaseElementTab ("Symbol" or "Footprint")
l ComponentTab ("General")
l Component("Component")
l CustomTab ("Intrinsic Variables")
l Quantities ("Quantities")
Signals ("Signals")
l

<PropServer> String An object identifier, generally returned from another script method, such as
Comp-Inst@R;2;3
<PropName> String Name of the property.

Return Value String value of the property.

Python Syntax GetPropertyValue (<PropTab>, <PropServer>, <PropName>)


Python Example selectionArray = oEditor.GetSelections()

Property Script Commands 7-28


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

for k in selectionArray:
val = oEditor.GetPropertyValue("PassedParameterTab", k, "R")
...

VB Syntax GetPropertyValue (<PropTab>, <PropServer>, <PropName>)


selectionArray = oEditor.GetSelections
for k in selectionArray:
VB Example
val = oEditor.GetPropertyValue("PassedParameterTab", k, "R")
...

GetVariables
Returns a list of all defined variables. To get a list of project variables, execute this command using oProject. To get a list of local
variables, use oDesign.

UI Access N/A
Parameters None.
Return Value Array of strings containing the variables.

Python Syntax GetVariables ()


Python Example oProject.GetVariables()

Property Script Commands 7-29


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDesign.GetVariables()

VB Syntax GetVariables
oProject.GetVariables
VB Example
oDesign.GetVariables

GetVariableValue
Gets the value of a single specified variable. To get the value of project variables, execute this command using oProject. To get the
value of local variables, use oDesign.

UI Access N/A

Name Type Description


Parameters
<VarName> String Name of the variable to access.

Return Value String represents the value of the variable.

Python Syntax GetVariableValue( <VarName> )


oProject.GetVariableValue("var_name")
Python Example

VB Syntax GetVariableValue <VarName>

Property Script Commands 7-30


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oProject.GetVariableValue "var_name"

SetPropertyValue
Sets the value of a single propertybelonging to a specific PropServer and PropTab. This function is available with the Project, Design
or Editor objects, including definition editors.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.
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.

UI Access N/A

Name Type Description


<propTab> String One of the following, where tab titles are shown in parentheses:
l PassedParameterTab ("Parameter Values")

l DefinitionParameterTab (Parameter Defaults")

l LocalVariableTab ("Variables" or "Local Variables")

l ProjectVariableTab ("Project variables")


Parameters l ConstantsTab ("Constants")

l BaseElementTab ("Symbol" or "Footprint")

l ComponentTab ("General")

l Component("Component")

l CustomTab ("Intrinsic Variables")

l Quantities ("Quantities")

Property Script Commands 7-31


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l Signals ("Signals")
<propServer> String An object identifier, generally returned from another script method, such as
Comp-Inst@R;2;3
<propName> String Name of the property.
<propValue> String The value for the property

Return Value None.

Python Syntax SetPropertyValue(<propTab>, <propServer>, <propName>, <propValue>)


Python Example oEditor.SetPropertyValue("PassedParameterTab", "k", "R", "2200")

VB Syntax SetPropertyValue <propTab>, <propServer>, <propName>, <propValue>


VB Example oEditor.SetPropertyValue "PassedParameterTab", "k", "R", "2200"

SetVariableValue
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.

UI Access N/A

Name Type Description


Parameters <VarName> String Variable name.
<VarValue> Value New value for the variable.

Property Script Commands 7-32


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax SetVariableValue (<VarName>, <VarValue>)


Python Example oProject.SetVariableValue('$Var1', '3mm')

VB Syntax SetVariableValue <VarName>, <VarValue>


VB Example oProject.SetVariableValue "$Var1", "3mm"

Example Use of Record Script and Edit Properties


A simple way to see how to format the string arguments for a design object or property of interest is to use the script recording com-
mand and then edit the property. Open the script file and look at the oEditor.ChangeProperty entry to see the string arguments.
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("wg_combiner")

Property Script Commands 7-33


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Set oDesign = oProject.SetActiveDesign("HFSSModel1")


Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:Geometry3DAttributeTab", Array
("NAME:PropServers", _
"Polyline1"), Array("NAME:ChangedProps", Array("NAME:Display Wireframe", "Value:=", true), _
Array("NAME:Display Wireframe", "Value:=", false), Array("NAME:Transparent", "Value:=", 0.2))))

Additional Property Scripting Examples


The following is a sample VB script that uses the GetPropertyValue, SetPropertyValue, and GetProperties functions. The script gets
all the properties of the first CreateBox command of "Box1". It then loops through the properties and for each one, shows the user the
current value and asks if the value should be changed.
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",_

Property Script Commands 7-34


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Box1:CreateBox:1", prop, new_val


val = _
oEditor.SetPropertyValue("Geometry3DCmdTab",_
"Box1:CreateBox:1", prop)
MsgBox("Now the value of '" + prop + "' is " + val)
End If
Next
The following is a sample VB script that creates a HFSS 3D Layout design, draws a rectangle in the layout editor and uses the
GetPropertyValue, SetPropertyValue and GetProperties functions. The script gets all properties of the rectangle. It then loops through
the properties and for each one, shows the user the current value and asks if the value should be changed. Note that the last call to
GetPropertyValue in the script will fail if you change the name of the rectangle from the script.
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
'
oDesktop.RestoreWindow
oDesktop.NewProject
Set oProject = oDesktop.GetActiveProject

Property Script Commands 7-35


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

'
' CREATE A RECTANGLE IN HFSS_3D_LAYOUT
'
oProject.InsertDesign "HFSS 3D Layout", "HFSS 3D Layout1", _
"C:\testinstall\Designer\syslib\PCB - SingleSided.asty", ""
Set oDesign = oProject.SetActiveDesign("HFSS 3D Layout1")
Set oEditor = oDesign.SetActiveEditor("Layout")
oEditor.CreateRectangle Array("NAME:Contents", _
"rectGeometry:=", Array("Name:=", _
"rect_1", "LayerName:=", "Top", "lw:=", _
"0mm", "Ax:=", "-22mm", "Ay:=", "20mm", "Bx:=", _
"29mm", "By:=", "-4mm", "ang:=", "0deg"))
'
' GET ALL PROPERTIES OF THE RECTANGLE
'
Dim all_props
Dim prop
Dim val
Dim new_val
'

Property Script Commands 7-36


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

all_props = oEditor.GetProperties("BaseElementTab","rect_1")
'
' LOOP OVER ALL PROPERTIES
'
For Each prop in all_props
val = oEditor.GetPropertyValue("BaseElementTab","rect_1",prop)
'
' DISPLAY VALUE TO THE USER
'
new_val = InputBox("New Value of "+prop+":",_
"Current Value of "+prop+" is "+val,val)
'
' CHANGE THE VALUE IF DESIRED
'
If new_val <> val Then
oEditor.SetPropertyValue _
"BaseElementTab","rect_1",prop,new_val
val = _
oEditor.GetPropertyValue("BaseElementTab","rect_1",prop)
MsgBox("Now the value of "+prop+" is "+val)
End If

Property Script Commands 7-37


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

'
Next
'

Property Script Commands 7-38


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

8 - Dataset Script Commands


Dataset commands should be executed by the oProject object:
Set oProject = oDesktop.SetActiveProject("Project1")
oProject.CommandName <args>
AddDataSet
DeleteDataSet
EditDataSet
ExportDataSet
HasDataSet
ImportDataSet

AddDataset
Adds a dataset. This can be executed by the oProject, or oDesign variables.

UI Access Project > Datasets > Add.

Name Type Description


< Array Array("NAME:<DatasetName>",
DatasetDataArray>
Array("NAME:Coordinates", <CoordinateArray>,
Parameters
<CoordinateArray>, ...)
<DatasetName> String Name of the dataset.
<CoordinateArray> Array Array("NAME:Coordinate", "X:=", <double>, "Y:=",<double>)

Return Value None.

Dataset Script Commands 8-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax AddDataset <DatasetDataArray>


oProject.AddDataset(
[
"NAME:$ds1",
[
"NAME:Coordinates",
[
"NAME:Coordinate",
"X:=", 2,
Python Example "Y:=", 4
],
[
"NAME:Coordinate",
"X:=", 6,
"Y:=", 8
]
]
]

Dataset Script Commands 8-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

)
oDesign.AddDataset(
[
"NAME:$ds1",
[
"NAME:Coordinates",
[
"NAME:Coordinate",
"X:=", 2,
"Y:=", 4
],
[
"NAME:Coordinate",
"X:=", 6,
"Y:=", 8
]
]
]
)

VB Syntax AddDataset <DatasetDataArray>

Dataset Script Commands 8-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oProject.AddDatasetArray("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)))
VB Example
oDesign.AddDatasetArray("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
Deletes a specified dataset. This can be executed by the oProject, or oDesign variables.

UI Access Project > Datasets > Remove.

Name Type Description


Parameters
<DatasetName> String Name of the dataset found in the project.

Return Value None.

Dataset Script Commands 8-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax DeleteDataset (<DatasetName>)


oProject.DeleteDataset('$ds1')
Python Example
oDesign.DeleteDataset('$ds1')

VB Syntax DeleteDataset <DatasetName>


oProject.DeleteDataset "$ds1"
VB Example
oDesign.DeleteDataset "$ds1"

EditDataset
Modifies a dataset. This can be executed by the oProject, or oDesign variables.

UI Access Project > Datasets > Edit.

Name Type Description


Parameters <OriginalName> String Name of the original dataset.
<DatasetDataArray> Array Data for the modified dataset.

Return Value None.

Python Syntax EditDataset (<OriginalName> <DatasetDataArray>)


oProject.EditDataset ("ds1"
Python Example ["NAME:ds2",
["NAME:Coordinates",

Dataset Script Commands 8-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:Coordinate",
"X:=", 1, "Y:=", 2
],
[
"NAME:Coordinate",
"X:=", 3, "Y:=", 4
]
]
]
)
oDesign.EditDataset ("ds1"
["NAME:ds2",
["NAME:Coordinates",
[
"NAME:Coordinate",
"X:=", 1, "Y:=", 2
],
[
"NAME:Coordinate",

Dataset Script Commands 8-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"X:=", 3, "Y:=", 4
]
]
]
)

VB Syntax EditDataset <OriginalName> <DatasetDataArray>


oProject.EditDataset "ds1" Array("NAME:ds2",_
Array("NAME:Coordinates",Array("NAME:Coordinate",
"X:=", 1, "Y:=", 2), Array("NAME:Coordinate",
"X:=", 3, "Y:=", 4)))
VB Example
oDesign.EditDataset "ds1" Array("NAME:ds2",_
Array("NAME:Coordinates",Array("NAME:Coordinate",
"X:=", 1, "Y:=", 2), Array("NAME:Coordinate",
"X:=", 3, "Y:=", 4)))

ExportDataset
Exports a dataset to a named file. This can be executed by the oProject, or oDesign variables.

UI Access Project > Datasets > Export.

Name Type Description


Parameters
<datasetFileFullPath> String The full path to the file.

Dataset Script Commands 8-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax ExportDataset (<datasetFileFullPath>)


oProject.ExportDataset('e:/tmp/dsdata.txt')
Python Example
oDesign.ExportDataset('e:/tmp/dsdata.txt')

VB Syntax ExportDataset <datasetFileFullPath>


oProject.ExportDataset "e:/tmp/dsdata.txt"
VB Example
oDesign.ExportDataset "e:/tmp/dsdata.txt"

HasDataset
Determines whether a specified dataset exists.

UI Access N/A

Name Type Description


Parameters
<datasetName> String Name of the specified dataset.

Integer:

Return Value l 1 - dataset exists.

l 0 - dataset does not exist.

Dataset Script Commands 8-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax HasDataset (<datasetName>)


Python Example oDesign.HasDataset('$ds1')

VB Syntax HasDataset <datasetName>


VB Example oDesign.HasDataset "$ds1"

ImportDataset
Imports a dataset from a named file. This can be executed by the oProject, or oDesign variables. The name of the dataset is file-
name+index number (e.g., dsdata1) unless the filename ends with a trailing number. When there is a trailing number at the end, we
will remove the number and use first unused index.

UI Access Project > Datasets > Import.

Name Type Description


Parameters
<datasetFileFullPath> String The full path to the file containing the dataset values.

Return Value None.

Tab-delimited or space-delimited files with the extension ".tab" is the recommended file type to be used.
For importing datasets at the Design level, this is the only file type supported.
At the Project level, other file types (e.g., ".csv") are supported. However, after calling the command, you must configure the file import
format manually through the GUI as shown in the figure below.

Dataset Script Commands 8-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ImportDataset (<datasetFileFullPath>)


Python Example oProject.ImportDataset('e:\tmp\dsdata.tab')

Dataset Script Commands 8-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDesign.ImportDataset('e:\tmp\dsdata.tab')

VB Syntax ImportDataset <datasetFileFullPath>


oProject.ImportDataset "e:\tmp\dsdata.tab"
VB Example
oDesign.ImportDataset "e:\tmp\dsdata.tab"

Dataset Script Commands 8-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

8-12
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

9 - Design Object Script Commands


Design object commands should be executed by the oDesign object.
oDesign.CommandName <args>
For example:
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Conventions Used in this Chapter
<ModuleName> is a placeholder for any one of the following modules:
l Analysis Module – "AnalysisSetup"
l Boundary Module – "BoundarySetup"
l Field Overlays Module – "FieldsReporter"
l Mesh Module – "MeshSetup"
l Optimetrics Module – "Optimetrics"
l Radiation Module – "RadField"
l Radiation Setup Manager Module – "RadiationSetupMgr"
l Reduce Matrix Module – "ReduceMatrix"
l Reporter Module – "ReportSetup"
l Simulation Setup Module – "SimSetup"
l Solutions Module – "Solutions"

AddDesignVariablesForDynamicLink
AnalyzeDistributed
ApplyMeshOps

Design Object Script Commands 9-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AssignDCThickness
ClearLinkedData
ConstructVariationString
DeleteFieldVariation
DeleteFullVariation
DeleteLinkedDataVariation
EditDesignSettings
EditLayoutForLayoutComponent
EditNotes
ExportConvergence
ExportForHSpice
ExportNMFData
ExportMatrixData
ExportMeshStats
ExportNetworkData
ExportProfile
ExportReport
GenerateMesh
GetActiveEditor
GetAllPorts

Design Object Script Commands 9-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetChildNames [Design]
GetChildObject [Design]
GetChildTypes [Design]
GetConfigurableData
GetData
GetDesignName
GetDesignType
GetDesignValidationInfo
GetEditSourcesCount
GetManagedFilesPath
GetModule
GetName
GetNominalVariation
GetNoteText
GetPostProcessingVariables
GetPropNames [Design]
GetPropValue [Design]
GetSelections
GetSolutionType
GetSolveInsideThreshold
PasteDesign

Design Object Script Commands 9-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Redo
RemoveModelingProperties
RenameDesignInstance
RenameSource
ReportTemplates
RunToolkit
SARSetup
SetActiveEditor
SetDesignSettings
SetLengthSettings
SetObjectAttributesForLayoutComponents
SetObjectDeformation
SetObjectTemperature
SetPhaseCenterPerPort
SetPropValue [Design]
SetPropertyValue
SetShowLayoutForLayoutComponent
SetSinglePhaseCenter
SetSolutionType
SetSolveInsideThreshold

Design Object Script Commands 9-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetSourceContexts
Solve
StartAnalysis
StopSimLink
Undo
ValidateCircuit
ValidateDesign
ValidateLink

AddDataset
Adds a dataset. This can be executed by the oProject, or oDesign variables.

UI Access Project > Datasets > Add.

Name Type Description


< Array Array("NAME:<DatasetName>",
DatasetDataArray>
Array("NAME:Coordinates", <CoordinateArray>,
Parameters
<CoordinateArray>, ...)
<DatasetName> String Name of the dataset.
<CoordinateArray> Array Array("NAME:Coordinate", "X:=", <double>, "Y:=",<double>)

Return Value None.

Python Syntax AddDataset <DatasetDataArray>


Python Example oProject.AddDataset(

Design Object Script Commands 9-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:$ds1",
[
"NAME:Coordinates",
[
"NAME:Coordinate",
"X:=", 2,
"Y:=", 4
],
[
"NAME:Coordinate",
"X:=", 6,
"Y:=", 8
]
]
]
)
oDesign.AddDataset(
[
"NAME:$ds1",

Design Object Script Commands 9-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:Coordinates",
[
"NAME:Coordinate",
"X:=", 2,
"Y:=", 4
],
[
"NAME:Coordinate",
"X:=", 6,
"Y:=", 8
]
]
]
)

VB Syntax AddDataset <DatasetDataArray>


oProject.AddDatasetArray("NAME:ds1",
Array("NAME:Coordinates",
VB Example
Array("NAME:Coordinate", "X:=", 1, "Y:=", 2,
Array("NAME:Coordinate", "X:=", 3, "Y:=", 4),

Design Object Script Commands 9-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Coordinate", "X:=", 5, "Y:=", 7),


Array("NAME:Coordinate", "X:=", 6, "Y:=", 20)))
oDesign.AddDatasetArray("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)))

AddDesignVariablesForDynamicLink
Creates design variables based on any in a Circuit, HFSS, 3D Layout, Q3D, or 2D extractor project that is connected to a Circuit or 3D
Layout design through a dynamic link.

l In the Schematic Editor or Layout Editor, right click the new instance of the linked design and click Add
Design Variables for Dynamic Link.
UI Access
l In the Project Manager, right click on [Project Name] > [Design Name] > [Dynamic Link Design] and
click Add Design Variables for Dynamic Link.

Name Type Description


Parameters
<InstanceID> String Instance ID for the dynamic link component

Return Value None

Design Object Script Commands 9-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax AddDesignVariablesForDynamicLink (<InstanceID>)


oDesign = oProject.SetActiveDesign("Circuit1")
Python Example
oDesign.AddDesignVariablesForDynamicLink ("6")

VB Syntax AddDesignVariablesForDynamicLink <InstanceID>


Set oDesign = oProject.SetActiveDesign("Circuit1")
VB Example
oDesign.AddDesignVariablesForDynamicLink "6"

AddModelingProperties
Use: Add a modeling property to a design
Command: None
Syntax: AddModelingProperties <design>
Return Value: None
Parameters: <design>
Type: string
VB Example: oDesign.AddModelingProperties <design>

Analyze
Solves a single solution setup and all of its frequency sweeps.

UI Access Right-click a solution setup in the project tree, and select Analyze.

Parameters Name Type Description

Design Object Script Commands 9-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<setup> String Setup name.

Integer value:
Return Value l 0 – Success
l Else – Error

Python Syntax Analyze (<setup>)


Python Example oDesign.Analyze("Setup1")

VB Syntax Analyze <setup>


VB Example oDesign.Analyze "Setup1"

AnalyzeAll [design]
Runs all solution setups and Optimetrics setups for the current design instance.

UI Access N/A
Parameters None.
Return Value None.

Design Object Script Commands 9-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax AnalyzeAll()


Python Example oDesign.AnalyzeAll()

VB Syntax AnalyzeAll
VB Example oDesign.AnalyzeAll

AnalyzeAllNominal
Runs all defined setups.

UI Access Right-click Analysis in the project tree, and select Analyze All.
Parameters None.
Return Value None.

Python Syntax AnalyzeAllNominal()


Python Example oDesign.AnalyzeAllNominal()

VB Syntax AnalyzeAllNominal
VB Example oDesign.AnalyzeAllNominal

Design Object Script Commands 9-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AnalyzeDistributed
Performs a distributed analysis.

UI Access N/A

Name Type Description


Parameters
<SetupName> String String name of the setup to be analyzed.

Integer value:
Return Value l 0 – Success
l Else – Error

Python Syntax AnalyzeDistributed(<SetupName>)


Python Example oDesign.AnalyzeDistributed('Setup1')

VB Syntax AnalyzeDistributed <SetupName>


VB Example oDesign.AnalyzeDistributed "Setup1"

ApplyMeshOps
If any mesh operations 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.

Design Object Script Commands 9-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Important:

This is a legacy script. Use GenerateMesh instead.

UI Access HFSS > Analysis Setup > Generate Mesh.

Name Type Description


Parameters
<SetupNameArray> Array Array containing the string names of setups.

Integer value:
Return Value l 0 – Success
l Else – Error

Python Syntax ApplyMeshOps(<SetupNameArray>)


Python Example oDesign.ApplyMeshOps(['Setup1','Setup2'])

VB Syntax ApplyMeshOps(<SetupNameArray>)
VB Example status = oDesign.ApplyMeshOps Array("Setup1","Setup2")

AssignDCThickness
Assigns DC thickness to more accurately compute DC resistance of a thin conducting object for which Solve Inside is not selected.

UI Access HFSS > Boundaries > Assign DC Thickness.

Design Object Script Commands 9-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<objectNameArray> Array Array containing string object name(s). These objects will have their
thickness changed.
<thicknessValueArray> Array Array containing string thickness values, including units. The values
are applied to the objects in the objectNameArrray, in order (the first
Parameters object receives the first value, the second object the second value, and
so on). An empty string leaves the value as-is.
Alternately, can be string "Infinite" for infinite thickness or "Effective" to
have it calculated automatically.
<enableAuto> String "EnableAuto" or "DisableAuto". Omitting this string leaves the selection
unchanged from its current setting.

Return Value None.

Python Syntax AssignDCThickness (<objectNameArray>, <thicknessValueArray>, <enableAuto>)


oModule.AssignDCThickness(
[
"pad1",
"pin1",
Python Example "pad2",
"pad3",
"pad4",
"pin2",
"pin3",

Design Object Script Commands 9-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"pin4",
"gnd"
],
[
"1mm",
"\"<Infinite>\"",
"\"<Effective>\"",
"2mm",
"\"<Infinite>\"",
"\"<Effective>\"",
"3mm",
"\"<Infinite>\"",
"\"<Effective>\""
],
"EnableAuto"
)

VB Syntax AssignDCThickness <objectNameArray>,<thicknessValueArray>, <enableAuto>


oModule.AssignDCThickness
VB Example Array("pad1", "pin1", "pad2", "pad3", "pad4", "pin2", "pin3", "pin4", "gnd"),
Array("2mm",

Design Object Script Commands 9-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"" & Chr(34) & "<Effective>" & Chr(34) & "",


"" & Chr(34) & "<Infinite>" & Chr(34) & "",
"1mm", "" & Chr(34) & "<Infinite>" & Chr(34) & "",
"" & Chr(34) & "<Effective>" & Chr(34) & "",
"3mm", "" & Chr(34) & "<Infinite>" & Chr(34) & "",
"" & Chr(34) & "<Effective>" & Chr(34) & ""),
"EnableAuto"

ChangeProperty[ReportSetup]
Change the properties for a Report.

UI Access Double-click on a report to change its properties.

Name Type Description


Parameters <PropertyArray> Array Varies, depending on the properties associated with the select object com-
mand.

Return Value None.

Python Syntax ChangeProperty(<PropertyArray>)


oModule = oDesign.GetModule("ReportSetup")
Python Example oModule.ChangeProperty(
[

Design Object Script Commands 9-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:AllTabs",
[
"NAME:General",
[
"NAME:PropServers",
"XY Plot 1:General"
],
[
"NAME:ChangedProps",
[
"NAME:Use Scientific Notation",
"Value:=", True
]
]
]
])

oModule = oDesign.GetModule("ReportSetup")
oModule.ChangeProperty(
[
"NAME:AllTabs",

Design Object Script Commands 9-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:Legend",
[
"NAME:PropServers",
"S Parameter Plot 1:Legend"
],
[
"NAME:ChangedProps",
[
"NAME:Legend Name",
"Value:=" , "Ansys"
]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:General",

Design Object Script Commands 9-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:PropServers",
"S Parameter Plot 1:General"
],
[
"NAME:ChangedProps",
[
"NAME:Auto Scale Fonts",
"Value:=" , False
]
]
]
])

VB ChangeProperty <PropertyArray>
Syntax

oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:Cartesian", Array


("NAME:PropServers", _
VB "XY Plot 1:CartesianDisplayTypeProperty"), Array("NAME:ChangedProps", Array("NAME:Show X
Examp- Scrollbar", "Value:=", _
le
true))))
oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:General", Array("NAME:PropServ-

Design Object Script Commands 9-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ers", _
"XY Plot 1:General"), Array("NAME:ChangedProps", Array("NAME:Use Scientific Notation",
"Value:=", _
true))))

ClearLinkedData (Design)
Clear the linked data of all the solution setups. Similar to the ClearLinkedData command for the module level.

UI Access [Product] > Analysis Setup > Clear Linked Data.


Parameters None.
Return Value None.

Python Syntax ClearLinkedData()


Python Example oDesign.ClearLinkedData()

VB Syntax ClearLinkedData
VB Example oDesign.ClearLinkedData

ConstructVariationString
Lists and orders the variables and values associated with a design variation.

Design Object Script Commands 9-20


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A

Name Type Description


Parameters
<ArrayOfVariableNames> Array of Strings List of variable names.
<ArrayOfVariableValuesIncludingUnits> Array of Strings List of variable values, including units, in
the same order as the list of names.

Returns variation string with the variables ordered to correspond to the order of variables in design variations.
Return Value The values for the variables are inserted into the variation string. For an example of how Con-
structionVariationString can be used, see the Python example.

Python Syntax ConstructVariationString(<ArrayOfVariableNames>, <ArrayOfVariableValuesIncludingUnits>)


varStr = oDesign.ConstructVariationString(["xx", "yy"], ["2mm", "1mm"])
Python Example
oDesign.ExportProfile("Setup1", varStr, "C:\profile.prof")

VB Syntax ConstructVariationString <ArrayOfVariableNames>, <ArrayOfVariableValuesIncludingUnits>


VB Example oDesign.ConstructVariationString Array("x_size","y_size"), Array("2mm", "1mm")

CopyItemCommand
Use: Copy tree items, such as Altrasim Solution Setups in Nexxim, or Solve Setups and Frequency Sweeps in Ensemble.
Command: None
Syntax: CopyItemCommand <ItemPathList>
Return Value: None
Parameters: <ItemPathList>

Design Object Script Commands 9-21


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Type: Array of strings


VB Example: oDesign.CopyItemCommand Array("Project1|Nexxim1|Analysis|DCAnalysis2")

CreateEMLossTarget
CreateEMLossTarget creates a target Icepak or Mechanical design from a source HFSS, Q3D, or Maxwell design.

UI Access Design Type > Create Target Design

Name Type Description


Icepak only:<Setup1 > int NA
Parameters
Icepak only: <NAME> string DesignSetup
Icepak only:<Sim Type> string Forced or Natural

Return Value placeholder

Python Syntax CreateEMLossTarget (<Setup1 >, <NAME>, <Sim Type>)


oDesign.CreateEMLossTarget("Icepak", "Setup1 : LastAdaptive",
[
Python Example "NAME:DesignSetup",
"Sim Type:=" , "Forced"
])

VB Syn- CreateEMLossTarget (<Setup1 >, <NAME>, <Sim Type>)


tax

VB oDesign.CreateEMLossTarget "Icepak", "Setup1 : LastAdaptive", Array

Design Object Script Commands 9-22


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

("NAME:DesignSetup",
Example
"Sim Type:=", _"Forced")
y, I

CreateReport
Creates a new report with a single trace and adds it to the Results branch in the project tree.

UI Access Right-click on Results > Create [Type] Report

Name Type Description


<ReportName> String Name of report.
<ReportType> String Type of report.
Possible values are:
"Modal S Parameters" - Only for Driven Modal solution-type prob-
lems with ports.
"Terminal S Parameters" - Only for Driven Terminal solution-type
problems with ports.

Parameters "Eigenmode Parameters" - Only for Eigenmode solution-type prob-


lems.
"Fields"
"Far Fields" - Only for problems with radiation or PML boundaries.
"Near Fields" - Only for problems with radiation or PML boundaries.
"Emission Test"
<DisplayType> String Type of display.
If ReportType is "Modal S Parameters", "Terminal S Parameters", or
"Eigenmode Parameters", then set to one of the following:

Design Object Script Commands 9-23


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Rectangular Plot", "Polar Plot", "Radiation Pattern",


"Smith Chart", "Data Table", "3D Rectangular Plot",
"3D Rectangular Bar Plot" or "3D Polar Plot".
If <ReportType> is "Fields", then set to one of the following:
"Rectangular Plot", "Polar Plot", "Radiation Pattern",
"Rectangular Contour Plot", "Data Table", "3D Rect-
angular Plot", or "3D Rectangular Bar Plot".
If <ReportType> is "Far Fields" or "Near Fields", then set to one of the fol-
lowing:
"Rectangular Plot", "Radiation Pattern", "Rectangular
Contour Plot" "Data Table",
"3D Rectangular Plot", "3D Rectangular Bar Plot" or
"3D Polar Plot"
If <ReportType> is "Emission Test", then set to one of the following:
"Rectangular Plot" or "Data Table"
<SolutionName> String Name of the solution as listed in the Modify Report dialog box.
<ContextArray> Array 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> Array Contains sweep definitions for the report.

Design Object Script Commands 9-24


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("<VariableName>:= ", <ValueArray>)


<ValueArray>
Array("All") or Array("Value1", "Value2", ..."Valuen")
examples of <VariableName> "Freq", "Theta", "Distance"
<ReportDataArray> Array This array contains the report quantity and X, Y, and (Z) axis definitions.
Array("X Component:=", <VariableName>, "Y Com-
ponent:=", <VariableName> | <ReportQuantityArray>)
<ReportQuantityArray>
ex. Array("dB(S(Port1, Port1))")

Return Value None.

CreateReport(<ReportName>, <ReportType>, <DisplayType>,


Pytho-
n Syn- <SolutionName>, <ContextArray>, <FamiliesArray>,
tax
<ReportDataArray>, <ExtendedInfo>)
Three examples are given below:(nominal, Optimetrics, spectral)
Nominal Example:

Pytho- oModule.CreateReport( "XY Plot 2", "Standard",_


n "Rectangular Plot", "TR", ["NAME:Context",_
Exam-
ple "SimValueContext:=", [] 1, 0, 2, 0, false,_
false, -1, 1, 0, 1, 1, "", 0, 0]], ["Time:=",_
["All"], "aaa:=", ["Nominal"]]_

Design Object Script Commands 9-25


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["X Component:=", "Time", "Y Component:=",_


["E1.I"]][])

Optimetrics Example:
oModule.CreateReport ("XY Plot 3", "Standard",_
"Rectangular Plot", "TR", ["NAME:Context",_
"OptiSetup:=", "ParametricSetup1", "SimValueCon
[1, 0, 2, 0, false, false, 0, 1, _
0, 1, 1, "", 0, 0]], ["Time:=", ["All"],_
"aaa:=", ["Nominal"]], ["X Component:=",_
"Time", "Y Component:=", ["E1.I"]], [])

Spectral Example:
oModule.CreateReport ("XY Plot 4", "Standard",_
"Rectangular Plot", "TR", ["NAME:Context",_
"SimValueContext:=", [ 2, 0, 2, 0, false, false
-1, 1, 0, 1, 1, "", 0, 0, "CG", false, "0", "KP
false, "0", "MH", false, "100", "TE", false, "4
"TH", false, "40", "TS", false, "0ns", "UF", fa
"0", "WT", false, "0", "WW", false, "100"]],_
["Spectrum:=", ["All"], "aaa:=",_

Design Object Script Commands 9-26


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["Nominal"]], ["X Component:=","Spectrum", _


"Y Component:=", ["mag(E1.I)"]], [])

Partial Discharge Example


oModule.CreateReport("Partial Discharge Plot 2", "Partial Discharge", "Rectangular Plot",
"PartialDischarge1 : PartialDischarge", [],
[
"GasPressure:=" , ["All"],
"Freq:=" , ["All"],
"bend_angle:=" , ["All"]
],
[
"X Component:=" , "GasPressure",
"Y Component:=" , ["Power"]
])
Example 3D Rectangular Bar Plot with Change Bar properties
oModule = oDesign.GetModule("ReportSetup")
oModule.CreateReport("S Parameter Plot 4", "Modal Solution Data", "3D Rectangular Bar
Plot", "Setup1 : Sweep", [],
[
"Freq:=" , ["All"],
"UU:=" , ["All"],
"ZZZ:=" , ["Nominal"]

Design Object Script Commands 9-27


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

],
[
"X Component:=" , "Freq",
"Y Component:=" , "UU",
"Z Component:=" , ["dB(S(wDipole1_1_p1,wDipole1_1_p1))"]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Transparency",
"Value:=" , "0.5"

Design Object Script Commands 9-28


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Filled",
"Value:=" , False
]
]
]

Design Object Script Commands 9-29


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Filled",
"Value:=" , True
]
]
]
])
oModule.ChangeProperty(

Design Object Script Commands 9-30


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Show Outline",
"Value:=" , True
]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[

Design Object Script Commands 9-31


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Outline Color",
"R:=" , 0,
"G:=" , 0,
"B:=" , 160
]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[

Design Object Script Commands 9-32


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Outline Width",
"Value:=" , "2"
]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",

Design Object Script Commands 9-33


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"


],
[
"NAME:ChangedProps",
[
"NAME:Bar Width",
"Value:=" , "Narrow"
]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],

Design Object Script Commands 9-34


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:ChangedProps",
[
"NAME:Bar Width",
"Value:=" , "Wide"
]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[

Design Object Script Commands 9-35


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:Bar Infinity",
"Value:=" , True
]
]
]
])

CreateReport <ReportName>, <ReportType>, <DisplayType>,


VB Syn-
<SolutionName>, <ContextArray>, <FamiliesArray>,
tax
<ReportDataArray>, <ExtendedInfo
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"), _
VB
"Freq:=", Array("10GHz")), _
Example
Array("X Component:=", "Theta", _
"Y Component:=", "Phi", _
"Z Component:=", Array("rETotal")), _
Array()

Design Object Script Commands 9-36


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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()
oModule.CreateReport "Rectangular Contour Plot 2", "Far Fields", _
"Rectangular Contour Plot", "Setup1 : LastAdaptive", Array("Context:=", _
"Infinite Sphere1"), Array("_u:=", Array("All"), "_v:=", Array("All"), "Freq:=",
Array( _
"5GHz")), Array("X Component:=", "_u", "Y Component:=", "_v", "Z Component:=", Array
( _
"rETotal")), Array()
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,LumpPort1))")), _
Array()

Design Object Script Commands 9-37


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

DeleteDataset
Deletes a specified dataset. This can be executed by the oProject, or oDesign variables.

UI Access Project > Datasets > Remove.

Name Type Description


Parameters
<DatasetName> String Name of the dataset found in the project.

Return Value None.

Python Syntax DeleteDataset (<DatasetName>)


oProject.DeleteDataset('$ds1')
Python Example
oDesign.DeleteDataset('$ds1')

VB Syntax DeleteDataset <DatasetName>


oProject.DeleteDataset "$ds1"
VB Example
oDesign.DeleteDataset "$ds1"

DeleteFieldVariation
Deletes field variations, fields and meshes, or fields and meshes for specified variations.

UI Access [Solver] > Results > Clean Up Solutions > [Fields Only / Fields and Meshes].

Design Object Script Commands 9-38


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<variationKeys> Array Array containing either "All" string to select all variations, or strings of vari-
ations to include.
Parameters
<deleteMesh> Boolean When true, deletes mesh data.
<deleteLinkedData> Boolean When true, deletes linked data.
<preserveRadFields> Boolean (Optional). When true, preserves radiated fields data.

Return Value None.

Python Syntax DeleteFieldVariation(<variationKeys>, <deleteMesh>, <deleteLinkedData>, <preserveRadFields>)


oProject = oDesktop.GetActiveProject()
oDesign = oProject.GetActiveDesign()
Python Example
Design.DeleteFieldVariation(['All'], True, False, False)

VB Syntax DeleteFieldVariation <variationKeys>, <deleteMesh>, <deleteLinkedData>, <preserveRadFields>


Set oProject = oDesktop.SetActiveProject "OptimTee"
Set oDesign = oProject.SetActiveDesign "TeeModel"
VB Example
oDesign.DeleteFieldVariation Array("offset=" &
Chr(39) & "0.0947046688081817in" & Chr(39) & ""), true, false, true

DeleteFullVariation
Deletes either all solution data, or selected variation data.

UI Access [HFSS] > Results > Clean Up Solutions.

Design Object Script Commands 9-39


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


Parameters
<variationKeys> Array Array containing either "All" string to select all variations, or strings of vari-
ations to include.
<deleteLinkedData> Boolean When true, deletes linked data as well.

Return Value None.

Python Syntax DeleteFullVariation(<variationKeys>, <deleteLinkedData>)


Python Example oDesign.DeleteFullVariation(['All']), false)

VB Syntax DeleteFullVariation <variationKeys>, <deleteLinkedData>


VB Example oDesign.DeleteFullVariation Array('All'), false

DeleteLinkedDataVariation
Deletes the linked data of specified variations.

UI Access [HFSS] > Results > Clean Up Solutions.

Name Type Description


Parameters <DesignVariationKeys> Array Array containing strings of the variations keys whose linked data are going
to be deleted.

Return Value None.

Design Object Script Commands 9-40


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax DeleteLinkedDataVariation(<DesignVariationKeys>)


Python Example oDesign.DeleteLinkedDataVariation(["current=\'0.9mA\'", "current=\'1.0mA\'"])

VB Syntax DeleteLinkedDataVariation <DesignVariationKeys>


VB Example oDesign.DeleteLinkedDataVariation Array("current=\'0.9mA\'", "current=\'1.0mA\'")

DeleteOutputVariable
Deletes an existing output variable. The variable can only be deleted if it is not in use by any traces.

UI Access HFSS > Results > Output Variables. In the Output Variables window, click Delete.

Name Type Description


Parameters
<OutputVarName> String Name of the output variable.

Return Value None.

Python Syntax DeleteOutputVariable (<OutputVarName>)


oModule = oDesign.GetModule("OutputVariable")
Python Example
oModule.DeleteOutputVariable ("testNew")

VB Syntax DeleteOutputVariable <OutputVarName>


VB Example Set oModule = oDesign.GetModule("OutputVariable")

Design Object Script Commands 9-41


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.DeleteOutputVariable "testNew"

DeleteSolutionVariation
Deletes all solution data for specific solutions and design variations. This is obsolete and is supported only for backward compatibility.
You should use DeleteFullVariation, DeleteFieldVariation, and DeleteLinked Variation.

UI Access Right-click on Results, select Browse Solutions..., click Delete button in the dialog.

Name Type Description


<SoluParams> Array Structured array.
Array(<DataSpecifierArray>, ...)
Parameters
<DataSpecifierArray> Array Structured array.
Array(<DesignVariationKey>, <SetupName>, <Sol-
nName>)

Return Value None.

Python Syntax DeleteSolutionVariation(<SoluParams>)


oModule.DeleteSolutionVariation([
["width=’2in’", "Setup1", "Adaptive_1"],
Python Example
["width=’2in’", "Setup1", "Sweep1"]
])

Design Object Script Commands 9-42


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax DeleteSolutionVariation <SoluParams>


oModule.DeleteSolutionVariation Array( _
VB Example Array("width=’2in’", "Setup1", "Adaptive_1"), _
Array("width=’2in’", "Setup1", "Sweep1"))

DeleteOutputVariable
Deletes an existing output variable. The variable can only be deleted if it is not in use by any traces.

UI Access HFSS > Results > Output Variables. In the Output Variables window, click Delete.

Name Type Description


Parameters
<OutputVarName> String Name of the output variable.

Return Value None.

Python Syntax DeleteOutputVariable (<OutputVarName>)


oModule = oDesign.GetModule("OutputVariable")
Python Example
oModule.DeleteOutputVariable ("testNew")

VB Syntax DeleteOutputVariable <OutputVarName>


Set oModule = oDesign.GetModule("OutputVariable")
VB Example
oModule.DeleteOutputVariable "testNew"

Design Object Script Commands 9-43


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

DistributeAnalysis
Performs a distributed analysis.

UI Access N/A

Name Type Description


Parameters
<SetupName> String String name of the setup to be analyzed.

Integer value:
Return Value l 0 – Success
l Else – Error

Python Syntax DistributeAnalysis(<SetupName>)


Python Example oDesign.DistributeAnalysis('Setup1')

VB Syntax DistributeAnalysis <SetupName>


VB Example oDesign.DistributeAnalysis "Setup1"

EditCoSimulationOptions
Sets options for cosimulation.
Command: None
Syntax: EditCoSimulationOptions <array_name>

Design Object Script Commands 9-44


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value: None


Parameters: <array_name>
Type: string
oDesign.EditCoSimulationOptions Array("NAME:CoSimOptions",
"Override:=", true, _
"Setup:=", "Setup 1", _
"OverrideSweep:=", true, _
"Sweep:=", "Sweep 1", _
"SweepType:=", 4, _
"Interpolate:=", false, _
"YMatrix:=", true, _
"AutoAlignPorts:=", false, _
"InterpAlg:=", "auto")

EditDesignSettings
Edits design settings.

UI Access [HFSS] > Design Settings.

Name Type Description


<overrideArray> Array Structured array.

Parameters For HFSS design:


Array("NAME:Design Settings Data",
"Use Advanced DC Extrapolation:= <Boolean>,

Design Object Script Commands 9-45


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Port Validation Settings=: ["Standard" | "Extended"]


"Calculate Lossy Dielectrics:=", <Boolean>)
"Use Power S:=", <Boolean>,
"Export After Simulation:=", <boolean>, "Export
Dir:=", "<path>",
"Allow Material Override:=", <boolean>,
"Calculate Lossy Dielectrics:=", <boolean>,
"EnabledObjects:=", Array(),
"Model validation Settings:=", Array("NAME:Validation
Options",
"EntityCheckLevel:=", "[strict | none | warningOnly |
basic ]",
"IgnoreUnclassifiedObjects:=", <boolean>,
"SkipIntersectionChecks:=", <boolean>),
"Design Validation Settings:=", "Perform full val-
idations" )
For HFSS-IE design:
Array("NAME:Design Settings Data",
"Allow Material Override:=", <boolean>,
"Calculate Lossy Dielectrics:=", <boolean>,
"Perform Minimal validation:=", <boolean>,
"PECThreshold:=", <real>, "CondThreshold:=", <int>),

Design Object Script Commands 9-46


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Model Validation Settings", "EntityCheck-


Level:=", [strict | none | warningOnly | basic ]",
"IgnoreUnclassifiedObjects:=", <boolean>,
"SkipIntersectionChecks:=", <boolean>)

Return Value None.

Python Syntax EditDesignSettings(<overrideArray>)


oDesign.EditDesignSettings(
[
"NAME:Design Settings Data",
"Use Advanced DC Extrapolation:=", True,
"Use Power S:=" , False,
"Export After Simulation:=", False,
"Allow Material Override:=", True,
Python Example
"Calculate Lossy Dielectrics:=", True,
"Perform Minimal validation:=", False,
"EnabledObjects:=" , [],
"Port Validation Settings:=", "Standard"
],
[
"NAME:Model Validation Settings",

Design Object Script Commands 9-47


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"EntityCheckLevel:=" , "Strict",
"IgnoreUnclassifiedObjects:=", False,
"SkipIntersectionChecks:=", False,
"SkipMeshChecks:=", True
])

VB Syntax EditDesignSettings <overrideArray>


Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
oDesign.EditDesignSettings Array("NAME:Design Settings Data", "Use Advanced DC
Extrapolation:=", _
false, "Use Power S:=", false, "Export After Simulation:=", false, "Allow Mater-
ial Override:=", _
VB Example
true, "Calculate Lossy Dielectrics:=", true, "Perform Minimal validation:=", _
false, "EnabledObjects:=", Array(), "Port Validation Settings:=", "Standard"),
Array("NAME:Model Validation Settings", "EntityCheckLevel:=", _
"Strict", "IgnoreUnclassifiedObjects:=", true, "SkipIntersectionChecks:=", _
false)

Design Object Script Commands 9-48


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditImportData
Use: Edit an imported solution
Command: None
Syntax: EditImportData <oldname> <newlink> <newpath> <newname> <data> <file>
Return Value: None
Parameters: <oldname>
Type: string
<newlink>
<newpath>
Type: string
<newname>
Type: string
<data>
Type: array
<file>
Type: string
VB Example: oDesign.EditImportData <oldname> <newlink> <newpath> <newname> <data> <file>

EditInfiniteArray
Edits the properties of an infinite array
Command: None
Syntax: EditInfiniteArray <array_name>

Design Object Script Commands 9-49


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value: None


Parameters: <array_name>
Type: string
VB Example: oDesign.EditInfiniteArray <array_name>
t

Edit (Layout Editor)


Use: Causes modification of one or more existing object(s).
Syntax: Edit <Array("NAME:items".....)>,
Parameters: <Array("NAME:items"
<edit_object_info>, // one object info
<edit_object_info>, // another one
…) // etc
<edit_object_info>:
Array("NAME:item",
"name:=", <object_name>, // name of the object
<object_description>) // ‘new’ object state, type should be consistent with <object_name>:

<object_description>:
<circle_description> |
<rectangle_description> |
<line_description> |

Design Object Script Commands 9-50


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<polyon_description> |
<text_description> |
<circle_void_description> |
<rectangle_void_description> |
<line_void_description> |
<polyon_void_description> |
<component_description> |
<pin_description> |
<via_description>
VB Example:
oEditor.Edit Array("NAME:items", Array("NAME:item",
"name:=", "circle_0", Array("NAME:contents",
"circleGeometry:=", Array("Layer:=", 6,
"Name:=", "circle_0", "LayerName:=", "Top",
"lw:=", "0mm", "x:=", "-0.008meter",
"y:=", "13.2924281984334mm", "r:=", 10.2924281984334mm")))

ua

EditLayoutForLayoutComponent
Opens the definition component for editing in HFSS 3D Layout for a Layout Component in an HFSS 3D design.

UI Access Edit Layout...

Design Object Script Commands 9-51


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


Parameters
<ComponentDefinitionName> String Name of the Layout Component Definition.

Return Value None.

EditLayoutForLayoutComponent ([Name:LayoutComponent EDB", Definitions:=",


Python Syntax
[<ComponentDefinitionName> ])
oDesign.EditLayoutForLayoutComponent (
[
Python Example "NAME:Layout Component EDB",
"Definitions:=" , ["Diff_Via_diffViaNominal"]
])

EditNotes
Updates the notes for the design.

UI Access HFSS > Edit Notes.

Name Type Description


Parameters
<DesignNotes> String New design notes that are applied, replacing any current notes.

Return Value None.

Design Object Script Commands 9-52


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax EditNotes(<DesignNotes>)


Python Example oDesign.EditNotes("My design notes.")

VB Syntax EditNotes <DesignNotes>


VB Example oDesign.EditNotes "My design notes."

EditNotes [HFSS 3D Layout]


Edits the notes of a design
Command: None
Syntax: EditNotes <design_name>
Return Value: None
Parameters: <design_name>
Type: string
VB Example: oDesign.EditNotes <design_name>

EditOptions [HFSS 3D Layout]


Edits the properties of an infinite array
Command: None
Syntax: EditOptions <array_name>
Return Value: None
Parameters: <array_name>

Design Object Script Commands 9-53


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Type: string
VB Example: oDesign.EditOptions <array_name>

EMDesignOptions
Use: Set options for an EM Design.
Command: Right click on design and select EM Design Options
Syntax: DesignOptions <Options Array>
Return Value: None
Parameters:
<Options Array>

Array("NAME:options",
"SaveSolFilesAsBinary:=", <boolean>,
"LowPriorityForSimulations:=", <boolean>,
"SaveNearFieldSolutions:=", <boolean>,
"SchematicEnabled:=", <boolean>,
"UseGlobalNumProc:=", <boolean>,
"ComputeBothEvenAndOddCPWModes:=", <boolean>,
"NumProcessors:=", <int>,
"NumProcessorsDistrib:=", <int>,
"CausalMaterials:=", <boolean>,

Design Object Script Commands 9-54


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseHPCForMP:=", <boolean>,
"HPCLicenseType:=", <int>)

SaveSolFilesAsBinary - if true, solutions files are saved using a binary format.


LowPriorityForSimulations - if true, run simulations at a lower CPU priority.
SaveNearFieldSolutions - if true, save near field solutions
SchematicEnabled - if true, enable schematics
UseGlobalNumProc - if true, use global number of processors and ignore NumProcessors
ComputeBothEvenAndOddCPWModes - if true, compute both even and odd cpw modes
NumProcessors - number of processors
NumProcessorsDistrib- number of distributed processors
CausalMaterials - if true, use causal materials
UseHPCForMP - if true, use hpc for mp
HPCLicenseType - number indicating hpc license type
VB Example:
oDesign.DesignOptions Array("NAME:options",
"SaveSolFilesAsBinary:=", true,
"LowPriorityForSimulations:=", false,
"SaveNearFieldSolutions:=", false,
"SchematicEnabled:=", true,
"UseGlobalNumProc:=", true,

Design Object Script Commands 9-55


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ComputeBothEvenAndOddCPWModes:=", false,
"NumProcessors:=", 1,
"NumProcessorsDistrib:=", 1,
"CausalMaterials:=", true,
"UseHPCForMP:=", true,
"HPCLicenseType:=", 1)

ExportConvergence
For a given variation, exports convergence data (max mag delta S, E, freq) to *.conv file.

UI Access Results > Solution Data. Select Convergence tab and click Export.

Name Type Description


<Setup> String Setup name.
Parameters <VariationKeys> String The variation. Pass empty string for the current nominal variation.
<FilePath> String Full path to desired *.conv file location.
<OverwriteIfExists> Boolean Optional. If True, overwrites any existing file at the same path.

Return Value None.

Python Syntax ExportConvergence(<Setup>, <VariationKeys>, <FilePath> <OverwriteIfExists>)


Python Example oDesign.ExportConvergence('Setup1', 'x_size = 2mm', 'c:\convergence.conv')

VB Syntax ExportConvergence <Setup>, <VariationKeys>, <FilePath> <OverwriteIfExists>

Design Object Script Commands 9-56


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDesign.ExportConvergence "Setup1", "x_size


VB Example
= 2mm", "c:\convergence.conv"

ExportDataset
Exports a dataset to a named file. This can be executed by the oProject, or oDesign variables.

UI Access Project > Datasets > Export.

Name Type Description


Parameters
<datasetFileFullPath> String The full path to the file.

Return Value None.

Python Syntax ExportDataset (<datasetFileFullPath>)


oProject.ExportDataset('e:/tmp/dsdata.txt')
Python Example
oDesign.ExportDataset('e:/tmp/dsdata.txt')

VB Syntax ExportDataset <datasetFileFullPath>


oProject.ExportDataset "e:/tmp/dsdata.txt"
VB Example
oDesign.ExportDataset "e:/tmp/dsdata.txt"

ExportForHSpice
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.

Design Object Script Commands 9-57


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A

Name Type Description


<DesignVariation> String Desgin variation key.
<SoluSelections> Array Array of selected solutions.
<SpiceType> Integer 1 - HSpice.
<BandWidth> Integer 0 - Low (narrow) band width.
<FWSFile> String Full wave spice file name.
<LumpedElementFile> String Lumped element file name.
Parameters <PoleZeroSpiceFile> String Pole zero spice file name.
<PoleZeroMatlabFile> String Pole zero Matlab file name.
<PartialFractionFile> String Partial fraction file name.
<FittingError> Double The accuracy to use in fitting the pole zero model.
<MinimumOrder> Integer Minimum number of poles in rational function expansion.
<MaximumOrder> Integer Maximum number of poles in rational function expansion.
<UseCommonGround> Integer Optional. 1 to use common ground, 0 otherwise.
<EnforcePassivity> Integer Optional. 1 to enforce passivity, 0 otherwise.

Return Value None.

ExportForHSpice(<DesignVariation>, <SoluSelections>, <SpiceType>, <BandWidth>, <FWSFile>,


Python Syntax <LumpedElementFile>, <PoleZeroSpiceFile>, <PoleZeroMatlabFile>, <PartialFractionFile>, <FittingError>,
<MinimumOrder>, <MaximumOrder>, [Optional <UseCommonGround>], [Optional <EnforcePassivity>])
oModule.ExportForHSpice("width=’2in’",
["Setup1:Sweep1"], 1, 0,
Python Example
"c:\mydir\Sweep1.fws", "", "", "", "",
.005, 20, 200)

Design Object Script Commands 9-58


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ExportForHSpice <DesignVariation>, <SoluSelections>, <SpiceType>, <BandWidth>, <FWSFile>,


VB Syntax <LumpedElementFile>, <PoleZeroSpiceFile>, <PoleZeroMatlabFile>, <PartialFractionFile>, <FittingError>,
<MinimumOrder>, <MaximumOrder>, [Optional <UseCommonGround>], [Optional <EnforcePassivity>]
oModule.ExportForHSpice "width=’2in’", _
Array("Setup1:Sweep1"), 1, 0, _
VB Example
"c:\mydir\Sweep1.fws", "", "", "", "", _
.005, 20, 200

ExportForHSpice [HFSS 3D Layout]


Use: Export matrix solution data to an HSpice subcircuit.
Command: None
Syntax: ExportForHSpice <SolutionVariationKey> <SolnSelectionArray> <Spice Type> <Bandwidth> <FullWaveSpiceFilename>
<LumpedElementFilenme> <Unused> <Unused> <PartialFractionFilename> <Fitting Error> <Unusedint> <MaxOrder> <UseCom-
monGround> <DoPassivityCheck>
Return Value: None
Parameters: <SolutionVariationKey>
Type: string
<SolnSelectionArray>
Type: array
<Spice Type: 1=HSPICE>
Type: int
<Bandwidth: 0=Low Bandwidth, 1=Broad Bandwidth>
Type: int

Design Object Script Commands 9-59


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<FullWaveSpiceFilename>
Type: string
<LumpedElementFilenme>
Type: string
<Unused>
Type: string
<Unused>
Type: string
<PartialFractionFilename>
Type: string
<Fitting Error>
Type: double
<Unusedint>
Type: int
<MaxOrder>
Type: int
<UseCommonGround [Default: FALSE]>
Type: boolean
<DoPassivityCheck [Default: FALSE]>
Type: boolean

Design Object Script Commands 9-60


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example: oDesign.ExportForHSpice "", Array("Setup 1:Sweep 1"), 1, 0, "C:/Projects/MyTRL_


fws.sp", "", "", "", "", 0.5, 0, 200, 0, 0

ExportForSpice [HFSS 3D Layout]


Use: Export matrix solution data to a file in the given spice format.
Command: None
Syntax: ExportForSpice <SolutionVariationKey> <SolnSelectionArray> <Spice Type> <Bandwidth> <FullWaveSpiceFilename>
<LumpedElementFilenme> <Unused> <Unused> <PartialFractionFilename> <FittingError> <MaxOrder> <UseCommonGround>
<DoPassivityCheck>
Return Value: None
Parameters: <SolutionVariationKey>
Type: string
<SolnSelectionArray>
Type: array
<Spice Type: 0=PSpice, 2=MaxwellSpice, 3=Spectre>
Type: int
<Bandwidth: 0=Low Bandwidth, 1=Broad Bandwidth>
Type: int
<FullWaveSpiceFilename>
Type: string
<LumpedElementFilenme>
Type: string
<Unused>

Design Object Script Commands 9-61


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Type: string
<Unused>
Type: string
<PartialFractionFilename>
Type: string
<FittingError [Default:0.5]>
Type: double
<MaxOrder [Default:200]>
Type: int
<UseCommonGround [Default:FALSE]>
Type: boolean
<DoPassivityCheck [Default:FALSE]>
Type: boolean
VB Example: oDesign.ExportForSpice "", Array("LNA:LNA"), 0, 0, _
"C:/Documents and Settings/Marcia.BMT/My Documents/Code Modifications/Test" & _
" Designs/s-params_fws_fws.lib", _
"C:/Documents and Settings/Marcia.BMT/My Documents/Code Modifications/Test" & _
" Designs/s-params_fws_lfws.lib", "", "", "", 0.52, 210, 1, 1

ExportMatrixData

Design Object Script Commands 9-62


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Use:Exports matrix in Matlab or spreadsheet format.


Command:In the Matrix tab of the Solution dialog box, click Export>RLGC.
Syntax:ExportMatrixData <FileName>, <SolnType>, <DesignVariationKey>, <Solution>, <Matrix>, <ResUnit>, <IndUnit>,
<CapUnit>, <CondUnit>, <Frequency>, <MatrixType>, <PassNumber>, <ACPlusDCResistance>
Return Value:none
Parameters:<FileName>
Type: <string>
The path and name of the file where the data will be exported. The file extension determines
the file format.
<SolnType>
Type: <string>
One of the following "C", "AC RL" and "DC RL"
<DesignVariationKey>
Type: <string>
Design variation string
Example: "radius = 3mm"
The empty variation string ("") is interpreted to mean the current nominal variation.
<Solution>
<SolveSetup>:<Soln>
Parameters:
<SolveSetup>
Type: <string>

Design Object Script Commands 9-63


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name of the solve setup


<Soln>
Type: <string>
Name of the solution at a certain adaptive pass.
<Matrix>
Type: <string>
Either "Original" or one of the reduce matrix setup names
<ResUnit>
Type: <string>
Unit used for the resistance value
<IndUnit>
Type: <string>
Unit used for the inductance value
<CapUnit>
Type: <string>
Unit used for the capacitance value
<CondUnit>
Type: <string>
Unit used for the conductance value
<Frequency>

Design Object Script Commands 9-64


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Type: <double>
Frequency in hertz.
<MatrixType>
Type: <String>
Value: "Maxwell", "Spice", "Couple" , (one or all of these).
Matrix type to export.
<PassNumber>
Type: <integer>
Pass number.
<ACPlusDCResistance>
Type: <bool>
Default Value: false
Add DC and AC resistance and export the matrix.
VB Example:oDesign.ExportMatrixData "C:/temp/3DScripts/rlgc_lvl.lvl", "C, DC RL, AC RL", "", _
"Setup1:LastAdaptive", "Original", "ohm", "nH", "pF", "mSie", 100000000, _ "Max-
well,Spice,Couple", 0

Python Syn- ExportMatrixData ([FileName, SolnType, DesignVariationKey, Solution, Matrix, ResUnit, IndUnit, CapUnit,
tax CondUnit, Frequency, MatrixType, PassNumber, ACPlusDCResistance])
oDesign.ExportMatrixData
Python (["C:/temp/3DScripts/rlgc_lvl.lvl", "C, DC RL, AC RL", "", _ "Setup1:LastAdaptive",
Example "Original", "ohm", "nH", "pF", "mSie", 100000000, _ "Maxwell,Spice,Couple",
0])

Design Object Script Commands 9-65


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ExportMeshStats
Exports mesh statistics to a file.

UI Access N/A

Name Type Description


<setupName> String Name of the solution setup.
<variationString> String Name of the variation. An empty string is interpreted as the current nom-
Parameters inal variation.
<filePath> String Full file path, including extension *.ms.
<overwriteIfExists> Boolean (Optional). Defaults to True. If True, script overwrites any existing file of
the same name. If False, no overwrite.

Return Value None.

Python Syntax ExportMeshStats(<setupName>, <variationString>, <filePath>, <overwriteIfExists>)


oDesign.ExportMeshStats ("Setup1", "radius=3mm", "C:\mydir\meshstats.ms",
Python Example
True)

VB Syntax ExportMeshStats <setupName>, <variationString>, <filePath>, <overwriteIfExists>


oDesign.ExportMeshStats "Setup1", "radius=3mm", "C:\mydir\meshstats.ms",
VB Example
true

ExportNetworkData
Exports matrix solution data to a file. Available only for Driven solution types with ports.

Design Object Script Commands 9-66


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A

Name Type Description


<DesignVariationKey> String Design variation key. Pass empty string for the current nominal vari-
ation.
<SolnSelectionArray> Array Array of selected solutions.
Array(<SolnSelector>, <SolnSelector>, ...)
If more than one array entry, this indicates a combined Interpolating
sweep.
<SolnSelector> String Solution setup name and solution name, separated by a colon.
<FileFormat> Integer File format value.
2 : Tab delimited spreadsheet format (.tab)
3 : Touchstone (.sNp)
4 : CitiFile (.cit)
Parameters
7 : Matlab (.m)
8 : Terminal Z0 spreadsheet
<OutFile> String Full path to the file to write out.
<FreqsArray> Array The frequencies to export. The <FreqsArray> argument contains a
vector (e.g. "1GHz", "2GHz", ...) to use, or "all". To export all fre-
quencies, use Array("all"). If no frequencies are specified, all fre-
quencies are used.
<DoRenorm> Boolean Specifies whether to renormalize the data before export.
<RenormImped> Double Real impedance value in ohms, for renormalization. Required in syn-
tax, but ignored if DoRenorm is false.
<DataType> String Optional. Type: "S", "Y", or "Z". The matrix to export.
<pass> Integer Optional. 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> Integer Optional. Type: "0", "1", or "2"

Design Object Script Commands 9-67


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

The format to use for the exported data.


0 = Magnitude/Phase.
1= Real/Imaginary.
2= db/Phase.
<Precision> Integer Optional. Touchstone number of digits precision. Default if not spe-
cified is 15.
<UseExportFreqs> Boolean Specifies whether to use export frequencies.
<IncludeGammaComments> Boolean Specifies whether to include Gamma and Impedance comments.
<SupportNonStdExport> Boolean Specifies whether to support non-standard Touchstone extensions
for mixed reference impedance.

Return Value None.

ExportNetworkData(<DesignVariationKey>, <SolnSelectionArray>, <SolnSelector>, <FileFormat>, <OutFile>, <Fre-


Python qsArray>, <DoRenorm>, <RenormImped>, [Optional <DataType>], [Optional <pass>], [Optional <ComplexFormat>],
Syntax [Optional <Precision>], [Optional <UseExportFreqs>], [Optional <IncludeGammaComments>], [Optional <Sup-
portNonStdExport>])
oModule.ExportNetworkData("", ["Setup1:Sweep1"], 3, "C://Documents/package_
Python HFSSDesign1.s4p",
Example
['all'], True, 50, "S", -1, 0, 15, True, True, True

ExportNetworkData <DesignVariationKey>, <SolnSelectionArray>, <SolnSelector>, <FileFormat>, <OutFile>,


VB Syntax <FreqsArray>, <DoRenorm>, <RenormImped>, [Optional <DataType>], [Optional <pass>], [Optional <Com-
plexFormat>], [Optional <Precision>], [Optional <UseExportFreqs>], [Optional <IncludeGammaComments>],

Design Object Script Commands 9-68


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[Optional <SupportNonStdExport>]
oModule.ExportNetworkData "width=’2in’", _
Array("Setup1:Sweep1"),2, "c:\mydir\out.tab", _
Array("all"), false, 0
VB Example oModule.ExportNetworkData "width=’2in’", _
Array("Setup1:Sweep1", "Setup1:Sweep2"), 3, _
"c:\mydir\out.s2p", Array(1.0e9, 1.5e9, 2.0e9), _
true, 50.0

ExportNetworkData
Exports matrix solution data to a file. Available only for Driven solution types with ports.

UI Access N/A

Name Type Description


<DesignVariationKey> String Design variation key. Pass empty string for the current nominal vari-
ation.
<SolnSelectionArray> Array Array of selected solutions.
Array(<SolnSelector>, <SolnSelector>, ...)
Parameters If more than one array entry, this indicates a combined Interpolating
sweep.
<SolnSelector> String Solution setup name and solution name, separated by a colon.
<FileFormat> Integer File format value.
2 : Tab delimited spreadsheet format (.tab)
3 : Touchstone (.sNp)

Design Object Script Commands 9-69


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

4 : CitiFile (.cit)
7 : Matlab (.m)
8 : Terminal Z0 spreadsheet
<OutFile> String Full path to the file to write out.
<FreqsArray> Array The frequencies to export. The <FreqsArray> argument contains a
vector (e.g. "1GHz", "2GHz", ...) to use, or "all". To export all fre-
quencies, use Array("all"). If no frequencies are specified, all fre-
quencies are used.
<DoRenorm> Boolean Specifies whether to renormalize the data before export.
<RenormImped> Double Real impedance value in ohms, for renormalization. Required in syn-
tax, but ignored if DoRenorm is false.
<DataType> String Optional. Type: "S", "Y", or "Z". The matrix to export.
<pass> Integer Optional. 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> Integer Optional. Type: "0", "1", or "2"
The format to use for the exported data.
0 = Magnitude/Phase.
1= Real/Imaginary.
2= db/Phase.
<Precision> Integer Optional. Touchstone number of digits precision. Default if not spe-
cified is 15.
<UseExportFreqs> Boolean Specifies whether to use export frequencies.
<IncludeGammaComments> Boolean Specifies whether to include Gamma and Impedance comments.
<SupportNonStdExport> Boolean Specifies whether to support non-standard Touchstone extensions
for mixed reference impedance.

Design Object Script Commands 9-70


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

ExportNetworkData(<DesignVariationKey>, <SolnSelectionArray>, <SolnSelector>, <FileFormat>, <OutFile>, <Fre-


Python qsArray>, <DoRenorm>, <RenormImped>, [Optional <DataType>], [Optional <pass>], [Optional <ComplexFormat>],
Syntax [Optional <Precision>], [Optional <UseExportFreqs>], [Optional <IncludeGammaComments>], [Optional <Sup-
portNonStdExport>])
oModule.ExportNetworkData("", ["Setup1:Sweep1"], 3, "C://Documents/package_
Python HFSSDesign1.s4p",
Example
['all'], True, 50, "S", -1, 0, 15, True, True, True

ExportNetworkData <DesignVariationKey>, <SolnSelectionArray>, <SolnSelector>, <FileFormat>, <OutFile>,


<FreqsArray>, <DoRenorm>, <RenormImped>, [Optional <DataType>], [Optional <pass>], [Optional <Com-
VB Syntax
plexFormat>], [Optional <Precision>], [Optional <UseExportFreqs>], [Optional <IncludeGammaComments>],
[Optional <SupportNonStdExport>]
oModule.ExportNetworkData "width=’2in’", _
Array("Setup1:Sweep1"),2, "c:\mydir\out.tab", _
Array("all"), false, 0
VB Example oModule.ExportNetworkData "width=’2in’", _
Array("Setup1:Sweep1", "Setup1:Sweep2"), 3, _
"c:\mydir\out.s2p", Array(1.0e9, 1.5e9, 2.0e9), _
true, 50.0

Design Object Script Commands 9-71


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ExportNMFData

Use:Exports s-parameters in neutral file format.


Command:In the matrix tab of the Solution dialog box, click Export->S-Parameter. Then select the Neutral Model file format.
Syntax: ExportNetworkData <SolutionName> <FileName> <ReduceMatrix><Reference Impedance> <FrequencyArray> <DesignVari-
ation> <Format> <Length> <PassNumber>
Return Value:None
Parameters:SolutionName>
Type: <String>
Format: <SetupName>:<SolutionName>
Solution that is exported.
<FileName>
Type:<String>
The name of the file. The file extension will determine the file format.
<ReduceMatrix>
Type: <string>
Either "Original" or one of the reduce matrix setup name
<Reference Impedance>
Type: <Double>
Reference impedance

Design Object Script Commands 9-72


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<FrequencyArray>
Type: <Array of doubles>
Value: Array(<double>,<double>….)
Frequency points in the sweep that is exported.
<DesignVariation>
Type: <String>
Design variation at which the solution is exported.
<Format>
Type: <String>
Values: "MagPhase", "RealImag", "DbPhase".
The format in which the sparameters will be exported.
<Length>
Type:<String>
Length for exporting sparameters.
<PassNumber>
Type:<integer>
Pass number.
VB Example:
oDesign.ExportNMFData "Setup7 : LastAdaptive", "C:/temp/neu.nmf", "Original", _ 50, Array
(10000000, 20000000, 30000000, 40000000, 50000000, 60000000, 70000000, _ 80000000, 90000000,
100000000), "", "MagPhase","7meter"

Design Object Script Commands 9-73


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ExportNMFData(
"",
# Empty string.
1,
#The number 1.
"Name",
# This is the full path of the file from which the solution is loaded
"ExportFile",
# full path of file to export to
["NAME:Frequencies"],
Python Syntax
#optional, if none defined all frequencies are used
["NAME:NMFOptions",
#Export NMF options object
"DataTypes:=", ["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)

Design Object Script Commands 9-74


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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:=", ["FF", "cap", "Rs"]
# Array of variables
"Variations:=", ["", "", ""]
# Array of variations to export solutions for
["NAME:ConstantVars"]
#Array of variables that are constant, can be empty
["NAME: DependentVars"]
#Array of variables that are dependent, can be empty
"MatrixSize:=", 2,
#Matrix size, optional (used in nmf file header)
"CreateNPortModel:=", true

Design Object Script Commands 9-75


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

#Create a model based on the exported file true/false


])
oTool = oDesktop.GetTool("NdExplorer")
oTool.ExportNetworkData("", True,
"C:/.../100OHM.S2P", "$SYSLIB/Test.s2p", "",
[
"NAME:Frequencies",
500000000,
1000000000,
10000000000,
25000000000,
Python Example
50000000000,
75000000000,

100000000000
],
[
"NAME:TSOptions",
"DataTypes:=" , ["S"],
"DisplayFormat:=" , "DB",

Design Object Script Commands 9-76


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"FileType:=" , 3,
"Renormalize:=" , True,
"RefImpedance:=" , 50,
"Precision:=" , 6,
"UseMultipleCores:=" , False,
"NumberOfCores:=" , 1,
"Comments:=" , True,
"Noise:=" , False
])

ExportProfile
Exports a solution profile to file.

UI Access N/A

Name Type Description


<SetupName> String Text of the design's notes.
<VariationString> String Variation name. Pass empty string for the current nominal variation.
<filePath> String Full file path, including extension *.prof.
Parameters
<overwriteIfExists> Boolean Optional.
l True - overwrites any existing file of the same name.
l False - no overwrite.

Return Value None.

Design Object Script Commands 9-77


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ExportProfile(<SetupName>, <VariationString>, <filePath>, <overwriteIfExists>)


Python Example oDesign.ExportProfile('Setup1', 'radius=3mm', 'C:\Files\Profile.prof', True)

VB Syntax ExportProfile <SetupName>, <VariationString>, <filePath>, <overwriteIfExists>


VB Example oDesign.ExportProfile "Setup1", "radius=3mm", "C:\Files\Profile.prof", True

Generate Mesh
If any mesh operations have been defined but 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.

UI Access [HFSS] > Analysis Setup > Generate Mesh.

Name Type Description


Parameters
<SimulationNames> Array List of simulation names.

Integer:
Return Value l 0 – Success
l Else – Failure

Python Syntax GenerateMesh(<SimulationNames>)


Python Example oDesign.GenerateMesh(['Setup1','Setup2','Setup3'])

VB Syntax GenerateMesh <SimulationNames>


VB Example oDesign.GenerateMesh Array('Setup1','Setup2','Setup3')

Design Object Script Commands 9-78


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetActiveEditor [HFSS 3D Layout]


Use: Get the name of the active editor.
Command: None
Syntax: GetActiveEditor <object_variable>
Return Value: String
Parameters: <object_variable>
Type: string
VB Example: oDesign.GetActiveEditor <object_variable>
Note that GetActiveEditor returns NULL if the editor is open in a non-active window.

GetChildNames [Design]
Returns the names of the design's child objects.

UI Access N/A

Name Type Description


Parameters <type> String Optional. Valid options are "Module", "Editor", and "Variable". Default returns
Module and Editor names.

Return Value Names of children for the queried object.

Python Syntax GetChildNames (<type>)


Python Example oDesign.GetChildNames("Variable")

VB Syntax GetChildNames <type>


VB Example oDesign.GetChildNames "Variable"

Design Object Script Commands 9-79


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetChildObject [Design]
Returns the design's child objects.

UI Access N/A

Name Type Description


Parameters <path> String The path may include multiple generations (for example, "designOb-
ject/moduleObj/SetupObject"). See: Object Path.

Return Value A child object if one is found. Otherwise script error.

Python Syntax GetChildObject(<path>)


oDesign = oProject.GetActiveDesign()
oOptimModule = oDesign.GetChildObject("Optimetrics")
oEditor = oDesign.GetChildObject("3D Model")
Python Example
oBox = oDesign.GetChildObject("3D Model/Box1")
oRpt = oDesign.GetChildObject("Results/S Parameter Plot 1")
oVariable= oDesign.GetChildObject("Offset")

VB Syntax GetChildObject <path>


VB Example oDesign = oProject.GetActiveDesign

Design Object Script Commands 9-80


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oOptimModule = oDesign.GetChildObject "Optimetrics"


oEditor = oDesign.GetChildObject "3D Model"
oBox = oDesign.GetChildObject "3D Model/Box1"
oRpt = oDesign.GetChildObject "Results/S Parameter Plot 1"
oVariable= oDesign.GetChildObject "Offset"

GetChildTypes [Design]
Returns the design's child object types.

UI Access N/A
Parameters None.
Return Value String: "Module", "Editor", or "Variable"

Python Syntax GetChildTypes()


Python Example oDesign.GetChildTypes()

VB Syntax GetChildTypes
VB Example oDesign.GetChildTypes

GetConfigurableData
Obtains configurable data of a specified type

Design Object Script Commands 9-81


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note:
This command is for internal Ansys use only.

UI Access N/A

Name Type Description


Parameters
<type> String Specified type.

Return Value None.

Python Syntax GetConfigurableData(<type>)


Python Example oDesign.GetConfigurableData("model")

VB Syntax GetConfigurableData <type>


VB Example oDesign.GetConfigurableData "model"

GetData

Note:
This command is for internal Ansys use only.

Design Object Script Commands 9-82


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetData()


Python Example oDesign.GetData()

GetDesignID
Returns the unique identification number of the active design.

UI Access N/A
Parameters None.
Return Value String indicating the unique identification number of the active design.

Python Syntax GetDesignID()


oDesign = oProject.GetActiveDesign()
Python Example
oDesign.GetDesignID()

VB Syntax GetDesignType
Set oDesign = oProject.GetActiveDesign
VB Example
oDesign.GetDesignID

GetDesignName
Returns the name of the active design.

Design Object Script Commands 9-83


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A
Parameters None.
Return Value String indicating the name of the active design.

Python Syntax GetDesignName()


oDesign = oProject.GetActiveDesign()
Python Example
oDesign.GetDesignName()

VB Syntax GetDesignName
Set oDesign = oProject.GetActiveDesign
VB Example
oDesign.GetDesignName

GetDesignType
Returns the design type of the active design.

UI Access N/A
Parameters None.

String indicating the design type of the active design ("Circuit Design", "Circuit Netlist","EMIT",
Return Value "HFSS 3D Layout Design", "HFSS", "HFSS-IE", "Icepak", "Maxwell 2D", "Maxwell 3D", "Q2D Extractor",
"Q3D Extractor", "RMxprt", or "Twin Builder").

Design Object Script Commands 9-84


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetDesignType()


oDesign = oProject.GetActiveDesign()
Python Example
oDesign.GetDesignType()

VB Syntax GetDesignType
Set oDesign = oProject.GetActiveDesign
VB Example
oDesign.GetDesignType
ain

GetDesignValidationInfo
Returns the design's validation information.

UI Access N/A

Name Type Description


Parameters
<validationResultFilePath> String Full path for validation file, including *.xml extension.

Boolean:
Return Value l 0 – Failure (validation not done)
l 1 – Success (results written to specified location; see file format below)

Python Syntax GetDesignValidationInfo(<validationResultFilePath>)


Python Example oDesign.GetDesignValidationInfo('E:/MyProjects/Validation.xml')

Design Object Script Commands 9-85


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetDesignValidationInfo <validationResultFilePath>


VB Example oDesign.GetDesignValidationInfo "E:/MyProjects/Validation.xml"

GetEdgePositionAtNormalizedParameter
Gets the position on an edge with normalized parameter.

UI Access N/A

Name Type Description


<EdgeID> Integer Edge ID.
Parameters <NormParam> Double Normalized parameter.(Proportional to the length of the specified edge)
For example, 0 leads to the start vertex position of the edge, 1 leads to the end
vertex position of the edge, 0.5 leads to the mid position on the edge.

Return Value Array of string containing the x, y and z coordinate values.

Python Syntax GetEdgePositionAtNormalizedParameter(<EdgeID>, <NormParam>)


oEditor.GetEdgePositionAtNormalizedParameter(5, 0)
Python Example oEditor.GetEdgePositionAtNormalizedParameter(5, 1)
oEditor.GetEdgePositionAtNormalizedParameter(5, 0.5)

VB Syntax GetEdgePositionAtNormalizedParameter <EdgeID>, <NormParam>


VB Example oEditor.GetEdgePositionAtNormalizedParameter 5, 0

Design Object Script Commands 9-86


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.GetEdgePositionAtNormalizedParameter 5, 1
oEditor.GetEdgePositionAtNormalizedParameter 5, 0.5

GetEditSourcesCount
For Characteristic Mode Analysis (CMA), returns the number of sources listed in the Edit Sources panel.

UI Access N/A
Parameters None.
Return Value Integer number of sources.

Python Syntax GetEditSourcesCount()


Python Example oModule.GetEditSourcesCount()

VB Syntax GetEditSourcesCount
Dim count
VB Example
count = oModule.GetEditSourcesCount

GetEditor [HFSS 3D Layout]


Use: Get the named editor without activating it.
Command: None
Syntax: GetEditor <editorName object_variable>
Return Value: String

Design Object Script Commands 9-87


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters: <editorName>
Type: string
<object_variable>
Type: string
VB Example: oDesign.GetEditor <editorName> <object_variable>

GetManagedFilesPath
Get the path to the project's results folder.

UI Access N/A
Parameters None.
Return Value String containing path where project results are located.

Python Syntax oDesign.GetManagedFilesPath()


Python Example oDesign.GetManagedFilesPath()

VB Syntax oDesign.GetManagedFilesPath
VB Example oDesign.GetManagedFilesPath

GetModule
Returns the IDispatch for the specified module.

Design Object Script Commands 9-88


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A

Name Type Description


<modulename> String One of the following:
l Analysis Module – "AnalysisSetup"
l Boundary Module – "BoundarySetup"
l Field Overlays Module – "FieldsReporter"
l Mesh Module – "MeshSetup"
Parameters l Optimetrics Module – "Optimetrics"
l Radiation Module – "RadField"
l Radiation Setup Manager Module – "RadiationSetupMgr"
l Reduce Matrix Module – "ReduceMatrix"
l Reporter Module – "ReportSetup"
l Simulation Setup Module – "SimSetup"
l Solutions Module – "Solutions"

Return Value Module IDispatch

Python Syntax GetModule (<modulename>)


Python Example oModule = oDesign.GetModule("SimSetup")

VB Syntax GetModule <modulename>

Design Object Script Commands 9-89


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example set oModule = oDesign.GetModule "SimSetup"

GetModule [HFSS 3D Layout]


Get the IDispatch for the specified module.
Command: None
Syntax: GetModule <"modulename"> <object_variable>
Return Value: Module IDispatch
Parameters: <"modulename">
Type: string
<object_variable>
Type: string
VB Example: oDesign.GetModule "modulename" object_variable

GetModule (RadiationSetupMgr)
Returns the IDispatch for the specified module.

UI Access N/A

Name Type Description


<modulename> String One of the following:

Parameters l Analysis Module – "AnalysisSetup"


l Boundary Module – "BoundarySetup"
l Field Overlays Module – "FieldsReporter"

Design Object Script Commands 9-90


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l Mesh Module – "MeshSetup"


l Optimetrics Module – "Optimetrics"
l Radiation Module – "RadField"
l Radiation Setup Manager Module – "RadiationSetupMgr"
l Reduce Matrix Module – "ReduceMatrix"
l Reporter Module – "ReportSetup"
l Simulation Setup Module – "SimSetup"
l Solutions Module – "Solutions"

Return Value Module IDispatch

Python Syntax GetModule (<modulename>)


oModule = oDesign.GetModule("SimSetup")
Python Example

VB Syntax GetModule <modulename>


VB Example set oModule = oDesign.GetModule("SimSetup")

GetName
Returns the name of the active design.

UI Access N/A
Parameters None.

Design Object Script Commands 9-91


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value String indicating the name of the active design.

Python Syntax GetName()


Python Example design_name = oDesign.GetName()

VB Syntax GetName
VB Example design_name = oDesign.GetName

GetName [HFSS 3D Layout]


Get the name of the active design.
Command: None
Syntax: GetName <namestring_variable>
Return Value: String
Parameters: <namestring_variable>
Type: string
VB Example: oDesign.GetName namestring_variable

GetNominalVariation
Returns the current nominal variation.

Design Object Script Commands 9-92


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A
Parameters None.
Return Value String containing current nominal variation.

Python Syntax GetNominalVariation()


Python Example oDesign.GetNominalVariation()

VB Syntax GetNominalVariation
VB Example oDesign.GetNominalVariation

GetNoteText
Returns the text of the note attached to a design.

UI Access N/A
Parameters None.
Return Value String: text of the design note.

Python Syntax GetNoteText()


Python Example oDesign.GetNoteText()

Design Object Script Commands 9-93


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetNoteText
VB Example oDesign.GetNoteText

GetObjPath [Design]
Obtains the path to the design.

UI Access N/A
Parameters None.
Return Value String containing the path to the design.

Python Syntax GetObjPath()


Python Example oDesign.GetObjPath()

VB Syntax GetObjPath
VB Example oDesign.GetObjPath

GetOutputVariableValue
Returns the double value of an output variable. Only expressions that return a double value are supported. The expression is eval-
uated only for a single point.

UI Access N/A

Design Object Script Commands 9-94


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<OutputVarName> String Name of the output variable.
<IntrinsicVariation> String A set of intrinsic variable value pairs to use when evaluating the output expres-
sion.
HFSS example:
"Freq='20GHz' Theta='20deg' Phi='30deg'"
<SolutionName> String Name of the solution as listed in the output variable UI. For example,
"Setup1 : Last Adaptive".
<ReportType> String The name of the report type as seen in the output variable UI.
Possible values in HFSS are:
Parameters l "Modal Solution Data"
l "Terminal S Parameters"
l "Eigenmode Parameters"
l "Fields"
l "Far Fields"
l "Near Fields"
"Emission Test"
l

<ContextArray> Array Structured array containing context for which the output variable expression is
being evaluated. Can be empty.
Array("Context:=", <string>)

Return Value Double value of the output variable.

GetOutputVariableValue(<OutputVarName>, <IntrinsicVariation>, <SolutionName>, <ReportTypeName>,


Python Syntax
<ContextArray>)

Design Object Script Commands 9-95


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Val = oDesign.GetOutputVariableValue("test","Freq = '20Ghz' Theta='20deg'


Python Example
Phi='30deg'", "TR", "Standard", [])

GetOutputVariableValue <OutputVarName>, <IntrinsicVariation>, <SolutionName>, <ReportTypeName>, <Con-


VB Syntax
textArray>
Val = oDesign.GetOutputVariableValue
VB Example "test","Freq = '20Ghz' Theta='20deg'
Phi='30deg'", "TR", "Standard", Array()

GetOutputVariables
Returns the list of output variables.

UI Access N/A
Parameters None.
Return Value Array containing all output variables.

Python Syntax GetOutputVariables()


Python Example oDesign.GetOutputVariables()

VB Syntax GetOutputVariables

Design Object Script Commands 9-96


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oDesign.GetOutputVariables

GetPostProcessingVariables
Returns the list of post-processing variables.

UI Access N/A
Parameters None.
Return Value Returns array containing variables.

Python Syntax GetPostProcessingVariables()


Python Example oDesign.GetPostProcessingVariables()

VB Syntax GetPostProcessingVariables
VB Example oDesign.GetPostProcessingVariables

GetProperties
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.

UI Access N/A

Name Type Description


Parameters <PropTab> String One of the following, where tab titles are shown in parentheses:
l PassedParameterTab ("Parameter Values")

Design Object Script Commands 9-97


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l DefinitionParameterTab (Parameter Defaults")


l LocalVariableTab ("Variables" or "Local Variables")
l ProjectVariableTab ("Project variables")
l ConstantsTab ("Constants")
l BaseElementTab ("Symbol" or "Footprint")
l ComponentTab ("General")
l Component("Component")
l CustomTab ("Intrinsic Variables")
l Quantities ("Quantities")
Signals ("Signals")
l

<PropServer> String An object identifier, generally returned from another script method, such as
Comp-Inst@R;2;3

Return Value Array of strings containing the names of the appropriate properties.

Python Syntax GetProperties( <PropTab>, <PropServer> )


Python Example oEditor.GetProperties('PassedParameterTab', 'k')

VB Syntax GetProperties <PropTab>, <PropServer>


VB Example oEditor.GetProperties "PassedParameterTab", "k"

Design Object Script Commands 9-98


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetPropertyValue
Returns the value of a single property belonging to a specific <PropServer> and <PropTab>. This function is available with the Pro-
ject, Design or Editor objects, including definition editors.

Tip:

Use the script recording feature and edit a property, and then view the resulting script to see the format for that property.

UI Access N/A

Name Type Description


<PropTab> String One of the following, where tab titles are shown in parentheses:
l PassedParameterTab ("Parameter Values")
l DefinitionParameterTab (Parameter Defaults")
l LocalVariableTab ("Variables" or "Local Variables")
l ProjectVariableTab ("Project variables")
l ConstantsTab ("Constants")

Parameters
l BaseElementTab ("Symbol" or "Footprint")
l ComponentTab ("General")
l Component("Component")
l CustomTab ("Intrinsic Variables")
l Quantities ("Quantities")
Signals ("Signals")
l

<PropServer> String An object identifier, generally returned from another script method, such as
Comp-Inst@R;2;3
<PropName> String Name of the property.

Design Object Script Commands 9-99


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value String value of the property.

Python Syntax GetPropertyValue (<PropTab>, <PropServer>, <PropName>)


selectionArray = oEditor.GetSelections()
for k in selectionArray:
Python Example
val = oEditor.GetPropertyValue("PassedParameterTab", k, "R")
...

VB Syntax GetPropertyValue (<PropTab>, <PropServer>, <PropName>)


selectionArray = oEditor.GetSelections
for k in selectionArray:
VB Example
val = oEditor.GetPropertyValue("PassedParameterTab", k, "R")
...

GetPropNames [Design]
Returns array containing names of property. For designs, always returns an empty array because the design has no property.

UI Access N/A

Design Object Script Commands 9-100


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<includeReadOnly> Boolean (Optional).
Parameters l True - include read only property.
l False - do not include read only property.

Return Value Empty array.

Python Syntax GetPropNames(<includeReadOnly>)


Python Example oDesign.GetPropNames()

VB Syntax GetPropNames <includeReadOnly>


VB Example oDesign.GetPropNames

GetPropValue [Design]
Returns the property value for the active design object, or specified property values.

UI Access N/A

Name Type Description


Parameters
<propPath> String A child object's property path. See: Object Property Script Function Summary.

Return Value The property value (integer, string, or array of strings) of the specified child object.

Python Syntax GetPropValue(<propPath>)


oDesign.GetPropValue('offset/SIValue')
Python Example
oDesign.GetPropValue('Results/S Parameter Plot 1/Display Type')

Design Object Script Commands 9-101


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDesign.GetPropValue('Results/S Parameter Plot 1/Display Type/Choices')

VB Syntax GetPropValue(<propPath>)
val = oDesign.GetPropValue("offset/SIValue")
VB Example disp = oDesign.GetPropValue("Results/S Parameter Plot 1/Display Type")
arr = oDesign.GetPropValue("Results/S Parameter Plot 1/Display Type/Choices")

GetSelections [Design]
This script serves no function at the Design level. See: GetSelections (Layout Editor), GetSelections (Model Editor), or Get Selections
(Schematic Editor).

GetSolutionType
Returns solution type of the design.

UI Access N/A
Parameters None.
String containing the solution type.
Return Value Possible values are: "SBR+", "HFSS [Modal | Terminal] [ Network | Composite]","Transient [Network | Com-
posite]","Eigenmode", or "Characteristic".

Python Syntax GetSolutionType()


Python Example oDesign.GetSolutionType()

Design Object Script Commands 9-102


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetSolutionType
VB Example oDesign.GetSolutionType

GetSolveInsideThreshold
Returns the solve inside threshold. This command does not apply to HFSS-IE.

UI Access N/A
Parameters None.
Return Value Double representing the solve inside threshold.

Python Syntax GetSolveInsideThreshold()


Python Example oDesign.GetSolveInsideThreshold()

VB Syntax GetSolveInsideThreshold
VB Example oDesign.GetSolveInsideThreshold

GetVariables
Returns a list of all defined variables. To get a list of project variables, execute this command using oProject. To get a list of local
variables, use oDesign.

UI Access N/A

Design Object Script Commands 9-103


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters None.
Return Value Array of strings containing the variables.

Python Syntax GetVariables ()


oProject.GetVariables()
Python Example
oDesign.GetVariables()

VB Syntax GetVariables
oProject.GetVariables
VB Example
oDesign.GetVariables

GetVariableValue
Gets the value of a single specified variable. To get the value of project variables, execute this command using oProject. To get the
value of local variables, use oDesign.

UI Access N/A

Name Type Description


Parameters
<VarName> String Name of the variable to access.

Return Value String represents the value of the variable.

Design Object Script Commands 9-104


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetVariableValue( <VarName> )


oProject.GetVariableValue("var_name")
Python Example

VB Syntax GetVariableValue <VarName>


VB Example oProject.GetVariableValue "var_name"

GetVariationVariableValue
Returns the value for a specified variation's variable.

UI Access N/A

Name Type Description


Parameters <VariationString> String The name of the design variation.
<VariableName> String The name of the variable.

Returns a double precision value in SI units, interpreted to mean the value of the variable contained in the vari-
Return Value
ation string.

Python Syntax GetVariationVariableValue(<VariationString>, <VariableName>)


oDesign.GetVariationVariableValue('x_size
Python Example
= 2mm y_size = 1mm', 'y_size')

VB Syntax GetVariationVariableValue <VariationString>, <VariableName>

VB Example varval = oDesign.GetVariationVariableValue "x_size

Design Object Script Commands 9-105


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

= 2mm y_size = 1mm", "y_size"

ImportDataset
Imports a dataset from a named file. This can be executed by the oProject, or oDesign variables. The name of the dataset is file-
name+index number (e.g., dsdata1) unless the filename ends with a trailing number. When there is a trailing number at the end, we
will remove the number and use first unused index.

UI Access Project > Datasets > Import.

Name Type Description


Parameters
<datasetFileFullPath> String The full path to the file containing the dataset values.

Return Value None.

Tab-delimited or space-delimited files with the extension ".tab" is the recommended file type to be used.
For importing datasets at the Design level, this is the only file type supported.
At the Project level, other file types (e.g., ".csv") are supported. However, after calling the command, you must configure the file import
format manually through the GUI as shown in the figure below.

Design Object Script Commands 9-106


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ImportDataset (<datasetFileFullPath>)


oProject.ImportDataset('e:\tmp\dsdata.tab')
Python Example
oDesign.ImportDataset('e:\tmp\dsdata.tab')

Design Object Script Commands 9-107


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax ImportDataset <datasetFileFullPath>


oProject.ImportDataset "e:\tmp\dsdata.tab"
VB Example
oDesign.ImportDataset "e:\tmp\dsdata.tab"

InsertDesign
Inserts a new design in the project. For HFSS scripts, the last argument will always be empty.

UI Access Project > Insert HFSS Design.

Name Type Description


<DesignType> String Design type. Use "HFSS".
Parameters <DesignName> String Design name.
<SolutionType> String Solution type. Valid types: "DrivenModal", "DrivenTerminal", or "Eigenmode".
"" None Empty argument.

Return Value None.

Python Syntax InsertDesign (<DesignType>, <DesignName>, <SolutionType>,'')


Python Example oProject.InsertDesign('HFSS', 'HFSSDesign3', 'DrivenModal', '')

VB Syntax InsertDesign <DesignType>, <DesignName>, <SolutionType>, ""

Design Object Script Commands 9-108


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oProject.InsertDesign "HFSS", "HFSSDesign3", "DrivenModal", ""

OverlayCurrents [HFSS 3D Layout]


Creates a 3D view with a currents overlay
Command: None
Syntax: OverlayCurrents <solution name>
Return Value: <success>
Type: boolean
Parameters: <solution name>
Type: string
VB Example: Dim success
success = oDesign.OverlayCurrents ("HFSS Setup : Sweep 1")

OverlayFarField [HFSS 3D Layout]


Creates a 3D view with a far field overlay
Command: None
Syntax: OverlayFarField <solution name>
Return Value: <success>
Type: boolean
Parameters: <solution name>
Type: string
VB Example: Dim success
success = oDesign.OverlayFarField ("HFSS Setup : Sweep 1")

Design Object Script Commands 9-109


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

OverlayMesh [HFSS 3D Layout]


Creates a 3D view with a mesh overlay
Command: None
Syntax: OverlayMesh <solution name>
Return Value: <success>
Type: boolean
Parameters: <solution name>
Type: string
VB Example: Dim success
success = oDesign.OverlayMesh ("HFSS Setup : Sweep 1")

OverlayNearField [HFSS 3D Layout]


Creates a 3D view with a near field overlay
Command: None
Syntax: OverlayNearField <solution name>
Return Value: <success>
Type: boolean
Parameters: <solution name>
Type: string
VB Example: Dim success
success = oDesign.OverlayNearField ("HFSS Setup : Sweep 1")

Design Object Script Commands 9-110


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

PasteDesign (Design Object)


Pastes a design that has already been copied to the clipboard into another design.

UI Access Edit > Paste.

Name Type Description


<pasteOption> Integer One of the following:
l 0 – Link to the existing design that was copied
Parameters l 1 – Create a new copy of the design and keep the original layers of
the design being copied
l 2 – Create a new copy of the design and merge the layers of the
design being copied.

Return Value None.

Python Syntax PasteDesign(<pasteOption>)


oProject.CopyDesign('DesignB')
Python Example oDesign = oProject.SetActiveDesign('DesignA')
oDesign.PasteDesign(1)

VB Syntax PasteDesign <pasteOption>


oProject.CopyDesign "B"
VB Example Set oDesign = oProject.SetActiveDesign("A")
oDesign.PasteDesign 1

Design Object Script Commands 9-111


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

PasteItemCommand [HFSS 3D Layout]


Paste tree items, such as Altrasim Solution and Solve Setups pasted to the Analysis Tree, or Frequency Sweeps pasted to the Solve
Setup Tree.
Command: Right-click on the Analysis item in the Project tree and select Paste.
Syntax: PasteItemCommand <ItemPath>
Return Value: None
Parameters: <ItemPath>
Type: string
VB Example: oDesign.PasteItemCommand "Project1|Nexxim1|Analysis"

PushExcitations
Allows access to computed excitations for transient and linear frequency solutions. The script command can be accessed from three
locations.

l Layout Editor
UI Access l Schematic Editor
l Select a Nexxim solution in a 3D Layout design, right click, and choose Push Excitations.

Name Type Description


<Reference Designation> String "<refdes>"

Parameters This argument is empty when excitations are pushed from a Nexxim
solution.
<PushExcitations Para- Array This parameter changes depending on whether the excitations
meters> comes from a transient or linear frequency solution. The keyword

Design Object Script Commands 9-112


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"transient:=" indicates to AEDT which solution generated the


excitations. If "transient:=" is present, "CalcThevenin ="
and its value are ignored.
For a linear frequency solution, use this array:
Array("NAME:options",
"CalcThevenin =" , <true|false>,
"Sol:=", "<solution name>")
If CalcThevenin is true, Thevenin’s equivalent is calculated. Para-
meters for the linear frequency solution do not include a Freq argu-
ment, so all frequencies from the solution are used.
For a transient solution, use:
Array("NAME:options",
"transient:=", Array(
"start:=", <start time>,
"stop:=", <stop time>,
"maxHarmonics:=", <max harmonics>,
"winType:=", <window>,
["widthPct:=", <width percentage>,]
["kaiser:=", <Kaiser value>,]
["correctCoherentGain:=", true]),
"Sol:=", "<solution name>")
winType can have the following values:
l Rectangular

Design Object Script Commands 9-113


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l Bartlett
l Blackman
l Hamming
l Hanning
l Kaiser
l Welch
l Weber
l Lanzcos

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

PushExcitations "<refdes>", Array("NAME:options", "transient:=",


["CalcThevenin =" , <true>], Array("start:=", <start time>, "stop:=", <stop time>,
VB Syntax "maxHarmonics:=", <max harmonics>, "winType:=", <window>,
["widthPct:=", <width percentage>,] ["kaiser:=", <Kaier value>,]
["correctCoherentGain:=", true]), "Sol:=", "<solution name>")

For a transient solution:


VB Example Set oEditor = oDesign.SetActiveEditor("Layout")
oEditor.PushExcitations "U3", Array("NAME:options", _

Design Object Script Commands 9-114


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"transient:=", Array("start:=", 0, "stop:=", 5E-005, _


"maxHarmonics:=", 100, "winType:=", "Rectangular", _
"widthPct:=", 100, "kaiser:=", 0, "correctCoherentGain:=",_
true), "Sol:=", "Transient")

Set oDesign = oProject.SetActiveEditor("Design1")


oDesign.PushExcitations "", Array("NAME:options", _
"transient:=", Array("start:=", 0, "stop:=", 1E-08, _
"maxHarmonics:=", 100, "winType:=", "Hamming", _
"widthPct:=", 100, "kaiser:=", 0, "correctCoherentGain:=",_
true), "Sol:=", "Transient Setup 1")

For a linear frequency solution:


Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
oEditor.PushExcitations "S1", Array("NAME:options", _
"CalcThevenin:=", false, "Sol:=", "LinearFrequency")

Redo [Design]
Reapplies the last design-level command.

UI Access Edit > Redo.


Parameters None.

Design Object Script Commands 9-115


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax Redo()


oDesign.Redo()
Python Example

VB Syntax Redo
VB Example oDesign.Redo

Redo [HFSS 3D Layout]


Redo the last operation
Command: Edit>Redo
Syntax: Redo
Return Value: None
Parameters: None
VB Example: oDesign.Redo

RemoveImportData [HFSS 3D Layout]


Remove an imported solution
Command: None
Syntax: RemoveImportData <solution_name>

Design Object Script Commands 9-116


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value: None


Parameters: <solution_name>
Type: string
VB Example: oDesign.RemoveImportData <solution_name>

RemoveModelingProperties [HFSS 3D Layout]


Remove a modeling property from a design
Command: None
Syntax: RemoveModelingProperties <design>
Return Value: None
Parameters: <design>
Type: string
VB Example: oDesign.RemoveModelingProperties <design>

RenameDesignInstance
Renames a design instance.

UI Access Right-click a design instance in the project tree, and then click Rename on the shortcut menu.

Name Type Description


Parameters
<OldName> String The current name of the design, which must be the design on which this com-
mand is invoked.
<NewName> String The new name for the design.

Return Value None.

Design Object Script Commands 9-117


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax RenameDesignInstance (<OldName>, <NewName>)


Python Example oDesign.RenameDesignInstance("Design1", "Design2")

VB Syntax RenameDesignInstance <OldName>, <NewName>


VB Example oDesign.RenameDesignInstance "Design1", "Design2"

RenameDesignInstance [HFSS 3D Layout]


Rename the design instance
Command: None
Syntax: RenameDesignInstance <oldname> <newname>
Return Value: None
Parameters: <oldname>
Type: string
<newname>
Type: string
VB Example: oDesign.RenameDesignInstance <oldname> <newname>

RenameImportData [HFSS 3D Layout]


Rename an imported solution
Command: None
Syntax: RenameImportData <oldname> <newname>

Design Object Script Commands 9-118


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value: None


Parameters: <oldname>
Type: string
<newname>
Type: string
VB Example: oDesign.RenameImportData <oldname> <newname>

RenameSource [Interface Source]


Use: Renames an interface source
Syntax: RenameSource (STRING: Interface Source name)
VB Example: oModule.RenameSource "OldName" "NewName"

ReportTemplates [HFSS 3D Layout]


Use: Creates a report using one of the HFSS 3D Layout report templates
Command: None
Syntax: ReportTemplates <template>
Return Value: None
Parameters: <template>
Type: string
Example: oDesign.ReportTemplates <template>

Design Object Script Commands 9-119


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

RunToolkit
Runs a Python toolkit script, applying it to the active design. The toolkit script itself may have prerequisites, such as sweeps defined, or
specific model characteristics, such as port definitions.

Important:

Full scripting for cable modeling is not supported and no arguments are allowed in the script. The RunToolkit command
will not automatically create a cable bundle, but will simply open the Cable Modeling dialog box. You will have to manually
input your parameters.

UI Access [HFSS] > Toolkit > [Script Name].

Name Type Description


<LibraryType> String Name of the library in which the script is located.
Parameters
<ToolkitName> String Name of the Python script.
<ToolkitArg> Array Structured array containing arguments required by the toolkit script.

Return Value User-defined solution(s) and/or output(s).

Python Syntax RunToolkit(<LibraryType>, <ToolkitName>, <ToolkitArg>)


Python Example oDesign.RunToolkit("SysLib", "Hearing Aid Compliance", [])

VB Syntax RunToolkit <LibraryType>, <ToolkitName>, <ToolkitArg>


oDesign.RunToolkit "SysLib", "Wavelength Calculator", Array()
VB Example
oDesign.RunToolkit "SysLib", "Hearing Aid Compliance", Array()

Design Object Script Commands 9-120


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SARSetup
Sets up for the specific absorption rate (SAR) computation. This command does not apply to HFSS-IE.

UI Access HFSS > Fields > SAR Setting.

Name Type Description


<TissueMass> Double Value represents mass of tissue between 1 and 10 in grams.
<MaterialDensity> Double Density of material in gram/cm^3.
Parameters <VoxelSize> Double Size of a voxel in millimeters.
<AverageSARMethod> Integer 0 - IEEE std 1528.
1 - Gridless, i.e. classical Ansoft method.

Return Value None.

Python Syntax SARSetup(<TissueMass>, <MaterialDensity>, <TissueObjectListID>, <VoxelSize>, <AverageSARMethod>)


Python Example oDesign.SARSetup(1.0, 1.0, 678, 1.0, 0)

VB Syntax SARSetup <TissueMass>, <MaterialDensity>, <TissueObjectListID>, <VoxelSize>, <AverageSARMethod>


VB Example oDesign.SARSetup 1.0, 1.0, 678, 1.0, 0

SetActiveEditor
Sets the active editor.

UI Access N/A.

Parameters Name Type Description

Design Object Script Commands 9-121


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<EditorName> String Text of the design's notes.

Return Value Editor object.

Python Syntax SetActiveEditor(<EditorName>)


Python Example oDesign.SetActiveEditor('3D Modeler')

VB Syntax SetActiveEditor <EditorName>


VB Example oDesign.SetActiveEditor "3D Modeler"

SetActiveEditor [HFSS 3D Layout]


Set the active editor to the named one. (Activates window or opens window if necessary).
Command: None
Syntax: SetActiveEditor <editorName> <object_variable>
Return Value: None
Parameters: <editorName>
Type: string
<object_variable>
Type: string
VB Example: oDesign.SetActiveEditor <editorName> <object_variable>

Design Object Script Commands 9-122


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetAllowMaterialOverride
Sets the option to allow material override.

UI Access N/A.

Name Type Description


Parameters <allowMaterialOverride> Integer 1 - allow material override.
0 - does not allow material override.

Return Value None.

Python Syntax SetAllowMaterialOverride(<allowMaterialOverride>)


Python Example oDesign.SetAllowMaterialOverride(1)

VB Syntax SetAllowMaterialOverride <allowMaterialOverride>


VB Example oDesign.SetAllowMaterialOverride 1

SetBackgroundMaterial
Sets the design's background material.

Important:

You can only use this script in 2D Extractor if there is no surface ground in the design and the problem type is "open".

UI Access From the Project Manager, right-click the design and select Set Background Material.

Design Object Script Commands 9-123


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


Parameters
<matName> String Material name.

Return Value None.

Python Syntax SetBackgroundMaterial(<matName>)


Python Example oDesign.SetBackgroundMaterial('vacuum')

VB Syntax SetBackgroundMaterial <matName>


VB Example oDesign.SetBackgroundMaterial "vacuum"

SetDesignMode
Switches between HFSS 3D Layout operating modes.

UI Access Edit Layout...

Name Type Description


Parameters
<modeName> String Enter "IC" or "General" to change operating modes.

Return Value None.

Python Syntax SetDesignMode(<modeName>)


Python Example oDesign.SetDesignMode("IC")

Design Object Script Commands 9-124


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax SetDesignMode <modeName>


VB Example oDesign.SetDesignMode "IC"

SetDesignSettings
Sets the design settings.

UI Access HFSS > Design Settings

Name Type Description


<DesignSettings> Array ["NAME:<DesignSettingsName>",
"Use Advanced DC Extrapolation:=" <boolean>,
"Port Validation Settings=:" <String of ["Standard" | "Extended"]>
"Calculate Lossy Dielectrics:=" <boolean>
"Use Power S:=" <boolean>,
"Export After Simulation:=" <boolean>,
Parameters
"Export FRTM After Simulation:=" <boolean>,
"Export Dir:=" <string of path>,
"Allow Material Override:=" <boolean>,
"Calculate Lossy Dielectrics:=" <boolean>,
"EnabledObjects:=" <array of objects>,
"Maximum Number of Frequencies for Broadband Adapt:=" <integer>]
<ModelValidationSettings> Array ["NAME:Validation Options",

Design Object Script Commands 9-125


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"EntityCheckLevel:=" <String of ["strict" | "none" | "warningOnly" | "basic"


]>,
"IgnoreUnclassifiedObjects:=" <boolean>,
"SkipIntersectionChecks:=" <boolean>),
"Design Validation Settings:=" "Perform full validations" )

Return Value None.

Python Syntax SetDesignSettings(<propName>, <description>)


Design.SetDesignSettings(
[
"NAME:Design Settings Data",
"Use Power S:=" , False,
"Export FRTM After Simulation:=", True,
"Allow Material Override:=", False,
Python Example
"Calculate Lossy Dielectrics:=", False,
"Perform Minimal validation:=", False,
"EnabledObjects:=" , [],
"Port Validation Settings:=", "Standard",
"Save Adaptive support files:=", True
],

Design Object Script Commands 9-126


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:Model Validation Settings",
"EntityCheckLevel:=" , "Strict",
"IgnoreUnclassifiedObjects:=", False,
"SkipIntersectionChecks:=", False
])

Python Syntax SetDesignSettings (<DesignSettings>, <ModelValidationSettings>)


oDesign.SetDesignSettings(
[
"NAME:Design Settings Data",
"Use Advanced DC Extrapolation:=", True,
"Use Power S:=", False,
"Export After Simulation:=", False,
Python Example
"Allow Material Override:=", True,
"Calculate Lossy Dielectrics:=", True,
"Perform Minimal validation:=", False,
"EnabledObjects:=", [],
"Port Validation Settings:=", "Standard"
"Maximum Number of Frequencies for Broadband Adapt:=", 5

Design Object Script Commands 9-127


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

],
[
"NAME:Model Validation Settings",
"EntityCheckLevel:=", "Strict",
"IgnoreUnclassifiedObjects:=", False,
"SkipIntersectionChecks:=", False
])

VB Syntax SetDesignSettings <DesignSettings>, <ModelValidationSettings>


oDesign.SetDesignSettings
Array(
"NAME:Design Settings Data",
"Use Advanced DC Extrapolation:=", True,
"Use Power S:=", False,
VB Example
"Export After Simulation:=", False,
"Allow Material Override:=", True,
"Calculate Lossy Dielectrics:=", True,
"Perform Minimal validation:=", False,
"EnabledObjects:=", [],

Design Object Script Commands 9-128


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Port Validation Settings:=", "Standard"


"Maximum Number of Frequencies for Broadband Adapt:=", 5
),
Array(
"NAME:Model Validation Settings",
"EntityCheckLevel:=", "Strict",
"IgnoreUnclassifiedObjects:=", False,
"SkipIntersectionChecks:=", False
)

SetDoMeshAssembly
Set the active Mesh fusion properties for each object.
Command: Set Components for Mesh Fusion
Syntax: SetDoMeshAssembly <MeshAssemblyParameters>
Return Value: None
Parameters: <MeshAssemblyParameters>
Python Example
oDesign.SetDoMeshAssembly(
[
"NAME:AllSettings",
[
"NAME:MeshAssembly",

Design Object Script Commands 9-129


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:Cylinder3",
[
"NAME:MeshSetting",
[
"NAME:GlobalSurfApproximation",
"CurvedSurfaceApproxChoice:=", "UseSlider",
"SliderMeshSettings:=" , 7
],
[
"NAME:GlobalCurvilinear",
"Apply:=" , False
],
[
"NAME:GlobalModelRes",
"UseAutoLength:=" , True
],
"MeshMethod:=" , "AnsoftClassic",
"UseLegacyFaceterForTauVolumeMesh:=", False,
"DynamicSurfaceResolution:=", False,

Design Object Script Commands 9-130


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseFlexMeshingForTAUvolumeMesh:=", False,
"UseAlternativeMeshMethodsAsFallBack:=", True,
"AllowPhiForLayeredGeometry:=", True
],
"MeshAssemblyBoundingVolumePadding:=", ["0","0","0","0","0","0"]
],
[
"NAME:Pentagon_tilted2_1",
"MeshAssemblyBoundingVolumePadding:=", ["0","0","0","0","0","0"]
],
[
"NAME:Cone_with_variable1",
"MeshAssemblyBoundingVolumePadding:=", ["0","0","0","0","0","0"]
]
],
[
"NAME:Priority Components",
"Cylinder3",
"Cone_with_variable1",
"BoxWithMeshRegion1"
]

Design Object Script Commands 9-131


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

])

SetFastTransformationForLayoutComponent
Toggles whether layout components in HFSS 3D show outlines of objects across layers during view changes. This improves the visu-
alization performance.

UI Access Fast Transformation

Name Type Description


Parameters <Layout ComponentName> String Name of the Layout Component.
Boolean String True or False

Return Value None.

Python Syntax SetFastTransformationForLayoutComponent ("<LayoutComponentName", <boolean> )


Python Example oDesign.SetFastTransformationForLayoutComponent ("LC1_1", False)

SetLengthSettings
Sets the distributed and lumped lengths of the design, as well as the rise time.

UI Access N/A

Name Type Description


Parameters <DistributedUnits> String Length units used for post-processing.
<LumpedLength> String Length of design in post-processing.

Design Object Script Commands 9-132


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<RiseTime> String Time used in post-processing.

Return Value None.

Python Syntax SetLengthSettings(<DistributedUnits>, <LumpedLength>, <RiseTime>)


Python Example oDesign.SetLengthSettings('mm', '7meter', '1s')

VB Syntax SetLengthSettings<DistributedUnits>, <LumpedLength>, <RiseTime>)


VB Example oDesign.SetLengthSettings "mm", "7meter", "1s"

SetObjectAttributesForLayoutComponent
Sets visualization attributes for layout components in HFSS 3D for a named component for layers, net and objects.

UI Access Object Attributes

Name Type Description


Parameters
<Layout ComponentName> String Name of the Layout Component.

Return Value None.

SetObjectAttributesForLayoutComponent (["<LayoutComponentName",[ <ObjectAttributesinNetMode>][


Python Syntax
<ObjectAttributesinLayerMode>],[ <ObjectAttributesinObjectMode>])
oDesign.SetObjectAttributesForLayoutComponent (
Python Example [
"Name:=" , "LC1_1",

Design Object Script Commands 9-133


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ShowDielectric:=" , False,
"DisplayMode:=" , 2,
[
"NAME:ObjectAttributesInLayerMode",
"GND_1_L2:=" , [True,True,0],
"GND_2_L4:=" , [True,True,0],
"GND_3_L6:=" , [True,True,0],
"GND_4_L9:=" , [True,True,0],
"GND_5_L11:=" , [True,True,0],
"Inner_Layer_3_L10:=" , [True,True,0],
"Top_L1:=" , [True,True,100],
"VCC1_L7:=" , [True,True,0],
"VCC2_L8:=" , [True,True,0]
],
[
"NAME:ObjectAttributesInNetMode",
"GND:=" , [True,True,29],
"VCC:=" , [True,True,0],
"neg:=" , [True,True,67],
"pos:=" , [True,True,67]

Design Object Script Commands 9-134


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

],
[
"NAME:ObjectAttributesInObjectMode",
"line_1:=" , [True,True,0],
"line_2:=" , [True,True,0],
"line_3:=" , [True,True,100],
"line_4:=" , [True,True,100],
"rect_6:=" , [True,True,0],
"rect_17:=" , [True,True,0],
"rect_18:=" , [True,True,0],
"rect_19:=" , [True,True,0],
"rect_20:=" , [True,True,0],
"rect_21:=" , [True,True,0],
"rect_22:=" , [True,True,0],
"line_24:=" , [True,True,100],
"via_0:=" , [True,True,100],
"via_1:=" , [True,True,100],
"via_2:=" , [True,True,100],
"via_3:=" , [True,True,100]
]
])

Design Object Script Commands 9-135


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetObjectDeformation
Sets the deformation of objects when calling Ansys Electronics Desktop from Ansys Workbench

UI Access N/A

Name Type Description


Parameters
<ObjectArray> Array Objects to set.

Return Value None.

Python Syntax SetObjectDeformation(<ObjectArray>)


Python Example oDesign.SetObjectDeformation(["EnabledObjects:=" , ["Cylinder1", "Sphere1"]])

VB Syn- SetObjectDeformation <ObjectArray>


tax

VB oDesign.SetObjectDeformation Array("EnabledObjects:=" , Array("Cylinder1", "Sphere1"))


Example

SetObjectTemperature
Sets the temperature of objects.

UI Access HFSS > Set Object Temperature

Design Object Script Commands 9-136


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<TemperatureSettings> Array ["NAME": <SettingName>,
"IncludeTemperatureDependence:=", <boolean, True
to include temperature dependence. False to not
Parameters include.>,
"EnableFeedback:=", <boolean, True to enable feed-
back. False to not enable feedback.>,
"Temperatures:=", <Temperatures>]
<Temperatures> Array Objects and temperatures.

Return Value None.

Python Syntax oDesign.SetObjectTemperature(<TemperatureSettings>)


oDesign.SetObjectTemperature(
[
"NAME:TemperatureSettings",
Python Example "IncludeTemperatureDependence:=", True,
"EnableFeedback:=" , False,
"Temperatures:=" , ["RegularPolyhedron1","22cel","Polygon1","22cel"
])

VB Syn- oDesign.SetObjectTemperature <TemperatureSettings>


tax

Design Object Script Commands 9-137


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDesign.SetObjectTemperature Array(

VB "NAME:TemperatureSettings", "IncludeTemperatureDependence:=", _
Example true, "EnableFeedback:=", true, "Temperatures:=", Array("RegularPolyhedron1", _
"22cel", "Polygon1", "22cel"))

SetPhaseCenterPerPort
Sets phase center per port for an HFSS Modal antenna in preparation for link to a target SBR+ design.

UI Access N/A

Name Type Description


<PhaseCenterArray> Array Structured array
Array(
"NAME:<PortName>", "Coordinate System:=", <CSName>,
Parameters
"NAME:<PortName>", "Coordinate System:=",
<CSName>,...)
Note: specified "CSName" must be valid as phase center for source far
fields.

Return Value None.

Python Syntax SetPhaseCenterPerPort(<PhaseCenterArray>)


Python Example oModule.SetPhaseCenterPerPort(

Design Object Script Commands 9-138


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:1", "Coordinate System:=", "Phase Center CS1",
"NAME:2", "Coordinate System:=", "Phase Center CS2"
])

VB Syntax SetPhaseCenterPerPort <PhaseCenterArray>


oModule.SetPhaseCenterPerPort Array( _
VB Example "NAME:1", "Coordinate System:=", "Phase Center CS1", _
"NAME:2", "Coordinate System:=", "Phase Center CS2")

SetPropValue [Design]
Sets the property value for the active property object.

UI Access Edit properties on Project Tree objects.

Name Type Description


Parameters <propPath> String A child object's property path. See: Object Property Script Function Summary.
<Value> String New property value.

Boolean:
Return Value l True - property found and the new value is valid.
l False - property not found.

Python Syn- SetPropValue(<propPath>, <Value>)

Design Object Script Commands 9-139


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

tax

Python oDesign.SetPropValue("offset", "12mm")


Example oDesign.SetPropValue("Results/S Parameter Plot 1/Display Type", "Rectangular Plot")

VB Syntax SetPropValue <propPath>, <Value>


oDesign.SetPropValue "offset", "12mm"
VB Example
oDesign.SetPropValue "Results/S Parameter Plot 1/Display Type", "Rectangular Plot"

SetPropertyValue
Sets the value of a single propertybelonging to a specific PropServer and PropTab. This function is available with the Project, Design
or Editor objects, including definition editors.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.
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.

UI Access N/A

Name Type Description


<propTab> String One of the following, where tab titles are shown in parentheses:
l PassedParameterTab ("Parameter Values")
Parameters
l DefinitionParameterTab (Parameter Defaults")

l LocalVariableTab ("Variables" or "Local Variables")

Design Object Script Commands 9-140


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l ProjectVariableTab ("Project variables")

l ConstantsTab ("Constants")

l BaseElementTab ("Symbol" or "Footprint")

l ComponentTab ("General")

l Component("Component")

l CustomTab ("Intrinsic Variables")

l Quantities ("Quantities")

l Signals ("Signals")
<propServer> String An object identifier, generally returned from another script method, such as
Comp-Inst@R;2;3
<propName> String Name of the property.
<propValue> String The value for the property

Return Value None.

Python Syntax SetPropertyValue(<propTab>, <propServer>, <propName>, <propValue>)


Python Example oEditor.SetPropertyValue("PassedParameterTab", "k", "R", "2200")

VB Syntax SetPropertyValue <propTab>, <propServer>, <propName>, <propValue>


VB Example oEditor.SetPropertyValue "PassedParameterTab", "k", "R", "2200"

Design Object Script Commands 9-141


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetShowLayoutForLayoutComponent
Layout visualization, rather than bounding box, for a Layout Component in an HFSS 3D design.

UI Access Edit Layout...

Name Type Description


Parameters <Layout ComponentName> String Name of the Layout Component.
Boolean String True or False

Return Value None.

Python Syntax SetShowLayoutForLayoutComponent ("<LayoutComponentName", <boolean> )


Python Example oDesign.SetShowLayoutForLayoutComponent ("LC1_1", True)

SetSinglePhaseCenter
Sets a single phase center for an HFSS Modal antenna in preparation for link to a target SBR+ design.

UI Access N/A

Name Type Description


Parameters
<CSName> String Phase center coordinate system name.

Return Value None.

Design Object Script Commands 9-142


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax SetSinglePhaseCenter(<CSName>)


Python Example oModule.SetSinglePhaseCenter("Phase Center CS1")

VB Syntax SetSinglePhaseCenter <CSName>


VB Example oModule.SetSinglePhaseCenter "Phase Center CS1"

SetSolutionType
Sets the solution type for the design.

UI Access HFSS > Solution Type.

Name Type Description


<SolutionType> String Possible values are: "SBR+", "HFSS [Modal | Terminal] [ Network | Com-
posite]","Transient [Network | Composite]", "Eigenmode", or "Char-
acteristic".
Parameters EnableAutoOpen:=, Boolean Only .
l True - turn on auto open mode.
False - turn off auto open mode.
l

<ModelExteriorAsIE> String Only Applies for Driven Solution Type with Auto Open Mode as True.
Possible values are: Radiation, FEBI, PML

Return Value None.

Python Syntax SetSolutionType(<SolutionType>, <AutoOpenMode>, <ModelExteriorAsIE>)


Python Example oDesign.SetSolutionType("HFSS Modal Network",

Design Object Script Commands 9-143


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:Options",
"EnableAutoOpen:=" , False
])

oDesign.SetSolutionType("Transient Network",
[
"NAME:Options",
"EnableAutoOpen:=" , False
])

oDesign.SetSolutionType("HFSS Hybrid Modal Network",


[
"NAME:Options",
"EnableAutoOpen:=" , False
])

oDesign.SetSolutionType("SBR+",
[
"NAME:Options",

Design Object Script Commands 9-144


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"EnableAutoOpen:=" , False
])

VB SetSolutionType <SolutionType>, <AutoOpenMode>, <ModelExteriorAsIE>


Syntax

oDesign.SetSolutionType "Transient Network", Array("NAME:Options", "EnableAutoOpen:=",


true, "BoundaryType:=", "Radiation")
VB
Exam- oDesign.SetSolutionType "SBR+", Array("NAME:Options", "EnableAutoOpen:=", false)
ple
oDesign.SetSolutionType "HFSS Terminal Composite", Array("NAME:Options",
"EnableAutoOpen:=", false)

SetSolveInsideThreshold
Sets the solve inside threshold to the specified double.

UI Access N/A

Name Type Description


Parameters
<threshold> Double Siemens/m.

Return Value None.

Python Syntax SetSolveInsideThreshold(<threshold>)


Python Example oDesign.SetSolveInsideThreshold(100000)

Design Object Script Commands 9-145


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax SetSolveInsideThreshold <threshold>


VB Example oDesign.SetSolveInsideThreshold 100000

SetSourceContexts
For Near or Far Field projects for Driven Modal or Driven Terminal Network Analysis Solutions, specifies the port name and all mod-
es/terminals of that port to be enabled as Source Context.

UI Access HFSS > Fields > Edit Sources.

Name Type Description


Parameters
<SourceId> Array Name of modes/terminals to be set as source context.

Return Value None.

Python Syntax SetSourceContexts(<SourceId>)


oModule.SetSourceContexts(
[
Python Example
"Box1_T1", "Box1_T2", "Box1_T3", "Current1", "IncPWave1"
])

VB Syntax SetSourceContexts <SourceId>


VB Example oModule.SetSourceContexts _

Design Object Script Commands 9-146


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("Box1_T1", "Box1_T2", "Box1_T3", "Current1", "IncPWave1")

SetVariableValue
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.

UI Access N/A

Name Type Description


Parameters <VarName> String Variable name.
<VarValue> Value New value for the variable.

Return Value None.

Python Syntax SetVariableValue (<VarName>, <VarValue>)


Python Example oProject.SetVariableValue('$Var1', '3mm')

VB Syntax SetVariableValue <VarName>, <VarValue>


VB Example oProject.SetVariableValue "$Var1", "3mm"

SimulateLink
Runs linked simulation.

UI Access N/A

Design Object Script Commands 9-147


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<setup> String Setup name.
Parameters <linkedDesign> Object Optional. Linked design.
<linkType> String Optional. Type of linked design.
<msg> String Optional. Messages to add.

Return Value None.

Python Syntax SimulateLink(<setup>, <linkedDesign>, <linkType>, <msg>)


Python Example oDesign.SimulateLink("1_4GHz")

VB Syntax SimulateLink <setup>, <linkedDesign>, <linkType>, <msg>


VB Example oDesign.SimulateLink "1_4GHz"

Solve
Performs one or more simulation. The next script command will not be executed until the simulation(s) are complete.

UI Access Select solution setup(s). Right-click and select Analyze.

Name Type Description


Parameters
<SimulationNames> Array Array containing string simulation names.

Integer:
Return Value
l 0 – Simulation(s) completed.

Design Object Script Commands 9-148


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l 1 – Simulation error.
l -1 – Command execution error.

Python Syntax Solve <SimulationNames>


Python Example oDesign.Solve(['Setup1','Setup2','Setup3'])

VB Syntax Solve <SimulationNames>


VB Example oDesign.Solve Array("Setup1", "Setup2", "Setup3")

StartAnalysis [HFSS 3D Layout]


Simulates all setups
Command: None
Syntax: StartAnalysis
Return Value: None
Parameters: None
VB Example: oDesign.StartAnalysis

StopSimLink
Stops linked simulation.

UI Access N/A

Name Type Description


Parameters
<simId> Integer ID of specified simulation.

Design Object Script Commands 9-149


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<abort> Boolean Whether to stop the running simulation:


l True - abort the running simulation.
l False - do not abort running simulation.

Return Value None.

Python Syntax StopSimLink(<simId>, <abort>)


Python Example oDesign.StopSimLink(18, True)

VB Syntax StopSimLink <simId>, <abort>


VB Example oDesign.StopSimLink 18, true

Undo [Design]
Cancels the last design-level command.

UI Access Edit > Undo


Parameters None.
Return Value None.

Python Syntax Undo()

Design Object Script Commands 9-150


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Example oDesign.Undo()

VB Syntax Undo
VB Example oDesign.Undo

Undo [HFSS 3D Layout]


Undo the last operation
Command: Edit>Undo
Syntax: Undo
Return Value: None
Parameters: None
VB Example: oDesign.Undo

ValidateLink

Note:
This command is for internal Ansys use only.

Python Syntax ValidateLink()


Python Example oDesign.ValidateLink()

Design Object Script Commands 9-151


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ValidateDesign
Returns whether a design is valid.

UI Access HFSS > Validation Check.


Parameters None.
Integer:
Return Value l 1 – Validation passed.
l 0 – Validation failed.

Python Syntax ValidateDesign()


Python Example oDesign.ValidateDesign()

VB Syntax ValidateDesign
VB Example oDesign.ValidateDesign

ValidateLink

Note:
This command is for internal Ansys use only.

Python Syntax ValidateLink()

Design Object Script Commands 9-152


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Example oDesign.ValidateLink()

Design Object Script Commands 9-153


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

9-154
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

10 - Model Setup Script Commands


Model Setup Script Commands should be executed by:
Set oModule = oDesign.GetModule("ModelSetup")
These commands are as follows:
AssignArray
CreateArrayAirbox
CreateOpenRegion
DeleteArray
GetArrayNames
GetLatticeVectors
EditArray
IsArrayDefined
UpdateArrayAirbox
UpdateOpenRegionPadding

Assign Array
Creates an array based on a unit cell model.
If the array has Enable Sizing Variable enabled, a block for Enable Sizing Variable will occur, and will show for AVector and for
BVector. The Python example shows this block.

UI Access HFSS > Model > Create Array.

Parameters Name Type Description

Model Setup Script Commands 10-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<Parameters> Array Structured array.


Array(NAME:<string>",
"Type:=", "Regular",
"Name:=", "<string>",
"UseAirObjects:=", <boolean>,
"RowPrimaryBnd:=", "Primary<n>",
"ColumnPrimaryBnd:=", "Primary<n>",
"RowDimension:=", <value>,
"ColumnDimension:=", <value>,
"PostProcessRow:=", <value>,
"PostProcessCol:=", <value>,
"ReferenceCSID:=" <Refer-
enceCoordinateSystemID>,
"Active:=", "All",
[<arraycoords> or "None"]
)

Return Value None.

Python Syntax AssignArray(<Parameters>)


Python Example oModule = oDesign.GetModule("ModelSetup")

Model Setup Script Commands 10-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.AssignArray(
[
"NAME:A",
"Name:=" , "A",
"UseAirObjects:=" , True,
"RowPrimaryBnd:=" , "Primary1",
"ColumnPrimaryBnd:=" , "Primary2",
"RowDimension:=" , 5,
"ColumnDimension:=" , 5,
"Visible:=" , False,
"ShowCellNumber:=" , True,
"RenderType:=" , 0,
"Padding:=" , 1,
"PostProcessRow:=" , "3",
"PostProcessCol:=" , "3",
"Active:=" , "All",
"Air:=" , "None"
[
"Name:EnableSizingVariable",
"ForAVector:=", "AVectorVar",
"ForBVector:=". "BVectorVar"

Model Setup Script Commands 10-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

]
])

VB Syn- AssignArray <Parameters>


tax

oModule.AssignArray Array("NAME:A", "Name:=", "A", "UseAirObjects:=", true,


"RowPrimaryBnd:=", _
"Master1", "ColumnPrimaryBnd:=", "Master2", "RowDimension:=", 3, "ColumnDimension:=",
_
VB
Example 2, "Visible:=", true, "ShowCellNumber:=", true, "RenderType:=", 0, "Padding:=", _
1, "PostProcessRow:=", "1", "PostProcessCol:=", "1", "ReferenceCSID:=", 1, "Active:=",
_
"All", "Air:=", "None")

CreateArrayAirbox
Creates an array airbox.

UI Access Create Array Airbox Enclosure.

Name Type Description


<Parameters> Array Structured array. Note: Direction is optional.
Parameters
Array(NAME:<string>",
"kXPosPad:=" , <real>,​

Model Setup Script Commands 10-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"kXNegPad:=" , <real>,​
"kYPosPad:=" , <real>,​
"kYNegPad:=" , <real>,​
"kZPosPad:=" , <real>,​
"kZNegPad:=" , <real>,​
"Boundary:=" , "<string>",​
"ApplyInfiniteGP:=" , <boolean>
["direction:=", "<InfiniteGPDirection>"]
)

Return Value None.

Python Syntax CreateArrayAirbox(<Parameters>)


oModule.CreateArrayAirbox(​
[​"NAME:Settings",​
"kXPosPad:=" , 0.05,​
"kXNegPad:=" , 0.05,​
Python Example "kYPosPad:=" , 0.05,​
"kYNegPad:=" , 0.05,​
"kZPosPad:=" , 0.05,​
"kZNegPad:=" , 0.2,​
"Boundary:=" , "PML",​

Model Setup Script Commands 10-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ApplyInfiniteGP:=" , False​
]
)

VB Syntax CreateArrayAirbox <Parameters>


oModule.CreateArrayAirbox Array("NAME:Settings", "kXPosPad:=", 0.05,
"kXNegPad:=", _
VB Example
0.05, "kYPosPad:=", 0.05, "kYNegPad:=", 0.05, "kZPosPad:=", 0.05, "kZNegPad:=", _
0, "Boundary:=", "Radiation", "ApplyInfiniteGP:=", true, "Direction:=", "-z")

CreateOpenRegion
Creates an open region volume.

UI Access HFSS > Model > Create Open Region...

Name Type Description


<OpenRegionParams> Array Structured array.
Array("NAME:Settings",

Parameters "OpFreq:=", "<value><unit>",


"Boundary:=", "<FEBI | Radiation | PML>",
"ApplyInfiniteGP:=", <boolean>,
"Direction:=", "<string coordinates>")

Model Setup Script Commands 10-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax CreateOpenRegion(<OpenRegionParams>)


oModule.CreateOpenRegion(
[
"NAME:Settings",
Python Example "OpFreq:=", "0.3GHz",
"Boundary:=", "PML",
"ApplyInfiniteGP:=", False
])

VB Syntax CreateOpenRegion <OpenRegionParams>


oModule.CreateOpenRegion _
Array("NAME:Settings", _
VB Example "OpFreq:=", "0.3GHz", _
"Boundary:=", "PML", _
"ApplyInfiniteGP:=", false)

DeleteArray
Use: Delete an existing array based on a unit cell model.
Command: Delete

Model Setup Script Commands 10-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax: DeleteArray
Return Value: None
Parameters: None
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("forcreatearraycube")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("ModelSetup")
oModule.DeleteArray

EditArray
Edits the properties of an existing array.

Model Setup Script Commands 10-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

If the array has Enable Sizing Variable enabled, a block for Enable Sizing Variable will occur, and will show for AVector and for
BVector. The Python example shows this block.

UI Access Properties window.

Name Type Description


<Parameters> Array Structured array.
Array(NAME:<string>",
"NAME:A",
"Name:=", "<string>",
"UseAirObjects:=", <boolean>,
"RowPrimaryBnd:=", "Primary<n>",

Parameters "ColumnPrimaryBnd:=", "Primary<n>",


"RowDimension:=", <value>,
"ColumnDimension:=", <value>,
"PostProcessRow:=", <value>,
"PostProcessCol:=", <value>,
"Active:=", "All" |
[<arraycoords>] or "None"]
)

Return Value None.

Model Setup Script Commands 10-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax EditArray (<Parameters>)


oModule.EditArray(​
[​"NAME:A",​
"Name:=" , "A",​
"UseAirObjects:=" , True,​
"RowPrimaryBnd:=" , "3DC_77GHz_Corner1_Sub1_LatticePair1",​
"ColumnPrimaryBnd:=" , "3DC_77GHz_Corner1_Sub1_LatticePair2",​
"RowDimension:=" , 5,​
"ColumnDimension:=" , 5,​
"Visible:=" , True,​
Python Example "ShowCellNumber:=" , True,​
"RenderType:=" , 0,​
"Padding:=" , 0,​
"ReferenceCSID:=" , 587,​
[​"NAME:Cells",​
"3DC_77GHz_Corner1_Sub1:=", ["[1,1], [2,1], [3,1], [4,1], [5,1]"],​
"3DC_Cell_Radome_In1:=" , ["[1,2], [2,2], [3,2], [4,2], [5,2]"],​
"3DC_Radome_Only_Sub1:=", ["[1,3], [2,3], [3,3], [4,3], [5,3]"],​
"3DC_77GHz_Side1_Sub1:=", ["[1,4], [2,4], [3,4], [4,4], [5,4]"],​
"3DC_Array_77GHz_Empty_Cell1:=", ["[1,5], [2,5], [3,5], [4,5],

Model Setup Script Commands 10-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[5,5]"
]​
],​
[​"NAME:Rotation"​
],​
"Active:=" , "All",​
[​
"NAME:PostProcessingCells"​
],​
"Colors:=" , []​
])

VB Syntax EditArray <Parameters>


oModule.EditArray Array("NAME:A", "Name:=", "A", "UseAirObjects:=", true, _
"RowPrimaryBnd:=", "PhasedArray1_1_Primary1", "ColumnPrimaryBnd:=", "PhasedAr-
ray1_1_Primary2", _
"RowDimension:=", 4, "ColumnDimension:=", 3, _
VB Example
"Visible:=", true, "RenderType:=", 0, "Padding:=", 0, "ReferenceCSID:=" , 587,​
Array("NAME:Cells", _
"PhasedArray1_1:=", Array("[1,1], [1,2], [1,3], [3,2]")), _
Array("NAME:Rotation"), "Active:=", "[1,1], [1,2], [1,3], [3,2]", _

Model Setup Script Commands 10-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:PostProcessingCells", "PhasedArray1_1:=", Array("3", "2")), _


"Colors:=", Array("PhasedArray1_1", "(128 128 255)"))

GetArrayNames
Gets names of the arrays defined in the current design.

UI Access N/A
Parameters None.
Return Value Array of names.

Python Syntax GetArrayNames()


Python Example oModule.GetArrayNames()

VB Syntax GetArrayNames
VB Example oModule.GetArrayNames

GetLatticeVectors
Gets lattice vectors defined in the current design.

UI Access N/A

Model Setup Script Commands 10-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters None.
Return Value Array of starting point coordinates paired with ending point coordinates.

Python Syntax GetLatticeVectors()


Python Example oModule.GetLatticeVectors()

VB Syntax GetLatticeVectors
VB Example oModule.GetLatticeVectors

IsArrayDefined
Determines whether an array is defined in the current design.

UI Access N/A
Parameters None.

Integer:
Return Value l 1 - an array is already defined.
l 0 - no array has been defined.

Python Syntax IsArrayDefined ()


Python Example oModule.IsArrayDefined()

Model Setup Script Commands 10-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax IsArrayDefined
VB Example oModule.IsArrayDefined

UpdateArrayAirbox
Updates an array airbox.

UI Access N/A.

Name Type Description


<Parameters> Array Structured array. Note: Direction is optional.
Array(NAME:<string>",
"kXPosPad:=" , <real>,​
"kXNegPad:=" , <real>,​
"kYPosPad:=" , <real>,​

Parameters "kYNegPad:=" , <real>,​


"kZPosPad:=" , <real>,​
"kZNegPad:=" , <real>,​
"Boundary:=" , "<string>",​
"ApplyInfiniteGP:=" , <true or false>​
,
["direction:=", "-z"" ]
)

Model Setup Script Commands 10-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax UpdateArrayAirbox (<Parameters>)


oModule.CreateArrayAirbox(​
[​"NAME:Settings",​
"kXPosPad:=" , 0.05,​
"kXNegPad:=" , 0.05,​
"kYPosPad:=" , 0.05,​
"kYNegPad:=" , 0.05,​
Python Example
"kZPosPad:=" , 0.05,​
"kZNegPad:=" , 0.2,​
"Boundary:=" , "PML",​
"ApplyInfiniteGP:=" , False​
]
)

VB Syntax UpdateArrayAirbox <Parameters>


oModule.UPdateOpenAirbox Array("NAME:Settings", "kXPosPad:=", 0.05, "kXNegPad:=",
VB Example _
0.05, "kYPosPad:=", 0.05, "kYNegPad:=", 0.05, "kZPosPad:=", 0.05, "kZNegPad:=", _

Model Setup Script Commands 10-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

0, "Boundary:=", "Radiation", "ApplyInfiniteGP:=", true, "Direction:=", "-z")

UpdateOpenRegionPadding
Updates the padding for a defined open region.

UI Access HFSS > Model > Update Open Region Padding...

Name Type Description


Parameters <OpFreq> String Specified solution frequency with unit.
<UseSolveSetup> Boolean Optional. True to specify frequency same as solve setup, false otherwise.

Return Value None.

Python Syntax UpdateOpenRegionPadding(<OpFreq>)


Python Example oModule.UpdateOpenRegionPadding("10GHz")

VB Syntax UpdateOpenRegionPadding <OpFreq>


VB Example oModule.UpdateOpenRegionPadding "10GHz"

Model Setup Script Commands 10-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

11 - 3D Modeler Editor Script Commands


3D Modeler commands should be executed by the "3D Modeler" editor:
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.<CommandName>

Conventions Used in this Chapter:


<AttributesArray>
<AttributesArray> takes the following structure:
Array("NAME:Attributes",
"Name:=", <string>,
"Flags:=", <string>,
"Color:=", <string>,
"Transparency:=", <value>,
"PartCoordinateSystem:=", <string>,
"UDMId:=", <string>,
"MaterialValue:=", <string>,
"SurfaceMaterialValue:=", <string>,
"Solveinside:=", <boolean>,
"ShellElement:=", <boolean>,
"ShellElementThickness:=", <string>,
"IsMaterialEditable:=", <boolean>,

3D Modeler Editor Script Commands 11-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseMaterialAppearance:=", <boolean>,
"IsLightweight:=", <boolean>)
Where:
l Flags – Takes a string containing "NonModel" and/or "Wireframe", separated by the # character. For example,
"NonModel#Wireframe".
l Color – Takes a string containing an RGB triple, formatted as "(<RGB>)". For example, "(255 255 255)".
l Transparency – Takes a value between 0 and 1.
l PartCoordinateSystem – Orientation of the primitive. The name of one of the defined coordinate systems should be specified.
l UDMId – Takes a string containing an ID.
l MaterialValue – Takes a string of the material name.
l SurfaceMaterialValue – Takes a string of the surface material name.
l Solveinside – Takes a boolean value.
l ShellElement – Takes a boolean value specifying whether or not a shell element is present.
l ShellElementThickness – Takes a string containing the shell element thickness. If element is not present, pass empty string.
l IsMaterialEditable – Takes a boolean value.
l IsLightweight – Takes a boolean value.

<SelectionsArray>
<SelectionsArray> typically takes the following structure:
Array("NAME:Selections",
"Selections:=", <string>)
Where:

3D Modeler Editor Script Commands 11-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l Selections – Takes a comma-separated list of parts on which to perform the action. For example, "Rect1, Rect2, Rect3".

In some cases, <SelectionsArray> takes additional parameters:


Array("NAME:Selections",
"AllowRegionDependentPartSelectionForPMLCreation:=", <boolean>,
"AllowRegionSelectionForPMLCreation:=", <boolean>,
"Selections:=", <string>,
"NewPartsModelFlag:=" , <string>,
"UseCurrentCS:=", <boolean>)
Where:
l AllowRegionDependentPartSelectionForPMLCreation – Takes a boolean value. See individual script for whether this para-
meter is required.
l AllowRegionSelectionForPMLCreation – Takes a boolean value. See individual script for whether this parameter is required.
l Selections – Takes a comma-separated list of parts on which to perform the action. For example, "Rect1, Rect2, Rect3".
l NewPartsModelFlag – Takes either string "Model" or string "Nonmodel". See individual script for whether this parameter is
required.
l UseCurrentCS – Takes a boolean value. See individual script for whether this parameter is required. Use GetAct-
iveCoordinateSystem to determine the current CS.

Note:

Selections is the only parameter required in all 3D Modeler Editor scripts. See individual scripts for additional required para-
meters.

Organization

3D Modeler Editor Script Commands 11-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

3D Modeler editor scripts are organized into the following categories:


Draw Menu Commands
Edit Menu Commands
Modeler Menu Commands
Cable Modeling Commands
Other oEditor Commands

Edit Menu Commands


Copy
DeletePolylinePoint
DuplicateAlongLine
DuplicateAroundAxis
DuplicateMirror
Mirror
Move
OffsetFaces
Paste
Rotate
Scale
Copy
Copies specified part(s) to the clipboard.

3D Modeler Editor Script Commands 11-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

Python Syntax Copy(<SelectionsArray>)


oEditor.Copy([
Python Example "NAME:Selections",
"Selections:=", "Box1"])

VB Syntax Copy <SelectionsArray>


oEditor.Copy Array(
VB Example "NAME:Selections",
"Selections:=", "Box1")

DeletePolylinePoint
Deletes either a start point or an end point from an existing polyline segment.

UI Access Edit > Delete [Start/End] Point

Name Type Description


<DeletePointArray> Array Structured array.
Parameters
Array("NAME:Delete Point",
"Selections:=", <string

3D Modeler Editor Script Commands 11-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"<PolylineName>:<PolylineAction>:<int>">,
"Segment Index:=", <integer>,
"At Start:=", <bool True for start point; False
for end point>)

Return Value None.

Python Syntax DeletePolylinePoint (<DeletePointArray>)


oEditor.DeletePolylinePoint(["NAME:Delete Point",
"Selections:=", "Polyline1:CreatePolyline:1",
Python Example
"Segment Index:=", 1,
"At Start:=", True])

VB Syn- DeletePolylinePoint <DeletePointArray>


tax

oEditor.DeletePolylinePoint Array("NAME:Delete Point", "Selections:=",


VB "Polyline1:CreatePolyline:1",
Example
"Segment Index:=", 1, "At Start:=", True)

DuplicateAlongLine
Duplicates specified parts along a line.

UI Access Edit > Duplicate > Along Line.

3D Modeler Editor Script Commands 11-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<SelectionsArray> Array Structured array.
Array("NAME:Selections",
"Selections:=" , <string>,
"NewPartsModelFlag:=" , <string>)
<ParametersArray> Array Structured array.
Array("NAME:DuplicateToAlongLineParameters",
"CreateNewObjects:=" , <boolean>,
"XComponent:=" , <string>,
Parameters
"YComponent:=" , <string>,
"ZComponent:=" , <string>,
"NumClones:=" , <string containing number greater
than 1>)
<OptionsArray> Array Structured array.
Array("NAME:Options",
"DuplicateAssignments:=", <boolean>)
<CreateGroup> Array Optional. Structured array.
Array("CreateGroupsForNewObjects:=", <boolean>)

Return Value None.

Python Syntax DuplicateAlongLine (<SelectionsArray>, <ParametersArray>, <OptionsArray>, <CreateGroup>)


Python Example oEditor.DuplicateAlongLine(

3D Modeler Editor Script Commands 11-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["NAME:Selections",
"Selections:=" , "Box1",
"NewPartsModelFlag:=" , "Model"
],
["NAME:DuplicateToAlongLineParameters",
"CreateNewObjects:=" , False,
"XComponent:=" , "1mm",
"YComponent:=" , "-0.7mm",
"ZComponent:=" , "0mm",
"NumClones:=" , "2"
],
["NAME:Options",
"DuplicateAssignments:=", False
],
["CreateGroupsForNewObjects:=", False
])

VB Syntax DuplicateAlongLine <SelectionsArray>, <ParametersArray>, <OptionsArray>, <CreateGroup>


VB Example oEditor.DuplicateAlongLine

3D Modeler Editor Script Commands 11-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array( "NAME:Selections",
"Selections:=", "Box1",
"NewPartsModelFlag:=", "Model")
Array( "NAME:DuplicateToAlongLineParameters",
"CreateNewObjects:=", false,
"XComponent:=", "1mm",
"YComponent:=", "-0.7mm",
"ZComponent:=", "0mm",
"NumClones:=", "2")
Array( "NAME:Options",
"DuplicateAssignments:=", false)
Array( "CreateGroupsForNewObjects:=", false)

DuplicateAroundAxis
Duplicates specified parts around an axis.

UI Access Edit > Duplicate > Around Axis.

Name Type Description


<SelectionsArray> Array Structured array.
Array("NAME:Selections",
Parameters
"Selections:=" , <string>,
"NewPartsModelFlag:=" , <string>)
<ParametersArray> Array Structured array.

3D Modeler Editor Script Commands 11-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:DuplicateAroundAxisParameters",
"CreateNewObjects:=" , <boolean>,
"WhichAxis:=" , <string>,
"AngleStr:=" , <string>,
"NumClones:=" , <string containing number greater
than 1>)
<OptionsArray> Array Structured array.
Array("NAME:Options",
"DuplicateAssignments:=", <boolean>)
<CreateGroup> Array Optional. Structured array.
Array("CreateGroupsForNewObjects:=", <boolean>)

Return Value None.

Python Syntax DuplicateAroundAxis (<SelectionsArray>, <ParametersArray>, <OptionsArray>, <CreateGroup>)


oEditor.DuplicateAroundAxis(
["NAME:Selections",
"Selections:=" , "Box1",
Python Example
"NewPartsModelFlag:=" , "Model"
],
["NAME:DuplicateAroundAxisParameters",

3D Modeler Editor Script Commands 11-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"CreateNewObjects:=" , True,
"WhichAxis:=" , "Z",
"AngleStr:=" , "90deg",
"NumClones:=" , "2"
],
["NAME:Options",
"DuplicateAssignments:=", False
],
["CreateGroupsForNewObjects:=", False
])

VB Syntax DuplicateAroundAxis <SelectionsArray>, <ParametersArray>, <OptionsArray>, <CreateGroup>


oEditor.DuplicateAroundAxis
Array("NAME:Selections",
"Selections:=", "Box1",
"NewPartsModelFlag:=", "Model")
VB Example Array("NAME:DuplicateAroundAxisParameters",
"CreateNewObjects:=", true,
"WhichAxis:=", "Z",
"AngleStr:=", "90deg",
"NumClones:=", "2")

3D Modeler Editor Script Commands 11-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Options",
"DuplicateAssignments:=", false)
Array("CreateGroupsForNewObjects:=", false)

DuplicateMirror
Duplicates specified parts according to a mirror plane.

UI Access Edit > Duplicate > Mirror.

Name Type Description


<SelectionsArray> Array Structured array.
Array("NAME:Selections",
"Selections:=" , <string>,
"NewPartsModelFlag:=" , <string>)
<ParametersArray> Array Structured array.
Array("NAME:DuplicateToMirrorParameters",
Parameters
"DuplicateMirrorBaseX:=", <string>,
"DuplicateMirrorBaseY:=", <string>,
"DuplicateMirrorNormalX:=", <string>,
"DuplicateMirrorNormalY:=", <string>,
"DuplicateMirrorNormalZ:=", <string>)
<OptionsArray> Array Structured array.
Array("NAME:Options",

3D Modeler Editor Script Commands 11-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"DuplicateAssignments:=", <boolean>)
<CreateGroup> Array Optional. Structured array.
Array("CreateGroupsForNewObjects:=", <boolean>)

Return Value None.

Python Syntax DuplicateMirror (<SelectionsArray>, <ParametersArray>, <OptionsArray>, <CreateGroup>)


oEditor.DuplicateMirror(
["NAME:Selections",
"Selections:=" , "Box1",
"NewPartsModelFlag:=" , "Model"
],
["NAME:DuplicateToMirrorParameters",
"DuplicateMirrorBaseX:=", "-0.4mm",
Python Example "DuplicateMirrorBaseY:=", "-1.2mm",
"DuplicateMirrorBaseZ:=", "0mm",
"DuplicateMirrorNormalX:=", "0.124034734589208mm",
"DuplicateMirrorNormalY:=", "0.992277876713668mm",
"DuplicateMirrorNormalZ:=", "0mm"
],
["NAME:Options",
"DuplicateAssignments:=", False

3D Modeler Editor Script Commands 11-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

],
["CreateGroupsForNewObjects:=", False
])

VB Syntax DuplicateMirror <SelectionsArray>, <ParametersArray>, <OptionsArray>, <CreateGroup>


oEditor.DuplicateMirror
Array("NAME:Selections",
"Selections:=", "Box1",
"NewPartsModelFlag:=", "Model)
Array("NAME:DuplicateToMirrorParameters",
"DuplicateMirrorBaseX:=", "-0.4mm",
"DuplicateMirrorBaseY:=", "-1.2mm",
VB Example
"DuplicateMirrorBaseZ:=", "0mm",
"DuplicateMirrorNormalX:=", "0.124034734589208mm",
"DuplicateMirrorNormalY:=", "0.992277876713668mm",
"DuplicateMirrorNormalZ:=", "0mm")
Array("NAME:Options",
"DuplicateAssignments:=", false)
Array("CreateGroupsForNewObjects:=", false)

3D Modeler Editor Script Commands 11-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Mirror
Mirrors specified part(s).

UI Access Edit > Arrange > Mirror.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<MirrorParameters> Array Structured array.
Array("NAME:MirrorParameters",
"MirrorBaseX:=" , <string>,
Parameters "MirrorBaseY:=" , <string>,
"MirrorBaseZ:=" , <string>,
"MirrorNormalX:=" , <string>,
"MirrorNormalY:=" , <string>,
"MirrorNormalZ:=" , <string>)

Return Value None.

Python Syntax Mirror(<SelectionsArray>, <MirrorParameters>)


oEditor.Mirror(
["NAME:Selections",
Python Example "Selections:=" , "Box1_1",
"NewPartsModelFlag:=" , "Model"
],

3D Modeler Editor Script Commands 11-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["NAME:MirrorParameters",
"MirrorBaseX:=" , "-0.2mm",
"MirrorBaseY:=" , "-1.2mm",
"MirrorBaseZ:=" , "0mm",
"MirrorNormalX:=" , "-0.316227766016838mm",
"MirrorNormalY:=" , "0.948683298050514mm",
"MirrorNormalZ:=" , "0mm"
])

VB Syntax Mirror <SelectionsArray> <MirrorParameters>


oEditor.Mirror
Array("NAME:Selections",
"Selections:=", "Box1_1",
"NewPartsModelFlag:=", "Model")
Array("NAME:MirrorParameters",
VB Example
"MirrorBaseX:=", "-0.2mm",
"MirrorBaseY:=", "-1.2mm",
"MirrorBaseZ:=", "0mm",
"MirrorNormalX:=", "-0.316227766016838mm",
"MirrorNormalY:=", "0.948683298050514mm",

3D Modeler Editor Script Commands 11-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MirrorNormalZ:=", "0mm")

Move
Moves specified part(s).

UI Access Edit > Arrange > Move.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<TranslateParameters> Array Structured array.
Array(["NAME:TranslateParameters",
Parameters
"TranslateVectorX:=" , <string>,
"TranslateVectorY:=" , <string>,
"TranslateVectorZ:=" , <string>)

Return Value None.

Python Syntax Move(<SelectionsArray>, <TranslateParameters>)


oEditor.Move(
["NAME:Selections",
"Selections:=" , "Box1_1",
Python Example
"NewPartsModelFlag:=" , "Model"
],
["NAME:TranslateParameters",

3D Modeler Editor Script Commands 11-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"TranslateVectorX:=" , "-0.5mm",
"TranslateVectorY:=" , "0.1mm",
"TranslateVectorZ:=" , "0mm"
])

VB Syntax Move <SelectionsArray> <TranslateParameters>


oEditor.Move
Array("NAME:Selections",
"Selections:=", "Box1_1",
"NewPartsModelFlag:=", "Model")
VB Example
Array("NAME:TranslateParameters",
"TranslateVectorX:=", "-0.5mm",
"TranslateVectorY:=", "0.1mm",
"TranslateVectorZ:=", "0mm")

OffsetFaces
Offsets the faces of selected part(s).

UI Access Edit > Arrange > Offset.

Name Type Description


Parameters <SelectionsArray> Array Structured array. See: SelectionsArray.
<OffsetParameters> Array Structured array.

3D Modeler Editor Script Commands 11-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:OffsetParameters",
"OffsetDistance:=" , <string>)

Return Value None.

Python Syntax OffsetFaces (<SelectionsArray>, <OffsetParameters>)


oEditor.OffsetFaces(
["NAME:Selections",
"Selections:=", "Box1_1",
"NewPartsModelFlag:=", "Model"
Python Example
],
["NAME:OffsetParameters",
"OffsetDistance:=", "16mm"
])

VB Syntax OffsetFaces <SelectionsArray> <OffsetParameters>


oEditor.OffsetFaces
Array("NAME:Selections",
"Selections:=", "Box1_1",
VB Example
"NewPartsModelFlag:=", "Model")
Array("NAME:OffsetParameters",
"OffsetDistance:=", "16mm")

3D Modeler Editor Script Commands 11-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Paste (Model Editor)


Pastes previously copied object(s). See: Copy.

UI Access Edit > Paste.


Parameters None.
Return Value None.

Python Syntax Paste()


oEditor.Copy(
["NAME:Selections",
Python Example "Selections:=" , "Box1_2"
])
oEditor.Paste()

VB Syntax Paste
oEditor.Copy Array("NAME:Selections", "Selections:=" , "Box1_2")
VB Example
oEditor.Paste

Rotate
Rotates specified object(s).

3D Modeler Editor Script Commands 11-20


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Edit > Arrange > Rotate.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<RotateParameters> Array Structured array.
Parameters Array("NAME:RotateParameters",
"RotateAxis:=" , <string "X", "Y", or "Z">,
"RotateAngle:=" , <string>)

Return Value None.

Python Syntax Rotate(<SelectionsArray>, <RotateParameters>)


oEditor.Rotate(
["NAME:Selections",
"Selections:=", "Box1_1",
"NewPartsModelFlag:=", "Model"
Python Example ],
["NAME:RotateParameters",
"RotateAxis:=", "Z",
"RotateAngle:=", "90deg"
])

VB Syntax Rotate <SelectionsArray> <RotateParameters>

3D Modeler Editor Script Commands 11-21


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.Rotate
Array("NAME:Selections",
"Selections:=", "Box1_1",
VB Example "NewPartsModelFlag:=", "Model")
Array("NAME:RotateParameters",
"RotateAxis:=", "Z",
"RotateAngle:=", "90deg")

Scale
Scales specified object(s).

UI Access Edit > Scale.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<ScaleParameters> Array Structured array.
Array("NAME:ScaleParameters",
Parameters
"ScaleX:=" , <string containing scale factor>,
"ScaleY:=" , <string containing scale factor>,
"ScaleZ:=" , <string containing scale factor>)

Return Value None.

Python Syntax Scale (<SelectionsArray>, <ScaleParameters>)

3D Modeler Editor Script Commands 11-22


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.Scale(
["NAME:Selections",
"Selections:=", "Box1",
"NewPartsModelFlag:=", "Model"
],
Python Example
["NAME:ScaleParameters",
"ScaleX:=", "2",
"ScaleY:=", "2",
"ScaleZ:=", "2"
])

VB Syntax Scale <SelectionsArray> <ScaleParameters>


oEditor.Scale
Array("NAME:Selections",
"Selections:=", "Box1",
"NewPartsModelFlag:=", "Model")
VB Example
Array("NAME:ScaleParameters",
"ScaleX:=", "2",
"ScaleY:=", "2",
"ScaleZ:=", "2")

3D Modeler Editor Script Commands 11-23


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Modeler Menu Commands


AssignMaterial
Chamfer
Connect
CoverLines
CoverSurfaces
CreateEntityList
CreateFaceCS
CreateGroup
CreateObjectCS
CreateObjectFromEdges
CreateObjectFromFaces
CreateRelativeCS
DeleteEmptyGroups
DeleteLastOperation
DetachFaces
EditEntityList
EditFaceCS
EditObjectCS
EditRelativeCS

3D Modeler Editor Script Commands 11-24


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Export
ExportModelImageToFile
ExportModelMeshToFile
Fillet
FlattenGroup
Generate History
GetActiveCoordinateSystem
GetCoordinateSystems
HealObject
Import
ImportDXF
ImportGDSII [Modeler]
Intersect
MoveCStoEnd
MoveEntityToGroup
MoveFaces
ProjectSheet
PurgeHistory
ReplaceWith3DComponent
Section
SeparateBody

3D Modeler Editor Script Commands 11-25


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetModelUnits
SetWCS
ShowWindow
Split
Subtract
SweepFacesAlongNormal
ThickenSheet
UncoverFaces
Unite
Ungroup
WrapSheet
AlignFaces
Aligns the adjacent selected faces of imported objects which have only one operation in their History Tree.

UI Access Modeler > Model Preparation > Align Faces

Name Type Description


<argFaceList> Array ["NAME:<SpecifiedName>",
Parameters "BaseFaces:=" , <FaceNumberArray>,
"SnapFaces:=" , <FaceNumberArray>]
<FaceNumberArray> Array Array of number represents specified faces.

Return Value None.

3D Modeler Editor Script Commands 11-26


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax AlignFaces(<argFaceList>)


oEditor.AlignFaces([
"NAME:Entity List",
Python Example "BaseFaces:=" , [9],
"SnapFaces:=" , [18]
])

VB Syntax AlignFaces <argFaceList>


oEditor.AlignFaces
Array("NAME:Entity List",
VB Example
"BaseFaces:=" , [9],
"SnapFaces:=" , [18])

AssignMaterial
Assigns a material to specified object(s).

UI Access Modeler > Assign Material.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<AttributesArray> Array Structured array. See: AttributesArray.
Parameters
This script supports the following attributes:
l MaterialValue

3D Modeler Editor Script Commands 11-27


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l SolveInside
l ShellElement
l ShellElementThickness
l IsMaterialEditable
l UseMaterialAppearance
l IsLightweight

Return Value None.

Python Syntax AssignMaterial(<SelectionsArray>, <AttributesArray>)

3D Modeler Editor Script Commands 11-28


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.AssignMaterial(
["NAME:Selections",
"AllowRegionDependentPartSelectionForPMLCreation:=", True,
"AllowRegionSelectionForPMLCreation:=", True,
"Selections:=" , "Box1"
],
["NAME:Attributes",
Python Example "MaterialValue:=" , "diamond",
"SolveInside:=" , False,
"ShellElement:=" , False,
"ShellElementThickness:=" , "nan",
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=" , False,
"IsLightweight:=" , False
])

VB Syntax AssignMaterial <SelectionsArray> <AttributesArray>

3D Modeler Editor Script Commands 11-29


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.AssignMaterial
Array("NAME:Selections",
"AllowRegionDependentPartSelectionForPMLCreation:=", true,
"AllowRegionSelectionForPMLCreation:=", true,
"Selections:=" , "Box1")
Array("NAME:Attributes",
VB Example "MaterialValue:=" , "diamond",
"SolveInside:=" , false,
"ShellElement:=" , false,
"ShellElementThickness:=" , "nan",
"IsMaterialEditable:=" , true,
"UseMaterialAppearance:=" , false,
"IsLightweight:=" , false)

Chamfer
Creates a chamfer.

UI Access Modeler > Chamfer.

Name Type Description


Parameters <SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.

3D Modeler Editor Script Commands 11-30


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Parameters",
Array("NAME:ChamferParameters",
"Edges:=" , <array containing integer>,
"Vertices:=" , <array>,
"LeftDistance:=" , <string>,
"RightDistance:=" , <string>,
"ChamferType:=" , <string "Symmetric",
"Left Distance-Angle", "Right Distance-Angle", or
"Left Distance-Right Distance">)
)

Return Value None.

Python Syntax Chamfer(<SelectionsArray>, <Parameters>)


oEditor.Chamfer(
["NAME:Selections",
"Selections:=" , "Box2",
"NewPartsModelFlag:=" , "Model"
Python Example ],
["NAME:Parameters",
["NAME:ChamferParameters",
"Edges:=" , [42],
"Vertices:=" , [],

3D Modeler Editor Script Commands 11-31


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"LeftDistance:=" , "0.1mm",
"RightDistance:=" , "0.1mm",
"ChamferType:=" , "Symmetric"
]
])

VB Syntax Chamfer <SelectionsArray> <Parameters>


oEditor.Chamfer
Array("NAME:Selections",
"Selections:=" , "Box2",
"NewPartsModelFlag:=" , "Model")
Array("NAME:Parameters",
VB Example Array("NAME:ChamferParameters",
"Edges:=" , [42],
"Vertices:=" , [],
"LeftDistance:=" , "0.1mm",
"RightDistance:=" , "0.1mm",
"ChamferType:=" , "Symmetric"))

CleanUpModel
Cleans up history tree operations.

3D Modeler Editor Script Commands 11-32


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Modeler > Cleanup Model History.


Parameters None.
Return Value None.

Python Syntax CleanUpModel()


Python Example oEditor.CleanUpModel()

VB Syntax CleanUpModel
VB Example oEditor.CleanUpModel

Connect
Connects two or more 1D polyline objects or 2D sheet objects.

UI Access Modeler > Surface > Connect.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

Python Syntax Connect(<SelectionsArray>)


oEditor.Connect(
Python Example ["NAME:Selections",
"Selections:=", "Polyline2,Polyline1"])

3D Modeler Editor Script Commands 11-33


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax Connect <SelectionsArray>


oEditor.Connect Array(
VB Example "NAME:Selections",
"Selections:=", "Polyline2,Polyline1")

CoverLines
Covers two or more 1D objects to form a sheet.

UI Access Modeler > Surface > Cover Lines.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

Python Syntax CoverLines(<SelectionsArray>)


oEditor.CoverLines([
"NAME:Selections",
Python Example
"Selections:=", "Polyline3,Polyline4",
"NewPartsModelFlag:=", "Model"])

VB Syntax CoverLines <SelectionsArray>

3D Modeler Editor Script Commands 11-34


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.CoverLines Array(
"NAME:Selections",
VB Example
"Selections:=", "Polyline3,Polyline4",
"NewPartsModelFlag:=", "Model")

CoverSurfaces
Covers two or more faces to form a solid object.

UI Access Modeler > Surface > Cover Faces.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

Python Syntax CoverSurfaces (<SelectionsArray>)


oEditor.CoverSurfaces(
["NAME:Selections",
Python Example "Selections:=", "Obj1_Face1,Obj2_Face2",
"NewPartsModelFlag:=", "Model"
])

VB Syntax CoverSurfaces <SelectionsArray>


oEditor.CoverSurfaces Array(
VB Example
"NAME:Selections",

3D Modeler Editor Script Commands 11-35


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Selections:=", "Obj1_Face1,Obj2_Face2",
"NewPartsModelFlag:=", "Model")

CreateEntityList
Creates a list of entities containing objects or faces (not both).

UI Access Modeler > List > Create > [Object / Face] List.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:GeometryEntityListParameters",
"EntityType:=" , <string "Object" or "Face">,
Parameters
"EntityList:=" , <string of object names or IDs>)
See GetObjectIDByName for returning object IDs.
<AttributesArray> Array Structured array. See: AttributesArray. CreateEntityList takes only
the "Name" parameter.

Return Value None.

Python Syntax CreateEntityList(<Parameters>,<AttributesArray>)


oEditor.CreateEntityList(
Python Example ["NAME:GeometryEntityListParameters",
"EntityType:=", "Object",

3D Modeler Editor Script Commands 11-36


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"EntityList:=", "Bondwire1,Bondwire2"
],
["NAME:Attributes",
"Name:=", "Objectlist1"
])

VB Syntax CreateEntityList<Parameters> <AttributesArray>


oEditor.CreateEntityList Array(
"NAME:GeometryEntityListParameters",
"EntityType:=", "Object",
VB Example
"EntityList:=", "Bondwire1,Bondwire2")
Array("NAME:Attributes",
"Name:=", "Objectlist1")

CreateFaceCS
Creates a Face Coordinate System from a selected face.

UI Access Modeler > Coordinate System > Create > FaceCS.

Name Type Description


<Parameters> Array Structured array.

Parameters Array("NAME:FaceCSParameters",
<OriginArray>,
"MoveToEnd:=", <boolean>,

3D Modeler Editor Script Commands 11-37


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"FaceID:=", <integer>,
<AxisPosnArray>,
"WhichAxis:=" , <string "X", "Y", or "Z">,
"ZRotationAngle:=" , <string>,
"XOffset:=" , <string>,
"YOffset:=" , <string>,
"AutoAxis:=" , <boolean>)
<OriginArray> Array Structured array.
Array("NAME:Origin",
"IsAttachedToEntity:=" , <boolean>,
"EntityID:=" , <integer>,
"FacetedBodyTriangleIndex:=", <integer>,
"TriangleVertexIndex:=" , <integer>,
"PositionType:=" , <string "FaceCenter",
"EdgeCenter", "OnVertex", "OnEdge", or "OnFace">,
"UParam:=" , <float between 0 and 1 representing
the relative position of the point on the edge or
face>,
"VParam:=" , <float between 0 and 1 representing
the relative position of the point on the edge or
face>,
"XPosition:=" , <string>,

3D Modeler Editor Script Commands 11-38


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"YPosition:=" , <string>,
"ZPosition:=" , <string>)
IsAttachedToEntity specifies whether the point is anchored to a vertex,
edge, or face. If True, provide UParam and VParam. If False, provide
XPosition, YPosition, and ZPosition to provide fixed position. Pass "0" for
unused parameters.
<AxisPosnArray> Array Structured array.
Array("NAME:AxisPosn",
"IsAttachedToEntity:=" , <boolean>,
"EntityID:=" , <integer>,
"FacetedBodyTriangleIndex:=", <integer>,
"TriangleVertexIndex:=" , <integer>,
"PositionType:=" , <string "FaceCenter",
"EdgeCenter", "OnVertex", "OnEdge", or "OnFace">,
"UParam:=" , <float>,
"VParam:=" , <float>,
"XPosition:=" , <string>,
"YPosition:=" , <string>,
"ZPosition:=" , <string>)
<AttributesArray> Array Structured array. See: AttributesArray.

Return Value None.

Python Syntax CreateFaceCS(<Parameters>,<AttributesArray>)

3D Modeler Editor Script Commands 11-39


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.CreateFaceCS(
["NAME:FaceCSParameters",
["NAME:Origin",
"IsAttachedToEntity:=" , True,
"EntityID:=" , 46,
"FacetedBodyTriangleIndex:=", -1,
"TriangleVertexIndex:=" , -1,
"PositionType:=" , "FaceCenter",
"UParam:=" , 0,
"VParam:=" , 0,
Python Example
"XPosition:=" , "0",
"YPosition:=" , "0",
"ZPosition:=" , "0"
],
"MoveToEnd:=" , False,
"FaceID:=" , 46,
["NAME:AxisPosn",
"IsAttachedToEntity:=" , True,
"EntityID:=" , 46,
"FacetedBodyTriangleIndex:=", -1,

3D Modeler Editor Script Commands 11-40


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"TriangleVertexIndex:=" , -1,
"PositionType:=" , "OnFace",
"UParam:=" , 0.487129134674319,
"VParam:=" , 0.308528523557527,
"XPosition:=" , "1292.27748080459mm",
"YPosition:=" , "-814.882885865484mm",
"ZPosition:=" , "0mm"
],
"WhichAxis:=" , "X",
"ZRotationAngle:=" , "0deg",
"XOffset:=" , "0mm",
"YOffset:=" , "0mm",
"AutoAxis:=" , False
],
["NAME:Attributes",
"Name:=" , "FaceCS1",
"PartName:=" , "Rectangle1"
])

VB Syn- CreateFaceCS <Parameters> <AttributesArray>


tax

VB oEditor.CreateFaceCS Array("NAME:FaceCSParameters", Array("NAME:Origin", "IsAt-

3D Modeler Editor Script Commands 11-41


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

tachedToEntity:=", _
true, "EntityID:=", 58, "FacetedBodyTriangleIndex:=", -1, "TriangleVertexIndex:=", _
-1, "PositionType:=", "FaceCenter", "UParam:=", 0, "VParam:=", 0, "XPosition:=", _
"0", "YPosition:=", "0", "ZPosition:=", "0"), "MoveToEnd:=", false, "FaceID:=", _
58, Array("NAME:AxisPosn", "IsAttachedToEntity:=", true, "EntityID:=", 58,
"FacetedBodyTriangleIndex:=", _
Exampl-
e -1, "TriangleVertexIndex:=", -1, "PositionType:=", "OnFace", "UParam:=", _
0.0664066713146499, "VParam:=", 0.407014331135309, "XPosition:=", _
"1826.56266852586mm", "YPosition:=", "-1355.79140131881mm", "ZPosition:=", "0mm"),
"WhichAxis:=", _
"X", "ZRotationAngle:=", "0deg", "XOffset:=", "0mm", "YOffset:=", "0mm", "AutoAxis:=",
_
false), Array("NAME:Attributes", "Name:=", "FaceCS2", "PartName:=", "Rectangle2")

CreateGroup
Creates a group from objects specified in the history tree.

UI Access Modeler > Group > Create.

Name Type Description


<Parameters> Array Structured array.

Parameters Array("NAME:GroupParameter",
"ParentGroupID:=" , <string>,
"Parts:=" , <string>,

3D Modeler Editor Script Commands 11-42


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SubmodelInstances:=" , <string>,
"Groups:=" , <string>)

Return Value None.

Python Syntax CreateGroup(<Parameters>)


oEditor.CreateGroup(
["NAME:GroupParameter",
"ParentGroupID:=" , "Model",
Python Example "Parts:=" , "Box1,Box2,Box3",
"SubmodelInstances:=" , "",
"Groups:=" , ""
])

VB Syntax CreateGroup <Parameters>


oEditor.CreateGroup Array("NAME:GroupParameter", "ParentGroupID:=", "Model", _
VB Example
"Parts:=", "Box1,Box2,Box3", "SubmodelInstances:=", "", "Groups:=", "")

CreateObjectCS
Creates an object coordinate system from a selected object.

UI Access Modeler > Coordinate System > Create > Object > [Offset / Rotated / Both].

3D Modeler Editor Script Commands 11-43


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<Parameters> Array Structured array.
Array("NAME:ObjectCSParameters",
<OriginArray>
"MoveToEnd:=" , <boolean>,
"ReverseXAxis:=" , <boolean>,
"ReverseYAxis:=" , <boolean>,
<xAxisArray / xAxisPosArray>
<yAxisArray / yAxisPosArray>)
Note: xAxisArray and xAxisPosArray differ. Use xAxisArray for absolute
position and xAxisPosArray for relative position. Do the same for yAx-
Parameters isArray and yAxisPosArray.
<OriginArray> Array Structured array.
Array("NAME:Origin",
"IsAttachedToEntity:=" , <boolean>,
"EntityID:=" , <integer>,
"FacetedBodyTriangleIndex:=", <integer>,
"TriangleVertexIndex:=" , <integer>,
"PositionType:=" , <string "OnVertex",
"EdgeCenter", "FaceCenter", "OnEdge", or "Abso-
lutePosition">,
"UParam:=" , <float between 0 and 1 representing
the relative position of the point on the edge or

3D Modeler Editor Script Commands 11-44


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

face>,
"VParam:=" , <float between 0 and 1 representing
the relative position of the point on the edge or
face>,
"XPosition:=" , <string>,
"YPosition:=" , <string>,
"ZPosition:=" , <string>)
IsAttachedToEntity specifies whether the point is anchored. If True,
provide UParam and VParam. If False, provide XPosition, YPosition, and
ZPosition to provide fixed position. Pass "0" for unused parameters.
<xAxisArray> Array Structured array for absolute position:
Array("NAME:xAxis",
"DirectionType:=" , "AbsoluteDirection",
"EdgeID:=" , <integer>,
"FaceID:=" , <integer>,
"xDirection:=" , <string>,
"yDirection:=" , <string>,
"zDirection:=" , <string>,
"UParam:=" , <float>,
"VParam:=" , <float>)
<xAxisPosArray> Array Structured array for relative position:
Array("NAME:xAxisPos",
"IsAttachedToEntity:=" , <boolean>,

3D Modeler Editor Script Commands 11-45


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"EntityID:=" , <integer>,
"FacetedBodyTriangleIndex:=", <integer>,
"TriangleVertexIndex:=" , <integer>,
"PositionType:=" , <string "OnVertex",
"EdgeCenter", "FaceCenter", or "OnEdge">,
"UParam:=" , <float>,
"VParam:=" , <float>,
"XPosition:=" , <string>,
"YPosition:=" , <string>,
"ZPosition:=" , <string>)
<yAxisArray> Array Structured array for absolute position:
Array("NAME:yAxis",
"DirectionType:=" , "AbsoluteDirection",
"EdgeID:=" , <integer>,
"FaceID:=" , <integer>,
"xDirection:=" , <string>,
"yDirection:=" , <string>,
"zDirection:=" , <string>,
"UParam:=" , <float>,
"VParam:=" , <float>)
<yAxisPosArray> Array Structured array for relative position:

3D Modeler Editor Script Commands 11-46


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:yAxisPos",
"IsAttachedToEntity:=" , <boolean>,
"EntityID:=" , <integer>,
"FacetedBodyTriangleIndex:=", <integer>,
"TriangleVertexIndex:=" , <integer>,
"PositionType:=" , <string "OnVertex",
"EdgeCenter", "FaceCenter", or "OnEdge">,
"UParam:=" , <float>,
"VParam:=" , <float>,
"XPosition:=" , <string>,
"YPosition:=" , <string>,
"ZPosition:=" , <string>)
<AttributesArray> Array Structured array. See: AttributesArray.

Return Value None.

Python Syntax CreateObjectCS(<Parameters>,<AttributesArray>)


oEditor.CreateObjectCS(
["NAME:ObjectCSParameters",
["NAME:Origin",
Python Example
"IsAttachedToEntity:=" , True,
"EntityID:=" , 59,
"FacetedBodyTriangleIndex:=", -1,

3D Modeler Editor Script Commands 11-47


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"TriangleVertexIndex:=" , -1,
"PositionType:=" , "OnVertex",
"UParam:=" , 0,
"VParam:=" , 0,
"XPosition:=" , "0",
"YPosition:=" , "0",
"ZPosition:=" , "0"
],
"MoveToEnd:=" , False,
"ReverseXAxis:=" , False,
"ReverseYAxis:=" , False,
["NAME:xAxis",
"DirectionType:=" , "AbsoluteDirection",
"EdgeID:=" , -1,
"FaceID:=" , -1,
"xDirection:=" , "1",
"yDirection:=" , "0",
"zDirection:=" , "0",
"UParam:=" , 0,
"VParam:=" , 0

3D Modeler Editor Script Commands 11-48


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

],
["NAME:yAxis",
"DirectionType:=" , "AbsoluteDirection",
"EdgeID:=" , -1,
"FaceID:=" , -1,
"xDirection:=" , "0",
"yDirection:=" , "1",
"zDirection:=" , "0",
"UParam:=" , 0,
"VParam:=" , 0
]
],
["NAME:Attributes",
"Name:=" , "ObjectCS1",
"PartName:=" , "Box2"
])

VB Syn- CreateObjectCS <Parameters> <AttributesArray>


tax

VB
oEditor.CreateObjectCS Array("NAME:ObjectCSParameters", Array("NAME:Origin", "IsAt-
Exampl- tachedToEntity:=", _
e false, "EntityID:=", -1, "FacetedBodyTriangleIndex:=", -1, "TriangleVertexIndex:=", _

3D Modeler Editor Script Commands 11-49


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

-1, "PositionType:=", "AbsolutePosition", "UParam:=", 0, "VParam:=", 0, "XPosition:=",


_
"0mm", "YPosition:=", "0mm", "ZPosition:=", "0mm"), "MoveToEnd:=", false, "ReverseXAx-
is:=", _
false, "ReverseYAxis:=", false, Array("NAME:xAxisPos", "IsAttachedToEntity:=", true,
"EntityID:=", _
80, "FacetedBodyTriangleIndex:=", -1, "TriangleVertexIndex:=", -1, "PositionType:=", _
"EdgeCenter", "UParam:=", 0, "VParam:=", 0, "XPosition:=", "0", "YPosition:=", _
"0", "ZPosition:=", "0"), Array("NAME:yAxisPos", "IsAttachedToEntity:=", true,
"EntityID:=", _
69, "FacetedBodyTriangleIndex:=", -1, "TriangleVertexIndex:=", -1, "PositionType:=", _
"EdgeCenter", "UParam:=", 0, "VParam:=", 0, "XPosition:=", "0", "YPosition:=", _
"0", "ZPosition:=", "0")), Array("NAME:Attributes", "Name:=", "ObjectCS2",
"PartName:=", _
"Box3")

CreateObjectFromEdges
Creates an object from the specified object edge.

UI Access Modeler > Edge > Create Object From Edge

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
Parameters <ParametersArray> Array Structured array.
Array("NAME:Parameters",

3D Modeler Editor Script Commands 11-50


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:BodyFromEdgeToPara-
meters",
"Edges:=" , <array containing
integer edges>
)
)
<CreateGroupsForNewObjects> Array Structured array.
Array("CreateGroupsForNewObjects:=",
<boolean True to create groups for new
objects; else False>)

Return Value None.

Python Syntax CreateObjectFromEdges(<SelectionsArray>, <ParametersArray>, <CreateGroupsForNewObjects>)


oEditor.CreateObjectFromEdges(
["NAME:Selections",
"Selections:=", "Box2",
"NewPartsModelFlag:=", "Model"
Python Example ],
["NAME:Parameters",
["NAME:BodyFromEdgeToParameters",
"Edges:=", [41] ]
],

3D Modeler Editor Script Commands 11-51


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["CreateGroupsForNewObjects:=", False
])

VB Syn- CreateObjectFromEdges <SelectionsArray> <ParametersArray> <CreateGroupsForNewObjects>


tax

oEditor.CreateObjectFromEdges Array("NAME:Selections", "Selections:=", "Box1",


VB "NewPartsModelFlag:=", _
Exampl- "Model"), Array("NAME:Parameters", Array("NAME:BodyFromEdgeToParameters", "Edges:=",
e Array( _
13))), Array("CreateGroupsForNewObjects:=", false)

CreateObjectFromFace
Creates 2D objects from specified face(s).

UI Access N/A

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Array("NAME:Parameters",
Parameters
<BodyFromFaceToParameters>)
<CreateGroupsForNewObjects> Array Optional. Structured array.
Array("CreateGroupsForNewObjects:=",
<boolean>)

Return Value None.

3D Modeler Editor Script Commands 11-52


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax CreateObjectFromFace (<SelectionsArray>,<Parameters>, <CreateGroupsForNewObjects>)


oEditor.CreateObjectFromFace(
["NAME:Selections",
"Selections:=" , "Box3",
"NewPartsModelFlag:=" , "Model"
],
["NAME:Parameters",
Python Example
["NAME:BodyFromFaceToParameters",
"FacesToDetach:=" , [68]
]
],
["CreateGroupsForNewObjects:=", False
])

VB Syn- CreateObjectFromFace <SelectionsArray> <Parameters> <CreateGroupsForNewObjects>


tax

oEditor.CreateObjectFromFace Array("NAME:Selections", "Selections:=", "Box3",


"NewPartsModelFlag:=" ,
VB
Exampl- "Model") Array("NAME:Parameters", Array("NAME:BodyFromFaceToParameters",
e "FacesToDetach:=", Array(68)))
Array("CreateGroupsForNewObjects:=", false)

3D Modeler Editor Script Commands 11-53


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CreateObjectFromFaces
Creates 2D objects from specified face(s).

UI Access Modeler > Surface > Create Object from Face

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Array("NAME:Parameters",
Parameters
<BodyFromFaceToParameters>)
<CreateGroupsForNewObjects> Array Structured array.
Array("CreateGroupsForNewObjects:=",
<boolean>)

Return Value None.

Python Syntax CreateObjectFromFaces (<SelectionsArray>,<Parameters>, <CreateGroupsForNewObjects>)


oEditor.CreateObjectFromFaces(
["NAME:Selections",
"Selections:=" , "Box3",
Python Example "NewPartsModelFlag:=" , "Model"
],
["NAME:Parameters",
["NAME:BodyFromFaceToParameters",

3D Modeler Editor Script Commands 11-54


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"FacesToDetach:=" , [68]
]
],
["CreateGroupsForNewObjects:=", False
])

VB Syn- CreateObjectFromFaces <SelectionsArray> <Parameters> <CreateGroupsForNewObjects>


tax

oEditor.CreateObjectFromFaces Array("NAME:Selections", "Selections:=", "Box3",


"NewPartsModelFlag:=" ,
VB
Exampl- "Model") Array("NAME:Parameters", Array("NAME:BodyFromFaceToParameters",
e "FacesToDetach:=", Array(68)))
Array("CreateGroupsForNewObjects:=", False)

CreateRelativeCS
Creates a Relative Coordinate System.

UI Access Modeler > Coordinate System > Create > Relative CS > [Offset / Rotated / Both].

Name Type Description


<Parameters> Array Structured array.
Array("NAME:RelativeCSParameters",
Parameters
"Mode:=" , "Axis/Position",
"OriginX:=" , <string>,
"OriginY:=" , <string>,

3D Modeler Editor Script Commands 11-55


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"OriginZ:=" , <string>,
"XAxisXvec:=" , <string>,
"XAxisYvec:=" , <string>,
"XAxisZvec:=" , <string>,
"YAxisXvec:=" , <string>,
"YAxisYvec:=" , <string>,
"YAxisZvec:=" , <string>)
<AttributesArray> Array Structured array. See: AttributesArray. CreateRelativeCS supports only
the "Name" parameter.

Return Value None.

Python Syntax CreateRelativeCS(<Parameters>,<AttributesArray>)


oEditor.CreateRelativeCS(
["NAME:RelativeCSParameters",
"Mode:=" , "Axis/Position",
"OriginX:=" , "0.62mm",
Python Example
"OriginY:=" , "-0.7mm",
"OriginZ:=" , "0mm",
"XAxisXvec:=" , "1mm",
"XAxisYvec:=" , "0mm",

3D Modeler Editor Script Commands 11-56


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"XAxisZvec:=" , "0mm",
"YAxisXvec:=" , "0mm",
"YAxisYvec:=" , "1mm",
"YAxisZvec:=" , "0mm"
],
["NAME:Attributes",
"Name:=" , "RelativeCS1"
])

VB Syn- CreateRelativeCS <Parameters> <AttributesArray>


tax

oEditor.CreateRelativeCS Array("NAME:RelativeCSParameters", "Mode:=", "Axis/Position",


"OriginX:=", _
"0mm", "OriginY:=", "0mm", "OriginZ:=", "0mm", "XAxisXvec:=", "0.66mm", "XAxisYvec:=",
VB _
Example
"0.28mm", "XAxisZvec:=", "0mm", "YAxisXvec:=", "0.06mm", "YAxisYvec:=", "0.14mm", "YAx-
isZvec:=", _
"0mm"), Array("NAME:Attributes", "Name:=", "RelativeCS1")

DeleteEmptyGroups
Deletes group(s) from the history tree.

UI Access Modeler > Group > Delete Empty.

Parameters Name Type Description

3D Modeler Editor Script Commands 11-57


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<Parameters> Array Structured array.


Array("Groups:=" , <array of string group IDs>)

Return Value None.

Python Syntax DeleteEmptyGroups(<Parameters>)


oEditor.DeleteEmptyGroups([
Python Example "Groups:=", ["Group1","Group2","Group3"]
])

VB Syntax DeleteEmptyGroups <Parameters>


VB Example oEditor.DeleteEmptyGroups Array("Groups:=", Array("Group1","Group2","Group3"))

DeleteLastOperation
Deletes the last operation performed on the specified object(s).

UI Access Modeler > Delete Last Operation.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

Python Syntax DeleteLastOperation(<SelectionsArray>)

3D Modeler Editor Script Commands 11-58


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.DeleteLastOperation([
"NAME:Selections",
Python Example "Selections:=", "Box3",
"NewPartsModelFlag:=", "Model"
])

VB Syn- DeleteLastOperation <SelectionsArray>


tax

VB oEditor.DeleteLastOperation Array("NAME:Selections", "Selections:=", "Box3",


Exampl- "NewPartsModelFlag:=", "Model")
e

DeleteOperation
Deletes specified operation performed on a selected object.

UI Access Select an operation in the project tree, then press Delete on the keyboard.

Name Type Description


<ParamsArray> Array Structured array.
Array("NAME:Parameters",
Array("NAME:PartOperations",
Parameters
Array("NAME:<PartName>",
"OperationIndices:=", <array of operation
indices>)),
Array("NAME:UDMOperations"))

3D Modeler Editor Script Commands 11-59


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax DeleteOperation(<ParamsArray>)


oEditor.DeleteOperation(
[
"NAME:Parameters",
[
"NAME:PartOperations",
[
Python Example
"NAME:Coil_0",
"OperationIndices:=", [1]
]
],
["NAME:UDMOperations"]
])

VB Syntax DeleteOperation <ParamsArray>


oEditor.DeleteOperation _
VB Example
Array("NAME:Parameters", _

3D Modeler Editor Script Commands 11-60


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:PartOperations", _
Array("NAME:Coil_0", _
"OperationIndices:=", Array(1))), _
Array("NAME:UDMOperations"))

DetachEdges
Detaches the specified edge(s) from an object.

UI Access Modeler > Edge > Detach Edges.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Array("NAME:Parameters",
Parameters <DetachEdgesArray>)
<DetachEdgesArray> Array Structured array.
Array("NAME:DetachEdgesToParameters",
"EdgesToDetach:=" , <array containing integer
edge IDs>)

Return Value None.

Python Syntax DetachEdges(<SelectionsArray>, <Parameters>)


oEditor.DetachEdges(
Python Example ["NAME:Selections",
"Selections:=", "Rectangle1",

3D Modeler Editor Script Commands 11-61


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NewPartsModelFlag:=", "Model"
],
["NAME:Parameters",
["NAME:DetachEdgesToParameters",
"EdgesToDetach:=", [18,17]
]
])

VB Syn- DetachEdges <SelectionsArray> <Parameters>


tax

oEditor.DetachEdges Array("NAME:Selections", "Selections:=", "Rectangle1",


VB "NewPartsModelFlag:=", "Model")
Exampl-
e Array("NAME:Parameters", Array("NAME:DetachEdgesToParameters", "EdgesToDetach:=",
[18,17]))

DetachFaces
Detaches the specified face(s) from an object.

UI Access Modeler > Surface > Detach Faces.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
Parameters <Parameters> Array Structured array.
Array("NAME:Parameters",

3D Modeler Editor Script Commands 11-62


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<DetachFacesArray>)
<DetachFacesArray> Array Structured array.
Array("NAME:DetachFacesToParameters",
"FacesToDetach:=" , <array containing integer
face IDs>)

Return Value None.

Python Syntax DetachFaces(<SelectionsArray>, <Parameters>)


oEditor.DetachFaces(
["NAME:Selections",
"Selections:=", "Box3",
"NewPartsModelFlag:=", "Model"
],
Python Example
["NAME:Parameters",
["NAME:DetachFacesToParameters",
"FacesToDetach:=", [68,67]
]
])

VB Syn- DetachFaces <SelectionsArray> <Parameters>


tax

VB oEditor.DetachFaces Array("NAME:Selections", "Selections:=", "Box3",

3D Modeler Editor Script Commands 11-63


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NewPartsModelFlag:=", "Model")
Example Array("NAME:Parameters", Array("NAME:DetachFacesToParameters", "FacesToDetach:=",
[68,67]))

EditEntityList
Modifies an entity list.

UI Access Modeler > List > Reassign.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Array("NAME:GeometryEntityListParameters",
Parameters
"EntityType:=" , <string "Object" or
"Face">,
"EntityList:=" , <string list>
)

Return Value None.

Python Syntax EditEntityList(<SelectionsArray>, <Parameters>)


oEditor.EditEntityList(
Python Example ["NAME:Selections",
"Selections:=" , "Objectlist1"

3D Modeler Editor Script Commands 11-64


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

],
["NAME:GeometryEntityListParameters",
"EntityType:=" , "Object",
"EntityList:=" , "Box1, Box2, Box3"
])

VB Syntax EditEntityList <SelectionsArray> <Parameters>


oEditor.EditEntityList
Array("NAME:Selections",
"Selections:=", "Objectlist1")
VB Example
Array("NAME:GeometryEntityListParameters",
"EntityType:=", "Object",
"EntityList:=", "Box1, Box2, Box3")

EditFaceCS
Recreates an existing face coordinate system. See: CreateFaceCS.

UI Access Modeler > Coordinate System > Edit.

Name Type Description


<Parameters> Array Structured array.

Parameters Array("NAME:FaceCSParameters",
<OriginArray>,
"MoveToEnd:=", <boolean>,

3D Modeler Editor Script Commands 11-65


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"FaceID:=", <integer>,
<AxisPosnArray>,
"WhichAxis:=" , <string "X", "Y", or "Z">,
"ZRotationAngle:=" , <string>,
"XOffset:=" , <string>,
"YOffset:=" , <string>,
"AutoAxis:=" , <boolean>)
<OriginArray> Array Structured array.
Array("NAME:Origin",
"IsAttachedToEntity:=" , <boolean>,
"EntityID:=" , <integer>,
"FacetedBodyTriangleIndex:=", <integer>,
"TriangleVertexIndex:=" , <integer>,
"PositionType:=" , <string "FaceCenter",
"EdgeCenter", "OnVertex", "OnEdge", or "OnFace">,
"UParam:=" , <float between 0 and 1 representing
the relative position of the point on the edge or
face>,
"VParam:=" , <float between 0 and 1 representing
the relative position of the point on the edge or
face>,
"XPosition:=" , <string>,

3D Modeler Editor Script Commands 11-66


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"YPosition:=" , <string>,
"ZPosition:=" , <string>)
IsAttachedToEntity specifies whether the point is anchored to a vertex,
edge, or face. If True, provide UParam and VParam. If False, provide
XPosition, YPosition, and ZPosition to provide fixed position. Pass "0" for
unused parameters.
<AxisPosnArray> Array Structured array.
Array("NAME:AxisPosn",
"IsAttachedToEntity:=" , <boolean>,
"EntityID:=" , <integer>,
"FacetedBodyTriangleIndex:=", <integer>,
"TriangleVertexIndex:=" , <integer>,
"PositionType:=" , <string "FaceCenter",
"EdgeCenter", "OnVertex", "OnEdge", or "OnFace">,
"UParam:=" , <float>,
"VParam:=" , <float>,
"XPosition:=" , <string>,
"YPosition:=" , <string>,
"ZPosition:=" , <string>)
<AttributesArray> Array Structured array. See: AttributesArray. Use to select the coordinate sys-
tem to edit.

Return Value None.

Python Syntax EditFaceCS (<Parameters>, <AttributesArray>)

3D Modeler Editor Script Commands 11-67


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.EditFaceCS(
["NAME:FaceCSParameters",
["NAME:Origin",
"IsAttachedToEntity:=" , True,
"EntityID:=" , 12,
"FacetedBodyTriangleIndex:=", -1,
"TriangleVertexIndex:=" , -1,
"PositionType:=" , "FaceCenter",
"UParam:=" , 0,
"VParam:=" , 0,
Python Example
"XPosition:=" , "0",
"YPosition:=" , "0",
"ZPosition:=" , "0"
],
"MoveToEnd:=" , False,
"FaceID:=" , 12,
["NAME:AxisPosn",
"IsAttachedToEntity:=" , True,
"EntityID:=" , 12,
"FacetedBodyTriangleIndex:=", -1,

3D Modeler Editor Script Commands 11-68


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"TriangleVertexIndex:=" , -1,
"PositionType:=" , "OnFace",
"UParam:=" , 0.62951717774066,
"VParam:=" , 0.226514925559344,
"XPosition:=" , "1200mm",
"YPosition:=" , "-354.697014888131mm",
"ZPosition:=" , "125.903435548132mm"
],
"WhichAxis:=" , "X",
"ZRotationAngle:=" , "0deg",
"XOffset:=" , "0mm",
"YOffset:=" , "0mm",
"AutoAxis:=" , False
],
["NAME:Attributes",
"Name:=" , "FaceCS1",
"PartName:=" , "Box1"
])

VB Syntax EditFaceCS <Parameters> <AttributesArray>


VB Example oEditor.EditFaceCS

3D Modeler Editor Script Commands 11-69


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:FaceCSParameters",
Array("NAME:Origin",
"IsAttachedToEntity:=" , True,
"EntityID:=" , 12,
"FacetedBodyTriangleIndex:=", -1,
"TriangleVertexIndex:=" , -1,
"PositionType:=" , "FaceCenter",
"UParam:=" , 0,
"VParam:=" , 0,
"XPosition:=" , "0",
"YPosition:=" , "0",
"ZPosition:=" , "0"),
"MoveToEnd:=" , False,
"FaceID:=" , 12,
Array("NAME:AxisPosn",
"IsAttachedToEntity:=" , True,
"EntityID:=" , 12,
"FacetedBodyTriangleIndex:=", -1,
"TriangleVertexIndex:=" , -1,
"PositionType:=" , "OnFace",

3D Modeler Editor Script Commands 11-70


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UParam:=" , 0.62951717774066,
"VParam:=" , 0.226514925559344,
"XPosition:=" , "1200mm",
"YPosition:=" , "-354.697014888131mm",
"ZPosition:=" , "125.903435548132mm"),
"WhichAxis:=" , "X",
"ZRotationAngle:=" , "0deg",
"XOffset:=" , "0mm",
"YOffset:=" , "0mm",
"AutoAxis:=" , False)
Array("NAME:Attributes",
"Name:=" , "FaceCS1",
"PartName:=" , "Box1")

EditObjectCS
Edits an existing object coordinate system. See: CreateObjectCS.

UI Access Modeler > Coordinate System > Edit.

Name Type Description


<Parameters> Array Structured array.

Parameters Array("NAME:ObjectCSParameters",
<OriginArray>
"MoveToEnd:=" , <boolean>,

3D Modeler Editor Script Commands 11-71


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ReverseXAxis:=" , <boolean>,
"ReverseYAxis:=" , <boolean>,
<xAxisArray / xAxisPosArray>
<yAxisArray / yAxisPosArray>)
Note: xAxisArray and xAxisPosArray differ. Use xAxisArray for absolute
position and xAxisPosArray for relative position. Do the same for yAx-
isArray and yAxisPosArray.
<OriginArray> Array Structured array.
Array("NAME:Origin",
"IsAttachedToEntity:=" , <boolean>,
"EntityID:=" , <integer>,
"FacetedBodyTriangleIndex:=", <integer>,
"TriangleVertexIndex:=" , <integer>,
"PositionType:=" , <string "OnVertex",
"EdgeCenter", "FaceCenter", "OnEdge", or "Abso-
lutePosition">,
"UParam:=" , <float between 0 and 1 representing
the relative position of the point on the edge or
face>,
"VParam:=" , <float between 0 and 1 representing
the relative position of the point on the edge or
face>,
"XPosition:=" , <string>,

3D Modeler Editor Script Commands 11-72


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"YPosition:=" , <string>,
"ZPosition:=" , <string>)
IsAttachedToEntity specifies whether the point is anchored. If True,
provide UParam and VParam. If False, provide XPosition, YPosition, and
ZPosition to provide fixed position. Pass "0" for unused parameters.
<xAxisArray> Array Structured array for absolute position:
Array("NAME:xAxis",
"DirectionType:=" , "AbsoluteDirection",
"EdgeID:=" , <integer>,
"FaceID:=" , <integer>,
"xDirection:=" , <string>,
"yDirection:=" , <string>,
"zDirection:=" , <string>,
"UParam:=" , <float>,
"VParam:=" , <float>)
<xAxisPosArray> Array Structured array for relative position:
Array("NAME:xAxisPos",
"IsAttachedToEntity:=" , <boolean>,
"EntityID:=" , <integer>,
"FacetedBodyTriangleIndex:=", <integer>,
"TriangleVertexIndex:=" , <integer>,
"PositionType:=" , <string "OnVertex",
"EdgeCenter", "FaceCenter", or "OnEdge">,

3D Modeler Editor Script Commands 11-73


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UParam:=" , <float>,
"VParam:=" , <float>,
"XPosition:=" , <string>,
"YPosition:=" , <string>,
"ZPosition:=" , <string>)
<yAxisArray> Array Structured array for absolute position:
Array("NAME:yAxis",
"DirectionType:=" , "AbsoluteDirection",
"EdgeID:=" , <integer>,
"FaceID:=" , <integer>,
"xDirection:=" , <string>,
"yDirection:=" , <string>,
"zDirection:=" , <string>,
"UParam:=" , <float>,
"VParam:=" , <float>)
<yAxisPosArray> Array Structured array for relative position:
Array("NAME:yAxisPos",
"IsAttachedToEntity:=" , <boolean>,
"EntityID:=" , <integer>,
"FacetedBodyTriangleIndex:=", <integer>,
"TriangleVertexIndex:=" , <integer>,

3D Modeler Editor Script Commands 11-74


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PositionType:=" , <string "OnVertex",


"EdgeCenter", "FaceCenter", or "OnEdge">,
"UParam:=" , <float>,
"VParam:=" , <float>,
"XPosition:=" , <string>,
"YPosition:=" , <string>,
"ZPosition:=" , <string>)
<AttributesArray> Array Structured array. See: AttributesArray. Use to select the coordinate sys-
tem to edit.

Return Value None.

Python Syntax EditObjectCS(<Parameters>,<AttributesArray>)


oEditor.EditObjectCS(
["NAME:ObjectCSParameters",
["NAME:Origin",
"IsAttachedToEntity:=" , True,
"EntityID:=" , 59,
Python Example
"FacetedBodyTriangleIndex:=", -1,
"TriangleVertexIndex:=" , -1,
"PositionType:=" , "OnVertex",
"UParam:=" , 0,
"VParam:=" , 0,

3D Modeler Editor Script Commands 11-75


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"XPosition:=" , "0",
"YPosition:=" , "0",
"ZPosition:=" , "0"
],
"MoveToEnd:=" , False,
"ReverseXAxis:=" , False,
"ReverseYAxis:=" , False,
["NAME:xAxis",
"DirectionType:=" , "AbsoluteDirection",
"EdgeID:=" , -1,
"FaceID:=" , -1,
"xDirection:=" , "1",
"yDirection:=" , "0",
"zDirection:=" , "0",
"UParam:=" , 0,
"VParam:=" , 0
],
["NAME:yAxis",
"DirectionType:=" , "AbsoluteDirection",
"EdgeID:=" , -1,

3D Modeler Editor Script Commands 11-76


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"FaceID:=" , -1,
"xDirection:=" , "0",
"yDirection:=" , "1",
"zDirection:=" , "0",
"UParam:=" , 0,
"VParam:=" , 0
]
],
["NAME:Attributes",
"Name:=" , "ObjectCS1",
"PartName:=" , "Box2"
])

VB Syn- EditObjectCS <Parameters> <AttributesArray>


tax

oEditor.EditObjectCS Array("NAME:ObjectCSParameters", Array("NAME:Origin", "IsAt-


tachedToEntity:=", _
false, "EntityID:=", -1, "FacetedBodyTriangleIndex:=", -1, "TriangleVertexIndex:=", _
VB -1, "PositionType:=", "AbsolutePosition", "UParam:=", 0, "VParam:=", 0, "XPosition:=",
Example _
"0mm", "YPosition:=", "0mm", "ZPosition:=", "0mm"), "MoveToEnd:=", false, "ReverseXAx-
is:=", _
false, "ReverseYAxis:=", false, Array("NAME:xAxisPos", "IsAttachedToEntity:=", true,

3D Modeler Editor Script Commands 11-77


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"EntityID:=", _
80, "FacetedBodyTriangleIndex:=", -1, "TriangleVertexIndex:=", -1, "PositionType:=", _
"EdgeCenter", "UParam:=", 0, "VParam:=", 0, "XPosition:=", "0", "YPosition:=", _
"0", "ZPosition:=", "0"), Array("NAME:yAxisPos", "IsAttachedToEntity:=", true,
"EntityID:=", _
69, "FacetedBodyTriangleIndex:=", -1, "TriangleVertexIndex:=", -1, "PositionType:=", _
"EdgeCenter", "UParam:=", 0, "VParam:=", 0, "XPosition:=", "0", "YPosition:=", _
"0", "ZPosition:=", "0")), Array("NAME:Attributes", "Name:=", "ObjectCS2",
"PartName:=", _
"Box3")

EditRelativeCS
Edits an existing Relative Coordinate System. See: CreateRelativeCS.

UI Access Modeler > Coordinate System > Edit.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:RelativeCSParameters",

Parameters "Mode:=" , "Axis/Position",


"OriginX:=" , <string>,
"OriginY:=" , <string>,
"OriginZ:=" , <string>,

3D Modeler Editor Script Commands 11-78


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"XAxisXvec:=" , <string>,
"XAxisYvec:=" , <string>,
"XAxisZvec:=" , <string>,
"YAxisXvec:=" , <string>,
"YAxisYvec:=" , <string>,
"YAxisZvec:=" , <string>)
<AttributesArray> Array Structured array. See: AttributesArray. Use to select the coordinate sys-
tem to edit.

Return Value None.

Python Syntax EditRelativeCS(<Parameters>,<AttributesArray>)


oEditor.EditRelativeCS(
["NAME:RelativeCSParameters",
"Mode:=" , "Axis/Position",
"OriginX:=" , "0.62mm",
"OriginY:=" , "-0.7mm",
Python Example "OriginZ:=" , "0mm",
"XAxisXvec:=" , "1mm",
"XAxisYvec:=" , "0mm",
"XAxisZvec:=" , "0mm",
"YAxisXvec:=" , "0mm",
"YAxisYvec:=" , "1mm",

3D Modeler Editor Script Commands 11-79


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"YAxisZvec:=" , "0mm"
],
["NAME:Attributes",
"Name:=" , "RelativeCS1"
])

VB Syn- EditRelativeCS <Parameters> <AttributesArray>


tax

oEditor.EditRelativeCS Array("NAME:RelativeCSParameters", "Mode:=", "Axis/Position",


"OriginX:=", _
"0mm", "OriginY:=", "0mm", "OriginZ:=", "0mm", "XAxisXvec:=", "0.66mm", "XAxisYvec:=",
VB _
Example
"0.28mm", "XAxisZvec:=", "0mm", "YAxisXvec:=", "0.06mm", "YAxisYvec:=", "0.14mm", "YAx-
isZvec:=", _
"0mm"), Array("NAME:Attributes", "Name:=", "RelativeCS1")

Export
Exports the model to a file.

Note:

This script does not export image file types or GDSII files. See: ExportModelImageToFile and ExportGDSII.

3D Modeler Editor Script Commands 11-80


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Modeler > Export.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:ExportParameters",
"AllowRe-
gionDependentPartSelectionForPMLCreation:=",
<boolean>,
"AllowRegionSelectionForPMLCreation:=",
Parameters <boolean>,
"Selections:=" , <string list>,
"File Name:=" , <string filepath>,
"Major Version:=" , <integer (-1 if not applic-
able)>,
"Minor Version:=" , <integer (-1 if not applic-
able)>)

Return None.
Value

Python Syntax Export(<Parameters>)


oEditor.Export(
["NAME:ExportParameters",
Python Example "AllowRegionDependentPartSelectionForPMLCreation:=", True,
"AllowRegionSelectionForPMLCreation:=", True,
"Selections:=" , "Box1,Box2,Box3",

3D Modeler Editor Script Commands 11-81


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"File Name:=" , "C:/Users/jdoe/Desktop/export.sab",


"Major Version:=" , 25,
"Minor Version:=" , 0
])

VB Syntax Export <Parameters>


oEditor.Export
Array("NAME:ExportParameters",
"AllowRegionDependentPartSelectionForPMLCreation:=", True,
"AllowRegionSelectionForPMLCreation:=", True,
VB Example
"Selections:=" , "Box1,Box2,Box3",
"File Name:=" , "C:/Users/jdoe/Desktop/export.sab",
"Major Version:=" , 25,
"Minor Version:=" , 0)

ExportModelImageToFile
Exports the model as an image file (*.avz, *.bmp, *.gif, *.jpeg, *.tiff, *.wrl). In Release 23.1, this command is fully supports -ng (non-
graphical) mode. To export to Ensight use *.avz. For export to Ensight in -ng mode, the corresponding version of Ensight must be
installed. On Linux, it might need manual set environment variable AWP_ROOT212 to its installation path, e.g. AWP_ROOT212-
2=/installations/ansys_inc/v212/ for AnsysEDT v21.2 and Ensight 21.2.
ExportModelImageToFile supports export overlay of polar plot 3D with existing transformation (scaling, rotation and translation) in -ng
(non-graphical) mode.

3D Modeler Editor Script Commands 11-82


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Modeler > Export.

Name Type Description


<path> String Full file path including extension.
<width> Integer Width in pixels (use 0 for default).
<height> Integer Height in pixels (use 0 for default).
<Parameters> Array Structured array.
Array("NAME:SaveImageParams",
"ShowAxis:=" , <string containing
boolean>,
"ShowGrid:=" , <string containing
boolean>,
Parameters
"ShowRuler:=" , <string containing
boolean>,
"ShowRegion:=" , <string>,
"Selections:=" , <string>,
"FieldPlotSelections:=", <string>' #
Comma delimited string. #Use to set which
field plot to show.
"Orientation:=" , <string>
"ShowOrientationGadget:=" , <False>

Return Value None.

Python Syntax ExportModelImageToFile(<path> <width> <height> <Parameters>)


Python Example oEditor.ExportModelImageToFile

3D Modeler Editor Script Commands 11-83


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

("C:/Users/jdoe/Desktop/export.bmp",
1920,
1080,
[
"NAME:SaveImageParams",
"ShowAxis:=" , "True",
"ShowGrid:=" , "True",
"ShowRuler:=" , "True",
"ShowRegion:=" , "Default",
"Selections:=" , "",
"FieldPlotSelections:=" , "",
"FitToSelections:=" , "",
"FitToFieldPlotSelections:=", "",
"Orientation:=" , ""
])

VB Syntax ExportModelImageToFile <path> <width> <height> <Parameters>


oEditor.ExportModelImageToFile
VB Example "C:/Users/jdoe/Desktop/export.bmp",
1383,

3D Modeler Editor Script Commands 11-84


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

512,
Array("NAME:SaveImageParams",
"ShowAxis:=", "True",
"ShowGrid:=", "True",
"ShowRuler:=", "True",
"ShowRegion:=", "Default",
"Selections:=", "",
"FitToFieldPlotSelections:=", "",
"Orientation:=", ""

ExportModelMeshToFile
Exports geometry model to a 3D model file (e.g. *.obj, *.wrl, etc.).

UI Access N/A

Name Type Description


Parameters <filePath> String Full file path, including extension *.obj, *.wrl, etc
<selections> Array Selected parts.

Return Value None.

Python Syntax ExportModelMeshToFile <filePath>, <selections>)


oEditor.ExportModelMeshToFile("E:/MyDir/scriptRun/2Selected-ng.obj", ["BotCover-
Python Example
","AveragingVolumeAtPeakRMSEfieldLocation"])

3D Modeler Editor Script Commands 11-85


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax ExportModelMeshToFile <filePath>, <selections>


oEditor.ExportModelMeshToFile("E:/MyDir/scriptRun/2Selected-ng.obj", ["BotCover-
VB Example
","AveragingVolumeAtPeakRMSEfieldLocation"])

Fillet
Performs a fillet on specified edge(s).

UI Access Modeler > Fillet.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Array("NAME:Parameters",
<FilletParametersArray>)
<FilletParametersArray> Array Structured array.
Parameters Array("NAME:FilletParameters",
"Edges:=" , <array containing integer
edge IDs>,
"Vertices:=" , <empty array>,
"Radius:=" , <string>,
"Setback:=" , <string>)

Return Value None.

Python Syntax Fillet(<SelectionsArray>, <Parameters>)

3D Modeler Editor Script Commands 11-86


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.Fillet(
["NAME:Selections",
"Selections:=" , "Box1",
"NewPartsModelFlag:=" , "Model"
],
["NAME:Parameters",
Python Example ["NAME:FilletParameters",
"Edges:=" , [13],
"Vertices:=" , [],
"Radius:=" , "1mm",
"Setback:=" , "0mm"
]
])

VB Syntax Fillet <SelectionsArray> <Parameters>


oEditor.Fillet
Array("NAME:Selections",
"Selections:=" , "Box1",
VB Example
"NewPartsModelFlag:=" , "Model")
Array("NAME:Parameters",
Array("NAME:FilletParameters",

3D Modeler Editor Script Commands 11-87


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Edges:=" , Array(13),
"Vertices:=" , Array(),
"Radius:=" , "1mm",
"Setback:=" , "0mm"))

FlattenGroup
Flattens a specified history tree group.

UI Access Modeler > Group > Flatten.

Name Type Description


<GroupID> Array Structured array.
Parameters
Array("Groups:=", Array(<string list of group
IDs>))

Return Value None.

Python Syntax FlattenGroup (<GroupID>)


Python Example oEditor.FlattenGroup(["Groups:=", ["Group1"]])

VB Syntax FlattenGroup <GroupID>


VB Example oEditor.FlattenGroup Array("Groups:=", Array("Group1"))

3D Modeler Editor Script Commands 11-88


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GenerateHistory
Generates the history for specified 1D object(s).

UI Access Modeler > Generate History.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

Python Syntax GenerateHistory (<SelectionsArray>)


oEditor.GenerateHistory(
["NAME:Selections",
"Selections:=" , "Polyline1",
Python Example
"NewPartsModelFlag:=" , "Model",
"UseCurrentCS:=" , True
])

VB Syntax GenerateHistory <SelectionsArray>

3D Modeler Editor Script Commands 11-89


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.GenerateHistory Array("NAME:Selections",
"Selections:=" , "Polyline1",
VB Example
"NewPartsModelFlag:=" , "Model",
"UseCurrentCS:=" , True)

GetActiveCoordinateSystem
Returns the active coordinate system.

UI Access None.
Parameters None.
Return Value String name of active coordinate system.

Python Syntax GetActiveCoordinateSystem()


Python Example oEditor.GetActiveCoordinateSystem()

VB Syntax GetActiveCoordinateSystem
dim csName
VB Example
csName = oEditor.GetActiveCoordinateSystem

GetActiveCoordinateSystemTransform
Returns the transformation information of active coordinate system.

3D Modeler Editor Script Commands 11-90


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access None.
Parameters None.
Return Value Array of strings containing transformation information.

Python Syntax GetActiveCoordinateSystemTransform()


Python Example oEditor.GetActiveCoordinateSystemTransform()

VB Syntax GetActiveCoordinateSystemTransform
VB Example oEditor.GetActiveCoordinateSystemTransform

GetCoordinateSystems
Returns the names of coordinate systems in the design.

UI Access None.
Parameters None.
Return Value Array containing string names of coordinate systems.

Python Syntax GetCoordinateSystems()


Python Example oEditor.GetCoordinateSystems()

VB Syntax GetCoordinateSystems()
VB Example dim csNames

3D Modeler Editor Script Commands 11-91


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

csNames = oEditor.GetCoordinateSystems

HealObject
Heals an imported object.

UI Access Modeler > Model Preparation > Heal.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Array("NAME:ObjectHealingParameters",
"Version:=" , <integer>,
"AutoHeal:=" , <boolean>,
"TolerantStitch:=" , <boolean>,
"SimplifyGeom:=" , <boolean>,
Parameters "TightenGaps:=" , <boolean>,
"HealToSolid:=" , <boolean>,
"StopAfterFirstStitchError:=", <boolean>,
"MaxStitchTol:=" , <float>,
"ExplodeAndStitch:=" , <boolean>,
"GeomSimplificationTol:=", <integer>,
"Max-
imumGeneratedRadiusForSimplification:=",
<integer>,

3D Modeler Editor Script Commands 11-92


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SimplifyType:=" , <integer>,
"TightenGapsWidth:=" , <float>,
"RemoveSliverFaces:=" , <boolean>,
"RemoveSmallEdges:=" , <boolean>,
"RemoveSmallFaces:=" , <boolean>,
"SliverFaceTol:=" , <integer>,
"SmallEdgeTol:=" , <integer>,
"SmallFaceAreaTol:=" , <integer>,
"BoundingBoxScaleFactor:=", <integer>,
"RemoveHoles:=" , <boolean>,
"RemoveChamfers:=" , <boolean>,
"RemoveBlends:=" , <boolean>,
"HoleRadiusTol:=" , <integer>,
"ChamferWidthTol:=" , <integer>,
"BlendRadiusTol:=" , <integer>,
"AllowableSurfaceAreaChange:=",
<integer>,
"AllowableVolumeChange:=", <integer>)

Return Value None.

Python Syntax HealObject(<SelectionsArray>, <Parameters>)

3D Modeler Editor Script Commands 11-93


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.HealObject(
["NAME:Selections",
"Selections:=" , "Box1",
"NewPartsModelFlag:=" , "Model"
],
["NAME:ObjectHealingParameters",
"Version:=" , 1,
"AutoHeal:=" , True,
"TolerantStitch:=" , True,
"SimplifyGeom:=" , True,
Python Example
"TightenGaps:=" , True,
"HealToSolid:=" , False,
"StopAfterFirstStitchError:=", False,
"MaxStitchTol:=" , 0.001,
"ExplodeAndStitch:=" , True,
"GeomSimplificationTol:=", -1,
"MaximumGeneratedRadiusForSimplification:=", -1,
"SimplifyType:=" , 2,
"TightenGapsWidth:=" , 1E-06,
"RemoveSliverFaces:=" , False,

3D Modeler Editor Script Commands 11-94


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"RemoveSmallEdges:=" , False,
"RemoveSmallFaces:=" , False,
"SliverFaceTol:=" , 0,
"SmallEdgeTol:=" , 0,
"SmallFaceAreaTol:=" , 0,
"BoundingBoxScaleFactor:=", 1250,
"RemoveHoles:=" , False,
"RemoveChamfers:=" , False,
"RemoveBlends:=" , False,
"HoleRadiusTol:=" , 0,
"ChamferWidthTol:=" , 0,
"BlendRadiusTol:=" , 0,
"AllowableSurfaceAreaChange:=", 5,
"AllowableVolumeChange:=", 5
])

VB Syn- HealObject <SelectionsArray> <Parameters>


tax

oEditor.HealObject Array("NAME:Selections", "Selections:=", "Box2",


VB "NewPartsModelFlag:=", _
Exampl-
e "Model"), Array("NAME:ObjectHealingParameters", "Version:=", 1, "AutoHeal:=", false,
"TolerantStitch:=", _

3D Modeler Editor Script Commands 11-95


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

true, "SimplifyGeom:=", true, "TightenGaps:=", true, "HealToSolid:=", false, "StopAfter-


FirstStitchError:=", _
false, "MaxStitchTol:=", 0.001, "ExplodeAndStitch:=", true, "GeomSimplificationTol:=",
_
-1, "MaximumGeneratedRadiusForSimplification:=", -1, "SimplifyType:=", 2,
"TightenGapsWidth:=", _
1E-06, "RemoveSliverFaces:=", false, "RemoveSmallEdges:=", false, "RemoveSmallFaces:=",
_
false, "SliverFaceTol:=", 0, "SmallEdgeTol:=", 0, "SmallFaceAreaTol:=", 0, "Bound-
ingBoxScaleFactor:=", _
1250, "RemoveHoles:=", false, "RemoveChamfers:=", false, "RemoveBlends:=", _
false, "HoleRadiusTol:=", 0, "ChamferWidthTol:=", 0, "BlendRadiusTol:=", 0, "Allow-
ableSurfaceAreaChange:=", _
5, "AllowableVolumeChange:=", 5)

Import
Imports a 3D model file.

Note:

This script does not import DXF or GDSII models. See: ImportDXF and ImportGDSII.

UI Access Modeler > Import.

Name Type Description


Parameters
<Parameters> Array Structured array.

3D Modeler Editor Script Commands 11-96


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:NativeBodyParameters",
"HealOption:=" , <integer>,
"Options:=" , <string>,
"FileType:=" , <string "UnRecognized">,
"MaxStitchTol:=" , <integer>,
"ImportFreeSurfaces:=" , <boolean>,
"GroupByAssembly:=" , <boolean>,
"CreateGroup:=" , <boolean>,
"STLFileUnit:=" , <string>,
"MergeFacesAngle:=" , <float>,
"HealSTL:=" , <boolean>,
"ReduceSTL:=" , <boolean>,
"ReduceMaxError:=" , <integer>,
"ReducePercentage:=" , <integer>,
"PointCoincidenceTol:=" , <float>,
"CreateLightweightPart:=", <boolean>,
"ImportMaterialNames:=" , <boolean>,
"SeparateDisjointLumps:=", <boolean>,
"SourceFile:=" , <string>)

Return Value None.

3D Modeler Editor Script Commands 11-97


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax Import(<Parameters>)


oEditor.Import(
["NAME:NativeBodyParameters",
"HealOption:=" , 0,
"Options:=" , "-1",
"FileType:=" , "UnRecognized",
"MaxStitchTol:=" , -1,
"ImportFreeSurfaces:=" , False,
"GroupByAssembly:=" , False,
"CreateGroup:=" , True,
Python Example "STLFileUnit:=" , "Auto",
"MergeFacesAngle:=" , 0.02,
"HealSTL:=" , False,
"ReduceSTL:=" , False,
"ReduceMaxError:=" , 0,
"ReducePercentage:=" , 100,
"PointCoincidenceTol:=" , 1E-06,
"CreateLightweightPart:=", False,
"ImportMaterialNames:=" , False,
"SeparateDisjointLumps:=", False,

3D Modeler Editor Script Commands 11-98


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SourceFile:=" , "C:\\Users\\jdoe\\Desktop\\export.model"
])

VB Syntax Import <Parameters>


oEditor.Import Array("NAME:NativeBodyParameters",
"HealOption:=" , 0,
"Options:=" , "-1",
"FileType:=" , "UnRecognized",
"MaxStitchTol:=" , -1,
"ImportFreeSurfaces:=" , False,
"GroupByAssembly:=" , False,
"CreateGroup:=" , True,
VB Example "STLFileUnit:=" , "Auto",
"MergeFacesAngle:=" , 0.02,
"HealSTL:=" , False,
"ReduceSTL:=" , False,
"ReduceMaxError:=" , 0,
"ReducePercentage:=" , 100,
"PointCoincidenceTol:=" , 1E-06,
"CreateLightweightPart:=", False,
"ImportMaterialNames:=" , False,

3D Modeler Editor Script Commands 11-99


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SeparateDisjointLumps:=", False,
"SourceFile:=" , "C:\\Users\\jdoe\\Desktop\\export.model")

ImportDXF [Modeler]
Imports a DXF model file.

UI Access Modeler > Import.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:options",
"FileName:=" , <string>,
"Scale:=" , <float>,
"AutoDetectClosed:=" , <boolean>,
"SelfStitch:=" , <boolean>,

Parameters "DefeatureGeometry:=" , <boolean>,


"DefeatureDistance:=" , <integer>,
"RoundCoordinates:=" , <boolean>,
"RoundNumDigits:=" , <integer>,
"WritePolyWithWidthAsFilledPoly:=", <boolean>,
"ImportMethod:=" , <integer>,
"2DSheetBodies:=" , <boolean>,
<layersArray>)

3D Modeler Editor Script Commands 11-100


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<layersArray> Array Structured array.


Array("NAME:LayerInfo",
<layer>, <layer>, <layer>,...)
<layer> Array Structured array.
Array("NAME:<layerName>",
"source:=" , <string>,
"display_source:=" , <string>,
"import:=" , <boolean>,
"dest:=" , <string>,
"dest_selected:=" , <boolean>,
"layer_type:=" , <string>)

Return Value None.

Python Syntax ImportDXF(<Parameters>)


oEditor.ImportDXF(
["NAME:options",
"FileName:=", "C:/Users/jdoe/Desktop/export.dxf",
Python Example "Scale:=" , 0.001,
"AutoDetectClosed:=" , True,
"SelfStitch:=" , True,
"DefeatureGeometry:=" , False,

3D Modeler Editor Script Commands 11-101


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"DefeatureDistance:=" , 0,
"RoundCoordinates:=" , False,
"RoundNumDigits:=" , 4,
"WritePolyWithWidthAsFilledPoly:=", False,
"ImportMethod:=" , 1,
"2DSheetBodies:=" , False,
["NAME:LayerInfo",
["NAME:0",
"source:=" , "0",
"display_source:=" , "0",
"import:=" , True,
"dest:=" , "0",
"dest_selected:=" , False,
"layer_type:=" , "signal"
],
["NAME:LAYER_1",
"source:=" , "LAYER_1",
"display_source:=" , "LAYER_1",
"import:=" , True,
"dest:=" , "LAYER_1",

3D Modeler Editor Script Commands 11-102


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"dest_selected:=" , False,
"layer_type:=" , "signal"
],
["NAME:LAYER_2",
"source:=" , "LAYER_2",
"display_source:=" , "LAYER_2",
"import:=" , True,
"dest:=" , "LAYER_2",
"dest_selected:=" , False,
"layer_type:=" , "signal"
]
]
])

VB Syn- ImportDXF <Parameters>


tax

oEditor.ImportDXF Array("NAME:options", "FileName:=", _


"C:/Users/jdoe/Desktop/export.dxf", "Scale:=", 0.001, "AutoDetectClosed:=", _
VB
true, "SelfStitch:=", true, "DefeatureGeometry:=", false, "DefeatureDistance:=", _
Exampl-
e 0, "RoundCoordinates:=", false, "RoundNumDigits:=", 4,
"WritePolyWithWidthAsFilledPoly:=", _
false, "ImportMethod:=", 1, "2DSheetBodies:=", false, Array("NAME:LayerInfo", Array

3D Modeler Editor Script Commands 11-103


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

("NAME:0", "source:=", _
"0", "display_source:=", "0", "import:=", true, "dest:=", "0", "dest_selected:=", _
false, "layer_type:=", "signal"), Array("NAME:LAYER_1", "source:=", "LAYER_1", "dis-
play_source:=", _
"LAYER_1", "import:=", true, "dest:=", "LAYER_1", "dest_selected:=", false, "layer_
type:=", _
"signal"), Array("NAME:LAYER_2", "source:=", "LAYER_2", "display_source:=", "LAYER_2",
"import:=", _
true, "dest:=", "LAYER_2", "dest_selected:=", false, "layer_type:=", "signal")))

ImportFromClipboard
Imports a model from clipboard.

UI Access Modeler > Import From Clipboard.


Parameters None.
Return Value None.

Python Syntax ImportFromClipboard ()


Python Example oEditor.ImportFromClipboard()

VB Syntax ImportFromClipboard
VB Example oEditor.ImportFromClipboard

3D Modeler Editor Script Commands 11-104


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ImportGDSII [Modeler]
Imports a GDSII model file.

UI Access Modeler > Import.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:options",
"FileName:=" , <string>,
"FlattenHierarchy:=" , <boolean>,
"ImportMethod:=" , <integer>,
<layerMapArray>, <layerMapArray>, <layerMapArray>,...
"OrderMap:=" ,
[ "entry:=" ,
Parameters <entry>, <entry>, <entry>,...
]
])
<layerMapArray> Array Structured array.
Array("NAME:LayerMapInfo",
"LayerNum:=" , <integer>,
"DestLayer:=" , <string>,
"layer_type:=" , <string>)
<entry> Array Structured array.
Array("order:=" , <integer LayerNum>, "layer:=" ,

3D Modeler Editor Script Commands 11-105


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<string DestLayer>)

Return Value None.

Python Syntax ImportGDSII(<Parameters>)


oEditor.ImportGDSII(
["NAME:options",
"FileName:=", "C:/Users/coil2.gds",
"FlattenHierarchy:=" , True,
"ImportMethod:=" , 1,
["NAME:LayerMap",
["NAME:LayerMapInfo",
"LayerNum:=" , 12,
Python Example
"DestLayer:=" , "Signal12",
"layer_type:=" , "signal"
],
["NAME:LayerMapInfo",
"LayerNum:=" , 13,
"DestLayer:=" , "Signal13",
"layer_type:=" , "signal"
],

3D Modeler Editor Script Commands 11-106


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["NAME:LayerMapInfo",
"LayerNum:=" , 14,
"DestLayer:=" , "Signal14",
"layer_type:=" , "signal"
]
],
"OrderMap:=",
[
"entry:=",
["order:=", 0, "layer:=", "Signal12"],
"entry:=",
["order:=", 1, "layer:=", "Signal13"],
"entry:=",
["order:=", 2, "layer:=", "Signal14"]
]
])

VB Syntax ImportGDSII <Parameters>


oEditor.ImportGDSII Array("NAME:options",
VB Example "FileName:=", "C:/export.gds",
"FlattenHierarchy:=", True,

3D Modeler Editor Script Commands 11-107


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ImportMethod:=", 1,
Array("NAME:LayerMap",
Array("NAME:LayerMapInfo",
"LayerNum:=", 1,
"DestLayer:=", "Signal1",
"layer_type:=", "signal"]))
"OrderMap:=", Array(
"entry:=", Array(
"order:=", 0,
"layer:=", "Signal1")))

Imprint
Imprints the geometry of one object upon another.

UI Access Modeler > Boolean > Imprint....

Name Type Description


<Selections> Array Structured array.
Array("NAME:Selections",
Parameters "Blank Parts:=", <string, object name>,
"Tool Parts:=", <string, object name>)
<Parameters> Array Structured array.
Array("NAME:ImprintParameters",

3D Modeler Editor Script Commands 11-108


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"KeepOriginals:=", <boolean>)

Return Value None.

Python Syntax Imprint (<Selections>, <Parameters>)


oEditor.Imprint(
["NAME:Selections",
"Blank Parts:=", "Cylinder1",
Python Example
"Tool Parts:=", "Box1"],
["NAME:ImprintParameters",
"KeepOriginals:=", False])

VB Syntax Imprint <Selections>, <Parameters>


oEditor.Imprint
Array("NAME:Selections",
"Blank Parts:=", "Cylinder1",
VB Example
"Tool Parts:=", "Box1"),
Array("NAME:ImprintParameters",
"KeepOriginals:=", false)

ImprintProjection
Projects the form of a sheet object onto the face or faces of another object (either solid or sheet).

3D Modeler Editor Script Commands 11-109


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Modeler > Boolean > Imprint Projection.

Name Type Description


<Selections> Array Structured array.
Array("NAME:Selections",
"Selections:=", <string, selected objects>)
<Parameters> Array Structured array.
Array("NAME:ImprintProjectionParameters",
Parameters "KeepOriginals:=", <boolean>,
"NormalProjection:=", <boolean>,
"Distance:=" , <float>,
"DirectionX:=" , <float>,
"DirectionY:=" , <float>,
"DirectionZ:=" , <float>)

Return Value None.

Python Syntax ImprintProjection (<Selections>, <Parameters>)


oEditor.ImprintProjection(
["NAME:Selections",
Python Example
"Selections:=", "Rectangle1,Cylinder1"],
["NAME:ImprintProjectionParameters",

3D Modeler Editor Script Commands 11-110


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"KeepOriginals:=", False,
"NormalProjection:=", True,
"Distance:=", "1.36014705087354mm",
"DirectionX:=", "0.882257546512569",
"DirectionY:=", "0.294085848837523",
"DirectionZ:=", "0.367607311046904"])

VB Syntax ImprintProjection <Selections>, <Parameters>


oEditor.ImprintProjection
Array("NAME:Selections",
"Selections:=", "Rectangle1,Cylinder1"),
Array("NAME:ImprintProjectionParameters",
"KeepOriginals:=", false,
VB Example
"NormalProjection:=", true,
"Distance:=", "1.36014705087354mm",
"DirectionX:=", "0.882257546512569",
"DirectionY:=", "0.294085848837523",
"DirectionZ:=", "0.367607311046904")

Intersect
Intersects specified objects.

3D Modeler Editor Script Commands 11-111


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Modeler > Boolean > Intersect.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Parameters
Array("NAME:IntersectParameters",
"KeepOriginals:=" , <boolean True to
keep original objects; False to delete>)

Return Value None.

Python Syntax Intersect(<SelectionsArray>, <Parameters>)


oEditor.Intersect(
["NAME:Selections",
"Selections:=", "Rectangle1,Rectangle2"
Python Example ],
["NAME:IntersectParameters",
"KeepOriginals:=", False
])

VB Syntax Intersect <SelectionsArray> <Parameters>


oEditor.Intersect
VB Example
Array("NAME:Selections",

3D Modeler Editor Script Commands 11-112


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Selections:=", "Rectangle1,Rectangle2")
Array("NAME:IntersectParameters",
"KeepOriginals:=", False)

MoveCStoEnd
Moves a specified Object Coordinate System to the end of the History tree.

UI Access Modeler > Coordinate System > Move CS to End.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

Python Syntax MoveCStoEnd (<SelectionsArray>)


oEditor.MoveCSToEnd(
["NAME:Selections",
Python Example
"Selections:=" , "ObjectCS1"
])

VB Syntax MoveCStoEnd <SelectionsArray>


VB Example oEditor.MoveCSToEnd Array("NAME:Selections", "Selections:=", "ObjectCS1")

3D Modeler Editor Script Commands 11-113


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

MoveEntityToGroup
Moves a specified entity or entities to a specified group.

UI Access Drag item into the group in the history tree.

Name Type Description


<Objects> Array Structured array. Selects the entity/entities to move.
Array("Objects:=" , <array containing string
Parameters
object IDs>)
<MoveEntityToGroup> Array Structured array.
Array("ParentGroup:=" , <string group name>)

Return Value None.

Python Syntax MoveEntityToGroup (<Objects>, <MoveEntityToGroup>)


oEditor.MoveEntityToGroup(
Python Example ["Objects:=", ["Box3"]],
["ParentGroup:=", "Box_Group"])

VB Syntax MoveEntityToGroup <Objects> <MoveEntityToGroup>


oEditor.MoveEntityToGroup
VB Example
Array("Objects:=", Array("Box3"))

3D Modeler Editor Script Commands 11-114


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("ParentGroup:=", "Box_Group")

MoveFaces
Moves the specified faces along normal or along a vector.

UI Access Modeler > Surface > Move Faces > Along [Normal/Vector].

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<MoveFacesParametersArray> Array Structured array.
Array("NAME:Parameters",
<FacesOfOneObjToMove>, <FacesOfOneOb-
jToMove>, ...)
<FacesOfOneObjToMove> Array Structured array.
Array("Name:MoveFacesParameters",
"MoveAlongNormalFlag:=", <boolean>,

Parameters "OffsetDistance:=", <string>,


"MoveVectorX:=", <string>,
"MoveVectorY:=", <string>,
"MoveVectorZ:=", <string>,
"FacesToMove:=", <array>)
MoveAlongNormalFlag specifies whether to move along the
face normal or along a vector. If false, provide the MoveVectorX,
MoveVectorY, and MoveVectorZ parameters.
FacesToMove is an array of integers (the IDs of the faces to
move).

3D Modeler Editor Script Commands 11-115


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None

Python Syntax MoveFaces (<SelectionsArray>, <MoveFacesParametersArray>)


oEditor.MoveFaces(
[
"NAME:Selections",
"Selections:=" , "Rectangle1",
"NewPartsModelFlag:=" , "Model"
],
[
"NAME:Parameters",
[
Python Example
"NAME:MoveFacesParameters",
"MoveAlongNormalFlag:=" , True,
"OffsetDistance:=" , "1mm",
"MoveVectorX:=" , "0mm",
"MoveVectorY:=" , "0mm",
"MoveVectorZ:=" , "0mm",
"FacesToMove:=" , [183]
]
])

VB Syntax MoveFaces <SelectionsArray>, <MoveFacesParametersArray>


oEditor.MoveFaces _
VB Example
Array("NAME:Selections", "Selections:=", _

3D Modeler Editor Script Commands 11-116


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Box2,Box1"), _
Array("NAME:Parameters", _
Array("NAME:MoveFacesParameters", _
"MoveAlongNormalFlag:=", true, _
"OffsetDistance:=", "1mm", _
"FacesToMove:=", Array(218)),
Array("NAME:MoveFacesParameters", _
"MoveAlongNormalFlag:=", false,_
"OffsetDistance:=", "1mm", _
"MoveVectorX:=", "1mm", _
"MoveVectorY:=", "0mm", _
"MoveVectorZ:=", "0mm", _
"FacesToMove:=", Array(185)))

ProjectSheet
Project a sheet object, typically for modeling thin conformal deposits. Typically followed by Thicken Sheet.

UI Access Click Modeler > Surface > Project Sheet.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
Parameters <Parameters> Array Array containing string.
Array("NAME:ProjectSheetParameters")

Return Value None.

3D Modeler Editor Script Commands 11-117


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ProjectSheet (<SelectionsArray>, <Parameters>)


oEditor.ProjectSheet(
['NAME:Selections',
Python Example 'Selections:=','Box1,Box2,Polyline1'],
['NAME:ProjectSheetParameters']
)

VB Syntax ProjectSheet <SelectionsArray> <Parameters>


oEditor.ProjectSheet
Array("NAME:Selections",
VB Example
"Selections:=", "Box1,Box2,Polyline1"),
Array("NAME:ProjectSheetParameters")

PurgeHistory
Purges the history of a specified object.

UI Access Modeler > Purge History.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

3D Modeler Editor Script Commands 11-118


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax PurgeHistory (<SelectionsArray>)


oEditor.PurgeHistory(
["NAME:Selections",
Python Example "Selections:=", "Box2",
"NewPartsModelFlag:=", "Model"
])

VB Syntax PurgeHistory <SelectionsArray>


oEditor.PurgeHistory
Array("NAME:Selections",
VB Example
"Selections:=", "Box2",
"NewPartsModelFlag:=", "Model")

ReplaceWith3DComponent
Replaces the selection with a 3D component.

UI Access None.

Name Type Description


Parameters <GeometryData> Array Structured array.
<DesignData> Array Structured array.

3D Modeler Editor Script Commands 11-119


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ImageFile> Array Structured array.

Return Value None.

Python Syntax ReplaceWith3DComponent(<GeometryData>, <DesignData>, <ImageFile>)


oEditor.ReplaceWith3DComponent(
["NAME:ReplaceData",
"ComponentName:=", "CoaxBend",
"Company:=", "",
"Company URL:=", "",
"Model Number:=", "",
"Help URL:=", "",
Python Example "Version:=", "1.0",
"Notes:=", "",
"IconType:=", "",
"Owner:=", "Jane Doe",
"Email:=", "[email protected]",
"Date:=", "3:46:31 PM Jul 26, 2020",
"HasLabel:=", False,
"IncludedParts:=", ["outer","teflon","inner","teflon_1"],

3D Modeler Editor Script Commands 11-120


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"HiddenParts:=", [],
"IncludedCS:=", [],
"ReferenceCS:=", "Global",
"IncludedParameters:=", ["bend_angle"],
"ParameterDescription:=", ["bend_angle:=", ""]
],
["NAME:DesignData",
"Excitations:=", ["1","2"]
],
["NAME:ImageFile",
"ImageFile:=", ""
]
)

VB Syn- ReplaceWith3DComponent <GeometryData>, <DesignData>, <ImageFile>


tax

oEditor.ReplaceWith3DComponent Array("NAME:CreateData", "ComponentName:=", _


"ConnectorOnly_wBCs", "Company:=", "", "Company URL:=", "", "Model Number:=", "", "Help
VB URL:=", _
Example
"", "Version:=", "1.0", "Notes:=", "", "IconType:=", "", "Owner:=", _
"MyName", "Email:=", "[email protected]", "Date:=", "3:07:37 PM Jun 25, 2019", _

3D Modeler Editor Script Commands 11-121


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"HasLabel:=", false, "IsEncrypted:=", false, "AllowEdit:=", false,_


"SecurityMessage:=", "", "Password:=", "", "EditPassword:=", "", _
"PasswordType:=", "UnknownPassword", "HideContents:=", true, "ReplaceNames:=", true, _
"ComponentOutline:=", "None", "IncludedParts:=", _
Array("pin", "solderl", "ConnectorDielectric", _
"ConnectorOuter", "pcap", "solderr"), "HiddenParts:=", Array(), _
"IncludedCS:=", Array(), "ReferenceCS:=", _
"Global", "IncludedParameters:=", Array("lcon", "lpin", "rpin"), _
"ParameterDescription:=", Array("lcon:=", "", "lpin:=", "", "rpin:=", ""), "IsLi-
censed:=", false, _
"LicensingDllName:=", "", "VendorComponentIdentifier:=", _
"", "PublicKeyFile:=", ""), Array("NAME:DesignData", "Boundaries:=", Array( _
"PinSurface", "Connect"), "Excitations:=", Array("1", "2"), "MeshOperations:=", Array(
_
"Length1", "SkinDepth1")), "", Array("NAME:ImageFile", "ImageFile:=", "")

Section
Creates a 2D cross-section of the selection in the specified plane.

UI Access Modeler > Surface > Section.

Name Type Description


Parameters <SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.

3D Modeler Editor Script Commands 11-122


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:SectionToParameters",
"CreateNewObjects:=" , <boolean>,
"SectionPlane:=" , <string "XY", "YZ", or
"ZX">,
"SectionCrossObject:=" , <boolean>)

Return Value None.

Python Syntax Section (<SelectionsArray>, <Parameters>)


oEditor.Section(
["NAME:Selections",
"Selections:=" , "Cone1",
"NewPartsModelFlag:=" , "Model"
],
Python Example
["NAME:SectionToParameters",
"CreateNewObjects:=" , True,
"SectionPlane:=" , "XY",
"SectionCrossObject:=" , False
])

VB Syntax Section <SelectionsArray> <Parameters>

3D Modeler Editor Script Commands 11-123


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.Section
Array("NAME:Selections",
"Selections:=" , "Cone1",
"NewPartsModelFlag:=" , "Model")
VB Example
Array("NAME:SectionToParameters",
"CreateNewObjects:=" , True,
"SectionPlane:=" , "XY",
"SectionCrossObject:=" , False)

SeparateBody
Separates the bodies of specified multi-lump objects.

UI Access Modeler > Boolean > Separate Bodies.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

Python Syntax SeparateBody (<SelectionsArray>)


oEditor.SeparateBody(
Python Example ["NAME:Selections",
"Selections:=", "Rectangle1,Circle1",

3D Modeler Editor Script Commands 11-124


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NewPartsModelFlag:=", "Model"
])

VB Syntax SeparateBody <SelectionsArray>


oEditor.SeparateBody
Array("NAME:Selections",
VB Example
"Selections:=", "Rectangle1,Circle1",
"NewPartsModelFlag:=", "Model")

SetModelUnits
Sets the model units.

UI Access Modeler > Units.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:Units Parameter",
Parameters "Units:=", <string>,
"Rescale:=", <boolean True to rescale model;
else False>)
To see valid unit strings, select Modeler > Units.

Return Value None.

3D Modeler Editor Script Commands 11-125


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax SetModelUnits (<Parameters>)


oEditor.SetModelUnits(
["NAME:Units Parameter",
Python Example "Units:=", "km",
"Rescale:=", False
])

VB Syntax SetModelUnits <Parameters>


oEditor.SetModelUnits
Array("NAME:Units Parameter",
VB Example
"Units:=", "km",
"Rescale:=", False)

SetWCS
Sets the working coordinate system.

UI Access Modeler > Coordinate System > Set Working CS.

Name Type Description


<Parameters> Array Structured array.
Parameters
Array("NAME:SetWCS Parameter",
"Working Coordinate System:=", <string CS name>,

3D Modeler Editor Script Commands 11-126


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"RegionDepCSOk:=" , <boolean True if region-depend-


ent; else False)

Return Value None.

Python Syntax SetWCS (<Parameters>)


oEditor.SetWCS(
["NAME:SetWCS Parameter",
Python Example "Working Coordinate System:=", "Global",
"RegionDepCSOk:=", False
])

VB Syntax SetWCS <Parameters>


oEditor.SetWCS
Array("NAME:SetWCS Parameter",
VB Example
"Working Coordinate System:=", "Global",
"RegionDepCSOk:=", False)

ShowWindow
Opens the active 3D Modeler window.

UI Access None.

3D Modeler Editor Script Commands 11-127


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters None.
Return Value None.

Python Syntax ShowWindow


Python Example oEditor.ShowWindow()

VB Syntax ShowWindow
VB Example oEditor.ShowWindow

Simplify
Converts a complex MCAD object into simpler primitives which are easy to mesh and solve.

UI Access Modeler > Model Preparation > Simplify.

Name Type Description


<Selections> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Array("NAME:SimplifyParameters",
Parameters "Type:=", <string fit type>,
"ExtrusionAxis:=", <string>,
"Cleanup:=", <boolean>,
"Splitting:=", <boolean>,

3D Modeler Editor Script Commands 11-128


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SeparateBodies:=", <boolean>,
"CloneBody:=", <boolean>,
"Generate Primitive History:=", <boolean>,
"NumberPointsCurve:=", <integer>,
"LengthThresholdCurve:=", <integer>)
<CreateGroup> Array Structured array.
Array("CreateGroupsForNewObjects:=",<boolean>)

Return Value None.

Python Syntax Simplify (<Selections>, <Parameters>, <CreateGroup>)


oEditor.Simplify(
["NAME:Selections",
"Selections:=", "Cylinder1,Box2",
"NewPartsModelFlag:=", "Model"],
["NAME:SimplifyParameters",
Python Example "Type:=", "Polygon Fit",
"ExtrusionAxis:=", "Auto",
"Cleanup:=", True,
"Splitting:=", True,
"SeparateBodies:=", False,
"CloneBody:=", False,

3D Modeler Editor Script Commands 11-129


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Generate Primitive History:=", True,


"NumberPointsCurve:=", 3,
"LengthThresholdCurve:=", 20],
["CreateGroupsForNewObjects:=", True]
)

VB Syntax Simplify <Selections>, <Parameters>, <CreateGroup>


oEditor.Simplify
Array("NAME:Selections",
"Selections:=", "Cylinder1,Box2",
"NewPartsModelFlag:=", "Model"),
Array("NAME:SimplifyParameters",
"Type:=", "Polygon Fit",
VB Example
"ExtrusionAxis:=", "Auto",
"Cleanup:=", true,
"Splitting:=", true,
"SeparateBodies:=", false,
"CloneBody:=", false,
"Generate Primitive History:=", true,

3D Modeler Editor Script Commands 11-130


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NumberPointsCurve:=", 3,
"LengthThresholdCurve:=", 20),
Array("CreateGroupsForNewObjects:=", true)

Split
Splits the specified object(s) along a plane.

UI Access Modeler > Boolean > Split.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Array("NAME:SplitToParameters",
"SplitPlane:=" , <string "XY", "YZ", "ZX", or
"Dummy">,
"WhichSide:=" , <string "PositiveOnly", "Neg-
ativeOnly" or "Both">,

Parameters "ToolType:=" , <string "PlaneTool" or


"FaceTool">,
"ToolEntityID:=" , <-1 if using SplitPlane; else
FaceID>,
"SplitCrossingObjectsOnly:=", <boolean>,
"DeleteInvalidObjects:=", <boolean>)
You can split an object either along an existing plane , or by creating a
plane using an edge.
For existing plane:

3D Modeler Editor Script Commands 11-131


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l SplitPlane is "XY", "YZ", or "ZX"


l ToolType is "PlaneTool"
l ToolEntityID is -1

For an edge:
l SplitPlane is "Dummy"
l ToolType is "EdgeTool"
l ToolEntityID is the face ID

Return Value None.

Python Syntax Split(<SelectionsArray>, <Parameters>)


oEditor.Split(
["NAME:Selections",
"Selections:=" , "Box1",
"NewPartsModelFlag:=" , "Model"
],
Python Example
["NAME:SplitToParameters",
"SplitPlane:=" , "XY",
"WhichSide:=" , "PositiveOnly",
"ToolType:=" , "PlaneTool",
"ToolEntityID:=" , -1,

3D Modeler Editor Script Commands 11-132


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SplitCrossingObjectsOnly:=", False,
"DeleteInvalidObjects:=", True
])

VB Syntax Split <SelectionsArray> <Parameters>


oEditor.Split
Array("NAME:Selections",
"Selections:=" , "Box1",
"NewPartsModelFlag:=" , "Model")
Array("NAME:SplitToParameters",
VB Example "SplitPlane:=" , "XY",
"WhichSide:=" , "PositiveOnly",
"ToolType:=" , "PlaneTool",
"ToolEntityID:=" , -1,
"SplitCrossingObjectsOnly:=", False,
"DeleteInvalidObjects:=", True)

Stitch
Stitches selected sheets.

UI Access Modeler > Model Preparation > Stitch Sheets.

Name Type Description


Parameters
<Selections> Array Structured array. See: SelectionsArray.

3D Modeler Editor Script Commands 11-133


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<Parameters> Array Structured array.


Array("NAME:StitchParameters",
"MaxTol:=", <integer maximum tolerance>)

Return Value None.

Python Syntax Stitch (<Selections>, <Parameters>)


oEditor.Stitch(
["NAME:Selections",
"Selections:=", "Rectangle3,Rectangle4",
Python Example "NewPartsModelFlag:=", "Model"],
["NAME:StitchParameters",
"MaxTol:=", -1]
)

VB Syntax Stitch <Selections>, <Parameters>


oEditor.Stitch
Array("NAME:Selections",
VB Example
"Selections:=", "Rectangle3,Rectangle4",
"NewPartsModelFlag:=", "Model"),

3D Modeler Editor Script Commands 11-134


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:StitchParameters",
"MaxTol:=", -1)

Subtract
Subtracts the specified object(s).

UI Access Modeler > Boolean > Subtract.

Name Type Description


<Selections> Array Structured array.
Array("NAME:Selections",
"Blank Parts:=" , <string object name(s)>,
"Tool Parts:=" , <string object name(s)>)
Parameters The Tool Parts object is the object being removed.
The Blank Parts object has any Tool Parts overlap removed.
Either string can contain more than one object.
<Parameters> Array Structured array.
Array("NAME:SubtractParameters",
"KeepOriginals:=" , <boolean>)

Return Value None.

Python Syntax Subtract(<Selections>, <Parameters>)


Python Example oEditor.Subtract(

3D Modeler Editor Script Commands 11-135


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["NAME:Selections",
"Blank Parts:=", "Rectangle1",
"Tool Parts:=", "Rectangle2"
],
["NAME:SubtractParameters",
"KeepOriginals:=", False
])

VB Syntax Subtract <Selections> <Parameters>


oEditor.Subtract
Array("NAME:Selections",
"Blank Parts:=", "Rectangle1",
VB Example
"Tool Parts:=", "Rectangle2")
Array("NAME:SubtractParameters",
"KeepOriginals:=", false)

SweepFacesAlongNormal
Sweep the specified face(s) along normal.

UI Access Modeler > Surface > Sweep Faces Along Normal

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

3D Modeler Editor Script Commands 11-136


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<parameters> Array Structured array.


Array("NAME:Parameters",
"NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=", <faceIDarray>,
"LengthOfSweep:=", "<value><units>")

Return Value None

Python Syntax SweepFacesAlongNormal(<SelectionsArray> <parameters>)


oEditor.SweepFacesAlongNormal(
["NAME:Selections",
"Selections:=", "Rectangle1",
"NewPartsModelFlag:=", "Model"],
Python Example ["NAME:Parameters",
"NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=", [183],
"LengthOfSweep:=", "0.1mm"])

VB Syntax SweepFacesAlongNormal <SelectionsArray> <parameters>


VB Example oEditor.SweepFacesAlongNormal

3D Modeler Editor Script Commands 11-137


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Selections",
"Selections:=", "Rectangle1",
"NewPartsModelFlag:=", "Model"),
Array("NAME:Parameters",
"NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=", Array(57),
"LengthOfSweep:=", "0.5mm")
)

ThickenSheet
Thickens a sheet object to convert it to a 3D object.

UI Access Modeler > Surface > Thicken Sheet

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<parameters> Array Structured array.
Parameters Array("NAME:SheetThickenParameters",
"Thickness:=" , <string>,
"BothSides:=" , <boolean>)

Return Value None.

3D Modeler Editor Script Commands 11-138


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ThickenSheet (<SelectionsArray> <parameters>)


oEditor.ThickenSheet(
["NAME:Selections",
"Selections:=" , "Rectangle3",
"NewPartsModelFlag:=" , "Model"
Python Example ],
["NAME:SheetThickenParameters",
"Thickness:=" , "0.01mm",
"BothSides:=" , False
])

VB Syntax ThickenSheet <SelectionsArray> <parameters>


oEditor.ThickenSheet
Array("NAME:Selections",
"Selections:=" , "Rectangle3",
VB Example "NewPartsModelFlag:=" , "Model")
Array("NAME:SheetThickenParameters",
"Thickness:=" , "0.01mm",
"BothSides:=" , false)

3D Modeler Editor Script Commands 11-139


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UncoverFaces
Uncovers the specified face(s).

UI Access Modeler > Surface > Uncover Faces

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<parameters> Array Structured array.

Parameters Array("NAME:Parameters",
Array("NAME:UncoverFacesParameters",
"FacesToUncover:=" , <array of face
IDs>))

Return Value None.

Python Syntax UncoverFaces(<SelectionsArray> <parameters>)


oEditor.UncoverFaces(
["NAME:Selections",
"Selections:=" , "Box1",
Python Example "NewPartsModelFlag:=" , "Model"
],
["NAME:Parameters",
["NAME:UncoverFacesParameters",

3D Modeler Editor Script Commands 11-140


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"FacesToUncover:=" , [12,16,18]
]
])

VB Syntax UncoverFaces <SelectionsArray> <parameters>


oEditor.UncoverFaces
Array("NAME:Selections",
"Selections:=" , "Box1",
VB Example "NewPartsModelFlag:=" , "Model")
Array("NAME:Parameters",
Array("NAME:UncoverFacesParameters",
"FacesToUncover:=" , Array(12,16,18)))

Unite
Unites the specified objects.

UI Access Modeler > Boolean > Unite

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<parameters> Array Structured array.
Parameters
Array("NAME:UniteParameters",
"KeepOriginals:=" , <boolean>)

3D Modeler Editor Script Commands 11-141


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax Unite(<SelectionsArray>, <parameters>)


oEditor.Unite(
["NAME:Selections",
"Selections:=", "Rectangle1,Rectangle2"
Python Example ],
["NAME:UniteParameters",
"KeepOriginals:=", False
])

VB Syntax Unite <SelectionsArray> <parameters>


oEditor.Unite
Array("NAME:Selections",
VB Example "Selections:=", "Rectangle1,Rectangle2")
Array("NAME:UniteParameters",
"KeepOriginals:=", false)

Ungroup
Ungroups a specified history tree group.

3D Modeler Editor Script Commands 11-142


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Modeler > Group > Ungroup

Name Type Description


Parameters <Groups> Array Structured array.
Array("Groups:=", <array of group names to ungroup>)

Return Value None

Python Syntax Ungroup(<Groups>)


Python Example oEditor.Ungroup(["Groups:=", ["Group1"]] )

VB Syntax Ungroup <Groups>


VB Example oEditor.Ungroup Array("Groups:=", Array("Group1"))

WrapSheet
Wraps a sheet object to another object.

UI Access None.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Parameters
Array("NAME:WrapSheetParameters",
"Imprinted:=", <boolean>)

Return Value None.

3D Modeler Editor Script Commands 11-143


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax WrapSheet (<SelectionsArray>, <Parameters>)


oEditor.WrapSheet(
["NAME:Selections",
"Selections:=","Rectangle1,Box1"
],
Python Example
["NAME:WrapSheetParameters",
"Imprinted:=", True
]
)

VB Syntax WrapSheet <SelectionsArray> <Parameters>


oEditor.WrapSheet
Array("NAME:Selections",
VB Example "Selections:=", "Rectangle1,Box1"),
Array("NAME:WrapSheetParameters",
"Imprinted:=", true)

Other oEditor Commands


AddDefinitionFromBlock

3D Modeler Editor Script Commands 11-144


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AddDefinitionFromLibFile
AddViewOrientation
BreakUDMConnection
ChangeProperty
Delete
FitAll
GeometryCheckAndAutofix
GetBodyNamesByPosition
GetChildNames [Modeler]
GetChildOjbect [Modeler]
GetChildTypes [Modeler]
GetEdgeByPosition
GetEdgeIDsFromObject
GetEdgeIDsFromFace
GetEntityListIDByName
GetExtendedDefinitionObject
GetFaceArea
GetFaceByPosition
GetFaceCenter
GetFaceIDs
GetGeometryModelerMode

3D Modeler Editor Script Commands 11-145


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetMatchedObjectName
GetModelBoundingBox
GetModelUnits
GetNumObjects
GetObjectIDByName
GetObjectName
GetObjectNameByFaceID
GetObjectsByMaterial
GetObjectsInGroup
GetObjectVolume
GetPropertyValue
GetPropEvaluatedValue
GetPropNames
GetPropSIValue
GetPropValue
GetSelections
GetUserPosition
GetVertexIDsFromEdge
GetVertexIDsFromFace
GetVertexIDsFromObject

3D Modeler Editor Script Commands 11-146


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetVertexPosition
OpenExternalEditor
PageSetup
RenamePart
SetPropValue [Modeler]
AddDefinitionFromBlock
Adds a material definition from block text (same definition format as would be contained in the material library file) by library type
(using definition folder name). This scripting command directly supports the .AMAT (or .ASURF) definition formats.

UI Access N/A

Name Type Description

<defBlock> String Text of the new material definition in block form.


Parameters <defFolderName> String Library type (by definition folder name)
<newTimeStamp> String New timestamp (time_t as integer number of seconds since 1/1/1970 12:00am,
as string), default is current time
<replaceExisting> Boolean True to replace existing, False to choose a new unique name if an existing defin-
ition is found

Return Value A property scripting object for the definition.

P- AddDefinitionFromBlock(<defBlock>,<defFolderName>, <newTimeStamp>, <replaceExisting>)


yt-
h-
o-
n
S-

3D Modeler Editor Script Commands 11-147


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

y-
nt-
ax

oProject = oDesktop.NewProject()
oProject.InsertDesign("HFSS", "HFSSDesign1", "DrivenModal", "")
oDesign = oProject.SetActiveDesign("HFSSDesign1")
oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateBox(

P- [
yt-
h-
o- "NAME:BoxParameters",
n
E-
x- "XPosition:=" , "-0.4mm",
a-
m- "YPosition:=" , "-1mm",
pl-
e
"ZPosition:=" , "0mm",
"XSize:=" , "1.4mm",
"YSize:=" , "1.6mm",
"ZSize:=" , "0.6mm"
],

3D Modeler Editor Script Commands 11-148


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:Attributes",
"Name:=" , "Box1",

"Flags:=" , "",

"Color:=" , "(143 175 143)",

"Transparency:=" , 0,

"PartCoordinateSystem:=", "Global",

"UDMId:=" , "",

"MaterialValue:=" , "\"vacuum\"",

"SurfaceMaterialValue:=", "\"\"",

"SolveInside:=" , True,

"ShellElement:=" , False,

"ShellElementThickness:=", "0mm",

"IsMaterialEditable:=" , True,

3D Modeler Editor Script Commands 11-149


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseMaterialAppearance:=", False,

"IsLightweight:=" , False

])
oDefinitionManager = oProject.GetDefinitionManager()
defBlock = "$begin 'vacuum2' $begin 'AttachedData' $begin 'MatAppearanceData' property_data-
='appearance_data' Red=230 Green=230 Blue=230 Transparency=0.95 $end 'MatAppearanceData'
$end 'AttachedData' simple('permittivity', 1) ModTime=1499970477 $end 'vacuum2'"
added = oDefinitionManager.AddDefinitionFromBlock(defBlock, "Materials", "10101010", True)
addedName = ''
if isinstance(added, basestring):
addedName = added
elif isinstance(added, list):
addedName = added[0]
else:

addedName = added.GetName().replace("Materials:", "")


AddInfoMessage(os.path.basename(__file__) + " result: " + addedName)
materialNameInQuotes = "\"" + addedName + "\""
oEditor.ChangeProperty(
[

3D Modeler Editor Script Commands 11-150


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:AllTabs",

"NAME:Geometry3DAttributeTab",

"NAME:PropServers",

"Box1"

],

"NAME:ChangedProps",

"NAME:Material",

"Value:=", materialNameInQuotes

3D Modeler Editor Script Commands 11-151


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

]
]
])

AddDefinitionFromLibFile
Adds a material definition from a library file (e.g. AMAT file), by name and library type (using definition folder name) . This scripting
command directly supports the .AMAT (or .ASURF) definition formats.

UI Access N/A

Name Type Description

<FilePath> String Path of the library file (i.e. AMAT file or ASURF file)
<defName> String Which definition to use, required because a lib file can have multiple definitions.
Parameters
<defFolderName> String Library type (by definition folder name).
<newTimeStamp> String New timestamp string (time_t as integer, number of seconds since 1/1/1970
12:00am), default is current time
<replaceExisting> Boolean True to replace existing, False to choose a new unique name if an existing defin-
ition is found, default is False

Return Value Property scripting object for the definition.

Python AddDefinitionFromLibFile(<FilePath>, <defName>, <defFolderName>, <newTimeStamp>,<replaceExisting>)


Syntax

Python
oProject = oDesktop.NewProject()
Example oProject.InsertDesign("HFSS", "HFSSDesign1", "DrivenModal", "")

3D Modeler Editor Script Commands 11-152


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDesign = oProject.SetActiveDesign("HFSSDesign1")
oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateBox(

"NAME:BoxParameters",

"XPosition:=" , "-0.4mm",
"YPosition:=" , "-1mm",
"ZPosition:=" , "0mm",
"XSize:=" , "1.4mm",
"YSize:=" , "1.6mm",
"ZSize:=" , "0.6mm"
],

"NAME:Attributes",
"Name:=" , "Box1",

"Flags:=" , "",

"Color:=" , "(143 175 143)",

3D Modeler Editor Script Commands 11-153


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Transparency:=" , 0,

"PartCoordinateSystem:=", "Global",

"UDMId:=" , "",

"MaterialValue:=" , "\"vacuum\"",

"SurfaceMaterialValue:=", "\"\"",

"SolveInside:=" , True,

"ShellElement:=" , False,

"ShellElementThickness:=", "0mm",

"IsMaterialEditable:=" , True,

"UseMaterialAppearance:=", False,

"IsLightweight:=" , False

])

3D Modeler Editor Script Commands 11-154


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDefinitionManager = oProject.GetDefinitionManager()
scriptDir = os.path.dirname(os.path.realpath(__file__))
amatFilePath = scriptDir + '/material0.txt'
materialName = "material0"
materialNameInQuotes = "\"" + materialName + "\""
added = oDefinitionManager.AddDefinitionFromLibFile(amatFilePath, materialName, "Mater-
ials", "")
addedName = ''
if isinstance(added, basestring):
addedName = added
elif isinstance(added, list):
addedName = added[0]
else:
addedName = added.GetName().replace("Materials:", "")
AddInfoMessage(os.path.basename(__file__) + " result: " + addedName)
oEditor.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Geometry3DAttributeTab",
[
"NAME:PropServers",

3D Modeler Editor Script Commands 11-155


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Box1"
],
[
"NAME:ChangedProps",
[
"NAME:Material",
"Value:=", materialNameInQuotes
]
]
]
])

AddViewOrientation
Creates a new orientation using a script. Input parameters can be either vector components or angles. Local view orientation specific
to a design can be saved in project by calling Save() on the project object.

Note:

You cannot use the name of an existing view. Default views include: top, bottom, right, left, front, back, trimetric, dimetric,
and isometric.

UI Access View > Modify Attributes > Orientation List. Enter parameters and click Add.

3D Modeler Editor Script Commands 11-156


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<orientationName> String Name of the new orientation.
<isGlobalOrientation> Long 1 to save global; else 0.
<OrientationVectorComponents> Array Structured array. Use either <Ori-
entationVectorComponents> or <OrientationAnglesArray>.
Array("NAME:OrientationVectorComponents",
Array("NAME:Direction",
<float>,
<float>,
<float>,
Array("NAME:Up",
<float>,
Parameters
<float>,
<float>))
<OrientationAnglesArray> Array Structured array. Use either <Ori-
entationVectorComponents> or <OrientationAnglesArray>.
Array("NAME:OrientationAngles",
"Psi:=" , <float>,
"Theta:=" , <float>,
"Phi:=" , <float>)
<ProjectionParams> Array Optional. Structured array containing arrays of four optional
parameters: Scaling, Translation, Projection Type, and
Projection Limits.
Array("NAME:ProjectionParams",

3D Modeler Editor Script Commands 11-157


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Scaling",
<float>,
<float>,
<float>
),
Array("NAME:Translation",
<float>,
<float>,
<float>
),
"ProjectionType:=" ,
<string "Orthographic" or "Perspective">,
Array("NAME:ProjectionLimits",
<float>,
<float>,
<float>,
<float>,
<float>,
<float>
)

3D Modeler Editor Script Commands 11-158


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax
AddViewOrientation(<orientationName>, <isGlobalOrientation>, <OrientationVectorComponents or Ori-
entationAnglesArray>, <ProjectionParams>)

Example Using Angles and Projection Parameters:


oEditor.AddViewOrientation("orientation3", 0,
["NAME:OrientationAngles",
"Psi:=" , -161.565002441406,
"Theta:=" , 32.3115005493164,
"Phi:=" , 0 ],

["NAME:ProjectionParams",
Python Example
["NAME:Scaling",
0.591607987880707,

0.591607987880707,

0.591607928276062
],

["NAME:Translation",

3D Modeler Editor Script Commands 11-159


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

0,
2.38418579101563E-07,
-5.7486834526062
],
"ProjectionType:=" , "Orthographic",

["NAME:ProjectionLimits",

-2.44362282752991,
2.44362282752991,

-1,

1,
0.625207424163818,
10.8721580505371
]
]
)
Example Using Vector without Projection Parameters:
oEditor.AddViewOrientation("orientation6", 0,

3D Modeler Editor Script Commands 11-160


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["NAME:OrientationVectorComponents",
["NAME:Direction",
-0.801783978939056,
-0.267262011766434,
-0.534521996974945
],
["NAME:Up",
-0.507091999053955,
-0.169030994176865,
0.845155000686646
]
])

AddViewOrientation <orientationName>, <isGlobalOrientation>, <OrientationVectorComponents or Ori-


VB Syntax
entationAnglesArray>, <ProjectionParams>

Example Using Angles and Projection Parameters:


oEditor.AddViewOrientation "orientation3", 0,
Array("NAME:OrientationAngles",
VB Example
"Psi:=" , -161.565002441406,
"Theta:=" , 32.3115005493164,
"Phi:=" , 0 ),

3D Modeler Editor Script Commands 11-161


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:ProjectionParams",

Array("NAME:Scaling",
0.591607987880707,

0.591607987880707,

0.591607928276062
),

Array("NAME:Translation",

0,
2.38418579101563E-07,
-5.7486834526062
),
"ProjectionType:=" , "Orthographic",

Array("NAME:ProjectionLimits",

-2.44362282752991,

3D Modeler Editor Script Commands 11-162


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

2.44362282752991,

-1,

1,
0.625207424163818,
10.8721580505371
)
)
Example Using Vector without Projection Parameters:
oEditor.AddViewOrientation "orientation6", 0,
Array("NAME:OrientationVectorComponents",
Array("NAME:Direction",
-0.801783978939056,
-0.267262011766434,
-0.534521996974945
),
Array("NAME:Up",
-0.507091999053955,
-0.169030994176865,
0.845155000686646

3D Modeler Editor Script Commands 11-163


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

)
)

AssignSurfaceMaterial
Assigns a material to specified surfaces.

UI Access N/A

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<AttributesArray> Array Structured array. See: AttributesArray.
This script supports the following attributes:
l MaterialValue

Parameters l SolveInside
l ShellElement
l ShellElementThickness
l IsMaterialEditable
l UseMaterialAppearance
l IsLightweight

Return Value None.

Python Syntax AssignSurfaceMaterial(<SelectionsArray>, <AttributesArray>)

3D Modeler Editor Script Commands 11-164


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.AssignSurfaceMaterial(
["NAME:Selections",
"AllowRegionDependentPartSelectionForPMLCreation:=", True,
"AllowRegionSelectionForPMLCreation:=", True,
"Selections:=" , "Rectangle1"
],
["NAME:Attributes",
Python Example "MaterialValue:=" , "diamond",
"SolveInside:=" , False,
"ShellElement:=" , False,
"ShellElementThickness:=" , "nan",
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=" , False,
"IsLightweight:=" , False
])

VB Syntax AssignSurfaceMaterial <SelectionsArray> <AttributesArray>

3D Modeler Editor Script Commands 11-165


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.AssignSurfaceMaterial
Array("NAME:Selections",
"AllowRegionDependentPartSelectionForPMLCreation:=", true,
"AllowRegionSelectionForPMLCreation:=", true,
"Selections:=" , "Rectangle1")
Array("NAME:Attributes",
VB Example "MaterialValue:=" , "diamond",
"SolveInside:=" , false,
"ShellElement:=" , false,
"ShellElementThickness:=" , "nan",
"IsMaterialEditable:=" , true,
"UseMaterialAppearance:=" , false,
"IsLightweight:=" , false)

BreakUDMConnection
Breaks a current UDM connection to SpaceClaim.

UI Access Break Connection.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

3D Modeler Editor Script Commands 11-166


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax BreakUDMConnection (<SelectionsArray>)


oEditor.BreakUDMConnection(
[
Python Example "NAME:Selections",
"Selections:=" , "SpaceClaim1"
])

VB Syntax BreakUDMConnection <SelectionsArray>


oEditor.BreakUDMConnection Array("NAME:Selections",
VB Example
"Selections:=", "")

ChangeProperty
Changes the properties of an object in the history tree.

UI Access Right-click an object in the History Tree and select Properties.

Name Type Description


<propertyArgs> Array Structured array. The properties vary depending on the
Parameters object. Due to the number of potential configurations, it is
recommended that you generate this script using the UI's
Automation tab.

Return Value None.

3D Modeler Editor Script Commands 11-167


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ChangeProperty(<propertyArgs>)

Example Changing the Position of a Box:


oEditor.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Geometry3DCmdTab",
[
"NAME:PropServers" ,
"Box1:CreateBox:1"
],
[
"NAME:ChangedProps",
[
"NAME:Position",
Python Example "X:=" , "0.35in",
"Y:=" , "0.55in",
"Z:=" , "0in"
]
]
]
])
Example Changing a Box's Material and Wireframe Display:
oEditor.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Geometry3DAttributeTab",
[

3D Modeler Editor Script Commands 11-168


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:PropServers" ,
"Box1"
],
[
"NAME:ChangedProps",
[
"NAME:Material",
"Value:=" , "\"vacuum\""
],
[
"NAME:Display Wireframe",
"Value:=" , True
]
]
]
])

VB Syntax ChangeProperty <propertyArgs>

Example Changing the Position of a Box:


oEditor.ChangeProperty
Array("NAME:AllTabs",
Array("NAME:Geometry3DCmdTab",
Array("NAME:PropServers" ,
"Box1:CreateBox:1"
VB Example ),
Array("NAME:ChangedProps",
Array("NAME:Position",
"X:=" , "0.35in",
"Y:=" , "0.55in",
"Z:=" , "0in"
)

3D Modeler Editor Script Commands 11-169


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

)
)
)
Example Changing a Box's Material and Wireframe Display:
oEditor.ChangeProperty(
Array("NAME:AllTabs",
Array("NAME:Geometry3DAttributeTab",
Array("NAME:PropServers",
"Box1"
),
Array("NAME:ChangedProps",
Array("NAME:Material",
"Value:=", "\"vacuum\""
),
Array("NAME:Display Wireframe",
"Value:=", True
)
)
)
)

CloseAllWindows[Editor]
Closes all windows belong to current 3D Modeler editor.

UI Access N/A
Parameters None.
Return Value None.

3D Modeler Editor Script Commands 11-170


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax CloseAllWindows()


Python Example oEditor.CloseAllWindows()

VB Syntax CloseAllWindows
VB Example oEditor.CloseAllWindows

Defeature
Removes irrelevant features from a primitive.

UI Access N/A

Name Type Description


<Selections> Array Structured array. See: SelectionsArray.
<Options> Array Structured array.

Parameters Array("NAME:options",
"tolerance:=", <double containing tolerance value>,
"fix:=", <boolean, if true, then self-intersections
are fixed.>)

Return Value None.

Python Syntax Defeature(<Selections>, <Options>)


oEditor.Defeature(
Python Example
["NAME:Selections", "Selections:=", "Box1"],

3D Modeler Editor Script Commands 11-171


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["NAME:Options", "Tolerance:=", 1E-006, "Fix:=", True])

VB Syntax Defeature <Selections>, <Options>


oEditor.Defeature
VB Example Array("NAME:Selections", "Selections:=", "Box1"),
Array("NAME:Options", "tolerance:=", 1E-006, "fix:=", true)

Delete
Deletes the specified object(s).

UI Access Edit > Delete.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

Python Syntax Delete(<SelectionsArray>)


oEditor.Delete(
["NAME:Selections",
Python Example
"Selections:=", "Rectangle1,Rectangle2"
])

3D Modeler Editor Script Commands 11-172


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax Delete <SelectionsArray>


VB Example oEditor.Delete Array("NAME:Selections", "Selections:=", "Rectangle1,Rectangle2")

FitAll
Fits the design to the modeling area.

UI Access View > Fit All > All Views.


Parameters None.
Return Value None.

Python Syntax FitAll()


Python Example oEditor.FitAll()

VB Syntax FitAll()
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
VB Example
oEditor.FitAll()

GenerateAllUserDefinedModels
Generates all user defined models.

UI Access N/A

3D Modeler Editor Script Commands 11-173


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters None.
Return Value Array of models generated.

Python Syntax GenerateAllUserDefinedModels ()


Python Example oEditor.GenerateAllUserDefinedModels()

VB Syntax GenerateAllUserDefinedModels
VB Example oEditor.GenerateAllUserDefinedModels

GenerateUserDefinedModel
Generates specified user defined model(s).

UI Access N/A

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value Array of models generated.

Python GenerateUserDefinedModel (<SelectionsArray>)


Syntax

Python oEditor.GenerateUserDefinedModel(["NAME:Selections", "Selections:=", "model1,

3D Modeler Editor Script Commands 11-174


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Example model2"])

VB Syn- GenerateAllUserDefinedModels
tax

VB oEditor.GenerateUserDefinedModel Array("NAME:Selections", "Selections:=", "model1,


Example model2")

GeometryCheckAndAutofix
Use: Runs Geometry Check and optionally applies autofixes.
Command: HFSS 3D Layout > Geometry Check
Syntax: GeometryCheckAndAutofix <ChecksArray>,
minimum_area_meters_squared,
<FixesArray>
Return Value: None
Parameters: <ChecksArray> - Array("NAME:checks", <check 1>, <check 2>, …, <check n>)
Specify the checks that should be included. Specifying fewer checks may speed up execution but
may also result in less problems reported in the message manager (or the logfile) and con-
sequently less problems that can be fixed by autofixes.
The following are valid checks that can be specified:
— "Self-Intersecting Polygons"
— "Disjoint Nets (Floating Nodes)"
— "DC-Short Errors"
— "Identical/Overlapping Vias"

3D Modeler Editor Script Commands 11-175


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

— "Misaligments"
There may be no checks, all 5 of the checks, or anything in between. The order that checks are
specified in is not relevant.

minimum_area_meters_squared
Specify a decimal value for the minimum area (e.g. .000015) optionally in scientific notation
(e.g. 2E-006). Cutouts smaller than this minimum area may be ignored during validation check.

<FixesArray> - Array("NAME:fixes", <fix 1>, <fix 2>, …, <fix n>)


Specify the autofixes that should be applied if they are found by a check.
The following are valid fixes that can be specified:
— "Self-Intersecting Polygons"
— "Disjoint Nets",
— "Identical/Overlapping Vias"
— "Traces-Inside-Traces Errors"
— "Misalignments (Planes/Traces/Vias)"
There may be no fixes specified, all 5 fixes specified, or anything in between. The order that
fixes are specified in is not relevant.
Example:
oEditor.GeometryCheckAndAutofix _
Array("NAME:checks", "Self-Intersecting Polygons", _

3D Modeler Editor Script Commands 11-176


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Disjoint Nets (Floating Nodes)", "DC-Short Errors", _


"Identical/Overlapping Vias", "Misaligments"), _
"minimum_area_meters_squared:=", 2E-006, _
Array("NAME:fixes", "Self-Intersecting Polygons", _
"Disjoint Nets", "Identical/Overlapping Vias", _
"Traces-Inside-Traces Errors", _
"Misalignments (Planes/Traces/Vias)")
GetBodyNamesByPosition
Returns the names of objects that contact a specified point.

UI Access N/A

Name Type Description


<positionParameters> Array Structured array containing position coordinates for active coordinate sys-
tem.
Array("NAME:Parameters",
Parameters
"XPosition:=", <string>,
"YPosition:=", <string>,
"ZPosition:=", <string>)

Return Value Array containing string object names.

Python Syntax GetBodyNamesByPosition (<positionParameters>)


Python Example oEditor.GetBodyNamesByPosition(

3D Modeler Editor Script Commands 11-177


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["NAME:Parameters",
"XPosition:=","0mm",
"YPosition:=","15mm",
"ZPosition:=","0mm"
]
)

VB Syntax GetBodyNamesByPosition <positionParameters>


oEditor.GetBodyNamesByPosition Array("NAME:Parameters", _
"XPosition:=", "0mm", _
VB Example
"YPosition:=", "15mm", _
"ZPosition:=", "0mm")

GetChildNames [Modeler]
Returns the names of children for a specified input. For 3D Components and UDMs, these commands do not return parts, coordinate
systems, plans, as top-level modeler children.

Note:

This command is not supported by the EMIT and Circuit design types.

UI Access N/A

3D Modeler Editor Script Commands 11-178


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<category> String Optional. Passing no input returns the list of possible strings:
l "AllParts" – Returns the names of all parts.
l "CoordinateSystems" – Returns the names of all
coordinate systems.
l "Groups" – Returns the names of all groups.
l "Lists" – Returns the names of all lists.
Parameters
l "ModelParts" – Returns names of model parts.
l "NonModelParts" – Returns the names of non-model
parts.
l "Planes" – Returns the names of all planes.
l "Points" – Returns the names of all points.
l "SubmodelDefinitions" – Returns the names of sub-
model definitions.

Return Value Array containing object names in the selected category.

Python Syntax GetChildNames(<category>)

Standalone Example:
oEditor.GetChildNames("ModelParts")
Python Example oEditor.GetChildNames("Points")
Example used in Conjunction with GetChildObject and GetPropNames:
oDesign = oProject.GetActiveDesign()

3D Modeler Editor Script Commands 11-179


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModel = oDesign.GetChildObject("3D Modeler")


oModel.GetChildTypes()

l This returns an array containing strings: "ModelParts", "AllParts", "NonModelParts", "Coordin-


ateSystems", "Points", "Planes", "SubmodelDefinitions", "Groups", and "Lists".
oModel.GetChildNames("ModelParts")

l This returns an array containing string model parts. For example: "WG_Interior", "WG", "MT_Interior",
"MT", "Box2", "Cylinder1".
oWGi = oModel.GetChildObject("WG_Interior")

l This sets the object WG_Interior to variable oWGi.


oWGi.GetPropNames()

l This returns property names from child object assigned to oWGi. In this case: "Name", "Material", "Mater-
ial/SIValue", "Material/EvaluatedValue", "Solve Inside", "Orientation", "Orientation/Choices", "Model",
"Display Wireframe", "Material Appearance", "Color", "Color/Red", "Color/Green", "Color/Blue", and
"Transparent".

VB Syntax GetChildNames <category>

Standalone Example:
oEditor.GetChildNames "ModelParts"
VB Example
oEditor.GetChildNames "Points"
Example used in Conjunction with GetChildObject and GetPropNames:

3D Modeler Editor Script Commands 11-180


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Set oDesign = oProject.GetActiveDesign()
Set oModel = oDesign.GetChildObject "3D Modeler"
oModel.GetChildTypes()

l This returns an array containing strings: "ModelParts", "AllParts", "NonModelParts", "CoordinateSystems",


"Points", "Planes", "SubmodelDefinitions", "Groups", and "Lists".
oModel.GetChildNames "ModelParts"

l This returns an array containing string model parts. For example: "WG_Interior", "WG", "MT_Interior",
"MT", "Box2", "Cylinder1".
Set oWGi = oModel.GetChildObject "WG_Interior"

l This sets the object WG_Interior to variable oWGi.


oWGi.GetPropNames()

l This returns property names from child object assigned to oWGi. In this case: "Name", "Material", "Mater-
ial/SIValue", "Material/EvaluatedValue", "Solve Inside", "Orientation", "Orientation/Choices", "Model", "Dis-
play Wireframe", "Material Appearance", "Color", "Color/Red", "Color/Green", "Color/Blue", and
"Transparent".

3D Modeler Editor Script Commands 11-181


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetChildObject [Modeler]
Returns a 3D modeler child object, which can be assigned to a variable. Will return normally if there are no active objects. For 3D Com-
ponents and UDMs, these commands do not return parts, coordinate systems, plans, as top-level modeler children.

Note: This command is not supported by the EMIT and Circuit design types.

UI Access N/A

Name Type Description


Parameters
<object> String In this case, "3D Modeler".

Return Value Returns the 3D Modeler object. In the examples below, it is assigned to the variable oEditor.

Python Syntax GetChildObject(<object>)

Standalone Example:
oDesign = oProject.GetActiveDesign()
oEditor = oDesign.GetChildObject("3D Modeler")
Example used in Conjunction with GetChildNames and GetPropNames:
Python Example
oDesign = oProject.GetActiveDesign()
oModel = oDesign.GetChildObject("3D Modeler")
oModel.GetChildTypes()

l This returns an array containing strings: "ModelParts", "AllParts", "NonModelParts", "CoordinateSystems",

3D Modeler Editor Script Commands 11-182


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Points", "Planes", "SubmodelDefinitions", "Groups", and "Lists".


oModel.GetChildNames("ModelParts")

l This returns an array containing string model parts. For example: "WG_Interior", "WG", "MT_Interior",
"MT", "Box2", "Cylinder1".
oWGi = oModel.GetChildObject("WG_Interior")

l This sets the object WG_Interior to variable oWGi.


oWGi.GetPropNames()

l This returns property names from child object assigned to oWGi. In this case: "Name", "Material", "Mater-
ial/SIValue", "Material/EvaluatedValue", "Solve Inside", "Orientation", "Orientation/Choices", "Model", "Dis-
play Wireframe", "Material Appearance", "Color", "Color/Red", "Color/Green", "Color/Blue", and
"Transparent".

VB Syntax GetChildObject<object>

Standalone Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
VB Example
Dim oDesign
Dim oEditor
Set oDesign = oProject.GetActiveDesign()
Set oEditor = oDesign.GetChildObject "3D Modeler"

3D Modeler Editor Script Commands 11-183


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Example used in Conjunction with GetChildNames and GetPropNames:


Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Set oDesign = oProject.GetActiveDesign()
Set oModel = oDesign.GetChildObject "3D Modeler"
oModel.GetChildTypes()

l This returns an array containing strings: "ModelParts", "AllParts", "NonModelParts", "Coordin-


ateSystems", "Points", "Planes", "SubmodelDefinitions", "Groups", and "Lists".
oModel.GetChildNames "ModelParts"

l This returns an array containing string model parts. For example: "WG_Interior", "WG", "MT_Interior",
"MT", "Box2", "Cylinder1".
Set oWGi = oModel.GetChildObject "WG_Interior"

l This sets the object WG_Interior to variable oWGi.


oWGi.GetPropNames()

l This returns property names from child object assigned to oWGi. In this case: "Name", "Material", "Mater-
ial/SIValue", "Material/EvaluatedValue", "Solve Inside", "Orientation", "Orientation/Choices", "Model",
"Display Wireframe", "Material Appearance", "Color", "Color/Red", "Color/Green", "Color/Blue", and

3D Modeler Editor Script Commands 11-184


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Transparent".

GetChildTypes [Modeler]
Gets child types of queried designs or editors obtained by GetActiveProject() and GetActiveDesign() commands. For 3D Components
and UDMs, these commands do not return parts, coordinate systems, plans, as top-level modeler children.

Note:

This command is not supported by the EMIT and Circuit design types.

UI Access N/A
Parameters None.
Return Value Array containing the names of child types.

Python Syntax GetChildTypes()

Standalone Example:
oDesign = oProject.GetActiveDesign()
oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.GetChildTypes()
Python Example
l This returns an array containing strings: "ModelParts", "AllParts", "NonModelParts", "Coordin-
ateSystems", "Points", "Planes", "SubmodelDefinitions", "Groups", and "Lists".

Example Used in Conjunction with GetChildNames:


oProject = oDesktop.GetActiveProject()

3D Modeler Editor Script Commands 11-185


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDesign = oProject.GetActiveDesign()
oDesign.GetChildNames()

l This returns an array containing names of child objects for the design. For example: "Boundaries", "Nets",
"Analysis", "Optimetrics", "Radiation", "Results", and "3D Modeler".
oDesign.GetChildTypes()

l This returns an array containing the child types. For example: "Module", "Editor", and "Variable".

VB Syntax GetChildTypes()

Standalone Example:
Dim oDesign
Dim oProject
Dim oEditor
Set oDesign = oProject.GetActiveDesign()
VB Example Set oEditor = oDesign.SetActiveEditor "3D Modeler"
oEditor.GetChildTypes()

l This returns an array containing strings: "ModelParts", "AllParts", "NonModelParts", "CoordinateSystems",


"Points", "Planes", "SubmodelDefinitions", "Groups", and "Lists".

Example Used in Conjunction with GetChildNames:


Dim oDesign

3D Modeler Editor Script Commands 11-186


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Dim oProject
Dim oDesign
Set oDesign = oProject.GetActiveDesign()
Set oDesign.GetChildNames()

l This returns an array containing names of child objects for the design. For example: "Boundaries", "Nets",
"Analysis", "Optimetrics", "Radiation", "Results", and "3D Modeler".
Set oDesign.GetChildTypes()

l This returns an array containing the child types. For example: "Module", "Editor", and "Variable".

GetEdgeByPosition
Returns the ID for edge(s) that contact a specified point.

UI Access N/A

Name Type Description


<positionParameters> Array Structured array.
Array("NAME:EdgeParameters",
"BodyName:=", <string object name>,

Parameters "Xposition:=", <string>,


"YPosition:=", <string>,
"ZPosition:=", <string>)
Note:
For 2D XY Designs, ZPosition should be set to "0".

3D Modeler Editor Script Commands 11-187


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

For 2D RZ Designs, YPosition should be set to "0".

Return Value Array containing string edge IDs.

Python Syntax GetEdgeByPosition (<positionParameters>)


oEditor.GetEdgeByPosition(
["NAME:EdgeParameters",
"BodyName:=", "Box1",
"Xposition:=", "10mm",
Python Example
"YPosition:=", "0mm",
"ZPosition:=", "10mm"
]
)

VB Syntax GetEdgeByPosition <positionParameters>

3D Modeler Editor Script Commands 11-188


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.GetEdgeByPosition Array("NAME:EdgeParameters",
"BodyName:=", "Box1",
VB Example "Xposition:=", "10mm",
"YPosition:=", "0mm",
"ZPosition:=", "10mm")

GetEdgeIDFromNameForFirstOperation
Gets edge ID from first operation of a part.

UI Access N/A

Name Type Description


Parameters <PartName> String Name of specified part.
<EdgeName> String Name of specified edge.

Return Value Integer edge ID

Python Syntax GetEdgeIDFromNameForFirstOperation(<PartName>, <EdgeName>)


Python Example oEditor.GetEdgeIDFromNameForFirstOperation("Coil_1", "Edge_4510")

VB Syntax GetEdgeIDFromNameForFirstOperation <PartName>, <EdgeName>


VB Example oEditor.GetEdgeIDFromNameForFirstOperation "Coil_1", "Edge_4510"

GetEdgeIDsFromFace
Returns the edge IDs for a specified Face ID.

3D Modeler Editor Script Commands 11-189


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A

Name Type Description


Parameters
<faceID> Integer ID of the specified face.

Return Value Array containing string edge IDs.

Python Syntax GetEdgeIDsFromFace (<faceID>)


Python Example oEditor.GetEdgeIDsFromFace(20)

VB Syntax GetEdgeIDsFromFace <faceID>


VB Example oEditor.GetEdgeIDsFromFace 20

GetEdgeIDsFromObject
Returns the edge IDs for a specified object.

UI Access N/A

Name Type Description


Parameters
<object> String Object name.

Return Value Array containing string edge IDs.

3D Modeler Editor Script Commands 11-190


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetEdgeIDsFromObject (<object>)


Python Example oEditor.GetEdgeIDsFromObject("Box1")

VB Syntax GetEdgeIDsFromObject <object>


VB Example oEditor.GetEdgeIDsFromObject "Box1"

GetEdgeLength
Returns the length of edges for a specified Face ID.

UI Access N/A

Name Type Description


Parameters
<faceID> Integer ID of the specified face.

Return Value Integer containing the length of found edges.

Python Syntax GetEdgeLength (<faceID>)


Python Example oEditor.GetEdgeLength(20)

VB Syntax GetEdgeLength <faceID>


VB Example oEditor.GetEdgeLength 20

GetEntityListIDByName
Returns a list of IDs in a given entity list (either object or face). See: CreateEntityList.

3D Modeler Editor Script Commands 11-191


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A

Name Type Description


Parameters
<listName> String List name.

Return Value Array containing string object IDs.

Python Syntax GetEntityListIDByName (<listName>)


Python Example oEditor.GetEntityListIDByName("MyList")

VB Syntax GetEntityListIDByName <listName>


VB Example oEditor.GetEntityListIDByName "MyList"

GetExtendedDefinitionObject
Get an object-oriented property scripting object by name and library type (using definition folder name) which also supports get-
ting/setting mod time and getting/setting generic string attributes. This scripting command directly supports the .AMAT (or .ASURF)
definition formats.

UI Access N/A

Name Type Description

Parameters
<defName> String Definition to retrieve.
<defFolderName> String Library type (by definition folder name).

3D Modeler Editor Script Commands 11-192


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value An extended material wrapper script object (see material wrapper script object functions above).

P- GetExtendedDefinitionObject(<defName>, <defFolderName>)
yt-
h-
o-
n
S-
y-
nt-
ax

oProject = oDesktop.GetActiveProject()
P-
oDefMgr = oProject.GetDefinitionManager()
yt-
h- defBlock = "$begin 'vacuum2' $begin 'AttachedData' $begin 'MatAppearanceData' property_data-
o- ='appearance_data' Red=230 Green=230 Blue=230 Transparency=0.95 $end 'MatAppearanceData'
n $end 'AttachedData' simple('permittivity', 1) ModTime=1499970477 $end 'vacuum2'"
E-
x- oDefMgr.AddDefinitionFromBlock(defBlock, 'Materials', '10101010', True)
a-
m- oMat = oDefMgr.GetExtendedDefinitionObject('vacuum2', 'Materials')
pl-
e
# use extended definition object function(s) to manipulate the definition
oMat.SetModTime("1630611487")

GetFaceArea
Returns the area of a specified face.

UI Access N/A

Name Type Description


Parameters
<faceID> Integer ID of specified face.

3D Modeler Editor Script Commands 11-193


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value Long integer of face area.

Python Syntax GetFaceArea (<faceID>)


Python Example oEditor.GetFaceArea(19)

VB Syntax GetFaceArea <faceID>


VB Example oEditor.GetFaceArea 19

GetFaceCenter
Returns the center position of a specified face.

UI Access N/A

Name Type Description


Parameters
<planarFaceID> Long Face ID

Return Value Array containing string X, Y, Z coordinates.

Python Syntax GetFaceCenter (<planarFaceID>)


Python Example oEditor.GetFaceCenter(12)

3D Modeler Editor Script Commands 11-194


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetFaceCenter <planarFaceID>


VB Example oEditor.GetFaceCenter 12

GetFaceByPosition
Returns the face ID located at a specified position.

Note:

The coordinates must point to exactly one face, not a vertex or edge where two or more faces join.

UI Access N/A

Name Type Description


<FaceParameters> Array Structured Array.
Array("NAME:FaceParameters",

Parameters "BodyName:=", <string>,


"XPosition:=", <string>,
"YPosition:=", <string>,
"ZPosition:=", <string>)

Return Value Integer Face ID.

Python Syntax GetFaceByPosition(<FaceParameters>)


oEditor.GetFaceByPosition(
Python Example
["NAME:FaceParameters",

3D Modeler Editor Script Commands 11-195


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"BodyName:=", "Box1",
"XPosition:=", "0.2mm",
"YPosition:=", "-0.2mm",
"ZPosition:=", "0.4mm"
])

VB Syntax GetFaceByPosition <FaceParameters>


dim FaceID
FaceID = oEditor.GetFaceByPosition Array("NAME:FaceParameters",
"BodyName:=", "Box1",
VB Example
"XPosition:=", "0.2mm",
"YPosition:=", "-0.2mm",
"ZPosition:=", "0.4mm")

GetFaceIDFromNameForFirstOperation
Gets face ID from first operation of a part.

UI Access N/A

Name Type Description


Parameters <PartName> String Name of specified part.
<FaceName> String Name of specified face.

3D Modeler Editor Script Commands 11-196


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value Integer face ID

Python Syntax GetFaceIDFromNameForFirstOperation(<PartName>, <FaceName>)


Python Example oEditor.GetFaceIDFromNameForFirstOperation("Rotor", "Face_14343"))

VB Syntax GetFaceIDFromNameForFirstOperation <PartName>, <FaceName>


VB Example oEditor.GetFaceIDFromNameForFirstOperation "Rotor", "Face_14343"

GetFaceIDs
Returns the face IDs associated with a specified object.

UI Access N/A

Name Type Description


Parameters
<objectName> String Object name.

Return Value Array containing string face IDs.

Python Syntax GetFaceIDs (<objectName>)


Python Example oEditor.GetFaceIDs('Box1')

VB Syntax GetFaceIDs <objectName>

3D Modeler Editor Script Commands 11-197


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oEditor.GetFaceIDs "Box1"

GetFaceIDsOfSheet
Returns the face IDs associated with a specified sheet object.

UI Access N/A

Name Type Description


Parameters
<sheetName> String Name of specified sheet object.

Return Value Array containing string face IDs.

Python Syntax GetFaceIDsOfSheet(<sheetName>)


Python Example oEditor.GetFaceIDsOfSheet('Sheet1')

VB Syntax GetFaceIDsOfSheet <sheetName>


VB Example oEditor.GetFaceIDsOfSheet "Sheet1"

GetGeometryModelerMode
Returns the modeler mode (3D or XY) for the current design. This lets you know whether the current model is 2D or 3D.

UI Access N/A
Parameters None.

3D Modeler Editor Script Commands 11-198


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value String containing the modeling mode ("3D" or "XY").

Python Syntax GetGeometryModelerMode()


Python Example oEditor.GetGeometryModelerMode()

VB Syntax GetGeometryModelerMode
VB Example oEditor.GetGeometryModelerMode

GetGroupSubmodelNames
Returns name of models belong to a specific group.

UI Access N/A

Name Type Description


Parameters
<groupName> String Group name.

Return Value Array of strings containing the model names.

Python Syntax GetGroupSubmodelNames(<groupName>)


Python Example oEditor.GetGroupSubmodelNames("Group 1")

VB Syntax GetGroupSubmodelNames <groupName>

3D Modeler Editor Script Commands 11-199


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oEditor.GetGroupSubmodelNames "Group 1"

GetMatchedObjectName
Returns all object names containing the input text string.

UI Access N/A

Name Type Description


Parameters
<wildcardText> String Text string present in object name(s).

Return Value Array containing string object names.

Python Syntax GetMatchedObjectName (<wildcardText>)


oEditor.GetMatchedObjectName('Box*')
Python Example
oEditor.GetMatchedObjectName('?ox?')

VB Syntax GetMatchedObjectName <wildcardText>


VB Example oEditor.GetMatchedObjectName "Box*"

GetModelBoundingBox
Returns the bounding box of the current model.

UI Access N/A

3D Modeler Editor Script Commands 11-200


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters None.
Return Value Array containing string Xmin, Ymin, Zmin, Xmax, Ymax, and Zmax values of the bounding box.

Python Syntax GetModelBoundingBox()


Python Example oEditor.GetModelBoundingBox()

VB Syntax GeModelBoundingBox
VB Example oEditor.GetModelBoundingBox

GetModelUnits
Returns the model's unit of measure.

UI Access N/A
Parameters None.
Return Value String containing unit of measure.

Python Syntax GetModelUnits()


Python Example oEditor.GetModelUnits()

VB Syntax GetModelUnits

3D Modeler Editor Script Commands 11-201


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oEditor.GetModelUnits

GetNumObjects
Returns the number of objects in a design.

UI Access N/A
Parameters None.
Return Value Integer number of objects.

Python Syntax GetNumObjects()


Python Example oEditor.GetNumObjects()

VB Syntax GetNumObjects
VB Example oEditor.GetNumObjects(

GetObjectIDByName
Given an object's name, returns its ID. IDs are used with CreateEntityList.

UI Access N/A

Name Type Description


Parameters
<objectName> String Object name.

3D Modeler Editor Script Commands 11-202


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value Integer object ID.

Python Syntax GetObjectIDByName(<objectName>)


Python Example oEditor.GetObjectIDByName('Box1')

VB Syntax GetObjectIDByName <objectName>


VB Example oEditor.GetObjectIDByName "Box1"

GetObjectName
Returns an object's name from its specified base index (creation order).

UI Access N/A

Name Type Description


Parameters
<index> Integer Base index (where '0' is the first item created)

Return Value String containing object name.

Python Syntax GetObjectName(<index>)


Python Example oEditor.GetObjectName(3)

VB Syntax GetObjectName <index>

3D Modeler Editor Script Commands 11-203


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oEditor.GetObjectName 3

GetObjectNameByEdgeID
Returns an object name given an edge ID.

UI Access N/A

Name Type Description


Parameters
<EdgeID> Integer The edge ID.

Return Value String containing object name.

Python Syntax GetObjectNameByEdgeID(<EdgeID>)


Python Example oEditor.GetObjectNameByEdgeID(88)

VB Syntax GetObjectNameByEdgeID <EdgeID>


VB Example oEditor.GetObjectNameByEdgeID 10

GetObjectNameByFaceID
Returns an object name given a face ID.

UI Access N/A

Name Type Description


Parameters
<FaceID> Integer The face ID.

3D Modeler Editor Script Commands 11-204


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value String containing object name.

Python Syntax GetObjectNameByFaceID (<FaceID>)


Python Example oEditor.GetObjectNameByFaceID(88)

VB Syntax GetObjectNameByFaceID <FaceID>


VB Example oEditor.GetObjectNameByFaceID 10

GetObjectNameByID
Returns an object name given an ID.

UI Access N/A

Name Type Description


Parameters
<ObjID> Integer The object ID.

Return Value String containing object name.

Python Syntax GetObjectNameByID(<ObjID>)


Python Example oEditor.GetObjectNameByID(88)

VB Syntax GetObjectNameByID <ObjID>

3D Modeler Editor Script Commands 11-205


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oEditor.GetObjectNameByID 10

GetObjectNameByVertexID
Returns an object name given a vertex ID.

UI Access N/A

Name Type Description


Parameters
<VertexID> Integer The vertex ID.

Return Value String containing object name.

Python Syntax GetObjectNameByVertexID(<VertexID>)


Python Example oEditor.GetObjectNameByVertexID(88)

VB Syntax GetObjectNameByVertexID <VertexID>


VB Example oEditor.GetObjectNameByVertexID 10

GetObjectsByMaterial
Returns a list of objects of a specified material.

UI Access N/A

Name Type Description


Parameters
<material> String Material name.

3D Modeler Editor Script Commands 11-206


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value Array containing string object names.

Python Syntax GetObjectsByMaterial (<material>)


Python Example oEditor.GetObjectsByMaterial('copper')

VB Syntax GetObjectsByMaterial <material>


VB Example oEditor.GetObjectsByMaterial "copper"

GetObjectShapeType
Returns the shape type of a specified object.

UI Access N/A

Name Type Description


Parameters <objName> String Name of specified object.
<csName> String Name of coordinate system of the object.

Return Value String containing shape type.

Python Syntax GetObjectShapeType(<objName>, <csName>)


Python Example oEditor.GetObjectShapeType("box1", "Global")

3D Modeler Editor Script Commands 11-207


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetObjectShapeType <objName>, <csName>


VB Example oEditor.GetObjectShapeType "box1", "Global"

GetObjectsInGroup
Returns a list of objects in a specified group.

UI Access N/A

Name Type Description


<group> String Group name.
One of:
l "<materialName>"
l "<assignmentName>"
Parameters
l "Non Model"
l "Solids"
l "Unclassified"
l "Sheets"
l "Lines"

Return Value Array containing string object names.

Python Syntax GetObjectsInGroup (<group>)


Python Example oEditor.GetObjectsInGroup('Sheets')

3D Modeler Editor Script Commands 11-208


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetObjectsInGroup <group>


VB Example oEditor.GetObjectsInGroup "Sheets"

GetObjectVolume
Returns an object's volume from its name).

UI Access N/A

Name Type Description


Parameters
<name> String Object name

Return Value .Real

Python Syntax GetObjectVolume(<name>)


Python Example oEditor.GetObjectVolume("Box1")

VB Syntax GetObjectVolume <name>


VB Example oEditor.GetObjectVolume "Box1"

GetObjPath [Editor]
Obtains the path to the 3D modeler.

UI Access N/A

3D Modeler Editor Script Commands 11-209


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters None.
Return Value String containing the path.

Python Syntax GetObjPath()


Python Example oEditor.GetObjPath()

VB Syntax GetObjPath
VB Example oEditor.GetObjPath

GetPartsForUserDefinedModel
Obtains parts from a specified user defined model.

UI Access N/A

Name Type Description


Parameters
<udmName> String Name of user defined model.

Return Value Array of strings containing associated parts.

Python Syntax GetPartsForUserDefinedModel (<udmName>)


Python Example oEditor.GetPartsForUserDefinedModel("OnDieSpiralInductor1")

3D Modeler Editor Script Commands 11-210


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetPartsForUserDefinedModel <udmName>


VB Example oEditor.GetPartsForUserDefinedModel "OnDieSpiralInductor1"

GetPoints [3D Modeler Editor]


Returns all the points defined in current 3D modeler.

UI Access N/A
Parameters None.
Return Value Array of strings containing names of points.

Python Syntax GetPoints ()


Python Example oEditor.GetPoints()

VB Syntax GetPoints
VB Example oEditor.GetPoints

GetPropEvaluatedValue
Returns the Evaluated-Value for Value-Property and Variable. Returns the Property-value as text string for other property types

3D Modeler Editor Script Commands 11-211


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note:

This command is not supported by the EMIT and Circuit design types.

UI Access N/A

Name Type Description


Parameters
<PropName> String Name of the property.

Return Value String value of the evaluated value.

Python Syntax GetPropEvaluatedValue (<PropName>)


oVar = oDesign.GetChildObject(" Variables/var")
Python Example
oVar.GetPropEvaluatedValue()

GetPropertyValue
Returns the value of a single property belonging to a specific <PropServer> and <PropTab>. This function is available with the Project,
Design or Editor objects, including definition editors.

Tip:

Use the script recording feature and edit a property, and then view the resulting script to see the format for that property.

3D Modeler Editor Script Commands 11-212


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A

Name Type Description


<PropTab> String One of the following, where tab titles are shown in parentheses:
l PassedParameterTab ("Parameter Values")
l DefinitionParameterTab (Parameter Defaults")
l LocalVariableTab ("Variables" or "Local Variables")
l ProjectVariableTab ("Project variables")
l ConstantsTab ("Constants")

Parameters
l BaseElementTab ("Symbol" or "Footprint")
l ComponentTab ("General")
l Component("Component")
l CustomTab ("Intrinsic Variables")
l Quantities ("Quantities")
Signals ("Signals")
l

<PropServer> String An object identifier, generally returned from another script method, such as
Comp-Inst@R;2;3
<PropName> String Name of the property.

Return Value String value of the property.

Python Syntax GetPropertyValue (<PropTab>, <PropServer>, <PropName>)


selectionArray = oEditor.GetSelections()
Python Example
for k in selectionArray:

3D Modeler Editor Script Commands 11-213


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

val = oEditor.GetPropertyValue("PassedParameterTab", k, "R")


...

VB Syntax GetPropertyValue (<PropTab>, <PropServer>, <PropName>)


selectionArray = oEditor.GetSelections
for k in selectionArray:
VB Example
val = oEditor.GetPropertyValue("PassedParameterTab", k, "R")
...

GetPropNames [Modeler]
Returns the property names for the active model object, or specified property values.

Note:

This command is not supported by the EMIT and Circuit design types.

UI Access N/A

Name Type Description


<IncludeReadOnly> Boolean Optional.
Parameters
l True - includes all properties.
l False - returns only property names that can be changed.

3D Modeler Editor Script Commands 11-214


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

True by default.

Return Value Returns property names of the current 3D Model object.

Python Syntax GetPropNames(<IncludeReadOnly>)


Python Example oEditor.GetPropNames(True)

VB Syntax GetPropNames(<IncludeReadOnly>)
VB Example oEditor.GetPropName True

GetPropSIValue
Returns the SI-Value for Value-Property and Variable. Return NAN for other property type if its value is not able to convert to be a
double-floating point value.

Note:

This command is not supported by the EMIT and Circuit design types.

UI Access N/A

Name Type Description


Parameters
<PropName> String Name of the property.

Property value as a double floating value, or NAN if the property value cannot be converted to double floating
Return Value
point.

3D Modeler Editor Script Commands 11-215


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetPropSIValue (<PropName>)


oCreateBox = oDesign.GetChildObject("3D Modeler/Box1/CreateBox:1")
oCreateBox.GetPropValue("xSize")
return "length / 2"
Python Example oCreateBox.GetPropEvaluatedValue("xSize")
return '0.4mm'
oCreateBox.GetPropSIValue("xSize")
return 0.0004

GetPropValue [Modeler]
Returns the property value for the active model object, or specified property values.

Note:

This command is not supported by the EMIT and Circuit design types.

UI Access N/A

Name Type Description


Parameters <propPath> Optional. Child object's property path. See: Object Property Function
Summary.

Return Value The property value.

3D Modeler Editor Script Commands 11-216


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetPropValue(<propPath>)


Rh1 = oDesign.GetChildObject('Box1')
Rh1.GetPropValue('Orientation')
Python Example
Returns the specified Property Value:
'Global'

VB Syntax GetPropValue(<propPath>)
Rh1 = oDesign.GetChildObject("Box1")
VB Example
GetPropValue("Orientation")

GetRelativeCoordinateSystems
Returns the relative coordinate systems in the current 3D modeler.

UI Access N/A
Parameters None.
Return Value Array containing name of relative coordinate systems.

Python Syntax GetRelativeCoordinateSystems()


Python Example oEditor.GetRelativeCoordinateSystems()

VB Syntax GetRelativeCoordinateSystems

3D Modeler Editor Script Commands 11-217


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oEditor.GetRelativeCoordinateSystems

GetSelections [Model Editor]


Returns an array of currently selected objects.

UI Access N/A
Parameters None.
Return Value Array containing object IDs

Python Syntax GetSelections()


Python Example oEditor.GetSelections()

VB Syntax GetSelections
VB Example oEditor.GetSelections

GetSubGroupsInGroup
Returns subgroup names in a specified group.

UI Access N/A

Name Type Description


Parameters <group> String Group name.
One of:

3D Modeler Editor Script Commands 11-218


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l "<materialName>"
l "<assignmentName>"
l "Non Model"
l "Solids"
l "Unclassified"
l "Sheets"
l "Lines"

Return Value Array containing subgroup names.

Python Syntax GetSubGroupsInGroup(<group>)


Python Example oEditor.GetSubGroupsInGroup('Sheets')

VB Syntax GetSubGroupsInGroup<group>
VB Example oEditor.GetSubGroupsInGroup "Sheets"

GetUserPosition
Returns a user's current coordinates in the 3D Modeler window.

UI Access N/A

Name Type Description


Parameters
<prompt> String "Enter a point." Then click a point in the 3D Modeler window.

3D Modeler Editor Script Commands 11-219


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value Array containing X, Y, Z coordinates.

Python Syntax GetUserPosition(<prompt>)


Python Example oEditor.GetUserPosition("Enter a point.")

VB Syntax GetUserPosition <prompt>


VB Example oEditor.GetUserPosition "Enter a point."

GetVertexIDFromNameForFirstOperation
Returns vertex ID associated with a specified vertex belongs to the first operation of a part.

UI Access N/A

Name Type Description


Parameters <PartName> String Name of specified part.
<VertexName> String Name of specified vertex.

Return Value Integer representing vertex ID.

Python Syntax GetVertexIDFromNameForFirstOperation(<PartName>, <VertexName>)


Python Example oEditor.GetVertexIDFromNameForFirstOperation("Part1", "Vertex1")

3D Modeler Editor Script Commands 11-220


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetVertexIDFromNameForFirstOperation <PartName>, <VertexName>


VB Example oEditor.GetVertexIDFromNameForFirstOperation "Part1", "Vertex1"

GetVertexIDsFromEdge
Returns vertex IDs associated with a specified edge.

UI Access N/A

Name Type Description


Parameters
<edgeID> Integer Edge ID.

Return Value Array containing string vertex IDs.

Python Syntax GetVertexIDsFromEdge(<edgeID>)


Python Example oEditor.GetVertexIDsFromEdge(10)

VB Syntax GetVertexIDsFromEdge <edgeID>


VB Example oEditor.GetVertexIDsFromEdge 10

GetVertexIDsFromFace
Returns vertex IDs associated with a specified face.

UI Access N/A

Name Type Description


Parameters
<faceID> Integer Face ID.

3D Modeler Editor Script Commands 11-221


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value Array containing string vertex IDs.

Python Syntax GetVertexIDsFromFace(<faceID>)


Python Example oEditor.GetVertexIDsFromFace(10)

VB Syntax GetVertexIDsFromFace <faceID>


VB Example oEditor.GetVertexIDsFromFace 10

GetVertexIDsFromObject
Returns vertex IDs associated with a specified object.

UI Access N/A

Name Type Description


Parameters
<objectName> String Object name.

Return Value Array containing string vertex IDs.

Python Syntax GetVertexIDsFromObject(<objectName>)


Python Example oEditor.GetVertexIDsFromObject('Box1')

3D Modeler Editor Script Commands 11-222


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetVertexIDsFromObject <objectName>


VB Example oEditor.GetVertexIDsFromObject "Box1"

GetVertexPosition
Returns an array of coordinates for a specified vertex.

UI Access N/A

Name Type Description


Parameters
<vertexID> Integer Vertex ID.

Return Value Array containing X, Y, Z coordinates.

Python Syntax GetVertexPosition(<vertexID>)


Python Example oEditor.GetVertexPosition(1)

VB Syntax GetVertexPosition <vertexID>


VB Example oEditor.GetVertexPosition 1

GetWireBodyNames
Returns the wire body names in current 3D modeler.

UI Access N/A
Parameters None.
Return Value Array containing string of names.

3D Modeler Editor Script Commands 11-223


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetWireBodyNames()


Python Example oEditor.GetWireBodyNames()

VB Syntax GetWireBodyNames
VB Example oEditor.GetWireBodyNames

OpenExternalEditor
Launches a SpaceClaim session.

UI Access Modeler > SpaceClaim Link > Connect to Active Session.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

Python Syntax OpenExternalEditor (<SelectionsArray>)


oEditor.OpenExternalEditor(
[
Python Example
"NAME:Selections",
"Selections:=" , "SpaceClaim1"

3D Modeler Editor Script Commands 11-224


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

])

VB Syntax OpenExternalEditor <SelectionsArray>


oEditor.OpenExternalEditor Array("NAME:Selections",
VB Example
"Selections:=", "")

PageSetup
Specifies Page Setup settings for printing.

UI Access File > Page Setup.

Name Type Description


<Parameters> Array Structured array.
[
"NAME:PageSetupData",
"margins:=", <SetupArray>
]
<SetupArray> Array Structured Array
Parameters
[
"left:=", <string>,
"right:=", <string>,
"top:=", <string>,
"bottom:=", <string>)
]

3D Modeler Editor Script Commands 11-225


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax PageSetup(<Parameters>)


oEditor.PageSetup([
"NAME:PageSetupData",
"margins:=",
["left:=", "10mm",
Python Example
"right:=", "10mm",
"top:=", "10mm",
"bottom:=", "10mm"]
])

VB Syntax PageSetup <Parameters>


oEditor.PageSetup Array("NAME:PageSetupData",
"margins:=",
Array("left:=", "10mm",
VB Example
"right:=", "10mm",
"top:=", "10mm",
"bottom:=", "10mm"

3D Modeler Editor Script Commands 11-226


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

)
)

RemoveBadEdges
Removes bad edges from specified list.

UI Access N/A

Name Type Description


Parameters
<EdgeList> Array Array containing edge IDs.

Return Value None.

Python Syntax RemoveBadEdges (<EdgeList>)


Python Example oEditor.RemoveBadEdges([18,30])

VB Syntax RemoveBadEdges <EdgeList>


VB Example oEditor.RemoveBadEdges Array(18, 30)

RemoveBadFaces
Removes bad faces from specified list.

UI Access N/A

Name Type Description


Parameters
<FaceList> Array Array containing face IDs.

3D Modeler Editor Script Commands 11-227


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax RemoveBadFaces (<FaceList>)


Python Example oEditor.RemoveBadFaces([328,333])

VB Syntax RemoveBadFaces <FaceList>


VB Example oEditor.RemoveBadFaces Array(328, 333)

RemoveBadVertices
Removes bad vertices from specified list.

UI Access N/A

Name Type Description


Parameters
<VertexList> Array Array containing vertex IDs.

Return Value None.

Python Syntax RemoveBadVertices (<VertexList>)


Python Example oEditor.RemoveBadVertices([324,325])

3D Modeler Editor Script Commands 11-228


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax RemoveBadVertices <VertexList>


VB Example oEditor.RemoveBadVertices Array(324, 325)

RenamePart
Renames an object.

UI Access Enter new name in Name field.

Name Type Description


<renameParametersArray> Array Structured array.
Array("NAME:Rename Data",
Parameters
"Old Name:=", <string>,
"New Name:=", <string>
)

Return Value None.

Python Syntax oEditor.RenamePart(<renameParametersArray>)


oEditor.RenamePart(
[
'NAME:Rename Data',
Python Example
'Old Name:=', 'partname',
'New Name:=', 'newpartname',
]

3D Modeler Editor Script Commands 11-229


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax oEditor.RenamePart <RenameParametersArray>


oEditor.RenamePart Array("NAME:Rename Data",
"Old Name:=", "partname",
VB Example
"New Name:=", "newpartname",
)

SetPropValue [Modeler]
Sets the property value for the active model property.

Note:

This command is not supported by the EMIT and Circuit design types.

UI Access Edit Properties on History Tree objects

Name Type Description


Parameters <propPath> String Child object's property path. See: Object Property Function Summary.
<value> Varies New property value.

Boolean:
Return Value l True – property found.
l False – property not found.

3D Modeler Editor Script Commands 11-230


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax SetPropValue(<propPath>, <value>)


Python Example oEditor.SetPropValue("Color/r",111)

VB Syntax SetPropValue <propPath>, <value>


VB Example oEditor.SetPropValue "Color/r",111)

SetTopDownViewDirectionForActiveView
Sets active view to top-down view direction.

UI Access N/A

Name Type Description


Parameters
<RelativeCS> String Name of relative coordinate system

Return Value None.

Python Syntax SetTopDownViewDirectionForActiveView (<RelativeCS>)


Python Example oEditor.SetTopDownViewDirectionForActiveView("Global")

VB Syntax SetTopDownViewDirectionForActiveView <RelativeCS>


VB Example oEditor.SetTopDownViewDirectionForActiveView "Global"

3D Modeler Editor Script Commands 11-231


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetTopDownViewDirectionForAllViews
Sets all views to top-down view direction.

UI Access N/A

Name Type Description


Parameters
<RelativeCS> String Name of relative coordinate system

Return Value None.

Python Syntax SetTopDownViewDirectionForAllViews (<RelativeCS>)


Python Example oEditor.SetTopDownViewDirectionForAllViews("Global")

VB Syntax SetTopDownViewDirectionForAllViews <RelativeCS>


VB Example oEditor.SetTopDownViewDirectionForAllViews "Global"

UpdatePriorityList
Updates specified priority lists.

UI Access N/A

Name Type Description


Parameters
<Lists> Array Array of priority list names.

Return Value None.

3D Modeler Editor Script Commands 11-232


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax UpdatePriorityList (<Lists>)


Python Example oEditor.UpdatePriorityList(["PriorityList1", "PriorityList2"])

VB Syntax UpdatePriorityList <Lists>


VB Example oEditor.UpdatePriorityList Array("PriorityList1", "PriorityList2")

UpgradeVersion
Upgrades legacy geometry to current version.

UI Access Right-click on an operation icon in the history tree, select Upgrade Version.

Name Type Description


<Selections> Array Structured array.
Array("NAME:Parameters",

Parameters Array("NAME:PartOperations",
Array("NAME:<string>",),
"OperationIndices:=", <array of integers>),
Array("NAME:UDMOperations") )

Return Value None.

Python Syntax UpgradeVersion (<Selections>)

3D Modeler Editor Script Commands 11-233


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.UpgradeVersion([
"NAME:Parameters",
["NAME:PartOperations",
["NAME:source",
Python Example
"OperationIndices:=", [0]]
],
["NAME:UDMOperations"]
])

VB Syntax UpgradeVersion <Lists>


oEditor.UpgradeVersion Array(
"NAME:Parameters",
Array("NAME:PartOperations",
Array("NAME:source",
VB Example
"OperationIndices:=", Array(0))
),
Array"NAME:UDMOperations")
)

3D Modeler Editor Script Commands 11-234


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Validate3DComponent
Validates a 3D component.

UI Access N/A

Name Type Description


Parameters <componentPath> String Path to a 3D component.
<password> String Optional. Password to access the component.

Boolean:
Return Value l 1 - component is valid.
l 0 - component is not valid.

Python Syntax Validate3DComponent (<componentPath>, <password>)


oEditor.Validate3DComponent(
Python Example
"C:/temp/component.3dcomp","")

VB Syntax Validate3DComponent <componentPath>, <password>


oEditor.Validate3DComponent
VB Example
"C:/temp/component.3dcomp", ""

WriteHistoryTreeLayoutForTest
Writes history tree layout to a file.

UI Access N/A

3D Modeler Editor Script Commands 11-235


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<filePath> String Path to the file.
<OrgByMaterial> Integer l 1 - organize objects by material.

l 0 - do not organize by material.


<OrgByAssignment> Integer l 1 - organize sheets by assignment.

l 0 - do not organize by assignment.


<OrgByCompDefinition> Integer l 1 - organize components by definition.
Parameters
l 0 - do not organize by definition.
<DonotOrgUnderGroup> Integer l 1 - do not organize within group.

0 - organize within group.


l

<ShowGroup> Integer Optional.


l 1 - show group.

l 0 - do not show.

Return Value None.

WriteHistoryTreeLayoutForTest (<filePath>, <OrgByMaterial>, <OrgByAssignment>, <OrgByCompDefinition>,


Python Syntax
<DonotOrgUnderGroup>, <ShowGroup>)
oEditor.WriteHistoryTreeLayoutForTest
Python Example
('C:\temp', 1, 0, 0, 0, 1)

3D Modeler Editor Script Commands 11-236


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

WriteHistoryTreeLayoutForTest <filePath>, <OrgByMaterial>, <OrgByAssignment>, <OrgByCompDefinition>,


VB Syntax
<DonotOrgUnderGroup>, <ShowGroup>
VB Example oEditor.WriteHistoryTreeLayoutForTest "C:\temp", 1, 0, 0, 0, 1

Cable Modeling Commands


Cable Modeling is a Beta Feature to 3D Component Modeling for Release 21.2. Cables are created and edited as design objects
using the Cable Seutp module, and then inserted as native components. For example, elements of a cable are created:
oModule = oDesign.GetModule("CableSetup")
oModule.CreateStraightWireCable(....
And then, when a Harness has been created from various components, it is inserted to the Modeler:
oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.InsertNativeComponent(
[
"NAME:InsertNativeComponentData",
"TargetCS:=" , "Global",
"SubmodelDefinitionName:=", "MyHarness",
...

AddCableToBundle
CreateCableBundle
CreateCableHarness
CreateClockSource
CreatePWLSource

3D Modeler Editor Script Commands 11-237


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CreateStraightWireCable
CreateTwistedPairCable
ExportCableLibrary
ImportCableLibrary
RemoveCable
UpdateCableHarness

AddCableToBundle
Add a cable to an existing bundle using the Beta Cable Modeling feature. Right click on the 3D Component icon and select
Cables>Edit Cables to open the Cable Editor.

UI Access 3D Components>Cables > Edit Cables


Parameters None
Return Value None

Python Syntax AddCableToBundle(<parameters>))


oModule.AddCableToBundle("bundle1", "tpwire2", 1,
[
Python Example
"NAME:CableInstParams",
"XPos:=" , "0mm",

3D Modeler Editor Script Commands 11-238


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"YPos:=" , "0mm",
"RotX:=" , "0deg"
],
[
"NAME:CableInstAttribs",
"Name:=" , "tpwire2"
])

VB Syntax AddCableToBundle <name> Array(<parameters> )


oModule.AddCableToBundle "bundle2", "bundle1", 1, Array("NAME:CableInstParams",
"XPos:=", _
VB Example "0mm", "YPos:=", "0mm", "RotX:=", "0deg"), Array("NAME:CableInstAttribs",
"Name:=", _
"bundle1")

CreateCableBundle
Creates a cable bundle using the Beta Cable Modeling feature. Right click on the 3D Component icon and select Cables>Edit
Cables to open the Cable Editor. Then Add>Bundle....

UI Access 3D Components>Cables > Edit Cables


Parameters None
Return Value None

3D Modeler Editor Script Commands 11-239


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax CreateCableBundle([<parameters>)], [<name>])


oModule.CreateCableBundle(
[
"NAME:BundleParams",
"AutoPack:=" , True,
[
"NAME:InsulationJacketParams",
"InsThickness:=" , "0.25mm",
"JacketMaterial:=" , "PVC plastic",
Python Example
"InnerDiameter:=" , "2.5mm"
]
],
[
"NAME:BundleAttribs",
"Name:=" , "bundle1"
])

3D Modeler Editor Script Commands 11-240


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax CreateCableBundle Array(<parameters> , <name>)

oModule.CreateCableBundle Array("NAME:BundleParams", "AutoPack:=", true, Array("NAME:In-


sulationJacketParams", "InsThickness:=", _
VB Example "0.25mm", "JacketMaterial:=", "PVC plastic", "InnerDiameter:=", "2.5mm")), Array("NAME:BundleAttribs",
"Name:=", _
"bundle3")

CreateCableHarness
Creates a cable harness using the Beta Cable Modeling feature. Right click on the 3D Component icon and select Cables>New
Cable Harness to open the Insert Cable Harness Component Editor.

UI Access 3D Components>Cables > New Cable Harness...


Parameters None
Return Value None

Python Syntax CreateCableHarness(<parameters>))


oModule.CreateCableHarness(
[
"NAME:HarnessParams",
Python Example "Bundle:=" , "bundle1",
"TwistAlongPath:=" , "720deg",
"Route:=" , "Polyline1",
"AutoOrient:=" , False,

3D Modeler Editor Script Commands 11-241


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Origin:=" , ["0mm","0mm","0mm"],
"XAxisEnd:=" , ["-6mm","0mm","0mm"],
"PlaneFlip:=" , True,
[
"NAME:RefConductors",
"tpwire2/w1"
],
[
"NAME:InputTerminations",
"tpwire2/w1:=" , [ "Source:="
"tpwire2/w2:=" , [ "Imped:="
],
[
"NAME:OutputTerminations",
"tpwire2/w1:=" , [ "Imped:="
"tpwire2/w2:=" , [ "Source:="
]
],
[
"NAME:HarnessAttribs",

3D Modeler Editor Script Commands 11-242


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Name:=" , "MyHarness"
])

VB Syntax CreateCableHarness Array(<parameters> )


oModule.CreateCableHarness Array("NAME:HarnessParams", "Bundle:=", "bundle1",
"TwistAlongPath:=", _
"360deg", "Route:=", "Polyline2", "AutoOrient:=", false, "Origin:=", Array( _
"-24mm", "24mm", "0mm"), "XAxisEnd:=", Array("-30mm", "24mm", "0mm"),
"PlaneFlip:=", _
true, Array("NAME:RefConductors", "tpwire2/w1"), Array("NAME:InputTerminations",
VB Example "tpwire2/w1:=", Array("Source:=", _
"5V", "Imped:=", "50ohm"), "tpwire2/w2:=", Array("Source:=", "5V", "Imped:=", _
"50ohm")), Array("NAME:OutputTerminations", "tpwire2/w1:=", Array("Source:=",
"5V", "Imped:=", _
"50ohm"), "tpwire2/w2:=", Array("Imped:=", "50ohm"))), Array("NAME:Har-
nessAttribs", "Name:=", _
"MyNewHarness")

CreateClockSource
Creates a clock source using the Beta Cable Modeling feature. Right click on the 3D Component icon and select Cables>Edit Cable
Sources... to open the Cable Time Domain Sources Editor.

UI Access 3D Components>Cables > Edit Cables

3D Modeler Editor Script Commands 11-243


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters None
Return Value None

Python Syntax CreateClockSource(<parameters>))


oModule.CreateClockSource(
[
"NAME:ClockSignalParams",
"Period:=" , "35us",
"LowPulseVal:=" , "0V",
"HighPulseVal:=" , "1V",
"Risetime:=" , "5us",
Python Example "Falltime:=" , "5us",
"PulseWidth:=" , "20us"
],
[
"NAME:TDSourceAttribs",
"Name:=" , "clock1"
])

3D Modeler Editor Script Commands 11-244


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax CreateClockSourceArray(<parameters> )
oModule.CreateClockSource Array("NAME:ClockSignalParams", "Period:=", "35us",
"LowPulseVal:=", _
VB Example "0V", "HighPulseVal:=", "1V", "Risetime:=", "5us", "Falltime:=", "5us",
"PulseWidth:=", _
"20us"), Array("NAME:TDSourceAttribs", "Name:=", "clock2")

CreatePWLSource
Creates a PWL source using the Beta Cable Modeling feature. Right click on the 3D Component icon and select Cables > Edit Cable
Sources... to open the Cable Time Domain Sources Editor.

UI Access 3D Components>Cables > Edit Cable Sources...


Parameters None
Return Value None

Python Syntax CreatePWLSource(<parameters>))


oModule.CreatePWLSource(
[
"NAME:PWLSignalParams",
Python Example [
"NAME:SignalValues",
"0V",
"0.5V",

3D Modeler Editor Script Commands 11-245


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"0V"
],
[
"NAME:TimeValues",
"0ns",
"1ns",
"2ns"
]
],
[
"NAME:TDSourceAttribs",
"Name:=" , "pwl3"
])

VB Syntax CreatePWLSourceArray(<parameters> )
oModule.CreatePWLSource Array("NAME:PWLSignalParams", Array("NAME:SignalValues",
"0V", _
VB Example "0.5V", "0V"), Array("NAME:TimeValues", "0ns", "1ns", "2ns")), Array
("NAME:TDSourceAttribs", "Name:=", _
"pwl1")

3D Modeler Editor Script Commands 11-246


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CreateStraightWireCable
Creates a straight Wire Cable using the Beta Cable Modeling feature. Right click on the 3D Component icon and select Cables > Edit
Cables to open the Cable Editor. Then Add Straight Wire Cable.

UI Access 3D Components>Cables > Edit Cables


Parameters None
Return Value None

Python Syntax CreateStraightWireCable([<parameters>)], [<name>])


oModule = oDesign.GetModule("CableSetup")
oModule.CreateStraightWireCable(
[
"NAME:StWireParams",
"WireStandard:=" , "ISO",
"WireGauge:=" , "0.13",
Python Example
"CondDiameter:=" , "0.55mm",
"CondMaterial:=" , "copper",
"InsThickness:=" , "0.25mm",
"InsMaterial:=" , "PVC plastic",
"InsType:=" , "Thin Wall"
],

3D Modeler Editor Script Commands 11-247


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:StWireAttribs",
"Name:=" , "stwire1"
])

VB Syntax Paste
oModule.CreateStraightWireCable Array("NAME:StWireParams", "WireStandard:=",
"ISO", "WireGauge:=", _
"0.13", "CondDiameter:=", "0.55mm", "CondMaterial:=", "copper", "InsThickness:=", _
VB Example
"0.25mm", "InsMaterial:=", "PVC plastic", "InsType:=", "Thin Wall"), Array
("NAME:StWireAttribs", _
"Name:=","stwire3")

CreateTwistedPairCable
Creates a twisted pair cable using the Beta Cable Modeling feature. Right click on the 3D Component icon and select Cables>Edit
Cables to open the Cable Editor. Then Add Twisted Pair Cable.

UI Access 3D Components>Cables > Edit Cables


Parameters None
Return Value None

3D Modeler Editor Script Commands 11-248


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax CreateTwisted Pair Cable([<parameters>)], [<name>])


oModule.CreateTwistedPairCable("stwire1",
[
"NAME:TwistedPairParams",
[
"NAME:VirtualJacketParams",
"JacketMaterial:=" , "",
"InnerDiameter:=" , "0"
],
Python Example "IsLayLengthSpecified:=", False,
"LayLength:=" , "13.8888888888889mm",
"TurnsPerMeter:=" , "72"
],
[
"NAME:TwistedPairAttribs",
"Name:=" , "tpwire1"
])

VB Syntax CreateTwistedPairCable "<name>" , Array(<parameters>)


VB Example oModule.CreateTwistedPairCable "stwire1", Array("NAME:TwistedPairParams", _

3D Modeler Editor Script Commands 11-249


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:VirtualJacketParams", "JacketMaterial:=", _
"", "InnerDiameter:=", "0"), "IsLayLengthSpecified:=", false, "LayLength:=", _
"13.8888888888889mm", "TurnsPerMeter:=", "72"), Array("NAME:TwistedPairAttribs", "Name:=", _
"tpwire3")

ExportCableLibrary
Exports a cable library created using the Beta Cable Modeling feature. Right click on the 3D Component icon and select Cables>Ex-
port Cable Library. to open a browser window.

UI Access 3D Components>Cables > Export Cable Library...


Parameters None
Return Value None

Python Syntax ExportCableLibrary(<parameters>))


oModule = oDesign.GetModule("CableSetup")
Python Example oModule.ExportCableLibrary("D:\\Users\\JaneDoe\\PersonalLib\\MyCables")

VB Syntax ExportCableLibrary(<parameters> )
VB Example oModule = oDesign.GetModule("CableSetup")

3D Modeler Editor Script Commands 11-250


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.ExportCableLibrary("D:\\Users\\JaneDoe\\PersonalLib\\MyCables")

ImportCableLibrary
Imports an existing cable library created using the Beta Cable Modeling feature. Right click on the 3D Component icon and select
Cables>Export Cable Library. to open a browser window.

UI Access 3D Components>Cables > Import Cable Library...


Parameters None
Return Value None

Python Syntax ImportCableLibrary(<parameters>))


oModule = oDesign.GetModule("CableSetup")
Python Example oModule.ExportCableLibrary("D:\\Users\\JaneDoe\\PersonalLib\\MyCables")

VB Syntax ImportCableLibrary(<parameters> )
oModule = oDesign.GetModule("CableSetup")
VB Example
oModule.ExportCableLibrary("D:\\Users\\JaneDoe\\PersonalLib\\MyCables")

RemoveCable
Removes an existing cable created using the Beta Cable Modeling feature. Right click on the 3D Component icon and select
Cables>Edit Cables.... to open a Cable Editor window.

3D Modeler Editor Script Commands 11-251


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access 3D Components>Cables > Edit Cables...


Parameters None
Return Value None

Python Syntax RemoveCable(<parameters>))


oModule = oDesign.GetModule("CableSetup")
Python Example
oModule.RemoveCable("bundle4")

VB Syntax ImportCableLibrary(<parameters> )
oModule = oDesign.GetModule("CableSetup")
VB Example
oModule.RemoveCable("bundle4")

UpdateCableHarness
Creates a cable harness using the Beta Cable Modeling feature. Right click on the 3D Component icon and select Cables>New
Cable Harness to open the Insert Cable Harness Component Editor.

UI Access 3D Components>Cables > New Cable Harness...


Parameters None
Return Value None

3D Modeler Editor Script Commands 11-252


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax UpdateCableHarness(<parameters>))


oModule.UpdateCableHarness(
[
"NAME:HarnessParams",
"Bundle:=" , "bundle1",
"TwistAlongPath:=" , "720deg",
"Route:=" , "Polyline1",
"AutoOrient:=" , False,
"Origin:=" , ["0mm","0mm","0mm"],
"XAxisEnd:=" , ["-6mm","0mm","0mm"],
"PlaneFlip:=" , True,
Python Example
[
"NAME:RefConductors",
"tpwire2/w1"
],
[
"NAME:InputTerminations",
"tpwire2/w1:=" , [ "Source:="
"tpwire2/w2:=" , [ "Imped:="
],
[

3D Modeler Editor Script Commands 11-253


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:OutputTerminations",
"tpwire2/w1:=" , [ "Imped:="
"tpwire2/w2:=" , [ "Source:="
]
],
[
"NAME:HarnessAttribs",
"Name:=" , "MyHarness"
])

VB Syntax UpdateCableHarness Array(<parameters> )


oModule.UpdateCableHarness Array("NAME:HarnessParams", "Bundle:=", "bundle1",
"TwistAlongPath:=", _
"360deg", "Route:=", "Polyline2", "AutoOrient:=", false, "Origin:=", Array( _
"-24mm", "24mm", "0mm"), "XAxisEnd:=", Array("-30mm", "24mm", "0mm"),
VB Example "PlaneFlip:=", _
true, Array("NAME:RefConductors", "tpwire2/w1"), Array("NAME:InputTerminations",
"tpwire2/w1:=", Array("Source:=", _
"5V", "Imped:=", "50ohm"), "tpwire2/w2:=", Array("Source:=", "5V", "Imped:=", _
"50ohm")), Array("NAME:OutputTerminations", "tpwire2/w1:=", Array("Source:=",

3D Modeler Editor Script Commands 11-254


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"5V", "Imped:=", _
"50ohm"), "tpwire2/w2:=", Array("Imped:=", "50ohm"))), Array("NAME:Har-
nessAttribs", "Name:=", _
"MyNewHarness")

3D Modeler Editor Script Commands 11-255


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

11-256
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

12 - Output Variable Script Commands


Output variable commands should be executed by the "OutputVariable" module.
First, obtain the output variable module from oDesign and use it for output variable commands:
Set oModule = oDesign.GetModule("OutputVariable")
oModule.<CommandName><args>
The commands are:
CreateOutputVariable
DeleteOutputVariable
DoesOutputVariableExist
EditOutputVariable
GetOutputVariableValue
SimValueContext

CreateOutputVariable
Adds a new output variable. Different forms of this command are executed for different design types.

Note:

Output variables are associated with a name and an expression. The name is not permitted to collide with design variable,
sim value, or other output variable names. It cannot have spaces or any arithmetic or other operators in it. Expression defin-
itions cannot be cyclic. For example, A = 2*B, B=3*A is not allowed.

UI Access HFSS > Results > Output Variables.

Output Variable Script Commands 12-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<OutputVarName> String Name of the new output variable.
<Expression> Value Value to assign to the variable.
<SolutionName> String Name of the solution, as seen in the output variable
UI.
<reportType> or <solutionType> String The name of the report type as seen in the output
variable UI.
Parameters
For Layout Editor, use the solution type.
<ContextArray> or <DomainArray> Array Structured array containing context for which the out-
put variable expression is being evaluated.
Array("Context:=", <string>)
For Layout Editor, use Domain array:
Array("Domain:=", <string>)

Return Value None.

Pyth- CreateOutputVariable (<OutputVarName>, <Expression>, <SolutionName>, <reportType | solutionType>, <contextArray


on | domainArray>)
Syn-
tax

HFSS Example:
Pyth-
oModule.CreateOutputVariable("Var" & OutputQuantity, OutputQuantity, Solution, "Far
on
Fields", ["Context:=", InfiniteSphere, "Domain:=", "Sweep"])
Exam-
ple
Layout Editor Example :

Output Variable Script Commands 12-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Set oModule = oDesign.GetModule("OutputVariable")


oModule.CreateOutputVariable("test","mag(S(WavePort1,WavePort1))", "Setup1 : LastAdaptive
", "Modal Solution Data", ["Domain:=", "Sweep"])

VB CreateOutputVariable <OutputVarName>, <Expression>, <SolutionName>, <reportType | solutionType>, <contextArray


Syn- | domainArray>
tax

HFSS Example:
oModule.CreateOutputVariable "Var_" & OutputQuantity, OutputQuantity, Solution, "Far
Fields",
VB Array("Context:=", InfiniteSphere, "Domain:=", "Sweep")
Exam-
ple Layout Editor Example :
Set oModule = oDesign.GetModule("OutputVariable")
oModule.CreateOutputVariable "test","mag(S(WavePort1,WavePort1))", "Setup1 : LastAdaptive
", "Modal Solution Data", Array("Domain:=", "Sweep")

DeleteOutputVariable
Deletes an existing output variable. The variable can only be deleted if it is not in use by any traces.

UI Access HFSS > Results > Output Variables. In the Output Variables window, click Delete.

Name Type Description


Parameters
<OutputVarName> String Name of the output variable.

Return Value None.

Output Variable Script Commands 12-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax DeleteOutputVariable (<OutputVarName>)


oModule = oDesign.GetModule("OutputVariable")
Python Example
oModule.DeleteOutputVariable ("testNew")

VB Syntax DeleteOutputVariable <OutputVarName>


Set oModule = oDesign.GetModule("OutputVariable")
VB Example
oModule.DeleteOutputVariable "testNew"

DoesOutputVariableExist
Verifies whether or not a named output variable exists.

UI Access N/A

Name Type Description


Parameters
<outputVariableName> String The output variable name.

Return Value Boolean True if the variable exists; False if it does not.

Python Syntax DoesOutputVariableExist(<outputVariableName>)


Python Example oProject = oDesktop.GetActiveProject()

Output Variable Script Commands 12-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDesign = oProject.GetActiveDesign()
oModule = oDesign.GetModule("OutputVariable")
oModule.DoesOutputVariableExist("MyTestVar")

VB Syntax DoesOutputVariableExist(<outputVariableName>)
Set oModule = oDesign.GetModule "OutputVariable"
VB Example
oModule.DoesOutputVariableExist "MyTestVar"

EditOutputVariable
Changes the name or expression of an existing output variable.

UI Access N/A

Name Type Description


<OrigVarName> String Name of the original output variable.
<NewExpression> String New value to assign to the variable.
<NewVarName> String New name of the variable if any, else pass empty
string.
<SolutionName> String Name of the solution as seen in the output variable UI.
Parameters
For example, "Setup1 : Last Adaptive".
<ReportType> or <SolutionType> String The name of the report type as seen in the output vari-
able UI.
For Layout Editor, use the solution type.
<ContextArray> or <DomainArray> Array Structured array containing context for which the out-
put variable expression is being evaluated.

Output Variable Script Commands 12-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("Context:=", <string>)
For Layout Editor, use Domain array:
Array("Domain:=", <string>)

Return Value None

Python EditOutputVariable (<OrigVarName>, <NewExpression>, <NewVarName>, <SolutionName>, <ReportType | Solu-


Syntax tionType>, <ContextArray | DomainArray>)
oModule = oDesign.GetModule("OutputVariable")
Python
Example oModule.EditOutputVariable ("test", "normalize(R1_0.V)", "testNew", "TR", "Standard",
[])

EditOutputVariable <OrigVarName>, <NewExpression>, <NewVarName>, <SolutionName>, <ReportType


VB Syntax
| SolutionType>, <ContextArray | DomainArray>
Set oModule = oDesign.GetModule("OutputVariable")
VB Example oModule.EditOutputVariable "test", "dB(S(WavePort1,WavePort1)) ", "testNew",
"Setup1 : LastAdaptive", "Modal Solution Data", Array("Domain:=", "Sweep")

ExportOutputVariables
Exports output variables to a file.

UI Access Click on Export in the Output Variables dialog.

Output Variable Script Commands 12-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


Parameters
<FileName> String Name of the file include path.

Boolean:

Return Value l True - output variable successfully exported.

l False - error when export output variables.

Python Syntax ExportOutputVariables(<FileName>)


Python Example oModule.ExportOutputVariables("C:/output_var.aoutvar")

VB Syntax ExportOutputVariables <FileName>


VB Example oModule.ExportOutputVariables "C:/output_var.aoutvar"

GetOutputVariables
Returns the list of output variables.

UI Access N/A
Parameters None.
Return Value Array containing all output variables.

Python Syntax GetOutputVariables()

Output Variable Script Commands 12-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Example oDesign.GetOutputVariables()

VB Syntax GetOutputVariables
VB Example oDesign.GetOutputVariables

GetOutputVariableValue
Returns the double value of an output variable. Only expressions that return a double value are supported. The expression is eval-
uated only for a single point.

UI Access N/A

Name Type Description


<OutputVarName> String Name of the output variable.
<IntrinsicVariation> String A set of intrinsic variable value pairs to use when evaluating the output expres-
sion.
HFSS example:
"Freq='20GHz' Theta='20deg' Phi='30deg'"
<SolutionName> String Name of the solution as listed in the output variable UI. For example,
Parameters
"Setup1 : Last Adaptive".
<ReportType> String The name of the report type as seen in the output variable UI.
Possible values in HFSS are:
l "Modal Solution Data"
l "Terminal S Parameters"
l "Eigenmode Parameters"

Output Variable Script Commands 12-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l "Fields"
l "Far Fields"
l "Near Fields"
"Emission Test"
l

<ContextArray> Array Structured array containing context for which the output variable expression is
being evaluated. Can be empty.
Array("Context:=", <string>)

Return Value Double value of the output variable.

GetOutputVariableValue(<OutputVarName>, <IntrinsicVariation>, <SolutionName>, <ReportTypeName>,


Python Syntax
<ContextArray>)
Val = oDesign.GetOutputVariableValue("test","Freq = '20Ghz' Theta='20deg'
Python Example
Phi='30deg'", "TR", "Standard", [])

GetOutputVariableValue <OutputVarName>, <IntrinsicVariation>, <SolutionName>, <ReportTypeName>,


VB Syntax
<ContextArray>
Val = oDesign.GetOutputVariableValue
VB Example "test","Freq = '20Ghz' Theta='20deg'
Phi='30deg'", "TR", "Standard", Array()

ImportOutputVariables
Imports output variables from a file.

Output Variable Script Commands 12-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Click on Import in the Output Variables dialog.

Name Type Description


Parameters
<FileName> String Name of the file include path.

Boolean:

Return Value l True - output variable successfully imported.

l False - error when import output variables.

Python Syntax ImportOutputVariables(<FileName>)


Python Example oModule.ImportOutputVariables("C:/output_var.aoutvar")

VB Syntax ImportOutputVariables <FileName>


VB Example oModule.ImportOutputVariables "C:/output_var.aoutvar"

SimValueContext
SimValueContext holds context information for a trace, and describes how data for a trace should be extracted from the simulation.
SimValueContext contains a list of 14 required initial values:

SimValueContext (
Domain ID, Calculation Type, Number of Cycles, Rise Time,
Step, Impulse, Context ID, Window Width,

Output Variable Script Commands 12-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Window Type, TDR Kaiser Parameter, Hold Time, DeviceName,


TDR Step Time, DR Maximum Time )

For example, the following indicates a trace in the Time Domain, Standard Calculation with the number of cycles being 2:
"SimValueContext:=", Array(1, 0, 2, 0, false, false, -1, 1, 0, 1, 1, "", 0, 0)
Additional, context-specific values may follow the required values, as described in subsection 15 below.
1. Domain ID

No Domain 0
Time Domain 1
Spectrum Domain 2
Sweep Domain 3
Device Domain 4
SinglePt Domain 5
LoadPull Domain 6
Transient Domain 7
Budget Domain 8
NetworkFunction Domain 9
Oscillator Domain 55802
Noise Domain 55803
Transfer Function Domain 55807
Time Frequency Domain 55808
Transient Time Domain 55809
Periodic AC Domain 55818

Output Variable Script Commands 12-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Domain 55819
Eye Measurement Domain 55823
Initial Response Domain 55824
Peak Distortion Domain 55825

2. Calculation Type

Standard Calculation 0
Device2_DCIV 1
Device3_DCIV_Output 2
Device3_DCIV_Input 3
Device3_DCIV_Transfer 4
Device3_DCIV_Reverse 5
Device2_ACLoad 6
Device3_ACLoad_Output 7
Device3_ACLoad_Input 8
Device3_ACLoad_Transfer 9
Device3_ACLoad_Reverse 10
Constellation 11
EyeDiagram 12
FreeX ( Statistic Report ) 13

3. Number of Cycles — Used in Time Domain in HarmonicBalance analysis.

Output Variable Script Commands 12-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

4. Rise Time — Not used by Designer/Nexxim.


5. Step — Not used by Designer/Nexxim.
6. Impulse — Not used by Designer/Nexxim.
7. Context ID — Not used by Designer/Nexxim.
8. Window Width — Not used by Designer/Nexxim.
9. Window Type — Not used by Designer/Nexxim.
10. TDR Kaiser Parameter — Not used by Designer/Nexxim.
11. Hold Time — Not used by Designer/Nexxim.
12. DeviceName — Not used by Designer/Nexxim.
13. TDR Step Time — Not used by Designer/Nexxim.
14. TDR Maximum Time — Not used by Designer/Nexxim.
15. Context-specific values — Used in Time Domain in HarmonicBalance analysis.

Context-specific values are entered in the format "key, true/false, keyvalue", where:
— "key" is the name of the key being set.
— "true/false" indicates whether the key is a string value.
— "keyvalue" is the value of the key.
— The order of the context keys is not significant.
— Context keys have software defaults that will be used if not provided in the script.

VB Example:

Output Variable Script Commands 12-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SimValueContext:=", Array(1, 0, 2, 0, false, false, -1, 1, 0, 1, 1, "", 0, 0,


"DE", false, "0",
"DP", false, "20000000",
"DT", false, "0.001",
"WE", false, "10ns",
"WM", false, "10ns",
"WN", false, "0ns",
"WS", false, "0ns"))

a. Plotting Range for Time domain in Transient and QuickEye analysis:

Description Key Name Is a string? Key Value


Start Time WS False 0ns
Stop Time WE False 10ns
Minimum Time WM False 0ns
Maximum Time WN False 10ns
Is Thinning Enabled? DE False 0
Dy/dx Tolerance DT False 0.001
Number of points DP False 20000000

b.Transient report context for Spectral domain in Transient analysis:

Output Variable Script Commands 12-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Description Key Name Is a string? Key Value


Start Time TS False 0ns
Stop Time TE False 10ns
Max Harmonics MH False 100
Max Frequency MF False *
Window type WT False 0
Width Percentage WW False 100
Kaiser Parameter KP False 0
Adjust Coherent Gain CG False 0

* Script can specify either MH or MF. If neither is specified, Max Harmonics is set to 100. If both are specified, MF is used.

Window Type ID
Rectangular 0
Bartlett 1
Blackman 2
Hamming 3
Hanning 4
Kaiser 5
Welch 6
Weber 7
Lanzcos 8

c. Eyeprobe index context for UI domain, Time domain, Eye Measuremant domain in VerifEye and QuickEye analysis:

Output Variable Script Commands 12-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Description Key Name Is a string? Key Value


Eyeprobe compinst ID PCID False 0

d. Eyesource index context for Initial Response domain and Peak Distortion domain in VerifEye and QuickEye analysis:

Description Key Name Is a string? Key Value


Eyesource compinst ID SCID False 0

e. UI domain context in VerifEye and QuickEye analysis:

Description Key Name Is a string? Key Value


Use midpoint? MIDPOINT False 0 - Don't use midpoint.
1 - Use midpoint of amplitude.
2 - Use midpoint of UI.
Minimum latch overdrive MLO False 0

f. Distribution Context for UI Domain in VerifEye and QuickEye analysis:

Output Variable Script Commands 12-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Description Key Name Is a string? Key Value


Use distribution? USE_DIST False 0 - No
1 - Yes
Distribution type DIST False 0 - Receiver Jitter
1 - Receiver Noise
2 - User Defined

Receiver Jitter Parameters

Description Key Name Is a string? Key Value


DLL standard deviation DSD False 0
Distribution type DIST False 0
DLL taps DMN False 0
Static Offset SOFF False 0
Number of Gaussian data sets NUMG False 0
Gaussian std deviation GS0,GS1... False 0
Offset mean GM1,GM1... False 0
Number of Uniform data sets NUMU False 0
Uniform width UW0,UW1... False 0
Uniform mean UM1,UM1... False 0

Output Variable Script Commands 12-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Receiver Noise Parameters

Description Key Name Is a string? Key Value


Number of Gaussian data sets NUMG False 0
Gaussian std deviation GS0,GS1... False 0
Number of Uniform data sets NUMU False 0
Uniform width UW0,UW1... False 0

User Defined Parameters

Description Key Name Is a string? Key Value


Number of XY data pairs NUMG False 0
X data X0,X1,X2... False 0
Y data Y0,Y1,Y2... False 0
Cutoff probability CP False 0

Output Variable Script Commands 12-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

13 - Reporter Editor Script Commands


Reporter commands should be executed by the oDesign object.
For example:
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("ReportSetup")
All Report and Trace properties can be edited using the ChangeProperty commands. This includes Title properties, General prop-
erties, and Background properties such as border color, fonts, X and Y axis scaling, and number display.

Note:

When you execute Tools > Record Script, operations performed in the Reporter are automatically recorded.

The list of commands is as follows:


AddCartesianLimitLine
AddCartesianXMarker
AddCartesianYMarker
AddCartesianYMarkerToStack
AddDeltaMarker
AddMarker
AddNote
AddTraces
AddVerifEyeAnalysis
ClearAllMarkers

Reporter Editor Script Commands 13-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ClearAllTraceCharacteristics
CopyReportDefinitions
CopyReportData
CopyTraceDefinitions
CopyTracesData
CreateReport
CreateReportFromFile
CreateReportFromTemplate
CreateReportOfAllQuantities
DeleteMarker
DeleteAllReports
DeleteReports
DeleteTraces
EditQuickEyeAnalysis
EditVerifEyeAnalysis
FFTOnReport
ExportFieldsToFile
ExportImageToFile
ExportModelImageToFile
ExportModelMeshToFile

Reporter Editor Script Commands 13-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ExportPlot3DToFile
ExportToFile [Reporter]
ExportMarkerTable
GetAllCategories
GetAllQuantities
GetAllReportNames
GetAvailableDisplayTypes
GetAvailableReportTypes
GetAvailableSolutions
GetChildNames
GetChildObject
GetChildTypes
GetDisplayType
GetPropertyValue
GetSolutionContexts
GetSolutionDataPerVariation
GroupPlotCurvesByGroupingStrategy
ImportIntoReport
MovePlotCurvesToGroup
MovePlotCurvesToNewGroup
PasteReports

Reporter Editor Script Commands 13-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

PasteTraces
RenameReport
RenameTrace
ResetPlotSettings
SavePlotSettingsAsDefault
SetPropValue
UpdateAllFieldsPlots
UpdateAllReports
UpdateQuantityFieldsPlots
UpdateReports
UpdateTraces
UpdateTracesContextandSweeps
UnGroupPlotCurvesInGroup

AddAllEyeMeasurements
Displays all the eye measurements in tabular format

UI Access Right-click the report and select Trace Characteristics > Add All Eye Measurements

Name Type Description


Parameters
<ReportName> String Name of the report.

Return Value None.

Reporter Editor Script Commands 13-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax AddAllEyeMeasurements(<ReportName>)


Python Example oModule.AddAllEyeMeasurements("DQS Eye")

VB Syntax AddAllEyeMeasurements <ReportName>


VB Example oModule.AddAllEyeMeasurements "DQS Eye"

AddCartesianLimitLine
Adds a limit line to a report on the X axis.

UI Access Report2D > Add Limit Line> Specify Points...

Name Type Description


<ReportName> String Name of the report.
<Def> Array Structured array:
Array("NAME:CartesianLimitLine",
Array("NAME:XValues", <integer X values>),
Parameters "XUnits:=", <string unit of measure for X>,
Array("NAME:YValues", <integer Y values>),
"YUnits:=", "<string unit of measure for Y>",
"YAxis:=", <string name of associated Y axis>
)

Return Value None.

Reporter Editor Script Commands 13-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax AddCartesianLimitLine (<ReportName>, <Def>)


oModule.AddCartesianLimitLine("Project Outputs",
["NAME:CartesianLimitLine",
["NAME:XValues",0, 2, 5, 7, 10, 15],
"XUnits:=", "s",
Python Example
["NAME:YValues",0.05, 0.3, 0.65, 0.825, 0.95, 1],
"YUnits:=", "mV", "YAxis:=", "Y1"
]
)

VB Syntax AddCartesianLimitLine <ReportName>, <Def>


oModule.AddCartesianLimitLine "Project Outputs",
Array("NAME:CartesianLimitLine",
Array("NAME:XValues",0, 2, 5, 7, 10, 15),
VB Example "XUnits:=", "s",
Array("NAME:YValues",0.05, 0.3, 0.65, 0.825, 0.95, 1),
"YUnits:=", "mV", "YAxis:=", "Y1"
)

Reporter Editor Script Commands 13-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AddCartesianLimitLineFromCurve
Adds a limit line to a report from selected curve on the plot.

UI Access Report2D > Add Limit Line > From Selected Curve...

Name Type Description


<ReportName> String Name of the report.
<LimitLineParams> String Structured array.
Array("NAME:CartesianLimitLineFromCurve",
"TraceName:=", <string name of selected trace>,
"CurveName:=", <string name of selected curve>,

Parameters "Start:=", "<value><unit>",


"Stop:=", "<value><unit>",
"YAxis:=", <integer Y-Axis number>,
"YOffset:=", <value offset from Y-Axis>,
"CreateMode:=", "<AboveCurve | BelowCurve | Above and
Below Curve>",
"YShiftPercent:=", <value percentage to shift from Y>)

Return Value None.

Python Syntax AddCartesianLimitLineFromCurve(<ReportName>, <LimitLineParams>)


oModule.AddCartesianLimitLineFromCurve("Variables Plot 2",
Python Example
[

Reporter Editor Script Commands 13-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:CartesianLimitLineFromCurve",
"TraceName:=" , "Phase",
"CurveName:=" , "",
"Start:=" , "0deg",
"Stop:=" , "375deg",
"YAxis:=" , 1,
"YOffset:=" , 0,
"CreateMode:=" , "AboveCurve",
"YShiftPercent:=" , 10
])

VB Syntax AddCartesianLimitLineFromCurve<ReportName>, <LimitLineParams>


oModule.AddCartesianLimitLineFromCurve _
"Variables Plot 2", _
Array("NAME:CartesianLimitLineFromCurve", _
VB Example "TraceName:=", "Phase", "CurveName:=", "", _
"Start:=", "0deg", "Stop:=", "375deg", _
"YAxis:=", 1, "YOffset:=", 0, _
"CreateMode:=", "AboveCurve", _

Reporter Editor Script Commands 13-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"YShiftPercent:=", 10)

AddCartesianLimitLineFromEquation
Adds a limit line to a report from a specified equation.

UI Access Report2D > Add Limit Line > Specify Equation...

Name Type Description


<ReportName> String Name of the report.
<LimitLineParams> Array Structured array.
Array("NAME:CartesianLimitLineFromEquation",
"YAxis:=", <integer Y-Axis number>,
Parameters
"Start:=", <string start frequency with unit>,
"Stop:=", <string end frequency with unit>,
"Step:=", <string frequency resolution with unit>,
"Equation:=", <string specified equation>)

Return Value None.

Python Syntax AddCartesianLimitLineFromEquation(<ReportName>, <LimitLineParams>)


oModule.AddCartesianLimitLineFromEquation("S Parameter Plot 1",
[
Python Example
"NAME:CartesianLimitLineFromEquation",
"YAxis:=" , 1,

Reporter Editor Script Commands 13-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Start:=" , "9GHz",
"Stop:=" , "11GHz",
"Step:=" , "0.2GHz",
"Equation:=" , "x+1"
])

VB Syntax AddCartesianLimitLineFromEquation <ReportName>, <LimitLineParams>


oModule.AddCartesianLimitLineFromEquation _
"S Parameter Plot 1", _
Array("NAME:CartesianLimitLineFromEquation", _
VB Example
"YAxis:=", 1, _
"Start:=", "9GHz", "Stop:=", "11GHz", "Step:=", "0.2GHz", _
"Equation:=", "x+1")

AddCartesianXMarker
Adds a marker to a report on the X axis.

UI Access Report2D > Marker > Add X Marker.

Name Type Description


Parameters <ReportName> String Name of report.
<MarkerName> String Marker name, including any trailing number.

Reporter Editor Script Commands 13-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<XValue> Double X coordinate.

Return Value None

Python Syntax AddCartesianXMarker (<ReportName>, <MarkerName>, <XValue>)


oModule.AddCartesianXMarker ("XY Plot 1", "MX1", 0)
Python Example

VB Syntax AddCartesianXMarker <ReportName>, <MarkerName>, <XValue>


VB Example oModule.AddCartesianXMarker "XY Plot1", "MX1", 0

AddCartesianYMarker
Adds a marker to a report on the Y axis.

UI Access Report2D > Marker > Add Y Marker.

Name Type Description


<ReportName> String Name of report.
<MarkerName> String Marker name, including any trailing number.
Parameters
<AxisName> String Name of axis.
<YValue> Double Y coordinate.
<CurveName> String Name of curve.

Return Value None

Reporter Editor Script Commands 13-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax AddCartesianYMarker (<ReportName>, <MarkerName>, <AxisName>, <YValue>, <CurveName>)


oModule.AddCartesianYMarker("XY Plot 1", "MY1", "Y1", 0,
Python Example
"dB() : Setup1 : Sweep1")

VB Syntax AddCartesianYMarker <ReportName>, <MarkerName>, <AxisName>, <YValue>, <CurveName>


oModule.AddCartesianYMarker "XY Plot 1", "MY1", "Y1", 0, _
VB Example
"dB() : Setup1 : Sweep1"

AddCartesianYMarkerToStack
Adds a marker to a stacked report on the Y axis.

UI Access N/A

Name Type Description


<ReportName> String Name of report.
<MarkerName> String Marker name, including any trailing number.
Parameters
<AxisName> String Name of axis.
<YValue> Double Y coordinate.
<CurveName> String Name of curve.
<StackOption> Array "Current" to create marker on the current stack. "All" to create marker on all
stack.

Return Value None

Reporter Editor Script Commands 13-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AddCartesianYMarkerToStack (<ReportName>, <MarkerName>, <AxisName>, <YValue>, <CurveName>,


Python Syntax
<StackOption>)
oModule.AddCartesianYMarker("XY Plot 1", "MY1", "Y1", 0,
Python Example
"dB() : Setup1 : Sweep1", ["All"])

AddCartesianYMarkerToStack <ReportName>, <MarkerName>, <AxisName>, <YValue>, <CurveName>,


VB Syntax
<StackOption>
oModule.AddCartesianYMarkerToStack "XY Plot 1", "MY1", "Y1", 0, _
VB Example
"dB() : Setup1 : Sweep1", Array("All")

AddDeltaMarker
Add markers to calculate differences between two trace points on a plot.

UI Access Report2D > Marker > Add Delta Marker.

Name Type Description


<ReportName> String Name of report.
<MarkerName1> String Marker name, including any trailing number, for the first marker.
<CurveName1> String Full trace name for the first marker.
Parameters
<PrimarySweepValue1> String Frequency, including unit, for the first marker's sweep.
<MarkerName2> String Marker name, including any trailing number, for the second marker.
<CurveName2> String Full trace name for the second marker.
<PrimarySweepValue2> String Frequency, including unit, for the second marker's sweep.

Return Value None

Reporter Editor Script Commands 13-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AddDeltaMarker(<ReportName>, <MarkerName1>, <CurveName1>, <PrimarySweepValue1>,


Python Syntax
<MarkerName2>, <CurveName2>, <PrimarySweepValue2>)
oModule.AddDeltaMarker("S Parameter Plot 1", "m1",
"dB(S(Port1 Port1)) : Setup1 : Sweep1 : Cartesian",
Python Example "8.45GHz", "m2",
"dB(S(Port1 Port1)) : Setup1 : Sweep1 : Cartesian",
"9.5GHz")

AddDeltaMarker <ReportName>, <MarkerName1>, <CurveName1>, <PrimarySweepValue1>,


VB Syntax
<MarkerName2>, <CurveName2>, <PrimarySweepValue2>
oModule.AddDeltaMarker "S Parameter Plot 1", "m1",
"dB(S(Port1 Port1)) : Setup1 : Sweep1 : Cartesian", "8.45GHz",
VB Example
"m2", "dB(S(Port1 Port1)) : Setup1 : Sweep1 : Cartesian",
"9.5GHz"

AddMarker
Adds a marker to a trace on a report.

UI Access Report2D > Marker > Add Marker.

Name Type Description


Parameters <ReportName> String Name of report.
<MarkerName> String Marker name, including any trailing number.

Reporter Editor Script Commands 13-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<CurveName> String Full trace name.


<PrimarySweepValue> String Primary sweep value, including unit.

Return Value None

Python Syntax AddMarker( <ReportName>, <MarkerName>, <CurveName>, <PrimarySweepValue>)


oModule.AddMarker("XY Plot 1", "m5",
Python Example "GS1.VAL : TR4 : Cartesian", "3.61599999999997s")

VB Syntax AddMarker <ReportName>, <MarkerName>, <CurveName>, <PrimarySweepValue>


Set oModule = oDesign.GetModule("ReportSetup")
oModule.AddMarker "XY Plot1","m1",
VB Example
"mag(S(Port1 Port1)) : Setup1:
LastAdaptive : Cartesian", "0.3in"

AddNote
Adds a note at a specified location to a given report.

UI Access Right-click on the plot and select Add Note.

Name Type Description


Parameters <ReportName> String Name of report
<NoteDataArray> Array Structured array.

Reporter Editor Script Commands 13-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:<StringDataName>", <NoteArray>)
<NoteArray> Array Structured array:
Array("NAME:<NoteDataSourceName>",
"SourceName:=", <string source name>,
"HaveDefaultPos:=", <boolean True for position 0,0;
False to specify below>,
"DefaultXPos:=", <int X position for note; 0 for
default>,
"DefaultYPos:=", <int Y position for note; 0 for
default>,
"String:=", <string note text>)

Return Value None

Python Syntax AddNote (<ReportName>, <NoteDataArray>)


oModule.AddNote("XY Plot1",
["NAME:NoteDataSource",
"SourceName:=", "Note1",
Python Example "HaveDefaultPos:=", False,
"DefaultXPos:=", 1996,
"DefaultYPos:=", 3177,
"String:=", "This is a note."

Reporter Editor Script Commands 13-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

]
)

VB Syntax AddNote <ReportName> <NoteDataArray>


oModule.AddNote "XY Plot1", _
Array("NAME:NoteDataSource", _
"SourceName:=", "Note1", _
VB Example "HaveDefaultPos:=", false, _
"DefaultXPos:=", 1996, _
"DefaultYPos:=", 3177, _
"String:=", "This is a note.")

AddTraceCharacteristics
Adds a trace characteristics field to the legend on a report.

UI Access Report2D > Trace Characteristics > All. This opens the Add Trace Characteristics dialog box.

Name Type Description


<ReportName> String Name of report.
<FunctionName> String The function name. See the Functions column of the Add Trace Char-
acteristics dialog box.
Parameters
<FunctionArgs> Array Array containing string values for any function arguments. Pass empty array if
no arguments exist.
To see which argument(s) a function takes, see the bottom of the Add
Trace Characteristics dialog box.

Reporter Editor Script Commands 13-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

For function with one argument:


Array(<value>)
For function with multiple arguments:
Array(<value>, <value>, ...)
<RangeArgs> Array Required. Array containing either string "Full" for a full sweep range, or "Spe-
cified" and strings containing the start and end values for the frequency range.
For example:
Array("Specified", "19.5GHz", "24.4GHz")

Return Value None.

Python AddTraceCharacteristics (<ReportName>, <FunctionName>, <FunctionArgs>, <RangeArgs>)


Syntax

oModule.AddTraceCharacteristics("XY Plot 2", "delaytime", ["0"], ["Full"])


Python oModule.AddTraceCharacteristics("Differential S-parameters", "prms", ["0", "0"],
Exampl- ["Full"])
e
oModule.AddTraceCharacteristics("Rept2DRectFreq", "distortion", ["0"], ["Specified",
"19.5GHz", "20.4GHz"])

VB AddTraceCharacteristics <ReportName>, <FunctionName>, <FunctionArgs>, <RangeArgs


Syntax

VB oModule.AddTraceCharacteristics "XY Plot 2", "delaytime", Array("0"), Array("Full")

Reporter Editor Script Commands 13-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.AddTraceCharacteristics "Differential S-parameters", "prms", Array("0", "0"),


Examp- Array("Full")
le oModule.AddTraceCharacteristics "Rept2DRectFreq", "distortion", Array("0"), Array( "Spe-
cified", "19.5GHz", "20.4GHz")

AddTraces
Creates a new trace and adds it to the specified report.

UI Access Modify Report > Add Trace.

Name Type Description


<ReportName> String Name of Report
<SolutionName> String Name of the solution as listed in the Modify Report dialog box.
<ContextArray> Array 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>)
Parameters <GeometryType> ex. "Infinite Spheren",
"Spheren", "Polylinen"
<FamiliesArray> Array 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-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ReportDataArray> Array This array contains the report quantity and X, Y, and (Z) axis definitions.
Array("X Component:=", <VariableName>,
"Y Component:=", <VariableName> | <ReportQuant-
ityArray>)
<ReportQuantityArray> ex. Array("dB(S(Port1,
Port1))")

Return Value None

Python Syntax Add Traces(<ReportName>, <SolutionName>, <ContextArray >, <FamiliesArray>, <ReportDataArray>)


oModule.AddTraces("XY Plot1", "Setup1 : Sweep1",
["Domain:=", "Time", "HoldTime:=", 1, "RiseTime:=", 0,
"StepTime:=", 6.24999373748E-012, "Step:=", False,
"WindowWidth:=", 1,
Python Example "WindowType:=", 0, "KaiserParameter:=", 1,
"MaximumTime:=", 6.2437437437444E-009],
["Time:=", ["All"], "OverridingValues:=", ["0s",
"6.24999373748188e-012s", ... ]], ["X Component:=", "Time",
"Y Component:=", ["TDRZ(WavePort1)"]], [])

VB Syntax Add Traces <ReportName> <SolutionName> <ContextArray> <FamiliesArray> <ReportDataArray>

Reporter Editor Script Commands 13-20


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.AddTraces "XY Plot1", "Setup1 : Sweep1", _


Array("Domain:=", "Time", "HoldTime:=", 1, "RiseTime:=", 0, _
"StepTime:=", 6.24999373748E-012, "Step:=", false, _
"WindowWidth:=", 1, _
"WindowType:=", 0, "KaiserParameter:=", 1, _
VB Example "MaximumTime:=", 6.2437437437444E-009), _
Array("Time:=", Array("All"), "OverridingValues:=", _
Array("0s","6.24999373748188e-012s", ...)), _
Array("X Component:=", "Time", _
"Y Component:=", Array("TDRZ(WavePort1)")), _
Array()

ApplyReportTemplate
Applies settings to a report from a template file.

UI Access Right-click on a report, select Report Templates > Apply Settings.

Name Type Description


<ReportName> String Name of the report to apply settings to.
Parameters <TemplateFile> String Template file name with path.
<PropertyType> String Property types to apply.
("Graphical" | "Data" | "All")

Return Value None.

Reporter Editor Script Commands 13-21


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ApplyReportTemplate(<ReportName>, <TemplateFile>, <PropertyType>)


Python oModule.ApplyReportTemplate("Variables Plot 1", "C:/MyTemplate.rpt", "Graphical")
Example

VB Syntax ApplyReportTemplate <ReportName>, <TemplateFile>, <PropertyType>


VB Example oModule.ApplyReportTemplate "Variables Plot 1", "C:/MyTemplate.rpt", "Graphical"

ChangeProperty[ReportSetup]
Change the properties for a Report.

UI Access Double-click on a report to change its properties.

Name Type Description


Parameters <PropertyArray> Array Varies, depending on the properties associated with the select object com-
mand.

Return Value None.

Python Syntax ChangeProperty(<PropertyArray>)


oModule = oDesign.GetModule("ReportSetup")
oModule.ChangeProperty(
Python Example
[
"NAME:AllTabs",

Reporter Editor Script Commands 13-22


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:General",
[
"NAME:PropServers",
"XY Plot 1:General"
],
[
"NAME:ChangedProps",
[
"NAME:Use Scientific Notation",
"Value:=", True
]
]
]
])

oModule = oDesign.GetModule("ReportSetup")
oModule.ChangeProperty(
[
"NAME:AllTabs",
[

Reporter Editor Script Commands 13-23


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:Legend",
[
"NAME:PropServers",
"S Parameter Plot 1:Legend"
],
[
"NAME:ChangedProps",
[
"NAME:Legend Name",
"Value:=" , "Ansys"
]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:General",
[

Reporter Editor Script Commands 13-24


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:PropServers",
"S Parameter Plot 1:General"
],
[
"NAME:ChangedProps",
[
"NAME:Auto Scale Fonts",
"Value:=" , False
]
]
]
])

VB ChangeProperty <PropertyArray>
Syntax

oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:Cartesian", Array


("NAME:PropServers", _

VB
"XY Plot 1:CartesianDisplayTypeProperty"), Array("NAME:ChangedProps", Array("NAME:Show X
Examp- Scrollbar", "Value:=", _
le true))))
oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:General", Array("NAME:PropServ-
ers", _

Reporter Editor Script Commands 13-25


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"XY Plot 1:General"), Array("NAME:ChangedProps", Array("NAME:Use Scientific Notation",


"Value:=", _
true))))

ClearAllMarkers
Clears all markers from a report.

UI Access Report2D > Markers > Clear All.

Name Type Description


Parameters
<ReportName> String Name of Report

Return Value None

Python Syntax ClearAllMarkers(<ReportName>)


Python Example oModule.ClearAllMarkers("XY Plot 1")

VB Syntax ClearAllMarkers <ReportName>


VB Example oModule.ClearAllMarkers "XY Plot 1"

ClearAllTraceCharacteristics
Clears all trace characteristics from the legend in a report.

Reporter Editor Script Commands 13-26


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Report2D > Trace Characteristics > Clear All.

Name Type Description


Parameters
<PlotName> String Name of the plot

Return Value None

Python Syntax ClearAllTraceCharacteristics(<PlotName>)


oModule.ClearAllTraceCharacteristics("XY Plot 1")
Python Example

VB Syntax ClearAllTraceCharacteristics <PlotName>


VB Example oModule.ClearAllTraceCharacteristics "XY Plot 1"

CloneReportsFromDatasetSolution
Clones a report for a solveed solution from a dataset solution.

UI Access Right-click the Project tree on the report and choose Clone from Dataset Solution > [Dataset_SolutionName]

Name Type Description


Parameters <ReportsToClone> Array Array of report names to clone.
<SoluNameToUse> String Name of the dataset solution.

Return Value None.

Reporter Editor Script Commands 13-27


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python CloneReportsFromDatasetSolution(<ReportsToClone>, <SoluNameToUse>)


Syntax

Python oModule.CloneReportsFromDatasetSolution(["Rectangular Plot1"], "DatasetSolution_rsm_


Example 5812")

VB Syntax CloneReportsFromDatasetSolution <ReportsToClone>, <SoluNameToUse>


oModule.CloneReportsFromDatasetSolution _
VB Example
Array("Rectangular Plot1"), "DatasetSolution_rsm_5812"

CopyPlotSettings
Copies settings of a specified plot.

UI Access Right-click a report, select Copy

Name Type Description


Parameters
<ReportName> String Name of specified report.

Return Value None.

Python Syntax CopyPlotSettings(<ReportName>)


Python Example oModule.CopyPlotSettings("Plot 1")

Reporter Editor Script Commands 13-28


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax CopyPlotSettings <ReportName>


VB Example oModule.CopyPlotSettings "Plot 1"

CopyReportDefinitions
Copy the definition of a report for paste operations.

UI Access Select a report in the Project tree, right-click and select Copy Definition

Name Type Description


Parameters
<ReportsArray> Array Names of reports from which to copy the definitions

Return Value None

Python Syntax CopyReportDefinitions(<ReportsArray>)


oModule.CopyReportDefinitions(["Transmission", "Reflection"])
Python Example

VB Syntax CopyReportDefinitions <ReportsArray>


oModule.CopyReportDefinitionsv _
VB Example
Array("Transmission", "Reflection")

CopyReportsData
Copy all data corresponding to the specified reports.

Reporter Editor Script Commands 13-29


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Select a report in the Project tree, right-click and select Copy Data

Name Type Description


Parameters
<ReportsArray> Array Names of reports from which to copy data

Return Value None

Python Syntax CopyReportsData (<ReportsArray>)


Python Example oModule.CopyReportsData (["Transmission","Reflection"])

VB Syntax CopyReportsData <ReportsArray>


oModule.CopyReportsData _
VB Example
Array("Transmission","Reflection")

CopyTraceDefinitions
Copy trace definitions for a paste operation.

UI Access Select a trace in the Project tree, right-click and select Copy Definition

Name Type Description


Parameters <ReportName> String Name of Report
<TracesArray> Array Trace definitions to copy

Return Value None

Reporter Editor Script Commands 13-30


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax CopyTraceDefinitions(<ReportName>, <TracesArray>)


oModule.CopyTraceDefinitions ("Transmission",
Python Example
["mag(S(Port1,Port2))"])

VB Syntax CopyTraceDefinitions <ReportName>, <TracesArray>


oModule.CopyTraceDefinitions "Transmission", _
VB Example
Array("mag(S(Port1,Port2))")

CopyTracesData
Copies trace data for a paste operation.

UI Access Select a trace in the Project tree, right-click and select Copy Data.

Name Type Description


Parameters <ReportName> String Name of Report.
<TraceArray> Array Trace definitions from which to copy corresponding data.

Return Value None.

Python Syntax CopyTracesData(<ReportName>, <TracesArray>)


oModule.CopyTracesData ("Transmission",
Python Example
["mag(S(Port1,Port2))"])

Reporter Editor Script Commands 13-31


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax CopyTracesData <ReportName>, <TracesArray>


oModule.CopyTracesData _
VB Example
"C11", Array("mag(S(Port1,Port2))")
y, I

CreateReport
Creates a new report with a single trace and adds it to the Results branch in the project tree.

UI Access Right-click on Results > Create [Type] Report

Name Type Description


<ReportName> String Name of report.
<ReportType> String Type of report.
Possible values are:
"Modal S Parameters" - Only for Driven Modal solution-type prob-
lems with ports.

Parameters "Terminal S Parameters" - Only for Driven Terminal solution-type


problems with ports.
"Eigenmode Parameters" - Only for Eigenmode solution-type prob-
lems.
"Fields"
"Far Fields" - Only for problems with radiation or PML boundaries.
"Near Fields" - Only for problems with radiation or PML boundaries.

Reporter Editor Script Commands 13-32


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Emission Test"
<DisplayType> String Type of display.
If ReportType is "Modal S Parameters", "Terminal S Parameters", or
"Eigenmode Parameters", then set to one of the following:
"Rectangular Plot", "Polar Plot", "Radiation Pattern",
"Smith Chart", "Data Table", "3D Rectangular Plot", "3D
Rectangular Bar Plot" or "3D Polar Plot".
If <ReportType> is "Fields", then set to one of the following:
"Rectangular Plot", "Polar Plot", "Radiation Pattern",
"Rectangular Contour Plot", "Data Table", "3D Rect-
angular Plot", or "3D Rectangular Bar Plot".
If <ReportType> is "Far Fields" or "Near Fields", then set to one of the fol-
lowing:
"Rectangular Plot", "Radiation Pattern", "Rectangular
Contour Plot" "Data Table",
"3D Rectangular Plot", "3D Rectangular Bar Plot" or "3D
Polar Plot"
If <ReportType> is "Emission Test", then set to one of the following:
"Rectangular Plot" or "Data Table"
<SolutionName> String Name of the solution as listed in the Modify Report dialog box.
<ContextArray> Array 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>)

Reporter Editor Script Commands 13-33


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<GeometryType>
ex. "Infinite Spheren", "Spheren", "Polylinen"
<FamiliesArray> Array Contains sweep definitions for the report.
Array("<VariableName>:= ", <ValueArray>)
<ValueArray>
Array("All") or Array("Value1", "Value2", ..."Valuen")
examples of <VariableName> "Freq", "Theta", "Distance"
<ReportDataArray> Array 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))")

Return Value None.

CreateReport(<ReportName>, <ReportType>, <DisplayType>,


Pytho-
n Syn- <SolutionName>, <ContextArray>, <FamiliesArray>,
tax
<ReportDataArray>, <ExtendedInfo>)

Pytho- Three examples are given below:(nominal, Optimetrics, spectral)


n
Exam-
Nominal Example:
ple oModule.CreateReport( "XY Plot 2", "Standard",_

Reporter Editor Script Commands 13-34


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Rectangular Plot", "TR", ["NAME:Context",_


"SimValueContext:=", [] 1, 0, 2, 0, false,_
false, -1, 1, 0, 1, 1, "", 0, 0]], ["Time:=",_
["All"], "aaa:=", ["Nominal"]]_
["X Component:=", "Time", "Y Component:=",_
["E1.I"]][])

Optimetrics Example:
oModule.CreateReport ("XY Plot 3", "Standard",_
"Rectangular Plot", "TR", ["NAME:Context",_
"OptiSetup:=", "ParametricSetup1", "SimValueCon
[1, 0, 2, 0, false, false, 0, 1, _
0, 1, 1, "", 0, 0]], ["Time:=", ["All"],_
"aaa:=", ["Nominal"]], ["X Component:=",_
"Time", "Y Component:=", ["E1.I"]], [])

Spectral Example:
oModule.CreateReport ("XY Plot 4", "Standard",_
"Rectangular Plot", "TR", ["NAME:Context",_
"SimValueContext:=", [ 2, 0, 2, 0, false, false
-1, 1, 0, 1, 1, "", 0, 0, "CG", false, "0", "KP
false, "0", "MH", false, "100", "TE", false, "4
"TH", false, "40", "TS", false, "0ns", "UF", fa

Reporter Editor Script Commands 13-35


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"0", "WT", false, "0", "WW", false, "100"]],_


["Spectrum:=", ["All"], "aaa:=",_
["Nominal"]], ["X Component:=","Spectrum", _
"Y Component:=", ["mag(E1.I)"]], [])

Partial Discharge Example


oModule.CreateReport("Partial Discharge Plot 2", "Partial Discharge", "Rectangular Plot",
"PartialDischarge1 : PartialDischarge", [],
[
"GasPressure:=" , ["All"],
"Freq:=" , ["All"],
"bend_angle:=" , ["All"]
],
[
"X Component:=" , "GasPressure",
"Y Component:=" , ["Power"]
])
Example 3D Rectangular Bar Plot with Change Bar properties
oModule = oDesign.GetModule("ReportSetup")
oModule.CreateReport("S Parameter Plot 4", "Modal Solution Data", "3D Rectangular Bar
Plot", "Setup1 : Sweep", [],
[

Reporter Editor Script Commands 13-36


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Freq:=" , ["All"],
"UU:=" , ["All"],
"ZZZ:=" , ["Nominal"]
],
[
"X Component:=" , "Freq",
"Y Component:=" , "UU",
"Z Component:=" , ["dB(S(wDipole1_1_p1,wDipole1_1_p1))"]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[

Reporter Editor Script Commands 13-37


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:Transparency",
"Value:=" , "0.5"
]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Filled",
"Value:=" , False

Reporter Editor Script Commands 13-38


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Filled",
"Value:=" , True
]
]
]

Reporter Editor Script Commands 13-39


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Show Outline",
"Value:=" , True
]
]
]
])
oModule.ChangeProperty(

Reporter Editor Script Commands 13-40


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Outline Color",
"R:=" , 0,
"G:=" , 0,
"B:=" , 160
]
]
]
])
oModule.ChangeProperty(
[

Reporter Editor Script Commands 13-41


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Outline Width",
"Value:=" , "2"
]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[

Reporter Editor Script Commands 13-42


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],
[
"NAME:ChangedProps",
[
"NAME:Bar Width",
"Value:=" , "Narrow"
]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",

Reporter Editor Script Commands 13-43


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"


],
[
"NAME:ChangedProps",
[
"NAME:Bar Width",
"Value:=" , "Wide"
]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Bar",
[
"NAME:PropServers",
"S Parameter Plot 4:Traces-dB(S(wDipole1_1_p1,wDipole1_1_p1))"
],

Reporter Editor Script Commands 13-44


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:ChangedProps",
[
"NAME:Bar Infinity",
"Value:=" , True
]
]
]
])

CreateReport <ReportName>, <ReportType>, <DisplayType>,


VB Syn-
<SolutionName>, <ContextArray>, <FamiliesArray>,
tax
<ReportDataArray>, <ExtendedInfo
oModule.CreateReport "3D Cartesian Plot1", "Far Fields",_
"3D Cartesian Plot", "Setup1 : LastAdaptive", _
Array("Context:=", "Infinite Sphere1", "Domain:=", "Sweep"), _

VB Array("Theta:=", Array("All"), "Phi:=", Array("All"), _


Example "Freq:=", Array("10GHz")), _
Array("X Component:=", "Theta", _
"Y Component:=", "Phi", _
"Z Component:=", Array("rETotal")), _

Reporter Editor Script Commands 13-45


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array()
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()
oModule.CreateReport "Rectangular Contour Plot 2", "Far Fields", _
"Rectangular Contour Plot", "Setup1 : LastAdaptive", Array("Context:=", _
"Infinite Sphere1"), Array("_u:=", Array("All"), "_v:=", Array("All"), "Freq:=",
Array( _
"5GHz")), Array("X Component:=", "_u", "Y Component:=", "_v", "Z Component:=", Array
( _
"rETotal")), Array()
oModule.CreateReport "Rept2DRectFreq",_
"Modal Solution Data", "XY Plot", _
"Setup1 : Sweep1", _
Array("Domain:=", "Sweep"), _
Array("Freq:=", Array("All")), _
Array("X Component:=", "Freq", _

Reporter Editor Script Commands 13-46


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Y Component:=", _ Array("dB(S(LumpPort1,LumpPort1))")), _


Array()

CreateReport [Designer]
Use:Creates a new report with a single trace and adds it to the Results branch in the project tree.
Command:Product Menu>Results>Create <type> Report
Syntax:CreateReport <ReportName> <ReportType> <DisplayType> <SolutionName> <ContextArray> <FamilesArray>
<ReportDataArray>
Return Value:None
Parameters:<ReportName>
Type: <string>
Name of Report.

<ReportType>
Type: <string>
Possible values are:
"Standard" - For most plot types.
"Load Pull" - For load pull plots.
"Constellation" - For constellation plots.
"Data table" - For data tables.
"Eye Diagram" - For eye diagrams.
"Statistical" - For statistical plots.

Reporter Editor Script Commands 13-47


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<DisplayType>
Type: <string>
Possible values are:
"Rectangular Plot", "Polar Plot", "Radiation Pattern", "Smith Chart", "Data Table", "3D Rectangular Plot", "3D Polar Plot", or
"Rectangular Stacked Plot".

<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:=", <SimValueContext>)

Reporter Editor Script Commands 13-48


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Context for the trace. For more information see SimValueContext.

<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))")

VB Example:

Reporter Editor Script Commands 13-49


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.CreateReport "XY Stacked Plot 1", "Standard", "Rectangular Stacked Plot", _


"LinearFrequency", Array("NAME:Context", "SimValueContext:=", Array(3, 0, 2, 0, _
false, false, -1, 1, 0, 1, 1, "", 0, 0)), Array("F:=", Array("All")), Array("X Component:=", _
"F", "Y Component:=", Array("dB(S(Port1,Port1))", "dB(S(Port1,Port2))", _
"dB(S(Port2,Port1))", "dB(S(Port2,Port2))")), Array()

VB Example:
oModule.CreateReport "Data Table 1", "Standard", "Data Table", "LinearFrequency",_
Array("NAME:Context", "SimValueContext:=", Array( _
3, 0, 2, 0, false, false, -1, 1, 0, 1, 1, "", 0, 0)), Array("F:=", Array("All")), Array("X Com-
ponent:=", _
"F", "Y Component:=", Array("dB(S(Port1,Port1))")), Array()

VB Example:
oModule.CreateReport "3D Rectangular Plot 1", "Standard", "3D Rectangular Plot", _
"LinearFrequency", Array("NAME:Context", "SimValueContext:=", Array(3, 0, 2, 0, _
false, false, -1, 1, 0, 1, 1, "", 0, 0)), Array("F:=", Array("All")), Array("X Component:=", _
"F", "Y Component:=", "F", "Z Component:=", Array("dB(S(Port1,Port1))")), Array()

VB Example:
oModule.CreateReport "3D Rectangular Plot 2", "Standard", "3D Rectangular Plot", _

Reporter Editor Script Commands 13-50


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"LinearFrequency", Array("NAME:Context", "SimValueContext:=", Array(3, 0, 2, 0, _


false, false, -1, 1, 0, 1, 1, "", 0, 0)), Array("F:=", Array("All")), Array("X Component:=", _
"F", "Y Component:=", "F", "Z Component:=", Array("dB(S(Port1,Port1))")), Array()

Python Syntax CreateReport(<data_block>)


oModule = oDesign.GetModule("ReportSetup")
oModule.CreateReport("QuickEye Voltage Plot 1", "Eye Diagram", "Rectangular
Plot", "QuickEyeAnalysis",
[
"NAME:Context",
"SimValueContext:=" , [1,0,2,0,False,False,
-1,1,0,1,1,"",0,0,"DE",False,"0","DP",False,
"20000000","DT",False,"0.001","NUMLEVELS",False,"1","PCID",

Python Example False,"3","PID",False,"0",


"WE",False,"49.99995us","WM",False,"49.99995us","WN",False,
"0ps","WS",False,"0ps"]
],
[
"Time:=" , ["All"]
],
[
"Component:=" , ["aeyeprobe3"]

Reporter Editor Script Commands 13-51


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

],
[
"Unit Interval:=" , "1e-009s",
"Offset:=" , "0",
"Auto Delay:=" , True,
"Manual Delay:=" , "0ps",
"AutoCompCrossAmplitude:=", True,
"CrossingAmplitude:=" , "0mV",
"AutoCompEyeMeasurementPoint:=", True,
"EyeMeasurementPoint:=" , "5e-010s"
])

CreateReportFromFile
Creates a new report from an .rdat file.

UI Access Right-click on Results > Create Report From File...

Name Type Description


Parameters
<FilePathName> String Path to .rdat file.

Return Value None.

Reporter Editor Script Commands 13-52


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax CreateReportFromFile(<FilePathName>)


Python Example oModule.CreateReportFromFile("C:/Users/MyDir/Documents/Return_Loss.rdat")

VB Syntax CreateReportFromFile <FilePathName>


VB Example oModule.CreateReportFromFile "C:/Users/MyDir/Documents/Return_Loss.rdat"

CreateReportFromTemplate
Creates a report from a saved template.

UI Access [product] > Results > Report Templates > PersonalLib > [TemplateName]

Name Type Description


Parameters
<TemplatePath> String Path to report template

Return Value None

Python Syntax CreateReportFromTemplate( <TemplatePath>)


oModule.CreateReportFromTemplate(
Python Example
"C:/MyHFSSProjects/PersonalLib/ReportTemplates/TestTemplate.rpt")

VB Syntax CreateReportFromTemplate <TemplatePath>


VB Example oModule.CreateReportFromTemplate "C:/MyHFSSProjects/PersonalLib/" _

Reporter Editor Script Commands 13-53


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ReportTemplates/TestTemplate.rpt"

CreateReportOfAllQuantities
Creates a report including all quantities in a category. Cannot create a report with expressions.

UI Access NA

Name Type Description


<ReportType> String Report type name as input parameter
<DisplayType> String Display type name as input parameter
<SolutionName> String Solution name as input parameter
Parameters <SimValueCtxt> String A context name, or array of string that encoded the context(I).
<CategoryName> String Category name as input parameter
<PointSet> Array Array of strings(II)
<CommonComponentsOfTraces> Array Array of strings(III)
<ExtTraceInfo> Array Array of strings(IV)

Return Value None.

CreateReportOfAllQuantities(<ReportNameArg>, <ReportType>, <DisplayType>,


Python Syntax <SolutionName>, <SimValueCtxt>, <CategoryName>,
<PointSet>, <CommonComponentsOfTraces>, <ExtTraceInfo>)
oModule.CreateReportOfAllQuantities("Smith Chart all",
Python Example "Modal Solution Data", "Smith Chart", "Setup1 : LastAdaptive",
[],"S Parameter",["Freq:=", ["All"], "offset:=", ["All"],"a:=",

Reporter Editor Script Commands 13-54


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["Nominal"],"b:=", ["Nominal"]],[],[])

CreateReportOfAllQuantities <ReportNameArg>, <ReportType>, <DisplayType>,


VB Syntax <SolutionName>, <SimValueCtxt>, <CategoryName>,
<PointSet>, <CommonComponentsOfTraces>, <ExtTraceInfo>
oModule.CreateReportOfAllQuantities "Smith Chart all", _
"Modal Solution Data", "Smith Chart", "Setup1 : LastAdaptive", _
Array(),"S Parameter", _
VB Example Array("Freq:=", Array("All"), "offset:=", Array("All"), _
"a:=", Array("Nominal"),"b:=", Array("Nominal")), _
Array(), Array()

DeleteMarker
Use:Deletes the specified marker.

UI Access [product] > Fields > Fields > Marker > Delete Marker.

Name Type Description


Parameters
<MarkerName> String Name of the marker.

Return Value None.

Reporter Editor Script Commands 13-55


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax DeleteMarker(<MarkerName>)


Python Example oModule.DeleteMarker("m1")

VB Syntax DeleteMarker <MarkerName>


VB Example oModule.DeleteMarker "m1"

DeleteAllReports
Deletes all existing reports.

UI Access Right-click the report to delete in the project tree, and then click Delete All Reports on the shortcut menu.
Parameters None.
Return Value None.

Python Syntax DeleteAllReports()


Python Example oModule.DeleteAllReports()

VB Syntax DeleteAllReports
VB Example oModule.DeleteAllReports

Reporter Editor Script Commands 13-56


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

DeleteReports
Deletes an existing report or reports.

UI Access Right-click the report to delete in the project tree, and then click Delete on the shortcut menu

Name Type Description


Parameters
<ReportNameArray> Array Array of report names to be deleted

Return Value None.

Python Syntax DeleteReports(<ReportNameArray>)


Python Example oModule.DeleteReports (["Rept2DRectFreq"])

VB Syntax DeleteReports <ReportNameArray>


VB Example oModule.DeleteReports Array("Rept2DRectFreq")

DeleteTraceCharacteristics
Deletes a trace characteristics field from a report

UI Access N/A

Name Type Description


Parameters <ReportName> String Name of the report to delete from.
<TraceCharsNames> Array Array of trace characteristics to delete.

Return Value None.

Reporter Editor Script Commands 13-57


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python DeleteTraceCharacteristics(<ReportName>, <TraceCharsNames>)


Syntax

Python oModule.DeleteTraceCharacteristics("Variables Plot 1", ["lowercutoff", "gain-


Example crossover"])

VB Syntax DeleteTraceCharacteristics <ReportName>, <TraceCharsNames>


oModule.DeleteTraceCharacteristics "Variables Plot 1", _
VB Example
Array("lowercutoff", "gaincrossover")

DeleteTraces
Deletes an existing traces or traces.

UI Access Right-click the Trace to delete in the project tree, and then click Delete on the shortcut menu

Name Type Description


<TraceSelection> Array Structured array define selections.
Array("<ReportName>:=", <TracesArray>, <TracesAr-
ray>,... )
Parameters
<ReportName> String Name of Report
<TracesArray> Array Contains the traces to delete within a report
Array(<Trace>, <Trace>, ...)
<Trace> String A specific trace that the user wishes to delete

Reporter Editor Script Commands 13-58


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax DeleteTraces(<TraceSelection>)


oModule.DeleteTraces (["XY Plot 1:=",
Python Example ["dB(S(LumpPort1,Lump-
Port1))"],
"XY Plot 2:=", ["Mag_E"]])

VB Syntax DeleteTraces <TraceSelection>


oModule.DeleteTraces Array("XY Plot 1:=", _
VB Example Array("dB(S(LumpPort1,Lump-
Port1))"), )
"XY Plot 2:=", Array("Mag_E"))

DoesSupportTraceCharacteristics
Determines whether trace characteristics is supported in a specified display type.

UI Access N/A

Name Type Description


Parameters
<DisplayType> String Specified display type to check.

Integer
Return Value l 1 - trace characteristics is supported.
l 0 - trace characteristics not supported.

Reporter Editor Script Commands 13-59


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax DoesSupportTraceCharacteristics(<DisplayType>)


Python Example oModule.DoesSupportTraceCharacteristics("Rectangular Plot")

VB Syntax DoesSupportTraceCharacteristics <DisplayType


VB Example oModule.DoesSupportTraceCharacteristics "Rectangular Plot"

DumpAllReportsData
Dumps all reports data to an Ansoft report data file.

UI Access N/A

Name Type Description


Parameters
<FileName> String File name with path.

Return Value None.

Python Syntax DumpAllReportsData(<FileName>)


Python Example oModule.DumpAllReportsData("C:/ReportsData.rdat")

VB Syntax DumpAllReportsData <FileName>

Reporter Editor Script Commands 13-60


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oModule.DumpAllReportsData "C:/ReportsData.rdat"

EditCartesianXMarker
Edits an XMarker value.

UI Access N/A

Name Type Description


<ReportName> String Name of report.
Parameters
<MarkerName> String Marker name, including any trailing number.
<XValue> Double X coordinate.

Return Value None.

Python Syntax EditCartesianXMarker (<ReportName>, <MarkerName>, <XValue>)


oModule.EditCartesianXMarker ("XY Plot 1", "MX1", 0)
Python Example

VB Syntax EditCartesianXMarker <ReportName>, <MarkerName>, <XValue>


VB Example oModule.EditCartesianXMarker "XY Plot1", "MX1", 0

EditCartesianYMarker
Edits a YMarker value.

UI Access N/A

Reporter Editor Script Commands 13-61


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<ReportName> String Name of report.
<MarkerName> String Marker name, including any trailing number.
Parameters
<AxisName> String Name of axis.
<YValue> Double Y coordinate.
<CurveName> String Name of curve.

Return Value None

Python Syntax EditCartesianYMarker (<ReportName>, <MarkerName>, <AxisName>, <YValue>, <CurveName>)


oModule.EditCartesianYMarker("XY Plot 1", "MY1", "Y1", 0,
Python Example
"dB() : Setup1 : Sweep1")

VB Syntax EditCartesianYMarker <ReportName>, <MarkerName>, <AxisName>, <YValue>, <CurveName>


oModule.EditCartesianYMarker "XY Plot 1", "MY1", "Y1", 0, _
VB Example
"dB() : Setup1 : Sweep1"

EditMarker
Edits a marker on a report.

UI Access N/A

Parameters Name Type Description

Reporter Editor Script Commands 13-62


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ReportName> String Name of report.


<MarkerName> String Marker name, including any trailing number.
<CurveName> String Full trace name.
<PrimarySweepValue> String Primary sweep value, including unit.

Return Value None.

Python Syntax EditMarker( <ReportName>, <MarkerName>, <CurveName>, <PrimarySweepValue>)


oModule.EditMarker("XY Plot 1", "m5",
Python Example "GS1.VAL : TR4 : Cartesian", "3.61599999999997s")

VB Syntax EditMarker <ReportName>, <MarkerName>, <CurveName>, <PrimarySweepValue>


Set oModule = oDesign.GetModule("ReportSetup")
oModule.EditMarker "XY Plot1","m1",
VB Example
"mag(S(Port1 Port1)) : Setup1:
LastAdaptive : Cartesian", "0.3in"

ExportEyeMaskViolation
Exports eye mask violations to a file.

UI Access N/A

Parameters Name Type Description

Reporter Editor Script Commands 13-63


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ReportName> String Name of specified report.


<ExportFileName> String File name to export to.

Return Value N/A

Python Syntax ExportEyeMaskViolation(<ReportName>, <ExportFileName>)


Python Example oModule.ExportEyeMaskViolation("Variables Plot 1", "C:/eyemask1.csv")

VB Syntax ExportEyeMaskViolation <ReportName>, <ExportFileName>


VB Example oModule.ExportEyeMaskViolation "Variables Plot 1", "C:/eyemask1.csv"

ExportImageToFile [Reporter]
Exports a report image in a specified format. In Release 23.1, this command is fully supports -ng (non-graphical) mode.

UI Access N/A

Name Type Description


<ReportName> String Name of report to be exported.
<FileName> String Full path of the exported image file name; with extension of jpg, gif, tiff, tif, bmp,
Parameters
or wrl.
<Width> Integer Image width in pixels; if width or height is less or equal to zero, use the report
window width, or 500 pixels if report window is closed.
<Height> Integer Image height in pixels; if width or height is less or equal to zero, use the report
window height, or 500 pixels report window is closed.

Reporter Editor Script Commands 13-64


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax ExportImageToFile(<ReportName>, <FileName>, <Width>, <Height>)


oModule.ExportImageToFile(
"Rectangular Contour Plot 1",
Python Example
"D:/work/2015/UV-Export/pp1.gif",
0, 0)

VB Syntax ExportImageToFile <ReportName>, <FileName>, <Width>, <Height>


oModule.ExportImageToFile _
VB Example "Rectangular Contour Plot 1", _
"D:/work/2015/UV-Export/pp1.gif", 0, 0

ExportModelImageToFile
Exports the model as an image file (*.avz, *.bmp, *.gif, *.jpeg, *.tiff, *.wrl). In Release 23.1, this command is fully supports -ng (non-
graphical) mode. To export to Ensight use *.avz. For export to Ensight in -ng mode, the corresponding version of Ensight must be
installed. On Linux, it might need manual set environment variable AWP_ROOT212 to its installation path, e.g. AWP_ROOT212-
2=/installations/ansys_inc/v212/ for AnsysEDT v21.2 and Ensight 21.2.
ExportModelImageToFile supports export overlay of polar plot 3D with existing transformation (scaling, rotation and translation) in -ng
(non-graphical) mode.

UI Access Modeler > Export.

Reporter Editor Script Commands 13-65


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<path> String Full file path including extension.
<width> Integer Width in pixels (use 0 for default).
<height> Integer Height in pixels (use 0 for default).
<Parameters> Array Structured array.
Array("NAME:SaveImageParams",
"ShowAxis:=" , <string containing
boolean>,
"ShowGrid:=" , <string containing
boolean>,
Parameters
"ShowRuler:=" , <string containing
boolean>,
"ShowRegion:=" , <string>,
"Selections:=" , <string>,
"FieldPlotSelections:=", <string>' #
Comma delimited string. #Use to set which
field plot to show.
"Orientation:=" , <string>
"ShowOrientationGadget:=" , <False>

Return Value None.

Python Syntax ExportModelImageToFile(<path> <width> <height> <Parameters>)


Python Example oEditor.ExportModelImageToFile

Reporter Editor Script Commands 13-66


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

("C:/Users/jdoe/Desktop/export.bmp",
1920,
1080,
[
"NAME:SaveImageParams",
"ShowAxis:=" , "True",
"ShowGrid:=" , "True",
"ShowRuler:=" , "True",
"ShowRegion:=" , "Default",
"Selections:=" , "",
"FieldPlotSelections:=" , "",
"FitToSelections:=" , "",
"FitToFieldPlotSelections:=", "",
"Orientation:=" , ""
])

VB Syntax ExportModelImageToFile <path> <width> <height> <Parameters>


oEditor.ExportModelImageToFile
"C:/Users/jdoe/Desktop/export.bmp",
VB Example
1383,
512,

Reporter Editor Script Commands 13-67


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:SaveImageParams",
"ShowAxis:=", "True",
"ShowGrid:=", "True",
"ShowRuler:=", "True",
"ShowRegion:=", "Default",
"Selections:=", "",
"FitToFieldPlotSelections:=", "",
"Orientation:=", ""

ExportModelMeshToFile
Exports geometry model to a 3D model file (e.g. *.obj, *.wrl, etc.).

UI Access N/A

Name Type Description


Parameters <filePath> String Full file path, including extension *.obj, *.wrl, etc
<selections> Array Selected parts.

Return Value None.

Python Syntax ExportModelMeshToFile <filePath>, <selections>)


oEditor.ExportModelMeshToFile("E:/MyDir/scriptRun/2Selected-ng.obj", ["BotCover-
Python Example
","AveragingVolumeAtPeakRMSEfieldLocation"])

Reporter Editor Script Commands 13-68


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax ExportModelMeshToFile <filePath>, <selections>


oEditor.ExportModelMeshToFile("E:/MyDir/scriptRun/2Selected-ng.obj", ["BotCover-
VB Example
","AveragingVolumeAtPeakRMSEfieldLocation"])

ExportPlot3DToFile [Reporter]
Use: Exports 3D polar, spherical and rectangular plot to a case file. It works in both graphical and NG mode..
Command: None.
Syntax: ExportPlot3DToFile(<plotName>, <path>)
Return Value: A 3D plot file.
Parameters: <plotName>
Type: <string>
Plot name.
<Path>
Type: <string>
Path to file.

Python Syntax ExportPlot3DToFile(<name> <Path>)


oModule = oDesign.GetModule("ReportSetup")
oModule.UpdateReports(["rE Plot 1"])
Python Example oModule.UpdateReports(["Directivity Plot 1"])
oModule.UpdateReports(["Gain Plot 1"])
oModule.ExportPlot3DToFile("rE Plot 1", "D:/projects/test2-output/rEPlot1.case")

Reporter Editor Script Commands 13-69


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.ExportPlot3DToFile("Directivity Plot 1", "D:/projects/test2-out-


put/DirectivityPlot1.case")
oModule.ExportPlot3DToFile("Gain Plot 1", "D:/projects/test2-out-
put/GainPlot1.case")

VB Syntax ExportPlot3DToFile <plotName> <Path>


VB Example oModule.ExportPlot3DToFile("rE Plot 1", "D:/projects/test2-output/rEPlot1.case")

ExportReport

Note:

The ExportReport script command has been replaced by the script command ExportToFile. ExportReport remains in order
to retain backward compatibility for existing scripts, but it is strongly recommended that you now use ExportToFile.

Export a report to a data file.


Command: None
Syntax: ExportReport <ReportName>, <FileName>, <FileExtension>
Return Value: None
Parameters: <ReportName>
Type: string
<Filename>
Type: string

Reporter Editor Script Commands 13-70


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<FileExtension>
Type: string
VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule

Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")


Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow

Set oProject = oDesktop.SetActiveProject("BJTinverter")


Set oDesign = oProject.SetActiveDesign("Nexxim1")
oDesign.ExportReport "Data Table 1", "table_test", "csv"

Python Syntax ExportReport( <ReportName>, <FileName>)


Python Example oDesign.ExportReport(

Reporter Editor Script Commands 13-71


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Plot1", "c:\report1.dat")

ExportReportDataToFile
Exports report data to a file.

UI Access N/A

Name Type Description


Parameters < ReportName > String Name of specified report.
<ExportFileName> String Name of export file. File extenstion "rdat" is expected.

Return Value None.

Python Syntax ExportReportDataToFile(<ReportName>, <ExportFileName>)


Python Example oModule.ExportReportDataToFile("Plot 1", "C:/Plot1data.rdat")

VB Syntax ExportReportDataToFile <ReportName>, <ExportFileName>


VB Example oModule.ExportReportDataToFile "Plot 1", "C:/Plot1data.rdat"

ExportTableToFile
Exports a marker table from a report to a file.

UI Access Right-click on a plot, select Marker > Export Marker Table... or Export Delta Marker Table...

Reporter Editor Script Commands 13-72


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<ReportName> String Name of specified report.
Parameters
<ExportFileName> String Name of export file.
<TableType> String Type of marker table to export. "Marker" or "DeltaMarker".

Return Value None.

Python Syntax ExportTableToFile(<ReportName>, <ExportFileName>, <TableType>)


Python Example oModule.ExportTableToFile("Plot 1", "C:/Marker.csv", "Marker")

VB Syntax ExportTableToFile <ReportName>, <ExportFileName>, <TableType>


VB Example oModule.ExportTableToFile "Plot 1", "C:/Marker.csv", "Marker"

ExportToFile [Reporter]
From a data table or plot, generates text format, comma delimited, tab delimited, .dat, or .rdat type output files.

UI Access Right-click on report name in the Project tree and select Export.

Name Type Description


<ReportName> String Name of the report
<FileName> String Path and File Name
Parameters Supported formats

.txt Post processor format file


.csv Comma-delimited data file

Reporter Editor Script Commands 13-73


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

.tab Tab-separated file


.dat Ansys plot data file
.rdat Ansys report data file

Return Value None

Python Syntax ExportToFile (<ReportName>, <FileName>)


oModule.ExportToFile(
Python Example
"Plot1", "c:\report1.dat")

VB Syntax ExportToFile <ReportName>, <FileName>


oModule.ExportToFile
VB Example
"Plot1", "c:\report1.dat"

ExportUniformPointsToFile
Exports uniform points from a data table or plot report that includes the Export Uniform Points to File option enabled to text format,
comma delimited, tab delimited, or .dat type output files.

Reporter Editor Script Commands 13-74


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Right-click on report name in the project tree and select Export Data.

Name Type Description


<ReportName> String Name of report to be exported.
<FileName> String Full path of the exported image file name; with extension of
.txt - Post processor format file
.csv - Comma-delimited data file
Parameters .tab - Tab-separated file
.dat - Ansys plot data file
<SweepRange> String Start, stop, and step range with units, for sweep.
<UnitSpec> String For example, “kV, Mhz, yd”
<UseTraceNumberFormat> Boolean "True", "False"

Return Value None.

Reporter Editor Script Commands 13-75


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ExportUniformPointsToFile(<ReportName>, <FileName>, <SweepRange>)


oModule.ExportUniformPointsToFile("S Parameter Table 2", "D:/MyFiles/cftt.csv",
Python Example
"4GHz", "5GHz", "1GHz", False, " kV, MHz, yd ", False)

VB Syntax ExportUniformPointsToFile <ReportName>, <FileName>


oModule.ExportUniformPointsToFile "rETheta and rEPhi [dB]", "C:/MyFiles/rETheta
VB Example
and rEPhi [dB].csv", "-180deg", "180deg", "36deg"

GetAllCategories
Get all available category names (not including variable and output-variables) in a solution for a report type and display type, returned
as an array of text strings.

UI Access NA

Name Type Description


<ReportType> String Report type name.
Parameters <DisplayType> String Name of display type.
<SolutionName> String Name of solution.
<SimValueCtxt> Array A context name, or array of strings that encode the contexts.

Return Value Array of text strings

Reporter Editor Script Commands 13-76


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetAllCategories(<ReportType>, <DisplayType>, <SolutionName>, <SimValueCtxt>)


oModule.GetAllCategories("Far Fields",
Python Example
"Rectangular Plot", "Setup1 : LastAdaptive", "Infinite Sphere1")

VB Syntax GetAllCategories <ReportType>, <DisplayType>, <SolutionName>, <SimValueCtxt>


oModule.GetAllCategories _
VB Example "Far Fields", "Rectangular Plot", _
"Setup1 : LastAdaptive", "Infinite Sphere1"

GetAllQuantities
Gets all available quantity names in category, returned as an array of text strings.

UI Access NA

Name Type Description


<ReportType> String Report type name.
<DisplayType> String Display type name.
Parameters <SolutionName> String Name of solution.
<SimValueCtxt> Array A context name, or array of string that encoded the contexts(I).
<CategoryName> String A category name as input parameter. a category name returned in GetAllCat-
egories() or "Vari-ables", or "Output Variables"

Return Value Array of text strings

Reporter Editor Script Commands 13-77


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetAllQuantities(<ReportType>,<DisplayType>, <SolutionName>, <SimValueCtxt>, <CategoryName>)


oModule.GetAllQuantities(
"Far Fields", "Rectangular Plot",
Python Example "Setup1 : LastAdaptive",
"Infinite Sphere1", "Gain")

VB Syntax GetAllQuantities <ReportType>,<DisplayType>, <SolutionName>, <SimValueCtxt>, <CategoryName>


oModule.GetAllQuantities _
"Far Fields", "Rectangular Plot", _
VB Example "Setup1 : LastAdaptive", )
"Infinite Sphere1", "Gain"

GetAllReportNames
Gets the names of existing reports in a design

UI Access N/A
Parameters None.
Return Value Array of report names

Reporter Editor Script Commands 13-78


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetAllReportNames()


Python Example oModule.GetAllReportNames()

VB Syntax GetAllReportNames
VB Example oModule.GetAllReportNames

GetAvailableDisplayTypes
Retrieves all supported display types in report type as an array of text strings.

UI Access N/A

Name Type Description


Parameters
<ReportType> String Report type name.

Return Value Array of text strings

Python Syntax GetAvailableDisplayTypes(<ReportType>)


Python Example oModule.GetAvailableDisplayTypes("Far Fields")

VB Syntax GetAvailableDisplayTypes <ReportType>


VB Example oModule.GetAvailableDisplayTypes "Far Fields"

Reporter Editor Script Commands 13-79


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetAvailableReportTypes
Retrieves all available report types in the current Design as an array of text string.

UI Access N/A
Parameters None.
Return Value Array of text strings

Python Syntax GetAvailableReportTypes()


Python Example oModule.GetAvailableReportTypes()

VB Syntax GetAvailableReportTypes
VB Example oModule.GetAvailableReportTypes

GetAvailableSolutions
Gets all available solutions in report type as an array of text strings.

UI Access N/A

Name Type Description


Parameters
<ReportType> String Report type name.

Return Value Array of text strings

Reporter Editor Script Commands 13-80


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetAvailableSolutions(<ReportType>)


Python Example oModule.GetAvailableSolutions("Far Fields")

VB Syntax GetAvailableSolutions <ReportType>


VB Example oModule.GetAvailableSolutions "Far Fields"

GetChildNames [Report Setup]


Gets a list of report names.

UI Access N/A
Parameters None.
Return Value Array of strings containing all report names.

Python Syntax GetChildNames()


Python Example oModule.GetChildNames()

VB Syntax GetChildNames
VB Example oModule.GetChildNames

Reporter Editor Script Commands 13-81


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetChildObject [Report Setup]


Gets a report object or report child object; the module’s first level of child object is report. Report has trace, axis, header, Legend, and
more children. Trace has curve as child etc. Those child objects can be accessed by calling all levels of parent object’s GetChildObject
(path) function.

UI Access NA

Name Type Description


Parameters
<ObjectPath> String Report Name or an object path beginning with a report name.

Return Value A ReportSetup(Results) Module Child Object, [ReportSetup(Results) Module Child Objects ]

Python Syntax GetChildObject(<ObjectPath>)


oRpt = oRptModule.GetChildObject("S Parameter Plot 1")
oTrace = oRptModule.GetChildObject("S Parameter Plot 1/dB(S(Port1,Port1))")
Python Example
oAxisX = oRptModule.GetChildObject("S Parameter Plot 1/AxisX")

VB Syntax GetChildObject <ObjectPath>


set oRpt = oRptModule.GetChildObject "S Parameter Plot 1"
VB Example set oTrace = oRptModule.GetChildObject "S Parameter Plot 1/dB(S(Port1,Port1))"
set oAxisX = oRptModule.GetChildObject "S Parameter Plot 1/AxisX"

Reporter Editor Script Commands 13-82


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetChildTypes [ReportSetup]
Gets child types of queried Report module object.

UI Access N/A
Parameters None.
Return Value Array of strings containing child object types.

Python Syntax GetChildTypes ()


Python Example oModule.GetChildTypes()

VB Syntax GetChildTypes
VB Example oModule.GetChildTypes

GetCurvePropServerName
Gets the PropServer (the owner of the properties, or the list containing them) name of a curve.

UI Access N/A

Name Type Description


Parameters <ReportName> String Name of specified report.
<TraceName> String Name of specified trace.

Return Value Array of string containing the PropServer name.

Reporter Editor Script Commands 13-83


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetCurvePropServerName(<ReportName>, <TraceName>)


Python Example oModule.GetCurvePropServerName("Plot 1", "Phase")

VB Syntax GetCurvePropServerName <ReportName>, <TraceName>


VB Example oModule.GetCurvePropServerName "Plot 1", "Phase"

GetDisplayType
Gets the display type of a specified report.

UI Access NA

Name Type Description


Parameters
<ReportName> String Report name

Return Value String containing display type.

Python Syntax GetDisplayType(<ReportName>)


oModule.GetDisplayType("Design Plot 1")
Python Example

VB Syntax GetDisplayType <ReportName>


VB Example oModule.GetDisplayType "Design Plot 1"

Reporter Editor Script Commands 13-84


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetDynLinkIntrinsicVariables
Gets variable names from a trace included in dynamic link outputs.

UI Access N/A

Name Type Description


Parameters
<TraceName> String Trace name with its report name.

Return Value Array of variable names

Python Syntax GetDynLinkIntrinsicVariables(<TraceName>)


Python Example oModule.GetDynLinkIntrinsicVariables("Plot 1:Trace")

VB Syntax GetDynLinkIntrinsicVariables <TraceName>


VB Example oModule.GetDynLinkIntrinsicVariables "Plot 1:Trace")

GetDynLinkQtyValueState
Gets the state of the quantity values from a source dynamic linked trace.

UI Access N/A

Name Type Description


Parameters <TraceName> String Name of specified source trace.
<QtyName> String Name of specified quantity value.

Return Value Array of strings containing states.

Reporter Editor Script Commands 13-85


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetDynLinkQtyValueState(<TraceName>, <QtyName>)


Python Example oModule.GetDynLinkQtyValueState("Plot 1:Trace1", "")

VB Syntax GetDynLinkQtyValueState <TraceName>, <QtyName>


VB Example oModule.GetDynLinkQtyValueState "Plot 1:Trace1", ""

GetDynLinkTraces
Gets the names of the dynamic linked traces.

UI Access N/A

Name Type Description


Parameters
<SoluName> String Name of the source solution. If empty, refer to current solution.

Return Value Array of strings containing trace names.

Python Syntax GetDynLinkTraces(<SoluName>)


Python Example oModule.GetDynLinkTraces("")

VB Syntax GetDynLinkTraces <SoluName>

Reporter Editor Script Commands 13-86


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oModule.GetDynLinkTraces ""

GetDynLinkVariableValues
Gets the values of a variable from a dynamic linked trace.

UI Access N/A

Name Type Description


Parameters <TraceName> String Name of specified dynamic linked trace, with its report name.
<VarName> String Name of specified variable.

Return Value Array of strings containing variable values.

Python Syntax GetDynLinkVariableValues(<TraceName>, <VarName>)


Python Example oModule.GetDynLinkVariableValues("Plot 1:Trace", "Var1")

VB Syntax GetDynLinkVariableValues <TraceName>, <VarName>


VB Example oModule.GetDynLinkVariableValues "Plot 1:Trace", "Var1"

GetName
Returns the name of the active design.

UI Access N/A
Parameters None.

Reporter Editor Script Commands 13-87


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value String indicating the name of the active design.

Python Syntax GetName()


Python Example design_name = oDesign.GetName()

VB Syntax GetName
VB Example design_name = oDesign.GetName

GetObjPath [Design]
Obtains the path to the design.

UI Access N/A
Parameters None.
Return Value String containing the path to the design.

Python Syntax GetObjPath()


Python Example oDesign.GetObjPath()

Reporter Editor Script Commands 13-88


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetObjPath
VB Example oDesign.GetObjPath

GetPropertyValue
Returns the value of a single property belonging to a specific <PropServer> and <PropTab>. This function is available with the Pro-
ject, Design or Editor objects, including definition editors.

Tip:

Use the script recording feature and edit a property, and then view the resulting script to see the format for that property.

UI Access N/A

Name Type Description


<PropTab> String One of the following, where tab titles are shown in parentheses:
l PassedParameterTab ("Parameter Values")
l DefinitionParameterTab (Parameter Defaults")
l LocalVariableTab ("Variables" or "Local Variables")
l ProjectVariableTab ("Project variables")

Parameters l ConstantsTab ("Constants")


l BaseElementTab ("Symbol" or "Footprint")
l ComponentTab ("General")
l Component("Component")
l CustomTab ("Intrinsic Variables")
l Quantities ("Quantities")
l Signals ("Signals")

Reporter Editor Script Commands 13-89


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<PropServer> String An object identifier, generally returned from another script method, such as
Comp-Inst@R;2;3
<PropName> String Name of the property.

Return Value String value of the property.

Python Syntax GetPropertyValue (<PropTab>, <PropServer>, <PropName>)


selectionArray = oEditor.GetSelections()
for k in selectionArray:
Python Example
val = oEditor.GetPropertyValue("PassedParameterTab", k, "R")
...

VB Syntax GetPropertyValue (<PropTab>, <PropServer>, <PropName>)


selectionArray = oEditor.GetSelections
for k in selectionArray:
VB Example
val = oEditor.GetPropertyValue("PassedParameterTab", k, "R")
...

GetPropNames [Reporter]
Report setup module does not have its own property, this function always returns empty array.

Reporter Editor Script Commands 13-90


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A
Parameters None.
Return Value Empty array.

Python Syntax GetPropNames()


Python Example oModule.GetPropNames()

VB Syntax GetPropNames
VB Example oModule.GetPropNames

GetPropValue [Report Setup]


Gets the property value for a Report, or reports’ child object.

UI Access N/A

Name Type Description


Parameters
<PropPath> String A child object's property path. See property path discussion here.

Return Value String containing the property value.

Python Syntax GetPropValue(<PropPath>)


Python Example oModule.GetPropValue(“S Parameter Plot 1/Display Type”)

Reporter Editor Script Commands 13-91


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetPropValue <PropPath>


VB Example oModule.GetPropValue “S Parameter Plot 1/Display Type”

GetQtyExpressionsForSourceTrace
Gets the quantity expressions from a specified source trace.

UI Access N/A

Name Type Description


Parameters
<SourceTraceName> String Name of specified source trace.

Return Value Array of strings containing quantity expressions.

Python Syntax GetQtyExpressionsForSourceTrace(<SourceTraceName>)


Python Example oModule.GetQtyExpressionsForSourceTrace("Plot 1:Trace1")

VB Syntax GetQtyExpressionsForSourceTrace <SourceTraceName>


VB Example oModule.GetQtyExpressionsForSourceTrace "Plot 1:Trace1"

GetReportTraceNames
Gets the names of existing trace names in a plot.

Reporter Editor Script Commands 13-92


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A

Name Type Description


Parameters
<PlotName> String Name of specified plot.

Return Value Array of strings containing trace names.

Python Syntax GetReportTraceNames(<PlotName>)


Python Example oModule.GetReportTraceNames("SParameter Plot 1")

VB Syntax GetReportTraceNames <PlotName>


VB Example oModule.GetReportTraceNames "SParameter Plot 1"

GetReportSummaryForRegressionTesting
Gets report summary from a dumped report file.

UI Access N/A

Name Type Description


Parameters
<ReportName> String Name of a specified dumped report.

Return Value String containing report summary.

Python Syntax GetReportSummaryForRegressionTesting(<ReportName>)

Reporter Editor Script Commands 13-93


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Example oModule.GetReportSummaryForRegressionTesting("C:/report.rdat")

VB Syntax GetReportSummaryForRegressionTesting <ReportName>


VB Example oModule.GetReportSummaryForRegressionTesting "C:/report.rdat"

GetSolutionContexts
Gets all available solution context names in a solution as an array of text strings.

UI Access N/A

Name Type Description


<ReportType> String Report type name.
Parameters
<DisplayType> String Display type name.
<SolutionName> String Name of solution.

Return Value Array of text strings

Python Syntax GetSolutionContexts(<ReportType>, <DisplayType>, <SolutionName>)


oModule.GetSolutionContexts(
Python Example
"Far Fields", "Rectangular Plot", "Setup1:LastAdaptive")

VB Syntax GetSolutionContexts <ReportType>, <DisplayType>, <SolutionName>

Reporter Editor Script Commands 13-94


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.GetSolutionContexts _
VB Example "Far Fields", "Rectangular Plot", _
"Setup1:LastAdaptive"

GetSolutionDataPerVariation
Obtains solution data for a given report type and solution. You must have already run a simulation.

UI Access N/A

Name Type Description


<reportTypeArg> String Report type name as input parameter.
<solutionNameArg> String Solution name as input parameter.
<simValueCtxtArg> Structured Array Same as ContextArray values created in the relevant
Parameters CreateReport script.
<familiesArg> Array of Strings Same as FamiliesArray values created in the relevant
CreateReport script.
<expressionArg> String or Array of Text string or array of text strings; valid expression, may val-
Strings idate it as the data-table Y-component.

ARRAY of ISolutionDataResultComInterface objects, containing:


l GetSweepNames()
l GetSweepUnits()
l GetSweepValues()
Return Value
l IsPerQuantityPrimarySweep()
l GetDataExpressions() – should be the same as <expressionArg>
l GetPerQuantityPrimarySweepValues()
l IsDataComplex()

Reporter Editor Script Commands 13-95


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l GetDataUnits()
l GetRealDataValues()
l GetImagDataValues()
l ReleaseData()
l GetDesignVariableNames()
l GetDesignVariableUnits()
l GetDesignVariableValue()
l GetDesignVariationKey()

Note:
l This command is not recordable from the UI, but its parameters are similar to CreateReport, so you may record a
CreateReport script to get the parameter values.
l For the returned ISolutionDataResultComInterface object, some of its functions have an optional boolean para-
meter: SIValue. SIValue defaults to True. When the pass in value is True, return data values will be in Standard Inter-
national values; when False, return data values will be in the current units.

Example: Freq Sweep with [1GHz, 2GHz,3GHz], GetSweepUnits(“Freq”) return “GHz”; GetSweepValues(“Freq”,
True) return [1000000,2000000,3000000]; GetSweepValues(“Freq”, False) return [1,2,3].

GetSolutionDataPerVariation(reportTypeArg, solutionNameArg, simValueCtxtArg, familiesArg, expres-


Python Syntax
sionArg)
oModule = oDesign.GetModule("ReportSetup")
Python Example
arr = oModule.GetSolutionDataPerVariation('Modal Solution Data', 'Setup1 :

Reporter Editor Script Commands 13-96


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Sweep', ['Domain:=', 'Sweep'], ['Freq:=', ['All'], 'offset:=', ['All']], ['S


(Port1,Port1)', 'dB(S(Port1,Port3))'])

GetSolutionDataPerVariation(reportTypeArg, solutionNameArg, simValueCtxtArg, familiesArg, expres-


VB Syntax
sionArg)
set solutionData = oModule.GetSolutionDataPerVariation(
"Modal Solution Data",
"Setup1 : Sweep",
VB Example Array("Domain:=", "Sweep"),
Array("Freq:=", Array("All"), "offset:=", Array("All")),
Array("S(Port1,Port1)", "dB(S(Port1,Port3))")
)

GetDataExpressions
Returns data expressions.

Important:

This script does not function on its own, but as part of GetSolutionDataPerVariation.

UI Access N/A
Parameters N/A
Return Value Array of text strings

Reporter Editor Script Commands 13-97


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetDataExpressions()


expressions = oModule.GetDataExpressions()
Python Example

VB Syntax GetDataExpressions()
dim expressions
VB Example
expressions = oModule.GetDataExpressions()

GetDataUnits
Returns text string containing units.

Important:

This script does not function on its own, but as part of GetSolutionDataPerVariation.

UI Access N/A

Name Type Description


Parameters
<expressionString> String Can be returned from GetDataExpressions()

Return Value Text string of units; empty if no units

Python Syntax GetDataUnits(<expressionString>)

Reporter Editor Script Commands 13-98


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.GetDataUnits(expressions)
Python Example

VB Syntax GetDataUnits(<expressionString>)
VB Example oModule.GetDataUnits(expressions)

GetDesignVariableNames
Returns array of strings containing design variable names.

Important:

This script does not function on its own, but as part of GetSolutionDataPerVariation.

UI Access NA
Parameters NA
Return Value Array of strings

Python Syntax GetDesignVariableNames()


names = oModule.GetDesignVariableNames()
Python Example

VB Syntax GetDesignVariableNames()

Reporter Editor Script Commands 13-99


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

dim names
VB Example
names = oModule.GetDesignVariableNames()

GetDesignVariableUnits
Returns array of strings containing design variable units.

Important:

This script does not function on its own, but as part of GetSolutionDataPerVariation.

UI Access N/A

Name Type Description


Parameters
<varName> String Can be returned from GetDesignVariableNames()

Return Value Text string of units; empty if no units.

Python Syntax GetDesignVariableUnits(<varName>)


units = oModule.GetDesignVariableUnits('Variable Name')
Python Example

VB Syntax GetDesignVariableUnits(<varName>)

Reporter Editor Script Commands 13-100


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

dim units
VB Example
units = oModule.GetDesignVariableUnits("Variable Name")

GetDesignVariableValue
Returns a design variable's value.

Important:

This script does not function on its own, but as part of GetSolutionDataPerVariation.

UI Access N/A

Name Type Description


Parameters <varName> String Can be returned from GetDesignVariableNames()
<siValue> Boolean True to return SI-value; False to return by GetDesignVariableUnits()

Return Value Double value

Python Syntax GetDesignVariableValue(<varName>, <siValue>)


value = oModule.GetDesignVariableValue('varName',1)
Python Example

VB Syntax GetDesignVariableValue(<varName>, <siValue>)


dim value
VB Example
value = oModule.GetDesignVariableValue("varName", True)

Reporter Editor Script Commands 13-101


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetDesignVariationKey
Returns a design's Variation Key.

Important:

This script does not function on its own, but as part of GetSolutionDataPerVariation.

UI Access N/A
Parameters N/A
Return Value String containing variation key.

Python Syntax GetDesignVariationKey()


oModule.GetDesignVariationKey()
Python Example

VB Syntax GetDesignVariationKey()
dim key
VB Example
set key = oModule.GetDesignVariationKey()

GetImagDataValues
Returns array of imaginary data values.

Reporter Editor Script Commands 13-102


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Important:

This script does not function on its own, but as part of GetSolutionDataPerVariation.

UI Access N/A

Name Type Description


Parameters
<expressionString> String Can be returned from GetDataExpressions()
<siValue> Boolean True to return SI-value; False to return with units returned in
GetSweepUnits().

Return Value Array of doubles

Python Syntax GetImagDataValues(<expressionString>,<siValue>)


imaginaryvalues = oModule.GetImagDataValues('expression',1)
Python Example

VB Syntax GetImagDataValues(<expressionString>,<siValue>)
dim imaginaryvalues
VB Example
imaginaryvalues = oModule.GetImagDataValues("expression",True)

GetPerQuantityPrimarySweepValues
Returns per quantity primary sweep values.

Reporter Editor Script Commands 13-103


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Important:

This script does not function on its own, but as part of GetSolutionDataPerVariation.

UI Access N/A

Name Type Description


Parameters <expressionString> String Can be returned from GetDataExpressions().
<siValue> Boolean True to return SI-value; False to return by GetSweepUnits().

Return Value Array of doubles if IsPerQuantityPrimarySweep() returned True; error if returned False

Python Syntax GetPerQuantitySweepValues(<expressionString>, <siValue>)


sweepvalues = oModule.GetPerQuantitySweepValues('0.111,0.201,0.345,0.231', 1)
Python Example

VB Syntax GetPerQuantitySweepValues(<expressionString>, <siValue>)


dim sweepvalues
VB Example
sweepvalues = oModule.GetPerQuantitySweepValues("0.111,0.201,0.345,0.231", True)

GetRealDataValues
Returns array of real data values.

Reporter Editor Script Commands 13-104


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Important:

This script does not function on its own, but as part of GetSolutionDataPerVariation.

UI Access N/A

Name Type Description


Parameters
<expressionString> String Can be returned from GetDataExpressions()
<siValue> Boolean True to return SI-value; False to return with units returned in
GetSweepUnits().

Return Value Array of doubles

Python Syntax GetRealDataValues(<expressionString>,<siValue>)


realvalues = oModule.GetRealDataValues('expression',1)
Python Example

VB Syntax GetRealDataValues(<expressionString>,<siValue>)
dim realvalues
VB Example
realvalues = oModule.GetRealDataValues("expression",True)

GetSweepNames
Returns array of text strings containing primary sweep name(s).

Reporter Editor Script Commands 13-105


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Important:

This script does not function on its own, but as part of GetSolutionDataPerVariation.

UI Access N/A
Parameters N/A
Return Value Array of text strings

Python Syntax GetSweepNames()


sweepnames = oModule.GetSweepNames()
Python Example

VB Syntax GetSweepNames()
dim sweepnames
VB Example
sweepnames = oModule.GetSweepNames()

GetSweepUnits
Returns text string containing units.

Reporter Editor Script Commands 13-106


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Important:

This script does not function on its own, but as part of GetSolutionDataPerVariation.

UI Access N/A

Name Type Description


Parameters
<sweepName> String Primary sweep name

Return Value Text string containing units

Python Syntax GetSweepUnits(<sweepName>)


sweepunits = oModule.GetSweepUnits('Sweep 1')
Python Example

VB Syntax GetSweepUnits(<sweepName>)
dim sweepunits
VB Example
sweepunits = oModule.GetSweepUnits("Sweep 1")

GetSweepValues
Returns sweep values.

Reporter Editor Script Commands 13-107


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Important:

This script does not function on its own, but as part of GetSolutionDataPerVariation.

UI Access N/A

Name Type Description


Parameters <sweepName> String Primary sweep name
<siValue> Boolean True to return SI-value; False to return by GetSweepUnits().

Return Value Array of doubles

Python Syntax GetSweepValues(<sweepName>, <siValue>)


sweepvalues = oModule.GetSweepValues('Sweep 1', True)
Python Example

VB Syntax GetSweepValues(<sweepName>, <siValue>)


dim sweepvalues
VB Example
sweepvalues = oModule.GetSweepValues("Sweep 1", True)

IsDataComplex
Returns whether an expression is complex.

Reporter Editor Script Commands 13-108


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Important:

This script does not function on its own, but as part of GetSolutionDataPerVariation.

UI Access NA

Name Type Description


Parameters
<expressionString> String Can be returned from GetDataExpressions().

Return Value Boolean (True if expression is Complex data; False if not)

Python Syntax IsDataComplex(<expressionString>)


oModule.IsDataComplex('.001,.234,.455,.434')
Python Example

VB Syntax IsDataComplex(<expressionString>)
VB Example oModule.IsDataComplex('.001,.234,.455,.434')

IsPerQuantityPrimarySweep
Returns whether data expressions have different primary sweep values.

Important:

This script does not function on its own, but as part of GetSolutionDataPerVariation.

Reporter Editor Script Commands 13-109


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A
Parameters N/A
Return Value Boolean (True if data expressions have different primary sweep values)

Python Syntax IsPerQuantityPrimarySweep()


var = oModule.IsPerQuantityPrimarySweep()
Python Example

VB Syntax IsPerQuantityPrimarySweep()
dim var
VB Example
var = oModule.IsPerQuantityPrimarySweep()

Release Data
Releases all cached data. After this function is called, all subsequent function calls to the object will fail.

Important:

This script does not function on its own, but as part of GetSolutionDataPerVariation.

UI Access N/A
Parameters N/A

Reporter Editor Script Commands 13-110


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value N/A

Python Syntax ReleaseData()


oModule.ReleaseData()
Python Example

VB Syntax ReleaseData()
VB Example oModule.ReleaseData()

GroupPlotCurvesByGroupingStrategy
Groups curves in a Stacked Plot automatically based on a curve grouping strategy.

UI Access N/A

Name Type Description


Parameters <ReportName> String Name of report.
<GroupStrategy> String Strategy for grouping, "Single", "By Trace" or "By Units".

Return Value None.

Python Syntax GroupPlotCurvesByGroupingStrategy(<ReportName>, <GroupStrategy>)


Python Example oModule.GroupPlotCurvesByGroupingStrategy("Transient Plot 1", "By Trace")

Reporter Editor Script Commands 13-111


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GroupPlotCurvesByGroupingStrategy <ReportName>, <GroupStrategy>


VB Example oModule.GroupPlotCurvesByGroupingStrategy "Transient Plot 1", "By Trace"

ImportIntoReport
Imports .tab, .csv, and .dat format files into a report.

UI Access Right-click on report name in the Project tree and select Import....

Name Type Description


<ReportName> String Name of the Report
<FileName> String Path and File Name
Parameters
.csv Comma-delimited data file
.tab Tab-separated file
.dat Ansys plot data file

Return Value None

Python Syntax ImportIntoReport (<ReportName>, <FileName>)


oDesign.ImportIntoReport ("Plot1", "c:\report1.dat")
Python Example

VB Syntax ImportIntoReport <ReportName>, <FileName>


VB Example oDesign.ImportIntoReport "Plot1", "c:\report1.dat"

Reporter Editor Script Commands 13-112


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ImportReportDataIntoReport
Imports report data from a file into a specified report.

UI Access N/A

Name Type Description


Parameters <ReportName> String Name of specified report.
<FileName> String Name of specified data file. File extenstion "rdat" is expected.

Return Value None.

Python Syntax ImportReportDataIntoReport(<ReportName>, <FileName>)


Python Example oModule.ImportReportDataIntoReport("Plot 1", "C:/Plot1data.rdat")

VB Syntax ImportReportDataIntoReport <ReportName>, <FileName>


VB Example oModule.ImportReportDataIntoReport "Plot 1", "C:/Plot1data.rdat"

MovePlotCurvesToGroup
In a Stacked Plot move curve(s) from its stack(s) to an existing stack. Here term ‘group’ is synonymous to ‘stack’ in the context of
cartesian stacked plot.

UI Access N/A

Name Type Description


Parameters <ReportName> String Name of report.
<CurveArray> Array Array of curve names to move.

Reporter Editor Script Commands 13-113


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<StackName> String Name of stack to move to.

Return Value None.

Python MovePlotCurvesToGroup(<ReportName>, <CurveArray>, <StackName>)


Syntax

Python oModule.MovePlotCurvesToGroup("XY Stacked Plot 1", ["R2.V : TR", "R2.I : TR"], "Stack
Example 2")

VB Syntax MovePlotCurvesToGroup <ReportName>, <CurveArray>, <StackName>


oModule.MovePlotCurvesToGroup _
"XY Stacked Plot 1", _
VB Example
Array("R2.V : TR", "R2.I : TR"), _
"Stack 2"

MovePlotCurvesToNewGroup
Move curve(s) from its stack(s) to a new stack. Here term ‘group’ is synonymous to ‘stack’ in the context of Cartesian stacked plot.

UI Access N/A

Name Type Description


Parameters <ReportName> String Name of report.
<CurveArray> Array Array of curve names to move.

Reporter Editor Script Commands 13-114


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax MovePlotCurvesToNewGroup (<ReportName>, <CurveArray>)


oModule.MovePlotCurvesToNewGroup(
Python Example "XY Stacked Plot 1",
["R2.V : TR", "R2.I : TR"])

VB Syntax MovePlotCurvesToNewGroup <ReportName>, <CurveArray>


oModule.MovePlotCurvesToNewGroup _
VB Example "XY Stacked Plot 1", _
Array("R2.V : TR", "R2.I : TR")

OpenWindowForAllReports
Opens windows for all reports belong to current design.

UI Access N/A
Parameters None.
Return Value None.

Python Syntax OpenWindowForAllReports()

Reporter Editor Script Commands 13-115


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Example oModule.OpenWindowForAllReports()

VB Syntax OpenWindowForAllReports
VB Example oModule.OpenWindowForAllReports

OpenWindowForReports
Opens windows for specified reports.

UI Access N/A

Name Type Description


Parameters
<ReportNames> Array Array of strings containing report names.

Return Value None.

Python Syntax OpenWindowForReports(<ReportNames>)


Python Example oModule.OpenWindowForReports(["Report1", "Report2"])

VB Syntax OpenWindowForReports <ReportNames>


VB Example oModule.OpenWindowForReports Array("Report1", "Report2")

Reporter Editor Script Commands 13-116


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

PastePlotSettings
Paste plot settings to a specified report.

UI Access Right-click a report, select Paste

Name Type Description


Parameters <ReportName> String Name of specified report.
<PropTypeToApply> String Property type to paste. "Graphical", "Data", or "All".

Return Value None.

Python Syntax PastePlotSettings(<ReportName>, <PropTypeToApply>)


Python Example oModule.PastePlotSettings("Plot 1", "Graphical")

VB Syntax PastePlotSettings <ReportName>, <PropTypeToApply>


VB Example oModule.PastePlotSettings "Plot 1", "Graphical"

PasteReports
Paste copied reports to results in the current project.

UI Access Edit > Paste


Parameters None.
Return Value None.

Reporter Editor Script Commands 13-117


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax PasteReports ()


oModule.PasteReports()
Python Example

VB Syntax PasteReports
VB Example oModule.PasteReports

PasteReportsWithLegacyNames
Pastes copied reports to results in the current project with legacy name definitions.

UI Access N/A
Parameters None.
Return Value None.

Python Syntax PasteReportsWithLegacyNames ()


oModule.PasteReportsWithLegacyNames()
Python Example

VB Syntax PasteReportsWithLegacyNames
VB Example oModule.PasteReportsWithLegacyNames

Reporter Editor Script Commands 13-118


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

PasteTraces
Pastes copied traces to a named plot.

UI Access Paste

Name Type Description


Parameters
<ReportName> String Name of plot

Return Value None

Python Syntax PasteTraces (<ReportName>)


Python Example oModule.PasteTraces ("XY Plot1")

VB Syntax PasteTraces <ReportName>


VB Example oModule.PasteTraces "XY Plot1"

PasteTracesWithLegacyNames
Pastes copied traces to a named plot using legacy name definitions.

UI Access N/A

Name Type Description


Parameters
<ReportName> String Name of plot

Return Value None

Reporter Editor Script Commands 13-119


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax PasteTracesWithLegacyNames (<ReportName>)


oModule.PasteTracesWithLegacyNames("XY Plot1")
Python Example

VB Syntax PasteTracesWithLegacyNames <ReportName>


VB Example oModule.PasteTracesWithLegacyNames "XY Plot1"

RenameReport
Renames an existing report.

UI Access Select a report on the Project tree, right-click and select Rename

Name Type Description


Parameters <OldReportName> String Old Report Name
<NewReportName> String New Report Name

Return Value None.

Python Syntax RenameReport (<OldReportName>, <NewReportName>)


oModule.RenameReport("XY Plot1", "Reflection")
Python Example

Reporter Editor Script Commands 13-120


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax RenameReport <OldReportName>, <NewReportName>


VB Example oModule.RenameReport "XY Plot1", "Reflection"

RenameTrace
To rename a trace in a plot

UI Access N/A

Name Type Description


<ReportName> String Name of report.
Parameters
<TraceName> String Name of Trace
<NewName> String New trace name.

Return Value None.

Python Syntax RenameTrace(<ReportName>, <TraceName>, <NewName>)


oModule.RenameTrace ("XY Plot1",
Python Example
"dB(S(WavePort1,WavePort1))1", "Port1dbS")

VB Syntax RenameTrace <ReportName>, <TraceName>, <NewName>


oModule.RenameTrace "XY Plot1", _
VB Example "dB(S(WavePort1,WavePort1))1", _
"Port1dbS"

Reporter Editor Script Commands 13-121


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ResetPlotSettings
Resets plot settings to defaults.

UI Access Right-click on a plot, select Edit > Reset Plot Settings

Name Type Description


Parameters
<PlotName> String Name of specified plot.

Return Value None.

Python Syntax ResetPlotSettings(<PlotName>)


Python Example oModule.ResetPlotSettings("Differential S-parameters")

VB Syntax ResetPlotSettings <PlotName>


VB Example oModule.ResetPlotSettings("Differential S-parameters")

SavePlotSettingsAsDefault
Saves report plot settings as default.

UI Access Report Templates > Save Settings as Default

Name Type Description


Parameters
<PlotName> String Name of plot to use for plot defaults.

Reporter Editor Script Commands 13-122


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax SavePlotSettingsAsDefault ("<PlotName>")


Python Example oModule.SavePlotSettingsAsDefault ("XY Plot1")

VB Syntax SavePlotSettingsAsDefault "<PlotName>"


VB Example oModule.SavePlotSettingsAsDefault "XY Plot 1"

SetLinkOutputTraces
Specifies dynamic link output traces from the current design.

UI Access Right-click the Results, select Link Output...

Name Type Description


<TraceArray> Array Array of traces to set.
Parameters
Array("<ReportName>:=", <array of trace names>,
"<ReportName>:=", <array of trace names>,...)

Return Value None.

Python Syntax SetLinkOutputTraces(<TraceArray>)


Python Example oModule.SetLinkOutputTraces(

Reporter Editor Script Commands 13-123


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"Plot 1:=", ["Trace1"],
"Plot 2:=", ["Trace1"]
])

VB Syntax SetLinkOutputTraces <TraceArray>


oModule.SetLinkOutputTraces _
VB Example Array("Plot 1:=", Array("Trace1"), _
"Plot 2:=", Array("Trace1"))

SetPropValue [Report Setup]


Sets the property value for report module child object.

UI Access Select Edit Properties on Report objects.

Name Type Description


Parameters
<PropPath> String A child object's property path. See property path discussion
here.
<NewValue> String, Number, or Boolean New value data type is depending on the property type,

Return Value True if the property is found and the new value is valid. Otherwise return False.

Python SetPropValue(<PropPath>, <NewValue>)

Reporter Editor Script Commands 13-124


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax

Python
oRptModule.SetPropValue(“S Parameter Plot 1/Display Type”, “DataTable”)
Example oRptModule.SetPropValue(“S Parameter Plot 1/db(S(port1,port2)/Primary sweep”, “Freq”)

VB Syn- SetPropValue <PropPath>, <NewValue>


tax

oRptModule.SetPropValue “S Parameter Plot 1/Display Type”, “DataTable”


VB
Example oRptModule.SetPropValue “S Parameter Plot 1/db(S(port1,port2)/Primary sweep”, “Freq”

UnGroupPlotCurvesInGroup
From a Stacked Plot, ungroups curves in a stack.

UI Access N/A

Name Type Description


Parameters <ReportName> String Name of report.
<GroupName> String Stack group name.

Return Value None.

Python Syntax UnGroupPlotCurvesInGroup(<ReportName>, <GroupName>)


Python Example oModule.UngroupPlotCurvesInGroup("S Parameter Plot 3", "Stack 1")

Reporter Editor Script Commands 13-125


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax UnGroupPlotCurvesInGroup <ReportName>, <GroupName>


VB Example oModule.UngroupPlotCurvesInGroup "S Parameter Plot 3", "Stack 1"

UpdateAllReports
Updates all reports in the Results branch in the project tree.

UI Access Right-click on Results in the project tree, select Update All Reports
Parameters None
Return Value None

Python Syntax UpdateAllReports()


Python Example oModule.UpdateAllReports()

VB Syntax UpdateAllReports
VB Example oModule.UpdateAllReports

UpdateReports
Updates specified reports.

UI Access N/A

Reporter Editor Script Commands 13-126


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


Parameters
<ReportNames> Array Array of strings containing report names.

Return Value None.

Python Syntax UpdateReports(<ReportNames>)


Python Example oModule.UpdateReports (["XY Plot 1", "XY Plot 4"])

VB Syntax UpdateReports <ReportNames>


VB Example oModule.UpdateReports Array("XY Plot 1", "XY Plot 4")

UpdateTraces
Update the traces in a report for which traces are not automatically updated by the Report Traces dialog box, Update Report, Real
Time selection.

UI Access In Report dialog, click Apply Traces button

Name Type Description


<ReportName> String Name of Report.
<TraceNames> Array Array of strings containing trace names.
<SolutionName> String Name of the solution.
Parameters <ContextArray> Array 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"

Reporter Editor Script Commands 13-127


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("Context:=", <GeometryType>)
<GeometryType> ex. "Infinite Spheren", "Spheren",
"Polylinen"
<FamiliesArray> Array Contains sweep definitions for the report.
Array("<VariableName>:= ", <ValueArray>)
<ValueArray>
Array("All") or Array("Value1", "Value2", ..."Valuen")
examples of <VariableName> "Freq", "Theta", "Distance"
<ReportDataArray> Array This array contains the report quantity and X, Y, and (Z) axis definitions.
Array("X Component:=", <VariableName>,
"Y Component:=", <VariableName> | <ReportQuant-
ityArray>)
<ReportQuantityArray> ex. Array("dB(S(Port1, Port1))")
<ExtTraceInfo> Array Optional. Array defines extended trace information.

Return Value None.

Python Syntax UpdateTraces(<ReportName>, <SolutionName>, <ContextArray >, <FamiliesArray>, <ReportDataArray>)


oModule.UpdateTraces("XY Plot 1", ["NEG1.VAL"], "TR4",
Python Example [
"NAME:Context",

Reporter Editor Script Commands 13-128


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SimValueContext:=", [2,0,2,0,False,False,
-1,1,0,1,1,"",0,0,"CG",False,"0","KP",False,"0","MH",False,
"100","TE",False,"100s","TH",False,"40",
"TS",False,"0ns","UF",False,
"0","WT",False,"0","WW",False,"100"]
],
[
"Spectrum:=", ["All"]
],
[
"X Component:=", "Spectrum",
"Y Component:=", ["mag(NEG1.VAL)"]
], [])

VB Syntax UpdateTraces <ReportName>, <SolutionName>, <ContextArray >, <FamiliesArray>, <ReportDataArray>


oModule.UpdateTraces "XY Plot1", Array("dB(S(WavePort1,WavePort1))"), _
"Setup1 : Sweep1", Array("Domain:=", "Time", "HoldTime:=", 1, _
VB Example "RiseTime:=", 0, "StepTime:=", 0, "Step:=", false, _
"WindowWidth:=", 1, "WindowType:=", 0, "KaiserParameter:=",1, _
"MaximumTime:=", 0), Array("Time:=", Array("All")), _

Reporter Editor Script Commands 13-129


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("X Component:=", "Time",_


"Y Component:=", Array("dB(S(WavePort1,WavePort1))")), _
Array()

UpdateTracesContextAndSweeps
Edits sweeps and context of multiple traces without affecting their component expressions.

UI Access Modify Report with multiple traces selected.

Name Type Description


<ReportName> String Name of Report.
<TraceNames> Array Array of strings containing trace names.
<SolutionName> String Name of the solution as listed in the Modify Report dialog box.
Parameters For example: "Setup1 : Last Adaptive"
<ContextArray> Array Context for which the expression is being evaluated. This can be an empty
string if there is no context.
ex. "Sweep" or "Time"
<PointSet> Array Point set for the selected traces, for example, X and Y values for the plot.

Return Value None

UpdateTracesContextAndSweeps(<ReportName>, <TraceNames>, <SolutionName>, <ContextArray>,


Python Syntax
<PointSet>)
oModule.UpdateTracesContextAndSweeps_
Python Example
("Active S Parameter Quick Report",

Reporter Editor Script Commands 13-130


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["dB(ActiveS(Port1:1))", "dB(ActiveS(Port2:1))"],
"Setup1 : Sweep1", [],
["Freq:=", ["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.9GHz", "9.95GHz", "10GHz"],
"off-
set:=",["All"]])

UpdateTracesContextAndSweeps <ReportName>, <TraceNames>, <SolutionName>, <ContextArray>,


VB Syntax
<PointSet>
oModule.UpdateTracesContextAndSweeps _
"Active S Parameter Quick Report",_
Array("dB(ActiveS(Port1:1))", "dB(ActiveS(Port2:1))"),_
VB Example "Setup1 : Sweep1", Array(), _
Array("Freq:=", _
Array("9GHz", "9.05GHz", "9.1GHz", _
"9.15GHz", "9.2GHz", _

Reporter Editor Script Commands 13-131


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"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"),_
"off-
set:=", Array("All"))

Reporter Editor Script Commands 13-132


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

14 - Boundary and Excitation Module Script Commands


Boundary and excitation commands should be executed by the "BoundarySetup" module.
Set oModule = oDesign.GetModule("BoundarySetup")
Conventions Used in this Chapter
<BoundName>
Type: string.
Name of a boundary.
<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 Measure Information dialog box.
<LineEndPoint>
Array(<double>, <double>, <double>)

Boundaries Supported in HFSS Scripting:


l Anisotropic Impedance
l Aperture

Boundary and
Excitation Module Script Commands 14-1
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l Coupled Boundaries:
l Lattice Pair
l Primary
l Secondary
l Finite Conductivity
l HalfSpace
l Impedance
l Layered Impedance
l Linked Impedance
l Lumped RLC
l Perfect E
l Perfect H
l Radiation
l Symmetry
l Multipaction SEE
l Fresnel

Excitations Supported in HFSS Scripting:


l Circuit Port
l Floquet Port
l Lumped Port
l Terminal

Boundary and
Excitation Module Script Commands 14-2
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l Wave Port
l Incident Wave Excitations:
l Plane Wave
l Hertzian-Dipole Incident Wave
l Cylindrical Wave
l Gaussian Beam
l Linear Antenna Wave
l Linked Field Excitations:
l Far Field Incident Wave
l Near Field Incident Wave
l Cable Network
l Voltage
l Current
l Magnetic Bias
l Multipaction Charge Region
l Multipaction DC Bias

The topics for this section include:


General Commands Recognized by the Boundary/Excitations Module
Script Commands for Creating and Modifying Boundaries
Script Commands for Creating and Modifying PMLs

General Commands Recognized by the Boundary/Excitations Module


AddAssignmentToBoundary

Boundary and
Excitation Module Script Commands 14-3
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AutoIdentifyNets
AutoIdentifyPorts
AutoIdentifyTerminals
ChangeImpedanceMult
ConvertNPortCircuitElementToPorts
CreateNPortCircuitElement
DeleteAllBoundaries
DeleteAllExcitations
DeleteBoundaries
GetBoundaryAssignment
GetBoundaries
GetBoundariesOfType
GetDefaultBaseName
GetExcitations
GetExcitationsOfType
GetHybridRegions
GetHybridRegionsOfType
GetNumBoundaries
GetNumBoundariesOfType
GetNumExcitations

Boundary and
Excitation Module Script Commands 14-4
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetNumExcitationsOfType
GetPortExcitationsCount
IdentifyNets
ReassignBoundary
RemoveAssignmentFromBoundary
RenameBoundary
ReprioritizeBoundaries
SetDefaultBaseName
AddAssignmentToBoundary
Adds a new geometry assignment to a boundary.

UI Access N/A

Name Type Description


<Assignment> Array Structured array.

Parameters Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)

Return Value None.

Python Syntax AddAssignmentToBoundary(<Assignment>)


Python Example oModule.AddAssignmentToBoundary((

Boundary and
Excitation Module Script Commands 14-5
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["NAME:PerfE1",
"Faces:=", [12]])

VB Syntax AddAssignmentToBoundary <Assignment>


oModule.AddAssignmentTOBoundary Array("NAME:PerfE1", _
VB Example "Objects:=", Array("Box2", "Box3"), _
"Faces:=", Array(12, 11))

AutoIdentifyLatticePair
Automatically identifies coupled lattice pair within specified object.

UI Access Boundaries > Assign > Coupled... > Auto Identify Lattice Pair...

Name Type Description


Parameters <PlaneName> String Name of relative plane.
<ObjectName> String Name of specified object.

Return Value None.

Python Syntax AutoIdentifyLatticePair (<PlaneName>, <ObjectName>)


Python Example oModule.AutoIdentifyLatticePair("Global:XY", "Cylinder1")

Boundary and
Excitation Module Script Commands 14-6
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax AutoIdentifyLatticePair <PlaneName>, <ObjectName>


VB Example oModule.AutoIdentifyLatticePair "Global:XY", "Cylinder1"

AutoIdentifyNets
Use: Automatically identifies nets.
Command: Q3D Extractor>Nets>Auto Identify Nets
Syntax: AutoIdentifyNets
Return Value: None
Command: oModule.AutoIdentifyNets
AutoIdentifyPorts
Automatically identifies ports in a terminal design.

UI Access N/A

Name Type Description


<FaceIDArray> Array Array of face IDs.
Array("NAME:Faces",
<FaceID>, <FaceID>, ...)
<IsWavePort> Boolean l True - waveport
Parameters
False - lumped port.
l

<Refer- Array Structured array.


enceConductorsArray>
Array("NAME:ReferenceConductors",
<ConductorName>, <ConductorName>, ...)
<BaseName- String Optional. Base name to use for created ports
forCreatedPorts>

Boundary and
Excitation Module Script Commands 14-7
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<UseConductorNames> Boolean Optional.


l True - use conductor names.

l False - use port object name as base name

Return Value None.

Python Syntax AutoIdentifyPorts (<FaceIDArray>, <IsWavePort>, <ReferenceConductorsArray>)


oModule.AutoIdentifyPorts(
["NAME:Faces", 52],
Python Example True,
["NAME:ReferenceConductors", "Conductor1"],
True)

VB Syntax AutoIdentifyPorts <FaceIDArray>, <IsWavePort>, <ReferenceConductorsArray>


oModule.AutoIdentifyPorts
VB Example Array("NAME:Faces", 52), true, _
Array("NAME:ReferenceConductors", "Conductor1"), true

AutoIdentifyTerminals
Automatically identifies the terminals within the given ports.

Boundary and
Excitation Module Script Commands 14-8
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A

Name Type Description


<ConductorsArray> Array Structured array.
Array("NAME:ReferenceConductors",
Parameters <ConductorName>, <ConductorName>, ...)
<PortNames> String Names of given ports.
<UseConductorNames> Boolean l True - use conductor names.

l False - use port object name as base name.

Return Value None.

Python Syntax AutoIdentifyTerminals (<ConductorsArray>, <PortNames>, <UseConductorNames>)


oModule.AutoIdentifyTerminals([
"NAME:ReferenceConductors",
Python Example
"Conductor1"],
"WavePort1", True)

VB Syntax AutoIdentifyTerminals <ConductorsArray>, <PortNames>, <UseConductorNames>


oModule.AutoIdentifyTerminals _
VB Example Array("NAME:ReferenceConductors","Conductor1"), _
"WavePort1", true

Boundary and
Excitation Module Script Commands 14-9
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ChangeImpedanceMult
Modifies the port impedance multiplier.

UI Access HFSS > Excitations > Edit Port Impedance Multiplier.

Name Type Description


Parameters
<MultVal> Double New value for the impedance multiplier.

Return Value None.

Python Syntax ChangeImpedanceMult (<MultVal>)


Python Example oModule.ChangeImpedanceMult(0.5)

VB Syntax ChangeImpedanceMult <MultVal>


VB Example oModule.ChangeImpedanceMult 0.5

ConvertNportCircuitElementsToPorts
Converts one or more HFSS Circuit Element to one or more ports.

UI Access Right-click on element and select Convert to HFSS Ports.

Name Type Description


Parameters
<NportName> Array Array of Nport names.

Return Value None.

Boundary and
Excitation Module Script Commands 14-10
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ConvertNportCircuitElementToPorts(<NportName>)


Python Example oModule.ConvertNportCircuitElementToPorts(["Nport2"])

VB Syntax ConvertNportCircuitElementToPorts <NportName>


VB Example oModule.ConvertNportCircuitElementToPorts Array("Nport2")

CreateNportCircuitElements
Creates an HFSS Circuit Element from one or more ports.

Right-click Circuit Elements > Create Single Port Model... or Circuit Elements > Create Multi-Terminal
UI Access
Model...

Name Type Description


<NPortArray> Array Structured array.

Parameters Array("NAME:<NPortName>",
"Definition:=", <string>,
<AssignmentArray>)

Return Value None.

Python Syntax CreateNportCircuitElement (<NPortArray>)


Python Example oModule.CreateNportCircuitElement(

Boundary and
Excitation Module Script Commands 14-11
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["NAME:Nport1",
"Definition:=", "Model",
["NAME:Assignments",
["NAME:Model",
"Assign:=", "1"]
]
])
oModule.CreateNportCircuitElement(
["NAME:Nport2",
"Definition:=", "Model2",
["NAME:Assignments",
["NAME:P01__NET179__T1",
"Assign:=", "2"],
["NAME:P02__NET178__T1",
"Assign:=", "3"],
["NAME:P03__NET178__T1",
"Assign:=", "4"],
["NAME:P04__NET179__T1",
"Assign:=", "5"],
]

Boundary and
Excitation Module Script Commands 14-12
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

])

VB Syntax CreateNportCircuitElement <NPortArray>


oModule.CreateNportCircuitElement _
Array("NAME:Nport1", _
"Definition:=", "Model", _
Array("NAME:Assignments", Array("NAME:Model", "Assign:=", "1")))

oModule.CreateNportCircuitElement _
VB Example
Array("NAME:Nport2", _
"Definition:=", "Model2", _
Array("NAME:Assignments", Array("NAME:P01__NET179__T1", "Assign:=", _
"2"), Array("NAME:P02__NET178__T1", "Assign:=", "3"), _
Array("NAME:P03__NET178__T1", "Assign:=", _
"4"), Array("NAME:P04__NET179__T1", "Assign:=", "5")))

DeleteAllBoundaries
Deletes all boundaries.

UI Access [product] > Boundaries > Delete All


Parameters None.
Return Value None.

Boundary and
Excitation Module Script Commands 14-13
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax DeleteAllBoundaries()


Python Example oModule.DeleteAllBoundaries()

VB Syntax DeleteAllBoundaries
VB Example oModule.DeleteAllBoundaries

DeleteAllExcitations
Deletes all excitations.

UI Access [product] > Excitations > Delete All


Parameters None.
Return Value None.

Python Syntax DeleteAllExcitations()


Python Example oModule.DeleteAllExcitations()

VB Syntax DeleteAllExcitations
VB Example oModule.DeleteAllExcitations

Boundary and
Excitation Module Script Commands 14-14
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

DeleteBoundaries
Deletes the specified boundaries and excitations.

UI Access Delete command in the List dialog box. Click [product] > List to open the List dialog box.

Name Type Description


Parameters
<NameArray> Array Array of boundary condition names.

Return Value None.

Python Syntax DeleteBoundaries(<NameArray>)


Python Example oModule.DeleteBoundaries(["PerfE1", "WavePort1"])

VB Syntax DeleteBoundaries <NameArray>


VB Example oModule.DeleteBoundaries Array("PerfE1", "WavePort1")

EditNportCircuitElement
Edits an HFSS Circuit Element.

UI Access N/A

Name Type Description


<NPortArray> Array Structured array.
Parameters
Array("NAME:<NPortName>",
"Definition:=", <string>,

Boundary and
Excitation Module Script Commands 14-15
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<AssignmentArray>)

Return Value None.

Python Syntax EditNportCircuitElement(<NPortArray>)


oModule.EditNportCircuitElement(
["NAME:Nport1",
"Definition:=", "Model",
["NAME:Assignments",
Python Example ["NAME:Model",
"Assign:=", "1"
]
]
])

VB Syntax EditNportCircuitElement <NPortArray>

Boundary and
Excitation Module Script Commands 14-16
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.EditNportCircuitElement _
Array("NAME:Nport1", "Definition:=", "Model", _
VB Example
Array("NAME:Assignments", _
Array("NAME:Model", "Assign:=", "1")))

GetBoundaries
Gets boundary names in the current design.

UI Access N/A
Parameters None.
Return Value Array of boundary names.

Python Syntax GetBoundaries()


Python Example oModule.GetBoundaries()

VB Syntax GetBoundaries
VB Example oModule.GetBoundaries

GetBoundariesOfType
Gets boundary names of the given type.

UI Access N/A

Boundary and
Excitation Module Script Commands 14-17
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


Parameters
<BoundaryType> String Name of boundary type.

Return Value Array of boundary names of the given type.

Python Syntax GetBoundariesOfType(<BoundaryType>)


Python Example oModule.GetBoundariesOfType("PerfectE")

VB Syntax GetBoundariesOfType <BoundaryType>


VB Example oModule.GetBoundariesOfType "PerfectE"

GetBoundaryAssignment
Gets a list of face IDs associated with the given boundary or excitation assignment.

UI Access N/A

Name Type Description


Parameters
<BoundaryName> String Name of the specified boundary or excitation.

Return Value Array of face IDs or object IDs.

Python Syntax GetBoundaryAssignment(<BoundaryName>)


Python Example oModule.GetBoundaryAssignment("Rad1")

Boundary and
Excitation Module Script Commands 14-18
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetBoundaryAssignment <BoundaryName>


VB Example oModule.GetBoundaryAssignment "Rad1"

GetDefaultBaseName
Gets the default base name for boundaries for a project.

UI Access N/A

Name Type Description


Parameters
<BoundaryType> String Name of legal boundary type.

Return Value String of boundary default base name.

Python Syntax GetDefaultBaseName(<BoundaryType>)


Python Example oModule.GetDefaultBaseName("Radiation")

VB Syntax GetDefaultBaseName <BoundaryType>


VB Example oModule.GetDefaultBaseName "Radiation"

GetDiffPairs
Gets the names of differential pairs defined.

UI Access N/A

Boundary and
Excitation Module Script Commands 14-19
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters None.
Return Value Array of differential pair names.

Python Syntax GetDiffPairs()


Python Example oModule.GetDiffPairs()

VB Syntax GetDiffPairs
VB Example oModule.GetDiffPairs

GetExcitations
Gets excitation port and terminal names for a model.

UI Access N/A
Parameters None.
Return Value Array of excitation name paired with excitation type.

Python Syntax GetExcitations()


Python Example oModule.GetExcitations()

Boundary and
Excitation Module Script Commands 14-20
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetExcitations
VB Example oModule.GetExcitations

GetExcitationsOfType
Gets excitation names of the given type.

UI Access N/A

Name Type Description


Parameters
<ExcitationType> String Name of excitation type.

Return Value Array of excitation names of the given type.

Python Syntax GetExcitationsOfType(<ExcitationType>)


Python Example oModule.GetExcitationsOfType("Wave Port")

VB Syntax GetExcitationsOfType <ExcitationType>


VB Example oModule.GetExcitationsOfType "Wave Port"

GetHybridRegions
Gets hybrid region names for a project.

UI Access N/A
Parameters None.
Return Value Array of hybrid region names.

Boundary and
Excitation Module Script Commands 14-21
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetHybridRegions ()


Python Example oModule.GetHybridRegions()

VB Syntax GetHybridRegions
VB Example oModule.GetHybridRegions

GetHybridRegionsOfType
Gets hybrid region names of the given type.

UI Access N/A

Name Type Description


Parameters
<HybridRegionType> String Name of legal hybrid region type.

Return Value Array of hybrid region names of the given type.

Python Syntax GetHybridRegionsOfType(<HybridRegionType>)


Python Example oModule.GetHybridRegionsOfType("FE-BI")

VB Syntax GetHybridRegionsOfType <HybridRegionType>

Boundary and
Excitation Module Script Commands 14-22
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oModule.GetHybridRegionsOfType "FE-BI"

GetNumBoundaries
Gets the number of boundaries in a design.

UI Access N/A
Parameters None.
Return Value Integer number of boundaries.

Python Syntax GetNumBoundaries()


Python Example oModule.GetNumBoundaries()

VB Syntax GetNumBoundaries
VB Example oModule.GetNumBoundaries

GetNumBoundariesOfType
Gets the number of boundaries of the given type.

UI Access N/A

Name Type Description


Parameters
<BoundaryType> String Specified boundary type.

Return Value Integer number of boundaries.

Boundary and
Excitation Module Script Commands 14-23
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetNumBoundariesOfType(<BoundaryType>)


Python Example oModule.GetNumBoundariesOfType("PerfectE")

VB Syntax GetNumBoundariesOfType <BoundaryType>


VB Example oModule.GetNumBoundariesOfType "PerfectE"

GetNumExcitations
Gets the number of excitations in a design.

UI Access N/A
Parameters None.
Return Value Integer number of excitations.

Python Syntax GetNumExcitations()


Python Example oModule.GetNumExcitations()

VB Syntax GetNumExcitations
VB Example oModule.GetNumExcitations

Boundary and
Excitation Module Script Commands 14-24
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetNumExcitationsOfType
Gets the number of excitations of the given type, including all defined modes and terminals of ports.

UI Access N/A

Name Type Description


Parameters
<ExcitationType> String Specified type of excitation.

Return Value Integer number of excitations.

Python Syntax GetNumExcitationsOfType(<ExcitationType>)


Python Example oModule.GetNumExcitationsOfType("Voltage")

VB Syntax GetNumExcitationsOfType <ExcitationType>


VB Example oModule.GetNumExcitationsOfType "Voltage"

GetNumHybridRegions
Gets number of hybrid regions in a design.

UI Access N/A
Parameters None.
Return Value Integer number of hybrid regions.

Boundary and
Excitation Module Script Commands 14-25
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetNumHybridRegions()


Python Example oModule.GetNumHybridRegions()

VB Syntax GetNumHybridRegions
VB Example oModule.GetNumHybridRegions

GetNumHybridRegionsOfType
Gets number of hybrid regions of the given type.

UI Access placeholder

Name Type Description


Parameters
<HybridRegionType> String Name of legal hybrid region type.

Return Value Integer number of hybrid regions.

Python Syntax GetNumHybridRegionsOfType(<HybridRegionType>)


Python Example oModule.GetNumHybridRegionsOfType("FE-BI")

VB Syntax GetNumHybridRegionsOfType <HybridRegionType>


VB Example oModule.GetNumHybridRegionsOfType "FE-BI"

Boundary and
Excitation Module Script Commands 14-26
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetPortExcitationCounts
Gets all port names and corresponding number of modes/terminals for each port excitation.

UI Access N/A
Parameters None.
Return Value Array of port names and corresponding mode/terminal counts.

Python Syntax GetPortExcitationCounts()


Python Example oModule.GetPortExcitationCounts()

VB Syntax GetPortExcitationCounts
VB Example oModule.GetPortExcitationCounts

IdentifyNets
Returns a list of nets and their associated objects and sources.

UI Access N/A
Parameters None.
Return Value List of nets.

Python Syntax IdentifyNets()

Boundary and
Excitation Module Script Commands 14-27
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Example oModule.IdentifyNets()

VB Syntax IdentifyNets
VB Example oModule.IdentifyNets

ListNets
Returns a list of nets and their associated objects and sources.

UI Access N/A

Name Type Description


Parameters <rmName> String Optional. Name of Reduce Matrix operation. Use "Original" to specify the ori-
ginal matrix.

If <rmName> is provided, returns a list of nets under the specified Reduce Matrix operation.
Return Value
If no <rmName> is provided, returns a list of all nets in the design.

Python Syntax ListNets(<rmName>)


Python Example oModule.ListNets('Original')

VB Syntax ListNets <rmName>


VB Example oModule.ListNets "Original"

Boundary and
Excitation Module Script Commands 14-28
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ReassignBoundary
Specifies a new geometry assignment for a boundary.

UI Access Right-click Boundaries > Reassign or Excitations > Reassign

Name Type Description


<AssignmentArray> Array Structured array.

Parameters Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)

Return Value None.

Python Syntax ReassignBoundary(<AssignmentArray>)


oModule.ReassignBoundary(
[
Python Example "NAME:PerfH12",
"Faces:=", [17]
])

VB Syntax ReassignBoundary <AssignmentArray>


oModule.ReassignBoundary _
VB Example
Array("NAME:PerfH12", _

Boundary and
Excitation Module Script Commands 14-29
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Faces:=", Array(17))

RemoveAssignmentFromBoundary
Removes a geometry assignment from a boundary.

UI Access Right-click on a boundary or an excitation, select Remove from Assignment.

Name Type Description


<AssignmentArray> Array Structured array.

Parameters Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)

Return Value None.

Python Syntax RemoveAssignmentFromBoundary(<AssignmentArray>)


oModule.RemoveAssignmentFromBoundary(
[
Python Example "NAME:Rad1",
"Faces:=", [11]
])

Boundary and
Excitation Module Script Commands 14-30
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax RemoveAssignmentFromBoundary <AssignmentArray>


oModule.RemoveAssignmentFromBoundary _
VB Example Array("NAME:Rad1", _
"Faces:=", Array(11))

RenameBoundary
Renames a boundary or excitation.

UI Access Right-click a boundary in the project tree, and then click Rename on the shortcut menu.

Name Type Description


Parameters <OldName> String Name of the boundary to be renamed.
<NewName> String New name for the boundary.

Return Value None.

Python Syntax RenameBoundary(<OldName>, <NewName>)


Python Example oModule.RenameBoundary("Rad2", "Rad3")

VB Syntax RenameBoundary <OldName>, <NewName>


VB Example oModule.RenameBoundary "Rad2", "Rad3"

ReprioritizeBoundaries
Specifies the order in which the boundaries and excitations are recognized by the solver. The first boundary in the list has the highest
priority.

Boundary and
Excitation Module Script Commands 14-31
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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.

UI Access [product] > Boundaries > Reprioritize

Name Type Description


<NewOrderArray> Array Structured array.
Parameters
Array("NAME:NewOrder",
<BoundName>, <BoundName>, ...)

Return Value None.

Python Syntax ReprioritizeBoundaries(<NewOrderArray>)


oModule.ReprioritizeBoundaries(
["NAME:NewOrder",
Python Example "Imped1",
"PerfE1",
"PerfH1"])

VB Syntax ReprioritizeBoundaries <NewOrderArray>


oModule.ReprioritizeBoundaries Array("NAME:NewOrder", _
VB Example
"Imped1", "PerfE1", "PerfH1")

Boundary and
Excitation Module Script Commands 14-32
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetDefaultBaseName
Sets the default base name for boundaries for a project.

UI Access N/A

Name Type Description


Parameters <BoundaryType> String Name of legal boundary type.
<DefaultName> String Default name for boundaries of specified type.

Return Value None.

Python Syntax SetDefaultBaseName(<BoundaryType>, <DefaultName>)


Python Example oModule.SetDefaultBaseName("Radiation", "RadBnd")

VB Syntax SetDefaultBaseName <BoundaryType>, <DefaultName>


VB Example oModule.SetDefaultBaseName "Radiation", "RadBnd"

SetPhaseCenterPerPort
Sets phase center per port for an HFSS Modal antenna in preparation for link to a target SBR+ design.

UI Access N/A

Name Type Description


Parameters <PhaseCenterArray> Array Structured array
Array(

Boundary and
Excitation Module Script Commands 14-33
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:<PortName>", "Coordinate System:=", <CSName>,


"NAME:<PortName>", "Coordinate System:=",
<CSName>,...)
Note: specified "CSName" must be valid as phase center for source far
fields.

Return Value None.

Python Syntax SetPhaseCenterPerPort(<PhaseCenterArray>)


oModule.SetPhaseCenterPerPort(
[
Python Example "NAME:1", "Coordinate System:=", "Phase Center CS1",
"NAME:2", "Coordinate System:=", "Phase Center CS2"
])

VB Syntax SetPhaseCenterPerPort <PhaseCenterArray>


oModule.SetPhaseCenterPerPort Array( _
VB Example "NAME:1", "Coordinate System:=", "Phase Center CS1", _
"NAME:2", "Coordinate System:=", "Phase Center CS2")

Boundary and
Excitation Module Script Commands 14-34
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetSinglePhaseCenter
Sets a single phase center for an HFSS Modal antenna in preparation for link to a target SBR+ design.

UI Access N/A

Name Type Description


Parameters
<CSName> String Phase center coordinate system name.

Return Value None.

Python Syntax SetSinglePhaseCenter(<CSName>)


Python Example oModule.SetSinglePhaseCenter("Phase Center CS1")

VB Syntax SetSinglePhaseCenter <CSName>


VB Example oModule.SetSinglePhaseCenter "Phase Center CS1"

Script Commands for Creating and Modifying Boundaries


Following are script commands for creating and modifying boundaries that are recognized by the "BoundarySetup" module. In the fol-
lowing commands, all named data can be included or excluded as desired and may appear in any order.
AssignCircuitPort [HFSS]
AssignCurrent
AssignDielectricCavity
AssignFiniteCond
AssignFloquet

Boundary and
Excitation Module Script Commands 14-35
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AssignHalfSpace
AssignHybridRegion
AssignIERegion
AssignImpedance
AssignIncidentWave
AssignLayeredImp
AssignLinkedRegion
AssignLumpedPort
AssignLumpedRLC
AssignMagneticBias
AssignRFDischargeDCBias
AssignPrimary
AssignPerfectE
AssignPerfectH
AssignRadiation
AssignRadiation
AssignScreeningImpedance
AssignSymmetry
AssignTerminal
AssignVoltage

Boundary and
Excitation Module Script Commands 14-36
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AssignWavePort
AutoCreatePECCapForWavePort
CircuitPortToLumpedPort
EditCircuitPort [HFSS]
EditCurrent
EditDiffPairs
EditFiniteCond
EditHalfSpace
EditHybridRegion
EditImpedance
EditIncidentWave
EditLayeredImpedance
EditPrimary
EditPerfectE
EditPerfectH
EditLumpedPort
EditLumpedRLC
EditMagneticBias
EditNPortCircuitElement
EditRadiation
EditRFDischargeDCBias

Boundary and
Excitation Module Script Commands 14-37
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditSymmetry
EditTerminal
EditVoltage
EditWavePort
LumpedPortToCircuitPort
SetHybridRegionCoupledGroup
SetSBRSources
SetSBRSourcesBlockage
SetSBRWedgeSettings
SetTerminalReferenceImpedances
SwapCircuitPortAssignment
UnassignIERegions
AssignAnisotropicImpedance
Assigns an Anisotropic Impedance boundary

UI Access HFSS > Boundaries > Assign > Anisotropic Impedance...

Name Type Description


<Aniso- Array Structured array.
tropicImpArray>
Parameters Array("NAME:<string name of anisotropic impedance>",
"Faces:=" , <array of face IDs>,
"UseInfiniteGroundPlane:=", <boolean>,

Boundary and
Excitation Module Script Commands 14-38
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"CoordSystem:=" , <string coordinate system name>,


"HasExternalLink:=" , <boolean>,
"ZxxResistance:=" , <string of an integer value>,
"ZxxReactance:=" , <string of an integer value>,
"ZxyResistance:=" , <string of an integer value>,
"ZxyReactance:=" , <string of an integer value>,
"ZyxResistance:=" , <string of an integer value>,
"ZyxReactance:=" , <string of an integer value>,
"ZyyResistance:=" , <string of an integer value>,
"ZyyReactance:=" , <string of an integer value>)

Return Value None.

Python Syntax AssignAnisotropicImpedance (<AnisotropicImpArray>)

Boundary and
Excitation Module Script Commands 14-39
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.AssignAnisotropicImpedance(
["NAME:Anisotropic1",
"Faces:=" , [17215],
"UseInfiniteGroundPlane:=", False,
"CoordSystem:=" , "Global",
"HasExternalLink:=" , False,
"ZxxResistance:=" , "377",
Python Example "ZxxReactance:=" , "0",
"ZxyResistance:=" , "0",
"ZxyReactance:=" , "0",
"ZyxResistance:=" , "0",
"ZyxReactance:=" , "0",
"ZyyResistance:=" , "377",
"ZyyReactance:=" , "0"
])

VB Syntax AssignAnisotropicImpedance <AnisotropicImpArray>


oModule.AssignAnisotropicImpedance
VB Example
Array("NAME:Anisotropic1",

Boundary and
Excitation Module Script Commands 14-40
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Faces:=", Array(17215),
"UseInfiniteGroundPlane:=", false,
"CoordSystem:=" , "Global",
"HasExternalLink:=" , false,
"ZxxResistance:=" , "377",
"ZxxReactance:=" , "0",
"ZxyResistance:=" , "0",
"ZxyReactance:=" , "0",
"ZyxResistance:=" , "0",
"ZyxReactance:=" , "0",
"ZyyResistance:=" , "377",
"ZyyReactance:=" , "0"
)

AssignAperture
Assigns an aperture boundary on selected IE region.

UI Access HFSS > Boundaries > Assign > Aperture...

Name Type Description


Parameters
<ApertureArray> Array Array defines selected objects.

Return Value None.

Boundary and
Excitation Module Script Commands 14-41
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax AssignAperture(<ApertureArray>)

oModule.AssignAperture(
["NAME:Aperture1",
Python Example
"Objects:=", ["Rectangle1"]
])

VB Syntax AssignAperture <ApertureArray>


oModule.AssignAperture
Array("NAME:Aperture1",
VB Example
"Objects:=", Array("Rectangle1")
)

AssignCircuitPort
Assigns a circuit port for a driven terminal or driven modal design in HFSS.

UI Access HFSS > Excitations > Assign > Circuit Port...

Name Type Description


<CircuitPortArray> Array Structured array.

Parameters Array("NAME:<PortName>",
"Edges:=", [n1, n2],
"Impedance:=", "valueohm",

Boundary and
Excitation Module Script Commands 14-42
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"DoDeembed:=", <boolean>
"RenormalizeAllTerminals:=", <boolean>
"TerminalIDLit:=", Array()
)

Return Value None.

Python Syntax AssignCircuitPort (<CircuitPortArray>)


oModule.AssignCircuitPort(
[
"NAME:1",
"Edges:=" , [50,56],
Python Example "Impedance:=" , "50ohm",
"DoDeembed:=" , False,
"RenormalizeAllTerminals:=", True,
"TerminalIDList:=" , []
])

VB Syntax AssignCircuitPort <CircuitPortArray>


oModule.AssignCircuitPort
VB Example
Array("NAME:1",

Boundary and
Excitation Module Script Commands 14-43
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Edges:=", Array(50,56),
"Impedance:=", "50ohm",
"DoDeembed:=", false,
"RenormalizeAllTerminals:=", true,
"TerminalIDList:=", Array())

AssignCurrent
Creates a current source.

UI Access HFSS > Excitations > Assign > Current

Name Type Description


<CurrentArray> Array Structured array.
Array("NAME:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Current:=", <value>,
<DirectionArray>,
Parameters
"Faces:=", <AssignmentFaces>)
"TerminalIDLit:=", Array() )
<DirectionArray> Array Structured array.
Array("NAME:Direction",
"Start:=", <LineEndPoint>,
"End:=", <LineEndPoint>)

Boundary and
Excitation Module Script Commands 14-44
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax AssignCurrent (<CurrentArray>)


oModule.AssignCurrent(
["NAME:Current1",
"Current:=", "1000mA",
Python Example ["NAME:Direction",
"Start:=", [-0.4, 0.4, -1.6],
"End:=", [-0.4, 0.4, 0]],
"Faces:=", [12]])

VB Syntax AssignCurrent <CurrentArray>


oModule.AssignCurrent Array("NAME:Current1",_
"Current:=", "1000mA",_
Array("NAME:Direction",_
VB Example
"Start:=", Array(-0.4, 0.4, -1.6),_
"End:=", Array(-0.4, 0.4, 0)), _
"Faces:=", Array(12))

AssignCylindricalWave
Creates an incident Cylindrical wave

Boundary and
Excitation Module Script Commands 14-45
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access HFSS > Excitations > Assign > Incident Wave > Cylindrical Wave.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:IncCWave1",
"Objects:=" , <Array of objects>,
"IsCartesian:=" , <boolean>,
"EoX:=" , <string of integer value>,
"EoY:=" , <string of integer value>,

Parameters "EoZ:=" , <string of integer value>,


"kX:=" , <string of integer value>,
"kY:=" , <string of integer value>,
"kZ:=" , <string of integer value>,
"OriginX:=" , <string of integer value>,
"OriginY:=" , <string of integer value>,
"OriginZ:=" , <string of integer value>,
"CylinderRadius:=" , <string of float value>)

Return Value None.

Python Syntax AssignCylindricalWave (<Parameters>)

Boundary and
Excitation Module Script Commands 14-46
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.AssignCylindricalWave(
["NAME:IncCWave1",
"Objects:=" , ["Cylinder1"],
"IsCartesian:=" , True,
"EoX:=" , "1",
"EoY:=" , "0",
"EoZ:=" , "0",
Python Example "kX:=" , "0",
"kY:=" , "0",
"kZ:=" , "1",
"OriginX:=" , "0mm",
"OriginY:=" , "0mm",
"OriginZ:=" , "0mm",
"CylinderRadius:=" , "0.25in"
])

VB Syntax AssignCylindricalWave <Parameters>


oModule.AssignCylindricalWave
Array("NAME:IncCWave1",
VB Example
"Objects:=", Array("Cylinder1"),
"IsCartesian:=", true,

Boundary and
Excitation Module Script Commands 14-47
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"EoX:=", "1",
"EoY:=", "0",
"EoZ:=", "0",
"kX:=", "0",
"kY:=", "0",
"kZ:=", "1",
"OriginX:=", "0mm",
"OriginY:=", "0mm",
"OriginZ:=", "0mm",
"CylinderRadius:=", "0.25in"
)

AssignDielectricCavity
Assigns a Hybrid Region as a Dielectric Cavity.

UI Access HFSS > Hybrid > Assign Hybrid > Dielectric Cavity.

Name Type Description


<Parameters> Array Structured array.
Parameters
Array("NAME:<cavity name>",
"Objects:=", <array of objects>)

Return Value None.

Boundary and
Excitation Module Script Commands 14-48
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax AssignDielectricCavity(<Parameters>)


oModule.AssignDielectricCavity(
Python Example ["NAME:Cavity1",
"Objects:=", ["Cylinder1"]])

VB Syntax AssignDielectricCavity <Parameters>


oModule.AssignDielectricCavity
VB Example Array("NAME:Cavity1",
"Objects:=", Array("Cylinder1"))

AssignFarFieldWave
Assigns far field wave as excitation.

UI Access HFSS > Excitations > Assign > Linked Field > Far Field Wave.

Name Type Description


<FarFieldWaveOptions> Array Structured array containing options to define the far field wave
excitation.
["NAME<name of the incident wave source>:",
Parameters
"IsFarField:=" <boolean>,
"UseDataLink:=" <boolean>,
"ExternalDataFile:=" <string path to external data file; or pass

Boundary and
Excitation Module Script Commands 14-49
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

empty string>,
"Project:=" <string path to linked project file>,
"Product:=" <string product name for source design>,
"Design:=" <string name for source design>,
"Soln:="<string name for source solution>, <ParametersArray>,
"ForceSourceToSolve:=" <boolean True to force source design to
solve in the absence of linked data in the target design; else,
False>,
"PreservePartnerSoln:=" <boolean True to save source design;
else False>,
"PathRelativeTo:=" <string "TargetProject",>,
"SourceCoordSystem:=" <string coordinate system name>]
<ParametersArray> Array Structured array containing parameters to define the linked source
solution.

Return Value None.

Python Syntax AssignFarFieldWave (<FarFieldWaveOptions>)


oModule.AssignFarFieldWave([
"NAME:IncNFWave2",
Python Example
"IsFarField:=", True,
"UseDataLink:=", True,

Boundary and
Excitation Module Script Commands 14-50
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ExternalDataFile:=", "",
"Project:=", "C:/HFSS/Antennas/Dish_FEBI.aedt",
"Product:=", "HFSS",
"Design:=", "Horn_Source_Project_for_PO_Solver",
"Soln:=", "8430MHz : LastAdaptive",[
"NAME:Params",
"xfactor:=", "1.2",
"yfactor:=", "1.6"],
"ForceSourceToSolve:=", False,
"PreservePartnerSoln:=", False,
"PathRelativeTo:=", "TargetProject",
"SourceCoordSystem:=", "Global"])

VB Syntax AssignFarFieldWave<FarFieldWaveOptions>
oModule.AssignFarFieldWave Array(
"NAME:IncNFWave2",
"IsFarField:=", true,
VB Examples "UseDataLink:=", true,
"ExternalDataFile:=", "",
"Project:=", "C:/HFSS/Antennas/Dish_FEBI.aedt",
"Product:=", "HFSS",

Boundary and
Excitation Module Script Commands 14-51
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Design:=", "Horn_Source_Project_for_PO_Solver",
"Soln:=", "8430MHz : LastAdaptive", Array(
"NAME:Params",
"xfactor:=", "1.2",
"yfactor:=", "1.6"),
"ForceSourceToSolve:=", false,
"PreservePartnerSoln:=", false,
"PathRelativeTo:=", "TargetProject",
"SourceCoordSystem:=", "Global")

AssignFEBI
Assigns a Hybrid Region as a FEBI.

UI Access HFSS > Hybrid > Assign Hybrid > FE-BI....

Name Type Description


<Parameters> Array Structured array.
Parameters Array("NAME:<name of the FEBI Hybrid Region.>",
"Objects:=", <array of names for the geometry assigned
as FEBI Hybrid Region>)

Return Value None.

Boundary and
Excitation Module Script Commands 14-52
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax AssignFEBI(<Parameters>)


oModule.AssignFEBI(
Python Example ["NAME:FE-BI1",
"Objects:=", ["RegularPolyhedron1"]])

VB Syntax AssignFEBI <Parameters>


oModule.AssignFEBI
VB Example Array("NAME:FE-BI1",
"Objects:=", Array("RegularPolyhedron1"))

AssignFiniteCond
Assigns a single finite conductivity boundary on selected edges.

UI Access 2D Extractor > Boundary > Assign > Finite Conductivity.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:<name of the boundary.>",
"Edges:=", <array of edge ids>,
Parameters "Roughness:=", "<string of double with units of
length>",
"UseCoating:=", <boolean>,
"LayerThickness:=", "<string of double with units of
length>",

Boundary and
Excitation Module Script Commands 14-53
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseMaterial:=", <boolean>,
"Material:=", "<string material name for coating>",
"Radius:=", <string of double with units of length>,
"Ratio:=", <string of double>)

Return Value None.

Python Syntax AssignFiniteCond(<Parameters>)

Example for the Hammerstad-Jensen surface roughness model.


oModule.AssignFiniteCond
["NAME:FiniteCond1",
"Edges:=", [7,9],
"Roughness:=", "2um",
"UseCoating:=", True,
Python Example
"LayerThickness:=", "1.2um",
"UseMaterial:=", True,
"Material:=", "Copper"]
Example for the Hurray surface roughness model
oModule.AssignFiniteCond
["NAME:FiniteCond1",

Boundary and
Excitation Module Script Commands 14-54
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Edges:=", [7],
"UseCoating:=", False,
"Radius:=", "0.5um",
"Ratio:=", "2.9"]

VB Syntax AssignFiniteCond <Parameters>

Example for the Hammerstad-Jensen surface roughness model.


oModule.AssignFiniteCond
Array("NAME:FiniteCond1",
"Edges:=", Array(7,9),
"Roughness:=", "2um",
"UseCoating:=", true,
"LayerThickness:=", "1.2um",
VB Example "UseMaterial:=", true,
"Material:=", "Copper")
Example for the Hurray surface roughness model
oModule.AssignFiniteCond
Array("NAME:FiniteCond1",
"Edges:=", Array(7),
"UseCoating:=", false,
"Radius:=", "0.5um",

Boundary and
Excitation Module Script Commands 14-55
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Ratio:=", "2.9")

AssignFloquet
Creates a Floquet port.

UI Access HFSS > Excitations > Assign > Floquet.

Name Type Description


<FloquetPortArray> Array Structured array.
Array("NAME:<BoundName>",
"Faces:=", <array of face IDs>,
"NumModes:=", <integer>,
"RenormalizeAllTerminals:=", <boolean>,
"DoDeembed:=", <boolean>,
<ModesArray>,
Parameters
"ShowReporterFilter:=", <boolean>,
"UseScanAngles:=", <boolean>,
"Phi:=", "<numdeg>",
"Theta:=", "<numdeg>",
<LatticeAVector>,
<LatticeBVector>,
<ModesCalculator>,
<ModesList>)

Boundary and
Excitation Module Script Commands 14-56
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ModesArray> Array Structured array.


Array("NAME:Modes", Array("NAME:<ModeName>",
"ModeNum:=", <integer>,
"UseIntLine:=", <boolean>),
...)
<LatticeAVector> Array Structured array.
Array("NAME:LatticeAVector",
"Start:=", Array("<num><units>", "<num><units>",
"<num><units>"),
"End:=", Array("<num><units>", "<num><units>",
"<num><units>"))
<LatticeBVector> Array Structured array.
Array("NAME:LatticeBVector",
"Start:=", Array("<num><units>", "<num><units>",
"<num><units>"),
"End:=", Array("<num><units>", "<num><units>",
"<num><units>"))
<ModesCalculator> Array Structured array.
Array("NAME:ModesCalculator",
"Frequency:=", "<Value>GHz",
"FrequencyChanged:=", <Boolean>,
"PhiStart:=", "<num>deg",
"PhiStop:=", "<num>deg",
"PhiStep:=", "<num>deg",

Boundary and
Excitation Module Script Commands 14-57
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ThetaStart:=", "<num>deg",
"ThetaStop:=", "<num>deg",
"ThetaStep:=", "<num>deg")
<ModesList> Array Structured array.
Array("NAME:ModesList",
Array("NAME:Mode",
"ModeNumber:=", <ModeID>,
"IndexM:=", <integer index>,
"IndexN:=", <integer index>,
"KC2:=", <integer value>,
"PropagationState:=", "Propagating",
"Attenuation:=", <integer value>,
"PolarizationState:=", <TE or TM>,
"AffectsRefinement:=", <boolean>),
...)

Return Value None.

Python Syntax AssignFloquetPort (<FloquetPortArray>)

Python Example oModule.AssignFloquetPort(["NAME:FloquetPort1",

Boundary and
Excitation Module Script Commands 14-58
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Faces:=", [7],
"NumModes:=", 2,
"RenormalizeAllTerminals:=", True,
"DoDeembed:=", False,
["NAME:Modes",
["NAME:Mode1",
"ModeNum:=",1,
"UseIntLine:=", False],
["NAME:Mode2",
"ModeNum:=", 2,
"UseIntLine:=", False]],
"ShowReporterFilter:=", False,
"UseScanAngles:=", True, "Phi:=", "0deg", "Theta:=", "0deg",
["NAME:LatticeAVector",
"Start:=", ["0mm", "0mm", "0.8mm"],
"End:=", ["0mm", "0.6mm", "0.8mm"]],
["NAME:LatticeBVector",
"Start:=", ["0mm", "0mm", "0.8mm"],
"End:=", ["0.8mm", "0mm", "0.8mm"]],
["NAME:ModesCalculator",
"Frequency:=", "1GHz",

Boundary and
Excitation Module Script Commands 14-59
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"FrequencyChanged:=", False,
"PhiStart:=", "0deg",
"PhiStop:=", "0deg",
"PhiStep:=","0deg",
"ThetaStart:=", "0deg",
"ThetaStop:=", "0deg",
"ThetaStep:=", "0deg"],
["NAME:ModesList",
["NAME:Mode",
"ModeNumber:=", 1,
"IndexM:=", 0,
"IndexN:=", 0,
"KC2:=", 0,
"PropagationState:=", "Propagating",
"Attenuation:=", 0,
"PolarizationState:=", "TE",
"AffectsRefinement:=", False],
["NAME:Mode",
"ModeNumber:=", 2,
"IndexM:=", 0,

Boundary and
Excitation Module Script Commands 14-60
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"IndexN:=", 0,
"KC2:=", 0,
"PropagationState:=", "Propagating",
"Attenuation:=", 0,
"PolarizationState:=", "TM",
"AffectsRefinement:=", False]
]])

VB Syntax AssignFloquetPort <FloquetPortArray>


oModule.AssignFloquetPort Array("NAME:FloquetPort1",
"Faces:=", Array(7),
"NumModes:=", 2,
"RenormalizeAllTerminals:=", true,
"DoDeembed:=", false,
Array("NAME:Modes", Array("NAME:Mode1", "ModeNum:=",
VB Example 1,
"UseIntLine:=", false),
Array("NAME:Mode2", "ModeNum:=", 2, "UseIntLine:=",
false)),
"ShowReporterFilter:=", false,
"UseScanAngles:=", true, "Phi:=", "0deg", "Theta:=",
"0deg",

Boundary and
Excitation Module Script Commands 14-61
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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", "ThetaStart:=", "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,
"PolarizationState:=", "TM", "AffectsRefinement:=",
false)))

Boundary and
Excitation Module Script Commands 14-62
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AssignFresnel
Assigns a Fresnel boundary condition, allows specifying either a perfect absorber or to import a Fresnel table file that describes reflec-
tion and transmission coefficients.

UI Access HFSS > Boundaries > Assign > Fresnel (SBR+)...

Name Type Description


<ArgArray> Array Structured array.
Array("NAME:<FresnelName>",
Parameters "Faces:=", <array of face IDs>,
"Fresnel Boundary Type:=", <PerfectAbsorber or
ImportFromTableFile>,
"RTTable Path:=", <string path to table file>)

Return Value None.

Python Syntax AssignFresnel(<ArgArray>)


oModule.AssignFresnel(["NAME:Fresnel2",
"Faces:=", [8],
Python Example "Fresnel Boundary Type:=", "ImportFromTableFile",
"RTTable Path:=", "C:\\temp\reflection-transmission-table.rttbl"
])

Boundary and
Excitation Module Script Commands 14-63
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax AssignFresnel <ArgArray>


oModule.AssignFresnel Array("NAME:Fresnel2",
"Faces:=", Array(8),
VB Example "Fresnel Boundary Type:=", "ImportFromTableFile",
"RTTable Path:=", "C:\\temp\reflection-transmission-table.rttbl"
)

AssignGaussianBeam
Assigns a Gaussian Beam type of incident wave excitation.

UI Access HFSS > Excitations > Assign > Incident Wave > Gaussian Beam...

Name Type Description


<IncidentWaveArray> Array Structured array.
Array("NAME:<Name of incident wave>",
"Faces:=", <array of face IDs>,
"IsCartesian:=", <boolean>,

Parameters "EoX:=" , "<numeric value>",


"EoY:=" , "<numeric value>",
"EoZ:=" , "<numeric value>",
"kX:=" , "<numeric value>",
"kY:=" , "<numeric value>",
"kZ:=" , "<numeric value>",

Boundary and
Excitation Module Script Commands 14-64
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PhiStart:=",<value>,
"PhiStop:=", <value>,
"PhiPoints:=", <int>,
"ThetaStart:=", <value>,
"ThetaStop:=", <value>,
"ThetaPoints:=", <int>,
"EoPhi:=", <value>,
"EoTheta:=", <value>,
"OriginX:=" , "<numUnit>",
"OriginY:=" , "<numUnit>",
"OriginZ:=" , "<numUnit>",
"BeamWidth:=" , "<numUnit>"
)
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.

Return Value None.

Python Syntax AssignGaussianBeam(<IncidentWaveArray>)


Python Example oModule.AssignGaussianBeam(

Boundary and
Excitation Module Script Commands 14-65
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["NAME:IncGBeam1",
"Faces:=" , [9],
"IsCartesian:=" , True,
"EoX:=" , "1",
"EoY:=" , "0",
"EoZ:=" , "0",
"kX:=" , "0",
"kY:=" , "0",
"kZ:=" , "1",
"OriginX:=" , "0mm",
"OriginY:=" , "0mm",
"OriginZ:=" , "0mm",
"BeamWidth:=" , "10mm"
])
oModule.AssignGaussianBeam(
["NAME:IncGBeam2",
"Faces:=" , [9],
"IsCartesian:=" , False,
"PhiStart:=" , "0deg",
"PhiStop:=" , "0deg",

Boundary and
Excitation Module Script Commands 14-66
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PhiPoints:=" , 1,
"ThetaStart:=" , "0deg",
"ThetaStop:=" , "0deg",
"ThetaPoints:=" , 1,
"EoPhi:=" , "1",
"EoTheta:=" , "0",
"OriginX:=" , "0mm",
"OriginY:=" , "0mm",
"OriginZ:=" , "0mm",
"BeamWidth:=" , "10mm"
])

VB Syntax AssignGaussianBeam <IncidentWaveArray>


oModule.AssignGaussianBeam Array("NAME:IncGBeam1",
"Faces:=", Array(9),
"IsCartesian:=", true,
"EoX:=" , "1", "EoY:=", "0", "EoZ:=", "0",
VB Example
"kX:=", "0", "kY:=", "0", "kZ:=", "1",
"OriginX:=", "0mm", "OriginY:=", "0mm", "OriginZ:=", "0mm",
"BeamWidth:=", "10mm")
oModule.AssignGaussianBeam Array("NAME:IncGBeam1",

Boundary and
Excitation Module Script Commands 14-67
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Faces:=", Array(9),
"IsCartesian:=", false,
"PhiStart:=","0deg", "PhiStop:=", "90deg", "PhiPoints:=", 2,
"ThetaStart:=", "0deg", "ThetaStop:=", "180deg", "ThetaPoints:=", 3,
"EoPhi:=", "1", "EoTheta:=", "0",
"OriginX:=", "0mm", "OriginY:=", "0mm", "OriginZ:=", "0mm",
"BeamWidth:=", "10mm")

AssignHalfSpace
Assigns a Half Space boundary, dividing the background material at a specified Z axis point. You also assign a material, typically to
the lower half.

UI Access HFSS > Boundaries > Assign > Half Space...

Name Type Description


<ArgArray> Array Structured array.

Parameters Array("NAME:<Name of Half Space>",


"ZLocation:=", "<intUnits>",
"Material:=", "<string material name>")

Return Value None.

Python Syntax AssignHalfSpace(<ArgArray>)

Boundary and
Excitation Module Script Commands 14-68
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.AssignHalfSpace(["NAME:HalfSpace1",
Python Example "ZLocation:=", "2mm",
"Material:=", "water_sea"])

VB Syntax AssignHalfSpace <ArgArray>


oModule.AssignHalfSpace Array("NAME:HalfSpace1",
VB Example
"ZLocation:=", "2mm", "Material:=", "water_sea")

AssignHertzianDipoleWave
Assigns an incident Hertzian-Dipole wave as excitation.

UI Access HFSS > Excitations > Assign > Incident Wave > Hertzian-Dipole Wave...

Name Type Description


<ArgArray> Array Structured array.
Array("NAME:<Name of incident wave>",
"Faces:=", <array of face IDs>,
"IsCartesian:=", <boolean>,
Parameters
"EoX:=" , "<numeric value>",
"EoY:=" , "<numeric value>",
"EoZ:=" , "<numeric value>",
"kX:=" , "<numeric value>",
"kY:=" , "<numeric value>",

Boundary and
Excitation Module Script Commands 14-69
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"kZ:=" , "<numeric value>",


"OriginX:=" , "<numUnit>",
"OriginY:=" , "<numUnit>",
"OriginZ:=" , "<numUnit>",
"SphereRadius:=" , "<numUnit>",
"IsElectricDipole:=" , <boolean>
)

Return Value None.

Python Syntax AssignHertzianDipoleWave(<ArgArray>)


oModule.AssignHertzianDipoleWave(
["NAME:IncHDWave2",
"Faces:=" , [9],
"IsCartesian:=" , True,
Python Example "EoX:=" , "0",
"EoY:=" , "0",
"EoZ:=" , "1",
"kX:=" , "0",
"kY:=" , "0",

Boundary and
Excitation Module Script Commands 14-70
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"kZ:=" , "1",
"OriginX:=" , "0mm",
"OriginY:=" , "0mm",
"OriginZ:=" , "0mm",
"SphereRadius:=" , "10mm",
"IsElectricDipole:=" , True
])

VB Syntax AssignHertzianDipoleWave<ArgArray>
oModule.AssignHertzianDipoleWave Array("NAME:IncHDWave2",
"Faces:=", Array(9),
"IsCartesian:=", true,
"EoX:=" , "0", "EoY:=", "0", "EoZ:=", "1",
VB Example
"kX:=", "0", "kY:=", "0", "kZ:=", "1",
"OriginX:=", "0mm", "OriginY:=", "0mm", "OriginZ:=", "0mm",
"SphereRadius:=", "10mm",
"IsElectricDipole:=", true)

AssignHybridRegion
Assigns a Hybrid Region to a conductor, one of IE, PO, or SBR.

UI Access HFSS > Hybrid > Assign Hybrid > IE Region... or PO Region... or SBR+ Region....

Boundary and
Excitation Module Script Commands 14-71
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<ArgArray> Array Structured array.
Array("NAME:<name of hybrid region>",
"Objects:=", <array of names for the geometry assigned
as Hybrid Region>,
Parameters
"Type:=" , <string one of "IE", "PO" or "SBR">,
"IsLinkedRegion:=" , <boolean>,
"ConductivityThreshold:=", "<numUnit>"
)

Return Value None.

Python Syntax AssignHybridRegion(<ArgArray>)


oModule.AssignHybridRegion(
["NAME:Hybrid1",
"Objects:=" , ["Cylinder1"],
Python Example
"Type:=" , "IE",
"IsLinkedRegion:=" , False,
"ConductivityThreshold:=", "20000S_per_m"])

Boundary and
Excitation Module Script Commands 14-72
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax AssignHybridRegion <ArgArray>


oModule.AssignHybridRegion Array("NAME:Hybrid1",
"Objects:=", Array("RegularPolyhedron1"),
VB Example
"Type:=", "PO",
"IsLinkedRegion:=", false)

AssignIERegion
Assigns an IE Region to a conductor contained within a FEBI Radiation boundary.

UI Access N/A

Name Type Description


Parameters
<GeometryName> String Name of the geometry to be assigned as an IE Region.

Return Value None.

Python Syntax AssignIERegion (<GeometryName>)


Python Example oModule.AssignIERegion("Box1")

VB Syntax AssignIERegion <GeometryName>


VB Example oModule.AssignIERegion "Box1"

AssignImpedance
Creates an impedance boundary for an HFSS design.

Boundary and
Excitation Module Script Commands 14-73
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access HFSS > Boundaries > Assign > Impedance...

Name Type Description


<ImpedanceArray> Array Structured array.
Array("NAME:<BoundName>",
"Resistance:=", <value>,

Parameters "Reactance:=", <value>,


"InfGroundPlane:=", <boolean>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
)

Return Value None.

Python Syntax AssignImpedance(<ImpedanceArray>)


oModule.AssignImpedance(["NAME:Imped1",
"Resistance:=", "50",
"Reactance:=", "50",
Python Example
"InfGroundPlane:=", False,
"Faces:=", [12]]
)

Boundary and
Excitation Module Script Commands 14-74
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax AssignImpedance <ImpedanceArray>


oModule.AssignImpedance Array("NAME:Imped1",_
"Resistance:=", "50",_
VB Example "Reactance:=", "50",_
"InfGroundPlane:=", false,_
"Faces:=", Array(12))

AssignIncidentWave
Creates an incident wave excitation.

UI Access N/A

Name Type Description


<IncidentWaveArray> Array Structured array.
Array("NAME:<BoundName>",
"Faces:=", <array of face IDs>,
"IsCartesian:=",<boolean>,
Parameters
"EoX:=", <value>,
"EoY:=", <value>,
"EoZ:=", <value>,
"kX:=", <value>,
"kY:=", <value>,

Boundary and
Excitation Module Script Commands 14-75
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"kZ:=", <value>
"PhiStart:=",<value>,
"PhiStop:=", <value>,
"PhiPoints:=", <int>,
"ThetaStart:=", <value>,
"ThetaStop:=", <value>,
"ThetaPoints:=", <int>,
"EoPhi:=", <value>,
"EoTheta:=", <value>,
"IsPropagating:=", <boolean>,
"IsEvanescent:=", <boolean>,
"IsEllipticallyPolarized:=", <boolean>)
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.

Return Value None.

Python Syntax AssignIncidentWave (<IncidentWaveArray>)


Python Example oModule.AssignIncidentWave(["NAME:IncWave1",

Boundary and
Excitation Module Script Commands 14-76
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Faces:=", [9],
"IsCartesian:=", True,
"EoX:=", "1", "EoY:=", "0", "EoZ:=", "0",
"kX:=", "0", "kY:=", "0", "kZ:=", "1",
"IsPropagating:=", True,
"IsEvanescent:=", False,
"IsEllipticallyPolarized:=", False]
)
oModule.AssignIncidentWave(["NAME:IncWave2",
"Faces:=", [9],
"IsCartesian:=", False,
"PhiStart:=","0deg",
"PhiStop:=", "90deg",
"PhiPoints:=", 2,
"ThetaStart:=", "0deg",
"ThetaStop:=", "180deg",
"ThetaPoints:=", 3,
"EoPhi:=", "1", "EoTheta:=", "0",
"IsPropagating:=", True,
"IsEvanescent:=", False,
"IsEllipticallyPolarized:=", False

Boundary and
Excitation Module Script Commands 14-77
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

])

VB Syntax AssignIncidentWave <IncidentWaveArray>


oModule.AssignIncidentWave Array("NAME:IncWave1",_
"Faces:=", Array(9),_
"IsCartesian:=", true,_
"EoX:=", "1", "EoY:=", "0", "EoZ:=", "0",_
"kX:=", "0", "kY:=", "0", "kZ:=", "1",
"IsPropagating:=", true, _
"IsEvanescent:=", false, _
"IsEllipticallyPolarized:=", false)
VB Example
oModule.AssignIncidentWave Array("NAME:IncWave2",_
"Faces:=", Array(9),_
"IsCartesian:=", false,_
"PhiStart:=","0deg",_
"PhiStop:=", "90deg",_
"PhiPoints:=", 2,_
"ThetaStart:=", "0deg",_
"ThetaStop:=", "180deg",_

Boundary and
Excitation Module Script Commands 14-78
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ThetaPoints:=", 3, _
"EoPhi:=", "1", "EoTheta:=", "0", _
"IsPropagating:=", true, _
"IsEvanescent:=", false, _
"IsEllipticallyPolarized:=", false)

AssignLatticePair
Assigns coupled Lattice Pair boundaries.

UI Access HFSS > Boundaries > Assign > Coupled... > Lattice Pair...

Name Type Description


<BoundaryArray> Array Structured array.
Array("NAME:<BoundName>",
"Faces:=", <Array of face IDs>,

Parameters "ReverseV:=", <boolean>,


"PhaseDelay:=", <UseScanAngle | InputPhaseDelay>,
"Phi:=", <numdeg>,
"Theta:=", <numdeg>,
"Phase:=", <numdeg>)

Return Value None.

Python Syntax AssignLatticePair(<BoundaryArray>)

Boundary and
Excitation Module Script Commands 14-79
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.AssignLatticePair(
["NAME:LatticePair1",
"Faces:=" , [9,8],
"ReverseV:=" , False,
"PhaseDelay:=" , "UseScanAngle",
"Phi:=" , "0deg",
"Theta:=" , "0deg"]
Python Example )
oModule.AssignLatticePair(
["NAME:LatticePair2",
"Faces:=" , [8,9],
"ReverseV:=" , False,
"PhaseDelay:=" , "InputPhaseDelay",
"Phase:=" , "10deg"]
)

VB Syntax AssignLatticePair <BoundaryArray>


oModule.AssignLatticePair Array("NAME:LatticePair1",
VB Example
"Faces:=", Array(9,8),

Boundary and
Excitation Module Script Commands 14-80
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ReverseV:=", false,
"PhaseDelay:=", "UseScanAngle",
"Phi:=", "0deg",
"Theta:=", "0deg")
oModule.AssignLatticePair Array("NAME:LatticePair2",
"Faces:=", Array(8,9),
"ReverseV:=", false,
"PhaseDelay:=", "InputPhaseDelay",
"Phase:=", "10deg")

AssignLayeredImp
Creates a layered impedance boundary.

UI Access HFSS > Boundaries > Assign > Layered Impedance...

Name Type Description


<LayeredImpArray> Array Structured array.
Array("NAME:<BoundName>",
"Frequency:=", <value>,

Parameters "Roughness:=", <value>,


"IsInternal:=", <bool>,
"IsTwoSided:=", <bool>,
"IsShellElement:=", <bool>,
<LayersArray>,

Boundary and
Excitation Module Script Commands 14-81
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>,
"InfGroundPlane:=", <boolean>)
<LayersArray> Array Structured array.
Array("NAME:Layers",
<OneLayerArray>, <OneLayerArray>, ...)
<OneLayerArray> Array Structured array.
Array("NAME:<LayerName>",
"LayerType:=", <LayerType>,
"Thickness:=",<value>,
"Material:=", <string>)
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".
<LayerName> String Specifies the layer number, such as "Layer1" or "Layer2"
<LayerType> String Should be specified for the last layer only.
Possible values: "Infinite", "PerfectE", or "PerfectH"

Return Value None.

Boundary and
Excitation Module Script Commands 14-82
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax AssignLayeredImp(<LayeredImpArray>)


oModule.AssignLayeredImp(
["NAME:Layered1",
"Objects:=", ["Rectangle1"],
"Frequency:=", "0GHz",
"Roughness:=", "0um",
Python Example
"IsTwoSided:=", True,
"IsShellElement:=", True,
["NAME:Layers", ["NAME:Layer1",
"Thickness:=", "1um", "Material:=", "vacuum"]],
"InfGroundPlane:=", False])

VB Syntax AssignLayeredImp <LayeredImpArray>


oModule.AssignLayeredImp Array("NAME:Layered1",
"Objects:=", Array("Rectangle1"),
"Frequency:=", "0GHz",
"Roughness:=", "0um",
VB Example
"IsTwoSided:=", true,
"IsShellElement:=", true,
Array("NAME:Layers", Array("NAME:Layer1",
"Thickness:=", "1um", "Material:=", "vacuum")),

Boundary and
Excitation Module Script Commands 14-83
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"InfGroundPlane:=", false)

AssignLinearAntennaWave
Creates an incident linear antenna wave excitation.

UI Access HFSS > Excitations > Assign > Incident Wave > Linear Antenna Wave...

Name Type Description


<IncidentWaveArray> Array Structured array.
Array("NAME:<Name of incident wave>",
"Faces:=", <array of face IDs>,
"IsCartesian:=", <boolean>,
"EoX:=" , "<numeric value>",
"EoY:=" , "<numeric value>",
"EoZ:=" , "<numeric value>",
Parameters
"kX:=" , "<numeric value>",
"kY:=" , "<numeric value>",
"kZ:=" , "<numeric value>",
"PhiStart:=",<value>,
"PhiStop:=", <value>,
"PhiPoints:=", <int>,
"ThetaStart:=", <value>,
"ThetaStop:=", <value>,

Boundary and
Excitation Module Script Commands 14-84
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ThetaPoints:=", <int>,
"EoPhi:=", <value>,
"EoTheta:=", <value>,
"OriginX:=" , "<numUnit>",
"OriginY:=" , "<numUnit>",
"OriginZ:=" , "<numUnit>",
"AntennaRadius:=" , "<numUnit>",
"AntennaLength:=" , "<numUnit>")
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.

Return Value None.

Python Syntax AssignLinearAntennaWave(<IncidentWaveArray>)


oModule.AssignLinearAntennaWave(
["NAME:IncLWave1",
"Faces:=" , [9],
Python Example
"IsCartesian:=" , True,
"EoX:=" , "1",
"EoY:=" , "0",

Boundary and
Excitation Module Script Commands 14-85
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"EoZ:=" , "0",
"kX:=" , "0",
"kY:=" , "0",
"kZ:=" , "1",
"OriginX:=" , "0mm",
"OriginY:=" , "0mm",
"OriginZ:=" , "0mm",
"AntennaRadius:=" , "10mm",
"AntennaLength:=" , "10mm"
])
oModule.AssignLinearAntennaWave(
["NAME:IncLWave2",
"Faces:=" , [9],
"IsCartesian:=" , False,
"PhiStart:=" , "0deg",
"PhiStop:=" , "0deg",
"PhiPoints:=" , 1,
"ThetaStart:=" , "0deg",
"ThetaStop:=" , "0deg",
"ThetaPoints:=" , 1,

Boundary and
Excitation Module Script Commands 14-86
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"EoPhi:=" , "1",
"EoTheta:=" , "0",
"OriginX:=" , "0mm",
"OriginY:=" , "0mm",
"OriginZ:=" , "0mm",
"AntennaRadius:=" , "10mm",
"AntennaLength:=" , "10mm"
])

VB Syntax AssignLinearAntennaWave <IncidentWaveArray>


oModule.AssignLinearAntennaWave Array("NAME:IncLWave1",
"Faces:=", Array(9),
"IsCartesian:=", true,
"EoX:=" , "1", "EoY:=", "0", "EoZ:=", "0",
"kX:=", "0", "kY:=", "0", "kZ:=", "1",
VB Example "OriginX:=", "0mm", "OriginY:=", "0mm", "OriginZ:=", "0mm",
"AntennaRadius:=", "10mm",
"AntennaLength:=", "10mm")
oModule.AssignLinearAntennaWave Array("NAME:IncLWave2",
"Faces:=", Array(9),
"IsCartesian:=", false,

Boundary and
Excitation Module Script Commands 14-87
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PhiStart:=","0deg", "PhiStop:=", "90deg", "PhiPoints:=", 2,


"ThetaStart:=", "0deg", "ThetaStop:=", "180deg", "ThetaPoints:=", 3,
"EoPhi:=", "1", "EoTheta:=", "0",
"OriginX:=", "0mm", "OriginY:=", "0mm", "OriginZ:=", "0mm",
"AntennaRadius:=", "10mm",
"AntennaLength:=", "10mm")

AssignLinkedImpedance
Assigns a linked Impedance boundary.

UI Access HFSS > Boundaries > Assign > Linked Impedance...

Name Type Description


<LinkedImpArray> Array Structured array.
Array("NAME:<BoundName>",
"Faces:=", <array of face IDs>,
"UseInfiniteGroundPlane:=", <boolean>,
Parameters "UseShellElement:=" , <boolean>,
<LinkDataArray>)
<LinkDataArray> Array Structured array.
Array("NAME:<LinkName>",
"Project:=", <string file path>,
"Product:=", <string product type>,

Boundary and
Excitation Module Script Commands 14-88
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Design:=", <string linked source design name>,


"Soln:=", <string linked source solution name>, <array
solution parameters>,
"ForceSourceToSolve:=", <boolean>,
"PreservePartnerSoln:=" , <boolean>,
"PathRelativeTo:=" , <string target project name>)

Return Value None.

Python Syntax AssignLinkedImpedance(<LinkedImpArray>)


oModule.AssignLinkedImpedance(
["NAME:Linked1",
"Faces:=", [9],
"UseInfiniteGroundPlane:=", True,
"UseShellElement:=", True,
["NAME:XLink",
Python Example
"Project:=", "C://temp/linkedproject.aedt",
"Product:=", "HFSS",
"Design:=", "Source_Project_Solver",
"Soln:=", "1000MHz : LastAdaptive",
["NAME:Params", "xfactor:=", "1.2", "yfactor:=", "1.6"],
"ForceSourceToSolve:=", True,

Boundary and
Excitation Module Script Commands 14-89
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PreservePartnerSoln:=", False,
"PathRelativeTo:=", "TargetProject"]
])

VB Syntax AssignLinkedImpedance <LinkedImpArray>


oModule.AssignLinkedImpedance Array("NAME:Linked1",
"Faces:=", Array(9),
"UseInfiniteGroundPlane:=", true,
"UseShellElement:=", true,
Array("NAME:XLink",
"Project:=", "C://temp/linkedproject.aedt",
VB Example "Product:=", "HFSS",
"Design:=", "Source_Project_Solver",
"Soln:=", "1000MHz : LastAdaptive",
Array("NAME:Params", "xfactor:=", "1.2", "yfactor:=", "1.6"),
"ForceSourceToSolve:=", true,
"PreservePartnerSoln:=", false,
"PathRelativeTo:=", "TargetProject"))

Boundary and
Excitation Module Script Commands 14-90
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AssignLinkedRegion
Assigns a Hybrid Region as a Linked Region.

UI Access N/A

Name Type Description


<LinkedRegionArray> Array Structured array.
Array("NAME:<name of linked region>",
"Objects:=", <array, names for the objects assigned as
Parameters
Hybrid Region>,
"Type:=" , <string, one of "IE", "PO" or "SBR">,
"IsLinkedRegion:=" , <boolean, true for linked
region>)

Return Value None.

Python Syntax AssignLinkedRegion (<LinkedRegionArray>)


oModule.AssignLinkedRegion (
["NAME:Linked1",
"Objects:=", ["RegularPolyhedron1"],
Python Example
"Type:=", "PO",
"IsLinkedRegion:=", True
])

Boundary and
Excitation Module Script Commands 14-91
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax AssignLinkedRegion <LinkedRegionArray>


oModule.AssignLinkedRegion Array("NAME:Linked1",
"Objects:=", Array("RegularPolyhedron1"),
VB Example
"Type:=", "PO",
"IsLinkedRegion:=", true)

AssignLumpedPort
Creates a lumped port excitation.

UI Access HFSS > Excitations > Assign > Port > Lumped Port...

Name Type Description


<LumpedPortArray> Array Structured array.
Array("NAME:<BoundName>",
"Faces:=", <FaceIDArray>,
"RenormalizeAllTerminals:=", <boolean>,
"DoDeembed:=", <boolean>,
Parameters
<ModesArray>,
"ShowReporterFilter:=", <boolean>,
"ReporterFilter:=", <array of boolean>,
"Impedance:=" , <value>)
<ModesArray> Array Structured array.
Array("NAME:<ModesArrayName>",

Boundary and
Excitation Module Script Commands 14-92
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<OneModeArray>, <OneModeArray>,...)
<OneModeArray> Array Structured array.
Array("NAME:<ModeName>",
"ModeNum:=", <integer>,
"UseIntLine:=", <boolean>,
<IntegerationLineArray>,
"AlignmentGroup:=", <integer, group id>,
"CharImp:=", <string, characteristic impedance>,
"RenormImp:=" , <value, renormalize impedance to>)
< Array Structured array.
IntegerationLineArray>
Array("NAME:<LineName>",
"Coordinate System:=", <string, relative coordinate
system>,
"Start:=" , <array, start location coordinates>,
"End:=" , <array, end location coordinates>)

Return Value None.

Python Syntax AssignLumpedPort (<LumpedPortArray>)


oModule.AssignLumpedPort(
Python Example ["NAME:LumpledPort1",
"Faces:=", [9],

Boundary and
Excitation Module Script Commands 14-93
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"DoDeembed:=", False,
"RenormalizeAllTerminals:=", True,
["NAME:Modes",
["NAME:Mode1",
"ModeNum:=", 1,
"UseIntLine:=", True,
["NAME:IntLine",
"Coordinate System:=", "Global",
"Start:=", ["-0.4mm","-1mm","0.8mm"],
"End:=" , ["-0.3mm","-1.2mm","0.8mm"]
],
"AlignmentGroup:=", 0,
"CharImp:=", "Zpi",
"RenormImp:=", "50ohm"]],
"ShowReporterFilter:=", False,
"ReporterFilter:=", [True],
"Impedance:=", "50ohm"
])

Boundary and
Excitation Module Script Commands 14-94
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax AssignLumpedPort <LumpedPortArray>


oModule.AssignLumpedPort Array("NAME:LumpedPort1",
"Faces:=", Array(9),
"DoDeembed:=", false,
"RenormalizeAllTerminals:=", true,
Array("NAME:Modes",
Array("NAME:Mode1", "ModeNum:=", 1, "UseIntLine:=", true,
VB Example Array("NAME:IntLine", "Coordinate System:=", "Global",
"Start:=", Array("-0.4mm", "-1mm", "0.8mm"),
"End:=", Array("-0.55mm", "-0.95mm", "0.8mm")),
"AlignmentGroup:=", 0, "CharImp:=", "Zpi", "RenormImp:=", "50ohm")),
"ShowReporterFilter:=", false,
"ReporterFilter:=", Array(true),
"Impedance:=", "50ohm")

AssignLumpedRLC
Creates a lumped RLC boundary.

UI Access HFSS > Boundaries > Assign > Lumped RLC...

Name Type Description


<LumpedRLCArray> Array Structured array.
Parameters
Array("NAME:<BoundName>",
"RLC Type:=" , <"Parallel" | "Serial" >,

Boundary and
Excitation Module Script Commands 14-95
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseResist:=",<boolean>,
"Resistance:=", <value>,
"UseInduct:=", <boolean>,
"Inductance:=", <value>,
"UseCap:=", <boolean>,
"Capacitance:=", <value>,
<CurrentLineArray>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
<CurrentLineArray> Array Structured array.
Array("NAME:CurrentLine", _
"Start:=", <LineEndPoint>,
"End:=", <LineEndPoint>)

Return Value None.

Python Syntax AssignLumpedRLC (<LumpedRLCArray>)


oModule.AssignLumpedRLC(
Python Example [
"NAME:LumpRLC1",

Boundary and
Excitation Module Script Commands 14-96
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Objects:=", ["Box1"],
[
"NAME:CurrentLine",
"Start:=", ["0.15mm","-0.2mm","0mm"],
"End:=" , ["0.15mm","0.6mm","0mm"]
],
"RLC Type:=", "Parallel",
"UseResist:=", True,
"Resistance:=", "100ohm",
"UseInduct:=", True,
"Inductance:=", "10nH",
"UseCap:=", True,
"Capacitance:=", "10pF"
])

VB Syntax AssignLumpedRLC <LumpedRLCArray>


oModule.AssignLumpedRLC Array("NAME:LumpRLC1",_
"RLC Type:=" ," Parallel" ,
VB Example "UseResist:=", true,_
"Resistance:=", "10Ohm",_
"UseInduct:=", true,_

Boundary and
Excitation Module Script Commands 14-97
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"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
Creates a magnetic bias source.

UI Access HFSS > Excitations > Assign > Magnetic Bias...

Name Type Description


<MagneticBiasArray> Array Structured array.
Array("NAME:<BoundName>",
"IsUniformBias:=", <boolean>,
"Bias:=", <value>,
Parameters
"XAngle:=", <value>,
"YAngle:=", <value>,
"ZAngle:=", <value>,
"Project:=",<string>,
"Objects:=", <AssignmentObjects>)

Boundary and
Excitation Module Script Commands 14-98
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

IsUniformBias
If true, supply the Bias, XAngle, YAngle, and ZAngle parameters.
If false, supply the Project parameter.

Return Value None.

Python Syntax AssignMagneticBias (<MagneticBiasArray>)


oModule.AssignMagneticBias(
["NAME:MagBias1",
"IsUniformBias:=", True,
"Bias:=", "1",
"XAngle:=", "10deg",
"YAngle:=", "10deg",
Python Example "ZAngle:=", "10deg",
"Objects:=", ["Box2"]])
oModule.AssignMagneticBias(
["NAME:MagBias2",
"IsUniformBias:=", False,
"Project:=","D:/Maxwell/testing/m3dfs.pjt",
"Objects:=", ["Box2"]])

Boundary and
Excitation Module Script Commands 14-99
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax AssignMagneticBias <MagneticBiasArray>


oModule.AssignMagneticBias Array("NAME:MagBias1",_
"IsUniformBias:=", true,_
"Bias:=", "1",_
"XAngle:=", "10deg",_
"YAngle:=", "10deg",_
VB Example "ZAngle:=", "10deg",_
"Objects:=", Array("Box2"))
oModule.AssignMagneticBias Array("NAME:MagBias2",_
"IsUniformBias:=", false,_
"Project:=","D:/Maxwell/testing/m3dfs.pjt",_
"Objects:=", Array("Box2"))

AssignMultipactionChargeRegion
Creates a Multipaction Charge Region for HFSS multipaction analysis.

UI Access HFSS > Excitations > Assign > Multipaction Charge Region...

Name Type Description


<ChargeRegionArray> Array Structured array.
Parameters
Array("NAME:MultipactionChargeRegion1",
"Objects:=", <array of objects>,

Boundary and
Excitation Module Script Commands 14-100
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Faces:=", <array of face IDs>,


"NumParticles:=", "<integer, number of
particles>",
"ParticleCharge:=", "<num><unit>",
"ParticleMass:=", "<num><unit>",
"Vx:=", "<num><unit>",
"Vy:=", "<num><unit>",
"Vz:=", "<num><unit>")

Return Value None.

Python Syntax AssignMultipactionChargeRegion(<ChargeRegionArray>)


oModule.AssignMultipactionChargeRegion(
["NAME:MultipactionChargeRegion1",
"Objects:=" , ["Cylinder1"],
"NumParticles:=" , "100",
Python Example "ParticleCharge:=" , "-1.60217662e-19Coulomb",
"ParticleMass:=" , "9.10938356e-31kg",
"Vx:=" , "0.1m_per_sec",
"Vy:=" , "0.3m_per_sec",
"Vz:=" , "0.15m_per_sec"])

Boundary and
Excitation Module Script Commands 14-101
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax AssignMultipactionChargeRegion <ChargeRegionArray>


oModule.AssignMultipactionChargeRegion Array("NAME:MultipactionChargeRegion1", _
"Objects:=", Array("Cylinder1"), _
"NumParticles:=", "100", _
VB Example
"ParticleCharge:=", "-1.60217662e-19Coulomb", _
"ParticleMass:=", "9.10938356e-31kg", _
"Vx:=", "0.1m_per_sec", "Vy:=", "0.3m_per_sec", "Vz:=", "0.15m_per_sec")

AssignMultipactionDCBias
Set up DC electric or magnetic bias fields for a multipaction analysis

UI Access HFSS > Excitations > Assign > Multipaction DC Bias...

Name Type Description


<DCBiasArray> Array Structured array.
Array(NAME:MultipactionDCBias1",
"Objects:=", <array of objects>,
"UniformE:=", <boolean>,
Parameters
"Ex:=", "<value><unit>",
"Ey:=", "<value><unit>",
"Ez:=", "<value><unit>",
<LinkedField>,
"UniformH:=" , <boolean>,

Boundary and
Excitation Module Script Commands 14-102
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Hx:=", "<value><unit>",
"Hy:=", "<value><unit>",
"Hz:=", "<value><unit>",
<LinkedField>)
UniformE or Uniform H:
l True - provide filed values.

False - provide field through linked Maxwell analysis.


l

<LinkedField> Array Structured array.


Array("NAME:<EField | HField>",
"Project:=", <string, path to linked project
file>,
"Product:=", "Maxwell",
"Design:=", <string, name of source design>,
"Soln:=", <string, name of linked solution>,
<Parameters for linked solution>,
"ForceSourceToSolve:=", <boolean>,
"PreservePartnerSoln:=", <boolean>,
"PathRelativeTo:=" , "TargetProject")

Return Value None.

Boundary and
Excitation Module Script Commands 14-103
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax AssignMultipactionDCBias (<DCBiasArray>)


oModule.AssignMultipactionDCBias(
["NAME:MultipactionDCBias1",
"Objects:=", ["Cylinder1"],
"UniformE:=", False,
["NAME:EField",
"Project:=", "C://projects/Maxwell/HallSensor.aedt",
"Product:=", "Maxwell",
"Design:=", "3_Maxwell3D",
"Soln:=", "Setup1 : Transient",
Python Example ["NAME:Params",
"angle:=", "0deg",
"cell_spacing:=", "2.5mm",
"die_thickness:=", "2mm",
"gap:=", "1.5mm",
"magnet_center_y:=", "0mm",
"magnet_center_z:=", "0mm",
"magnet_x:=", "3mm",
"magnet_y:=", "6mm",
"magnet_z:=", "5mm",

Boundary and
Excitation Module Script Commands 14-104
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"move_x:=", "-1.5mm",
"sensor_offset_x:=", "0mm",
"sensor_offset_y:=", "0mm",
"sensor_offset_z:=", "0mm",
"sensor_pitch:=", "0deg",
"sensor_roll:=", "0deg",
"sensor_yaw:=", "0deg",
"target_dia:=", "80mm"
],
"ForceSourceToSolve:=", False,
"PreservePartnerSoln:=", False,
"PathRelativeTo:=", "TargetProject"
],
"UniformH:=", True,
"Hx:=", "0A_per_m",
"Hy:=", "0A_per_m",
"Hz:=", "0A_per_m"
])

VB Syntax AssignMultipactionDCBias <DCBiasArray>


VB Example oModule.AssignMultipactionDCBias Array("NAME:MultipactionDCBias1", _

Boundary and
Excitation Module Script Commands 14-105
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Objects:=", Array("Cylinder1"), _
"UniformE:=", true, _
"Ex:=", "0V_per_meter", "Ey:=", "0V_per_meter", "Ez:=", "0V_per_meter", _
"UniformH:=", true, _
"Hx:=", "0A_per_m", "Hy:=", "0A_per_m", "Hz:=", "0A_per_m")

AssignMultipactionSEE
Creates Secondary Electron Emission (SEE) boundaries for a Multipaction analysis.

UI Access HFSS > Boundaries > Assign > Multipaction SEE...

Name Type Description


<SEEArray> Array Structured array.
Array("NAME:<SEEName>",
"Faces:=", <array of face IDs>,
"AlphaMax:=", <value>,

Parameters "Alpha0:=", <value>,


"E0:=", <value>,
"E1:=", <value>,
"E2:=", <value>,
"Em:=", <value>,
"DielectricSurface:=", <boolean>)

Boundary and
Excitation Module Script Commands 14-106
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax AssignMultipactionSEE (<SEEArray>)


oModule.AssignMultipactionSEE(
["NAME:SEE1",
"Faces:=", [342, 7, 341, 11, 8, 175, 35],
"AlphaMax:=", "2.25", "Alpha0:=", "0",
Python Example
"E0:=", "12.5", "E1:=", "25", "E2:=", "5000",
"Em:=", "175",
"DielectricSurface:=", false]
)

VB Syntax AssignMultipactionSEE <SEEArray>


oModule.AssignMultipactionSEE Array("NAME:SEE1", _
"Faces:=", Array(342, 7, 341, 11, 8, 175, 35), _
VB Example "AlphaMax:=", "2.25", "Alpha0:=", "0", _
"E0:=", "12.5", "E1:=", "25", "E2:=", "5000", _
"Em:=", "175", "DielectricSurface:=", false)

AssignNearFieldWave
Assigns near field wave as excitation.

Boundary and
Excitation Module Script Commands 14-107
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access HFSS > Excitations > Assign > Linked Field > Near Field Wave.

Name Type Description


<NearFieldWaveOptions> Array Structured array containing options to define the near field wave
excitation.
["NAME<name of the incident wave source>:",
"IsFarField:=" <boolean>,
"UseDataLink:=" <boolean>,
"ExternalDataFile:=" <string path to external data file; or pass
empty string>,
"Project:=" <string path to linked project file>,
"Product:=" <string product name for source design>,

Parameters "Design:=" <string name for source design>,


"Soln:=" <string name for source solution>, <ParametersArray>,
"ForceSourceToSolve:=" <boolean True to force source design to
solve in the absence of linked data in the target design; else,
False>,
"PreservePartnerSoln:=" <boolean True to save source design;
else False>,
"PathRelativeTo:=" <string "TargetProject",>,
"SourceCoordSystem:=" <string coordinate system name>,
"Type:=" <string source type>]
<ParametersArray> Array Structured array containing parameters to define the linked source
solution.

Boundary and
Excitation Module Script Commands 14-108
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax AssignNearFieldWave (<NearFieldWaveOptions>)


oModule.AssignNearFieldWave([
"NAME:IncNFWave2",
"IsFarField:=", False,
"UseDataLink:=", True,
"ExternalDataFile:=", "",
"Project:=", "C:/HFSS/Antennas/Dish_FEBI.aedt",
"Product:=", "HFSS",
"Design:=", "Horn_Source_Project_for_PO_Solver",
Python Example "Soln:=", "8430MHz : LastAdaptive",[
"NAME:Params",
"xfactor:=", "1.2",
"yfactor:=", "1.6"],
"ForceSourceToSolve:=", False,
"PreservePartnerSoln:=", False,
"PathRelativeTo:=", "TargetProject",
"SourceCoordSystem:=", "Global",
"Type:=", "Incident"])

Boundary and
Excitation Module Script Commands 14-109
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax AssignNearFieldWave <NearFieldWaveOptions>


oModule.AssignNearFieldWave Array(
"NAME:IncNFWave2",
"IsFarField:=", false,
"UseDataLink:=", true,
"ExternalDataFile:=", "",
"Project:=", "C:/HFSS/Antennas/Dish_FEBI.aedt",
"Product:=", "HFSS",
"Design:=", "Horn_Source_Project_for_PO_Solver",
VB Examples
"Soln:=", "8430MHz : LastAdaptive", Array(
"NAME:Params",
"xfactor:=", "1.2",
"yfactor:=", "1.6"),
"ForceSourceToSolve:=", false,
"PreservePartnerSoln:=", false,
"PathRelativeTo:=", "TargetProject",
"SourceCoordSystem:=", "Global",

Boundary and
Excitation Module Script Commands 14-110
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Type:=", "Incident")

AssignPerfectE
Creates a perfect E boundary.

UI Access HFSS > Boundaries > Assign > Perfect E...

Name Type Description


<PerfectEArray> Array Structured array.
Array("NAME:<BoundName>",
Parameters
"InfGroundPlane:=", <boolean>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)

Return Value None.

Python Syntax AssignPerfectE (<PerfectEArray>)


oModule.AssignPerfectE([
"NAME:PerfE1",
Python Example
"InfGroundPlane:=", False,
"Faces:=", [12]])

VB Syntax AssignPerfectE <PerfectEArray>

Boundary and
Excitation Module Script Commands 14-111
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.AssignPerfectE Array("NAME:PerfE1",_
VB Example "InfGroundPlane:=", false,_
"Faces:=", Array(12))

AssignPerfectH
Creates a perfect H boundary.

UI Access HFSS > Boundaries > Assign > Perfect H...

Name Type Description


<PerfectHArray> Array Structured array.

Parameters Array("NAME:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)

Return Value None.

Python Syntax AssignPerfectH (<PerfectHArray>)


oModule.AssignPerfectH([
Python Example "NAME:PerfH1",
"Faces:=", [12]])

Boundary and
Excitation Module Script Commands 14-112
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax AssignPerfectH <PerfectHArray>


oModule.AssignPerfectH Array("NAME:PerfH1",_
VB Example
"Faces:=", Array(12))

AssignPlaneWave
Creates an incident plane wave excitation.

UI Access HFSS > Excitations > Assign > Incident Wave > Plane Wave...

Name Type Description


< Array Structured array.
PlaneWaveArray>
Array("NAME:<Name of incident wave>",
"Faces:=", <array of face IDs>,
"IsCartesian:=", <boolean>,
"EoX:=", "<numeric value>",
"EoY:=", "<numeric value>",

Parameters "EoZ:=", "<numeric value>",


"kX:=", "<numeric value>",
"kY:=", "<numeric value>",
"kZ:=", "<numeric value>",
"PhiStart:=",<value>,
"PhiStop:=", <value>,
"PhiPoints:=", <int>,
"ThetaStart:=", <value>,

Boundary and
Excitation Module Script Commands 14-113
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ThetaStop:=", <value>,
"ThetaPoints:=", <integer>,
"EoPhi:=", <value>,
"EoTheta:=", <value>,
"OriginX:=", "<numUnit>",
"OriginY:=", "<numUnit>",
"OriginZ:=", "<numUnit>",
"IsPropagating:=", <boolean>,
"IsEvanescent:=", <boolean>,
"IsEllipticallyPolarized:=", <boolean>,
"RealPropConst:=", "<value>",
"ImagPropConst:=", "<value>",
"PolarizationAngle:=", "<value>deg",
"PolarizationRatio:=" , "<value>")
IsCartesian:

l True - provide the EoX, EoY, EoZ, kX, kY, kZ parameters.


l False - provide the PhiStart, PhiStop, PhiPoints, ThetaStart, ThetStop,
ThetaPoints, EoPhi, EoTheta parameters.
IsEvanescent:

l True - provide the RealPropConst, ImagPropConst.

Boundary and
Excitation Module Script Commands 14-114
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

IsEllipticallyPolarized:

l True - provide the PolarizationAngle, PolarizationRatio.

Return Value None.

Python Syntax AssignPlaneWave(<PlaneWaveArray>)


oModule.AssignPlaneWave(
["NAME:IncPWave1",
"Faces:=" , [9],
"IsCartesian:=" , True,
"EoX:=" , "1",
"EoY:=" , "0",
"EoZ:=" , "0",
Python Example "kX:=" , "0",
"kY:=" , "0",
"kZ:=" , "1",
"OriginX:=" , "0mm",
"OriginY:=" , "0mm",
"OriginZ:=" , "0mm",
"IsPropagating:=" , True,
"IsEvanescent:=" , False,

Boundary and
Excitation Module Script Commands 14-115
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"IsEllipticallyPolarized:=", False
])
oModule.AssignPlaneWave(
["NAME:IncPWave2",
"Faces:=" , [8],
"IsCartesian:=" , False,
"PhiStart:=" , "0deg",
"PhiStop:=" , "0deg",
"PhiPoints:=" , 1,
"ThetaStart:=" , "0deg",
"ThetaStop:=" , "0deg",
"ThetaPoints:=" , 1,
"EoPhi:=" , "1",
"EoTheta:=" , "0",
"OriginX:=" , "0mm",
"OriginY:=" , "0mm",
"OriginZ:=" , "0mm",
"IsPropagating:=" , False,
"IsEvanescent:=" , True,
"IsEllipticallyPolarized:=", False,

Boundary and
Excitation Module Script Commands 14-116
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"RealPropConst:=" , "0",
"ImagPropConst:=" , "1"
])

VB Syntax AssignPlaneWave <PlaneWaveArray>


oModule.AssignPlaneWave Array("NAME:IncPWave3", _
"Faces:=", Array(8), _
"IsCartesian:=", true, _
"EoX:=", "1", "EoY:=", "0", "EoZ:=", "0", _
"kX:=", "0", "kY:=", "0", "kZ:=", "1", _
VB Example
"OriginX:=", "0mm", "OriginY:=", "0mm", "OriginZ:=", "0mm", _
"IsPropagating:=", false, _
"IsEvanescent:=", false, _
"IsEllipticallyPolarized:=", true, _
"PolarizationAngle:=", "0deg", "PolarizationRatio:=", "1")

AssignPrimary
Creates a primary boundary.

UI Access HFSS > Boundaries > Assign > Coupled > Primary...

Name Type Description


Parameters
<PrimaryBondArray> Array Structured array.

Boundary and
Excitation Module Script Commands 14-117
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:<BoundName>",
<CoordSysArray>,
"ReverseV:=", <boolean>,
"Faces:=", <AssignmentFaces>)
<CoordSysArray> Array Structured array.
Array("NAME:CoordSysVector",
"Origin:=", <CoordSysPoint>,
"UPos:=", <LineEndPoint>)

Return Value None.

Python Syntax AssignPrimary (<PrimaryBondArray>)


oModule.AssignPrimary(
["NAME:Primary1",
["NAME:CoordSysVector",
"Origin:=", [-1.4, -1.4, -0.8],
Python Example
"UPos:=", [-1.4, -1.4, 0]],
"ReverseV:=", False,
"Faces:=", [12]]
)

Boundary and
Excitation Module Script Commands 14-118
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax AssignPrimary <PrimaryBondArray>


oModule.AssignPrimary Array("NAME:Primary1",_
Array("NAME:CoordSysVector",_
"Origin:=", Array(-1.4, -1.4, -0.8),_
VB Example
"UPos:=", Array(-1.4, -1.4, 0)),_
"ReverseV:=", false,_
"Faces:=", Array(12))

AssignRadiation
Creates a radiation boundary.

UI Access HFSS > Boundaries > Assign > Radiation...

Name Type Description


<RadiationArray> Array Structured array.
Array("NAME:<BoundName>",
"Objects:=", <AssignmentObjects>,
Parameters "Faces:=", <AssignmentFaces>,
"IsFssReference:=", <boolean>,
"IsForPML:=", <boolean>)
"IsFssReference" and "IsForPML" are only used to support legacy designs. In
the current version, these should always be set to "False".

Return Value None.

Boundary and
Excitation Module Script Commands 14-119
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax AssignRadiation(<RadiationArray>)


oModule.AssignRadiation(
[
"NAME:Rad1",
Python Example "Faces:=",[6, 7],
"IsFssReference:=", False,
"IsForPML:=", False
])

VB Syntax AssignRadiation <RadiationArray>


oModule.AssignRadiation Array("NAME:Rad1", _
"Faces:=", Array(6, 7), _
VB Example
"IsFssReference:=", false, _
"IsForPML:=", false)

AssignRFDischargeDCBias
Creates the DC bias for an RF Discharge simulation.

UI Access HFSS > Excitations > Assign > RF Discharge DC Bias...

Boundary and
Excitation Module Script Commands 14-120
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<DCBiasParameters> Array Structured array.
Array("NAME:<DCBiasName>",

Parameters "UniformH:=", <boolean>,


"Hx:=", "<real>A_per_m",
"Hy:=", "<real>A_per_m",
"Hz:=", "<real>A_per_m")

Return Value None.

Python Syntax AssignRFDischargeDCBias (<DCBiasParameters>)


oModule.AssignRFDischargeDCBias(
[
"NAME:RFDischargeDCBias1",
"UniformH:=", True,
Python Example
"Hx:=", "795774.71546A_per_m",
"Hy:=", "0A_per_m",
"Hz:=", "0A_per_m"
])

VB Syntax AssignRFDischargeDCBias <DCBiasParameters>

Boundary and
Excitation Module Script Commands 14-121
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.AssignRFDischargeDCBias _
Array("NAME:RFDischargeDCBias1", _
VB Example
"UniformH:=", True, _
"Hx:=", "795774.71546A_per_m","Hy:=", "0A_per_m","Hz:=", "0A_per_m")

AssignScreeningImpedance
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 see the second example.

Boundary and
Excitation Module Script Commands 14-122
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:XLink",
"Project:=", "<projectName>.aedt",
"Design:=", "<DesignName>",
"Soln:=", "Setup1 : LastAdaptive",
Array("NAME:Params", "<variable>:=", "<value>"),
"ForceSourceToSolve:=", <Boolean>,
"PreservePartnerSoln:=", <Boolean>,
"PathRelativeTo:=", "TargetProject"),
Array("NAME:YLink",
"Project:=", "<projectName>.aedt",
"Design:=", "HFSSDesign1",
"Soln:=", "Setup1 : LastAdaptive",
Array("NAME:Params", "<variable>:=", "<value>"),
"ForceSourceToSolve:=", <Boolean>
"PreservePartnerSoln:=", <Boolean>,
"PathRelativeTo:=", "TargetProject"))
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign

Boundary and
Excitation Module Script Commands 14-123
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
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",
"Faces:=", Array(12),
"IsAnisotropic:=", false,
"HasExternalLink:=", false,
"XResistance:=", "377", "XReactance:=", "0")

Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")

Boundary and
Excitation Module Script Commands 14-124
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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.aedt",
"Design:=", "HFSSDesign1",
"Soln:=", "Setup1 : LastAdaptive",
Array("NAME:Params", "bend_angle:=", "50deg"),
"ForceSourceToSolve:=", false,
"PreservePartnerSoln:=", false,
"PathRelativeTo:=", "TargetProject"),
Array("NAME:YLink", "Project:=", "mydesign.aedt",
"Design:=", "HFSSDesign1",
"Soln:=", "Setup1 : LastAdaptive",
Array("NAME:Params", "bend_angle:=", "50deg"),
"ForceSourceToSolve:=", true,
"PreservePartnerSoln:=", true,
"PathRelativeTo:=", "TargetProject"))

AssignSecondary
Creates a secondary boundary.

Boundary and
Excitation Module Script Commands 14-125
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access HFSS > Boundaries > Assign > Coupled > Secondary...

Name Type Description


<SecondaryBondArray> Array Structured array.
Array("NAME:<BoundName>",
<CoordSysArray>,
"ReverseV:=", <boolean>,
"Primary:=", <string>,
"UseScanAngles:=", <boolean>,
"Phi:=", <value>,
"Theta:=", <value>,

Parameters "Phase:=", <value>,


"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
<UseScanAngles>:

l True - specify Phi and Theta.


False - specify Phase.
l

<CoordSysArray> Array Structured array.


Array("NAME:CoordSysVector",
"Origin:=", <CoordSysPoint>,
"UPos:=", <LineEndPoint>)

Boundary and
Excitation Module Script Commands 14-126
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax AssignSecondary (<SecondaryBondArray>)


oModule.AssignSecondary(["NAME:Secondary1",
["NAME:CoordSysVector",
"Origin:=", [-1, 0, 0.2],
"UPos:=", [-1, 0, 0]],
"ReverseV:=", False,
"Primary:=", "Primary1",
"UseScanAngles:=", True,
"Phi:=", "10deg",
"Theta:=", "0deg",
Python Example
"Faces:=", [12]])
oModule.AssignSecondary(["NAME:Secondary2",
["NAME:CoordSysVector",
"Origin:=", [-1, 0, 0.2],
"UPos:=", [-2, 0, 0.2]],
"ReverseV:=", False,
"Primary:=", "Primary1",
"UseScanAngles:=", False,
"Phase:=", "10deg",

Boundary and
Excitation Module Script Commands 14-127
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Faces:=", [11]])

VB Syntax AssignSecondary <SecondaryBondArray>


oModule.AssignSecondary Array("NAME:Secondary1",_
Array("NAME:CoordSysVector", _
"Origin:=", Array(-1, 0, 0.2),_
"UPos:=", Array(-1, 0, 0)),_
"ReverseV:=", false,_
"Primary:=", "Primary1",_
"UseScanAngles:=", true,_
"Phi:=", "10deg",_
VB Example
"Theta:=", "0deg",_
"Faces:=", Array(12))
oModule.AssignSecondary Array("NAME:Secondary2",_
Array("NAME:CoordSysVector",_
"Origin:=", Array(-1, 0, 0.2),_
"UPos:=", Array(-2, 0, 0.2)),_
"ReverseV:=", false,_
"Primary:=", "Primary1",_

Boundary and
Excitation Module Script Commands 14-128
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseScanAngles:=",false,_
"Phase:=", "10deg",_
"Faces:=", Array(11))

AssignSymmetry
Creates a symmetry boundary.

UI Access HFSS > Boundaries > Assign > Symmetry.

Name Type Description


<SymmetryArray> Array Structured array.
Array("NAME:<BoundName>",
Parameters
"IsPerfectE:=", <boolean>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)

Return Value None.

Python Syntax AssignSymmetry (<SymmetryArray>)


oModule.AssignSymmetry(
["NAME:Sym1",
Python Example
"IsPerfectE:=", True,
"Faces:=", [12]])

Boundary and
Excitation Module Script Commands 14-129
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax AssignSymmetry <SymmetryArray>


oModule.AssignSymmetry Array("NAME:Sym1",_
VB Example "IsPerfectE:=", true,_
"Faces:=", Array(12))

AssignTerminal
Assigns terminals to a port.

UI Access HFSS > Excitations > Assign > Terminal...

Name Type Description


<TerminalArray> Array Structured array.
Array("NAME: <TerminalName>,
Parameters "Edges:", <array of edge IDs>,
"ParentBndID":= , "<string, name of port>",
"TeminalResistance:=", <string, value and units for
the resistance.>)

Return Value None.

Python Syntax AssignTerminal (<TerminalArray>)

Boundary and
Excitation Module Script Commands 14-130
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.AssignTerminal(
["NAME:Rectangle1_T1",
Python Example "Edges:=", [36],
"ParentBndID:=", "WavePort1",
"TerminalResistance:=", "50ohm"])

VB Syntax AssignTerminal <TerminalArray>


oModule.AssignTerminal Array("NAME:Rectangle1_T1", _
VB Example "Edges:=", Array(36), "ParentBndID:=", _
"WavePort1", "TerminalResistance:=", "50ohm")

AssignVoltage
Creates a voltage source.

UI Access HFSS > Excitations > Assign > Voltage...

Name Type Description


<VoltageArray> Array Structured array.
Array("NAME:<BoundName>",

Parameters "Voltage:=", <value>,


<DirectionArray>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)

Boundary and
Excitation Module Script Commands 14-131
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<DirectionArray> Array Structured array.


Array("NAME:Direction",_
"Start:=",<LineEndPoint>,
"End:=", <LineEndPoint>)

Return Value None.

Python Syntax AssignVoltage (<VoltageArray>)


oModule.AssignVoltage(["NAME:Voltage1",
"Voltage:=", "1000mV",
["NAME:Direction",
Python Example
"Start:=", [-0.4, -1.2, 0],
"End:=", [-1.4, -1.2, 0]],
"Faces:=", [7])

VB Syntax AssignVoltage <VoltageArray>


oModule.AssignVoltage Array("NAME:Voltage1",_
"Voltage:=", "1000mV",_
VB Example
Array("NAME:Direction",_
"Start:=", Array(-0.4, -1.2, 0),_

Boundary and
Excitation Module Script Commands 14-132
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"End:=", Array(-1.4, -1.2, 0)),_


"Faces:=", Array(7))

AssignWavePort
Creates a wave port.

UI Access HFSS > Excitations > Assign > Port > Wave Port...

Name Type Description


<WavePortArray> Array Structured array.
Array("NAME:<BoundName>",
"Faces:=", <FaceIDArray>,
"NumModes:=", <integer>,
"PolarizeEField:=",<boolean>,
"DoDeembed:=", <boolean>,
"DeembedDist:=", <value>,
Parameters
"DoRenorm:=", <boolean>,
"RenormValue:=",<value>,
<ModesArray>,
"TerminalIDList:=", <TerminalsArray>)
NumModes
Number of modes for modal problems.
Number of terminals for terminal problems.
<ModesArray> Array Structured array.

Boundary and
Excitation Module Script Commands 14-133
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Modes",
<OneModeArray>, <OneModeArray>, ...)
<OneModeArray> Array Structured array.
Array("NAME:<ModeName>",
"ModeNum:=", <integer>,
"UseIntLine:=", <boolean>,
<IntLineArray>)
<IntLineArray> Array Structured array.
Array("NAME:IntLine",
"Start:=", <LineEndPoint>,
"End:=", <LineEndPoint>,
"CharImp:=", <string, Characteristic impedance of
the mode. Possible values are "Zpi", "Zpv", or
"Zvi">)

Return Value None.

Python Syntax AssignWavePort (<WavePortArray>)


oModule.AssignWavePort(["NAME:WavePort1",
"NumModes:=", 2,
Python Example
"PolarizeEField:=",False,
"DoDeembed:=", True,

Boundary and
Excitation Module Script Commands 14-134
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"DeembedDist:=", "10mil",
"DoRenorm:=", True,
"RenormValue:=","50Ohm",
["NAME:Modes",
["NAME:Mode1",
"ModeNum:=", 1,
"UseIntLine:=", True,
["NAME:IntLine",
"Start:=", [-0.4, -1.2, 0),
"End:=", [-1.4, 0.4, 0]],
"CharImp:=", "Zpi"),
["NAME:Mode2",
"ModeNum:=", 2,
"UseIntLine:=", False]],
"Faces:=", [7]])

VB Syntax AssignWavePort <WavePortArray>


oModule.AssignWavePort Array("NAME:WavePort1",_
"NumModes:=", 2,_
VB Example
"PolarizeEField:=",false,_
"DoDeembed:=", true,_

Boundary and
Excitation Module Script Commands 14-135
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"DeembedDist:=", "10mil",_
"DoRenorm:=", true,_
"RenormValue:=","50Ohm",
Array("NAME:Modes",_
Array("NAME:Mode1",_
"ModeNum:=", 1,_
"UseIntLine:=", true,_
Array("NAME:IntLine",_
"Start:=", Array(-0.4, -1.2, 0),_
"End:=", Array(-1.4, 0.4, 0)),_
"CharImp:=", "Zpi"), _
Array("NAME:Mode2",_
"ModeNum:=", 2,_
"UseIntLine:=", false)),_
"Faces:=", Array(7))

AutoCreatePECCapforWavePort
Use: If the HFSS Option for HFSS>Boundary Assignment>Automatic PEC cap creation for wave port is enabled, HFSS automatically
creates a PEC cap under the following conditions: The general rule is that the dialog for creating wave port PEC backing appears if the
wave port is internal to the design and does not touch any non-solve-inside component. If a project has open region defined, all geo-
metries are considered internal.
Command: None.

Boundary and
Excitation Module Script Commands 14-136
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax: AutoCreatePECCapForWavePort ([<PECCapParameters>])


Return Value: None
Parameters: <PECCapParameters>
"NAME:AutoCreatePECCapForWavePort",
"Wave Port Name:=" , "<string>",
"Face ID:=" , <intID>,
"Flip Side:=" , Boolean,
"Thickness:=" , "<real><units>"
VB Example:
oModule.AutoCreatePECCapForWavePort Array("NAME:AutoCreatePECCapForWavePort", "Wave Port
Name:=", _
"2", "Face ID:=", 280, "Flip Side:=", false, "Thickness:=", "0.18mm")

Python Syntax AutoCreatePECCapforWavePort(<PECCapParameters>)

Boundary and
Excitation Module Script Commands 14-137
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AutoCreatePECCapForWavePort(
[
"NAME:AutoCreatePECCapForWavePort",
"Wave Port Name:=" , "2",
Python Example
"Face ID:=" , 280,
"Flip Side:=" , False,
"Thickness:=" , "0.18mm"
])

CircuitPortToLumpedPort
Converts a circuit port to a lumped port for a driven terminal or driven modal design in HFSS.

UI Access Right-click on a circuit port, then select Convert to Lumped Port.

Name Type Description


Parameters
<PortName> String Name of specified circuit port.

Return Value None.

Python Syntax CircuitPortToLumpedPort (<PortName>)


Python Example oModule.CircuitPortToLumpedPort("1")

Boundary and
Excitation Module Script Commands 14-138
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax CircuitPortToLumpedPort <PortName>


VB Example oModule.CircuitPortToLumpedPort "1"

EditAnisotropicImpedance
Modifies an Anisotropic Impedance boundary condition.

UI Access Double-click the boundary condition in the project tree to modify its settings.

Name Type Description


<BondName> String Name of boundary condition to be edited.
<Aniso- Array Structured array.
tropicImpArray>
Array("NAME:<string name of anisotropic impedance>",
"Faces:=" , <array of face IDs>,
"UseInfiniteGroundPlane:=", <boolean>,
"CoordSystem:=" , <string coordinate system name>,
"HasExternalLink:=" , <boolean>,
Parameters "ZxxResistance:=" , <string of an integer value>,
"ZxxReactance:=" , <string of an integer value>,
"ZxyResistance:=" , <string of an integer value>,
"ZxyReactance:=" , <string of an integer value>,
"ZyxResistance:=" , <string of an integer value>,
"ZyxReactance:=" , <string of an integer value>,
"ZyyResistance:=" , <string of an integer value>,
"ZyyReactance:=" , <string of an integer value>)

Boundary and
Excitation Module Script Commands 14-139
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax EditAnisotropicImpedance (<BondName>, <AnisotropicImpArray>)

oModule.EditAnisotropicImpedance("Anistropic10",
["NAME:Anisotropic1",
"Faces:=" , [17215],
"UseInfiniteGroundPlane:=", False,
"CoordSystem:=" , "Global",
"HasExternalLink:=" , False,
"ZxxResistance:=" , "377",
Python Example "ZxxReactance:=" , "0",
"ZxyResistance:=" , "0",
"ZxyReactance:=" , "0",
"ZyxResistance:=" , "0",
"ZyxReactance:=" , "0",
"ZyyResistance:=" , "377",
"ZyyReactance:=" , "0"
])

Boundary and
Excitation Module Script Commands 14-140
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax EditAnisotropicImpedance <BondName>, <AnisotropicImpArray>


oModule.EditAnisotropicImpedance
"Anisotropic10", _
Array("NAME:Anisotropic1",
"Faces:=", Array(17215),
"UseInfiniteGroundPlane:=", false,
"CoordSystem:=" , "Global",
"HasExternalLink:=" , false,
"ZxxResistance:=" , "377",
VB Example
"ZxxReactance:=" , "0",
"ZxyResistance:=" , "0",
"ZxyReactance:=" , "0",
"ZyxResistance:=" , "0",
"ZyxReactance:=" , "0",
"ZyyResistance:=" , "377",
"ZyyReactance:=" , "0"
)

EditAperture
Modifies an aperture boundary.

UI Access Double-click the boundary condition in the project tree to modify its settings.

Boundary and
Excitation Module Script Commands 14-141
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


Parameters <BondName> String Name of boundary condition to be edited.
<ApertureArray> Array Array defines selected objects.

Return Value None.

Python Syntax EditAperture(<BondName>, <ApertureArray>)

oModule.EditAperture("Aperture1"
["NAME:Aperture2",
Python Example
"Objects:=", ["Rectangle1"]
])

VB Syntax EditAperture <BondName>, <ApertureArray>


oModule.EditAperture "Aperture1"
VB Example Array("NAME:Apertur2",
"Objects:=", Array("Rectangle1"))

EditCircuitPort[HFSS]
Edits a circuit port for a driven terminal or driven modal design in HFSS.

UI Access Double-click the excitation in the project tree to modify its settings.

Boundary and
Excitation Module Script Commands 14-142
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<ExcitationName> String Name of the excitation to be edited.
<CircuitPortArray> Array Structured array.
Array("NAME:<PortName>",
Parameters "Impedance:=", "valueohm",
"DoDeembed:=", <boolean>
"RenormalizeAllTerminals:=", <boolean>
"TerminalIDLit:=", Array() )

Return Value None.

Python Syntax EditCircuitPort (<ExcitationName>, <CircuitPortArray>)


oModule.EditCircuitPort ("5"
["NAME:1",
"Impedance:=" , "50ohm",
Python Example "DoDeembed:=" , False,
"RenormalizeAllTerminals:=", True,
"TerminalIDList:=" , []
])

VB Syntax EditCircuitPort <ExcitationName>, <CircuitPortArray>

Boundary and
Excitation Module Script Commands 14-143
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.EditCircuitPort "5" _
Array("NAME:1", _
"Impedance:=", "50ohm", _
VB Example
"DoDeembed:=", false, _
"RenormalizeAllTerminals:=", true, _
"TerminalIDList:=", Array())

EditCurrent
Modifies a current source.

UI Access Double-click the excitation in the project tree to modify its settings.

Name Type Description


<ExcitationName> String Name of the excitation to be edited.
<CurrentArray> Array Structured array.
Array("NAME:<BoundName>",
"Current:=", <value>,

Parameters <DirectionArray>,
"TerminalIDLit:=", Array() )
<DirectionArray> Array Structured array.
Array("NAME:Direction",
"Start:=", <LineEndPoint>,
"End:=", <LineEndPoint>)

Boundary and
Excitation Module Script Commands 14-144
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax EditCurrent (<ExcitationName>, <CurrentArray>)


oModule.EditCurrent("Current1",
["NAME:Current2",
"Current:=", "1000mA",
["NAME:Direction",
Python Example
"Start:=", [-0.4, 0.4, -1.6],
"End:=", [-0.4, 0.4, 0]
]
])

VB Syntax EditCurrent <ExcitationName>, <CurrentArray>


oModule.EditCurrent "Current1", Array("NAME:Current2",_
"Current:=", "1000mA",_
Array("NAME:Direction",_
VB Example
"Start:=", Array(-0.4, 0.4, -1.6),_
"End:=", Array(-0.4, 0.4, 0)), _
)

Boundary and
Excitation Module Script Commands 14-145
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditDielectricCavity
Modifies definitions of a Dielectric Cavity.

UI Access Double-click the cavity under Hybrid Regions in the project tree to modify its settings.

Name Type Description


<CavityName> String Name of the cavity to be edited.
Parameters <CavityArray> Array Structured array.
Array("NAME:<new name>")

Return Value None.

Python Syntax EditDielectricCavity(<CavityName>, <CavityArray>)


oModule.EditDielectricCavity("Cavity1"
[
Python Example
"NAME:Cavity2"
])

VB Syntax EditDielectricCavity <CavityName>, <CavityArray>


oModule.EditDielectricCavity "Cavity1", _
VB Example
Array("NAME:Cavity2")

Boundary and
Excitation Module Script Commands 14-146
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditDiffPairs
Edits the properties of differential pairs defined from terminal excitations on wave ports.

UI Access HFSS > Excitations > Differential Pairs.

Name Type Description


<DifferentialPairsArray> Array Structured array.
Array("NAME:EditDiffPairs",
<OneDiffPairArray>, <OneDiffPairArray>,...)
<OneDiffPairArray> Array Structured array.
Array("NAME:Pair1",_
"PosBoundary:=", <string, name of the terminal to
use as the positive terminal.>,
"NegBoundary:=", <string, name of the terminal to
Parameters use as the negative terminal.>,
"CommonName:=", <string, name for the common
mode.>,
"CommonRefZ:=", <value, reference impedance for
the common mode.>,
"DiffName:=", <string, name for the differential
mode.>,
"DiffRefZ:=", <value, reference impedance for the
differential mode.>,
"IsActive:=", <boolean>)

Return Value None.

Boundary and
Excitation Module Script Commands 14-147
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax EditDiffPairs(<DifferentialPairsArray>)


oModule.EditDiffPairs(["NAME:EditDiffPairs",
["NAME:Pair1",
"PosBoundary:=", "Rectangle1_T1",
"NegBoundary:=", "Rectangle2_T1",
"CommonName:=", "Comm1",
Python Example
"CommonRefZ:=", "25ohm",
"DiffName:=", "Diff1",
"DiffRefZ:=", "100ohm",
"IsActive:=", True]]
)

VB Syntax EditDiffPairs <DifferentialPairsArray>


oModule.EditDiffPairs Array("NAME:EditDiffPairs",
Array("NAME:Pair1", _
VB Example "PosBoundary:=", "Rectangle1_T1", "NegBoundary:=", "Rectangle2_T1", _
"CommonName:=", "Comm1", "CommonRefZ:=", "25ohm", _
"DiffName:=", "Diff1", "DiffRefZ:=", "100ohm", _

Boundary and
Excitation Module Script Commands 14-148
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"IsActive:=", true))

EditFEBI
Modifies a FE-BI hybrid region.

UI Access Double-click the FE-BI under Hybrid Regions in the project tree to modify its settings.

Name Type Description


<FEBIName> String Name of the FE-BI region to be edited.
Parameters <FEBIArray> Array Structured array.
Array("NAME:<new name>")

Return Value None.

Python Syntax EditFEBI (<FEBIName>, <FEBIArray>)


oModule.EditFEBI("FE-BI1"
[
Python Example
"NAME:FE-BI2"
])

VB Syntax EditFEBI <FEBIName>, <FEBIArray>


oModule.EditFEBI "FE-BI1", _
VB Example
Array("NAME:FE-BI2")

Boundary and
Excitation Module Script Commands 14-149
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditFiniteCond
Modifies parameters of single finite conductivity boundary.

UI Access Double-click finite conductivity boundary in project tree.

Name Type Description


<BoundaryName> String Name of the finite conductivity boundary to be edited.
<FiniteCondArray> Array Structured array.
Array("NAME:<Name of the boundary>",
"Roughness:=", "<string, double value with units of
length>",
Parameters
"UseCoating:=", <boolean>,
"LayerThickness:=", "<string, double value with
units of length>",
"UseMaterial:=", <boolean>,
"Material:=", "<string, material name for coat-
ing.>")

Return Value None.

Python Syntax EditFiniteCond (<BoundaryName>, <FiniteCondArray>)


oModule.EditFiniteCond("FiniteCond1",
Python Example
["NAME:FiniteCond1",

Boundary and
Excitation Module Script Commands 14-150
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Roughness:=", "2um",
"UseCoating:=", false]
)

VB Syntax EditFiniteCond <BoundaryName>, <FiniteCondArray>


oModule.EditFiniteCond "FiniteCond1", _
Array("NAME:FiniteCond1", _
VB Example
"Roughness:=", "2um", _
"UseCoating:=", false)

EditFloquetPort
Modifies a Floquet port excitation.

UI Access Double-click on a floquet port under Excitations in history tree.

Name Type Description


<FloquetPortName> String Name of the floquet port excitation to be edited.
<FloquetPortArray> Array Structured array.
Array("NAME:<BoundName>",
Parameters "NumModes:=", <integer>,
"RenormalizeAllTerminals:=", <boolean>,
"DoDeembed:=", <boolean>,
<ModesArray>,

Boundary and
Excitation Module Script Commands 14-151
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ShowReporterFilter:=", <boolean>,
"UseScanAngles:=", <boolean>,
"Phi:=", "<numdeg>",
"Theta:=", "<numdeg>",
<LatticeAVector>,
<LatticeBVector>,
<ModesCalculator>,
<ModesList>)
<ModesArray> Array Structured array.
Array("NAME:Modes", Array("NAME:<ModeName>",
"ModeNum:=", <integer>,
"UseIntLine:=", <boolean>),
...)
<LatticeAVector> Array Structured array.
Array("NAME:LatticeAVector",
"Start:=", Array("<num><units>", "<num><units>",
"<num><units>"),
"End:=", Array("<num><units>", "<num><units>",
"<num><units>"))
<LatticeBVector> Array Structured array.
Array("NAME:LatticeBVector",
"Start:=", Array("<num><units>", "<num><units>",

Boundary and
Excitation Module Script Commands 14-152
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"<num><units>"),
"End:=", Array("<num><units>", "<num><units>",
"<num><units>"))
<ModesCalculator> Array Structured array.
Array("NAME:ModesCalculator",
"Frequency:=", "<Value>GHz",
"FrequencyChanged:=", <Boolean>,
"PhiStart:=", "<num>deg",
"PhiStop:=", "<num>deg",
"PhiStep:=", "<num>deg",
"ThetaStart:=", "<num>deg",
"ThetaStop:=", "<num>deg",
"ThetaStep:=", "<num>deg")
<ModesList> Array Structured array.
Array("NAME:ModesList",
Array("NAME:Mode",
"ModeNumber:=", <ModeID>,
"IndexM:=", <integer index>,
"IndexN:=", <integer index>,
"KC2:=", <integer value>,
"PropagationState:=", "Propagating",
"Attenuation:=", <integer value>,

Boundary and
Excitation Module Script Commands 14-153
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PolarizationState:=", <TE or TM>,


"AffectsRefinement:=", <boolean>),
...)

Return Value None.

Python Syntax EditFloquetPort(<FloquetPortName>, <FloquetPortArray>)


oModule.EditFloquetPort("FloquetPort1",
["NAME:FloquetPort1After",
"NumModes:=", 2,
"RenormalizeAllTerminals:=", True,
"DoDeembed:=", False,
["NAME:Modes",
Python Example ["NAME:Mode1",
"ModeNum:=",1,
"UseIntLine:=", False],
["NAME:Mode2",
"ModeNum:=", 2,
"UseIntLine:=", False]],
"ShowReporterFilter:=", False,

Boundary and
Excitation Module Script Commands 14-154
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseScanAngles:=", True, "Phi:=", "0deg", "Theta:=", "0deg",


["NAME:LatticeAVector",
"Start:=", ["0mm", "0mm", "0.8mm"],
"End:=", ["0mm", "0.5mm", "0.8mm"]],
["NAME:LatticeBVector",
"Start:=", ["0mm", "0mm", "0.8mm"],
"End:=", ["0.8mm", "0mm", "0.5mm"]],
["NAME:ModesCalculator",
"Frequency:=", "1GHz",
"FrequencyChanged:=", False,
"PhiStart:=", "0deg",
"PhiStop:=", "0deg",
"PhiStep:=","0deg",
"ThetaStart:=", "0deg",
"ThetaStop:=", "0deg",
"ThetaStep:=", "0deg"],
["NAME:ModesList",
["NAME:Mode",
"ModeNumber:=", 1,
"IndexM:=", 0,
"IndexN:=", 0,

Boundary and
Excitation Module Script Commands 14-155
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"KC2:=", 0,
"PropagationState:=", "Propagating",
"Attenuation:=", 0,
"PolarizationState:=", "TE",
"AffectsRefinement:=", False],
["NAME:Mode",
"ModeNumber:=", 2,
"IndexM:=", 0,
"IndexN:=", 0,
"KC2:=", 0,
"PropagationState:=", "Propagating",
"Attenuation:=", 0,
"PolarizationState:=", "TM",
"AffectsRefinement:=", False]
]])

VB Syntax EditFloquetPort <FloquetPortName>, <FloquetPortArray>


oModule.AssignFloquetPort "FloquetPort1"
VB Example
Array("NAME:FloquetPort1After",

Boundary and
Excitation Module Script Commands 14-156
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"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.5mm"),
"End:=", Array( "0mm", "0.6mm", "0.8mm")),
Array("NAME:LatticeBVector", "Start:=", Array("0mm", "0mm", "0.5mm"),
"End:=", Array("0.8mm", "0mm", "0.8mm")),
Array("NAME:ModesCalculator", "Frequency:=", "1GHz", "FrequencyChanged:=", false,
"PhiStart:=", "0deg", "PhiStop:=", "0deg", "PhiStep:=", "0deg",
"ThetaStart:=", "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),

Boundary and
Excitation Module Script Commands 14-157
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Mode", "ModeNumber:=", 2,
"IndexM:=", 0, "IndexN:=", 0,
"KC2:=", 0,
"PropagationState:=", "Propagating",
"Attenuation:=", 0,
"PolarizationState:=", "TM", "AffectsRefinement:=", false)))

EditFresnel
Modifies a Fresnel boundary condition.

UI Access Double-click on a fresnel under Boundaries in project history tree.

Name Type Description


<FresnelName> String Name of the fresnel boundary to be edited.
<FresnelArray> Array Structured array.

Parameters Array("NAME:<FresnelName>",
"Fresnel Boundary Type:=", <PerfectAbsorber or
ImportFromTableFile>,
"RTTable Path:=", <string path to table file>)

Return Value None.

Python Syntax EditFresnel(<FresnelName>, <FresnelArray>)


Python Example oModule.AssignFresnel("Fresnel1"

Boundary and
Excitation Module Script Commands 14-158
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["NAME:Fresnel2",
"Fresnel Boundary Type:=", "PerfectAbsorber"
])

VB Syntax EditFresnel <FresnelName>, <FresnelArray>


oModule.AssignFresnel "Fresnel1"
VB Example Array("NAME:Fresnel2", _
"Fresnel Boundary Type:=", "PerfectAbsorber")

EditGlobalMatEnv
Modifies global material environment setting to tell HFSS what material properties to use when calculating far fields.

UI Access HFSS > Boundaries > Edit Global Material Environment...

Name Type Description


Parameters
<MatEnvName> String Name of the global material environment, default is "vacuum".

Return Value None.

Python Syntax EditGlobalMatEnv(<MatEnvName>)


Python Example oModule.EditGlobalMatEnv("water_distilled")

VB Syntax EditGlobalMatEnv <MatEnvName>

Boundary and
Excitation Module Script Commands 14-159
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oModule.EditGlobalMatEnv "water_distilled"

EditHalfSpace
Modifies a Half Space boundary name, Z location, and or materials.

UI Access Double-clock on a half space under Boundaries in history tree.

Name Type Description


<HalfSpaceName> String Name of the half space boundary to be edited.
<HalfSpaceArray> Array Structured array.
Parameters Array("NAME:<Name of Half Space>",
"ZLocation:=", "<intUnits>",
"Material:=", "<string material name>")

Return Value None.

Python Syntax EditHalfSpace(<HalfSpaceName>, <HalfSpaceArray>)


oModule.EditHalfSpace("HalfSpace1"
["NAME:HalfSpace1After",
Python Example
"ZLocation:=", "2mm",
"Material:=", "tungsten"])

VB Syntax EditHalfSpace <HalfSpaceName>, <HalfSpaceArray>

Boundary and
Excitation Module Script Commands 14-160
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.EditHalfSpace "HalfSpace1", _
Array("NAME:HalfSpace1After", _
VB Example
"ZLocation:=", "2mm", _
"Material:=", "tungsten")

EditHybridRegion
Modifies settings of an assigned hybrid region.

UI Access Double-click on an assignment under Hybrid Regions in project history tree.

Name Type Description


<HybridRegionName> String Name of the hybrid region to be edited.
<HybridRegionArray> Array Structured array.
Parameters Array("NAME:<new name of hybrid region>",
"Type:=", <string one of "IE", "PO" or "SBR">,
"IsLinkedRegion:=", <boolean>)

Return Value None.

Python Syntax EditHybridRegion(<HybridRegionName>, <HybridRegionArray>)


oModule.EditHybridRegion("Hybrid1"
["NAME:Hybrid1After",
Python Example
"Type:=", "IE",
"IsLinkedRegion:=", False

Boundary and
Excitation Module Script Commands 14-161
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

])

VB Syntax EditHybridRegion <HybridRegionName>, <HybridRegionArray>


oModule.EditHybridRegion "Hybrid1", _
Array("NAME:Hybrid1After", _
VB Example
"Type:=", "IE", _
"IsLinkedRegion:=", false)

EditImpedance
Modifies an impedance boundary definitions.

UI Access Double-click on an impedance under Boundaries in the project history tree.

Name Type Description


<BoundaryName> String Name of the impedance boundary to be edited.
<ImpedanceArray> Array Structured array.
Array("NAME:<New name>",
Parameters
"Resistance:=", <value>,
"Reactance:=", <value>,
"InfGroundPlane:=", <boolean>)

Return Value None.

Boundary and
Excitation Module Script Commands 14-162
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax EditImpedance(<BoundaryName>, <ImpedanceArray>)


oModule.AssignImpedance("Imped1"
["NAME:Imped1After",
"Resistance:=", "50",
Python Example
"Reactance:=", "50",
"InfGroundPlane:=", False]
)

VB Syntax EditImpedance <BoundaryName>, <ImpedanceArray>


oModule.AssignImpedance "Imped1", _
Array("NAME:Imped1After",_
VB Example "Resistance:=", "50",_
"Reactance:=", "50",_
"InfGroundPlane:=", false)

EditIncidentWave
Modifies an incident wave excitation.

UI Access Double-click the excitation in the project tree to modify its settings.

Name Type Description


Parameters <BoundaryName> String Name of the incident wave excitation to be edited.
<IncidentWaveArray> Array Structured array.

Boundary and
Excitation Module Script Commands 14-163
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:<BoundName>",
"IsCartesian:=",<boolean>,
"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>,
"EoTheta:=", <value>,
"IsPropagating:=", <boolean>,
"IsEvanescent:=", <boolean>,
"IsEllipticallyPolarized:=", <boolean>)
IsCartesian

Boundary and
Excitation Module Script Commands 14-164
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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.

Return Value None.

Python Syntax EditIncidentWave(<BoundaryName>, <IncidentWaveArray>)


oModule.EditIncidentWave("IncWave1",
["NAME:IncWave1After",
"IsCartesian:=", True,
"EoX:=", "1", "EoY:=", "0", "EoZ:=", "0",
Python Example
"kX:=", "0", "kY:=", "0", "kZ:=", "1",
"IsPropagating:=", True,
"IsEvanescent:=", False,
"IsEllipticallyPolarized:=", False])

VB Syntax EditIncidentWave <BoundaryName>, <IncidentWaveArray>


oModule.EditIncidentWave "IncWave1", _
Array("NAME:IncWave1After",_
VB Example
"IsCartesian:=", true,_
"EoX:=", "1", "EoY:=", "0", "EoZ:=", "0",_

Boundary and
Excitation Module Script Commands 14-165
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"kX:=", "0", "kY:=", "0", "kZ:=", "1",


"IsPropagating:=", true, _
"IsEvanescent:=", false, _
"IsEllipticallyPolarized:=", false)

EditLatticePair
Modifies coupled Lattice Pair boundaries.

UI Access Double-click on a lattice pair under Boundaries in the project history tree.

Name Type Description


<BoundaryName> String Name of the lattice pair boundary to be edited.
<BoundaryArray> Array Structured array.
Array("NAME:<BoundName>",
"ReverseV:=", <boolean>,
Parameters
"PhaseDelay:=", <UseScanAngle | InputPhaseDelay>,
"Phi:=", <numdeg>,
"Theta:=", <numdeg>,
"Phase:=", <numdeg>)

Return Value None.

Python Syntax EditLatticePair(<BoundaryName>, <BoundaryArray>)

Boundary and
Excitation Module Script Commands 14-166
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.EditLatticePair("LatticePair1",
["NAME:LatticePair1After",
"ReverseV:=", False,
Python Example "PhaseDelay:=", "UseScanAngle",
"Phi:=", "10deg",
"Theta:=", "0deg"]
)

VB Syntax EditLatticePair <BoundaryName>, <BoundaryArray>


oModule.EditLatticePair "LatticePair1", _
Array("NAME:LatticePair1After", _
"ReverseV:=", false, _
VB Example
"PhaseDelay:=", "UseScanAngle", _
"Phi:=", "10deg", _
"Theta:=", "0deg")

EditLayeredImp
Modifies a layered impedance boundary.

UI Access Double-click on a layered impedance under Boundaries in the project history tree.

Name Type Description


Parameters
<BoundaryName> String Name of the layered impedance boundary.

Boundary and
Excitation Module Script Commands 14-167
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<LayeredImpArray> Array Structured array.


Array("NAME:<BoundName>",
"Frequency:=", <value>,
"Roughness:=", <value>,
"IsInternal:=", <bool>,
"IsTwoSided:=", <bool>,
"IsShellElement:=", <bool>,
<LayersArray>,
"InfGroundPlane:=", <boolean>)
<LayersArray> Array Structured array.
Array("NAME:Layers",
<OneLayerArray>, <OneLayerArray>, ...)
<OneLayerArray> Array Structured array.
Array("NAME:<LayerName>",
"LayerType:=", <LayerType>,
"Thickness:=",<value>,
"Material:=", <string>)
Thickness
Thickness of the layer. Should be specified for all layers except the
last layer.
Material

Boundary and
Excitation Module Script Commands 14-168
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Material assigned on the layer. For the last layer, do not specify a
material if the LayerType is "PerfectE" or "PerfectH".
<LayerName> String Specifies the layer number, such as "Layer1" or "Layer2"
<LayerType> String Should be specified for the last layer only.
Possible values: "Infinite", "PerfectE", or "PerfectH"

Return Value None.

Python Syntax EditLayeredImp(<BoundaryName>, <LayeredImpArray>)


oModule.EditLayeredImp("Layered1",
["NAME:Layered1After",
"Frequency:=", "10GHz",
"Roughness:=", "0um",
Python Example "IsTwoSided:=", True,
"IsShellElement:=", True,
["NAME:Layers", ["NAME:Layer1",
"Thickness:=", "1um", "Material:=", "vacuum"]],
"InfGroundPlane:=", False])

VB Syntax EditLayeredImp <BoundaryName>, <LayeredImpArray>


oModule.EditLayeredImp "Layered1", _
VB Example
Array("NAME:Layered1After", _

Boundary and
Excitation Module Script Commands 14-169
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Frequency:=", "10GHz", _
"Roughness:=", "0um", _
"IsTwoSided:=", true, _
"IsShellElement:=", true, _
Array("NAME:Layers", Array("NAME:Layer1", _
"Thickness:=", "1um", "Material:=", "vacuum")), _
"InfGroundPlane:=", false)

EditLinkedImpedance
Edits a linked Impedance boundary.

UI Access Double-click on a linked impedance under Boundaries in project history tree.

Name Type Description


<BoundaryName> String Name of the linked impedance boundary to be edited.
<LinkedImpArray> Array Structured array.
Array("NAME:<BoundName>",
"UseInfiniteGroundPlane:=", <boolean>,
Parameters
"UseShellElement:=" , <boolean>,
<LinkDataArray>)
<LinkDataArray> Array Structured array.
Array("NAME:<LinkName>",
"Project:=", <string file path>,

Boundary and
Excitation Module Script Commands 14-170
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Product:=", <string product type>,


"Design:=", <string linked source design name>,
"Soln:=", <string linked source solution name>, <array
solution parameters>,
"ForceSourceToSolve:=", <boolean>,
"PreservePartnerSoln:=" , <boolean>,
"PathRelativeTo:=" , <string target project name>)

Return Value None.

Python Syntax EditLinkedImpedance(<BoundaryName>, <LinkedImpArray>)


oModule.EditLinkedImpedance("Linked1",
["NAME:Linked1After",
"UseInfiniteGroundPlane:=", True,
"UseShellElement:=", True,
["NAME:XLink",
Python Example "Project:=", "C://temp/linkedproject.aedt",
"Product:=", "HFSS",
"Design:=", "Source_Project_Solver",
"Soln:=", "1000MHz : LastAdaptive",
["NAME:Params", "xfactor:=", "1.2", "yfactor:=", "1.6"],
"ForceSourceToSolve:=", True,

Boundary and
Excitation Module Script Commands 14-171
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PreservePartnerSoln:=", False,
"PathRelativeTo:=", "TargetProject"]
])

VB Syntax EditLinkedImpedance <BoundaryName>, <LinkedImpArray>


oModule.EditLinkedImpedance "Linked1", _
Array("NAME:Linked1After", _
"UseInfiniteGroundPlane:=", true, _
"UseShellElement:=", true, _
Array("NAME:XLink", _
"Project:=", "C://temp/linkedproject.aedt", _
VB Example "Product:=", "HFSS", _
"Design:=", "Source_Project_Solver", _
"Soln:=", "1000MHz : LastAdaptive", _
Array("NAME:Params", "xfactor:=", "1.2", "yfactor:=", "1.6"), _
"ForceSourceToSolve:=", true, _
"PreservePartnerSoln:=", false, _
"PathRelativeTo:=", "TargetProject"))

Boundary and
Excitation Module Script Commands 14-172
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditLinkedRegion
Edits a Linked Region.

UI Access N/A

Name Type Description


<BoundaryName> String Name of linked region.
<LinkedRegionArray> Array Structured array.

Parameters Array("NAME:<New name>",


"Type:=" , <string, one of "IE", "PO" or "SBR">,
"IsLinkedRegion:=" , <boolean, true for linked
region>)

Return Value None.

Python Syntax EditLinkedRegion(<BoundaryName>, <LinkedRegionArray>)


oModule.EditLinkedRegion("Linked1",
["NAME:Linked1After",
Python Example "Type:=", "PO",
"IsLinkedRegion:=", True]
)

VB Syntax EditLinkedRegion <BoundaryName>, <LinkedRegionArray>

Boundary and
Excitation Module Script Commands 14-173
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.EditLinkedRegion "Linked1", _
Array("NAME:Linked1After", _
VB Example
"Type:=", "PO", _
"IsLinkedRegion:=", true)

EditLumpedPort
Modifies a lumped port.

UI Access Double-click the excitation in the project tree to modify its settings.

Name Type Description


<BoundaryName> String Name of lumped port excitation to be edited.
<LumpedPortArray> Array Structured array.
Array("NAME:<BoundName>",
"RenormalizeAllTerminals:=", <boolean>,
"DoDeembed:=", <boolean>,
<ModesArray>,
Parameters
"ShowReporterFilter:=", <boolean>,
"ReporterFilter:=", <array of boolean>,
"Impedance:=" , <value>)
<ModesArray> Array Structured array.
Array("NAME:<ModesArrayName>",
<OneModeArray>, <OneModeArray>,...)
<OneModeArray> Array Structured array.

Boundary and
Excitation Module Script Commands 14-174
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:<ModeName>",
"ModeNum:=", <integer>,
"UseIntLine:=", <boolean>,
<IntegerationLineArray>,
"AlignmentGroup:=", <integer, group id>,
"CharImp:=", <string, characteristic impedance>,
"RenormImp:=" , <value, renormalize impedance to>)
< Array Structured array.
IntegerationLineArray>
Array("NAME:<LineName>",
"Coordinate System:=", <string, relative coordinate
system>,
"Start:=" , <array, start location coordinates>,
"End:=" , <array, end location coordinates>)

Return Value None.

Python Syntax EditLumpedPort(<BoundaryName>, <LumpedPortArray>)


oModule.EditLumpedPort("LumpledPort1",
["NAME:LumpledPort1After",
Python Example "DoDeembed:=", False,
"RenormalizeAllTerminals:=", True,
["NAME:Modes",

Boundary and
Excitation Module Script Commands 14-175
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["NAME:Mode1",
"ModeNum:=", 1,
"UseIntLine:=", True,
["NAME:IntLine",
"Coordinate System:=", "Global",
"Start:=", ["-0.4mm","-1mm","0.8mm"],
"End:=" , ["-0.3mm","-1.2mm","0.8mm"]
],
"AlignmentGroup:=", 0,
"CharImp:=", "Zpi",
"RenormImp:=", "50ohm"]],
"ShowReporterFilter:=", False,
"ReporterFilter:=", [True],
"Impedance:=", "50ohm"
])

VB Syntax EditLumpedPort <BoundaryName>, <LumpedPortArray>


oModule.EditLumpedPort "lp2", _
VB Example
Array("NAME:lp2After", "RenormalizeAllTerminals:=", true, "DoDeembed:=", true, _

Boundary and
Excitation Module Script Commands 14-176
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Modes", Array("NAME:Mode1", "ModeNum:=", 1, "UseIntLine:=", true, _


Array("NAME:IntLine", "Start:=", Array("120mm", "50mm", "40mm"), _
"End:=", Array("120mm", "50mm", "120mm")), "CharImp:=", "Zpi")), _
"ShowReporterFilter:=", false, "ReporterFilter:=", Array(true), _
"FullResistance:=", "50ohm", "FullReactance:=", "0ohm")

EditLumpedRLC
Modifies a lumped RLC boundary.

UI Access Double-click the boundary in the project tree to modify its settings.

Name Type Description


<BoundaryName> String Name of the boundary to be edited.
<LumpedRLCArray> Array Structured array.
Array("NAME:<NewBoundName>",
"RLC Type:=", <"Parallel" | "Serial" >,
"UseResist:=", <boolean>,

Parameters "Resistance:=", <value>,


"UseInduct:=", <boolean>,
"Inductance:=", <value>,
"UseCap:=", <boolean>,
"Capacitance:=", <value>,
<CurrentLineArray>)
<CurrentLineArray> Array Structured array.

Boundary and
Excitation Module Script Commands 14-177
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:CurrentLine",
"Start:=", <LineEndPoint>,
"End:=", <LineEndPoint>)

Return Value None.

Python Syntax EditLumpedRLC(<BoundaryName>, <LumpedRLCArray>)


oModule.AssignLumpedRLC("LumpRLC1",
["NAME:LumpRLC1After",
["NAME:CurrentLine",
"Start:=", ["0.15mm","-0.2mm","0mm"],
"End:=", ["0.15mm","0.6mm","0mm"]],
"RLC Type:=", "Parallel",
Python Example
"UseResist:=", True,
"Resistance:=", "100ohm",
"UseInduct:=", True,
"Inductance:=", "10nH",
"UseCap:=", True,
"Capacitance:=", "10pF"])

Boundary and
Excitation Module Script Commands 14-178
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax EditLumpedRLC <BoundaryName>, <LumpedRLCArray>


oModule.EditLumpedRLC "LumpRLC1", _
Array("NAME:LumpRLC1After",_
"RLC Type:=" ," Parallel", _
"UseResist:=", true, _
"Resistance:=", "10Ohm", _
"UseInduct:=", true, _
VB Example
"Inductance:=", "10nH", _
"UseCap:=", true, _
"Capacitance:=","10pF", _
Array("NAME:CurrentLine", _
"Start:=", Array(-0.4, -1.2, -1.6), _
"End:=", Array(-0.4, -1.2, 0)))

EditMagneticBias
Modifies a magnetic bias excitation.

UI Access Double-click on the magnetic bias under Excitations in the project tree.

Name Type Description


<BoundaryName> String Name of the magnetic bias excitation to be edited.
<MagneticBiasArray> Array Structured array.
Parameters
Array("NAME:<NewBoundName>",
"IsUniformBias:=", <boolean>,

Boundary and
Excitation Module Script Commands 14-179
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Bias:=", <value>,
"XAngle:=", <value>,
"YAngle:=", <value>,
"ZAngle:=", <value>,
"Project:=",<string>)
IsUniformBias
If true, supply the Bias, XAngle, YAngle, and ZAngle parameters.
If false, supply the Project parameter.

Return Value None.

Python Syntax EditMagneticBias(<BoundaryName>, <MagneticBiasArray>)


oModule.EditMagneticBias("MagBias1",
["NAME:MagBias1After",
"IsUniformBias:=", True,
Python Example "Bias:=", "1",
"XAngle:=", "10deg",
"YAngle:=", "10deg",
"ZAngle:=", "10deg"])

Boundary and
Excitation Module Script Commands 14-180
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax EditMagneticBias <BoundaryName>, <MagneticBiasArray>


oModule.EditMagneticBias "MagBias1", _
Array("NAME:MagBias1After", _
"IsUniformBias:=", true, _
VB Example "Bias:=", "1", _
"XAngle:=", "10deg", _
"YAngle:=", "10deg", _
"ZAngle:=", "10deg")

EditMultipactionChargeRegion
Modifies settings for a Multipaction Charge Region.

UI Access Double-click on the excitation in project tree to edit its settings.

Name Type Description


<BoundaryName> String Name of the multipaction charge region to be edited.
<ChargeRegionArray> Array Structured array.
Array("NAME:MultipactionChargeRegion1",
"NumParticles:=", "<integer, number of
Parameters particles>",
"ParticleCharge:=", "<num><unit>",
"ParticleMass:=", "<num><unit>",
"Vx:=", "<num><unit>",
"Vy:=", "<num><unit>",

Boundary and
Excitation Module Script Commands 14-181
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Vz:=", "<num><unit>")

Return Value None.

Python Syntax EditMultipactionChargeRegion (<BoundaryName>, <ChargeRegionArray>)


oModule.EditMultipactionChargeRegion("MultipactionChargeRegion1",
["NAME:MultipactionChargeRegion1After",
"NumParticles:=", "100",
"ParticleCharge:=", "-1.60217662e-19Coulomb",
Python Example
"ParticleMass:=", "9.10938356e-31kg",
"Vx:=", "0.1m_per_sec",
"Vy:=", "0.3m_per_sec",
"Vz:=", "0.15m_per_sec"])

VB Syntax EditMultipactionChargeRegion <BoundaryName>, <ChargeRegionArray>


oModule.EditMultipactionChargeRegion "MultipactionChargeRegion1", _
Array("NAME:MultipactionChargeRegion1After", _
VB Example "NumParticles:=", "100", _
"ParticleCharge:=", "-1.60217662e-19Coulomb", _
"ParticleMass:=", "9.10938356e-31kg", _

Boundary and
Excitation Module Script Commands 14-182
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Vx:=", "0.1m_per_sec", "Vy:=", "0.3m_per_sec", "Vz:=", "0.15m_per_sec")

EditMultipactionDCBias
Edits settings for a multipaction DC bias boundary.

UI Access Double-click on the excitation in the project tree to edit its settings.

Name Type Description


<BoundaryName> String Name of the multipaction DC bias to be edited.
<DCBiasArray> Array Structured array.
Array(NAME:MultipactionDCBias1",
"UniformE:=", <boolean>,
"Ex:=", "<value><unit>",
"Ey:=", "<value><unit>",
"Ez:=", "<value><unit>",
<LinkedField>,
Parameters
"UniformH:=" , <boolean>,
"Hx:=", "<value><unit>",
"Hy:=", "<value><unit>",
"Hz:=", "<value><unit>",
<LinkedField>)
UniformE or Uniform H:
l True - provide filed values.

l False - provide field through linked Maxwell analysis.

Boundary and
Excitation Module Script Commands 14-183
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<LinkedField> Array Structured array.


Array("NAME:<EField | HField>",
"Project:=", <string, path to linked project
file>,
"Product:=", "Maxwell",
"Design:=", <string, name of source design>,
"Soln:=", <string, name of linked solution>,
<Parameters for linked solution>,
"ForceSourceToSolve:=", <boolean>,
"PreservePartnerSoln:=", <boolean>,
"PathRelativeTo:=" , "TargetProject")

Return Value None.

Python Syntax EditMultipactionDCBias(<BoundaryName>, <DCBiasArray>)


oModule.EditMultipactionDCBias("MultipactionDCBias1",
["NAME:MultipactionDCBias1After",
"UniformE:=", False,
Python Example
["NAME:EField",
"Project:=", "C://projects/Maxwell/HallSensor.aedt",
"Product:=", "Maxwell",

Boundary and
Excitation Module Script Commands 14-184
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Design:=", "3_Maxwell3D",
"Soln:=", "Setup1 : Transient",
["NAME:Params",
"angle:=", "0deg",
"cell_spacing:=", "2.5mm",
"die_thickness:=", "2mm",
"gap:=", "1.5mm",
"magnet_center_y:=", "0mm",
"magnet_center_z:=", "0mm",
"magnet_x:=", "3mm",
"magnet_y:=", "6mm",
"magnet_z:=", "5mm",
"move_x:=", "-1.5mm",
"sensor_offset_x:=", "0mm",
"sensor_offset_y:=", "0mm",
"sensor_offset_z:=", "0mm",
"sensor_pitch:=", "0deg",
"sensor_roll:=", "0deg",
"sensor_yaw:=", "0deg",
"target_dia:=", "80mm"
],

Boundary and
Excitation Module Script Commands 14-185
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ForceSourceToSolve:=", False,
"PreservePartnerSoln:=", False,
"PathRelativeTo:=", "TargetProject"
],
"UniformH:=", True,
"Hx:=", "0A_per_m",
"Hy:=", "0A_per_m",
"Hz:=", "0A_per_m"
])

VB Syntax EditMultipactionDCBias <BoundaryName>, <DCBiasArray>


oModule.EditMultipactionDCBias "MultipactionDCBias1", _
Array("NAME:MultipactionDCBias1After", _
"UniformE:=", true, _
VB Example
"Ex:=", "0V_per_meter", "Ey:=", "0V_per_meter", "Ez:=", "0V_per_meter", _
"UniformH:=", true, _
"Hx:=", "0A_per_m", "Hy:=", "0A_per_m", "Hz:=", "0A_per_m")

EditMultipactionSEE
Edits a Secondary Electron Emission (SEE) boundary settings.

Boundary and
Excitation Module Script Commands 14-186
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Double-click on the boundary in the project tree to edit its settings.

Name Type Description


<BoundaryName> String Name of the boundary to be edited.
<SEEArray> Array Structured array.
Array("NAME:<NewSEEName>",
"AlphaMax:=", <value>,
"Alpha0:=", <value>,
Parameters
"E0:=", <value>,
"E1:=", <value>,
"E2:=", <value>,
"Em:=", <value>,
"DielectricSurface:=", <boolean>)

Return Value None.

Python Syntax EditMultipactionSEE(<BoundaryName>, <SEEArray>)


oModule.EditMultipactionSEE("SEE1",
["NAME:SEE1After",
"AlphaMax:=", "2.25", "Alpha0:=", "0",
Python Example
"E0:=", "12.5", "E1:=", "25", "E2:=", "5000",
"Em:=", "175",
"DielectricSurface:=", false]

Boundary and
Excitation Module Script Commands 14-187
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax EditMultipactionSEE <BoundaryName>, <SEEArray>


oModule.EditMultipactionSEE "SEE1", _
Array("NAME:SEE1After", _
VB Example "AlphaMax:=", "2.25", "Alpha0:=", "0", _
"E0:=", "12.5", "E1:=", "25", "E2:=", "5000", _
"Em:=", "175", "DielectricSurface:=", false)

EditRFDischargeDCBias
Edits settings for an RF discharge DC bias excitation.

UI Access Double-click on the excitation in the project tree to edit its settings.

Name Type Description


<BoundaryName> String Name of the excitation to be edited.
<DCBiasParameters> Array Structured array.
Array("NAME:<DCBiasName>",
Parameters "UniformH:=", <boolean>,
"Hx:=", "<real>A_per_m",
"Hy:=", "<real>A_per_m",
"Hz:=", "<real>A_per_m")

Boundary and
Excitation Module Script Commands 14-188
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax EditRFDischargeDCBias(<BoundaryName>, <DCBiasParameters>)


oModule.EditRFDischargeDCBias("DCBias1",
[
"NAME:RFDischargeDCBias1",
"UniformH:=", True,
Python Example
"Hx:=", "795774.71546A_per_m",
"Hy:=", "0A_per_m",
"Hz:=", "0A_per_m"
])

VB Syntax EditRFDischargeDCBias <BoundaryName>, <DCBiasParameters>


oModule.EditRFDischargeDCBias "DCBias1", _
Array("NAME:RFDischargeDCBias1", _
VB Example
"UniformH:=", True, _
"Hx:=", "795774.71546A_per_m","Hy:=", "0A_per_m","Hz:=", "0A_per_m")

EditPerfectE
Modifies a perfect E boundary.

Boundary and
Excitation Module Script Commands 14-189
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Double-click on the boundary in project tree to edit its settings.

Name Type Description


<BoundaryName> String Name of the boundary to be edited.
<PerfectEArray> Array Structured array.
Parameters
Array("NAME:<NewBoundName>",
"InfGroundPlane:=", <boolean>)

Return Value None.

Python Syntax EditPerfectE(<BoundaryName>, <PerfectEArray>)


oModule.EditPerfectE("PerfE1",
["NAME:PerfE1After",
Python Example
"InfGroundPlane:=", False,
])

VB Syntax EditPerfectE <BoundaryName>, <PerfectEArray>


oModule.EditPerfectE "PerfE1", _
VB Example Array("NAME:PerfE1After", _
"InfGroundPlane:=", false)

Boundary and
Excitation Module Script Commands 14-190
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditPerfectH
Modifies a perfect H boundary.

UI Access Double-click on the boundary in the project tree to edit its settings.

Name Type Description


<BoundaryName> String Name of the boundary to be edited.
Parameters <PerfectHArray> Array Structured array.
Array("NAME:<NewBoundName>")

Return Value None.

Python Syntax EditPerfectH(<BoundaryName>, <PerfectHArray>)


oModule.EditPerfectH("PerfH1",
Python Example
["NAME:PerfH1After"])

VB Syntax EditPerfectH <BoundaryName>, <PerfectHArray>


oModule.EditPerfectH "PerfH1", _
VB Example
Array("NAME:PerfH1After")

EditPrimary
Modifies a primary boundary.

UI Access Double-click on a primary boundary in the project tree to edit its settings.

Boundary and
Excitation Module Script Commands 14-191
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<BoundaryName> String Name of the primary boundary to be edited.
<PrimaryBondArray> Array Structured array.
Array("NAME:<BoundName>",
<CoordSysArray>,
Parameters
"ReverseV:=", <boolean>)
<CoordSysArray> Array Structured array.
Array("NAME:CoordSysVector",
"Origin:=", <CoordSysPoint>,
"UPos:=", <LineEndPoint>)

Return Value None.

Python Syntax EditPrimary(<BoundaryName>, <PrimaryBondArray>)


oModule.EditPrimary("Primary1",
["NAME:Primary1After",
["NAME:CoordSysVector",
Python Example "Origin:=", [-1.4, -1.4, -0.8],
"UPos:=", [-1.4, -1.4, 0]
],
"ReverseV:=", False

Boundary and
Excitation Module Script Commands 14-192
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

])

VB Syntax EditPrimary <BoundaryName>, <PrimaryBondArray>


oModule.EditPrimary "Primary1", _
Array("NAME:Primary1After",_
Array("NAME:CoordSysVector",_
VB Example
"Origin:=", Array(-1.4, -1.4, -0.8),_
"UPos:=", Array(-1.4, -1.4, 0)),_
"ReverseV:=", false))

EditRadiation
Modifies a radiation boundary.

UI Access Double-click the boundary in the project tree to modify its settings.

Name Type Description


<BoundaryName> String Name of the boundary to be edited.
<RadiationArray> Array Structured array.
Array("NAME:<BoundName>",
Parameters "IsIncidentField:=", <boolean>,
"IsEnforcedHField:=", <boolean>,
"IsEnforcedEField:=", <boolean>,
"IsFssReference:=", <boolean>,

Boundary and
Excitation Module Script Commands 14-193
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"IsForPML:=", <boolean>,
"UseAdaptiveIE:=", <boolean>,
"IncludeInPostproc:=", <boolean>)

Return Value None.

Python Syntax EditRadiation(<BoundaryName>, <RadiationArray>)


oModule.EditRadiation("Rad1",
["NAME:Rad1After",
"IsIncidentField:=", True,
"IsEnforcedField:=", False,
Python Example "IsFssReference:=", False,
"IsForPML:=", False,
"UseAdaptiveIE:=", False,
"IncludeInPostproc:=", Frue]
)

VB Syntax EditRadiation <BoundaryName>, <RadiationArray>


oModule.EditRadiation "Rad1", _
VB Example
Array("NAME:Rad1After", _

Boundary and
Excitation Module Script Commands 14-194
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"IsIncidentField:=", true, _
"IsEnforcedField:=", false, _
"IsFssReference:=", false, _
"IsForPML:=", false, _
"UseAdaptiveIE:=", false, _
"IncludeInPostproc:=", true)

EditSecondary
Modifies a secondary boundary.

UI Access Double-click the boundary in the project tree to modify its settings.

Name Type Description


<BoundaryName> String Name of the secondary boundary to be edited.
<SecondaryBondArray> Array Structured array.
Array("NAME:<BoundName>",
<CoordSysArray>,
"ReverseV:=", <boolean>,
Parameters "Primary:=", <string>,
"UseScanAngles:=", <boolean>,
"Phi:=", <value>,
"Theta:=", <value>,
"Phase:=", <value>)
<UseScanAngles>:

Boundary and
Excitation Module Script Commands 14-195
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l True - specify Phi and Theta.


False - specify Phase.
l

<CoordSysArray> Array Structured array.


Array("NAME:CoordSysVector",
"Origin:=", <CoordSysPoint>,
"UPos:=", <LineEndPoint>)

Return Value None.

Python Syntax EditSecondary(<BoundaryName>, <SecondaryBondArray>)


oModule.EditSecondary("Secondary1",
["NAME:Secondary1After",
["NAME:CoordSysVector",
"Origin:=", [-1, 0, 0.2],
"UPos:=", [-1, 0, 0]],
Python Example
"ReverseV:=", False,
"Primary:=", "Primary1",
"UseScanAngles:=", True,
"Phi:=", "10deg",
"Theta:=", "0deg"

Boundary and
Excitation Module Script Commands 14-196
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

])

VB Syntax EditSecondary <BoundaryName>, <SecondaryBondArray>


oModule.EditSecondary "Secondary1", _
Array("NAME:Secondary1After",_
Array("NAME:CoordSysVector", _
"Origin:=", Array(-1, 0, 0.2),_
"UPos:=", Array(-1, 0, 0)),_
VB Example
"ReverseV:=", false,_
"Primary:=", "Primary1",_
"UseScanAngles:=", true,_
"Phi:=", "10deg",_
"Theta:=", "0deg")

EditSymmetry
Modifies a symmetry boundary.

UI Access Double-click the symmetry boundary in the project tree to edit its settings.

Name Type Description


<BoundaryName> String Name of the symmetry boundary to be edited.
Parameters <SymmetryArray> Array Structured array.
Array("NAME:<BoundName>",

Boundary and
Excitation Module Script Commands 14-197
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"IsPerfectE:=", <boolean>)

Return Value None.

Python Syntax EditSymmetry(<BoundaryName>, <SymmetryArray>)


oModule.EditSymmetry("Sym1",
["NAME:Sym1After",
Python Example
"IsPerfectE:=", True
])

VB Syntax EditSymmetry <BoundaryName>, <SymmetryArray>


oModule.EditSymmetry "Sym1", _
VB Example Array("NAME:Sym1After",_
"IsPerfectE:=", true)

EditTerminal
Modifies properties of a terminal

UI Access Edit Properties for a selected terminal.

Name Type Description


Parameters
<TerminalName> String Name of the terminal to be edited.

Boundary and
Excitation Module Script Commands 14-198
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<TerminalArray> Array Structured array.


Array("NAME: <TerminalName>",
"ParentBndID:=", "<PortName>",
"TerminalResistance:=," <Value and units of res-
istance>")

Return Value None.

Python Syntax EditTerminal (<TerminalName>, <TerminalArray>)


oModule.EditTerminal("Rectangle2_T1",
["NAME:Rectangle2_T1",
Python Example "ParentBndID:=", "WavePort1",
"TerminalResistance:=", "75ohm"]
)

VB Syntax EditTerminal <TerminalName>, <TerminalArray>


oModule.EditTerminal "Rectangle2_T1", _
VB Example Array("NAME:Rectangle2_T1", _
"ParentBndID:=", "WavePort1", "TerminalResistance:=", "75ohm")

EditVoltage
Modifies a voltage source.

Boundary and
Excitation Module Script Commands 14-199
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Double-click the excitation in the project tree to modify its settings.

Name Type Description


<BoundaryName> String Name of the voltage source to be edited.
<VoltageArray> Array Structured array.
Array("NAME:<BoundName>",
"Voltage:=", <value>,
Parameters
<DirectionArray>)
<DirectionArray> Array Structured array.
Array("NAME:Direction",
"Start:=",<LineEndPoint>,
"End:=", <LineEndPoint>)

Return Value None.

Python Syntax EditVoltage(<BoundaryName>, <VoltageArray>)


oModule.EditVoltage("Voltage1",
["NAME:Voltage1After",
"Voltage:=", "1000mV",
Python Example
["NAME:Direction",
"Start:=", [-0.4, -1.2, 0],
"End:=", [-1.4, -1.2, 0]

Boundary and
Excitation Module Script Commands 14-200
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

]
)

VB Syntax EditVoltage <BoundaryName>, <VoltageArray>


oModule.EditVoltage "Voltage1", _
Array("NAME:Voltage1After",_
"Voltage:=", "1000mV",_
VB Example
Array("NAME:Direction",_
"Start:=", Array(-0.4, -1.2, 0),_
"End:=", Array(-1.4, -1.2, 0)))

EditVoltageDrop
Use: Edits a voltage drop excitation.
Command: Double-click the excitation in the project tree to edit it.
Syntax:EditVoltageDrop <BoundName> <VoltageDropArray>
Return Value: None
EditWavePort
Modifies a wave port.

UI Access Double-click the excitation in the project tree to modify its settings.

Name Type Description


Parameters
<BoundaryName> String Name of the wave port to be edited.

Boundary and
Excitation Module Script Commands 14-201
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<WavePortArray> Array Structured array.


Array("NAME:<BoundName>",
"NumModes:=", <integer>,
"PolarizeEField:=",<boolean>,
"DoDeembed:=", <boolean>,
"DeembedDist:=", <value>,
"DoRenorm:=", <boolean>,
"RenormValue:=",<value>,
<ModesArray>,
"TerminalIDList:=", <TerminalsArray>)
NumModes
Number of modes for modal problems.
Number of terminals for terminal problems.
<ModesArray> Array Structured array.
Array("NAME:Modes",
<OneModeArray>, <OneModeArray>, ...)
<OneModeArray> Array Structured array.
Array("NAME:<ModeName>",
"ModeNum:=", <integer>,
"UseIntLine:=", <boolean>,
<IntLineArray>)

Boundary and
Excitation Module Script Commands 14-202
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<IntLineArray> Array Structured array.


Array("NAME:IntLine",
"Start:=", <LineEndPoint>,
"End:=", <LineEndPoint>,
"CharImp:=", <string, Characteristic impedance of
the mode. Possible values are "Zpi", "Zpv", or
"Zvi">)

Return Value None.

Python Syntax EditWavePort(<BoundaryName>, <WavePortArray>)


oModule.EditWavePort("WavePort1",
["NAME:WavePort1After",
"NumModes:=", 2,
"PolarizeEField:=",False,
"DoDeembed:=", True,
Python Example "DeembedDist:=", "10mil",
"DoRenorm:=", True,
"RenormValue:=","50Ohm",
["NAME:Modes",
["NAME:Mode1",
"ModeNum:=", 1,

Boundary and
Excitation Module Script Commands 14-203
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseIntLine:=", True,
["NAME:IntLine",
"Start:=", [-0.4, -1.2, 0),
"End:=", [-1.4, 0.4, 0]],
"CharImp:=", "Zpi"),
["NAME:Mode2",
"ModeNum:=", 2,
"UseIntLine:=", False]
]
])

VB Syntax EditWavePort <BoundaryName>, <WavePortArray>


oModule.EditWavePort "WavePort1", _
Array("NAME:WavePort1After",_
"NumModes:=", 2,_
VB Example "PolarizeEField:=",false,_
"DoDeembed:=", true,_
"DeembedDist:=", "10mil",_
"DoRenorm:=", true,_

Boundary and
Excitation Module Script Commands 14-204
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"RenormValue:=","50Ohm",
Array("NAME:Modes",_
Array("NAME:Mode1",_
"ModeNum:=", 1,_
"UseIntLine:=", true,_
Array("NAME:IntLine",_
"Start:=", Array(-0.4, -1.2, 0),_
"End:=", Array(-1.4, 0.4, 0)),_
"CharImp:=", "Zpi"), _
Array("NAME:Mode2",_
"ModeNum:=", 2,_
"UseIntLine:=", false)))

LumpedPortToCircuitPort
Converts a lumped port to a circuit port for a driven terminal or driven modal design in HFSS.

UI Access Right-click on a lumped port excitation in the project tree, then select Convert to Circuit Port.

Name Type Description


Parameters
<PortName> String Name of the lumped port to be converted.

Return Value None.

Python Syntax LumpedPortToCircuitPort(<PortName>)

Boundary and
Excitation Module Script Commands 14-205
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Example oModule.LumpedPortToCircuitPort("Port1")

VB Syntax LumpedPortToCircuitPort <PortName>


VB Example oModule.LumpedPortToCircuitPort "Port1"

SetAllHybridRegionsToOneWayCoupled
Specifies one-way coupling for all hybrid regions.

UI Access Right-click Hybrid Regions > Set Regions > All Regions Are One Way Coupled.
Parameters None.
Return Value None.

Python Syntax SetAllHybridRegionsToOneWayCoupled()


Python Example oModule.SetAllHybridRegionsToOneWayCoupled()

VB Syntax SetAllHybridRegionsToOneWayCoupled
VB Example oModule.SetAllHybridRegionsToOneWayCoupled

SetAllHybridRegionsToTwoWayCoupled
Specifies two-way coupling for all hybrid regions.

Boundary and
Excitation Module Script Commands 14-206
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Right-click Hybrid Regions > Set Regions > All Regions Are Two Way Coupled.
Parameters None.
Return Value None.

Python Syntax SetAllHybridRegionsToTwoWayCoupled()


Python Example oModule.SetAllHybridRegionsToTwoWayCoupled()

VB Syntax SetAllHybridRegionsToTwoWayCoupled
VB Example oModule.SetAllHybridRegionsToTwoWayCoupled

SetHybridRegionCoupledGroup
Use: To set coupling for hybrid regions.
Command: HFSS>HybridRegions>Set Coupling
Syntax: SetHybridRegionCoupledGroup <value>
Return Value: None
Parameters: <value>
Type: <string>
"OneWayCoupled" or "TwoWayCoupled" for all regions or "Advanced", Array("One Way:= <hybridregionname>, Array(Two
Way:=", Array("<hybridregionname>" , )))
VB Example:
Setting All Hybrid Regions to One Way Coupled

Boundary and
Excitation Module Script Commands 14-207
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project35")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.SetHybridRegionCoupledGroup "OneWayCoupled"
Setting All Hybrid Regions to Two Way Coupled
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule

Boundary and
Excitation Module Script Commands 14-208
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")


Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project35")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.SetHybridRegionCoupledGroup "TwoWayCoupled"
Setting Hybrid Region Groupings
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project35")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.SetHybridRegionCoupledGroup "Advanced", Array("One Way:=", Array("Two Way:=", Array( _

Boundary and
Excitation Module Script Commands 14-209
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Hybrid1", "Hybrid2")))
SetHybridRegionsCoupling
Sets coupling for hybrid regions.

UI Access Right-click Hybrid Regions > Set Couling > Advanced.

Name Type Description


<CouplingArray> Array Structured array.
Array(
Parameters
"One Way:=", <array of region names>,
"Two Way:=", <array of region names>)
Note: At least two regions must be specified in a group.

Return Value None

Python Syntax SetHybridRegionsCoupling(<CouplingArray>)


oModule.SetHybridRegionsCoupling(
[
Python Example "One Way:=", ["FE-BI1","FE-BI2"],
"Two Way:=", ["FE-BI3","FE-BI4","FE-BI5"]
])

Boundary and
Excitation Module Script Commands 14-210
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax SetHybridRegionsCoupling <CouplingArray>


oModule.SetHybridRegionsCoupling Array( _
VB Example "One Way:=", Array("FE-BI1","FE-BI2"), _
"Two Way:=", Array("FE-BI3","FE-BI4","FE-BI5"))

SetScatteredFieldFormulation
Sets incident wave to scattered field formulation. Note: Incident field formulation is only applicable in a driven terminal/modal design
with incident wave.

UI Access Right-click on Excitations, then select Set Incident Field Formulation > Scattered.
Parameters None.
Return Value None.

Python Syntax SetScatteredFieldFormulation()


Python Example oModule.SetScatteredFieldFormulation()

VB Syntax SetScatteredFieldFormulation
VB Example oModule.SetScatteredFieldFormulation

SetSBRCreepingWaveSettings
Sets creeping wave settings for SBR+ solutions.

UI Access Right-click on Hybrid Regions, then select Creeping Wave Settings...

Boundary and
Excitation Module Script Commands 14-211
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<CWArray> Array Structured array.
Array("NAME:SBRCreepingWaveSettings",

Parameters "CWRaySampleDensity:=" , <value>,


"CWRayCutoffDb:=" , <value>,
"CWCurvatureSensitivity:=", <value>,
"CWAngularRayInterval:=", <value>)

Return Value None.

Python Syntax SetSBRCreepingWaveSettings(<CWArray>)


oModule.SetSBRCreepingWaveSettings([
"NAME:SBRCreepingWaveSettings",
"CWRaySampleDensity:=" , 10,
Python Example "CWRayCutoffDb:=" , 40,
"CWCurvatureSensitivity:=", 50,
"CWAngularRayInterval:=", 2
])

VB Syntax SetSBRCreepingWaveSettings <CWArray>

Boundary and
Excitation Module Script Commands 14-212
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.SetSBRCreepingWaveSettings _
Array("NAME:SBRCreepingWaveSettings", _
"CWRaySampleDensity:=", 10, _
VB Example
"CWRayCutoffDb:=", 40, _
"CWCurvatureSensitivity:=", 50, _
"CWAngularRayInterval:=", 2)

SetSBRSources
Designs containing SBR+ regions will always be set to All One-Way and the Set Coupling menu is replaced by the Set SBR+ Source
Regions command. Non-SBR+ regions will serve as sources, and interact with each other through the SBR+ regions. All source
regions interact as one-way links to SBR+ and coupling between the source regions are handled by SBR+ using reciprocity theory. If
Global Setting is selected, Current Source Conformance, Thin Sources, and Power Fraction are not recorded.

UI Access Right-click on Hybrid Regions in the project tree, then select Set SBR+ Source Regions.

Name Type Description


<SBRSourcesArray> Array Structured array.
Array(<OneSBRSource>, <OneSBRSource>,...)
<OneSBRSource> Array Structured array.
Array("Name:<SourceName>",

Parameters "Regions:=", [<Region Names>],


"Use Global:=" <boolean>,
"Far Field Source CS:=" "<string>",
"Current Source Conformance:=", <"Auto" | "Enable"
| "Disable">,
"Thin Sources:=", <boolean>,

Boundary and
Excitation Module Script Commands 14-213
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Power Fraction:=", "decimal less than 1 and


greater than 0.1")

Return Value None.

Python Syntax SetSBRSources(<SBRSourcesArray>)


oModule.SetSBRSources([
[
"NAME:Two Way",
"Regions:=", ["FE-BI3", "Hybrid2"],
"Use Global:=", True
],
[
Python Example "Name:Two Way",
"Regions:=", ["FE-BI1", "FE-BI2"],
"Far Field Source CS:=", "Global"
],
[
"NAME:Hybrid3",
"Use Global:=", False,
"Use Current Source Conformance:=", "Auto",

Boundary and
Excitation Module Script Commands 14-214
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Thin Sources:=", False


],
[
"NAME:Hybrid4",
"Use Global:=", False,
"Use Current Source Conformance:=", "Enable",
"Thin Sources:=", True,
"Power Fraction:=", 0.42
]
])

VB Syntax SetSBRSources <SBRSourcesArray>


oModule.SetSBRSources Array( _
Array("NAME:Two Way", _
"Regions:=", Array("FE-BI3", "Hybrid2"), _
"Use Global:=", true), _
VB Example Array("Name: Two Way", _
"Regions:=", Array("FE-BI1", "FE-BI2"), _
"Far Field Source CS:=", "Global"), _
Array("NAME:Hybrid3", _
"Use Global:=", false, _

Boundary and
Excitation Module Script Commands 14-215
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Use Current Source Conformance:=", "Auto", _


"Thin Sources:=", false), _
Array("NAME:Hybrid4", _
"Use Global:=", false, _
"Use Current Source Conformance:=", "Enable", _
"Thin Sources:=", true, _
"Power Fraction:=", 0.42 _))

SetSBRSourcesBlockage
For HFSS Driven Modal Terminal or Driven Terminal Designs containing SBR+ regions the Set Coupling menu is replaced by the Set
SBR+ Source Regions command. The dialog also contains a Blockage List button. You can create object lists containing objects to
treat as blockages. Such object lists must contain at least one conducting object and have no SBR+ Regions. Enable those lists to
treat the objects as blockages.

UI Access Click Blockage List in the Set SBR+ Source Regions dialog window.

Name Type Description


<SBRBlockageArray> Array Structured array.
Parameters
Array("NAME:SBRBlockageSettings",
"ListsForBlockage:=" , <ObjectlistName>)

Return Value None.

Python Syntax SetSBRSourcesBlockage(<SBRBlockageArray>)

Boundary and
Excitation Module Script Commands 14-216
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.SetSBRSourcesBlockage(
[
Python Example "NAME:SBRBlockageSettings",
"ListsForBlockage:=", ["Objectlist1"]
])

VB Syntax SetSBRSourcesBlockage <SBRBlockageArray>


oModule.SetSBRSourcesBlockage _
VB Example Array("NAME:SBRBlockageSettings", _
"ListsForBlockage:=", Array( "Objectlist1"))

SetSBRTxRxSettings
Assigns Transmit and Receive assignments for antennas in SBR+ solutions.

UI Access Right-click on Excitations > Select Tx/Rx...

Name Type Description


<TxRxArray> Array Structured array.
Array("NAME:SBRTxRxSettings",
Parameters <AssignmentList>, <AssignmentList>,...)
<AssignmentList> Array Structured array.
Array("NAME:<ListName>",
"Tx Antenna:=", <string, antenna components>,

Boundary and
Excitation Module Script Commands 14-217
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Rx Antennas:=", <string, antenna components>)

Return Value None.

Python Syntax SetSBRTxRxSettings(<TxRxArray>)


oModule.SetSBRTxRxSettings([
"NAME:SBRTxRxSettings",
[
"NAME:Tx/Rx List 0",
"Tx Antenna:=", "cHorn1_1_p1",
"Rx Antennas:=", "Beam1_1_p1,pHorn1_1_p1,sDipole1_1_p1"
],
Python Example [
"NAME:Tx/Rx List 1",
"Tx Antenna:=", "Beam1_1_p1",
"Rx Antennas:=", "Beam1_1_p1,pHorn1_1_p1,sDipole1_1_p1"
],
[
"NAME:Tx/Rx List 2",
"Tx Antenna:=", "sDipole1_1_p1",

Boundary and
Excitation Module Script Commands 14-218
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Rx Antennas:=", "Beam1_1_p1,pHorn1_1_p1,sDipole1_1_p1"


]
])

VB Syntax SetSBRTxRxSettings <TxRxArray>


oModule.SetSBRTxRxSettings Array("NAME:SBRTxRxSettings", _
Array("NAME:Tx/Rx List 0", _
"Tx Antenna:=", "cHorn1_1_p1", _
"Rx Antennas:=", "Beam1_1_p1,pHorn1_1_p1,sDipole1_1_p1"), _
Array("NAME:Tx/Rx List 1", _
VB Example
"Tx Antenna:=", "Beam1_1_p1", _
"Rx Antennas:=", "Beam1_1_p1,pHorn1_1_p1,sDipole1_1_p1"), _
Array("NAME:Tx/Rx List 2", _
"Tx Antenna:=", "sDipole1_1_p1", _
"Rx Antennas:=", "Beam1_1_p1,pHorn1_1_p1,sDipole1_1_p1"))

SetSBRWedgeSettings
For designs with an SBR+ Region, sets SBR wedge settings.

UI Access Right-click on Hybrid Regions > SBR+ Wedges > Settings...

Name Type Description


Parameters
<WedgeSettingArray> Array Structured array.

Boundary and
Excitation Module Script Commands 14-219
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("Name:SBRWedgeSettings",
"MaxWedgeAngle:=" "<integer with deg>",
"IncludeSheetEdges:=" <boolean>,
"ApplySourceDistFilter:="<boolean>,
"SourceX:=" <x coord>,
"SourceY:=" <Y coord>,
"SourceZ:=" <Z coord>,
"CS:=" "<CS Name>,
"DistFromSource:=", "<integer with units>",
"ApplyBoxFilter:=", <boolean>,
If False, no additional parameters. If True:
"Box:=" <BoxID>)

Return Value None.

Python Syntax SetSRBWedgeSettings(<WedgeSettingArray>)


oModule.SetSBRWedgeSettings([
"NAME:SBRWedgeSettings",
Python Example
"MaxWedgeAngle:=", "135deg",
"IncludeSheetEdges:=", True,

Boundary and
Excitation Module Script Commands 14-220
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ApplySourceDistFilter:=", True,
"SourceX:=", 0,
"SourceY:=", 0,
"SourceZ:=", 0,
"CS:=", "Global",
"DistFromSource:=", "1000mm",
"ApplyBoxFilter:=", True,
"Box:=", "Box1"
])

VB Syntax SetSRBWedgeSettings <WedgeSettingArray>


oModule.SetSBRWedgeSettings _
Array("NAME:SBRWedgeSettings", _
"MaxWedgeAngle:=", "135deg", _
"IncludeSheetEdges:=", true, _
VB Example "ApplySourceDistFilter:=", true, _
"SourceX:=", 0, "SourceY:=", 0, "SourceZ:=", 0, _
"CS:=", "Global", _
"DistFromSource:=", "1000mm", _
"ApplyBoxFilter:=", false)

Boundary and
Excitation Module Script Commands 14-221
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetTerminalReferenceImpedances
Sets the reference impedance for all terminals within a specified port.

UI Access HFSS > Excitations > Set Terminal Renormalizing Impedances...

Name Type Description


<RefImpValue> String Impedance value with unit.
<PortName> String Optional. Name of the port.
Parameters <RenormalizeTerminals> Boolean Optional.
l True - renormalize terminals.

l False - do not renormalize terminals.

Return Value None.

Python Syntax SetTerminalReferenceImpedances(<RefImpValue>, <PortName>, <RenormalizeTerminals>)


Python Example oModule.SetTerminalReferenceImpedances("50ohm", "", False)

VB Syntax SetTerminalReferenceImpedances <RefImpValue>, <PortName>, <RenormalizeTerminals>


VB Example oModule.SetTerminalReferenceImpedances "50ohm", "", false

Boundary and
Excitation Module Script Commands 14-222
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetTotalFieldFormulation
Sets incident wave to total field formulation. Note: Incident field formulation is only applicable in a driven terminal/modal design with
incident wave.

UI Access Right-click on Excitations, then select Set Incident Field Formulation > Total.
Parameters None.
Return Value None.

Python Syntax SetTotalFieldFormulation()


Python Example oModule.SetTotalFieldFormulation()

VB Syntax SetTotalFieldFormulation
VB Example oModule.SetTotalFieldFormulation

SwapCircuitPortDirection
Swaps the direction of a circuit port.

UI Access N/A

Name Type Description


Parameters
<PortName> String Name of specified port.

Return Value None.

Boundary and
Excitation Module Script Commands 14-223
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax SwapCircuitPortDirection(<PortName>)


Python Example oModule.SwapCircuitPortDirection("1")

VB Syntax SwapCircuitPortDirection <PortName>


VB Example oModule.SwapCircuitPortDirection "1"

SwapLatticePair
Swaps the faces defined in a lattice pair.

UI Access Right-click on a lattice pair in the project tree, then select Swap Faces.

Name Type Description


Parameters
<LatticePairName> String Name of specified lattice pair boundary to be edited.

Return Value None.

Python Syntax SwapLatticePair(<LatticePairName>)


Python Example oModule.SwapLatticePair("LatticePair1")

VB Syntax SwapLatticePair <LatticePairName>


VB Example oModule.SwapLatticePair "LatticePair1"

Boundary and
Excitation Module Script Commands 14-224
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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:

Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project58")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")

Boundary and
Excitation Module Script Commands 14-225
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Set oModule = oDesign.GetModule("BoundarySetup")


oModule.UnassignIERegions Array("Box1")

Script Commands for Creating and Modifying PMLs


Following are script commands for creating and modifiying PMLs that are recognized by the BoundarySetup module.
The PML Setup wizard allows you to set up one or more PMLs in the model. There is not a single ‘Create PML’ or ‘Edit PML’ com-
mand that represents the work performed by the PML Setup wizard. Instead, a series of geometry and material commands are
executed. As a result, when a script is being recorded, a series of geometry and material creation commands is what is actually recor-
ded in the script for a PML setup. This is followed by a script command stating that PMLs have been set up or modified.
CreatePML
ModifyPMLGroup
PMLGroupCreated
PMLGroupModified
RecalculatePMLMaterial
CreatePML
Set up a perfectly matched layer (PML) boundary.

UI Access HFSS > Boundaries > PML Setup Wizard...

Name Type Description


<PMLArray> Array Structured array.
Parameters
For manually created PMLs:
Array("NAME:PMLCreationSettings",

Boundary and
Excitation Module Script Commands 14-226
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UserDrawnGroup:=", true,
"PMLObj:=", <string, name of the object to use as the
PML cover.>,
"BaseObj:=", <string, name of the base object touching
the PML cover object>,
"Thickness:=", <value>,
"Orientation:=", <string, orientation of the PML. Poss-
ible values are: "XAxis", "YAxis", and "ZAxis">,
"RadDist:=", <value>,
"UseFreq:=", <boolean, If true, provide the MinFreq
parameter. If false, provide the MinBeta parameter.>,
"MinFreq:=", <value>,
"MinBeta:=", <double>)
For automatically created PMLs:
Array("NAME:PMLCreationSettings",
"UserDrawnGroup:=", false,
"PMLFaces:=", <AssignmentFaces>,
"CreateJoiningObjs:=", <bool>,
"Thickness:=", <value>,
"RadDist:=", <value>,
"UseFreq:=", <boolean, If true, provide the MinFreq
parameter. If false, provide the MinBeta parameter.>,
"MinFreq:=", <value>,

Boundary and
Excitation Module Script Commands 14-227
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MinBeta:=", <double>)

Return Value None.

Python Syntax CreatePML(<PMLArray>)


oModule.CreatePML(
["NAME:PMLCreationSettings",
"UserDrawnGroup:=", True,
"PMLFaces:=", [120],
"Thickness:=", "1mm",
"CreateJoiningObjs:=", False,
"PMLObj:=", 6,
Python Example
"BaseObj:=", 15,
"Orientation:=", "ZAxis",
"UseFreq:=", True,
"MinFreq:=", "1GHz",
"MinBeta:=", 20,
"RadDist:=", "0.3mm"
])

Boundary and
Excitation Module Script Commands 14-228
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax CreatePML <PMLArray>


oModule.CreatePML Array("NAME:PMLCreationSettings", _
"UserDrawnGroup:=", false,_
"PMLFaces:=", Array(120), "CreateJoiningObjs:=", true,_
"Thickness:=", "0.33mm", "RadDist:=", "1.6mm",_
"UseFreq:=", true, "MinFreq:=", "1GHz")

VB Example
oModule.CreatePML Array("NAME:PMLCreationSettings", _
"UserDrawnGroup:=", true,_
"PMLObj:=", "Box1", "BaseObj:=", "Box2", _
"Thickness:=", "0.3mm", "Orientation:=", "ZAxis", _
"RadDist:=", "1.6mm", "UseFreq:=", false, _
"MinBeta:=", "2")

ModifyPMLGroup
Modifies a PML group.

UI Access N/A

Name Type Description


<PMLGroupArray> Array Structured array.

Parameters Array("NAME:<GroupName>",
"RadDist:=", <value>,
"UseFreq:=", <boolean>,

Boundary and
Excitation Module Script Commands 14-229
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MinFreq:=", <value>,
"MinBeta:=", <double>)
UseFreq
If true, provide the MinFreq argument.
If false, provide the MinBeta argument.

Return Value None.

Python Syntax ModifyPMLGroup(<PMLGroupArray>)


oModule.ModifyPMLGroup(
["NAME:PMLGroup1",
"RadDist:=", "1.166666667mm",
Python Example
"UseFreq:=", False,
"MinBeta:=", 2]
)

VB Syntax ModifyPMLGroup <PMLGroupArray>

Boundary and
Excitation Module Script Commands 14-230
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.ModifyPMLGroup Array("NAME:PMLGroup1", _
VB Example "RadDist:=", "1.166666667mm", _
"UseFreq:=", false, "MinBeta:=", 2)

PMLGroupCreated
Command added by HFSS after a PML has been created. It is not responsible for creating the PML objects and materials. It just con-
tains 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.

UI Access N/A

Name Type Description


Parameters
<PMLArray> Array Array represents the created PML group.

Return Value None.

Python Syntax PMLGroupCreated(<PMLArray>)


oModule.PMLGroupCreated(
["NAME:PMLCreationSettings",
"UserDrawnGroup:=", True,
Python Example "PMLFaces:=", [120],
"Thickness:=", "1mm",
"CreateJoiningObjs:=", False,
"PMLObj:=", 6,

Boundary and
Excitation Module Script Commands 14-231
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"BaseObj:=", 15,
"Orientation:=", "ZAxis",
"UseFreq:=", True,
"MinFreq:=", "1GHz",
"MinBeta:=", 20,
"RadDist:=", "0.3mm"
])

VB Syntax PMLGroupCreated <PMLArray>


oModule.PMLGroupCreated Array("NAME:PMLCreationSettings", _
"UserDrawnGroup:=", false,_
VB Example "PMLFaces:=", Array(120), "CreateJoiningObjs:=", true,_
"Thickness:=", "0.33mm", "RadDist:=", "1.6mm",_
"UseFreq:=", true, "MinFreq:=", "1GHz")

PMLGroupModified
Modifies a defined PML Group.

UI Access Click Update in the PML Setup wizard.

Name Type Description


Parameters
< PMLGroupArray> Array Structured array.

Boundary and
Excitation Module Script Commands 14-232
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:<GroupName>",
"RadDist:=", <value>,
"UseFreq:=", <boolean>,
"MinFreq:=", <value>,
"MinBeta:=", <double>)
UseFreq
If true, provide the MinFreq argument.
If false, provide the MinBeta argument.

Return Value None.

Python Syntax PMLGroupModified(<PMLGroupArray>)


oModule.PMLGroupModified(
["NAME:PMLGroup1",
"RadDist:=", "2.00833333333333in",
"UseFreq:=", True,
Python Example "MinFreq:=", "2GHz",
["NAME:ProjectMaterials"],
["NAME:InternalPrivateMaterials"]
]
)

Boundary and
Excitation Module Script Commands 14-233
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax PMLGroupModified <PMLGroupArray>


oModule.PMLGroupModified Array("NAME:PMLGroup1", _
"RadDist:=", "2.00833333333333in", _
VB Example "UseFreq:=", true, "MinFreq:=", "2GHz", _
Array("NAME:ProjectMaterials"), _
Array("NAME:InternalPrivateMaterials"))

RecalculatePMLMaterials
Updates the PML materials to match the current state of the PML Setup wizard data.

UI Access Click Recalculate Materials in the PML Setup wizard.


Parameters None.
Return Value None.

Python Syntax RecalculatePMLMaterials()


Python Example oModule.RecalculatePMLMaterials()

VB Syntax RecalculatePMLMaterials

Boundary and
Excitation Module Script Commands 14-234
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oModule.RecalculatePMLMaterials

AssignMultiFloatingLine
Use: Assigns multiple "Floating Line" on selected objects (each per object).
Command: Click 2D Extractor>Conductor>Assign>Floating Line
Syntax: AssignMultiFloatingLine <MultiAssignmentParameters>
Return Value: None
Parameters: <MultiAssignmentParameters>
Array(<ConductorName>,<ConductorName>..), <AssignmentParameters>
<ConductorName>
Type:<String>
Name of the assigned conductors.
<AssignmentParameters>
Array("NAME:<SourceName>", "Objects:=", <AssignmentObjects>)
"SolveOptions:=<SolveOptions>", "Thickness:=<Thickness>")
<SourceName>
Type:<String>
Name of the conductor
<AssignmentObjects>
Type:<String>
Name of the object or body in geometry.
<SolveOptions>

Boundary and
Excitation Module Script Commands 14-235
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Type: <String>
Value: one of the following - "SolveInside", "SolveOnBoundary", "Automatic".
<Thickness>
Type: String
Value: a double value with units of length.
VB Example: oModule.AssignMultiSignalLine Array("Rectangle3", "Rectangle4"), Array("NAME:Rect-
angle1", "Objects:=", Array( _ "Rectangle1"), "SolveOption:=", "Boundary", "Thickness:=",
"0.171428571428571mm")
AssignMultiSignalLine
Use: Assigns multiple "Signal Line" on selected objects (each per object).
Command: 2D Extractor>Conductor>Assign>Signal Line
Syntax: AssignMultiSignalLine <MultiAssignmentParameters>
Return Value: None
Parameters: <MultiAssignmentParameters>
Array(<ConductorName>,<ConductorName>..), <AssignmentParameters>
<ConductorName>
Type:<String>
Name of the assigned conductors.
<AssignmentParameters>
Array("NAME:<SourceName>", "Objects:=", <AssignmentObjects>)
"SolveOptions:=<SolveOptions>", "Thickness:=<Thickness>")

Boundary and
Excitation Module Script Commands 14-236
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<SourceName>
Type:<String>
Name of the conductor
<AssignmentObjects>
Type:<String>
Name of the object or body in geometry.
<SolveOptions>
Type: <String>
Value: one of the following - "SolveInside", "SolveOnBoundary", "Automatic".
<Thickness>
Type: String
Value: a double value with units of length.
VB Example: oModule.AssignMultiFloatingLine Array("Rectangle3", "Rectangle4"), Array("NAME:Rect-
angle1", "Objects:=", Array( _ "Rectangle1"), "SolveOption:=", "Boundary", "Thickness:=",
"0.171428571428571mm")
AssignMultiNonIdealGround
Use: Assigns multiple "Non Ideal Ground" on selected objects (each per object).
Command: 2D Extractor>Conductor>Assign>Non Ideal Ground
Syntax: AssignMultiNonIdealGround <MultiAssignmentParameters>
Return Value: None
Parameters: <MultiAssignmentParameters>
Array(<ConductorName>,<ConductorName>..), <AssignmentParameters>

Boundary and
Excitation Module Script Commands 14-237
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ConductorName>
Type:<String>
Name of the assigned conductors.
<AssignmentParameters>
Array("NAME:<SourceName>", "Objects:=", <AssignmentObjects>)
"SolveOptions:=<SolveOptions>", "Thickness:=<Thickness>")
<SourceName>
Type:<String>
Name of the conductor
<AssignmentObjects>
Type:<String>
Name of the object or body in geometry.
<SolveOptions>
Type: <String>
Value: one of the following - "SolveInside", "SolveOnBoundary", "Automatic".
<Thickness>
Type: String
Value: a double value with units of length.

Boundary and
Excitation Module Script Commands 14-238
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example: oModule.AssignMultiNonIdealGround Array("Rectangle3", "Rectangle4"), Array


("NAME:Rectangle1", "Objects:=", Array( _ "Rectangle1"), "SolveOption:=", "Boundary", "Thick-
ness:=", "0.171428571428571mm")
ToggleConductor
Use: Toggles between one conductor to other.
Command: Click a conductor in the project tree, and then click Toggle on the shortcut menu.
Syntax: ToggleConductor <TerminalName>, <NewType>
Return Value: None
Parameters: <ConductorName>
Type: <string>
Conductor name that is selected.
<NewType>
Type: <String>
New type of conductor to be toggled.
VB Example: oModule.ToggleConductor "Rectangle5", "ReferenceGround"
EditSignalLine
Use: Edits the properties of a signal line conductor.
Command: Double-click a conductor.
Syntax: EditSignalLine <ConductorName> , <ConductorParameters>
Return Value: None
Parameters: <ConductorName>
Type: <string>

Boundary and
Excitation Module Script Commands 14-239
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Conductor name that is selected.


<ConductorParameters>
Array(("Name:=<NewName>", "SolveOptions:=<SolveOptions>", "Thickness:=<Thickness>"))
<SolveOptions>
Type: <String>
Value: one of the following, "SolveInside", "SolveOnBoundary", "Automatic"
<Thickness>
Type: String
Value: a double value with units of length.
<NewName>
Type: <String>
New name of conductor to be toggled.
VB Example: oModule.EditSignalLine "Rectangle6", Array("NAME:Rectangle6_1", "SolveOption:=",
"Automatic", "Thickness:=", "0.179464285714286mm")

EditSurfaceGround
Use: Edits the properties of a surface ground conductor.
Command: Double-click a conductor.
Syntax: EditSurfaceGround <ConductorName> , <ConductorParameters>
Return Value: None

Boundary and
Excitation Module Script Commands 14-240
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters: <ConductorName>
Type: <string>
Conductor name that is selected.
<ConductorParameters>
Array(("Name:=<NewName>", "SolveOptions:=<SolveOptions>", "Thickness:=<Thickness>"))
<SolveOptions>
Type: <String>
Value: one of the following, "SolveInside", "SolveOnBoundary", "Automatic"
<Thickness>
Type: String
Value: a double value with units of length.
<NewName>
Type: <String>
New name of conductor to be toggled.
VB Example: oModule.EditSurfaceGround "Rectangle6", Array("NAME:Rectangle6_1", "SolveOption:=",
"Automatic", "Thickness:=", "0.179464285714286mm")
EditFloatingLine
Use: Edits the properties of a floating line conductor.
Command: Double-click a conductor.
Syntax: EditFloatingLine <ConductorName> , <ConductorParameters>
Return Value: None
Parameters: <ConductorName>

Boundary and
Excitation Module Script Commands 14-241
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Type: <string>
Conductor name that is selected.
<ConductorParameters>
Array(("Name:=<NewName>", "SolveOptions:=<SolveOptions>", "Thickness:=<Thickness>"))
<SolveOptions>
Type: <String>
Value: one of the following, "SolveInside", "SolveOnBoundary", "Automatic"
<Thickness>
Type: String
Value: a double value with units of length.
<NewName>
Type: <String>
New name of conductor to be toggled.
VB Example: oModule.EditFloatingLine "Rectangle6", Array("NAME:Rectangle6_1") "SolveOption:=",
"Automatic", "Thickness:=", "0.179464285714286mm")
AssignFiniteCond
Assigns a single finite conductivity boundary on selected edges.

UI Access 2D Extractor > Boundary > Assign > Finite Conductivity.

Name Type Description


Parameters
<Parameters> Array Structured array.

Boundary and
Excitation Module Script Commands 14-242
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:<name of the boundary.>",


"Edges:=", <array of edge ids>,
"Roughness:=", "<string of double with units of
length>",
"UseCoating:=", <boolean>,
"LayerThickness:=", "<string of double with units of
length>",
"UseMaterial:=", <boolean>,
"Material:=", "<string material name for coating>",
"Radius:=", <string of double with units of length>,
"Ratio:=", <string of double>)

Return Value None.

Python Syntax AssignFiniteCond(<Parameters>)

Example for the Hammerstad-Jensen surface roughness model.


oModule.AssignFiniteCond
["NAME:FiniteCond1",
Python Example "Edges:=", [7,9],
"Roughness:=", "2um",
"UseCoating:=", True,
"LayerThickness:=", "1.2um",

Boundary and
Excitation Module Script Commands 14-243
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseMaterial:=", True,
"Material:=", "Copper"]
Example for the Hurray surface roughness model
oModule.AssignFiniteCond
["NAME:FiniteCond1",
"Edges:=", [7],
"UseCoating:=", False,
"Radius:=", "0.5um",
"Ratio:=", "2.9"]

VB Syntax AssignFiniteCond <Parameters>

Example for the Hammerstad-Jensen surface roughness model.


oModule.AssignFiniteCond
Array("NAME:FiniteCond1",
"Edges:=", Array(7,9),
VB Example
"Roughness:=", "2um",
"UseCoating:=", true,
"LayerThickness:=", "1.2um",
"UseMaterial:=", true,

Boundary and
Excitation Module Script Commands 14-244
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Material:=", "Copper")
Example for the Hurray surface roughness model
oModule.AssignFiniteCond
Array("NAME:FiniteCond1",
"Edges:=", Array(7),
"UseCoating:=", false,
"Radius:=", "0.5um",
"Ratio:=", "2.9")

EditFiniteCond
Modifies parameters of single finite conductivity boundary.

UI Access Double-click finite conductivity boundary in project tree.

Name Type Description


<BoundaryName> String Name of the finite conductivity boundary to be edited.
<FiniteCondArray> Array Structured array.
Array("NAME:<Name of the boundary>",
"Roughness:=", "<string, double value with units of
length>",
Parameters
"UseCoating:=", <boolean>,
"LayerThickness:=", "<string, double value with
units of length>",
"UseMaterial:=", <boolean>,
"Material:=", "<string, material name for coat-

Boundary and
Excitation Module Script Commands 14-245
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ing.>")

Return Value None.

Python Syntax EditFiniteCond (<BoundaryName>, <FiniteCondArray>)


oModule.EditFiniteCond("FiniteCond1",
["NAME:FiniteCond1",
Python Example "Roughness:=", "2um",
"UseCoating:=", false]
)

VB Syntax EditFiniteCond <BoundaryName>, <FiniteCondArray>


oModule.EditFiniteCond "FiniteCond1", _
Array("NAME:FiniteCond1", _
VB Example
"Roughness:=", "2um", _
"UseCoating:=", false)

AssignThinConductor
Use:Assign a thin conductor boundary on a 2D object.
Command:Q3D Extractor>Boundary>Assign>Thin Conductor

Boundary and
Excitation Module Script Commands 14-246
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax:AssignThinConductor <Boundary Name>, Array("NAME:<Boundary Name>,"Material:=", <Material Name>, "Thickness:=",


<thickness string", "Direction:=", <direction string>)
Return Value:none
Parameters:<Name>
Type:<String>
Name of the boundary
<sheet ids>
Type:<String>
List of 2D object names, separated by comma.
<ThinCondParameters>
Parameters:
"Material:=", "<Material Name>", "Thickness:=", <Thickness>
<Material Name>
Type: <String>
Value: material name, default is "Copper"
<Thickness>
Type: String
Value: double with units of length
<Direction>
Type: String
Value: can be "Positive" or "Negative"

Boundary and
Excitation Module Script Commands 14-247
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example:Set oModule = oDesign.GetModule("BoundarySetup") oModule.AssignThinConductor


"ThinCond1", Array("NAME:ThinCond1", "Material:=", "Copper", "Thickness:=", _ "2mm", "Dir-
ection:=", "Positive")

ToggleTerminal
Use:Toggles between source and sink.
Command:Click a terminal in the project tree, and then click Toggle on the shortcut menu.
Syntax:ToggleTerminal <TerminalName>
Return Value:None

Boundary and
Excitation Module Script Commands 14-248
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

15 - Mesh Operations Module Script Commands


Commands for mesh setup and operations should be executed by the "MeshSetup" module.
Set oModule = oDesign.GetModule("MeshSetup")
oModule.CommandName <args>
Conventions Used in this Chapter
<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 3DModeler>Measure>Area
command. The face ID is given in the Measure Information dialog box.

The topics for this section include:


General Commands Recognized by the Mesh Operations Module
Script Commands for Creating and Modifying Mesh Operations

Mesh Operations Module Script Commands 15-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

General Commands Recognized by the Mesh Operations Module


General commands recognized by the Mesh Operations Module:
DeleteOp
GetMeshOpAssignment
GetOperationName
RenameOp
DeleteOp
Deletes the specified mesh operations.

UI Access Delete command in the List dialog box.

Name Type Description


Parameters
<NameArray> Array Array of mesh operation names.

Return Value None.

Python Syntax DeleteOp(<NameArray>)


Python Example oModule.DeleteOp(["Length1", "SkinDepth1","Length2"])

VB Syntax DeleteOp <NameArray>


VB Example oModule.DeleteOp Array("Length1", "SkinDepth1",_

Mesh Operations Module Script Commands 15-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Length2")

GetMeshOpAssignment
Find a list of objects that are associated with a mesh operation.

UI Access N/A

Name Type Description


Parameters
<OperationType> String Specified mesh operation name.

Return Value Array of IDs containing body/face assignments for this mesh operation.

Python Syntax GetMeshOpAssignment(<OperationType>)


Python Example oModule.GetMeshOpAssignment("Length Based")

VB Syntax GetMeshOpAssignment <OperationType>


VB Example oModule.GetOperationNames "Length Based"

GetOperationNames
Gets the names of mesh operations defined in a design.

UI Access N/A

Name Type Description


Parameters
<OperationType> String Specified operation type.

Return Value Array of strings containing mesh operation names.

Mesh Operations Module Script Commands 15-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetOperationNames(<OperationType>)


Python Example oModule.GetOperationNames("Length Based")

VB Syntax GetOperationNames <OperationType>


VB Example oModule.GetOperationNames "Length Based"

ReassignOp
Reassigns a mesh operation

UI Access Right-click on a mesh operation, then select Reassign

Name Type Description


<OpName> String Operation name to reassign.
Parameters <AssignParams> Array Structured array.
Array("Objects:=", <array of objects> | "Faces:=", <array
of faces>)

Return Value None.

Python Syntax ReassignOp(<OpName>, <AssignParams>)


Python Example oModule.ReassignOp("ApplyCurvilinear1",

Mesh Operations Module Script Commands 15-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"Faces:=", [16]
])
oModule.ReassignOp("Length1",
[
"Objects:=", ["Box1"]
])

VB Syntax ReassignOp <OpName>, <AssignParams>


oModule.ReassignOp "ApplyCurvilinear1", _
Array("Faces:=", Array(16))
VB Example
oModule.ReassignOp("Length1", _
Array("Objects:=", Array("Box1"))

RenameOp
Renames a mesh operation.

UI Access Right-click the mesh operation in the project tree, and then click Rename on the shortcut menu.

Name Type Description


Parameters <OldName> String Old name for the mesh operation.
<NewName> String New name for the mesh operation.

Return Value None.

Mesh Operations Module Script Commands 15-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax RenameOp(<OldName>, <NewName>)


Python Example oModule.RenameOp("SkinDepth1", "NewName")

VB Syntax RenameOp <OldName>, <NewName>


VB Example oModule.RenameOp "SkinDepth1", "NewName"

Script Commands for Creating and Modifying Mesh Operations


Script commands for creating and modifying mesh operations are as follows:
AssignApplyCurvilinearElementsOp
AssignCurvatureExtrationOp
AssignLengthOp
AssignModelResolutionOp
"AssignSkinDepthLayerSetting " on page 15-23
AssignSBRCurvatureExtractionOp
AssignSkinDepthOp
AssignTrueSurfOp
EditLengthOp
EditModelResolutionOp
EditSBRCurvatureExtractionOp

Mesh Operations Module Script Commands 15-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditSkinDepthOp
EditTrueSurfOp
"InitialMeshSettings " on page 15-50
AssignApplyCurvilinearElementsOp
Applies a curvilinear elements mesh operation to the selection.

UI Access HFSS > Mesh > Assign Mesh Operation > On Selection > Apply Curvlinear Meshing...

Name Type Description


<CurvilinearnElementsOpParams> Array Structured array.
Array("NAME:<OpName>",
Parameters
"Faces:=", <AssignmentFaces>, | "Object-
s:=", Array("objectID")
"Apply:=", <bool>)

Return Value None.

Python Syntax AssignApplyCurvilinearElementsOp(<CurvilinearnElementsOpParams>)


oModule.AssignApplyCurvlinearElementsOp(
[
"NAME:ApplyCurvilinear1",
Python Example
"Faces:=", [155],
"Apply:=", False
])

Mesh Operations Module Script Commands 15-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax AssignApplyCurvilinearElementsOp <CurvilinearnElementsOpParams>


oModule.AssignApplyCurvlinearElementsOp _
Array("NAME:ApplyCurvilinear1", _
VB Example
"Objects:=", Array( "Sphere1"), _
"Apply:=", true)

AssignCloneOp
Uses the mesh data from a user-specified parent region to apply identical meshes to its cloned regions

UI Access Maxwell 2D > Mesh > Assign Mesh Operation > Clone Mesh...

Name Type Description


<CloneOpParams> Array Structured array.
Array("NAME:<CloneOpName>",
"Enabled:=", <boolean>,
"InnerRadius:=", "<value><unit>",
Parameters
"OuterRadius:=", "<value><unit>",
"StartAngle:=", "<value (default = 0)><unit>",
"EndAngle:=", "<value><unit>",
"GapAngle:=", "<value angular spacing between
clones><unit>",

Mesh Operations Module Script Commands 15-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NumberofClones:=", "<integer number of periodic


regions (including the parent)>",
"ParentRegionSymmetry:=", <boolean>)

Return Value None.

Python Syntax AssignCloneOp(<CloneOpParams>)


oModule.AssignCloneOp(
[
"NAME:Clone1",
"Enabled:=", True,
"InnerRadius:=", "55mm",
"OuterRadius:=", "175mm",
Python Example
"StartAngle:=", "0deg",
"EndAngle:=", "15deg",
"GapAngle:=", "0deg",
"NumberofClones:=", "6",
"ParentRegionSymmetry:=", True
])

VB Syntax AssignCloneOp <CloneOpParams>

Mesh Operations Module Script Commands 15-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.AssignCloneOp _
Array("NAME:Clone1", _
"Enabled:=", true, _
"InnerRadius:=", "55mm", _
"OuterRadius:=", "175mm", _
VB Example
"StartAngle:=", "0deg", _
"EndAngle:=", "15deg", _
"GapAngle:=", "0deg", _
"NumberofClones:=", "6", _
"ParentRegionSymmetry:=", true)

AssignCurvatureExtractionOp (Beta)
Assigns a curvature extraction operation to the selection for a faceted SBR+ object or face.

UI Access HFSS > Mesh > Assign Mesh Operation > SBR+ Curvature Extraction for Faceted Surfaces...

Name Type Description


<CurvilinearnElementsOpParams> Array Structured array.
Array("NAME:<OpName>",
Parameters
"Faces:=", <AssignmentFaces>, | "Object-
s:=", Array("objectID")
"DisableForFacetedSurfaces:=", <bool>)

Return Value None.

Mesh Operations Module Script Commands 15-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax AssignCurvatureExtractionOp(<CurvilinearnElementsOpParams>)


oModule.AssignCurvatureExtractionOp(
[
"NAME:SBRCurvExtr1",
Python Example
"Faces:=", [155],
"DisableForFacetedSurfaces:=", True
])

VB Syntax AssignCurvatureExtractionOp <CurvilinearnElementsOpParams>


oModule.AssignCurvatureExtractionOp _
Array("NAME:SBRCurvExtr1", _
VB Example
"Objects:=", Array( "RegularPolyhedron1"), _
"DisableForFacetedSurfaces:=", true)

AssignCylindricalGapOp
3D Designs
For 3D designs, assigns a cylindrical gap 3D mesh operation to enable use of Clone Mesh and associated Band Mapping Angle.
=======
Assigns a cylindrical gap 3D mesh operation to enable use of Clone Mesh and associated Band Mapping Angle.

UI Access HFSS > Mesh > Assign Mesh Operation > Cylindrical Gap Treatment

Mesh Operations Module Script Commands 15-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<CylindricalGapOpParams> Array Structured array.
Array("NAME:<OpName>",
"CloneMesh:=", <bool>,
Parameters "BandMappingAngle:=", <value> [use if CloneMesh is
"true"]
"MovingSideLayers:=", <integer>,
"StaticSideLayers:=", <integer>,
"Objects:=", <AssignmentObjects>)

Return Value None.

Python Syntax AssignCylindricalGapOp(<CylindricalGapOpParams>)


oModule.AssignCylindricalGapOp
([
"NAME:CylindricalGap1",
"CloneMesh:=", True,
Python Example
"BandMappingAngle:=", 3deg,
"MovingSideLayers:=", 1,
"StaticSideLayers:=", 3,
"Objects:=", ["Box2"]

Mesh Operations Module Script Commands 15-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

])

VB Syntax AssignCylindricalGapOp <CylindricalGapOpParams>


oModule.AssignCylindricalGapOp _
Array("NAME:CylindricalGap1", _
"CloneMesh:=", true, _
"BandMappingAngle:=", 3deg, _
"MovingSideLayers:=", 1, _
VB Example "StaticSideLayers:=", 3, _
"Objects:=", Array("Box2"))
oModule.AssignCylindricalGapOp _
Array("NAME:CylindricalGap1", _
"CloneMesh:=", false, _
"Objects:=", Array("Box2"))

AssignDensityControlOp
Assigns a density control mesh operation to specify refinement of clone mesh.

UI Access HFSS > Mesh > Assign Mesh Operation > Inside Selection > Clone Mesh Density

Mesh Operations Module Script Commands 15-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<DensityControlParams> Array Structured array.
Array("NAME:<OpName>",
"RefineInside:=", <bool>,
"Objects:=", <AssignmentObjects>,
"RestrictMaxElemLength:=", <bool>,
"MaxElemLength:=", <value>,
"RestrictLayersNum:=", <bool>,
"LayersNum:=", <integer>)
Parameters RefineInside
If true, Objects should be specified. Implies
apply restrictions to tetrahedra inside the
object.
If false, Faces and/or Objects can be spe-
cified. Implies apply restrictions to triangles
on the surface of the face or object.
RestrictMaxElemLength
If true, MaxElemLength should be specified.
RestrictLayersNum
If true, LayersNum should be specified.

Return Value None.

Mesh Operations Module Script Commands 15-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax AssignDensityControlOp(<DensityControlParams>)


oModule.AssignDensityControlOp(
[
"NAME:Clone Mesh Density3",
"RefineInside:=" , True,
"Objects:=" , ["Inner_arm"],
Python Example
"RestrictMaxElemLength:=", True,
"MaxElemLength:=" , "0.015mm",
"RestrictLayersNum:=" , True,
"LayersNum:=" , "15"
])

VB Syntax AssignDensityControlOp <DensityControlParams>

Mesh Operations Module Script Commands 15-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.AssignDensityControlOp _
Array("NAME:Clone Mesh Density3", _
"RefineInside:=", true, _
"Objects:=", Array("Inner_arm"), _
VB Example
"RestrictMaxElemLength:=", true, _
"MaxElemLength:=", "0.015mm", _
"RestrictLayersNum:=", true, _
"LayersNum:=", "15")

AssignEdgeCutLayerOp
Assigns the edge cut mesh operation to specify refinement of layer mesh.

UI Access HFSS > Mesh > Assign Mesh Operation > Inside Selection > Edge Cut Based

Name Type Description


<EdgeCutLayerOpParams> Array Structured array.

Parameters Array("NAME:<OpName>",
"Objects:=", <AssignmentObjects>,
"Layer Thickness:=", <value>)

Return Value None.

Mesh Operations Module Script Commands 15-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax AssignEdgeCutLayerOp(<EdgeCutLayerOpParams>)


oModule.AssignEdgeCutLayerOp(
[
"NAME:EdgeCut1",
Python Example
"Objects:=" , ["Rotor"],
"Layer Thickness:=" , "0.55mm"
])

VB Syntax AssignEdgeCutLayerOp <EdgeCutLayerOpParams>


oModule.AssignEdgeCutLayerOp _
Array("NAME:EdgeCut1", _
VB Example
"Objects:=", Array("Rotor"), _
"Layer Thickness:=", "0.55mm")

AssignLengthOp
Assigns length-based operations to the selection.

UI Access HFSS > Mesh > Assign Mesh Operation > On Selection | Inside Selection > Length Based

Name Type Description


<LengthOpParams> Array Structured array.
Parameters
Array("NAME:<OpName>",
"RefineInside:=", <bool>,

Mesh Operations Module Script Commands 15-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>,
"RestrictElem:=", <bool>
"NumMaxElem:=", <integer>
"RestrictLength:=", <bool>
"MaxLength:=", <value>)
RefineInside
If true, Objects should be specified. Implies apply restrictions to tet-
rahedra inside the object.
If false, Faces and/or Objects can be specified. Implies apply restric-
tions to triangles on the surface of the face or object.
RestrictElem
If true, NumMaxElem should be specified.
RestrictLength
If true, MaxLength should be specified.

Return Value None.

Python Syntax AssignLengthOp(<LengthOpParams>)


oModule.AssignLengthOp
Python Example
([

Mesh Operations Module Script Commands 15-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:Length1",
"RefineInside:=", True,
"Objects:=", ["Box1"],
"RestrictElem:=", True,
"NumMaxElem:=", 1000,
"RestrictLength:=", True,
"MaxLength:=", "1mm"
])

VB Syntax AssignLengthOp <LengthOpParams>


oModule.AssignLengthOp Array("NAME:Length1", _
"RefineInside:=", true, _
"Objects:=", Array("Box1"), _
VB Example "RestrictElem:=", true, _
"NumMaxElem:=", 1000, _
"RestrictLength:=", true, _
"MaxLength:=", "1mm")

AssignMeshRegion
Assigns a mesh region to selection.

UI Access HFSS .> Mesh > Assign Mesh Region...

Mesh Operations Module Script Commands 15-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<MeshRegionParams> Array Structured array.
Array("NAME:<MeshRegionName>",
Parameters
"Enabled:=", <boolean>,
"Objects:=", <array containing a single solid
body>)

Return Value None.

Python Syntax AssignMeshRegion(<MeshRegionParams>)


oModule.AssignMeshRegion(
[
"NAME:MeshRegion1",
Python Example
"Enabled:=", True,
"Objects:=", ["Polyline1"]
])

VB Syntax AssignMeshRegion <MeshRegionParams>


oModule.AssignMeshRegion _
VB Example
Array("NAME:MeshRegion1", _

Mesh Operations Module Script Commands 15-20


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Enabled:=", true, _
"Objects:=", Array("Polyline1"))

AssignModelResolutionOp
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.

UI Access HFSS > Mesh > Assign Mesh Operation > Model Resolution

Name Type Description


<ModelResParams> Array Structured array.
Array("NAME:<ModelResName>",
Parameters
"Objects:=", <array of object names>,
"UseAutoLength:=", <boolean>,
"DefeatureLength:=", "<value><units>")

Return Value None.

Python Syntax AssignModelResolutionOp(<ModelResParams>)


oModule.AssignModelResolutionOp
([
Python Example "NAME:ModelResolution1",
"Objects:=", ["waveguide"],
"UseAutoLength:=", True,

Mesh Operations Module Script Commands 15-21


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"DefeatureLength:=", "71.5891053163818mil"
])

VB Syntax AssignModelResolutionOp <ModelResParams>


oModule.AssignModelResolutionOp _
Array("NAME:ModelResolution1", _
VB Example "Objects:=", Array( "waveguide"), _
"UseAutoLength:=", true, _
"DefeatureLength:=", "71.5891053163818mil")

AssignRotationalLayerOp
Assigns a rotational layer mesh operation.

Right-click to open the context menu, and select Assign Mesh Operation > Inside Selection > Rotational
UI Access
Layer Mesh.

Name Type Description


<RotLayerOpParams> Array Structured array.
Array("NAME:<RotationalLayerName>",
Parameters "Objects:=", <array of objects>,
"Number of Layers:=", "<integer>",
"Total Layer Thickenss:=", "<numeric value with
unit>")

Mesh Operations Module Script Commands 15-22


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax AssignRotationalLayerOp(<RotLayerOpParams>)


oModule.AssignRotationalLayerOp(
[
"NAME:RotationalLayer1",
Python Example "Objects:=", ["Box1"],
"Number of Layers:=", "3",
"Total Layer Thickenss:=", "1.5mm"
])

VB Syntax AssignRotationalLayerOp <RotLayerOpParams>


oModule.AssignRotationalLayerOp _
Array("NAME:RotationalLayer1", _
VB Example "Objects:=", Array("Box1"), _
"Number of Layers:=", "3", _
"Total Layer Thickenss:=", "1.5mm")

AssignSkinDepthLayerSetting
Use: Assigns a skin-depth layer settings to the selected edges.

Mesh Operations Module Script Commands 15-23


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Command: Click Mesh > Assign Mesh Operation > On Selection > Skin Depth Based
Syntax: AssignSkinDepthLayerSetting Array("NAME:<LayerSettingName>", "Enabled:=", <SettingEnabled>, "Edges:=", Array
(<EdgeIDArray>), "SkinDepth:=", "<SkinDepthValue>", "NumLayers:=", "<LayerNumber>")
Return Value: None
Parameters: <LayerSettingName>
The name of the skin depth layer setting.
<SettingEnabled>
Boolean: "Enabled:=", true
<EdgeIDArray>
Array of edge IDs. "Edges:=", Array(10, 12, 13)
<SkinDepthValue>
Skin depth value with unit. "SkinDepth:=", "1mm"
<LayerNumber>
Integer, the number of layers. "NumLayers:=", "2"
Example: oModule.AssignSkinDepthLayerSetting Array("NAME:SkinDepthLayer1",
"Enabled:=", true
"Edges:=", Array(10, 12, 13),
"SkinDepth:=", "1mm",
"NumLayers:=", 2)

Mesh Operations Module Script Commands 15-24


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AssignSkinDepthOp
Assigns a skin-depth based operations to the selection.

UI Access HFSS > Mesh > Assign Mesh Operation > On Selection > Skin Depth Based

Name Type Description


<SkinDepthOpParams> Array Structured array.
Array("NAME:<OpName>",
"Faces:=", <AssignmentFaces>,
"RestrictElem:=", <bool>,

Parameters "NumMaxElem:=", <int>,


"SkinDepth:=", <value>,
"SurfTriMaxLength:=", <value>,
"NumLayers:=", <int>)
RestrictElem
If true, NumMaxElem should be specified.

Return Value None.

Python Syntax AssignSkinDepthOp(<SkinDepthOpParams>)


oModule.AssignSkinDepthOp
Python Example ([
"NAME:SkinDepth1",

Mesh Operations Module Script Commands 15-25


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Faces:=", [7],
"RestrictElem:=", True,
"NumMaxElem:=", 1000,
"SkinDepth:=", "1mm",
"SurfTriMaxLength:=", "1mm",
"NumLayers:=", 2
])

VB Syntax AssignSkinDepthOp <SkinDepthOpParams>


oModule.AssignSkinDepthOp Array("NAME:SkinDepth1", _
"Faces:=", Array(7), _
"RestrictElem:=", true, _
VB Example "NumMaxElem:=", 1000, _
"SkinDepth:=", "1mm", _
"SurfTriMaxLength:=", "1mm", _
"NumLayers:=", 2)

AssignSurfPriorityForTauOp
Sets the mesh operation surface representation priority for TAU mesh.

Mesh Operations Module Script Commands 15-26


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Right-click to open the context menu, and select Assign Mesh Operation > Surface Priority for TAU....

Name Type Description


<SurfPriorityParams> Array Structured array.
Array("NAME:<SurfPriorityName>",
Parameters
"Faces:=", <array of face IDs>,
"SurfaceRepPriority:=", <0 - normal priority, 1 - high
priority>)

Return Value None.

Python Syntax AssignSurfPriorityForTauOp(<SurfPriorityParams>)


oModule.AssignSurfPriorityForTauOp(
[
"NAME:SurfPriority1",
Python Example
"Faces:=", [15],
"SurfaceRepPriority:=", 1
])

VB Syntax AssignSurfPriorityForTauOp <SurfPriorityParams>


oModule.AssignSurfPriorityForTauOp _
VB Example
Array("NAME:SurfPriority1", _

Mesh Operations Module Script Commands 15-27


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Faces:=", Array(15), _
"SurfaceRepPriority:=", 1)

AssignTrueSurfOp
Assigns a true surface-based mesh operation on the selection.

UI Access HFSS > Mesh > Assign Mesh Operation > Surface Approximation

Name Type Description


<TrueSurfOpParams> Array Structured array.
Array("NAME:<OpName>",
"Faces:=", <AssignmentFaces>,
"SurfDevChoice:=", <RadioOption>,
"SurfDev:=", <value>,
"NormalDevChoice:=", <RadioOption>,

Parameters "NormalDev:=", <value>,


"AspectRatioChoice:=", <RadioOption>,
"AspectRatio:=", <double>)

<RadioOption>
Type: <int>
0: Ignore
1: Use defaults

Mesh Operations Module Script Commands 15-28


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

2: Specify the value

Return Value None.

Python Syntax AssignTrueSurfOp(<TrueSurfOpParams>)


oModule.AssignTrueSurfOp
([
"NAME:TrueSurf1",
"Faces:=", [9],
"SurfDevChoice:=", 2,
Python Example
"SurfDev:=", "0.04123105626mm",
"NormalDevChoice:=", 2,
"NormalDev:=", "15deg",
"AspectRatioChoice:=", 1
])

VB Syntax AssignTrueSurfOp <TrueSurfOpParams>


oModule.AssignTrueSurfOp Array("NAME:TrueSurf1",
"Faces:=", Array(9), _
VB Example
"SurfDevChoice:=", 2, _
"SurfDev:=", "0.04123105626mm", _

Mesh Operations Module Script Commands 15-29


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NormalDevChoice:=", 2, _
"NormalDev:=", "15deg", _
"AspectRatioChoice:=", 1)

EditApplyCurvilinearElementsOp
Edits a curvilinear elements mesh operation to the selection.

UI Access Double-click on the mesh operation to edit its settings.

Name Type Description


<OpName> String Name of the operation to be edited.
<CurvilinearElementsOpParams> Array Structured array.
Parameters
Array("NAME:<OpName>",
"Apply:=", <bool>)

Return Value None.

Python Syntax EditApplyCurvilinarElementsOp(<OpName>, <CurvilinearElementsOpParams>)


oModule.EditApplyCurvlinearElementsOp
(
Python Example "ApplyCurvilinear1",
[
"NAME:ApplyCurvilinear2",

Mesh Operations Module Script Commands 15-30


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Apply:=", False
]
)

VB Syntax EditApplyCurvilinarElementsOp <OpName>, <CurvilinearElementsOpParams>


oModule.EditApplyCurvlinearElementsOp _
"ApplyCurvilinear1", _
VB Example
Array("NAME:ApplyCurvilinear2", _
"Apply:=", false)

EditCloneOp
Modifies an existing clone mesh operation.

UI Access Double-click on a clone mesh operation in the project tree.

Name Type Description


<CloneOpName> String Name of the operation to be edited.
<CloneOpParams> Array Structured array.
Array("NAME:<CloneOpName>",
Parameters "Enabled:=", <boolean>,
"InnerRadius:=", "<value><unit>",
"OuterRadius:=", "<value><unit>",
"StartAngle:=", "<value (default = 0)><unit>",

Mesh Operations Module Script Commands 15-31


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"EndAngle:=", "<value><unit>",
"GapAngle:=", "<value angular spacing between
clones><unit>",
"NumberofClones:=", "<integer number of periodic
regions (including the parent)>",
"ParentRegionSymmetry:=", <boolean>)

Return Value None.

Python Syntax EditCloneOp (<CloneOpName>, <CloneOpParams>)


oModule.EditCloneOp("Clone1",
[
"NAME:Clone2",
"Enabled:=", True,
"InnerRadius:=", "45mm",
Python Example "OuterRadius:=", "175mm",
"StartAngle:=", "0deg",
"EndAngle:=", "15deg",
"GapAngle:=", "0deg",
"NumberofClones:=", "5",
"ParentRegionSymmetry:=", True

Mesh Operations Module Script Commands 15-32


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

])

VB Syntax EditCloneOp <CloneOpName>, <CloneOpParams>


oModule.EditCloneOp "Clone1", _
Array("NAME:Clone2", _
"Enabled:=", true, _
"InnerRadius:=", "45mm", _
"OuterRadius:=", "175mm", _
VB Example
"StartAngle:=", "0deg", _
"EndAngle:=", "15deg", _
"GapAngle:=", "0deg", _
"NumberofClones:=", "5", _
"ParentRegionSymmetry:=", true)

EditCurvatureExtractionOp (Beta)
Edits a curvature extraction operation.

UI Access Double-click on the operation to edit its settings.

Name Type Description


<OpName> String Name of the operation to be edited.
Parameters <CurvilinearnElementsOpParams> Array Structured array.
Array("NAME:<OpName>",

Mesh Operations Module Script Commands 15-33


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"DisableForFacetedSurfaces:=", <bool>)

Return Value None.

Python Syntax EditCurvatureExtractionOp(<OpName>, <CurvilinearnElementsOpParams>)


oModule.EditCurvatureExtractionOp("SBRCurvExtr1",
[
Python Example "NAME:SBRCurvExtr1",
"DisableForFacetedSurfaces:=", True
])

VB Syntax EditCurvatureExtractionOp <OpName>, <CurvilinearnElementsOpParams>


oModule.EditCurvatureExtractionOp "SBRCurvExtr1", _
VB Example Array("NAME:SBRCurvExtr1", _
"DisableForFacetedSurfaces:=", true)

EditCylindricalGapOp
Modifies an existing cylindrical gap 3D mesh operation to enable/disable use of Clone Mesh and associated Band Mapping Angle.

UI Access Double-click the operation in the project tree to modify its settings.

Mesh Operations Module Script Commands 15-34


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<OpName> String Name of the operation to be edited.
<CylindricalGapOpParams> Array Structured array.
Array("NAME:<OpName>",

Parameters "CloneMesh:=", <bool>,


"BandMappingAngle:=", <value> [use if CloneMesh is
"true"]
"MovingSideLayers:=", <integer>,
"StaticSideLayers:=", <integer>)

Return Value None

Python Syntax EditCylindricalGapOp(<OpName>, <CylindricalGapOpParams>)


oModule.EditCylindricalGapOp("CylindricalGap1",
["NAME:CylindricalGap1",
"CloneMesh:=", True,
Python Example "BandMappingAngle:=", 3deg,
"MovingSideLayers:=", 1,
"StaticSideLayers:=", 3]
)

VB Syntax EditCylindricalGapOp <OpName>, <CylindricalGapOpParams>

Mesh Operations Module Script Commands 15-35


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.EditCylindricalGapOp "CylindricalGap1", _
Array("NAME:CylindricalGap1", _
"CloneMesh:=", true, _
VB Example
"BandMappingAngle:=", 3deg, _
"MovingSideLayers:=", 1, _
"StaticSideLayers:=", 3)

EditDensityControlOp
Edits an existing density control operation. This cannot be used to modify assignments. Instead, the mesh operation should be deleted
and a new one created.

UI Access Double-click the operation in the project tree to modify its settings.

Name Type Description


<OpName> String Name of the operation to be edited.
<DensityControlParams> Array Structured array.
Array("NAME:<OpName>",
"RefineInside:=", <bool>,
Parameters "RestrictMaxElemLength:=", <bool>,
"MaxElemLength:=", <value>,
"RestrictLayersNum:=", <bool>,
"LayersNum:=", <integer>)
RefineInside

Mesh Operations Module Script Commands 15-36


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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 triangles on the
surface of the face or object.
RestrictMaxElemLength
If true, MaxElemLength should be specified.
RestrictLayersNum
If true, LayersNum should be specified.

Return Value None.

Python Syntax EditDensityControlOp(<OpName>, <DensityControlOpParams>)


oModule.EditDensityControlOp("Clone Mesh Density1",
[
"NAME:Clone Mesh Density1",
"RefineInside:=" , True,
Python Example "RestrictMaxElemLength:=", True,
"MaxElemLength:=" , "0.02mm",
"RestrictLayersNum:=" , True,
"LayersNum:=" , "15"
])

Mesh Operations Module Script Commands 15-37


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax EditDensityControlOp <OpName>, <DensityControlOpParams>


oModule.EditDensityControlOp "Clone Mesh Density1", _
Array("NAME:Clone Mesh Density1", _
"RefineInside:=", true, _
VB Example "RestrictMaxElemLength:=", true, _
"MaxElemLength:=", "0.015mm", _
"RestrictLayersNum:=", true, _
"LayersNum:=", "15")

EditEdgeCutLayerOp
Edits an existing edge cut operation. This cannot be used to modify assignments. Instead, the mesh operation should be deleted and
a new one created.

UI Access Double-click the operation in the project tree to modify its settings.

Name Type Description


<OpName> String Name of the operation to be edited.
<EdgeCutLayerOpParams> Array Structured array.
Parameters
Array("NAME:<OpName>",
"Layer Thickness:=", <value>)

Return Value None.

Mesh Operations Module Script Commands 15-38


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax EditEdgeCutLayerOp(<OpName>, <EdgeCutLayerOpParams>)


oModule.EditEdgeCutLayerOp("EdgeCut1",
[
Python Example "NAME:EdgeCut1",
"Layer Thickness:=" , "0.66mm"
])

VB Syntax EditEdgeCutLayerOp <OpName>, <EdgeCutLayerOpParams>


oModule.EditEdgeCutLayerOp "EdgeCut1", _
VB Example Array("NAME:EdgeCut1", _
"Layer Thickness:=", "0.66mm")

EditLengthOp
Edits an existing length-based operation. This cannot be used to modify assignments. Instead, the mesh operation should be deleted
and a new one created.

UI Access Double-click the operation in the project tree to modify its settings.

Name Type Description


<OpName> String Name of the operation to be edited.
<LengthOpParams> Array Structured array.
Parameters Array("NAME:<OpName>",
"RefineInside:=", <bool>,
"RestrictElem:=", <bool>,

Mesh Operations Module Script Commands 15-39


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NumMaxElem:=", <integer>,
"RestrictLength:=", <bool>,
"MaxLength:=", <value>)
RefineInside
If true, Objects should be specified. Implies apply restrictions to tet-
rahedra inside the object.
If false, Faces and/or Objects can be specified. Implies apply
restrictions to triangles on the surface of the face or object.
RestrictElem
If true, NumMaxElem should be specified.
RestrictLength
If true, MaxLength should be specified.

Return Value None.

Python Syntax EditLengthOp(<OpName>, <LengthOpParams>)


oModule.EditLengthOpK("Length1",
[
Python Example "NAME:Length1",
"RefineInside:=", False,
"RestrictElem:=", False,

Mesh Operations Module Script Commands 15-40


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"RestrictLength:=", True,
"MaxLength:=", "2mm"
])

VB Syntax EditLengthOp <OpName>, <LengthOpParams>


oModule.EditLengthOpK "Length1", Array("NAME:Length1", _
"RefineInside:=", false, _
VB Example "RestrictElem:=", false, _
"RestrictLength:=", true, _
"MaxLength:=", "2mm")

EditMeshRegion
Modifies an existing mesh region settings.

UI Access Right-click on a mesh region in the project tree, then select Properties...

Name Type Description


<MeshRegionName> String Name of specified mesh region.
<MeshRegionParams> Array Structured array.
Parameters
Array("NAME:<MeshRegionName>",
"Enabled:=", <boolean>)

Return Value None.

Mesh Operations Module Script Commands 15-41


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax EditMeshRegion (<MeshRegionName>, <MeshRegionParams>)


oModule.EditMeshRegion("MeshRegion1",
[
Python Example "NAME:MeshRegion2",
"Enabled:=", True
])

VB Syntax EditMeshRegion <MeshRegionName>, <MeshRegionParams>


oModule.EditMeshRegion "MeshRegion1"_
VB Example Array("NAME:MeshRegion2", _
"Enabled:=", true)

EditModelResolutionOp
Assigns a model resolution name, value and unit for mesh operations. If UseAutoLength is true, the Defeature length is not used.

UI Access Double-click the operation in the project tree to modify its settings.

Name Type Description


<OpName> String Name of the operation to be edited.
<ModelResParams> Array Structured array.
Parameters
Array("NAME:<ModelResName>",
"UseAutoLength:=", <boolean>,

Mesh Operations Module Script Commands 15-42


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"DefeatureLength:=", "<value><units>")

Return Value None.

Python Syntax EditModelResolutionOp(<OpName>, <ModelResParams>


oModule.EditModelResolutionOp("ModelResolution1",
[
"NAME:ModelResolution1",
Python Example
"UseAutoLength:=", False,
"DefeatureLength:=", "71.5891053163818mil"
])

VB Syntax EditModelResolutionOp <OpName>, <ModelResParams>


oModule.EditModelResolutionOp "ModelResolution1", _
VB Example Array("NAME:ModelResolution1", "UseAutoLength:=", false, _
"DefeatureLength:=", "71.5891053163818mil")

EditRotationalLayerOp
Modifies a existing rotational layer mesh operation.

UI Access Right-click on a rotational layer mesh in the project tree, then select Properties...

Parameters Name Type Description

Mesh Operations Module Script Commands 15-43


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<RotationalLayerName> String Name of rotational layer mesh operation to be edited.


<RotLayerOpParams> Array Structured array.
Array("NAME:<RotationalLayerName>",
"Number of Layers:=", "<integer>",
"Total Layer Thickenss:=", "<numeric value with
unit>")

Return Value None.

Python Syntax EditRotationalLayerOp(<RotationalLayerName>, <RotLayerOpParams>)


oModule.EditRotationalLayerOp("RotationalLayer1",
[
"NAME:RotationalLayer2",
Python Example
"Number of Layers:=", "4",
"Total Layer Thickenss:=", "1.8mm"
])

VB Syntax EditRotationalLayerOp <RotationalLayerName>, <RotLayerOpParams>


oModule.EditRotationalLayerOp "RotationalLayer1", _
VB Example
Array("NAME:RotationalLayer2", _

Mesh Operations Module Script Commands 15-44


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Number of Layers:=", "4", _


"Total Layer Thickenss:=", "1.8mm")

EditSBRCurvatureExtractionOp (Beta)
Edits a curvature extraction operation to the selection for an SBR+ object or face.
Command: Edit Propeties
Syntax: EditSBRCurvatureExtractionOp <CurvilinearElementsOpParams>
Return Value: None
Parameters: <CurvilinearnElementsOpParams>
Array("NAME:<OpName>",
"Faces:=", <AssignmentFaces>, | "Objects:=", Array("objectID")
"Apply:=", <bool>)
VB Example:
oModule.EditSBRApplyCurvlinearElementsOp Array("NAME:ApplyCurvilinear1", "Objects:=", Array( "Sphere1"), "Apply:=", true)

Python Syntax EditSBRCurvatureExtractionOp (<OpName>, <FaceID> | <ObjectID>, <boolean>)


oModule.EditSBRCurvatureExtractionOp("SBRCurvExtr1",
[
Python Example "NAME:SBRCurvExtr1",
"DisableForFacetedSurfaces:=", True
])

Mesh Operations Module Script Commands 15-45


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditSkinDepthOp
Modifies an existing skin-depth based mesh operation. Assignments cannot be changed using this command. To change the assign-
ment, you must delete operation and create it using a new assignment.

UI Access Double-click the operation in the project tree to modify its settings.

Name Type Description


<OpName> String Name of the operation to be edited.
<SkinDepthOpParams> Array Structured array.
Array("NAME:<OpName>",
"RestrictElem:=", <bool>,
"NumMaxElem:=", <int>,
Parameters
"SkinDepth:=", <value>,
"SurfTriMaxLength:=", <value>,
"NumLayers:=", <int>)
RestrictElem
If true, NumMaxElem should be specified.

Return Value None.

Python Syntax EditSkinDepthOp(<OpName>, <SkinDepthOpParams>)


oModule.EditSkinDepthOp("SkinDepth1",
Python Example
[

Mesh Operations Module Script Commands 15-46


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:SkinD",
"RestrictElem:=", False,
"SkinDepth:=", "2mm",
"SurfTriMaxLength:=", "1mm",
"NumLayers:=", 2
])

VB Syntax EditSkinDepthOp <OpName>, <SkinDepthOpParams>


oModule.EditSkinDepthOp "SkinDepth1",
Array("NAME:SkinD",_
"RestrictElem:=", false, _
VB Example
"SkinDepth:=", "2mm", _
"SurfTriMaxLength:=", "1mm", _
"NumLayers:=", 2)

EditSurfPriorityOp
Modifies an existing surface representation priority for TAU mesh.

UI Access Right-click on a surface priority in the project tree, then select Properties...

Name Type Description


Parameters <SurfPriorityName> String Name of the surface priority to be edited.
<SurfPriorityParams> Array Structured array.

Mesh Operations Module Script Commands 15-47


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:<SurfPriorityName>",
"SurfaceRepPriority:=", <0 - normal priority, 1 - high
priority>)

Return Value None.

Python Syntax EditSurfPriorityOp(<SurfPriorityName>, <SurfPriorityParams>)


oModule.EditSurfPriorityOp("SurfPriority1",
[
Python Example "NAME:SurfPriority1",
"SurfaceRepPriority:=", 1
])

VB Syntax EditSurfPriorityOp <SurfPriorityName>, <SurfPriorityParams>


oModule.EditSurfPriorityOp "SurfPriority1", _
VB Example Array("NAME:SurfPriority1", _
"SurfaceRepPriority:=", 1)

EditTrueSurfOp
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.

Mesh Operations Module Script Commands 15-48


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Double-click the operation in the project tree to modify its settings.

Name Type Description


<OpName> String Name of the operation to be edited.
<TrueSurfOpParams> Array Structured array.
Array("NAME:<OpName>",
"SurfDevChoice:=", <RadioOption>,
"SurfDev:=", <value>,
"NormalDevChoice:=", <RadioOption>,
"NormalDev:=", <value>,
Parameters "AspectRatioChoice:=", <RadioOption>,
"AspectRatio:=", <double>)

<RadioOption>
Type: <int>
0: Ignore
1: Use defaults
2: Specify the value

Return Value None.

Python Syntax EditTrueSurfOp(<OpName>, <TrueSurfOpParams>)


Python Example oModule.EditTrueSurfOp("TrueSurf2",

Mesh Operations Module Script Commands 15-49


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:trusurf",
"SurfDevChoice:=", 2,
"SurfDev:=","0.03mm",
"NormalDevChoice:=", 1,
"AspectRatioChoice:=", 2,
"AspectRatio:=", 10
])

VB Syntax EditTrueSurfOp <OpName>, <TrueSurfOpParams>


oModule.EditTrueSurfOp "TrueSurf2",
Array("NAME:trusurf", _
"SurfDevChoice:=", 2, _
VB Example "SurfDev:=","0.03mm", _
"NormalDevChoice:=", 1, _
"AspectRatioChoice:=", 2, _
"AspectRatio:=", 10)

InitialMeshSettings
Assigns a true surface-based mesh operation to the selection.

Mesh Operations Module Script Commands 15-50


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Mesh > Initial Mesh Settings

Name Type Description


<InitialMeshSettingsParams> Array Structured array.
Array("NAME:<MeshSettings>",
"CurvedSurfaceApproxChoice:=", <"UseSlider"
or "Manual Settings">
"SliderMeshSettings:=", <integer 1 through
9>,
Parameters "UseLegacyFaceterForTauVolumeMesh:=",
<boolean>,
"DynamicSurfaceResolution:=", <boolean>,
"UseFlexMeshingForTAUvolumeMesh:=",
<boolean>,
"UseAlternativeMeshMethodsAsFallBack:=",
<boolean>,
"AllowPhiForLayeredGeometry:=", <boolean>)

Return Value None.

Python Syntax InitialMeshSettings(<InitialMeshSettingsParams>)


oModule.InitialMeshSettings
([
Python Example
"NAME:MeshSettings",
[

Mesh Operations Module Script Commands 15-51


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:GlobalSurfApproximation",
"CurvedSurfaceApproxChoice:=", "UseSlider",
"SliderMeshSettings:=" , 5
],
[
"NAME:GlobalCurvilinear",
"Apply:=" , False
],
[
"NAME:GlobalModelRes",
"UseAutoLength:=" , True
],
"MeshMethod:=" , "Auto",
"UseLegacyFaceterForTAUVolumeMesh:=", False,
"DynamicSurfaceResolution:=", False,
"UseFlexMeshingForTAUvolumeMesh:=", False,
"UseAlternativeMeshMethodsAsFallBack:=", False,
"AllowPhiForLayeredGeometry:=", True
])

Mesh Operations Module Script Commands 15-52


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syn- InitialMeshSettings <InitialMeshSettingsParams>


tax

oModule.InitialMeshSettings Array("NAME:MeshSettings", Array("NAME:G-


lobalSurfApproximation",
"CurvedSurfaceApproxChoice:=", "UseSlider", "SliderMeshSettings:=", 5),
Array("NAME:GlobalCurvilinear", "Apply:=", false),
Array("NAME:GlobalModelRes", "UseAutoLength:=", true), "MeshMethod:=", "Auto",
"UseLegacyFaceterForTauVolumeMesh:=", false,
"DynamicSurfaceResolution:=", false,
"UseFlexMeshingForTAUvolumeMesh:=", true,
"UseAlternativeMeshMethodsAsFallBack:=", false,
"AllowPhiForLayeredGeometry:=", true)
VB
Example oModule.InitialMeshSettings Array("NAME:MeshSettings",
Array("NAME:GlobalSurfApproximation",
"CurvedSurfaceApproxChoice:=",
"ManualSettings",
"SurfDevChoice:=", 2,
"SurfDev:=", "0.01mm",
"NormalDevChoice:=", 2,
"NormalDev:=", "22.5deg",
"AspectRatioChoice:=", 2, "AspectRatio:=", "10"),
Array("NAME:GlobalCurvilinear", "Apply:=", false),

Mesh Operations Module Script Commands 15-53


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:GlobalModelRes", "UseAutoLength:=", true), "MeshMethod:=", "Auto",


"UseLegacyFaceterForTauVolumeMesh:=", false,
"DynamicSurfaceResolution:=", false,
"UseFlexMeshingForTAUvolumeMesh:=", true,
"UseAlternativeMeshMethodsAsFallBack:=", false,
"AllowPhiForLayeredGeometry:=", true)

Mesh Operations Module Script Commands 15-54


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

16 - Analysis Setup Module Script Commands


HFSS analysis setup commands should be executed by the Analysis module, referred to in HFSS scripts as the "AnalysisSetup" mod-
ule.
Set oModule = oDesign.GetModule("AnalysisSetup")
ClearLinkedData
CopySetup
DeleteDrivenSweep
DeleteSetups
EditCircuitSettings
EditFrequencySweep
EditSetup
ExportCircuit
GetSetupCount
GetSetups
GetSweepCount
GetSweeps
InsertFrequencySweep
InsertSetup
InsertSetup [Transient]
PasteSetup
PasteSweep

Analysis Setup Module Script Commands 16-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

RenameDrivenSweep
RenameSetup
RevertAllToInitial
RevertAllToInitialTemperature
RevertSetupToInitial
RevertSetupToInitialTemperature

ClearLinkedData (Module)
Clear the linked data of all the solution setups. Similar to the ClearLinkedData command for the design level.
Right-click menu of individual setups under the Analysis item.

UI Access Project Manager > Design name > Analysis > right-click Setup name > Clear Linked Data

Name Type Description


Parameters
<SetupNameArray> Array Specify the name of the setups whose linked data are to be cleaned

Return Value None

Python Syntax ClearLinkedData(<SetupNameArray>)


Python Example oModule.ClearLinkedData(["setup1"])

VB Syntax ClearLinkedData <SetupNameArray>

Analysis Setup Module Script Commands 16-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oModule.ClearLinkedData Array("setup1")

CopySetup
Copy the specified Optimetrics setup.

UI Access NA

Name Type Description


Parameters
<SetupName> String Name of the setup.

Return Value None.

Python Syntax CopySetup (<SetupName>)


Python Example oModule.CopySetup ("OptimizationSetup1")

VB Syntax CopySetup <SetupName>


VB Example oModule.CopySetup "OptimizationSetup1"

CopyDrivenSetup
Copies a driven setup.

UI Access N/A

Name Type Description


Parameters
<SetupName> String Name of the setup.

Analysis Setup Module Script Commands 16-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax CopyDrivenSetup(<SetupName>)


Python Example oModule.CopyDrivenSetup("Setup1")

VB Syntax CopyDrivenSetup <SetupName>


VB Example oModule.CopyDrivenSetup "Setup1"

CopyEigenSetup
Copies an eigen-analysis setup.

UI Access N/A

Name Type Description


Parameters
<SetupName> String Name of the setup.

Return Value None.

Python Syntax CopyEigenSetup(<SetupName>)


Python Example oModule.CopyEigenSetup("Setup1")

Analysis Setup Module Script Commands 16-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax CopyEigenSetup <SetupName>


VB Example oModule.CopyEigenSetup "Setup1"

CopySweep
Copies a frequency sweep from an analysis setup.

UI Access Right-click on a sweep, select Copy

Name Type Description


Parameters <SetupName> String Name of the setup to which the sweep belongs.
<SweepName> String Name of the sweep.

Return Value None.

Python Syntax CopySweep (<SetupName>, <SweepName>)


Python Example oModule.CopySweep("Setup1", "Sweep2")

VB Syntax CopySweep <SetupName>, <SweepName>


VB Example oModule.CopySweep "Setup1", "Sweep2"

DeleteDrivenSweep
Deletes a driven frequency sweep.

UI Access N/A

Analysis Setup Module Script Commands 16-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


Parameters <SetupName> String Name of the setup to which the sweep belongs.
<SweepName> String Name of the sweep.

Return Value None.

Python Syntax DeleteDrivenSweep (<SetupName>, <SweepName>)


Python Example oModule.DeleteDrivenSweep("Setup1", "Sweep2")

VB Syntax DeleteDrivenSweep <SetupName>, <SweepName>


VB Example oModule.DeleteDrivenSweep "Setup1", "Sweep2"

DeleteSetups
Deletes one or more solution setups, which are specified by an array of solution setup names.

Right-click a solution setup in the project tree and then click Delete on the shortcut menu, or delete selected solu-
UI Access
tion setups in the List dialog box.

Name Type Description


Parameters
<SetupArray> Array Array of solution setup names.

Return Value None.

Analysis Setup Module Script Commands 16-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax DeleteSetups (<SetupArray>)


Python Example oModule.DeleteSetups(["Setup1", "Setup2"])

VB Syntax DeleteSetups <SetupArray>


VB Example oModule.DeleteSetups Array("Setup1", "Setup2")

DoesSweepSetupExists
Determines whether a specified sweep exists.

UI Access N/A

Name Type Description


Parameters <SetupName> String Name of the setup to which the sweep belongs.
<SweepName> String Name of the sweep.

Integer:

Return Value l 1 - sweep exists.

l 0 - sweep does not exist.

Python Syntax DoesSweepSetupExists (<SetupName>, <SweepName>)


Python Example oModule.DoesSweepSetupExists("Setup1", "Sweep2")

Analysis Setup Module Script Commands 16-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax DoesSweepSetupExists <SetupName>, <SweepName>


VB Example oModule.DoesSweepSetupExists "Setup1", "Sweep2"

EditCircuitSettings
Use: Exports equivalent circuit data.
Command: Right-click the Analysis folder, and then choose Edit Circuit Settings.
Syntax: EditCircuitSettings <ExportSettings>
Return Value: None
Parameters: <ExportSettings>
See ExportCircuit for details.
VB Example: oModule.EditCircuitSettings Array("NAME:CircuitData", "MatrixName:=", "Original", _
"NumberOfCells:=", "1", "UserHasChangedSettings:=", true, "IncludeCap:=", true, "IncludeCond:=",
_
true, Array("NAME:CouplingLimits", "CouplingLimitType:=", "By Fraction", "CapFraction:=", 0.01, _
"IndFraction:=", 0.01, "ResFraction:=", 0.01, "CondFraction:=", 0.01), "IncludeDCR:=", false, _
"IncudeDCL:=", false, "IncludeACR:=", false, "IncludeACL:=", false, "ADDResistance:=", true)

VB Example: oModule.EditCircuitSettings Array("NAME:CircuitData", "MatrixName:=", "Original", _


"1", "UserHasChangedSettings:=", true, "IncludeCap:=", true, "IncludeCond:=", true, Array _
("NAME:CouplingLimits", "CouplingLimitType:=", "By Fraction", "CapFraction:=",0.01, _
"IndFraction:=", 0.01, "ResFraction:=", 0.01, "CondFraction:=", 0.01), "IncludeR:=", false, _
"IncludeL:=", false, "ExportDistributed:=", true, "LumpedLength:=", "7meter", "RiseTime:=", "1s")

Analysis Setup Module Script Commands 16-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditDrivenSweep
Modifies a driven frequency sweep.

UI Access N/A.

Name Type Description


<SetupName> String Name of the solution setup containing the sweep to be edited.
<SweepName> String Name of the sweep to be edited.
<Attributes> Array Structured array.
Array("NAME:<SweepName>",
"IsEnabled:=", <boolean>,
"SetupType:=", <SetupType>,
Parameters
<FrequencyInformation>,
"Type:=", <SweepType>,
<SaveFieldsList>
<DCExtrapInfo>
"SMatrixOnlySolveMode:=", <"Manual">|"Auto">,
"SMatrixOnlySolveAbove:=", "<real><units>")

Return Value None.

Python Syntax EditDrivenSweep (<SetupName>, <SweepName>, <Attributes>)


oModule.EditDrivenSweep("Setup1", "Sweep3",
Python Example
["NAME:Sweep3", "IsEnabled:=", True,

Analysis Setup Module Script Commands 16-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SetupType:=", "SinglePoints",
"ValueList:=", ["1GHz", "2GHz", "3GHz"],
"Type:=", "Discrete",
"SaveFieldsList:=", [False, False, False],
"ExtrapToDC:=", False])

VB Syntax EditDrivenSweep <SetupName>, <SweepName>, <Attributes>


oModule.EditDrivenSweep "Setup1", "Sweep3", _
Array("NAME:Sweep3", "IsEnabled:=", true, _
"SetupType:=", "SinglePoints", _
VB Example "ValueList:=", Array("1GHz", "2GHz", "3GHz"), _
"Type:=", "Discrete", _
"SaveFieldsList:=", Array(false, false, false), _
"ExtrapToDC:=", false)

EditFrequencySweep
Modifies an existing frequency sweep. For HFSS-IE use EditSweep [HFSS-IE]

UI Access Double-click a frequency sweep in the Project Manager to modify its settings.

Name Type Description


Parameters
<SetupName> String Name of the solution setup containing the sweep to be edited.

Analysis Setup Module Script Commands 16-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<SweepName> String Name of the sweep to be edited.


<Attributes> Array Structured array.
Array("NAME:<SweepName>",
"IsEnabled:=", <boolean>,
"SetupType:=", <SetupType>,
<FrequencyInformation>,
"Type:=", <SweepType>,
<SaveFieldsList>
<DCExtrapInfo>
"SMatrixOnlySolveMode:=", <"Manual">|"Auto">,
"SMatrixOnlySolveAbove:=", "<real><units>")

Return Value None.

Python Syntax EditFrequencySweep (<SetupName>, <SweepName>, <Attributes>)


oModule.EditFrequencySweep("Setup1", "Sweep3",
["NAME:Sweep3", "IsEnabled:=", True,
"SetupType:=", "SinglePoints",
Python Example "ValueList:=", ["1GHz", "2GHz", "3GHz"],
"Type:=", "Discrete",
"SaveFieldsList:=", [False, False, False],
"ExtrapToDC:=", False])

Analysis Setup Module Script Commands 16-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax EditFrequencySweep <SetupName>, <SweepName>, <Attributes>


oModule.EditFrequencySweep "Setup1", "Sweep3", _
Array("NAME:Sweep3", "IsEnabled:=", true, _
"SetupType:=", "SinglePoints", _
VB Example "ValueList:=", Array("1GHz", "2GHz", "3GHz"), _
"Type:=", "Discrete", _
"SaveFieldsList:=", Array(false, false, false), _
"ExtrapToDC:=", false)

EditSetup
Modifies an existing solution setup.

UI Access Double-click a solution setup in the project tree to modify its settings.

Name Type Description


<SetupName> String Name of the solve setup being edited.
<Attributes> Array Structured array.
Parameters
Array("NAME:<NewSetupName>", <NamedParameters>)
See the InsertSetup command for details and examples.

Return Value None.

Analysis Setup Module Script Commands 16-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax EditSetup (<SetupName>, <Attributes>)


oModule.EditSetup("Setup1",
["NAME:NewSetup",
"AdaptiveFreq:=", "1GHz",
"EnableDistribProbTypeOption:=", false,
"SaveFields:=", "true",
"Enabled:=", true,
["NAME:Cap",
"MaxPass:=", 10,
"MinPass:=", 1,
"MinConvPass:=", 2,
Python Example
"PerError:=", 1,
"PerRefine:=", 30,
"AutoIncreaseSolutionOrder:=", false,
"SolutionOrder:=", "Normal"],
["NAME:DC",
"Residual:=", 1E-005,
"SolveResOnly:=", false,
["NAME:Cond",
"MaxPass:=", 10,
"MinPass:=", 1,

Analysis Setup Module Script Commands 16-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MinConvPass:=", 1,
"PerError:=", 1,
"PerRefine:=", 30),
["NAME:Mult",
"MaxPass:=", 1,
"MinPass:=", 1,
"MinConvPass:=", 1,
"PerError:=", 1,
"PerRefine:=", 30]],
["NAME:AC",
"MaxPass:=", 10,
"MinPass:=", 1,
"MinConvPass:=", 2,
"PerError:=", 1,
"PerRefine:=", 30]]
)
oModule.InsertSetup("HfssDrivenAuto",
["NAME:Setup1",
"IsEnabled:=", True,
"AutoSolverSetting:=", "Balanced",

Analysis Setup Module Script Commands 16-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["NAME:Sweeps",
["NAME:Sweep",
"RangeType:=", "LinearStep",
"RangeStart:=", "1GHz",
"RangeEnd:=", "10GHz",
"RangeStep:=", "1GHz"
]
],
"SaveRadFieldsOnly:=", False,
"SaveAnyFields:=", True,
"Type:=", "Discrete"
])

oModule.InsertSetup("HfssDrivenAuto",
[
"NAME:Setup2",
"SolveType:=" , "Auto",
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False

Analysis Setup Module Script Commands 16-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

],
"AutoSolverSetting:=" , "Balanced",
[
"NAME:Sweeps",
[
"NAME:Sweep",
"RangeType:=" , "LinearCount",
"RangeStart:=" , "0GHz",
"RangeEnd:=" , "10GHz",
"RangeCount:=" , 501
]
],
"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,
"InfiniteSphereSetup:=" , "Infinite Sphere1",
"ListsForFields:=" , ["Objectlist2"],
"Type:=" , "Interpolating"
])

oModule.InsertSetup("HfssDriven",

Analysis Setup Module Script Commands 16-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["NAME:Setup3",
"AdaptMultipleFreqs:=", False,
"Frequency:=", "5GHz",
"MaxDeltaS:=", 0.02,
"PortsOnly:=", False,
"UseMatrixConv:=", False,
"MaximumPasses:=", 6,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"IsEnabled:=", True,
"BasisOrder:=", 1,
"DoLambdaRefine:=", True,
"DoMaterialLambda:=", True,
"SetLambdaTarget:=", False,
"Target:=", 0.3333,
"UseMaxTetIncrease:=", False,
"PortAccuracy:=", 2,
"UseABCOnPort:=", False,
"SetPortMinMaxTri:=", False,
"UseDomains:=", True,

Analysis Setup Module Script Commands 16-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseIterativeSolver:=", False,
"IterativeResidual:=", 1E-06,
"DDMSolverResidual:=", 0.0001,
"EnhancedLowFreqAccuracy:=", True,
"SaveRadFieldsOnly:=", False,
"SaveAnyFields:=", True,
"IESolverType:=", "Auto",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True,
"SkipIERegionSolveDuringAdaptivePasses:=", True
"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"InfiniteSphereSetup:=" , "Infinite Sphere1",
"SkipSBRSolveDuringAdaptivePasses:=", True,
"PTDUTDSimulationSettings:=", "PTD Correction + UTD Rays",
"PTDEdgeDensity:=" , 20
])
### Edit an SBR+ Setup with Fast Frequency Looping
oModule.EditSetup("HfssDriven",
[

Analysis Setup Module Script Commands 16-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:Setup1",
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],
"IsSbrRangeDoppler:=" , False,
"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"IsMonostaticRCS:=" , True,
"EnableCWRays:=" , False,
"RadiationSetup:=" , "",
"PTDUTDSimulationSettings:=", "None",
"FastFrequencyLooping:=", True,
[
"NAME:Sweeps",
[
"NAME:Sweep",
"RangeType:=" , "LinearStep",
"RangeStart:=" , "1GHz",
"RangeEnd:=" , "10GHz",

Analysis Setup Module Script Commands 16-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"RangeStep:=" , "1GHz"
]
],
"ComputeFarFields:=" , True
"UseSBREnhancedRadiatedPowerCalculation:=", True,
"IsGOBlockageEnabled:=" , False,
"GOBlockageSurfaceSelfBlock:=", False
])
#### Edit and RF Discharge Setup for HFSS
import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oProject = oDesktop.SetActiveProject("coaxbend_discharge_r212")
oDesign = oProject.SetActiveDesign("HFSSDesign60degBendTeflon")
oModule = oDesign.GetModule("AnalysisSetup")
oModule.EditSetup("RFDischarge1",
[
"NAME:RFDischarge1",
"Enabled:=" , True,
[

Analysis Setup Module Script Commands 16-20


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:MeshLink",
"ImportMesh:=" , True,
"Project:=" , "This Project*",
"Product:=" , "HFSS",
"Design:=" , "This Design*",
"Soln:=" , "Setup1 : Sweep",
[
"NAME:Params",
"bend_angle:=" , "bend_angle"
],
"ForceSourceToSolve:=" , True,
"PreservePartnerSoln:=" , False,
"PathRelativeTo:=" , "SourceProduct",
"ApplyMeshOp:=" , True
],
[
"NAME:Excitations",
[
"NAME:1:1",
"Magnitude:=" , "1",
"Phase:=" , "0deg"

Analysis Setup Module Script Commands 16-21


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

],
[
"NAME:2:1",
"Magnitude:=" , "0",
"Phase:=" , "0deg"
]
],
[
"NAME:Frequencies",
"10GHz"
],
"Minimum Power:=" , "0.01",
"Maximum Power:=" , "1000000",
"Minimum Pressure:=" , "100pascal",
"Maximum Pressure:=" , "101325pascal",
"Postproc Sampling:=" , 500,
"Temperature:=" , "0cel",
"BuiltInGas:=" , "Helium"
])

Analysis Setup Module Script Commands 16-22


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax EditSetup <SetupName>, <Attributes>


oModule.EditSetup "Setup1",
Array("NAME:NewSetup",
"AdaptiveFreq:=", "1GHz",
"EnableDistribProbTypeOption:=", false,
"SaveFields:=", "true",
"Enabled:=", true,
Array("NAME:Cap",
"MaxPass:=", 10,
"MinPass:=", 1,
"MinConvPass:=", 2,
VB Example
"PerError:=", 1,
"PerRefine:=", 30,
"AutoIncreaseSolutionOrder:=", false,
"SolutionOrder:=", "Normal"),
Array("NAME:DC",
"Residual:=", 1E-005,
"SolveResOnly:=", false,
Array("NAME:Cond",
"MaxPass:=", 10,
"MinPass:=", 1,

Analysis Setup Module Script Commands 16-23


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MinConvPass:=", 1,
"PerError:=", 1,
"PerRefine:=", 30),
Array("NAME:Mult",
"MaxPass:=", 1,
"MinPass:=", 1,
"MinConvPass:=", 1,
"PerError:=", 1,
"PerRefine:=", 30)),
Array("NAME:AC",
"MaxPass:=", 10,
"MinPass:=", 1,
"MinConvPass:=", 2,
"PerError:=", 1,
"PerRefine:=", 30))

ExportCircuit
Use:Export equivalent circuit data.
Command:Right-click a setup in the project tree or the Analysis folder and choose Export Circuit.
Syntax:ExportCircuit <Solution>, <Variation>, <FileName>, <ExportSettings>, <ModelName>, <Freq>
Return Value: none

Analysis Setup Module Script Commands 16-24


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters: <Solution>
<SetupName>:<SolutionName>
<SetupName>
Type: <string>
Name of the setup where circuit is being exported
<SolutionName>
Type: <String>
Name of the solution.
<Variation>
Type: <string>
The variation where circuit is being exported
<FileName>
Type: <string>
The name of the file where circuit is being exported
<ModelName>
Type: <String>
Model name or name of the sub circuit (Optional). If not specified then <FileName> is con-
sidered as model name.
<Freq>
Type: <double>
Sweep frequecny in hz.
<ExportSettings>

Analysis Setup Module Script Commands 16-25


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:CircuitData", "MatrixName:=", _
<ReduceMatrix>, "NumberOfCells:=", <NumCell>, "UserHasChangedSettings:=", <User-
ChangedSettings>, "IncludeCap:=", <IncludeCap>, "IncludeCond:=", <IncludeCond>, Array
("NAME:CouplingLimits", <CouplingLimitsArray>, "IncludeDCR:=", <IncludeDCR>, "IncludeDCL:=",
<IncludeDCL>, "IncludeACR:=", <IncludeACR>, "IncludeACL:=", <IncludeACL>, "ADDResistance:=",
<AddResistance>)
Parameters:
<ReduceMatrix>
Type: <string>
One of the reduced matrix setup or "Original"
<NumCell>
Type: <string>
Number of cells in export. Can be a variable.
<UserChangedSettings>
Type: <bool>
Whether user changed settings or use default settings.
<IncludeCap>
Type: <bool>
Flag indicates whether to export Capacitance matrix.
<IncludeCond>
Type: <bool>
Flag indicates whether to export Conductance matrix.

Analysis Setup Module Script Commands 16-26


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<IncludeDCR>
Type: <bool>
Flag indicates whether to export DC resistance matrix.
<IncludeDCL>
Type: <bool>
Flag indicates whether to export DC Inductance matrix.
<IncludeACR>
Type: <bool>
Flag indicates whether to export AC resistance matrix.
<IncludeACL>
Type: <bool>
Flag indicates whether to export AC inductance matrix.
<AddResistance>
Type: <bool>
Adds the DC and AC resistance.

Note:

You cannot export both AC and DC matrices unless AddResistance is selected.

<CouplingLimitsArray>
Array("NAME:CouplingLimits", "CouplingLimitType:=", <CouplingLimitType>, _
<CouplingLimitsParameters>, 0.01, "CondFraction:=", 0.01)

Analysis Setup Module Script Commands 16-27


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<CouplingLimitType> = "None"
Argument not needed
<CouplingLimitType> = "ByFraction"
<CouplingLimitsParameters>
"CapFraction:=", <Fraction>, "IndFraction:=", <Fraction>,
"ResFraction:=", <Fraction>,"CondFraction:=",<Fraction>,
Parameters:
<Fraction>
Type: <double>
Fraction of the self term
<CouplingLimitType> = "ByValue"
<CouplingLimitsParameters>
"CapLimit:=", <Limit>, "IndLimit:=", <Limit>, "ResLimit:=", <Limit>,
"CondLimit:=", <Limit>,
Parameters:
<Limit>
Type: <string>
Value of the limit.

Analysis Setup Module Script Commands 16-28


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example:
oModule.ExportCircuit
"Setup1 : LastAdaptive", "", "C:/Project/Q3D/FourNets.cir", Array("NAME:CircuitData", _
"MatrixName:=", "Original", "NumberOfCells:=", "1", "UserHasChangedSettings:=", true, _
"IncludeCap:=", true, "IncludeCond:=", true, Array("NAME:CouplingLimits", "CouplingLimitType:=",
_
"By Fraction", "CapFraction:=", 0.01, "IndFraction:=", 0.01, "ResFraction:=", 0.01, _
"CondFraction:=", 0.01), "IncludeDCR:=", false, IncudeDCL:=", false, "IncludeACR:=", false, _
"IncludeACL:=", false, "ADDResistance:=", true), "", 2000000000000

GetSetupCount
Gets the number of analysis setups in a design.

UI Access N/A
Parameters None.
Return Value Integer containing number of setups.

Python Syntax GetSetupCount ()


Python Example oModule.GetSetupCount()

VB Syntax GetSetupCount
VB Example oModule.GetSetupCount

GetSetups
Gets the names of analysis setups in a design.

Analysis Setup Module Script Commands 16-29


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A
Parameters None.
Return Value Array of analysis setup names

Python Syntax GetSetups ()


Python Example oModule.GetSetups()

VB Syntax GetSetups
VB Example oModule.GetSetups

GetSetups [HFSS 3D Layout]


Get setups.
Command: None
Syntax: GetSetups <setups>
Return Value: String array of setup names
Parameters: <setups>
Type: string
VB Example: oSetup = oDesign.GetModule("SolveSetups")
setups = oSetup.GetSetups()

Analysis Setup Module Script Commands 16-30


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetSetupNames
Gets the names of far field and near field radiation setups in a design.

UI Access N/A

Name Type Description


Parameters
<RadiationType> String Type of radiation.

Return Value Array of strings containing setup names.

Python Syntax GetSetupNames(<RadiationType>)


Python Example oModule.GetSetupNames("Infinite Sphere")

VB Syntax GetSetupNames <RadiationType>


VB Example oModule.GetSetupNames "Infinite Sphere"

GetSweepCount
Gets the number of sweeps in a specified analysis setup.

UI Access N/A

Name Type Description


Parameters
<SetupName> String Name of specified setup.

Return Value Integer containing number of sweeps for the named setup.

Analysis Setup Module Script Commands 16-31


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetSweepCount (<SetupName>)


Python Example oModule.GetSweepCount("Setup1")

VB Syntax GetSweepCount <SetupName>


VB Example oModule.GetSweepCount "Setup1"

GetSweeps
Gets the names of all sweeps in a given analysis setup.

UI Access N/A

Name Type Description


Parameters
<SetupName> String Name of specified setup.

Return Value Array of sweep names.

Python Syntax GetSweeps (<SetupName>)


Python Example oModule.GetSweeps("Setup1")

VB Syntax GetSweeps <SetupName>

Analysis Setup Module Script Commands 16-32


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oModule.GetSweeps "Setup1"

GetSweeps [HFSS 3D Layout]


Get sweeps.
Command: None
Syntax: GetSweeps <sweep>
Return Value: String array of sweeps
Parameters: <sweep>
Type: string
VB Example: oSetup = oDesign.GetModule("SolveSetups")
setups = oSetup.GetSetups()
sweep = oSetup.GetSweeps(setups[0])

InsertDrivenSweep
Adds a frequency sweep to a Driven solution-type setup.

UI Access N/A.

Name Type Description


<SetupName> String Name of the solution setup into which the sweep will be inserted.
<Attributes> Array Structured array.

Parameters Array("NAME:<string name of sweep>",


"IsEnabled:=", <boolean>
"RangeType:=", <"LinearStep" | "LinearCount" |
"LogScale">,

Analysis Setup Module Script Commands 16-33


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<LinearStepArray>
"RangeStart:=", "<real>GHz",
"RangeEnd:=", "<real>GHz",
"RangeStep:=", "<real>GHz",
<LinearCountArray>
"RangeStart:=", "<real>GHz",
"RangeEnd:=", "<real>GHz",
"RangeCount:=", <int>,
<LogScaleArray>
RangeStart:=", "<real>GHz",
"RangeEnd:=", "<real>GHz",
"RangeCount:=", <int>,
"RangeSamples:=", <int>,
<SweepTypeArray>
"Type:=", <"Interpolating" |"Fast" | "Discrete">,
<InterpolatingParametersArray>
"SaveFields:=", <boolean>,
"SaveRadFields:=", <boolean>,
"InterpTolerance:=", <real>,
"InterpMaxSolns:=", <int>,

Analysis Setup Module Script Commands 16-34


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"InterpMinSolns:=", <int>,
"InterpMinSubranges:=", <int>,
"ExtrapToDC:=", <boolean>,
"InterpUseS:=", <boolean>,
"InterpUsePortImped:=", <boolean>,
"InterpUsePropConst:=", <boolean>,
"UseDerivativeConvergence:=", true,
"InterpDerivTolerance:=", <real>,
"UseFullBasis:=", <boolean>,
"EnforcePassivity:=", <boolean>,
"PassivityErrorTolerance:=", <real>)
"EnforceCausality:=", <boolean>,
"UseQ3DForDCSolve:=" , <boolean>,
"SMatrixOnlySolveMode:=", <"Manual">|"Auto">,
"SMatrixOnlySolveAbove:=", "<real><units>"
<FastParametersArray>
"SaveFields:=", <boolean>,
"SaveRadFields:=", <boolean>,
"GenerateFieldsForAllFreqs:=", <boolean>,
"ExtrapToDC:=", <boolean>)
<DiscreteParametersArray>

Analysis Setup Module Script Commands 16-35


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SaveFields:=", <boolean>,
SaveRadFields:=", <boolean>,
"ExtrapToDC:=", <boolean>)

Return Value None.

Python Syntax InsertDrivenSweep(<SetupName>, <Attributes>)


oModule.InsertDrivenSweep("Setup1",
[
"NAME:Sweep1",
"IsEnabled:=" , True,
"RangeType:=" , "LinearCount",
"RangeStart:=" , "2.5GHz",
Python Example "RangeEnd:=" , "7.5GHz",
"RangeCount:=" , 401,
"Type:=" , "Interpolating",
"SaveFields:=" , False,
"SaveRadFields:=" , False,
"InterpTolerance:=" , 0.5,
"InterpMaxSolns:=" , 250,

Analysis Setup Module Script Commands 16-36


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"InterpMinSolns:=" , 0,
"InterpMinSubranges:=" , 1,
"InterpUseS:=" , True,
"InterpUsePortImped:=" , False,
"InterpUsePropConst:=" , True,
"UseDerivativeConvergence:=", False,
"InterpDerivTolerance:=", 0.2,
"UseFullBasis:=" , True,
"EnforcePassivity:=" , True,
"PassivityErrorTolerance:=", 0.0001,
"SMatrixOnlySolveMode:=", "Manual",
"SMatrixOnlySolveAbove:=", "1MHz"
])

VB Syntax InsertDrivenSweep <SetupName>, <Attributes>


Discrete Sweep:
oModule.InsertDrivenSweep "Setup1", Array("NAME:Sweep",
"IsEnabled:=", true,
VB Example "RangeType:=", "LinearStep",
"RangeStart:=", "1GHz",
"RangeEnd:=", "10GHz",
"RangeStep:=", "0.1GHz",
"Type:=", "Discrete",

Analysis Setup Module Script Commands 16-37


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SaveFields:=", false,
"SaveRadFields:=", false,
"ExtrapToDC:=", false)
Fast Sweep:
oModule.InsertDrivenSweep "Setup1",
Array("NAME:Sweep2", "IsEnabled:=", false,
"RangeType:=", "LinearStep",
"RangeStart:=", "1GHz",
"RangeEnd:=", "10GHz",
"RangeStep:=", "0.1GHz",
"Type:=", "Fast",
"SaveFields:=", true,
"SaveRadFields:=", false,
"GenerateFieldsForAllFreqs:=", false,
"ExtrapToDC:=", false)
Interpolating Sweep with additional setups:
oModule.InsertDrivenSweep "Setup1", Array("NAME:Sweep3", _
"IsEnabled:=", true, "SetupType:=", _
"LinearStep", "StartValue:=", "0GHz", _
"StopValue:=", "2.5GHz", "StepSize:=", "0.005GHz", _
"Type:=", "Interpolating", _
"SaveFields:=", false, _
"InterpTolerance:=", 0.5, _
"InterpMaxSolns:=", 50, "InterpMinSolns:=", 0, _
"InterpMinSubranges:=", 1, _

Analysis Setup Module Script Commands 16-38


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ExtrapToDC:=", true, "MinSolvedFreq:=", "0.005GHz", _


"InterpUseS:=", true, _
"InterpUseT:=", false, "InterpUsePortImped:=", false, _
"InterpUsePropConst:=", true, "UseFullBasis:=", true) _
Array( "SetupType:=", "LogScale", "StartValue:=", "11GHz", "StopValue:=", _
"12GHz", "Count:=", 91, _
"SetupType:=", "LinearCount", "StartValue:=", "13GHz", _
"StopValue:=", "100GHz", "Count:=", 91)
Discrete sweeps with linear step and log scale:
oModule.InsertDrivenSweep "Setup1", Array("NAME:Sweep2", _
"IsEnabled:=", true, "SetupType:=", "LinearStep", _
"StartValue:=", "0.005GHz", >"StopValue:=", "2.5GHz", _
"StepSize:=", "0.005GHz", "Type:=", "Discrete", _
"SaveFields:=", false, "ExtrapToDC:=", false)

oModule.InsertDrivenSweep "Setup1", Array("NAME:Sweep3", _


"IsEnabled:=", true, "SetupType:=", "LogScale", _
"StartValue:=", "1GHz", "StopValue:=", "10GHz", _
"SamplesPerDecade:=", 4, "Type:=", "Discrete", _
"SaveFields:=", false, "ExtrapToDC:=", false)
A Fast sweep, specified using the starting and stopping frequencies and the step
count:

Analysis Setup Module Script Commands 16-39


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.InsertDrivenSweep "Setup1", Array("NAME:Sweep4", _


"IsEnabled:=", true, "SetupType:=", "LinearCount", _
"StartValue:=", "1GHz", "StopValue:=", "10GHz", _
"Count:=", 3, "Type:=", "Fast", _
"SaveFields:=", true, "ExtrapToDC:=", false)

InsertFrequencySweep
Adds a frequency sweep to a Driven solution-type setup.

UI Access Right-click an analysis setup, then select Add Frequency Sweep....

Name Type Description


<SetupName> String Name of the solution setup into which the sweep will be inserted.
<Attributes> Array Structured array.
Array("NAME:<string name of sweep>",
"IsEnabled:=", <boolean>
"RangeType:=", <"LinearStep" | "LinearCount" |
Parameters "LogScale">,
<LinearStepArray>
"RangeStart:=", "<real>GHz",
"RangeEnd:=", "<real>GHz",
"RangeStep:=", "<real>GHz",
<LinearCountArray>

Analysis Setup Module Script Commands 16-40


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"RangeStart:=", "<real>GHz",
"RangeEnd:=", "<real>GHz",
"RangeCount:=", <int>,
<LogScaleArray>
RangeStart:=", "<real>GHz",
"RangeEnd:=", "<real>GHz",
"RangeCount:=", <int>,
"RangeSamples:=", <int>,
<SweepTypeArray>
"Type:=", <"Interpolating" |"Fast" | "Discrete">,
<InterpolatingParametersArray>
"SaveFields:=", <boolean>,
"SaveRadFields:=", <boolean>,
"InterpTolerance:=", <real>,
"InterpMaxSolns:=", <int>,
"InterpMinSolns:=", <int>,
"InterpMinSubranges:=", <int>,
"ExtrapToDC:=", <boolean>,
"InterpUseS:=", <boolean>,
"InterpUsePortImped:=", <boolean>,
"InterpUsePropConst:=", <boolean>,

Analysis Setup Module Script Commands 16-41


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseDerivativeConvergence:=", true,
"InterpDerivTolerance:=", <real>,
"UseFullBasis:=", <boolean>,
"EnforcePassivity:=", <boolean>,
"PassivityErrorTolerance:=", <real>)
"EnforceCausality:=", <boolean>,
"UseQ3DForDCSolve:=" , <boolean>,
"SMatrixOnlySolveMode:=", <"Manual">|"Auto">,
"SMatrixOnlySolveAbove:=", "<real><units>"
<FastParametersArray>
"SaveFields:=", <boolean>,
"SaveRadFields:=", <boolean>,
"GenerateFieldsForAllFreqs:=", <boolean>,
"ExtrapToDC:=", <boolean>)
<DiscreteParametersArray>
"SaveFields:=", <boolean>,
SaveRadFields:=", <boolean>,
"ExtrapToDC:=", <boolean>)

Return Value None.

Analysis Setup Module Script Commands 16-42


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax InsertFrequencySweep(<SetupName>, <Attributes>)


oModule.InsertFrequencySweep("Setup1",
[
"NAME:Sweep1",
"IsEnabled:=" , True,
"RangeType:=" , "LinearCount",
"RangeStart:=" , "2.5GHz",
"RangeEnd:=" , "7.5GHz",
"RangeCount:=" , 401,
"Type:=" , "Interpolating",
"SaveFields:=" , False,
Python Example
"SaveRadFields:=" , False,
"InterpTolerance:=" , 0.5,
"InterpMaxSolns:=" , 250,
"InterpMinSolns:=" , 0,
"InterpMinSubranges:=" , 1,
"InterpUseS:=" , True,
"InterpUsePortImped:=" , False,
"InterpUsePropConst:=" , True,
"UseDerivativeConvergence:=", False,
"InterpDerivTolerance:=", 0.2,

Analysis Setup Module Script Commands 16-43


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseFullBasis:=" , True,
"EnforcePassivity:=" , True,
"PassivityErrorTolerance:=", 0.0001,
"SMatrixOnlySolveMode:=", "Manual",
"SMatrixOnlySolveAbove:=", "1MHz"
])

VB Syntax InsertFrequencySweep <SetupName>, <Attributes>


Discrete Sweep:
oModule.InsertFrequencySweep "Setup1", Array("NAME:Sweep",
"IsEnabled:=", true,
"RangeType:=", "LinearStep",
"RangeStart:=", "1GHz",
"RangeEnd:=", "10GHz",
"RangeStep:=", "0.1GHz",
"Type:=", "Discrete",
VB Example "SaveFields:=", false,
"SaveRadFields:=", false,
"ExtrapToDC:=", false)
Fast Sweep:
oModule.InsertFrequencySweep "Setup1",
Array("NAME:Sweep2", "IsEnabled:=", false,
"RangeType:=", "LinearStep",
"RangeStart:=", "1GHz",

Analysis Setup Module Script Commands 16-44


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"RangeEnd:=", "10GHz",
"RangeStep:=", "0.1GHz",
"Type:=", "Fast",
"SaveFields:=", true,
"SaveRadFields:=", false,
"GenerateFieldsForAllFreqs:=", false,
"ExtrapToDC:=", false)
Interpolating Sweep with additional setups:
oModule.InsertFrequencySweep "Setup1", Array("NAME:Sweep3", _
"IsEnabled:=", true, "SetupType:=", _
"LinearStep", "StartValue:=", "0GHz", _
"StopValue:=", "2.5GHz", "StepSize:=", "0.005GHz", _
"Type:=", "Interpolating", _
"SaveFields:=", false, _
"InterpTolerance:=", 0.5, _
"InterpMaxSolns:=", 50, "InterpMinSolns:=", 0, _
"InterpMinSubranges:=", 1, _
"ExtrapToDC:=", true, "MinSolvedFreq:=", "0.005GHz", _
"InterpUseS:=", true, _
"InterpUseT:=", false, "InterpUsePortImped:=", false, _
"InterpUsePropConst:=", true, "UseFullBasis:=", true) _
Array( "SetupType:=", "LogScale", "StartValue:=", "11GHz", "StopValue:=", _
"12GHz", "Count:=", 91, _
"SetupType:=", "LinearCount", "StartValue:=", "13GHz", _

Analysis Setup Module Script Commands 16-45


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"StopValue:=", "100GHz", "Count:=", 91)


Discrete sweeps with linear step and log scale:
oModule.InsertFrequencySweep "Setup1", Array("NAME:Sweep2", _
"IsEnabled:=", true, "SetupType:=", "LinearStep", _
"StartValue:=", "0.005GHz", >"StopValue:=", "2.5GHz", _
"StepSize:=", "0.005GHz", "Type:=", "Discrete", _
"SaveFields:=", false, "ExtrapToDC:=", false)

oModule.InsertFrequencySweep "Setup1", Array("NAME:Sweep3", _


"IsEnabled:=", true, "SetupType:=", "LogScale", _
"StartValue:=", "1GHz", "StopValue:=", "10GHz", _
"SamplesPerDecade:=", 4, "Type:=", "Discrete", _
"SaveFields:=", false, "ExtrapToDC:=", false)
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)

Analysis Setup Module Script Commands 16-46


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

InsertSetup
Adds a new solution setup.

UI Access [product ] > Analysis Setup > Add Solution Setup.

Name Type Description


<SetupType> String Type of setup to be inserted.
<Attributes> Array Structured array.
Array("NAME:<SetupName>", <NamedParameters>)
<Named Parameters>
"AdaptMultipleFreqs:=", <boolean>,
"Frequency:=", <string>,
"MaxDeltaS:=", <float>,
"PortsOnly:=", <boolean>,
"UseMatrixConv:=", <boolean>,
### If UseMatrixCov is True, ###
[
Parameters
"NAME:Matrix Convergence",
<Convergence Array>
],
MaximumPasses:=", <integer>,
"MinimumPasses:=", <integer>,
"MinimumConvergedPasses:=", <integer>,
"PercentRefinement:=", <integer>,
"IsEnabled:=", <boolean>,
"BasisOrder:=", <integer>,
"DoLambdaRefine:=", <boolean>,
"DoMaterialLambda:=", <boolean>,
"SetLambdaTarget:=", <boolean>,
"Target:=", <float>,

Analysis Setup Module Script Commands 16-47


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PortAccuracy:=", <integer>,
SaveRadFieldsOnly:=", <boolean>,
"SaveAnyFields:=", <boolean>,
"ListsForFields:=", <array of string>,
"IESolverType:=", <string>,
"LambdaTargetForIESolver:=", <float>,
"UseDefaultLambdaTgtForIESolver:=", <boolean>

Return Value None.

Python InsertSetup(<SetupType>, <Attributes>)


Syntax

oModule.InsertSetup("HfssDrivenAuto",
["NAME:Setup1",
"IsEnabled:=", True,
"AutoSolverSetting:=", "Balanced",
["NAME:Sweeps",
Python
["NAME:Sweep",
Example
"RangeType:=", "LinearStep",
"RangeStart:=", "1GHz",
"RangeEnd:=", "10GHz",
"RangeStep:=", "1GHz"
]

Analysis Setup Module Script Commands 16-48


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

],
"SaveRadFieldsOnly:=", False,
"SaveAnyFields:=", True,
"Type:=", "Discrete"
])

oModule.InsertSetup("HfssDrivenAuto",
[
"NAME:Setup2",
"SolveType:=" , "Auto",
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],
"AutoSolverSetting:=" , "Balanced",
[
"NAME:Sweeps",
[
"NAME:Sweep",
"RangeType:=" , "LinearCount",

Analysis Setup Module Script Commands 16-49


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"RangeStart:=" , "0GHz",
"RangeEnd:=" , "10GHz",
"RangeCount:=" , 501
]
],
"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,
"InfiniteSphereSetup:=" , "Infinite Sphere1",
"ListsForFields:=" , ["Objectlist2"],
"Type:=" , "Interpolating"
])

oModule.InsertSetup("HfssDriven",
["NAME:Setup3",
"AdaptMultipleFreqs:=", False,
"Frequency:=", "5GHz",
"MaxDeltaS:=", 0.02,
"PortsOnly:=", False,
"UseMatrixConv:=", False,
"MaximumPasses:=", 6,

Analysis Setup Module Script Commands 16-50


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"IsEnabled:=", True,
"BasisOrder:=", 1,
"DoLambdaRefine:=", True,
"DoMaterialLambda:=", True,
"SetLambdaTarget:=", False,
"Target:=", 0.3333,
"UseMaxTetIncrease:=", False,
"PortAccuracy:=", 2,
"UseABCOnPort:=", False,
"SetPortMinMaxTri:=", False,
"UseDomains:=", True,
"UseIterativeSolver:=", False,
"IterativeResidual:=", 1E-06,
"DDMSolverResidual:=", 0.0001,
"EnhancedLowFreqAccuracy:=", True,
"SaveRadFieldsOnly:=", False,
"SaveAnyFields:=", True,
"IESolverType:=", "Auto",

Analysis Setup Module Script Commands 16-51


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True,
"SkipIERegionSolveDuringAdaptivePasses:=", True
"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"InfiniteSphereSetup:=" , "Infinite Sphere1",
"SkipSBRSolveDuringAdaptivePasses:=", True,
"PTDUTDSimulationSettings:=", "PTD Correction + UTD Rays",
"PTDEdgeDensity:=" , 20
])

### An HFSS with Hybrid and Arrays setup


import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oProject = oDesktop.SetActiveProject("Project1")
oDesign = oProject.SetActiveDesign("HFSSDesign1")
oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup("HfssDriven",
[

Analysis Setup Module Script Commands 16-52


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:Setup1",
"SolveType:=" , "Single",
"Frequency:=" , "5GHz",
"MaxDeltaE:=" , 0.1,
"MaximumPasses:=" , 6,
"MinimumPasses:=" , 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=" , 30,
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],
"BasisOrder:=" , 1,
"DoLambdaRefine:=" , True,
"DoMaterialLambda:=" , True,
"SetLambdaTarget:=" , False,
"Target:=" , 0.3333,
"UseMaxTetIncrease:=" , False,
"DrivenSolverType:=" , "Direct Solver",
"EnhancedLowFreqAccuracy:=", False,

Analysis Setup Module Script Commands 16-53


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,
"IESolverType:=" , "Auto",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True,
"IE Solver Accuracy:=" , "Balanced",
"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"RadiationSetup:=" , "Infinite Sphere1",
"PTDUTDSimulationSettings:=", "None",
"EnableSBRSelfCoupling:=", False,
"UseSBRAdvOptionsGOBlockage:=", False,
"UseSBRAdvOptionsWedges:=", False,
"SkipSBRSolveDuringAdaptivePasses:=", False,
"UseSBREnhancedRadiatedPowerCalculation:=", True
])

### An SBR+ Setup with Fast Frequency Looping


oModule.InsertSetup("HfssDriven",
[

Analysis Setup Module Script Commands 16-54


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:Setup1",
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],
"IsSbrRangeDoppler:=" , False,
"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"IsMonostaticRCS:=" , True,
"EnableCWRays:=" , False,
"RadiationSetup:=" , "",
"PTDUTDSimulationSettings:=", "None",
"FastFrequencyLooping:=", True,
[
"NAME:Sweeps",
[
"NAME:Sweep",
"RangeType:=" , "LinearStep",
"RangeStart:=" , "1GHz",
"RangeEnd:=" , "10GHz",

Analysis Setup Module Script Commands 16-55


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"RangeStep:=" , "1GHz"
]
],
"ComputeFarFields:=" , True
])

### SBR+ Setup with Enhanced Radiated Power Calculation


oModule.InsertSetup("HfssDriven",
[
"NAME:Setup2",
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],
"IsSbrRangeDoppler:=" , False,
"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"EnableCWRays:=" , False,
"RadiationSetup:=" , "Infinite Sphere1",

Analysis Setup Module Script Commands 16-56


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PTDUTDSimulationSettings:=", "None",
"FastFrequencyLooping:=", False,
"UseSBRAdvOptionsGOBlockage:=", False,
"UseSBRAdvOptionsWedges:=", False,
[
"NAME:Sweeps",
[
"NAME:Sweep",
"RangeType:=" , "LinearStep",
"RangeStart:=" , "1GHz",
"RangeEnd:=" , "10GHz",
"RangeStep:=" , "1GHz"
]
],
"ComputeFarFields:=" , True,
"UseSBREnhancedRadiatedPowerCalculation:=", True,
"IsGOBlockageEnabled:=" , False,
"GOBlockageSurfaceSelfBlock:=", False
])

### Insert RF Discharge Setup for HFSS

Analysis Setup Module Script Commands 16-57


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oProject = oDesktop.SetActiveProject("coaxbend_discharge_r212")
oDesign = oProject.SetActiveDesign("HFSSDesign60degBendTeflon")
oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup("HfssRFDischarge",
[
"NAME:RFDischarge1",
"Enabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , True,
"Project:=" , "This Project*",
"Product:=" , "HFSS",
"Design:=" , "This Design*",
"Soln:=" , "Setup1 : Sweep",
[
"NAME:Params",
"bend_angle:=" , "bend_angle"

Analysis Setup Module Script Commands 16-58


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

],
"ForceSourceToSolve:=" , False,
"PreservePartnerSoln:=" , False,
"PathRelativeTo:=" , "SourceProduct",
"ApplyMeshOp:=" , True
],
[
"NAME:Excitations",
[
"NAME:1:1",
"Magnitude:=" , "1",
"Phase:=" , "0deg"
],
[
"NAME:2:1",
"Magnitude:=" , "0",
"Phase:=" , "0deg"
]
],
[
"NAME:Frequencies",

Analysis Setup Module Script Commands 16-59


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"10GHz"
],
"Minimum Power:=" , "0.01",
"Maximum Power:=" , "1000000",
"Minimum Pressure:=" , "100pascal",
"Maximum Pressure:=" , "101325pascal",
"Postproc Sampling:=" , 500,
"Temperature:=" , "0cel",
"BuiltInGas:=" , "Argon"
])
#### Setup with UseMatrixConv is True and Matrix Convergence Entry Specified as All
###
oModule.InsertSetup("Setup1",
[
"NAME:Setup1",
"SolveType:=" , "Single",
"Frequency:=" , "10GHz",
"MaxDeltaS:=" , 0.02,
"UseMatrixConv:=" , True,
[

Analysis Setup Module Script Commands 16-60


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:Matrix Convergence",
"AllEntries:=" , True,
"MagLimit:=" , "0.01",
"PhaseLimit:=" , "2deg",
"MagMinThreshold:=" , 0.01
],
"MaximumPasses:=" , 12,
"MinimumPasses:=" , 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=" , 30,
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],
"BasisOrder:=" , 1,
"DoLambdaRefine:=" , True,
"DoMaterialLambda:=" , True,
"SetLambdaTarget:=" , False,
"Target:=" , 0.3333,
"UseMaxTetIncrease:=" , False,

Analysis Setup Module Script Commands 16-61


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PortAccuracy:=" , 2,
"UseABCOnPort:=" , False,
"SetPortMinMaxTri:=" , False,
"DrivenSolverType:=" , "Direct Solver",
"EnhancedLowFreqAccuracy:=", False,
"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,
"IESolverType:=" , "ACA",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True,
"IE Solver Accuracy:=" , "Balanced",
"InfiniteSphereSetup:=" , ""
])
### Setup with UseMatrixConv as Entries and MeshLink
oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup("Setup1",
[
"NAME:Setup1",
"SolveType:=" , "Single",
"Frequency:=" , "10GHz",

Analysis Setup Module Script Commands 16-62


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MaxDeltaS:=" , 0.02,
"UseMatrixConv:=" , True,
[
"NAME:Matrix Convergence",
[
"NAME:Entries",
[
"NAME:Entry",
"Port1:=" , "A[1,1]P1",
"Port2:=" , "A[1,1]P1",
"MagLimit:=" , "0.011",
"PhaseLimit:=" , "5deg"
],
[
"NAME:Entry",
"Port1:=" , "A[4,4]P2",
"Port2:=" , "A[1,1]P2",
"MagLimit:=" , "0.041",
"PhaseLimit:=" , "5deg"
]
]

Analysis Setup Module Script Commands 16-63


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

],
"MaximumPasses:=" , 1,
"MinimumPasses:=" , 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=" , 30,
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , True,
"Project:=" , "This Project*",
"Product:=" , "",
"Design:=" , "unit",
"Soln:=" , "Setup1 : LastAdaptive",
[
"NAME:Params",
"Airbox_dist:=" , "9.9931mm",
"Scan_Theta:=" , "0deg",
"Scan_phi:=" , "0deg",
"VirtualObject_dist:=" , "2.9979mm",
"coax_inner_rad:=" , "0.125mm",

Analysis Setup Module Script Commands 16-64


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"coax_outer_rad:=" , "0.425mm",
"cut_off:=" , "1.7mm",
"feedX:=" , "-0.4mm",
"feedY:=" , "2mm",
"feed_length:=" , "1mm",
"patchX:=" , "9.65mm",
"rot:=" , "45deg",
"subH:=" , "0.8mm",
"subX:=" , "15mm",
"subY:=" , "15mm"
],
"ForceSourceToSolve:=" , False,
"PreservePartnerSoln:=" , False,
"PathRelativeTo:=" , "TargetProject",
"ApplyMeshOp:=" , True,
"AdaptPort:=" , False
],
"BasisOrder:=" , 1,
"DoLambdaRefine:=" , False,
"DoMaterialLambda:=" , True,
"SetLambdaTarget:=" , False,

Analysis Setup Module Script Commands 16-65


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Target:=" , 0.3333,
"UseMaxTetIncrease:=" , False,
"PortAccuracy:=" , 2,
"UseABCOnPort:=" , False,
"SetPortMinMaxTri:=" , False,
"DrivenSolverType:=" , "Domain Decomposition",
"IterativeResidual:=" , 0.0001,
"DDMSolverResidual:=" , 0.0001,
"EnhancedLowFreqAccuracy:=", False,
"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,
"IESolverType:=" , "Auto",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True,
"IE Solver Accuracy:=" , "Balanced",
"InfiniteSphereSetup:=" , ""
])
### Example from design with UseMatrixConv True for AllDiagEntries
"UseMatrixConv:=" , True,
[

Analysis Setup Module Script Commands 16-66


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:Matrix Convergence",
"AllDiagEntries:=" , True,
"DiagonalMag:=" , "0.03",
"DiagonalPhase:=" , "4rad",
"MagMinThreshold:=" , 0.01,
"AllOffDiagEntries:=" , True,
"OffDiagonalMag:=" , "0.05",
"OffDiagonalPhase:=" , "6deg",
"MagMinThreshold:=" , 0.01
],
### Example from Modal design with UseMatrixConv True for Entries
"UseMatrixConv:=" , True,
[
"NAME:Matrix Convergence",
[
"NAME:Entries",
[
"NAME:Entry",
"Port1:=" , "Port1",
"Port2:=" , "Port1",
"MagLimit:=" , "0.02",

Analysis Setup Module Script Commands 16-67


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PhaseLimit:=" , "5deg"
],
[
"NAME:Entry",
"Port1:=" , "Port3",
"Port2:=" , "Port2",
"MagLimit:=" , "0.03",
"PhaseLimit:=" , "5deg"
]
]
],

#### Example from Design with Periodic Ports and UseMaxtrixConv is True
"UseMatrixConv:=" , True,
[
"NAME:Matrix Convergence",
[
"NAME:Entries",
[
"NAME:Entry",

Analysis Setup Module Script Commands 16-68


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Port1:=" , "Incident_Port1",
"Port2:=" , "Incident_Port1",
"MagLimit:=" , "0.11",
"PhaseLimit:=" , "5deg"
],
[
"NAME:Entry",
"Port1:=" , "Incident_Port2",
"Port2:=" , "Incident_Port2",
"MagLimit:=" , "0.22",
"PhaseLimit:=" , "5deg"
]
]
],
#### Example Terminal Design with UseMatrixConv = True and Expression Cache
oProject = oDesktop.SetActiveProject("term-2x2_1_parasolid")
oDesign = oProject.SetActiveDesign("unit")
oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup("Setup1",
[
"NAME:Setup1",

Analysis Setup Module Script Commands 16-69


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SolveType:=" , "Single",
"Frequency:=" , "10GHz",
"MaxDeltaS:=" , 0.02,
"UseMatrixConv:=" , True,
[
"NAME:Matrix Convergence",
[
"NAME:Entries",
[
"NAME:Entry",
"Port1:=" , "P2",
"Port2:=" , "P1",
"MagLimit:=" , "0.05",
"PhaseLimit:=" , "10deg"
]
]
],
"MaximumPasses:=" , 15,
"MinimumPasses:=" , 1,
"MinimumConvergedPasses:=", 1,

Analysis Setup Module Script Commands 16-70


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PercentRefinement:=" , 30,
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],
"BasisOrder:=" , 1,
"DoLambdaRefine:=" , True,
"DoMaterialLambda:=" , True,
"SetLambdaTarget:=" , False,
"Target:=" , 0.3333,
"UseMaxTetIncrease:=" , False,
"PortAccuracy:=" , 2,
"UseABCOnPort:=" , False,
"SetPortMinMaxTri:=" , False,
"DrivenSolverType:=" , "Iterative Solver",
"IterativeResidual:=" , 0.0001,
"DDMSolverResidual:=" , 0.0001,
"EnhancedLowFreqAccuracy:=", False,
"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,

Analysis Setup Module Script Commands 16-71


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:ExpressionCache",
[
"NAME:CacheItem",
"Title:=" , "dB_AxialRatioValue_1",
"Expression:=" , "dB(AxialRatioValue)",
"Intrinsics:=" , "Phi=\'0deg\' Theta=\'0deg\'",
"ReportType:=" , "Far Fields",
[
"NAME:ExpressionContext",
"Context:=" , "Infinite Sphere1"
]
],
[
"NAME:CacheItem",
"Title:=" , "dB_St_Diff1_Diff1__1",
"Expression:=" , "dB(St(Diff1,Diff1))",
"Intrinsics:=" , "",
"ReportType:=" , "Terminal Solution Data",
[

Analysis Setup Module Script Commands 16-72


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:ExpressionContext",
"Diff:=" , "Differential Pairs"
]
],
[
"NAME:CacheItem",
"Title:=" , "dB_St_P1_P1__1",
"Expression:=" , "dB(St(P1,P1))",
"Intrinsics:=" , "",
"ReportType:=" , "Terminal Solution Data",
[
"NAME:ExpressionContext",
"Diff:=" , "Terminals"
]
]
],
"CacheSaveKind:=" , "Delta",
"ConstantDelta:=" , "0s",
"IESolverType:=" , "Auto",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True,

Analysis Setup Module Script Commands 16-73


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"IE Solver Accuracy:=" , "Balanced",


"InfiniteSphereSetup:=" , ""
])

VB Syn- InsertSetup <SetupType>, <Attributes>


tax

An HFSS Driven project solution with Auto Solution:


oModule.InsertSetup "HfssDrivenAuto", Array("NAME:Setup1", "IsEnabled:=", true, _
"AutoSolverSetting:=", "Balanced", _
Array("NAME:Sweeps", Array("NAME:Sweep", "RangeType:=", "LinearCount", _
"RangeStart:=", "1GHz", "RangeEnd:=", "10GHz", "RangeCount:=", "451")), _
"SaveRadFieldsOnly:=", false, "SaveAnyFields:=", false, "Type:=", "Interpolating")
VB
A Driven solution type with a mesh link. References to dependent solve in old scripts
Exampl-
are converted to mesh link form.
e
oModule.InsertSetup "HfssDriven",
Array("NAME:Setup1",
"Frequency:=", "1GHz",
"MaxDeltaE:=", 0.1,
"MaximumPasses:=", 6,
"MinimumPasses:=", 1,

Analysis Setup Module Script Commands 16-74


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"IsEnabled:=", true,
Array("NAME:MeshLink",
"Project:=", "Tee.aedt",
"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,
"Target:=", 0.3333,
"UseMaxTetIncrease:=", false,
"MaxTetIncrease:=", 1000000,
"EnableSolverDomains:=", false,

Analysis Setup Module Script Commands 16-75


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ThermalFeedback:=", false,
"UsingConstantDelta:=", 0,
"ConstantDelta:=", "0s",
"NumberSolveSteps:=", 1)
A Driven solution type with ports:
oModule.InsertSetup "HfssDriven",
Array("NAME:Setup2",
"Frequency:=", "1GHz",
"PortsOnly:=", false,
"MaxDeltaS:=", 0.02,
"UseMatrixConv:=", false,
"MaximumPasses:=", 6,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"IsEnabled:=", true,
"BasisOrder:=", 1,
"UseIterativeSolver:=", true,
"IterativeResidual:=", 0.0001,
"DoLambdaRefine:=", true,

Analysis Setup Module Script Commands 16-76


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"DoMaterialLambda:=", false,
"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)
An Eigenmode solution type:
oModule.InsertSetup "HfssEigen",
Array("NAME:Setup2",
"MinimumFrequency:=", "1.77347GHz",
"NumModes:=", 1,
"MaxDeltaFreq:=", 10,
"ConvergeOnRealFreq:=", true,
"MaximumPasses:=", 3,

Analysis Setup Module Script Commands 16-77


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"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)
A Driven solution type with ports and matrix convergence:
oModule.InsertSetup "HfssDriven",
Array("NAME:Setup2",
"Frequency:=", "1GHz",
"PortsOnly:=", false,

Analysis Setup Module Script Commands 16-78


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"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,

Analysis Setup Module Script Commands 16-79


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SetPortMinMaxTri:=", false,
"EnableSolverDomains:=", false,
"ThermalFeedback:=", false,
"UsingConstantDelta:=", 0,
"ConstantDelta:=", "0s",
"NumberSolveSteps:=", 1)
A Driven solution type with Multi-Frequencies specified:
oModule.InsertSetup "HfssDriven", Array("NAME:Setup2", "AdaptMultipleFreqs:=", true, _
Array("NAME:MultipleAdaptiveFreqsSetup", "1.1GHz:=", Array( _
0.02), "10GHz:=", Array(0.02), "11GHz:=", Array(0.02), "12.5GHz:=", Array(0.02),
"15GHz:=", Array( _
0.02), "20GHz:=", Array(0.02)), "MaximumPasses:=", 6, "MinimumPasses:=", 1, "Min-
imumConvergedPasses:=", _
1, "PercentRefinement:=", 30, "IsEnabled:=", true, "BasisOrder:=", 1,
"DoLambdaRefine:=", _
true, "DoMaterialLambda:=", true, "SetLambdaTarget:=", false, "Target:=", _
0.3333, "UseMaxTetIncrease:=", false, "PortAccuracy:=", 2, "UseABCOnPort:=", _
false, "SetPortMinMaxTri:=", false, "UseDomains:=", false, "UseIterativeSolver:=", _
false, "SaveRadFieldsOnly:=", false, "SaveAnyFields:=", true, "IESolverType:=", _
"Auto", "LambdaTargetForIESolver:=", 0.15, "UseDefaultLambdaTgtForIESolver:=", _
true, "RayDensityPerWavelength:=", 4, "MaxNumberOfBounces:=", 5)

Analysis Setup Module Script Commands 16-80


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

An Driven Solution type with Broadband specified:


oModule.InsertSetup "HfssDriven", Array("NAME:Setup1", "AdaptMultipleFreqs:=", true, _
Array("NAME:MultipleAdaptiveFreqsSetup", Array("NAME:Broadband", "Low:=", _
"2GHz", "High:=", "20GHz")), "MaximumPasses:=", 6, "MinimumPasses:=", 1, "Min-
imumConvergedPasses:=", _
1, "PercentRefinement:=", 30, "IsEnabled:=", true, "BasisOrder:=", 1,
"DoLambdaRefine:=", _
true, "DoMaterialLambda:=", true, "SetLambdaTarget:=", false, "Target:=", _
0.3333, "UseMaxTetIncrease:=", false, "PortAccuracy:=", 2, "UseABCOnPort:=", _
false, "SetPortMinMaxTri:=", false, "UseDomains:=", false, "UseIterativeSolver:=", _
false, "SaveRadFieldsOnly:=", false, "SaveAnyFields:=", true, "IESolverType:=", _
"Auto", "LambdaTargetForIESolver:=", 0.15, "UseDefaultLambdaTgtForIESolver:=", _
true, "RayDensityPerWavelength:=", 4, "MaxNumberOfBounces:=", 5)
oModule.InsertFrequencySweep "Setup1", Array("NAME:Sweep", "IsEnabled:=", true,
"RangeType:=", _
"LinearCount", "RangeStart:=", "2GHz", "RangeEnd:=", "20GHz", "RangeCount:=", _
451, "Type:=", "Interpolating", "SaveFields:=", false, "SaveRadFields:=", _
false, "InterpTolerance:=", 0.5, "InterpMaxSolns:=", 250, "InterpMinSolns:=", _
0, "InterpMinSubranges:=", 1, "ExtrapToDC:=", false, "InterpUseS:=", true, "Inter-
pUsePortImped:=", _
false, "InterpUsePropConst:=", true, "UseDerivativeConvergence:=", false, "Inter-
pDerivTolerance:=", _
0.2, "UseFullBasis:=", true, "EnforcePassivity:=", true, "PassivityErrorTolerance:=",
_

Analysis Setup Module Script Commands 16-81


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

0.0001)

InsertSetup [Transient]
Add a new solution setup to a Transient design
Command: HFSS>Analysis Setup>Add Solution Setup
Syntax: InsertSetup <SetupType>, <AttributesArray>
Return Value: None
Parameters: <SetupType>
Type: <string>
"HfssTransient". Must match the HFSS solution type.
<AttributesArray>
Array("NAME:<SetupName>", <Named Parameters>)

<Named Parameters>
The parameters correspond to fields in the Setup dialog box. For example, here is default dialog for an HFSS Transient
driven Composite Excitation setup with one excitation assigned. To see the required parameters for a specific set of para-
meters and their format, use the record script function, and view the resulting script in a text editor.

Analysis Setup Module Script Commands 16-82


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

The first part of a vbs script corresponds to the fields and selections on the General tab:
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup "HfssTransient", Array("NAME:Setup1", "Frequency:=", "5GHz", "MaxDeltaE:=",
0.1, _"MaximumPasses:=", 6, "UseImplicitSolver:=", true, "IsEnabled:=", true,
The next parameters correspond to fields and selections on the Saved Fields tab:

Analysis Setup Module Script Commands 16-83


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Transient", "ListsForFields:=", Array("integrationloops", "groundplane"), _


"UseSaveCount:=", 1, "SaveCount:=", 256, _
"UseSaveStart:=", 1, "SaveStart:=", "0s", _
"UseSaveDelta:=", 1, "SaveDelta:=", "10ps", _
"SaveRadFields:=", 0, "SaveFDRadFields:=", 0, _

Analysis Setup Module Script Commands 16-84


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

You must create one or more face lists and select them to enable the ability to Save fields at specified intervals.
The next part corresponds to fields on the Duration tab.

"UseAutoTermination:=", 1, "SteadyStateCriteria:=", 0.01, _


"UseMinimumDuration:=", 0, "TerminateOnMaximum:=", 0))
The choices made for solver, Transient solution type as Network Analysis or Composite Excitation, Mesh Linking, and
whether you use Expression Cash, Derivatives, and HPC will all affect the parameters array for a particular setup. The Net-
work Analysis solution type includes the Input Signal tab.

Analysis Setup Module Script Commands 16-85


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

The vbs script for this setup includes parameters for this information.
Array("NAME:Transient", "TimeProfile:=", "Broadband Pulse", "HfssFrequency:=", "5GHz", _
"MinFreq:=", "100MHz", "MaxFreq:=", "1GHz", _

Analysis Setup Module Script Commands 16-86


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NumFreqsExtracted:=", 401, _
"SweepMinFreq:=", "100MHz", "SweepMaxFreq:=", "1GHz",
To see the parameters for a specific Setup and their format, use the record script function, and view the resulting script in a
text editor. For descriptions of the parameters, see the Online help for the setup. See the examples below.
VB 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"))

Analysis Setup Module Script Commands 16-87


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example:Transient Network Solution Type


Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("transient")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup "HfssTransient", Array("NAME:Setup1", "Frequency:=", "5GHz", "MaxDeltaS:=", _
0.02, "MaximumPasses:=", 20, "UseImplicitSolver:=", true, "IsEnabled:=", true, "BasisOrder:=", _
-1, Array("NAME:Transient", "TimeProfile:=", "Broadband Pulse", "HfssFrequency:=", _
"5GHz", "MinFreq:=", "100MHz", "MaxFreq:=", "1GHz", "NumFreqsExtracted:=", 401, "SweepMinFreq:=",
_
"100MHz", "SweepMaxFreq:=", "1GHz", "ListsForFields:=", Array("Facelist1"), "UseSaveCount:=", _
1, "SaveCount:=", 256, "UseSaveStart:=", 1, "SaveStart:=", "0s", "UseSaveDelta:=", _
1, "SaveDelta:=", "10ps", "SaveRadFields:=", 0, "SaveFDRadFields:=", 0, "UseAutoTermination:=", _

Analysis Setup Module Script Commands 16-88


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

1, "SteadyStateCriteria:=", 0.01, "UseMinimumDuration:=", 0, "TerminateOnMaximum:=", _


1, "UseMaxTime:=", 1, "MaxTime:=", "20ns"))

Python Syntax InsertSetup("HfssTransient", [<parameters>])


oModule.InsertSetup("HfssTransient",
[
"NAME:Setup2",
"Frequency:=" , "5GHz",
"MaxDeltaS:=" , 0.02,
"MaximumPasses:=" , 20,
"UseImplicitSolver:=" , True,
"IsEnabled:=" , True,
"BasisOrder:=" , -1,
[
"NAME:Transient",
"TimeProfile:=" , "Broadband Pulse",
"HfssFrequency:=" , "5GHz",
"MinFreq:=" , "100MHz",
Python Example "MaxFreq:=" , "1GHz",
"NumFreqsExtracted:=" , 401,
"SweepMinFreq:=" , "100MHz",
"SweepMaxFreq:=" , "1GHz",
"ListsForFields:=" , ["Facelist1"],
"UseSaveCount:=" , 1,
"SaveCount:=" , 256,
"UseSaveStart:=" , 1,
"SaveStart:=" , "0s",
"UseSaveDelta:=" , 1,
"SaveDelta:=" , "10ps",
"SaveRadFields:=" , 0,
"SaveFDRadFields:=" , 0,
"UseAutoTermination:=" , 1,
"SteadyStateCriteria:=" , 0.01,

Analysis Setup Module Script Commands 16-89


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseMinimumDuration:=" , 0,
"TerminateOnMaximum:=" , 0
]
])

PasteDrivenSetup
Pastes a driven setup.

UI Access N/A
Parameters None.
Return Value None.

Python Syntax PasteDrivenSetup()


Python Example oModule.PasteDrivenSetup()

VB Syntax PasteDrivenSetup
VB Example oModule.PasteDrivenSetup

PasteEigenSetup
Pastes an eigen-analysis setup.

UI Access N/A

Analysis Setup Module Script Commands 16-90


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters None.
Return Value None.

Python Syntax PasteEigenSetup ()


Python Example oModule.PasteEigenSetup()

VB Syntax PasteEigenSetup
VB Example oModule.PasteEigenSetup

PasteSetup
Use: Paste a solve setup.
Syntax: PasteSetup
Return Value: None
VB Example: oModule.PasteSetup

PasteSweep
Pastes a copied sweep.

UI Access Right-click on a setup, select Paste

Name Type Description


Parameters
<SetupName> String Name of setup where the copied sweep is pasted to.

Analysis Setup Module Script Commands 16-91


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax PasteSweep (<SetupName>)


Python Example oModule.PasteSweep("Setup1")

VB Syntax PasteSweep <SetupName>


VB Example oModule.PasteSweep "Setup1"

RenameDrivenSweep
Renames an existing frequency sweep in HFSS. For HFSS-IE use RenameSweep.

UI Access Right-click a frequency sweep in the Project Manager and then click Rename on the shortcut menu.

Name Type Description


<SetupName> String Name of setup to which the sweep belongs.
Parameters
<OldSweepName> String Name of the sweep to be renamed.
<NewSweepName> String New name for the sweep.

Return Value None.

Python Syntax RenameDrivenSweep (<SetupName>, <OldSweepName>, <NewSweepName>)


Python Example oModule.RenameDrivenSweep("Setup1", "Sweep1", "MySweep")

Analysis Setup Module Script Commands 16-92


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax RenameDrivenSweep <SetupName>, <OldSweepName>, <NewSweepName>


VB Example oModule.RenameDrivenSweep "Setup1", "Sweep1", "MySweep"

RenameSetup
Renames an existing solution setup.

UI Access Right-click a solution setup in the Project Manager and then click Rename on the shortcut menu.

Name Type Description


Parameters <OldSetupName> String Name of the solution setup being renamed.
<NewSetupName> String New name for the solution setup.

Return Value None.

Python Syntax RenameSetup (<OldSetupName>, <NewSetupName>)


Python Example oModule.RenameSetup("Setup1", "MySetup")

VB Syntax RenameSetup <OldSetupName>, <NewSetupName>


VB Example oModule.RenameSetup "Setup1", "MySetup"

ResetToTimeZero
Resets a simulation to time zero.

Analysis Setup Module Script Commands 16-93


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access CleanStop when running Electronics Desktop in Batchmode.

Name Type Description


Parameters
<setupName> String Name of the simulation setup to be reset.

Return Value None.

Python Syntax ResetToTimeZero(<setupName>)


Python Example oModule.ResetToTimeZero("Setup1")

VB Syntax ResetToTimeZero <setupName>


VB Example oModule.ResetToTimeZero "Setup1"

RevertAllToInitial
Marks the current mesh for all solution setups as invalid. This will force the next simulation to begin with the initial mesh.

UI Access HFSS > Analysis Setup > Revert to Initial Mesh.


Parameters None.
Return Value None.

Python Syntax RevertAllToInitial ()


Python Example oModule.RevertAllToInitial()

Analysis Setup Module Script Commands 16-94


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax RevertAllToInitial
VB Example oModule.RevertAllToInitial

RevertAllToInitialTemperature
Reverts all setups to their initial temperature. Used when coupling with thermal designs.

HFSS > Set Object Temperature > Enable Feedback. Then in the Project Manager, right-click Analysis
UI Access
> Revert to Initial Temperature. Repeat for all setups.
Parameters None.
Return Value None.

Python Syntax RevertAllToInitialTemperature()


Python Example oModule.RevertAllToInitialTemperature()

VB Syntax RevertAllToInitialTemperature
VB Example oModule.RevertAllToInitialTemperature

RevertAllToZeroDisplacement
Reverts the displacement values of all objects to zero.

UI Access N/A

Analysis Setup Module Script Commands 16-95


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters None.
Return Value None.

Python Syntax RevertAllToZeroDisplacement()


Python Example oModule.RevertAllToZeroDisplacement()

VB Syntax RevertAllToZeroDisplacement
VB Example oModule.RevertAllToZeroDisplacement

RevertSetupToInitial
Marks the current mesh for a solution setup as invalid. This will force the next simulation to begin with the initial mesh.

UI Access Right-click a solution setup in the Project Manager and then click Rename on the shortcut menu.

Name Type Description


Parameters
<SetupName> String Name of specified setup.

Return Value None.

Python Syntax RevertSetupToInitial (<SetupName>)


Python Example oModule.RevertSetupToInitial("Setup1")

Analysis Setup Module Script Commands 16-96


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax RevertSetupToInitial <SetupName>


VB Example oModule.RevertSetupToInitial "Setup1"

RevertSetupToInitialTemperature
Reverts a specified setup to its initial temperature. Used when coupling with thermal designs.

HFSS > Set Object Temperature > Enable Feedback. Then in the Project Manager, right-click Analysis
UI Access
> Revert to Initial Temperature.

Name Type Description


Parameters
<setupName> String Name of solution setup.

Return Value None

Python Syntax RevertSetupToInitialTemperature(<setupName>)


Python Example oModule.RevertSetupToInitialTemperature('Setup1')

VB Syntax RevertSetupToInitialTemperature <setupName>


VB Example oModule.RevertSetupToInitialTemperature "Setup1"

RevertSetupToZeroDisplacement
Reverts the displacement values of objects for a specified setup to zero.

Analysis Setup Module Script Commands 16-97


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A

Name Type Description


Parameters
<SetupName> String Name of specified setup.

Return Value None.

Python Syntax RevertSetupToZeroDisplacement (<SetupName>)


Python Example oModule.RevertSetupToZeroDisplacement("Setup1")

VB Syntax RevertSetupToZeroDisplacement <SetupName>


VB Example oModule.RevertSetupToZeroDisplacement "Setup1"

SetMPIVendor
The documented command is applicable for Q3D Extractor.
Use: Specify vendor name.
Syntax: SetMPIVendor <vendorname>, <product name>
Return Value: None
Parameters: <vendorname>
Type: <String>
Name of MPI vendor. Possible values are "Intel", "PlatformComputing"

Analysis Setup Module Script Commands 16-98


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<product name>
Type: <String>
Valid value is "Q3D Extractor". It is optional input, if not specified the default value is
"Q3D Extractor"
oAnsoftApp.SetMPIVendor "Intel", "Q3D Extractor"

SolveSetup
Solves the specified setup.

UI Access Right-click the setup in the project tree, and then click Analyze on the shortcut menu.

Name Type Description


Parameters
<SetupName> String Name of the setup to be solved

Return Value None

Python Syntax SolveSetup (<SetupName>)


oModule.SolveSetup ("Setup1")
Python Example

VB Syntax SolveSetup <SetupName>


VB Example oModule.SolveSetup "Setup1"

Analysis Setup Module Script Commands 16-99


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

16-100
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

17 - Optimetrics Module Script Commands


Optimetrics script commands should be executed by the "Optimetrics" module.
Set oModule = oDesign.GetModule("Optimetrics")
oModule.CommandName <args>

Conventions Used in this Chapter


<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.
<StopV>
Type: <VarValue>
The stopping value of a variable.
<MinV>
Type: <VarValue>

Optimetrics Module Script Commands 17-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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>

Optimetrics Module Script Commands 17-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Type: <bool>
If true, the embedded parametric setup will be solved before the
analysis begins.
If false, the embedded parametric setup will be solved during each
iteration of the analysis.
<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.

Optimetrics Module Script Commands 17-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<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:=",
<StopV>))
<Soln>
Type: <string>
Name of the solution.
<Calc>
Type: <string>
An expression that is composed of a basic solution quantity and an
output variable.
<ContextName>
Type: <string>
Name of context needed in the evaluation of <Calc>.

Optimetrics Module Script Commands 17-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<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.
if "s", start values specify the single value for the variable.
EditSetup
EditSetup [Optimization]
EditSetup [Sensitivity]
EditSetup [Statistical]
GetPropNames [Optimetrics]
GetPropValue [Optimetrics]
GetSetupNames [Optimetrics]
GetSetupNamesByType [Optimetrics]
InsertSetup [Parametric]
InsertSetup [Optimization]
InsertSetup [Sensitivity]
InsertSetup [Statistical]
PasteSetup [Optimetrics]
RenameSetup [Optimetrics]

Optimetrics Module Script Commands 17-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetPropValue [Optimetrics]
SolveSetup [Optimetrics]
The topics for this section include:
General Commands Recognized by the Optimetrics Module
Parametric Script Commands
Optimization Script Commands
Sensitivity Script Commands
Statistical Script Commands

CopySetup
Copy the specified Optimetrics setup.

UI Access NA

Name Type Description


Parameters
<SetupName> String Name of the setup.

Return Value None.

Python Syntax CopySetup (<SetupName>)


Python Example oModule.CopySetup ("OptimizationSetup1")

Optimetrics Module Script Commands 17-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax CopySetup <SetupName>


VB Example oModule.CopySetup "OptimizationSetup1"

DeleteSetups [Optimetrics]
Deletes the specified Optimetrics setups.

UI Access Right-click the setup in the project tree, and then click Delete on the shortcut menu

Name Type Description


Parameters
<NameArray> Array of Strings An Array of Setup Names

Return Value None

Python Syntax DeleteSetups (<NameArray>)


oModule.DeleteSetups (["OptimizationSetup1"])
Python Example

VB Syntax DeleteSetups <NameArray>


VB Example oModule.DeleteSetups Array("OptimizationSetup1")

DistributedAnalyzeSetup
Distributes all variable value instances within a parametric sweep to different machines already specified from within the user inter-
face

UI Access Right-click the parametric setup name in the project tree and select Distribute Analysis.

Optimetrics Module Script Commands 17-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


Parameters
<ParametricSetupName> String Name of the Setup

Return Value None

Python Syntax DistributedAnalyzeSetup (<ParametricSetupName>)


oModule.DistributedAnalyzeSetup("ParametricSetup1")
Python Example

VB Syntax DistributedAnalyzeSetup <ParametricSetupName>


VB Example oModule.DistributedAnalyzeSetup "ParametricSetup1"

EditSetup
Modifies an existing solution setup.

UI Access Double-click a solution setup in the project tree to modify its settings.

Name Type Description


<SetupName> String Name of the solve setup being edited.
<Attributes> Array Structured array.
Parameters
Array("NAME:<NewSetupName>", <NamedParameters>)
See the InsertSetup command for details and examples.

Return Value None.

Optimetrics Module Script Commands 17-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax EditSetup (<SetupName>, <Attributes>)


oModule.EditSetup("Setup1",
["NAME:NewSetup",
"AdaptiveFreq:=", "1GHz",
"EnableDistribProbTypeOption:=", false,
"SaveFields:=", "true",
"Enabled:=", true,
["NAME:Cap",
"MaxPass:=", 10,
"MinPass:=", 1,
Python Example "MinConvPass:=", 2,
"PerError:=", 1,
"PerRefine:=", 30,
"AutoIncreaseSolutionOrder:=", false,
"SolutionOrder:=", "Normal"],
["NAME:DC",
"Residual:=", 1E-005,
"SolveResOnly:=", false,
["NAME:Cond",
"MaxPass:=", 10,

Optimetrics Module Script Commands 17-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MinPass:=", 1,
"MinConvPass:=", 1,
"PerError:=", 1,
"PerRefine:=", 30),
["NAME:Mult",
"MaxPass:=", 1,
"MinPass:=", 1,
"MinConvPass:=", 1,
"PerError:=", 1,
"PerRefine:=", 30]],
["NAME:AC",
"MaxPass:=", 10,
"MinPass:=", 1,
"MinConvPass:=", 2,
"PerError:=", 1,
"PerRefine:=", 30]]
)
oModule.InsertSetup("HfssDrivenAuto",
["NAME:Setup1",
"IsEnabled:=", True,

Optimetrics Module Script Commands 17-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"AutoSolverSetting:=", "Balanced",
["NAME:Sweeps",
["NAME:Sweep",
"RangeType:=", "LinearStep",
"RangeStart:=", "1GHz",
"RangeEnd:=", "10GHz",
"RangeStep:=", "1GHz"
]
],
"SaveRadFieldsOnly:=", False,
"SaveAnyFields:=", True,
"Type:=", "Discrete"
])

oModule.InsertSetup("HfssDrivenAuto",
[
"NAME:Setup2",
"SolveType:=" , "Auto",
"IsEnabled:=" , True,
[
"NAME:MeshLink",

Optimetrics Module Script Commands 17-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ImportMesh:=" , False
],
"AutoSolverSetting:=" , "Balanced",
[
"NAME:Sweeps",
[
"NAME:Sweep",
"RangeType:=" , "LinearCount",
"RangeStart:=" , "0GHz",
"RangeEnd:=" , "10GHz",
"RangeCount:=" , 501
]
],
"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,
"InfiniteSphereSetup:=" , "Infinite Sphere1",
"ListsForFields:=" , ["Objectlist2"],
"Type:=" , "Interpolating"
])

Optimetrics Module Script Commands 17-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.InsertSetup("HfssDriven",
["NAME:Setup3",
"AdaptMultipleFreqs:=", False,
"Frequency:=", "5GHz",
"MaxDeltaS:=", 0.02,
"PortsOnly:=", False,
"UseMatrixConv:=", False,
"MaximumPasses:=", 6,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"IsEnabled:=", True,
"BasisOrder:=", 1,
"DoLambdaRefine:=", True,
"DoMaterialLambda:=", True,
"SetLambdaTarget:=", False,
"Target:=", 0.3333,
"UseMaxTetIncrease:=", False,
"PortAccuracy:=", 2,
"UseABCOnPort:=", False,
"SetPortMinMaxTri:=", False,

Optimetrics Module Script Commands 17-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseDomains:=", True,
"UseIterativeSolver:=", False,
"IterativeResidual:=", 1E-06,
"DDMSolverResidual:=", 0.0001,
"EnhancedLowFreqAccuracy:=", True,
"SaveRadFieldsOnly:=", False,
"SaveAnyFields:=", True,
"IESolverType:=", "Auto",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True,
"SkipIERegionSolveDuringAdaptivePasses:=", True
"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"InfiniteSphereSetup:=" , "Infinite Sphere1",
"SkipSBRSolveDuringAdaptivePasses:=", True,
"PTDUTDSimulationSettings:=", "PTD Correction + UTD Rays",
"PTDEdgeDensity:=" , 20
])
### Edit an SBR+ Setup with Fast Frequency Looping
oModule.EditSetup("HfssDriven",

Optimetrics Module Script Commands 17-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:Setup1",
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],
"IsSbrRangeDoppler:=" , False,
"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"IsMonostaticRCS:=" , True,
"EnableCWRays:=" , False,
"RadiationSetup:=" , "",
"PTDUTDSimulationSettings:=", "None",
"FastFrequencyLooping:=", True,
[
"NAME:Sweeps",
[
"NAME:Sweep",
"RangeType:=" , "LinearStep",
"RangeStart:=" , "1GHz",

Optimetrics Module Script Commands 17-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"RangeEnd:=" , "10GHz",
"RangeStep:=" , "1GHz"
]
],
"ComputeFarFields:=" , True
"UseSBREnhancedRadiatedPowerCalculation:=", True,
"IsGOBlockageEnabled:=" , False,
"GOBlockageSurfaceSelfBlock:=", False
])
#### Edit and RF Discharge Setup for HFSS
import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oProject = oDesktop.SetActiveProject("coaxbend_discharge_r212")
oDesign = oProject.SetActiveDesign("HFSSDesign60degBendTeflon")
oModule = oDesign.GetModule("AnalysisSetup")
oModule.EditSetup("RFDischarge1",
[
"NAME:RFDischarge1",
"Enabled:=" , True,

Optimetrics Module Script Commands 17-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:MeshLink",
"ImportMesh:=" , True,
"Project:=" , "This Project*",
"Product:=" , "HFSS",
"Design:=" , "This Design*",
"Soln:=" , "Setup1 : Sweep",
[
"NAME:Params",
"bend_angle:=" , "bend_angle"
],
"ForceSourceToSolve:=" , True,
"PreservePartnerSoln:=" , False,
"PathRelativeTo:=" , "SourceProduct",
"ApplyMeshOp:=" , True
],
[
"NAME:Excitations",
[
"NAME:1:1",
"Magnitude:=" , "1",

Optimetrics Module Script Commands 17-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Phase:=" , "0deg"
],
[
"NAME:2:1",
"Magnitude:=" , "0",
"Phase:=" , "0deg"
]
],
[
"NAME:Frequencies",
"10GHz"
],
"Minimum Power:=" , "0.01",
"Maximum Power:=" , "1000000",
"Minimum Pressure:=" , "100pascal",
"Maximum Pressure:=" , "101325pascal",
"Postproc Sampling:=" , 500,
"Temperature:=" , "0cel",
"BuiltInGas:=" , "Helium"
])

Optimetrics Module Script Commands 17-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax EditSetup <SetupName>, <Attributes>


oModule.EditSetup "Setup1",
Array("NAME:NewSetup",
"AdaptiveFreq:=", "1GHz",
"EnableDistribProbTypeOption:=", false,
"SaveFields:=", "true",
"Enabled:=", true,
Array("NAME:Cap",
"MaxPass:=", 10,
"MinPass:=", 1,
VB Example "MinConvPass:=", 2,
"PerError:=", 1,
"PerRefine:=", 30,
"AutoIncreaseSolutionOrder:=", false,
"SolutionOrder:=", "Normal"),
Array("NAME:DC",
"Residual:=", 1E-005,
"SolveResOnly:=", false,
Array("NAME:Cond",
"MaxPass:=", 10,

Optimetrics Module Script Commands 17-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MinPass:=", 1,
"MinConvPass:=", 1,
"PerError:=", 1,
"PerRefine:=", 30),
Array("NAME:Mult",
"MaxPass:=", 1,
"MinPass:=", 1,
"MinConvPass:=", 1,
"PerError:=", 1,
"PerRefine:=", 30)),
Array("NAME:AC",
"MaxPass:=", 10,
"MinPass:=", 1,
"MinConvPass:=", 2,
"PerError:=", 1,
"PerRefine:=", 30))

EnableSetup
Enables and disables a defined optimetrics analysis setup.

UI Access Right-click on a setup in the project tree, select Enable Setup or Disable Setup

Optimetrics Module Script Commands 17-20


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<SetupName> String Name of specified setup.
Parameters <Enable> Boolean Determines whether enable or disable a setup.
l True - enable setup.
l False - disable setup.

Return Value None.

Python Syntax EnableSetup(<SetupName>, <Enable>)


Python Example oModule.EnableSetup("OptimizationSetup1", True)

VB Syntax EnableSetup <SetupName>, <Enable>


VB Example oModule.EnableSetup "OptimizationSetup1", true

ExportDXConfigFile
Create an xml file with the setup information for Design Xplorer

Right click on the Design Xplorer setup in the project tree and choose Export External Connector Addin Con-
UI Access
figuration…

Name Type Description


Parameters <SetupName> String Must be one of existing DesignExplorer setup names
<FileName> String Must be a valid file path and name

Return Value None

Optimetrics Module Script Commands 17-21


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ExportDXConfigFile (<SetupName>, <FileName>)


oModule.ExportDXConfigFile ("DesignXplorerSetup1",
Python Example "c:/exportdir/DXSetup1.xml")

VB Syntax ExportDXConfigFile <SetupName>, <FileName>


oModule.ExportDXConfigFile ("DesignXplorerSetup1",
VB Example
"c:/exportdir/DXSetup1.xml")

ExportOptimetricsProfile
Export Optimetrics profile data

Right click on the Optimetrics setup in the project tree and choose View Analysis Result… On the Post Ana-
UI Access
lysis Display dialog box, click the Profile tab and click on the Export button.

Name Type Description


<SetupName> String Must be one of the existing Parametric, Optimization, Sensitivity, Statistical or
DesignXplorer setup names
Parameters
<FileName> String Must be a valid file path and name with extension of csv, tab, dat, or txt
[profileNum] String Must be a numeric string. Optional: defaulted to last profile number. It should
be a zero indexed profile number.

Return Value None

Optimetrics Module Script Commands 17-22


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ExportOptimetricsProfile (<SetupName>, <FileName>, [profileNum]


oModule.ExportOptimetricsProfile
Python Example ("StatisticalSetup1", "c:/exportdir/test.csv")

VB Syntax ExportOptimetricsProfile <SetupName>, <FileName>, [profileNum]


oModule.ExportOptimetricsProfile
VB Example
"StatisticalSetup1", "c:/exportdir/test.csv"

ExportOptimetricsResult
Export an existing Optimization, Sensitivity, Statistical or DesignXplorer result. (Does not export Parametric results.)

Right click on the desired Optimetrics setup in the project tree and choose View Analysis Result… On the
UI Access
Post Analysis Display dialog box, click the Result tab, then select Table view, and click on the Export button

Name Type Description


<SetupName> String Must be one of the existing Optimization, Sensitivity, Statistical, or
DesignXplorer setup names
Parameters
<FileName> String Must be a valid file path and name with extension of csv, tab, dat, or txt..
[useFullOutputName] Boolean Optional: defaulted to false. If set to true values will be printed with units.
This parameter is ignored for Optimization and Statistical results.

Return Value None

Optimetrics Module Script Commands 17-23


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ExportOptimetricsResult (<SetupName>, <FileName>, [useFullOutputName])


oModule.ExportOptimetricsResult (
Python Example
"StatisticalSetup1", "c:/exportdir/test.csv",false)

VB Syntax ExportOptimetricsResult <SetupName>, <FileName>, [useFullOutputName]


oModule.ExportOptimetricsResult "StatisticalSetup1", "c:/exportdir/test.csv",
VB Example
false

ExportParametricResults
Export existing Parametric results.

Right click on the desired Parametric setup in the project tree and choose View Analysis Result… On the Post
UI Access
Analysis Display dialog box, click the Result tab, then select Table view, and click on the Export button.

Name Type Description


<SetupName> String Must be one of the existing Parametric setup names
Parameters
<FileName> String Must be a valid file path and name with extension of csv, tab, dat or txt
<bOutputUnits> Boolean If set to true, values will be printed with units

Return Value None

Python Syntax ExportParametricResults (<SetupName>, <FileName>, <bOutputUnits>)


Python Example oModule.ExportParametricResults (

Optimetrics Module Script Commands 17-24


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ParametricSetup1", "c:/exportdir/test.csv", False)

VB Syntax ExportParametricResults <SetupName>, <FileName>, <bOutputUnits>


oModule.ExportParametricResults
VB Example
"ParametricSetup1", "c:/exportdir/test.csv",false

ExportParametricSetupTable
Exports the parametric setup table as a CSV file.

UI Access Double-click parametric setup. Select Table tab. Click Export.

Name Type Description


Parameters <SetupName> String Name of the setup.
<filePath> String Full path for file export.

Return Value None

Python ExportParametricSetupTable (<SetupName>, <filePath>)


Syntax

oModule.ExportParametricSetupTable('ParametricSetup1', 'E:/Files/ParametricSetup1_
Python
Table.csv')
Example

VB Syn- ExportParametricSetupTable <SetupName>, <filePath>


tax

Optimetrics Module Script Commands 17-25


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB obj.ExportParametricSetupTable "ParametricSetup1", "E:/Files/ParametricSetup1_


Example Table.csv"

ExportRespSurfaceMinMaxTable
Exports min-max table from a response surface to a file

Click on Export... From the Response Surface tab of the Design of Experiments Post Analysis Display dia-
UI Access
log.

Name Type Description


Parameters <DOEName> String Name of the Design of Experiments (DOE) setup.
<FileName> String Output file name with path.

Return Value None.

Python Syntax ExportRespSurfaceMinMaxTable(<DOEName>, <FileName>)


oModule.ExportRespSurfaceMinMaxTable("DesignOfExperimentsSetup1",
Python Example
"C:/temp/DesignOfExperimentsSetup1_Min-Max_Search.csv")

VB Syntax ExportRespSurfaceMinMaxTable <DOEName>, <FileName>


oModule.ExportRespSurfaceMinMaxTable _
VB Example "DesignOfExperimentsSetup1", _
"C:/temp/DesignOfExperimentsSetup1_Min-Max_Search.csv"

Optimetrics Module Script Commands 17-26


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ExportRespSurfaceRefinePoints
Exports refinement points table to a file

From the Response Surface tab of the Design of Experiments Post Analysis Display dialog box, select
UI Access
Refinement Points option under View, Click on Export....

Name Type Description


Parameters <DOEName> String Name of the Design of Experiments (DOE) setup.
<FileName> String Output file name with path.

Return Value None.

Python Syntax ExportRespSurfaceRefinePoints(<DOEName>, <FileName>)


oModule.ExportRespSurfaceRefinePoints("DesignOfExperimentsSetup1",
Python Example
"C:/temp/DesignOfExperimentsSetup1_Refine_Points.csv")

VB Syntax ExportRespSurfaceRefinePoints <DOEName>, <FileName>


oModule.ExportRespSurfaceRefinePoints_
VB Example "DesignOfExperimentsSetup1", _
"C:/temp/DesignOfExperimentsSetup1_Refine_Points.csv"

ExportRespSurfaceResponsePoints
Exports response points table to a file

Optimetrics Module Script Commands 17-27


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

From the Response Surface tab of the Design of Experiments Post Analysis Display dialog box, select
UI Access
Response Points option under View, Click on Export....

Name Type Description


Parameters <DOEName> String Name of the Design of Experiments (DOE) setup.
<FileName> String Output file name with path.

Return Value None.

Python Syntax ExportRespSurfaceResponsePoints (<DOEName>, <FileName>)


oModule.ExportRespSurfaceResponsePoints("DesignOfExperimentsSetup1",
Python Example
"C:/temp/DesignOfExperimentsSetup1_Response_Points.csv")

VB Syntax ExportRespSurfaceResponsePoints <DOEName>, <FileName>


oModule.ExportRespSurfaceResponsePoints_
VB Example "DesignOfExperimentsSetup1", _
"C:/temp/DesignOfExperimentsSetup1_Response_Points.csv"

ExportRespSurfaceVerificationPoints
Exports verification points table to a file

From the Response Surface tab of the Design of Experiments Post Analysis Display dialog box, select Veri-
UI Access
fication Points option under View, Click on Export....

Optimetrics Module Script Commands 17-28


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


Parameters <DOEName> String Name of the Design of Experiments (DOE) setup.
<FileName> String Output file name with path.

Return Value None.

Python Syntax ExportRespSurfaceVerificationPoints (<DOEName>, <FileName>)


oModule.ExportRespSurfaceVerificationPoints("DesignOfExperimentsSetup1",
Python Example
"C:/temp/DesignOfExperimentsSetup1_Veri_Points.csv")

VB Syntax ExportRespSurfaceVerificationPoints <DOEName>, <FileName>


oModule.ExportRespSurfaceVerificationPoints_
VB Example "DesignOfExperimentsSetup1", _
"C:/temp/DesignOfExperimentsSetup1_Veri_Points.csv"

GenerateVariationData [Parametric]
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 the setup.

Optimetrics Module Script Commands 17-29


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example:
oModule.GenerateVariationData "ParametricSetup1"

GetChildNames [Optimetrics]
If used without a specific optimization setup name, gets a list of all setups for all types. If a with a specific setup name, returns names
for that optimization setup.

UI Access NA

Name Type Description


Parameters typeName text string Optional, default to get all types of setup names. Or one of type name return in
GetChildTypes(). Also, the type name can be used without the prefix “Opti”.

Return Value Array of setup names.

Python Syntax GetChildNames()


oOptimModule = oDesign.GetChildObject(“Optimetrics”)
arrAllSetup = oOptimModule.GetChildNames()
Python Example
arrParmSetup = oOptimModule.GetChildNames(“'OptiParametric'”)
arrOptimizeSetup = oOptimModule.GetChildNames(“'Optimization'”)

GetChildObject [Optimetrics]
Gets a Setup Object of the Optimetrics module

Optimetrics Module Script Commands 17-30


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access NA

Name Type Description


Parameters
Setup Name text string A optimetrics setup name, names returned by the GetChildNames().

A script object for the setup See discussion of Optimetrics Setup Objects in Object Script Property Function Sum-
Return Value mary.

Python Syntax GetChildObject()


oParamSetup = oOptModule.GetChildObject('ParametricSetup1')
Python Example
oOptSetup = oOptModule.GetChildObject('OptimizationSetup1')

GetChildTypes [Optimetrics]
Use: Gets child types of queried Optimetrics module.
Syntax: GetChildTypes()
Return Value: Array of text string, it can be an empty array if there is no setup is defined. There are six types of setup, they are
['OptiParametric', 'OptiOptimization', 'OptiSensitivity', 'OptiStatistical', 'OptiDesignExplorer', 'OptiDXDOE'].

Python Syntax GetChildTypes ()


oOptimModule = oDesign.GetChildObject(“Optimetrics”)
Python Example
arrSetupTypes = oOptimModule.GetChildTypes()

Optimetrics Module Script Commands 17-31


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetName
Returns the name of the active design.

UI Access N/A
Parameters None.
Return Value String indicating the name of the active design.

Python Syntax GetName()


Python Example design_name = oDesign.GetName()

VB Syntax GetName
VB Example design_name = oDesign.GetName

GetObjPath [Design]
Obtains the path to the design.

UI Access N/A
Parameters None.
Return Value String containing the path to the design.

Optimetrics Module Script Commands 17-32


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetObjPath()


Python Example oDesign.GetObjPath()

VB Syntax GetObjPath
VB Example oDesign.GetObjPath

GetOptimetricResult
Returns an Optimetric calculation. The specific calculation is determined by the setup.

UI Access N/A

Name Type Description


<SetupName> String Optimetrics setup name.
<vars> Array Array containing string variable names.
Use the Sweep Definitions tab in the UI or the <SweepDefs> parameter in the
Parameters InsertSetup script to determine appropriate inputs.
<values> Array Optional. Array containing string values.
When multiple variables and values are provided, the order must be the same
in both the <vars> and <values> arrays. The first variable is paired with the first
value, the second variable is paired with the second value, and so on.

Return Value Calculation result. If the setup contains more than one calculation, the output will be an array of values.

Optimetrics Module Script Commands 17-33


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetOptimetricResult(<SetupName>, <vars>, <values>)


Python Example oModule.GetOptimetricResult('ParametricSetup1',['AR','Re'],['4.64','6e+04'])

VB Syntax GetOptimetricResult <SetupName>, <vars>, <values>


dim vars(1)
vars(0) = "AR"
vars(1) = "Re"
VB Example dim values(1)
values(0) = "4.64"
values(1) = "6e+04"
oModule.GetOptimetricResult "ParametricSetup1", vars, values

GetOptimetricsResult
Get an existing Optimization, Sensitivity, Statistical, Parametric or DesignXplorer result.

Right click on the desired Optimetrics setup in the project tree and choose View Analysis Result… On the Post
UI Access
Analysis Display dialog box, click the Result tab, then select Table view, and click on the Export button

Name Type Description


<SetupName> String Must be one of the existing Optimization, Sensitivity, Statistical, or
Parameters DesignXplorer setup names
<FileName> String Must be a valid file path and name with extension of csv, tab, dat, or txt..
[useFullOutputName] Boolean Optional: defaulted to false. If set to true values will be printed with units. This

Optimetrics Module Script Commands 17-34


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

parameter is ignored for Optimization and Statistical results.

Return Value None

Python Syntax GetOptimetricsResult (<SetupName>, <FileName>, [useFullOutputName])


oModule.GetOptimetricsResult (
Python Example
"StatisticalSetup1", "c:/exportdir/test.csv",false)

VB Syntax GetOptimetricsResult <SetupName>, <FileName>, [useFullOutputName]


oModule.ExportOptimetricsResult "StatisticalSetup1", "c:/exportdir/test.csv",
VB Example
false

GetPropNames [Optimetrics]
Use: Always returns the empty set for Optimetrics objects since they do not have properties.
Syntax: GetPropNames(bIncludeReadOnly)
Return Value: Returns empty set.
Parameters: bIncludeReadOnly—optional, default to True.

Python Syntax GetPropNames ()


oOptModule.GetPropNames()
Python Example oOptModule.GetPropNames(True)
oOptModule.GetPropNames(False)

Optimetrics Module Script Commands 17-35


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetPropValue [Optimetrics]
Returns the property value for a setup property.

UI Access NA

Name Type Description


Parameters
property-path a child object's property path. See property path discussion here.

Return Value Returns the value of an setup property.

Python Syntax GetPropValue(propPath)


oOptModule.GetPropValue("OptimizationSetup1\Optimizer") //get the optimizer name
for OptimizationSetup1
Python Example
oOptModule.GetPropValue("OptimizationSetup1\Optimizer\Choices") //Get the menu
property’s menu items. In this case all Optimizer names.

VB Syntax GetPropValue()
GetPropValue(“Optimetrics/OptimizationSetup1/Enabled”)
VB Example
Returns True if Enabled, or False if disabled.

GetSetupNames [Optimetrics]
Gets a list of Optimetrics setup names

Optimetrics Module Script Commands 17-36


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access NA

Name Type Description


Parameters
None

Return Value IAnsoftCollectionObj – a collection of Optimetrics setup names

Python Syntax GetSetupNames()


oModule = oDesign.GetModule("Optimetrics")
Python Example setupNames = oModule.GetSetupNames()

VB Syntax GetSetupNames()
Set oModule_opt = oDesign.GetModule("Optimetrics")
VB Example Set opt_setup_list = oModule.GetSetupNames()
numsetups = setupnames.Count

GetSetupNamesByType [Optimetrics]
Gets a list of Optimetrics setup names by type.

UI Access NA

Name Type Description


Parameters
<Optimetrics type> String Examples: parametric, optimization, statistical, sensitivity

Return Value Array of Optimetrics setup names of the given type.

Optimetrics Module Script Commands 17-37


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetSetupNamesByType (<Optimetrics type>)


for name in oModule.GetSetupNamesByType("optimization")
Python Example AddInfoMessage(str(name))

VB Syntax GetSetupNamesByType <Optimetrics type>


For each name in oModule.GetSetupNamesByType("optimization")
VB Example Msgbox name
Next

ImportSetup
Import an Optimetric setup from a file.

UI Access NA

Name Type Description


<SetupTypeName> String Must be one of "OptiParametric" , "OptiOptimization", "OptiSensitivity", "OptiS-
tatistical", or "OptiDesignExplorer".
Parameters <SetupInfo> Array Array("NAME:<SetupName>", "FilePath")
<SetupName>
Type: <string>

Optimetrics Module Script Commands 17-38


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name of the setup.


<FilePath>
Type : <string: file path>
Must be a valid file path and name.

Return Value None

Python Syntax ImportSetup (<SetupTypeName>, <SetupInfo>)


oModule.ImportSetup ("OptiStatistical",
["NAME:StatisticalSetup1",
Python Example
"c:/importdir/mySetupInfoFile"])

VB Syntax ImportSetup <SetupTypeName>, <SetupInfo>


oModule.ImportSetup "OptiStatistical",
Array("NAME:StatisticalSetup1",
VB Example

"c:/importdir/mySetupInfoFile")

InsertSetup
Adds a new solution setup.

Optimetrics Module Script Commands 17-39


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access [product ] > Analysis Setup > Add Solution Setup.

Name Type Description


<SetupType> String Type of setup to be inserted.
<Attributes> Array Structured array.
Array("NAME:<SetupName>", <NamedParameters>)
<Named Parameters>
"AdaptMultipleFreqs:=", <boolean>,
"Frequency:=", <string>,
"MaxDeltaS:=", <float>,
"PortsOnly:=", <boolean>,
"UseMatrixConv:=", <boolean>,
### If UseMatrixCov is True, ###
[
"NAME:Matrix Convergence",
Parameters <Convergence Array>
],
MaximumPasses:=", <integer>,
"MinimumPasses:=", <integer>,
"MinimumConvergedPasses:=", <integer>,
"PercentRefinement:=", <integer>,
"IsEnabled:=", <boolean>,
"BasisOrder:=", <integer>,
"DoLambdaRefine:=", <boolean>,
"DoMaterialLambda:=", <boolean>,
"SetLambdaTarget:=", <boolean>,
"Target:=", <float>,
"PortAccuracy:=", <integer>,
SaveRadFieldsOnly:=", <boolean>,

Optimetrics Module Script Commands 17-40


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SaveAnyFields:=", <boolean>,
"ListsForFields:=", <array of string>,
"IESolverType:=", <string>,
"LambdaTargetForIESolver:=", <float>,
"UseDefaultLambdaTgtForIESolver:=", <boolean>

Return Value None.

Python InsertSetup(<SetupType>, <Attributes>)


Syntax

oModule.InsertSetup("HfssDrivenAuto",
["NAME:Setup1",
"IsEnabled:=", True,
"AutoSolverSetting:=", "Balanced",
["NAME:Sweeps",
["NAME:Sweep",
Python
"RangeType:=", "LinearStep",
Example
"RangeStart:=", "1GHz",
"RangeEnd:=", "10GHz",
"RangeStep:=", "1GHz"
]
],
"SaveRadFieldsOnly:=", False,

Optimetrics Module Script Commands 17-41


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SaveAnyFields:=", True,
"Type:=", "Discrete"
])

oModule.InsertSetup("HfssDrivenAuto",
[
"NAME:Setup2",
"SolveType:=" , "Auto",
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],
"AutoSolverSetting:=" , "Balanced",
[
"NAME:Sweeps",
[
"NAME:Sweep",
"RangeType:=" , "LinearCount",
"RangeStart:=" , "0GHz",

Optimetrics Module Script Commands 17-42


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"RangeEnd:=" , "10GHz",
"RangeCount:=" , 501
]
],
"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,
"InfiniteSphereSetup:=" , "Infinite Sphere1",
"ListsForFields:=" , ["Objectlist2"],
"Type:=" , "Interpolating"
])

oModule.InsertSetup("HfssDriven",
["NAME:Setup3",
"AdaptMultipleFreqs:=", False,
"Frequency:=", "5GHz",
"MaxDeltaS:=", 0.02,
"PortsOnly:=", False,
"UseMatrixConv:=", False,
"MaximumPasses:=", 6,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,

Optimetrics Module Script Commands 17-43


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PercentRefinement:=", 30,
"IsEnabled:=", True,
"BasisOrder:=", 1,
"DoLambdaRefine:=", True,
"DoMaterialLambda:=", True,
"SetLambdaTarget:=", False,
"Target:=", 0.3333,
"UseMaxTetIncrease:=", False,
"PortAccuracy:=", 2,
"UseABCOnPort:=", False,
"SetPortMinMaxTri:=", False,
"UseDomains:=", True,
"UseIterativeSolver:=", False,
"IterativeResidual:=", 1E-06,
"DDMSolverResidual:=", 0.0001,
"EnhancedLowFreqAccuracy:=", True,
"SaveRadFieldsOnly:=", False,
"SaveAnyFields:=", True,
"IESolverType:=", "Auto",
"LambdaTargetForIESolver:=", 0.15,

Optimetrics Module Script Commands 17-44


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseDefaultLambdaTgtForIESolver:=", True,
"SkipIERegionSolveDuringAdaptivePasses:=", True
"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"InfiniteSphereSetup:=" , "Infinite Sphere1",
"SkipSBRSolveDuringAdaptivePasses:=", True,
"PTDUTDSimulationSettings:=", "PTD Correction + UTD Rays",
"PTDEdgeDensity:=" , 20
])

### An HFSS with Hybrid and Arrays setup


import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oProject = oDesktop.SetActiveProject("Project1")
oDesign = oProject.SetActiveDesign("HFSSDesign1")
oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup("HfssDriven",
[
"NAME:Setup1",
"SolveType:=" , "Single",
"Frequency:=" , "5GHz",

Optimetrics Module Script Commands 17-45


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MaxDeltaE:=" , 0.1,
"MaximumPasses:=" , 6,
"MinimumPasses:=" , 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=" , 30,
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],
"BasisOrder:=" , 1,
"DoLambdaRefine:=" , True,
"DoMaterialLambda:=" , True,
"SetLambdaTarget:=" , False,
"Target:=" , 0.3333,
"UseMaxTetIncrease:=" , False,
"DrivenSolverType:=" , "Direct Solver",
"EnhancedLowFreqAccuracy:=", False,
"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,

Optimetrics Module Script Commands 17-46


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"IESolverType:=" , "Auto",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True,
"IE Solver Accuracy:=" , "Balanced",
"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"RadiationSetup:=" , "Infinite Sphere1",
"PTDUTDSimulationSettings:=", "None",
"EnableSBRSelfCoupling:=", False,
"UseSBRAdvOptionsGOBlockage:=", False,
"UseSBRAdvOptionsWedges:=", False,
"SkipSBRSolveDuringAdaptivePasses:=", False,
"UseSBREnhancedRadiatedPowerCalculation:=", True
])

### An SBR+ Setup with Fast Frequency Looping


oModule.InsertSetup("HfssDriven",
[
"NAME:Setup1",
"IsEnabled:=" , True,
[

Optimetrics Module Script Commands 17-47


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:MeshLink",
"ImportMesh:=" , False
],
"IsSbrRangeDoppler:=" , False,
"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"IsMonostaticRCS:=" , True,
"EnableCWRays:=" , False,
"RadiationSetup:=" , "",
"PTDUTDSimulationSettings:=", "None",
"FastFrequencyLooping:=", True,
[
"NAME:Sweeps",
[
"NAME:Sweep",
"RangeType:=" , "LinearStep",
"RangeStart:=" , "1GHz",
"RangeEnd:=" , "10GHz",
"RangeStep:=" , "1GHz"
]

Optimetrics Module Script Commands 17-48


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

],
"ComputeFarFields:=" , True
])

### SBR+ Setup with Enhanced Radiated Power Calculation


oModule.InsertSetup("HfssDriven",
[
"NAME:Setup2",
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],
"IsSbrRangeDoppler:=" , False,
"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"EnableCWRays:=" , False,
"RadiationSetup:=" , "Infinite Sphere1",
"PTDUTDSimulationSettings:=", "None",
"FastFrequencyLooping:=", False,
"UseSBRAdvOptionsGOBlockage:=", False,

Optimetrics Module Script Commands 17-49


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseSBRAdvOptionsWedges:=", False,
[
"NAME:Sweeps",
[
"NAME:Sweep",
"RangeType:=" , "LinearStep",
"RangeStart:=" , "1GHz",
"RangeEnd:=" , "10GHz",
"RangeStep:=" , "1GHz"
]
],
"ComputeFarFields:=" , True,
"UseSBREnhancedRadiatedPowerCalculation:=", True,
"IsGOBlockageEnabled:=" , False,
"GOBlockageSurfaceSelfBlock:=", False
])

### Insert RF Discharge Setup for HFSS


import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")

Optimetrics Module Script Commands 17-50


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDesktop.RestoreWindow()
oProject = oDesktop.SetActiveProject("coaxbend_discharge_r212")
oDesign = oProject.SetActiveDesign("HFSSDesign60degBendTeflon")
oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup("HfssRFDischarge",
[
"NAME:RFDischarge1",
"Enabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , True,
"Project:=" , "This Project*",
"Product:=" , "HFSS",
"Design:=" , "This Design*",
"Soln:=" , "Setup1 : Sweep",
[
"NAME:Params",
"bend_angle:=" , "bend_angle"
],
"ForceSourceToSolve:=" , False,
"PreservePartnerSoln:=" , False,

Optimetrics Module Script Commands 17-51


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PathRelativeTo:=" , "SourceProduct",
"ApplyMeshOp:=" , True
],
[
"NAME:Excitations",
[
"NAME:1:1",
"Magnitude:=" , "1",
"Phase:=" , "0deg"
],
[
"NAME:2:1",
"Magnitude:=" , "0",
"Phase:=" , "0deg"
]
],
[
"NAME:Frequencies",
"10GHz"
],

Optimetrics Module Script Commands 17-52


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Minimum Power:=" , "0.01",


"Maximum Power:=" , "1000000",
"Minimum Pressure:=" , "100pascal",
"Maximum Pressure:=" , "101325pascal",
"Postproc Sampling:=" , 500,
"Temperature:=" , "0cel",
"BuiltInGas:=" , "Argon"
])
#### Setup with UseMatrixConv is True and Matrix Convergence Entry Specified as All
###
oModule.InsertSetup("Setup1",
[
"NAME:Setup1",
"SolveType:=" , "Single",
"Frequency:=" , "10GHz",
"MaxDeltaS:=" , 0.02,
"UseMatrixConv:=" , True,
[
"NAME:Matrix Convergence",
"AllEntries:=" , True,
"MagLimit:=" , "0.01",
"PhaseLimit:=" , "2deg",

Optimetrics Module Script Commands 17-53


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MagMinThreshold:=" , 0.01
],
"MaximumPasses:=" , 12,
"MinimumPasses:=" , 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=" , 30,
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],
"BasisOrder:=" , 1,
"DoLambdaRefine:=" , True,
"DoMaterialLambda:=" , True,
"SetLambdaTarget:=" , False,
"Target:=" , 0.3333,
"UseMaxTetIncrease:=" , False,
"PortAccuracy:=" , 2,
"UseABCOnPort:=" , False,
"SetPortMinMaxTri:=" , False,

Optimetrics Module Script Commands 17-54


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"DrivenSolverType:=" , "Direct Solver",


"EnhancedLowFreqAccuracy:=", False,
"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,
"IESolverType:=" , "ACA",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True,
"IE Solver Accuracy:=" , "Balanced",
"InfiniteSphereSetup:=" , ""
])
### Setup with UseMatrixConv as Entries and MeshLink
oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup("Setup1",
[
"NAME:Setup1",
"SolveType:=" , "Single",
"Frequency:=" , "10GHz",
"MaxDeltaS:=" , 0.02,
"UseMatrixConv:=" , True,
[
"NAME:Matrix Convergence",

Optimetrics Module Script Commands 17-55


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:Entries",
[
"NAME:Entry",
"Port1:=" , "A[1,1]P1",
"Port2:=" , "A[1,1]P1",
"MagLimit:=" , "0.011",
"PhaseLimit:=" , "5deg"
],
[
"NAME:Entry",
"Port1:=" , "A[4,4]P2",
"Port2:=" , "A[1,1]P2",
"MagLimit:=" , "0.041",
"PhaseLimit:=" , "5deg"
]
]
],
"MaximumPasses:=" , 1,
"MinimumPasses:=" , 1,

Optimetrics Module Script Commands 17-56


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MinimumConvergedPasses:=", 1,
"PercentRefinement:=" , 30,
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , True,
"Project:=" , "This Project*",
"Product:=" , "",
"Design:=" , "unit",
"Soln:=" , "Setup1 : LastAdaptive",
[
"NAME:Params",
"Airbox_dist:=" , "9.9931mm",
"Scan_Theta:=" , "0deg",
"Scan_phi:=" , "0deg",
"VirtualObject_dist:=" , "2.9979mm",
"coax_inner_rad:=" , "0.125mm",
"coax_outer_rad:=" , "0.425mm",
"cut_off:=" , "1.7mm",
"feedX:=" , "-0.4mm",
"feedY:=" , "2mm",

Optimetrics Module Script Commands 17-57


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"feed_length:=" , "1mm",
"patchX:=" , "9.65mm",
"rot:=" , "45deg",
"subH:=" , "0.8mm",
"subX:=" , "15mm",
"subY:=" , "15mm"
],
"ForceSourceToSolve:=" , False,
"PreservePartnerSoln:=" , False,
"PathRelativeTo:=" , "TargetProject",
"ApplyMeshOp:=" , True,
"AdaptPort:=" , False
],
"BasisOrder:=" , 1,
"DoLambdaRefine:=" , False,
"DoMaterialLambda:=" , True,
"SetLambdaTarget:=" , False,
"Target:=" , 0.3333,
"UseMaxTetIncrease:=" , False,
"PortAccuracy:=" , 2,

Optimetrics Module Script Commands 17-58


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseABCOnPort:=" , False,
"SetPortMinMaxTri:=" , False,
"DrivenSolverType:=" , "Domain Decomposition",
"IterativeResidual:=" , 0.0001,
"DDMSolverResidual:=" , 0.0001,
"EnhancedLowFreqAccuracy:=", False,
"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,
"IESolverType:=" , "Auto",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True,
"IE Solver Accuracy:=" , "Balanced",
"InfiniteSphereSetup:=" , ""
])
### Example from design with UseMatrixConv True for AllDiagEntries
"UseMatrixConv:=" , True,
[
"NAME:Matrix Convergence",
"AllDiagEntries:=" , True,
"DiagonalMag:=" , "0.03",
"DiagonalPhase:=" , "4rad",

Optimetrics Module Script Commands 17-59


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MagMinThreshold:=" , 0.01,
"AllOffDiagEntries:=" , True,
"OffDiagonalMag:=" , "0.05",
"OffDiagonalPhase:=" , "6deg",
"MagMinThreshold:=" , 0.01
],
### Example from Modal design with UseMatrixConv True for Entries
"UseMatrixConv:=" , True,
[
"NAME:Matrix Convergence",
[
"NAME:Entries",
[
"NAME:Entry",
"Port1:=" , "Port1",
"Port2:=" , "Port1",
"MagLimit:=" , "0.02",
"PhaseLimit:=" , "5deg"
],
[

Optimetrics Module Script Commands 17-60


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:Entry",
"Port1:=" , "Port3",
"Port2:=" , "Port2",
"MagLimit:=" , "0.03",
"PhaseLimit:=" , "5deg"
]
]
],

#### Example from Design with Periodic Ports and UseMaxtrixConv is True
"UseMatrixConv:=" , True,
[
"NAME:Matrix Convergence",
[
"NAME:Entries",
[
"NAME:Entry",
"Port1:=" , "Incident_Port1",
"Port2:=" , "Incident_Port1",
"MagLimit:=" , "0.11",
"PhaseLimit:=" , "5deg"

Optimetrics Module Script Commands 17-61


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

],
[
"NAME:Entry",
"Port1:=" , "Incident_Port2",
"Port2:=" , "Incident_Port2",
"MagLimit:=" , "0.22",
"PhaseLimit:=" , "5deg"
]
]
],
#### Example Terminal Design with UseMatrixConv = True and Expression Cache
oProject = oDesktop.SetActiveProject("term-2x2_1_parasolid")
oDesign = oProject.SetActiveDesign("unit")
oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup("Setup1",
[
"NAME:Setup1",
"SolveType:=" , "Single",
"Frequency:=" , "10GHz",
"MaxDeltaS:=" , 0.02,

Optimetrics Module Script Commands 17-62


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseMatrixConv:=" , True,
[
"NAME:Matrix Convergence",
[
"NAME:Entries",
[
"NAME:Entry",
"Port1:=" , "P2",
"Port2:=" , "P1",
"MagLimit:=" , "0.05",
"PhaseLimit:=" , "10deg"
]
]
],
"MaximumPasses:=" , 15,
"MinimumPasses:=" , 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=" , 30,
"IsEnabled:=" , True,
[
"NAME:MeshLink",

Optimetrics Module Script Commands 17-63


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ImportMesh:=" , False
],
"BasisOrder:=" , 1,
"DoLambdaRefine:=" , True,
"DoMaterialLambda:=" , True,
"SetLambdaTarget:=" , False,
"Target:=" , 0.3333,
"UseMaxTetIncrease:=" , False,
"PortAccuracy:=" , 2,
"UseABCOnPort:=" , False,
"SetPortMinMaxTri:=" , False,
"DrivenSolverType:=" , "Iterative Solver",
"IterativeResidual:=" , 0.0001,
"DDMSolverResidual:=" , 0.0001,
"EnhancedLowFreqAccuracy:=", False,
"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,
[
"NAME:ExpressionCache",
[

Optimetrics Module Script Commands 17-64


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:CacheItem",
"Title:=" , "dB_AxialRatioValue_1",
"Expression:=" , "dB(AxialRatioValue)",
"Intrinsics:=" , "Phi=\'0deg\' Theta=\'0deg\'",
"ReportType:=" , "Far Fields",
[
"NAME:ExpressionContext",
"Context:=" , "Infinite Sphere1"
]
],
[
"NAME:CacheItem",
"Title:=" , "dB_St_Diff1_Diff1__1",
"Expression:=" , "dB(St(Diff1,Diff1))",
"Intrinsics:=" , "",
"ReportType:=" , "Terminal Solution Data",
[
"NAME:ExpressionContext",
"Diff:=" , "Differential Pairs"
]
],

Optimetrics Module Script Commands 17-65


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:CacheItem",
"Title:=" , "dB_St_P1_P1__1",
"Expression:=" , "dB(St(P1,P1))",
"Intrinsics:=" , "",
"ReportType:=" , "Terminal Solution Data",
[
"NAME:ExpressionContext",
"Diff:=" , "Terminals"
]
]
],
"CacheSaveKind:=" , "Delta",
"ConstantDelta:=" , "0s",
"IESolverType:=" , "Auto",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True,
"IE Solver Accuracy:=" , "Balanced",
"InfiniteSphereSetup:=" , ""
])

Optimetrics Module Script Commands 17-66


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syn- InsertSetup <SetupType>, <Attributes>


tax

An HFSS Driven project solution with Auto Solution:


oModule.InsertSetup "HfssDrivenAuto", Array("NAME:Setup1", "IsEnabled:=", true, _
"AutoSolverSetting:=", "Balanced", _
Array("NAME:Sweeps", Array("NAME:Sweep", "RangeType:=", "LinearCount", _
"RangeStart:=", "1GHz", "RangeEnd:=", "10GHz", "RangeCount:=", "451")), _
"SaveRadFieldsOnly:=", false, "SaveAnyFields:=", false, "Type:=", "Interpolating")
A Driven solution type with a mesh link. References to dependent solve in old scripts
are converted to mesh link form.
oModule.InsertSetup "HfssDriven",
VB
Exampl- Array("NAME:Setup1",
e "Frequency:=", "1GHz",
"MaxDeltaE:=", 0.1,
"MaximumPasses:=", 6,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"IsEnabled:=", true,
Array("NAME:MeshLink",
"Project:=", "Tee.aedt",

Optimetrics Module Script Commands 17-67


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"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,
"Target:=", 0.3333,
"UseMaxTetIncrease:=", false,
"MaxTetIncrease:=", 1000000,
"EnableSolverDomains:=", false,
"ThermalFeedback:=", false,
"UsingConstantDelta:=", 0,
"ConstantDelta:=", "0s",
"NumberSolveSteps:=", 1)

Optimetrics Module Script Commands 17-68


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

A Driven solution type with ports:


oModule.InsertSetup "HfssDriven",
Array("NAME:Setup2",
"Frequency:=", "1GHz",
"PortsOnly:=", false,
"MaxDeltaS:=", 0.02,
"UseMatrixConv:=", false,
"MaximumPasses:=", 6,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"IsEnabled:=", true,
"BasisOrder:=", 1,
"UseIterativeSolver:=", true,
"IterativeResidual:=", 0.0001,
"DoLambdaRefine:=", true,
"DoMaterialLambda:=", false,
"SetLambdaTarget:=", false,
"Target:=", 0.3333,
"UseMaxTetIncrease:=", false,
"MaxTetIncrease:=", 1000000,

Optimetrics Module Script Commands 17-69


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PortAccuracy:=", 2,
"UseABCOnPort:=", true,
"SetPortMinMaxTri:=", false,
"EnableSolverDomains:=", false,
"ThermalFeedback:=", false,
"UsingConstantDelta:=", 0,
"ConstantDelta:=", "0s",
"NumberSolveSteps:=", 1)
An Eigenmode solution type:
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,

Optimetrics Module Script Commands 17-70


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"BasisOrder:=", 1,
"UseIterativeSolver:=", false,
"DoLambdaRefine:=", true,
"DoMaterialLambda:=", true,
"SetLambdaTarget:=", false,
"Target:=", 0.2,
"UseMaxTetIncrease:=", false,
"MaxTetIncrease:=", 1000000,
"UsingConstantDelta:=", 0,
"ConstantDelta:=", "0s",
"NumberSolveSteps:=", 1)
A Driven solution type with ports and matrix convergence:
oModule.InsertSetup "HfssDriven",
Array("NAME:Setup2",
"Frequency:=", "1GHz",
"PortsOnly:=", false,
"MaxDeltaS:=", 0.02,
"UseMatrixConv:=", true,
Array("NAME:ConvergenceMatrix",
"AllDiagEntries:=", true,
"MagMinThreshold:=", 0.01,

Optimetrics Module Script Commands 17-71


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"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,

Optimetrics Module Script Commands 17-72


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ConstantDelta:=", "0s",
"NumberSolveSteps:=", 1)
A Driven solution type with Multi-Frequencies specified:
oModule.InsertSetup "HfssDriven", Array("NAME:Setup2", "AdaptMultipleFreqs:=", true, _
Array("NAME:MultipleAdaptiveFreqsSetup", "1.1GHz:=", Array( _
0.02), "10GHz:=", Array(0.02), "11GHz:=", Array(0.02), "12.5GHz:=", Array(0.02),
"15GHz:=", Array( _
0.02), "20GHz:=", Array(0.02)), "MaximumPasses:=", 6, "MinimumPasses:=", 1, "Min-
imumConvergedPasses:=", _
1, "PercentRefinement:=", 30, "IsEnabled:=", true, "BasisOrder:=", 1,
"DoLambdaRefine:=", _
true, "DoMaterialLambda:=", true, "SetLambdaTarget:=", false, "Target:=", _
0.3333, "UseMaxTetIncrease:=", false, "PortAccuracy:=", 2, "UseABCOnPort:=", _
false, "SetPortMinMaxTri:=", false, "UseDomains:=", false, "UseIterativeSolver:=", _
false, "SaveRadFieldsOnly:=", false, "SaveAnyFields:=", true, "IESolverType:=", _
"Auto", "LambdaTargetForIESolver:=", 0.15, "UseDefaultLambdaTgtForIESolver:=", _
true, "RayDensityPerWavelength:=", 4, "MaxNumberOfBounces:=", 5)
An Driven Solution type with Broadband specified:
oModule.InsertSetup "HfssDriven", Array("NAME:Setup1", "AdaptMultipleFreqs:=", true, _
Array("NAME:MultipleAdaptiveFreqsSetup", Array("NAME:Broadband", "Low:=", _
"2GHz", "High:=", "20GHz")), "MaximumPasses:=", 6, "MinimumPasses:=", 1, "Min-
imumConvergedPasses:=", _
1, "PercentRefinement:=", 30, "IsEnabled:=", true, "BasisOrder:=", 1,

Optimetrics Module Script Commands 17-73


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"DoLambdaRefine:=", _
true, "DoMaterialLambda:=", true, "SetLambdaTarget:=", false, "Target:=", _
0.3333, "UseMaxTetIncrease:=", false, "PortAccuracy:=", 2, "UseABCOnPort:=", _
false, "SetPortMinMaxTri:=", false, "UseDomains:=", false, "UseIterativeSolver:=", _
false, "SaveRadFieldsOnly:=", false, "SaveAnyFields:=", true, "IESolverType:=", _
"Auto", "LambdaTargetForIESolver:=", 0.15, "UseDefaultLambdaTgtForIESolver:=", _
true, "RayDensityPerWavelength:=", 4, "MaxNumberOfBounces:=", 5)
oModule.InsertFrequencySweep "Setup1", Array("NAME:Sweep", "IsEnabled:=", true,
"RangeType:=", _
"LinearCount", "RangeStart:=", "2GHz", "RangeEnd:=", "20GHz", "RangeCount:=", _
451, "Type:=", "Interpolating", "SaveFields:=", false, "SaveRadFields:=", _
false, "InterpTolerance:=", 0.5, "InterpMaxSolns:=", 250, "InterpMinSolns:=", _
0, "InterpMinSubranges:=", 1, "ExtrapToDC:=", false, "InterpUseS:=", true, "Inter-
pUsePortImped:=", _
false, "InterpUsePropConst:=", true, "UseDerivativeConvergence:=", false, "Inter-
pDerivTolerance:=", _
0.2, "UseFullBasis:=", true, "EnforcePassivity:=", true, "PassivityErrorTolerance:=",
_
0.0001)

PasteSetup [Optimetrics]
Pastes the specified Optimetrics setup.

Optimetrics Module Script Commands 17-74


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access NA

Name Type Description


Parameters
<SetupName> String Name of the Setup

Return Value None

Python Syntax PasteSetup (<SetupName>)


oModule.PasteSetup ("OptimizationSetup1")
Python Example

VB Syntax PasteSetup <SetupName>


VB Example oModule.PasteSetup "OptimizationSetup1"

RenameSetup [Optimetrics]
Renames the specified Optimetrics setup.

UI Access Right-click the setup in the project tree, and then click Rename on the shortcut menu.

Name Type Description


Parameters <OldName> String The name that needs to be replaced
<NewName> String Replacement name

Return Value None

Optimetrics Module Script Commands 17-75


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax RenameSetup (<OldName> <NewName>)


oModule.RenameSetup ("OptimizationSetup1" "MyOptimization")
Python Example

VB Syntax RenameSetup <OldName> <NewName>


VB Example oModule.RenameSetup "OptimizationSetup1" "MyOptimization"

SetPropValue [Optimetrics]
Sets the property value for the active Optimetrics setup.

UI Access Set Property value on Optimetrics objects

Name Type Description


Property path text string Setup property path. See discussion of Property Path
Parameters new Value Text String, New value data type is depending on the property type,
Number, or
Boolean

Return Value True if the property is found and the new value is valid. Otherwise return False.

Python Syntax SetPropValue(propPath, newValue)


oOptModule.SetPropValue("ParametricSetup1\Enabled", False) //disable Para-
Python Example metricSetup1
oOptModule.SetPropValue("OptimizationSetup1/Optimizer","Quasi Newton")

Optimetrics Module Script Commands 17-76


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax SetPropValue(propPath, newValue)


VB Example SetPropValue("ParametricSetup1\Enabled", False)

SolveAllSetup
Solves all Optimetrics setups

UI Access Right-click on Optimetrics in Project Manager and select Analyze>All from context menu

Name Type Description


Parameters
None

Return Value None

Python Syntax SolveAllSetup()


oModule.SolveAllSetup()
Python Example

VB Syntax SolveAllSetup
VB Example oModule.SolveAllSetup

SolveSetup [Optimetrics]
Solves the specified Optimetrics setup.

Optimetrics Module Script Commands 17-77


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Right-click the setup in the project tree, and then click Analyze on the shortcut menu.

Name Type Description


Parameters
<SetupName> String Name of the setup to be solved

Return Value None

Python Syntax SolveSetup (<SetupName>)


oModule.SolveSetup ("OptimizationSetup1")
Python Example

VB Syntax SolveSetup <SetupName>


VB Example oModule.SolveSetup "OptimizationSetup1"

ValidateSetup [Parametric]
Performs a validation of all design variations in a parametric setup.
For information on reviewing the output produced by this script command, see: Validating a Parametric Setup

Under Optimetrics in the Project Manager, right-click the <Parametric Setup Name> and then click Validate
UI Access
Parametric Setup on the shortcut menu.

Name Type Description


Parameters
<SetupName> String Name of the parametric setup.

Return Value None

Optimetrics Module Script Commands 17-78


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ValidateSetup (<SetupName>)


Python Example oModule.ValidateSetup('ParametricSetup1')

VB Syntax ValidateSetup <SetupName>


VB Example oModule.ValidateSetup "ParametricSetup1"

General Commands Recognized by the Optimetrics Module


Following are general script commands recognized by the Optimetrics module:
CopySetup
DistrbutedAnalyzeSetup
EditSetup
ExportDXConfigFile
ExportOptimetricsProfile
ExportOptimetricsResult
ExportParametricResults
GetOptimetricResult
GetPropNames [Optimetrics]
GetPropValue [Optimetrics]
GetSetupNames [Optimetrics]
GetSetupNamesByType [Optimetrics]

Optimetrics Module Script Commands 17-79


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ImportSetup
PasteSetup [Optimetrics]
RenameSetup [Optimetrics]
SetPropValue [Optimetrics]
SolveSetup [Optimetrics]
SolveAllSetup
CopySetup
Copy the specified Optimetrics setup.

UI Access NA

Name Type Description


Parameters
<SetupName> String Name of the setup.

Return Value None.

Python Syntax CopySetup (<SetupName>)


Python Example oModule.CopySetup ("OptimizationSetup1")

VB Syntax CopySetup <SetupName>


VB Example oModule.CopySetup "OptimizationSetup1"

Optimetrics Module Script Commands 17-80


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

DeleteSetups [Optimetrics]
Deletes the specified Optimetrics setups.

UI Access Right-click the setup in the project tree, and then click Delete on the shortcut menu

Name Type Description


Parameters
<NameArray> Array of Strings An Array of Setup Names

Return Value None

Python Syntax DeleteSetups (<NameArray>)


oModule.DeleteSetups (["OptimizationSetup1"])
Python Example

VB Syntax DeleteSetups <NameArray>


VB Example oModule.DeleteSetups Array("OptimizationSetup1")

DistributedAnalyzeSetup
Distributes all variable value instances within a parametric sweep to different machines already specified from within the user inter-
face

UI Access Right-click the parametric setup name in the project tree and select Distribute Analysis.

Name Type Description


Parameters
<ParametricSetupName> String Name of the Setup

Return Value None

Optimetrics Module Script Commands 17-81


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax DistributedAnalyzeSetup (<ParametricSetupName>)


oModule.DistributedAnalyzeSetup("ParametricSetup1")
Python Example

VB Syntax DistributedAnalyzeSetup <ParametricSetupName>


VB Example oModule.DistributedAnalyzeSetup "ParametricSetup1"

EditSetup
Modifies an existing solution setup.

UI Access Double-click a solution setup in the project tree to modify its settings.

Name Type Description


<SetupName> String Name of the solve setup being edited.
<Attributes> Array Structured array.
Parameters
Array("NAME:<NewSetupName>", <NamedParameters>)
See the InsertSetup command for details and examples.

Return Value None.

Python Syntax EditSetup (<SetupName>, <Attributes>)

Optimetrics Module Script Commands 17-82


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.EditSetup("Setup1",
["NAME:NewSetup",
"AdaptiveFreq:=", "1GHz",
"EnableDistribProbTypeOption:=", false,
"SaveFields:=", "true",
"Enabled:=", true,
["NAME:Cap",
"MaxPass:=", 10,
"MinPass:=", 1,
"MinConvPass:=", 2,
Python Example "PerError:=", 1,
"PerRefine:=", 30,
"AutoIncreaseSolutionOrder:=", false,
"SolutionOrder:=", "Normal"],
["NAME:DC",
"Residual:=", 1E-005,
"SolveResOnly:=", false,
["NAME:Cond",
"MaxPass:=", 10,
"MinPass:=", 1,
"MinConvPass:=", 1,

Optimetrics Module Script Commands 17-83


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PerError:=", 1,
"PerRefine:=", 30),
["NAME:Mult",
"MaxPass:=", 1,
"MinPass:=", 1,
"MinConvPass:=", 1,
"PerError:=", 1,
"PerRefine:=", 30]],
["NAME:AC",
"MaxPass:=", 10,
"MinPass:=", 1,
"MinConvPass:=", 2,
"PerError:=", 1,
"PerRefine:=", 30]]
)
oModule.InsertSetup("HfssDrivenAuto",
["NAME:Setup1",
"IsEnabled:=", True,
"AutoSolverSetting:=", "Balanced",
["NAME:Sweeps",

Optimetrics Module Script Commands 17-84


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["NAME:Sweep",
"RangeType:=", "LinearStep",
"RangeStart:=", "1GHz",
"RangeEnd:=", "10GHz",
"RangeStep:=", "1GHz"
]
],
"SaveRadFieldsOnly:=", False,
"SaveAnyFields:=", True,
"Type:=", "Discrete"
])

oModule.InsertSetup("HfssDrivenAuto",
[
"NAME:Setup2",
"SolveType:=" , "Auto",
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],

Optimetrics Module Script Commands 17-85


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"AutoSolverSetting:=" , "Balanced",
[
"NAME:Sweeps",
[
"NAME:Sweep",
"RangeType:=" , "LinearCount",
"RangeStart:=" , "0GHz",
"RangeEnd:=" , "10GHz",
"RangeCount:=" , 501
]
],
"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,
"InfiniteSphereSetup:=" , "Infinite Sphere1",
"ListsForFields:=" , ["Objectlist2"],
"Type:=" , "Interpolating"
])

oModule.InsertSetup("HfssDriven",
["NAME:Setup3",

Optimetrics Module Script Commands 17-86


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"AdaptMultipleFreqs:=", False,
"Frequency:=", "5GHz",
"MaxDeltaS:=", 0.02,
"PortsOnly:=", False,
"UseMatrixConv:=", False,
"MaximumPasses:=", 6,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"IsEnabled:=", True,
"BasisOrder:=", 1,
"DoLambdaRefine:=", True,
"DoMaterialLambda:=", True,
"SetLambdaTarget:=", False,
"Target:=", 0.3333,
"UseMaxTetIncrease:=", False,
"PortAccuracy:=", 2,
"UseABCOnPort:=", False,
"SetPortMinMaxTri:=", False,
"UseDomains:=", True,
"UseIterativeSolver:=", False,

Optimetrics Module Script Commands 17-87


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"IterativeResidual:=", 1E-06,
"DDMSolverResidual:=", 0.0001,
"EnhancedLowFreqAccuracy:=", True,
"SaveRadFieldsOnly:=", False,
"SaveAnyFields:=", True,
"IESolverType:=", "Auto",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True,
"SkipIERegionSolveDuringAdaptivePasses:=", True
"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"InfiniteSphereSetup:=" , "Infinite Sphere1",
"SkipSBRSolveDuringAdaptivePasses:=", True,
"PTDUTDSimulationSettings:=", "PTD Correction + UTD Rays",
"PTDEdgeDensity:=" , 20
])
### Edit an SBR+ Setup with Fast Frequency Looping
oModule.EditSetup("HfssDriven",
[
"NAME:Setup1",

Optimetrics Module Script Commands 17-88


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],
"IsSbrRangeDoppler:=" , False,
"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"IsMonostaticRCS:=" , True,
"EnableCWRays:=" , False,
"RadiationSetup:=" , "",
"PTDUTDSimulationSettings:=", "None",
"FastFrequencyLooping:=", True,
[
"NAME:Sweeps",
[
"NAME:Sweep",
"RangeType:=" , "LinearStep",
"RangeStart:=" , "1GHz",
"RangeEnd:=" , "10GHz",
"RangeStep:=" , "1GHz"

Optimetrics Module Script Commands 17-89


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

]
],
"ComputeFarFields:=" , True
"UseSBREnhancedRadiatedPowerCalculation:=", True,
"IsGOBlockageEnabled:=" , False,
"GOBlockageSurfaceSelfBlock:=", False
])
#### Edit and RF Discharge Setup for HFSS
import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oProject = oDesktop.SetActiveProject("coaxbend_discharge_r212")
oDesign = oProject.SetActiveDesign("HFSSDesign60degBendTeflon")
oModule = oDesign.GetModule("AnalysisSetup")
oModule.EditSetup("RFDischarge1",
[
"NAME:RFDischarge1",
"Enabled:=" , True,
[
"NAME:MeshLink",

Optimetrics Module Script Commands 17-90


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ImportMesh:=" , True,
"Project:=" , "This Project*",
"Product:=" , "HFSS",
"Design:=" , "This Design*",
"Soln:=" , "Setup1 : Sweep",
[
"NAME:Params",
"bend_angle:=" , "bend_angle"
],
"ForceSourceToSolve:=" , True,
"PreservePartnerSoln:=" , False,
"PathRelativeTo:=" , "SourceProduct",
"ApplyMeshOp:=" , True
],
[
"NAME:Excitations",
[
"NAME:1:1",
"Magnitude:=" , "1",
"Phase:=" , "0deg"
],

Optimetrics Module Script Commands 17-91


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:2:1",
"Magnitude:=" , "0",
"Phase:=" , "0deg"
]
],
[
"NAME:Frequencies",
"10GHz"
],
"Minimum Power:=" , "0.01",
"Maximum Power:=" , "1000000",
"Minimum Pressure:=" , "100pascal",
"Maximum Pressure:=" , "101325pascal",
"Postproc Sampling:=" , 500,
"Temperature:=" , "0cel",
"BuiltInGas:=" , "Helium"
])

Optimetrics Module Script Commands 17-92


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax EditSetup <SetupName>, <Attributes>


oModule.EditSetup "Setup1",
Array("NAME:NewSetup",
"AdaptiveFreq:=", "1GHz",
"EnableDistribProbTypeOption:=", false,
"SaveFields:=", "true",
"Enabled:=", true,
Array("NAME:Cap",
"MaxPass:=", 10,
"MinPass:=", 1,
"MinConvPass:=", 2,
VB Example
"PerError:=", 1,
"PerRefine:=", 30,
"AutoIncreaseSolutionOrder:=", false,
"SolutionOrder:=", "Normal"),
Array("NAME:DC",
"Residual:=", 1E-005,
"SolveResOnly:=", false,
Array("NAME:Cond",
"MaxPass:=", 10,
"MinPass:=", 1,

Optimetrics Module Script Commands 17-93


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MinConvPass:=", 1,
"PerError:=", 1,
"PerRefine:=", 30),
Array("NAME:Mult",
"MaxPass:=", 1,
"MinPass:=", 1,
"MinConvPass:=", 1,
"PerError:=", 1,
"PerRefine:=", 30)),
Array("NAME:AC",
"MaxPass:=", 10,
"MinPass:=", 1,
"MinConvPass:=", 2,
"PerError:=", 1,
"PerRefine:=", 30))

EnableSetup
Enables and disables a defined optimetrics analysis setup.

UI Access Right-click on a setup in the project tree, select Enable Setup or Disable Setup

Name Type Description


Parameters
<SetupName> String Name of specified setup.

Optimetrics Module Script Commands 17-94


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<Enable> Boolean Determines whether enable or disable a setup.


l True - enable setup.
l False - disable setup.

Return Value None.

Python Syntax EnableSetup(<SetupName>, <Enable>)


Python Example oModule.EnableSetup("OptimizationSetup1", True)

VB Syntax EnableSetup <SetupName>, <Enable>


VB Example oModule.EnableSetup "OptimizationSetup1", true

ExportDXConfigFile
Create an xml file with the setup information for Design Xplorer

Right click on the Design Xplorer setup in the project tree and choose Export External Connector Addin Con-
UI Access
figuration…

Name Type Description


Parameters <SetupName> String Must be one of existing DesignExplorer setup names
<FileName> String Must be a valid file path and name

Return Value None

Optimetrics Module Script Commands 17-95


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ExportDXConfigFile (<SetupName>, <FileName>)


oModule.ExportDXConfigFile ("DesignXplorerSetup1",
Python Example "c:/exportdir/DXSetup1.xml")

VB Syntax ExportDXConfigFile <SetupName>, <FileName>


oModule.ExportDXConfigFile ("DesignXplorerSetup1",
VB Example
"c:/exportdir/DXSetup1.xml")

ExportOptimetricsProfile
Export Optimetrics profile data

Right click on the Optimetrics setup in the project tree and choose View Analysis Result… On the Post Ana-
UI Access
lysis Display dialog box, click the Profile tab and click on the Export button.

Name Type Description


<SetupName> String Must be one of the existing Parametric, Optimization, Sensitivity, Statistical or
DesignXplorer setup names
Parameters
<FileName> String Must be a valid file path and name with extension of csv, tab, dat, or txt
[profileNum] String Must be a numeric string. Optional: defaulted to last profile number. It should
be a zero indexed profile number.

Return Value None

Optimetrics Module Script Commands 17-96


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ExportOptimetricsProfile (<SetupName>, <FileName>, [profileNum]


oModule.ExportOptimetricsProfile
Python Example ("StatisticalSetup1", "c:/exportdir/test.csv")

VB Syntax ExportOptimetricsProfile <SetupName>, <FileName>, [profileNum]


oModule.ExportOptimetricsProfile
VB Example
"StatisticalSetup1", "c:/exportdir/test.csv"

ExportOptimetricsResult
Export an existing Optimization, Sensitivity, Statistical or DesignXplorer result. (Does not export Parametric results.)

Right click on the desired Optimetrics setup in the project tree and choose View Analysis Result… On the
UI Access
Post Analysis Display dialog box, click the Result tab, then select Table view, and click on the Export button

Name Type Description


<SetupName> String Must be one of the existing Optimization, Sensitivity, Statistical, or
DesignXplorer setup names
Parameters
<FileName> String Must be a valid file path and name with extension of csv, tab, dat, or txt..
[useFullOutputName] Boolean Optional: defaulted to false. If set to true values will be printed with units.
This parameter is ignored for Optimization and Statistical results.

Return Value None

Python Syntax ExportOptimetricsResult (<SetupName>, <FileName>, [useFullOutputName])


Python Example oModule.ExportOptimetricsResult (

Optimetrics Module Script Commands 17-97


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"StatisticalSetup1", "c:/exportdir/test.csv",false)

VB Syntax ExportOptimetricsResult <SetupName>, <FileName>, [useFullOutputName]


oModule.ExportOptimetricsResult "StatisticalSetup1", "c:/exportdir/test.csv",
VB Example
false

ExportParametricResults
Export existing Parametric results.

Right click on the desired Parametric setup in the project tree and choose View Analysis Result… On the Post
UI Access
Analysis Display dialog box, click the Result tab, then select Table view, and click on the Export button.

Name Type Description


<SetupName> String Must be one of the existing Parametric setup names
Parameters
<FileName> String Must be a valid file path and name with extension of csv, tab, dat or txt
<bOutputUnits> Boolean If set to true, values will be printed with units

Return Value None

Python Syntax ExportParametricResults (<SetupName>, <FileName>, <bOutputUnits>)


oModule.ExportParametricResults (
Python Example
"ParametricSetup1", "c:/exportdir/test.csv", False)

Optimetrics Module Script Commands 17-98


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax ExportParametricResults <SetupName>, <FileName>, <bOutputUnits>


oModule.ExportParametricResults
VB Example
"ParametricSetup1", "c:/exportdir/test.csv",false

ExportParametricSetupTable
Exports the parametric setup table as a CSV file.

UI Access Double-click parametric setup. Select Table tab. Click Export.

Name Type Description


Parameters <SetupName> String Name of the setup.
<filePath> String Full path for file export.

Return Value None

Python ExportParametricSetupTable (<SetupName>, <filePath>)


Syntax

oModule.ExportParametricSetupTable('ParametricSetup1', 'E:/Files/ParametricSetup1_
Python
Table.csv')
Example

VB Syn- ExportParametricSetupTable <SetupName>, <filePath>


tax

VB obj.ExportParametricSetupTable "ParametricSetup1", "E:/Files/ParametricSetup1_


Example Table.csv"

Optimetrics Module Script Commands 17-99


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ExportRespSurfaceMinMaxTable
Exports min-max table from a response surface to a file

Click on Export... From the Response Surface tab of the Design of Experiments Post Analysis Display dia-
UI Access
log.

Name Type Description


Parameters <DOEName> String Name of the Design of Experiments (DOE) setup.
<FileName> String Output file name with path.

Return Value None.

Python Syntax ExportRespSurfaceMinMaxTable(<DOEName>, <FileName>)


oModule.ExportRespSurfaceMinMaxTable("DesignOfExperimentsSetup1",
Python Example
"C:/temp/DesignOfExperimentsSetup1_Min-Max_Search.csv")

VB Syntax ExportRespSurfaceMinMaxTable <DOEName>, <FileName>


oModule.ExportRespSurfaceMinMaxTable _
VB Example "DesignOfExperimentsSetup1", _
"C:/temp/DesignOfExperimentsSetup1_Min-Max_Search.csv"

ExportRespSurfaceRefinePoints
Exports refinement points table to a file

Optimetrics Module Script Commands 17-100


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

From the Response Surface tab of the Design of Experiments Post Analysis Display dialog box, select
UI Access
Refinement Points option under View, Click on Export....

Name Type Description


Parameters <DOEName> String Name of the Design of Experiments (DOE) setup.
<FileName> String Output file name with path.

Return Value None.

Python Syntax ExportRespSurfaceRefinePoints(<DOEName>, <FileName>)


oModule.ExportRespSurfaceRefinePoints("DesignOfExperimentsSetup1",
Python Example
"C:/temp/DesignOfExperimentsSetup1_Refine_Points.csv")

VB Syntax ExportRespSurfaceRefinePoints <DOEName>, <FileName>


oModule.ExportRespSurfaceRefinePoints_
VB Example "DesignOfExperimentsSetup1", _
"C:/temp/DesignOfExperimentsSetup1_Refine_Points.csv"

ExportRespSurfaceResponsePoints
Exports response points table to a file

From the Response Surface tab of the Design of Experiments Post Analysis Display dialog box, select
UI Access
Response Points option under View, Click on Export....

Name Type Description


Parameters
<DOEName> String Name of the Design of Experiments (DOE) setup.

Optimetrics Module Script Commands 17-101


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<FileName> String Output file name with path.

Return Value None.

Python Syntax ExportRespSurfaceResponsePoints (<DOEName>, <FileName>)


oModule.ExportRespSurfaceResponsePoints("DesignOfExperimentsSetup1",
Python Example
"C:/temp/DesignOfExperimentsSetup1_Response_Points.csv")

VB Syntax ExportRespSurfaceResponsePoints <DOEName>, <FileName>


oModule.ExportRespSurfaceResponsePoints_
VB Example "DesignOfExperimentsSetup1", _
"C:/temp/DesignOfExperimentsSetup1_Response_Points.csv"

ExportRespSurfaceVerificationPoints
Exports verification points table to a file

From the Response Surface tab of the Design of Experiments Post Analysis Display dialog box, select Veri-
UI Access
fication Points option under View, Click on Export....

Name Type Description


Parameters <DOEName> String Name of the Design of Experiments (DOE) setup.
<FileName> String Output file name with path.

Return Value None.

Optimetrics Module Script Commands 17-102


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ExportRespSurfaceVerificationPoints (<DOEName>, <FileName>)


oModule.ExportRespSurfaceVerificationPoints("DesignOfExperimentsSetup1",
Python Example
"C:/temp/DesignOfExperimentsSetup1_Veri_Points.csv")

VB Syntax ExportRespSurfaceVerificationPoints <DOEName>, <FileName>


oModule.ExportRespSurfaceVerificationPoints_
VB Example "DesignOfExperimentsSetup1", _
"C:/temp/DesignOfExperimentsSetup1_Veri_Points.csv"

GenerateVariationData [Parametric]
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 the setup.
VB Example:
oModule.GenerateVariationData "ParametricSetup1"

Optimetrics Module Script Commands 17-103


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetChildNames [Optimetrics]
If used without a specific optimization setup name, gets a list of all setups for all types. If a with a specific setup name, returns names
for that optimization setup.

UI Access NA

Name Type Description


Parameters typeName text string Optional, default to get all types of setup names. Or one of type name return in
GetChildTypes(). Also, the type name can be used without the prefix “Opti”.

Return Value Array of setup names.

Python Syntax GetChildNames()


oOptimModule = oDesign.GetChildObject(“Optimetrics”)
arrAllSetup = oOptimModule.GetChildNames()
Python Example
arrParmSetup = oOptimModule.GetChildNames(“'OptiParametric'”)
arrOptimizeSetup = oOptimModule.GetChildNames(“'Optimization'”)

GetChildObject [Optimetrics]
Gets a Setup Object of the Optimetrics module

UI Access NA

Parameters Name Type Description

Optimetrics Module Script Commands 17-104


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Setup Name text string A optimetrics setup name, names returned by the GetChildNames().

A script object for the setup See discussion of Optimetrics Setup Objects in Object Script Property Function Sum-
Return Value mary.

Python Syntax GetChildObject()


oParamSetup = oOptModule.GetChildObject('ParametricSetup1')
Python Example
oOptSetup = oOptModule.GetChildObject('OptimizationSetup1')

GetChildTypes [Optimetrics]
Use: Gets child types of queried Optimetrics module.
Syntax: GetChildTypes()
Return Value: Array of text string, it can be an empty array if there is no setup is defined. There are six types of setup, they are
['OptiParametric', 'OptiOptimization', 'OptiSensitivity', 'OptiStatistical', 'OptiDesignExplorer', 'OptiDXDOE'].

Python Syntax GetChildTypes ()


oOptimModule = oDesign.GetChildObject(“Optimetrics”)
Python Example
arrSetupTypes = oOptimModule.GetChildTypes()

GetName
Returns the name of the active design.

Optimetrics Module Script Commands 17-105


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A
Parameters None.
Return Value String indicating the name of the active design.

Python Syntax GetName()


Python Example design_name = oDesign.GetName()

VB Syntax GetName
VB Example design_name = oDesign.GetName

GetObjPath [Design]
Obtains the path to the design.

UI Access N/A
Parameters None.
Return Value String containing the path to the design.

Python Syntax GetObjPath()

Optimetrics Module Script Commands 17-106


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Example oDesign.GetObjPath()

VB Syntax GetObjPath
VB Example oDesign.GetObjPath

GetOptimetricResult
Returns an Optimetric calculation. The specific calculation is determined by the setup.

UI Access N/A

Name Type Description


<SetupName> String Optimetrics setup name.
<vars> Array Array containing string variable names.
Use the Sweep Definitions tab in the UI or the <SweepDefs> parameter in the
Parameters InsertSetup script to determine appropriate inputs.
<values> Array Optional. Array containing string values.
When multiple variables and values are provided, the order must be the same
in both the <vars> and <values> arrays. The first variable is paired with the first
value, the second variable is paired with the second value, and so on.

Return Value Calculation result. If the setup contains more than one calculation, the output will be an array of values.

Python Syntax GetOptimetricResult(<SetupName>, <vars>, <values>)


Python Example oModule.GetOptimetricResult('ParametricSetup1',['AR','Re'],['4.64','6e+04'])

Optimetrics Module Script Commands 17-107


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetOptimetricResult <SetupName>, <vars>, <values>


dim vars(1)
vars(0) = "AR"
vars(1) = "Re"
VB Example dim values(1)
values(0) = "4.64"
values(1) = "6e+04"
oModule.GetOptimetricResult "ParametricSetup1", vars, values

GetPropNames [Optimetrics]
Use: Always returns the empty set for Optimetrics objects since they do not have properties.
Syntax: GetPropNames(bIncludeReadOnly)
Return Value: Returns empty set.
Parameters: bIncludeReadOnly—optional, default to True.

Python Syntax GetPropNames ()


oOptModule.GetPropNames()
Python Example oOptModule.GetPropNames(True)
oOptModule.GetPropNames(False)

GetPropValue [Optimetrics]
Returns the property value for a setup property.

Optimetrics Module Script Commands 17-108


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access NA

Name Type Description


Parameters
property-path a child object's property path. See property path discussion here.

Return Value Returns the value of an setup property.

Python Syntax GetPropValue(propPath)


oOptModule.GetPropValue("OptimizationSetup1\Optimizer") //get the optimizer name
for OptimizationSetup1
Python Example
oOptModule.GetPropValue("OptimizationSetup1\Optimizer\Choices") //Get the menu
property’s menu items. In this case all Optimizer names.

VB Syntax GetPropValue()
GetPropValue(“Optimetrics/OptimizationSetup1/Enabled”)
VB Example
Returns True if Enabled, or False if disabled.

GetSetupNames [Optimetrics]
Gets a list of Optimetrics setup names

UI Access NA

Name Type Description


Parameters
None

Return Value IAnsoftCollectionObj – a collection of Optimetrics setup names

Optimetrics Module Script Commands 17-109


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetSetupNames()


oModule = oDesign.GetModule("Optimetrics")
Python Example setupNames = oModule.GetSetupNames()

VB Syntax GetSetupNames()
Set oModule_opt = oDesign.GetModule("Optimetrics")
VB Example Set opt_setup_list = oModule.GetSetupNames()
numsetups = setupnames.Count

GetSetupNamesByType [Optimetrics]
Gets a list of Optimetrics setup names by type.

UI Access NA

Name Type Description


Parameters
<Optimetrics type> String Examples: parametric, optimization, statistical, sensitivity

Return Value Array of Optimetrics setup names of the given type.

Python Syntax GetSetupNamesByType (<Optimetrics type>)

Optimetrics Module Script Commands 17-110


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

for name in oModule.GetSetupNamesByType("optimization")


Python Example AddInfoMessage(str(name))

VB Syntax GetSetupNamesByType <Optimetrics type>


For each name in oModule.GetSetupNamesByType("optimization")
VB Example Msgbox name
Next

ImportSetup
Import an Optimetric setup from a file.

UI Access NA

Name Type Description


<SetupTypeName> String Must be one of "OptiParametric" , "OptiOptimization", "OptiSensitivity", "OptiS-
tatistical", or "OptiDesignExplorer".
<SetupInfo> Array Array("NAME:<SetupName>", "FilePath")
<SetupName>
Parameters Type: <string>
Name of the setup.
<FilePath>
Type : <string: file path>
Must be a valid file path and name.

Optimetrics Module Script Commands 17-111


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None

Python Syntax ImportSetup (<SetupTypeName>, <SetupInfo>)


oModule.ImportSetup ("OptiStatistical",
["NAME:StatisticalSetup1",
Python Example
"c:/importdir/mySetupInfoFile"])

VB Syntax ImportSetup <SetupTypeName>, <SetupInfo>


oModule.ImportSetup "OptiStatistical",
Array("NAME:StatisticalSetup1",
VB Example

"c:/importdir/mySetupInfoFile")

InsertSetup
Adds a new solution setup.

UI Access [product ] > Analysis Setup > Add Solution Setup.

Name Type Description


Parameters <SetupType> String Type of setup to be inserted.
<Attributes> Array Structured array.

Optimetrics Module Script Commands 17-112


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:<SetupName>", <NamedParameters>)
<Named Parameters>
"AdaptMultipleFreqs:=", <boolean>,
"Frequency:=", <string>,
"MaxDeltaS:=", <float>,
"PortsOnly:=", <boolean>,
"UseMatrixConv:=", <boolean>,
### If UseMatrixCov is True, ###
[
"NAME:Matrix Convergence",
<Convergence Array>
],
MaximumPasses:=", <integer>,
"MinimumPasses:=", <integer>,
"MinimumConvergedPasses:=", <integer>,
"PercentRefinement:=", <integer>,
"IsEnabled:=", <boolean>,
"BasisOrder:=", <integer>,
"DoLambdaRefine:=", <boolean>,
"DoMaterialLambda:=", <boolean>,
"SetLambdaTarget:=", <boolean>,
"Target:=", <float>,
"PortAccuracy:=", <integer>,
SaveRadFieldsOnly:=", <boolean>,
"SaveAnyFields:=", <boolean>,
"ListsForFields:=", <array of string>,
"IESolverType:=", <string>,
"LambdaTargetForIESolver:=", <float>,
"UseDefaultLambdaTgtForIESolver:=", <boolean>

Return Value None.

Optimetrics Module Script Commands 17-113


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python InsertSetup(<SetupType>, <Attributes>)


Syntax

oModule.InsertSetup("HfssDrivenAuto",
["NAME:Setup1",
"IsEnabled:=", True,
"AutoSolverSetting:=", "Balanced",
["NAME:Sweeps",
["NAME:Sweep",
"RangeType:=", "LinearStep",
"RangeStart:=", "1GHz",
Python
"RangeEnd:=", "10GHz",
Example
"RangeStep:=", "1GHz"
]
],
"SaveRadFieldsOnly:=", False,
"SaveAnyFields:=", True,
"Type:=", "Discrete"
])

Optimetrics Module Script Commands 17-114


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.InsertSetup("HfssDrivenAuto",
[
"NAME:Setup2",
"SolveType:=" , "Auto",
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],
"AutoSolverSetting:=" , "Balanced",
[
"NAME:Sweeps",
[
"NAME:Sweep",
"RangeType:=" , "LinearCount",
"RangeStart:=" , "0GHz",
"RangeEnd:=" , "10GHz",
"RangeCount:=" , 501
]
],
"SaveRadFieldsOnly:=" , False,

Optimetrics Module Script Commands 17-115


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SaveAnyFields:=" , True,
"InfiniteSphereSetup:=" , "Infinite Sphere1",
"ListsForFields:=" , ["Objectlist2"],
"Type:=" , "Interpolating"
])

oModule.InsertSetup("HfssDriven",
["NAME:Setup3",
"AdaptMultipleFreqs:=", False,
"Frequency:=", "5GHz",
"MaxDeltaS:=", 0.02,
"PortsOnly:=", False,
"UseMatrixConv:=", False,
"MaximumPasses:=", 6,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"IsEnabled:=", True,
"BasisOrder:=", 1,
"DoLambdaRefine:=", True,

Optimetrics Module Script Commands 17-116


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"DoMaterialLambda:=", True,
"SetLambdaTarget:=", False,
"Target:=", 0.3333,
"UseMaxTetIncrease:=", False,
"PortAccuracy:=", 2,
"UseABCOnPort:=", False,
"SetPortMinMaxTri:=", False,
"UseDomains:=", True,
"UseIterativeSolver:=", False,
"IterativeResidual:=", 1E-06,
"DDMSolverResidual:=", 0.0001,
"EnhancedLowFreqAccuracy:=", True,
"SaveRadFieldsOnly:=", False,
"SaveAnyFields:=", True,
"IESolverType:=", "Auto",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True,
"SkipIERegionSolveDuringAdaptivePasses:=", True
"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"InfiniteSphereSetup:=" , "Infinite Sphere1",

Optimetrics Module Script Commands 17-117


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SkipSBRSolveDuringAdaptivePasses:=", True,
"PTDUTDSimulationSettings:=", "PTD Correction + UTD Rays",
"PTDEdgeDensity:=" , 20
])

### An HFSS with Hybrid and Arrays setup


import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oProject = oDesktop.SetActiveProject("Project1")
oDesign = oProject.SetActiveDesign("HFSSDesign1")
oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup("HfssDriven",
[
"NAME:Setup1",
"SolveType:=" , "Single",
"Frequency:=" , "5GHz",
"MaxDeltaE:=" , 0.1,
"MaximumPasses:=" , 6,
"MinimumPasses:=" , 1,

Optimetrics Module Script Commands 17-118


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MinimumConvergedPasses:=", 1,
"PercentRefinement:=" , 30,
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],
"BasisOrder:=" , 1,
"DoLambdaRefine:=" , True,
"DoMaterialLambda:=" , True,
"SetLambdaTarget:=" , False,
"Target:=" , 0.3333,
"UseMaxTetIncrease:=" , False,
"DrivenSolverType:=" , "Direct Solver",
"EnhancedLowFreqAccuracy:=", False,
"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,
"IESolverType:=" , "Auto",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True,
"IE Solver Accuracy:=" , "Balanced",

Optimetrics Module Script Commands 17-119


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"RadiationSetup:=" , "Infinite Sphere1",
"PTDUTDSimulationSettings:=", "None",
"EnableSBRSelfCoupling:=", False,
"UseSBRAdvOptionsGOBlockage:=", False,
"UseSBRAdvOptionsWedges:=", False,
"SkipSBRSolveDuringAdaptivePasses:=", False,
"UseSBREnhancedRadiatedPowerCalculation:=", True
])

### An SBR+ Setup with Fast Frequency Looping


oModule.InsertSetup("HfssDriven",
[
"NAME:Setup1",
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],

Optimetrics Module Script Commands 17-120


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"IsSbrRangeDoppler:=" , False,
"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"IsMonostaticRCS:=" , True,
"EnableCWRays:=" , False,
"RadiationSetup:=" , "",
"PTDUTDSimulationSettings:=", "None",
"FastFrequencyLooping:=", True,
[
"NAME:Sweeps",
[
"NAME:Sweep",
"RangeType:=" , "LinearStep",
"RangeStart:=" , "1GHz",
"RangeEnd:=" , "10GHz",
"RangeStep:=" , "1GHz"
]
],
"ComputeFarFields:=" , True
])

Optimetrics Module Script Commands 17-121


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

### SBR+ Setup with Enhanced Radiated Power Calculation


oModule.InsertSetup("HfssDriven",
[
"NAME:Setup2",
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],
"IsSbrRangeDoppler:=" , False,
"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"EnableCWRays:=" , False,
"RadiationSetup:=" , "Infinite Sphere1",
"PTDUTDSimulationSettings:=", "None",
"FastFrequencyLooping:=", False,
"UseSBRAdvOptionsGOBlockage:=", False,
"UseSBRAdvOptionsWedges:=", False,
[
"NAME:Sweeps",

Optimetrics Module Script Commands 17-122


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:Sweep",
"RangeType:=" , "LinearStep",
"RangeStart:=" , "1GHz",
"RangeEnd:=" , "10GHz",
"RangeStep:=" , "1GHz"
]
],
"ComputeFarFields:=" , True,
"UseSBREnhancedRadiatedPowerCalculation:=", True,
"IsGOBlockageEnabled:=" , False,
"GOBlockageSurfaceSelfBlock:=", False
])

### Insert RF Discharge Setup for HFSS


import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oProject = oDesktop.SetActiveProject("coaxbend_discharge_r212")
oDesign = oProject.SetActiveDesign("HFSSDesign60degBendTeflon")
oModule = oDesign.GetModule("AnalysisSetup")

Optimetrics Module Script Commands 17-123


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.InsertSetup("HfssRFDischarge",
[
"NAME:RFDischarge1",
"Enabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , True,
"Project:=" , "This Project*",
"Product:=" , "HFSS",
"Design:=" , "This Design*",
"Soln:=" , "Setup1 : Sweep",
[
"NAME:Params",
"bend_angle:=" , "bend_angle"
],
"ForceSourceToSolve:=" , False,
"PreservePartnerSoln:=" , False,
"PathRelativeTo:=" , "SourceProduct",
"ApplyMeshOp:=" , True
],

Optimetrics Module Script Commands 17-124


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:Excitations",
[
"NAME:1:1",
"Magnitude:=" , "1",
"Phase:=" , "0deg"
],
[
"NAME:2:1",
"Magnitude:=" , "0",
"Phase:=" , "0deg"
]
],
[
"NAME:Frequencies",
"10GHz"
],
"Minimum Power:=" , "0.01",
"Maximum Power:=" , "1000000",
"Minimum Pressure:=" , "100pascal",
"Maximum Pressure:=" , "101325pascal",

Optimetrics Module Script Commands 17-125


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Postproc Sampling:=" , 500,


"Temperature:=" , "0cel",
"BuiltInGas:=" , "Argon"
])
#### Setup with UseMatrixConv is True and Matrix Convergence Entry Specified as All
###
oModule.InsertSetup("Setup1",
[
"NAME:Setup1",
"SolveType:=" , "Single",
"Frequency:=" , "10GHz",
"MaxDeltaS:=" , 0.02,
"UseMatrixConv:=" , True,
[
"NAME:Matrix Convergence",
"AllEntries:=" , True,
"MagLimit:=" , "0.01",
"PhaseLimit:=" , "2deg",
"MagMinThreshold:=" , 0.01
],

Optimetrics Module Script Commands 17-126


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MaximumPasses:=" , 12,
"MinimumPasses:=" , 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=" , 30,
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],
"BasisOrder:=" , 1,
"DoLambdaRefine:=" , True,
"DoMaterialLambda:=" , True,
"SetLambdaTarget:=" , False,
"Target:=" , 0.3333,
"UseMaxTetIncrease:=" , False,
"PortAccuracy:=" , 2,
"UseABCOnPort:=" , False,
"SetPortMinMaxTri:=" , False,
"DrivenSolverType:=" , "Direct Solver",
"EnhancedLowFreqAccuracy:=", False,
"SaveRadFieldsOnly:=" , False,

Optimetrics Module Script Commands 17-127


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SaveAnyFields:=" , True,
"IESolverType:=" , "ACA",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True,
"IE Solver Accuracy:=" , "Balanced",
"InfiniteSphereSetup:=" , ""
])
### Setup with UseMatrixConv as Entries and MeshLink
oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup("Setup1",
[
"NAME:Setup1",
"SolveType:=" , "Single",
"Frequency:=" , "10GHz",
"MaxDeltaS:=" , 0.02,
"UseMatrixConv:=" , True,
[
"NAME:Matrix Convergence",
[
"NAME:Entries",

Optimetrics Module Script Commands 17-128


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:Entry",
"Port1:=" , "A[1,1]P1",
"Port2:=" , "A[1,1]P1",
"MagLimit:=" , "0.011",
"PhaseLimit:=" , "5deg"
],
[
"NAME:Entry",
"Port1:=" , "A[4,4]P2",
"Port2:=" , "A[1,1]P2",
"MagLimit:=" , "0.041",
"PhaseLimit:=" , "5deg"
]
]
],
"MaximumPasses:=" , 1,
"MinimumPasses:=" , 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=" , 30,
"IsEnabled:=" , True,

Optimetrics Module Script Commands 17-129


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:MeshLink",
"ImportMesh:=" , True,
"Project:=" , "This Project*",
"Product:=" , "",
"Design:=" , "unit",
"Soln:=" , "Setup1 : LastAdaptive",
[
"NAME:Params",
"Airbox_dist:=" , "9.9931mm",
"Scan_Theta:=" , "0deg",
"Scan_phi:=" , "0deg",
"VirtualObject_dist:=" , "2.9979mm",
"coax_inner_rad:=" , "0.125mm",
"coax_outer_rad:=" , "0.425mm",
"cut_off:=" , "1.7mm",
"feedX:=" , "-0.4mm",
"feedY:=" , "2mm",
"feed_length:=" , "1mm",
"patchX:=" , "9.65mm",

Optimetrics Module Script Commands 17-130


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"rot:=" , "45deg",
"subH:=" , "0.8mm",
"subX:=" , "15mm",
"subY:=" , "15mm"
],
"ForceSourceToSolve:=" , False,
"PreservePartnerSoln:=" , False,
"PathRelativeTo:=" , "TargetProject",
"ApplyMeshOp:=" , True,
"AdaptPort:=" , False
],
"BasisOrder:=" , 1,
"DoLambdaRefine:=" , False,
"DoMaterialLambda:=" , True,
"SetLambdaTarget:=" , False,
"Target:=" , 0.3333,
"UseMaxTetIncrease:=" , False,
"PortAccuracy:=" , 2,
"UseABCOnPort:=" , False,
"SetPortMinMaxTri:=" , False,
"DrivenSolverType:=" , "Domain Decomposition",

Optimetrics Module Script Commands 17-131


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"IterativeResidual:=" , 0.0001,
"DDMSolverResidual:=" , 0.0001,
"EnhancedLowFreqAccuracy:=", False,
"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,
"IESolverType:=" , "Auto",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True,
"IE Solver Accuracy:=" , "Balanced",
"InfiniteSphereSetup:=" , ""
])
### Example from design with UseMatrixConv True for AllDiagEntries
"UseMatrixConv:=" , True,
[
"NAME:Matrix Convergence",
"AllDiagEntries:=" , True,
"DiagonalMag:=" , "0.03",
"DiagonalPhase:=" , "4rad",
"MagMinThreshold:=" , 0.01,
"AllOffDiagEntries:=" , True,

Optimetrics Module Script Commands 17-132


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"OffDiagonalMag:=" , "0.05",
"OffDiagonalPhase:=" , "6deg",
"MagMinThreshold:=" , 0.01
],
### Example from Modal design with UseMatrixConv True for Entries
"UseMatrixConv:=" , True,
[
"NAME:Matrix Convergence",
[
"NAME:Entries",
[
"NAME:Entry",
"Port1:=" , "Port1",
"Port2:=" , "Port1",
"MagLimit:=" , "0.02",
"PhaseLimit:=" , "5deg"
],
[
"NAME:Entry",
"Port1:=" , "Port3",
"Port2:=" , "Port2",

Optimetrics Module Script Commands 17-133


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MagLimit:=" , "0.03",
"PhaseLimit:=" , "5deg"
]
]
],

#### Example from Design with Periodic Ports and UseMaxtrixConv is True
"UseMatrixConv:=" , True,
[
"NAME:Matrix Convergence",
[
"NAME:Entries",
[
"NAME:Entry",
"Port1:=" , "Incident_Port1",
"Port2:=" , "Incident_Port1",
"MagLimit:=" , "0.11",
"PhaseLimit:=" , "5deg"
],
[

Optimetrics Module Script Commands 17-134


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:Entry",
"Port1:=" , "Incident_Port2",
"Port2:=" , "Incident_Port2",
"MagLimit:=" , "0.22",
"PhaseLimit:=" , "5deg"
]
]
],
#### Example Terminal Design with UseMatrixConv = True and Expression Cache
oProject = oDesktop.SetActiveProject("term-2x2_1_parasolid")
oDesign = oProject.SetActiveDesign("unit")
oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup("Setup1",
[
"NAME:Setup1",
"SolveType:=" , "Single",
"Frequency:=" , "10GHz",
"MaxDeltaS:=" , 0.02,
"UseMatrixConv:=" , True,
[
"NAME:Matrix Convergence",

Optimetrics Module Script Commands 17-135


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:Entries",
[
"NAME:Entry",
"Port1:=" , "P2",
"Port2:=" , "P1",
"MagLimit:=" , "0.05",
"PhaseLimit:=" , "10deg"
]
]
],
"MaximumPasses:=" , 15,
"MinimumPasses:=" , 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=" , 30,
"IsEnabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],

Optimetrics Module Script Commands 17-136


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"BasisOrder:=" , 1,
"DoLambdaRefine:=" , True,
"DoMaterialLambda:=" , True,
"SetLambdaTarget:=" , False,
"Target:=" , 0.3333,
"UseMaxTetIncrease:=" , False,
"PortAccuracy:=" , 2,
"UseABCOnPort:=" , False,
"SetPortMinMaxTri:=" , False,
"DrivenSolverType:=" , "Iterative Solver",
"IterativeResidual:=" , 0.0001,
"DDMSolverResidual:=" , 0.0001,
"EnhancedLowFreqAccuracy:=", False,
"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,
[
"NAME:ExpressionCache",
[
"NAME:CacheItem",
"Title:=" , "dB_AxialRatioValue_1",
"Expression:=" , "dB(AxialRatioValue)",

Optimetrics Module Script Commands 17-137


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Intrinsics:=" , "Phi=\'0deg\' Theta=\'0deg\'",


"ReportType:=" , "Far Fields",
[
"NAME:ExpressionContext",
"Context:=" , "Infinite Sphere1"
]
],
[
"NAME:CacheItem",
"Title:=" , "dB_St_Diff1_Diff1__1",
"Expression:=" , "dB(St(Diff1,Diff1))",
"Intrinsics:=" , "",
"ReportType:=" , "Terminal Solution Data",
[
"NAME:ExpressionContext",
"Diff:=" , "Differential Pairs"
]
],
[
"NAME:CacheItem",

Optimetrics Module Script Commands 17-138


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Title:=" , "dB_St_P1_P1__1",
"Expression:=" , "dB(St(P1,P1))",
"Intrinsics:=" , "",
"ReportType:=" , "Terminal Solution Data",
[
"NAME:ExpressionContext",
"Diff:=" , "Terminals"
]
]
],
"CacheSaveKind:=" , "Delta",
"ConstantDelta:=" , "0s",
"IESolverType:=" , "Auto",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True,
"IE Solver Accuracy:=" , "Balanced",
"InfiniteSphereSetup:=" , ""
])

VB Syn- InsertSetup <SetupType>, <Attributes>


tax

Optimetrics Module Script Commands 17-139


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

An HFSS Driven project solution with Auto Solution:


oModule.InsertSetup "HfssDrivenAuto", Array("NAME:Setup1", "IsEnabled:=", true, _
"AutoSolverSetting:=", "Balanced", _
Array("NAME:Sweeps", Array("NAME:Sweep", "RangeType:=", "LinearCount", _
"RangeStart:=", "1GHz", "RangeEnd:=", "10GHz", "RangeCount:=", "451")), _
"SaveRadFieldsOnly:=", false, "SaveAnyFields:=", false, "Type:=", "Interpolating")
A Driven solution type with a mesh link. References to dependent solve in old scripts
are converted to mesh link form.
oModule.InsertSetup "HfssDriven",

VB Array("NAME:Setup1",
Exampl-
"Frequency:=", "1GHz",
e
"MaxDeltaE:=", 0.1,
"MaximumPasses:=", 6,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"IsEnabled:=", true,
Array("NAME:MeshLink",
"Project:=", "Tee.aedt",
"Design:=", "TeeModel",

Optimetrics Module Script Commands 17-140


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"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,
"Target:=", 0.3333,
"UseMaxTetIncrease:=", false,
"MaxTetIncrease:=", 1000000,
"EnableSolverDomains:=", false,
"ThermalFeedback:=", false,
"UsingConstantDelta:=", 0,
"ConstantDelta:=", "0s",
"NumberSolveSteps:=", 1)
A Driven solution type with ports:
oModule.InsertSetup "HfssDriven",

Optimetrics Module Script Commands 17-141


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Setup2",
"Frequency:=", "1GHz",
"PortsOnly:=", false,
"MaxDeltaS:=", 0.02,
"UseMatrixConv:=", false,
"MaximumPasses:=", 6,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"IsEnabled:=", true,
"BasisOrder:=", 1,
"UseIterativeSolver:=", true,
"IterativeResidual:=", 0.0001,
"DoLambdaRefine:=", true,
"DoMaterialLambda:=", false,
"SetLambdaTarget:=", false,
"Target:=", 0.3333,
"UseMaxTetIncrease:=", false,
"MaxTetIncrease:=", 1000000,
"PortAccuracy:=", 2,

Optimetrics Module Script Commands 17-142


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseABCOnPort:=", true,
"SetPortMinMaxTri:=", false,
"EnableSolverDomains:=", false,
"ThermalFeedback:=", false,
"UsingConstantDelta:=", 0,
"ConstantDelta:=", "0s",
"NumberSolveSteps:=", 1)
An Eigenmode solution type:
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,

Optimetrics Module Script Commands 17-143


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"DoLambdaRefine:=", true,
"DoMaterialLambda:=", true,
"SetLambdaTarget:=", false,
"Target:=", 0.2,
"UseMaxTetIncrease:=", false,
"MaxTetIncrease:=", 1000000,
"UsingConstantDelta:=", 0,
"ConstantDelta:=", "0s",
"NumberSolveSteps:=", 1)
A Driven solution type with ports and matrix convergence:
oModule.InsertSetup "HfssDriven",
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)),

Optimetrics Module Script Commands 17-144


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"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)

Optimetrics Module Script Commands 17-145


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

A Driven solution type with Multi-Frequencies specified:


oModule.InsertSetup "HfssDriven", Array("NAME:Setup2", "AdaptMultipleFreqs:=", true, _
Array("NAME:MultipleAdaptiveFreqsSetup", "1.1GHz:=", Array( _
0.02), "10GHz:=", Array(0.02), "11GHz:=", Array(0.02), "12.5GHz:=", Array(0.02),
"15GHz:=", Array( _
0.02), "20GHz:=", Array(0.02)), "MaximumPasses:=", 6, "MinimumPasses:=", 1, "Min-
imumConvergedPasses:=", _
1, "PercentRefinement:=", 30, "IsEnabled:=", true, "BasisOrder:=", 1,
"DoLambdaRefine:=", _
true, "DoMaterialLambda:=", true, "SetLambdaTarget:=", false, "Target:=", _
0.3333, "UseMaxTetIncrease:=", false, "PortAccuracy:=", 2, "UseABCOnPort:=", _
false, "SetPortMinMaxTri:=", false, "UseDomains:=", false, "UseIterativeSolver:=", _
false, "SaveRadFieldsOnly:=", false, "SaveAnyFields:=", true, "IESolverType:=", _
"Auto", "LambdaTargetForIESolver:=", 0.15, "UseDefaultLambdaTgtForIESolver:=", _
true, "RayDensityPerWavelength:=", 4, "MaxNumberOfBounces:=", 5)
An Driven Solution type with Broadband specified:
oModule.InsertSetup "HfssDriven", Array("NAME:Setup1", "AdaptMultipleFreqs:=", true, _
Array("NAME:MultipleAdaptiveFreqsSetup", Array("NAME:Broadband", "Low:=", _
"2GHz", "High:=", "20GHz")), "MaximumPasses:=", 6, "MinimumPasses:=", 1, "Min-
imumConvergedPasses:=", _
1, "PercentRefinement:=", 30, "IsEnabled:=", true, "BasisOrder:=", 1,
"DoLambdaRefine:=", _

Optimetrics Module Script Commands 17-146


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

true, "DoMaterialLambda:=", true, "SetLambdaTarget:=", false, "Target:=", _


0.3333, "UseMaxTetIncrease:=", false, "PortAccuracy:=", 2, "UseABCOnPort:=", _
false, "SetPortMinMaxTri:=", false, "UseDomains:=", false, "UseIterativeSolver:=", _
false, "SaveRadFieldsOnly:=", false, "SaveAnyFields:=", true, "IESolverType:=", _
"Auto", "LambdaTargetForIESolver:=", 0.15, "UseDefaultLambdaTgtForIESolver:=", _
true, "RayDensityPerWavelength:=", 4, "MaxNumberOfBounces:=", 5)
oModule.InsertFrequencySweep "Setup1", Array("NAME:Sweep", "IsEnabled:=", true,
"RangeType:=", _
"LinearCount", "RangeStart:=", "2GHz", "RangeEnd:=", "20GHz", "RangeCount:=", _
451, "Type:=", "Interpolating", "SaveFields:=", false, "SaveRadFields:=", _
false, "InterpTolerance:=", 0.5, "InterpMaxSolns:=", 250, "InterpMinSolns:=", _
0, "InterpMinSubranges:=", 1, "ExtrapToDC:=", false, "InterpUseS:=", true, "Inter-
pUsePortImped:=", _
false, "InterpUsePropConst:=", true, "UseDerivativeConvergence:=", false, "Inter-
pDerivTolerance:=", _
0.2, "UseFullBasis:=", true, "EnforcePassivity:=", true, "PassivityErrorTolerance:=",
_
0.0001)

PasteSetup [Optimetrics]
Pastes the specified Optimetrics setup.

UI Access NA

Parameters Name Type Description

Optimetrics Module Script Commands 17-147


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<SetupName> String Name of the Setup

Return Value None

Python Syntax PasteSetup (<SetupName>)


oModule.PasteSetup ("OptimizationSetup1")
Python Example

VB Syntax PasteSetup <SetupName>


VB Example oModule.PasteSetup "OptimizationSetup1"

RenameSetup [Optimetrics]
Renames the specified Optimetrics setup.

UI Access Right-click the setup in the project tree, and then click Rename on the shortcut menu.

Name Type Description


Parameters <OldName> String The name that needs to be replaced
<NewName> String Replacement name

Return Value None

Python Syntax RenameSetup (<OldName> <NewName>)

Optimetrics Module Script Commands 17-148


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.RenameSetup ("OptimizationSetup1" "MyOptimization")


Python Example

VB Syntax RenameSetup <OldName> <NewName>


VB Example oModule.RenameSetup "OptimizationSetup1" "MyOptimization"

SetPropValue [Optimetrics]
Sets the property value for the active Optimetrics setup.

UI Access Set Property value on Optimetrics objects

Name Type Description


Property path text string Setup property path. See discussion of Property Path
Parameters new Value Text String, New value data type is depending on the property type,
Number, or
Boolean

Return Value True if the property is found and the new value is valid. Otherwise return False.

Python Syntax SetPropValue(propPath, newValue)


oOptModule.SetPropValue("ParametricSetup1\Enabled", False) //disable Para-
Python Example metricSetup1
oOptModule.SetPropValue("OptimizationSetup1/Optimizer","Quasi Newton")

VB Syntax SetPropValue(propPath, newValue)

Optimetrics Module Script Commands 17-149


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example SetPropValue("ParametricSetup1\Enabled", False)

SolveAllSetup
Solves all Optimetrics setups

UI Access Right-click on Optimetrics in Project Manager and select Analyze>All from context menu

Name Type Description


Parameters
None

Return Value None

Python Syntax SolveAllSetup()


oModule.SolveAllSetup()
Python Example

VB Syntax SolveAllSetup
VB Example oModule.SolveAllSetup

SolveSetup [Optimetrics]
Solves the specified Optimetrics setup.

UI Access Right-click the setup in the project tree, and then click Analyze on the shortcut menu.

Optimetrics Module Script Commands 17-150


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


Parameters
<SetupName> String Name of the setup to be solved

Return Value None

Python Syntax SolveSetup (<SetupName>)


oModule.SolveSetup ("OptimizationSetup1")
Python Example

VB Syntax SolveSetup <SetupName>


VB Example oModule.SolveSetup "OptimizationSetup1"

ValidateSetup [Parametric]
Performs a validation of all design variations in a parametric setup.
For information on reviewing the output produced by this script command, see: Validating a Parametric Setup

Under Optimetrics in the Project Manager, right-click the <Parametric Setup Name> and then click Validate
UI Access
Parametric Setup on the shortcut menu.

Name Type Description


Parameters
<SetupName> String Name of the parametric setup.

Return Value None

Optimetrics Module Script Commands 17-151


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ValidateSetup (<SetupName>)


Python Example oModule.ValidateSetup('ParametricSetup1')

VB Syntax ValidateSetup <SetupName>


VB Example oModule.ValidateSetup "ParametricSetup1"

Parametric Script Commands


EditSetup [Parametric]
ExportParametricSetupTable
GenerateVariationData [Parametric]
InsertSetup [Parametric]
ValidateSetup [Parametric]
EditSetup [Parametric]
Modifies an existing parametric setup

UI Access Right-click the setup in the project tree, and then click Properties on the shortcut menu.

Name Type Description


Parameters <SetupName> String Name of the Setup

Return Value None

Optimetrics Module Script Commands 17-152


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax EditSetup (<SetupName>, <ParametricParams>)


See EditSetup [Optimization]
Python Example

VB Syntax EditSetup <SetupName>, <ParametricParams>


VB Example See EditSetup [Optimization]

ExportParametricSetupTable
Exports the parametric setup table as a CSV file.

UI Access Double-click parametric setup. Select Table tab. Click Export.

Name Type Description


Parameters <SetupName> String Name of the setup.
<filePath> String Full path for file export.

Return Value None

Python ExportParametricSetupTable (<SetupName>, <filePath>)


Syntax

oModule.ExportParametricSetupTable('ParametricSetup1', 'E:/Files/ParametricSetup1_
Python
Table.csv')
Example

VB Syn- ExportParametricSetupTable <SetupName>, <filePath>

Optimetrics Module Script Commands 17-153


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

tax

VB obj.ExportParametricSetupTable "ParametricSetup1", "E:/Files/ParametricSetup1_


Example Table.csv"

GenerateVariationData [Parametric]
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 the setup.
VB Example:
oModule.GenerateVariationData "ParametricSetup1"
InsertSetup [Parametric]
Inserts a new parametric setup.

UI Access Right-click the Optimetrics folder in the project tree, and then click Add> Parametric on the shortcut menu.

Name Type Description


<Parametric Array Array("NAME:<SetupName>", "SaveFields:=",
Params>
Parameters <SaveField>, <StartingPoint>, "Sim. Setups:=",
<SimSetups>,
<SweepDefs>, <SweepOps>,

Optimetrics Module Script Commands 17-154


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Goals", Array("NAME:Goal",
<OptiGoalSpec>), ... Array("NAME:Goal",
<OptiGoalSpec>))
<SetupName> String Name of the parametric setup.
<SimSetups> Array of An array of Twin Builder solution setup names.
Strings
<SweepDefs> Array Array("NAME:Sweeps",
Array("NAME:SweepDefinition", "Variable:=",
<VarName>, "Data:=", <SweepData>,
"Synchronize:=", <SyncNum>), ...
Array("NAME:SweepDefinition", "Variable:=",
<VarName>, "Data:=", <SweepData>,
"Synchronize:=", <SyncNum>))
<SweepData> String "<SweepType>, <StartV>, <StopV>, <StepV>"
<SweepType> String The type of sweep data.
<SyncNum> Integer SweepDatas with the same value are synchronized.
<SweepOps> Array("NAME:Sweep Operations", "<OpType>:=,
Array(<VarValue>, …, <VarValue>), ...
<OpType>:=, Array(<VarValue>, …, <VarValue>))
<OpType> String The sweep operation type.

Return Value None

Python Syntax InsertSetup ("OptiParametric", <ParametricParams>)

Optimetrics Module Script Commands 17-155


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.InsertSetup(
"OptiParametric",
["NAME:ParametricSetup1", _
"SaveFields:=", true, _
["NAME:StartingPoint"], _
"Sim. Setups:=", ["Setup1"],_
["NAME:Sweeps", _
["NAME:SweepDefinition", _
"Variable:=", "$width", _

Python Example "Data:=", "LIN 12mm 17mm 2.5mm", _


"OffsetF1:=", false, _
"Synchronize:=", 0],
["NAME:SweepDefinition", _
"Variable:=", "$length", _
"Data:=", "LIN 8mm 12mm 2mm", _
"OffsetF1:=", false, _
"Synchronize:=", 0]],
["NAME:Sweep Operations"], _
["NAME:Goals", _

Optimetrics Module Script Commands 17-156


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "returnloss", _
"Context:=", "",_
["NAME:Ranges", _
"Range:=", ["Var:=", "Freq", "Type:=","s", _
"Start:=", "8GHz", "Stop:=", "8GHz"]], _
["NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect", _
"Context:=", "", _
["NAME:Ranges", _
"Range:=", ["Var:=", "Freq", "Type:=","s", _
"Start:=", "8GHz", "Stop:=", "8GHz"]]]]]])

VB Syntax InsertSetup "OptiParametric", <ParametricParams>


oModule.InsertSetup
"OptiParametric",
VB Example
Array("NAME:ParametricSetup1", _
"SaveFields:=", true, _

Optimetrics Module Script Commands 17-157


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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:=", "",_

Optimetrics Module Script Commands 17-158


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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", _
"Range:=", Array("Var:=", "Freq", "Type:=","s", _
"Start:=", "8GHz", "Stop:=", "8GHz")))))

ValidateSetup [Parametric]
Performs a validation of all design variations in a parametric setup.
For information on reviewing the output produced by this script command, see: Validating a Parametric Setup

Under Optimetrics in the Project Manager, right-click the <Parametric Setup Name> and then click Validate
UI Access
Parametric Setup on the shortcut menu.

Name Type Description


Parameters
<SetupName> String Name of the parametric setup.

Return Value None

Python Syntax ValidateSetup (<SetupName>)

Optimetrics Module Script Commands 17-159


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Example oModule.ValidateSetup('ParametricSetup1')

VB Syntax ValidateSetup <SetupName>


VB Example oModule.ValidateSetup "ParametricSetup1"

Optimization Script Commands


EditSetup [Optimization]
InsertSetup [Optimization]
EditSetup [Optimization]
Modifies an existing optimization setup.

UI Access Right-click the setup in the project tree, and then click Properties on the shortcut menu

Name Type Description


Parameters <SetupName> String Name of the Setup

Return Value None

Python Syntax EditSetup (<SetupName>, <OptimizationParams>)


oModule.EditSetup("OptimizationSetup1",
Python Example
[

Optimetrics Module Script Commands 17-160


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:OptimizationSetup1",
"UseFastCalculationUpdateAlgo:=", False,
"FastCalcOptCtrledByUser:=", False,
"IsEnabled:=", True,
"SaveSolutions:=", False,
[
"NAME:StartingPoint"
],
"Optimizer:=", "Quasi Newton",
[
"NAME:AnalysisStopOptions",
"StopForNumIteration:=" , True,
"StopForElapsTime:=", False,
"StopForSlowImprovement:=", False,
"StopForGrdTolerance:=", False,
"MaxNumIteration:=",1000,
"MaxSolTimeInSec:=",3600,
"RelGradientTolerance:=", 0,
"MinNumIteration:=", 10
],
"CostFuncNormType:=", "L2",

Optimetrics Module Script Commands 17-161


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PriorPSetup:=", "",
"PreSolvePSetup:=", True,
[
"NAME:Variables"
],
[
"NAME:LCS"
],
[
"NAME:Goals",
[
"NAME:Goal",
"ReportType:=", "Standard",
"Solution:=", "TR",
[
"NAME:SimValueContext",
"SimValueContext:=", [1,0,2,0,False,False,-1,1,0,1,1,"",0,0
]
],

Optimetrics Module Script Commands 17-162


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Calculation:=", "acosh(Time)",
"Name:=", "Time",
[
"NAME:Ranges",
"Range:=", ["Var:=", "Time","Type:=", "a"]
],
"Condition:=", "==",
[
"NAME:GoalValue",
"GoalValueType:=", "Independent",
"Format:=", "Real/Imag",
"bG:=", ["v:=", "[1;]"]
],
"Weight:=", "[1;]"
]
],
"Acceptable_Cost:=" , 0,
"Noise:=", 0.0001,
"UpdateDesign:=", False,
"UpdateIteration:=", 5,
"KeepReportAxis:=", True,

Optimetrics Module Script Commands 17-163


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UpdateDesignWhenDone:=", True
])

VB Syntax EditSetup <SetupName>, <OptimizationParams>


oModule.EditSetup "OptimizationSetup1",
Array("NAME:OptimizationSetup1", "UseFastCalculationUpdateAlgo:=", _
false, "FastCalcOptCtrledByUser:=", false,
"IsEnabled:=", true, "SaveSolutions:=", _
false, Array("NAME:StartingPoint"), "Optimizer:=",
"Quasi Newton", Array("NAME:AnalysisStopOptions", "StopForNumIteration:=", _
true, "StopForElapsTime:=", false,

VB Example "StopForSlowImprovement:=", false, "StopForGrdTolerance:=", _


false, "MaxNumIteration:=", 1000, "MaxSolTimeInSec:=",
3600, "RelGradientTolerance:=", _
0, "MinNumIteration:=", 10), "CostFuncNormType:=",
"L2", "PriorPSetup:=", "", "PreSolvePSetup:=", _
true, Array("NAME:Variables"), Array("NAME:LCS"),
Array("NAME:Goals", Array("NAME:Goal", "ReportType:=", _
"Standard", "Solution:=", "TR", Array("NAME:SimValueContext",

Optimetrics Module Script Commands 17-164


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SimValueContext:=", Array( _
1, 0, 2, 0, false, false, -1, 1, 0, 1, 1, "", 0, 0)),
"Calculation:=", "Time", "Name:=", _
"Time", Array("NAME:Ranges", "Range:=",
Array("Var:=", "Time", "Type:=", "a")), "Condition:=", _
"==", Array("NAME:GoalValue", "GoalValueType:=",
"Independent", "Format:=", _
"Real/Imag", "bG:=", Array("v:=", "[1;]")),
"Weight:=", "[1;]")), "Acceptable_Cost:=", _
0, "Noise:=", 0.0001, "UpdateDesign:=", false,
"UpdateIteration:=", 5, "KeepReportAxis:=", _
true, "UpdateDesignWhenDone:=", true)

InsertSetup [Optimization]
Use: Inserts a new optimization setup.

UI Access Right-click the Optimetrics folder in the project tree, and then click Add>Optimization on the shortcut menu.

Name Type Description


<OptimizationParams> Array Array("NAME:<SetupName>", "SaveFields:=",
<SaveField>, <StartingPoint>, "Optimizer:=",
Parameters
<Optimizer>,
"MaxIterations:=", <MaxIter>, "PriorPSetup:=",
<PriorSetup>, "PreSolvePSetup:=", <Preceed>,

Optimetrics Module Script Commands 17-165


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<OptimizationVars>, <Constraint>,
Array("NAME:Goals", Array("NAME:Goal",
<OptiGoalSpec>, <OptimizationGoalSpec>), ...
Array("NAME:Goal", <OptiGoalSpec>,
<OptimizationGoalSpec>)),
"Acceptable_Cost:=", <AcceptableCost>, "Noise:=",
<Noise>, "UpdateDesignWhenDone:=", <UpdateDesign"
<OptimizationVars> Array Array("NAME:Variables", "VarName:=", Array("i:=",
<IncludeVar>, "Min:=", <MinV>, "Max:=", <MaxV>,
"MinStep:=", <MinStepV>, "MaxStep:=", <MaxStepV>),
………………. "VarName:=", Array("i:=", <IncludeVar>,
"Min:=", <MinV>, "Max:=", <MaxV>,
"MinStep:=", <MinStepV>, "MaxStep:=", <MaxStepV>))
<MinStepV> VarValue The minimum step of the variable.
<MaxStepV> VarValue The maximum step of the variable.
<AcceptableCost> Double The acceptable cost value for the optimizer to stop.
<Noise> Double The noise of the design.
<UpdateDesign> Boolean Specifies whether or not to apply the optimal variation to the design after
the optimization is done.
<OptimizationGoalSpec> Array "Condition:=", <OptimizationCond>,
Array("NAME:GoalValue", "GoalValeType:=",
<GoalValueType>,
"Format:=", <GoalValueFormat>, "bG:=",

Optimetrics Module Script Commands 17-166


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("v:=", <GoalValue>)), "Weight:=", <Weight>)


<OptimizationCond> String Either "<=", "==", or ">="
<GoalValueType> String Either "Independent" or "Dependent"
<GoalValueFormat> String Either "Real/Imag" or "Mag/Ang".
<GoalValue> String Value in string. Value can be a real number, complex number, or expres-
sion.

Return Value None

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"

Optimetrics Module Script Commands 17-167


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<OptimizationVars>
Array("NAME:Variables", "VarName:=", Array("i:=",
<IncludeVar>, "Min:=", <MinV>, "Max:=", <MaxV>,
"MinStep:=", <MinStepV>, "MaxStep:=", <MaxStepV>),
………………. "VarName:=", Array("i:=", <IncludeVar>, "Min:=", <MinV>, "Max:=", <MaxV>,
"MinStep:=", <MinStepV>, "MaxStep:=", <MaxStepV>))

<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.

Optimetrics Module Script Commands 17-168


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<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 optimization is done.

<OptimizationGoalSpec>
"Condition:=", <OptimizationCond>,
Array("NAME:GoalValue", "GoalValueType:=",
<GoalValueType>,
"Format:=", <GoalValueFormat>, "bG:=",
Array("v:=", <GoalValue>)), "Weight:=", <Weight>)

<OptimizationCond>
Type: <string>
Either "<=", "==", or ">="

<GoalValueType>
Type: <string>

Optimetrics Module Script Commands 17-169


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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.
VB 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", _

Optimetrics Module Script Commands 17-170


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"$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", _
"Context:=", "", _
Array("NAME:Ranges", _
"Range:=", Array("Var:=", "Freq", _
"Type:=", "s", _
"Start:=", "8GHz", "Stop:=", "8GHz")), _
"Condition:=", "<=", _
Array("NAME:GoalValue", _
"GoalValueType:=", "Independent", _

Optimetrics Module Script Commands 17-171


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"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)

Python Syntax InsertSetup ("OptiOptimization", <OptimizationParams>)


oModule.InsertSetup(
"OptiOptimization",_
["NAME:OptimizationSetup1", _
"SaveFields:=", false, _
Python Example
["NAME:StartingPoint", "$length:=", "8mm",_
"$width:=", "14.5mm"], _
"Optimizer:=", "Quasi Newton", _
"MaxIterations:=", 100, _

Optimetrics Module Script Commands 17-172


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PriorPSetup:=", "ParametricSetup1", _
"PreSolvePSetup:=", true, _
["NAME:Variables", _
"$length:=", ["i:=", true, "Min:=", "6mm",_
"Max:=", "18mm", _
"MinStep:=", "0.001mm", "MaxStep:=", _
"1.2mm"], _
"$width:=", ["i:=", true, "Min:=", _
"6.5mm", "Max:=", "19.5mm", _
"MinStep:=", "0.001mm", "MaxStep:=", _
"1.3mm"]], _
["NAME:LCS"], _
["NAME:Goals", _
["NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "reflect", _
"Context:=", "", _
["NAME:Ranges", _
"Range:=", ["Var:=", "Freq", _
"Type:=", "s", _

Optimetrics Module Script Commands 17-173


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Start:=", "8GHz", "Stop:=", "8GHz"]], _


"Condition:=", "&lt;=", _
["NAME:GoalValue", _
"GoalValueType:=", "Independent", _
"Format:=", "Real/Imag", _
"bG:=", ["v:=", "[0.0001]"]], _
"Weight:=", "[1]"]],
"Acceptable_Cost:=", 0.0002, _
"Noise:=", 0.0001, _
"UpdateDesign:=", true, _
"UpdateIteration:=", 5, _
"KeepReportAxis:=", true, _
"UpdateDesignWhenDone:=", true)

VB Syntax InsertSetup "OptiOptimization", <OptimizationParams>


oModule.InsertSetup
"OptiOptimization",_
VB Example
Array("NAME:OptimizationSetup1", _
"SaveFields:=", false, _

Optimetrics Module Script Commands 17-174


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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", _

Optimetrics Module Script Commands 17-175


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Context:=", "", _
Array("NAME:Ranges", _
"Range:=", Array("Var:=", "Freq", _
"Type:=", "s", _
"Start:=", "8GHz", "Stop:=", "8GHz")), _
"Condition:=", "&lt;=", _
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)

Sensitivity Script Commands


EditSetup [Sensitivity]

Optimetrics Module Script Commands 17-176


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

InsertSetup [Sensitivity]
EditSetup [Sensitivity]
Modifies an existing sensitivity setup.

UI Access Right-click the setup in the project tree, and then click Properties on the shortcut menu

Name Type Description


Parameters <SetupName> String Name of the Setup

Return Value None

Python Syntax EditSetup (<SetupName>, <SensitivityParams>)


oModule.EditSetup("OptimizationSetup1",
[
"NAME:OptimizationSetup1",
"UseFastCalculationUpdateAlgo:=", False,
"FastCalcOptCtrledByUser:=", False,
Python Example
"IsEnabled:=", True,
"SaveSolutions:=", False,
[
"NAME:StartingPoint"
],

Optimetrics Module Script Commands 17-177


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Optimizer:=", "Quasi Newton",


[
"NAME:AnalysisStopOptions",
"StopForNumIteration:=", True,
"StopForElapsTime:=", False,
"StopForSlowImprovement:=", False,
"StopForGrdTolerance:=" , False,
"MaxNumIteration:=", 1001,
"MaxSolTimeInSec:=", 3600,
"RelGradientTolerance:=", 0,
"MinNumIteration:=", 10
],
"CostFuncNormType:=", "L2",
"PriorPSetup:=", "",
"PreSolvePSetup:=", True,
[
"NAME:Variables"
],
[

Optimetrics Module Script Commands 17-178


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:LCS"
],
[
"NAME:Goals",
[
"NAME:Goal",
"ReportType:=", "Standard",
"Solution:=", "TR3",
[
"NAME:SimValueContext",
"SimValueContext:=", [1,0,2,0,False,False,-1,1,0,1,1,"",0,0]
],
"Calculation:=", "mag(DIFF1.VAL)",
"Name:=", "DIFF1.VAL",
[
"NAME:Ranges",
"Range:=", [
"Var:=", "Time","Type:=", "a"]
],
"Condition:=", "==",
[

Optimetrics Module Script Commands 17-179


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:GoalValue",
"GoalValueType:=", "Independent",
"Format:=", "Real/Imag",
"bG:=", ["v:=", "[1;]"]
],
"Weight:=", "[1;]"
]
],
"Acceptable_Cost:=", 0,
"Noise:=", 0.0001,
"UpdateDesign:=", False,
"UpdateIteration:=", 5,
"KeepReportAxis:=", True,
"UpdateDesignWhenDone:=", True
])

VB Syntax EditSetup <SetupName>, <SensitivityParams>


oModule.EditSetup("OptimizationSetup1",
VB Example
Array(

Optimetrics Module Script Commands 17-180


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:OptimizationSetup1",
"UseFastCalculationUpdateAlgo:=", False,
"FastCalcOptCtrledByUser:=", False,
"IsEnabled:=", True,
"SaveSolutions:=", False,
Array(
"NAME:StartingPoint"
),
"Optimizer:=", "Quasi Newton",
Array(
"NAME:AnalysisStopOptions",
"StopForNumIteration:=" , True,
"StopForElapsTime:=", False,
"StopForSlowImprovement:=", False,
"StopForGrdTolerance:=", False,
"MaxNumIteration:=", 1001,
"MaxSolTimeInSec:=", 3600,
"RelGradientTolerance:=", 0,
"MinNumIteration:=" , 10
),
"CostFuncNormType:=", "L2",

Optimetrics Module Script Commands 17-181


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PriorPSetup:=", "",
"PreSolvePSetup:=", True,
Array(
"NAME:Variables"
),
Array(
"NAME:LCS"
),
Array(
"NAME:Goals",
Array(
"NAME:Goal",
"ReportType:=", "Standard",
"Solution:=", "TR3",
Array(
"NAME:SimValueContext",
"SimValueContext:=",
Array(1,0,2,0,False,False,-1,1,0,1,1,"",0,0)
),

Optimetrics Module Script Commands 17-182


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Calculation:=", "mag(DIFF1.VAL)",
"Name:=", "DIFF1.VAL",
Array(
"NAME:Ranges",
"Range:=", Array("Var:=", "Time","Type:=", "a")
),
"Condition:=", "==",
Array(
"NAME:GoalValue",
"GoalValueType:=", "Independent",
"Format:=", "Real/Imag",
"bG:=", Array("v:=", "Array(1;]")
),
"Weight:=", "Array(1;]"
)
),
"Acceptable_Cost:=", 0,
"Noise:=", 0.0001,
"UpdateDesign:=", False,
"UpdateIteration:=", 5,
"KeepReportAxis:=", True,

Optimetrics Module Script Commands 17-183


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UpdateDesignWhenDone:=", True
))

InsertSetup [Sensitivity]
Inserts a new sensitivity setup.

UI Access Right-click Optimetrics in the project tree, and then click Add>Sensitivity on the shortcut menu.

Name Type Description


<SensitivityParams> Array Array("NAME:<SetupName>", "SaveFields:=",
<SaveField>, <StartingPoint>, "MaxIterations:=",
<MaxIter>, "PriorPSetup:=", <PriorSetup>,
"PreSolvePSetup:=", <Preceed>, <SensitivityVars>,
<Constraint>,
Array("NAME:Goals", Array("NAME:Goal",
Parameters <OptiGoalSpec>), ..., Array("NAME:Goal",
<OptiGoalSpec>)), "Primary Goal:=". <PrimaryGoalID>,
"PrimaryError:=", <PrimaryError>)
<SensitivityVars> Array Array("NAME:Variables",
"VarName:=", Array("i:=", <IncludeVar>,
"Min:=", <MinV>, "Max:=", <MaxV>,
"IDisp:=", <InitialDisp>),...
"VarName:=", Array("i:=", <IncludeVar>,

Optimetrics Module Script Commands 17-184


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Min:=", <MinV>, "Max:=", <MaxV>,


"IDisp:=", <InitialDisp>))
<InitialDisp> VarValue Index of the Primary goal. Index starts from zero.
<PrimaryError> Double Error associated with the Primary goal.

Return Value None

Python Syntax InsertSetup ("OptiSensitivity", <SensitivityParams>)


oModule.InsertSetup(
"OptiSensitivity", _
["NAME:SensitivitySetup1",_
"SaveFields:=", true,_
["NAME:StartingPoint"], _
"MaxIterations:=", 20,_
"PriorPSetup:=", "",_
Python Example
"PreSolvePSetup:=", true, _
["NAME:Variables"], _
["NAME:LCS"],_
"NAME:Goals",_
["NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "returnloss",_

Optimetrics Module Script Commands 17-185


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Context:=", "",_
["NAME:Ranges",_
"Range:=", ["Var:=", "Freq", "_
Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz"]]],_
["NAME:Goal",_
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect",_
"Context:=", "",_
["NAME:Ranges",_
"Range:=", ["Var:=","Freq",_
"Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz"]]]],_
"Primary Goal:=", 1,_
"PrimaryError:=", 0.001])

VB Syntax InsertSetup "OptiSensitivity", <SensitivityParams>


oModule.InsertSetup
VB Example
"OptiSensitivity", _

Optimetrics Module Script Commands 17-186


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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"))),_
Array("NAME:Goal",_
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect",_

Optimetrics Module Script Commands 17-187


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Context:=", "",_
Array("NAME:Ranges",_
"Range:=", Array("Var:=","Freq",_
"Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz")))),_
"Primary Goal:=", 1,_
"PrimaryError:=", 0.001)

Statistical Script Commands


EditSetup [Statistical]
InsertSetup Statistical
EditSetup [Statistical]
Modifies an existing statistical setup.

UI Access Right-click the setup in the project tree, and clickProperties on the shortcut menu.

Name Type Description


Parameters <SetupName> String Name of the Setup

Return Value None

Optimetrics Module Script Commands 17-188


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax EditSetup (<SetupName>, <StatisticalParams>)


Python Example See EditSetup [Optimization]

VB Syntax EditSetup <SetupName>, <StatisticalParams>


VB Example See EditSetup [Optimization]

Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("optiguides")
Set oDesign = oProject.SetActiveDesign("HFSSModel1")
Set oModule = oDesign.GetModule("Optimetrics")
oModule.EditSetup "StatisticalSetup1", Array("NAME:StatisticalSetup1",
Array("NAME:ProdOptiSetupData",

Optimetrics Module Script Commands 17-189


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SaveFields:=", true, "CopyMesh:=", false),


Array("NAME:StartingPoint", "$length:=", "7.824547736mm",
"$width:=", "14.8570192mm"),
"MaxIterations:=", 50,
"PriorPSetup:=", "",
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"),
"$width:=", Array("i:=", true,
"int:=", false,
"Dist:=", "Gaussian",
"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.02",
"Mean:=", "0.4mm")),

Array("NAME:Goals", Array("NAME:Goal",
"ReportType:=", "Modal Solution Data",

Optimetrics Module Script Commands 17-190


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Solution:=", "Setup1 : PortOnly",


Array("NAME:SimValueContext", "Domain:=", "Sweep"),
"Calculation:=", "returnloss",
"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]
Inserts a new statistical setup.

UI Access Right-click Optimetrics in the project tree, and then click Add>Statistical on the shortcut menu.

Name Type Description


<StatisticalParams> Array Array("NAME:<SetupName>", "SaveFields:=",

Parameters <SaveField>, <StartingPoint>, "MaxIterations:=",


<MaxIter>, "PriorPSetup:=", <PriorSetup>,
"PreSolvePSetup:=", <Preceed>, <StatisticalVars>,

Optimetrics Module Script Commands 17-191


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Goals", Array("NAME:Goal",
<OptiGoalSpec>), …, Array("NAME:Goal",
<OptiGoalSpec>)))
<StatisticalVars> Array Array("NAME:Variables",
"VarName:=", Array("i:=", <IncludeVar>, "Dist:=",
<DistType>, "Tol:=", <Tolerance>,
"StdD:=", <StdD>, "Min:=", <MinCutoff>, "Max:=",
<MaxCutoff>, ...
"VarName:=", Array("i:=", <IncludeVar>, "Dist:=",
<DistType>, "Tol:=", <Tolerance>, "StdD:=",
<StdD>, "Min:=", <MinCutoff>, "Max:=",
<MaxCutoff>))
<DistType> String Distrbution can be "Gaussian" or "Uniform".
<Tolerance> VarValue The tolerance for the variable when distribution is Uniform
<StdD> VarValue The standard deviation for the variable when distribution is Gaussian.
<MinCutoff> Double The minimum cut-off for the variable when distribution is Gaussian.
<MaxCutoff> Double The maximum cut-off for the variable when distribution is Gaussian.

Return Value None

Python Syntax InsertSetup ("OptiStatistical", <StatisticalParams>)


Python Example oModule.InsertSetup(

Optimetrics Module Script Commands 17-192


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"OptiStatistical", _
["NAME:StatisticalSetup1", _
"SaveFields:=", true, _
["NAME:StartingPoint"],_
"MaxIterations:=", 50,_
"PriorPSetup:=", "", _
["NAME:Variables"], _
["NAME:Goals", _
["NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "returnloss", _
"Context:=", "", _
["NAME:Ranges", _
"Range:=", ["Var:=", "Freq", _
"Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz"]]],_
["NAME:Goal",_
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect",_
"Context:=", "", _

Optimetrics Module Script Commands 17-193


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["NAME:Ranges",_
"Range:=", ["Var:=", "Freq", "Type:=",_
"s", "Start:=", "8GHz", "Stop:=", "8GHz"]]]])

VB Syntax InsertSetup "OptiStatistical", <StatisticalParams>


oModule.InsertSetup
"OptiStatistical", _
Array("NAME:StatisticalSetup1", _
"SaveFields:=", true, _
Array("NAME:StartingPoint"),_
"MaxIterations:=", 50,_
"PriorPSetup:=", "", _
VB Example
Array("NAME:Variables"), _
Array("NAME:Goals", _
Array("NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "returnloss", _
"Context:=", "", _
Array("NAME:Ranges", _

Optimetrics Module Script Commands 17-194


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Range:=", Array("Var:=", "Freq", _


"Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz"))),_
Array("NAME:Goal",_
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect",_
"Context:=", "", _
Array("NAME:Ranges",_
"Range:=", Array("Var:=", "Freq", "Type:=",_
"s", "Start:=", "8GHz", "Stop:=", "8GHz"))))

Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()

Optimetrics Module Script Commands 17-195


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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:StatisticalSetup1",
Array("NAME:ProdOptiSetupData",
"SaveFields:=", false, "CopyMesh:=", false),
Array("NAME:StartingPoint", "offset:=", "0in"),
"MaxIterations:=", 50, "PriorPSetup:=", "",
Array("NAME:Variables",
"offset:=", Array("i:=", true,
"int:=", false,
"Dist:=", "Gaussian",
"Tol:=", "10%",
"StdD:=", ".5in",
"Min:=", "-3",
"Max:=", "3",
"Shape:=", "1",
"Scale:=", "0in",
"Location:=", "0in",
"Dataset:=", "",
"LatinHypercube:=", "true",
"VarMin:=", "-1in",

Optimetrics Module Script Commands 17-196


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"VarMax:=", "1in",
"Prob:=", "0.01",
"Mean:=", "0in")),

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")))))

For Q3D Extractor and Circuit the command details are as follows:
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",

Optimetrics Module Script Commands 17-197


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<OptiGoalSpec>))),
<StatisticalVars>
Array("NAME:Variables",
"VarName:=", Array("i:=", <IncludeVar>, "Dist:=",
<DistType>, "Tol:=", <Tolerance>,
"StdD:=", <StdD>, "Min:=", <MinCutoff>, "Max:=",
<MaxCutoff>, ...
"VarName:=", Array("i:=", <IncludeVar>, "Dist:=",
<DistType>, "Tol:=", <Tolerance>, "StdD:=",
<StdD>, "Min:=", <MinCutoff>, "Max:=",
<MaxCutoff>))
Parameters:
<DistType>
Type : <string>
Distrbution can be "Gaussian" or "Uniform".
<Tolerance>
Type: <VarValue>
The tolerance for the variable when distribution is Uniform.
<StdD>
Type: <VarValue>

Optimetrics Module Script Commands 17-198


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

The standard deviation for the variable when distribution is Gaussian.


<MinCutoff>
Type: <double>
The minimum cut-off for the variable when distribution is Gaussian.
<MaxCutoff>
Type: <double>
The maximum cut-off for the variable when distribution is Gaussian.
Example: oModule.InsertSetup "OptiStatistical", _
Array("NAME:StatisticalSetup1", _
"SaveFields:=", true, _
Array("NAME:StartingPoint"),_
"MaxIterations:=", 50,_
"PriorPSetup:=", "", _
Array("NAME:Variables"), _
Array("NAME:Goals", _
Array("NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "returnloss", _
"Context:=", "", _
Array("NAME:Ranges", _
"Range:=", Array("Var:=", "Freq", _

Optimetrics Module Script Commands 17-199


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz"))),_
Array("NAME:Goal",_
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect",_
"Context:=", "", _
Array("NAME:Ranges",_
"Range:=", Array("Var:=", "Freq", "Type:=", _
"s", "Start:=", "8GHz", "Stop:=", "8GHz"))))

Optimetrics Module Script Commands 17-200


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

18 - Solutions Module Script Commands


Solutions commands should be executed by the "Solutions" module.
Set oModule = oDesign.GetModule("Solutions")
oModule.CommandName <args>
DeleteImportData
DeleteSolutionVariation
EditSources
ExportEigenmodes
ExportForHSpice
ExportNetworkData
ExportNMFData
GetAdaptiveFreq
GetAvailableVariations
GetExcitationScaling
GetISolutionVersionID
GetSolveRangeInfo
GetValidISolutionList
HasFields
HasMatrixData
HasMesh

Solutions Module Script Commands 18-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ImportSolution
ImportTable
IsFieldAvailableAt
ListMatchingVariations
ListValuesOfVariables
ListVariations

DeleteImportData
Deletes imported solution or table data in HFSS. Not in HFSS-IE

UI Access Right-click on Results > Import Solutions, click Delete Selections button.

Name Type Description


Parameters <ImportSpecArray> Array Array of import solutions.
Array(<ImportName:SolnName OR TableName>, ...)

Return Value None.

Python Syntax DeleteImportData(<ImportSpecArray>)


oModule.DeleteImportData([
Python Example "Import1:Adaptive_1", "Import2:DataTable"
])

Solutions Module Script Commands 18-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax DeleteImportData <ImportSpecArray>


oModule.DeleteImportData _
VB Example
Array("Import1:Adaptive_1", "Import2:DataTable")

DeleteSolutionVariation
Deletes all solution data for specific solutions and design variations. This is obsolete and is supported only for backward compatibility.
You should use DeleteFullVariation, DeleteFieldVariation, and DeleteLinked Variation.

UI Access Right-click on Results, select Browse Solutions..., click Delete button in the dialog.

Name Type Description


<SoluParams> Array Structured array.
Array(<DataSpecifierArray>, ...)
Parameters
<DataSpecifierArray> Array Structured array.
Array(<DesignVariationKey>, <SetupName>, <Sol-
nName>)

Return Value None.

Python Syntax DeleteSolutionVariation(<SoluParams>)


oModule.DeleteSolutionVariation([
["width=’2in’", "Setup1", "Adaptive_1"],
Python Example
["width=’2in’", "Setup1", "Sweep1"]
])

Solutions Module Script Commands 18-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax DeleteSolutionVariation <SoluParams>


oModule.DeleteSolutionVariation Array( _
VB Example Array("width=’2in’", "Setup1", "Adaptive_1"), _
Array("width=’2in’", "Setup1", "Sweep1"))

DeleteVariation [HFSS]
Obsolete. Replaced by DeleteFullVariation, DeleteFieldVariation, and DeleteLinked Variation.

EditSources
Indicates which source excitations should be used for fields post-processing.

For HFSS, the command details are as follows.


Indicates which source excitations should be used for fields post processing.
Command: HFSS or HFSS-IE>Fields>Edit Sources
Syntax: EditSources([["Name:=", "<portName>" , <keyword>, <value>, ...]...]
Return Value: None
Parameters:
Each inner block describes the values to be assigned to an individual excitation. The valid keywords are:
Name ​- Required. This identifies the excitation and uses the same syntax as the edit source dialog box. As opposed to the old
command, names can be specified in any order. Unspecified excitations will not be affected, so users can edit one or more excit-
ations without needing to edit them all.
Magnitude ​- a unit quantity ("1W", "2mV", …)

Solutions Module Script Commands 18-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Phase ​- a unit quantity ("1W", "2mV", …)


For Driven Terminal designs, a terminal may be terminated
Terminated ​- boolean ("true", "false"). If terminated, Magnitude and Phase are superseded with:
Resistance ​- a unit quantity ("50ohm", …)
Reactance ​- a unit quantity ("50ohm", …)
For Transient problems, the spectral fields use Magnitude and Phase. The transient fields are controlled by:
Delay- ​a unit quantity ("3.5ps", …)
TransientMagnitude ​- a unit quantity ("1W", …)
For CMA problems, the special excitation "Modes" specifies the modal excitations. These are then set with the keywords:
Magnitudes - integer vector [ "0", "0", "1", "2.5" ]. The size of the vector will determine how many modes are visible in the
dialog.
Phases ​- unit quantity vector [ "30deg", ... ]. The size of the vector must match the size of the magnitude vector.
For Eigen problems the special excitation "Modes" specifies the modal excitations. These are then set with the keywords:
Magnitudes - integer vector [ "0", "0", "1", "2.5" ]. The size of the vector must match the design,
Phases​- unit quantity vector [ "30deg", ... ]. The size of the vector must match the design. :Phases is not needed for Stored
Energy fields.
Optional settings that apply to all sources
Incident Power​- unit quantity ("2.5W"). Use in system gain calculations
SpecifySystemPower - boolean. If set, the above power is used. Otherwise, the maximum power is calculated.
FieldType - string. One of
ScatteredFields
TotalFields

Solutions Module Script Commands 18-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

IncidentFields
NoIncidentWave
EigenPeakElecticField
EigenStoredEnergy
IncludePortPostProcessing - boolean
For Driven Terminal designs, a terminal may be terminated
UseIncidentVoltage - boolean - otherwise use total voltage
For CMA problems:
ExciteModes - boolean. If true use modal excitations, otherwise use terminals. Terminal excitations are specified by their
name, magnitude, and phase
For Eigen problems:
The special excitation "Modes" specifies the modal excitations. These are then set with the keywords
For all unit quantities, expressions ( "3 * my_var", "pwl( freq, ds1 )") are permitted as well.

ExportEigenmodes
Exports a tab delimited table of Eigenmodes in HFSS. Not in HFSS-IE.

UI Access N/A

Name Type Description


<SoluName> String Name of specified solution.
Parameters
<DesignVariation> String Design variation key.
<FileName> String Output file name with path.

Solutions Module Script Commands 18-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax ExportEigenmodes(<SoluName>, <DesignVariation>, <FileName>)


oModule.ExportEigenmodes(
Python Example "Setup1 : LastAdaptive", "",
"C:\mydir\myeigenmode.eig")

VB Syntax ExportEigenmodes <SoluName>, <DesignVariation>, <FileName>


oModule.ExportEigenmodes _
VB Example "Setup1 : LastAdaptive", "", _
"C:\mydir\myeigenmode.eig"

ExportForHSpice
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.

UI Access N/A

Name Type Description


<DesignVariation> String Desgin variation key.
<SoluSelections> Array Array of selected solutions.
Parameters
<SpiceType> Integer 1 - HSpice.
<BandWidth> Integer 0 - Low (narrow) band width.
<FWSFile> String Full wave spice file name.

Solutions Module Script Commands 18-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<LumpedElementFile> String Lumped element file name.


<PoleZeroSpiceFile> String Pole zero spice file name.
<PoleZeroMatlabFile> String Pole zero Matlab file name.
<PartialFractionFile> String Partial fraction file name.
<FittingError> Double The accuracy to use in fitting the pole zero model.
<MinimumOrder> Integer Minimum number of poles in rational function expansion.
<MaximumOrder> Integer Maximum number of poles in rational function expansion.
<UseCommonGround> Integer Optional. 1 to use common ground, 0 otherwise.
<EnforcePassivity> Integer Optional. 1 to enforce passivity, 0 otherwise.

Return Value None.

ExportForHSpice(<DesignVariation>, <SoluSelections>, <SpiceType>, <BandWidth>, <FWSFile>,


Python Syntax <LumpedElementFile>, <PoleZeroSpiceFile>, <PoleZeroMatlabFile>, <PartialFractionFile>, <FittingError>,
<MinimumOrder>, <MaximumOrder>, [Optional <UseCommonGround>], [Optional <EnforcePassivity>])
oModule.ExportForHSpice("width=’2in’",
["Setup1:Sweep1"], 1, 0,
Python Example
"c:\mydir\Sweep1.fws", "", "", "", "",
.005, 20, 200)

ExportForHSpice <DesignVariation>, <SoluSelections>, <SpiceType>, <BandWidth>, <FWSFile>, <LumpedEle-


VB Syntax mentFile>, <PoleZeroSpiceFile>, <PoleZeroMatlabFile>, <PartialFractionFile>, <FittingError>,
<MinimumOrder>, <MaximumOrder>, [Optional <UseCommonGround>], [Optional <EnforcePassivity>]
oModule.ExportForHSpice "width=’2in’", _
VB Example Array("Setup1:Sweep1"), 1, 0, _
"c:\mydir\Sweep1.fws", "", "", "", "", _

Solutions Module Script Commands 18-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

.005, 20, 200

ExportNetworkData
Exports matrix solution data to a file. Available only for Driven solution types with ports.

UI Access N/A

Name Type Description


<DesignVariationKey> String Design variation key. Pass empty string for the current nominal vari-
ation.
<SolnSelectionArray> Array Array of selected solutions.
Array(<SolnSelector>, <SolnSelector>, ...)
If more than one array entry, this indicates a combined Interpolating
sweep.
<SolnSelector> String Solution setup name and solution name, separated by a colon.
<FileFormat> Integer File format value.
2 : Tab delimited spreadsheet format (.tab)
Parameters
3 : Touchstone (.sNp)
4 : CitiFile (.cit)
7 : Matlab (.m)
8 : Terminal Z0 spreadsheet
<OutFile> String Full path to the file to write out.
<FreqsArray> Array The frequencies to export. The <FreqsArray> argument contains a
vector (e.g. "1GHz", "2GHz", ...) to use, or "all". To export all fre-
quencies, use Array("all"). If no frequencies are specified, all fre-
quencies are used.
<DoRenorm> Boolean Specifies whether to renormalize the data before export.

Solutions Module Script Commands 18-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<RenormImped> Double Real impedance value in ohms, for renormalization. Required in syn-
tax, but ignored if DoRenorm is false.
<DataType> String Optional. Type: "S", "Y", or "Z". The matrix to export.
<pass> Integer Optional. 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> Integer Optional. Type: "0", "1", or "2"
The format to use for the exported data.
0 = Magnitude/Phase.
1= Real/Imaginary.
2= db/Phase.
<Precision> Integer Optional. Touchstone number of digits precision. Default if not spe-
cified is 15.
<UseExportFreqs> Boolean Specifies whether to use export frequencies.
<IncludeGammaComments> Boolean Specifies whether to include Gamma and Impedance comments.
<SupportNonStdExport> Boolean Specifies whether to support non-standard Touchstone extensions
for mixed reference impedance.

Return Value None.

ExportNetworkData(<DesignVariationKey>, <SolnSelectionArray>, <SolnSelector>, <FileFormat>, <OutFile>, <Fre-


Python qsArray>, <DoRenorm>, <RenormImped>, [Optional <DataType>], [Optional <pass>], [Optional <ComplexFormat>],
Syntax [Optional <Precision>], [Optional <UseExportFreqs>], [Optional <IncludeGammaComments>], [Optional <Sup-
portNonStdExport>])

Python oModule.ExportNetworkData("", ["Setup1:Sweep1"], 3, "C://Documents/package_


Example HFSSDesign1.s4p",

Solutions Module Script Commands 18-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

['all'], True, 50, "S", -1, 0, 15, True, True, True

ExportNetworkData <DesignVariationKey>, <SolnSelectionArray>, <SolnSelector>, <FileFormat>, <OutFile>,


<FreqsArray>, <DoRenorm>, <RenormImped>, [Optional <DataType>], [Optional <pass>], [Optional <Com-
VB Syntax
plexFormat>], [Optional <Precision>], [Optional <UseExportFreqs>], [Optional <IncludeGammaComments>],
[Optional <SupportNonStdExport>]
oModule.ExportNetworkData "width=’2in’", _
Array("Setup1:Sweep1"),2, "c:\mydir\out.tab", _
Array("all"), false, 0
VB Example oModule.ExportNetworkData "width=’2in’", _
Array("Setup1:Sweep1", "Setup1:Sweep2"), 3, _
"c:\mydir\out.s2p", Array(1.0e9, 1.5e9, 2.0e9), _
true, 50.0

ExportNMFData [HFSS]
Exports matrix solution data to a file in neutral model format. Available only for Driven solution types with ports. Variables can be held
constant by setting their values in the variation field. For example: "length='50mm' width='30mm'". All other independent variables will
be treated as NMF parameters.

UI Access N/A

Name Type Description


<SolnSelectionArray> Array Array of selected solutions.
Parameters <OutFile> String Full path to the file to write out.
<FreqsArray> Array The frequencies to export. The <FreqsArray> argument contains a vec-
tor (e.g. "1GHz", "2GHz", ...) to use, or "all". To export all frequencies,

Solutions Module Script Commands 18-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

use Array("all"). If no frequencies are specified, all frequencies are used.


<DesignVariationKey> String Design variation.
<DoRenorm> Boolean Specifies whether to renormalize the data before export.
<RenormImped> Double Real impedance value in ohms, for renormalization. Required in syntax,
but ignored if DoRenorm is false.
<Pass> Integer Optional. The pass to export. This is ignored if the sourceName is a fre-
quency sweep. Leaving out this value or specifying -1 gets all passes.

Return Value None.

ExportNMFData(<SolnSelectionArray>, <OutFile>, <FreqsArray> <DesignVariationKey>, <DoRenorm>,


Python Syntax
<RenormImped>)
oModule.ExportNMFData(["Setup1:Sweep1"],
Python Example
"c:\mydir\out.nmf", ["all"], "", False, 0)

ExportNMFData <SolnSelectionArray>, <OutFile>, <FreqsArray> <DesignVariationKey>, <DoRenorm>,


VB Syntax
<RenormImped>
oModule.ExportNMFData Array("Setup1:Sweep1"), _
VB Example
"c:\mydir\out.nmf", Array("all"), "", false, 0

ExportTransientData
Exports transient solution data to a file.

Solutions Module Script Commands 18-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access HFSS > Results > Solution Data..., then click Export.

Name Type Description


<SoluName> String Name of specified solution.
<Variation> String Design variation key. Pass empty string for the current nominal variation.
<FileName> String Full path of output file.
<DataType> String Optional. Type of output data.
<DataFormat> String Optional. Format of output data.
Parameters
.csv - Comma Delimited Data.
.tab - Tab Delimited Data files.
.dat - Ansys Plot Data files
.txt - Post Processing Files

Return Value None.

Python Syntax ExportTransientData(<SoluName>, <Variation>, <FileName>)


Python Example oModule.ExportTransientData("Setup1:Transient", "", "C:/transient_solu1.csv")

VB Syntax ExportTransientData <SoluName>, <Variation>, <FileName>


VB Example oModule.ExportTransientData "Setup1:Transient", "", "C:/transient_solu1.csv"

FFTOnReport
Performs an FFT on a selected report.

Solutions Module Script Commands 18-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Right-click on Results in the project tree, select Perform FFT On Report...

Name Type Description


<ReportName> String Name of specified report.
<WindowName> String Name of window to apply for FFT. Possible values are "Rectangular", "Tri",
Parameters "Van Hann", "Hamming", "Blackman", "Lanczos", "Weber", "Welch".
<Function> String Function to apply on transformation values. Possible values are "none", "ang_
deg", "ang_rad", "arg", "cang_deg", "cang_rad", "dB", "dB1 normalize",
"dB20normalize", "dBc", "im", "mag", "normalize", "re".

Return Value None.

Python Syntax FFTOnReport <ReportName>, <WindowName>, <Function>


Python Example oModule.FFTOnReport("XY Plot 1", "Rectangular", "dB")

VB Syntax FFTOnReport(<ReportName>, <WindowName>, <Function>)


VB Example oModule.FFTOnReport "XY Plot 1", "Rectangular", "dB"

GetAdaptiveFreq
Obtains an adaptive frequency for a specified setup.

UI Access N/A

Name Type Description


Parameters
<SetupName> String Name of specified setup.

Solutions Module Script Commands 18-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value Double frequency value.

Python Syntax GetAdaptiveFreq(<SetupName>)


Python Example oModule.GetAdaptiveFreq("Setup1")

VB Syntax GetAdaptiveFreq <SetupName>


VB Example oModule.GetAdaptiveFreq "Setup1"

GetAdaptiveSettings
Obtains the adaptive frequency settings of a specified setup.

UI Access N/A

Name Type Description


Parameters
<SetupName> String Name of specified setup.

Return Value Array of stings represents adaptive frequency settings.

Python Syntax GetAdaptiveSettings(<SetupName>)


Python Example oModule.GetAdaptiveSettings("Setup1")

VB Syntax GetAdaptiveSettings <SetupName>

Solutions Module Script Commands 18-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oModule.GetAdaptiveSettings "Setup1"

GetAllSourceMagnitudes
Obtains the magnitude values of all defined sources.

UI Access N/A
Parameters None.
Return Value Array of strings containing magnitude values.

Python Syntax GetAllSourceMagnitudes()


Python Example oModule.GetAllSourceMagnitudes()

VB Syntax GetAllSourceMagnitudes
VB Example oModule.GetAllSourceMagnitudes

GetAllSourceModes
Obtains mode information of all defined sources.

UI Access N/A
Parameters None.
Return Value Array of strings containing mode information.

Solutions Module Script Commands 18-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetAllSourceModes()


Python Example oModule.GetAllSourceModes()

VB Syntax GetAllSourceModes
VB Example oModule.GetAllSourceModes

GetAllSourcePhases
Obtains the phase values of all defined sources.

UI Access N/A
Parameters None.
Return Value Array of strings containing phase values.

Python Syntax GetAllSourcePhases()


Python Example oModule.GetAllSourcePhases()

VB Syntax GetAllSourcePhases
VB Example oModule.GetAllSourcePhases

Solutions Module Script Commands 18-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetAllSources
Retrieves all sources defined in the current solution setup.

UI Access N/A
Parameters None.
Return Value Array of strings containing source names.

Python Syntax GetAllSources()


Python Example oModule.GetAllSources()

VB Syntax GetAllSources
VB Example oModule.GetAllSources

GetAntennaParameters
Retrieves antenna parameters defined in a specified setup.

UI Access N/A

Name Type Description


Parameters
<SetupName> String Name of specified setup.

Return Value Array of strings containing antenna parameters.

Solutions Module Script Commands 18-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetAntennaParameters(<SetupName>)


Python Example oModule.GetAntennaParameters("Setup1")

VB Syntax GetAntennaParameters <SetupName>


VB Example oModule.GetAntennaParameters "Setup1"

GetAvailableVariations
Returns the available variation for a solution.

UI Access N/A

Name Type Description


Parameters
<SoluName> String Name of specified solution.

Return Value Array of strings containing available variations.

Python Syntax GetAvailableVariations(<SoluName>)


Python Example oModule.GetAvailableVariations("Setup1 : LastAdaptive")

VB Syntax GetAvailableVariations <SoluName>


VB Example oModule.GetAvailableVariations "Setup1 : LastAdaptive"

Solutions Module Script Commands 18-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetEditSourcesCount
For Characteristic Mode Analysis (CMA), returns the number of sources listed in the Edit Sources panel.

UI Access N/A
Parameters None.
Return Value Integer number of sources.

Python Syntax GetEditSourcesCount()


Python Example oModule.GetEditSourcesCount()

VB Syntax GetEditSourcesCount
Dim count
VB Example
count = oModule.GetEditSourcesCount

GetExcitationScaling
Gets source scaling parameters.

UI Access N/A

Name Type Description


Parameters
<portName> String Port ID.

Solutions Module Script Commands 18-20


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<Index> Integer Optional. Port/mode/terminal/eigenmode index, if present.

Return Value Array of strings containing source scaling parameters.

Python Syntax GetExcitationScaling(<portName>, <portIndex>)


Python Example oDesign.GetExcitationScaling("Port1", 2)

VB Syntax GetExcitationScaling(<portName>, <portIndex>)


VB Example oDesign.GetExcitationScaling("Port1", 2)

GetFieldType
Gets the field type of a driven modal design solution.

UI Access N/A
Parameters None.
Return Value String containing field type.

Python Syntax GetFieldType()


Python Example oModule.GetFieldType()

VB Syntax GetFieldType

Solutions Module Script Commands 18-21


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oModule.GetFieldType

GetIncludePortPostProcessing
Determines whether the Include Port Post Processing Effects option is enabled.

UI Access N/A
Parameters None.

Integer.

Return Value l 1 - Include Port Post Processing Effects is enabled.

l 0 - Include Port Post Processing Effects is disabled.

Python Syntax GetIncludePortPostProcessing()


Python Example oModule.GetIncludePortPostProcessing()

VB Syntax GetIncludePortPostProcessing
VB Example oModule.GetIncludePortPostProcessing

GetMultipactionBreakdown
Gets multipaction breakdown from the specified setup.

Solutions Module Script Commands 18-22


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A

Name Type Description


Parameters <SetupName> String Name of specified setup.
<Variation> String Design variation. Pass empty string for the current nominal variation.

Return Value Array of string containing the multipaction breakdown.

Python Syntax GetMultipactionBreakdown(<SetupName>, <Variation>)


Python Example oModule.GetMultipactionBreakdown("Setup1", "")

VB Syntax GetMultipactionBreakdown <SetupName>, <Variation>


VB Example oModule.GetMultipactionBreakdown "Setup1", ""

GetNetworkDataSolution
Gets matrix data solution from a specified setup.

UI Access N/A

Name Type Description


Parameters <SoluName> String Name of solution.
<VariationKey> String Design variation key. Pass empty string for the current nominal variation.

Return Value String containing matrix data.

Solutions Module Script Commands 18-23


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetNetworkDataSolution(<SoluName>, <VariationKey>)


Python Example oModule.GetNetworkDataSolution("Setup1:Sweep1", "")

VB Syntax GetNetworkDataSolution <SoluName>, <VariationKey>


VB Example oModule.GetNetworkDataSolution "Setup1:Sweep1", ""

GetNetworkDataSolutionDefinition
Gets definition of network data solution from a specified setup.

UI Access N/A

Name Type Description


Parameters
<SoluName> String Name of specified solution.

Return Value String containing network data definition.

Python Syntax GetNetworkDataSolutionDefinition(<SoluName>)


Python Example oModule.GetNetworkDataSolutionDefinition("Setup1:Sweep1")

VB Syntax GetNetworkDataSolutionDefinition <SoluName>


VB Example oModule.GetNetworkDataSolutionDefinition "Setup1:Sweep1"

Solutions Module Script Commands 18-24


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetNetworkPostprocSetup
Obtains network post-processing setup.

UI Access N/A
Parameters None.
Return Value String containing post-processing setup.

Python Syntax GetNetworkPostprocSetup()


Python Example oModule.GetNetworkPostprocSetup()

VB Syntax GetNetworkPostprocSetup
VB Example oModule.GetNetworkPostprocSetup

GetISolutionVersionID
Use: To obtain the solution ID to help track solution validity.
Syntax: GetISolutionVersionID(BSTR fullSolutionName)
Return Value: Returns a solution ID.
Parameters: None
VB Example:
versionID = oModule.GetISolutionVersionID(BSTR fullSolutionName)

Solutions Module Script Commands 18-25


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetSolveRangeInfo
Determines 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 fre-
quency.

UI Access N/A

Name Type Description


Parameters <SoluName> String Name of specified solution.
<IncludeRangeFieldSaved> Boolean Optional. Specify whether to only include the range with field saved.

Return Value Array of strings containing frequency values.

Python Syntax GetSolveRangeInfo(<SoluName>, [Optional <IncludeRangeFieldSaved>])


Python Example oModule.GetSolveRangeInfo("Setup1:Sweep1")

VB Syntax GetSolveRangeInfo <SoluName>, [Optional <IncludeRangeFieldSaved>]


VB Example oModule.GetSolveRangeInfo "Setup1:Sweep1"

GetSourceContexts
Obtains sources currently enabled as context in the Edit Sources dialog Source Context tab.

UI Access N/A

Solutions Module Script Commands 18-26


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters None.
Return Value Array of enabled source names

Python Syntax GetSourceContexts()


Python Example oModule.GetSourceContexts()

VB Syntax GetSourceContexts
VB Example oModule.GetSourceContexts

GetSourceData [HFSS 3D Layout]


Takes a source name as input and returns a VARIANT array containing a data block of the source data.
Command: None
Syntax: GetSourceData
Return Value: Type: Array of i/o block data
Parameters: <SourceName>
Type: string
VB Example: Dim sourceDataArr
sourceDataArr = oDesign.GetSourceData ("SourceName")

GetTerminalExcitationType
Obtains the type for terminal excitation in a driven terminal design.

Solutions Module Script Commands 18-27


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A
Parameters None.
Return Value String containing excitation type.

Python Syntax GetTerminalExcitationType()


Python Example oModule.GetTerminalExcitationType()

VB Syntax GetTerminalExcitationType
VB Example oModule.GetTerminalExcitationType

GetTransientSolveTimes
Gets the transient solution solve time.

UI Access N/A

Name Type Description


Parameters <SoluName> String Name of specified solution.
<Variation> String Design variation. Pass empty string for the current nominal variation.

Return Value Array of strings containing solve time.

Solutions Module Script Commands 18-28


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetTransientSolveTimes(<SoluName>, <Variation>)


Python Example oModule.GetTransientSolveTimes("Setup1:Transient1", "")

VB Syntax GetTransientSolveTimes <SoluName>, <Variation>


VB Example oModule.GetTransientSolveTimes "Setup1:Transient1", ""

GetValidISolutionList
Gets all available solution names that exist in a design.

UI Access N/A

Name Type Description


Parameters <IncludeImportedSolutions> Boolean Optional. Specifies whether to include imported solutions. Default
is false.

Return Value Array of strings containing solution names.

Python Syntax GetValidISolutionList([Optional <IncludeImportedSolutions>])


Python Example oModule.GetValidISolutionList()

VB Syntax GetValidISolutionList [Optional <IncludeImportedSolutions>]


VB Example oModule.GetValidISolutionList

Solutions Module Script Commands 18-29


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

HasFields
Determines if fields exist for a particular solution.

UI Access N/A

Name Type Description


Parameters <SoluName> String Name of specified solution.
<DesignVar> String Design variation.

Return Value Integer (1 - True, 0 - False).

Python Syntax HasFields(<SoluName>, <DesignVar>)


Python Example oModule.HasFields("Setup1:Sweep1", "x_size=2mm")

VB Syntax HasFields <SoluName>, <DesignVar>


VB Example oModule.HasFields "Setup1:Sweep1", "x_size=2mm"

HasMatrixData
Determines if matrix data exists for a particular solution.

UI Access N/A

Name Type Description


Parameters
<SoluName> String Name of specified solution.

Solutions Module Script Commands 18-30


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<DesignVar> String Design variation.

Return Value Integer (1 - True, 0 - False).

Python Syntax HasMatrixData(<SoluName>, <DesignVar>)


Python Example oModule.HasMatrixData("Setup1:Sweep1", "")

VB Syntax HasMatrixData <SoluName>, <DesignVar>


VB Example oModule.HasMatrixData "Setup1:Sweep1", ""

HasMesh
Determines if a current mesh exists for a particular simulation setup, not including the initial mesh.

UI Access N/A

Name Type Description


Parameters <DesignName> String Name of specified design.
<DesignVar> String Design variation.

Return Value Integer (1 - True, 0 - False).

Python Syntax HasMesh(<DesignName>, <DesignVar>)


Python Example oModule.HasMesh("Setup1", "")

Solutions Module Script Commands 18-31


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax HasMesh <DesignName>, <DesignVar>


VB Example oModule.HasMesh "Setup1", ""

ImportSolution
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.

UI Access Right-click on Results > Import Solutions..., click on Import Solution... in the opened dialog window.

Name Type Description


<FileName> String 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
Parameters .tou), and Ansoft Designer (.flp).
<ImportName> String Identifying name to use for the import, analogous to solution setup name.
<SoluArray> Array 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.

Return Value None.

Python Syntax ImportSolution(<FileName>, <ImportName>, <SoluArray>)


oModule.ImportSolution(
Python Example
"c:\mydir\in.s2p", "MeasuredData", ["Sweep1"])

VB Syntax ImportSolution <FileName>, <ImportName>, <SoluArray>

Solutions Module Script Commands 18-32


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.ImportSolution _
VB Example "c:\mydir\in.s2p", _
"MeasuredData", Array("Sweep1")

ImportTable
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 delim-
ited 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.

UI Access Right-click on Results > Import Solutions..., click on Import Table... in the opened dialog window.

Name Type Description


<FileName> String Location of the source data.
<ImportName> String Identifying name to use for the import, analogous to solution setup name.
<TableName> String Identifying name for the table, analogous to solution name.
<IsRealImag> Boolean Whether to use real/imag to interpret data for any complex column. If
false, then use mag/phase(degrees).
Parameters <ContainsSoluData> Boolean Whether contains solution data.
<ColNames> Array Non-empty array used only if intend to override the column names
obtained from the table data file, in which case all column names are
required.
<ColIndepFlags> Array 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.

Return Value None.

Solutions Module Script Commands 18-33


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ImportTable(<FileName>, <ImportName>, <TableName>, <IsRealImag>, <ContainsSoluData>, <ColNames>,


Python Syntax
<ColIndepFlags>)
oModule.ImportTable("c:\mydir\mytable.tab",
Python Example "ImportData", "Measurements", True, True,
[], [True, True, False, False, False])

ImportTable <FileName>, <ImportName>, <TableName>, <IsRealImag>, <ContainsSoluData>, <ColNames>,


VB Syntax
<ColIndepFlags>
oModule.ImportTable "c:\mydir\mytable.tab", _
VB Example "ImportData", "Measurements", true, true, _
Array(), Array(true, true, false, false, false)

IsFieldAvailableAt
Determines if a field solution exists for a particular frequency in a simulation.

UI Access N/A

Name Type Description


<SoluName> String Name of specified solution.
Parameters
<DesignVar> String Design varitaiton.
<Freq> Double Specified frequency.

Return Value Integer ( 1 - True, 0 - False).

Solutions Module Script Commands 18-34


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax IsFieldAvailableAt(<SoluName>, <DesignVar>, <Freq>)


Python Example oModule.IsFieldAvailableAt("Setup1:Sweep1", "", 100.0)

VB Syntax IsFieldAvailableAt <SoluName>, <DesignVar>, <Freq>


VB Example oModule.IsFieldAvailableAt "Setup1:Sweep1", "", 100.0

ListMatchingVariations
Gets a list of solved variations that include the specified variable values.

UI Access N/A

Name Type Description


<SoluName> String Name of specified solutions.
Parameters
<MatchVarNames> Array Array of matching variable names.
<MatchValStrings> Array Array of matching variable value strings including units.

Array of strings corresponding to solved variations. The match variables may be a partial set of design variables
Return Value
and the match values are one per variable in the same order as the variables.

Python Syntax ListMatchingVariations(<SoluName>, <MatchVarNames>, <MatchValStrings>)


oModule.ListMatchingVariations(
Python Example "Setup1:LastAdaptive",
["x_size", "y_size"], ["2mm", "1mm"])

Solutions Module Script Commands 18-35


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax ListMatchingVariations <SoluName>, <MatchVarNames>, <MatchValStrings>


oModule.ListMatchingVariations _
VB Example "Setup1 :LastAdaptive", _
Array("x_size", "y_size"), Array("2mm", "1mm")

ListValuesOfVariable
Gets the values of a specified variable corresponding to the solved variations.

UI Access N/A

Name Type Description


Parameters <SoluName> String Name of specified solution.
<VariableName> String Name of specified variable.

Array of double precision values in SI units interpreted as the specified variable corresponding to the solved vari-
Return Value
ations.

Python Syntax ListValuesOfVariable(<SoluName>, <VariableName>)


Python Example oModule.ListValuesOfVariable("Setup1:LastAdaptive", "x_size")

VB Syntax ListValuesOfVariable <SoluName>, <VariableName>


VB Example oModule.ListValuesOfVariable "Setup1:LastAdaptive", "x_size"

Solutions Module Script Commands 18-36


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ListVariations
Gets a list of solved variations.

UI Access N/A

Name Type Description


Parameters
<SoluName> String Name of specified solution.

Return Value Array of strings corresponding to solved variations.

Python Syntax ListVariations(<SoluName>)


Python Example oModule.ListVariations("Setup1 : LastAdaptive")

VB Syntax ListVariations <SoluName>


VB Example oModule.ListVariations "Setup1 : LastAdaptive"

SetSourceContexts
For Near or Far Field projects for Driven Modal or Driven Terminal Network Analysis Solutions, specifies the port name and all mod-
es/terminals of that port to be enabled as Source Context.

UI Access HFSS > Fields > Edit Sources.

Name Type Description


Parameters
<SourceId> Array Name of modes/terminals to be set as source context.

Return Value None.

Solutions Module Script Commands 18-37


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax SetSourceContexts(<SourceId>)


oModule.SetSourceContexts(
[
Python Example
"Box1_T1", "Box1_T2", "Box1_T3", "Current1", "IncPWave1"
])

VB Syntax SetSourceContexts <SourceId>


oModule.SetSourceContexts _
VB Example
Array("Box1_T1", "Box1_T2", "Box1_T3", "Current1", "IncPWave1")

TDROnReport
Performs a time-domain reflectometry (TDR) analysis on a specified report.

UI Access Right-click on Resutls > Perform TDR On Report...

Name Type Description


<ReportName> String Name of specified report.
<IsStep> Boolean Specifies the input signal as Step or Impulse.
Parameters <RiseTime> Double Specifies rise time with unit in 'ps'.
<WindowName> String Name of window to apply. Possible values are "Rectangular", "Bartlett", "Black-
man", "Hamming", "Hanning", "Kaiser", "Welch".
<WindowWidth> Integer Width of window in percentage.

Solutions Module Script Commands 18-38


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<KaiserParams> Double Optional. If Kaiser window is specified, set corresponding parameters.

Return Value None.

TDROnReport(<ReportName>, <IsStep>, <RiseTime>, <WindowName>, <WindowWidth>, [Optional <Kaiser-


Python Syntax
Params>])
Python Example oModule.TDROnReport("Rept2DRectFreq", True, 1E-12, "Hanning", 100, 1)

TDROnReport <ReportName>, <IsStep>, <RiseTime>, <WindowName>, <WindowWidth>, [Optional <Kaiser-


VB Syntax
Params>]
VB Example oModule.TDROnReport "Rept2DRectFreq", true, 1E-12, "Hanning", 100, 1

Solutions Module Script Commands 18-39


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

18-40
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

19 - Fields Calculator Script Commands


Fields Calculator commands should be executed by the Field Overlays module, which is called "FieldsReporter" in HFSS scripts.
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.CommandName <args>
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

Fields Calculator Script Commands 19-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EnterPoint
EnterQty
EnterScalar
EnterScalarFunc
EnterSurf
EnterVector
EnterVectorFunc
EnterVol
ExportOnGrid [Fields Calculator]
ExportToFile [Fields Calculator]
GetTopEntryValue
LoadNamedExpressions
SaveNamedExpressions

AddNamedExpression
Creates a named expression using the expression at the top of the stack.

UI Access Click Add in the Fields Calculator dialogue.

Name Type Description


Parameters <ExprName> String Name for the new named expression.
<FieldType> String Type of field.

Return Value None.

Fields Calculator Script Commands 19-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax AddNamedExpression(<ExprName>, <FieldType>)


Python Example oModule.AddNamedExpression("Mag_JxE", "Fields")

VB Syntax AddNamedExpression <ExprName>, <FieldType>


VB Example oModule.AddNamedExpression "Mag_JxE", "Fields"

AddNamedExpr
Creates a named expression using the expression at the top of the stack.

UI Access Click Add in the Fields Calculator dialogue.

Name Type Description


Parameters
<ExprName> String Name for the new named expression.

Return Value None.

Python Syntax AddNamedExpr(<ExprName>)


Python Example oModule.AddNamedExpr("Mag_JxE")

VB Syntax AddNamedExpr <ExprName>


VB Example oModule.AddNamedExpr "Mag_JxE"

Fields Calculator Script Commands 19-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CalcOp
Performs a calculator operation.

UI Access Operation commands like Mag, +, etc.

Name Type Description


Parameters
<OpString> String The text on the corresponding calculator button.

Return Value None.

Python Syntax CalcOp(<OpString>)


Python Example oModule.CalcOp("+")

VB Syntax CalcOp <OpString>


VB Example oModule.CalcOp "+"

CalcRead(deprecated)
Reads a file that is written out by the CalcWrite command, and puts the result into a calculator numeric.

UI Access Click Read... in the Fields Calculator dialog.

Name Type Description


Parameters <FileName> String Name of the file to be read.
<SoluName> String Specified solution to read in.

Fields Calculator Script Commands 19-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<VarArray> Array Array of variables to read.

Return Value None.

Python Syntax CalcRead(<FileName>, <SoluName>, <VarArray>)


oModule.CalcRead(
"c:\example.reg",
Python Example
"Setup1: LastAdaptive",
["Freq:=", "10GHz", "Phase:=", "0deg"])

VB Syntax CalcRead <FileName>, <SoluName>, <VarArray>


oModule.CalcRead _
"c:\example.reg", _
VB Example
"Setup1: LastAdaptive", _
Array("Freq:=", "10GHz", "Phase:=", "0deg")

CalculatorRead
Gets a register file and applies it to the calculator stack.

UI Access Click Read... in the Fields Calculator dialog.

Name Type Description


Parameters
<FileName> String Path to and including name of input register file.

Fields Calculator Script Commands 19-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<SoluName> String Specified solution to read in.


<FieldType> String Type of specified field.
<VarArray> Array Array of variable names, value pairs.

Return Value None.

Python Syntax CalculatorRead(<FileName>, <SoluName>, <FieldType>, <VarArray>)


oModule.CalculatorRead(
"c:\example.reg",
Python Example
"Setup1: LastAdaptive", "Fields",
["Freq:=", "10GHz", "Phase:=", "0deg"])

VB Syntax CalculatorRead <FileName>, <SoluName>, <FieldType>, <VarArray>


oModule.CalculatorRead _
"c:\example.reg", _
VB Example
"Setup1: LastAdaptive", "Fields", _
Array("Freq:=", "10GHz", "Phase:=", "0deg")

CalcStack
Performs an operation on the stack.

Fields Calculator Script Commands 19-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Stack operation buttons such as Push and Pop.

Name Type Description


Parameters
<OpString> String The text on the corresponding calculator button.

Return Value None.

Python Syntax CalcStack(<OpString>)


Python Example oModule.CalcStack("push")

VB Syntax CalcStack <OpString>


VB Example oModule.CalcStack "push"

CalculatorWrite
Writes contents of top register to file.

UI Access Click Write... in the Fields Calculator dialog.

Name Type Description


<OutputFilePath> String Path to and including name of output register file.
Parameters
<SoluNameArray> Array Array of strings containing solution names.
<VarArray> Array Array of variable names, value pairs.

Return Value None.

Fields Calculator Script Commands 19-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax CalculatorWrite(<OutputFilePath>, <SoluNameArray>, <VarArray>)


oModule.CalculatorWrite("c:\test.reg",
["Solution:=", "Setup1 : LastAdaptive"],
Python Example
["Freq:=", "1GHz", "Phase:=", "0deg"]
)

VB Syntax CalculatorWrite <OutputFilePath>, <SoluNameArray>, <VarArray>


oModule.CalculatorWrite "c:\test.reg", _
VB Example Array("Solution:=", "Setup1 : LastAdaptive"),_
Array("Freq:=", "1GHz", "Phase:=", "0deg")

CalcWrite
Writes contents of top register to file.

UI Access N/A

Name Type Description


<FilePath> String Path to output and including name of output register file.
Parameters
<SoluName> String Name of solution.
<VariablesArray> Array Array of variable names, value pairs.

Return Value None.

Fields Calculator Script Commands 19-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax CalcWrite(<FilePath>, <SoluName>, <VariablesArray>)


oModule.CalcWrite("C:\Ansoft\smoothedTemp.fld",
Python Example
"Setup1 : LastAdaptive", ["$conductivity:=", "50000000"])

VB Syntax CalcWrite <FilePath>, <SoluName>, <VariablesArray>


oModule.CalcWrite "C:\Ansoft\smoothedTemp.fld", _
VB Example "Setup1 : LastAdaptive", _
Array("$conductivity:=", "50000000")

ChangeGeomSettings
Changes the line discretization setting.

UI Access In the Fields Calculator dialog box, click on Geom Settings...

Name Type Description


Parameters
<LineDiscr> Integer Line discretization value.

Return Value None.

Python Syntax ChangeGeomSettings(<LineDiscr>)


Python Example oModule.ChangeGeomSettings(500)

Fields Calculator Script Commands 19-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax ChangeGeomSettings <LineDiscr>


VB Example oModule.ChangeGeomSettings 500

ClcEval
Evaluates the expression at the top of the stack using the provided solution name and variable values.

UI Access Click Eval in the Fields Calculator dialog.

Name Type Description


<SoluName> String Name of specified solution.
Parameters
<VarArray> Array Array of variable name, value pairs.
<FieldType> String Optional. Type of specified field.

Return Value None.

Python Syntax ClcEval(<SoluName>, <VarArray>, [Optional <FieldType>])


oModule.ClcEval(
"Setup1: LastAdaptive",
Python Example
["Freq:=", "10GHz",
"Phase:=", "0deg"])

VB Syntax ClcEval <SoluName>, <VarArray>, [Optional <FieldType>]

Fields Calculator Script Commands 19-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.ClcEval "Setup1: LastAdaptive", _


VB Example Array ("Freq:=", "10GHz", _
"Phase:=", "0deg")

ClcMaterial
Performs a material operation on the top stack element.

UI Access Click Matl... in the Fields Calculator dialog.

Name Type Description


Parameters <MatString> String The material property to apply.
<OpString> String Name of operation. Possible values are "mult", or "div".

Return Value None.

Python Syntax ClcMaterial(<MatString>, <OpString>)


Python Example oModule.ClcMaterial("Permeability (mu)" "mult")

VB Syntax ClcMaterial <MatString>, <OpString>


VB Example oModule.ClcMaterial "Permeability (mu)" "mult"

ClcMaterialValue
Shows the value of the material property without performing any operation.

Fields Calculator Script Commands 19-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Select None in the Material Operation dialog.

Name Type Description


Parameters
<MaterialName> String Name of specified material property.

Return Value None.

Python Syntax ClcMaterialValue(<MaterialName>)


Python Example oModule.ClcMaterialValue("Mass Density")

VB Syntax ClcMaterialValue <MaterialName>


VB Example oModule.ClcMaterialValue "Mass Density"

ClearAllNamedExpr
Clears all user-defined named expressions from the list.

UI Access Click ClearAll in the Fields Calculator dialog.


Parameters None.
Return Value None.

Python Syntax ClearAllNamedExpr()

Fields Calculator Script Commands 19-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Example oModule.ClearAllNamedExpr()

VB Syntax ClearAllNamedExpr
VB Example oModule.ClearAllNamedExpr

CopyNamedExprToStack
Copies the named expression selected to the calculator stack.

UI Access Select a named expression and then click Copy to stack.

Name Type Description


Parameters
<ExprName> String Name of the expression to be copied to the top of the stack.

Return Value None.

Python Syntax CopyNamedExprToStack(<ExprName>)


Python Example oModule.CopyNamedExprToStack("Mag_JxE")

VB Syntax CopyNamedExprToStack <ExprName>


VB Example oModule.CopyNamedExprToStack "Mag_JxE"

DeleteNamedExpr
Deletes the selected named expression from the list.

Fields Calculator Script Commands 19-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Select a named expression and then click Delete.

Name Type Description


Parameters
<ExprName> String Name of specified named expression.

Return Value None.

Python Syntax DeleteNamedExpr(<ExprName>)


Python Example oModule.DeleteNamedExpr("Mag_JxE")

VB Syntax DeleteNamedExpr <ExprName>


VB Example oModule.DeleteNamedExpr "Mag_JxE"

DoesNamedExpressionExists
Determines whether specified named expression exists.

UI Access N/A

Name Type Description


Parameters
<ExpName> String Name of the specified named expression.

Boolean:

Return Value l 1 - named expression exists.

l 0 - named expression does not exist.

Fields Calculator Script Commands 19-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax DoesNamedExpressionExists(<ExpName>)


Python Example oModule.DoesNamedExpressionExists("Mag_JxE")

VB Syntax DoesNamedExpressionExists <ExpName>


VB Example oModule.DoesNamedExpressionExists "Mag_JxE"

EnterComplex
Enters a complex number onto the stack.

UI Access Click Number, and then click Scalar. Complex option is selected.

Name Type Description


Parameters
<ComplexNum> String String of complex value. Ex. "1 + 2j".

Return Value None.

Python Syntax EnterComplex(<ComplexNum>)


Python Example oModule.EnterComplex("1 + 2 j")

VB Syntax EnterComplex <ComplexNum>


VB Example oModule.EnterComplex "1 + 2 j"

Fields Calculator Script Commands 19-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EnterComplexVector
Enters a complex vector onto the stack.

UI Access Click Number, and then click Vector. Complex option is selected.

Name Type Description


Parameters
<ComplexVector> Array Array of strings containing X, Y and Z complex values.

Return Value None.

Python Syntax EnterComplexVector(<ComplexVector>)


oModule.EnterComplexVector
([
"1 + 2 j",
Python Example
"1 + 2 j",
"1 + 2 j"
])

VB Syntax EnterComplexVector <ComplexVector>


oModule.EnterComplexVector _
VB Example
Array("1 + 2 j",_

Fields Calculator Script Commands 19-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"1 + 2 j",_
"1 + 2 j")

EnterCoord
Enters a coordinate system defined in the 3D Modeler editor.

UI Access Click Geometry and then select Coord.

Name Type Description


Parameters
<CoordName> String Name of a coordinate system defined in the 3D Modeler editor.

Return Value None.

Python Syntax EnterCoord(<CoordName>)


Python Example oModule.EnterCoord("Global")

VB Syntax EnterCoord <CoordName>


VB Example oModule.EnterCoord "Global"

EnterEdge
Enters an edge defined in the 3D Modeler editor.

UI Access N/A

Parameters Name Type Description

Fields Calculator Script Commands 19-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<EdgeName> String Name of an edge defined in the 3D Modeler editor.

Return Value None.

Python Syntax EnterEdge(<EdgeName>)


Python Example oModule.EnterPoint("Edge_1")

VB Syntax EnterEdge <EdgeName>


VB Example oModule.EnterPoint "Edge_1"

EnterLine
Enters a line defined in the 3D Modeler editor.

UI Access Click Geometry and then select Line

Name Type Description


Parameters
<LineName> String Name of a line defined in the 3D Modeler editor.

Return Value None.

Python Syntax EnterLine(<LineName>)


Python Example oModule.EnterLine("Line1")

Fields Calculator Script Commands 19-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax EnterLine <LineName>


VB Example oModule.EnterLine "Line1"

EnterOutputVar
Enters Output Vars, only valid for Eigenmode problems.

UI Access Click Geometry and then select Output Vars.

Name Type Description


Parameters <VarName> String Name of the output vars. Only 'freq' is supported.
<VarType> String Type of the output vars. 'Complex' type.

Return Value None.

Python Syntax EnterOutputVar(<VarName>, <VarType>)


Python Example oModule.EnterOutputVar("Freq", "Complex")

VB Syntax EnterOutputVar <VarName>, <VarType>


VB Example oModule.EnterOutputVar "Freq", "Complex"

EnterPoint
Enters a point defined in the 3D Modeler editor.

Fields Calculator Script Commands 19-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Click Geometry and then select Point.

Name Type Description


Parameters
<PointName> String Name of a point defined in the 3D Modeler editor.

Return Value None.

Python Syntax EnterPoint(<PointName>)


Python Example oModule.EnterPoint("Point1")

VB Syntax EnterPoint <PointName>


VB Example oModule.EnterPoint "Point1"

EnterQty
Enters a field quantity.

UI Access Click Quantity, and then select from the list.

Name Type Description


Parameters
<FieldQty> String The field quantity to be entered onto the stack.

Return Value None.

Fields Calculator Script Commands 19-20


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax EnterQty(<FieldQty>)


Python Example oModule.EnterQty("E")

VB Syntax EnterQty <FieldQty>


VB Example oModule.EnterQty "E"

EnterScalar
Enters a scalar onto the stack.

UI Access Click Number and then click Scalar. Complex option not selected.

Name Type Description


Parameters
<Scalar> Double The real number to enter onto the stack.

Return Value None.

Python Syntax EnterScalar(<Scalar>)


Python Example oModule.EnterScalar(3.14159265358979)

VB Syntax EnterScalar <Scalar>


VB Example oModule.EnterScalar 3.14159265358979

Fields Calculator Script Commands 19-21


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EnterScalarFunc
Enters a scalar function.

UI Access Click Function and then select Scalar.

Name Type Description


Parameters
<VarName> String Name of a variable to enter as a scalar function onto the stack.

Return Value None.

Python Syntax EnterScalarFunc(<VarName>)


Python Example oModule.EnterScalarFunc("Phase")

VB Syntax EnterScalarFunc <VarName>


VB Example oModule.EnterScalarFunc "Phase"

EnterSurf
Enters a surface defined in the 3D Modeler editor.

UI Access Click Geometry and then select Surface.

Name Type Description


Parameters
<SurfName> String Name of a surface defined in the 3D Modeler editor.

Fields Calculator Script Commands 19-22


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax EnterSurf(<SurfName>)


Python Example oModule.EnterSurf("Rectangle1")

VB Syntax EnterSurf <SurfName>


VB Example oModule.EnterSurf "Rectangle1"

EnterVector
Enters a vector onto the stack.

UI Access Click Number, and then click Vector. Complex option not selected.

Name Type Description


Parameters
<VectorArray> Array Array of strings containing X, Y and Z components of the vector.

Return Value None.

Python Syntax EnterVector(<VectorArray>)


Python Example oModule.EnterVector([1.0, 1.0, 1.0])

VB Syntax EnterVector <VectorArray>

Fields Calculator Script Commands 19-23


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oModule.EnterVector Array(1.0, 1.0, 1.0)

EnterVectorFunc
Enters a vector function.

UI Access Click Function and then select Vector.

Name Type Description


Parameters <VarNames> Array Array of strings containing names of a variable for the X, Y, and Z coordinates,
respectively, to enter as a vector function on the stack.

Return Value None.

Python Syntax EnterVectorFunc(<VarNames>)


Python Example oModuleEnterVectorFunc(["X", "Y", "Z"])

VB Syntax EnterVectorFunc <VarNames>


VB Example oModuleEnterVectorFunc Array("X", "Y", "Z")

EnterVol
Enters a volume defined in the 3D Modeler editor.

UI Access Click Geometry and then select Volume.

Fields Calculator Script Commands 19-24


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


Parameters
<VolumeName> String Name of a volume defined in the 3D Modeler editor.

Return Value None.

Python Syntax EnterVol(<VolumeName>)


Python Example oModule.EnterVol("Box1")

VB Syntax EnterVol <VolumeName>


VB Example oModule.EnterVol "Box1"

ExportOnGrid [Fields Calculator]


Evaluates the top stack element at a set of points specified by a grid and exports the data to a file.

UI Access Click Export, and then click On Grid.

Name Type Description


<OutputFile> String Name of the output file.
<Min> Array Minimum values for the coordinate components of the grid system
<Max> Array Maximum values for the coordinate components of the grid system
Parameters <Spacing> Array Spacing values for the coordinate components of the grid system
<SolnName> String Name of the simulation setup
<VarVals> Array Array of strings containing setup definitions.
<IncludePoints> Boolean Optional. Specifies whether include points in the output file.
<CSType> String Optional. Type of coordinate system. "Cartesian" (default) | "Cylindrical" |
"Spherical"

Fields Calculator Script Commands 19-25


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<Offsets> Array Optional. Origin for the offset coordinate system. For Cartesian, x, y, z, for
Cylindrical, R, Phi, Z, for Spherical, Rho, Theta, Phi.
<ByCount> Boolean Optional.

Return Value None.

Note:Regarding the ExportOnGrid legacy script which only has “IncludePtInOutput” argument (the last Boolean one), AEDT can still
read it and assign other new arguments as default values. Those default values are RefCSName = “global”, PtInSI = “True”, FieldInRe-
fCS = “False”

ExportOnGrid(<OutputFile>, <Min>, <Max>, <Spacing>, <SolnName>, <SolnParameters>, [<ExportOption>,


Python Syntax "IncludePointsInOutput:=", <boolean>], " RefCSName:=", <CSName>, "PtsInSI:=, <boolean>, "FieldRefCS:=",
<boolean>], "<CSType>", [ <Offsets>, <ByCount>)
oModule.ExportOnGrid("C:\offset_grid_model_unit_ref.fld",
["-1mm", "16mm", "0mm"],
["1mm", "18mm", "1mm"],
["2mm", "2mm", "1mm"],
"4500MHz : LastAdaptive",
Python Example ["Freq:=", "4.5GHz","Phase:=" , "0deg"],
[
"NAME:ExportOption",
"IncludePtInOutput:=" , True,
"RefCSName:=" , "offset",
"PtInSI:=" , False,

Fields Calculator Script Commands 19-26


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"FieldInRefCS:=" , True
],
"Cartesian", ["0mm", "0mm", "0mm"], False
)

ExportOnGrid(<OutputFile>, <Min>, <Max>, <Spacing>, <SolnName>, <SolnParameters>, [<ExportOption>,


VB Syntax "IncludePointsInOutput:=", <boolean>], " RefCSName:=", <CSName>, "PtsInSI:=, <boolean>, "FieldRefCS:=",
<boolean>], "<CSType>", [ <Offsets>, <ByCount>)
oModule.ExportOnGrid "C:/Grid.fld", _
Array( "0mm", "0deg", "-25mm"), _
Array("20mm", "90deg", "125mm"), _
Array("10mm", "45deg", "50mm"), _
"Setup1 : LastAdaptive", _
Array("Freq:=", "10000Hz", "Phase:=", "0deg"), _
VB Example true, "Cylindrical", _
Array("0mm", "0mm", "0mm")

oModule.ExportOnGrid("C:\offset_grid_model_unit_ref.fld",
Array("-1mm", "16mm", "0mm"),
Array("1mm", "18mm", "1mm"),
Array("2mm", "2mm", "1mm"),

Fields Calculator Script Commands 19-27


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"4500MHz : LastAdaptive",
Array("Freq:=", "4.5GHz","Phase:=" , "0deg"),
[
"NAME:ExportOption",
"IncludePtInOutput:=" , True,
"RefCSName:=" , "offset",
"PtInSI:=" , False,
"FieldInRefCS:=" , True
],
"Cartesian", Array("0mm", "0mm", "0mm"), False
)

ExportToFile [Fields Calculator]


Evaluates the top stack element at a set of points specified in an external file and exports the data to a file.

Note:

Regarding to legacy ExportToFile script which only has “IncludePtInOutput” argument (the last Boolean one), AEDT can
still read it and assign other new arguments as default values. Those default values are RefCSName = “global”, PtInSI =
“True”, FieldInRefCS = “False”

UI Access Click Export, and then click To File.

Fields Calculator Script Commands 19-28


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<ReportName> String Name of report to be exported.
<FileName> String Full path of the exported image file name; with extension of
.txt - Post processor format file
.csv - Comma-delimited data file
.tab - Tab-separated file
Parameters
.dat - Ansys plot data file
<solution> Solution Name
<freq> frequency
<phase> phase
<Export Options> Whether to include points in output, RefCSName, Pts in SI units <boolean>,
Field in RefCS, <boolean>.

Return Value None.

Python ExportToFile(<ReportName>, <FileName>, <solution>, ["Freq:=", <freq>, "Phase:=", "<phase>], <ExportOptions>)


Syntax

oModule.ExportToFile("C:\\offset_file_model_unit_ref.fld", "C:\\offset_SI.pts",
"4500MHz : LastAdaptive",

Python [
Exampl-
"Freq:=" , "4.5GHz",
e
"Phase:=" , "0deg"
],

Fields Calculator Script Commands 19-29


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:ExportOption",
"IncludePtInOutput:=" , True,
"RefCSName:=" , "offset",
"PtInSI:=" , False,
"FieldInRefCS:=" , True
])

VB Syn- ExportToFile <ReportName>, <FileName>


tax

oModule.ExportToFile("C:\\offset_file_model_unit_ref.fld", "C:\\offset_SI.pts",
"4500MHz : LastAdaptive",
[
"Freq:=" , "4.5GHz",

VB "Phase:=" , "0deg"
Exampl-
],
e
[
"NAME:ExportOption",
"IncludePtInOutput:=" , True,
"RefCSName:=" , "offset",

Fields Calculator Script Commands 19-30


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PtInSI:=" , False,
"FieldInRefCS:=" , True
])

GetTopEntryValue
Gets the value of the top entry of the calculator stack.

UI Access N/A

Name Type Description


Parameters <SolnName> String Name of specified solution.
<VarVals> Array Array of variable name, value pairs.

Return Value Array of strings containing top entry values.

Python Syntax GetTopEntryValue(<SolnName>, <VarVals>)


oModule.GetTopEntryValue(
"Setup1:LastAdaptive",
Python Example
["Freq:=", "1GHz", "Phase:=", "0deg", "x_size:=", "2mm"]
)

VB Syntax GetTopEntryValue <SolnName>, <VarVals>

Fields Calculator Script Commands 19-31


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.GetTopEntryValue "Setup1:LastAdaptive", _
VB Example Array("Freq:=", "1GHz", "Phase:=", "0deg", _
"x_size:=", "2mm")

LoadNamedExpressions
Loads a named expression definition from a saved file.

UI Access In the Fields Calculator, click Load From... in the Library area.

Name Type Description


<FileName> String Filename and full path to the file to hold the named expression definition.
Parameters <FieldType> String For products with just one filed type, it is set to "Fields".
<NamedExpr> Array rray of strings containing the names of expression definitions to load from the
file.

Return Value None.

Python Syntax LoadNamedExpressions(<FileName>, <FieldType>, <NamedExpr>)


oModule.LoadNamedExpressions(
Python Example "C:\Ansoft\PersonalLib\smth.clc",
"Fields", ["smoothedtemp"])

VB Syntax LoadNamedExpressions <FileName>, <FieldType>, <NamedExpr>

Fields Calculator Script Commands 19-32


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.LoadNamedExpressions _
VB Example "C:\Ansoft\PersonalLib\smth.clc", _
"Fields", Array("smoothedtemp")

SaveNamedExpressions
Saves a named expression definition to a file.

UI Access In the Fields Calculator, click Save To... in the Library area.

Name Type Description


<FileName> String Filename and full path to the file to hold the named expression definition.
Parameters <NamedExprs> Array Array of strings containing the names of expression definitions to load from the
file.
<Overwrite> Boolean Specifies whether to overwrite the file.

Return Value None.

Python Syntax SaveNamedExpressions(<FileName>, <NamedExprs>, <Overwrite>)


oModule.SaveNamedExpressions(
Python Example "C:\Ansoft\PersonalLib\smth.clc",
["smoothedtemp"], True)

VB Syntax SaveNamedExpressions <FileName>, <NamedExprs>, <Overwrite>


VB Example oModule.SaveNamedExpressions _

Fields Calculator Script Commands 19-33


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"C:\Ansoft\PersonalLib\smth.clc", _
Array("smoothedtemp"), true

Fields Calculator Script Commands 19-34


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

20 - Radiation Module Script Commands


Radiation field commands should be executed by the RadField module.
Set oModule = oDesign.GetModule("RadField")
oModule.CommandName <args>
Conventions Used in this Chapter
<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 sur-
face, 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.
The topics for this section include:
General Commands Recognized by the Radiation Module
Script Commands for Creating and Modifying Radiation Setups
Script Commands for Modifying Antenna Array Setups
Script Commands for Exporting Antenna Parameters and Max Field Parameters

Radiation Module Script Commands 20-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

General Commands Recognized by the Radiation Module


DeleteFarFieldSetup
DeleteNearFieldSetup
EditRadiatedPowerCalculationMethod
GetChildObject [Radiation]
GetChildNames [Radiation]
GetChildTypes [Radiation]
GetPropNames [Radiation]
GetPropValue [Radiation]
GetSetupNames
RenameSetup
SetPropValue [Radiation]
CopyRadFieldSetup
Copies a radiation field setup to clipboard.

UI Access N/A

Name Type Description


Parameters
<SetupName> String Name of radiation field setup to be copied.

Return Value None.

Radiation Module Script Commands 20-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax CopyRadFieldSetup(<SetupName>)


Python Example oModule.CopyRadFieldSetup("RadField1")

VB Syntax CopyRadFieldSetup <SetupName>


VB Example oModule.CopyRadFieldSetup "RadField1"

DeleteFarFieldSetup
Deletes an existing far-field setup.

UI Access Right-click on a far field setup under Radiation in the project tree, select Delete.

Name Type Description


Parameters
<SetupName> Array Name of setup(s) to be deleted.

Return Value None.

Python Syntax DeleteFarFieldSetup(<SetupName>)


Python Example oModule.DeleteFarFieldSetup(["Infinite Sphere1"])

VB Syntax

oModule.DeleteFarFieldSetup _
VB Example
Array("Infinite Sphere1")

Radiation Module Script Commands 20-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

DeleteNearFieldSetup
Deletes an existing near-field line radiation setup.

UI Access Project Manager > Radiation. Right-click a setup and click Delete.

Name Type Description


Parameters
<NameArray> Array List of fields for deletion.

Return Value None.

Python Syntax DeleteNearFieldSetup(NameArray)


Python oModule.DeleteNearFieldSetup(['Line1', 'Sphere1', 'Box2', 'Rectangle1'])
Example

VB Syntax DeleteNearFieldSetup(NameArray)
VB Example oModule.DeleteNearFieldSetup Array("Line1", "Sphere1", "Box2", "Rectangle1")

DeleteSetup
Deletes specified radiation field setup(s).

UI Access Right-click on a setup under Radiation in the project, select Delete.

Name Type Description


Parameters
<SetupName> Array Array of setup names to be deleted.

Return Value None.

Radiation Module Script Commands 20-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax DeleteSetup(<SetupName>)


Python Example oModule.DeleteSetup(["Rad Field1"])

VB Syntax DeleteSetup <SetupName>


VB Example oModule.DeleteSetup Array("Rad Field1")

EditRadiatedPowerCalculationMethod
Selects the method used to calculate radiated power.

UI Access Right-click Radiation in the project tree, select Radiated Power Calculation Method.

Name Type Description


Parameters
<PowerCalculationMethod> String One of: "Auto", "Raidation Surface Integral", or "Far Field Integral".

Return Value None.

Python Syntax EditRadiatedPowerCalculationMethod(<PowerCalculationMethod>)


oModule.EditRadiatedPowerCalculationMethod("Auto")
Python Example oModule.EditRadiatedPowerCalculationMethod("Radiation Surface Integral")
oModule.EditRadiatedPowerCalculationMethod("Far Field Integral")

Radiation Module Script Commands 20-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax EditRadiatedPowerCalculationMethod <PowerCalculationMethod>


oModule.EditRadiatedPowerCalculationMethod "Auto"
VB Example oModule.EditRadiatedPowerCalculationMethod "Radiation Surface Integral"
oModule.EditRadiatedPowerCalculationMethod "Far Field Integral"

GetChildNames [Radiation]
Use: Gets setupup names .
Syntax: GetChildNames()
Return Value: All setup names.
Parameters: Optional, this parameter is ignored.

Python Syntax GetChildNames ()


GetChildNames() //return all setup names.
Python Example

GetChildObject [Radiation]
Gets a Setup Object of the Radiation module.

Python Syntax GetChildObject()


oOverlay= oRadModule.GetChildObject('Antenna Parameter Overlay1')
Python Example
oSphere = oRadModule.GetChildObject('Infinite Sphere1')

Radiation Module Script Commands 20-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetChildTypes [Radiation]
Use: Gets child types of queried Radiation module object.
Syntax: GetChildTypes()
Return Value: Returns empty array.

Python Syntax GetChildTypes ()


oRad = oDesign.GetChildObject(“RadField”)
Python Example oRadModule.GetChildTypes()

GetPropNames [Radiation]
Use: Radiation module does not have its own property, this function always returns empty array.
Syntax: GetPropNames(bIncludeReadOnly)
Return Value: Returns empty set.
Parameters: bIncludeReadOnly—optional, default to True.

Python Syntax GetPropNames ()


oRadModule.GetPropNames()
Python Example oRadModule.GetPropNames(True)
oRadModule.GetPropNames(False)

GetPropValue [Radiation]
Get the property value for a setup object.

Radiation Module Script Commands 20-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access NA

Name Type Description


Parameters
PropPath Value text string A Property path begin with a setup name. See property path discussion here.

Return Value The property value.

Python Syntax GetPropValue(propPath)


oRadModule.GetPropValue('Line1/Num Points') //Get the Line1 setups’ “Num Points”
Python Example
property value.

GetSetupNames
Gets the names of far field and near field radiation setups in a design.

UI Access N/A

Name Type Description


Parameters
<RadiationType> String Type of radiation.

Return Value Array of strings containing setup names.

Python Syntax GetSetupNames(<RadiationType>)


Python Example oModule.GetSetupNames("Infinite Sphere")

Radiation Module Script Commands 20-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetSetupNames <RadiationType>


VB Example oModule.GetSetupNames "Infinite Sphere"

PasteRadFieldSetup
Pastes a copied radiation field setup.

UI Access N/A
Parameters None.
Return Value String name of pasted setup.

Python Syntax PasteRadFieldSetup()


Python Example oModule.PasteRadFieldSetup()

VB Syntax PasteRadFieldSetup
VB Example oModule.PasteRadFieldSetup

RenameSetup [Radiation]
Renames an existing radiation setup.

UI Access Right-click a radiation setup in the project tree, and then click Rename on the shortcut menu.

Name Type Description


Parameters <OldName> String Name of specified setup to be renamed.
<NewName> String New name for the setup.

Radiation Module Script Commands 20-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax RenameSetup(<OldName>, <NewName>)


Python Example oModule.RenameSetup("Sphere1", "MyNearSphere")

VB Syntax RenameSetup <OldName>, <NewName>


VB Example oModule.RenameSetup "Sphere1", "MyNearSphere"

SetPropValue [Radiation]
Sets the property value for the active Radiation property object.

UI Access Edit Properties on ProjectTree objects

Name Type Description


propPath text string A Property path begin with a setup name. See property path discussion here.
Parameters Value Text String, New value data type is depending on the property type.
Number, or
Boolean

Return Value True if the property is found and the new value is valid. Otherwise return False.

Python Syntax SetPropValue(propPath, value)

Python Example oRadModule.SetPropValue('Line1/Num Points', 100) ; Set the Line1 setups’ “Num

Radiation Module Script Commands 20-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Points” property to 100.

VB Syntax SetPropValue(propPath, value)


VB Example SetPropValue(“Color/r”,111)

Script Commands for Creating and Modifying Radiation Setups


EditBoxSetup
EditFarFieldSphereSetup
EditNearFieldLineSetup
EditNearFieldRectangleSetup
EditNearFieldSphereSetup
InsertBoxSetup
InsertFarFieldSphereSetup
InsertNearFieldLineSetup
InsertNearFieldRectangleSetup
InsertNearFieldSphereSetup
AddAntennaOverlay
Saves a table of antenna parameters for use an overlay on far field plots.

UI Access Click on Save for Overlay in the Antenna Parameters dialog.

Radiation Module Script Commands 20-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<AntennaParams> Array Structured array.
Array("NAME:<AntennaOverlayName>",
"Setup:=", <string far field radiation setup name>,
"Solution:=", <string for the Solution Setup and Pass>,
Parameters "IntrinsicVariation:=", <string for variation defin-
ition>,
"UseNominalDesign:=", <boolean>,
"DesignVariation:=", <string>,
"Calculations:=" , <list of each antenna parameter to
display>)

Return Value None.

Python Syntax AddAntennaOverlay(<AntennaParams>)


oModule.AddAntennaOverlay(
[
"NAME:Antenna Parameter Overlay1",
Python Example
"Setup:=", "Infinite Sphere1",
"Solution:=", "4500MHz : LastAdaptive",
"IntrinsicVariation:=", "Freq=4.5GHz ",

Radiation Module Script Commands 20-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseNominalDesign:=", False,
"DesignVariation:=", "",
"Calculations:=", "Max U,Peak Directivity,Peak Gain,Radiation Efficiency,
Front To Back Ratio,Total Efficiency,System Efficiency"
])

VB Syn- AddAntennaOverlay <AntennaParams>


tax

oModule.AddAntennaOverlay _
Array("NAME:Antenna Parameter Overlay1", _
"Setup:=", "Infinite Sphere1", _
VB "Solution:=", "Setup1 : LastAdaptive", _
Example
"IntrinsicVariation:=", "Freq=1.8GHz", _
"UseNominalDesign:=", true, _
"Calculations:=","Max U,Peak Directivity,Peak Gain,Radiation Efficiency,Front To Back
Ratio")

AddRadFieldSourceGroup
Adds source group definitions for radiation field setup.

UI Access Right-click on Radiation in the project tree, select Insert Far Field Setup > Source Group...

Name Type Description


Parameters
<SourceGroupParams> Array Structured array

Radiation Module Script Commands 20-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:<SourceGroupName>",
Array("NAME:Sources",
<SourceName>, <SourceName>...))

Return Value None.

Python Syntax AddRadFieldSourceGroup(<SourceGroupParams>)


oModule.AddRadFieldSourceGroup(
[
"NAME:Source Group1",
Python Example ["NAME:Sources",
"feedpin1_T1",
"feedpin1_T2"]
])

VB Syntax AddRadFieldSourceGroup <SourceGroupParams>

Radiation Module Script Commands 20-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.AddRadFieldSourceGroup _
Array("NAME:Source Group1", _
VB Example
Array("NAME:Sources", _
"feedpin1_T1", "feedpin1_T2"))

EditAntennaOverlay
Edits parameters in an existing antenna overlay.

UI Access N/A

Name Type Description


<AntennaOverlayName> String Name of the antenna overlay to be edited.
<AntennaParams> Array Structured array.
Array("NAME:<AntennaOverlayName>",
"Setup:=", <string far field radiation setup name>,
"Solution:=", <string for the Solution Setup and Pass>,
Parameters
"IntrinsicVariation:=", <string for variation defin-
ition>,
"UseNominalDesign:=", <boolean>,
"DesignVariation:=", <string>,
"Calculations:=" , <list of each antenna parameter to
display>)

Return Value None.

Radiation Module Script Commands 20-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax EditAntennaOverlay(<AntennaOverlayName>, <AntennaParams>)


oModule.EditAntennaOverlay("Antenna Parameter Overlay1",
[
"NAME:Antenna Parameter Overlay1",
"Setup:=", "Infinite Sphere1",
"Solution:=", "4500MHz : LastAdaptive",
Python Example "IntrinsicVariation:=", "Freq=4.5GHz ",
"UseNominalDesign:=", False,
"DesignVariation:=", "",
"Calculations:=", "Max U,Peak Directivity,Peak Gain,Radiation Efficiency,
Front To Back Ratio,Total Efficiency,System Efficiency"
])

VB Syn- EditAntennaOverlay <AntennaOverlayName>, <AntennaParams>


tax

oModule.AddAntennaOverlay "Antenna Parameter Overlay1", _


Array("NAME:Antenna Parameter Overlay1", _
VB
"Setup:=", "Infinite Sphere1", _
Example
"Solution:=", "Setup1 : LastAdaptive", _
"IntrinsicVariation:=", "Freq=1.8GHz", _

Radiation Module Script Commands 20-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseNominalDesign:=", true, _
"Calculations:=","Max U,Peak Directivity,Peak Gain,Radiation Efficiency,Front To Back
Ratio")

EditBoxSetup
Edits a near-field box radiation setup.

UI Access Project Manager > Radiation > Box. Double-click and edit information.

Name Type Description


<BoxParams> Array Structured array.
Array("NAME:<SetupName>",
"UseCustomRadiationSurface:=", <bool>,
"CustomRadiationSurface:=",
<FaceListName>,
"Length:=", <string>,
"Width:=", <string>,
Parameters
"LengthSamples:=", <int>,
"WidthSamples:=", <int>,
"CoordSystem:=", <CSname>
"Height:=", <string>,
"HeightSamples:=", <int>)
For UseCustomRadiationSurface parameter, provide value if
True. If False, radiation boundary/PML boundaries will be used
as radiation surfaces.

Radiation Module Script Commands 20-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax EditBoxSetup(<BoxParams>)


oModule.EditBoxSetup(
['NAME:MyBox',
'UseCustomRadiationSurface:=', False,
'Length:=', '20mm',
'Width:=', '20mm',
Python Example 'LengthSamples:=', 21,
'WidthSamples:=', 21,
'CoordSystem:=', 'Global',
'Height:=', '20mm',
'HeightSamples:=', 21
])

VB Syntax EditBoxSetup(<BoxParams>)
oModule.EditBoxSetup Array("NAME:MyBox", _
VB Example "UseCustomRadiationSurface:=", false, _
"Length:=", "20mm", _

Radiation Module Script Commands 20-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Width:=", "20mm", _
"LengthSamples:=", 21 _
"WidthSamples:=", 21 _
"CoordSystem:=", "Global" _
"Height:=", "20mm" _
"HeightSamples:=", 21)

EditFarFieldSphereSetup
Modifies an existing far-field sphere setup.

UI Access Double-click a radiation setup in the project tree to modify its settings.

Name Type Description


<FarFieldSphereName> String Name of the Far Field Sphere Radiation Setup to be edited.
<FarFieldSphereParams> Array Structured array.
Array("NAME:<InfSphereName>",
"UseCustomRadiationSurface:=", <boolean>,
"CSDefinition:=", <string, "Theta-Phi" | "Az
Over EI" | "EI Over AS">,
Parameters
"Polarization:=", <string, "Linear" | "Slant">,
"ThetaStart:=", "<value><unit>",
"ThetaStop:=", "<value><unit>",
"ThetaStep:=", "<value><unit>",
"PhiStart:=", "<value><unit>",
"PhiStop:=", "<value><unit>",

Radiation Module Script Commands 20-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PhiStep:=", "<value><unit>",
"UseLocalCS:=", boolean)

Return Value None

Python Syntax EditFarFieldSphereSetup(<FarFieldSphereName>, <FarFieldSphereParams>)


oModule.EditFarFieldSphereSetup("Infinite Sphere1",
[
"NAME:Infinite Sphere1",
"UseCustomRadiationSurface:=", False,
"ThetaStart:=" , "0deg",
"ThetaStop:=" , "180deg",
Python Example
"ThetaStep:=" , "3deg",
"PhiStart:=" , "-180deg",
"PhiStop:=" , "180deg",
"PhiStep:=" , "3deg",
"UseLocalCS:=" , False
])

Radiation Module Script Commands 20-20


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax EditFarFieldSphereSetup <FarFieldSphereName>, <FarFieldSphereParams>


oModule.EditFarFieldSphereSetup "Infinite Sphere1", _
Array("NAME:Infinite Sphere1",_
"UseCustomRadiationSurface:=", false, "ThetaStart:=", "0deg", _
VB Example
"ThetaStop:=", "180deg", "ThetaStep:=", "2deg", "PhiStart:=", _
"-180deg", "PhiStop:=", "180deg", "PhiStep:=", "2deg", _
"UseLocalCS:=", false)

EditInfiniteSphereSetup
Modifies an infinite sphere radiation field setup.

UI Access Double-click on a setup under Radiation in the project tree.

Name Type Description


<InfSphereName> String Name of the infinite sphere setup to be edited.
<InfSphereParams> Array Structured array.
Array("NAME:<InfSphereName>",
"UseCustomRadiationSurface:=", <boolean>,
Parameters
"CSDefinition:=", <string, "Theta-Phi" | "Az Over EI"
| "EI Over AS">,
"Polarization:=", <string, "Linear" | "Slant">,
"ThetaStart:=", "<value><unit>",
"ThetaStop:=", "<value><unit>",

Radiation Module Script Commands 20-21


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ThetaStep:=", "<value><unit>",
"PhiStart:=", "<value><unit>",
"PhiStop:=", "<value><unit>",
"PhiStep:=", "<value><unit>",
"UseLocalCS:=", boolean)

Return Value None.

Python Syntax EditInfiniteSphereSetup(<InfSphereName>, <InfSphereParams>)


oModule.EditInfiniteSphereSetup("Infinite Sphere1",
[
"NAME:Infinite Sphere1",
"UseCustomRadiationSurface:=", False,
"CSDefinition:=" , "Theta-Phi",
Python Example "Polarization:=" , "Linear",
"ThetaStart:=" , "0deg",
"ThetaStop:=" , "180deg",
"ThetaStep:=" , "2deg",
"PhiStart:=" , "-180deg",
"PhiStop:=" , "180deg",

Radiation Module Script Commands 20-22


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PhiStep:=" , "2deg",
"UseLocalCS:=" , False
])

VB Syntax EditInfiniteSphereSetup <InfSphereName>, <InfSphereParams>


oModule.EditInfiniteSphereSetup "Infinite Sphere1", _
Array("NAME:Infinite Sphere1", _
"UseCustomRadiationSurface:=", false, _
"CSDefinition:=", "Theta-Phi", _
VB Example "Polarization:=", "Linear", _
"ThetaStart:=", "0deg", "ThetaStop:=", "180deg", _
"ThetaStep:=", "2deg", "PhiStart:=", "-180deg", _
"PhiStop:=", "180deg", "PhiStep:=", "2deg", _
"UseLocalCS:=", false)

EditLineSetup
Modifies a near field line setup.

UI Access Double-click on a setup under Radiation in the project tree.

Name Type Description


Parameters <SetupName> String Name of the setup to be edited.
<LineParams> Array Structured array.

Radiation Module Script Commands 20-23


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:<LineName>",
"UseCustomRadiationSurface:=", <boolean>,
"Line:=", <string, name of specified line>,
"NumPts:=", "<integer, number of points>")

Return Value None.

Python Syntax EditLineSetup(<SetupName>, <LineParams>)


oModule.EditLineSetup("Line1",
[
"NAME:Line1",
Python Example "UseCustomRadiationSurface:=", False,
"Line:=" , "Polyline1",
"NumPts:=" , "1000"
])

VB Syntax EditLineSetup <SetupName>, <LineParams>


oModule.EditLineSetup "Line1", _
VB Example Array("NAME:Line1", _
"UseCustomRadiationSurface:=", false, _

Radiation Module Script Commands 20-24


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Line:=", "Polyline1", "NumPts:=", "1000")

EditNearFieldBoxSetup
Modifies a near field box radiation field setup.

UI Access N/A

Name Type Description


<BoxSetupName> String Name of the near field box setup to be edited.
<BoxSetupParams> Array Structured array.
Array("NAME:<BoxSetupName>",
"UseCustomRadiationSurface:=", <boolean>,
"Length:=", "<value><unit>",
Parameters "Width:=", "<value><unit>",
"LengthSamples:=", <value>,
"WidthSamples:=", <value>,
"CoordSystem:=", <string name of coordinate system>,
"Height:=", "<value><unit>",
"HeightSamples:=", <value>)

Return Value None.

Python Syntax EditNearFieldBoxSetup(<BoxSetupName>, <BoxSetupParams>)


Python Example oModule.EditNearFieldBoxSetup("Box1",

Radiation Module Script Commands 20-25


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:Box1",
"UseCustomRadiationSurface:=", False,
"Length:=" , "20meter",
"Width:=" , "20meter",
"LengthSamples:=" , 21,
"WidthSamples:=" , 21,
"CoordSystem:=" , "Global",
"Height:=" , "20meter",
"HeightSamples:=" , 21
])

VB Syntax EditNearFieldBoxSetup <BoxSetupName>, <BoxSetupParams>


oModule.EditNearFieldBoxSetup "Box1", _
Array("NAME:Box1", _
"UseCustomRadiationSurface:=", false, _
VB Example
"Length:=", "20meter", "Width:=", "20meter", _
"LengthSamples:=", 21, "WidthSamples:=", 21, _
"CoordSystem:=", "Global", _

Radiation Module Script Commands 20-26


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Height:=", "20meter", "HeightSamples:=", 21)

EditNearFieldLineSetup
Modifies a near field line setup.

UI Access N/A

Name Type Description


<SetupName> String Name of the setup to be edited.
<LineParams> Array Structured array.
Array("NAME:<LineName>",
Parameters
"UseCustomRadiationSurface:=", <boolean>,
"Line:=", <string, name of specified line>,
"NumPts:=", "<integer, number of points>")

Return Value None.

Python Syntax EditNearFieldLineSetup(<SetupName>, <LineParams>)


oModule.EditNearFieldLineSetup("Line1",
[
"NAME:Line1",
Python Example
"UseCustomRadiationSurface:=", False,
"Line:=" , "Polyline1",
"NumPts:=" , "1000"

Radiation Module Script Commands 20-27


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

])

VB Syntax EditNearFieldLineSetup <SetupName>, <LineParams>


oModule.EditNearFieldLineSetup "Line1", _
Array("NAME:Line1", _
VB Example
"UseCustomRadiationSurface:=", false, _
"Line:=", "Polyline1", "NumPts:=", "1000")

EditNearFieldRectangleSetup
Modifies a near field rectangle radiation setup.

UI Access N/A.

Name Type Description


<RectangleSetupName> String Name of rectangle radiation setup to be edited.
<RectangleSetupParams> Array Structured array.
Array("NAME:<RectangleSetupName>",
"UseCustomRadiationSurface:=", <boolean>,
Parameters
"Length:=", "<value><unit>",
"Width:=", "<value><unit>",
"LengthSamples:=", <value>,
"WidthSamples:=", <value>,

Radiation Module Script Commands 20-28


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"CoordSystem:=", <string name of coordinate sys-


tem>)

Return Value None.

Python Syntax EditNearFieldRectangleSetup(<RectangleSetupName>, <RectangleSetupParams>)


oModule.EditNearFieldRectangleSetup("Rectangle1",
[
"NAME:Rectangle1",
"UseCustomRadiationSurface:=", False,
"Length:=" , "20meter",
Python Example
"Width:=" , "20meter",
"LengthSamples:=" , 41,
"WidthSamples:=" , 41,
"CoordSystem:=" , "Global"
])

VB Syntax EditNearFieldRectangleSetup <RectangleSetupName>, <RectangleSetupParams>


oModule.EditNearFieldRectangleSetup "Rectangle1", _
VB Example Array("NAME:Rectangle1", _
"UseCustomRadiationSurface:=", false, _

Radiation Module Script Commands 20-29


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Length:=", "20meter", "Width:=", "20meter", _


"LengthSamples:=", 41, "WidthSamples:=", 41, _
"CoordSystem:=", "Global")

EditNearFieldSphereSetup
Modifies a near field sphere radiation setup.

UI Access N/A

Name Type Description


<SphereSetupName> String Name of sphere radiation field setup to be edited.
<SphereSetupParams> Array Structured array.
Array("NAME:<SphereSetupName>",
"UseCustomRadiationSurface:=", <boolean>,
"Radius:=", "<value><unit>",
"ThetaStart:=", "<value><unit>",
Parameters
"ThetaStop:=", "<value><unit>",
"ThetaStep:=", "<value><unit>",
"PhiStart:=", "<value><unit>",
"PhiStop:=", "<value><unit>",
"PhiStep:=", "<value><unit>",
"UseLocalCS:=", <boolean>)

Return Value None.

Radiation Module Script Commands 20-30


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax EditNearFieldSphereSetup(<SphereSetupName>, <SphereSetupParams>)


oModule.EditNearFieldSphereSetup("Sphere1",
[
"NAME:Sphere2",
"UseCustomRadiationSurface:=", False,
"Radius:=" , "20meter",
"ThetaStart:=" , "0deg",
Python Example "ThetaStop:=" , "180deg",
"ThetaStep:=" , "2deg",
"PhiStart:=" , "-180deg",
"PhiStop:=" , "180deg",
"PhiStep:=" , "2deg",
"UseLocalCS:=" , False
])

VB Syntax EditNearFieldSphereSetup <SphereSetupName>, <SphereSetupParams>


oModule.EditNearFieldSphereSetup "Sphere1", _
VB Example Array("NAME:Sphere2", _
"UseCustomRadiationSurface:=", false, _

Radiation Module Script Commands 20-31


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Radius:=", "20meter", _
"ThetaStart:=", "0deg", "ThetaStop:=", "180deg", "ThetaStep:=", "2deg", _
"PhiStart:=", "-180deg", "PhiStop:=", "180deg", "PhiStep:=", "2deg", _
"UseLocalCS:=", false)

EditRadFieldSourceGroup
Modifies an existing source group definitions for radiation field setup.

UI Access Double-click on a source group setup under Radiation in the project tree.

Name Type Description


<SourceGroupName> String Name of the source group setup to be edited.
<SourceGroupParams> Array Structured array
Parameters Array("NAME:<SourceGroupName>",
Array("NAME:Sources",
<SourceName>, <SourceName>...))

Return Value None.

Python Syntax EditRadFieldSourceGroup(<SourceGroupName>, <SourceGroupParams>)


oModule.EditRadFieldSourceGroup("Source Group1",
Python Example [
"NAME:Source Group1",

Radiation Module Script Commands 20-32


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["NAME:Sources",
"IncPWave1",
"IncPWave2"]
])

VB Syntax EditRadFieldSourceGroup <SourceGroupName>, <SourceGroupParams>


oModule.EditRadFieldSourceGroup "Source Group1", _
Array("NAME:Source Group1", _
VB Example
Array("NAME:Sources", _
"IncPWave1", "IncPWave2"))

EditRectangleSetup
Modifies a near field rectangle radiation setup.

UI Access Double-click on a rectangle setup under Radiation in the project tree.

Name Type Description


<RectangleSetupName> String Name of rectangle radiation setup to be edited.
<RectangleSetupParams> Array Structured array.
Array("NAME:<RectangleSetupName>",
Parameters
"UseCustomRadiationSurface:=", <boolean>,
"Length:=", "<value><unit>",
"Width:=", "<value><unit>",

Radiation Module Script Commands 20-33


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"LengthSamples:=", <value>,
"WidthSamples:=", <value>,
"CoordSystem:=", <string name of coordinate sys-
tem>)

Return Value None.

Python Syntax EditRectangleSetup(<RectangleSetupName>, <RectangleSetupParams>)


oModule.EditRectangleSetup("Rectangle1",
[
"NAME:Rectangle1",
"UseCustomRadiationSurface:=", False,
"Length:=" , "20meter",
Python Example
"Width:=" , "20meter",
"LengthSamples:=" , 41,
"WidthSamples:=" , 41,
"CoordSystem:=" , "Global"
])

VB Syntax EditRectangleSetup <RectangleSetupName>, <RectangleSetupParams>

Radiation Module Script Commands 20-34


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.EditRectangleSetup "Rectangle1", _
Array("NAME:Rectangle1", _
"UseCustomRadiationSurface:=", false, _
VB Example
"Length:=", "20meter", "Width:=", "20meter", _
"LengthSamples:=", 41, "WidthSamples:=", 41, _
"CoordSystem:=", "Global")

EditSphereSetup
Modifies a near field sphere radiation setup.

UI Access Double-click on a sphere setup under Radiation in the project tree.

Name Type Description


<SphereSetupName> String Name of sphere radiation field setup to be edited.
<SphereSetupParams> Array Structured array.
Array("NAME:<SphereSetupName>",
"UseCustomRadiationSurface:=", <boolean>,
"Radius:=", "<value><unit>",
Parameters "ThetaStart:=", "<value><unit>",
"ThetaStop:=", "<value><unit>",
"ThetaStep:=", "<value><unit>",
"PhiStart:=", "<value><unit>",
"PhiStop:=", "<value><unit>",
"PhiStep:=", "<value><unit>",

Radiation Module Script Commands 20-35


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseLocalCS:=", <boolean>)

Return Value None.

Python Syntax EditSphereSetup(<SphereSetupName>, <SphereSetupParams>)


oModule.EditSphereSetup("Sphere1",
[
"NAME:Sphere2",
"UseCustomRadiationSurface:=", False,
"Radius:=" , "20meter",
"ThetaStart:=" , "0deg",
Python Example "ThetaStop:=" , "180deg",
"ThetaStep:=" , "2deg",
"PhiStart:=" , "-180deg",
"PhiStop:=" , "180deg",
"PhiStep:=" , "2deg",
"UseLocalCS:=" , False
])

VB Syntax EditSphereSetup <SphereSetupName>, <SphereSetupParams>

Radiation Module Script Commands 20-36


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.EditSphereSetup "Sphere1", _
Array("NAME:Sphere2", _
"UseCustomRadiationSurface:=", false, _
VB Example "Radius:=", "20meter", _
"ThetaStart:=", "0deg", "ThetaStop:=", "180deg", "ThetaStep:=", "2deg", _
"PhiStart:=", "-180deg", "PhiStop:=", "180deg", "PhiStep:=", "2deg", _
"UseLocalCS:=", false)

InsertBoxSetup
Inserts a near-field box radiation setup.

UI Access HFSS > Radiation > Insert Near Field Setup > Box.

Name Type Description


<BoxParams> Array Structured array.
Array("NAME:<SetupName>",
"UseCustomRadiationSurface:=", <bool>,
"CustomRadiationSurface:=",
<FaceListName>,
Parameters
"Length:=", <string>,
"Width:=", <string>,
"LengthSamples:=", <int>,
"WidthSamples:=", <int>,
"CoordSystem:=", <CSname>

Radiation Module Script Commands 20-37


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Height:=", <string>,
"HeightSamples:=", <int>)
For UseCustomRadiationSurface parameter, provide value if
True. If False, radiation boundary/PML boundaries will be used
as radiation surfaces.

Return Value None.

Python Syntax InsertBoxSetup(<BoxParams>)


oModule.InsertBoxSetup(
[
'NAME:MyBox',
'UseCustomRadiationSurface:=', False,
'Length:=', '20mm', 'Width:=', '20mm',
Python Example 'LengthSamples:=', 21,
'WidthSamples:=', 21,
'CoordSystem:=', 'Global',
'Height:=', '20mm',
'HeightSamples:=', 21
])

Radiation Module Script Commands 20-38


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax InsertBoxSetup <BoxParams>


oModule.InsertBoxSetup Array("NAME:MyBox", _
"UseCustomRadiationSurface:=", false, _
"Length:=", "20mm", _
"Width:=", "20mm", _
VB Example "LengthSamples:=", 21 _
"WidthSamples:=", 21 _
"CoordSystem:=", "Global" _
"Height:=", "20mm" _
"HeightSamples:=", 21)

InsertFarFieldSphereSetup
Inserts a far field infinite sphere setup.

UI Access N/A

Name Type Description


<SphereParams> Array Structured array.
Array("NAME:<InfSphereName>",
"UseCustomRadiationSurface:=", <boolean>,
Parameters
"CSDefinition:=", <string, "Theta-Phi" | "Az Over EI"
| "EI Over AS">,
"Polarization:=", <string, "Linear" | "Slant">,
"ThetaStart:=", "<value><unit>",

Radiation Module Script Commands 20-39


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ThetaStop:=", "<value><unit>",
"ThetaStep:=", "<value><unit>",
"PhiStart:=", "<value><unit>",
"PhiStop:=", "<value><unit>",
"PhiStep:=", "<value><unit>",
"UseLocalCS:=", boolean)

Return Value None.

Python Syntax InsertFarFieldSphereSetup(<SphereParams>)


oModule.InsertFarFieldSphereSetup(
[
"NAME:Infinite Sphere1",
"UseCustomRadiationSurface:=", False,
"CSDefinition:=" , "Theta-Phi",
Python Example
"Polarization:=" , "Linear",
"ThetaStart:=" , "0deg",
"ThetaStop:=" , "180deg",
"ThetaStep:=" , "2deg",
"PhiStart:=" , "-180deg",

Radiation Module Script Commands 20-40


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PhiStop:=" , "180deg",
"PhiStep:=" , "2deg",
"UseLocalCS:=" , False
])

VB Syntax InsertFarFieldSphereSetup<SphereParams>
oModule.InsertFarFieldSphereSetup _
Array("NAME:Infinite Sphere1", _
"UseCustomRadiationSurface:=", false, _
"CSDefinition:=", "Theta-Phi", _
VB Example "Polarization:=", "Linear", _
"ThetaStart:=", "0deg", "ThetaStop:=", "180deg", _
"ThetaStep:=", "2deg", "PhiStart:=", "-180deg", _
"PhiStop:=", "180deg", "PhiStep:=", "2deg", _
"UseLocalCS:=", false)

InsertInfiniteSphereSetup
Inserts an infinite sphere radiation field setup.

UI Access Right-click on Radiation in the project tree, select Insert Far Field Setup > Infinite Sphere...

Name Type Description


Parameters
<InfSphereParams> Array Structured array.

Radiation Module Script Commands 20-41


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:<InfSphereName>",
"UseCustomRadiationSurface:=", <boolean>,
"CSDefinition:=", <string, "Theta-Phi" | "Az Over EI"
| "EI Over AS">,
"Polarization:=", <string, "Linear" | "Slant">,
"ThetaStart:=", "<value><unit>",
"ThetaStop:=", "<value><unit>",
"ThetaStep:=", "<value><unit>",
"PhiStart:=", "<value><unit>",
"PhiStop:=", "<value><unit>",
"PhiStep:=", "<value><unit>",
"UseLocalCS:=", boolean)

Return Value None.

Python Syntax InsertInfiniteSphereSetup(<InfSphereParams>)


oModule.InsertInfiniteSphereSetup(
[
Python Example "NAME:Infinite Sphere1",
"UseCustomRadiationSurface:=", False,
"CSDefinition:=" , "Theta-Phi",

Radiation Module Script Commands 20-42


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Polarization:=" , "Linear",
"ThetaStart:=" , "0deg",
"ThetaStop:=" , "180deg",
"ThetaStep:=" , "2deg",
"PhiStart:=" , "-180deg",
"PhiStop:=" , "180deg",
"PhiStep:=" , "2deg",
"UseLocalCS:=" , False
])

VB Syntax InsertInfiniteSphereSetup <InfSphereParams>


oModule.InsertInfiniteSphereSetup _
Array("NAME:Infinite Sphere1", _
"UseCustomRadiationSurface:=", false, _
"CSDefinition:=", "Theta-Phi", _
VB Example "Polarization:=", "Linear", _
"ThetaStart:=", "0deg", "ThetaStop:=", "180deg", _
"ThetaStep:=", "2deg", "PhiStart:=", "-180deg", _
"PhiStop:=", "180deg", "PhiStep:=", "2deg", _
"UseLocalCS:=", false)

Radiation Module Script Commands 20-43


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

InsertLineSetup
Inserts a near field line setup.

UI Access Right-click on Radiation in the project tree, select Insert Near Field Setup > Line...

Name Type Description


<LineParams> Array Structured array.
Array("NAME:<LineName>",
Parameters
"UseCustomRadiationSurface:=", <boolean>,
"Line:=", <string, name of specified line>,
"NumPts:=", "<integer, number of points>")

Return Value None.

Python Syntax InsertLineSetup(<LineParams>)


oModule.InsertLineSetup(
[
"NAME:Line1",
Python Example "UseCustomRadiationSurface:=", False,
"Line:=" , "Polyline1",
"NumPts:=" , "1000"
])

Radiation Module Script Commands 20-44


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax InsertLineSetup <LineParams>


oModule.InsertLineSetup _
Array("NAME:Line1", _
VB Example
"UseCustomRadiationSurface:=", false, _
"Line:=", "Polyline1", "NumPts:=", "1000")

InsertNearFieldBoxSetup
Inserts a near field box radiation field setup.

UI Access N/A

Name Type Description


<BoxSetupParams> Array Structured array.
Array("NAME:<BoxSetupName>",
"UseCustomRadiationSurface:=", <boolean>,
"Length:=", "<value><unit>",

Parameters "Width:=", "<value><unit>",


"LengthSamples:=", <value>,
"WidthSamples:=", <value>,
"CoordSystem:=", <string name of coordinate system>,
"Height:=", "<value><unit>",
"HeightSamples:=", <value>)

Radiation Module Script Commands 20-45


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax InsertNearFieldBoxSetup(<BoxSetupParams>)


oModule.InsertNearFieldBoxSetup(
[
"NAME:Box1",
"UseCustomRadiationSurface:=", False,
"Length:=" , "20meter",
"Width:=" , "20meter",
Python Example
"LengthSamples:=" , 21,
"WidthSamples:=" , 21,
"CoordSystem:=" , "Global",
"Height:=" , "20meter",
"HeightSamples:=" , 21
])

VB Syntax InsertNearFieldBoxSetup <BoxSetupParams>


oModule.InsertNearFieldBoxSetup _
VB Example
Array("NAME:Box1", _

Radiation Module Script Commands 20-46


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseCustomRadiationSurface:=", false, _
"Length:=", "20meter", "Width:=", "20meter", _
"LengthSamples:=", 21, "WidthSamples:=", 21, _
"CoordSystem:=", "Global", _
"Height:=", "20meter", "HeightSamples:=", 21)

InsertNearFieldLineSetup
Inserts a near field line setup.

UI Access N/A

Name Type Description


<LineParams> Array Structured array.
Array("NAME:<LineName>",
Parameters
"UseCustomRadiationSurface:=", <boolean>,
"Line:=", <string, name of specified line>,
"NumPts:=", "<integer, number of points>")

Return Value None.

Python Syntax InsertNearFieldLineSetup(<LineParams>)


oModule.InsertNearFieldLineSetup(
Python Example [
"NAME:Line1",

Radiation Module Script Commands 20-47


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseCustomRadiationSurface:=", False,
"Line:=" , "Polyline1",
"NumPts:=" , "1000"
])

VB Syntax InsertNearFieldLineSetup<LineParams>
oModule.InsertNearFieldLineSetup _
Array("NAME:Line1", _
VB Example
"UseCustomRadiationSurface:=", false, _
"Line:=", "Polyline1", "NumPts:=", "1000")

InsertNearFieldRectangleSetup
Inserts a near field rectangle radiation setup.

UI Access N/A

Name Type Description


<RectangleSetupParams> Array Structured array.
Array("NAME:<RectangleSetupName>",
Parameters
"UseCustomRadiationSurface:=", <boolean>,
"Length:=", "<value><unit>",
"Width:=", "<value><unit>",

Radiation Module Script Commands 20-48


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"LengthSamples:=", <value>,
"WidthSamples:=", <value>,
"CoordSystem:=", <string name of coordinate sys-
tem>)

Return Value None.

Python Syntax InsertNearFieldRectangleSetup(<RectangleSetupParams>)


oModule.InsertNearFieldRectangleSetup(
[
"NAME:Rectangle1",
"UseCustomRadiationSurface:=", False,
"Length:=" , "20meter",
Python Example
"Width:=" , "20meter",
"LengthSamples:=" , 41,
"WidthSamples:=" , 41,
"CoordSystem:=" , "Global"
])

VB Syntax InsertNearFieldRectangleSetup <RectangleSetupParams>


VB Example oModule.InsertNearFieldRectangleSetup _

Radiation Module Script Commands 20-49


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Rectangle1", _
"UseCustomRadiationSurface:=", false, _
"Length:=", "20meter", "Width:=", "20meter", _
"LengthSamples:=", 41, "WidthSamples:=", 41, _
"CoordSystem:=", "Global")

InsertNearFieldSphereSetup
Inserts a near field sphere radiation setup.

UI Access N/A

Name Type Description


<SphereSetupParams> Array Structured array.
Array("NAME:<SphereSetupName>",
"UseCustomRadiationSurface:=", <boolean>,
"Radius:=", "<value><unit>",
"ThetaStart:=", "<value><unit>",
Parameters
"ThetaStop:=", "<value><unit>",
"ThetaStep:=", "<value><unit>",
"PhiStart:=", "<value><unit>",
"PhiStop:=", "<value><unit>",
"PhiStep:=", "<value><unit>",
"UseLocalCS:=", <boolean>)

Radiation Module Script Commands 20-50


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax InsertNearFieldSphereSetup(<SphereSetupParams>)


oModule.InsertNearFieldSphereSetup(
[
"NAME:Sphere2",
"UseCustomRadiationSurface:=", False,
"Radius:=" , "20meter",
"ThetaStart:=" , "0deg",
Python Example "ThetaStop:=" , "180deg",
"ThetaStep:=" , "2deg",
"PhiStart:=" , "-180deg",
"PhiStop:=" , "180deg",
"PhiStep:=" , "2deg",
"UseLocalCS:=" , False
])

VB Syntax InsertNearFieldSphereSetup <SphereSetupParams>


oModule.InsertNearFieldSphereSetup _
VB Example
Array("NAME:Sphere2", _

Radiation Module Script Commands 20-51


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseCustomRadiationSurface:=", false, _
"Radius:=", "20meter", _
"ThetaStart:=", "0deg", "ThetaStop:=", "180deg", "ThetaStep:=", "2deg", _
"PhiStart:=", "-180deg", "PhiStop:=", "180deg", "PhiStep:=", "2deg", _
"UseLocalCS:=", false)

InsertRectangleSetup
Inserts a near field rectangle radiation setup.

UI Access Right-click on Radiation in the project tree ,select Insert Near Field Setup > Rectangle...

Name Type Description


<RectangleSetupParams> Array Structured array.
Array("NAME:<RectangleSetupName>",
"UseCustomRadiationSurface:=", <boolean>,
"Length:=", "<value><unit>",
Parameters
"Width:=", "<value><unit>",
"LengthSamples:=", <value>,
"WidthSamples:=", <value>,
"CoordSystem:=", <string name of coordinate sys-
tem>)

Return Value None.

Radiation Module Script Commands 20-52


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax InsertRectangleSetup(<RectangleSetupParams>)


oModule.InsertRectangleSetup(
[
"NAME:Rectangle1",
"UseCustomRadiationSurface:=", False,
"Length:=" , "20meter",
Python Example
"Width:=" , "20meter",
"LengthSamples:=" , 41,
"WidthSamples:=" , 41,
"CoordSystem:=" , "Global"
])

VB Syntax InsertRectangleSetup <RectangleSetupParams>


oModule.InsertRectangleSetup _
Array("NAME:Rectangle1", _
"UseCustomRadiationSurface:=", false, _
VB Example
"Length:=", "20meter", "Width:=", "20meter", _
"LengthSamples:=", 41, "WidthSamples:=", 41, _
"CoordSystem:=", "Global")

Radiation Module Script Commands 20-53


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

InsertSphereSetup
Inserts a near field sphere radiation setup.

UI Access Right-click on Radiation in the project tree ,select Insert Near Field Setup > Sphere...

Name Type Description


<SphereSetupParams> Array Structured array.
Array("NAME:<SphereSetupName>",
"UseCustomRadiationSurface:=", <boolean>,
"Radius:=", "<value><unit>",
"ThetaStart:=", "<value><unit>",
Parameters
"ThetaStop:=", "<value><unit>",
"ThetaStep:=", "<value><unit>",
"PhiStart:=", "<value><unit>",
"PhiStop:=", "<value><unit>",
"PhiStep:=", "<value><unit>",
"UseLocalCS:=", <boolean>)

Return Value None.

Python Syntax InsertSphereSetup(<SphereSetupParams>)


Python Example oModule.InsertSphereSetup(

Radiation Module Script Commands 20-54


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:Sphere2",
"UseCustomRadiationSurface:=", False,
"Radius:=" , "20meter",
"ThetaStart:=" , "0deg",
"ThetaStop:=" , "180deg",
"ThetaStep:=" , "2deg",
"PhiStart:=" , "-180deg",
"PhiStop:=" , "180deg",
"PhiStep:=" , "2deg",
"UseLocalCS:=" , False
])

VB Syntax InsertSphereSetup <SphereSetupParams>


oModule.InsertSphereSetup _
Array("NAME:Sphere2", _
"UseCustomRadiationSurface:=", false, _
VB Example "Radius:=", "20meter", _
"ThetaStart:=", "0deg", "ThetaStop:=", "180deg", "ThetaStep:=", "2deg", _
"PhiStart:=", "-180deg", "PhiStop:=", "180deg", "PhiStep:=", "2deg", _
"UseLocalCS:=", false)

Radiation Module Script Commands 20-55


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Script Commands for Modifying Antenna Array Setups


EditAntennaArraySetup
EditAntennaArraySetup
Modifies the antenna array setup. There are 3 choices in the setup. The default is set to No Array Setup. There are two (other) kinds
of arrays that the user can set: Regular Array Setup and Custom Array Setup.

UI Access Right-click on Radiation in the project tree, select Antenna Array Setup...

Name Type Description


<AntennaArrayParams> Array Structured array.
Array("NAME:ArraySetupInfo",
"UseOption:=", <string "No Array" | "Parametric
Array" | "Custom Array">,
<ParametricArrayParams> | <CustomArrayParams>)
< Array Structured array.
ParametricArrayParams>
Array("NAME:ParametricArray",
Parameters
"DesignFrequency:=", "<value><unit>",
"LayoutType:=", <integer>,
"CenterCellX:=", "<value><unit>",
"CenterCellY:=", "<value><unit>",
"CenterCellZ:=", "<value><unit>",
"SpecifyDesignInWavelength:=", <boolean>,
"WidthSpacing:=", "<value><unit>",

Radiation Module Script Commands 20-56


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"WidthSpacingInWavelength:=", "<value>",
"Width:=", "<value><unit>",
"WidthInWavelength:=", "<value>",
"LengthSpacing:=", "<value><unit>",
"LengthSpacingInWavelength:=", "<value>",
"Length:=", "<value><unit>",
"LengthInWavelength:=", "<value>",
"SymmetryType:=", <integer>,
"StaggerAngle:=", "<value><unit>",
"StaggerType:=", <integer>,
"UDirnX:=", "<integer>",
"UDirnY:=", "<integer>",
"UDirnZ:=", "<integer>",
"VDirnX:=", "<integer>",
"VDirnY:=", "<integer>",
"VDirnZ:=", "<integer>",
"WeightType:=", <integer>,
"EdgeTaperX_db:=", "<integer>",
"CosineExp:=", "<integer>",
"DifferentialType:=", <integer>,
"Behavior:=", <string>,

Radiation Module Script Commands 20-57


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ScanAnglePhi:=", "<value><unit>",
"ScanAngleTheta:=", "<value><unit>",
"UDirnPhaseShift:=", "<value><unit>",
"VDirnPhaseShift:=", "<value><unit>")
<CustomArrayParams> Array Structured array.
Array("NAME:CustomArray",
"NumCells:=", <int>,
<CellsParamsArray>)
<CellsParamsArray> Array Structured array.
Array("NAME:Cell",
<CellParams>, <CellParams>, ...)
<CellParams> Array Structured array.
Array("Name:<CellName>",
"XCoord:=", <double>,
"YCoord:=", <double>,
"ZCoord:=", <double>,
"Amplitude:=", <double>,
"Phase:=", <double>)

Return Value None.

Radiation Module Script Commands 20-58


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax EditAntennaArraySetup(<AntennaArrayParams>)


oModule.EditAntennaArraySetup(
[
"NAME:ArraySetupInfo",
"UseOption:=" , "ParametricArray",
["NAME:ParametricArray",
"DesignFrequency:=" , "1GHz",
"LayoutType:=" , 1,
"CenterCellX:=" , "0mm",
"CenterCellY:=" , "0mm",
"CenterCellZ:=" , "0mm",
Python Example
"SpecifyDesignInWavelength:=", False,
"WidthSpacing:=" , "60mm",
"WidthSpacingInWavelength:=", "0.200138457118891",
"Width:=" , "480mm",
"WidthInWavelength:=" , "1.60110765695113",
"LengthSpacing:=" , "60mm",
"LengthSpacingInWavelength:=", "0.200138457118891",
"Length:=" , "360mm",
"LengthInWavelength:=" , "1.20083074271335",
"SymmetryType:=" , 0,

Radiation Module Script Commands 20-59


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"StaggerAngle:=" , "0deg",
"StaggerType:=" , 0,
"UDirnX:=" , "0",
"UDirnY:=" , "0",
"UDirnZ:=" , "-1",
"VDirnX:=" , "1",
"VDirnY:=" , "0",
"VDirnZ:=" , "0",
"WeightType:=" , 3,
"EdgeTaperX_db:=" , "-200",
"CosineExp:=" , "1",
"DifferentialType:=" , 0,
"Behavior:=" , "UseSlaveSettings",
"ScanAnglePhi:=" , "135deg",
"ScanAngleTheta:=" , "45deg",
"UDirnPhaseShift:=" , "0deg",
"VDirnPhaseShift:=" , "0deg"]
])

Radiation Module Script Commands 20-60


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax EditAntennaArraySetup <AntennaArrayParams>


oModule.EditAntennaArraySetup _
Array("NAME:ArraySetupInfo", "UseOption:=",
"NoArray")
oModule.EditAntennaArraySetup _
Array("NAME:ArraySetupInfo",
"UseOption:=", "CustomArray",_
Array("NAME:CustomArray", _
"NumCells:=", 3,_
Array("NAME:Cell", _
VB Example
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))))

Script Commands for Exporting Antenna Parameters and Max Field Parameters
ExportRadiationParametersToFile

Radiation Module Script Commands 20-61


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ExportElementPatternToFile
ExportElementPatternToFile
Exports far field data for specified elements to a file.

UI Access Export Element Pattern button in Antenna Parameters dialog box.

Name Type Description


<ExportElementPatternFileParams> Array Structured array.
Array(
"ExportFileName:=", <string file name
include path>,
"SetupName:=" , <string radiation setup
to use>,
"IntrinsicVariationKey:=", <string fre-
Parameters quency at which to extract the para-
meters>,
"DesignVariationKey:=", <string design
variations at which to extract the para-
meters.>,
"SolutionName:=", <string solution to
use>,
"SourceGroupName:=", <string source group
to use>)

Return Value None.

Radiation Module Script Commands 20-62


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ExportElementPatternToFile(<ExportElementPatternFileParams>)


oModule.ExportElementPatternToFile(
[
"ExportFileName:=" , "C:\Documents\\exportelement2.ffd",
"SetupName:=" , "3D",
Python Example
"IntrinsicVariationKey:=", "Freq=\'28GHz\'",
"DesignVariationKey:=" , "antipad_rad=\'0.14999999999999999mm\'",
"SolutionName:=" , "Setup1 : LastAdaptive"
])

VB Syn- ExportElementPatternToFile <ExportElementPatternFileParams>


tax

oModule.ExportElementPatternToFile Array("ExportFileName:=", "C:\Docu-


ments\exportelement1.ffd", _
"SetupName:=", "3D", _
VB
"IntrinsicVariationKey:=", "Freq=" & Chr(39) & "28GHz" & Chr(39) & "", _
Example
"DesignVariationKey:=", "antipad_rad=" & Chr(39) & "0.14999999999999999mm" & Chr(39) &
", _
"SolutionName:=", "Setup1 : LastAdaptive")

ExportFieldsToFile
Exports fields to a file.

Radiation Module Script Commands 20-63


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access From the Antenna Parameters dialog box, Export Fields to .ffd file.

Name Type Description


<ExportParams> Array Structured array.
Array("ExportFileName:=", <string file name include
path>,
"SetupName:=", <string name of the Radiation Far Field
or Near Field setup>,
Parameters
"IntrinsicVariationKey:=", <string from the Antenna
Parameters dialog.>,
"DesignVariationKey:=", <string>,
"SolutionName:=" , <string name of solution to use>,
"Quantity:=" , <string antenna Parameter name. If
empty, all parameters are exported.>)

Return Value None.

Python Syntax ExportFieldsToFile (<ExportParams>)


oModule.ExportFieldsToFile(
[
Python Example "ExportFileName:=", "C:/exportfields.ffd",
"SetupName:=", "Infinite Sphere1",
"IntrinsicVariationKey:=", "Freq=\'4.5GHz\'",

Radiation Module Script Commands 20-64


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"DesignVariationKey:=", "",
"SolutionName:=", "4500MHz : LastAdaptive",
"Quantity:=", ""
])

VB Syntax ExportFieldsToFile <ExportParams>


oModule.ExportFieldsToFile _
Array("ExportFileName:=", "C:/exportfields.ffd", _
"SetupName:=", "Infinite Sphere1", _
"IntrinsicVariationKey:=", "Freq=" & Chr(39) & "6GHz" & Chr(39) & "", _
VB Example
"DesignVariationKey:=", "",
"SolutionName:=", "Setup1 : LastAdaptive", _
"SourceGroupName:=", "Source Group1", _
"Quantity:=", "")

ExportParametersToFile
Exports antenna parameters to a file.

UI Access Click Export in the Antenna Parameters dialog.

Name Type Description


Parameters <DefParams> Array Structured array.
Array(

Radiation Module Script Commands 20-65


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ExportFileName:=", <string file name include path>,


"SetupName:=", <string name of setup to export>,
"IntrinsicVariationKey:=", <string>,
"DesignVariationKey:=" , <string>,
"SolutionName:=", <string name of solution to export>,
"Quantity:=" , <string name of quantity, empty to
export all>)

Return Value None.

Python Syntax ExportParametersToFile(<DefParams>)


oModule.ExportParametersToFile(
[
"ExportFileName:=", "C:/exportparams.txt",
"SetupName:=", "Infinite Sphere1",
Python Example "IntrinsicVariationKey:=", "Freq=\'4.5GHz\'",
"DesignVariationKey:=", "",
"SolutionName:=", "4500MHz : LastAdaptive",
"Quantity:=", ""
])

Radiation Module Script Commands 20-66


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax ExportParametersToFile(<DefParams>
oModule.ExportParametersToFile _
Array("ExportFileName:=", "C:/exportparams.txt", _
"SetupName:=", "Infinite Sphere1", _
VB Example "IntrinsicVariationKey:=", "Freq=\'4.5GHz\'", _
"DesignVariationKey:=", "", _
"SolutionName:=", "4500MHz : LastAdaptive", _
"Quantity:=", "")

ExportRadiationFieldsToFile
Exports radiation fields to a file.

UI Access N/A

Name Type Description


<ExportParams> Array Structured array.
Array("ExportFileName:=", <string file name include
path>,
"SetupName:=", <string name of the Radiation Far Field
or Near Field setup>,
Parameters
"IntrinsicVariationKey:=", <string from the Antenna
Parameters dialog.>,
"DesignVariationKey:=", <string>,
"SolutionName:=" , <string name of solution to use>,
"Quantity:=" , <string antenna Parameter name. If

Radiation Module Script Commands 20-67


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

empty, all parameters are exported.>)

Return Value None.

Python Syntax ExportRadiationFieldsToFile (<ExportParams>)


oModule.ExportRadiationFieldsToFile(
[
"ExportFileName:=", "C:/exportfields.ffd",
"SetupName:=", "Infinite Sphere1",
Python Example "IntrinsicVariationKey:=", "Freq=\'4.5GHz\'",
"DesignVariationKey:=", "",
"SolutionName:=", "4500MHz : LastAdaptive",
"Quantity:=", ""
])

VB Syntax ExportRadiationFieldsToFile <ExportParams>


oModule.ExportRadiationFieldsToFile _
VB Example Array("ExportFileName:=", "C:/exportfields.ffd", _
"SetupName:=", "Infinite Sphere1", _

Radiation Module Script Commands 20-68


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"IntrinsicVariationKey:=", "Freq=" & Chr(39) & "6GHz" & Chr(39) & "", _
"DesignVariationKey:=", "",
"SolutionName:=", "Setup1 : LastAdaptive", _
"SourceGroupName:=", "Source Group1", _
"Quantity:=", "")

ExportRadiationParametersToFile
Exports radiation parameters to a file. This command can be used to export the max quantities of a near-field setup and, in the case of
far fields, the antenna parameters to the specified file.

UI Access HFSS > Radiation > Compute Max/Antenna Params

Name Type Description


<ExportToFileParams> Array Structured array.
Array("ExportFileName:=", <string file name
include path>
Parameters "SetupName:=", <string>
"IntrinsicVariationKey:=", <string>,
"DesignVariationKey:=", <string>,
"SolutionName:=", <string>)

Return Value None.

Python Syntax ExportRadiationParametersToFile(<ExportToFileParams>)


Python Example oModule.ExportRadiationParametersToFile(

Radiation Module Script Commands 20-69


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"ExportFileName:=", "C:\projects\exportantparams.txt",
"SetupName:=", "Infinite Sphere1",
"IntrinsicVariationKey:=", "Freq='10GHz'",
"DesignVariationKey:=", "",
"SolutionName:=", "LastAdaptive"
])

VB Syntax ExportRadiationParametersToFile <ExportToFileParams>


oModule.ExportRadiationParametersToFile _
Array("ExportFileName:=", _
"C:\projects\exportantparams.txt",_
VB Example "SetupName:=", "Infinite Sphere1", _
"IntrinsicVariationKey:=", "Freq='10GHz'", _
"DesignVariationKey:=", "",
"SolutionName:=", "LastAdaptive")

Radiation Module Script Commands 20-70


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

21 - Radiation Setup Manager Module Script Commands


Radiation Setup Manager commands should be executed by the RadiationSetupMgr module.
Set oModule = oDesign.GetModule("RadiationSetupMgr")
oModule.CommandName <args>
The commands in this module create and change radiation boundaries which can be modified by the Radiation module script com-
mands. Radiation boundaries are divided into a far-field boundary in the shape of an infinite sphere and near-field boundaries in the
shapes of a sphere, line, or plane. Each boundary uses a different set of parameters. The following commands create and edit the radi-
ation boundaries.
l Add or edit a far field infinite sphere
l Add or edit a near-field line
l Add or edit a near-field plane
l Add or edit a near-field sphere

Add (Infinite Sphere)


Adds a far-field radiation boundary in the shape of an infinite sphere.

Note: Only Name and Type are required parameters. If you set a custom Theta or Phi parameter, then you must set all
Theta and Phi parameters. If you have a local coordinate system, then you must set the CS and UseLocalCS parameters.

In the Project Manager under the design name, right click Radiation and in the right-click menu, click Insert Far
UI Access
Field Setup>Infinite Sphere.

Name Type Description


Parameters <Name> String A user-defined name for the infinite sphere.
<Type> String Type of radiation setup. It should be IntiniteSphereFarField.

Radiation Setup Manager Module Script Commands 21-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<VersionID> Integer Optional. Set to 0.


<ID> Integer Optional. Identifier that is created differently for every setup.
<StartTheta > String Optional. Starting point for theta in the spherical coordinate system
for the sphere being defined. The default value is "0deg". Use the
form "<num>deg".
<StartPhi> String Optional. Starting point for phi in the spherical coordinate system
for the sphere being defined. The default value is "-180deg". Use
the form "<num>deg".
<StopTheta> String Optional. Stopping point for theta in the spherical coordinate sys-
tem for the sphere being defined. The default value is "180deg".
Use the form "<num>deg".
<StopPhi> String Optional. Stopping point for phi in the spherical coordinate system
for the sphere being defined. The default value is "1800deg". Use
the form "<num>deg".
<StepTheta> String Optional. Step size between the start and the stop theta values at
which the far field is calculated. The default value is "2deg". Use
the form "<num>deg".
<StepPhi> String Optional. Step size between the start and the stop phi values at
which the far field is calculated. The default value is "2deg". Use
the form "<num>deg".
<CS> Integer Optional. The coordinate system to use. When coordinate system
is local, set this number to the index of the local coordinate system.
Set this value to -1 for a global coordinate system. The default
value is -1.
<UseLocalCS> Boolean Optional. True to select a local coordinate system, and False to
use the global coordinate system. The default value is False.

Return Value None.

Radiation Setup Manager Module Script Commands 21-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.Add(
[
"NAME:<Name>",
"Type:=" , "InfiniteSphereFarField",
"VersionID:=" , 0,
"ID:=" , <ID>,
"StartTheta:=" , "<StartTheta>deg",
Python Syntax "StartPhi:=" , "<StartPhi>deg",
"StopTheta:=" , "<StopTheta>deg",
"StopPhi:=" , "<StopPhi>deg",
"StepTheta:=" , "<StepTheta>deg",
"StepPhi:=" , "<StapPhi>deg",
"CS:=" , <CS>,
"UseLocalCS:=" , <UseLocalCS>
])
oDesign = oDesign.GetModule("RadiationSetupMgr")
oModule.Add(
[
Python Example
"NAME:Infinite Sphere 1",
"Type:=", "InfiniteSphereFarField",
"VersionID:=", 0,

Radiation Setup Manager Module Script Commands 21-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ID:=", 5,
"StartTheta:=", "0deg",
"StartPhi:=", "-180deg",
"StopTheta:=", "180deg",
"StopPhi:=", "180deg",
"StepTheta:=", "2deg",
"StepPhi:=", "2deg",
"CS:=", 1,
"UseLocalCS:=", False
])

oModule.Add Array("NAME:<Name>", "Type:=", "InfiniteSphereFarField", "VersionID:=", 0, "ID:=", <ID>, "StartTheta:=",


VB Syn-
"<StartTheta>deg", "StartPhi:=", "<StartPhi>deg", "StopTheta:=", "<StopPhi>deg", "StopPhi:=", "<StopPhi>deg",
tax
"StepTheta:=", "<StepTheta>deg", "StepPhi:=", "<StepPhi>deg", "CS:=",<CS>, "UseLocalCS:=", <UseLocalCS>)
Set oModule = oDesign.GetModule("RadiationSetupMgr")
oModule.Add Array("NAME:Infinite Sphere 1", "Type:=", "InfiniteSphereFarField", "Ver-
sionID:=", _
VB
Example 0, "ID:=", 0, "StartTheta:=", "0deg", "StartPhi:=", "-180deg", "StopTheta:=", _
"180deg", "StopPhi:=", "180deg", "StepTheta:=", "2deg", "StepPhi:=", "2deg", "CS:=", _
-1, "UseLocalCS:=", false)

Radiation Setup Manager Module Script Commands 21-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Edit (RadiationSetupMgr for Infinite Sphere)


Changes a far-field radiation boundary in the shape of an infinite sphere.

Note: Only Name and Type are required parameters. If you set a custom Theta or Phi parameter, then you must set all
Theta and Phi parameters. If you have a local coordinate system, then you must set the CS and UseLocalCS parameters.

UI Access In the Project Manager under the design name > Radiation, double click on the name of the infinite sphere.

Name Type Description


<Name> String A user-defined name for the infinite sphere.
<Type> String Type of radiation setup. It should be IntiniteSphereFarField.
<VersionID> Integer Optional. Set to 0.
<ID> Integer Optional. Identifier that is created differently for every setup.
<StartTheta > String Optional. Starting point for theta in the spherical coordinate system
for the sphere being defined. Use the form "<num>deg".
<StartPhi> String Optional. Starting point for phi in the spherical coordinate system
for the sphere being defined. Use the form "<num>deg".
<StopTheta> String Optional. Stopping point for theta in the spherical coordinate sys-
Parameters tem for the sphere being defined. Use the form "<num>deg".
<StopPhi> String Optional. Stopping point for phi in the spherical coordinate system
for the sphere being defined. Use the form "<num>deg".
<StepTheta> String Optional. Step size between the start and the stop theta values at
which the far field is calculated. Use the form "<num>deg".
<StepPhi> String Optional. Step size between the start and the stop phi values at
which the far field is calculated. Use the form "<num>deg".
<CS> Integer Optional. The coordinate system to use. When coordinate system
is local, set this number to the index of the local coordinate system.
Set this value to -1 for a global coordinate system.
<UseLocalCS> Boolean Optional. True to select a local coordinate system, and False to
use the global coordinate system.

Radiation Setup Manager Module Script Commands 21-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

oModule.Edit(
[
"NAME:<Name>",
"Type:=" , "InfiniteSphereFarField",
"VersionID:=" , 0,
"ID:=" , <ID>,
"StartTheta:=" , "<StartTheta>deg",
Python Syntax "StartPhi:=" , "<StartPhi>deg",
"StopTheta:=" , "<StopTheta>deg",
"StopPhi:=" , "<StopPhi>deg",
"StepTheta:=" , "<StepTheta>deg",
"StepPhi:=" , "<StapPhi>deg",
"CS:=" , <CS>,
"UseLocalCS:=" , <UseLocalCS>
])
oDesign = oDesign.GetModule("RadiationSetupMgr")
Python Example
oModule.Edit(

Radiation Setup Manager Module Script Commands 21-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:Infinite Sphere 1",
"Type:=", "InfiniteSphereFarField",
"VersionID:=", 0,
"ID:=", 5,
"StartTheta:=", "0deg",
"StartPhi:=", "-180deg",
"StopTheta:=", "180deg",
"StopPhi:=", "180deg",
"StepTheta:=", "2deg",
"StepPhi:=", "2deg",
"CS:=", 1,
"UseLocalCS:=", False
])

oModule.Edit Array("NAME:<Name>", "Type:=", "InfiniteSphereFarField", "VersionID:=", 0, "ID:=", <ID>, "StartTheta:=",


VB Syn-
"<StartTheta>deg", "StartPhi:=", "<StartPhi>deg", "StopTheta:=", "<StopPhi>deg", "StopPhi:=", "<StopPhi>deg",
tax
"StepTheta:=", "<StepTheta>deg", "StepPhi:=", "<StepPhi>deg", "CS:=",<CS>, "UseLocalCS:=", <UseLocalCS>)
Set oModule = oDesign.GetModule("RadiationSetupMgr")
VB oModule.Edit Array("NAME:Infinite Sphere 1", "Type:=", "InfiniteSphereFarField", "Ver-
Example sionID:=", _
0, "ID:=", 0, "StartTheta:=", "0deg", "StartPhi:=", "-180deg", "StopTheta:=", _

Radiation Setup Manager Module Script Commands 21-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"180deg", "StopPhi:=", "180deg", "StepTheta:=", "2deg", "StepPhi:=", "2deg", "CS:=", _


-1, "UseLocalCS:=", false)

Add (Near Field Line)


Adds a near-field radiation boundary in the shape of a line. To calculate the near fields, you must have a 3D line defined across the
design area before creating this type of radiation boundary.

In the Project Manager under the design name, right click Radiation and in the right-click menu, click Insert
UI Access
Near Field Setup>Line.

Name Type Description


<Name> String A user-defined name for the near field line.
<Type> String Type of radiation setup. It should be NearFieldLine.
<VersionID> Integer Optional. Set to 0.
Parameters <ID> Integer Optional. Identifier that is created differently for every setup.
<NFLineID > Integer Optional. Index of the 3D line in the design area across which the
near fields are calculated.
<NumSamples> String Optional. Number of points (samples) needed to calculate the near
fields across the line. Use the form "<num>". The default value is
"1000".

Return Value None.

oModule.Add(
Python Syntax [
"NAME:<Name>",

Radiation Setup Manager Module Script Commands 21-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Type:=" , "NearFieldLine",
"VersionID:=" , 0,
"ID:=" , <ID>,
"NFLineID:=", "<NFLineID>",
"NumSamples:=","<NumSamples>"
])
oDesign = oDesign.GetModule("RadiationSetupMgr")
oModule.Add(
[
"NAME:Line 1",
"Type:=", "NearFieldLine",
Python Example
"VersionID:=", 0,
"ID:=", 7,
"NFLineID:=", 312,
"NumSamples:=", "1000"
])

VB Syn- oModule.Add Array("NAME:<Name>", "Type:=", "NearFieldLine", "VersionID:=", 0, "ID:=", <ID>, "NFLineID:=",


tax <NFLineID>,"NumSamples:=", " <NumSamples>")

VB
Set oModule = oDesign.GetModule("RadiationSetupMgr")
Example oModule.Add Array("NAME:Line 1", "Type:=", "NearFieldLine", "VersionID:=", 0, "ID:=",

Radiation Setup Manager Module Script Commands 21-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

_
4, "NFLineID:=", 312, "NumSamples:=", "1000")

Edit (RadiationSetupMgr for Near Field Line)


Changes a near-field radiation boundary in the shape of a line. To calculate the near fields, you must have a 3D line defined across the
design area before creating this type of radiation boundary.

UI Access In the Project Manager under the design name > Radiation, double click on the name of the line.

Name Type Description


<Name> String A user-defined name for the near field line.
<Type> String Type of radiation setup. It should be NearFieldLine.
<VersionID> Integer Optional. Set to 0.
Parameters <ID> Integer Optional. Identifier that is created differently for every setup.
<NFLineID > Integer Optional. Index of the 3D line in the design area across which the
near fields are calculated.
<NumSamples> String Optional. Number of points (samples) needed to calculate the near
fields across the line. Use the form "<num>".

Return Value None.

oModule.Edit(
[
Python Syntax
"NAME:<Name>",
"Type:=" , "NearFieldLine",

Radiation Setup Manager Module Script Commands 21-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"VersionID:=" , 0,
"ID:=" , <ID>,
"NFLineID:=", "<NFLineID>",
"NumSamples:=","<NumSamples>"
])
oDesign = oDesign.GetModule("RadiationSetupMgr")
oModule.Edit(
[
"NAME:Line 1",
"Type:=", "NearFieldLine",
Python Example
"VersionID:=", 0,
"ID:=", 7,
"NFLineID:=", 312,
"NumSamples:=", "1000"
])

VB Syn- oModule.Edit Array("NAME:<Name>", "Type:=", "NearFieldLine", "VersionID:=", 0, "ID:=", <ID>, "NFLineID:=",


tax <NFLineID>,"NumSamples:=", " <NumSamples>")
Set oModule = oDesign.GetModule("RadiationSetupMgr")
VB
Example oModule.Edit Array("NAME:Line 1", "Type:=", "NearFieldLine", "VersionID:=", 0, "ID:=",
_

Radiation Setup Manager Module Script Commands 21-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

4, "NFLineID:=", 312, "NumSamples:=", "1000")

Add (Near Field Plane)


Adds a near-field radiation boundary in the shape of a plane. This plane is calculated in reference to a rectangle defined by the X and
Y parameters.

In the Project Manager under the design name, right click Radiation and in the right-click menu, click Insert
UI Access
Near Field Setup>Plane.

Name Type Description


<Name> String A user-defined name for the near field sphere.
<Type> String Type of radiation setup. It should be NearFieldSphere.
<VersionID> Integer Optional. Set to 0.
<ID> Integer Optional. Identifier that is created differently for every setup.
<MinX > String Optional. Starting X value for the plane that the near fields will be
calculated for. The default value is "-41.5mm". Use the form
"<num><unit>".
<MaxX> String Optional. Final X value for the plane that the near fields will be cal-
culated for. The default value is "8.5mm". Use the form
Parameters "<num><unit>".
<MinY> String Optional. Starting Y value for the plane that the near fields will be
calculated for. The default value is "16mm". Use the form
"<num><unit>".
<MaxY> String Optional. Final Y value for the plane that the near fields will be cal-
culated for. The default value is "16mm". Use the form
"<num><unit>".
<Height> String Optional. Height of the reference rectangle. The default value is
"1.652145mm". Use the form "<num>".
<ExpFactor> String Optional. The X and Y dimensions are multipled by this exponential
factor to determine new dimensions for the plane. For example, set

Radiation Setup Manager Module Script Commands 21-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

to 1 to use the default calculated dimensions of the plane or set to 2


to double each dimension of the plane. The default value is "1".
Use the form "<num>".
<UseExpFactor> Boolean Optional. Set to True to add the exponent factor to the plane dimen-
sions or False to use the automatically calculated plane dimen-
sions or user-defined plane dimensions. The default value is False.
<CSID> Integer Optional. An identifier for the coordinate system.

Return Value None.

oModule.Add(
[
"NAME:<Name>",
"Type:=" , "NearFieldPlane",
"VersionID:=" , 0,
"ID:=" , <ID>,
"MinX:=" , "<MinX>",
Python Syntax
"MaxX:=" , "<MaxX>",
"MinY:=" , "<MinY>",
"MaxY:=" , "<MaxY>",
"Height:=" , "<Height>",
"ExpFactor:=" , "<ExpFactor>",
"UseExpFactor:=" , <UseExpFactor>,
"CSID:=" , <CSID>

Radiation Setup Manager Module Script Commands 21-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

])
oDesign = oDesign.GetModule("RadiationSetupMgr")
oModule.Add(
[
"NAME:Plane 1",
"Type:=", "NearFieldPlane",
"VersionID:=", 0,
"ID:=", 7,
"MinX:=", "-50mm",
Python Example
"MaxX:=", "25mm",
"MinY:=", "-18.5mm",
"MaxY:=", "31.5mm",
"Height:=", "5.6mm",
"ExpFactor:=", "1",
"UseExpFactor:=", False,
"CSID:=", -4
])

VB Syn- oModule.Add Array("NAME:<Name>", "Type:=", "NearFieldPlane", "VersionID:=", 0, "ID:=", <ID>, "MinX:=", "<MinX>",
tax "MaxX:=", "<MaxX>", "MinY:=", "<MinY>", "MaxY:=", "<MaxY>", "Height:=", "<Height>", "ExpFactor:=", "<ExpFactor>",

Radiation Setup Manager Module Script Commands 21-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"CSID:=",<CSID>)
Set oModule = oDesign.GetModule("RadiationSetupMgr")
oModule.Add Array("NAME:Plane 1", "Type:=", "NearFieldPlane", "VersionID:=", 0,
VB "ID:=", _
Example 2, "MinX:=", "-49mm", "MaxX:=", "19mm", "MinY:=", "-11mm", "MaxY:=", "29mm",
"Height:=", _
"4.652145mm", "ExpFactor:=", "1", "UseExpFactor:=", false, "CSID:=", -3)

Edit (RadiationSetupMgr for Near Field Plane)


Changes a near-field radiation boundary in the shape of a plane. This plane is calculated in reference to a rectangle defined by the X
and Y parameters.

UI Access In the Project Manager under the design name > Radiation, double click on the name of the plane.

Name Type Description


<Name> String A user-defined name for the near field sphere.
<Type> String Type of radiation setup. It should be NearFieldSphere.
<VersionID> Integer Optional. Set to 0.
<ID> Integer Optional. Identifier that is created differently for every setup.
<MinX > String Optional. Starting X value for the plane that the near fields will be
calculated for. Use the form "<num><unit>".
Parameters <MaxX> String Optional. Final X value for the plane that the near fields will be cal-
culated for. Use the form "<num><unit>".
<MinY> String Optional. Starting Y value for the plane that the near fields will be
calculated for. Use the form "<num><unit>".
<MaxY> String Optional. Final Y value for the plane that the near fields will be cal-
culated for. Use the form "<num><unit>".
<Height> String Optional. Height of the reference rectangle. Use the form "<num>".
<ExpFactor> String Optional. The X and Y dimensions are multipled by this exponential

Radiation Setup Manager Module Script Commands 21-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

factor to determine new dimensions for the plane. For example, set
to 1 to use the default calculated dimensions of the plane or set to 2
to double each dimension of the plane. Use the form "<num>".
<UseExpFactor> Boolean Optional. Set to True to add the exponent factor to the plane dimen-
sions or False to use the automatically calculated plane dimen-
sions or user-defined plane dimensions.
<CSID> Integer Optional. An identifier for the coordinate system.

Return Value None.

oModule.Edit(
[
"NAME:<Name>",
"Type:=" , "NearFieldPlane",
"VersionID:=" , 0,
"ID:=" , <ID>,
Python Syntax
"MinX:=" , "<MinX>",
"MaxX:=" , "<MaxX>",
"MinY:=" , "<MinY>",
"MaxY:=" , "<MaxY>",
"Height:=" , "<Height>",
"ExpFactor:=" , "<ExpFactor>",

Radiation Setup Manager Module Script Commands 21-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"UseExpFactor:=" , <UseExpFactor>,
"CSID:=" , <CSID>
])
oDesign = oDesign.GetModule("RadiationSetupMgr")
oModule.Edit(
[
"NAME:Plane 1",
"Type:=", "NearFieldPlane",
"VersionID:=", 0,
"ID:=", 7,
"MinX:=", "-50mm",
Python Example
"MaxX:=", "25mm",
"MinY:=", "-18.5mm",
"MaxY:=", "31.5mm",
"Height:=", "5.6mm",
"ExpFactor:=", "1",
"UseExpFactor:=", False,
"CSID:=", -4
])

VB Syn- oModule.Edit Array("NAME:<Name>", "Type:=", "NearFieldPlane", "VersionID:=", 0, "ID:=", <ID>, "MinX:=", "<MinX>",

Radiation Setup Manager Module Script Commands 21-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MaxX:=", "<MaxX>", "MinY:=", "<MinY>", "MaxY:=", "<MaxY>", "Height:=", "<Height>", "ExpFactor:=", "<ExpFactor>",
tax
"CSID:=",<CSID>)
Set oModule = oDesign.GetModule("RadiationSetupMgr")
oModule.Edit Array("NAME:Plane 1", "Type:=", "NearFieldPlane", "VersionID:=", 0,
VB "ID:=", _
Example 2, "MinX:=", "-49mm", "MaxX:=", "19mm", "MinY:=", "-11mm", "MaxY:=", "29mm",
"Height:=", _
"4.652145mm", "ExpFactor:=", "1", "UseExpFactor:=", false, "CSID:=", -3)

Add (Near Field Sphere)


Adds a near-field radiation boundary in the shape of a sphere.

Note: Only Name and Type are required parameters. If you set a custom Theta or Phi parameter, then you must set all
Theta and Phi parameters. If you have a local coordinate system, then you must set the CS and UseLocalCS parameters.

In the Project Manager under the design name, right click Radiation and in the right-click menu, click Insert
UI Access
Near Field Setup>Sphere.

Name Type Description


<Name> String A user-defined name for the near field sphere.
<Type> String Type of radiation setup. It should be NearFieldSphere.
Parameters <VersionID> Integer Optional. Set to 0.
<ID> Integer Optional. Identifier that is created differently for every setup.
<StartTheta > String Optional. Starting point for theta in the spherical coordinate system
for the sphere being defined. The default value is "0deg". Use the
form "<num>deg".

Radiation Setup Manager Module Script Commands 21-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<StartPhi> String Optional. Starting point for phi in the spherical coordinate system
for the sphere being defined. The default value is "-180deg". Use
the form "<num>deg".
<StopTheta> String Optional. Stopping point for theta in the spherical coordinate sys-
tem for the sphere being defined. The default value is "180deg".
Use the form "<num>deg".
<StopPhi> String Optional. Stopping point for phi in the spherical coordinate system
for the sphere being defined. The default value is "1800deg". Use
the form "<num>deg".
<StepTheta> String Optional. Step size between the start and the stop theta values at
which the far field is calculated. The default value is "2deg". Use
the form "<num>deg".
<StepPhi> String Optional. Step size between the start and the stop phi values at
which the far field is calculated. The default value is "2deg". Use
the form "<num>deg".
<CS> Integer Optional. The coordinate system to use. When coordinate system
is local, set this number to the index of the local coordinate system.
Set this value to -1 for a global coordinate system. The default
value is -1.
<UseLocalCS> Boolean Optional. True to select a local coordinate system, and False to
use the global coordinate system. The default value is False.
<NFRadius> String Optional. Radius of the sphere we want to calculate near fields on.
The default value is "20mm".Use the form "<num><unit>".

Return Value None.

oModule.Add(
[
Python Syntax
"NAME:<Name>",
"Type:=" , "InfiniteSphereFarField",

Radiation Setup Manager Module Script Commands 21-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"VersionID:=" , 0,
"ID:=" , <ID>,
"StartTheta:=" , "<StartTheta>deg",
"StartPhi:=" , "<StartPhi>deg",
"StopTheta:=" , "<StopTheta>deg",
"StopPhi:=" , "<StopPhi>deg",
"StepTheta:=" , "<StepTheta>deg",
"StepPhi:=" , "<StapPhi>deg",
"CS:=" , <CS>,
"UseLocalCS:=" , <UseLocalCS>,
"NFRadius:=", "<NFRadius>"
])
oDesign = oDesign.GetModule("RadiationSetupMgr")
oModule.Add(
[
"NAME:Sphere 1",
Python Example
"Type:=", "NearFieldSphere",
"VersionID:=", 0,
"ID:=", 7,
"StartTheta:=", "0deg",

Radiation Setup Manager Module Script Commands 21-20


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"StartPhi:=", "-180deg",
"StopTheta:=", "180deg",
"StopPhi:=", "180deg",
"StepTheta:=", "2deg",
"StepPhi:=", "2deg",
"CS:=", -1,
"UseLocalCS:=", False,
"NFRadius:=", "20mm"
])

oModule.Add Array("NAME:<Name>", "Type:=", "NearFieldSphere", "VersionID:=", 0, "ID:=", <ID>, "StartTheta:=",


VB Syn- "<StartTheta>deg", "StartPhi:=", "<StartPhi>deg", "StopTheta:=", "<StopPhi>deg", "StopPhi:=", "<StopPhi>deg",
tax "StepTheta:=", "<StepTheta>deg", "StepPhi:=", "<StepPhi>deg", "CS:=",<CS>, "UseLocalCS:=",
<UseLocalCS>,"NFRadius:=", " <NFRadius>")
Set oModule = oDesign.GetModule("RadiationSetupMgr")
oModule.Add Array("NAME:Sphere 1", "Type:=", "NearFieldSphere", "VersionID:=", 0,
"ID:=", _
VB
3, "StartTheta:=", "0deg", "StartPhi:=", "-180deg", "StopTheta:=", "180deg",
Example
"StopPhi:=", _
"180deg", "StepTheta:=", "2deg", "StepPhi:=", "2deg", "CS:=", -1, "UseLocalCS:=", _
false, "NFRadius:=", "20mm")

Radiation Setup Manager Module Script Commands 21-21


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Edit (RadiationSetupMgr for Near Field Sphere)


Changes a near-field radiation boundary in the shape of a sphere.

Note: Only Name and Type are required parameters. If you set a custom Theta or Phi parameter, then you must set all
Theta and Phi parameters. If you have a local coordinate system, then you must set the CS and UseLocalCS parameters.

UI Access In the Project Manager under the design name > Radiation, double click on the name of the near-field sphere.

Name Type Description


<Name> String A user-defined name for the near field sphere.
<Type> String Type of radiation setup. It should be NearFieldSphere.
<VersionID> Integer Optional. Set to 0.
<ID> Integer Optional. Identifier that is created differently for every setup.
<StartTheta > String Optional. Starting point for theta in the spherical coordinate system
for the sphere being defined. Use the form "<num>deg".
<StartPhi> String Optional. Starting point for phi in the spherical coordinate system
for the sphere being defined. Use the form "<num>deg".
Parameters <StopTheta> String Optional. Stopping point for theta in the spherical coordinate sys-
tem for the sphere being defined. Use the form "<num>deg".
<StopPhi> String Optional. Stopping point for phi in the spherical coordinate system
for the sphere being defined. Use the form "<num>deg".
<StepTheta> String Optional. Step size between the start and the stop theta values at
which the far field is calculated. Use the form "<num>deg".
<StepPhi> String Optional. Step size between the start and the stop phi values at
which the far field is calculated. Use the form "<num>deg".
<CS> Integer Optional. The coordinate system to use. When coordinate system
is local, set this number to the index of the local coordinate system.
Set this value to -1 for a global coordinate system.

Radiation Setup Manager Module Script Commands 21-22


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<UseLocalCS> Boolean Optional. True to select a local coordinate system, and False to
use the global coordinate system.
<NFRadius> String Optional. Radius of the sphere we want to calculate near fields on.
Use the form "<num><unit>".

Return Value None.

oModule.Edit(
[
"NAME:<Name>",
"Type:=" , "InfiniteSphereFarField",
"VersionID:=" , 0,
"ID:=" , <ID>,
"StartTheta:=" , "<StartTheta>deg",
"StartPhi:=" , "<StartPhi>deg",
Python Syntax
"StopTheta:=" , "<StopTheta>deg",
"StopPhi:=" , "<StopPhi>deg",
"StepTheta:=" , "<StepTheta>deg",
"StepPhi:=" , "<StapPhi>deg",
"CS:=" , <CS>,
"UseLocalCS:=" , <UseLocalCS>,
"NFRadius:=", "<NFRadius>"
])

Radiation Setup Manager Module Script Commands 21-23


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDesign = oDesign.GetModule("RadiationSetupMgr")
oModule.Edit(
[
"NAME:Sphere 1",
"Type:=", "NearFieldSphere",
"VersionID:=", 0,
"ID:=", 7,
"StartTheta:=", "0deg",
Python Example "StartPhi:=", "-180deg",
"StopTheta:=", "180deg",
"StopPhi:=", "180deg",
"StepTheta:=", "2deg",
"StepPhi:=", "2deg",
"CS:=", -1,
"UseLocalCS:=", False,
"NFRadius:=", "20mm"
])

VB Syn- oModule.Edit Array("NAME:<Name>", "Type:=", "NearFieldSphere", "VersionID:=", 0, "ID:=", <ID>, "StartTheta:=",


tax "<StartTheta>deg", "StartPhi:=", "<StartPhi>deg", "StopTheta:=", "<StopPhi>deg", "StopPhi:=", "<StopPhi>deg",

Radiation Setup Manager Module Script Commands 21-24


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"StepTheta:=", "<StepTheta>deg", "StepPhi:=", "<StepPhi>deg", "CS:=",<CS>, "UseLocalCS:=",


<UseLocalCS>,"NFRadius:=", " <NFRadius>")
Set oModule = oDesign.GetModule("RadiationSetupMgr")
oModule.Edit Array("NAME:Sphere 1", "Type:=", "NearFieldSphere", "VersionID:=", 0,
"ID:=", _
VB
3, "StartTheta:=", "0deg", "StartPhi:=", "-180deg", "StopTheta:=", "180deg",
Example
"StopPhi:=", _
"180deg", "StepTheta:=", "2deg", "StepPhi:=", "2deg", "CS:=", -1, "UseLocalCS:=", _
false, "NFRadius:=", "20mm")

Radiation Setup Manager Module Script Commands 21-25


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

21-26
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

22 - User Defined Document Script Commands


The product has to implement the GetModule call to create the UserDefinedDocument scripting object (e.g., Check
AltraSimDesign.cpp (function GetMgrIDispatch()). To access the UserDefinedDocuments scripting object, use:
Set oModule = oDesign.GetModule("UserDefinedDocuments")
Once you have the scripting object, you can use the following methods:
l AddDocument
l EditDocument
l RenameDocument
l DeleteDocument
l UpdateDocument
l ViewHtmlDocument
l ViewPdfDocument
l SaveHtmlDocumentAs
l SavePdfDocumentAs
l GetDocumentDefinitionNames
l DeleteAllDocuments
l UpdateAllDocuments

You can find examples of how to use these methods on each of the methods' pages. A complete example of a Python script is also
available, as is an example with a line by line explanation.

AddDocument
Creates a new document based on provided data and traces. The document names come from UserDefinedDocument folder under
syslib, userlib, and personallib. This creates a document and places it in the Project Manager under Results > Documents.

User Defined Document Scripting Interface 22-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Right click on Results > Create Document. Choose a document name.

Name Type Description


Parameters <data> Array Data the defines the document.
<traces> Array trace data for the inputs in the document.

Return Value None

Python Syntax AddDocument (<data>, <traces>)


oModule.AddDocument(
[
"NAME:Design Summary",
"",
"SysLib",
Python Example
"DesignSummary",
["NAME:Inputs"]
],
["NAME:DocTraces"]
)

VB Syn- AddDocument <data>, <traces>


tax

User Defined Document Scripting Interface 22-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

In this example, the document names come from the UserDefinedDocument folder in the syslib, userlib, and personallib
folders. This creates a document and places it in the Documents folder under results.
oModule.AddDocument _
Array("NAME:Design Summary", _
"", "SysLib", "DesignSummary", _
Array("NAME:Inputs")), _
Array("NAME:DocTraces")
The following example is explained in Explication of a Sample UDD Script.
oModule.AddDocument Array("NAME:Test Report1", "Test Report", "SysLib", _
"Examples/TestUDDInputs", Array("NAME:Inputs", Array("NAME:DLMetrics", "Solution", _
"Data Line Metrics", -1, -1), Array("NAME:DQ0", "Trace", "DQ0", -1, -1), _
VB
Example Array("NAME:DQS", "Trace", "DQS", -1, -1), _
Array("NAME:Name", "Text", "User Name", Array("Sita Ramesh")), _
Array("NAME:Summary", "Bool", "Display Summary", Array(true)), _
Array("NAME:Version", "Number", "Script Version"))), _
Array("NAME:DocTraces", Array("NAME:DLMetrics", _
Array("User Defined", "", "DDR3 AC-Timing 4-DQ1", Array("Context:=", ""), _
Array("Index:=", Array("All"), "Trise:=", Array( "Nominal"), "Tfall:=", _
Array("Nominal"), "Pulse_Width:=", Array("Nominal"), _
"Data_Rate:=", Array( "Nominal"),"Length:=", Array("Nominal")), _
Array("Probe Component:=", Array("")), Array())), _
Array("NAME:DQ0", Array( _

User Defined Document Scripting Interface 22-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Standard", "DQ0", "NexximTransient", Array("NAME:Context", "SimValueContext:=", Array


( _
1, 0, 2, 0, false, false, -1, 1, 0, 1, 1, "", 0, 0, _
"DE", false, "0", "DP", false, "20000000", "DT", false, "0.001", "WE", _
false, "100ns", "WM", false, "100ns", "WN", false, "0ps", "WS", false, "0ps")), _
Array("Time:=", Array("All"), "Trise:=", Array("Nominal"), "Tfall:=", Array("Nom-
inal"), _
"Pulse_Width:=", Array("Nominal"), "Data_Rate:=", Array("Nominal"), _
"Length:=", Array("Nominal")), Array("Probe Component:=", Array("DQ0")), Array())))

DeleteAllDocuments
Deletes all documents in the object.

UI Access Right click on Documents in the Project Manager and click Delete All Documents.
Parameters None.
Return Value None.

Python Syntax DeleteAllDocuments()


Python Example oModule.DeleteAllDocuments()

VB Syntax DeleteAllDocuments

User Defined Document Scripting Interface 22-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oModule.DeleteAllDocuments

DeleteDocument
Deletes a specified document.

UI Access Right click on the created document in the Project Manager under Results > Documents and click Delete.

Name Type Description


Parameters
<name> String Name of the document to be deleted.

Return Value None.

Python Syntax DeleteDocument(<names>)


Python Example oModule.DeleteDocument("Project Design Summary")

VB Syntax DeleteDocument <names>


oModule.DeleteDocument "Project Design Summary"
VB Example

EditDocument
Edits specified documents. If the document pops up a dialog box, the user can make a change the inputs for the document. The doc-
ument is regenerated and updated. A new one is not created.

Right click on the created document in the Project Manager under Results > Documents and click Modify doc-
UI Access
ument.

User Defined Document Scripting Interface 22-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<originalName> String Name of the original document
Parameters
<modifiedData> Array New data to add to or modify the document
<modifiedraces> Array Trace data for the inputs of the document

Return Value None.

Python Syntax EditDocument( <name>,<data>,<traces>)


oModule.EditDocument("Design Summary",
[
"NAME:Design Summary",
"",
"SysLib",
Python Example
"DesignSummary",
["NAME:Inputs"]
],
["NAME:DocTraces"]
)

VB Syntax EditDocument <name>, <data>, <traces>

User Defined Document Scripting Interface 22-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.EditDocument "Design Summary", _


VB Example Array("NAME:Design Summary", "", "SysLib", _
"DesignSummary", Array("NAME:Inputs")), Array("NAME:DocTraces")

GetDocumentDefinitionNames
Document definition names are the list of names that can be used to create a document. They appear when you click on Create doc-
ument. This method returns the filenames of document definitions according to the files in the installation directories:
l syslib/UserDefinedDocuments
l userlib/UserDefinedDocuments
l personalllb/UserDefinedDocuments

UI Access NA

Name Type Description


Parameters
<separator> String Separator used to convey the directory "level"

Return Value None.

Python Syntax GetDocumentDefinitionNames(<separator>)


Python Example oModule.GetDocumentDefinitionNames("/")

VB Syntax GetDocumentDefinitionNames <separator>


VB Example oModule.GetDocumentDefinitionNames "/"

User Defined Document Scripting Interface 22-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetDocumentNames
Retrieves the names for all documents.

UI Access N/A
Parameters None.
Return Value Array of strings containing document names.

Python Syntax GetDocumentNames()


Python Example oModule.GetDocumentNames()

VB Syntax GetDocumentNames
VB Example oModule.GetDocumentNames

RenameDocument
Changes the name of a document.

UI Access Right click on the created document in the Project Manager under Results> Documents and click Rename.

Name Type Description


Parameters <oldName> String Current name of the document
<newName> String New name of the document

User Defined Document Scripting Interface 22-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax RenameDocument(<oldName>, <newName>)


Python Example oModule.RenameDocument("Design Summary", "Project Design Summary")

VB Syntax RenameDocument <oldName>, <newName>


VB Example oModule.RenameDocument "Design Summary", "Project Design Summary"

SaveHtmlDocumentAs
Saves a pre-existing HTML file to a different name and/or location.

Right click on the created document in the Project Manager under Results > Documents and click Save As >
UI Access
HTML.

Name Type Description


Parameters <name> String Name of the document to be saved.
<saveTo> String File path to save the document to.

Return Value none

Python Syntax SaveHtmlDocumentAs(<name>, <saveTo>)


Python Example oModule.SaveHtmlDocumentAs("Design Summary 1", "DS1.html")

User Defined Document Scripting Interface 22-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax SaveHtmlDocumentAs <name> <saveTo>


VB Example oModule.SaveHtmlDocumentAs "Design Summary 1" "DS1.html"

SavePdfDocumentAs
Saves a pre-existing PDF file to a different name and/or location.

Right click on the created document in the Project Manager under Results > Documents and click Save As >
UI Access
PDF.

Name Type Description


Parameters <name> String Name of the document to be saved.
<saveTo> String File path to save the document at.

Return Value None.

Python Syntax SavePdfDocumentAs(<name>, <saveTo>)


Python Example oModule.SavePdfDocumentAs("Design Summary 1", "DS1.pdf")

VB Syntax SavePdfDocumentAs <name>, <saveTo>


VB Example oModule.SavePdfDocumentAs "Design Summary 1", "DS1.pdf"

UpdateAllDocuments
Refreshes the contents of all created documents. This action is made on the folder rather than the individual document.

User Defined Document Scripting Interface 22-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Right click on Results > Documents in the Project Manager and click Update All Documents.
Parameters None.
Return Value None.

Python Syntax UpdateAllDocuments()


Python Example oModule.UpdateAllDocuments()

VB Syntax UpdateAllDocuments
VB Example oModule.UpdateAllDocuments

UpdateDocument
Refreshes the contents of the selected document.

Right click on the created document in the Project Manager under Results > Documents and click Update
UI Access
Document.

Name Type Description


Parameters
<name> String Name of the document to be updated

Return Value None.

User Defined Document Scripting Interface 22-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax UpdateDocument(<name>)


Python Example oModule.UpdateDocument("Test UDD Report")

VB Syntax UpdateDocument <name>


VB Example oModule.UpdateDocument "Test UDD Report"

ViewHtmlDocument
Displays a pre-existing document as HTML.

Right click on the created document in the Project Manager under Results > Documents and click View Xml
UI Access
Document.

Name Type Description


Parameters
<name> String Name of the document to be viewed as a HTML

Return Value None

Python Syntax ViewHtmlDocument(<name>)


Python Example oModule.ViewHtmlDocument("Design Summary 1")

VB Syntax ViewHtmlDocument <name>


VB Example oModule.ViewHtmlDocument "Design Summary 1"

User Defined Document Scripting Interface 22-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ViewPdfDocument
Displays a pre-existing document as a PDF file.

Right click on the created document in the Project Manager under Results > Documents and click View PDF
UI Access
Document.

Name Type Description


Parameters
<name> String Name of the document to be viewed as a PDF

Return Value None.

Python Syntax ViewPdfDocument(<name>)


Python Example oModule.ViewPdfDocument("Design Summary 1")

VB Syntax ViewPdfDocument <name>


VB Example oModule.ViewPdfDocument "Design Summary 1"

Explication of a Sample UDD Script


This VB script defines a document. It is a portion of one of the UDD example VB scripts.

Array("NAME:Test Report", ' Name of the document


"Test Report", ' Description of the document
"SysLib", ' Location of the python script: Syslib, Userlib, PeronalLib, etc.
"TestUDDReport", ' Relative path of the script in the UserDefinedDocuments folder

' This array is the start of the input definition.

User Defined Document Scripting Interface 22-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Inputs", ' Document Inputs keyword

' This array contains the Solution input.


Array("NAME:DLMetrics", ' Input name
"Solution", ' Solution Input Type
"Data Line Metrics", ' Input Description
-1, ' Solution ID
-1), ' Report ID

' This array contains the trace input.


Array("NAME:DQ0", ' Input name
"Trace", ' Trace Input Type
"DQ0", ' Input Description
-1, ' Solution ID
-1), ' Report ID

' This array contains the text input.


Array("NAME:Name", ' Input name
"Text", ' Text Input Type
"User Name", ' Input Description
Array("Sita Ramesh")), ' Default Value

' This array contains the Bool input.


Array("NAME:Summary", ' Input name
"Bool", ' Boolean Input Type
"Display Summary", ' Input Description
Array(true)), ' Default Value

' This array contains the number input.

User Defined Document Scripting Interface 22-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Version", ' Input name


"Number", ' Number Input Type
"Script Version", ' Input Description
Array(1021)))), ' Default Value

' This array contains trace selection for the solution and trace inputs.
Array("NAME:DocTraces", ' Document traces keyword

' This array has input for "DLMetrics".


Array("NAME:DLMetrics", ' Input name

' This array defines a trace similar to the UDO. This trace definition is a User defined solution
Array("User Defined", "", "DDR3 AC-Timing 4-DQ1", Array("Context:=", ""), Array("Index:=", Array
("All"), "Trise:=", Array("Nominal"), "Tfall:=", Array("Nominal"), "Pulse_Width:=", Array("Nom-
inal"), "Data_Rate:=", Array("Nominal"), "Length:=", Array("Nominal")), Array("Probe Com-
ponent:=", Array("")), Array())),

' This array is for input "DQ0".


Array("NAME:DQ0",

' This array defines a trace similar to the UDO. This trace definition is a Standard solution.
Array("Standard", "DQ0", "NexximTransient", Array("NAME:Context", "SimValueContext:=", Array(1,
0, 2, 0, false, false, -1, 1, 0, 1, 1, "", 0, 0, "DE", false, "0", "DP", _
false, "20000000", "DT", false, "0.001", "WE", false, "100ns", "WM", false, _
"100ns", "WN", false, "0ps", "WS", false, "0ps")), Array("Time:=", Array("All"), "Trise:=",
Array( _
"Nominal"), "Tfall:=", Array("Nominal"), "Pulse_Width:=", Array("Nominal"), "Data_Rate:=", Array
("Nominal"), "Length:=", Array("Nominal")), Array("Probe Component:=", Array( _
"DQ0")), Array())))

Example Python Script: Defining a Document


This script creates a user-defied solution and a document.

User Defined Document Scripting Interface 22-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oProject = oDesktop.SetActiveProject("BJT_Inverter")
oDesign = oProject.SetActiveDesign("Nexxim1")
oModule = oDesign.GetModule("UserDefinedSolutionModule")

oModule.CreateUserDefinedSolution("UDS Distance Trace Arithmetic Result1", "SysLib", "TraceArith-


metic/Distance Sweep Trace Arithmetic",
[
"Offset 1:=", "0",
"Scale 1:=", "1",
"Offset 2:=", "0",
"Scale 2:=", "1",
"Operation:=", "Add"
],
[
[
"Standard",
"probe1",
"Transient",
[
style="font-family: monospace;">"NAME:Context",
style="font-family: monospace;">"SimValueContext:=", [1,0,2,0,False,False,-
1,1,0,1,1,"",0,0,"DE",False,"0","DP",False,"500000000","DT",False,"0.001","NUMLEVELS",False,"0","-
WE",False,"10us","WM",False,"10us","WN",False,"0ns","WS",False,"0ns"]
],
[
"Time:=", ["All"]
],
[
"Probe Component:=", ["V(Port1)"]

User Defined Document Scripting Interface 22-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

],
[]
],
[
"Standard",
"probe2",
"Transient",
[
"NAME:Context",
"SimValueContext:=", [1,0,2,0,False,False,-
1,1,0,1,1,"",0,0,"DE",False,"0","DP",False,"500000000","DT",False,"0.001","NUMLEVELS",False,"0",-
"WE",False,"10us","WM",False,"10us","WN",False,"0ns","WS",False,"0ns"]
],
[
"Time:=", ["All"]
],
[
"Probe Component:=", ["V(Port1)"]
],
[]
]
],
[])
oModule = oDesign.GetModule("UserDefinedDocuments")
oModule.AddDocument(
[
"NAME:Test Report",
"Test Report",
"SysLib",
"TestUDDInputs",
[
"NAME:Inputs",
[
"NAME:UDS1",

User Defined Document Scripting Interface 22-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Solution",
"UDS Distance Trace Arithmetic Result1",
1000000,
0
],
[
"NAME:UDS2",
"Solution",
"UDS Distance Trace Arithmetic Result2",
1000000,
2
]
]
],
[
"NAME:DocTraces",
[
"NAME:UDS1",
[
"User Defined",
"",
"UDS Distance Trace Arithmetic Result1",
[
"Context:=", ""
],
[
"Distance:=", ["All"]
],
[
"Probe Component:=", [""]
],
[]

User Defined Document Scripting Interface 22-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

]
],
[
"NAME:UDS2",
[
"User Defined",
"",
"UDS Distance Trace Arithmetic Result1",
[
"Context:=", ""
],
[
"Distance:=", ["All"]
],
[
"Probe Component:=", [""]
],
[]
]
]
])

User Defined Document Scripting Interface 22-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

22-20
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

23 - User Defined Solutions Commands


User Defined Solution commands should be executed by the "UserDefinedSolutionModule" module.

Set oDesign = oProject.SetActiveDesign("TestDesign1")


Set oModule =
oDesign.GetModule("UserDefinedSolutionModule")
The list of commands is as follows:

CreateUserDefinedSolution
DeleteUserDefinedSolutions
EditUserDefinedSolution

CreateUserDefinedSolution
Creates a new user defined solution.

UI Access Right-click on Results > Create User Defined Solution.

Name Type Description


<SoluName> String Name of user defined solution.
<LibType> String Indicates the library where the UDS plugin file is located. This parameter must
Parameters be one of the following values: "SysLib", "UserLib", "PersonalLib".
<RelativePath> String The path of the UDS plugin file relative to the "UserDefinedOutputs" sub-
directory of the library specified by <LibType>.
<PropList> Array Strings specify name-value pairs corresponding to the UDS properties spe-
cified in the plugin file.

User Defined Solutions Commands 23-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

For example:
Array("multiply_factor:=", "2.0", "component_name:=",
"resistor1")
<ProbeSelections> Array Name of the probe being specified. Note: this must match a probe name spe-
cified in the UDS plugin file.
<DynamicProbes> Array Array of <ProbeSelection>'s, representing the probes that are used by
dynamic-probes.

Return Value String name of created user defined solution.

CreateUserDefinedSolution(<SoluName>, <LibType>, <RelativePath>, <PropList>, <ProbeSelections>,


Python Syntax
<DynamicProbes>)
oModule.CreateUserDefinedSolution(
Python Example "ConstantTimestep1", "SysLib",
"ConstantTimestep", [], [], [])

CreateUserDefinedSolution <SoluName>, <LibType>, <RelativePath>, <PropList>, <ProbeSelections>,


VB Syntax
<DynamicProbes>
oModule.CreateUserDefinedSolution "User Defined Solution 1", _
"SysLib", "Example", _
VB Example Array("multiplication_factor:=", "1.2"), _
Array(Array("Modal Solution Data",
"Probe 1", "Setup1 : LastAdaptive", _

User Defined Solutions Commands 23-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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()))

DeleteUserDefinedSolutions
Deletes one or more user defined solutions.

UI Access Delete button from the User Defined Solutions dialog.

Name Type Description


Parameters
<SoluNames> Array Array of strings containing names of User Defined Solutions to be deleted.

Return Value None.

Python Syntax DeleteUserDefinedSolutions(<SoluNames>)


Python Example oModule.DeleteUserDefinedSolutions(["Solution1", "Solution2"])

User Defined Solutions Commands 23-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax DeleteUserDefinedSolutions <SoluNames>


oModule.DeleteUserDefinedSolutions _
VB Example
Array("Solution1", "Solution2")

EditUserDefinedSolution
Modifies an existing user defined solution.

UI Access Edit button from the User Defined Solutions dialog box.

Name Type Description


<SoluName> String Name of user defined solution to be edited.
<NewSoluName> String New name for the specified user defined solution.
<LibType> String Indicates the library where the UDS plugin file is located. This parameter must
be one of the following values: "SysLib", "UserLib", "PersonalLib".
<RelativePath> String The path of the UDS plugin file relative to the "UserDefinedOutputs" sub-
directory of the library specified by <LibType>.
<PropList> Array Strings specify name-value pairs corresponding to the UDS properties spe-
Parameters cified in the plugin file.
For example:
Array("multiply_factor:=", "2.0", "component_name:=",
"resistor1")
<ProbeSelections> Array Name of the probe being specified. Note: this must match a probe name spe-
cified in the UDS plugin file.
<DynamicProbes> Array Array of <ProbeSelection>'s, representing the probes that are used by
dynamic-probes.

Return Value String name of update user defined solution.

User Defined Solutions Commands 23-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditUserDefinedSolution(<SoluName>, <NewSoluName>, <LibType>, <RelativePath>, <PropList>,


Python Syntax
<ProbeSelections>, <DynamicProbes>)
oModule.EditUserDefinedSolution("ConstantTimestep1"
Python Example "ConstantTimestep1After", "SysLib",
"ConstantTimestep", [], [], [])

EditUserDefinedSolution <SoluName>, <NewSoluName>, <LibType>, <RelativePath>, <PropList>,


VB Syntax
<ProbeSelections>, <DynamicProbes>
oModule.CreateUserDefinedSolution "User Defined Solution 1", _
"User Defined Solution 1", "SysLib", "Example", _
Array("multiplication_factor:=", "1.2"), _
Array(Array("Modal Solution Data",
"Probe 1", "Setup1 : LastAdaptive", _
Array(), Array("Freq:=", Array( "All")), _
VB Example 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(), _

User Defined Solutions Commands 23-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("Freq:=", Array( "All")), _


Array("Probe Component:=", Array("Freq")), Array()))

GetUserDefinedSolutionNames
Retrieves user defined solution names.

UI Access N/A
Parameters None.
Return Value Array of strings containing solution names.

Python Syntax GetUserDefinedSolutionNames()


Python Example oModule.GetUserDefinedSolutionNames()

VB Syntax GetUserDefinedSolutionNames
VB Example oModule.GetUserDefinedSolutionNames

GetUserDefinedSolutionProperties
Obtains properties for a specified user defined solution.

UI Access N/A

User Defined Solutions Commands 23-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


Parameters
<SoluName> String Name of a specified user defined solution.

Return Value Array of strings containing properties values.

Python Syntax GetUserDefinedSolutionProperties(<SoluName>)


Python Example oModule.GetUserDefinedSolutionProperties("ConstantTimestep1")

VB Syntax GetUserDefinedSolutionProperties <SoluName>


VB Example oModule.GetUserDefinedSolutionProperties "ConstantTimestep1"

User Defined Solutions Commands 23-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

23-8
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

24 - Network Data Explorer Script Commands


Network Data Explorer (NDE) scripting uses three objects, each with unique script commands:
l Network Data Explorer – top-level object obtained by calling oNDE=oDesktop.GetTool("ndExplorer"). Network Data Explorer
commands are called using oNDE.
l Network Data – single set of S-parameters, corresponding to a single entry in the UI tree. Network Data commands are called
using oData.
l Post Process Settings – settings that can be applied and removed from network data without making permanent changes to
the underlying data. Post Process Settings commands are called using oPostProc.

Examples using the above objects:


oNDE = oDesktop.GetTool("ndExplorer")
oData = oNDE.Open("D:\folder\test.s2p")
success = oPostProc.AddDiffPair(2, 1, "Diff1", "Comm1", 100, 25)
The following commands are described in this section:

Warning: The following commands are preliminary. Their syntax


may change. Be prepared to make changes to legacy scripts.

AddDiffPair
Cascade (SPISim)
ClearDiffPairs
Clone
Close

Network Data Explorer Script Commands 24-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Combine (SPISim)
Deembed (SPISim)
DeembedBack (SPISim)
DeembedFront (SPISim)
DisableDiffPairs
EnableDiffPairs
ExportCitiFile
ExportFullWaveSpice
ExportMatlab
ExportNMFData
ExportNetworkData
ExportSpreadsheet
ExportTouchstone
ExportTouchstone2
Extract (SPISim)
GetFrequencies
GetFrequencyCount
GetName
GetPortCount
GetPortNumber

Network Data Explorer Script Commands 24-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetPostProcSettings
GetSolutionVariation
GetVariation
HasSameData
LoadSolution
Open
Rename (SPISim)
Renormalize (SPISim)
Reorder
Reorder (SPISim)
Reset
SetAllPortImpedances
SetAllPortImpedances
SetPortDeembedDistance
SetPortImpedance
SetPostProcSettings
Smooth
Stretch (SPISim)
Terminate

Network Data Explorer Script Commands 24-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

AddDiffPair
Specifies a differential pair from two terminal ports.

From the Network Data Explorer tab, select Differential Pairs in the NDE ribbon to open the Differential
UI Access
Pairs window. Then select differential pairs from the Pairs group box and click Add Pairs >>.

Name Type Description


<positiveTerminal> Integer The portNumber of the positive terminal.
<negativeTerminal> Integer The portNumber of the negative terminal.
<diffName> String The new name of the differential pin (e.g., Diff1).
<commName> String The new name of the common pin (e.g., Comm1).
Parameters <diffImpedance> Double The differential pin characteristic impedance.
<commImpedance> Double The common pin characteristic impedance.
<matched> Boolean Specify whether to use matched pair.

Note: The default value is False.

Return Value Boolean.

Python Syntax AddDiffPair()


Python success = oPostProc.AddDiffPair(2, 1, "Diff1", "Comm1", 100, 25)
Example

Network Data Explorer Script Commands 24-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax AddDiffPair
VB Example Set success = oPostProc.AddDiffPair 2, 1, "Diff1", "Comm1", 100, 25

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Cascade (SPISim)
Creates new network data from a group of network data objects cascaded together. The network data must have an even number of
terminal ports and must have the same number of ports.

Note: Cascade opens and interacts with SPISim to complete.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Cascade from the
UI Access
drop-down menu.

Name Type Description


Parameters <dataArray> Array These network data objects are cascaded together to create the
new network data.

Network IDispatch.

Return Value Note: Cascade returns None if the specified network data does not have compatible terminal ports
defined.

Network Data Explorer Script Commands 24-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax Cascade()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData2 = oNDE.Cascade([oData1, oData2, oData3])

VB Syntax Cascade
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData2 = oNDE.Cascade Array(oData1, oData2, oData3)

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

ClearDiffPairs
Clears all differential pair definitions. All other post-processing settings remain the same.

From the Network Data Explorer tab, select Differential Pairs in the NDE ribbon to open the Dif-
UI Access
ferential Pairs window. Then select differential pairs from the rightmost box and click << Remove Pairs.
Parameters None.
Return Value None.

Python Syntax ClearDiffPairs()

Network Data Explorer Script Commands 24-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oPostProc.ClearDiffPairs()

VB Syntax ClearDiffPairs
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
oPostProc.ClearDiffPairs

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Clone
Creates a copy of the network data object.

From the Network Data Explorer tab, select the network data object to clone. Then select Clone from
UI Access
the NDE ribbon.

Parameters None.
Return Value Network IDispatch.

Python Syntax Clone()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData1 = oData.Clone()

Network Data Explorer Script Commands 24-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax Clone
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData1 = oData.Clone

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Close
Closes the network data object. The object will no longer be accessible.

UI Access From the Network Data Explorer tab, click Close in the NDE ribbon, or select File > Close.

Parameters None.
Return Value None.

Python Syntax Close()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData.Close()

VB Syntax Close
VB Example Set oNDE = oDesktop.GetTool("ndExplorer")

Network Data Explorer Script Commands 24-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oData.Close

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Combine (SPISim)
Combines frequencies from multiple network data objects to create a new network data with all of the frequencies.

Note: Combine opens and interacts with SPISim to complete.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Combine from the
UI Access
drop-down menu.

Name Type Description


<dataArray> Array These network data objects are combined to create the new net-
work data.
Parameters
<freqTol> Double If abs(f1 – f2) < freqTol, f1 and f2 are considered the same fre-
quency.

Note: The default value is 100.

Network IDispatch.
Return Value
Note: Combine returns None if the network data does not have the same number of ports.

Network Data Explorer Script Commands 24-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax Combine()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData4 = oNDE.Combine([oData1, oData2, oData3], 1000)

VB Syntax Combine
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData4 = oNDE.Combine Array(oData1, oData2, oData3), 1000

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Deembed (SPISim)
Creates a new network data, dembedding the frontData and the backData from the front and back of the originalData.

Note: Deembed opens and interacts with SPISim to complete.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Deembed from the
UI Access drop-down menu to open the Deembed... window, and choose Given 3 S-params in order of: Total, Front,
Back from the Settings group box.

Name Type Description


Parameters <originalData> Object Original network data that is deembeded.
<frontData> Object Network data that is deembeded from the front of the original.

Network Data Explorer Script Commands 24-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<backData> Object Network data that is deembeded from the back of the original.

Network IDispatch.

Return Value Note: Deembed returns None if the specified network data does not have compatible terminal ports
defined.

Python Syntax Deembed()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData2 = oNDE.Deembed(oData1, oDataFront, oDataBack)

VB Syntax Deembed
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData2 = oNDE.Deembed oData1, oDataFront, oDataBack

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

DeembedBack (SPISim)
Creates a new network data, dembedding the backData from the back of the originalData.

Note: DeembedBack opens and interacts with SPISim to complete.

Network Data Explorer Script Commands 24-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Deembed from the
UI Access drop-down menu to open the Deembed... window, and choose Given 3 S-params in order of: Total, Back
from the Settings group box.

Name Type Description


Parameters <originalData> Object Original network data that is deembeded.
<backData> Object Network data that is deembeded from the back of the original.

Network IDispatch.

Return Value Note: DeembedBack returns None if the specified network data does not have compatible terminal
ports defined.

Python Syntax DeembedBack()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData2 = oNDE.DeembedBack(oData1, oDataBack)

VB Syntax DeembedBack
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData2 = oNDE.DeembedBack oData1, oDataBack

Network Data Explorer Script Commands 24-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

DeembedFront (SPISim)
Creates a new network data, dembedding the frontData from the front of the originalData.

Note: DeembedFront opens and interacts with SPISim to complete.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Deembed from the
UI Access drop-down menu to open the Deembed... window, and choose Given 3 S-params in order of: Total, Front
from the Settings group box.

Name Type Description


Parameters <originalData> Object Original network data that is deembeded.
<frontData> Object Network Data that is deembeded from the front of the original.

Network IDispatch.

Return Value Note: DeembedFront returns None if the specified network data does not have compatible terminal
ports defined.

Python Syntax DeembedFront()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData2 = oNDE.DeembedFront(oData1, oDataFront)

Network Data Explorer Script Commands 24-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax DeembedFront
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData2 = oNDE.DeembedFront oData1, oDataFront

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

DisableDiffPairs
Deactivates all differential pair definitions. This script does not remove them, so they can be reactivated.

From the Network Data Explorer tab, select Differential Pairs in the NDE ribbon to open the Dif-
ferential Pairs window. Once differential pairs have been added to the rightmost box (i.e., select dif-
UI Access
ferential pairs from the Pairs group box and click Add Pairs >>), remove check marks from the Enabled
column to deactivate the corresponding differential pairs.
Parameters None.
Return Value None.

Python Syntax DisableDiffPairs()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oPostProc.DisableDiffPairs()

Network Data Explorer Script Commands 24-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax DisableDiffPairs
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
oPostProc.DisableDiffPairs

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

EnableDiffPairs
Enables all differential pair definitions.

From the Network Data Explorer tab, select Differential Pairs in the NDE ribbon to open the Dif-
ferential Pairs window. Once differential pairs have been added to the rightmost box (i.e., select dif-
UI Access
ferential pairs from the Pairs group box and click Add Pairs >>), add check marks to the Enabled column
to activate the corresponding differential pairs.
Parameters None.
Return Value None.

Python Syntax EnableDiffPairs()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
success = oPostProc.EnableDiffPairs()

VB Syntax EnableDiffPairs

Network Data Explorer Script Commands 24-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Set oNDE = oDesktop.GetTool("ndExplorer")


VB Example
Set success = oPostProc.EnableDiffPairs

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

ExportCitiFile
Writes the S-parameters to disk in Citifile format (*.cit text file).

From the Network Data Explorer tab, select File > Save As to open a Save As explorer window. Then select
UI Access
Citifile (*.cit) from the Save as type: drop-down menu.

Name Type Description


<filePath> String The full path to the file.
<matrixType> Integer One of the following:
l 0 – S-Parameters
l 1 – Y-Parameters
l 2 – Z-Parameters
Parameters l 3 – Gamma
l 4 – Impedance

Note: The default value is 0.

<formalType> Integer One of the following:


l 0 – Magnitude/Angle (degrees)

Network Data Explorer Script Commands 24-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l 1 – Real/Imaginary
l 2 – dB/Angle (degrees)

Note: The default value is 0.

<precision> Integer The number of significant figures.

Note: The default value is 10.

<frequencies> Array of A subset of the calculated frequencies. Any array values that don’t
Doubles have calculated data will be ignored. An empty array will cause all
frequencies to be written.

Note: The default value is an empty array.

Return Value Boolean True if file was successfully written; else False.

Python Syntax ExportCitiFile()

Python oNDE = oDesktop.GetTool("ndExplorer")


Example success = oData.ExportCitiFile("D:\folder\ne133.cit", 0, 1, 12, [])

VB Syntax ExportCitiFile
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set success = oData.ExportCitiFile "D:\folder\ne133.cit", 0, 1, 12, Array()

Network Data Explorer Script Commands 24-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ExportFullWaveSpice
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
"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", "Spectre", "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 "ConvexOptimization",
// "PassivityByPerturbation", or "IteratedFittingOfPV"

Network Data Explorer Script Commands 24-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"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
)

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

ExportMatlab
Writes the S-parameters to disk in Matlab format (*.m text file).

From the Network Data Explorer tab, select File > Save As to open a Save As explorer window. Then select
UI Access
MATLAB (*.m) from the Save as type: drop-down menu.

Name Type Description


<filePath> String The full path to the file.
Parameters <matrixType> Integer One of the following:
l 0 – S-Parameters

Network Data Explorer Script Commands 24-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l 1 – Y-Parameters
l 2 – Z-Parameters
l 3 – Gamma
l 4 – Impedance

Note: The default value is 0.

<formalType> Integer One of the following:


l 0 – Magnitude/Angle (degrees)
l 1 – Real/Imaginary
l 2 – dB/Angle (degrees)

Note: The default value is 0.

<precision> Integer The number of significant figures.

Note: The default value is 10.

<frequencies> Array of A subset of the calculated frequencies. Any array values that don’t
Doubles have calculated data will be ignored. An empty array will cause all
frequencies to be written.

Note: The default value is an empty array.

Return Value Boolean True if file was successfully written; else False.

Network Data Explorer Script Commands 24-20


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ExportMatlab()

Python oNDE = oDesktop.GetTool("ndExplorer")


Example success = oData.ExportMatlab("D:\folder\ne133.m", 0, 1, 12, [])

VB Syntax ExportMatlab
Set oNDE = oDesktop.GetTool "ndExplorer"
VB Example
Set success = oData.ExportMatlab "D:\folder\ne133.m", 0, 1, 12, Array()

ExportNMFData

Use:Exports s-parameters in neutral file format.


Command:In the matrix tab of the Solution dialog box, click Export->S-Parameter. Then select the Neutral Model file format.
Syntax: ExportNetworkData <SolutionName> <FileName> <ReduceMatrix><Reference Impedance> <FrequencyArray>
<DesignVariation> <Format> <Length> <PassNumber>
Return Value:None
Parameters:SolutionName>
Type: <String>
Format: <SetupName>:<SolutionName>
Solution that is exported.
<FileName>
Type:<String>
The name of the file. The file extension will determine the file format.

Network Data Explorer Script Commands 24-21


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ReduceMatrix>
Type: <string>
Either "Original" or one of the reduce matrix setup name
<Reference Impedance>
Type: <Double>
Reference impedance
<FrequencyArray>
Type: <Array of doubles>
Value: Array(<double>,<double>….)
Frequency points in the sweep that is exported.
<DesignVariation>
Type: <String>
Design variation at which the solution is exported.
<Format>
Type: <String>
Values: "MagPhase", "RealImag", "DbPhase".
The format in which the sparameters will be exported.
<Length>
Type:<String>
Length for exporting sparameters.

Network Data Explorer Script Commands 24-22


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<PassNumber>
Type:<integer>
Pass number.
VB Example:
oDesign.ExportNMFData "Setup7 : LastAdaptive", "C:/temp/neu.nmf", "Original", _ 50, Array
(10000000, 20000000, 30000000, 40000000, 50000000, 60000000, 70000000, _ 80000000, 90000000,
100000000), "", "MagPhase","7meter"

ExportNMFData(
"",
# Empty string.
1,
#The number 1.
"Name",
# This is the full path of the file from which the solution is loaded
Python Syntax
"ExportFile",
# full path of file to export to
["NAME:Frequencies"],
#optional, if none defined all frequencies are used
["NAME:NMFOptions",
#Export NMF options object
"DataTypes:=", ["S"],

Network Data Explorer Script Commands 24-23


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

#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
"Variables:=", ["FF", "cap", "Rs"]
# Array of variables
"Variations:=", ["", "", ""]
# Array of variations to export solutions for

Network Data Explorer Script Commands 24-24


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["NAME:ConstantVars"]
#Array of variables that are constant, can be empty
["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
])
oTool = oDesktop.GetTool("NdExplorer")
oTool.ExportNetworkData("", True,
"C:/.../100OHM.S2P", "$SYSLIB/Test.s2p", "",
[
"NAME:Frequencies",
500000000,
Python Example
1000000000,
10000000000,
25000000000,
50000000000,
75000000000,

Network Data Explorer Script Commands 24-25


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

100000000000
],
[
"NAME:TSOptions",
"DataTypes:=" , ["S"],
"DisplayFormat:=" , "DB",
"FileType:=" , 3,
"Renormalize:=" , True,
"RefImpedance:=" , 50,
"Precision:=" , 6,
"UseMultipleCores:=" , False,
"NumberOfCores:=" , 1,
"Comments:=" , True,
"Noise:=" , False
])

ExportNetworkData
Exports matrix solution data to a file. Available only for Driven solution types with ports.

UI Access N/A

Network Data Explorer Script Commands 24-26


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<DesignVariationKey> String Design variation key. Pass empty string for the current nominal vari-
ation.
<SolnSelectionArray> Array Array of selected solutions.
Array(<SolnSelector>, <SolnSelector>, ...)
If more than one array entry, this indicates a combined Interpolating
sweep.
<SolnSelector> String Solution setup name and solution name, separated by a colon.
<FileFormat> Integer File format value.
2 : Tab delimited spreadsheet format (.tab)
3 : Touchstone (.sNp)
4 : CitiFile (.cit)

Parameters 7 : Matlab (.m)


8 : Terminal Z0 spreadsheet
<OutFile> String Full path to the file to write out.
<FreqsArray> Array The frequencies to export. The <FreqsArray> argument contains a
vector (e.g. "1GHz", "2GHz", ...) to use, or "all". To export all fre-
quencies, use Array("all"). If no frequencies are specified, all fre-
quencies are used.
<DoRenorm> Boolean Specifies whether to renormalize the data before export.
<RenormImped> Double Real impedance value in ohms, for renormalization. Required in syn-
tax, but ignored if DoRenorm is false.
<DataType> String Optional. Type: "S", "Y", or "Z". The matrix to export.
<pass> Integer Optional. 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> Integer Optional. Type: "0", "1", or "2"
The format to use for the exported data.

Network Data Explorer Script Commands 24-27


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

0 = Magnitude/Phase.
1= Real/Imaginary.
2= db/Phase.
<Precision> Integer Optional. Touchstone number of digits precision. Default if not spe-
cified is 15.
<UseExportFreqs> Boolean Specifies whether to use export frequencies.
<IncludeGammaComments> Boolean Specifies whether to include Gamma and Impedance comments.
<SupportNonStdExport> Boolean Specifies whether to support non-standard Touchstone extensions
for mixed reference impedance.

Return Value None.

ExportNetworkData(<DesignVariationKey>, <SolnSelectionArray>, <SolnSelector>, <FileFormat>, <OutFile>, <Fre-


Python qsArray>, <DoRenorm>, <RenormImped>, [Optional <DataType>], [Optional <pass>], [Optional <ComplexFormat>],
Syntax [Optional <Precision>], [Optional <UseExportFreqs>], [Optional <IncludeGammaComments>], [Optional <Sup-
portNonStdExport>])
oModule.ExportNetworkData("", ["Setup1:Sweep1"], 3, "C://Documents/package_
Python HFSSDesign1.s4p",
Example
['all'], True, 50, "S", -1, 0, 15, True, True, True

ExportNetworkData <DesignVariationKey>, <SolnSelectionArray>, <SolnSelector>, <FileFormat>, <OutFile>,


<FreqsArray>, <DoRenorm>, <RenormImped>, [Optional <DataType>], [Optional <pass>], [Optional <Com-
VB Syntax
plexFormat>], [Optional <Precision>], [Optional <UseExportFreqs>], [Optional <IncludeGammaComments>],
[Optional <SupportNonStdExport>]

Network Data Explorer Script Commands 24-28


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.ExportNetworkData "width=’2in’", _
Array("Setup1:Sweep1"),2, "c:\mydir\out.tab", _
Array("all"), false, 0
VB Example oModule.ExportNetworkData "width=’2in’", _
Array("Setup1:Sweep1", "Setup1:Sweep2"), 3, _
"c:\mydir\out.s2p", Array(1.0e9, 1.5e9, 2.0e9), _
true, 50.0

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

ExportSpreadsheet
Writes the S-parameters to disk in spreadsheet format (*.tab text file).

From the Network Data Explorer tab, select File > Save As to open a Save As explorer window. Then select
UI Access
Data Table (spreadsheet) (*.tab) from the Save as type: drop-down menu.

Name Type Description


<filePath> String The full path to the file.
<matrixType> Integer One of the following:
l 0 – S-Parameters
Parameters l 1 – Y-Parameters
l 2 – Z-Parameters
l 3 – Gamma
l 4 – Impedance

Network Data Explorer Script Commands 24-29


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note: The default value is 0.

<formalType> Integer One of the following:


l 0 – Magnitude/Angle (degrees)
l 1 – Real/Imaginary
l 2 – dB/Angle (degrees)

Note: The default value is 0.

<precision> Integer The number of significant figures.

Note: The default value is 10.

<frequencies> Array of A subset of the calculated frequencies. Any array values that don’t
Doubles have calculated data will be ignored. An empty array will cause all
frequencies to be written.

Note: The default value is an empty array.

<renormalize> Boolean If True, will renormalize the data to the value of renormImpedance
before writing.

Note: The default value is False.

<renormImpedance> Double Data will be renormalized to this impedance before writing only if
renormalize is True.

Network Data Explorer Script Commands 24-30


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note: The default value is 50 ohms.

Return Value Boolean True if file was successfully written; else False.

Python Syn- ExportSpreadsheet()


tax

Python oNDE = oDesktop.GetTool("ndExplorer")


Example success = oData.ExportSpreadsheet("D:\folder\ne133.tab", 0, 1, 12, [], True, 23)

VB Syn- ExportSpreadsheet
tax

VB Set oData=oDesktop.GetTool("ndExplorer")
Example success = oData.ExportSpreadsheet "D:\folder\ne133.tab", 0, 1, 12, Array(), True, 23

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

ExportTouchstone
Writes the S-parameters to disk in Touchstone 1.0 format (*.snp text file).

From the Network Data Explorer tab, select File > Save As to open a Save As explorer window. Then select
UI Access
Touchstone Format 1.0 (*.snp) from the Save as type: drop-down menu.

Network Data Explorer Script Commands 24-31


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<filePath> String The full path to the file.
<matrixType> Integer One of the following:
l 0 – S-Parameters
l 1 – Y-Parameters
l 2 – Z-Parameters
l 3 – Gamma
l 4 – Impedance

Note: The default value is 0.

Parameters
<formalType> Integer One of the following:
l 0 – Magnitude/Angle (degrees)
l 1 – Real/Imaginary
l 2 – dB/Angle (degrees)

Note: The default value is 0.

<precision> Integer The number of significant figures.

Note: The default value is 10.

<frequencies> Array of A subset of the calculated frequencies. Any array values that don’t
Doubles have calculated data will be ignored. An empty array will cause all
frequencies to be written.

Network Data Explorer Script Commands 24-32


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note: The default value is an empty array.

<renormalize> Boolean If True, will renormalize the data to the value of renormImpedance
before writing.

Note: The default value is False.

<renormImpedance> Double Data will be renormalized to this impedance before writing only if
renormalize is True.

Note: The default value is 50 ohms.

<freqUnits> String One of the following: "Hz", "KHz", "MHz", "GHz".

Note: The default value is "Hz".

Return Value Boolean True if file was successfully written; else False.

Python ExportTouchstone()
Syntax

Python oNDE = oDesktop.GetTool("ndExplorer")


Example success = oData.ExportTouchstone("D:\folder\ne133.s2p", 0, 1, 12, [], True, 23, "GHz")

VB Syn- ExportTouchstone
tax

VB Set oNDE = oDesktop.GetTool("ndExplorer")

Network Data Explorer Script Commands 24-33


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

success = oData.ExportTouchstone "D:\folder\ne133.s2p", 0, 1, 12, Array(), True, 23,


Example
"GHz"

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

ExportTouchstone2
Writes the S-parameters to disk in Touchstone 2 format (*.ts text file).

From the Network Data Explorer tab, select File > Save As to open a Save As explorer window. Then select
UI Access
Touchstone 2 Format (*.ts) from the Save as type: drop-down menu.

Name Type Description


<filePath> String The full path to the file.
<matrixType> Integer One of the following:
l 0 – S-Parameters
l 1 – Y-Parameters
l 2 – Z-Parameters
Parameters l 3 – Gamma
l 4 – Impedance

Note: The default value is 0.

<formalType> Integer One of the following:


l 0 – Magnitude/Angle (degrees)

Network Data Explorer Script Commands 24-34


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l 1 – Real/Imaginary
l 2 – dB/Angle (degrees)

Note: The default value is 0.

<precision> Integer The number of significant figures.

Note: The default value is 10.

<frequencies> Array of A subset of the calculated frequencies. Any array values that don’t
Doubles have calculated data will be ignored. An empty array will cause all
frequencies to be written.

Note: The default value is an empty array.

<renormalize> Boolean If True, will renormalize the data to the value of renormImpedance
before writing.

Note: The default value is False.

<renormImpedance> Double Data will be renormalized to this impedance before writing only if
renormalize is True.

Note: The default value is 50 ohms.

<freqUnits> String One of the following: "Hz", "KHz", "MHz", "GHz".

Note: The default value is "Hz".

Return Value Boolean True if file was successfully written; else False.

Network Data Explorer Script Commands 24-35


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python ExportTouchstone2()
Syntax

Python oNDE = oDesktop.GetTool("ndExplorer")


Example success = oData.ExportTouchstone2("D:\folder\ne133.ts", 0, 1, 12, [], True, 23, "GHz")

VB Syn- ExportTouchstone2
tax

Set oNDE = oDesktop.GetTool("ndExplorer")


VB
Example Set success = oData.ExportTouchstone2 "D:\folder\ne133.ts", 0, 1, 12, Array(), True,
23, "GHz"

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Extract (SPISim)
Creates a new smaller network data after removing data for the specified terminal port numbers.

Note: Extract opens and interacts with SPISim to complete.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Extract from the drop-
UI Access
down menu.

Network Data Explorer Script Commands 24-36


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<oData> Object Data from this object is copied to a new network data and the copy
Parameters is transformed.
<portNumbers> Array of The port numbers that will be retained (integers between 1 and n).
Integers

Return Value Network IDispatch.

Python Syntax Extract()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData2 = oNDE.Extract(oData1, [3, 2])

VB Syntax Extract
Set oNDE = oDesktop.GetTool "ndExplorer"
VB Example
Set oData2 = oNDE.Extract oData1, Array(3, 2)

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

GetFrequencies
Returns the frequency values with calculated data in the network data.

UI Access None.
Parameters None.

Network Data Explorer Script Commands 24-37


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value Array of doubles.

Python Syntax GetFrequencies()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
Freqs = oData.GetFrequencies()

VB Syntax GetFrequencies
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set Freqs = oData.GetFrequencies

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

GetFrequencyCount
Returns the number of frequencies with calculated data in the network data.

UI Access None.
Parameters None.
Return Value Integer number of frequencies.

Network Data Explorer Script Commands 24-38


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetFrequencyCount()


oData = oDesktop.GetTool("ndExplorer")
Python Example
numFreqs = oData.GetFrequencyCount()

VB Syntax GetFrequencyCount
Set oData = oDesktop.GetTool("ndExplorer")
VB Example
Set numFreqs = oData.GetFrequencyCount

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

GetName
Returns the name of the network data.

UI Access None.
Parameters None.
Return Value String name.

Python Syntax GetName()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
strName = oData.GetName()

Network Data Explorer Script Commands 24-39


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetName
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
strName = oNDE.GetName

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

GetPortCount
Returns the total number of ports.

From the Network Data Explorer tab, select Edit Ports in the NDE ribbon to open the Port prop-
UI Access
erties window.
Parameters None.
Return Value Integer number of ports.

Python Syntax GetPortCount()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
num = oData.GetPortCount()

Network Data Explorer Script Commands 24-40


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetPortCount
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
num = oData.GetPortCount

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

GetPortNumber
Returns the terminal port number for a given terminal port name.

Note: GetPortNumber can be used in other commands that require a port number, if a port name is preferable.

From the Network Data Explorer tab, ensure the Full Port Names check box is activated. Port numbers will be
UI Access
represented in the object portNames.

Name Type Description


Parameters
<portName> String The designation of the port number.

Return Value Integer.

Python Syntax GetPortNumber()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
index = oPostProc.GetPortNumber("Input35")

Network Data Explorer Script Commands 24-41


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetPortNumber
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
index = oPostProc.GetPortNumber "Input35"

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

GetPostProcSettings
Returns a copy of the IDispatch to the postprocessing settings for the network data (oPostProc).

Note: Making changes to the PostProcSettings will not change the network data. To make changes, call
oData.SetPostProcSettings to change the network data.

UI Access None.
Parameters None.
Return Value PostProcSettings IDispatch

Python Syntax GetPostProcSettings()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oPostProc = oData.GetPostProcSettings()

Network Data Explorer Script Commands 24-42


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetPostProcSettings
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oPostProc = oData.GetPostProcSettings

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

GetSolutionVariation
Returns the network data object corresponding to a variation of the solution.

UI Access None.

Name Type Description


Parameters <solutionID> Integer ID of the solution (obtained with LoadSolution).
<variation> String The variation key.

Return Value Network IDispatch.

Python Syntax GetSolutionVariation()

Python oNDE = oDesktop.GetTool("ndExplorer")


Example oData = oNDE.GetSolutionVariation("O, "offset='0.1'")

VB Syntax GetSolutionVariation
VB Example Set oNDE = oDesktop.GetTool("ndExplorer")

Network Data Explorer Script Commands 24-43


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oData = oNDE.GetSolutionVariation "O, "offset='0.1'"

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

GetVariation
Returns the variation key for the network data.

UI Access None.

Parameters None.
Return Value String variation key.

Python Syntax GetVariation()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
variation = oData.GetVariation()

VB Syntax GetVariation
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set variation = oData.GetVariation

Network Data Explorer Script Commands 24-44


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

HasSameData
Compares one network data object with another network data. Actual calculated values will be compared and no interpolation will be
done.

UI Access None.

Name Type Description


<NetworkData> Object The second network data to compare against.
<matrixType> Integer One of the following:
l 0 – S-Parameters
l 1 – Y-Parameters
l 2 – Z-Parameters
l 3 – Gamma
Parameters l 4 – Impedance

Note: The default value is 0.

<comparePortNames> Boolean If True, port names must be identical.

Note: The default value is True.

<compareNoise> Boolean If True, and both network data have noise data, the comparison will
fail unless the noise values also match.

Network Data Explorer Script Commands 24-45


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note: The default value is 10.

<relativeTolerance> Double If the absoluteTolerance test fails, then abs(value1 - value2)/max


(abs(value1), abs(value2)) must be less than this to be considered
equal.

Note: The default value is 1e-14.

<absoluteTolerance> Double If True, then abs(value1 - value2) < absoluteTolerance.

Note: The default value is 0.

Return Value Boolean True if the compared network data have the same frequency and matrix values; otherwise, False.

Python Syntax HasSameData()

Python oNDE = oDesktop.GetTool("ndExplorer")


Example success = oData.HasSameData(oData2, 0, True, False, 1e-10, 0)

VB Syntax HasSameData
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set success = oData.HasSameData oData2, 0, True, False, 1e-10, 0

Network Data Explorer Script Commands 24-46


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

LoadSolution
Loads the specified design (all variations) and returns an integer ID.

After analyzing a design, from the Project Manager window, expand the Project Tree and Analysis folders.
UI Access Then right-click on the completed analysis icon and select Network Data Explorer to open the solution in the
Network Data Explorer tab.

Name Type Description


<projectName> String Full path to the Electronics Desktop file.
Parameters
<designName> String Name of the design.
<solutionName> String Name of the solution.

Return Value Integer ID (identifying the solution); < 0 if the solution is not loaded.

Python Syn- LoadSolution()


tax

Python oNDE = oDesktop.GetTool("ndExplorer")


Example id = oNDE.LoadSolution("D:\folder\Tee.aedt", "HFSS_Test", "Setup1:Sweep1")

VB Syntax LoadSolution
VB Example Set oNDE = oDesktop.GetTool("ndExplorer")

Network Data Explorer Script Commands 24-47


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

id = oNDE.LoadSolution "D:\folder\Tee.aedt", "HFSS_Test", "Setup1:Sweep1"

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Open
Reads contents of file and returns the IDispatch for the new network data.

From the Network Data Explorer tab, select Open in the NDE ribbon, or select File > Open to open an explorer
UI Access
window. Then navigate to the required S-parameter file.

Name Type Description


Parameters
<fileName> String Full path to the file containing S-parameters.

Return Value Network IDispatch.

Python Syntax Open()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData = oNDE.Open("D:\folder\test.s2p")

VB Syntax Open
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData = oNDE.Open "D:\folder\test.s2p"

Network Data Explorer Script Commands 24-48


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Rename (SPISim)
Creates a new network data of the same size with the terminal ports renamed.

Note: Rename opens and interacts with SPISim to complete.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Rename from the
UI Access
drop-down menu.

Name Type Description


<oData> Object Data from this object is copied to a new network data and the copy
Parameters is transformed.
<portNames> Array of The new names (one for each port).
Strings

Return Value Network IDispatch.

Python Syntax Rename()

Python oNDE = oDesktop.GetTool("ndExplorer")


Example oData2 = oNDE.Rename(oData1, ["input", "control", "output"])

VB Syntax Rename

Network Data Explorer Script Commands 24-49


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Set oNDE = oDesktop.GetTool "ndExplorer"


VB Example
Set oData2 = oNDE.Rename oData1, Array("input", "control", "output")

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Renormalize (SPISim)
Creates a new network data of the same size after renormalizing the terminal ports using the specified impedance values.

Note: Rename opens and interacts with SPISim to complete.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Renormalize from the
UI Access
drop-down menu.

Name Type Description


<oData> Object Data from this object is copied to a new network data and the copy
Parameters is transformed.
<portImpedances> Array of The new impedance values to be applied to each port.
Doubles

Network IDispatch.
Return Value
Note: Renormalize returns None if there is not an impedance value for each port.

Network Data Explorer Script Commands 24-50


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax Renormalize()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData2 = oNDE.Renormalize(oData1, [3, 2])

VB Syntax Renormalize
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
oData2 = oNDE.Renormalize oData1, Array(3, 2)

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Reorder
Rearranges the terminal port entries but does not change the port names (i.e., switching first and third terminal port positions will give
switched values for S(1,1) and S(3,3) but S(Port1,Port1) and S(Port3,Port3) do not change).

From the Network Data Explorer tab, select Edit Ports in the NDE ribbon to open the Port properties win-
UI Access
dow. Click+drag the terminal port rows to reorder them. Make changes, as necessary, then click OK.

Name Type Description


Parameters <newOrder> Array of Must have one entry for each port; all numbers 1 to n must be
Integers present.

Return Value None.

Network Data Explorer Script Commands 24-51


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax Reorder()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oPostProc.Reorder([3, 2, 1])

VB Syntax Reorder
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
oPostProc.Reorder Array(3, 2, 1)

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Reorder (SPISim)
Creates a new network data with the same number of terminal ports and with the port names in the same order. The data is also
reordered so it corresponds to the new order (e.g., the data for S(Port1, Port1) may correspond to S(Port3, Port3).

Note: Reorder opens and interacts with SPISim to complete.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Reorder from the
UI Access
drop-down menu.

Name Type Description


Parameters <oData> Object Data from this object is copied to a new network data and the copy
is transformed.

Network Data Explorer Script Commands 24-52


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<portNumbers> Array of The port numbers in new order (integers between 1 and n).
Integers

Network IDispatch.

Return Value Note: Reorder returns None if the array argument does not contain all the terminal port numbers, in
any order.

Python Syntax Reorder()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData2 = oNDE.Reorder([3, 2, 1])

VB Syntax Reorder
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData2 = oNDE.Reorder Array(3, 2, 1)

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Reset
Resets the post-processing to what it was when the network data was created.

Network Data Explorer Script Commands 24-53


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note: This is not equivalent to setting post-processing to an empty state. The network data may have been read from a file
or created from solution data that already had post-processing settings.

UI Access From the Network Data Explorer tab, select Reset postprocessing in the NDE ribbon.
Parameters None.
Return Value None.

Python Syntax Reset()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oPostProc.Reset()

VB Syntax Reset
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
oPostProc.Reset

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

SetAllPortImpedances
Sets all terminal port impedances in a single call. The impedances are in an array of real or complex values.

Network Data Explorer Script Commands 24-54


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Through the UI, the terminal ports can only be edited individually. From the Network Data Explorer tab, select
UI Access
Edit Ports in the NDE ribbon to open the Port properties window. Make changes, then click OK.

Name Type Description


Parameters
<impedances> Array of Must have one entry for each port or a single complex (or real)
Doubles value which will be applied to all ports.
or String

Return Value None.

Python SetAllPortImpedances()
Syntax

Python oNDE = oDesktop.GetTool("ndExplorer")


Example oPostProc.SetAllPortImpedances([23, "2+3i", 50]) -or- oData.SetAllPortImpedances(50)

VB Syn- SetAllPortImpedances
tax

Set oData=oDesktop.GetTool("ndExplorer")
VB
Example oPostProc.SetAllPortImpedances Array(23, "2+3i", 50) -or- oData.SetAllPortImpedances
50

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Network Data Explorer Script Commands 24-55


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetPortDeembedDistance
Sets terminal port impedance for a single port.

From the Network Data Explorer tab, select Edit Ports in the NDE ribbon to open the Port properties window.
UI Access
Make changes, then click OK.

Name Type Description


<portNumber> Integer The port number of the changed terminal port (integers between 1
Parameters and n) .
<distance> String Impedance with units (e.g., “20mm”); if no units, meters are
assumed

Return Value None.

Python Syntax SetPortDeembedDistance()

Python oNDE = oDesktop.GetTool("ndExplorer")


Example oPostProc.SetPortDeembedDistance(2, "20mm")

VB Syntax SetPortDeembedDistance
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
oPostProc.SetPortDeembedDistance 2, "20mm"

Network Data Explorer Script Commands 24-56


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

SetPortImpedance
Sets port impedance for a single port.

From the Network Data Explorer tab, select Edit Ports in the NDE ribbon to open the Port properties win-
UI Access
dow. Make changes, then click OK.

Name Type Description


<portNumber> Integer The port number of the changed terminal port (integers between 1
Parameters
and n).
<impedance> Double Double if impedance value is real; string format (e.g., 24+10i) for
or complex impedance.
String

Return Value None.

Python Syntax SetPortImpedance()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oPostProc.SetPortImpedance(2, "25+3i")

VB Syntax SetPortImpedance
VB Example Set oNDE = oDesktop.GetTool("ndExplorer")

Network Data Explorer Script Commands 24-57


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oPostProc.SetPortImpedance 2, "25+3i"

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

SetPostProcSettings
Applies postprocessing settings (oPostProc) to the specified network data.

Note: Making changes to the PostProcSettings will not change the network data. To make changes, call
oData.SetPostProcSettings to change the network data.

UI Access None.

Name Type Description


Parameters
<PostProcSettings> Object The settings that will be applied to the data.

Return Value None.

Python Syntax SetPostProcSettings()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData.SetPostProcSettings(oPostProc)

VB Syntax SetPostProcSettings

Network Data Explorer Script Commands 24-58


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Set oNDE = oDesktop.GetTool("ndExplorer")


VB Example
oData.SetPostProcSettings oPostProc

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Smooth
Creates a new network data with values smoothed. The number of adjacent points smoothed is user-specified.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Smooth from the
UI Access
drop-down menu.

Name Type Description


<oData> Object Data from this object is copied to a new network data and the copy
is transformed.
<order> Integer The number of adjacent points that are smoothed.

Parameters Note: The default value is 10.

<enforceCausality> Boolean Casual data is calculated before smoothing.

Note: The default value is False.

Return Value Network IDispatch.

Python Syntax Smooth()


Python Example oNDE = oDesktop.GetTool("ndExplorer")

Network Data Explorer Script Commands 24-59


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oData2 = oNDE.Smooth(oData1, 3, True)

VB Syntax Smooth
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData2 = oNDE.Smooth oData1, 3, True

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Stretch (SPISim)
Creates a new network data representing a matrix of transmission lines with the length of those transmission lines multiplied by a
factor of n.

Note: Stretch opens and interacts with SPISim to complete.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Stretch from the
UI Access
drop-down menu.

Name Type Description


<oData> Object Data from this object is copied to a new network data and the copy is
Parameters
transformed.
<factor> Double The transmission line lengths are multiplied by this number.

Return Value Network IDispatch.

Network Data Explorer Script Commands 24-60


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note: Stretch returns None if the network data argument does not represent a matrix of transmission
lines.

Python Syntax Stretch()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData2 = oNDE.Stretch(oData1, 3.1)

VB Syntax Stretch
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData2 = oNDE.Stretch oData1, 3.1

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Terminate
Creates a new network data with specified ports terminated.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Terminate from the
UI Access
drop-down menu.

Name Type Description


Parameters <oData> Object Data from this object is copied to a new network data and the copy
is transformed.

Network Data Explorer Script Commands 24-61


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<portNumbers> Array of The port numbers that are terminated (integers between 1 and n).
Integers
<termImpedances> Array of The impedance values used to terminate the specified ports.
Complex
Numbers

Network IDispatch.

Return Value Note: Terminate returns None if the port numbers are not valid or there are no impedance value for
the port numbers.

Python Syntax Terminate()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData2 = oNDE.Terminate(oData1, [2, 3], [23, "10+2i"])

VB Syntax Terminate
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData2 = oNDE.Terminate oData1, Array(2, 3), Array(23, "10+2i")

Network Data Explorer Script Commands 24-62


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

25 - CompInstance Script Commands


CompInstance commands should be executed by the oDesign2 or oPropHost2 object.
Set oDesign2 = CompInstance.GetParentDesign
Set oPropHost2 = CompInstance.GetPropHost

Callback Scripting Using CompInstance Object


Callback scripts are scripts that can be set in the Property Dialog for individual properties by clicking the button in the Callback column
and choosing a script that is saved with the project. Callback scripts can contain any legal script commands including general Ansys
script function calls ( e.g., GetApplicationName() ). In addition, Callback scripts can also call functions on a special object named Com-
pInstance.
You can obtain an interface to a CompInstance in a schematic or layout by calling oEditor.GetCompInstanceFromRefDes(refDes). For
more information see Layout Scripting and Schematic Scripting. This interface is also available as a CompInstance object in Com-
pInstance event callbacks, such as placing a component in a layout or schematic.

Definitions
<propName> = text string
<value> = double
<valueText> = text string
<fileName> = full path file name
<choices> = string containing menu choices separated by commas
<initialChoice> = string containing initial choice for menu; must be one of the <choices>
<scriptName> = string containing name of script stored in project
<bool> is 1 for true or 0 for false

CompInstance Script Commands (multiple)


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<editorName> is either "Layout" or "SchematicEditor"

The topics for this section include:


CompInstance Functions

CompInstance Functions
Following are commands that can be used to manipulate properties from a CompInstance script.
The topics for this section include:
GetComponentName
GetEditor
GetInstanceID
GetInstanceName
GetParentDesign
GetPropHost
GetPropServerName
GetComponentName
Returns the name of the component corresponding to this CompInstance.

UI Access NA

Parameters Name Type Description

CompInstance Script Commands 64


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

None

String
Return Value
name of component (e.g. MS_TRL) and stores it in "name"

Python Syntax GetComponentName()


Python Example name = CompInstance.GetComponentName()

VB Syntax GetComponentName()
VB Example name = CompInstance.GetComponentName()

GetInstanceID [Component Instance]


Use: Returns the instanceID of the CompInstance.
Command: None
Syntax: GetInstanceID()
Return Value: String
VB Example: id = CompInstance.GetInstanceID();
Returns id of compInstance (e.g. 7) and stores it in "id".
Note that this is not the same number as the one used in the RefDes.

Python Syntax GetInstanceID()

CompInstance Script Commands 65


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Example id = CompInstance.GetInstanceID()

GetInstanceName [Component Instance]


Use: Returns the instance name of the component corresponding to this CompInstance.
Command: None
Syntax: GetInstanceName()
Return Value: String
VB Example: name = CompInstance.GetInstanceName();
Returns instanceName (e.g. A7) of compInstance and stores it in "name".
Note that the Instance Name is not the same as the RefDes.

GetParentDesign
Use: Returns an interface to the compInstance's parent design.
Command: None
Syntax: GetParentDesign()
Return Value: Returns interface to design.
Example: Set oDesign2 = CompInstance.GetParentDesign();
Returns the interface to the design containing the compInstance.
This interface can be used to call Design functions. See: Design Object Script Commands.

CompInstance Script Commands 66


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetParentDesign()


Python Example oDesign2 = CompInstance.GetParentDesign()

GetPropServerName
Use: Returns the PropServerName of the Component corresponding to this CompInstance.
Command: None
Syntax: GetPropServerName()
Return Value: String
VB Example:
name = CompInstance.GetPropServerName();
Returns propserver name of compInstance (e.g., CompInst@MS_TRL;7) and stores it in "name".

Python Syntax GetPropServerName()


Python Example name = CompInstance.GetPropServerName()

CompInstance Script Commands 67


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

68
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

26 - Simulation Setup Commands


This section presents the commands that are available in the SolveSetups module. These commands should be executed by the
oDesign object. For example:
oDesign.GetModule("SolveSetups")
oModule.CommandName <args>

The following commands are described in this section:


AddSetup
AddSweep
Analyze
AnalyzeSweep
Delete
DeleteSweep
DynamicMeshOverlays
Edit
EditSweep
ExportToHFSS
ExportToQ3D
GetAllSolutionNames
LayoutMeshOverlay
Layout3DMeshOverlay

Simulation Setup Commands 26-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ListVariations
RefreshMeshOverlays
RenameSweep

AddSetup [HFSS 3D Layout]


Use: Adds a new setup
Syntax: AddSetup(STRING newsetup) // new setup name
VB Example: oModule. Add <newsetup>

AddSweep [HFSS 3D Layout]


Use: Adds a sweep to a setup
Use: AddSweep(STRING setup) // setup name
STRING newsweep) // new sweep name
VB Example:
oModule.AddSweep "Setup 1", _
Array("NAME:Sweep 1", _
Array("NAME:Properties", "Enable:=", "true"), _
"GenerateSurfaceCurrent:=", false, _
"FastSweep:=", false, _
"ZoSelected:=", false, _
"SAbsError:=", 0.005, _
"ZoPercentError:=", 1, _

Simulation Setup Commands 26-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Sweeps", _
"Variable:=", "F", _
"Data:=", "LINC 1GHz 10GHz 10 LINC 10GHz 12GHz 5"))

Analyze [HFSS 3D Layout]


Use: Simulates the given setup
Syntax: Analyze(STRING setup1) // setup name
VB Example: oModule. Analyze <setup1>

AnalyzeSweep [HFSS 3D Layout]


Use: Simulates the given sweep
Syntax: AnalyzeSweep(STRING setup1) // setup name
STRING sweep1) // sweep name
VB Example: oModule. AnalyzeSweep <setup1> <sweep1>

Delete [HFSS 3D Layout]

Use: Removes a simulation setup


Syntax: Delete(STRING name) // The specified setup to delete
VB Example: oModule. Delete <name>

Simulation Setup Commands 26-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

DeleteSweep [HFSS 3D Layout]


Use: Removes a sweep from a setup
Syntax: DeleteSweep(STRING setup1) // The specified setup
STRING sweep1) // The specified sweep
VB Example: oModule. DeleteSweep <setup1> <sweep1>
=

DynamicMeshOverlays [HFSS 3D Layout]


Use: Turns on dynamic mesh overlays
Syntax: DynamicMeshOverlays(STRING setup) // setup name
VB Example: oModule. DynamicMeshOverlay <setup>

Edit [HFSS 3D Layout]


Use: Edits an excitation
Syntax: Edit( STRING excitation_name) // excitation name
ARRAY excitation_data) // excitation data
VB Example: oModule. Edit <excitation_name> <excitation_data>

EditSweep [HFSS 3D Layout]


Use: Edit a sweep
Syntax: EditSweep(STRING setup) // setup name

Simulation Setup Commands 26-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ARRAY solvesetup_data) // setup data


VB Example: oModule. EditSweep <setup> <solvesetup_data>

ExportToHFSS [HFSS 3D Layout]


Use: Exports an HFSS 3D Layout design to a new project with an equivalent HFSS 3D design. This command is only valid on HFSS
Setup types.
Syntax: ExportToHfss(<setupName>, <pathToExportFile>)
VB Example: oSetup.ExportToHfss("HFSS Setup 1", "C:\Temp\myexport.aedt")

ExportToQ3D [HFSS 3D Layout]


Use: Exports an HFSS 3D Layout design to a new project containing an equivalent Q3D design. This command is only valid on HFSS
Setup types.
Syntax: ExportToQ3d(<setupName>, <pathToExportFile>)
VB Example: oSetup.ExportToQ3d("HFSS Setup 1", "C:\Temp\myexport.aedt")

GetAllSolutionNames [HFSS 3D Layout]


Use: Returns a list of Ensemble solution names
Syntax: GetAllSolutionNames
Return Value: Array of Strings
Parameters: None
VB Example: Dim setupArr
setupArr = oModule.GetAllSolutionNames

GetSetupData [HFSS 3D Layout]


Get setup data.

Simulation Setup Commands 26-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Command: None
Syntax: GetSetupData <setup>
Return Value: String array of setup information.
Parameters: <setup>
Type: string
VB Example: oSetup = oDesign.GetModule("SolveSetups")
setup = oSetup.GetSetups()
dat = oSetup.GetSetupData(setup[0])

LayoutMeshOverlay [HFSS 3D Layout]


Use: Overlay a mesh for a setup in layout
Syntax: LayoutMeshOverlay(STRING setup) // setup name
VB Example: oModule. LayoutMeshOverlay <setup>

Layout3DMeshOverlay [HFSS 3D Layout]


Use: Overlay a mesh for a setup in 3D
Syntax: Layout3DMeshOverlay(STRING setup) // setup name
Example: oModule. Layout3DMeshOverlay <setup>

ListVariations [HFSS 3D Layout]


Use: Get a list of solution variations for a given solution
Syntax: ListVariations(STRING SolutionName) // solution name

Simulation Setup Commands 26-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Example: oModule.ListVariations("NWA1")

RefreshMeshOverlays [HFSS 3D Layout]


Use: Refreshes mesh display for a setup
Syntax: RefreshMeshOverlays(STRING setup) // setup name
Example: oModule.RefreshMeshOverlays <setup>

RenameSweep [HFSS 3D Layout]


Use: Renames a simulation setup
Syntax: RenameSweep(STRING oldname) // old setup name
STRING newname) // new setup name
Example: oModule. RenameSweep <oldname> <newname>

Simulation Setup Commands 26-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

26-8
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

27 - Excitations Commands
The following commands are available in the Excitations module. These commands should be executed by the oDesign object. For
example:
oDesign.GetModule("Excitations")
oModule.CommandName <args>

The following commands are described in this section:


Add
AddRefPort
AddRefPortUsingEdges
ConvertPlaneToTrace
CoupleEdgePorts
DecoupleEdgePorts
CreateGroundPortComponent
CreateInterfaceGround
CreateInterfacePort
CreateInterfacePortComponent
Delete
DeleteSource
DeleteProbePortAndVia
Edit

Excitations Commands 27-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditCircuitExcitations
EditCircuitPort
EditExcitations
GetAllBoundariesList
GetAllPortsList
RemoveRefPort
Rename
RenameSource
SelectInLayout

Add [Excitation HFSS 3D Layout]


Use: Adds an excitation
Syntax: Add(ARRAY excitation_data) // excitation data
Example:
oModule. Add <excitation_data>

AddRefPort [HFSS 3D Layout]


Use: Adds a reference to an existing port
Syntax: AddRefPort(STRING portname) // name of the port
STRING edgeportname) // name of the edgeport
VB Example: oModule. AddRefPort portname edgeportname

Excitations Commands 27-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AddRefPortUsingEdges [HFSS 3D Layout]


Use: Creates an edge port with reference using the specified edge
Command: None
Syntax: <port name>,
Array("Name:EdgeRefs",
"edge:=", Array(<edge information>)
Return Value: None
Parameters: <port name>: string that will name the created edge port
<edge information>: describes the edge.
There are two choices: primitive edge or via edge.

<edge information> for a primitive edge:


"et:=", "pe", "prim:=", <primitive name>, "edge:=", <edge number>

<primitive name>: text that is the name of the primitive to use


<edge number>: an integer indexing the edge of the primitive to use

<edge information> for via edge:


"et:=", "pse", "sel:=", <via name>, "layer:=", <layer id>,
"sx:=", <start X location>, "sy:=", <start Y location>,

Excitations Commands 27-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ex:=", <end X location>, "ey:=", <end Y location>,


"h:=", <arc height>, "rad:=", <radians>

<via name>: text that is the name of the via to use


<layer id>: an integer that is the id of the layer of the pad of the via to use
<start X location>, <start Y Location>:
doubles that are the X, Y location of the start point of the edge arc
<end X location>, <end Y Location>:
doubles that are the X, Y location of the end point of the edge arc
<arc height>: double giving the height of the edge arc (0 for a straight edge)
<radians>: double giving the arc size in radians (0 for a straight edge)

oModule.AddRefPortUsingEdges "Port1", Array("NAME:EdgeRefs", "edge:=",


Array("et:=", "pe", "prim:=", "rect_3", "edge:=", 1))

oModule.AddRefPortUsingEdges "Port1", Array("NAME:EdgeRefs", "edge:=",


Array("et:=", "pse", "sel:=", "via_5", "layer:=", 10, "sx:=", 0.0015, "sy:=", 0.0015,
"ex:=", -0.0015, "ey:=", 0.0015, "h:=", 0, "rad:=", 0))

Excitations Commands 27-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ConvertPlaneToTrace [HFSS 3D Layout]


Use: Convert planes to traces
Syntax: ConvertPlaneToTrace <polygon information>
Return Value: None
Parameters: <Polygon_Data>
Type: array
VB Example: oEditor.ConvertPlanetoTrace Array("NAME:elements", "poly_10", "poly_9", "poly_8", …)

ConvertTraceToPlane [HFSS 3D Layout]


Use: Convert traces to planes
Syntax: ConvertTraceToPlane <line information>
Return Value: None
Parameters: <Line_Data>
Type: array
VB Example: oEditor.ConvertTracetoPlane Array("NAME:elements", " line _10", " line _9", " line _
8", …)

CoupleEdgePorts
Use: Couples valid edge ports
Syntax: CoupleEdgePorts(VARIANT coupledlist) //entry containing ports to be coupled
Example: oModule.CoupleEdgePorts Array("Port1", "Port2")

Excitations Commands 27-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CreateGroundPortComponent [HFSS 3D Layout]


Use: Create a ground port component
Command: Right-click selected port > Port > Nexxim Ports > Add Grounds at Unconnected Pins
Return Value: None
Parameters: <Component_Data>
Type: array
VB Example: oEditor.CreateGroundPortComponent Array("NAME:elements", "Comp37", "Comp10", …)

CreateInterfaceGround [HFSS 3D Layout]


Use: Create an interrface ground
Command: Right-click selected port > Port > Nexxim Ports > Circuit Ground
Return Value: None
Parameters: <Port_Data>
Type: array
VB Example: oEditor.CreateInterfaceGround Array("NAME:NexximPort", "Name:=", "NexximGnd3", _
"X:=", -0.00103067385498434, "Y:=", -0.00738649582490325, "Rot:=", 0)

CreateInterfacePort [HFSS 3D Layout]


Use: Create an interrface port
Command: Right-click selected port > Port > Nexxim Ports > Circuit Interface
Syntax: CreateInterfacePort <Port_Data>

Excitations Commands 27-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters: <Port_Data>
Type: array
VB Example: oEditor.CreateInterfacePort Array("NAME:NexximPort", "Name:=", "Port1", _
"X:=", -0.00309202168136835, "Y:=", 0.00314928125590086, "Rot:=", 0)

CreateInterfacePortComponent [HFSS 3D Layout]


Use: Create an interface port component
Command: Right-click selected port > Port > Nexxim Ports > Add Interface Ports at Unconnected Pins
Syntax: CreateInterfacePortComponent <Port_Data>
Parameters: <Component_Data>
Type: array
VB Example: oEditor.CreateInterfacePortComponent Array("NAME:elements", "Comp37", "Comp10", …)

DecoupleEdgePorts
Use: Decouples edge ports
Syntax: DecoupleEdgePorts(
VARIANT decoupledlist) //entry containing ports to be decoupled
Example: oModule.DecoupleEdgePorts Array("Port1:T1", "Port1:T2")

Delete[Excitation HFSS 3D Layout]


Use: Deletes an excitation
Syntax: Delete( STRING excitation_name) // excitation name
Example: oModule. Delete <excitation_name>

Excitations Commands 27-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Delete [Interface Port]


Use: Deletes an interface port
Syntax: Delete( STRING: Interface Port name)
VB Example: oModule.Delete "PortName"

Delete[Excitation HFSS 3D Layout]


Use: Deletes an excitation
Syntax: Delete( STRING excitation_name) // excitation name
Example: oModule. Delete <excitation_name>

DeleteProbePortAndVia [HFSS 3D Layout]


Use: Deletes a coaxial probe port and the associated via
Syntax: DeleteProbePortAndVia( STRING port_name) // Probe Port name
STRING via_name) //Via name
Example: oModule. DeleteProbePortAndVia <port_name> <via_name>

DeleteSource [Interface Source]


Use: Deletes an interface source
Syntax: DeleteSource (STRING: Interface Source name)
VB Example: oModule. DeleteSource "SourceName"

Excitations Commands 27-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Edit [HFSS 3D Layout]


Use: Edits an excitation
Syntax: Edit( STRING excitation_name) // excitation name
ARRAY excitation_data) // excitation data
VB Example: oModule. Edit <excitation_name> <excitation_data>

EditCircuitExcitations [HFSS 3D Layout]


Use:Edits the properties of all the existing circuit excitations
Syntax:EditCircuitExcitations Array("NAME:NexximPostProcess", Array("NAME:portname", do-post-proc, "de-embedding distance",
"re-normalization impedance")...))
Return Value:None
VB Example:oModule.EditCircuitExcitations Array("NAME:NexximPostProcess", Array("Port1", true,
"50ohm + 0i ohm"), Array("Port5", true, "75ohm + 0i ohm"))

EditCircuitPort [Interface Port]


Use: Edit a circuit port
Command: None
Syntax: EditCircuitPort <Port Name> <Port Info> <Port Properties>
Return Value: None

Excitations Commands 27-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters: <Port Name> - Type: string


<Port Info> - Type: array
<Port Properties> - Type:array
VB Example:
oModule.EditCircuitPort "Port2", Array("NAME:Port2", "IIPortName:=", "Port2", "SymbolType:=", _
0), Array(Array("NAME:Properties", Array("NAME:NewProps", Array("NAME:term", "PropType:=", _
"TextProp", "OverridingDef:=", true, "Value:=", "Model1")), Array("NAME:ChangedProps", Array
("NAME:TerminationData", "Value:=", _
"Zo"), Array("NAME:pnum", "Value:=", "2"), Array("NAME:noisetemp", "Value:=", "16.85")))

EditExcitations [HFSS 3D Layout]


Edits the properties of all existing excitations.

Note: GapSource should always be set.

UI Access None.

Name Type Description


<exciteArray> Structured Array Excitations block.
Parameters <ppArray> Structured Array Post-processing block.
<gapSource> String Gap source.
<pushExParams> Structured Array PushExParams block. "" by default.

Return Value None.

Excitations Commands 27-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax EditExcitations (<exciteArray>, <ppArray>, <gapSource>, <pushExParams>))


oModule.EditExcitations(
[ "NAME:Excitations",
["Port1","0deg","0.099V"],
["Port2","0deg","0.099V"]
],
Python Example ["NAME:PostProcess",
["Port1",True,True,"0mm","50ohm + 0i ohm"],
["Port2",True,True,"0mm","50ohm + 0i ohm"]
],
"GapSource,IncidentVoltage",
[])

VB Syntax EditExcitations <exciteArray>, <ppArray>, <gapSource>, <pushExParams>


oModule.EditExcitations
Array("NAME:Excitations", Array("NAME:Port1", "0deg", "1V")),
VB Example Array("NAME:PostProcess", Array("NAME:Port1", true, "1mm", "50ohm +0i ohm")),
"GapSource",
""

Excitations Commands 27-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetAllBoundariesList [HFSS 3D Layout]


Use: Get a list of all boundaries.
Command: None
Syntax: GetAllBoundariesList <bounds>
Return Value: String array of list of all boundaries.
Parameters: <bounds>
Type: string
Example: oEx = oDesign.GetModule('Excitations')
bounds = oEx.GetAllBoundariesList()

GetAllPortsList [HFSS 3D Layout]


Use: Returns the names of all Ensemble ports
Syntax: GetAllPortsList
Return Value: Array of Strings
Parameters: None
Example: Dim portArr
portArr= oModule.GetAllPortsList

Rename [Interface Port]


Use: Renames an interface port

Excitations Commands 27-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax: Rename (STRING: Interface Port name)(STRING: New name)


VB Example: oModule.Rename "OldName" "NewName"

RenameSource [Interface Source]


Use: Renames an interface source
Syntax: RenameSource (STRING: Interface Source name)
VB Example: oModule.RenameSource "OldName" "NewName"

Rename [HFSS 3D Layout]


Use: Renames an excitation
Syntax: Rename(STRING oldname) // old excitation name
STRING newname) // new excitation name
Example: oModule. Rename <oldname> <newname>

RemoveRefPort [HFSS 3D Layout]


Use: Removes the reference for an existing port
Syntax: RemoveRefPort(
STRING portname) // name of the port
Example: oModule. RemoveRefPort portname

SelectInLayout [HFSS 3D Layout]


Use: Selects and highlights an excitation in the layout editor
Syntax: SelectInLayout( STRING excitation_name) // excitation name

Excitations Commands 27-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Example: oModule. SelectInLayout <excitation_name>

Excitations Commands 27-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

28 - 2.5D Via Commands


The following commands are available in the LayoutVias module. These commands should be executed by the oDesign object. For
example:
oDesign.GetModule("LayoutVias")
oModule.CommandName <args>

The following commands are described in this section:


ConvertPrimitives
Delete
Edit
MultipleEdit
Rename
SelectInLayout

2.5D Via Commands 28-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

28-2
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

29 - Cavity Commands
The following commands are available in the Cavities module. These commands should be executed by the oDesign object. For
example:
oDesign.GetModule("Cavities")
oModule.CommandName <args>

The following commands are described in this section:


Add
Delete
Edit
Rename
SelectInLayout

Cavity Commands 29-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

29-2
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

30 - Layout Scripting
The Layout scripting interface is a set of commands that can be executed by the Layout Editor interface of Design objects. Accessing
the Layout Editor interface can be done by the SetActiveEditor method of a Design object, for example:
Dim oEditor
oEditor = DesignObject.SetActiveEditor ("Layout")
The call to each scripting method contains three elements:
l Layout editor
l Method name
l Method arguments (if any)

For instance, in Visual Basic, a call might look like this:


oEditor.Delete ("rect_1")
The beIhavior of the scripting methods is similar to the corresponding commands in the Layout editor. This correspondence is par-
ticularly evident when recording a script in Layout Editor (Tools>Record Script).
The topics for this section include:
Object Identifiers and Script Recording
Create Primitives
Create Voids in Primitives
Other Creation Methods
Object Movement and Modification Methods
Activation and Deactivation Methods
Layout and Geometry Interrogation Methods

Layout Scripting 30-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Boolean Operations on Primitives


Coordinate System Methods
Layers Methods
NetClass Methods
Port Methods
Miscellaneous Methods

Object Identifiers and Script Recording


Many scripting methods apply to one or more existing objects. Objects in scripts are uniquely identified by their names, and the object
names are typically referenced as:
Array("name1", "name2") // name1 and name2 are the names of the objects.
While working interactively in the Layout Editor, the user may observe (but not modify, except in some special cases) the names of the
currently selected objects through the "Selected Object Properties" dialogs. These same names are the ones that the scripting meth-
ods use in order to identify the object the method applies to.
When particular objects are involved in interactive script recording, they are typically selected before the actual execution the par-
ticular interactive command. In this case, the selected objects’ names would appear within the generated script method argument(s).

Create Primitives
The following create primitives are available.
CreateCircle
CreateLine
CreatePolygon
CreateRectangle

Layout Scripting 30-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CreateText

CreateCircle (Layout Editor)


Use: Creates a circle primitive object and adds it to the current layout. Returns the name of the newly created object.
Syntax: CreateCircle<circle_description>

Parameters: <circle_description>:
Array("NAME:Contents",
"circleGeometry:=", <circle_geometry>) // object description

<circle_geometry> :
Array("LayerName:=", <layer_name>, // name of the layer
"lw:=", <value>, // border line width
"x:=", <value>, // center x coordinate
"y:=", <value>, // center y coordinate
"r:=", <value>) // radius

<layer_id> :
integer; never used in scripting

<object_name> :
quoted string, uniquely identifying an object

Layout Scripting 30-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<value> :
quoted_string_parseable_as_value (e.g. "0.111mm")
VB Example:
oEditor.CreateCircle
Array("NAME:Contents",
"circleGeometry:=",
Array("Layer:=", 6,
"Name:=", "circle_150",
"LayerName:=", "Top",
"lw:=", "0mm",
"x:=", "34mm",
"y:=", "-15mm",
"r:=", "8.60232526704263mm"))
CreateLine (Layout Editor)
Use: Creates a line primitive object.
Syntax: CreateLine <line_description>
Return Value: Returns the name of the newly created object.
Parameters: <line_description>:
Array("NAME:Contents",

Layout Scripting 30-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"lineGeometry:=", <line_geometry>)
<line_geometry> :
Array("LayerName:=",<layer_name>,
"lw:=", <value>, // line width
"endstyle:=", <end_style>,
"joinstyle:=",<join_style>,
<vertex_sequence> )

<end_style> : integer
FlatEnd = 0
ExtendedEnd = 1
RoundEnd = 2

<join_style> : integer
UnmiteredJoin = 0
MiteredJoin = 1
OptimallyMiteredJoin = 2
RadiallyMiteredJoin = 3
ChordMiteredJoin = 4

<vertex_sequence>:

Layout Scripting 30-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"n:=", integer, // the total count of the vertices


"x0:=",<value>, "y0:=", <value>,
"x1:=",<value>, "y1:=", <value>,
etc. up to vertex count)
VB Example:
oEditor.CreateLine
Array("NAME:Contents",
"lineGeometry:=",
Array("Layer:=", 6,
"Name:=", "line_1",
"LayerName:=", "Top",
"lw:=", "2mil",
"endstyle:=", 0,
"joinstyle:=", 0,
"n:=", 4,
"x0:=", "-32mm", "y0:=", "2mm",
"x1:=", "-5mm", "y1:=", "12mm",
"x2:=", "1mm", "y2:=", "-4mm",
"x3:=", "19mm", "y3:=", "3mm"))

Layout Scripting 30-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CreateRectangle (Layout Editor)


Use: Creates a rectangle primitive object and adds it to the current layout.
Syntax: CreateRectangle<rectangle_description>
Return Value: Returns the name of the newly created object.
Syntax: <rectangle_description>:
Array("NAME:Contents",
"rectGeometry:=", <rectangle_geometry>)
<rectangle_geometry> :
Array("LayerName:=", <layer_name>, // placement layer
"lw:=", <value>, // line width
"x:=", <value>, // center X coordinate
"y:=", <value>, // center Y coordinate
"w:=", <value>, // width (X-direction size)
"h:=", <value>, // height (Y-direction size)
"ang:=", <value>)) // rotation
VB Example:
oEditor.CreateRectangle
Array("NAME:Contents",
"rectGeometry:=",
Array("Layer:=", 6,
"Name:=", "rect_4",

Layout Scripting 30-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"LayerName:=", "Top",
"lw:=", "0mm",
"x:=", "29mm",
"y:=", "9.5mm",
"w:=", "24mm",
"h:=", "15mm",
"ang:=", "0deg"))

CreatePolygon (Layout Editor)


Use: Creates a polygon primitive object.
Syntax: CreatePolygon<polygon_description>
Return Value: Returns the name of the newly created object.
Parameters: <polygon_description>:
Array("NAME:Contents",
"lineGeometry:=", <polygon_geometry>)

<polygon_geometry> :
Array("LayerName:=", <layer_name>, // layer
"lw:=", <value>, // border line width
<vertex_sequence> ) // polygon boundary

Layout Scripting 30-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example:
oEditor.CreatePolygon
Array("NAME:Contents",
"polyGeometry:=",
Array("Layer:=", 6,
"Name:=", "poly_5",
"LayerName:=", "Top",
"lw:=", "0mm",
"n:=", 5,
"x0:=", "-35mm", "y0:=", "17mm",
"x1:=", "-37mm", "y1:=", "5mm",
"x2:=", "-30mm", "y2:=", "8mm",
"x3:=", "-30mm", "y3:=", "8mm",
"x4:=", "-30mm", "y4:=", "8mm"))

CreateText (Layout Editor)


Use: Creates a text primitive object and adds it to the current layout.
Syntax: CreateText <text_description>
Return Value: Returns the name of the newly created object.
Parameters: <text_description>:
Array("NAME:Contents",

Layout Scripting 30-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"textGeometry:=", <text_geometry>)
<text_geometry> :
Array("LayerName:=", <layer_name>,
"x:=", <value>, // origin X
"y:=", <value>, // origin Y
"ang:=", <value>, // rotation
"isPlot:=", <bool>, // is it plotted or not
"font:=", <font_name>,
"size:=", <value>,
"weight:=", <text_weight>,
"just:=", <text_justification>,
"mirror:=", <bool>,
"text:=", <quoted_string>) // text itself

<bool> : true | false

<font_name> : quoted string, a font name

<text_weight> : integer
Thin = 0,

Layout Scripting 30-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ExtraLight = 1
Light = 2
Normal = 3
Medium = 4
SemiBold = 5
Bold = 6
ExtraBold = 7
Heavy =8

<text_justification> : integer
LeftTop = 0
LeftBase = 1
LeftBottom = 2
CenterTop = 3
CenterBase= 4
CenterBottom = 5
RightTop = 6
RightBase = 7
RightBottom = 8
VB Example: oEditor.CreateText
Array("NAME:Contents",

Layout Scripting 30-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"textGeometry:=",
Array("Layer:=", 6,
"Name:=", "text_6",
"LayerName:=", "Top",
"x:=", "-26mm",
"y:=", "-16mm",
"ang:=", "0deg",
"isPlot:=", true,
"font:=", "Roman",
"size:=", "0.508mm",
"weight:=", 3,
"just:=", 4,
"mirror:=", false,
"text:=", "Sample"))

Create Voids in Primitives


The following primitives are available.
CreateLineVoid
CreatePolygonVoid
CreateCircleVoid

Layout Scripting 30-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CreateRectangleVoid

CreateCircleVoid (Layout Editor)


Use: Creates a circle void and adds it to a particular parent primitive.
Syntax: CreateCircleVoid<circle_void_description>
Return Value: Returns the name of the newly created object
Parameters: <circle_void_description>:
Array("NAME:Contents",
"owner:=", <object_name>, // parent primitive name
"circle voidGeometry:=", <circle_geometry>) // definition
VB Example:
oEditor.CreateCircleVoid
Array("NAME:Contents",
"owner:=", "rect_4",
"circle voidGeometry:=",
Array ("Layer:=", 6,
"Name:=", "circle void_10",
"LayerName:=", "Top",
"lw:=", "0mm",
"x:=", "26mm",
"y:=", "11mm",

Layout Scripting 30-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"r:=", "1.41421356237309mm"))

CreateLineVoid (Layout Editor)


Use: Creates a line void and adds it to a specified as parameter parent primitive.
Syntax: CreateLineVoid<line_void_description>
Return Value: Returns the name of the newly created object.
Parameters: <line_void_description>:
Array("NAME:Contents",
"owner:=", <object_name>, // parent primitive name
"line voidGeometry:=", <line_geometry>) // definition
VB Example: oEditor.CreateLineVoid
Array("NAME:Contents",
"owner:=", "rect_4",
"line voidGeometry:=",
Array("Layer:=", 6,
"Name:=", "line void_14",
"LayerName:=", "Top",
"lw:=", "2mil",
"endstyle:=", 0,
"joinstyle:=", 0,

Layout Scripting 30-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"n:=", 3,
"x0:=", "27mm", "y0:=", "5mm",
"x1:=", "35mm", "y1:=", "5mm",
"x2:=", "36mm", "y2:=", "9mm"))

CreatePolygonVoid (Layout Editor)


Use: Creates a polygon void and adds it to a specified as parameter parent primitive.
Syntax: CreatePolygonVoid <polygon_void_description>
Return Value: Returns the name of the newly created object.
Parameters: <polygon_void_description>:
Array("NAME:Contents",
"owner:=", <object_name>, // owner name
"poly voidGeometry:=", <polygon_geometry>) // definition
VB Example: oEditor.CreatePolygonVoid
Array("NAME:Contents",
"owner:=", "rect_4",
"poly voidGeometry:=",
Array("Layer:=", 6,
"Name:=", "poly void_18",
"LayerName:=", "Top",
"lw:=", "0mm",

Layout Scripting 30-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"n:=", 5,
"x0:=", "21mm", "y0:=", "9mm",
"x1:=", "21mm", "y1:=", "5mm",
"x2:=", "24mm", "y2:=", "7mm",
"x3:=", "24mm", "y3:=", "7mm",
"x4:=", "24mm", "y4:=", "7mm"))

CreateRectangleVoid (Layout Editor)


Use: Creates a rectangle void and adds it to a specified as parameter parent primitive.
Syntax: CreateRectangleVoid<rectangle_void_description>
Return Value: Returns the name of the newly created object.
Syntax: <rectangle_void_description>:
Array("NAME:Contents",
"owner:=", <object_name>, // owner_name
"rect voidGeometry:=", <rectangle_geometry>)
VB Example:
oEditor.CreateRectangleVoid
Array("NAME:Contents",
"owner:=", "rect_4",
"rect voidGeometry:=",

Layout Scripting 30-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("Layer:=", 6,
"Name:=", "rect void_16",
"LayerName:=", "Top",
"lw:=", "0mm",
"x:=", "34.5mm",
"y:=", "13mm",
"w:=", "3mm",
"h:=", "2mm",
"ang:=", "0deg"))

Other Creation Methods


The following creation methods are available.
CreateComponent <…>
CreateHole <…>
CreateMeasure <…>
CreatePin <…>
CreatePinGroup <…>
CreatePinGroupPort <…>
CreateTrace <…>
CreateVia <…>
DeletePinGroup <…>

Layout Scripting 30-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CreateComponent (Layout Editor)


Use: Places a component.
Syntax: CreateComponent <Array>
Return Value: Returns the name of the newly created component.
Parameters: Array("NAME:Contents",
"definition_name:=", <component name>,
"placement:=", Array("x:=", <x position>, "y:=", <y position>),
"layer:=", <placement layer name>,
"StackupLayers:=", Array("<fooprint stackup layer>:<design stackup layer>", …),
"DrawLayers:=", Array("<fooprint layer>:<design layer>", …))
VB Example: oEditor.CreateComponent Array("NAME:Contents",
"definition_name:=", "MSTRL",
"placement:=", Array("x:=", "-13mm", "y:=", "5mm"),
"layer:=", "Top",
"StackupLayers:=", Array("Top:Top", "0:Dielectric", "0:Ground"),
"DrawLayers:=", Array("Measures:Measures", "Assembly Top:Assembly Top", "Silkscreen Top:Silk-
screen Top", "Wirebonds:0"))

Notes:

Layout Scripting 30-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Each Layer mapping is specified as a single text string in quotes, "<footprint layer>:<design layer>". If the layer does not map to any-
thing, use a "0" for the layer. For example, you can use "Measures:0", if the footprint "Measures" layer does not map to a design layer.
Use "0:Dielectric", if the design "Dielectric" layer does not map to a footprint layer.
Note, also, that the "StackupLayers" and the "DrawLayers" arguments may be omitted, in which case, the mappings are determined
automatically.

CreateHole (Layout Editor)


Use: Places a Hole object.
Syntax: CreateHole <Array>
Return Value: Returns the name of the newly created Hole
Parameters: Array("NAME:Contents",
Array("NAME:full_definition",
"type:=", "hole",
Array("NAME:Properties",
"VariableProp:=",
Array("radius", "D", "", <value>), // radius
"VariableProp:=",
Array("sides", "D", "", integer)),//side count
"from_layer:=", <layer_name>,
"to_layer:=", <layer_name>),
"placement:=", <vpoint>, // placement position
"layer:=", <layer_name>) // placement layer

Layout Scripting 30-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<vpoint> :
Array("x:=", <value>, // X coordinate
"y:=", <value>) // Y coordinate

VB Example: oEditor.CreateHole
Array("NAME:Contents",
Array("NAME:full_definition",
"type:=", "hole",
Array("NAME:Properties",
"VariableProp:=",
Array("radius", "D", "", "0.635mm"),
"VariableProp:=",
Array("sides", "D", "", "6")),
"from_layer:=", 6,
"to_layer:=", 6),
"placement:=", Array("x:=", "-36mm", "y:=", "-9mm"),
"layer:=", "Top")

Layout Scripting 30-20


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CreateMeasure (Layout Editor)


Use: Creates a measurement.
Syntax: CreateMeasure
Use: Returns the name of the created object.
Parameters: Array("NAME:Contents",
"MeasurementGeometry:=",
Array("LayerName:=", <layer_name>, // layer
"lw:=", <value>, // line width
"sx:=", <value>, // start X coordinate
"sy:=", <value>, // start Y coordinate
"ex:=", <value>, // end X coordinate
"ey:=", <value>, // end Y coordinate
<text_style>)

<text_style> :
"name:=", <quoted string>, // its name
"isPlot:=", <bool>,
"font:=", <font_name>,
"size:=", double, // size in current units
"angle:=", <value>,
"weight:=", <text_weight>,

Layout Scripting 30-21


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"just:=", <text_justification>,
"mirror:=", <bool>,
"scales:=", <bool>))
VB Example: oEditor.CreateMeasure
Array("NAME:Contents",
"MeasurementGeometry:=",
Array("Layer:=", 0,
"Name:=", "Measurement_2",
"LayerName:=", "Measures",
"lw:=", "0mm",
"sx:=", "-32mm",
"sy:=", "-13mm",
"ex:=", "32mm",
"ey:=", "-11mm",
"name:=", "<DefaultAnnotation>",
"isPlot:=", false,
"font:=", "Arial",
"size:=", 10,
"angle:=", "0deg",
"weight:=", 3,

Layout Scripting 30-22


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"just:=", 4,
"mirror:=", false,
"scales:=", false))

CreatePin (Layout Editor)


Use: Creates a pin.
Syntax: CreatePin <pin_description>
Return Value: Returns the name of the newly created pin.
Parameters: <pin_description>:
Array("NAME:Contents",
Array("NAME:Port", "Name:=", <object_name>), // not used
"Rotation:=", Array(<value>), // rotation
"Offset:=", <vpoint>, // position
"Padstack:=", <quoted_string>) // padstack name
VB Example: oEditor.CreatePin
Array("NAME:Contents",
Array("NAME:Port", "Name:=", "Pin_1"),
"Rotation:=", Array("0deg"),
"Offset:=", Array("x:=", "-2mm", "y:=", "-1mm"),
"Padstack:=", "NoPad SMT East")

Layout Scripting 30-23


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CreatePinGroup (Layout Editor)


Use: Create a pin group from a selection of pins.
Syntax: CreatePinGroup(STRING pin-group-name, ["NAME:elements", STRING pin, STRING pin, …])
VB Example: oEditor.CreatePinGroup("J1_GND_Group", [ "NAME:elements", "J1-1", "J1-2", "J1-35",
"J1-56" ])

CreatePinGroupPort (Layout Editor)


Use: Create a pin group port from two pin-groups; first is positive, second is negative.
Syntax: CreatePinGroupPort(["Name:elements", STRING pos-pin-group, STRING neg-pin-group])
VB Example: oEditor.CreatePinGroupPort( [ "NAME:elements", "J1_GND_Group", "J1_VCC_Group" ])

CreateTrace (Layout Editor)


Use: Create a trace with a manually specified path between pins, ports, or selected edges.
Command: Draw > Route > Manual
Syntax: CreateTrace
Array("NAME:options", "Layer1:=", <"layer">, "Layer2:=", <"layer">),
Array("NAME:Lines", "Num:=", <n_lines>, "l0:=",
Array("Name:=", <"line">, "LayerName:=", <"layer">, "lw:=", <"width">,
"endstyle:=", <endstyle>, "joinstyle:=", <joinstyle>, "n:=", <n_vertex>,
"U:=", <"units">, "x:=", <value>, "y:=", <value>, ), …),

Layout Scripting 30-24


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Vias", "Num:=", <n_vias>,


Array("NAME:v1", "name:=", <"via">, "ReferencedPadstack:=", <"padstack">,
"vposition:=", Array("x:=", <"vertex">, "y:=", <"vertex">), "vrotation:=",
Array(<"angle">), "overrides hole:=", <override>, "hole diameter:=",
Array(<"diameter">), "highest_layer:=", <"layer">, "lowest_layer:=", <"layer">), …),
Array("NAME:elements", <"port">, …),
Array("NAME:EdgeRefs", "edge:=", Array(<edge description>), …)
Return Value: None
Parameters: <"layer">
Type: text
Description: layer name

<n_lines>
Type: integer
Description: number of line definitions following

<"line">
Type: text
Description: line name

<"width">

Layout Scripting 30-25


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Type: text
Description: line width; value with units, e.g. "1mm"

<endstyle>
Type: integer
Description: end (cap) style value for the line.

<joinstyle>
Type: integer
Description: join style value.

<n_vertex>
Type: integer
Description: number of vertices in the line

<value>
Type: double
Description: simple value, e.g. 10

<n_vias>

Layout Scripting 30-26


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Type: integer
Description: number of via defintions following

<"via">
Type: text
Description: via name

<"padstack">
Type: text
Description: padstack defintion name.

<"angle">
Type: text
Description: via orientation; value with units, e.g. "180deg"

<override>
Type: boolean (true or false)
Description: if true, the diameter is used to override the via hole definition.

<"diameter">
Type: text

Layout Scripting 30-27


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Description: via hole diameter override; a value with units, e.g. "1mm"

<"port">
Type: text
Description: a port or pin name.

<edge description>
for primitive edges
"et:=", "pe", "prim:=", <"prim">, "edge:=", <edge#>

<"prim">
Type: text
Description: primitive name

<edge#>
Type: integer
Description: edge number on the primitive

<edge description>
for via edges

Layout Scripting 30-28


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"et:=", "pse", "sel:=", <"via">, "layer:=", <layer id>,


"sx:=", <start X location>, "sy:=", <start Y location>, "ex:=", <end X location>,
"ey:=", <end Y location>, "h:=", <arc height>, "rad:=", <radians>

<"via">:
text that is the name of the via to use
<layer id>:
an integer that is the id of the layer of the pad of the via to use

<start X location>, <start Y Location>:


doubles that are the X, Y location of the start point of the edge arc
<end X location>, <end Y Location>:
doubles that are the X, Y location of the end point of the edge arc

<arc height>:
double giving the height of the edge arc (0 for a straight edge)
<radians>:
double giving the arc size in radians (0 for a straight edge)

VB Example: oEditor.CreateTrace Array("NAME:options", "Layer1:=", "Top",


"Layer2:=", "Ground"), Array("NAME:elements"), Array("NAME:EdgeRefs",

Layout Scripting 30-29


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"edge:=", Array("et:=", "pe", "prim:=", "rect_4", "edge:=", 3), "edge:=",


Array("et:=", "pse", "sel:=", "via_3", "layer:=", 8, "sx:=", -0.0015, "sy:=", 0.0015,
"ex:=", -0.0015, "ey:=", -0.0015, "h:=", 0, "rad:=", 0))

CreateVia (Layout Editor)


Use: Creates a new via.
Syntax: CreateVia <via_description>
Return Value: Returns the name of the created via
Parameters: <via_description>:
Array("NAME:Contents",
"name:=", <object_name>, // not used
"vposition:=", <vpoint>, // position
"rotation:=", double, // rotation in radians
"overrides hole:=", <bool>,// overrides or not padstack hole
"hole diameter:=", Array(<value>), // via diameter
"ReferencedPadstack:=", <quoted_string>, // padstack name
"highest_layer:=", <layer_name>,
"lowest_layer:=", <layer_name>)
VB Example: oEditor.CreateVia
Array("NAME:Contents",

Layout Scripting 30-30


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"name:=", "",
"vposition:=", Array("x:=", "-22mm", "y:=", "5mm"),
"rotation:=", 0,
"overrides hole:=", false,
"hole diameter:=", Array( "1mm"),
"ReferencedPadstack:=", "Round 1mm/0.5mm",
"highest_layer:=", "Top",
"lowest_layer:=", "Bottom")

DeletePinGroup (Layout Editor)


Use: Deletes a pin group.
Syntax: DeletePinGroup(STRING pin-group-name)
VB Example: oEditor.DeletePinGroup("J1_GND_Group")

Object Movement and Modification Methods


The documented object movement methods are available.
Connect (Layout Editor)
Copy (Layout Editor)
Delete (Layout Editor)
Disconnect (Layout Editor)

Layout Scripting 30-31


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Edit (Layout Editor)


Expand (Layout Editor)
ExpandWithPorts (Layout Editor)
FlipHorizontal (Layout Editor)
FlipVertical (Layout Editor)
Move (Layout Editor)
Paste (Layout Editor)
Rotate (Layout Editor)
Connect (Layout Editor)
Use: Causes connecting of the referenced object. After the command the objects will be in the same electrical net.
Syntax: Connect Array ("NAME: elements",
<object_name>, // 1st object

<object_name>, // 2nd object, if any

…) // etc
VB Example:
oEditor.Connect Array("NAME:elements", "2:n2", "circle_4")

Copy (Layout Editor)


Use: Copies the referenced objects to the clipboard.
Syntax: Copy Array (<object_name>, // 1st object

Layout Scripting 30-32


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<object_name>, // 2nd object

Return Value: Returns the name of the new net.


VB Example:
oEditor.Copy Array("circle_0", "rect_2")

Delete (Layout Editor)


Use: Deletes one or more objects.
Syntax: Delete <object_name_list>// names of the objects to be deleted
<object_name_list>:
Array ("NAME:elements", <object_name>, <object_name>, …)
VB Example:
oEditor.Delete Array("NAME:elements", "circle_0", "rect_2")

Disconnect (Layout Editor)


Use: Removes the specified object(s) from their current electrical net(s) (if any).
Syntax: Disconnect Array ("NAME: elements",
<object_name>, // 1st object

<object_name>, // 2nd object, if any

…) // etc
VB Example: oEditor.Disonnect Array("NAME:elements", "2:n2")

Layout Scripting 30-33


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Edit (Layout Editor)


Use: Causes modification of one or more existing object(s).
Syntax: Edit <Array("NAME:items".....)>,
Parameters: <Array("NAME:items"
<edit_object_info>, // one object info
<edit_object_info>, // another one
…) // etc
<edit_object_info>:
Array("NAME:item",
"name:=", <object_name>, // name of the object
<object_description>) // ‘new’ object state, type should be consistent with <object_name>:

<object_description>:
<circle_description> |
<rectangle_description> |
<line_description> |
<polyon_description> |
<text_description> |
<circle_void_description> |
<rectangle_void_description> |

Layout Scripting 30-34


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<line_void_description> |
<polyon_void_description> |
<component_description> |
<pin_description> |
<via_description>
VB Example:
oEditor.Edit Array("NAME:items", Array("NAME:item",
"name:=", "circle_0", Array("NAME:contents",
"circleGeometry:=", Array("Layer:=", 6,
"Name:=", "circle_0", "LayerName:=", "Top",
"lw:=", "0mm", "x:=", "-0.008meter",
"y:=", "13.2924281984334mm", "r:=", 10.2924281984334mm")))

Expand (Layout Editor)


Scales an existing circle, square, or polygon. To expand an object while preserving ports, use ExpandWithPorts.

UI Access Draw > Expand.

Name Type Description


<expansion> String Expansion amount, including unit. Value can be negative to shrink an object.
<join> String Corner style. One of:
Parameters
l "ROUND"
l "MITER"

Layout Scripting 30-35


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"CORNER"
l

<replace> Boolean True to replace original object; False to create new object.
<items> Array Structured array containing object to expand:
Array("NAME:elements",
"<Name of Object to Expand>")

Return Value None.

Python Syntax Expand (<expansion>, <join>, <replace>, <items>)


Python Example oEditor.Expand("2mm", "ROUND", True, ["NAME:elements", "circle_0"])

VB Syntax Expand <expansion>, <join>, <replace>, <items>


VB Example oEditor.Expand "2mm", "ROUND", true, Array("NAME:elements", "poly_0")

ExpandWithPorts (Layout Editor)


Scales an existing circle, square, or polygon and preserves ports. To expand an object without preserving ports, use Expand.

UI Access Draw > Expand.

Name Type Description


<expansion> String Expansion amount, including unit. Value can be negative to shrink an object.
Parameters <join> String Corner style. One of:
l "ROUND"

Layout Scripting 30-36


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l "MITER"
"CORNER"
l

<replace> Boolean True to replace original object; False to create new object.
<items> Array Structured array containing object to expand:
Array("NAME:elements",
"<Name of Object to Expand>")

Return Value None.

Python Syntax ExpandWithPorts (<expansion>, <join>, <replace>, <items>)


Python Example oEditor.ExpandWithPorts("2mm", "ROUND", True, ["NAME:elements", "circle_0"])

VB Syntax ExpandWithPorts <expansion>, <join>, <replace>, <items>


VB Example oEditor.ExpandWithPorts "2mm", "ROUND", true, Array("NAME:elements", "poly_0")

FlipHorizontal (Layout Editor)


Use: Causes horizontal flipping of one or more specified objects (mirroring about a vertical axis given its X coordinate).
Syntax: FlipHorizontal <object_name_list>,//objects to be flipped <position_or_center> // (X of flip_axis / not used)
VB Example:
oEditor.FlipHorizontal Array("NAME:elements", "circle_0", "rect_2"),
Array(0.01, -0.001)

Layout Scripting 30-37


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

FlipVertical (Layout Editor)


Use: Causes vertical flipping of one or more specified objects (mirroring about a horizontal axis given its Y coordinate).
Syntax: FlipVertical <object_name_list>, //objects to be flipped <position_or_center> // not used, flip axis
VB Example: oEditor.FlipVertical Array("NAME:elements", "circle_0", "rect_2"), Array(0.01, -
0.001)

Move(Layout Editor)
Use: Translate this Polygon by the vector specified in the provided Point. Return this Polygon.
Syntax: oPolygon.Move(<oPoint>)
Return Value: This Polygon object.
VB Example: oPolygon = oPolygon.Move(oLayout.Point().Set(1,1))

Paste (Layout Editor)


Use: Pastes the objects currently in clipboard; the argument specifies the offset of the new (copy) object(s) from their initial position(s).
Syntax: Paste Array("NAME:offset",
"xy:=",
Array(double, double)) // X/Y offset
VB Example: oEditor.Paste Array("NAME:offset", "xy:=", Array(0.034, 0.013))

Layout Scripting 30-38


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Rotate (Layout Editor)


Use: Rotate this Polygon counter clockwise (CCW) about a center specified by the provided Point. Angle is in radians. Return this
Polygon.
Syntax: oPolygon.Rotate(<AngRad>, <oPoint>)
Return Value: This Polygon object.
VB Example: oPolygon = oPolygon.Rotate(pi/2, oLayout.Point())

Activation and Deactivation Methods


The following activation/deactivation methods are available.
Activate <object_names>
DeactivateOpen <object_names>
DeactivateShort <object_names>
Delete (Layout Editior)

Activate (Layout Editor)


Use: Causes activation of one or more components.
Syntax: Activate Array("NAME:components",
<object_name>, // 1st component name

<object_name>, // 2nd component, if any

…) // etc
VB Example:

Layout Scripting 30-39


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.Activate Array("NAME:components", "2", "3")

DeactivateOpen (Layout Editor)


Use: Causes deactivation of one or more components to open circuit state.
Syntax: ActivateOpen Array ("NAME:components",
<object_name>, // 1st component name

<object_name>, // 2nd component, if any

…) // etc
VB Example:
oEditor.DeactivateShort Array("NAME:components", "2", "3")

DeactivateShort (Layout Editor)


Use: Causes deactivation of one or more components to short circuit state.
Syntax: ActivateShort Array("NAME:components",
<object_name>, // 1st component name

<object_name>, // 2nd component, if any

…) // etc
VB Example:
oEditor.DeactivateShort Array("NAME:components", "2", "3")

Layout Scripting 30-40


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Delete (Layout Editor)


Use: Deletes one or more objects.
Syntax: Delete <object_name_list>// names of the objects to be deleted
<object_name_list>:
Array ("NAME:elements", <object_name>, <object_name>, …)
VB Example:
oEditor.Delete Array("NAME:elements", "circle_0", "rect_2")

Layout and Geometry Interrogation Methods


From the Layout scripting object, the following methods are available for layout and geometry interrogation.
The topics for this section include:
Layout Interrogation
Point Object
Polygon Object
Layout Interrogation (Layout Editor)
Methods employing Point and Polygon objects are specified in SI units (e.g. meters).
The following methods are available.
Point (Layout Editor)
Polygon (Layout Editor)
FindObjects (Layout Editor
FilterObjectList (Layout Editor)

Layout Scripting 30-41


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetCSObjects (Layout Editor)


GetPolygon (Layout Editor)
GetPolygonDef (Layout Editor)
GetBBox (Layout Editor)
FindObjectsByPolygon (Layout Editor)
FindObjectsByPoint (Layout Editor)
CreateObjectFromPolygon (Layout Editor)
CreateLineFromPolygon (Layout Editor)
Point (Layout Editor)
Use:Create and return a Point Object.
Syntax:oLayout.Point()
Return Value:Point object.
VB Example:oPoint = oLayout.Point()

Polygon (Layout Editor)


Use: Create and return a Polygon Object.
Syntax: oLayout.Polygon()
Return Value: Polygon object.
VB Example: oPolygon = oLayout.Polygon()

Layout Scripting 30-42


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

FindObjects (Layout Editor)


Returns a list of object names using a key/value pair.

UI Access N/A.

Name Type Description


<key> String One of:
l "Name" to search by object name.
l "Type" to search by object type.

Valid <value> strings for this type include: 'pin', 'via', 'rect', 'arc', 'line',
'poly', 'plg', 'circle void', 'line void', 'rect void', 'poly void', 'plg void', 'text',
'cell', 'Measurement', 'Port', 'Port Instance', 'Port Instance Port', 'Edge
Parameters Port', 'component', 'CS', 'S3D', 'ViaGroup'

l "Layer" to search by layer.

An asterisk ('*') in the <value> string matches all layers. Vias and pins
match using their defined layer range. 'Multi' matches (non via/pin)
multi-layer objects.

"Net" to search by net assignment.


l

<value> String Specific query. Queries use a basic string match. For instance, an asterisk ('*')
matches anything. All matching is case insensitive.

Return Value List of object names.

Python Syntax FindObjects (<key>, <value>)

Layout Scripting 30-43


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Example oLayout.FindObjects('Type','Via')

VB Syntax FindObjects <key>, <value>


VB Example Set vias = oLayout.FindObjects "Type", "Via"

FilterObjectList (Layout Editor)


Filters a list of object names using a key/value pair. See: FindObjects.

UI Access N/A.

Name Type Description


<key> String One of:
l "Name" to search by object name.
l "Type" to search by object type.

Valid <value> strings for this type include: 'pin', 'via', 'rect', 'arc', 'line',
'poly', 'plg', 'circle void', 'line void', 'rect void', 'poly void', 'plg void', 'text',
Parameters
'cell', 'Measurement', 'Port', 'Port Instance', 'Port Instance Port', 'Edge
Port', 'component', 'CS', 'S3D', 'ViaGroup'

l "Layer" to search by layer.

An asterisk ('*') in the <value> string matches all layers. Vias and pins
match using their defined layer range. 'Multi' matches (non via/pin)
multi-layer objects.

Layout Scripting 30-44


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Net" to search by net assignment.


l

<value> String Specific query. Queries use a basic string match. For instance, an asterisk ('*')
matches anything. All matching is case insensitive.

Return Value Filtered list of object names.

Python FilterObjectList (<key>, <value>)


Syntax

Python RFIN_pins = oLayout.FilterObjectList('Type', 'Pin', oLayout.FindObjects('Net','RFIN'))


Example

VB Syntax FilterObjectList <key>, <value>


Set objectlist = oEditor.FindObjects("Net", "RFIN")
VB Example
Set RFIN_pins = oEditor.FilterObjectList("Type", "Pin", objectlist)

GetCSObjects (Layout Editor)


Use: Given a coordinate system name, returns a list of the objects inside. Coordinate system names can be found using FindObjects
('Type', 'CS'). See Find Objects.
Syntax: oLayout.GetCSObjects(<CS_name>)
Return Value: List of objects in the coordinate system.
VB Example: CS_objects = oLayout.GetCSObjects("CS_1")
GetPolygon (Layout Editor)
Use: Get a Polygon Object for the specified object name, or None if the object does not exist. Returned polygon is as rendered, in SI
units

Layout Scripting 30-45


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax: oLayout.GetPolygon(<Name>)
Return Value: Polygon object.
VB Example: oPolygon = oLayout.GetPolygon('line_37')

GetPolygonDef (Layout Editor)


Use: Get a Polygon Object for the specified object name, or None if the object does not exist. Returned polygon is as rendered, in SI
units. For trace types, this corresponds to the center line.
Syntax: oLayout.GetPolygonDef(<Name>)
Return Value: Polygon object.
VB Example: oPolygon = oLayout.GetPolygonDef('line_37')

GetBBox (Layout Editor)


Use: Get a Polygon Object defining the bounding box for the specified object name, or None if the object does not exist.
Syntax: oLayout.GetBBox(<Name>)
Return Value: Polygon object.
VB Example: oPolygon = oLayout.GetBBox('rect_10')

FindObjectsByPolygon (Layout Editor)


Use: Get a list of all objects intersecting the specified Polygon object on the given layer.
Syntax: oLayout.FindObjectsByPolygon(<oPolygopn>, <Layer>)
Return Value: Object list.

Layout Scripting 30-46


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example:
# Find all objects intersecting box = {(0,0), (1e-3,1e-3)}
p0 = oLayout.Point().Set(0, 0)
p1 = oLayout.Point().Set(1e-3, 0)
p2 = oLayout.Point().Set(1e-3, 1e-3)
p3 = oLayout.Point().Set(0, 1e-3)
box = oLayout.Polyon().AddPoint(p0).AddPoint(p1).AddPoint(p2).AddPoint(p3).SetClosed(True)
objs = oLayout.FindObjectsByPolygon(box, '*')

FindObjectsByPoint (Layout Editor)


Use: Get a list of all objects intersected by the specified Point object on a given layer.
Syntax: oLayout.FindObjectsByPoint(<oPoint>, <Layer>)
Return Value: Object list.
VB Example:
objs = oLayout.FindObjectsByPoint(oLayout.Point().Set(-1.149e-3, 3.465e-3), 'L3')

CreateObjectFromPolygon (Layout Editor)


Use: Create a polygon on the specified layer and net from the provided Polygon object. Return the name of the new object. Net is
optional.
Syntax: oLayout.CreateObjectFromPolygon(<oPolygon>, <Layer>, <Net>)
Return Value: Object name.
VB Example:

Layout Scripting 30-47


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

newobj = oLayout.CreateObjectFromPolygon(oPolygon, 'L1', 'GND')

CreateLineFromPolygon (Layout Editor)


Use: Create a line/trace object on the specified layer and net from the provided Polygon object. Net is optional.
Syntax: oLayout.CreateLineFromPolygon(<oPolygon>, <width>, <bendType>, <startCapType>, <endCapType>, <Layer>, <Net>)
Parameters: width - line width, in meters
bendType - {'corner', 'round'}
startCapType, endCapType - {'flat', 'extended', 'round'}
VB Example:
newobj = oLayout.CreateLineFromPolygon(oPolygon, 0.1e-3, 'round', 'flat', 'round', 'L1', 'DQ0')

Point Object (Layout Editor)


The Point object provides a point container in a 2D Cartesian coordinate system. Point objects have no link to specific Layout prim-
itives. All values and interfaces are specified in meters.
A Layout object is used to create a Point as:
oPoint = oLayout.Point()
The following methods are available.
Set
SetX
GetX

Layout Scripting 30-48


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetY
GetY
SetArc
IsArc
IsEqual
Mag
Distance
Cross
Move
Rotate
Normalize
DistanceFromLine
ClosestPointOnLine
Set (Layout Editor)
Use: Set both the x and y -coordinates of the Point, in meters. Return this Point.
Syntax: oPoint.Set(<x>, <y>)
Return Value: This Point object.
VB Example: oPoint = oPoint.Set(1e-3, 1e-3)

SetX (Layout Editor)


Use: Set the x-coordinate of the Point, in meters. Return this Point.

Layout Scripting 30-49


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax: oPoint.SetX(<x>)
Return Value: This Point object.
VB Example: oPoint = oPoint.SetX(1e-3)

GetX (Layout Editor)

Use:Get the x-coordinate of the Point, in meters.


Syntax:oPoint.GetX()
Return Value:X-coordinate.
VB Example:x = oPoint.GetX()

SetY (Layout Editor)


Use: Set the y-coordinate of the Point, in meters. Return this Point.
Syntax: oPoint.SetY(<y>)
Return Value: This Point object.
VB Example: oPoint = oPoint.SetY(1e-3)

GetY (Layout Editor)


Use: Get the y-coordinate of the Point, in meters.
Syntax: oPoint.GetY()

Layout Scripting 30-50


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value: Y-coordinate.


VB Example: y = oPoint.GetY()

SetArc (Layout Editor)


Use:Set whether the given point is an arc. For arc-points, the x-coordinate is used to specify signed height. Return this Point.
Syntax:oPoint.SetArc(<isArc>)
Return Value:This Point object.
VB Example:oPoint = oPoint.SetArc(True)

IsArc (Layout Editor)


Use: Check whether this Polygon is defined by an arc-segment.
Syntax: oPolygon.IsArc()
VB Example: isArc = oPolygon.IsArc()

IsEqual (Layout Editor)


Use: Test whether this point is equal to another. If tolerance is not specified, a default 1e-9 is used.
Syntax: oPoint.IsEqual(<oPoint>, [<Tolerance>])
VB Example:
isEqual1 = oPointThis.IsEqual(oPointOther)
isEqual2 = oPointThis.IsEqual(oPointOther, 1e-6)

Layout Scripting 30-51


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Mag (Layout Editor)


Use:Get the magnitude of the given Point
Syntax:oPoint.Mag()
VB Example:mag = oPoint.Mag()

Distance (Layout Editor)


Use: Get the distance from this point to another.
Syntax: oPointThis.Distance(oPointOther)
VB Example: dist = oPointThis.Distance(oPointOther)

Cross (Layout Editor)


Use: Get the cross product of this point with another. In 2D, this is simply the determinant of [x1 x2; y1 y2].
Syntax: oPointThis.Cross(oPointOther)
VB Example: cross = oPointThis.Cross(oPointOther)

Move(Layout Editor)
Use: Translate this Polygon by the vector specified in the provided Point. Return this Polygon.
Syntax: oPolygon.Move(<oPoint>)
Return Value: This Polygon object.
VB Example: oPolygon = oPolygon.Move(oLayout.Point().Set(1,1))

Layout Scripting 30-52


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Rotate (Layout Editor)


Use: Rotate this Polygon counter clockwise (CCW) about a center specified by the provided Point. Angle is in radians. Return this
Polygon.
Syntax: oPolygon.Rotate(<AngRad>, <oPoint>)
Return Value: This Polygon object.
VB Example: oPolygon = oPolygon.Rotate(pi/2, oLayout.Point())

Normalize (Layout Editor)


Use: Normalize this point. Return this point.
Syntax: oPoint.Normalize()
Return Value: This Point object.
VB Example: oPoint = oPoint.Normalize()

DistanceFromLine (Layout Editor)


Use: Get the distance from this point to a line defined by two additional points.
Syntax: oPoint.DistanceFromLine(<oPoint>,<oPoint>)
VB Example: dist = oPoint.DistanceFromLine(oLayout.Point().Set(0,0), oLayout.Point().Set(1,0))

ClosestPointOnLine (Layout Editor)


Use: Get the closest point to this on a line defined by the two input points.
Syntax: oPoint.ClosestPointOnLine(<oPoint>, <oPoint>)

Layout Scripting 30-53


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value: The closest point, as a Point Object.


VB Example: oPointClosest = oPoint.ClosestPointOnLine(oLayout.Point().Set(0,0), oLayout.Point
().Set(1,0))

Polygon Object (Layout Editor)


The Polygon object provides a polygon container in a 2D Cartesian coordinate system. Objects have no link to specific Layout prim-
itives. All values and interfaces are specified in meters.
A Layout object can be used to create an empty, and open, Polygon as:
oPolygon = oLayout.Polygon()
The following methods are available.
AddPoint
SetClosed
IsClosed
Move
Rotate
Scale
MirrorX
GetPoints
AddHole
HasHoles
GetHoles

Layout Scripting 30-54


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

HasArcs
HasSelfIntersections
BBoxLL
BBoxUR
IsParametric
IsConvex
IsPoint
IsSegment
IsArc
IsBox
IsCircle
GetBoundingCircleCenter
GetBoundingCircleRadius
Area
PointInPolygon
CircleIntersectsPolygon
GetIntersectionType
GetClosestPoint
GetClosestPoints
Unite
Intersect

Layout Scripting 30-55


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Subtract
Xor

AddPoint (Layout Editor)


Command: Add a point to the polygon. Return this Polygon.
Syntax: oPolygon.AddPoint(<oPoint>)
Return Value: This Polygon object.
VB Example: oPolygon=oPolygon.AddPoint(oLayout.Point().Set(0,1))

SetClosed (Layout Editor)


Use: Set whether a polygon is open or closed. Return this Polygon.
Syntax: oPolygon.SetClosed(isClosed)
Return Value: This Polygon object.
VB Example: oPolygon = oPolygon.SetClosed(True)

IsClosed (Layout Editor)


Use: Get whether a polygon is open or closed.
Syntax: oPolygon.IsClosed()
VB Example: isClosed = oPolygon.IsClosed()

Layout Scripting 30-56


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Move(Layout Editor)
Use: Translate this Polygon by the vector specified in the provided Point. Return this Polygon.
Syntax: oPolygon.Move(<oPoint>)
Return Value: This Polygon object.
VB Example: oPolygon = oPolygon.Move(oLayout.Point().Set(1,1))

Rotate (Layout Editor)


Use: Rotate this Polygon counter clockwise (CCW) about a center specified by the provided Point. Angle is in radians. Return this
Polygon.
Syntax: oPolygon.Rotate(<AngRad>, <oPoint>)
Return Value: This Polygon object.
VB Example: oPolygon = oPolygon.Rotate(pi/2, oLayout.Point())

Scale (Layout Editor)


Scales the polygon by the specified factor.

UI Access N/A.

Name Type Description


Parameters <factor> Integer Scaling factor.
<centerPoint> Object Any oPoint object. See: Point Object.

Return Value Polygon object.

Layout Scripting 30-57


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax Scale(<factor>, <centerPoint>)


Python Example oPolygon.Scale(2, oPoint)

VB Syntax Scale <factor>, <centerPoint>


VB Example oPolygon.Scale 2, oPoint

MirrorX (Layout Editor)


Use: Mirror this Polygon about the line defined by the provided X-coordinate. Return this Polygon.
Syntax: oPolygon.MirrorX(x-coord)
Return Value: This Polygon object.
VB Example: oPolygon = oPolygon.MirrorX(0.0)

GetPoints (Layout Editor)


Use: Get a list of Point objects defining this Polygon.
Syntax: oPolygon.GetPoints()
Return Value: List of Point objects.
VB Example: ptList = oPolygon.GetPoints()

AddHole (Layout Editor)


Use: Add a hole to a Polygon. The hole is defined by the input Polygon object. Return this Polygon.

Layout Scripting 30-58


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax: oPolygon.AddHole(oPolygon)
Return Value: This Polygon object.
VB Example: oPolygon = oPolygon.AddHole(oPolygonHole)

HasHoles (Layout Editor)


Use: Get whether a Polygon has holes.
Syntax: oPolygon.HasHoles()
VB Example: HasHoles = oPolygon.HasHoles()

GetHoles (Layout Editor)


Use: Get a list of holes owned by this Polygon.
Syntax: oPolygon.GetHoles()
Return Value: List of holes as Polygon objects.
VB Example: HoleList = oPolygon.GetHoles()

HasArcs (Layout Editor)


Use: Get whether this Polygon has any arc-segments.
Syntax: oPolygon.HasArcs()
VB Example: HasArcs = oPolygon.HasArcs()

Layout Scripting 30-59


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

HasSelfIntersections (Layout Editor)


Use: Check whether this Polygon has any self-intersections. Default tolerance is 1e-9, or it may be explicitly provided.
Syntax: oPolygon.HasSelfIntersections(<tolerance>)
VB Example: hasSelfInt1 = oPolygon.HasSelfIntersections() # default tol=1e-9
hasSelfInt2 = oPolygon.HasSelfIntersections(1e-6)

BBoxLL (Layout Editor)


Use: Get the lower-left point for the bounding-box region of this Polygon.
Syntax: oPolygon.BBoxLL()
Return Value: A Point object defining the lower-left coordinate.
VB Example: oPoint = oPolygon.BBoxLL()
BBoxUR (Layout Editor)
Use: Get the upper-right point for the bounding-box region of this Polygon.
Syntax: oPolygon.BBoxUR()
Return Value: A Point object defining the upper-right coordinate.
VB Example: oPoint = oPolygon.BBoxUR()

IsParametric (Layout Editor)


Use: Check whether this Polygon is defined parametrically.
Syntax: oPolygon.IsParametric()

Layout Scripting 30-60


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example: isParametric = oPolygon.IsParametric()

IsConvex (Layout Editor)


Use: Check whether this Polygon is convex.
Syntax: oPolygon.IsConvex()
VB Example: isConvex = oPolygon.IsConvex()

IsPoint (Layout Editor)


Use: Check whether this Polygon is defined by a point.
Syntax: oPolygon.IsPoint()
VB Example: isPt = oPolygon.IsPoint()

IsSegment (Layout Editor)


Use: Check whether this Polygon is defined by a segment.
Syntax: oPolygon.IsSegment
VB Example: isSeg = oPolygon.IsSegment

IsArc (Layout Editor)


Use: Check whether this Polygon is defined by an arc-segment.
Syntax: oPolygon.IsArc()
VB Example: isArc = oPolygon.IsArc()

Layout Scripting 30-61


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

IsBox (Layout Editor)


Use: Check whether this Polygon defines a box.
Syntax: oPolygon.IsBox()
VB Example: isBox = oPolygon.IsBox()

IsCircle (Layout Editor)


Use: Check whether this Polygon defines a circle.
Syntax: oPolygon.IsCircle()
VB Example: isCircle = oPolygon.IsCircle()

GetBoundingCircleCenter (Layout Editor)


Use: Get a Point defining the center of a bounding circle for this Polygon.
Syntax: oPolygon.GetBoundingCircleCenter()
Return Value: A Point object defining the bounding circle’s center coordinate.
VB Example: oPoint = oPolygon.GetBoundingCircleCenter()

GetBoundingCircleRadius (Layout Editor)


Use: Get the radius of a bounding circle for this Polygon.
Syntax: oPolygon.GetBoundingCircleRadius()

Layout Scripting 30-62


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value: The bouding circle’s radius.


VB Example: rad = oPolygon.GetBoundingCircleRadius()

Area (Layout Editor)


Use: Get the area of the Polygon, in square meters.
Syntax: oPolygon.Area()
VB Example: area = oPolygon.Area()

PointInPolygon (Layout Editor)


Use: Test whether the provided Point is in this Polygon. Points on the Polygon's boundary are considered in the Polygon.
Syntax: oPolygon.PointInPolygon(<oPoint>)
VB Example: hit = oPolygon.PointInPolygon(oPoint)

CircleIntersectsPolygon (Layout Editor)


Use: Test whether the circle defined by the input Point and radius hit this Polygon. Circles tangent to the Polygon's boundary are con-
sidered intersecting.
Syntax: oPolygon.CircleIntersectsPolygon(<oPointCenter>, <radius>)
VB Example: hit = oPolygon.CircleIntersectsPolygon(oPointCenter, 1e-3)

GetIntersectionType (Layout Editor)


Use: Get the intersection type of this Polygon with another. A tolerance can be optionally specified, or the default 1e-9 will be used.
Syntax: oPolygon.GetIntersectionType(<oPolygon>)

Layout Scripting 30-63


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value: Integer:


0 - No intersection
1 - This fully inside other
2 - Other fully inside this
3 - Common contour points
4 - Undefined intersection
VB Example: typ1 = oPolygon.GetIntersectionType(oPolygonOther) # default tol=1e-9
typ2 = oPolygon.GetIntersectionType(oPolygonOther, 1e-6)

GetClosestPoint (Layout Editor)


Use: Find the closest Point on this Polygon's boundary to the Point provided.
Syntax: oPolygon.GetClosestPoint(<oPoint>)
Return Value: A Point object defining the closest location on this Polygon’s boundary.
VB Example: oPointClosest = oPolygon.GetClosestPoint(oLayout.Point().Set(1.0,0))

GetClosestPoints (Layout Editor)


Use: Given another Polygon, find the closest Points on each. The closest Point on this Polygon is returned as the first Point in the list.
The closest Point on the other Polygon is returned as the last (or second) Point in the list.
Syntax: oPolygon.GetClosestPoints(oPolygon)
Return Value: A list of Point objects.
VB Example: closestPointList = oPolygon.GetClosestPoints(oPolygonOther)

Layout Scripting 30-64


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Unite (Layout Editor)


Use: Causes Boolean uniting of 2 or more primitive (polygons, rectangles, lines, or circles) objects.
Syntax: Unite Array ("NAME: primitives",
<object_name>, // 1st primitive name

<object_name>, // 2nd primitive, if any

…) // etc
VB Example:
oEditor.Unite Array("NAME:primitives", "circle_0", "rect_2")

Intersect (Layout Editor)


Use: Causes Boolean intersecting of 2 or more primitive (polygons, rectangles, lines, or circles) objects.
Syntax: Intersect Array ("NAME: primitives",
<object_name>, // 1st primitive name

<object_name>, // 2nd primitive, if any

…) // etc
VB Example:
oEditor.Intersect Array("NAME:primitives", "circle_0", "rect_2")

Subtract (Layout Editor)


Use: Causes boolean subtracting of one or more primitive (polygons, rectangles, lines, or circles) object(s) from another one.

Layout Scripting 30-65


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax: Subtract Array ("NAME: primitives",


<object_name>, // Primitive to subtract from
<object_name>, // 1nd primitive to subtract, if any

…) // etc
VB Example:
oEditor.Intersect Subtract ("NAME:primitives", "circle_0", "rect_2")

Xor (Layout Editor)


Use: Exclusive or (XOR) this Polygon with another and return as a list of Polygons.
Syntax: oPolygon.Xor(oPolygon)
Return Value: Xor as a list of Polygon objects.
VB Example:
resList = oPolygon.Xor(oPolygonOther)

Boolean Operations on Primitives


The following boolean operations on primitives are available.
Unite
Intersect
Subtract
Unite (Layout Editor)
Use: Causes Boolean uniting of 2 or more primitive (polygons, rectangles, lines, or circles) objects.

Layout Scripting 30-66


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax: Unite Array ("NAME: primitives",


<object_name>, // 1st primitive name

<object_name>, // 2nd primitive, if any

…) // etc
VB Example:
oEditor.Unite Array("NAME:primitives", "circle_0", "rect_2")

Intersect (Layout Editor)


Use: Causes Boolean intersecting of 2 or more primitive (polygons, rectangles, lines, or circles) objects.
Syntax: Intersect Array ("NAME: primitives",
<object_name>, // 1st primitive name

<object_name>, // 2nd primitive, if any

…) // etc
VB Example:
oEditor.Intersect Array("NAME:primitives", "circle_0", "rect_2")

Subtract (Layout Editor)


Use: Causes boolean subtracting of one or more primitive (polygons, rectangles, lines, or circles) object(s) from another one.
Syntax: Subtract Array ("NAME: primitives",
<object_name>, // Primitive to subtract from
<object_name>, // 1nd primitive to subtract, if any

Layout Scripting 30-67


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

…) // etc
VB Example:
oEditor.Intersect Subtract ("NAME:primitives", "circle_0", "rect_2")

Coordinate System Methods


The following scripts are availabe for use with the Designer Coordinate System.
CreateCS (Layout Editor)
ClearRelative (Layout Editor)
Create3DStructure (Layout Editor)
Group (Layout Editor)
CreateGroupSelected (Layout Editor)
PositionRelative (Layout Editor)
GetCSObjects (Layout Editor)
SetCS (Layout Editor)

CreateCS (Layout Editor)


Use: Inserts a new coordinate system (CS) into the currently active Layout design.
Command: Draw > Coordinate System > Create.
Syntax: There are two forms available:

Layout Scripting 30-68


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CreateCS
Array("NAME:Contents",
Array("NAME:full_definition", "type:=", "CS", "N:=", <"CS name">),
"placement:=", Array("x:=", <"x_coord">, "y:=", <"y_coord">),
"Clf:=", <color flag>, "Col:=", <color> )

CreateCS
Array("NAME:Contents",
"Name:=", <"CS name">),
"RelPos:=", Array(edge description))

Return Value: Text containing the name of the created relative coordinate system.
Parameters: <"CS name">
Text with the requested name for the relative coordinate system

<x_coord>
Text that is the X location for the relative coordinate system origin

<y_coord>
Text that is the Y location for the relative coordinate system origin

Layout Scripting 30-69


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

// the following arguments are optional

<color flag>
True if a color is being specified by the next parameter

<color>
Integer specifying the color for the relative coordinate system.
Only used if color flag is true;

<edge description> for primitive edges

"t:=", "pe", "from:=", <"prim">, "pos:=", <edge position>, "et:=", "pe", "prim:=",
<"prim">, "edge:=", <edge#>

<"prim">: text that is the primitive name

<edge position>
double between 0 and 1, inclusive
0 indicates the start of the edge
1 indicates the end of the edge

Layout Scripting 30-70


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

values in between are positions along the edge

<edge#>: integer that is the edge number on the primitive

<edge description> for via edges

"t:=", "pe", "from:=", <"via">, "pos:=", <edge position>, "et:=", "pse", "sel:=", <"via">, "lay-
er:=", <layer id>, "sx:=", <start X location>, "sy:=", <start Y location>, "ex:=", <end X loc-
ation>, "ey:=", <end Y location>,
"h:=", <arc height>, "rad:=", <radians>

<"via">:
text that is the name of the via to use

<layer id>:
an integer that is the id of the layer of the pad of the via to use <start X location>,

<start Y Location>:
doubles that are the X, Y location of the start point of the edge arc <end X location>, <end Y Location>:
doubles that are the X, Y location of the end point of the edge arc

<arc height>:

Layout Scripting 30-71


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

double giving the height of the edge arc (0 for a straight edge)
<radians>:
double giving the arc size in radians (0 for a straight edge)

VB Example: oEditor.CreateCS Array("NAME:Contents", Array("NAME:full_definition",


"type:=", "CS", "N:=", "CS_232"), "placement:=", Array("x:=", "-15mm", "y:=",
"15mm"), "Clf:=", false, "Col:=", 8421504)

oEditor.CreateCS Array("NAME:Contents", "Name:=", "CS_15", "RelPos:=",


Array("t:=", "pe", "from:=", "poly_1", "pos:=", 0, "et:=", "pe", "prim:=", "poly_1",
"edge:=", 1))

oEditor.CreateCS Array("NAME:Contents", "Name:=", "CS_196", "RelPos:=",


Array("t:=", "pe", "from:=", "via_0", "pos:=", 0, "et:=", "pse", "sel:=", "via_0",
"layer:=", 10, "sx:=", -0.0015, "sy:=", -0.0015, "ex:=", 0.0015, "ey:=", -0.0015,
"h:=", 0, "rad:=", 0))

ClearRelative (Layout Editor)


Use: Clear the relative positioning between a coordinate system (CS) and another object.
Command: None.

Layout Scripting 30-72


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax: oEditor.ClearRelative Array("NAME:elements", <CS1>, <CS2>, …)


Return Value: None.
VB Example: oEditor.ClearRelative Array("NAME:elements", "CS_13")
Create3DStructure (Layout Editor)
Use: Place a set of primitives into a 3D structure coordinate system (i.e. a 3D via or cross-layer plate).
Command: None.
Syntax: oEditor.Create3DStructure <3D structure name>, Array("NAME:elements", <element1>, <element2>, …)
Return Value: None.
VB Example: oEditor.Create3DStructure "S3D_11", Array("NAME:elements", "circle_10", "circle_9")
Group (Layout Editor)
Use: Groups a set of primitives into a coordinate system.
Command: None.
Syntax: oEditor.Group <CS name>, Array("NAME:elements", <element1>, <element2>, …)
Return Value: None.
VB Example: oEditor.Group "CS_7", Array("NAME:elements", "rect_4", "rect_6")
CreateGroupSelected (Layout Editor)
Use: Groups a set of primitives into a subdesign.
Command: Layout > Group into Subdesign
Syntax: oEditor.CreateGroupSelected Array("NAME:elements", <selectable name>, …)
Return Value: None.
VB Example: oEditor.CreateGroupSelected Array("NAME:elements", "1", "2", "3", "4", "5", "6")

Layout Scripting 30-73


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

PositionRelative (Layout Editor)


Use: Position a coordinate system (CS), including 3D structures and components, relative to another object.
Command: Draw > Position Relative
Syntax: There are two forms available:

PositionRelative
Array("NAME:Contents",
"RelPos:=", Array(<edge description>)),
Array("NAME:elements", <coordinate system name>, < coordinate system name >, …)

PositionRelative Array("NAME:Contents",
"RelPos:=", Array("t:=", "pr", "from:=", <edge port or pin name>)),
Array("NAME:elements", <coordinate system name>, <coordinate system name>, …)

Return Value: None.


Parameters:
Array("NAME:elements", "CS_23")

<edge description> for primitive edges

Layout Scripting 30-74


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"t:=", "pe", "from:=", <"prim">, "pos:=", <edge position>, "et:=", "pe", "prim:=", <"prim">, "edge:=", <edge#>

<"prim">: text that is the primitive name

<edge position>
double between 0 and 1, inclusive
0 indicates the start of the edge
1 indicates the end of the edge
values in between are positions along the edge

<edge#>: integer that is the edge number on the primitive

<edge description> for via edges

"t:=", "pe", "from:=", <"via">, "pos:=", <edge position>, "et:=", "pse",


"sel:=", <"via">, "layer:=", <layer id>, "sx:=", <start X location>,
"sy:=", <start Y location>, "ex:=", <end X location>, "ey:=",
<end Y location>, "h:=", <arc height>, "rad:=", <radians>

<"via">: text that is the name of the via to use


<layer id>: an integer that is the id of the layer of the pad of the via to use

Layout Scripting 30-75


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<start X location>, <start Y Location>:


doubles that are the X, Y location of the start point of the edge arc
<end X location>, <end Y Location>:
doubles that are the X, Y location of the end point of the edge arc

<arc height>: double giving the height of the edge arc (0 for a straight edge)
<radians>: double giving the arc size in radians (0 for a straight edge)

< coordinate system name >


Text that contains the name of the coordinate system

<edge port or pin name>


Text that contains the name of the edge port or via
VB Example:
oEditor.PositionRelative Array("NAME:Contents", "RelPos:=", Array("t:=", "pe",
"from:=", "poly_0", "pos:=", 0, "et:=", "pe", "prim:=", "poly_0", "edge:=", 3)),
Array("NAME:elements", "CS_23")

oEditor.PositionRelative Array("NAME:Contents", "RelPos:=", Array("t:=", "pe",

Layout Scripting 30-76


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"from:=", "via_0", "pos:=", 0, "et:=", "pse", "sel:=", "via_0", "layer:=", 10, "sx:=",
0.0015, "sy:=", 0.0015, "ex:=", -0.0015, "ey:=", 0.0015, "h:=", 0, "rad:=", 0)),
Array("NAME:elements", "CS_201")

GetCSObjects (Layout Editor)


Use: Given a coordinate system name, returns a list of the objects inside. Coordinate system names can be found using FindObjects
('Type', 'CS'). See Find Objects.
Syntax: oLayout.GetCSObjects(<CS_name>)
Return Value: List of objects in the coordinate system.
VB Example: CS_objects = oLayout.GetCSObjects("CS_1")
SetCS (Layout Editor)
Use: Activate a coordinate system (CS).
Command: None.
Syntax: oEditor.SetCS <CS name or blank>
Return Value: None.
VB Example: oEditor.SetCS "CS_7" // activate CS_7
oEditor.SetCS "" // activate the ‘global CS’, i.e. no CS is active
Ungroup (Layout Editor)
Use: Reverses a group operation; deletes a coordinate system but leaves the primitives.
Command: None.
Syntax: oEditor.Ungroup Array("NAME:elements", <CS1>, <CS2>, …)
Return Value: None.

Layout Scripting 30-77


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example: oEditor.Ungroup Array("NAME:elements", "CS_7")

Layers Methods
The following methods are available to manipulate layers:
l AddLayer (Layout Editor)
l AddStackupLayer (Layout Editor)
l ChangeLayers (Layout Editor)
l ClearLayerMappings (Layout Editor)
l CreateBoardBend
l DuplicateAcrossLyrs (Layout Editor)
l GetAllLayerNames (Layout Editor)
l GetLayerInfo (Layout Editor)
l GetStackupLayerNames (Layout Editor)
l ProcessBentModelCmd
l RemoveLayer (Layout Editor)
l SetLayerMapping (Layout Editor)
l SyncRigidFlexSandbox

ClearLayerMappings (Layout Editor)


Use: Clear layer mappings.

Layout Scripting 30-78


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Command: None.
Syntax: ClearLayerMappings <component name>
Return Value: None.
Parameters: <component name> is a string that specifies the name of the component.
VB Example: oEditor.ClearLayerMappings "2"

CreateBoardBend (Layout Editor)


Creates a rigid-flex bend in a non-fixed zone in a design.

UI Access None

Name Type Description


<Contents> Array Structured Array containing:
Array("Name:contents",
"board bendGeometry:=", "<boardbendGeometry>")
<boardbendGeometry> Array Structural Array containing:
"Name:=", <string bend name>,

Parameters "LayerName:=", "Outline",


"lw:=", "<line width value>",
"PrimName:=", <string primary zone name>,
"Definition:=", <DefinitionArray>) // see below
<Definition> Array Structured Array containing:
"Id:=", "<bend .edb ID number>",
"Poly:=", <poly>, // see below

Layout Scripting 30-79


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Radius:=", "<value and unit of measure>",


"Angle:=", " <value and unit of measure>",
"ZonePrimId:=", <integer primary zone .edb
ID number>,
"BendIndex:=", // Integer used to determine pre-
cedence of bends. If bends overlap, the bend with the
higher index will be inactive.
<Poly> Array Structured Array containing:
"U:=" <string unit of measurement>,
"x:=", <value>,
"y:=", <value>,
"x:=", <value>,
"y:=", <value>,

Return Value None.

Python Syntax CreateBoardBend(<Contents>,<boardbendGeometry>)


oEditor.CreateBoardBend
[
Python Example "NAME:Contents",
"board bendGeometry:=" , [ "Name:=" , "board bend_example", "LayerName:=" , "Out-
line", "lw:=" , "0", "PrimName:=" , "Zone1", "Definition:=" , [ "Id:=" , 12,

Layout Scripting 30-80


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Poly:=" , [ "U:=" , "cm", "x:=" , 3.75, "y:=" , 0.25, "x:=" , 3.70467214069287,


"y:=" , 0], "Radius:=" , "124mil", "Angle:=" , "90deg", "ZonePrimId:=" , 9]]
])

VB Syntax CreateBoardBend<Contents>,<boardbendGeometry>
oEditor.CreateBoardBend
Array("NAME:Contents",
"board bendGeometry:=" , Array( "Name:=" , "board bend_example", "LayerName:=" ,
"Outline", "lw:=" , "0", "PrimName:=" , "Zone1" , "Definition:=" , Array("Id:=" ,
VB Example 12, "Poly:=" , Array( "U:=" , "cm", "x:=" , 3.75, "y:=" , 0.25, "x:=" ,
3.70467214069287, "y:=" , 0), "Radius:=" , "124mil", "Angle:=" , "90deg",
"ZonePrimId:=" , 9)
)

DuplicateAcrossLyrs (Layout Editor)


Use: Duplicate selected objects (layout and footprint) to other layers.
Command: Draw > Duplicate > Across Layers
Syntax: DuplicateAcrossLyrs Array("NAME:elements", "element-name",…), Array("NAME:layers", "layer-name",…)
Return Value: None
Parameters: <element-name> // The name of the element to be duplicated.
<layer-name> // The name of the layer to duplicate elements to.

Layout Scripting 30-81


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example: oEditor.DuplicateAcrossLyrs Array("NAME:elements", "poly_550"), Array("NAME:layers",


"Top")

GetAllLayerNames (Layout Editor)


Use: Informational.
Command: None.
Syntax: GetAllLayerNames
Return Value: Array of strings which are the names of all layers in the layout, blackbox, or footprint.
VB Example: None
GetLayerInfo (Layout Editor)
Retrieves information on a specified layer in the Layout editor.

UI Access None

Name Type Description


Parameters
<LayerName> String Name of the layer

An array of strings, as follows:


l Type: type of name
l TopBottomAssociation: "Top"|"Neither"|"Bottom"|"Template"|"Invalid"
Return Value
l Color: integer [representing rgb in hex]
l IsVisible: "true"|"false". This is true if any these types of objects are visible:
l IsVisibleShape: "true"|"false"[for stackup layer only]

Layout Scripting 30-82


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l IsVisiblePath: "true"|"false"[for stackup layer only]


l IsVisiblePad: "true"|"false"[for stackup layer only]
l IsVisibleHole: "true"|"false"[for stackup layer only]
l IsVisibleComponent: "true"|"false"[for stackup layer only]
l IsLocked: "true"|"false"
l LayerId: integer [the ID for the layer]

The following are also in the array if the layer is a stackup layer:
l Index: integer [the stackup order index]
l LayerThickness: double [total layer thickness, in meters]
l EtchFactor: double [This will not appear if the layer has no etch factor defined.]
l IsIgnored: "true"|"false"
l NumberOfSublayers: 1 [This is always 1.]
l Material0: material name
l FillMaterial0: material name
l Thickness0: expression with units
l LowerElevation0: expression with units
l If roughness is defined, some or all of the following appear:
l Roughness0Type: Groiss | Huray
l Roughness0: value and units or surface ratio value for Huray
l BottomRoughness0 Type: Groiss | Huray
l BottomRoughness0: value and units or surface ratio value for Huray
l SideRoughness0 Type: Groiss | Huray

Layout Scripting 30-83


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l SideRoughness0: value and units or surface ratio value for Huray

For example:
['Type: signal', 'TopBottomAssociation: Neither', 'Color: 32512d', 'IsVisible:
true', ' IsVisibleShape: true', ' IsVisiblePath: true', ' IsVisiblePad: true', '
IsVisibleHole: true', ' IsVisibleComponent: true', 'IsLocked: false', 'LayerId:
7', 'Index: 0', 'LayerThickness: 0', 'IsIgnored: false', 'NumberOfSublayers: 1',
'Material0: copper', 'FillMaterial0: FR4_epoxy', 'Thickness0: 0mil', 'Lower-
Elevation0: 62mil', 'Roughness0 Type: Huray', 'Roughness0: 0mil, 2.9', 'Bot-
tomRoughness0 Type: Huray', 'BottomRoughness0: 0mil, 2.9', 'SideRoughness0 Type:
Huray', 'SideRoughness0: 0mil, 2.9']

Python Syntax GetLayerInfo(<layer_name>)


oEditor = oDesign.SetActiveEditor("Layout")
Python Example
oEditor.GetLayerInfo("TopLayer")

VB Syntax GetLayerInfo <layer_name>


Set oModule = oDesign.GetModule("Layout")
VB Example
oModule.GetLayerInfo "TopLayer"

GetStackupLayerNames (Layout Editor)


Use: Informational.
Command: None.

Layout Scripting 30-84


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax: GetStackupLayerNames
Return Value: array of strings which are the names of all layers in the layout, blackbox, or footprint.
Parameters: None

ProcessBentModelCmd (Layout Editor)


Processes and generates a model for a design with one or more rigid-flex bends.

UI Access None

Parameters None.

Return Value None.

Python Syntax ProcessBentModelCmd


Python Example

VB Syntax ExportNetlist <solution> <fileName>


VB Example oEditor.ProcessBentModelCmd

RemoveLayer (Layout Editor)


Use: Removes a layer or stackup layer.
Command: Remove Layer from a layout or footprint definition
Syntax: RemoveLayer (<LayerName>)
Return Value: None.

Layout Scripting 30-85


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters: <LayerName>
Type: <String>
VB Example: oEditor.RemoveLayer ("T3 C1 sub")
oDefinitionEditor.RemoveLayer("Top3 Footprint")

Note As with other Layout scripting interface commands that modifiy the layout, this command is not intended for use within scripts
that define footprints. The command behavior from within such a script is undefined and may be unexpected. Use the LayoutHost
scripting interface commands within scripts that define footprints.
SetLayerMapping (Layout Editor)
Use: Set layer mapping.
Command: None.
Syntax: SetLayerMapping <component name>, <design layer>, <footprint layer>
Return Value: None.
Parameters: <component name> is a string that specifies the name of the component
<design layer> is a string that specifies the name of the design layer
<footprint layer> is a string that specifies the name of the footprint layer
VB Example: oEditor.SetLayerMapping "2", "Bottom Signal", "Top"

Net and NetClass Methods


The following net and net class primitives are available:

Layout Scripting 30-86


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l CreateNetClass
l DeleteNets
l DelNetClass
l GetNetClasses
l GetNetClassNets
l GetNetConnections
l HighlightNet
l ModifyNetClass
l SetNetVisible

CreateNetClass
Use:Create a new net class into a layout.
Command:CreateNetClass.
Syntax:CreateNetClass (<name> <description> <nets name list>)
Return Value:None
VB Example:oEditor.CreateNetClass "power", "power nets", Array("A_D2D_VDD_0", "A_D2D_VDD_1", "A_
D2D_VSS_0")

DeleteNets
Removes specified nets from the project.

UI Access None.

Layout Scripting 30-87


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


Parameters
<netName> String Name of unwanted net.

Return Value None.

Python Syntax DeleteNets ([<netName>, ...])


oEditor.DeleteNets(
[
"NET_1",
Python Example
"NET_2",
"NET_3"
])

VB Syntax DeleteNets Array (<netName>, ...)


oEditor.DeleteNets Array("NET_1")
VB Example
oEditor.DeleteNets Array("NET_2", "NET_3", "NET_4")

DelNetClass
Use:Delete a net class in a layout.
Command:DelNetClass

Layout Scripting 30-88


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax:DelNetClass (<names>)
Return Value:None
VB Example:oEditor.DelNetClass Array ("power")

GetNetClasses
Use:Gets all the net classes in a layout.
Command:GetNetClasses
Syntax:GetNetClasses ()
Return Value:None
VB Example:oEditor. GetNetClasses

GetNetClassNets
Use:Gets the list of nets in a net class.
Command:GetNetClassNets
Syntax:GetNetClassNets (<name>)
Return Value:None
VB Example:oEditor. GetNetClassNets Array ("power")

GetNetConnections (Layout Editor)


Use: Informational.

Layout Scripting 30-89


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Command: None.
Syntax: GetNetConnections(<netName>)
Return Value: Array of strings containing the connections for the net identified by the
netName argument. The strings in the array are in one of four formats:
"ComponentPin compID pinname x y EdgePort"
"ComponentPin compID pinname x y PinPadstack: padstackName"
"InterfacePort portname portID x y Padstack: padstackName"
"EdgePort portname portID EdgeInfo: Primitive id, edge index[Primitive id, edge index]"
where compID is the component instance identifier, pinname is the name of
the connected pin, x and y are the connection point, padstackName is the name of the
padstack, portname is the name of the port, portID is the identifier for the interface
port, and id and index identify edges involved in an edgeport.
Parameters: <netName>
Type: String
The name of the net.
VB Example: netArray = oEditor.GetNetConnections("net_1")

HighlightNet (Layout Editor)


Highlights or removes the highlight from all elements in a net.

UI Access None.

Layout Scripting 30-90


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<requiredPara- String Required first parameter which must have the value
meterKeyword> "Name:Args".
<requiredNetKeyword> String Required second parameter which must have the value
"Name:=". Must be the first parameter for each net.
Parameters
<netName> String Name of the net.
<requiredFlagKeyword> String Required fourth parameter which must have the value
"Hi:=". Must be the third parameter for each net.
<highlightFlag> Boolean True if the net should be highlighted. False if it should
not.

Return Value None.

Python Syntax HighlightNet (["Name:Args", "Name:=", " <netName>", "Hi:=", <highlightFlag>, ...])
oEditor.HighlightNet(
[
"NAME:Args",
Python Example
"Name:=", "net_0",
"Hi:=", True
])

VB Syntax HighlightNet Array("Name:Args", "Name:=", " <netName>", "Hi:=", <highlightFlag>, ...)


Set oDesign = oProject.SetActiveDesign("HFSS3D1")
VB Example
Set oEditor = oDesign.SetActiveEditor("Layout")

Layout Scripting 30-91


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.HighlightNet Array("NAME:Args", "Name:=", "net_0", "Hi:=", false)

ModifyNetClass
Use:Modify an existing net class in a layout.
Command:ModifyNetClass
Syntax:ModifyNetClass (<name> <new name> <new description> <new nets name list>)
Return Value:None
VB Example:oEditor.ModifyNetClass "power", "power", "new power nets", Array("A_D2D_VDD_0", "A_
D2D_VDD_1", "A_D2D_VSS_0", "VDD_DIG_0", "VDD_DIG_1")

SetNetVisible [HFSS 3D Layout]


Shows and highlights or hides specified nets in the Layout Editor. Multiple nets can be highlighted or hidden at once.

On the Nets tab of the Nets window, highlight and right click on one or more nets. Click Hide or any of the Show
UI Access
options.

Name Type Description


<requiredPara- String Required first parameter which must have the value
meterKeyword> "Name:Args".
<requiredNameKeyword> String Required second parameter which must have the value
"Name:=". Must be the first parameter for each net.
Parameters
<netName> String Name of the net
<requiredFlagKeyword> String Required fourth parameter which must have the value
"Vis:=". Must be the third parameter for each net.
<visibilityFlag> Boolean True if the net should be visible. False if it should be hid-
den.

Layout Scripting 30-92


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax SetNetVisible (["Name:Args", "Name:=", "<netName>", "Vis:=", <highlightFlag>, ...])


oEditor.SetNetVisible(
[
"NAME:Args",
"Name:=", "Net_1",
"Vis:=", True
])
oEditor.SetNetVisible(
[
Python Example
"NAME:Args",
"Name:=", "<NO-NET>",
"Vis:=", False,
"Name:=", "Ground",
"Vis:=", False,
"Name:=", "Chassis",
"Vis:=", True
])

Layout Scripting 30-93


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB SetNetVisible Array ("Name:Args", "Name:=", "<netName>", "Vis:=", <visibilityFlag>, ...)


Syn-
tax

VB
oEditor.SetNetVisible Array("NAME:Args","Name:=","NET_1","Vis:=", true)
Exa- oEditor.SetNetVisible Array("NAME:Args", "Name:=", "<NO-NET>", "Vis:=", false, "Name:=",
mple "Ground", "Vis:=", false, "Name:=", "Chassis", "Vis:=", true)

Port Methods
The following port methods are available:
l AddCircuitRefPort
l AddPortsToAllNets
l AddPortsToNets
l AddRefPort
l AlignPorts
l AssignCircuitRefPort
l AssignRefPort
l ClearRefPort
l CreateCircuitPort
l CreateEdgePort
l CreateNPort
l CreatePortInstancePorts

Layout Scripting 30-94


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l CreatePortsOnComponents
l GetPortInfo
l RemovePortsFromAllNets
l RemovePortsFromNet
l RemovePortsOnComponents

AddCircuitRefPort (Layout Editor)


Use: Assign an edge as a reference to an existing port; model as a circuit port.
Command: AddCircuitRefPort
Syntax: AddCircuitRefPort
Array(<"port name">, <"port name">, ...),
Array("NAME:Contents",
"edge:=", Array(<edge description>), "edge:=, Array(<edge description>), ...)
Return Value: None.
Parameters: <edge description> for primitive edges

"et:=", "pe", "prim:=", <"prim">, "edge:=", <edge#>

<"prim">:
text that is the primitive name

<edge#>:

Layout Scripting 30-95


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

integer that is the edge number on the primitive

<edge description>:
for via edges

"et:=", "pse", "sel:=", <"via">, "layer:=", <layer id>,


"sx:=", <start X location>, "sy:=", <start Y location>, "ex:=", <end X location>,
"ey:=", <end Y location>, "h:=", <arc height>, "rad:=", <radians>

<"via">:
text that is the name of the via to use
<layer id>:
an integer that is the id of the layer of the pad of the via to use

<start X location>, <start Y Location>:


doubles that are the X, Y location of the start point of the edge arc
<end X location>, <end Y Location>:
doubles that are the X, Y location of the end point of the edge arc
<arc height>:
double giving the height of the edge arc (0 for a straight edge)

Layout Scripting 30-96


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<radians>:
double giving the arc size in radians (0 for a straight edge)

VB Example: oEditor.AddCircuitRefPort Array("Port3"), Array("NAME:Contents", "edge:=", _


Array("et:=", "pe", "prim:=", "rect_2", "edge:=", 1))

AddPortsToAllNets (Layout Editor)


Use: Adds ports to all the pins in all the nets.
Command: Layout tab under Nets right-click and click Create Ports.
Syntax: AddPortsToAllNets
Return Value: None
Parameters: None.
VB Example:
oEditor. AddPortsToAllNets
AddPortsToNet (Layout Editor)
Use: Add ports to all the pins on the designated nets.
Command: In Layout right-click and click Port > Create Ports on Net.
Layout tab under Nets, right-click and click Create Ports.
Syntax: AddPortsToNet Array("NAME:Nets", "net-name", …)
Return Value: None
Parameters: net-name the name of a net; all pins on this particular net receive ports.

Layout Scripting 30-97


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example:
oEditor.AddPortsToNet Array("NAME:Nets", "CB1", "CB5")
AddRefPort (Layout Editor)
Use: Create a reference port from edges and associate with each of the named ports.
Command: (When more than 2 edges are selected.)
Draw > Port > Create
Right-click > Port > Create
Also available through toolbar icon.
Syntax: AddRefPort
Array(<"port name">, <"port name">, ...),
Array("NAME:Contents",
"edge:=", Array(<edge description>), "edge:=, Array(<edge description>), ...)
Return Value: None.
Parameters: <edge description> for primitive edges

"et:=", "pe", "prim:=", <"prim">, "edge:=", <edge#>

<"prim">:
text that is the primitive name

Layout Scripting 30-98


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<edge#>:
integer that is the edge number on the primitive

<edge description>
for via edges

"et:=", "pse", "sel:=", <"via">, "layer:=", <layer id>,


"sx:=", <start X location>, "sy:=", <start Y location>, "ex:=", <end X location>,
"ey:=", <end Y location>, "h:=", <arc height>, "rad:=", <radians>

<"via">:
text that is the name of the via to use
<layer id>:
an integer that is the id of the layer of the pad of the via to use

<start X location>, <start Y Location>:


doubles that are the X, Y location of the start point of the edge arc
<end X location>, <end Y Location>:
doubles that are the X, Y location of the end point of the edge arc

<arc height>:

Layout Scripting 30-99


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

double giving the height of the edge arc (0 for a straight edge)
<radians>:
double giving the arc size in radians (0 for a straight edge)
VB Example: oEditor.AddRefPort Array("Port3"), Array("NAME:Contents", "edge:=",
Array("et:=", "pe", "prim:=", "line_998", "edge:=", 0))
oEditor.AddRefPort Array("Port1"), Array("NAME:Contents", "edge:=",
Array("et:=", "pse", "sel:=", "via_5", "layer:=", 10, "sx:=", 0.0015, "sy:=", 0.0015,
"ex:=", -0.0015, "ey:=", 0.0015, "h:=", 0, "rad:=", 0))

AlignPorts (Layout Editor)


Use: Causes automatic alignment of the microwave ports of the components, EdgePorts, and Pins referenced in the argument. In
case the list is empty, aligns ALL the microwave ports in the layout.
Command: None.
Syntax: AlignPorts Array ("NAME: elements",
<object_name>, // 1st object

<object_name>, // 2nd object, if any

…) // etc
Return Value: None.
Parameters: The LayoutComp's ID
VB Example: oEditor.Paste Array ("NAME:elements", "1", "2")
oEditor.Paste Array ("NAME:elements")

Layout Scripting 30-100


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AssignCircuitRefPort (Layout Editor)


Use: Assign the internal port as a reference to an existing port; model as a circuit port.
Command: AssignCircuitRefPort
Syntax: AssignCircuitRefPort
Array(<"port name">, <"port name">, ...),
Array("NAME:Contents",
"edge:=", Array(<edge description>), "edge:=, Array(<edge description>), ...)
Return Value: None
Parameters: <"layer">
Type: text
Description: layer name.

<"port">
Type: text
Description: a port or pin name.

<edge description> for primitive edges


"et:=", "pe", "prim:=", <"prim">, "edge:=", <edge#>

<"prim">
Type: text

Layout Scripting 30-101


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Description: primitive name

<edge#>
Type: integer
Description: edge number on the primitive

<edge description> for via edges


"et:=", "pse", "sel:=", <"via">, "layer:=", <layer id>,
"sx:=", <start X location>, "sy:=", <start Y location>, "ex:=", <end X location>,
"ey:=", <end Y location>, "h:=", <arc height>, "rad:=", <radians>

<"via">:
text that is the name of the via to use
<layer id>:
an integer that is the id of the layer of the pad of the via to use
<start X location>, <start Y Location>:
doubles that are the X, Y location of the start point of the edge arc
<end X location>, <end Y Location>:
doubles that are the X, Y location of the end point of the edge arc
<arc height>:

Layout Scripting 30-102


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

double giving the height of the edge arc (0 for a straight edge)
<radians>:
double giving the arc size in radians (0 for a straight edge)
VB Example: oEditor.AssignCircuitRefPort Array("pin_1"), "pin_2"

AssignRefPort (Layout Editor)


Use: Assign the named internal port as a reference for each of the named ports.
Command: AssignRefPort
Syntax: AssignRefPort
Array(<"port name">, <"port name">, ...),
Array("NAME:Contents",
"edge:=", Array(<edge description>), "edge:=, Array(<edge description>), ...)
Return Value: None
Parameters: <"layer">
Type: text
Description: layer name.

<"port">
Type: text
Description: a port or pin name.

Layout Scripting 30-103


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<edge description>
for primitive edges
"et:=", "pe", "prim:=", <"prim">, "edge:=", <edge#>

<"prim">
Type: text
Description: primitive name

<edge#>
Type: integer
Description: edge number on the primitive

<edge description>
for via edges
"et:=", "pse", "sel:=", <"via">, "layer:=", <layer id>,
"sx:=", <start X location>, "sy:=", <start Y location>, "ex:=", <end X location>,
"ey:=", <end Y location>, "h:=", <arc height>, "rad:=", <radians>

<"via">:
text that is the name of the via to use

Layout Scripting 30-104


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<layer id>:
an integer that is the id of the layer of the pad of the via to use

<start X location>, <start Y Location>:


doubles that are the X, Y location of the start point of the edge arc

<end X location>, <end Y Location>:


doubles that are the X, Y location of the end point of the edge arc

<arc height>:
double giving the height of the edge arc (0 for a straight edge)

<radians>:
double giving the arc size in radians (0 for a straight edge)

VB Example: oEditor.AssignRefPort Array("pin_1"), "pin_2"

ClearRefPort (Layout Editor)


Use: Clear references (or referencing) ports from each of the named ports.
Command: Draw > Clear reference Port

Layout Scripting 30-105


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax: ClearRefPort Array("Port1", …)


Return Value: None.
VB Example: oEditor.ClearRefPort Array("Port1", …)

CreateCircuitPort (Layout Editor)


Use: Create a circuit port between two points.
Command: Draw > Create Circuit Ports
Syntax: CreateCircuitPort Array("NAME:Location", "PosLayer:=", "layer name", "X0:=", _
x-value, "Y0:=", y-value, "NegLayer:=", "layer name", "X1:=", x-value, "Y1:=", y-value)
Return Value: None
Parameters: <"layer">
Type: text
Description: layer name.

<"port">
Type: text
Description: a port or pin name.

<edge description>
for primitive edges

Layout Scripting 30-106


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"et:=", "pe", "prim:=", <"prim">, "edge:=", <edge#>

<"prim">
Type: text
Description: primitive name

<edge#>
Type: integer
Description: edge number on the primitive

<edge description>
for via edges

"et:=", "pse", "sel:=", <"via">, "layer:=", <layer id>,


"sx:=", <start X location>, "sy:=", <start Y location>, "ex:=", <end X location>,
"ey:=", <end Y location>, "h:=", <arc height>, "rad:=", <radians>

<"via">:
text that is the name of the via to use
<layer id>:
an integer that is the id of the layer of the pad of the via to use

Layout Scripting 30-107


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<start X location>, <start Y Location>:


doubles that are the X, Y location of the start point of the edge arc

<end X location>, <end Y Location>:


doubles that are the X, Y location of the end point of the edge arc

<arc height>:
double giving the height of the edge arc (0 for a straight edge)
<radians>:
double giving the arc size in radians (0 for a straight edge)

VB Example: oEditor.CreateCircuitPort Array("NAME:Location", "PosLayer:=", "Top", "X0:=", _


-0.003, "Y0:=", 0.003, "NegLayer:=", "Top", "X1:=", 0.002, "Y1:=", 0.003)

CreateEdgePort (Layout Editor)


Use: Creates an edge port using the specified edges.
Command: Draw > Port > Create
Right-click > Port > Create
Also available through Tool Bar icon

Layout Scripting 30-108


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax: CreateEdgePort
Array("NAME:Contents",
"edge:=", Array(<edge description>), "edge:=, Array(<edge description>), ...
"external:=", <flag>)
Return Value: Text containing the name of the created edge port. (Returns an empty name if the edge port is not created.)
Parameters: <edge description> for primitive edges
"et:=", "pe", "prim:=", <"prim">, "edge:=", <edge#>

<"prim">: text that is the primitive name

<edge#>: integer that is the edge number on the primitive

<edge description>
for via edges

"et:=", "pse", "sel:=", <"via">, "layer:=", <layer id>,


"sx:=", <start X location>, "sy:=", <start Y location>, "ex:=", <end X location>,
"ey:=", <end Y location>, "h:=", <arc height>, "rad:=", <radians>

<"via">: text that is the name of the via to use


<layer id>:

Layout Scripting 30-109


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

an integer that is the id of the layer of the pad of the via to use

<start X location>, <start Y Location>:


doubles that are the X, Y location of the start point of the edge arc
<end X location>, <end Y Location>:
doubles that are the X, Y location of the end point of the edge arc

<arc height>:
double giving the height of the edge arc (0 for a straight edge)
<radians>:
double giving the arc size in radians (0 for a straight edge)
<flag>
true if the port is an external port
false if the port is an internal port
VB Example: oEditor.CreateEdgePort Array("NAME:Contents", "edge:=", Array("et:=", "pe",
"prim:=", "rect_167", "edge:=", 0), "edge:=", Array("et:=", "pe", "prim:=",
"rect_167", "edge:=", 3), "external:=", true)

oEditor.CreateEdgePort Array("NAME:Contents", "edge:=", Array("et:=", "pse",


"sel:=", "via_0", "layer:=", 10, "sx:=", -0.0015, "sy:=", -0.0015, "ex:=", 0.0015,

Layout Scripting 30-110


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ey:=", -0.0015, "h:=", 0, "rad:=", 0), "external:=", true)

CreateNPort (Layout Editor)


Use: Creates an N-Port definition and component and adds them to the current project, layout, and schematic.
Syntax: CreateNPort<Array>
Return Value: Returns the name of the newly created component.
Parameters: Array("NAME:Contents",
"definition_name:=",<nport_definition_name>,
"placement:=", <component_placement>,
"layer:=", <placement_layer_name>,
<nport_data_definition>)

<nport_definition_name>:
quoted string (name of the component definition)

<component_placement>:
Array("x:=", <value>, // x coordinate
"y:=", <value>, // y coordinate
"scaling:=", <value>) // double

<nport_data_definition> – see the I/O format in TODO

Layout Scripting 30-111


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example: oEditor.CreateNPort
Array("NAME:Contents",
"definition_name:=", "NetworkData3",
"placement:=",
Array("x:=", "-9mm",
"y:=", "-5mm",
"scaling:=", "2"),
"layer:=", "Symbols",
Array("NAME:NPortData",
Array("NAME:NetworkData2",
"filelocation:=", "UsePath",
"filename:=", "",
"domain:=", "frequency",
"numberofports:=", 2,
"datamode:=", "Import",
"devicename:=", "", "
ImpedanceTab:=", 1,
"NoiseDataTab:=", 1,
"DCBehaviorTab:=", 1,

Layout Scripting 30-112


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SolutionName:=", "",
"dcbehavior:=", "DCOpen",
"displayformat:=", "MagnitudePhase",
"datatype:=", "SMatrix",
"interptype:=", "Linear",
"extraptype:=", "Same as interpolation",
"ShowRefPin:=", 0,
"RefNodeCheckbox:=", 1)))

CreatePortInstancePorts (Layout Editor)


Use: Create port on port instances.
Command: Right-Click-Menu > Port > Create
Syntax: CreatePortInstancePorts Array("NAME:elements", "element-name",…)
Return Value: None
Parameters: <element-name>
Type: string
// Name of a port instance on which ports will be created.
VB Example:
oEditor.CreatePortInstancePorts Array("NAME:elements", "0:106")
CreatePortsOnComponents (Layout Editor)
Use: Create port on port instances of selected components.

Layout Scripting 30-113


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Command: Right-Click-Menu > Port > Create Ports on Component


Syntax: CreatePortsOnComponentsArray("NAME:elements", "element-name",…)
Return Value: None
Parameters: <element-name>
Type: string
// Name of a component.
// Ports are created on the unconnected port instances of the selected components.
VB Example:
oEditor.CreatePortsOnComponents Array("NAME:elements", "0")
GetPortInfo (Layout Editor)
Use: Request information on a port or pin.
Command: None.
Syntax: GetPortInfo<"name">
Return Value: an array of text as follows:
For pins and ports that are not edge ports:
Name=<name>
Type=Pin, Padstack: <padstack definition name>
X=<X coordinate>
Y=<Y coordinate>
ConnectionPoints=<connection description>; <connection description>,...

Layout Scripting 30-114


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

NetName=<net name>

For edge ports:


Name=<name>
Type=EdgePort
X=<X coordinate>
Y=<Y coordinate>
ConnectionPoints=<connection description>; <connection description>,...
NetName=<net name>

<name>
Text containing the name of the pin or port

<padstack definition name>


Text containing the name of the associated padstack definition

<X coordinate>
Double indicating the X location of the pin or port location

<Y coordinate>
Double indicating the Y location of the pin or port location

<connection description>
< X coordinate> <Y coordinate> Dir:<direction> Layer: <layer name>

Layout Scripting 30-115


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<direction>
Either NONE or a double giving the angle in degrees for the connection direction

<layer name>
Name of the layer for the connection point being described.

Example returned values:

Name=Pin1
Type=Pin, Padstack: Padstack
X=0.000744
Y=0.015537
ConnectionPoints= 0.000744 0.015537 Dir:NONE Layer: Top; 0.000744 0.015537
Dir:NONE Layer: Ground; 0.000744 0.015537 Dir:NONE Layer: Bottom
NetName=Pin1

Name=Port1
Type=EdgePort
X=-0.008120
Y=0.004264
ConnectionPoints= -0.008120 0.004264 Dir:90.000000 Layer: Bottom
NetName=Port1

Layout Scripting 30-116


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters: <"name">
Text that contains the name of the port or pin for which information is being requested.
VB Example:
Dim conns
conns = oEditor.GetPortInfo("Port1")

RemovePortsFromAllNets (Layout Editor)


Use: Removes ports from all the pins in all the nets.
Command: Layout tab under Nets right-click and click Remove Ports.
Syntax: RemovePortsFromAllNets
Return Value: None
Parameters: None.
VB Example: oEditor.RemovePortsFromAllNets
RemovePortsFromNet (Layout Editor)
Removes ports from all the pins on the designated nets.

In the Layout window, right click the net and click Port > Remove Ports from Net or on the Nets tab of the
UI Access
Nets window, highlight and right click one or more nets and choose Remove Ports.

Name Type Description


< String Required parameter that must proceed all element names with
Parameters requiredKeyword> the value "NAME:Nets".
<netName> String Name of a net. Ports are removed from the port instances of the
selected nets.

Layout Scripting 30-117


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax RemovePortsFromNet(["NAME:Nets", <netName>, ...])


oEditor.RemovePortsFromNet(
[
"NAME:Nets",
Python Example "NET_1",
"NET_2",
"NET_3"
])

VB Syntax RemovePortsFromNet Array("NAME:Nets", <netName>, ...)


VB Example oEditor.RemovePortsFromNet Array("NAME:Nets", "NET_1", "NET_2", "NET_3")

RemovePortsOnComponents (Layout Editor)


Remove ports on port instances of selected components. Multiple nets can be listed.

UI Access Right click and choose Port > Remove Ports From Component.

Name Type Description


Parameters
< String Required parameter that must proceed all element names with

Layout Scripting 30-118


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

requiredKeyword> the value "NAME:elements".


<elementName> String Name of a component. Ports are removed from the port instances
of the selected components.

Return Value None.

Python Syntax RemovePortsOnComponents (["NAME:elements", <elementName>,...])


oEditor.RemovePortsOnComponents(
[
Python Example "NAME:elements",
"0"
])

VB Syntax RemovePortsOnComponents Array("NAME:elements", " <element-name>",…)


VB Example oEditor.RemovePortsOnComponents Array("NAME:elements", "0")

Miscellaneous Methods
The following miscellaneous methods are available.
l AlignObjects (Layout Editor)
l ChangeOptions (Layout Editor)
l ClipPlane (Layout Editor)
l CopyToHFSS 3D Layout (Layout Editor)

Layout Scripting 30-119


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l CutOutSubDesign (Layout Editor)


l DefeatureObjects (Layout Editor)
l Duplicate (Layout Editor)
l Edit3DComponentDefinition (Layout Editor)
l EraseMeasurements (Layout Editor)
l ExportDXF (Layout Editor)
l ExportGDSII (Layout Editor)
l ExportGerber (Layout Editor)
l ExportNCDrill (Layout Editor)
l GetComponentInfo (Layout Editor)
l GetCompInstanceFromRefDes (Layout Editor)
l GetComponentPins (Layout Editor)
l GetComponentPinInfo (Layout Editor)
l GetEditorName (Layout Editor)
l GetMaterialList (Layout Editor)
l GetProperties (Layout Editor)
l GetPropertyValue (Layout Editor)
l GetSelections (Layout Editor)
l Heal (Layout Editor)
l PageSetup (Layout Editor)
l PushExcitations (Layout Editor)
l SelectAll (Layout Editor)

Layout Scripting 30-120


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l SetPropertyValue (Layout Editor)


l StitchLines (Layout Editor)
l UnselectAll (Layout Editor)
l ZoomToFit (Layout Editor)

AlignObjects (Layout Editor)


Use: Align objects, e.g. primitives, relative to each other.
Command: AlignObjects
Syntax: AlignObjects
Array("NAME:align", <"alignment">, …),
Array("NAME:elements", <"elem">, …)
Return Value: Return Value: None
Parameters: <"alignment">
Type: text
Description: any one of:
"AlignLeft"
"AlignRight"
"CenterHorz" - align centers horizontally
"DistributeCentersHorz" - distribute object centers evenly horizontally
"SpaceEdgesHorz" - space objects equal distances apart horizontally
"AlignTop"
"AlignBottom"
"CenterVert" - align centers vertically

Layout Scripting 30-121


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"DistributeCentersVert" - distribute object centers evenly vertically


"SpaceEdgesVert" - space objects equal distances apart vertically
"elem">
Type: text
Description: name of element (primitive, component, etc.) to align
Example:
Set oDesign = oProject.SetActiveDesign("HFSS 3D Layout1")
Set oEditor = oDesign.SetActiveEditor("Layout")
oEditor.AlignObjects Array("NAME:align", "AlignLeft"), Array("NAME:elements", "circle_2", "rect_
1", "poly_3")

ChangeOptions (Layout Editor)


Use: Changes options for an existing layout. (Does not change global options specified in the registry.) Only those options being
changed need to be specified. Options not specified are not affected.
Command: None.
Syntax: ChangeOptions Array("NAME:options",<OptionData>,…)
Return Value: None
Parameters: <OptionData> can be of varying forms:
Type: <String>
Type: integer
Type: Array(float, float, float, float)

Layout Scripting 30-122


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example: oEditor.ChangeOptions Array("NAME:options", _


"MajorSize:=", "20", _
"MinorSize:=", "1", "MajorColor:=", 8421376, _
"MinorColor:=", 16776960, _
"ShowGrid:=", false, "PageExtent:=", _
Array( -0.3, -0.1, 0.1, 0.1), _
"background color:=", 4194368, _
"DefaultToSketchMode:=", true, _
"fillMode:=", false, "PixelSnapTolerance:=", 22, _
"SnapTargetVertex_on:=", _
false, "SnapTargetEdgeCenter_on:=", false, _
"SnapTargetObjCenter_on:=", _
true, "SnapTargetEdge_on:=", true, _
"SnapTargetElecConnection_on:=", true, _
"SnapTargetIntersection_on:=", true, _
"SnapTargetGrid_on:=", false, _
"SnapSourceVertex_on:=", false, _
"SnapSourceEdgeCenter_on:=", false, _
"SnapSourceObjCenter_on:=", true, _
"SnapSourceEdge_on:=", true, _
"SnapSourceElecConnection_on:=", true, _

Layout Scripting 30-123


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ConstrainToGrid:=", false _
"defaultholesize:=", "5mil", _
"show connection points:=", true, _
"display vertex labels:=", true, _
"NetColor:=", 8421440, _
"rectangle description:=", 1, "snaptoport:=", false, _
"sym footprint scaling:=", _
0.385, "primary selection color:=", 32768, _
"secondary selection color:=", _
22784, "preview selection:=", true, "anglesnap:=", _
"59deg", "AllowDragOnFirstClick:=", true, _
"useFixedDrawingResolution:=", true, _
"DrawingResolution:=", "0.002mm", "Tol:=", _
Array(3E-009, 1.5E-008, 1E-012))

Note:

An error will be returned if this script command is not used at the top-level hierarchy.

l Global layout defaults are stored in the registry (Layout\Preferences\)


l Names of registry items were chosen for backwards compatibility and are consistent with adsn, technology file, and scripting
naming

Layout Scripting 30-124


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l Local options are both script-able and undo-able


l Global options are neither script-able nor undo-able

Option Description Installed default Registry, Scripting Names,


Data Type
Arc Drawing Controls drawing of segments for Dynamic "useFixedDrawingResolution"1
Resolution arcs - either dynamic and based
on current zoom or fixed to spe- "DrawingResolution" 2
cified value
Major and Spacing, color, and visibility The grid is displayed. Spacing based on current "MajorColor" 3
Minor Grid default length units. Major grid lines are 10 minor
lines grid lines apart. The line colors are light blue "MinorColor" 3
grays, with major grid lines being darker.
"MajorSize" 2

"MinorSize" 2

"ShowGrid" 1
Drawing Specifies size and coordinates of Lower left of the layout is (-0.1, -0.1) and the "PageExtent" 4
Extent the layout upper right is (0.1, 0.1)
Background Color of the layout background white "background color" 3
color
Sketch Mode Fill patterns and center lines are off "DefaultToSketchMode" 1
not drawn.
Solid Mode Objects are filled in with solid off "fillMode" 1
color.
Draw Con- Display pin symbols in the layout. off "show connection points" 1
nection
Points
Draw Rats Display lines indicating missing on "draw rats" 1
physical connections in nets

Layout Scripting 30-125


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Label Ver- Display property text labeling the off "display vertex labels" 1
tices vertices of selected polygons and
lines.
Net Color Color used for highlighting nets light yellow "NetColor" 3
Rectangle Specifies if rectangles are 2 points "rectangle description" 5
Description described with two points or cen-
ter point, width, and height
Default Hole Default size for actual holes in a 25 mil "defaultholesize" 2
Size PC board
Align Snaps components on entry. on "snaptoport" 1
Microwave
Components
Symbol Foot- Used to size symbol footprints Based on data extent and current length units. "sym footprint scaling" 6
print Scaling placed in layout.
Primary and Colors used to indicate the first Primary color is red, secondary color is a darker "primary selectioncolor" 3
Secondary item selected and other items cur- red
Selection Col- rently selected. "secondary selection color" 3
ors
Preview Highlight the object that would be off "preview selection" 1
Selection selected with a left mouse button
click in the current location.
Snapping Choose snapping sources and Snap distance is 20 pixels. Snapping sources are "PixelSnapTolerance"7
options targets and the maximum dis- vertex, edge center, object center, & elec. conn. "SnapTargetVertex_on"1
tance (in pixels) for snapping to Snapping targets are vertex, edge center, object "SnapTargetEdgeCenter_on"1
occur. Constrain edits to grid if center, elec. conn, & grid. Edits are constrained to "SnapTargetObjCenter_on"1
desired. grid. "SnapTargetEdge_on"1
"SnapTargetElecConnection_
on"1
"SnapTargetIntersection_on"1

Layout Scripting 30-126


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note: Off-grid objects are "SnapSourceVertex_on"1


ignored if ConstrainToGrid "SnapSourceEdgeCenter_on"1
is asserted. "SnapSourceObjCenter_on"1
"SnapSourceEdge_on"1
"SnapSourceElecConnection_
on"1
"ConstrainToGrid"1
Always Show Controls display of the layer mer- off – Only show dialog when the user must be "AlwaysShowLayerMergeDlg"
Merge Lay- ging dialog. involved. 1
ers Dialog
Rotation During rotation, objects are Based on current angle units. "anglesnap" 2
Increment rotated by multiples of this
amount.
Allow Drag Selection and move with one left false "AllowDragOnFirstClick" 1
on first click mouse button click.

The footnotes in the table above correspond to the following:


1 = Integer with a value of 1 for on/true and 0 for off/false

2 = String containing a amount and units

3 = Integer representing a Color

4 = An Array containing (lower left x, lower left y, upper right x, upper right y)

5 = Integer with a value of 0 for two points, and 1 for center/width/height

6 = String holding a double.

7 = Integer

Layout Scripting 30-127


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ClipPlane
Truncates graphics at the XY-plane in the +Z direction. Clip planes can be used to truncate graphics in the Layout view, including
mesh and fields plots.

UI Access From the View menu, select Clip Plane, or from the View ribbon, select Add Clipping Plane.
Parameters None.
Return Value None.

Python Syntax ClipPlane()


oEditor = oDesign.SetActiveEditor("Layout")
Python Example Editor.ClipPlane ("n1, n2, n3, et cetera")
success = oEditor.ClipPlane("n1, n2, n3, et cetera")

VB Syntax ClipPlane
oEditor = oDesign.SetActiveEditor"Layout"
VB Example Editor.ClipPlane "n1, n2, n3, et cetera"
Set success = oEditor.ClipPlane "n1, n2, n3, et cetera"

CopyToHFSS 3D Layout (Layout Editor)


Use: Generate a single, flat, HFSS 3D Layout design from a selection of components and/or sub-circuits.

Layout Scripting 30-128


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Command: CopyToHFSS 3D Layout


Syntax: CopyToHFSS 3D Layout Array("NAME:elements", <"obj1">, <"obj2">, …)
Return Value: None
Parameters: <"obj1">
Type: text
// component or sub-circuit instance name.
Example:
Set oDesign = oProject.SetActiveDesign("Nexxim1")
Set oEditor = oDesign.SetActiveEditor("Layout")
oEditor.CopyToHFSS 3D Layout Array("NAME:elements", "1", "2", "3")

CutOutSubDesign (Layout Editor)


Use: Cut out a subdesign.
Command: CutOutSubDesign
Syntax: oEditor.CutOutSubDesign Array(
"NAME:Params",
"Name:=", <"name">,
"EMDesign:=", <boolean>,
"SubDesign:=", <boolean>,
"Within:=", <boolean>,
"Without:=", <boolean>,

Layout Scripting 30-129


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"AutoGenExtent":=<boolean>,
"Expansion":=<double>,
"RoundCorner":=<boolean>,
"Increments":=<integer>,
"ExtentSel:=", Array(<"extent-poly">, …),
Array("NAME:Nets", "net:=", Array(<"net-name">, <clip>), …))

In place of "ExtentSel:=", Array(<"extent-poly">, …) an explicit polygon can be used:


"Extent:=", Array("cl:=", true,
"pt:=", Array(U:=", <"units">, "x:=", <double>, "y:=" <double>, …))

Parameters: Name — name of the cutout design.


EMDesign — if true, create an EM design, otherwise create a Nexxim design.
Within — boolean; cut out the interior region.
Without — boolean; cut out the exterior region.
AutoGenExtent — boolean; when true, Circuit disregards both ExtentSel and Extent. Circuit will instead generate a poly-
gonal shape around all nets which are not clipped.
Expansion — double; similar to the Auto Generate Extent dialog box. However, this is always a unitless fraction. By default it
is set to .1.
RoundCorner — boolean; identical to the Auto Generate dialog box. By default this is set to true. In general, rounded
corners are preferred when the cutout shape has acute or nea-acute angles

Layout Scripting 30-130


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Increments — integer; this is from the Auto Generate Dialog, and by default is set to true. This can greatly increase the run-
ning time and a small increase can make a big difference. It is probably best to experiment with this parameter first, rather
than set it arbitrarily.
ExtentSel— an array of extent polygon names.
Extent — alternative to ExtentSel; an explicit polygon defined by coordinates.
cl — must always be true; indicates that the polygon is closed.
U — coordinate units, e.g. "mm"
pt — array of coordinate values.
x — x coordinate value
y — y coordinate value
Nets — the net information.
net — array of net information.
<"net-name">
"<no net trace>" — special value referring to traces not in a net.
"<no net fill>" — special value refereeing to fill polygons not in a net.
<design>:<net> — net within a particular design.
<net> — net within the active design.
<clip> — boolean true/false; if true, the net is clipped against the extent else the net is included but not clipped.
Return Value: None
Example: Using "extent_poly" as the selection extent:
oEditor.CutOutSubDesign Array("NAME:Params",
"Name:=", "EMDesign1_cutout",

Layout Scripting 30-131


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"EMDesign:=", true,
"SubDesign:=", false,
"Within:=", true,
"Without:=", false,
"ExtentSel:=", Array("extent_poly", …),
Array("NAME:Nets",
"net:=", Array("<no net trace>", true),
"net:=", Array("<no net fill>", true),
"net:=", Array("EMDesign1:GND", true) … ))
Example: Example using an explicit polygon as the selection extent:
oEditor.CutOutSubDesign Array("NAME:Params",
"Name:=", "EMDesign1_cutout",
"EMDesign:=", true,
"SubDesign:=", false,
"Within:=", true,
"Without:=", false,
"Extent:=", Array(
"cl:=", true,
"pt:=", Array(
"U:=", "mm",

Layout Scripting 30-132


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"x:=", 0,
"y:=" 0, ) ),
Array("NAME:Nets",
"net:=", Array("<no net trace>", true),
"net:=", Array("<no net fill>", true),
"net:=", Array("EMDesign1:GND", true) … ))
Example: That will create a cutout around first the pos and then the neg trace from the Sample
Project "Diff_Via" under Open Samples/EM/SI:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Diff_Via")
Set oDesign = oProject.SetActiveDesign("diffViaNominal")
Set oEditor = oDesign.SetActiveEditor("Layout")
oEditor.CutOutSubDesign Array("NAME:Params", "Name:=", "diffViaNominal_pos", "EMDesign:=", _
true, "SubDesign:=", false, "Within:=", true, "Without:=", false, "AutoGenExtent:=", _

Layout Scripting 30-133


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

true, "Expansion:=", 0.1, "RoundCorners:=", false, "Increments:=", 1, "ExtentSel:=", Array(),


Array("NAME:Nets", "net:=", Array( _
"diffViaNominal:neg", true), "net:=", Array("diffViaNominal:pos", false)))
oEditor.CutOutSubDesign Array("NAME:Params", "Name:=", "diffViaNominal_neg", "EMDesign:=", _
true, "SubDesign:=", false, "Within:=", true, "Without:=", false, "AutoGenExtent:=", _
true, "Expansion:=", 0.1, "RoundCorners:=", false, "Increments:=", 1, "ExtentSel:=", Array(),
Array("NAME:Nets", "net:=", Array( _
"diffViaNominal:neg", false), "net:=", Array("diffViaNominal:pos", true)))
Note that in this example, each sub design should have its own name, otherwise the results are not well defined. Also note
that the "false" after the net indicates that it will be used to build the extent outline. "True" means that the net will be included
but will be trimmed.
Defeature Objects (Layout Editor)
Use: Remove irrelevant features from a primitive. Vertices that deviate less than the tolerance from a chord are removed; narrow con-
cave regions less than the tolerance wide are also eliminated. The command can also be used to fix self-intersections (only the 'pos-
itive' areas are kept).
Command: DefeatureObjects
Syntax: DefeatureObjects Array("NAME:options", "tolerance:=", <value>, "fix:=", <fix>), Array("NAME:elements", <"primitive">, …)
Return Value: None
Parameters: <"value">
Type: double, e.g. 0.001
Description: tolerance value
<fix>

Layout Scripting 30-134


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Type: boolean (true or false)


Description: if true, then self-intersections are fixed.
< primitive >
Type: text
Description: primitive name.
Example:
Set oDesign = oProject.SetActiveDesign("HFSS 3D Layout1")
Set oEditor = oDesign.SetActiveEditor("Layout")
oEditor.DefeatureObjects Array("NAME:options", "tolerance:=", 1E-006, "fix:=", true), Array
("NAME:elements", "poly_3", "poly_4", "poly_5")
Duplicate (Layout Editor)
Use: Duplicates layout objects.
Command: The specified objects are duplicated by the given count with the specified offset.
Syntax: Duplicate Array("NAME:options", "count:=", <count data>), Array("NAME:elements", <element names>), Array( <x>, <y>)
Return Value: None
Parameters: <count data> is the number of sets of new objects to be generated (and does not
include the original objects)
<element names> is one or more strings with the names of layout objects
<x> is the x value for the offset
<y> is the y value for the offset
VB Example: oEditor.Duplicate Array("NAME:options", "count:=", 2), Array("NAME:elements", "rect_
56"), Array( -0.018, 0.017)

Layout Scripting 30-135


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Edit3DComponentDefinition
Edits definitions of a specified 3D component.

UI Access Layout > 3D Component Definitions. Select component and click Edit Definition.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:3D Components",
"Definitions:=" , [<string component name>],

Parameters "IsLocal:=" , <boolean True for local defin-


ition; False to save to file>,
"EditFilePath:=", <string path of new component
file location>)
If saving locally or leaving the file path unaltered, pass empty string for
EditFilePath.

Return Value None.

Python Syntax Edit3DComponentDefinition (<Parameters>)


oEditor.Update3DComponentDefinitions(
["NAME:3D Components",
Python Example
"Definitions:=" , ["My_Component"],
"IsLocal:=" , True,

Layout Scripting 30-136


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"EditFilePath:=", ""
)

VB Syntax Edit3DComponentDefinition <Parameters>


oEditor.Update3DComponentDefinitions Array("NAME:3D Components", _
VB Example
"Definitions:=" , Array("My_Component"), "IsLocal:=" , True, "EditFilePath:=" , "")

EraseMeasurements (Layout Editor)


Use: Causes erasing of ALL measurements currently present.
Command: None.
Syntax: EraseMeasurements
Return Value: None.
Parameters: None.
VB Example: oEditor.EraseMeasurements
ExportDXF (Layout Editor)
Use: Export DXF
Command: File > Export > AutoCAD
Syntax: ExportDXF
Array("NAME:options", "FileName:=", <"filename">, "AcadVersion:=,<version>, "ScaleFactor:=", <scale>),
Array("NAME:layers", <"layer">, …)
Return Value: None
Parameters:

Layout Scripting 30-137


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<"filename">
Type: text
Description: file path for the export file
<version>
Type: integer
Description: version of AutoCAD. Acceptable values are:
l 0 corresponding to AutoCAD version 13
l 1 corresponding to AutoCAD version 14
l 2 corresponding to AutoCAD 2000-2003
l 3 corresponding to AutoCAD 2004-2006
l 4 corresponding to AutoCAD 2007-2009
l 5 corresponding to AutoCAD 2010-2012

<scale>
Type: double
Description: the scaling of the values written out, e.g. if the data is written out in "mm", the scaling factor will be 1000.
<"layer">
Type: text
Description: names of the layers to be exported.
VB Example:
Set oDesign = oProject.SetActiveDesign("HFSS3D1")
Set oEditor = oDesign.SetActiveEditor("Layout")

Layout Scripting 30-138


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.ExportDXF Array("NAME:options", "FileName:=", "C:/Projects/Temp/output.dxf", "AcadVer-


sion:=", 0, "ScaleFactor:=", 1000), Array("NAME:layers", "Assembly Bottom", "Assembly Top", "Bot-
tom", "Bottom Dielectric", "Errors", "Ground", "Measures", "Rats", "Silkscreen Bottom",
"Silkscreen Top", "Symbols", "Top", "Top Dielectric")
Python Example:
import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oProject = oDesktop.SetActiveProject("05514795_y1_10kv_v02-1mm")
oDesign = oProject.SetActiveDesign("PCB")
oEditor = oDesign.SetActiveEditor("Layout")
oEditor.ExportDXF(
[
"NAME:options",
"FileName:=" , "E:/Anstranslator/resultsEDB/05514795_y1_10kv_v02-1mm_PCB.dxf",
"AcadVersion:=" , 5,
"ScaleFactor:=" , 1000
],
[
"NAME:layers",
"BOTTOM",
"Outline",
"TOP"
])

Layout Scripting 30-139


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ExportGDSII (Layout Editor)


Exports results to GDSII.

UI Access File > Export > GDSII.

Name Type Description


<OptionParameters> Array Structured array.
Array("NAME:options",
"FileName:=", <string, GDSII export
file name.>,
"NumVertices:=", <integer, maximum num-
ber of vertices allowed in a polygon (spe-
cify zero if unlimited).>,
"ArcTol:=", <double, arc tolerance (in
meters); the value used to discretize arcs.
Parameters Smaller the value the greater the number of
edges exported. For 0.1mm use 0.0001.>,
"LayerMap:=", Array(
"entry:=", Array(
"layer:=", <string, name of a layer to
export.>,
"id:=", <integer, GDSII layer ID to
assign the exported layer.>,
"include:=", <boolean, if true, the
layer is exported.>))

Layout Scripting 30-140


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value None.

Python Syntax ExportGDSII(<OptionParameters>)


oEditor.ExportGDSII [(
"NAME:options",
"FileName:=", "C:/Projects/ design.gds",
"NumVertices:=", 0,
"ArcTol:=", 2E-006,
"LayerMap:=", [
"entry:=",[
"layer:=", "Bottom",
Python Example
"id:=", 2,
"include:=", true],
"entry:=", [
"layer:=", "Top",
"id:=", 1,
"include:=", true]
]
]

VB Syntax ExportGDSII <OptionParameters>

Layout Scripting 30-141


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.ExportGDSII
Array("NAME:options",
"FileName:=", "C:/Projects/ design.gds",
"NumVertices:=", 0,
"ArcTol:=", 2E-006,
"LayerMap:=", Array(
"entry:=", Array(
VB Example
"layer:=", "Bottom",
"id:=", 2,
"include:=", true),
"entry:=", Array(
"layer:=", "Top",
"id:=", 1,
"include:=", true)))

ExportGerber (Layout Editor)


Use: Export the current design to Gerber files.
Command: File > Export > Gerber
Syntax: ExportGerber
Array("NAME:options",
"FileName:=", <"file name">,

Layout Scripting 30-142


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Units:=", <"units">,
"IntPlace:=", <integer places>,
"DecimalPlace:=", <decimal places>,
"Suppress:=", <"suppress">,
Array("NAME:GerberPages",
"<page>:=", Array(<"layer">, …), …))
Return Value: None
Parameters: <"file name">
Type: text
Description: prefix for the exported Gerber files; the actual files will be named <file name>_<page>.ger
<"units">
Type: text
Description: unit code, e.g. "in", "mm", etc.
<integer places>
Type: integer
Description: number of integer places to use when formatting the numerical output.
<decimal places>
Type: integer
Description: number of decimal places to use when formatting the numerical output.
<"suppress">
Type: text

Layout Scripting 30-143


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Description: either "Leading Zeros", or "Trailing Zeros".


<page>
Type: integer
Description: Gerber page number
<"layer">
Type: text
Description: Layers to be exported to the specified Gerber page.
Example:
Set oDesign = oProject.SetActiveDesign("HFSS3D1")
Set oEditor = oDesign.SetActiveEditor("Layout")
oEditor.ExportGerber
Array("NAME:options",
"FileName:=", "C:/ Projects/design.ger",
"Units:=", "in",
"IntPlace:=", 5,
"DecimalPlace:=", 5,
"Suppress:=", "Leading Zeros",
Array("NAME:GerberPages", "1:=", Array("Ground"), "2:=", Array("Top") ))

Layout Scripting 30-144


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ExportNCDrill (Layout Editor)


Use: Export the vias to an NC Drill file
Command: File > Export > NCDrill
Syntax: ExportNCDrill
Array("NAME:options",
"FileName:=", <"file name">,
"Units:=", <"units">,
"IntPlace:=", <integer places>,
"DecimalPlace:=", <decimal places>,
"SuppressLeadingZero:=", <suppress leading zeros>,
Array("NAME:NCDFileOptsVec",
Array("NAME:NCDrillOptions",
"Top:=", <"layer">,
"Bottom:=", <"layer">,
"Create:=", <create>), …))
Return Value: None
Parameters: <"file name">
Type: text
Description: prefix for the exported Gerber files; the actual files will be named <file name>_<page>.ger
<"units">
Type: text

Layout Scripting 30-145


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Description: unit code, e.g. "in", "mm", etc.


<integer places>
Type: integer
Description: number of integer places to use when formatting the numerical output.
<decimal places>
Type: integer
Description: number of decimal places to use when formatting the numerical output.
<suppress leading zeros>
Type: boolean
Description: if true, then suppress leading zeros in the output file.
<layer>
Type: text
Description: Start/end layer names; each layer range is written to a separate NC drill file.
<create>
Type: boolean
Description: if true, create the corresponding NC drill file.
Example:
Set oDesign = oProject.SetActiveDesign("HFSS3D1")
Set oEditor = oDesign.SetActiveEditor("Layout")
oEditor.ExportNCDrill

Layout Scripting 30-146


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:options",
"FileName:=", "C:/ Projects/drill.ncd",
"Units:=", "mm",
"IntPlace:=", 5,
"DecimalPlace:=", 5,
"SuppressLeadingZero:=", true,
Array("NAME:NCDFileOptsVec",
Array("NAME:NCDrillOptions",
"Top:=", "Top",
"Bottom:=", "Ground",
"Create:=", true),
Array("NAME:NCDrillOptions",
"Top:=", "Top",
"Bottom:=", "Bottom",
"Create:=", true)))

GetComponentInfo (Layout Editor)


Use: Informational.
Command: None.
Syntax: GetComponentInfo<compID>
Return Value: array of strings, as follows:

Layout Scripting 30-147


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ComponentName=string"
"PlacementLayer=string"
"LocationX=number"
"LocationY=number"
"BBoxLLx=number"
"BBoxLLy=number"
"BBoxURx=number"
"BBoxURy=number"
"Angle=number" (in degrees)
"Flip=true or false"
"Scale=number"
Parameters: The LayoutComp's ID
VB Example: dim info
sys= oEditor.GetComponentInfo ("1")

GetCompInstanceFromRefDes (Layout Editor)


Use: Informational.
Command: None.
Syntax: GetCompInstanceFromRefDes (<object_name>)
Return Value: Returns IDispatch for CompInstance.

Layout Scripting 30-148


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters: <object_name> // string is refDes


VB Example: oEditor.GetCompInstanceFromRefDes("A1")

GetComponentPins (Layout Editor)


Use: Informational.
Command: None.
Syntax: GetComponentPins<compID>
Return Value: array of strings, which are the names of all the component's pins
Parameters: The LayoutComp's ID
CompInst@<ComponentName>;<CompInstID>
VB Example:
’ --------------------------------------------------------------------------------------------
’ Script Recorded by Ansys Electronics Desktop
’ Component Name is CAP_ and ID is 1
’ --------------------------------------------------------------------------------------------
dim pins

pins = oEditor.GetComponentPins ("1")


Note: For the documented example, the capacitor component name is CAP_ and its ID is 1. If you can select the item of interest in the
schematic, the Properties window gets updated with the corresponding component name, its ID, and other details as shown in the fol-
lowing figure.

Layout Scripting 30-149


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetComponentPinInfo (Layout Editor)


Use: Informational.
Command: None.
Syntax: GetComponentPinInfo<compID, pinName>
Return Value: retval = array of strings, as follows:
"X=val"
"Y=val"
"Angle=val"
"Flip=true/false"
"WireID=string"

Layout Scripting 30-150


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters: compID = The LayoutComp's ID


pinName = The name of the pin
VB Example: dim info
info = oEditor.GetComponentPinInfo ("1", "n1")

GetEditorName (Layout Editor)


Use: Informational.
Command: None.
Syntax: GetEditorName()
Return Value: Returns the name of the editor.
VB Example: dim info
info = oEditor.GetEditorName

GetMaterialList (Layout Editor)


Use: Get the names of all the materials for a layout.
Command: None.
Syntax: GetMaterialList
Return Value: Array of strings.
Parameters: None.
VB Example: Dim materialNames
materialNames = oEditor.GetMaterialList

Layout Scripting 30-151


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetProperties (Layout Editor)


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 objects.
Command: None
Syntax: GetProperties( <PropTab>, <PropServer> )
Return Value: Variant array of strings – the names of the properties belonging to the prop server.
VB Example: Dim all_props
all_props = oDesign.GetProperties("BaseElementTab",_
"rect_1")
GetPropertyValue (Layout Editor)
Use: Gets the value of a single property. This can be executed by the oProject, oDesign, or oEditor objects.
Command: None
Syntax: GetPropertyValue(<PropTab>, <PropServer>, <PropName>)
Return Value: String representing the property value.
VB Example: value_string = _
oEditor.GetPropertyValue("BaseElementTab",_
"rect_1", "Name")

GetSelections (Layout Editor)


Returns an array of currently selected objects.

Layout Scripting 30-152


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access N/A
Parameters None.
Return Value Array containing object IDs

Python Syntax GetSelections()


Python Example oEditor.GetSelections()

VB Syntax GetSelections
VB Example oEditor.GetSelections

Heal (Layout Editor)


Use: Draw > Geometry Healing
Command: Heal( [ "NAME:<category>", "Type:=", "<type>", "Tol:= ", "<tolerance>", <args>] )

<category> can have these values: Snap, Feature, or Repair

<type> will have these values:


For category Snap: Point, Arc, Grid
For category Feature: Voids, FloatingBodies
For category Repair: Colinear, SelfIntersecting

For the category Feature, type Voids there is an additional optional argument: "AntiPads:=" true or false.

Layout Scripting 30-153


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax:

Heal( [ "NAME:<category>", "Type:=", "<type>", "Tol:= ", "<tolerance>", <args>] ))

Heal( [ "NAME:<category>", "Selection:=", ["<obj1>", "<obj2>", … ],"Type:=", "<type>", "Tol:= ", "<tolerance>", <args>] ))

Return Value: None

VB Example:
oProject = oDesktop.SetActiveProject("GeometryHealing")
oDesign = oProject.SetActiveDesign("TestDesign")
oEditor = oDesign.SetActiveEditor("Layout")
oEditor.Heal(
[
"NAME:Snap",
"Type:=" , "Point",
"Tol:=" , "0.1mm"
])
oEditor.Heal(
[
"NAME:Snap",
"Type:=" , "Arc",

Layout Scripting 30-154


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Tol:=" , "0.1mm"
])
oEditor.Heal(
[
"NAME:Snap",
"Type:=" , "Grid",
"Tol:=" , "0.1mm"
])
oEditor.Heal(
[
"NAME:Feature",
"Type:=" , "Voids",
"AntiPads:=" , False,
"Tol:=" , "4mm2"
])
oEditor.Heal(
[
"NAME:Feature",
"Type:=" , "FloatingBodies",
"AntiPads:=" , False,
"Tol:=" , "4mm2"

Layout Scripting 30-155


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

])
oEditor.Heal(
[
"NAME:Repair",
"Type:=" , "Colinear",
"Tol:=" , "1e-007mm"
])
oEditor.Heal(
[
"NAME:Repair",
"Type:=" , "SelfIntersecting",
"Tol:=" , "1e-007mm"
])

PageSetup (Layout Editor)


Use: Specifies page setup for printing.
Command: File>Page Setup
Syntax: PageSetup <ArgArray>
Return Value: None.
Parameters: <Margins>: Page margins in implicit units of inches.

Layout Scripting 30-156


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<Border>: Integer value indicating to draw border (1) or not to draw (0).
<DesignVars>: Integer value indicating to draw design vars (1) or not to draw (0).
VB Example: Set oProject = oDesktop.GetActiveProject()
Set oDesign = oProject.GetActiveDesign()
Set oEditor = oDesign.GetActiveEditor()
oEditor.PageSetup Array("NAME:PageSetupData", "margins:=", Array("left:=", 550, "right:=", _
550, "top:=", 500, "bottom:=", 500), "border:=", 1, "DesignVars:=", 0)

PushExcitations
Allows access to computed excitations for transient and linear frequency solutions. The script command can be accessed from three
locations.

l Layout Editor
UI Access l Schematic Editor
l Select a Nexxim solution in a 3D Layout design, right click, and choose Push Excitations.

Name Type Description


<Reference Designation> String "<refdes>"
This argument is empty when excitations are pushed from a Nexxim
solution.
Parameters
<PushExcitations Para- Array This parameter changes depending on whether the excitations
meters> comes from a transient or linear frequency solution. The keyword
"transient:=" indicates to AEDT which solution generated the
excitations. If "transient:=" is present, "CalcThevenin ="
and its value are ignored.

Layout Scripting 30-157


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

For a linear frequency solution, use this array:


Array("NAME:options",
"CalcThevenin =" , <true|false>,
"Sol:=", "<solution name>")
If CalcThevenin is true, Thevenin’s equivalent is calculated. Para-
meters for the linear frequency solution do not include a Freq argu-
ment, so all frequencies from the solution are used.
For a transient solution, use:
Array("NAME:options",
"transient:=", Array(
"start:=", <start time>,
"stop:=", <stop time>,
"maxHarmonics:=", <max harmonics>,
"winType:=", <window>,
["widthPct:=", <width percentage>,]
["kaiser:=", <Kaiser value>,]
["correctCoherentGain:=", true]),
"Sol:=", "<solution name>")
winType can have the following values:
l Rectangular
l Bartlett

Layout Scripting 30-158


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l Blackman
l Hamming
l Hanning
l Kaiser
l Welch
l Weber
l Lanzcos

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

PushExcitations "<refdes>", Array("NAME:options", "transient:=",


["CalcThevenin =" , <true>], Array("start:=", <start time>, "stop:=", <stop time>,
VB Syntax "maxHarmonics:=", <max harmonics>, "winType:=", <window>,
["widthPct:=", <width percentage>,] ["kaiser:=", <Kaier value>,]
["correctCoherentGain:=", true]), "Sol:=", "<solution name>")

For a transient solution:


Set oEditor = oDesign.SetActiveEditor("Layout")
VB Example oEditor.PushExcitations "U3", Array("NAME:options", _
"transient:=", Array("start:=", 0, "stop:=", 5E-005, _
"maxHarmonics:=", 100, "winType:=", "Rectangular", _

Layout Scripting 30-159


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"widthPct:=", 100, "kaiser:=", 0, "correctCoherentGain:=",_


true), "Sol:=", "Transient")

Set oDesign = oProject.SetActiveEditor("Design1")


oDesign.PushExcitations "", Array("NAME:options", _
"transient:=", Array("start:=", 0, "stop:=", 1E-08, _
"maxHarmonics:=", 100, "winType:=", "Hamming", _
"widthPct:=", 100, "kaiser:=", 0, "correctCoherentGain:=",_
true), "Sol:=", "Transient Setup 1")

For a linear frequency solution:


Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
oEditor.PushExcitations "S1", Array("NAME:options", _
"CalcThevenin:=", false, "Sol:=", "LinearFrequency")

SelectAll (Layout Editor)


Use: Select all elements in the layout editor.
Command: None.
Syntax: SelectAll()
Parameters: None
VB Example: Dim removedDefs

Layout Scripting 30-160


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

removedDefs = oDefinitionEditor.SelectAll()

SetPropertyValue (Layout Editor)


Use: Sets the value of one property. This is not supported for properties of the following types: ButtonProp, PointProp, and
VPointProp. Only the ChangeProperty command can be used to modify these properties. This can be executed by the oProject,
oDesign, or oEditor objects.
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. Use
GetPropertyValue for the desired property to see the expected
format.
VB Example: oEditor.SetPropertyValue _
"BaseElementTab","rect_1",_
"LineWidth", "3mm"
StitchLines (Layout Editor)
Use: Stitch together connected or crossing lines into polygons and lines.
Command: StitchLines

Layout Scripting 30-161


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax: StitchLines Array("NAME:elements", <"line">, …)


Return Value: None
Parameters: <"line">
Type: text
Description: line name.
Example:
Set oDesign = oProject.SetActiveDesign("HFSS3D1")
Set oEditor = oDesign.SetActiveEditor("Layout")
oEditor.StitchLines Array("NAME:elements", "line_1", "line_2", "line_3")

UnselectAll (Layout Editor)


Use: Unselect all active selections in the layout editor.
Command: Edit > Unselect All
Syntax: UnselectAll()
Parameters: None
VB Example: oLayout.UnselectAll()

ZoomToFit (Layout Editor)


Use: Set the current schematic zoom to fit the contents of the currently visible page
Command: None

Layout Scripting 30-162


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax: ZoomToFit()
Return Value: None

Layout Scripting 30-163


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

30-164
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

31 - Schematic Scripting
The Schematic scripting interface is a set of commands that match the data changing methods available in the UI of the Schematic,
plus some selection and query methods. Examples of the commands available through the scripting interface are adding items, remov-
ing items, and modifying items on the Schematic. Identifying objects on the Schematic is done by a unique ID that is generated and
returned by all methods that add objects, and by the FindElements and GetSelections methods. This ID can then be passed into com-
mands to modify or remove Schematic objects.
l Since most Schematic objects can have sub-components (such as property displays or segments on a wire, etc), IDs can also
be in the format of "TopLevelID:SubComponentIndex".
l The SubComponentIndex is a one-based index into the sub components of the item thus making the second segment of com-
ponent CAP1 identified by "CAP1:2".
l A SubComponentIndex of zero will refer to the TopLevel item only.
l When an ID is mentioned later in this document, it will refer to either a simple string ID representing a top-level Schematic item
or a "TopLevelID:SubComponentIndex" pair unless otherwise stated.
l If a specified ID or SubComponentIndex does not exist, then the function will ignore that entry and proceed with other specified
IDs. Even if no valid IDs are specified, the functions will still return success.

The topics for this section include:


l Method Format
l Editor Scripting IDs
l Create Method List
l General Method List
l Property Method List
l Information Method List

Schematic Scripting 31-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Method Format
In the following formats, [Opt=x] appearing after a parameter indicates that the parameter is optional and the default value is x.
When calling object-creation methods as functions, parenthesis are required in order to retrieve the name of the created object. Par-
enthesis are also required in JavaScript. When using VB/VBScript to call a method as a subroutine, however, parenthesis are not
required.
All methods to create Schematic objects have the following form:
Create[type](VARIANT parameters,
// Array of type specific parameters
VARIANT attributes,
// attributes is in the format of:
Array("NAME:Attributes", _
"Page:=", int, _ // [Opt=1] Page number (one-based)
// Note: Page 1 always exists
"X:=", double, _ // X position of the object
"Y:=", double, _ // Y position of the object
"Angle:=", double, _ // Rotation angle (radians)
"Flip:=", bool) // True if mirrored
[out,retval] string id)

The algorithm used in the create methods is:


1) Create SchAdd[type]Command object with parameters passed in

Schematic Scripting 31-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

2) Execute the command


All methods to modify Schematic objects have the following form:
[modification](Array("NAME:Selections",
"Page:=", Page number [optional: Default=1]
"Selections:=", IDs to modify see format below),
VARIANT params
// Array of modification specific parameters)

The algorithms in these types of methods will be:


1) Go through ids and get the SelectableObjs they correspond to
2) Select the SelectableObjs found in (1)
3) Select any sub components specified
4) Create the Sch[modification]Command
5) Execute the command

ID Format
When IDs are passed to a function it can be in one of the following formats:
l Array of integers of top-level items only
l String of IDs separated by spaces or commas
l Array of strings with each string element being an ID

Point Format

Schematic Scripting 31-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

When a method takes an array of points, each element in the array is a string in the format of: "x y", "x,y", or "(x,y)".

Editor Scripting IDs


Objects in the schematic are identified by text IDs. These IDs are used in scripts to perform actions on objects. These IDs are returned
by all methods that add objects, and by the FindElements and GetSelections methods. The IDs are then passed into commands to
modify or remove Schematic objects.
Format of IDs for different schematic objects:
Components: CompInst@<CompName>;<compInstID>;<optional schematicID>
Geometric primitive: SchObj@<schematicID>
Global Port/ground :: GPort@<portName>;<schematicID>
Interface Port :: IPort@<portName>;<schematicID>
Page Port: PagePort@<portName>;<schematicID>
Wire : Wire@<netName>;<schematicID>;<segment index list>
Find this information in the Properties Window for the selected object as follows:
<CompName> General tab/CompName
<compInstID> General tab/ID
<schematicID> Symbol tab/SchematicID
<portName> Param Values tab/PortName
<netName> General tab/NetName
<segment index list> numbers separated by commas; Symbol tab/Segmentn - e.g. Segment0 refers to index "0"
In the Layout, the ID for a selected object is always the Name or Net property in the Footprint tab of the Properties Window

Schematic Scripting 31-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Format for Components


Array("CompInst@CAP_;2;4"))
The format for Components is CompInst@<CompName>;<compInstID>;<optional schematicID>. In the documented example, <Com-
pName> stands for the component name CAP_, <compInstID> stands for its ID 2, and <optional schematicID> is the schematic ID 4.
If you select the component, the Properties window gets updated and displays its details. For example, the selected object’s com-
ponent name and ID appear in the General tab of the Properties window as shown below.

The SchematicID is shown in the Symbol tab.

Schematic Scripting 31-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Create Method List


This section lists the scripts that are available in the Schematic scripting interface to create and change data.
Script Position Parameters
In Create Method scripts, X and Y position parameters are expressed in meters.
l If your layout grid units are metric, you may enter the X and Y positions directly into a script as parameters.
l If your layout grid is expressed in mils, you must first convert the component's positional coordinates to meters.

To convert an X or Y position to meters based on the minor grid size:


X or Y position in meters = desired_position x ( 0.00254 / minor_grid_size )
where desired_position and minor_grid_size have the same units. For example, to position an object at 500mm with a minor grid size
of 20mm:
X or Y position in meters = 500 x ( 0.00254 / 20 )
This section lists the following commands:
CreateArc (Schematic Editor)
CreateCircle (Schematic Editor)
CreateComponent (Schematic Editor)
CreateCurve (Schematic Editor)
CreateGlobalPort (Schematic Editor)
CreateGround (Schematic Editor)
CreateLine (Schematic Editor)
CreatePagePort (Schematic Editor)

Schematic Scripting 31-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CreateIPort (Schematic Editor)


CreatePolygon (Schematic Editor)
CreateRectangle (Schematic Editor)
CreateText (Schematic Editor)
CreateWire (Schematic Editor)
CreateArc (Schematic Editor)
Create an arc

UI Access Draw>Primitive>Arc

Name Type Description


<ArcData> Array Array("NAME:ArcData" _
"x:=", double, _ // X position of the object
"y:=", double, _ // Y position of the object
"Radius:=", double, _ // Radius of the circle
"StartAng:=", double,_ // Start angle of the arc (radians)
Parameters "EndAng:=", double, _ // End angle of the arc (radians)
"LineWidth:=", double, // the width of the line, in meters
"Color:=", int, // the RBG value of the arc color
"Id:=", int), // [Opt=New id] Id for this item
<Attributes> Array Array("NAME:Attributes", _
"Page:=", int) _ // [Opt=1] Page number (one-based)
[out,retval] string id)

Schematic Scripting 31-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

String
Return Value
Unique id

Arc is created with the format SchObj@<schematicID>

The Schematic ID can be found on the Symbols tab of the Properties window when you select the arc.

Python Syntax CreateArc()


Python Example oEditor.CreateArc

Schematic Scripting 31-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

(["NAME:ArcData", _
"X:=", -0.004318, "Y:=", -0.00127, _
"Radius:=", 0.00297299377732279, _
"StartAng:=", 1.9195673303788, _
"EndAng:=", 3.32144615338227, _
"Id:=", 10], _
["NAME:Attributes", "Page:=", 1])

VB Syntax CreateArc()
oEditor.CreateArc
Array("NAME:ArcData", _
"X:=", -0.004318, "Y:=", -0.00127, _
"Radius:=", 0.00297299377732279, _
VB Example
"StartAng:=", 1.9195673303788, _
"EndAng:=", 3.32144615338227, _
"Id:=", 10), _
Array("NAME:Attributes", "Page:=", 1)

VB Example:
Dim oAnsoftApp

Schematic Scripting 31-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("Circuit1")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
Dim ArcID
ArcID = oEditor.CreateArc(Array("NAME:ArcData", "X:=", 0.10414, "Y:=", 0.08382, "Radius:=", _
0.00915810023967853, "StartAng:=", 2.15879893034246, "EndAng:=", _
5.49778714378214, "LineWidth:=", 0, "Color:=", 0, "Id:=", 48), Array("NAME:Attributes", "Page:=",
_
1))
MsgBox "Arc ID = " & ArcID
CreateCircle (Schematic Editor)
Create a circle

Schematic Scripting 31-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Draw>Primitive>Circle

Name Type Description


<CircleData> Array Array("NAME:CircleData" _
"x:=", double, _ // X position of the object
"y:=", double, _ // Y position of the object
"Radius:=", double, _ // Radius of the circle
"LineWidth:=", double, // the width of the circle border, in meters
"Bordercolor:=", int, // the RBG value of the border color
Parameters
"Fill:=", int, // the fill pattern id, 0 = hollow, 1 = solid, 2 = NEDiagonal,
3 = OrthoCross, 4 = DiagCross, 5 = NWDiagonal, 6 = Horizontal, 7 = Vertical
"Color:=", int, // the RBG value of the circle fill color
"Id:=", int), // [Opt=New id] Id for this item
<Attributes> Array Array("NAME:Attributes", _
"Page:=", int) _ // [Opt=1] Page number (one-based)
[out,retval] string id)

String
Return Value
Unique id

Circle is created and the returned value has the format SchObj@<schematicID>
The schematic ID of the circle can be located in the Properties window on the Symbols tab.

Schematic Scripting 31-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax CreateCircle()


oEditor.CreateCircle(["NAME:CircleData", _
"X:=", -0.004572, "Y:=", -0.000508, _
Python Example "Radius:=", 0.001778, "Id:=", 12], _
["NAME:Attributes", "Page:=", 1])

VB Syntax CreateCircle()

Schematic Scripting 31-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.CreateCircle
Array("NAME:CircleData", _

VB Example "X:=", -0.004572, "Y:=", -0.000508, _


"Radius:=", 0.001778, "Id:=", 12), _
Array("NAME:Attributes", "Page:=", 1)

CreateComponent (Schematic Editor)


Creates a component of a given type.

UI Access N/A.

Name Type Description


<params> Array Structured array.
Array("NAME:ComponentProps",
"Name:=", <String path to component in library>,
"Id:=", <String Component ID>)
<attributes> Array Structured array.
Array("NAME:Attributes",
Parameters
"Page:=", <Integer: page number>,

Note:

For the page number, page 1 always exists.

"X:=", <Double: X position of object>,


"Y:=", <Double: Y position of the object>,

Schematic Scripting 31-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Angle:=", <Double: rotation angle in degrees>,


"Flip:=", <boolean: True if mirrored; else False>,
"PinNumber:=", <Integer: index of pin in symbol 0 to
n-1>

Note:

PinNumber is optional and is set to -1 by default. PinNumber affects


where the symbol is placed relative to the X and Y parameters. If
PinNumber is set to -1, the symbol is placed with its center at (X,Y). If it
is a pin index, the symbol is placed so that the pin is located at (X,Y).
The PinNumber is not recorded.

String containing unique ID in the format:


CompInst@<CompName>;<compInstID>;<optional schematicID>
Return Value For example, the return value CompInst@CAP;4;35 indicates that the component name is CAP, its ID is 4, and
its Schematic ID is 35.
You can also see these details in the Properties window when you select the created component.

Python Syntax CreateComponent(<params>, <attributes>)


oEditor.CreateComponent(
Python Example ["NAME:ComponentProps",
"Name:=", "Maxwell Circuit Elements\Passive Elements:Res",

Schematic Scripting 31-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Id:=", "1"
],
["NAME:Attributes",
"Page:=", 1,
"X:=", -0.01524,
"Y:=", 0.00508,
"Angle:=", 0,
"Flip:=", false
]
)

VB Syntax CreateComponent <params>, <attributes>


Set oProject = oDesktop.SetActiveProject("Project1")
Set oDesign = oProject.SetActiveDesign("Circuit1")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
VB Example
Dim CompID
CompID = oEditor.CreateComponent Array("NAME:ComponentProps", "Name:=", "Maxwell
Circuit Elements\Passive Elements:Res", "Id:=", "1"), Array("NAME:Attributes",
"Page:=", 1, "X:=", -0.01524, "Y:=", 0.00508, "Angle:=", 0, "Flip:=", false)

CreateGlobalPort (Schematic Editor)


Create a global port and enable placement on the schematic

Schematic Scripting 31-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Draw>Global Port

Name Type Description


<portname> String Name for this port - leave empty to use default unique name
<id> Integer ID number for the port - leave empty to use default (recommended)
<pagenumber> Integer The (1-based) page number of the schematic page this port should be added to
- leave empty to use default (1)
Parameters
<xval> Double X position of the object
<yval> Double Y position of the object
<angle> Double Rotation of the object, in radians. Rotations of multiples of 90 degrees are valid.
Other values will be adjusted to the nearest valid angle.
<degrees> Double Rotation of the object, in degrees. Rotations of multiples of 90 degrees are
valid. Other values will be adjusted to the nearest valid angle
<flip> Boolean True if mirrored

Return Value
String
PortID, the identifier that can be used for this port in script operations involving this schematic

Global port is created and the return value has the format GPort@<portName>;<schematicID>
The Schematic ID can be found in the Properties window on the Symbols tab when you select the global port.

Schematic Scripting 31-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CreateGlobalPort(["NAME:GlobalPortProps", "Name:=", <portname>, "Id:=", <id>], ["NAME:Attributes",


Python Syntax "Page:=", <pagenumber>, "X:=", <xval>, "Y:=", <yval>, "Angle:=", <angle>, [or "Degrees:=", <degrees> ,]
"Flip:=", <flip>])
oEditor.CreateGlobalPort
(["NAME:GlobalPortProps", "Name:=", "G_0", "Id:=", 1],_
Python Example
["NAME:Attributes", "Page:=", 1, "X:=", -0.02286, "Y:=",
0.00254, "Angle:=", 0, "Flip:=", false)

Schematic Scripting 31-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CreateGlobalPort(Array("NAME:GlobalPortProps", "Name:=", <portname>, "Id:=", <id>), Array("NAME:At-


VB Syntax tributes", "Page:=", <pagenumber>, "X:=", <xval>, "Y:=", <yval>, "Angle:=", <angle>, [or "Degrees:=", <degrees>
,] "Flip:=", <flip>)
oEditor.CreateGlobalPort
Array("NAME:GlobalPortProps", "Name:=", "G_0", "Id:=", 1),_
VB Example
Array("NAME:Attributes","Page:=", 1, "X:=", -0.02286,
"Y:=", 0.00254, "Angle:=", 0, "Flip:=", false)

VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("Circuit1")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")

Schematic Scripting 31-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Dim GPort
GPort = oEditor.CreateGlobalPort(Array("NAME:GlobalPortProps", "Name:=", "G_1", "Id:=", 68),
Array("NAME:Attributes", "Page:=", _
1, "X:=", 0.11684, "Y:=", 0.0635, "Angle:=", 0, "Flip:=", false))
MsgBox "Port = " & GPort
CreateGround (Schematic Editor)
Create a ground

UI Access Draw>Ground

Name Type Description


<GroundProps> Array Array("NAME:GroundProps",_
"Id:=", int), // [Opt=New id] Id for this item
<Attributes> Array Array("NAME:Attributes", _
"Page:=", int, _ // [Opt=1] Page number (one-based)
Note: Page 1 always exists
Parameters
"X:=", double, _ // X position of the object
"Y:=", double, _ // Y position of the object
"Angle:=", double, _ // Rotation angle (radians)
"Flip:=", bool), // True if mirrored
[out,retval] string id)

String
Return Value
Unique id

Schematic Scripting 31-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Ground is created and the returned value has the format GPort@<portname>;<schematicID>
The Schematic ID for ground can be found on the Symbols tab of the Properties window when you select the object.

Python Syntax CreateGround()


oEditor.CreateGround
(["NAME:GroundProps", "Id:=", 8),

Python Example ["NAME:Attributes", "Page:=", 1, "X:=",


-0.04064, "Y:=", -0.00254, "Angle:=",
0, "Flip:=", false])

Schematic Scripting 31-20


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax CreateGround()
oEditor.CreateGround
Array("NAME:GroundProps", "Id:=", 8),

VB Example Array("NAME:Attributes", "Page:=", 1, "X:=",


-0.04064, "Y:=", -0.00254, "Angle:=",
0, "Flip:=", false)

VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("Circuit1")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")

Schematic Scripting 31-21


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Gnd = oEditor.CreateGround(Array("NAME:GroundProps", "Id:=", 144), Array("NAME:Attributes",


"Page:=", _
1, "X:=", 0.11684, "Y:=", 0.06604, "Angle:=", 0, "Flip:=", false))

MsgBox "GndIndex =" & Gnd


CreateLine (Schematic Editor)
Creates a line.

UI Access Draw>Primitive>Line

Name Type Description


<LineData> Array Array("NAME:LineData" _
"Points:=", Array of points, _
"LineWidth:=", double, // the width of the line, in meters
Parameters "Color:=", int, // the RBG value of the line color
"Id:=", int), // [Opt=New id] Id for this item
<Attributes> Array Array("NAME:Attributes", _
"Page:=", int) _ // [Opt=1] Page number (one-based)
[out,retval] string id)

String
Return Value
Unique id

Line is created and the returned value has the format SchObj@<schematicID>

Schematic Scripting 31-22


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

The Schematic ID can be found on the Symbol tab of the Properties window when you select the line.

Python Syntax CreateLine()


oEditor.CreateLine (["NAME:LineData",_
"Points:=", ["(-0.055652, 0.020669)", _
"(-0.036923, 0.011257)", "(-0.023144, 0.018049)"],_
Python Example
"Line-
Width:=", 0, "Color:=", 0, "Id:=", 22)], _
["NAME:Attributes", "Page:=", 1])

Schematic Scripting 31-23


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax CreateLine()
oEditor.CreateLine Array("NAME:LineData",_
"Points:=", Array("(-0.055652, 0.020669)", _

VB Example "(-0.036923, 0.011257)", "(-0.023144, 0.018049)"),_


"Line-
Width:=", 0, "Color:=", 0, "Id:=", 22), _
Array("NAME:Attributes", "Page:=", 1)

VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("Circuit1")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
LineID = oEditor.CreateLine(Array("NAME:LineData", "Points:=", Array("(0.050800, 0.106680)", _

Schematic Scripting 31-24


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"(0.124460, 0.106680)", "(0.124460, 0.106680)"), "LineWidth:=", 0, "Color:=", _


0, "Id:=", 169), Array("NAME:Attributes", "Page:=", 1))
MsgBox "LineID = " & LineID
CreateNPort (Schematic Editor)
Use: Creates an N-Port definition and component and adds them to the current project, layout, and schematic.
Command: CreateNPort
Syntax: CreateNPort
Array("NAME:Contents",
"definition_name:=",<nport_definition_name>,
"placement:=", <component_placement>,
"layer:=", <placement_layer_name>,
<nport_data_definition>)

<nport_definition_name>:
quoted string (name of the component definition)

<component_placement>:
Array("x:=", <value>, // x coordinate
"y:=", <value>, // y coordinate
"scaling:=", <value>) // double
Return Value: Returns the name of the newly created component.

Schematic Scripting 31-25


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<nport_data_definition> - see the I/O format in TODO


VB Example: Example:
oEditor.CreateNPort
Array("NAME:Contents",
"definition_name:=", "NetworkData3",
"placement:=",
Array("x:=", "-9mm",
"y:=", "-5mm",
"scaling:=", "2"),
"layer:=", "Symbols",
Array("NAME:NPortData",
Array("NAME:NetworkData2",
"filelocation:=", "UsePath",
"filename:=", "",
"domain:=", "frequency",
"numberofports:=", 2,
"datamode:=", "Import",
"devicename:=", "", "
ImpedanceTab:=", 1,

Schematic Scripting 31-26


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NoiseDataTab:=", 1,
"DCBehaviorTab:=", 1,
"SolutionName:=", "",
"dcbehavior:=", "DCOpen",
"displayformat:=", "MagnitudePhase",
"datatype:=", "SMatrix",
"interptype:=", "Linear",
"extraptype:=", "Same as interpolation",
"ShowRefPin:=", 0,
"RefNodeCheckbox:=", 1)))

CreatePagePort (Schematic Editor)


Create a PagePort

UI Access Draw>Page Connector

Name Type Description


<PagePortProps> Array Array("NAME:PagePortProps"),
Array("NAME:Attributes", _

Parameters "Page:=", int, _ // [Opt=1] Page number (one-based)


Note: Page 1 always exists
"X:=", double, _ // X position of the object
"Y:=", double, _ // Y position of the object

Schematic Scripting 31-27


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Angle:=", double, _ // Rotation angle (radians)


"Flip:=", bool), // True if mirrored
[out,retval] string id)

String
Return Value
Unique id

The pageport is created and it has the following format:


PagePort@<portName>;<schematicID>
The schematic ID can be found in the Properties window on the Symbols tab when you select the pageport.

Schematic Scripting 31-28


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax CreatePagePort()


oEditor.CreatePagePort
(["NAME:PagePortProps", "Name:=", "pageport_0", "Id:=", _

Python Example 12], ["NAME:Attributes", "Page:=",_


1, "X:=", -0.0381, "Y:=", -0.0127, "Angle:=", _
0, "Flip:=", false])

VB Syntax CreatePagePort()
oEditor.CreatePagePort
Array("NAME:PagePortProps", "Name:=", "pageport_0", "Id:=", _

VB Example 12), Array("NAME:Attributes", "Page:=",_


1, "X:=", -0.0381, "Y:=", -0.0127, "Angle:=", _
0, "Flip:=", false)

VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject

Schematic Scripting 31-29


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("Circuit1")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
PagePortID = oEditor.CreatePagePort(Array("NAME:PagePortProps", "Name:=", "pageport_0", "Id:=", _
177), Array("NAME:Attributes", "Page:=", 1, "X:=", 0.0889, "Y:=", 0.1651, "Angle:=", _
0, "Flip:=", false))
MsgBox "PagePort = " & PagePortID
CreateIPort (Schematic Editor)
Create an interface port

UI Access Draw>Interface Port

Name Type Description


<IPortProps> Array Array("NAME:IPortProps"),
Parameters
"Name:=", string), // [Opt=default name] Name for this port
"Id:=", int), // Port id number

Schematic Scripting 31-30


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<Attributes> Array Array("NAME:Attributes", _


"Page:=", int, _ // [Opt=1] Page number (one-based)

Note:

Page 1 always exists


"X:=", double, _ // X position of the object
"Y:=", double, _ // Y position of the object
"Angle:=", double, _ // Rotation angle (radians)
"Flip:=", bool), // True if mirrored
[out,retval] string id)

String
Return Value
Unique id

Interface port is created and the returned value has the following format:
IPort@<portName>;<schematicID>
The interface port schematic ID can be found in the Properties window on the Symbols tab.

Schematic Scripting 31-31


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax CreateIPort()


oEditor.CreateIPort (["NAME:IPortProps", "Name:=", _
"Port1", "Id:=", 4], ["NAME:Attributes","Page:=", _
Python Example
1, "X:=", -0.0381, "Y:=", 0.0127, "Angle:=",_
0, "Flip:=", false])

VB Syntax CreateIPort()
VB Example oEditor.CreateIPort Array("NAME:IPortProps", "Name:=",_

Schematic Scripting 31-32


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Port1", "Id:=", 4), Array("NAME:Attributes","Page:=", _


1, "X:=", -0.0381, "Y:=", 0.0127, "Angle:=",_
0, "Flip:=", false)

VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("Circuit1")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
IPortID = oEditor.CreateIPort(Array("NAME:IPortProps", "Name:=", "Port1", "Id:=", 189), Array
("NAME:Attributes", "Page:=", _
1, "X:=", 0.0889, "Y:=", 0.1651, "Angle:=", 0, "Flip:=", false))
MsgBox "IPort ID = " & IPortID

Schematic Scripting 31-33


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CreatePolygon (Schematic Editor)


Create a polygon

UI Access Draw>Primitive>Polygon

Name Type Description


<PolygonData> Array Array("NAME:PolygonData" _
"Points:=", Array of points, _
"LineWidth:=", double, // the width of the Polygon border, in meters
"Bordercolor:=", int, // the RBG value of the border color
"Fill:=", int, // the fill pattern id, 0 = hollow, 1 = solid, 2 = NEDiagonal,
Parameters
3 = OrthoCross, 4 = DiagCross, 5 = NWDiagonal, 6 = Horizontal, 7 = Vertical
"Color:=", int, // the RBG value of the Polygon fill color
"Id:=", int), // [Opt=New id] Id for this item
<Attributes> Array Array("NAME:Attributes", _
"Page:=", int) _ // [Opt=1] Page number (one-based)
[out,retval] string id)

String
Return Value
Unique id

Polygon is created and the return value has the format


SchObj@<schematicID>
The Schematic ID can be found in the Properties window on the Symbol tab when you select the polygon.

Schematic Scripting 31-34


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax CreatePolygon()


oEditor.CreatePolygon(
["NAME:PolygonData", "Points:=", [ _
"(-0.058951, 0.006308)", "(-0.046142, 0.010480)",_
Python Example
"(-0.046239, 0.001067)"), "LineWidth:=", _
0, "BorderColor:=", 0, "Fill:=", 0, "Color:=",_
0, "Id:=", 27], ["NAME:Attributes", "Page:=", 1]])

VB Syntax CreatePolygon()

Schematic Scripting 31-35


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.CreatePolygon
Array("NAME:PolygonData", "Points:=", Array( _
"(-0.058951, 0.006308)", "(-0.046142, 0.010480)",_
VB Example
"(-0.046239, 0.001067)"), "LineWidth:=", _
0, "BorderColor:=", 0, "Fill:=", 0, "Color:=",_
0, "Id:=", 27), Array("NAME:Attributes", "Page:=", 1)

VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("Circuit1")

Schematic Scripting 31-36


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Set oEditor = oDesign.SetActiveEditor("SchematicEditor")


polygonID = oEditor.CreatePolygon(Array("NAME:PolygonData", "Points:=", Array( _
"(0.101600, 0.058420)", "(0.101600, 0.060960)", "(0.101600, 0.058420)", _
"(0.099060, 0.060960)", "(0.101600, 0.060960)", "(0.101600, 0.058420)", _
"(0.101600, 0.060960)", "(0.101600, 0.060960)"), "LineWidth:=", 0, "BorderColor:=", _
0, "Fill:=", 0, "Color:=", 0, "Id:=", 218), Array("NAME:Attributes", "Page:=", 1))
MsgBox "Polygon ID = " & polygonID
CreateRectangle (Schematic Editor)
Create a rectangle

UI Access Draw>Primitive>Rectangle

Name Type Description


<RectData> Array Array("NAME:RectData" _
"x1:=", double, _ // X position of the upper left
"y1:=", double, _ // Y position of the upper left
"x2:=", double, _ // X position of the lower right
Parameters "y2:=", double",_ // Y position of the lower right
"LineWidth:=", double, // the width of the Rectangle border, in meters
"Bordercolor:=", int, // the RBG value of the border color
"Fill:=", int, // the fill pattern id, 0 = hollow, 1 = solid, 2 = NEDiagonal,
3 = OrthoCross, 4 = DiagCross, 5 = NWDiagonal, 6 = Horizontal, 7 = Vertical
"Color:=", int, // the RBG value of the Rectangle fill color

Schematic Scripting 31-37


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Id:=", int), // [Opt=New id] Id for this item


<Attributes> Array Array("NAME:Attributes", _
"Page:=", int) _ // [Opt=1] Page number (one-based)
[out,retval] string id)

String
Return Value
Unique id

Rectangle is created and the return value has the format


SchObj@<schematicID>
The Schematic ID can be found in the Properties window on the Symbol tab when you select the rectangle.

Schematic Scripting 31-38


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax CreateRectangle()


oEditor.CreateRectangle
(["NAME:RectData", "X1:=", -0.0755449856733525, "Y1:=", _
0.0335755491881566, "X2:=", -0.0611831900668577, "Y2:=", _
Python Example
0.0254242597898758, "LineWidth:=", _
0, "BorderColor:=", 0, "Fill:=", 0, "Color:=", 0, "Id:=", 31], _
["NAME:Attributes", "Page:=", 1])

VB Syntax CreateRectangle()
oEditor.CreateRectangle
Array("NAME:RectData", "X1:=", -0.0755449856733525, "Y1:=", _
0.0335755491881566, "X2:=", -0.0611831900668577, "Y2:=", _
VB Example
0.0254242597898758, "LineWidth:=", _
0, "BorderColor:=", 0, "Fill:=", 0, "Color:=", 0, "Id:=", 31), _
Array("NAME:Attributes", "Page:=", 1)

VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject

Schematic Scripting 31-39


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("Circuit1")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
rectangleID = oEditor.CreateRectangle(Array("NAME:RectData", "X1:=", 0.1016, "Y1:=", 0.0635,
"X2:=", _
0.10414, "Y2:=", 0.06096, "LineWidth:=", 0, "BorderColor:=", 0, "Fill:=", 0, "Color:=", _
0, "Id:=", 9), Array("NAME:Attributes", "Page:=", 1))
MsgBox "Rectangle ID = " & rectangleID
CreateText (Schematic Editor)
Create text

UI Access Draw>Primitive>Text

Name Type Description


Parameters <TextData> Array Array("NAME:TextData" _
"x:=", double, _ // X position of the object

Schematic Scripting 31-40


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"y:=", double, _ // Y position of the object


"Text:=", string, _ // Text to display
"Color:=", int, // the RBG value of the text color
"Id:=", int), // Id for this item
"ShowRect:=", bool, // true or false, whether to show the highlight rectangle for
the text
"X1:=", double, // the text rectangle left X value, in meters
"Y1:=", double, // the text rectangle upper Y value, in meters
"X2:=", double, // the text rectangle right X value, in meters
"Y2:=", double, // the text rectangle lower Y value, in meters
"RectLineWidth:=", double, // the width of the rectangle border, in meters
"RectBordercolor:=", int, // the RBG value of the rectangle border color
"RectFill:=", int, // the rectangle fill pattern id, 0 = hollow, 1 = solid,
2 = NEDiagonal, 3 = OrthoCross, 4 = DiagCross, 5 = NWDiagonal, 6 = Hori-
zontal, 7 = Vertical
"RectColor:=", int, // the RBG value of the rectangle fill color
<Attributes> Array Array("NAME:Attributes", _
"Page:=", int) _ // [Opt=1] Page number (one-based)
[out,retval] string id)

String
Return Value
Unique id

Text is created and the return value has the format: SchObj@<SchematicID>

Schematic Scripting 31-41


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

The Schematic ID can be found in the Properties window on the Symbols tab when you select the text.

Python Syntax CreateText()


oEditor.CreateText(
["NAME:TextData", "X:=", -0.0764183381088826, "Y:=", _
0.040174212034384, "Size:=", 12, "Angle:=",_
Python Example
0, "Text:=", "Con-
trol Circuit", "Color:=", _
0, "Id:=", 34, "ShowRect:=", false, "X1:=", _
-0.0793287547755609, "Y1:=", _

Schematic Scripting 31-42


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

0.0407033787010528, "X2:=", -0.0502245881087778,_


"Y2:=", 0.035411712034365, "RectLineWidth:=", _
0, "RectBorderColor:=", 0, "RectFill:=",
0, "RectColor:=", 0], ["NAME:Attributes", "Page:=", 1])

VB Syntax CreateText()
oEditor.CreateText
Array("NAME:TextData", "X:=", -0.0764183381088826, "Y:=", _
0.040174212034384, "Size:=", 12, "Angle:=",_
0, "Text:=", "Con-
trol Circuit", "Color:=", _
0, "Id:=", 34, "ShowRect:=", false, "X1:=", _
VB Example
-0.0793287547755609, "Y1:=", _
0.0407033787010528, "X2:=", -0.0502245881087778,_
"Y2:=", 0.035411712034365, "RectLineWidth:=", _
0, "RectBorderColor:=", 0, "RectFill:=",
0, "RectColor:=", 0), Array("NAME:Attributes", "Page:=", 1)

VB Example:
Dim oAnsoftApp
Dim oDesktop

Schematic Scripting 31-43


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("Circuit1")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
textobj = oEditor.CreateText(Array("NAME:TextData", "X:=", 0.10414, "Y:=", 0.06604, "Size:=", _
12, "Angle:=", 0, "Text:=", "CreateDefaultTectxt" & Chr(13) & Chr(10) & "", "Color:=", _
0, "Id:=", 286, "ShowRect:=", false, "X1:=", 0.100141851851836, "Y1:=", _
0.0670983333333376, "X2:=", 0.140123333333477, "Y2:=", 0.0565149999999619, "RectLineWidth:=", _
0, "RectBorderColor:=", 0, "RectFill:=", 0, "RectColor:=", 0), Array("NAME:Attributes", "Page:=",
_
1))
MsgBox "text = " & textobj
CreateWire (Schematic Editor)
Create a wire

Schematic Scripting 31-44


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Draw>Wire

Name Type Description


<WireData> Array Array("NAME:WireData" _
"Name:=", string), // [Opt=default name] Name for this wire
"Id:=", int), // Wire idnum
Parameters "Points:=", Points on wire)
<Attributes> Array Array("NAME:Attributes", _
"Page:=", int, _ // [Opt=1] Page number (one-based)
Note: Page 1 always exists
[out,retval] string id)

String
Return Value
Unique id

Wire is created and its return value has the format Wire@<netName>;<schematicID>;<segment index list>
The Schematic ID can be found in the Symbol tab of the Properties window when you select the wire. The wire net name appears in
the General tab. The parameter segment index list indicates the number of segments i.e. the segment count.

Schematic Scripting 31-45


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax CreateWire()


oEditor.CreateWire(
["NAME:WireData", "Name:=", "", "Id:=", 41, "Points:=", [ _
Python Example
"(-0.033020, 0.015240)", "(-0.017780, 0.015240)",
"(-0.017780, 0.012700)"]], ["NAME:Attributes", "Page:=", 1])

VB Syntax CreateWire()
VB Example oEditor.CreateWire

Schematic Scripting 31-46


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:WireData", "Name:=", "", "Id:=", 41, "Points:=", Array( _


"(-0.033020, 0.015240)", "(-0.017780, 0.015240)",
"(-0.017780, 0.012700)")), Array("NAME:Attributes", "Page:=", 1)

VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("Circuit1")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
WireID = oEditor.CreateWire(Array("NAME:WireData", "Name:=", "", "Id:=", 261, "Points:=", Array(
_
"(0.101600, 0.063500)", "(0.106680, 0.063500)", "(0.106680, 0.060960)")), Array("NAME:At-
tributes", "Page:=", _
1))
MsgBox "Wire ID = " & WireID

Schematic Scripting 31-47


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

General Method List


This section presents the general script methods that are available.
The general method script commands are listed here.
Activate (Schematic Editor)
AddPinGrounds (Schematic Editor)
AddPinIPorts (Schematic Editor)
AddPinPageConnectors (Schematic Editor)
AlignHorizontal (Schematic Editor)
AlignVertical (Schematic Editor)
BringToFront (Schematic Editor)
Close Editor (Schematic Editor)
Copy (Schematic Editor)
CopyData [Schematic Editor]
CopySubdesign [Schematic Editor]
CreatePage (Schematic Editor)
Cut (Schematic Editor)
DeactivateOpen (Schematic Editor)
DeactivateShort (Schematic Editor)
Delete (Schematic Editor)
DeletePage (Schematic Editor)

Schematic Scripting 31-48


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ElectricRuleCheck (Schematic Editor)


ExportImage (Schematic Editor)
FindElements (Schematic Editor)
FitToBorder [Schematic Editor]
GridSetup (Schematic Editor)
FlipHorizontal (Schematic Editor)
FlipVertical (Schematic Editor)
Move (Schematic Editor)
NameNets (Schematic Editor)
PageBorders (Schematic Editor)
Pan (Schematic Editor)
Paste (Schematic Editor)
PasteData [Schematic Editor]
PasteDesign (Schematic Editor)
PushExcitations (Schematic Editor)
Rotate (Schematic Editor)
ShowVariableBlock (Schematic Editor)
SelectAll (Schematic Editor)
SelectPage (Schematic Editor)
SendToBack(Schematic Editor)
SetPageData [Schematic]

Schematic Scripting 31-49


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SortComponents (Schematic Editor)


ZoomArea (Schematic Editor)
ZoomIn (Schematic Editor)
ZoomOut (Schematic Editor)
ZoomPrevious (Schematic Editor)
ZoomToFit (Schematic Editor)
Wire (Schematic Editor)
Activate (Schematic Editor)
Enable items previously disabled

UI Access Edit>Activate

Name Type Description


Parameters
Name Type Description

Return Value Value

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax Activate(["NAME:Selections","Selections:=", [<components>] ])

Schematic Scripting 31-50


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Example oEditor.Activate(["NAME:Selections","Selections:=", ["CompInst@STEP;1;1"]])

VB Syntax Activate Array("NAME:Selections", "Selections:=", Array("<components>"))


oEditor.Activate Array("NAME:Selections",
VB Example
"Selections:=", Array("CompInst@STEP;1;1"))

AddPinGrounds (Schematic Editor)


Adds grounds at all unconnected pins
AddPinGrounds (
Array("NAME:Selections", _ // PagePort Name
"Selections:=", _ // Net Name
Array("CompInst@CAP_;2;4"))

Note:

The format for Components is CompInst@<CompName>;<compInstID>;<optional schematicID>. In the documented


example, <CompName> stands for the component name CAP_, <compInstID> stands for its ID 2, and <optional schem-
aticID> is the schematic ID 4. If you select the component, the Properties window gets updated and displays its details.
For example, the selected object’s component name and ID appear in the General tab of the Properties window as shown
below.

Schematic Scripting 31-51


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

To view the SchematicID click the Symbol tab.

Schematic Scripting 31-52


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax AddPinPageConnectors ()


oEditor.AddPinPageconnectors["NAME:Selections",
Python Example "Selections:=", [ _
"CompInst@C;1;1"]]

AddPinIPorts (Schematic Editor)


Adds Interface Ports at unconnected pins of all selected components. Each port has a unique name.

Schematic Scripting 31-53


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Draw>Add at unconnected pins>Interface Ports

Name Type Description


Parameters <IntPortName,NetName> Array Array("NAME:Selections", _ // Interface Port Name
"Selections:=", _ // Net Name

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax AddPinIPorts ()


oEditor.AddPinIPorts

Python Example
["NAME:Selections", "Selections:=", ["CompInst@R;2;37"]]

VB Syntax AddPinIPorts ()
oEditor.AddPinIPorts
VB Example
Array("NAME:Selections", "Selections:=", Array("CompInst@R;2;37"))

Schematic Scripting 31-54


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AddPinPageConnectors (Schematic Editor)


Adds Page Ports at unconnected pins of all selected components

UI Access Draw>Add at unconnected pins>Grounds

Name Type Description


Parameters
Name Type Description

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax AddPinPageConnectors ()


oEditor.AddPinPageconnectors
Python Example ["NAME:Selections", "Selections:=", [ _
"CompInst@C;1;1"]]

VB Syntax AddPinPageConnectors ()
oEditor.AddPinPageconnectors
VB Example Array("NAME:Selections", "Selections:=", Array( _
"CompInst@C;1;1"))

Schematic Scripting 31-55


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AlignHorizontal (Schematic Editor)


Align items horizontally

UI Access Draw>Align Horizontal

Name Type Description


<Selections> Array Array("NAME:Selections", _
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify)
Parameters <AlignParameters> Array Array("NAME:AlignParameters", _
"Disconnect:=", bool _ // [Opt=0] Should wires disconnect
"Rubberband:=", bool) _ // [Opt=1] Should wires staircase
Note: Alignment occurs relative to the first item in ids

Return Value Value

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax AlignHorizontal()

Python
oEditor.AlignHorizontal (["NAME:Selections", "Selections:=", [ _
Example "CompInst@R;2;4", "CompInst@C;1;1"]], ["NAME:AlignParame-
ters", "Disconnect:=", _

Schematic Scripting 31-56


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

false, "Rubberband:=", false])

VB Syn- AlignHorizontal()
tax

oEditor.AlignHorizontal Array("NAME:Selections", "Selections:=", Array( _


VB
"CompInst@R;2;4", "CompInst@C;1;1")), Array("NAME:AlignParame-
ters", "Disconnect:=", _
Example
false, "Rubberband:=", false)

AlignVertical (Schematic Editor)


Align items vertically

UI Access Draw>Align Vertical

Name Type Description


<Selections> Array Array("NAME:Selections", _
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify)
Parameters <Align Para- Array Array("NAME:AlignParameters", _
meters>
"Disconnect:=", bool _ // [Opt=0] Should wires disconnect
"Rubberband:=", bool) _ // [Opt=1] Should wires staircase
Note: Alignment occurs relative to the first item in ids

Return Value None

Schematic Scripting 31-57


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python AlignVertical()
Syntax

oEditor.AlignVertical (["NAME:Selections", "Selections:=", ["CompInst@R;2;4", _


Python
"CompInst@C;1;1"]], ["NAME:AlignParameters", "Disconnect:=", false, "Rubberband:=", _
Example
false])

VB Syn- AlignVertical()
tax

oEditor.AlignVertical Array("NAME:Selections", "Selections:=", Array("CompInst@R;2;4",


_
VB
"CompInst@C;1;1")), Array("NAME:AlignParameters", "Discon-
nect:=", false, "Rub-
Example
berband:=", _
false)

BringToFront (Schematic Editor)


Bring the selected object to the front of the view

Schematic Scripting 31-58


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Draw>Bring to Front

Name Type Description


<Selections> Array ["NAME: Selections", "Selections:=",[<Selected Components>]]
<Selected Components>
Parameters
CompInst@DefName; ID, schematic ID , CompInst@DefName; ID, schematic
ID
CompInst@R;1,2

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax BringToFront( )


oEditor.BringToFront(
Python Example
["NAME:Selections", "Selections:=", ["SchObj@1"]])

VB Syntax BringToFront( )
oEditor.BringToFront
VB Example
Array("NAME:Selections", "Selections:=", Array("SchObj@1"))

Schematic Scripting 31-59


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CloseEditor (Schematic Editor)


Close an Editor

UI Access NA

Name Type Description


Parameters
None

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax CloseEditor()


Python Example oDefinitionEditor.CloseEditor()

VB Syntax CloseEditor
VB Example oDefinitionEditor.CloseEditor

Copy (Schematic Editor)


GeneralCopy

Schematic Scripting 31-60


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

// Copy items for pasting


Copy(
Array("NAME:Selections", _
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify))

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax Copy( )


oEditor.Copy (["NAME:Selections", "Selections:=",
Python Example
["CompInst@R;2;37", _ "CompInst@C;1;1"]])

CopyData [Schematic Editor]


Use: Copy graphic object or component properties for pasting.
Command: Edit> Copy Data (or Right-click on graphic object or component and select Copy Data)
Syntax: CopyData Array("NAME:Selections", "Selections:=", Array(<selections>))
Return Value: None.
Parameters: <selections>
Type: Comma-separated list of strings

Schematic Scripting 31-61


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Identifiers for each selected item to be copied, in the form CompInst@<id>, where id is the compname;ID;schematicID for each ele-
ment.
Example: Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
oEditor.CopyData Array("NAME:Selections", "Selections:=", Array("CompInst@Cap;1;1"))

CopySubdesign [Schematic Editor]


Copy components that represent subdesigns, as well as their represented designs, for pasting. The designs, when pasted, will be inde-
pendent, with unique names based on the original design.

UI Access (Right-click on hierarchical component) Copy as New Design

Name Type Description


<selections> Comma- Identifiers for each selected item to be copied, in the form CompInst@<id>,
Parameters separated where id is the compname;ID;schematicID for each element.
list of
strings

Return Value None

Python Syntax CopySubdesign (["NAME:Selections", "Selections:=", [<selections>]])


oEditor.CopySubdesign ([
"NAME:Selections", "Selections:=", [
Python Example
"CompInst@Simplorer2;23;17"]])

Schematic Scripting 31-62


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax CopySubdesign Array("NAME:Selections", "Selections:=", Array(<selections>))


oEditor.CopySubdesign Array(
VB Example "NAME:Selections", "Selections:=",
Array("CompInst@Simplorer2;23;17"))

CreatePage (Schematic Editor)


Create a page at the end of the existing pages

UI Access Schematic>New Page

Name Type Description


Parameters <PageName> String Name of the page that has been created
<PageNum> Integer Page Number

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

CreatePage(string name, // Page name


Python Syntax
[out,retval] int num) // Page number
Python Example oEditor.CreatePage ("TestPage1")

Schematic Scripting 31-63


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CreatePage( string name, // Page name


VB Syntax
[out,retval] int num) // Page number
VB Example oEditor.CreatePage "TestPage1"

Cut (Schematic Editor)


Cut Page Selection

UI Access Edit>Cut

Name Type Description


<Selections> Array Array("NAME:Selections", _
Parameters
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify))

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax Cut()


Python Example oEditor.Cut (["NAME:Selections", "Selections:=", ["CompInst@R;10;93"]])

Schematic Scripting 31-64


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax Cut()
oEditor.Cut Array("NAME:Selections",
VB Example
"Selections:=", Array("CompInst@R;10;93"))

DeactivateOpen (Schematic Editor)


Disable items and replace with an open circuit

UI Access Edit>Deactivate (Open)

Name Type Description


<Selections> Array Array("NAME:Selections", _
Parameters
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify))

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax DeactivateOpen()


oEditor.DeactivateOpen (["NAME:Selections",
Python Example
"Selections:=", [ "CompInst@R;2;37"]])

Schematic Scripting 31-65


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax DeactivateOpen()
oEditor.DeactivateOpen Array("NAME:Selections",
VB Example
"Selections:=", Array( "CompInst@R;2;37"))

DeactivateShort (Schematic Editor)


Disable items and replace with a closed circuit

UI Access Edit>Deactivate (Short)

Name Type Description


<Selections> Array Array("NAME:Selections", _
Parameters
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify))

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax DeactivateShort ()


oEditor.DeactivateShort(["NAME:Selections", "Selections:=", [ _
Python Example
"CompInst@R;2;37"])

Schematic Scripting 31-66


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax DeactivateShort ()
oEditor.DeactivateShort Array("NAME:Selections", "Selections:=", Array( _
VB Example
"CompInst@R;2;37"))

Delete (Schematic Editor)


Delete items

UI Access Edit>Delete

Name Type Description


<Selections> Array Array("NAME:Selections", _
Parameters
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify))

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax Delete()


oEditor.Delete (["NAME:Selections", "Selections:=",
Python Example
["CompInst@R;10;93"]])

Schematic Scripting 31-67


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax Delete()
oEditor.Delete Array("NAME:Selections", "Selections:=",
VB Example
Array("CompInst@R;10;93"))

DeletePage (Schematic Editor)


To reduce the number of pages in the schematic

UI Access Schematic>Remove Page

Name Type Description


Parameters
None

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax DeletePage(<pagenum>, <pagenum>*)


Python Example num = oEditor.DeletePage([1, 4])

VB Syntax DeletePage Array(<pagenum>[, <pagenum>]*)


VB Example Dim oEditor

Schematic Scripting 31-68


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Set num = oEditor.DeletePage Array(1, 4)

ElectricRuleCheck (Schematic Editor)


Check Electric Rule

UI Access Schematic>Electric Rule Check

Name Type Description


<ElectricRules> Array Array(string, ...), bool)
Array
Array of strings containing names of electric rules to perform.
Valid names are:
Parameters
"PinRule": Checks for components with unconnected pins
"OutputPinRule": Checks for nets with more than one output pin
bool
True if this should check all subcircuits
False if this should just check this circuit

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Schematic Scripting 31-69


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ElectricRuleCheck()


oEditor.ElectricRuleCheck (["PinRule",
Python Example
"OutputPinRule", "OverlapCompRule"], True)

VB Syntax ElectricRuleCheck()
oEditor.ElectricRuleCheck Array("PinRule",
VB Example
"OutputPinRule", "OverlapCompRule"), True

ExportImage (Schematic Editor)


To export a picture for a specified page of the current design to a file. The image size can also be specified. The filename extension
determines the type of image exported.

UI Access None.

Name Type Description


<filename> String The name of the file, with format-specific extension. Extensions supported are:
bmp, gif, jpg, jpeg, png, tif, tiff.
Parameters <pagenum> Integer The page number of the current schematic. Page numbers start at 1. If the num-
ber is out of range, the current schematic page will be printed.
<dx> Integer The width of the image. If dx is less than 160, 160 will be used for the width.
<dy> Integer The height of the image. If dy is less than 160, 160 will be used for the height.

Return Value None

Schematic Scripting 31-70


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax ExportImage (<filename>, <pagenum>, <dx>, <dy>)


oEditor.ExportImage ("c:\mysch.png", 1, 800, 400)
Python Example

VB Syntax ExportImage (<filename>, <pagenum>, <dx>, <dy>)


VB Example oEditor.ExportImage "c:\mysch.png", 1, 800, 400

FindElements (Schematic Editor)


Select elements based on properties

UI Access Edit>Find Elements

Name Type Description


<propname> String The name of the property, or "*" to search through all properties
<propvalue> String The value of the property, or a substring
<criterion> Integer 0 = Contains
Parameters 1 = Does not contain
2 = Exact match
<types> Integer 2 - components only
4 - graphic objects only

Schematic Scripting 31-71


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

8 - wires only
16 - ports only
Add the numbers to look through more types - 30 is a common number, search-
ing through everything
<match> Boolean True = match all of the properties specified
False = match any of the properties specified
<case> Boolean True = case-sensitive
False = not case-sensitive
<sub> Boolean True = search subcircuits as well as current schematic
False = only search current schematic
<only> Boolean True = search within current selections
False = search schematic(s)

Return Value Array of strings, the names of the elements selected

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

FindElements(["NAME:SearchProps", "Prop:=", [<propname>, <propvalue>, <criterion>)[, [<propname>, <prop-


Python Syntax value>, <criterion>]]*], ["NAME:Parameters", "Filter:=", <types>, "MatchAll:=", <match>, "MatchCase:=",
<case>, "SearchSubCkt:=", <sub>, "SearchSelectionOnly:=", <only>])
oEditor.FindElements(
Python Example
[

Schematic Scripting 31-72


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:SearchProps",
"Prop:=", ["CompName","",0]
],
[
"NAME:Parameters",
"Filter:=" , 30,
"MatchAll:=" , False,
"MatchCase:=" , False,
"SearchSubCkt:=" , True,
"SearchSelectionOnly:=" , False
])

FindElements(Array("NAME:SearchProps", "Prop:=", Array(<propname>, <propvalue>, <criterion>)[, Array


VB Syntax (<propname>, <propvalue>, <criterion>)]*), Array("NAME:Parameters", "Filter:=", <types>, "MatchAll:=",
<match>, "MatchCase:=", <case>, "SearchSubCkt:=", <sub>, "SearchSelectionOnly:=", <only>)
eltarray = oEditor.FindElements Array("NAME:SearchProps",
"Prop:=", Array("InstanceName", "R", 0)),
Array("NAME:Parame-
ters", "Filter:=",_2,
VB Example

"MatchAll:=", true, "MatchCase:=", false,

Schematic Scripting 31-73


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SearchSubCkt:=", false, "SearchSelectionOnly:=", false)

FitToBorder [Schematic Editor]


Use: To reset the schematic view to just include the page border, if any.

UI Access View>Fit Border

Name Type Description


Parameters
None

Return Value None

Python Syntax FitToBorder()


oEditor.FitToBorder()
Python Example

VB Syntax FitToBorder
VB Example oEditor.FitToBorder

FlipHorizontal (Schematic Editor)


Flip items about the horizontal (x) axis

UI Access NA

Schematic Scripting 31-74


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Name Type Description


<Selections> Array Array("NAME:Selections", _
"Page:=", page number, _ // [Opt=1] Page number
Parameters "Selections:=", IDs to modify))
<FlipParameters> Array Array("NAME: FlipParameters", _
"Disconnect:=", bool _ // [Opt=0] Should wires disconnect
"Rubberband:=", bool) _ // [Opt=1] Should wires staircase

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax FlipHorizontal(


oEditor.FlipHorizontal(
["NAME:Selections", "Selections:=", [ _

Python Example "CompInst@R;2;4", "CompInst@C;1;1"]],


["NAME:FlipParame-
ters",
"Disconnect:=", true, "Rubberband:=", false])

VB Syntax FlipHorizontal(

Schematic Scripting 31-75


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.FlipHorizontal
Array("NAME:Selections", "Selections:=", Array( _

VB Example "CompInst@R;2;4", "CompInst@C;1;1")),


Array("NAME:FlipParame-
ters",
"Disconnect:=", true, "Rubberband:=", false)

FlipVertical (Schematic Editor)


Flip items about the vertical (y) axis

UI Access NA

Name Type Description


<Selections> Array Array("NAME:Selections", _
"Page:=", page number, _ // [Opt=1] Page number
Parameters "Selections:=", IDs to modify))
<FlipParameters> Array Array("NAME:FlipParameters", _
"Disconnect:=", bool _ // [Opt=0] Should wires disconnect
"Rubberband:=", bool) _ // [Opt=1] Should wires staircase

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Schematic Scripting 31-76


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax FlipVertical(


oEditor.FlipVertical (["NAME:Selections",

Python Example
"Selections:=", ["CompInst@R;2;4", _
"CompInst@C;1;1"]], ["NAME:FlipParameters",
"Disconnect:=", true, "Rubberband:=", false])

VB Syntax FlipVertical(
oEditor.FlipVertical Array("NAME:Selections",
"Selections:=", Array("CompInst@R;2;4", _
VB Example
"CompInst@C;1;1")), Array("NAME:FlipParameters",
"Disconnect:=", true, "Rubberband:=", false)

GridSetup (Schematic Editor)


Changes the settings on the schematic grid

UI Access Schematic>Grid Setup

Name Type Description


<Options> Array Array("NAME:Options", _

Parameters "MajorGrid:=", string, _ // Major grid size with units


"Divisions:=", int, _ // Number of minor grid divisions
"MajorColor:=", int, _ // RGB Color of major grid lines

Schematic Scripting 31-77


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MinorColor:=", int, _ // RGB Color of minor grid lines


"ShowGrid:=", bool, _ // Should the grid be shown?
"SnapToGrid:=", bool, _ // Should objects snap to grid?
"BackgroundColor:=", int, _ // RGB Color of the background
"SaveAsDefault:=", bool))

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax GridSetup()


oEditor.GridSetup([
"NAME:Options", _
"MajorGrid:=", "10mm", _

Python Example "Divisions:=", 10, _


"MajorColor:=", 0x00ff0000, _ # Red
"MinorColor:=", 0x0000ff00, _ # Green
"ShowGrid:=", true, _

Schematic Scripting 31-78


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SnapToGrid:=", true, _
"BackgroundColor:=", 0x00ffffff, _ # White
"SaveAsDefault:=", false])

VB Syntax GridSetup()
oEditor.GridSetup
Array(
"NAME:Options", _
"MajorGrid:=", "10mm", _
"Divisions:=", 10, _

VB Example "MajorColor:=", 0x00ff0000, _ // Red


"MinorColor:=", 0x0000ff00, _ // Green
"ShowGrid:=", true, _
"SnapToGrid:=", true, _
"BackgroundColor:=", 0x00ffffff, _ // White
"SaveAsDefault:=", false)

For example:
oEditor.GridSetup Array(
"NAME:Options", _
"MajorGrid:=", "10mm", _

Schematic Scripting 31-79


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Divisions:=", 10, _
"MajorColor:=", 0x00ff0000, _ // Red
"MinorColor:=", 0x0000ff00, _ // Green
"ShowGrid:=", true, _
"SnapToGrid:=", true, _
"BackgroundColor:=", 0x00ffffff, _ // White
"SaveAsDefault:=", false)
Move (Schematic Editor)
Move items

UI Access NA

Name Type Description


<Selections> Array Array("NAME:Selections", _
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify))
<MoveParameters> Array Array("NAME:MoveParameters", _
Parameters
"xdelta:=", double _ // X distance to move
"ydelta:=", double _ // Y distance to move
"Disconnect:=", bool _ // [Opt=0] Should wires disconnect
"Rubberband:=", bool) _ // [Opt=1] Should wires staircase

Return Value None

Schematic Scripting 31-80


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax Move()


oEditor.Move (["NAME:elements", "circle_0", "rect_2"],
Python Example
[0.0165613577023499, -0.001])

VB Syntax Move()
oEditor.Move Array("NAME:elements", "circle_0", "rect_2"),
VB Example
Array(0.0165613577023499, -0.001)

NameNets (Schematic Editor)


Change names of nets on the schematic

UI Access Schematic>Auto-Name Wires

Name Type Description


Parameters
None

Return Value None

Schematic Scripting 31-81


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

NameNets(
bool display, // Show Net names or not
["NAME:NetNames", _
Python Syntax
"string:=", _ #Old name of the net (e.g. net_1)
string, _ #New name of the net (e.g. my_net)
...]) # Repeat for additional nets to change
oEditor.NameNets (True, ["NAME:NetNames",
Python Example
"Wire@net_2;41:1:=", "A[0]"])

NameNets(
bool display, // Show Net names or not
Array("NAME:NetNames", _
VB Syntax
"string:=", _ // Old name of the net (e.g. net_1)
string, _ // New name of the net (e.g. my_net)
...) // Repeat for additional nets to change

Schematic Scripting 31-82


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.NameNets true, Array("NAME:NetNames",


VB Example
"Wire@net_2;41:1:=", "A[0]")

PageBorders (Schematic Editor)

Note:

This command has been replaced with the SetPageData command. Legacy scripts using this command will play back for
the first page of a schematic only.

Sets up visible page borders on the schematic


PageBorders(
Array("NAME:Options", _
"PageSize:=", _
Array("x:=", string, _ // Width of page border with units
"y:=", string), _ // Height of page border with units
"PageMargins:=", _
Array("x:=", string, _ // Margin Width with units
"y:=", string), _ // Margin Height with units
"ZonesHoriz:=", int, _ // Number of Horizontal zones
"ZonesVert:=", int)) // Number of Vertical zones

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Schematic Scripting 31-83


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Pan (Schematic Editor)


Pan Display

UI Access View>Pan

Name Type Description


Parameters
None

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Pan([
Python Syntax double, _ // Move the visible area by X meters
double]) // Move the visible area by Y meters
oDefinitionEditor.Pan
Python Example
([-0.00922653869663931, 0.00686839904222147])

Schematic Scripting 31-84


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Pan(Array(
VB Syntax double, _ // Move the visible area by X meters
double)) // Move the visible area by Y meters
oDefinitionEditor.Pan
VB Example
Array(-0.00922653869663931, 0.00686839904222147)

Paste (Schematic Editor)


Paste copied items

UI Access Edit>Paste

Name Type Description


Parameters
None

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax Paste( VARIANT attrs)# specified attributes


oEditor.Paste (["NAME:Attributes",
Python Example "Page:=", 1, "X:=", -0.059131200000001, "Y:=",_
0.030784799999999, "Angle:=", 0, "Flip:=",false])

Schematic Scripting 31-85


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax Paste(VARIANT attrs); // specified attributes


oEditor.Paste Array("NAME:Attributes",
VB Example "Page:=", 1, "X:=", -0.059131200000001, "Y:=",_
0.030784799999999, "Angle:=", 0, "Flip:=",false)

PasteData [Schematic Editor]


Use: Paste graphic object or component properties to another object or component.
Command: Edit> Paste Data (or Right-click on graphic object or component and select Paste Data)
Syntax: PasteData Array("NAME:Selections", "Selections:=", Array(<selections>), "SelectList:=", Array(<select_prop_display>,
<select_parameters>), "Exclude:=", Array(<ExcludeList>))
Return Value: None.
Parameters: Selections
Type: Comma separated component instance list where user wants to paste data
Identifiers for each selected item to be copied, in the form CompInst@<id>, where id is the compname;ID;schematicID for each ele-
ment.
SelectList
Type: Comma separated Boolean list where:
<select_prop_display> true to paste property displays
<select_parameters> true to paste parameters
<ExcludeList>
Type: Comma separated list of property names to exclude from being pasted.

Schematic Scripting 31-86


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Example: Set oEditor = oDesign.SetActiveEditor("SchematicEditor")


oEditor.PasteData Array("NAME:Selections", "Selections:=", Array("CompInst@Cap;2;3"),
"SelectList:=", Array(true, true), "Exclude:=", Array("IC"))
PasteDesign (Schematic Editor)
Paste a design that has already been copied to the clipboard into schematic as a subdesign.
Syntax:
PasteDesign(
pasteOption , // see below for values
Array("NAME:Attributes", _
"Page:=", int, _ // [Opt=1] Page number (one-based)
// Note: Page 1 always exists
"X:=", double, _ // X position of the object
"Y:=", double, _ // Y position of the object
"Angle:=", double, _ // Rotation angle (radians)
"Flip:=", bool) // True if mirrored
)
Return Value: Component is created and the returned value has the format CompInst@<CompName>;<compInstID>;<optional
schematicID>
For instance a return value CompInst@CAP_;4;35 indicates that the component name is CAP_, its ID is 5, and its Schem-
atic ID is 35. These details can be found in the Properties window when you select the created component. The component
name and ID can be found in the Gen-eral tab and the Schematic ID can be found in the Symbols tab.
Parameters: pasteOption should be one of the following:
0 to link to the existing design that was copied

Schematic Scripting 31-87


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

1 to create a new copy of the design that was copied but keep the original layers of the design being copied
2 to create a new copy of the design and merge the layers of the design being copied into the design receiving the copy

VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("SimpleCircuitPaste")
oProject.CopyDesign "D"
Set oDesign = oProject.SetActiveDesign("A")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
oEditor.PasteDesign 1, Array("NAME:Attributes", "Page:=", 1, "X:=", 0.0762, "Y:=", _
0.0635, "Angle:=", 0, "Flip:=", false)

Schematic Scripting 31-88


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

PushExcitations
Allows access to computed excitations for transient and linear frequency solutions. The script command can be accessed from three
locations.

l Layout Editor
UI Access l Schematic Editor
l Select a Nexxim solution in a 3D Layout design, right click, and choose Push Excitations.

Name Type Description


<Reference Designation> String "<refdes>"
This argument is empty when excitations are pushed from a Nexxim
solution.
<PushExcitations Para- Array This parameter changes depending on whether the excitations
meters> comes from a transient or linear frequency solution. The keyword
"transient:=" indicates to AEDT which solution generated the
excitations. If "transient:=" is present, "CalcThevenin ="
and its value are ignored.
For a linear frequency solution, use this array:
Parameters
Array("NAME:options",
"CalcThevenin =" , <true|false>,
"Sol:=", "<solution name>")
If CalcThevenin is true, Thevenin’s equivalent is calculated. Para-
meters for the linear frequency solution do not include a Freq argu-
ment, so all frequencies from the solution are used.
For a transient solution, use:
Array("NAME:options",

Schematic Scripting 31-89


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"transient:=", Array(
"start:=", <start time>,
"stop:=", <stop time>,
"maxHarmonics:=", <max harmonics>,
"winType:=", <window>,
["widthPct:=", <width percentage>,]
["kaiser:=", <Kaiser value>,]
["correctCoherentGain:=", true]),
"Sol:=", "<solution name>")
winType can have the following values:
l Rectangular
l Bartlett
l Blackman
l Hamming
l Hanning
l Kaiser
l Welch
l Weber
l Lanzcos

Return Value None

Schematic Scripting 31-90


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

PushExcitations "<refdes>", Array("NAME:options", "transient:=",


["CalcThevenin =" , <true>], Array("start:=", <start time>, "stop:=", <stop time>,
VB Syntax "maxHarmonics:=", <max harmonics>, "winType:=", <window>,
["widthPct:=", <width percentage>,] ["kaiser:=", <Kaier value>,]
["correctCoherentGain:=", true]), "Sol:=", "<solution name>")

For a transient solution:


Set oEditor = oDesign.SetActiveEditor("Layout")
oEditor.PushExcitations "U3", Array("NAME:options", _
"transient:=", Array("start:=", 0, "stop:=", 5E-005, _
"maxHarmonics:=", 100, "winType:=", "Rectangular", _
"widthPct:=", 100, "kaiser:=", 0, "correctCoherentGain:=",_
VB Example true), "Sol:=", "Transient")

Set oDesign = oProject.SetActiveEditor("Design1")


oDesign.PushExcitations "", Array("NAME:options", _
"transient:=", Array("start:=", 0, "stop:=", 1E-08, _
"maxHarmonics:=", 100, "winType:=", "Hamming", _
"widthPct:=", 100, "kaiser:=", 0, "correctCoherentGain:=",_

Schematic Scripting 31-91


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

true), "Sol:=", "Transient Setup 1")

For a linear frequency solution:


Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
oEditor.PushExcitations "S1", Array("NAME:options", _
"CalcThevenin:=", false, "Sol:=", "LinearFrequency")

Rotate (Schematic Editor)


Rotate items

UI Access Draw>Rotate

Name Type Description


<Selections> Array Array("NAME:Selections", _
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify))
<RotateParameters> Array Array("NAME:RotateParameters", _
Parameters
"Disconnect:=", bool _ // [Opt=0] Should wires disconnect
"Rubberband:=", bool _ // [Opt=1] Should wires staircase
"Angle:=", double) // [Opt=/2] Angle to rotate
Note: Rotation occurs around center of ids

Return Value None

Schematic Scripting 31-92


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note:

When you record a script, the schematic editor's Rotate command shows the rotation angle for some older scripts in radi-
ans, while newer scripts show rotation angle in degrees.

oEditor.Rotate Array("NAME:Selections", "Selections:=", _

Array("CompInst@RES_;1;1:1")), Array("NAME:RotateParameters", _

"Angle:=", 1.5707963267949, "Disconnect:=", false, "Rubberband:=", false)

If "Degrees=xxx" is not shown, the rotation must be scaled.

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax Rotate()


oEditor.Rotate (["NAME:Selections", "Selections:=",
["CompInst@R;2;4", "CompInst@C;1;1"]],
Python Example
["NAME:RotateParameters","Degrees:=", 90, "Disconnect:=", _
false, "Rubberband:=", false])

Schematic Scripting 31-93


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax Rotate()
oEditor.Rotate Array("NAME:Selections", "Selections:=",
Array("CompInst@R;2;4", "CompInst@C;1;1")),
VB Example
Array("NAME:RotateParameters","Degrees:=", 90, "Disconnect:=", _
false, "Rubberband:=", false)

SelectAll (Schematic Editor)


Select all elements on the given page.

UI Access Edit>Select All

Name Type Description


Parameters
None

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

SelectAll(int pageNum) # Page number


Python Syntax
The first page number is 1. If an invalid page number is passed in (i.e. 0, -1, etc), SelectAll will use the active
page on the currently active view. If there is no active view, the first page, page 1, is used.
Python Example oEditor.SelectAll(1)

Schematic Scripting 31-94


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SelectAll(int pageNum) // Page number


VB Syntax The first page number is 1. If an invalid page number is passed in (i.e. 0, -1, etc), SelectAll will use the active
page on the currently active view. If there is no active view, the first page, page 1, is used.
VB Example oEditor.SelectAll 1

SelectPage (Schematic Editor)


Select a page in the UI

UI Access NA

Name Type Description


Parameters
None

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax SelectPage(int page) # Page number


Python Example oEditor.SelectPage(1)

VB Syntax SelectPage(int page) // Page number

Schematic Scripting 31-95


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oEditor.SelectPage 1

SendToBack
Send the selected object to the back of the view

UI Access Draw>Send To Back

Name Type Description


Parameters
<Object> String Object to send to the back.

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs

Python Syntax SendToBack (["NAME:Selections", "Selections:=", [<Object>, <Object>, ...]])


oDefinitionEditor.SendToBack(["NAME:Selections",
Python Example
"Selections:=", ["SchObj@10"]])

VB Syntax SendToBack Array("NAME:Selections", "Selections:=", Array (<Object>, <Object>, ...))


oDefinitionEditor.SendToBack Array("NAME:Selections",
VB Example
"Selections:=", Array( "SchObj@10"))

Schematic Scripting 31-96


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetPageData [Schematic Editor]

Note:

This command replaces the PageBorders command.

To add or remove page border, title block and page property data from the specified page. Title blocks will not be shown if the page
border type is "None". Any number of title blocks may be specified, as well as any number of page properties. Some of the page prop-
erties are special and their values will be updated automatically as appropriate, such as Project, ProjectPath, Design, Number and
Date.

UI Access Schematic>Page Borders and Title Blocks...

Name Type Description


<bordertype> String One of: "None", "Outline", "ANSI", "ISO", "DIN"
<sizeX> Double Size of X axis
(with units)
<sizeY> Double Size of Y axis
(with units)
<marginX> Double Margin of X axis
(with units)
<marginY> Double Margin of Y axis
Parameters
(with units)
<zonesH> Integer
<zonesV> Integer
<symbolName> String The name of the title block symbol.
<libName> String The name of the library (with path from library directory root) that contains the
title block symbol
<Hsnap> String One of: "Left", "Right", "Center", "None"
<Vsnap> String One of "Top", "Bottom", "Center", "None"
<rotation> String One of "0", "90", "270"

Schematic Scripting 31-97


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<propName> String The name of a page property followed by ":="


<propVal> String The value of a page property

Return Value None

SetPageData (<pagenum>,
["NAME:Border", "BorderType:=", <bordertype>, "Page-
Size:=", ["x:=", <sizeX>,
"y:=", <sizeY>],
"PageMargins:=", ["x:=", <marginX>,
"y:=", <marginX>],"ZonesHoriz:=", <zonesH>,
Python Syntax
"ZonesVert:=", <zonesV>],
["NAME:TitleBlocks"[, "TitleBlock:=",
[<symbolName>, <libName>, <Hsnap>, <Vsnap>,
<rotation>, -1)]*],
["NAME:PageProps"[, <propName>, <propVal>]*])

oEditor.SetPageData (1, ["NAME:Border",


"BorderType:=", "ANSI", "PageSize:=", ["x:=", "11in", "y:=", "8.5in"],

Python Example "PageMargins:=", ["x:=", "0.38in", "y:=", "0.25in"], "ZonesHoriz:=",


2, "ZonesVert:=", 2], ["NAME:TitleBlocks", "TitleBlock:=", ["TitleBlk1",
"TitleBlocks", "Right", "Bottom", "0", -1]], ["NAME:PageProps",

Schematic Scripting 31-98


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Title:=", "Design Title", "Author:=", "I. M. User", "Number:=", "1",


"Project:=", "Project8", "ProjectPath:=", "e:/projects/",
"Design:=", "TwinBuilder1", "Date:=", "9:53:11 PM Jan 27, 2016"])

SetPageData (<pagenum>,
Array("NAME:Border", "BorderType:=", <bordertype>, "Page-
Size:=", Array("x:=",
<sizeX>, "y:=", <sizeY>),
"PageMargins:=", Array("x:=", <marginX>,
"y:=", <marginX>),"ZonesHoriz:=", <zonesH>,
VB Syntax
"ZonesVert:=", <zonesV>),
Array("NAME:TitleBlocks"[, "TitleBlock:=",
Array(<symbolName>, <libName>, <Hsnap>, <Vsnap>,
<rotation>, -1)]*),
Array("NAME:PageProps"[, <propName>, <propVal>]*)

Dim oEditor
oEditor.SetPageData 1, Array("NAME:Border",
"BorderType:=", "ANSI", "PageSize:=", Array("x:=", "11in", "y:=", "8.5in"),
VB Example
"PageMargins:=", Array("x:=", "0.38in", "y:=", "0.25in"), "ZonesHoriz:=",
2, "ZonesVert:=", 2), Array("NAME:TitleBlocks", "TitleBlock:=", Array("TitleBlk1",
"TitleBlocks", "Right", "Bottom", "0", -1)), Array("NAME:PageProps",

Schematic Scripting 31-99


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Title:=", "Design Title", "Author:=", "I. M. User", "Number:=", "1",


"Project:=", "Project8", "ProjectPath:=", "e:/projects/",
"Design:=", "TwinBuilder1", "Date:=", "9:53:11 PM Jan 27, 2016")

ShowVariableBlock (Schematic Editor)


Use: Control display of Variable Text Block in Schematic Editor.
Command: Schematic Ribbon > Settings > Design Variables
Syntax: ShowVariableBlock("True") // Display Text Block
ShowVariableBlock("False") // Hide Text Block
Return Value: None.
Parameters: True // Display Text Block
False // Hide Text Block

Python Syntax ShowVariableBlock ()

oEditor ShowVariableBlock
[
Python Example
("True")
]

SortComponents (Schematic Editor)


Sorts all components, or a block of components, using the specified method

Schematic Scripting 31-100


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Schematic>Sort Components

Name Type Description


<Type> Array Array(type, _ // string specifying sort type
method)) // string specifying sort method type
Parameters // string argument specifying sort type: "All Components" or "Blocks"
// An empty string corresponds to "All Components" method
// string argument specifying sort method: "By Name", "Left to Right", or "Signal
Flow"

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax SortComponents ()


Python Example oEditor.SortComponents()

VB Syntax SortComponents ()
VB Example oEditor.SortComponents

Wire (Schematic Editor)


Use: Wire specified pairs of pins in two selected component instances.
Command: Select two component instances in the Schematic Editor, then right click on one and choose Wire.

Schematic Scripting 31-101


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax:

Wire (string firstComponent, _


string firstListOfPins, _// list of pins separated by space
string secondComponent, _
string secondListOfPins ) //second list of pins separated by space
Return Value: None
VB Example: oEditor.Wire "CompInst@etch_sline_s20_z70_1;10;76", "A1 A2", "Com-
pInst@CX0805MRNPO9BB220;1;1", "B1 B2"
ZoomArea (Schematic Editor)
Zoom Area

UI Access View>Zoom Area

Name Type Description


<Size> Array Array(double, _
//Base X value of the area to zoom into double),

Parameters _ // Base Y value of the area to zoom into


Array(double, _ // X size of the area to zoom
double)) // Y Size of the area to zoom
NOTE: All values in meters

Return Value None

Schematic Scripting 31-102


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax ZoomArea()


oEditor.ZoomArea ([0.00307569800375911, 0.021101611633739],
Python Example
[-0.050433530091516, -0.0220260723256825])

Python Syntax ZoomArea()


oEditor.ZoomArea ([0.00307569800375911, 0.021101611633739],
Python Example
[-0.050433530091516, -0.0220260723256825])

ZoomIn (Schematic Editor)


Zoom into the schematic

UI Access View>Zoom In

Name Type Description


Parameters
None

Return Value None

Schematic Scripting 31-103


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax ZoomIn()


Python Example oEditor.ZoomIn()

VB Syntax ZoomIn()
VB Example oEditor.ZoomIn

ZoomOut (Schematic Editor)


Zoom out from the schematic

UI Access View>Zoom Out

Name Type Description


Parameters
None

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Schematic Scripting 31-104


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ZoomOut()


Python Example oEditor.ZoomOut()

VB Syntax ZoomOut()
VB Example oEditor.ZoomOut

ZoomPrevious (Schematic Editor)


Restore the zoom to the previous settings

UI Access NA

Name Type Description


Parameters
None

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax ZoomPrevious()


Python Example oEditor.ZoomPrevious()

Schematic Scripting 31-105


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax ZoomPrevious()
VB Example oEditor.ZoomPrevious

ZoomToFit (Schematic Editor)


Set the Zoom to Fit

UI Access View>Fit Drawing

Name Type Description


Parameters
None

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax ZoomToFit()


Python Example oEditor.ZoomToFit()

VB Syntax ZoomToFit()
VB Example oEditor.ZoomToFit

Schematic Scripting 31-106


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Property Method List


This section presents the property script methods that are available.
ChangeProperty (Schematic Editor)
GetEvaluatedPropertyValue (Schematic Editor)
GetProperties (Schematic Editor)
GetPropertyAttribute [Schematic Editor]
GetPropertyValue (Schematic Editor)
SetPropertyValue (Schematic Editor)
ChangeProperty (Schematic Editor)
Change a property

UI Access NA

Name Type Description


Parameters
Name Type Description

Return Value Value

Python Syntax ChangeProperty()


oEditor.ChangeProperty(["NAME:AllTabs",
["NAME:ComponentTab", ["NAME:PropServers", _
Python Example
"Wire@net_1;14:1"], ["NAME:ChangedProps",
["NAME:NetName", "ExtraText:=", _

Schematic Scripting 31-107


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"net_10", "Name:=", "net_10", "SplitWires:=", false]]])

VB Syntax ChangeProperty()
oEditor.ChangeProperty Array("NAME:AllTabs",
Array("NAME:ComponentTab", Array("NAME:PropServers", _
VB Example "Wire@net_1;14:1"), Array("NAME:ChangedProps",
Array("NAME:NetName", "ExtraText:=", _
"net_10", "Name:=", "net_10", "SplitWires:=", false))))

GetEvaluatedPropertyValue (Schematic Editor)


Get value.
Command: None.
Syntax: GetEvaluatedPropertyValue<tabDescription, componentID, propName>
Return Value: Evaluated value of variable property in double format.
Parameters: tabDescription = name of property tab where property is found
componentID = id of component instance where property is found,
in the format: "CompInst@<name of component type>;<id of compInstance>"
propName = name of the variable property
VB Example:
dim info

Schematic Scripting 31-108


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

evalValue = oEditor.GetEvaluatedPropertyValue("PassedParameterTab", "CompInst@CAP_;3", "C")


Notes:
1. This function is only available with the schematic editor.
2. Calling this function on non-numeric properties (e.g. Text properties) returns 0.

GetProperties (Schematic Editor)


To get the names of properties for a specified tab and element.

UI Access NA

Name Type Description


Parameters
<tab> String One of six choices, "PassedParameterTab", "ComponentTab", "Component",
"BaseElementTab", "Quantities", "Signals"
<objectId> String Instance ID of object with the property

Return Value Array of strings, the property names

Python Syntax GetProperties(<tab>, <objectId>)


comparray = oEditor.GetAllComponents()
for i in comparray:
instval = oEditor.GetPropertyValue
Python Example
("PassedParameterTab",i,"InstanceName")
proparray = oEditor.GetProperties ("Quantities",i)
for j in proparray:

Schematic Scripting 31-109


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

direction = oEditor.GetPropertyAttribute
("Quantities",i, j, "Direction")

AddInfoMessage(str(j) + " = (direction) " +


str(direction))

VB Syntax GetProperties(<tab>, <objectId>)


comparray = oEditor.GetAllComponents
for each i in comparray
instval = oEditor.GetPropertyValue ("PassedParameterTab",i,"InstanceName")
proparray = oEditor.GetProperties ("Quantities",i)
for each j in proparray
VB Example direction = oEditor.GetPropertyAttribute
("Quantities",i, j, "Direction")

MsgBox j + " = (direction) " + direction


next
next

Schematic Scripting 31-110


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetPropertyAttribute [Schematic Editor]


To find the value of an attribute of a specified property.

UI Access NA

Name Type Description


<tab> String One of six choices, "PassedParameterTab", "ComponentTab", "Component",
"BaseElementTab", "Quantities", "Signals"
Parameters <objectId> String Instance ID of object with the property
<propName> String The name of the property
<attribute> String Currently, only the "Direction" attribute is supported. Return values will be one
of "In", "Out" or "InOut"

Return Value A string, the attribute's value.

Python Syntax GetPropertyAttribute(<tab>, <objectId>, <propName>, <attribute>)


comparray = oEditor.GetAllComponents()
for i in comparray:
instval = oEditor.GetPropertyValue
("PassedParameterTab",i,"InstanceName")
Python Example proparray = oEditor.GetProperties ("Quantities",i)
for j in proparray:
direction = oEditor.GetPropertyAttribute
("Quantities",i, j, "Direction")
AddInfoMessage(str(j)+ " = (direction) " +

Schematic Scripting 31-111


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

str(direction))

VB Syntax GetPropertyAttribute(<tab>, <objectId>, <propName>, <attribute>)


comparray = oEditor.GetAllComponents
for each i in comparray

instval = oEditor.GetPropertyValue ("PassedParameterTab",i,"InstanceName")

proparray = oEditor.GetProperties ("Quantities",i)

VB Example
for each j in proparray

direction = oEditor.GetPropertyAttribute("Quantities",i, j, "Direction")


MsgBox j + " = (direction) " + direction

next
next

GetPropertyValue (Schematic Editor)


Get a property

UI Access NA

Parameters Name Type Description

Schematic Scripting 31-112


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<tab> String Tab with the property


<item> String Name of the object
<propname> String Name of the property
<value> String Value of the property

Return Value None

Python Syntax GetPropertyValue(<tab>,<item>,<propname>,<value>)


Python Example None

VB Syntax GetPropertyValue(<tab>,<item>,<propname>,<value>)

Please refer to the examples that can be found in C:\Program Files\...[Ansys Installation]...\Examples\Twin Build-
VB Example
er\Applications\Scripting\Ex6_MathMod

SetPropertyValue (Schematic Editor)


Set a property.

UI Access NA

Name Type Description


<tab> String Tab with the property
Parameters <item> String Name of the objects
<propname> String Name of the property
<value> String The new value of the property

Return Value None

Schematic Scripting 31-113


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax SetPropertyValue(<params>)


Python Example None

VB Syntax SetPropertyValue(<params>)

Please refer to the examples that can be found in C:\Program Files\...[Ansys Installation]...\Examples\Twin Build-
VB Example
er\Applications\Scripting\Ex6_MathMod

Information Method List


This section presents the information methods that are available.
GetCompInstanceFromRefDes (Schematic Editor)
GetComponentInfo (Schematic Editor)
GetComponentPins (Schematic Editor)
GetComponentPinInfo (Schematic Editor)
GetComponentPinLocation [Schematic Editor]
GetEditorName (Schematic Editor)
GetNetConnections (Schematic Editor)
GetNumPages [Schematic Editor]
GetPortInfo (Schematic Editor)
GetSelections (Schematic Editor)

Schematic Scripting 31-114


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetSignals (Schematic Editor)


GetAllPorts
Get all ports in a design.

UI Access NA

Name Type Description


Parameters
None

Return Value Ports in the design

Python Syntax GetAllPorts()


oEditor.GetAllPorts()
Python Example

VB Syntax GetAllPorts
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
VB Example
oEditor.GetAllPorts()

GetCompInstanceFromRefDes (Schematic Editor)


Informational

UI Access NA

Parameters Name Type Description

Schematic Scripting 31-115


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Component String Name of the Component

Return Value Returns IDispatch for CompInstance

GetCompInstanceFromRefDes(string)
Python Syntax
# string is refDes for the component
GetCompInstanceFromRefDes("R1")
Python Example

GetCompInstanceFromRefDes(string)
VB Syntax
// string is refDes for the component
VB Example GetCompInstanceFromRefDes("R1")

GetComponentInfo (Schematic Editor)


Informational

UI Access NA

Name Type Description


Parameters <compID> String The Schematic component’s ID, obtained from GetSelections or through
FindElements

Array of Strings, as follows:


Return Value
"Page=number"

Schematic Scripting 31-116


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ComponentName=string"
"GateCount=number"
"LocationX=number"
"LocationY=number"
"BBoxLLx=number"
"BBoxLLy=number"
"BBoxURx=number"
"BBoxURy=number"
"Angle=number" (in degrees)
"Flip=true or false"

Python Syntax GetComponentInfo(<compID>)


For i in selectionArray:
compArray = oEditor.GetComponentInfo(i)
For Each k in compArray:
Python Example
AddInfoMessage(str(k) +
"Got with GetComponentInfo")

VB Syntax GetComponentInfo<compID>

Schematic Scripting 31-117


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

selectionArray = oEditor.GetSelections
For Each i in selectionArray
compArray = oEditor.GetComponentInfo(i)

VB Example For Each k in compArray


MsgBox k, 0, "GetComponentInfo"
Next
Next

GetComponentPins (Schematic Editor)


Informational

UI Access NA

Name Type Description


Parameters <compID> String The Schematic component’s ID, obtained from GetSelections or through
FindElements.

Return Value Array of strings, which are the names of all the component's pins

Python Syntax GetComponentPins(<compID>)


selectionArray = oEditor.GetSelections()
Python Example for i in selectionArray
pinArray = oEditor.GetComponentPins(i)

Schematic Scripting 31-118


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

for j in pinArray
AddInfoMessage("Pin: " + str(j))

VB Syntax GetComponentPins<compID>
selectionArray = oEditor.GetSelections
for Each i in selectionArray
pinArray = oEditor.GetComponentPins(i)

VB Example for each j in pinArray


MsgBox j, 0, "GetComponentPins"
Next
Next

GetComponentPinInfo (Schematic Editor)


Informational - gets details about a pin on a schematic component.

UI Access NA

Name Type Description


Parameters <compID> String The Schematic component’s ID
<pinName> String The pin name

String values, as follows:


Return Value "X=number"
"Y=number"

Schematic Scripting 31-119


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Angle=number" (in degrees)


"Flip=true or false"
"WireId=netID or empty string" (netID is the identifier of the schematic net, and can be used in other inform-
ational methods)

Python Syntax GetComponentPinInfo( <compID>, <pinName>)


info = oEditor.GetComponentPinInfo
Python Example ("1","N1")

VB Syntax GetComponentPinInfo <compID>, <pinName>


info = oEditor.GetComponentPinInfo
VB Example
("1","N1")

GetComponentPinLocation [Schematic Editor]


Informational - gets the X or Y location of a pin on a schematic component. Invoke once with TRUE for "XorY" to get the X value of the
pin's location in the schematic, and once with FALSE to get the Y value.

UI Access NA

Name Type Description


Parameters
<compID> String The Schematic component’s ID

Schematic Scripting 31-120


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<pinName> String The pin name


<XorY> Boolean TRUE gets the X value; FALSE gets the Y value.

String values, as follows:


Return Value "X=number"
"Y=number"

Python Syntax GetComponentPinLocation <compID>, <pinname>, <XorY>


varx = oEditor.GetComponentPinLocation
Python Example (compid, "N1", TRUE)

VB Syntax GetComponentPinLocation <compID>, <pinname>, <XorY>


varx = oEditor.GetComponentPinLocation
VB Example
(compid,"N1", TRUE)

GetEditorName (Schematic Editor)


Get the name of the schematic editor.

UI Access N/A
Parameters None
Return Value String containing the name of the schematic editor. “SchematicEditor”

Schematic Scripting 31-121


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetEditorName()


Python Example oEditor.GetEditorName()

VB Syntax GetEditorName( [out, retval] string) // name of the editor


dim info
VB Example
info = oEditor.GetEditorName

GetNetConnections (Schematic Editor)


Use: Informational.
Command: None.
Syntax: GetNetConnections(<netName>)
Return Value: Array of strings containing the connections for the net identified by the
netName argument. Strings in the array are in one of four formats:
"IPort portID x y pinName"
"GPort portID x y pinName"
"PagePort portID x y pinName"
"Component componentName compID x y pinName"
where IPort, GPort, PagePort, and Component are key words
that indicate what the rest of the string specifies:
IPort indicates that portID specifies the name of the interface port,
GPort indicates that portID specifies the name of the global port,

Schematic Scripting 31-122


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

PagePort indicates that portID specifies the name of the page port,
Component indicates that compID specifies the component instance identifier,
x and y are the connection point,
pinName is the name of the connected pin,
componentName is the name of the component.
Parameters: <netName>
Type: String
The name of the net. Specifying "0" as the netName will return all objects connected
to ground including all ground ports.
VB Example: netArray = oEditor.GetNetConnections("net_1")

GetNumPages [Schematic Editor]


To determine how many pages there are in the schematic.

UI Access NA

Name Type Description


Parameters
None

Return Value Integer, the number of pages in the schematic.

Python Syntax GetNumPages()


Python Example num = oEditor. GetNumPages()

Schematic Scripting 31-123


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax GetNumPages
VB Example Set num = oEditor. GetNumPages

GetPortInfo (Schematic Editor)


Informational – get details about a port on a schematic component.

UI Access NA

Name Type Description


Parameters <portID> String The Schematic port’s ID, obtained from GetSelections or through FindEle-
ments.

Array of strings, as follows:


"Name=string" // Name of the port.
"X=val" // Connection point X location.
Return Value "Y=val" // Connection point Y location.
"Angle=val" // Component angle.
"Flip=true or false" // Whether the component is flipped or not.
"WireId=string" // The identifier of the schematic net, can be used in other informational methods.

Schematic Scripting 31-124


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetPortInfo(<portID>)


selectionArray = oEditor.GetSelections()
for i in selectionArray:
info = oEditor.GetPortInfo(i)
Python Example
for j in info:
AddInfoMessage(str("GetPortInfo: " + j))

VB Syntax GetPortInfo<portID>
selectionArray = oEditor.GetSelections
For Each i in selectionArray
info = oEditor.GetPortInfo(i)

VB Example for each j in info


MsgBox j, mbokonly, "GetPortInfo"
Next
Next

GetSelections (Schematic Editor)


Returns an array of currently selected objects.

UI Access N/A
Parameters None.

Schematic Scripting 31-125


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value Array containing object IDs

Python Syntax GetSelections()


Python Example oEditor.GetSelections()

VB Syntax GetSelections
VB Example oEditor.GetSelections

GetSignals (Schematic Editor)


Informational

UI Access NA

Name Type Description


Parameters <wirename> String The wire’s name, as seen in the UI, obtained in script through parsing return
data from GetWireInfo.

Array of strings which contains the signal names in the wirename argument. The wirename "Net1" would return
Return Value an array with a single string "Net1". The wirename "WW[0-3],A,B" would return an array with six strings "WW[0]",
"WW[1]", "WW[2]", "WW[3]", "A", :B".

Python Syntax GetSignals(<wirename>)


Python Example selectionArray = oEditor.GetSelections()

Schematic Scripting 31-126


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

for i in selectionArray:

netArray3 = oEditor.GetWireInfo(i)
for n in netArray3:

wname = n[0:9]

if (wname == "WireName:"):
nn = len(n)
wn = n[nn-10:]
AddInfoMessage("Wirename, parsed from ID :" + str(wn))
sigs = oEditor.GetSignals(wn)
for ll in sigs:
AddInfoMessage("Element in array
from GetSignals :" + str(ll))

VB Syntax GetSignals(<wirename>)
selectionArray = oEditor.GetSelections
For Each i in selectionArray
VB Example
netArray3 = oEditor.GetWireInfo(i)

Schematic Scripting 31-127


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

for each n in netArray3

wname = Left(n, 9)

If (wname = "WireName:") Then

nn = Len(n)

wn = Right(n, nn - 10)

MsgBox wn, 0, "Wirename, parsed from ID"

sigs = oEditor.GetSignals(wn)

for each ll in sigs


MsgBox ll, 0, "Element in array from GetSignals"

Next
End If
Next
Next

GetWireConnections (Schematic Editor)


Informational.

Schematic Scripting 31-128


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access NA

Name Type Description


Parameters
None

Array of strings containing the connections for the wire identified by the wireID argument.
The strings in the array are in one of four formats:
"InterfacePort=portname portID x,y"
Return Value "GlobalPort=portname portID x,y"
"PagePort=portname portID x,y"
"ComponentPin=compId pinname x,y"
where x,y is the connection point.

Python Syntax GetWireConnections(<wireID>)


selectionArray = oEditor.GetSelections()
for i in selectionArray:
AddInfoMessage("Selected element" + i)
Python Example
netArray = oEditor.GetWireConnections(i)
for m in netArray:
AddInfoMessage("GetWireConnections" + str(m))

VB Syntax GetWireConnections(<wireID>)

Schematic Scripting 31-129


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

selectionArray = oEditor.GetSelections
For Each i in selectionArray
MsgBox i, 0, "Selected element"
netArray = oEditor.GetWireConnections(i)
VB Example
for each m in netArray
MsgBox m, mbokonly, "GetWireConnections"
Next
Next

GetWireInfo (Schematic Editor)


Informational.

UI Access NA

Name Type Description


Parameters <wire id> String The Schematic wire’s ID, obtained from GetSelections
or through FindElements.

Schematic Scripting 31-130


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array of strings containing the wire info in the wireID argument.


The strings in the array are:
"Page=number"
"WireName=string"
"SegmentCount=number"
"IPortCount=number"
Return Value "GPortCount=number"
"PagePortCount=number"
"PinCount=number"
"BBoxLLx=val"
"BBoxLLy=val"
"BBoxURx=val"
"BBoxURy=val"

Python Syntax GetWireInfo(<wireID>)


selectionArray = oEditor.GetSelections()
for i in selectionArray:

Python Example AddInfoMessage("Selected element" + str(i))


netArray2 = oEditor.GetWireInfo(i)
for n in netArray2:

Schematic Scripting 31-131


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AddInfoMessage("GetWireInfo" + str(n))

VB Syntax GetWireInfo(<wireID>)
selectionArray = oEditor.GetSelections
For Each i in selectionArray
MsgBox i, 0, "Selected element"
netArray3 = oEditor.GetWireInfo(i)
VB Example
for each n in netArray3
MsgBox n, 0, "GetWireInfo"
Next
Next

GetWireSegments (Schematic Editor)


Informational.

UI Access NA

Name Type Description


Parameters <wireID> String The Schematic wire’s ID, obtained from GetSelections
or through FindElements

Schematic Scripting 31-132


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array of strings containing the wire segments in the wireID argument. The strings in the array are:
"Segment=val,val val,val number" the "val" quantities are
Return Value
segment endpoints x1,y1 x2,y2
and the "number" is a schematic segment ID

Python Syntax GetWireSegments (<wireID>)


selectionArray = oEditor.GetSelections()
for i in selectionArray:
AddInfoMessage("Selected element" + str(i))
Python Example
netArray2 = oEditor.GetWireSegments(i)
for n in netArray2:
AddInfoMessage("GetWireSegments" + str(n))

VB Syntax GetWireSegments (<wireID>)


selectionArray = oEditor.GetSelections
For Each i in selectionArray

VB Example MsgBox i, 0, "Selected element"


netArray2 = oEditor.GetWireSegments(i)
for each n in netArray2

Schematic Scripting 31-133


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

MsgBox n, 0, "GetWireSegments"
Next
Next

Schematic Scripting 31-134


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

32 - Definition Manager Script Commands


The definition manager controls the use of materials and scripts in a project. It also provides access to the managers for symbols, foot-
prints, padstacks, and components in a project.
Set oProject = oDesktop.SetActiveProject("Project1")
Set oDefinitionManager = oProject.GetDefinitionManager()
The topics for this section include:
AddDefinitionFromBlock
AddMaterial
CloneMaterial
DoesMaterialExist
EditMaterial
ExportMaterial
RemoveMaterial
RemoveUnusedDefinitions

Definition Manager Script Commands 32-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Related Topics:

Component Manager Script Commands

Footprint Manager Script Commands

Material Manager Script Commands

Model Manager Script Commands

Network Data Explorer Manager Script Commands

Padstack Manager Script Commands

Script and Library Scripts

Symbol Manager Script Commands

Add [component manager]


Use:Add a component
Command: Tools > Edit Configured Libraries > Components > Add Component
Syntax:Add Array("NAME:<ComponentName>",
"Info:=", <ComponentInfo>,
"RefBase:=", <string>, // reference designator
"NumParts:=", <int>, // parts per component
"OriginalComponent:=", <string>
"Terminal:=", <TerminalInfo>,

Definition Manager Script Commands 32-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Terminal:=", <TerminalInfo>, ...


// The remaining parameters are optional
Array("NAME:Parameters", // any combo of the following
"VariableProp:=", <VariableInfo>,
"CheckboxProp:=", <CheckBoxInfo>,
"ButtonProp:=", <ButtonInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>),
Array("NAME:Properties", // any combo of the following
"CheckboxProp:=", <CheckBoxInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>),
"VPointProp:=", <VPointInfo>,
"PointProp:=", <PointInfo>),
Array("Quantities",

Definition Manager Script Commands 32-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"QuantityProp:=", <QuantityPropInfo>...),
Array("NAME:CosimDefinitions",
<CosimDefInfo>,
<CosimDefInfo>...)
Return Value:<string>
// composite name of the component.
// If the name requested conflicts with the name of an existing
// component, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.

Parameters:<ComponentName>:
<string> // simple name of the component

<ComponentInfo>:
Array("Type:=", <TypeInfo>,
"NumTerminals:=", <int>,
"DataSource:=", <string>,
"ModifiedOn:=", <ModifiedOnInfo>,
"Manufacturer:=", "<string>,
"Symbol:=", <string>,

Definition Manager Script Commands 32-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Footprint:=", <string>,
"Description:=", <string>,
"InfoTopic:=", <string>,
"InfoHelpFile:=", <string>,
"IconFile:=", <string>,
"LibraryName:=", "",
"OriginalLocation:=", "Project", // Project Location
"Author:=", <string>,
"OriginalAuthor:=", <string>,
"CreationDate:= ", <int>)

<TypeInfo>:
An integer that is the or-ing of bits for each product listed below. The default setting is 0xffffffff (4294967295) which indicates
valid for all products. In the component editing dialog, checking different boxes in the "Specify products for which this com-
ponent is valid" grid control sets specific flags that correspond to the following hex/decimal settings:
Nexxim -- 100 binary, 4 decimal, 0x4
SIwaveDeNovo -- 1000 binary, 8 decimal, 0x8
Simplorer -- 10000 binary, 16 decimal, 0x10
MaxwellCircuit -- 100000 binary, 32 decimal, 0x20

<ModifiedOnInfo>:

Definition Manager Script Commands 32-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

An integer that corresponds to the number of seconds that have elapsed since 00:00 hours, Jan 1, 1970 UTC from the sys-
tem clock.

<TerminalInfo>:
Array(<string>, // symbol pin
<string> // footprint pin
<string >, // gate name
<bool>, // shared
<int>, // equivalence number
<int>, // what to do if unconnected: flag as error:0, ignore:1
<string> // description
<Nature>)

<Nature>:
<string> // content varies as follows

Nexxim/Circuit:
"Electrical" // the only choice

Simplorer:
// several choices

Definition Manager Script Commands 32-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Electrical", "Magnetic", "Fluidic", "Translational",


"Translational_V", "Rotational", "Rotational_V",
""Radiant", "Thermal", or <VHDLPackageName>

<VHDLPackageName>:
<string> // in the form <Library>.<Package>

<Library>:
<string> // name of the VHDL library

<Package>:
<string> // name of the VHDL package

<VariableInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: number, variable, or expression

Definition Manager Script Commands 32-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<FlagLetters>:
<string> // "D" - has description parameter,
// "RD" - readonly & has description parameter,
// or "RHD" - readonly, hidden, & has description parameter

<CheckBoxInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<bool>) // value: true or false

<ButtonInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
<string>, // button title
<string>, // extra text
<ClientID>,
"ButtonPropClientData:= ", <ClientDataArray>)

Definition Manager Script Commands 32-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ClientID>:
<int> // specifies Button Prop Client
// 0 - unknown, ButtonPropClientData
// array will be empty
// 1 - Netlist Prop Client
// 2 - not used
// 3 - File Name Prop Client

<ClientDataArray>:
varies with <ClientID>

<ClientId> is 0 or 1: empty array


Array()

<ClientID> is 3:
Array("InternalFormatText:=", "<prefix><RelativePath>")

<prefix>:
<string> // "<Project>", "<PersonalLib>", "<UserLib>", or "<SysLib>"

<RelativePath>:

Definition Manager Script Commands 32-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<string> // relative path to file from <prefix>

<TextInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: a text string

<NumberInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<real>, // value: a number
<string>) // units

<SeparatorInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description

Definition Manager Script Commands 32-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"CB:=", <string>, // optional - script for call back


<string>) // value: a text string

<ValueInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: a number, variable or expression

<MenuPropInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
<string>, // menu choices - separated by commas
<int>) // 0 based index of current menu choice

<VPointInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back

Definition Manager Script Commands 32-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<string>, // x value: number with length units


<string>) // y value: number with length units

<PointInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<real>, // x value
<real>) // y value

<QuantityPropInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
<string>, // value
<TypeString>,
<TypeStringDependentInfo>)

<TypeString>:

Definition Manager Script Commands 32-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<string> // "Across", "Through", or "Free"

<TypeStringDependentInfo>:

<TypeString> is "Free" :
<string>, // direction: "In", "Out", "InOut", or "DontCare"
// Following <string> is not present if direction is "DontCare"
<string> // when to calculate: "BeforeAnalogSolver",
// "BeforeStateGraph", "AfterStateGraph", or "DontCareWhen"

<TypeString> is "Across" or "Through":


<int>, // terminal 1
<int> // terminal 2

<CosimDefInfo>:
Array("NAME:CosimDefinition",
"CosimulatorType:=", <int>,
"CosimDefName:=", <string> // "HFSS 3D Layout", "Circuit",
// "Custom", or "Netlist"
"IsDefinition:=", <bool>,
final array member(s) vary with CosimDefName)

Definition Manager Script Commands 32-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

final array members for HFSS 3D Layout:


"CosimStackup:=", <string>,
"CosimDmbedRatio:=", <int>

final array members for Circuit:


"ExportAsNport:=", <int>,
"UsePjt:=", <int>

final array member for Custom:


"DefinitionCompName:=", <string>

final array member for Netlist:


"NetlistString:=", <string>

VB Example:
Dim name
oComponentManager.Add (Array("NAME:MyComponent", _
"Info:=", Array("Type:=", 4294901767, _
"NumTerminals:=", 2, _
"DataSource:=", "", _

Definition Manager Script Commands 32-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ModifiedOn:=", 1071096503, _
"Manufacturer:=", "Ansys", _
"Symbol:=", "bendo", _
"Footprint:=", "BENDO", _
"Description:=", "",_
"InfoTopic:=", "", _
"InfoHelpFile:=", "", _
"IconFile:=", "", _
"LibraryName:=", "", _
"OriginalLocation:=", "Project", _
"Author:=", "", _
"OriginalAuthor:=", "", _
"CreationDate:= ", 1147460679), _
"Refbase:=", "U", _
"NumParts:=", 1, _
"OriginalComponent:=", "", _
"Terminal:=", Array("n1", _
"n1", _
"A", _
false, _
0, _

Definition Manager Script Commands 32-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

1, _
"", _
"Electrical"), _
"Terminal:=", Array("n2", _
"n2", _
"A", _
false, _
1, _
0, _
"", _
"Electrical"), _
Array("NAME:Parameters", _
"MenuProp:=", Array("CoSimulator", _
"D", _
"", _
"Default,HFSS 3D Layout,Circuit,Custom,Netlist", _
0), _
"ButtonProp:=", Array("CosimDefinition", _
"D", _
"", _

Definition Manager Script Commands 32-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"", _
"Edit", _
0, _
"ButtonPropClientData:=", Array())), _
Array("NAME:CosimDefinitions", _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 0, _
"CosimDefName:=", "HFSS 3D Layout", _
"IsDefinition:=", true, _
"CosimStackup:=", "Layout stackup", _
"CosimDmbedRatio:=", 3), _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 1, _
"CosimDefName:=", "Circuit", _
"IsDefinition:=", true, _
"ExportAsNport:=", 0, _
"UsePjt:=", 0), _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 2, _
"CosimDefName:=", "Custom", _
"IsDefinition:=", true, _

Definition Manager Script Commands 32-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"DefinitionCompName:=", ""), _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 3, _
"CosimDefName:=", "Netlist", _
"IsDefinition:=", true, _
"NetlistString:=", "")))

Add [("NAME:<ComponentName>",
"Info:=", <ComponentInfo>,
"RefBase:=", <string>, // reference designator
"NumParts:=", <int>, // parts per component
"OriginalComponent:=", <string>
"Terminal:=", <TerminalInfo>,
Python Syntax "Terminal:=", <TerminalInfo>, ...
The remaining parameters are optional.
["NAME:Parameters", // any combo of the following
"VariableProp:=", <VariableInfo>,
"CheckboxProp:=", <CheckBoxInfo>,
"ButtonProp:=", <ButtonInfo>,
"TextProp:=", <TextInfo>,

Definition Manager Script Commands 32-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>],
["NAME:Properties", Any combination of the following:
"CheckboxProp:=", <CheckBoxInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>,
"VPointProp:=", <VPointInfo>,
"PointProp:=", <PointInfo>],
["Quantities",
"QuantityProp:=", <QuantityPropInfo>...],
["NAME:CosimDefinitions",
<CosimDefInfo>,
<CosimDefInfo>...]]

oComponentManager.Add(
Python Example [
"NAME:Component",

Definition Manager Script Commands 32-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Info:=", [
"Type:=", 0,
"NumTerminals:=", 0,
"DataSource:=", "",
"ModifiedOn:=", 1467910752,
"Manufacturer:=", "",
"Symbol:=", "Component",
"ModelNames:=", "",
"Footprint:=", "",
"Description:=" , "",
"InfoTopic:=", "",
"InfoHelpFile:=", "",
"IconFile:=", "",
"Library:=", "",
"OriginalLocation:=", "Project",
"IEEE:=", "",
"Author:=", "",
"OriginalAuthor:=", "",
"CreationDate:=", 1467910746,
"ExampleFile:=", ""],

Definition Manager Script Commands 32-20


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Refbase:=", "U",
"NumParts:=", 1,
"ModSinceLib:=", True,
"CompExtID:=", 2
])

AddDataset
Adds a dataset. This can be executed by the oProject, or oDesign variables.

UI Access Project > Datasets > Add.

Name Type Description


< Array Array("NAME:<DatasetName>",
DatasetDataArray>
Array("NAME:Coordinates", <CoordinateArray>,
Parameters
<CoordinateArray>, ...)
<DatasetName> String Name of the dataset.
<CoordinateArray> Array Array("NAME:Coordinate", "X:=", <double>, "Y:=",<double>)

Return Value None.

Python Syntax AddDataset <DatasetDataArray>


oProject.AddDataset(
Python Example [
"NAME:$ds1",

Definition Manager Script Commands 32-21


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:Coordinates",
[
"NAME:Coordinate",
"X:=", 2,
"Y:=", 4
],
[
"NAME:Coordinate",
"X:=", 6,
"Y:=", 8
]
]
]
)
oDesign.AddDataset(
[
"NAME:$ds1",
[
"NAME:Coordinates",

Definition Manager Script Commands 32-22


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:Coordinate",
"X:=", 2,
"Y:=", 4
],
[
"NAME:Coordinate",
"X:=", 6,
"Y:=", 8
]
]
]
)

VB Syntax AddDataset <DatasetDataArray>


oProject.AddDatasetArray("NAME:ds1",
Array("NAME:Coordinates",
Array("NAME:Coordinate", "X:=", 1, "Y:=", 2,
VB Example
Array("NAME:Coordinate", "X:=", 3, "Y:=", 4),
Array("NAME:Coordinate", "X:=", 5, "Y:=", 7),
Array("NAME:Coordinate", "X:=", 6, "Y:=", 20)))

Definition Manager Script Commands 32-23


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDesign.AddDatasetArray("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)))

AddDefinitionFromBlock
Adds a material definition from block text (same definition format as would be contained in the material library file) by library type
(using definition folder name). This scripting command directly supports the .AMAT (or .ASURF) definition formats.

UI Access N/A

Name Type Description

<defBlock> String Text of the new material definition in block form.


Parameters <defFolderName> String Library type (by definition folder name)
<newTimeStamp> String New timestamp (time_t as integer number of seconds since 1/1/1970 12:00am,
as string), default is current time
<replaceExisting> Boolean True to replace existing, False to choose a new unique name if an existing defin-
ition is found

Return Value A property scripting object for the definition.

P- AddDefinitionFromBlock(<defBlock>,<defFolderName>, <newTimeStamp>, <replaceExisting>)


yt-

Definition Manager Script Commands 32-24


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

h-
o-
n
S-
y-
nt-
ax

oProject = oDesktop.NewProject()
oProject.InsertDesign("HFSS", "HFSSDesign1", "DrivenModal", "")
oDesign = oProject.SetActiveDesign("HFSSDesign1")
oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateBox(
P-
yt- [
h-
o-
n "NAME:BoxParameters",
E-
x-
a- "XPosition:=" , "-0.4mm",
m-
pl- "YPosition:=" , "-1mm",
e
"ZPosition:=" , "0mm",
"XSize:=" , "1.4mm",
"YSize:=" , "1.6mm",
"ZSize:=" , "0.6mm"
],

Definition Manager Script Commands 32-25


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:Attributes",
"Name:=" , "Box1",

"Flags:=" , "",

"Color:=" , "(143 175 143)",

"Transparency:=" , 0,

"PartCoordinateSystem:=", "Global",

"UDMId:=" , "",

"MaterialValue:=" , "\"vacuum\"",

"SurfaceMaterialValue:=", "\"\"",

"SolveInside:=" , True,

"ShellElement:=" , False,

"ShellElementThickness:=", "0mm",

Definition Manager Script Commands 32-26


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"IsMaterialEditable:=" , True,

"UseMaterialAppearance:=", False,

"IsLightweight:=" , False

])
oDefinitionManager = oProject.GetDefinitionManager()
defBlock = "$begin 'vacuum2' $begin 'AttachedData' $begin 'MatAppearanceData' property_data-
='appearance_data' Red=230 Green=230 Blue=230 Transparency=0.95 $end 'MatAppearanceData'
$end 'AttachedData' simple('permittivity', 1) ModTime=1499970477 $end 'vacuum2'"
added = oDefinitionManager.AddDefinitionFromBlock(defBlock, "Materials", "10101010", True)
addedName = ''
if isinstance(added, basestring):
addedName = added
elif isinstance(added, list):
addedName = added[0]
else:

addedName = added.GetName().replace("Materials:", "")


AddInfoMessage(os.path.basename(__file__) + " result: " + addedName)
materialNameInQuotes = "\"" + addedName + "\""
oEditor.ChangeProperty(

Definition Manager Script Commands 32-27


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:AllTabs",

"NAME:Geometry3DAttributeTab",

"NAME:PropServers",

"Box1"

],

"NAME:ChangedProps",

"NAME:Material",

"Value:=", materialNameInQuotes

Definition Manager Script Commands 32-28


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

]
]
]
])

AddMaterial
Adds a local material.

UI Access Add Material in the material editor.

Name Type Description

<MaterialParams> Array [
"NAME: <name of the material to be added>",
<MatProperty>, <MatProperty>, ...
]
Parameters
<MatProperty> Array For simple material:
"<PropertyName>:=", <value>

For anisotropic material:


[
"NAME:<PropertyName>",

Definition Manager Script Commands 32-29


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"property_type:=", "AnisoProperty",
"unit:=", <Unit>",
"component1:=", <value>,
"component2:=", <value>,
"component3:=", <value>))
]

<PropertyName> String Should be one of the following (depending on the material, design, and solution
types):
Electromagnetic (Maxwell-exclusive material properties omitted, see
Maxwell Scripting help):
"permittivity", "permeability", "conductivity", "dielectric_loss_tan-
gent",
"magnetic_loss_tangent", "electric_coercivity", "magnetic_coer-
civity",
"saturation_mag", "lande_g_factor", "delta_H", "delta_h_freq",
"mass_density"
Thermal (including solids, Icepak fluid flow, and Mechanical rotating fluid
modeling):
"thermal_conductivity", "mass_density", "specific_heat",
"thermal_expansion_coefficient", "thermal_material_type", "vis-
cosity",
"diffusivity", "molecular_mass", "clarity_type"

Definition Manager Script Commands 32-30


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Structural:
"mass_density", "youngs_modulus", "poissons_ratio",
"thermal_expansion_coefficient"

<Unit> String Possible values (Maxwell-exclusive properties omitted, see Maxwell Scripting
Help; other missing entries are unitless):
conductivity: "siemens/m"
saturation_mag: "uTesla", "mTesla", "tesla", "kTesla", "uGauss",
"mGauss", "gauss", "kGauss"
delta_H: "A_per_meter", "kA_per_meter", "Oe", "kOe"
delta_h_frequency: "Hz", "kHz", "MHz", "GHz", "THz", "rps", "per_sec"
mass_density: "kg/m^3"
thermal_conductivity: "W/m-C"
specific_heat: "J/kg-C"
youngs_modulus: "N/m^2"
thermal_expansion_coefficient: "1/C"

Return Value None

AddMaterial (["NAME:<MaterialName>",
Python Syntax
<MatProperty>, <MatProperty>, ...])

Definition Manager Script Commands 32-31


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDefinitionManager.AddMaterial(
["permittivity:=", "2.2", "0.002"])

oDefinitionManager.AddMaterial [("NAME:Material2",_
"dielectric_loss_tangent:=", "44",
Array("NAME:saturation_mag",_
Python Example
"property_type:=", "AnisoProperty",_
"unit:=", "Gauss",_
"component1:=", "11", _
"component2:=", "22", _
"component3:=", "33"), _
"delta_H:=", "44Oe")]

AddMaterial Array("NAME:<MaterialName>",
VB Syntax
<MatProperty>, <MatProperty>, ...)

oDefinitionManager.AddMaterial Array(
VB Example
"permittivity:=", "2.2", "0.002")

Definition Manager Script Commands 32-32


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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")

Add [padstack manager]


Use: Add a padstack
Command: Tools > Edit Configured Libraries > Padstacks > Add Padstack
Syntax: Add Array("NAME:<PadstackName>",
"ModTime:=", <ModifiedOnInfo>,
"Library:=", "", // name of the library
"LibLocation:=", "Project", // location of the named library
Array("NAME:psd",
"nam:= ", <PadstackName>,
"lib:=", "", // name of the library
"mat:=", "", // hole plating material
"plt:=", "0", // percent of hole's radius filled by plating
Array("NAME:pds",

Definition Manager Script Commands 32-33


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<LayerGeometryArray>,
<LayerGeometryArray....),
"hle:=", <PadInfo>
"hRg:=", <HoleRange>,
"sbsh:=", <SolderballShape>,
"sbpl:=", <SolderballPlacement>,
"sbr:=", <string>, // solderball diameter, real with units
"sb2:=", <string>, // solderball mid diameter, real with units
"sbn:=", <string>), // name of solderball material
"ppl:=", <PadPortLayerArray>)
Return Value: simple name of the added padstack
// If the name requested conflicts with the name of an existing
// padstack, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.

Parameters: <PadstackName>:
<string> // simple name of padstack to create

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed

Definition Manager Script Commands 32-34


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

since 00:00 hours, Jan 1, 1970 UTC from the system clock.

<LayerGeometryArray>:
Array("Name:lgm",
"lay:=", <string>, // definition layer name
"id:=", <int>, // definition layer id
"pad:=", <PadInfo>, // pad
"ant:=", <PadInfo>, // antipad
"thm:=", <PadInfo>, // themal pad
"X:=", <string>, // pad x connection, real with units
"Y:=", <string>, // pad y connection, real with units
"dir:=", <DirectionString>) // pad connection direction

<PadInfo>:
Array("shp:=", <PadShape>,
"Szs:=", <DimensionArray>,
"X:=", <string>, // x offset, real with units
"Y:=", <string>, // y offset, real with units
"R:=", <string>) // rotation, real with units

<PadShape>:

Definition Manager Script Commands 32-35


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<string> one of these choices


"No" // no pad
"Cir" // Circle
"Sq" // Square
"Rct" // Rectangle
"Ov" // Oval
"Blt" // Bullet
"Ply" // Polygons
"R45" // Round 45 thermal
"R90" // Round 90 thermal
"S45" // Square 45 thermal
"S90" // Square 90 thermal

<DimensionArray>:
Array(<string>, ...) // each string is a real with units for one of the dimensions of the shape

<DirectionString>:
<string> one of these choices
"No" // no direction
"Any" // any direction

Definition Manager Script Commands 32-36


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"0" // 0 degrees
"45" // 45 degrees
"90" // 90 degrees
"135" // 135 degrees
"180" // 180 degrees
"225" // 225 degrees
"270" // 270 degrees
"315" // 315 degrees

<HoleRange>:
<string> one of these choices
"Thr" // through all layout layers
"Beg" // from upper pad layer to lowest layout layer
"End" // from upper layout layer to lowest pad layer
"UTL" // from upper pad layer to lowest pad layer
<SolderballShape>:
<string> one of these choices
"None" // no solderball
"Cyl" // cylinder solderball
"Sph" // spheroid solderball

<SolderballPlacement>:

Definition Manager Script Commands 32-37


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<string> one of these choices


"abv" // above padstack
"blw" // below padstack

<PadPortLayerArray>:
Array( <int>, <int>,....) where each int is a layer id
VB Example:

oPadstackManager.Add Array("NAME:Circle - through3", "ModTime:=", 1235765635, "Library:=", _


"", "LibLocation:=", "Project", Array("NAME:psd", "nam:=", "Circle - through3", "lib:=", _
"", "mat:=", "", "plt:=", "0", Array("NAME:pds", Array("NAME:lgm", "lay:=", "Top Signal", "id:=",
_
0, "pad:=", Array("shp:=", "Cir", "Szs:=", Array("2.5mm"), "X:=", "0mm", "Y:=", _
"0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir", "Szs:=", Array("3.5mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array("shp:=", "No", "Szs:=", Array(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", "0mm", "dir:=", "Any"), Array("NAME:lgm",
"lay:=", _
"SignalA", "id:=", 1, "pad:=", Array("shp:=", "Cir", "Szs:=", Array("2mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir", "Szs:=", Array( _
"3mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array("shp:=", "No", "Szs:=", Array(),
"X:=", _

Definition Manager Script Commands 32-38


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", "0mm", "dir:=", "Any"), Array("NAME:lgm",
"lay:=", _
"SignalB", "id:=", 2, "pad:=", Array("shp:=", "Cir", "Szs:=", Array("2mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir", "Szs:=", Array( _
"3mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0deg"), "thm:=", Array("shp:=", "No", "Szs:=", Array
(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", "0mm", "dir:=", "Any"), Array("NAME:lgm",
"lay:=", _
"Ground", "id:=", 3, "pad:=", Array("shp:=", "No", "Szs:=", Array(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "No", "Szs:=", Array(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array("shp:=", "R90", "Szs:=", Array( _
"3mm", "0.75mm", "1mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", _
"0mm", "dir:=", "Any"), Array("NAME:lgm", "lay:=", "Bottom signal", "id:=", 5, "pad:=", Array
("shp:=", _
"Cir", "Szs:=", Array("1mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array
("shp:=", _
"Cir", "Szs:=", Array("2mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0deg"), "thm:=", Array
("shp:=", _
"No", "Szs:=", Array(), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", _
"0mm", "dir:=", "Any")), "hle:=", Array("shp:=", "Cir", "Szs:=", Array("1.5mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "hRg:=", "End", "sbsh:=", "Sph", "sbpl:=", _
"abv", "sbr:=", "750um", "sb2:=", "1200um", "1200um", "sbn:=", "solder"), "ppl:=", Array( _
0, 1, 2, 3, 5))

Definition Manager Script Commands 32-39


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Add [symbol manager]


Use: Add a symbol
Command: Tools > Edit Configured Libraries > Symbols > Add Symbol
Syntax: Add Array("NAME:<SymbolName>",
"ModTime:=", <ModifiedTimeInfo>,
"Library:=", "", // Library name
"LibLocation:=", "Project", // Project Location
<PinDefInfo>,
<PinDefInfo>,... // optional, to define pins
<GraphicsDataInfo>, // optional, to define graphics
<PropDisplayMapInfo>)) // optional, to define property displays

Return Value: <string>


// composite name of the symbol.
// If the name requested conflicts with the name of an existing
// symbol, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.

Parameters: <SymbolName>:
<string> // simple name of the symbol being added

Definition Manager Script Commands 32-40


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.

<PinDefInfo>:
Array("NAME:PinDef",
"Pin:=", Array (<string>, // pin name
<real>, // x location
<real>, // y location
<real>, // angle in radians
<PinType>,
<real>, // line width
<real>, // line length
<bool>, // mirrored
<int>, // color
<bool>, // true if visible, false if not
<string>, // hidden net name
<OptionalPinInfo>, // optional info
<PropDisplayMapInfo>)) // optional

Definition Manager Script Commands 32-41


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<PinType>:
<string> // "N" : normal pin
// "I" : input pin
// "O" : output pin

<OptionalPinInfo>:
// Specify both or neither
<bool>, // true if name is to be shown
<bool>, // true if number is to be shown

<PropDisplayMapInfo>:
Array("NAME:PropDisplayMap",
<PropDisplayInfo>,
<PropDisplayInfo>,...)

<PropDisplayInfo>:
<NameString>, Array(<DisplayTypeInfo>,
<DisplayLocationInfo>,
<int>, // optional, level number

Definition Manager Script Commands 32-42


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<TextInfo>)
<NameString>:
<string> // PropertyName:=, where PropertyName is the name of
// the property to be displayed

<DisplayTypeInfo>:
<int> // 0 : No display
// 1 : Display name only
// 2 : Display value only
// 3 : Display both name and value
// 4: Display evaluated value only
// 5: Display both name and evaluated value

<DisplayLocationInfo>:
<int> // 0 : Left
// 1 : Top
// 2 : Right
// 3 : Bottom
// 4 : Center
// 5 : Custom placement

Definition Manager Script Commands 32-43


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<GraphicsDataInfo>:
Array("NAME:Graphics",
// one or more of the following
<RectInfo>,
<CircleInfo>,
<ArcInfo>,
<LineInfo>,
<PolygonInfo>,
<TextInfo>,
<ImageInfo>)

<RectInfo>:
"Rect:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // angle, in radians
<real>, // x position of center
<real>, // y position of center
<real>, // width
< real>) // height

Definition Manager Script Commands 32-44


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<CircleInfo>:
"Circle:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>) // radius

<ArcInfo>:
"Arc:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>, // radius
<real>, // start angle, in radians
<end>) // end angle, in radians

<LineInfo>:
"Line:=", Array(<real>, // line width

Definition Manager Script Commands 32-45


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<int>, // line pattern


<int>, // color
<PointInfo>, // must specify at least 2 points
<PointInfo>...)
<PointInfo>:
<real>, // x position
<real> // y position

<PolygonInfo>:
"Polygon:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<PointInfo>, // must specify at least 3 points
<PointInfo>...)

<TextInfo>:
"Text:=", Array(<real>, // x position
<real>, // y position
<real>, // angle, in radians
<Justification>,

Definition Manager Script Commands 32-46


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<bool>, // is plotter font


<string>, // font name
<int>, // color
<string>) // text string

<Justification>:
<int> // 0 : left top
// 1 : left base
// 2 : left bottom
// 3 : center top
// 4 : center base
// 5 : center bottom
// 6 : right top
// 7 : right base
// 8 : right bottom

<ImageInfo>:
"Image:=", Array(<RectInfo>,
<ImageData>,
<bool>) // is mirrored

Definition Manager Script Commands 32-47


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ImageData>:
<string>, // file path
<int>, // 0 : use the file path and link to it
// 1 : ignore file path and use next parameter
<string> // text data, only present if preceding int is 1

VB Example:
oSymbolManager.Add Array("NAME:MySymbol",_
"ModTime:=", 1070989137, _
"Library:=", "", _
"LibLocation:=", "Project", _
Array("NAME:PinDef", _
"Pin:=", Array ("newpin0", _
0.00254, _ 0, _
0, _
"N",_
0, _
0.00254, _
false, _
0, _
true, _

Definition Manager Script Commands 32-48


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"",_
false, _
false)), _
Array("NAME:PinDef", _
"Pin:=", Array ("newpin1", _
-0.00254, _
0, _
3.14159265358979, _
"N",_
0, _
0.00254, _
false, _
0, _
true, _
"",_
false, _
false)),
Array("NAME:Graphics", _
"Rect:=", Array(0, _
0, _
12566272, _

Definition Manager Script Commands 32-49


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

0, _
4.33680868994202e-019, _
-0.000635, _
0.00508, _
0.002794), _
"Circle:=", Array(0, _
0, _
12566272, _
0.000127, _
0.000635, _
0.000635)))

AreMaterialPropertiesEqual
Checks whether named material compared to added material data have equivalent major properties.

UI Access None.

Name Type Description


material_data <string> This will be the same format as the AddMaterial() input para-
Parameters meter, material_data. For example, material_data can be
something like this.["NAME:Mold_Material", "Coordin-
ateSystemType:=", "Cartesian", "BulkOrSurfaceType:=", 1,
["NAME:PhysicsTypes", "set:=", ["Thermal"] ], "thermal_con-

Definition Manager Script Commands 32-50


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ductivity:=", "0.8", "mass_density:=", "1980", "specific_


heat:=", "960"].
<MaterialName> <String> Name of the material to compare with material database

Boolean:
Return Value l True – named materials have equivalent major properties.
l False – named materials do not have equivalent major properties.

Python Syntax AreMaterialPropetiesEqual(<material_data>, '<MaterialName>')


Python Example oDefinitionManager.AreMaterialPropertiesEqual(material_data, 'Mold_Material')

VB Syntax AreMaterialPropertiesEqual <material_data>, <MaterialName>


VB Example oDefinitionManager.AreMaterialPropetiesEqual material_data, "modified_epoxy"

AreSurfaceMaterialPropertiesEqual
Checks whether named surface material compared to added surface material data have equivalent major properties.

UI Access None.

Name Type Description


material_data <string> This will be the same format as the AddMaterial() input para-
meter, material_data. For example, material_data can be
Parameters something like this.["NAME:Mold_Material", "Coordin-
ateSystemType:=", "Cartesian", "BulkOrSurfaceType:=", 1,
["NAME:PhysicsTypes", "set:=", ["Thermal"] ], "thermal_con-
ductivity:=", "0.8", "mass_density:=", "1980", "specific_

Definition Manager Script Commands 32-51


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

heat:=", "960"]
<MaterialName> <String> Name of the surface material to compare with material data-
base

Boolean:
Return Value l True – named surface materials have equivalent major properties.
l False – named surface materials do not have equivalent major properties.

Python Syn- AreSurfaceMaterialPropetiesEqual(<material_data>, '<MaterialName>')


tax

Python oDefinitionManager.AreSurfaceMaterialPropertiesEqual(material_data, 'Mold_Material')


Example

VB Syntax AreMaterialPropertiesEqual <material_data>, <MaterialName>


VB Example oDefinitionManager.AreMaterialPropetiesEqual material_data, "modified_epoxy"

ChangeProperty (Symbol Editor)


Use: Changes to properties are scripted using the ChangeProperty command. This command can be executed by the oEditor to
change editor properties, 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 Circuit, only Variable and Separator properties can be
deleted.
Command: None
Syntax: ChangeProperty Array("Name:AllTabs", <PropTabArray>, <PropTabArray>, ...)

Definition Manager Script Commands 32-52


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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>

Definition Manager Script Commands 32-53


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("Name:DeletedProps", <PropName>,
<PropName>, ...)
OR (for PropDisplay deletions only)
Array("Name:DeletedProps",<PropDataArray>,
<PropDataArray>, ...)

<PropDataArray>
Array("NAME:<PropName>",
"PropType:=", <PropType>,
"NewName:=", <string>,
"Description:=", <string>,
"Callback:=", <string>,
"NewRowPosition:=", <int>,
"ReadOnly:=", <bool>,
"Hidden:=", <bool>,
<PropTypeSpecificArgs>)OR (for PropDisplays only)
Array("Name:<PropName>",<PropDisplayData>)

<PropDisplayData>

Definition Manager Script Commands 32-54


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

for adding, changing, deleting PropDisplays


<PropDisplayAttributes>
for changing PropDisplays only
<PropDisplayNewAttributes>

<PropDisplayAttributes>
Layer & Location only used for PropDisplays in layout

For adding PropDisplays, this will add a single PropDisplay with attributes as shown; if an attribute is missing, a default
value will be assigned. Adding PropDisplay to schematic with attributes that are identical to one already existing there will
fail without an error message.
For deleting PropDisplays, these attributes are used to identify an existing PropDisplay to delete. If there doesn't exist a
PropDisplay that matches the given attributes, then nothing will be deleted. If multiple PropDisplays match the given attrib-
utes, then all of them will be deleted. If an attribute is missing, then all PropDisplays match that missing attribute. For
example, if Layer is missing, then PropDisplays on all layers that match the remaining given attributes will be deleted.
For changing PropDisplays, these attributes are used to identify an existing PropDisplay to change. If no PropDisplay
matching the attributes is found, no changes will be made. If multiple PropDisplays match the attributes, all of them will be
changed. If an attribute is missing, it matches all PropDisplays. For example, to change the format of PropDisplays that are
on the bottom, but have any layer, style or format to show the name only, this command should have Location set to "Bot-
tom" and all other attributes omitted.
"Format:=", <PropDisplayType>,
"Location:=", <PropDisplayLocation>,
"Layer:=", <string>,
"Style:=", <string>

Definition Manager Script Commands 32-55


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<PropDisplayNewAttributes>

NewLayer & NewLocation only used for PropDisplays in layout


For changing PropDisplays, these attributes are used to identify which attributes to change and what the new value is. If the
attribute should not be changed, the corresponding entry should be omitted.
"NewName:=", <string>,
"NewFormat:=", <PropDisplayType>,
"NewLocation:=", <PropDisplayLocation>,
"NewLayer:=", <string>,
"NewStyle:=", <string>

<PropDisplayType>
Type: string
Identifies the format of PropDisplay.
"Name"
"Value"
"NameAndValue"
"EvaluatedValue"
"NameAndEvaluatedValue"

<PropDisplayLocation>

Definition Manager Script Commands 32-56


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Type: string
Identifies where PropDisplay is located with respect to object
"Left"
"Top"
"Right"
"Bottom"
"Custom"

<PropType>
Type: string
Identifies the type of property when a new property is added. In Circuit, only separator properties and variable properties
can be added.
"SeparatorProp"
"VariableProp"
"TextProp"
"NumberProp"
"ValueProp"
"CheckboxProp"
"MenuProp"
"PointProp"
"VPointProp"
"ButtonProp"

Definition Manager Script Commands 32-57


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

NewName
Specify the new name of a property if the property’s name is being edited. In Circuit, the name can only be changed for sep-
arators and variables.

Description
Specify a description of the property. In Circuit, the description can only be changed for separators and variables.

Callback
Specify the name of the script callback to be run when the property value is changed.

NewRowPosition
Used to reorder rows in the Property dialog box. In Circuit, this only applies to the Project>Project Variables panel and the
Designer>DesignProperties panel. Specify the new zero-based row index of the variable or separator.

ReadOnly
Used to mark a property as "read only" so it can not be modified. In Circuit, this flag can only be set for variables and sep-
arators.

Hidden

Definition Manager Script Commands 32-58


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Used to hide a property so it can not be viewed outside of the Property dialog box. In Circuit, 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>
Material Button: "Material:=", <string>
Color Button: "R:=",<int>,"G:=",<int>,"B:=",<int>
Transparency Button: "Value:=", <double>

<PropTypeSpecificArgs> for MenuProps


Syntax for NewProps array: "AllChoices:=",
<"choice1,choice2,..."> or <Array("choice1" "choice2", ... )>,
"Value:=", <string>
Syntax for ChangedProps array: "Value:=", <string>

Definition Manager Script Commands 32-59


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<PropTypeSpecificArgs> for VariableProps


Syntax:
"Value:=", <value>, <OptimizationFlagsArray>,
<TuningFlagsArray>, <SensitivityFlagsArray>,
<StatisticsFlagsArray>

Parameters:
<OptimizationFlagsArray>
Array("NAME:Optimization",
"Included:=", <bool>,
"Min:=", <value>,
"Max:=", <value>)

<TuningFlagsArray>
Array("NAME:Tuning",
"Included:=", <bool>,
"Step:=", <value>,
"Min:=", <value>,
"Max:=", <value>)

<SensitivityFlagsArray>

Definition Manager Script Commands 32-60


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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.

Definition Manager Script Commands 32-61


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Min
Low cut-off for the distribution.

Max
High cut-off for the distribution.

Tol
Tolerance for uniform distributions. Format is "<int>%".
Example: "20%".

VB 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",_

Definition Manager Script Commands 32-62


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Description:=", "my new variable"))))

VB Example: Deleting the design level variable "height":


oDesign.ChangeProperty Array("NAME:AllTabs",_
Array("NAME:LocalVariableTab",_
Array("NAME:PropServers", "DefinitionParameters"),_
Array("NAME:DeletedProps", "height"))

Changing a property’s value. If the following command were executed, then the value of the prop-
erty "XSize" of the PropServer
"Box1:CreateBox:1" on the "Geometry3DCmdTab" tab would be changed. (oEditor is the Geometry3D
editor in Circuit.)
oEditor.ChangeProperty Array("NAME:AllTabs",_
Array("NAME:Geometry3DCmdTab",_
Array("NAME:PropServers","Box1:CreateBox:1"),_
Array("NAME:ChangedProps",_
Array("NAME:XSize", "Value:=", "1.4mil"))))

VB Example: Changing a property’s value. If the following command were executed, then the values
of Callback and L on the PassedParameterTab would be changed.

oEditor.ChangeProperty Array("NAME:AllTabs", _
Array("NAME:PassedParameterTab", _

Definition Manager Script Commands 32-63


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:PropServers", "CHOKE2"), _
Array("NAME:ChangedProps", _
Array("NAME:L", "Callback:=", "ac", "OverridingDef:=", true), _
Array("NAME:L", "Value:=", "1nH"))))

VB Example: Changing the Company Name, Design Name, the background color, and the Axis scaling in
a Report.

Set oProject = oDesktop.SetActiveProject("wgcombiner")


Set oDesign = oProject.SetActiveDesign("CircuitDesign2")
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"))))
oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:Header",_ Array("NAME:PropServers", "XY
Plot1:Header"), _
Array("NAME:ChangedProps", Array("NAME:Design Name", _
"Value:=", "WG Combiner"))))
oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:General",_ Array("NAME:PropServers", "XY
Plot1:General"), _
Array("NAME:ChangedProps", Array("NAME:Back Color", _

Definition Manager Script Commands 32-64


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"R:=", 128, "G:=", 255, "B:=", 255))))


oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:Axis", _ Array("NAME:PropServers", "XY
Plot1:AxisX"), _
Array("NAME:ChangedProps", Array("NAME:Axis Scaling", _
"Value:=", "Log"))))

VB Example: Changing a property’s value. Note that the AllChoices parameter is only used when
the MenuProp is being added. Also note that either a string of choices separated by commas or an
Array("choice1", "choice2", "choice3") works for the AllChoices parameter.

Set oEditor = oDesign.SetActiveEditor("SchematicEditor")


oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:PassedParameterTab", Array
("NAME:PropServers", _
"CompInst@CAP_;2"), Array("NAME:NewProps", Array("NAME:xxxx", "PropType:=", _
"MenuProp", "AllChoices:=", Array("aa", "bb", "cc", "dd"), "Value:=", "bb"))))

CloneMaterial
Clones a local material.

UI Access N/A

Name Type Description


Parameters <matName> String Name of existing material.
<newName> String Name for newly cloned material.

Definition Manager Script Commands 32-65


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Boolean:
Return Value l 1 - Material is cloned.
l 0 - Existing material not found or a conflict with the new material name.

Python Syntax CloneMaterial (<matName>, <newName>)


Python Example oDefinitionManager.CloneMaterial("copper1", "copper3")

VB Syntax CloneMaterial <matName>, <newName>


VB Example oDefinitionManager.CloneMaterial "copper1", "copper3"

DeleteDataset
Deletes a specified dataset. This can be executed by the oProject, or oDesign variables.

UI Access Project > Datasets > Remove.

Name Type Description


Parameters
<DatasetName> String Name of the dataset found in the project.

Return Value None.

Python Syntax DeleteDataset (<DatasetName>)

Definition Manager Script Commands 32-66


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oProject.DeleteDataset('$ds1')
Python Example
oDesign.DeleteDataset('$ds1')

VB Syntax DeleteDataset <DatasetName>


oProject.DeleteDataset "$ds1"
VB Example
oDesign.DeleteDataset "$ds1"

DoesMaterialExist
Checks for the presence of a material in the library by name

UI Access None.

Name Type Description


Parameters
<MaterialName> <String> Name of the material to search for in the material database

Boolean:
Return Value l True – specified material exists.
l False – specified material does not exist.

Python Syntax DoesMaterialExist(<MaterialName>)


Python Example oDefinitionManager.DoesMaterialExist("modified_epoxy")

Definition Manager Script Commands 32-67


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax DoesMaterialExist <MaterialName>


VB Example oDefinitionManager.DoesMaterialExist "modified_epoxy"

Edit [component manager]


Modifies an existing component
Command: Tools > Edit Configured Libraries > Components > Edit Component
Syntax: Edit <ComponentName>,
Array("NAME:<NewComponentName>",
"Info:=", <ComponentInfo>,
"RefBase:=", <string>, // reference designator
"NumParts:=", <int>, // parts per component
"OriginalComponent:=", <string>
"Terminal:=", <TerminalInfo>,
"Terminal:=", <TerminalInfo>, ...
// The remaining parameters are optional
Array("NAME:Parameters", // any combo of the following
"VariableProp:=", <VariableInfo>,
"CheckboxProp:=", <CheckBoxInfo>,
"ButtonProp:=", <ButtonInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,

Definition Manager Script Commands 32-68


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>),
Array("NAME:Properties", // any combo of the following
"CheckboxProp:=", <CheckBoxInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>),
"VPointProp:=", <VPointInfo>,
"PointProp:=", <PointInfo>),
Array("Quantities",
"QuantityProp:=", <QuantityPropInfo>...),
Array("NAME:CosimDefinitions",
<CosimDefInfo>,
<CosimDefInfo>...)
Return Value: <string>
// composite name of the component.
// If the name requested conflicts with the name of an existing
// component, the requested name is altered to be unique.

Definition Manager Script Commands 32-69


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

// The name returned reflects any change made to be unique.

Parameters: <ComponentName>:
<string> // composite name of the component to edit

<NewComponentName>:
<string> // new simple name for the component

<ComponentInfo>:
Array("Type:=", <TypeInfo>,
"NumTerminals:=", <int>,
"DataSource:=", <string>,
"ModifiedOn:=", <ModifiedOnInfo>,
"Manufacturer:=", "<string>,
"Symbol:=", <string>,
"Footprint:=", <string>,
"Description:=", <string>,
"InfoTopic:=", <string>,
"InfoHelpFile:=", <string>,
"IconFile:=", <string>,

Definition Manager Script Commands 32-70


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"LibraryName:=", <string>,
"OriginalLocation:=", <string>, // Project Location
"Author:=", <string>,
"OriginalAuthor:=", <string>,
"CreationDate:= ", <int>)

<TypeInfo>:
An integer that is the or-ing of bits for each product listed below. The default setting is 0xffffffff (4294967295) which indicates
valid for all products. In the component editing dialog, checking different boxes in the "Specify products for which this com-
ponent is valid" grid control sets specific flags that correspond to the following hex/decimal settings:
Nexxim -- 100 binary, 4 decimal, 0x4
SIwaveDeNovo -- 1000 binary, 8 decimal, 0x8
Simplorer -- 10000 binary, 16 decimal, 0x10
MaxwellCircuit -- 100000 binary, 32 decimal, 0x20

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed since 00:00 hours, Jan 1, 1970 UTC from the sys-
tem clock.

<TerminalInfo>:
Array(<string>, // symbol pin
<string> // footprint pin
<string >, // gate name

Definition Manager Script Commands 32-71


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<bool>, // shared
<int>, // equivalence number
<int>, // what to do if unconnected: flag as error:0, ignore:1
<string>, // description
<Nature>)

<Nature>:
<string> // content varies as follows

Nexxim/Circuit:
"Electrical" // the only choice

Simplorer:
// several choices
"Electrical", "Magnetic", "Fluidic", "Translational",
"Translational_V", "Rotational", "Rotational_V",
""Radiant", "Thermal", or <VHDLPackageName>

<VHDLPackageName>:
<string> // in the form <Library>.<Package>

Definition Manager Script Commands 32-72


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<Library>:
<string> // name of the VHDL library

<Package>:
<string> // name of the VHDL package

<VariableInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: number, variable, or expression

<FlagLetters>:
<string> // "D" - has description parameter,
// "RD" - readonly & has description parameter,
// or "RHD" - readonly, hidden, & has description parameter

<CheckBoxInfo>:

Definition Manager Script Commands 32-73


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<bool>) // value: true or false

<ButtonInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
<string>, // button title
<string>, // extra text
<ClientID>,
"ButtonPropClientData:= ", <ClientDataArray>)

<ClientID>:
<int> // specifies Button Prop Client
// 0 - unknown, "ButtonPropClientData
// array will be empty
// 1 - Netlist Prop Client

Definition Manager Script Commands 32-74


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

// 2 - not used
// 3 - File Name Prop Client

<ClientDataArray>:
varies with <ClientID>

<ClientID> is 0 or 1: empty array


Array()

<ClienID> is 3:
Array("InternalFormatText:=", "<prefix><RelativePath>")

<prefix>:
<string> // "<Project>", "<PersonalLib>", "<UserLib>", or "<SysLib>"

<RelativePath>:
<string> // relative path to file from <prefix>

<TextInfo>:
Array(<string>, // name
<FlagLetters>,

Definition Manager Script Commands 32-75


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: a text string

<NumberInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<real>, // value: a number
<string>) // units

<SeparatorInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: a text string

<ValueInfo>:
Array(<string>, // name

Definition Manager Script Commands 32-76


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: a number, variable or expression

<MenuPropInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
<string>, // menu choices - separated by commas
<int>) // 0 based index of current menu choice

<VPointInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>, // x value: number with length units
<string>) // y value: number with length units

<PointInfo>:
Array(<string>, // name

Definition Manager Script Commands 32-77


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<real>, // x value
<real>) // y value

<QuantityPropInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
<string>, // value
<TypeString>,
<TypeStringDependentInfo>)

<TypeString>:
<string> // "Across", "Through", or "Free"

<TypeStringDependentInfo>:

"Free" :

Definition Manager Script Commands 32-78


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<string>, // direction: "In", "Out", "InOut", or "DontCare"


// Following <string> is not present if direction is "DontCare"
<string> // when to calculate: "BeforeAnalogSolver",
// "BeforeStateGraph", "AfterStateGraph", or "DontCareWhen"

"Across" or "Through"
<int>, // terminal 1
<int> // terminal 2

<CosimDefInfo>:
Array("NAME:CosimDefinition",
"CosimulatorType:=", <int>,
"CosimDefName:=", <string> // "HFSS3D", "Circuit",
// "Custom", or "Netlist"
"IsDefinition:=", <bool>,
final array member(s) vary with CosimDefName)

final array members for HFSS 3D Layout:


"CosimStackup:=", <string>,
"CosimDmbedRatio:=", <int>

final array members for Circuit:

Definition Manager Script Commands 32-79


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ExportAsNport:=", <int>,
"UsePjt:=", <int>

final array member for Custom:


"DefinitionCompName:=", <string>

final array member for Netlist:


"NetlistString:=", <string>
VB Example:
Dim name
name = oComponentManager.Edit ("Nexxim Circuit Elements\BJTs:Level01_NPN", _
Array("NAME:Level01_NPN", _
"Info:=", Array("Type:=", 4294901764,_
"NumTerminals:=", 3, _
"DataSource:=", "Ansys built-in component", _
"ModifiedOn:=", 1152722112, _
"Manufacturer:=", "", _
"Symbol:=", "nexx_bjt_npn", _
"Footprint:=", "", _
"Description:=", "BJT, GP, NPN", _

Definition Manager Script Commands 32-80


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"InfoTopic:=", "NXBJT1.htm", _
"InfoHelpFile:=", "nexximcomponents.chm", _
"IconFile:=", "bjtsn.bmp", _
"Library:=", "Nexxim Circuit Elements\BJTs", _
"OriginalLocation:=", "SysLibrary ", _
"Author:=", "", _
"OriginalAuthor:=", "", _
"CreationDate:=", 1152722102), _
"Refbase:=", "Q", _
"NumParts:=", 1, _
"Terminal:=", Array("collector", _
"collector", _
"A", _
false, _
6, _
0, _
"", _
"Electrical"), _
"Terminal:=", Array("base", _
"base", _
"A", _

Definition Manager Script Commands 32-81


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

false, _
7, _
0, _
"", _
"Electrical"), _
"Terminal:=", Array("emitter", _
"emitter", _
"A", _
false, _
8, _
0, _
"", _
"Electrical"), _
Array("NAME:Parameters", _
"TextProp:=", Array("LabelID", _
"HD", _
"Property string for netlist ID", _
"Q@ID"), _
"TextProp:=", Array("MOD", _
"D", _

Definition Manager Script Commands 32-82


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Name of model data reference", _


"required"), _
"VariableProp:=", Array("AREA", _
"D", _
"Emitter area multiplying factor, which affects curents, resistances, and capacitances", _ "1"),
_
"VariableProp=", Array("AREAB", _
"D", _
"Base AREA", _
"1"), _
"VariableProp:=", Array( "AREAC", _
"D", _
Collector AREA", _
"1"), _
"VariableProp:=", Array("DTEMP", _
"D", _
"The difference between element and circuit temperature deg Cel)", _
"0"), _
"VariableProp:=", Array("M", _
"D", _
"Multiplier factor to simulate multiple BJTs in paralel", _ "1"), _
"ButtonProp:=", Array("NexximNetlist", _

Definition Manager Script Commands 32-83


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"HD", _
"", _
"Q@ID %0 %1 %2 *MOD(@MOD) *AREA(AREA=@AREA)" & _
" *AREAB(AREAB=@AREAB) *AREAC(AREAC=@" & _
"AREAC) *DTEMP(DTEMP=@DTEMP) *M(M=@M)", _
"Q@ID %0 %1 %2 *MOD(@MOD) " & _ "*AREA(AREA=@AREA) AREAB(AREAB=@AREAB) *AREAC(AREAC=@" & _
"AREAC) *DTEMP(DTEMP=@DTEMP) *M(M=@M)", _
1, _
"ButtonPropClientData:=", Array()), _
"TextProp:=", Array( "ModelName", _
"HD", _
"", _
"Q"))))
VB Example:
Dim name2
name2 = oComponentManager.Edit "MyComponent", _
(Array("NAME:MyOtherComponent", _
"Info:=", Array("Type:=", 4294901767, _
"NumTerminals:=", 2, _
"DataSource:=", "", _

Definition Manager Script Commands 32-84


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ModifiedOn:=", 1071096503, _
"Manufacturer:=", "Ansys", _
"Symbol:=", "bendo", _
"Footprint:=", "BENDO", _
"Description:=", "",_
"InfoTopic:=", "", _
"InfoHelpFile:=", "", _
"IconFile:=", "", _
"LibraryName:=", "", _
"OriginalLocation:=", "Project", _
"Author:=", "", _
"OriginalAuthor:=", "", _
"CreationDate:= ", 1147460679), _
"Refbase:=", "U", _
"NumParts:=", 1, _
"OriginalComponent:=", "", _
"Terminal:=", Array("n1", _
"n1", _
"A", _
false, _
0, _

Definition Manager Script Commands 32-85


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

0, _
"", _
"Electrical"), _
"Terminal:=", Array("n2", _
"n2", _
"A", _
false, _
1, _
0, _
"", _
Electrical"), _
Array("NAME:Parameters", _
"MenuProp:=", Array("CoSimulator", _
"D", _
"", _
"Default,HFSS3D,Circuit,Custom,Netlist", _
0), _
"ButtonProp:=", Array("CosimDefinition", _
"D", _
"", _

Definition Manager Script Commands 32-86


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"", _
"Edit", _
0, _
"ButtonPropClientData:=", Array())), _
Array("NAME:CosimDefinitions", _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 0, _
"CosimDefName:=", "HFSS3D", _
"IsDefinition:=", true, _
"CosimStackup:=", "Layout stackup", _
"CosimDmbedRatio:=", 3), _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 1, _
"CosimDefName:=", "Circuit", _
"IsDefinition:=", true, _
"ExportAsNport:=", 0, _
"UsePjt:=", 0), _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 2, _
"CosimDefName:=", "Custom", _
"IsDefinition:=", true, _

Definition Manager Script Commands 32-87


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"DefinitionCompName:=", ""), _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 3, _
"CosimDefName:=", "Netlist", _
"IsDefinition:=", true, _
"NetlistString:=", "")))

Edit <ComponentName>,
["NAME:<NewComponentName>",
"Info:=", <ComponentInfo>,
"RefBase:=", <string>, // reference designator
"NumParts:=", <int>, // parts per component
"OriginalComponent:=", <string>
Python Syntax "Terminal:=", <TerminalInfo>,
"Terminal:=", <TerminalInfo>, ...
#The remaining parameters are optional
["NAME:Parameters", // any combo of the following
"VariableProp:=", <VariableInfo>,
"CheckboxProp:=", <CheckBoxInfo>,
"ButtonProp:=", <ButtonInfo>,

Definition Manager Script Commands 32-88


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>],
["NAME:Properties", # any combo of the following
"CheckboxProp:=", <CheckBoxInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>),
"VPointProp:=", <VPointInfo>,
"PointProp:=", <PointInfo>),
["Quantities",
"QuantityProp:=", <QuantityPropInfo>...],
["NAME:CosimDefinitions",
<CosimDefInfo>,
<CosimDefInfo>...])

Python
name = oComponentManager.Edit ("Simplorer Circuit Elements\BJTs:Level01_NPN", _
Example ["NAME:Level01_NPN", "Info:=", ["Type:=", 4294901764,_

Definition Manager Script Commands 32-89


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NumTerminals:=", 3, "DataSource:=", "Ansoft built-in component",_


"ModifiedOn:=", 1152722112, "Manufacturer:=", "", _
"Symbol:=", "nexx_bjt_npn", "Footprint:=", "", _
"Description:=", "BJT, GP, NPN", "InfoTopic:=", "NXBJT1.htm", _
"InfoHelpFile:=", "nexximcomponents.chm", "IconFile:=", "bjtsn.bmp", _
"Library:=", "Nexxim Circuit Elements\BJTs",_
"OriginalLocation:=", "SysLibrary ", "Author:=", "", _
"OriginalAuthor:=", "", "CreationDate:=", 1152722102], _
"Refbase:=", "Q", "NumParts:=", 1, "Terminal:=", ["collector", _
"collector", "A", false, 6, 0, "", "Electrical"], _
"Terminal:=", ["base", "base", "A", false, _
7, 0, "", "Electrical"], "Terminal:=", ["emitter", _
"emitter", "A", false, 8, 0, "", "Electrical"], _
["NAME:Parameters", "TextProp:=", ["LabelID", _
"HD", "Property string for netlist ID", _
"Q@ID"], "TextProp:=", ["MOD", "D", _
"Name of model data reference", "required"], _
"VariableProp:=", ["AREA", "D", _
"Emitter area multiplying factor, which affects

Definition Manager Script Commands 32-90


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

cur-
rents, resistances, and capacitances", "1"], _
"VariableProp:=", ["AREAB", "D", "Base AREA", _
"1"], "VariableProp:=", ["AREAC", "D", "Collector AREA", _
"1"], "VariableProp:=", ["DTEMP", "D", _
"The difference between element and circuit temperature (deg Cel)", _
"0"], "VariableProp:=", ["M", "D", _
"Multiplier factor to simulate multiple BJTs in parallel", _
"1"], "ButtonProp:=", ["NexximNetlist", "HD", "", _
"Q@ID %0 %1 %2 *MOD(@MOD) *AREA(AREA=@AREA)"& _

" *AREAB(AREAB=@AREAB) *AREAC(AREAC=@" &_


"AREAC) *DTEMP(DTEMP=@DTEMP) *M(M=@M)", _
"Q@ID %0 %1 %2 *MOD(@MOD) " & "*AREA(AREA=@AREA)
*AREAB(AREAB=@AREAB) *AREAC(AREAC=@" & _
"AREAC) *DTEMP(DTEMP=@DTEMP) *M(M=@M)", 1, _
"ButtonPropClientData:=", []],
"TextProp:=", ["ModelName", "HD", "", "Q"]]])

name2 = oComponentManager.Edit ("MyComponent",_


Python
Example
2 (["NAME:MyOtherComponent","Info:=", ["Type:=", 4294901767, _

Definition Manager Script Commands 32-91


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NumTerminals:=", 2, "DataSource:=", "", _

"ModifiedOn:=", 1071096503, "Manufacturer:=", "Ansoft", _

"Symbol:=", "bendo", "Footprint:=", "BENDO", _

"Description:=", "", "InfoTopic:=", "", _

"InfoHelpFile:=", "", "IconFile:=", "", _

"LibraryName:=", "", "OriginalLocation:=", "Project", _

"Author:=", "", "OriginalAuthor:=", "", _

"CreationDate:= ", 1147460679], "Refbase:=", "U", _

"NumParts:=", 1, "OriginalComponent:=", "", _

Definition Manager Script Commands 32-92


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Terminal:=", ["n1", "n1", "A", false, 0, 0, "", _

"Electrical"], "Terminal:=", ["n2", "n2", "A", _

false, 1, 0, "", Electrical"], ["NAME:Parameters", _

"MenuProp:=", ["CoSimulator", "D", "", _

"Default,Custom,Netlist", 0], "ButtonProp:=", ["CosimDefinition", _

"D", "", "", "Edit", 0, "ButtonPropClientData:=", []]], _

["NAME:CosimDefinitions", ["NAME:CosimDefinition", _

"CosimulatorType:=", 0, "CosimDefName:=", "HFSS3D", _

"IsDefinition:=", true, "CosimStackup:=", "Layout stackup", _

"CosimDmbedRatio:=", 3], ["NAME:CosimDefinition", _

Definition Manager Script Commands 32-93


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"CosimulatorType:=", 1, "CosimDefName:=", "", _

"IsDefinition:=", true, "ExportAsNport:=", 0, _

"UsePjt:=", 0], ["NAME:CosimDefinition", _

"CosimulatorType:=", 2, "CosimDefName:=", "Custom", _

"IsDefinition:=", true, "DefinitionCompName:=", ""], _

["NAME:CosimDefinition", "CosimulatorType:=", 3, _

"CosimDefName:=", "Netlist", "IsDefinition:=", true, _

"NetlistString:=", ""]]])

Definition Manager Script Commands 32-94


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditDataset
Modifies a dataset. This can be executed by the oProject, or oDesign variables.

UI Access Project > Datasets > Edit.

Name Type Description


Parameters <OriginalName> String Name of the original dataset.
<DatasetDataArray> Array Data for the modified dataset.

Return Value None.

Python Syntax EditDataset (<OriginalName> <DatasetDataArray>)


oProject.EditDataset ("ds1"
["NAME:ds2",
["NAME:Coordinates",
[
"NAME:Coordinate",
Python Example "X:=", 1, "Y:=", 2
],
[
"NAME:Coordinate",
"X:=", 3, "Y:=", 4
]

Definition Manager Script Commands 32-95


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

]
]
)
oDesign.EditDataset ("ds1"
["NAME:ds2",
["NAME:Coordinates",
[
"NAME:Coordinate",
"X:=", 1, "Y:=", 2
],
[
"NAME:Coordinate",
"X:=", 3, "Y:=", 4
]
]
]
)

VB Syntax EditDataset <OriginalName> <DatasetDataArray>

Definition Manager Script Commands 32-96


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oProject.EditDataset "ds1" Array("NAME:ds2",_


Array("NAME:Coordinates",Array("NAME:Coordinate",
"X:=", 1, "Y:=", 2), Array("NAME:Coordinate",
"X:=", 3, "Y:=", 4)))
VB Example
oDesign.EditDataset "ds1" Array("NAME:ds2",_
Array("NAME:Coordinates",Array("NAME:Coordinate",
"X:=", 1, "Y:=", 2), Array("NAME:Coordinate",
"X:=", 3, "Y:=", 4)))

EditMaterial
Modifies an existing material.

UI Access View/Edit Materials command in the material editor

Name Type Description


<OriginalName> String Name of the material before editing.
<MatProperties> Array Structured array containing material properties:
[
"NAME:<New material name>",
Parameters "CoordinateSystemType:=", <string>,
"BulkOrSurfaceType:=" , <integer>,
[
"NAME:PhysicsTypes",
"set:=" , <array containing string physics

Definition Manager Script Commands 32-97


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

types>
],
<Optional ModifierDataArray>,
"permeability:=" , <string containing value>,
"conductivity:=" , <string containing value>,
"thermal_conductivity:=", <string containing value>,
"mass_density:=" , <string containing value>,
"specific_heat:=" , <string containing value>,
"youngs_modulus:=" , <string containing value>,
"poissons_ratio:=" , <string containing value>,
"thermal_expansion_coefficient:=", <string con-
taining value>
]
<Modi- Array Optional structured array containing thermal or spatial modifiers:
fierDataArray>
[
"NAME:ModifierData",
[
"NAME:<ThermalModifierData or SpatialModifierData>",
"modifier_data:=" , <"thermal_modifier_data" or "spa-
tial_modifier_data">,
[

Definition Manager Script Commands 32-98


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:<all_thermal_modifiers or all_spatial_mod-
ifiers>",
[
"NAME:<modifierName>",
"Property::=" , <string property being mod-
ified>,
"Index::=" , <integer>,
"prop_modifier:=" , <"thermal_modifier" or
"spatial_modifier">,
"use_free_form:=" , <Boolean>,
"free_form_value:=" , <string modifier
value>,
]
]
]
]

Return Value None.

Python EditMaterial (<OriginalName>, <MatProperties>)


Syntax

Python Without Modifiers:


Example oDefinitionManager.EditMaterial("alumina_92pct",

Definition Manager Script Commands 32-99


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:alumina_92pct",
"CoordinateSystemType:=" , "Cartesian",
"BulkOrSurfaceType:=" , 1,
[
"NAME:PhysicsTypes",
"set:=" , ["Electromagnetic","Thermal","Structural"]
],
"permittivity:=" , "9.3",
"dielectric_loss_tangent:=" , "0.008",
"thermal_conductivity:=" , "26",
"mass_density:=" , "3720",
"specific_heat:=" , "790",
"youngs_modulus:=" , "267000000000",
"poissons_ratio:=" , "0.26",
"thermal_expansion_coeffcient:=", "7.2e-006"
]
)
With Thermal Modifier:
oDefinitionManager.EditMaterial("copper",

Definition Manager Script Commands 32-100


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:copper",
"CoordinateSystemType:=", "Cartesian",
"BulkOrSurfaceType:=" , 1,
[
"NAME:PhysicsTypes",
"set:=" , ["Electromagnetic","Thermal","Structural"]
],
[
"NAME:ModifierData",
[
"NAME:ThermalModifierData",
"modifier_data:=" , "thermal_modifier_data",
[
"NAME:all_thermal_modifiers",
[
"NAME:one_thermal_modifier",
"Property::=" , "permittivity",
"Index::=" , 0,
"prop_modifier:=" , "thermal_modifier",
"use_free_form:=" , True,

Definition Manager Script Commands 32-101


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"free_form_value:=" , "if(Temp > 1000cel, 1, if(Temp < -273.15cel,


1, 1))"
]
]
]
],
"permeability:=" , "0.999991",
"conductivity:=" , "58000000",
"thermal_conductivity:=" , "400",
"mass_density:=" , "8933",
"specific_heat:=" , "385",
"youngs_modulus:=" , "120000000000",
"poissons_ratio:=" , "0.38",
"thermal_expansion_coefficient:=" , "1.77e-05"
])
Transient Solve, Non-linear Drude Data Plasma
# ----------------------------------------------
# Script Recorded by Ansys Electronics Desktop Version 2023.1.0
# 14:23:56 Jun 17, 2022
# ----------------------------------------------

Definition Manager Script Commands 32-102


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oProject = oDesktop.SetActiveProject("Drude_plasma_parameters_r231")
oDefinitionManager = oProject.GetDefinitionManager()
oDefinitionManager.EditMaterial("Drude",
[
"NAME:Drude",
"CoordinateSystemType:=", "Cartesian",
"BulkOrSurfaceType:=" , 1,
[
"NAME:PhysicsTypes",
"set:=" , ["Electromagnetic"]
],
[
"NAME:AttachedData",
[
"NAME:MatNonLinearDrudeFreqDepData",
"property_data:=" , "nonlinear_drude_data",
"EpsilonInfinity:=" , "1",
"PlasmaFrequency:=" , "4.62348462366278GHz",

Definition Manager Script Commands 32-103


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"CollisionFrequency:=" , "0.00054491190162662GHz",
"FieldBreakdown:=" , "10000V_per_meter",
"PlasmaMaintainFrequency:=", "2.31174231183139GHz",
"NeutralDensity:=" , 2.65164580488373E+20,
"ElectronDensity:=" , 2.65164580488373E+17,
"CollisionRateConstant:=", 2.05499505485618E-15
]
]
])

VB Syn- EditMaterial <OriginalName>, <MatProperties>


tax

Without Modifiers:
oDefinitionManager.EditMaterial "alumina_92pct",
Array(

VB "NAME:alumina_92pct",
Example "CoordinateSystemType:=", "Cartesian",
"BulkOrSurfaceType:=", 1,
Array("NAME:PhysicsTypes",
"set:=", Array("Electromagnetic","Thermal","Structural")),

Definition Manager Script Commands 32-104


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"permittivity:=", "9.3",
"dielectric_loss_tangent:=", "0.008",
"thermal_conductivity:=", "26",
"mass_density:=", "3720",
"specific_heat:=", "790",
"youngs_modulus:=", "267000000000",
"poissons_ratio:=", "0.26",
"thermal_expansion_coeffcient:=", "7.2e-006"
)
With Thermal Modifier:
oDefinitionManager.EditMaterial "copper",
Array("NAME:copper",
"CoordinateSystemType:=", "Cartesian",
"BulkOrSurfaceType:=" , 1,
Array("NAME:PhysicsTypes",
"set:=" , Array("Electromagnetic","Thermal","Structural")),
Array("NAME:ModifierData",
Array("NAME:ThermalModifierData",
"modifier_data:=" , "thermal_modifier_data",
Array("NAME:all_thermal_modifiers",
Array("NAME:one_thermal_modifier",

Definition Manager Script Commands 32-105


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Property::=" , "permittivity",
"Index::=" , 0,
"prop_modifier:=" , "thermal_modifier",
"use_free_form:=" , True,
"free_form_value:=" , "if(Temp > 1000cel, 1, if(Temp < -273.15cel,
1, 1))"
)
)
)
),
"permeability:=" , "0.999991",
"conductivity:=" , "58000000",
"thermal_conductivity:=" , "400",
"mass_density:=" , "8933",
"specific_heat:=" , "385",
"youngs_modulus:=" , "120000000000",
"poissons_ratio:=" , "0.38",
"thermal_expansion_coefficient:=" , "1.77e-05"
)

Definition Manager Script Commands 32-106


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Edit [padstack manager]


Use: Edit an existing padstack.
Command: Tools > Edit Configured Libraries > Padstacks > Edit Padstack
Syntax: Edit <PadstackName>,
Array("NAME:<NewPadstackName>",
"ModTime:=", <ModifiedOnInfo>,
"Library:=", "", // name of the library
"LibLocation:=", "Project", // location of the named library
Array("NAME:psd",
"nam:= ", <PadstackName>,
"lib:=", "", // name of the library
"mat:=", "", // hole plating material
"plt:=", "0", // percent of hole's radius filled by plating
Array("NAME:pds",
<LayerGeometryArray>,
<LayerGeometryArray....),
"hle:=", <PadInfo>
"hRg:=", <HoleRange>,
"sbsh:=", <SolderballShape>,
"sbpl:=", <SolderballPlacement>,
"sbr:=", <string>, // solderball diameter, real with units

Definition Manager Script Commands 32-107


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"sb2:=", <string>, // solderball mid diameter, real with units


"sbn:=", <string>), // name of solderball material
"ppl:=", <PadPortLayerArray>)
Return Value: <string> // composite name of the padstack
// If the name requested conflicts with the name of an existing
// padstack, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.

Parameters: <PadstackName>:
<string> // composite name of padstack to edit

<NewPadstackName>:
<string> // new simple name for padstack

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.

<LayerGeometryArray>:
Array("Name:lgm",

Definition Manager Script Commands 32-108


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"lay:=", <string>, // definition layer name


"id:=", <int>, // definition layer id
"pad:=", <PadInfo>, // pad
"ant:=", <PadInfo>, // antipad
"thm:=", <PadInfo>, // themal pad
"X:=", <string>, // pad x connection, real with units
"Y:=", <string>, // pad y connection, real with units
"dir:=", <DirectionString>) // pad connection direction

<PadInfo>:
Array("shp:=", <PadShape>,
"Szs:=", <DimensionArray>,
"X:=", <string>, // x offset, real with units
"Y:=", <string>, // y offset, real with units
"R:=", <string>) // rotation, real with units

<PadShape>:
<string> one of these choices
"No" // no pad
"Cir" // Circle
"Sq" // Square

Definition Manager Script Commands 32-109


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Rct" // Rectangle
"Ov" // Oval
"Blt" // Bullet
"Ply" // Polygons
"R45" // Round 45 thermal
"R90" // Round 90 thermal
"S45" // Square 45 thermal
"S90" // Square 90 thermal

<DimensionArray>:
Array(<string>, ...) // each string is a real with units for one of the
// dimensions of the shape

<DirectionString>:
<string> one of these choices
"No" // no direction
"Any" // any direction
"0" // 0 degrees
"45" // 45 degrees
"90" // 90 degrees

Definition Manager Script Commands 32-110


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"135" // 135 degrees


"180" // 180 degrees
"225" // 225 degrees
"270" // 270 degrees
"315" // 315 degrees

<HoleRange>:
<string> one of these choices
"Thr" // through all layout layers
"Beg" // from upper pad layer to lowest layout layer
"End" // from upper layout layer to lowest pad layer
"UTL" // from upper pad layer to lowest pad layer

<SolderballShape>:
<string> one of these choices
"None" // no solderball
"Cyl" // cylinder solderball
"Sph" // spheroid solderball

<SolderballPlacement>:
<string> one of these choices
"abv" // above padstack

Definition Manager Script Commands 32-111


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"blw" // below padstack

<PadPortLayerArray>:
Array( <int>, <int>,....) where each int is a layer id

VB Example:
oPadstackManager.Edit "Circle - through1", Array("NAME:Circle - through1", "ModTime:=", _
1235765635, "Library:=", "", "LibLocation:=", "Project", Array("NAME:psd", "nam:=", _
"Circle - through1", "lib:=", "", "mat:=", "", "plt:=", "0", Array("NAME:pds", Array("NAME:lgm",
"lay:=", _
"Top Signal", "id:=", 0, "pad:=", Array("shp:=", "Cir", "Szs:=", Array("2.5mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir", "Szs:=", Array( _
"3.5mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array("shp:=", "No", "Szs:=", Array
(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", "0mm", "dir:=", "Any"), Array("NAME:lgm",
"lay:=", _
"SignalA", "id:=", 1, "pad:=", Array("shp:=", "Cir", "Szs:=", Array("2mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir", "Szs:=", Array( _
"3mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array("shp:=", "No", "Szs:=", Array(),
"X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", "0mm", "dir:=", "Any"), Array("NAME:lgm",
"lay:=", _
"SignalB", "id:=", 2, "pad:=", Array("shp:=", "Cir", "Szs:=", Array("2mm"), "X:=", _

Definition Manager Script Commands 32-112


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir", "Szs:=", Array( _
"3mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0deg"), "thm:=", Array("shp:=", "No", "Szs:=", Array
(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", "0mm", "dir:=", "Any"), Array("NAME:lgm",
"lay:=", _
"Ground", "id:=", 3, "pad:=", Array("shp:=", "No", "Szs:=", Array(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "No", "Szs:=", Array(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array("shp:=", "R90", "Szs:=", Array( _
"3mm", "0.75mm", "1mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", _
"0mm", "dir:=", "Any"), Array("NAME:lgm", "lay:=", "Bottom signal", "id:=", 5, "pad:=", Array
("shp:=", _
"Cir", "Szs:=", Array("1mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array
("shp:=", _
"Cir", "Szs:=", Array("2mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0deg"), "thm:=", Array
("shp:=", _
"No", "Szs:=", Array(), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", _
"0mm", "dir:=", "Any")), "hle:=", Array("shp:=", "Cir", "Szs:=", Array("1.5mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "hRg:=", "End", "sbsh:=", "Sph", "sbpl:=", _
"abv", "sbr:=", "750um", "sb2:=", "1200um", "1200um", "sbn:=", "solder"), "ppl:=", Array( _
0, 1, 2, 3, 5))

ExportDataset
Exports a dataset to a named file. This can be executed by the oProject, or oDesign variables.

Definition Manager Script Commands 32-113


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Project > Datasets > Export.

Name Type Description


Parameters
<datasetFileFullPath> String The full path to the file.

Return Value None.

Python Syntax ExportDataset (<datasetFileFullPath>)


oProject.ExportDataset('e:/tmp/dsdata.txt')
Python Example
oDesign.ExportDataset('e:/tmp/dsdata.txt')

VB Syntax ExportDataset <datasetFileFullPath>


oProject.ExportDataset "e:/tmp/dsdata.txt"
VB Example
oDesign.ExportDataset "e:/tmp/dsdata.txt"

Export [footprint manager]


Use: Export a footprint to a library
Command: Tools > Edit Configured Libraries > Footprints > Export to Library
Syntax: Export Array("NAME:<LibraryName>",
<FootprintName>,
<FootprintName>...),

Definition Manager Script Commands 32-114


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<LibraryLocation>
Return Value: None
Parameters: <LibraryName>:
<string> // name of the library

<FootprintName>:
<string> // composite name of footprint to export

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

VB Example:
oFootprintManager.Export Array("NAME:mylib", "Distributed Footprints:BPAD"), "PersonalLib"

ExportMaterial
Exports a local material to a library.

UI Access Export to Library command in the material editor.

Name Type Description


<ExportData> Array ["NAME:<LibraryName>",
Parameters
<MaterialName>, <MaterialName>, ...]
<LibraryName> String Name of the exported library.

Definition Manager Script Commands 32-115


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<MaterialName> String Name of the material to be exported.


<LibraryLocation> String Location to save the library. Only "PersonalLib" and "UserLib" are
allowed.

Return Value None.

Python Syntax ExportMaterial (<ExportData>, <LibraryLocation>)


oDefinitionManager.ExportMaterial (["NAME:mylib",_
Python Example
"Material1", "Material2", "Material3"], "PersonalLib")

VB Syntax ExportMaterial <ExportData>, <LibraryLocation>


oDefinitionManager.ExportMaterial Array("NAME:mylib",_
VB Example
"Material1", "Material2", "Material3"), "PersonalLib"

Export [padstack manager]


Use: Export a padstack to a library
Command: Tools > Edit Configured Libraries > Padstacks > Export to Library
Syntax: Export Array("NAME:<LibraryName>",
<PadstackName>,
<PadstackName>...),
<LibraryLocation>

Definition Manager Script Commands 32-116


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value: None


Parameters: <LibraryName>:
<string> // name of the library

<PadstackName>:
<string> // simple name of padstack to export

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

VB Example:
oPadstackManager.Export Array("NAME:mylib", "myPadstack"), "PersonalLib"

ExportScript
Use: Export to Library in the script definition manager
Command: None
Syntax: ExportScript <ExportData>,<Library location>
Return Value: None
Parameters: <ExportData>
Array("NAME:<LibraryName>",<ScriptName>,<ScriptName>,…)
VB Example:

Definition Manager Script Commands 32-117


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oProject.ExportComponent Array("NAME:mylib", "myscript"), "PersonalLib"

Python Syntax ExportScript( <ExportData>,<Library location>)


oProject.ExportComponent
Python Example
(["NAME:mylib", "myscript"], "PersonalLib")

Export [symbol manager]


Use: Exports symbol(s) to a library
Command: Tools > Edit Configured Libraries > Symbols > Export to Library
Syntax: Export Array("NAME:<LibraryName>",
<SymbolName>,
<SymbolName>...),
<LibraryLocation>
Return Value: None
Parameters: <LibraryName>:
<string> // name of the library

<SymbolName>:
<string> // composite name of symbol to export

<LibraryLocation>:

Definition Manager Script Commands 32-118


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<string> // location of the library in <LibraryName>


// One of "Project", "PersonalLib", or "UserLib"

VB Example:
oSymbolManager.Export _
Array("NAME Nexxim Circuit Elements\Distributed\Distributed:bendo:mylib", _ "mySymbol"), "Per-
sonalLib"

GetProjextMaterialNames
Returns the material names belonging to an active Project.

UI Access N/A

Name Type Description


Parameters
None

Return Value String names of the materials in the active project.

Python Syntax GetProjectMaterialNames()


oProject = oDesktop.GetActiveProject()
oDefinitionManager = oProject.GetDefinitionManager()
Python Example
materials = oDefinitionManager.GetProjectMaterialNames()
AddWarningMessage(str(materials))

Definition Manager Script Commands 32-119


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetPropertyValue
Returns the value of a single property belonging to a specific <PropServer> and <PropTab>. This function is available with the Project,
Design or Editor objects, including definition editors.

Tip:

Use the script recording feature and edit a property, and then view the resulting script to see the format for that property.

UI Access N/A

Name Type Description


<PropTab> String One of the following, where tab titles are shown in parentheses:
l PassedParameterTab ("Parameter Values")
l DefinitionParameterTab (Parameter Defaults")
l LocalVariableTab ("Variables" or "Local Variables")
l ProjectVariableTab ("Project variables")
l ConstantsTab ("Constants")
Parameters
l BaseElementTab ("Symbol" or "Footprint")
l ComponentTab ("General")
l Component("Component")
l CustomTab ("Intrinsic Variables")
l Quantities ("Quantities")
Signals ("Signals")
l

<PropServer> String An object identifier, generally returned from another script method, such as

Definition Manager Script Commands 32-120


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Comp-
Inst@R;2;3
<PropName> String Name of the property.

Return Value String value of the property.

Python Syntax GetPropertyValue (<PropTab>, <PropServer>, <PropName>)


selectionArray = oEditor.GetSelections()
for k in selectionArray:
Python Example
val = oEditor.GetPropertyValue("PassedParameterTab", k, "R")
...

VB Syntax GetPropertyValue (<PropTab>, <PropServer>, <PropName>)


selectionArray = oEditor.GetSelections
for k in selectionArray:
VB Example
val = oEditor.GetPropertyValue("PassedParameterTab", k, "R")
...

ImportDataset
Imports a dataset from a named file. This can be executed by the oProject, or oDesign variables. The name of the dataset is file-
name+index number (e.g., dsdata1) unless the filename ends with a trailing number. When there is a trailing number at the end, we
will remove the number and use first unused index.

Definition Manager Script Commands 32-121


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UI Access Project > Datasets > Import.

Name Type Description


Parameters
<datasetFileFullPath> String The full path to the file containing the dataset values.

Return Value None.

Tab-delimited or space-delimited files with the extension ".tab" is the recommended file type to be used.
For importing datasets at the Design level, this is the only file type supported.
At the Project level, other file types (e.g., ".csv") are supported. However, after calling the command, you must configure the file import
format manually through the GUI as shown in the figure below.

Definition Manager Script Commands 32-122


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax ImportDataset (<datasetFileFullPath>)


oProject.ImportDataset('e:\tmp\dsdata.tab')
Python Example
oDesign.ImportDataset('e:\tmp\dsdata.tab')

Definition Manager Script Commands 32-123


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax ImportDataset <datasetFileFullPath>


oProject.ImportDataset "e:\tmp\dsdata.tab"
VB Example
oDesign.ImportDataset "e:\tmp\dsdata.tab"

Remove [component manager]


Remove a component from a library
Command: Tools > Edit Configured Libraries > Components > Remove Component
Syntax: Remove <ComponentName>,
<IsProjectComponent>,
<LibraryName>,
<LibraryLocation>
Return Value: None
Parameters: <ComponentName>:
<string> // composite name of the component to remove

<IsProjectComponent>:
<bool>

<LibraryName>:
<string> // name of the library

Definition Manager Script Commands 32-124


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

VB Example:
oComponentManager.Remove "Nexxim Circuit Elements\BJTs:Level01_NPN", _ true, "Project"

Python Syntax Remove (<ComponentName>, <IsProjectComponent>, <LibraryName>, <LibraryLocation>)


oComponentManager.Remove ("Simplorer Circuit
Python Example
Elements\BJTs:Level01_NPN", _ true, "Project")

Remove [footprint manager]


Use: Removes a footprint from a library
Command: Tools > Edit Configured Libraries > Footprints > Remove Footprint
Syntax: Remove <FootprintName>,
<IsProjectFootprint>,
<LibraryName>,
<LibraryLocation>
Return Value: None
Parameters: <FootprintName>:

Definition Manager Script Commands 32-125


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<string> // composite name of the footprint to remove

<IsProjectFootprint>:
<bool>

<LibraryName>:
<string> // name of the library

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

VB Example:
oFootprintManager.Remove "BPAD", true, "Distributed Footprints", "Project"
oFootprintManager.Remove "BPAD", false, "MyLib", "PersonalLib"

RemoveMaterial
Removes a material from a library.

UI Access Remove Material(s) command in the material editor

Parameters Name Type Description

Definition Manager Script Commands 32-126


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<MaterialName> String Name of the material to be removed.


<IsProjectMaterial> Boolean If True, HFSS assumes the material is a project material. The last two
parameters will be ignored.
If False, the material is not a project material.
<LibraryName> String Name of the user or personal library where the material resides.
<LibraryLocation> String Location of library. Valid options:"UserLib" or "PersonalLib".

Return Value None.

RemoveMaterial (<MaterialName>, <IsProjectMaterial>,


Python Syntax
<LibraryName>, <LibraryLocation>)
oDefinitionManager.RemoveMaterial ([
Python Example
"Material1", false, "mo0907","UserLib"])

RemoveMaterial <MaterialName>, <IsProjectMaterial>,


VB Syntax
<LibraryName>, <LibraryLocation>
oDefinitionManager.RemoveMaterial
VB Example
"Material1", false, "mo0907","UserLib"

Remove [padstack manager]


Use: Removes a padstack from a library
Command: Tools > Edit Configured Libraries > Padstacks > Remove Padstacks
Syntax: Remove <PadstackName>,

Definition Manager Script Commands 32-127


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<IsProjectPadstack>,
<LibraryName>,
<LibraryLocation>
Return Value: None
Parameters: <PadstackName>:
<string> // simple name of the padstack to remove

<IsProjectPadstack>:
<bool>

<LibraryName>:
<string> // name of the library

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

VB Example:

oPadstackManager.Remove "Polygon SMT", true, "Padstacks", "Project"


oPadstackManager.Remove "Polygon SMT", false, "MyLib", "PersonalLib"

Definition Manager Script Commands 32-128


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

RemoveScript
Use: Remove Script in the script definition manager
Command: None
Syntax: RemoveScript <ScriptName>,<IsProjectScript>, <LibraryName>,<LibraryLocation>
Return Value: None
Parameters: <ScriptName>
Type: <string>
<IsProjectScript>
Type: <bool>
<LibraryName>
Type: <string>
<LibraryLocation>
Type: <string>
VB Example:
oDefinitionManager.RemoveScript "myscript", true, "Local", "Project"

Python Syntax RemoveScript (<ScriptName>,<IsProjectScript>, <LibraryName>,<LibraryLocation>)


oDefinitionManager.RemoveScript(
Python Example
"myscript", true, "Local", "Project")

Definition Manager Script Commands 32-129


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Remove [symbol manager]


Use: Removes a symbol from a library
Command: Tools > Edit Configured Libraries > Symbols > Remove Symbol
Syntax: Remove <SymbolName>,
<IsProjectSymbol>,
<LibraryName>,
<LibraryLocation>
Return Value: None
Parameters: <SymbolName>:
<string> // composite name of the symbol to remove

<IsProjectSymbol>:
<bool>

<LibraryName>:
<string> // name of the library

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

Definition Manager Script Commands 32-130


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example:
oSymbolManager.Remove "Nexxim Circuit Elements\Distributed\Distributed:bendo", true, "Project"

RemoveUnusedDefinitions
Removes any unused project definitions.

UI Access Tools > Project Tools > Remove Unused Definitions.

Name Type Description


Parameters
<Definitions> Array Definitions to be removed, such as materials and surface materials.

Return Value None.

Python Syntax RemoveUnusedDefinitions(<Definitions>)


oProject.RemoveUnusedDefinitions(
[
[
"NAME:Materials",
Python Example
"Al-Extruded"
],
[
"NAME:SurfaceMaterials",

Definition Manager Script Commands 32-131


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Steel-oxidised-surface"
]
])

VB RemoveUnusedDefinitions <Definitions>
Syntax

VB
oProject.RemoveUnusedDefinitions Array(Array("NAME:Materials", "Al-Extruded"), Array
Exampl- ("NAME:SurfaceMaterials", _
e "Steel-oxidised-surface"))

SetPropertyValue
Sets the value of a single propertybelonging to a specific PropServer and PropTab. This function is available with the Project, Design
or Editor objects, including definition editors.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.
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.

UI Access N/A

Name Type Description


<propTab> String One of the following, where tab titles are shown in parentheses:
Parameters l PassedParameterTab ("Parameter Values")

l DefinitionParameterTab (Parameter Defaults")

Definition Manager Script Commands 32-132


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

l LocalVariableTab ("Variables" or "Local Variables")

l ProjectVariableTab ("Project variables")

l ConstantsTab ("Constants")

l BaseElementTab ("Symbol" or "Footprint")

l ComponentTab ("General")

l Component("Component")

l CustomTab ("Intrinsic Variables")

l Quantities ("Quantities")

l Signals ("Signals")
<propServer> String An object identifier, generally returned from another script method, such as
Comp-Inst@R;2;3
<propName> String Name of the property.
<propValue> String The value for the property

Return Value None.

Python Syntax SetPropertyValue(<propTab>, <propServer>, <propName>, <propValue>)


Python Example oEditor.SetPropertyValue("PassedParameterTab", "k", "R", "2200")

VB Syntax SetPropertyValue <propTab>, <propServer>, <propName>, <propValue>

Definition Manager Script Commands 32-133


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example oEditor.SetPropertyValue "PassedParameterTab", "k", "R", "2200"

UpdateDefFromBlock
Updates a material definition from block text (same definition format as would be contained in the material library file) by library type
(using definition folder name). This scripting command directly supports the .AMAT (or .ASURF) definition formats.

UI Access N/A

Name Type Description

<targetDefName> String Name of the target definition, i.e. the name of the material to update (string).
Parameters <defBlock> String Text of the new material definition in block format (string); this block could use a
new definition name, which will cause a rename as part of the update.
<defFolderName> String Library type (by definition, folder name).
<newTimeStamp> String New timestamp string (time_t as integer, number of seconds since 1/1/1970
12:00am), default is current time.

Return Value A property scripting object for the definition.

P- UpdateDefFromBlock(<targetDefName>, <defBlock>, <defFolderName>, <newTimeStamp>)


yt-
h-
o-
n
S-
y-
nt-
ax

Definition Manager Script Commands 32-134


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oProject = oDesktop.NewProject()
oProject.InsertDesign("HFSS", "HFSSDesign1", "DrivenModal", "")
oDesign = oProject.SetActiveDesign("HFSSDesign1")
oEditor = oDesign.SetActiveEditor("3D Modeler")
oDefinitionManager = oProject.GetDefinitionManager()
defBlock = "$begin 'vacuum2' $begin 'AttachedData' $begin 'MatAppearanceData' property_data-
='appearance_data' Red=230 Green=230 Blue=230 Transparency=0.95 $end 'MatAppearanceData'
$end 'AttachedData' simple('permittivity', 1) ModTime=1499970477 $end 'vacuum2'"
P- added = oDefinitionManager.AddDefinitionFromBlock(defBlock, "Materials", "10101010", True)
yt-
h- addedName = ''
o-
n
if isinstance(added, basestring):
E- addedName = added
x-
a- elif isinstance(added, list):
m-
pl- addedName = added[0]
e
else:

addedName = added.GetName().replace("Materials:", "")


AddInfoMessage(os.path.basename(__file__) + " result: " + addedName)
materialNameInQuotes = "\"" + addedName + "\""
# rename vacuum2 to vacuum3
newDefBlock = "$begin 'vacuum3' $begin 'AttachedData' $begin 'MatAppearanceData' property_
data='appearance_data' Red=230 Green=230 Blue=230 Transparency=0.95 $end 'MatAppearanceData'
$end 'AttachedData' simple('permittivity', 1) ModTime=1499970477 $end 'vacuum3'"

Definition Manager Script Commands 32-135


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

updatedObj = UpdateDefFromBlock(addedName, newDefBlock, "Materials")

Component Manager Script Commands


The component manager provides access to components in a project. The manager object is accessed via the definition manager.
Set oDefinitionManager = oProject.GetDefinitionManager()
Set oComponentManager = oDefinitionManager.GetManager("Component")
The topics for this section include:
Add
AddDynamicNPortData
AddNPortData
AddSolverOnDemandModel
ClearSolutionCache
Edit
EditSolverOnDemandModel
EditWithComps
Export
GetNPortData
GetSolverOnDemandData
GetSolverOnDemandModelList
Remove
RemoveSolverOnDemandMode

Definition Manager Script Commands 32-136


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UpdateDynamicLink
Add [component manager]
Use:Add a component
Command: Tools > Edit Configured Libraries > Components > Add Component
Syntax:Add Array("NAME:<ComponentName>",
"Info:=", <ComponentInfo>,
"RefBase:=", <string>, // reference designator
"NumParts:=", <int>, // parts per component
"OriginalComponent:=", <string>
"Terminal:=", <TerminalInfo>,
"Terminal:=", <TerminalInfo>, ...
// The remaining parameters are optional
Array("NAME:Parameters", // any combo of the following
"VariableProp:=", <VariableInfo>,
"CheckboxProp:=", <CheckBoxInfo>,
"ButtonProp:=", <ButtonInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>),

Definition Manager Script Commands 32-137


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Properties", // any combo of the following


"CheckboxProp:=", <CheckBoxInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>),
"VPointProp:=", <VPointInfo>,
"PointProp:=", <PointInfo>),
Array("Quantities",
"QuantityProp:=", <QuantityPropInfo>...),
Array("NAME:CosimDefinitions",
<CosimDefInfo>,
<CosimDefInfo>...)
Return Value:<string>
// composite name of the component.
// If the name requested conflicts with the name of an existing
// component, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.

Definition Manager Script Commands 32-138


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters:<ComponentName>:
<string> // simple name of the component

<ComponentInfo>:
Array("Type:=", <TypeInfo>,
"NumTerminals:=", <int>,
"DataSource:=", <string>,
"ModifiedOn:=", <ModifiedOnInfo>,
"Manufacturer:=", "<string>,
"Symbol:=", <string>,
"Footprint:=", <string>,
"Description:=", <string>,
"InfoTopic:=", <string>,
"InfoHelpFile:=", <string>,
"IconFile:=", <string>,
"LibraryName:=", "",
"OriginalLocation:=", "Project", // Project Location
"Author:=", <string>,
"OriginalAuthor:=", <string>,
"CreationDate:= ", <int>)

Definition Manager Script Commands 32-139


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<TypeInfo>:
An integer that is the or-ing of bits for each product listed below. The default setting is 0xffffffff (4294967295) which indicates
valid for all products. In the component editing dialog, checking different boxes in the "Specify products for which this com-
ponent is valid" grid control sets specific flags that correspond to the following hex/decimal settings:
Nexxim -- 100 binary, 4 decimal, 0x4
SIwaveDeNovo -- 1000 binary, 8 decimal, 0x8
Simplorer -- 10000 binary, 16 decimal, 0x10
MaxwellCircuit -- 100000 binary, 32 decimal, 0x20

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed since 00:00 hours, Jan 1, 1970 UTC from the sys-
tem clock.

<TerminalInfo>:
Array(<string>, // symbol pin
<string> // footprint pin
<string >, // gate name
<bool>, // shared
<int>, // equivalence number
<int>, // what to do if unconnected: flag as error:0, ignore:1
<string> // description

Definition Manager Script Commands 32-140


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<Nature>)

<Nature>:
<string> // content varies as follows

Nexxim/Circuit:
"Electrical" // the only choice

Simplorer:
// several choices
"Electrical", "Magnetic", "Fluidic", "Translational",
"Translational_V", "Rotational", "Rotational_V",
""Radiant", "Thermal", or <VHDLPackageName>

<VHDLPackageName>:
<string> // in the form <Library>.<Package>

<Library>:
<string> // name of the VHDL library

<Package>:

Definition Manager Script Commands 32-141


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<string> // name of the VHDL package

<VariableInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: number, variable, or expression

<FlagLetters>:
<string> // "D" - has description parameter,
// "RD" - readonly & has description parameter,
// or "RHD" - readonly, hidden, & has description parameter

<CheckBoxInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<bool>) // value: true or false

Definition Manager Script Commands 32-142


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ButtonInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
<string>, // button title
<string>, // extra text
<ClientID>,
"ButtonPropClientData:= ", <ClientDataArray>)

<ClientID>:
<int> // specifies Button Prop Client
// 0 - unknown, ButtonPropClientData
// array will be empty
// 1 - Netlist Prop Client
// 2 - not used
// 3 - File Name Prop Client

<ClientDataArray>:
varies with <ClientID>

Definition Manager Script Commands 32-143


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ClientId> is 0 or 1: empty array


Array()

<ClientID> is 3:
Array("InternalFormatText:=", "<prefix><RelativePath>")

<prefix>:
<string> // "<Project>", "<PersonalLib>", "<UserLib>", or "<SysLib>"

<RelativePath>:
<string> // relative path to file from <prefix>

<TextInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: a text string

<NumberInfo>:

Definition Manager Script Commands 32-144


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<real>, // value: a number
<string>) // units

<SeparatorInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: a text string

<ValueInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: a number, variable or expression

<MenuPropInfo>:

Definition Manager Script Commands 32-145


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array(<string>, // name
<FlagLetters>,
<string>, // description
<string>, // menu choices - separated by commas
<int>) // 0 based index of current menu choice

<VPointInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>, // x value: number with length units
<string>) // y value: number with length units

<PointInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<real>, // x value
<real>) // y value

Definition Manager Script Commands 32-146


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<QuantityPropInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
<string>, // value
<TypeString>,
<TypeStringDependentInfo>)

<TypeString>:
<string> // "Across", "Through", or "Free"

<TypeStringDependentInfo>:

<TypeString> is "Free" :
<string>, // direction: "In", "Out", "InOut", or "DontCare"
// Following <string> is not present if direction is "DontCare"
<string> // when to calculate: "BeforeAnalogSolver",
// "BeforeStateGraph", "AfterStateGraph", or "DontCareWhen"

<TypeString> is "Across" or "Through":


<int>, // terminal 1

Definition Manager Script Commands 32-147


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<int> // terminal 2

<CosimDefInfo>:
Array("NAME:CosimDefinition",
"CosimulatorType:=", <int>,
"CosimDefName:=", <string> // "HFSS 3D Layout", "Circuit",
// "Custom", or "Netlist"
"IsDefinition:=", <bool>,
final array member(s) vary with CosimDefName)

final array members for HFSS 3D Layout:


"CosimStackup:=", <string>,
"CosimDmbedRatio:=", <int>

final array members for Circuit:


"ExportAsNport:=", <int>,
"UsePjt:=", <int>

final array member for Custom:


"DefinitionCompName:=", <string>

Definition Manager Script Commands 32-148


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

final array member for Netlist:


"NetlistString:=", <string>

VB Example:
Dim name
oComponentManager.Add (Array("NAME:MyComponent", _
"Info:=", Array("Type:=", 4294901767, _
"NumTerminals:=", 2, _
"DataSource:=", "", _
"ModifiedOn:=", 1071096503, _
"Manufacturer:=", "Ansys", _
"Symbol:=", "bendo", _
"Footprint:=", "BENDO", _
"Description:=", "",_
"InfoTopic:=", "", _
"InfoHelpFile:=", "", _
"IconFile:=", "", _
"LibraryName:=", "", _
"OriginalLocation:=", "Project", _
"Author:=", "", _

Definition Manager Script Commands 32-149


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"OriginalAuthor:=", "", _
"CreationDate:= ", 1147460679), _
"Refbase:=", "U", _
"NumParts:=", 1, _
"OriginalComponent:=", "", _
"Terminal:=", Array("n1", _
"n1", _
"A", _
false, _
0, _
1, _
"", _
"Electrical"), _
"Terminal:=", Array("n2", _
"n2", _
"A", _
false, _
1, _
0, _
"", _

Definition Manager Script Commands 32-150


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Electrical"), _
Array("NAME:Parameters", _
"MenuProp:=", Array("CoSimulator", _
"D", _
"", _
"Default,HFSS 3D Layout,Circuit,Custom,Netlist", _
0), _
"ButtonProp:=", Array("CosimDefinition", _
"D", _
"", _
"", _
"Edit", _
0, _
"ButtonPropClientData:=", Array())), _
Array("NAME:CosimDefinitions", _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 0, _
"CosimDefName:=", "HFSS 3D Layout", _
"IsDefinition:=", true, _
"CosimStackup:=", "Layout stackup", _
"CosimDmbedRatio:=", 3), _

Definition Manager Script Commands 32-151


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:CosimDefinition", _
"CosimulatorType:=", 1, _
"CosimDefName:=", "Circuit", _
"IsDefinition:=", true, _
"ExportAsNport:=", 0, _
"UsePjt:=", 0), _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 2, _
"CosimDefName:=", "Custom", _
"IsDefinition:=", true, _
"DefinitionCompName:=", ""), _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 3, _
"CosimDefName:=", "Netlist", _
"IsDefinition:=", true, _
"NetlistString:=", "")))

Add [("NAME:<ComponentName>",
Python Syntax "Info:=", <ComponentInfo>,
"RefBase:=", <string>, // reference designator

Definition Manager Script Commands 32-152


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NumParts:=", <int>, // parts per component


"OriginalComponent:=", <string>
"Terminal:=", <TerminalInfo>,
"Terminal:=", <TerminalInfo>, ...
The remaining parameters are optional.
["NAME:Parameters", // any combo of the following
"VariableProp:=", <VariableInfo>,
"CheckboxProp:=", <CheckBoxInfo>,
"ButtonProp:=", <ButtonInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>],
["NAME:Properties", Any combination of the following:
"CheckboxProp:=", <CheckBoxInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>,

Definition Manager Script Commands 32-153


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"VPointProp:=", <VPointInfo>,
"PointProp:=", <PointInfo>],
["Quantities",
"QuantityProp:=", <QuantityPropInfo>...],
["NAME:CosimDefinitions",
<CosimDefInfo>,
<CosimDefInfo>...]]

oComponentManager.Add(
[
"NAME:Component",
"Info:=", [
"Type:=", 0,
"NumTerminals:=", 0,
Python Example "DataSource:=", "",
"ModifiedOn:=", 1467910752,
"Manufacturer:=", "",
"Symbol:=", "Component",
"ModelNames:=", "",
"Footprint:=", "",
"Description:=" , "",

Definition Manager Script Commands 32-154


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"InfoTopic:=", "",
"InfoHelpFile:=", "",
"IconFile:=", "",
"Library:=", "",
"OriginalLocation:=", "Project",
"IEEE:=", "",
"Author:=", "",
"OriginalAuthor:=", "",
"CreationDate:=", 1467910746,
"ExampleFile:=", ""],
"Refbase:=", "U",
"NumParts:=", 1,
"ModSinceLib:=", True,
"CompExtID:=", 2
])

AddDynamicNPortData [component manager]


Adds a component using the specified data
Command: Project Menu > Add Model > Add 2DExtractor Model
Project Menu > Add Model > Add HFSS Model
Project Menu > Add Model > Add Nexsys Matlab Model
Project Menu > Add Model > Add Nport Model

Definition Manager Script Commands 32-155


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Project Menu > Add Model > Add Parametric Model


Project Menu > Add Model > Add Q3D Model
Project Menu > Add Model > Add SIwave Model
Project Menu > Add Model > Add State-space Model
Syntax: AddDynamicNPortData Array("NAME:<ComponentDataName>",
"ComponentDataType:=", <DataType>,
"name:=", <string>, // Name of the item
"filename:=", <string>, // Path to the file to find the data>
"numberofports:=", <int>,
"DesignName:=", <string>, // Name of the internal design
"SolutionName:=", <string>, // Name of the solution to reference
"Simulate:=", <bool>,
"CloseProject:=", <bool>,
"SaveProject:=", <bool>,
"RefNode:=", <bool>,
"InterpY:=", <bool>, // true to choose interpolating
"InterpAlg:=", <InterpolationAlgorithm>,
"NewToOldMap:=", <NewToOldMapPairs>,
"OldToNewMap:=", <OldToNewMapPairs>,
"PinNames:=", Array(<string>, <string>...))

Definition Manager Script Commands 32-156


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value: <string>


// composite name of the component.
// If the name requested conflicts with the name of an existing
// component, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.
Parameters: <ComponentDataName>:
<string> // simple name of the component

<DataType>:
<string> // "DesignerData" or "Q3DData"

<InterpolationAlgorithm>:
<string> // "auto", "lin", "shadH", or "shadNH"

<NewToOldMapPairs>:
Array of name/value pairs such as "V1", "V2" that will have the new variable name first and the old variable name second.

<OldToNewMapPairs>:
Array of name/value pairs such as "V1", "V2" that will have the old variable name first and the new variable name second.
VB Example:
oComponentManager.AddDynamicNPortData

Definition Manager Script Commands 32-157


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:ComponentData", _
"ComponentDataType:=", "DesignerData", _
"name:=", "DesignerData", _
"filename:=", _
"C:/Program Files/AnsysEM/Designer/Examples/Projects/optiguides/optiguides.adsn", _
"numberofports:=", 2, _
"DesignName:=", "DesignerModel1", _
"SolutionName:=", "Setup1 : Adaptive_1", _
"Simulate:=", true, _
"CloseProject:=", false, _
"SaveProject:=", true, _
"RefNode:=", false, _
"InterpY:=", true, _
"InterpAlg:=", "auto", _
"NewToOldMap:=", Array("nport_height:=", "$height", _
"nport_length:=", "$length", _
"nport_width:=", "$width"), _
"OldToNewMap:=", Array("$height:=", "nport_height", _
"$length:=", "nport_length", _
"$width:=", "nport_width"), _

Definition Manager Script Commands 32-158


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PinNames:=", Array( "WavePort1:1", "WavePort2:1"))


AddNPortData [component manager]
Use: Adds a component using the specified data
Command: Project Menu > Add Model > Add Nport Model
Syntax: AddNPortData Array("NAME:<ComponentDataName>",
"ComponentDataType:=", "NportData",
"name:=", <string>, // Name of the item
"filename:=", <string>, // Path to the file to find the data
"numberofports:=", <int>,
"filelocation:=", <LocationType>,
"domain:=", <string>, // "time" or "frequency"
"datamode:=", <string> // "EnterData", "Import", or "Link"
"devicename:=", <string>,
"ImpedanceTab:=", <bool>,
"NoiseDataTab:=", <bool>,
"DCBehaviorTab:=", <bool>,
"SolutionName:=", <string>,
"displayformat:=", <DisplayInfo>,
"datatype:=", <string>, // "SMatrix", "YMatrix", or "ZMatrix"
"ShowRefPin:=", <bool>,
"RefNodeCheckbox:=", <bool>, ...

Definition Manager Script Commands 32-159


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ProductOptionsInfo>)
Return Value: <string>
// composite name of the component.
// If the name requested conflicts with the name of an existing
// component, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.

Parameters: <ComponentDataName>:
<string> // simple name of the component

<LocationType>:
<string> // one of "UsePath", "PersonalLib", "UserLib", "SysLib",
// or "Project".

<dcInfo>:
<string> // one of "DCOpen", "DCShort", "DCShShort",
// "DCNone", or "DCEmpty".

<DisplayInfo>:
<string> // one of "MagnitudePhase", "RealImaginary",

Definition Manager Script Commands 32-160


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

// or "DbPhase".

<ProductOptionsInfo>:
// The remaining parameters differ by product

// HFSS 3D Layout - doesn't support interpolation/DC behavior


"DCOption:=", -1,
"InterpOption:=", -1,
"ExtrapOption:=",-1,
"DataType:=", 0

// Nexxim
"DCOption:=", <NexximDCOption>,
"InterpOption:=", <NexximInterpOption>,
"ExtrapOption:=", <NexximExtrapOption>,
"DataType:=", 2

<NexximDCOption>:
<int> // 0 : Zero Padding
// 1 : Same as last point
// 2 : Linear extrapolation from last 2 points

Definition Manager Script Commands 32-161


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

// 3 : Constant magnitude, linear phase extrapolation


// 4 : Leave all signal lines open circuited
// 5 : Short all signal lines together
// 6 : Short all signal lines to ground

<NexximInterpOption>:
<int> // 0 : Step
// 1 : Linear

<NexximExtrapOption>:
<int> // 0 : Zero padding
// 1 : Same as last point
// 2 : Linear extrapolation from last 2 points
// 3 : Constant magnitude, linear phase extrapolation

<CircuitDCOption>:
<int> // 0 : Leave all signal lines open circuited
// 1 : Short all signal lines together
// 2 : Short all signal lines to ground
// 3 : Extrapolate from data provided (not recommended)

Definition Manager Script Commands 32-162


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<CircuitInterpOption>:
<int> // 0 : Linear
// 1 : Cubic spline
// 2 : Rational polynomial

<CircuitExtrapOption>:
<int> // 0 : Same as interpolation
// 1 : Zero padding
// 2 : Same as last point
VB Example:
oComponentManager.AddNPortData Array("NAME:ComponentData", _
"ComponentDataType:=", "NPortData", _
"name:=", "NportData", _
"filename:=", "", _
"numberofports:=", 2, _
"filelocation:=", "UsePath", _
"domain:=", "frequency", _
"datamode:=", "Import", _
"devicename:=", "", _
"ImpedenceTab:=", true, _

Definition Manager Script Commands 32-163


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NoiseDataTab:=", true, _
"DCBehaviorTab:=", true, _
"SolutionName:=", "", _
"displayformat:=", "MagnitudePhase", _
"datatype:=", "SMatrix", _
"ShowRefPin:=", true, _
"RefNodeCheckbox:=", false, _
"DCOption:=", 3, _
"InterpOption:=", 1, _
"ExtrapOption:=", 3, _
"DataType:=", 2, _
"DCOption:=", 3, _
"InterpOption:=", 1, _
"ExtrapOption:=", 3, _
"DataType:=", 2)
AddSolverOnDemandModel
Use: This method looks for a local component of the name passed in, and to this component it adds an SOD model definition using the
information passed in the VARIANT. It returns the name of the SOD model added.
Parameters: BSTR component name.
Parameters: VARIANT which is the SOD model data.

Definition Manager Script Commands 32-164


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value: Returns the name of the model added.


ClearSolutionCache [component manager]
Use: Clear the solution cache for dynamic link component.
Command:Each of the following commands will clear the solution cache:
— Dynamic Link Item RCM > Clear Solution Cache
— Dynamic Link Component in schematic RCM > Clear Solution Cache
Syntax: ClearSolutionCache <Component Name >
Return Value: None
Parameters: <component name> is the name of the dynamic link component
VB Example:
oComponentManager.ClearSolutionCache "TeeModel1"
Edit [component manager]
Modifies an existing component
Command: Tools > Edit Configured Libraries > Components > Edit Component
Syntax: Edit <ComponentName>,
Array("NAME:<NewComponentName>",
"Info:=", <ComponentInfo>,
"RefBase:=", <string>, // reference designator
"NumParts:=", <int>, // parts per component
"OriginalComponent:=", <string>
"Terminal:=", <TerminalInfo>,

Definition Manager Script Commands 32-165


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Terminal:=", <TerminalInfo>, ...


// The remaining parameters are optional
Array("NAME:Parameters", // any combo of the following
"VariableProp:=", <VariableInfo>,
"CheckboxProp:=", <CheckBoxInfo>,
"ButtonProp:=", <ButtonInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>),
Array("NAME:Properties", // any combo of the following
"CheckboxProp:=", <CheckBoxInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>),
"VPointProp:=", <VPointInfo>,
"PointProp:=", <PointInfo>),

Definition Manager Script Commands 32-166


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("Quantities",
"QuantityProp:=", <QuantityPropInfo>...),
Array("NAME:CosimDefinitions",
<CosimDefInfo>,
<CosimDefInfo>...)
Return Value: <string>
// composite name of the component.
// If the name requested conflicts with the name of an existing
// component, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.

Parameters: <ComponentName>:
<string> // composite name of the component to edit

<NewComponentName>:
<string> // new simple name for the component

<ComponentInfo>:
Array("Type:=", <TypeInfo>,
"NumTerminals:=", <int>,
"DataSource:=", <string>,

Definition Manager Script Commands 32-167


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ModifiedOn:=", <ModifiedOnInfo>,
"Manufacturer:=", "<string>,
"Symbol:=", <string>,
"Footprint:=", <string>,
"Description:=", <string>,
"InfoTopic:=", <string>,
"InfoHelpFile:=", <string>,
"IconFile:=", <string>,
"LibraryName:=", <string>,
"OriginalLocation:=", <string>, // Project Location
"Author:=", <string>,
"OriginalAuthor:=", <string>,
"CreationDate:= ", <int>)

<TypeInfo>:
An integer that is the or-ing of bits for each product listed below. The default setting is 0xffffffff (4294967295) which indicates
valid for all products. In the component editing dialog, checking different boxes in the "Specify products for which this com-
ponent is valid" grid control sets specific flags that correspond to the following hex/decimal settings:
Nexxim -- 100 binary, 4 decimal, 0x4
SIwaveDeNovo -- 1000 binary, 8 decimal, 0x8
Simplorer -- 10000 binary, 16 decimal, 0x10

Definition Manager Script Commands 32-168


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

MaxwellCircuit -- 100000 binary, 32 decimal, 0x20

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed since 00:00 hours, Jan 1, 1970 UTC from the sys-
tem clock.

<TerminalInfo>:
Array(<string>, // symbol pin
<string> // footprint pin
<string >, // gate name
<bool>, // shared
<int>, // equivalence number
<int>, // what to do if unconnected: flag as error:0, ignore:1
<string>, // description
<Nature>)

<Nature>:
<string> // content varies as follows

Nexxim/Circuit:
"Electrical" // the only choice

Definition Manager Script Commands 32-169


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Simplorer:
// several choices
"Electrical", "Magnetic", "Fluidic", "Translational",
"Translational_V", "Rotational", "Rotational_V",
""Radiant", "Thermal", or <VHDLPackageName>

<VHDLPackageName>:
<string> // in the form <Library>.<Package>

<Library>:
<string> // name of the VHDL library

<Package>:
<string> // name of the VHDL package

<VariableInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description

Definition Manager Script Commands 32-170


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"CB:=", <string>, // optional - script for call back


<string>) // value: number, variable, or expression

<FlagLetters>:
<string> // "D" - has description parameter,
// "RD" - readonly & has description parameter,
// or "RHD" - readonly, hidden, & has description parameter

<CheckBoxInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<bool>) // value: true or false

<ButtonInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
<string>, // button title
<string>, // extra text

Definition Manager Script Commands 32-171


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ClientID>,
"ButtonPropClientData:= ", <ClientDataArray>)

<ClientID>:
<int> // specifies Button Prop Client
// 0 - unknown, "ButtonPropClientData
// array will be empty
// 1 - Netlist Prop Client
// 2 - not used
// 3 - File Name Prop Client

<ClientDataArray>:
varies with <ClientID>

<ClientID> is 0 or 1: empty array


Array()

<ClienID> is 3:
Array("InternalFormatText:=", "<prefix><RelativePath>")

Definition Manager Script Commands 32-172


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<prefix>:
<string> // "<Project>", "<PersonalLib>", "<UserLib>", or "<SysLib>"

<RelativePath>:
<string> // relative path to file from <prefix>

<TextInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: a text string

<NumberInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<real>, // value: a number
<string>) // units

<SeparatorInfo>:

Definition Manager Script Commands 32-173


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: a text string

<ValueInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: a number, variable or expression

<MenuPropInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
<string>, // menu choices - separated by commas
<int>) // 0 based index of current menu choice

<VPointInfo>:

Definition Manager Script Commands 32-174


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>, // x value: number with length units
<string>) // y value: number with length units

<PointInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<real>, // x value
<real>) // y value

<QuantityPropInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
<string>, // value
<TypeString>,

Definition Manager Script Commands 32-175


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<TypeStringDependentInfo>)

<TypeString>:
<string> // "Across", "Through", or "Free"

<TypeStringDependentInfo>:

"Free" :
<string>, // direction: "In", "Out", "InOut", or "DontCare"
// Following <string> is not present if direction is "DontCare"
<string> // when to calculate: "BeforeAnalogSolver",
// "BeforeStateGraph", "AfterStateGraph", or "DontCareWhen"

"Across" or "Through"
<int>, // terminal 1
<int> // terminal 2

<CosimDefInfo>:
Array("NAME:CosimDefinition",
"CosimulatorType:=", <int>,
"CosimDefName:=", <string> // "HFSS3D", "Circuit",

Definition Manager Script Commands 32-176


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

// "Custom", or "Netlist"
"IsDefinition:=", <bool>,
final array member(s) vary with CosimDefName)

final array members for HFSS 3D Layout:


"CosimStackup:=", <string>,
"CosimDmbedRatio:=", <int>

final array members for Circuit:


"ExportAsNport:=", <int>,
"UsePjt:=", <int>

final array member for Custom:


"DefinitionCompName:=", <string>

final array member for Netlist:


"NetlistString:=", <string>
VB Example:
Dim name
name = oComponentManager.Edit ("Nexxim Circuit Elements\BJTs:Level01_NPN", _
Array("NAME:Level01_NPN", _

Definition Manager Script Commands 32-177


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Info:=", Array("Type:=", 4294901764,_


"NumTerminals:=", 3, _
"DataSource:=", "Ansys built-in component", _
"ModifiedOn:=", 1152722112, _
"Manufacturer:=", "", _
"Symbol:=", "nexx_bjt_npn", _
"Footprint:=", "", _
"Description:=", "BJT, GP, NPN", _
"InfoTopic:=", "NXBJT1.htm", _
"InfoHelpFile:=", "nexximcomponents.chm", _
"IconFile:=", "bjtsn.bmp", _
"Library:=", "Nexxim Circuit Elements\BJTs", _
"OriginalLocation:=", "SysLibrary ", _
"Author:=", "", _
"OriginalAuthor:=", "", _
"CreationDate:=", 1152722102), _
"Refbase:=", "Q", _
"NumParts:=", 1, _
"Terminal:=", Array("collector", _
"collector", _

Definition Manager Script Commands 32-178


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"A", _
false, _
6, _
0, _
"", _
"Electrical"), _
"Terminal:=", Array("base", _
"base", _
"A", _
false, _
7, _
0, _
"", _
"Electrical"), _
"Terminal:=", Array("emitter", _
"emitter", _
"A", _
false, _
8, _
0, _
"", _

Definition Manager Script Commands 32-179


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Electrical"), _
Array("NAME:Parameters", _
"TextProp:=", Array("LabelID", _
"HD", _
"Property string for netlist ID", _
"Q@ID"), _
"TextProp:=", Array("MOD", _
"D", _
"Name of model data reference", _
"required"), _
"VariableProp:=", Array("AREA", _
"D", _
"Emitter area multiplying factor, which affects curents, resistances, and capacitances", _ "1"),
_
"VariableProp=", Array("AREAB", _
"D", _
"Base AREA", _
"1"), _
"VariableProp:=", Array( "AREAC", _
"D", _
Collector AREA", _

Definition Manager Script Commands 32-180


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"1"), _
"VariableProp:=", Array("DTEMP", _
"D", _
"The difference between element and circuit temperature deg Cel)", _
"0"), _
"VariableProp:=", Array("M", _
"D", _
"Multiplier factor to simulate multiple BJTs in paralel", _ "1"), _
"ButtonProp:=", Array("NexximNetlist", _
"HD", _
"", _
"Q@ID %0 %1 %2 *MOD(@MOD) *AREA(AREA=@AREA)" & _
" *AREAB(AREAB=@AREAB) *AREAC(AREAC=@" & _
"AREAC) *DTEMP(DTEMP=@DTEMP) *M(M=@M)", _
"Q@ID %0 %1 %2 *MOD(@MOD) " & _ "*AREA(AREA=@AREA) AREAB(AREAB=@AREAB) *AREAC(AREAC=@" & _
"AREAC) *DTEMP(DTEMP=@DTEMP) *M(M=@M)", _
1, _
"ButtonPropClientData:=", Array()), _
"TextProp:=", Array( "ModelName", _
"HD", _
"", _

Definition Manager Script Commands 32-181


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Q"))))
VB Example:
Dim name2
name2 = oComponentManager.Edit "MyComponent", _
(Array("NAME:MyOtherComponent", _
"Info:=", Array("Type:=", 4294901767, _
"NumTerminals:=", 2, _
"DataSource:=", "", _
"ModifiedOn:=", 1071096503, _
"Manufacturer:=", "Ansys", _
"Symbol:=", "bendo", _
"Footprint:=", "BENDO", _
"Description:=", "",_
"InfoTopic:=", "", _
"InfoHelpFile:=", "", _
"IconFile:=", "", _
"LibraryName:=", "", _
"OriginalLocation:=", "Project", _
"Author:=", "", _
"OriginalAuthor:=", "", _

Definition Manager Script Commands 32-182


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"CreationDate:= ", 1147460679), _


"Refbase:=", "U", _
"NumParts:=", 1, _
"OriginalComponent:=", "", _
"Terminal:=", Array("n1", _
"n1", _
"A", _
false, _
0, _
0, _
"", _
"Electrical"), _
"Terminal:=", Array("n2", _
"n2", _
"A", _
false, _
1, _
0, _
"", _
Electrical"), _
Array("NAME:Parameters", _

Definition Manager Script Commands 32-183


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MenuProp:=", Array("CoSimulator", _
"D", _
"", _
"Default,HFSS3D,Circuit,Custom,Netlist", _
0), _
"ButtonProp:=", Array("CosimDefinition", _
"D", _
"", _
"", _
"Edit", _
0, _
"ButtonPropClientData:=", Array())), _
Array("NAME:CosimDefinitions", _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 0, _
"CosimDefName:=", "HFSS3D", _
"IsDefinition:=", true, _
"CosimStackup:=", "Layout stackup", _
"CosimDmbedRatio:=", 3), _
Array("NAME:CosimDefinition", _

Definition Manager Script Commands 32-184


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"CosimulatorType:=", 1, _
"CosimDefName:=", "Circuit", _
"IsDefinition:=", true, _
"ExportAsNport:=", 0, _
"UsePjt:=", 0), _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 2, _
"CosimDefName:=", "Custom", _
"IsDefinition:=", true, _
"DefinitionCompName:=", ""), _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 3, _
"CosimDefName:=", "Netlist", _
"IsDefinition:=", true, _
"NetlistString:=", "")))

Edit <ComponentName>,
["NAME:<NewComponentName>",
Python Syntax "Info:=", <ComponentInfo>,
"RefBase:=", <string>, // reference designator
"NumParts:=", <int>, // parts per component

Definition Manager Script Commands 32-185


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"OriginalComponent:=", <string>
"Terminal:=", <TerminalInfo>,
"Terminal:=", <TerminalInfo>, ...
#The remaining parameters are optional
["NAME:Parameters", // any combo of the following
"VariableProp:=", <VariableInfo>,
"CheckboxProp:=", <CheckBoxInfo>,
"ButtonProp:=", <ButtonInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>],
["NAME:Properties", # any combo of the following
"CheckboxProp:=", <CheckBoxInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>),

Definition Manager Script Commands 32-186


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"VPointProp:=", <VPointInfo>,
"PointProp:=", <PointInfo>),
["Quantities",
"QuantityProp:=", <QuantityPropInfo>...],
["NAME:CosimDefinitions",
<CosimDefInfo>,
<CosimDefInfo>...])
name = oComponentManager.Edit ("Simplorer Circuit Elements\BJTs:Level01_NPN", _
["NAME:Level01_NPN", "Info:=", ["Type:=", 4294901764,_
"NumTerminals:=", 3, "DataSource:=", "Ansoft built-in component",_
"ModifiedOn:=", 1152722112, "Manufacturer:=", "", _
"Symbol:=", "nexx_bjt_npn", "Footprint:=", "", _
"Description:=", "BJT, GP, NPN", "InfoTopic:=", "NXBJT1.htm", _
"InfoHelpFile:=", "nexximcomponents.chm", "IconFile:=", "bjtsn.bmp", _
Python
Example "Library:=", "Nexxim Circuit Elements\BJTs",_
"OriginalLocation:=", "SysLibrary ", "Author:=", "", _
"OriginalAuthor:=", "", "CreationDate:=", 1152722102], _
"Refbase:=", "Q", "NumParts:=", 1, "Terminal:=", ["collector", _
"collector", "A", false, 6, 0, "", "Electrical"], _
"Terminal:=", ["base", "base", "A", false, _
7, 0, "", "Electrical"], "Terminal:=", ["emitter", _

Definition Manager Script Commands 32-187


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"emitter", "A", false, 8, 0, "", "Electrical"], _


["NAME:Parameters", "TextProp:=", ["LabelID", _
"HD", "Property string for netlist ID", _
"Q@ID"], "TextProp:=", ["MOD", "D", _
"Name of model data reference", "required"], _
"VariableProp:=", ["AREA", "D", _
"Emitter area multiplying factor, which affects
cur-
rents, resistances, and capacitances", "1"], _
"VariableProp:=", ["AREAB", "D", "Base AREA", _
"1"], "VariableProp:=", ["AREAC", "D", "Collector AREA", _
"1"], "VariableProp:=", ["DTEMP", "D", _
"The difference between element and circuit temperature (deg Cel)", _
"0"], "VariableProp:=", ["M", "D", _
"Multiplier factor to simulate multiple BJTs in parallel", _
"1"], "ButtonProp:=", ["NexximNetlist", "HD", "", _
"Q@ID %0 %1 %2 *MOD(@MOD) *AREA(AREA=@AREA)"& _

" *AREAB(AREAB=@AREAB) *AREAC(AREAC=@" &_


"AREAC) *DTEMP(DTEMP=@DTEMP) *M(M=@M)", _
"Q@ID %0 %1 %2 *MOD(@MOD) " & "*AREA(AREA=@AREA)

Definition Manager Script Commands 32-188


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

*AREAB(AREAB=@AREAB) *AREAC(AREAC=@" & _


"AREAC) *DTEMP(DTEMP=@DTEMP) *M(M=@M)", 1, _
"ButtonPropClientData:=", []],
"TextProp:=", ["ModelName", "HD", "", "Q"]]])

name2 = oComponentManager.Edit ("MyComponent",_

(["NAME:MyOtherComponent","Info:=", ["Type:=", 4294901767, _

"NumTerminals:=", 2, "DataSource:=", "", _

"ModifiedOn:=", 1071096503, "Manufacturer:=", "Ansoft", _


Python
Example
2 "Symbol:=", "bendo", "Footprint:=", "BENDO", _

"Description:=", "", "InfoTopic:=", "", _

"InfoHelpFile:=", "", "IconFile:=", "", _

"LibraryName:=", "", "OriginalLocation:=", "Project", _

Definition Manager Script Commands 32-189


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Author:=", "", "OriginalAuthor:=", "", _

"CreationDate:= ", 1147460679], "Refbase:=", "U", _

"NumParts:=", 1, "OriginalComponent:=", "", _

"Terminal:=", ["n1", "n1", "A", false, 0, 0, "", _

"Electrical"], "Terminal:=", ["n2", "n2", "A", _

false, 1, 0, "", Electrical"], ["NAME:Parameters", _

"MenuProp:=", ["CoSimulator", "D", "", _

"Default,Custom,Netlist", 0], "ButtonProp:=", ["CosimDefinition", _

"D", "", "", "Edit", 0, "ButtonPropClientData:=", []]], _

Definition Manager Script Commands 32-190


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

["NAME:CosimDefinitions", ["NAME:CosimDefinition", _

"CosimulatorType:=", 0, "CosimDefName:=", "HFSS3D", _

"IsDefinition:=", true, "CosimStackup:=", "Layout stackup", _

"CosimDmbedRatio:=", 3], ["NAME:CosimDefinition", _

"CosimulatorType:=", 1, "CosimDefName:=", "", _

"IsDefinition:=", true, "ExportAsNport:=", 0, _

"UsePjt:=", 0], ["NAME:CosimDefinition", _

"CosimulatorType:=", 2, "CosimDefName:=", "Custom", _

"IsDefinition:=", true, "DefinitionCompName:=", ""], _

["NAME:CosimDefinition", "CosimulatorType:=", 3, _

Definition Manager Script Commands 32-191


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"CosimDefName:=", "Netlist", "IsDefinition:=", true, _

"NetlistString:=", ""]]])

EditSolverOnDemandModel
Use: This method looks for a local component of the name passed in, and in this component it looks for an SOD model using the name
passed in the second BSTR. It modifies the SOD model using the data in the VARIANT. It returns the name of the SOD model edited.
Return Value: Returns the name of the model edited.
Parameters: BSTR component name.
Parameters: BSTR SOD model name.
Parameters: VARIANT which is the new SOD model data (can include changed name).
EditWithComps [component manager]
Edit an existing component.
Command: None
Syntax: EditWithComps <ComponentName>,
Array("NAME:<NewComponentName>",
"ModTime:=", <ModifiedTimeInfo>,
"Library:=", <string>, // Library name
"LibLocation:=", <string>, // Project Location

Definition Manager Script Commands 32-192


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<PinDefInfo>,
<PinDefInfo>,... // optional, to define pins
<GraphicsDataInfo>, // optional, to define graphics
<PropDisplayMapInfo>), // optional, to define property displays
Array(<ListOfComponentNames>) // Component names

Return Value: <string>


// composite name of the component.
// If the name requested conflicts with the name of an existing
// component, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.

Parameters: <ComponentName>:
<string> // composite name of the component being edited

<NewComponentName>:
<string> // new simple name for the component

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.

Definition Manager Script Commands 32-193


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<PinDefInfo>:
Array("NAME:PinDef",
"Pin:=", Array (<string>, // pin name
<real>, // x location
<real>, // y location
<real>, // angle in radians
<PinType>,
<real>, // line width
<real>, // line length
<bool>, // mirrored
<int>, // color
<bool>, // true if visible, false if not
<string>, // hidden net name
<OptionalPinInfo>, // optional info
<PropDisplayMapInfo>)) // optional

<PinType>:
<string> // "N" : normal pin
// "I" : input pin

Definition Manager Script Commands 32-194


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

// "O" : output pin

<OptionalPinInfo>:
// Specify both or neither
<bool>, // true if name is to be shown
<bool>, // true if number is to be shown

<PropDisplayMapInfo>:
Array("NAME:PropDisplayMap",
<PropDisplayInfo>,
<PropDisplayInfo>,...)

<PropDisplayInfo>:
<NameString>, Array(<DisplayTypeInfo>,
<DisplayLocationInfo>,
<int>, // optional, level number
<TextInfo>)

<NameString>:
<string> // PropertyName:=, where PropertyName is the name of
// the property to be displayed

Definition Manager Script Commands 32-195


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<DisplayTypeInfo>:
<int> // 0 : No display
// 1 : Display name only
// 2 : Display value only
// 3 : Display both name and value
// 4: Display evaluated value only
// 5: Display both name and evaluated value

<DisplayLocationInfo>:
<int> // 0 : Left
// 1 : Top
// 2 : Right
// 3 : Bottom
// 4 : Center
// 5 : Custom placement

<GraphicsDataInfo>:
Array("NAME:Graphics",
// one or more of the following

Definition Manager Script Commands 32-196


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<RectInfo>,
<CircleInfo>,
<ArcInfo>,
<LineInfo>,
<PolygonInfo>,
<TextInfo>,
<ImageInfo>)

<RectInfo>:
"Rect:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // angle, in radians
<real>, // x position of center
<real>, // y position of center
<real>, // width
< real>) // height

<CircleInfo>:
"Circle:=", Array(<real>, // line width
<int>, // fill pattern

Definition Manager Script Commands 32-197


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>) // radius

<ArcInfo>:
"Arc:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>, // radius
<real>, // start angle, in radians
<end>) // end angle, in radians

<LineInfo>:
"Line:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<PointInfo>, // must specify at least 2 points

Definition Manager Script Commands 32-198


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<PointInfo>...)
<PointInfo>:
<real>, // x position
<real> // y position

<PolygonInfo>:
"Polygon:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<PointInfo>, // must specify at least 3 points
<PointInfo>...)

<TextInfo>:
"Text:=", Array(<real>, // x position
<real>, // y position
<real>, // angle, in radians
<Justification>,
<bool>, // is plotter font
<string>, // font name
<int>, // color
<string>) // text string

Definition Manager Script Commands 32-199


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<Justification>:
<int> // 0 : left top
// 1 : left base
// 2 : left bottom
// 3 : center top
// 4 : center base
// 5 : center bottom
// 6 : right top
// 7 : right base
// 8 : right bottom

<ImageInfo>:
"Image:=", Array(<RectInfo>,
<ImageData>,
<bool>) // is mirrored

<ImageData>:
<string>, // file path
<int>, // 0 : use the file path and link to it

Definition Manager Script Commands 32-200


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

// 1 : ignore file path and use next parameter


<string> // text data, only present if preceding int is 1

<ListOfComponentNames>:
<string>,<string> ...
// The list may be empty. When not empty, each string that is listed is a component
// that references the component to be edited. Prior to editing, a clone of the component is
// made, and the components that are listed are modified so that they now refer to
// the clone.

VB Example:
Dim nam
oModelManager.EditWithComps_
("Nexxim Circuit Elements\Distributed\Distributed:bendo", _
Array("NAME:bendo new name", _
"ModTime:=", 1152722165, _
"Library:=", "Nexxim Circuit Elements\Distributed\Distributed", _
"LibLocation:=", "SysLibrary", _
Array("NAME:PinDef", _
"Pin:=", Array( "n1", _
-0.00254, _

Definition Manager Script Commands 32-201


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

0.00254, _
0, _
"N", _
0, _
0, _
false, _
0, _
true, _
"", _
false, _
false)), _
Array("NAME:PinDef", _
"Pin:=", Array( "n2", _
0.00254, _
-0.00254, _
1.5708, _
"N", _
0, _
0, _
false, _

Definition Manager Script Commands 32-202


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

0, _
true, _
"", _
false, _
false)), _
Array("NAME:Graphics", _
"Polygon:=", Array( 0, 0, 12566272, 0, 0.00381, 0, .00127, 0.00127, _
0.00127, 0.00127, 0, 0.00381, 0, 0.00381, _
0.002032, 0.00127, 0.00381), _
"Line:=", Array(0, 1, 12566272, -0.00254, 0.00254, 0, .00254), _
"Line:=", Array(0, 1, 12566272, 0.00254, -0.00254, .00254, 0)), _
Array("NAME:PropDisplayMap", _
"W:=", Array(3, _
5, _
0, _
"Text:=", Array( 2.1684E-019, _
0.00504119, _
0, _
1, _
5, _
false, _

Definition Manager Script Commands 32-203


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Arial", _
0, _
"W=***"))))), _
Array("MY_COMP")

Export [component manager]


Export component(s) to a library
Command: Tools > Edit Configured Libraries > Components > Export to Library
Syntax: Export Array("NAME:<LibraryName>",
<ComponentName>,
<ComponentName>...),
<LibraryLocation>
Return Value: None
Parameters: <LibraryName>:
<string> // name of the library

<ComponentName>:
<string> // composite name of the component to export

<LibraryLocation>:

Definition Manager Script Commands 32-204


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<string> // location of the library in <LibraryName>


// One of "Project", "PersonalLib", or "UserLib"

VB Example:
oComponentManager.Export Array("NAME:mylib", "Nexxim Circuit Elements\BJTs:Level01_NPN"),"Per-
sonalLib"

Python Syntax Export(["NAME:<LibraryName>", <ComponentName>, <ComponentName>...], <LibraryLocation>)


oComponentManager.Export(["NAME:mylib",
Python Example "Simplorer Circuit Elements\BJTs:Level01_NPN"],
"PersonalLib")

GetData [component manager]


Gets data that describes the definition.
Command: None
Syntax: GetData(<DefinitionName>)
Return Value: <DefinitionData> This is an array of data for the definition.
Parameters: <DefinitionName>:
<string> // composite name of the definition to edit
VB Example:
Dim compData
compData = oComponentManager.GetData("Level01_NPN")

Definition Manager Script Commands 32-205


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Note:

GetData allows the user to access definition information, make modifications, and then use the Edit or EditWithComps
script commands to save the modified definition. Accordingly, for each type of definition, the array data returned to GetData
should be the same array information that is supplied to the Edit or EditWithComps commands.

Python Syntax GetData(<DefinitionName>)


Python Example compData = oComponentManager.GetData("Level01_NPN")

GetNames [component manager]


Returns the names of the components (used and unused) in a design. The following script command, IsUsed, can then be used to
separate used and unused components.
Command: None
Syntax: GetNames()
Return Value: An array of strings
Parameters: None
VB Example:
Dim componentNames
componentNames = oComponentManager.GetNames()

Definition Manager Script Commands 32-206


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetNames()


Python Example componentNames = oComponentManager.GetNames()

GetNPortData [component manager]


Returns NPort data for the component with the specified name.
Command: None
Return Value: Variant array, whose contents depend on the type of component. The array will be empty if the component does not
have NPort data. See the syntax for AddDynamicNPortData and AddNPortData for descriptions of the array contents for components
with those types of NPort data.
Parameters: <ComponentName>:
<string>
Example: This script displays each item in the returned array for each component in the design.

Sub DisplayVariant(x)
Dim index
index = 0

For Each info In x


curr = x(index)
If TypeName(curr) <> "Variant()" Then
If TypeName(curr) <> "Empty" And TypeName(curr) <> "Null" Then
str = CStr(curr)
If str = "" Then

Definition Manager Script Commands 32-207


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

str = ChrW(34) & ChrW(34)


End If
Msgbox str
Else
str = "Empty/Null item."
Msgbox str
End If
Else
DisplayVariant curr
End If

index = index + 1
Next

End Sub

Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim dnpInfo

Definition Manager Script Commands 32-208


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Dim index

Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")


Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject()
Set oDefinitionManager = oProject.GetDefinitionManager()

Set oComponentManager = oDefinitionManager.GetManager("Component")

Dim componentNames
componentNames = oComponentManager.GetNames()

index = 0
For Each name In componentNames
name = componentNames(index)
message = "NPort data for component " + name
Msgbox message
dnpInfo = oComponentManager.GetNPortData(name)

DisplayVariant dnpInfo

Definition Manager Script Commands 32-209


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

index = index + 1
Next

GetSolverOnDemandData
Use: This method looks for a local component of the name passed in, and in this component it looks for an SOD model of the name
passed in and returns the SOD data pertaining to that model.
Parameters: BSTR component name.
Parameters: BSTR SOD model name
Return Value: VARIANT which is the SOD data.
GetSolverOnDemandModelList
Use: This method looks for a local component of the name passed in, and returns a list of SOD model names defined in the com-
ponent.
Parameters: BSTR component name.
Return Value: VARIANT which is a list of SOD model names.
IsUsed [component manager]
Used to determine if a component is used in the design.
Command: None
Syntax: IsUsed(<ComponentName>)
Return Value: <Boolean> // true if the specified component is used in the design
Parameters: <ComponentName>:
<string>

Definition Manager Script Commands 32-210


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example:
Dim isUsed
isUsed = oComponentManager.IsUsed("MyComponent")

Python Syntax IsUsed(<ComponentName>)


Python Example IsUsed = oComponentManager.IsUsed("MyComponent")

Remove [component manager]


Remove a component from a library
Command: Tools > Edit Configured Libraries > Components > Remove Component
Syntax: Remove <ComponentName>,
<IsProjectComponent>,
<LibraryName>,
<LibraryLocation>
Return Value: None
Parameters: <ComponentName>:
<string> // composite name of the component to remove

<IsProjectComponent>:
<bool>

<LibraryName>:

Definition Manager Script Commands 32-211


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<string> // name of the library

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

VB Example:
oComponentManager.Remove "Nexxim Circuit Elements\BJTs:Level01_NPN", _ true, "Project"

Python Syntax Remove (<ComponentName>, <IsProjectComponent>, <LibraryName>, <LibraryLocation>)


oComponentManager.Remove ("Simplorer Circuit
Python Example
Elements\BJTs:Level01_NPN", _ true, "Project")

RemoveSolverOnDemandModel
Use: This method looks for a local component of the name passed in, and in this component it looks for an SOD model of the name
passed in and deletes the SOD model definition from the component.
Parameters: BSTR component name.
Parameters: BSTR SOD model name
Return Value: None.
RemoveUnused [component manager]
Removes components that are not used in the design.

Definition Manager Script Commands 32-212


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Command: Project->Remove Unused Definitions is similar but operates slightly different and does not record script commands.
Syntax: RemoveUnused()
Return Value: <bool> True if one or more components are removed.
Parameters: None
VB Example:
Dim removedDefs
removedDefs = oComponentManager.RemoveUnused()

Note:

The order of calls to RemoveUnused is significant. As a result, removing definitions in an unordered fashion may cause
other components in dependent definitions to be rendered unusable.

Also, the symbol and footprint of an unused component are not unusable until after the component itself is removed using
the Component Manager Remove script.

Python Syntax RemoveUnused()


Python Example removedDefs = oComponentManager.RemoveUnused()

Update Dynamic Link [component manager]


Use:Reads data from the linked design and updates the dynamic link component. This will update the following: properties, solutions,
ports, geometry.
Command:Each of the following commands will record a non-undoable script command:

Definition Manager Script Commands 32-213


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

—Dynamic Link Item RCM > Refresh Dynamic Link


—Dynamic Link Component in schematic RCM > Refresh Dynamic Link
— Click the Refresh Dynamic Link button in the Footprint tab of the Properties Window for selected Dynamic Link components
in the Layout Editor.
Syntax:UpdateDynamicLink(<component name>)
Return Value:None
Parameters:<component name> is the name of the dynamic link component
VB Example:
oComponentManager.UpdateDynamicLink("TeeModel_L1")

Footprint Manager Script Commands


The footprint manager provides access to footprints in a project. The manager object is accessed via the definition manager.
Set oDefinitionManager = oProject.GetDefinitionManager()
Set oFootprintManager = oDefinitionManager.GetManager("Footprint")
The footprint manager script commands are listed below:
Add
Edit
EditWithComps
Export
GetData
GetNames
IsUsed

Definition Manager Script Commands 32-214


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Remove
RemoveUnused
Add [footprint manager]
Use: Add a footprint
Command: Tools > Edit Configured Libraries > Footprints > Add Footprint
Syntax: Add Array("NAME:<FootprintName>,
"ModTime:=", <ModifiedOnInfo>,
"Library:=", "",
"LibLocation:=", "Project",
"OkayToMirror:=", <bool>,
"DefUnits:=", <UnitType>,
Array(NAME:Lyrs",
"Layer:=", <LayerArray>,
"Layer:=", <LayerArray>…,
"SLayer:=", <StackupLayerArray>,
"SLayer:=", <StackupLayerArray>...),
"ActLyr:=", <string>, // name of active layer
"Tol:=", <ToleranceArray> // optional
<PrimitivesInfo>, // optional
<PinsInfo>, // optional
<ViasInfo>, // optional

Definition Manager Script Commands 32-215


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<EdgeportsInfo>, // optional
<ComponentPropertyInfo>,
<ScriptInfo>) // optional, specified for scripted footprints

Return Value: <string>


// composite name of the footprint.
// If the name requested conflicts with the name of an existing
// footprint, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.

Parameters: <FootprintName>:
<string> // simple name of footprint to create
<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.

<UnitType>:
<string> // default length units to use if units are not specified in other
// parameters

Definition Manager Script Commands 32-216


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<LayerArray>:
Array("N:=", <string>, // layer name
"ID:=", <int> ,
"T:=", <LayerTypeInfo>, // layer type
"TB:=", <TopBottomInfo>,
"Col:=", <int>, // optional - color
"Pat:=", <int>, // optional - fill pattern
"Vis:=", <bool>, // optional - are objects on layer visible
"Sel:=", <bool>, // optional - are objects on layer selectable
"L:=", <bool>) // optional
// are objects on layer locked (can't be edited)

<LayerTypeInfo>:
<string> // one of: signal, dielectric, metalized signal, assembly, silkscreen, soldermask, solderpaste, glue, or user

<TopBottomInfo>:
<string> // one of: top, neither, bottom, or template

<StackupLayerArray>:
Array(<LayerArray>,
"Elev:=", <ElevationInfo>,

Definition Manager Script Commands 32-217


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SubL:=", Array("Th:=", <Dimension>,


"LElev:=", <Dimension>,
"R:=", <Dimension>,
"M:=", <MaterialInfo>))

<ElevationInfo>:
<string> // "top" - snap to top
// "mid" - snap to middle
// "bot" - snap to bottom
// "edit" - manual edit
// "none"

<Dimension>:
<string> // real number, may include units

<MaterialInfo>:
<string> // name of the layer material

<ToleranceArray>:
Array(<real>, // distance tolerance
<real>, // angle tolerance (radians)

Definition Manager Script Commands 32-218


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<real>) // dimensionless tolerance

<PrimitivesInfo>:
Array("NAME:Prims",
// one or more of the following
<RectInfo>,
<CircleInfo>,
<ArcInfo>,
<LineInfo>,
<PolygonInfo>,
<TextInfo>,
<ImageInfo>)

<RectInfo>:
"Rect:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // angle, in radians
<real>, // x position of center
<real>, // y position of center
<real>, // width

Definition Manager Script Commands 32-219


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

< real>) // height

<CircleInfo>:
"Circle:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>) // radius

<ArcInfo>:
"Arc:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>, // radius
<real>, // start angle, in radians
<end>) // end angle, in radians

Definition Manager Script Commands 32-220


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<LineInfo>:
"Line:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<PointInfo>, // must specify at least 2 points
<PointInfo>...)
<PointInfo>:
<real>, // x position
<real> // y position

<PolygonInfo>:
"Polygon:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<PointInfo>, // must specify at least 3 points
<PointInfo>...)

<TextInfo>:
"Text:=", Array(<real>, // x position
<real>, // y position
<real>, // angle, in radians

Definition Manager Script Commands 32-221


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<Justification>,
<bool>, // is plotter font
<string>, // font name
<int>, // color
<string>) // text string
<Justification>: <int>
// 0 : left top
// 1 : left base
// 2 : left bottom
// 3 : center top
// 4 : center base
// 5 : center bottom
// 6 : right top
// 7 : right base
// 8 : right bottom

<ImageInfo>:
"Image:=", Array(<RectInfo>,
<ImageData>,
<bool>) // is mirrored

Definition Manager Script Commands 32-222


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ImageData>:
<string>, // file path
<int>, // 0 : use the file path and link to it
// 1 : ignore file path and use next parameter
<string> // text data, only present if preceding int is 1

<PinsInfo>:
Array("NAME:Pins",
"P:=", <PinArray>,
"P:=", <PinArray>,...)

<PinArray>:
Array("Port:=", Array("Id:=", <int>,
"Clr:=", <real>, // optional - clearance
"N:=", <string>), // pin name
"Pos:=", Array("x:=", <Location>, // padstack (x,y) position
"y:=", <Location>),
"VRt:=", <Angle>, // optional - rotation
"HD:=", <Size>, // optional - hole diameter
<PadstackImplementationInfo>)

Definition Manager Script Commands 32-223


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<Location>:
<string> specifying real number and units (may use variables)

<Angle>:
<string> specifying angle with a real number and units

<Size>:
<string> specifying size with a real number and units

<PadstackImplementationInfo>:
If another with the same implementation has already been specified:
"Ref:=", <int> // id of the other
If not:
"Ref:=", <string>, // name
"Frm:=", <int>, // id of highest layer
"To:=", <int>, // id of lowest layer
<LayerPlacementInfo>,
"Man:=", <int>, // optional, 1 if manually placed, 0 if not (default)
"Use:=", Array(<PadUseInfo>, <PadUseInfo>…) // array may be empty

Definition Manager Script Commands 32-224


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<LayerPlacementInfo>:
"Lyr:=", Array("Mrg:=", <int>, // optional,
// 1 if all layers have been merged (default)
// 0 if layer are not merged
"Flp:=", <int>, // optional,
// 1 if placed bottom up
// 0 if not (default)
"Map:=", <ParentToLocalLayerInfo>)

<ParentToLocalLayerInfo>:
Array("U:=", <DirectionOfUniqueness>,
"F:=", Array(<int>, <int>, …), // forward mapping
// -1 is not mapped
"B:=", Array(<int>, <int>, …)) // backward mapping
// -1 is not mapped

<PadUseInfo>:
"Pad:=", Array("Lid:=", <int>, // layer id
"T:=", <string>, // type : "connected", "thermal",
// "no_pad, "not_connected",

Definition Manager Script Commands 32-225


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

// or "not_connected_thermal"
"Man:=", <int>) // optional, 1 if manually placed
// 0 if not (default)

<DirectionOfUniqueness>:
<string> // one of "forward", "backward", or "two ways"

<ViasInfo>:
Array("NAME:Vias", <ViaInfo>, <ViaInfo>…)

<ViaInfo>:
"V:=", Array("Id:=", <int>,
"N:=", <string>, // name
"Pos:=", Array("x:=", <Location>, // via (x,y) position
"y:=", <Location>),
"VRt:=", <Angle>, // optional - rotation
<ImplementationInfo>

<EdgeportsInfo>:
Array("NAME:EPorts", <EdgePortArray>, <EdgePortArray>…)

Definition Manager Script Commands 32-226


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<EdgePortArray>:
Array("NAME:EP",
"LP:=", Array("Id:=", <int>, // port id
"N:=", <string>), // port name
"Eo:=", Array(<edge description>, <edge description>,...))

<edge description> for primitive edges

"et:=", "pe", "pr:=", <id>, "ei:=", <edge#>

<id>: integer that is the primitive id

<edge#>: integer that is the edge number on the primitive

<edge description> for via edges

"et:=", "pse", "layer:=", <layer id>, "se:=", <via id>,


"sx:=", <start X location>, "sy:=", <start Y location>, "ex:=", <end X location>,
"ey:=", <end Y location>, "h:=", <arc height>, "rad:=", <radians>

Definition Manager Script Commands 32-227


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<via id>: an integer that is the id of the via to use


<layer id>: an integer that is the id of the layer of the pad of the via to use
<start X location>

<start Y Location>:
doubles that are the X, Y location of the start point of the edge arc <end X location>
<end Y Location>:
doubles that are the X, Y location of the end point of the edge arc

<arc height>: double giving the height of the edge arc (0 for a straight edge)
<radians>: double giving the arc size in radians (0 for a straight edge)

<ComponentPropertyInfo>:
Array("NAME:CProps",
"VariableProp:=", <VariableInfo>,
"VariableProp:=", <VariableInfo>,
…)

<VariableInfo>:
Array(<string>, // name

Definition Manager Script Commands 32-228


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: number, variable, or expression

<ScriptInfo>:
Array("NAME:script",
"language:=", <string>, // one of "javascript" or "vbscript"
"UsesScript:=", true,
"script:=", <string>) // contents of script

VB Example:
oFootprintManager.Add (Array("NAME:BCL", _
"ModTime:=", 1023388445, _
"Library:=", "", _
"LibLocation:=", "Project", _
"OkayToMirror:=", false, _
"DefUnits:=", "mm", _
Array("NAME:Lyrs", _
"Layer:=", Array("N:=", "Measures", _
"ID:=", 8, _

Definition Manager Script Commands 32-229


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"T:=", "measures", _
"Col:=", 4144959, _
"Pat:=", 1), _
"Layer:=", Array("N:=", "Rats", _
"ID:=", 1, _
"T:=", "rat", _
"Col:=", 16711680, _
"Pat:=", 1), _
"Layer:=", Array("N:=", "Errors", _
"ID:=", 2, _
"T:=", "error", _
"Col:=", 255, _
"Pat:=", 1, _
"L:=", true), _
"Layer:=", Array("N:=", "Symbols", _
"ID:=", 3, _
"T:=", "symbol", _
"Col:=", 8323199, _
"Pat:=", 4), _
"Layer:=", Array("N:=", "Assembly", _

Definition Manager Script Commands 32-230


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ID:=", 4, _
"T:=", "assembly", _
"TB:=", "top", _
"Col:=", 16711680, _
Pat:=", 3), _
"Layer:=", Array("N:=", "Silkscreen", _
"ID:=", 5, _
"T:=", "silkscreen", _
TB:=", "top", _
"Col:=", 8454143, _
"Pat:=", 6), _
SLayer:=", Array("Layer:=", Array("N:=", "Cover", _
"ID:=", 12, _
"T:=", "metalizedsignal", _
"Col:=", 32639, _
Pat:=", 7), _
"Elev:=", "mid", _
"SubL:=", Array("Th:=", "0mm", _
"LElev:=", "118.110236220472mil", _
"R:=", "0mm", _
"Mat:=", "")), _

Definition Manager Script Commands 32-231


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SLayer:=", Array("Layer:=", Array("N:=", "Dielec3", _


"ID:=", 11, _
"T:=", "dielectric", _
"Col:=", 8323199, _
"Pat:=", 6), _
"Elev:=", "none", _
"SubL:=", Array("Th:=", "1mm", _
"LElev:=", "78.740157480315mil", _
"R:=", "0mm", _
"Mat:=", "")), _
"SLayer:=", Array("Layer:=", Array("N:=", "Trace2", _
"ID:=", 10, _
"T:=", "signal", _
"Col:=", 8355584, _
"Pat:=", 5), _
"Elev:=", "mid", _
"SubL:=", Array("Th:=", "0mm", _
"LElev:=", "78.740157480315mil", _
"R:=", "0mm", _
"Mat:=", "")), _

Definition Manager Script Commands 32-232


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SLayer:=", Array("Layer:=", Array("N:=", "Dielec2", _


"ID:=", 6, _
"T:=", "dielectric", _
"Col:=", 8323072, _
"Pat:=", 4), _
"Elev:=", "none", _
"SubL:=", Array("Th:=", "1mm", _
"LElev:=", "39.3700787401575mil", _
"R:=", "0mm", _
"Mat:=", "")), _
"SLayer:=", Array("Layer:=", Array("N:=", "Trace1", _
"ID:=", 0, _
"T:=", "signal", _
"Col:=", 32512, _
"Pat:=", 3), _
"Elev:=", "mid", _
"SubL:=", Array("Th:=", "0mm", _
"LElev:=", "39.3700787401575mil", _
"R:=", "0mm", _
"Mat:=", "")), _
"SLayer:=", Array("Layer:=", Array("N:=", "Dielec1", _

Definition Manager Script Commands 32-233


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ID:=", 7, _
"T:=", "dielectric", _
"Col:=", 127, _
"Pat:=", 7), _
"Elev:=", "none", _
"SubL:=", Array("Th:=", "1mm", _
"LElev:=", "0mil", _
"R:=", "0mil", _
"Mat:=", "")), _
"SLayer:=", Array("Layer:=", Array("N:=", "Ground", _
"ID:=", 9, _
"T:=", "metalizedsignal", _
"Col:=", 4144959, _
"Pat:=", 6), _
"Elev:=", "mid", _
"SubL:=", Array("Th:=", "0mil", _
"LElev:=", "0mil", _
"R:=", "0mil", _
"Mat:=", ""))), _
"ActLyr:=", "Trace2", _

Definition Manager Script Commands 32-234


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Prims",
"rect:=", Array("Id:=", 10003, _
"Lyr:=", 10, _
"N:=", "rect101", _
"x:=", "0mm", _
"y:=", "0mm", _
"w:=", "P", _
"h:=", "W", _
"Vds:=", Array()), _
"rect:=", Array("Id:=", 10103, _
"Lyr:=", 0, _
"N:=", "rect103", _
"x:=", "0mm", _
"y:=", "0mm", _
"w:=", "P", _
"h:=", "W", _
"Vds:=", Array())), _
Array("NAME:Pins",
"P:=", Array("Port:=", Array("Id:=", 3, "N:=", "n1"), _
"Pos:=", Array("x:=", "-P/2", "y:=", "0mm"), _
"VRt:=", "180deg", _

Definition Manager Script Commands 32-235


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Ref:=", "NoPad SMT East", _


"Frm:=", 12, _
"To:=", 9, _
"Lyr:=", Array("Map:=", Array("U:=", "forward",_
"F:=", Array(-1, -1, -1, -1,_
-1, -1, -1, -1,_
-1, -1, 0, -1, -1), _
"B:=", Array(10))), _
"Use:=", Array()), _
"P:=", Array("Port:=", Array("Id:=", 4, "N:=", "n4"),_
"Pos:=", Array("x:=","P/2", "y:=", "0mm"),_
"HD:=", "1mm", _
"Ref:=", 3), _
"P:=", Array("Port:=", Array("Id:=",5, "N:=", "n2"),_
"Pos:=", Array("x:=", "-P/2", "y:=", "0mm"),_
"VRt:=", "180deg",_
"Ref:=", "NoPad SMT East",_
"Frm:=", 12, _
"To:=", 9, _
"Lyr:=", Array("Map:=", Array("U:=", "forward",_

Definition Manager Script Commands 32-236


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"F:=", Array(0, -1, -1, -1, -1,_


-1, -1, -1, -1, _
-1, -1, -1, -1), _
"B:=", Array(0))), _
"Use:=", Array()), _
"P:=", Array("Port:=", Array("Id:=", 6, "N:=", "n3"), _
"Pos:=", Array("x:=", "P/2", "y:=", "0mm"),_
"HD:=", "1mm", _
"Ref:=", 5)), _
Array("NAME:Nets"), _
Array("NAME:CProps",
"VariableProp:=", Array("W", _
"UD", _
"", _
"1.5mm"),_
"VariableProp:=", Array("P", _
"UD", _
"", _
10mm"))))

Edit [footprint manager]

Definition Manager Script Commands 32-237


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Deprecated command — please use EditWithComps.


EditWithComps [footprint manager]
Use: Edit an existing footprint.
Command: None
Syntax: EditWithComps <FootprintName>,
Array("NAME:<NewFootprintName>,
"ModTime:=", <ModifiedOnInfo>,
"Library:=", "",
"LibLocation:=", "Project",
"OkayToMirror:=", <bool>,
"DefUnits:=", <UnitType>,
Array(NAME:Lyrs",
"Layer:=", <LayerArray>,
"Layer:=", <LayerArray>…,
"SLayer:=", <StackupLayerArray>,
"SLayer:=", <StackupLayerArray>...),
"ActLyr:=", <string>, // name of active layer
"Tol:=", <ToleranceArray> // optional
<PrimitivesInfo>, // optional
<PinsInfo>, // optional

Definition Manager Script Commands 32-238


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ViasInfo>, // optional
<EdgeportsInfo>, // optional
<ComponentPropertyInfo>,
<ScriptInfo>, // optional, specified for scripted footprints
Array(<ListofComponentNames>) // Component names
Return Value: <string>
// composite name of the footprint.
// If the name requested conflicts with the name of an existing
// footprint, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.

Parameters: <FootprintName>:
<string> // composite name of the footprint being edited

<NewFootprintName>:
<string> // new simple name for the footprint

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.

Definition Manager Script Commands 32-239


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<UnitType>:
<string> // default length units to use if units are not specified in other
// parameters

<LayerArray>:
Array("N:=", <string>, // layer name
"ID:=", <int> ,
"T:=", <LayerTypeInfo>, // layer type
"TB:=", <TopBottomInfo>,
"Col:=", <int>, // optional - color
"Pat:=", <int>, // optional - fill pattern
"Vis:=", <bool>, // optional - are objects on layer visible
"Sel:=", <bool>, // optional - are objects on layer selectable
"L:=", <bool>) // optional
// are objects on layer locked (can't be edited)

<LayerTypeInfo>:
<string> // one of: signal, dielectric, metalized signal, assembly, silkscreen, soldermask, solderpaste, glue, or user

<TopBottomInfo>:

Definition Manager Script Commands 32-240


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<string> // one of: top, neither, bottom, or template

<StackupLayerArray>:
Array(<LayerArray>,
"Elev:=", <ElevationInfo>,
"SubL:=", Array("Th:=", <Dimension>,
"LElev:=", <Dimension>,
"R:=", <Dimension>,
"M:=", <MaterialInfo>))

<ElevationInfo>:
<string> // "top" - snap to top
// "mid" - snap to middle
// "bot" - snap to bottom
// "edit" - manual edit
// "none"

<Dimension>:
<string> // real number, may include units

<MaterialInfo>:

Definition Manager Script Commands 32-241


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<string> // name of the layer material

<ToleranceArray>:
Array(<real>, // distance tolerance
<real>, // angle tolerance (radians)
<real>) // dimensionless tolerance

<PrimitivesInfo>:
Array("NAME:Prims",
// one or more of the following
<RectInfo>,
<CircleInfo>,
<ArcInfo>,
<LineInfo>,
<PolygonInfo>,
<TextInfo>,
<ImageInfo>)

<RectInfo>:
"Rect:=", Array(<real>, // line width

Definition Manager Script Commands 32-242


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<int>, // fill pattern


<int>, // color
<real>, // angle, in radians
<real>, // x position of center
<real>, // y position of center
<real>, // width
< real>) // height

<CircleInfo>:
"Circle:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>) // radius

<ArcInfo>:
"Arc:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<real>, // x position of center

Definition Manager Script Commands 32-243


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<real>, // y position of center


< real>, // radius
<real>, // start angle, in radians
<end>) // end angle, in radians

<LineInfo>:
"Line:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<PointInfo>, // must specify at least 2 points
<PointInfo>...)
<PointInfo>:
<real>, // x position
<real> // y position

<PolygonInfo>:
"Polygon:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<PointInfo>, // must specify at least 3 points

Definition Manager Script Commands 32-244


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<PointInfo>...)

<TextInfo>:
"Text:=", Array(<real>, // x position
<real>, // y position
<real>, // angle, in radians
<Justification>,
<bool>, // is plotter font
<string>, // font name
<int>, // color
<string>) // text string
<Justification>: <int>
// 0 : left top
// 1 : left base
// 2 : left bottom
// 3 : center top
// 4 : center base
// 5 : center bottom
// 6 : right top
// 7 : right base
// 8 : right bottom

Definition Manager Script Commands 32-245


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ImageInfo>:
"Image:=", Array(<RectInfo>,
<ImageData>,
<bool>) // is mirrored

<ImageData>:
<string>, // file path
<int>, // 0 : use the file path and link to it
// 1 : ignore file path and use next parameter
<string> // text data, only present if preceding int is 1

<PinsInfo>:
Array("NAME:Pins",
"P:=", <PinArray>,
"P:=", <PinArray>,...)

<PinArray>:
Array("Port:=", Array("Id:=", <int>,
"Clr:=", <real>, // optional - clearance

Definition Manager Script Commands 32-246


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"N:=", <string>), // pin name


"Pos:=", Array("x:=", <Location>, // padstack (x,y) position
"y:=", <Location>),
"VRt:=", <Angle>, // optional - rotation
"HD:=", <Size>, // optional - hole diameter
<PadstackImplementationInfo>)

<Location>:
<string> specifying real number and units (may use variables)

<Angle>:
<string> specifying angle with a real number and units

<Size>:
<string> specifying size with a real number and units

<PadstackImplementationInfo>:
If another with the same implementation has already been specified:
"Ref:=", <int> // id of the other
If not:
"Ref:=", <string>, // name

Definition Manager Script Commands 32-247


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Frm:=", <int>, // id of highest layer


"To:=", <int>, // id of lowest layer
<LayerPlacementInfo>,
"Man:=", <int>, // optional, 1 if manually placed, 0 if not (default)
"Use:=", Array(<PadUseInfo>, <PadUseInfo>…) // array may be empty

<LayerPlacementInfo>:
"Lyr:=", Array("Mrg:=", <int>, // optional,
// 1 if all layers have been merged (default)
// 0 if layer are not merged
"Flp:=", <int>, // optional,
// 1 if placed bottom up
// 0 if not (default)
"Map:=", <ParentToLocalLayerInfo>)

<ParentToLocalLayerInfo>:
Array("U:=", <DirectionOfUniqueness>,
"F:=", Array(<int>, <int>, …), // forward mapping
// -1 is not mapped
"B:=", Array(<int>, <int>, …)) // backward mapping

Definition Manager Script Commands 32-248


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

// -1 is not mapped

<PadUseInfo>:
"Pad:=", Array("Lid:=", <int>, // layer id
"T:=", <string>, // type : "connected", "thermal",
// "no_pad, "not_connected",
// or "not_connected_thermal"
"Man:=", <int>) // optional, 1 if manually placed
// 0 if not (default)

<DirectionOfUniqueness>:
<string> // one of "forward", "backward", or "two ways"

<ViasInfo>:
Array("NAME:Vias", <ViaInfo>, <ViaInfo>…)

<ViaInfo>:
"V:=", Array("Id:=", <int>,
"N:=", <string>, // name
"Pos:=", Array("x:=", <Location>, // via (x,y) position
"y:=", <Location>),

Definition Manager Script Commands 32-249


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"VRt:=", <Angle>, // optional - rotation


<ImplementationInfo>

<EdgeportsInfo>:
Array("NAME:EPorts", <EdgePortArray>, <EdgePortArray>…)

<EdgePortArray>
Array("NAME:EP",
"LP:=", Array("Id:=", <int>, // port id
"N:=", <string>), // port name
"Eo:=", Array(<edge description>, <edge description>,...))

<edgedescription> for primitive edges

"et:=", "pe", "pr:=", <id>, "ei:=", <edge#>

<id>: integer that is the primitive id

<edge#>: integer that is the edge number on the primitive

Definition Manager Script Commands 32-250


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<edge description> for via edges

"et:=", "pse", "sel:=", <"via">, "layer:=", <layer id>,


"sx:=", <start X location>, "sy:=", <start Y location>, "ex:=", <end X location>, "ey:=", <end Y location>, "h:=", <arc height>,
"rad:=", <radians>

<"via">: text that is the name of the via to use


<layer id>: an integer that is the id of the layer of the pad of the via to use

<start X location>, <start Y Location>:


doubles that are the X, Y location of the start point of the edge arc
<end X location>, <end Y Location>:
doubles that are the X, Y location of the end point of the edge arc

<arc height>: double giving the height of the edge arc (0 for a straight edge)
<radians>: double giving the arc size in radians (0 for a straight edge)

<ComponentPropertyInfo>:
Array("NAME:CProps",
"VariableProp:=", <VariableInfo>,
"VariableProp:=", <VariableInfo>,
…)

Definition Manager Script Commands 32-251


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<VariableInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: number, variable, or expression

<ScriptInfo>:
Array("NAME:script",
"language:=", <string>, // one of "javascript" or "vbscript"
"UsesScript:=", true,
"script:=", <string>) // contents of script

<ListOfComponentNames>:
<string>,<string> ...
// The list may be empty. When not empty, each string that is listed is a component
// that references the footprint to be edited. Prior to editing, a clone of the footprint is
// made, and the components that are listed are modified so that they now refer to
// the clone.

Definition Manager Script Commands 32-252


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example:
Dim nam
oFootprintManager.EditWithComps _
("Nexxim Circuit Elements\Distributed\Distributed:bendo", _
Array("NAME:bendo new name", _
"ModTime:=", 1152722165, _
"Library:=", "Nexxim Circuit Elements\Distributed\Distributed", _
"LibLocation:=", "SysLibrary", _
Array("NAME:PinDef", _
"Pin:=", Array( "n1", _
-0.00254, _
0.00254, _
0, _
"N", _
0, _
0, _
false, _
0, _
true, _
"", _

Definition Manager Script Commands 32-253


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

false, _
false)), _
Array("NAME:PinDef", _
"Pin:=", Array( "n2", _
0.00254, _
-0.00254, _
1.5708, _
"N", _
0, _
0, _
false, _
0, _
true, _
"", _
false, _
false)), _
Array("NAME:Graphics", _
"Polygon:=", Array( 0, 0, 12566272, 0, 0.00381, 0, .00127, 0.00127, _
0.00127, 0.00127, 0, 0.00381, 0, 0.00381, _
0.002032, 0.00127, 0.00381), _

Definition Manager Script Commands 32-254


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Line:=", Array(0, 1, 12566272, -0.00254, 0.00254, 0, .00254), _


"Line:=", Array(0, 1, 12566272, 0.00254, -0.00254, .00254, 0)), _
Array("NAME:PropDisplayMap", _
"W:=", Array(3, _
5, _
0, _
"Text:=", Array( 2.1684E-019, _
0.00504119, _
0, _
1, _
5, _
false, _
"Arial", _
0, _
"W=***"))))), _
Array("MY_COMP")
Export [footprint manager]
Use: Export a footprint to a library
Command: Tools > Edit Configured Libraries > Footprints > Export to Library
Syntax: Export Array("NAME:<LibraryName>",
<FootprintName>,

Definition Manager Script Commands 32-255


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<FootprintName>...),
<LibraryLocation>
Return Value: None
Parameters: <LibraryName>:
<string> // name of the library

<FootprintName>:
<string> // composite name of footprint to export

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

VB Example:
oFootprintManager.Export Array("NAME:mylib", "Distributed Footprints:BPAD"), "PersonalLib"
GetData [footprint manager]
FootprintGetData
Use: Gets data that describes the definition.
Command: None
Syntax: GetData(<DefinitionName>)

Definition Manager Script Commands 32-256


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value: <DefinitionData> This is an array of data for the definition.


Parameters: <DefinitionName>:
<string> // composite name of the definition to edit
VB Example:
Dim footprintData
footprintData = oFootprintManager.GetData("Nexxim Circuit Elements\Distributed\Nexxim_Foot-
prints:MCPL13_Nexx")

Note:

GetData allows the user to access definition information, make modifications, and then use the Edit or EditWithComps
script commands to save the modified definition. Accordingly, for each type of definition, the array data returned to
GetData should be the same array information that is supplied to the Edit or EditWithComps commands.

GetNames [footprint manager]


Use: Returns the names of the footprints (used and unused) in a design. The following script command, IsUsed, can then be used to
separate used and unused footprints.
Command: None
Syntax: GetNames()
Return Value: An array of strings
Parameters: None
VB Example:
Dim footprintNames
footprintNames = oFootprintManager.GetNames()

Definition Manager Script Commands 32-257


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

IsUsed [footprint manager]


Use: Used to determine if a footprint is used in the design.
Command: None
Syntax: IsUsed(<FootprintName>)
Return Value: <Boolean> // true if the specified footprint is used in the design
Parameters: <FootprintName>:
<string>
VB Example:
Dim isUsed
isUsed = oFootprintManager.IsUsed("MyFootprint")
Remove [footprint manager]
Use: Removes a footprint from a library
Command: Tools > Edit Configured Libraries > Footprints > Remove Footprint
Syntax: Remove <FootprintName>,
<IsProjectFootprint>,
<LibraryName>,
<LibraryLocation>
Return Value: None
Parameters: <FootprintName>:
<string> // composite name of the footprint to remove

Definition Manager Script Commands 32-258


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<IsProjectFootprint>:
<bool>

<LibraryName>:
<string> // name of the library

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

VB Example:
oFootprintManager.Remove "BPAD", true, "Distributed Footprints", "Project"
oFootprintManager.Remove "BPAD", false, "MyLib", "PersonalLib"
RemoveUnused [footprint manager]
Use: Removes footprints that are not used in the design.
Command: Project->Remove Unused Definitions is similar but operates slightly different and does not record script commands.
Syntax: RemoveUnused()
Return Value: <bool> True if one or more footprints are removed.
Parameters: None
VB Example:

Definition Manager Script Commands 32-259


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Dim removedDefs
removedDefs = oFootprintManager.RemoveUnused()

Note:

The order of calls to RemoveUnused is significant. As a result, removing definitions in an unordered fashion may cause
other footprints in dependent definitions to be rendered unusable.

Also, the symbol and footprint of an unused component are not unusable until after the component itself is removed using
the Component ManagerRemove script.

Material Manager Script Commands


The material manager provides access to materials in a project. The manager object is accessed via the definition manager.
Set oDefinitionManager = oProject.GetDefinitionManager()
Set oMaterialManager = oDefinitionManager.GetManager("Material")
The topics for this section include:
GetData
GetNames
GetProperties
IsUsed
RemoveUnused

Definition Manager Script Commands 32-260


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetData [material manager]


Use: Get material data
Command: None
Syntax: GetData <material_name>
Return Value: Array of material data
Parameters: <material_name>
Type: string
Value: Name of the project material
VB Example:
materialData = oMaterialMgr.GetData("MyMaterial2")

Python Syntax GetData(<SimpleName>)


dataArray = oMaterialManager.GetData
Python Example
("mymaterial")

GetNames [material manager]


Use: Get the names of the materials in a project
Command: None
Syntax: GetNames
Return Value: Names of the materials in a project
Parameters: None
Example:

Definition Manager Script Commands 32-261


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

materialNames = oMaterialMgr.GetNames()

Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.NewProject
oProject.InsertDesign "Nexxim Circuit", "Nexxim1", "", ""
Set oMaterialMgr = oProject.GetDefinitionManager().GetManager("Material")
oMaterialMgr.Add( Array("NAME:MyMaterial1", "CoordinateSystemType:=", "Cartesian", "per-
mittivity:=", "0.123") )
oMaterialMgr.Add( Array("NAME:MyMaterial2", "CoordinateSystemType:=", "Cartesian", "per-
mittivity:=", "0.456")
Dim materialNames
materialNames = oMaterialMgr.GetNames()

Definition Manager Script Commands 32-262


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetNames()


Python Example materialnames = oMaterialManager.GetNames()

GetProperties [material manager]


Get material properties. Differs from GetData in that only material properties available to the user are returned by GetProperties.

UI Access NA

Name Type Description


<material_name> string Name of the project material
Parameters
Boolean True or False. If you use False or only a single argument, then GetProperties
returns only the properties that are different from the defaults.

Return Value Array of material data

Python Syntax GetProperties (<materialname>)


oMaterialManager.GetProperties("Gold", True)
Python Example
oMaterialManager.GetProperties("vacuum")

VB Syntax GetProperties <material_name>


VB Example materialProps = oMaterialMgr.GetProperties( "MyMaterial2" )

IsUsed [material manager]


Use: Checks if a project material is in use
Command: None

Definition Manager Script Commands 32-263


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax: IsUsed <material_name>


Return Value: Returns 'True' if the material is in use.
Parameters: <material_name>
Type: string
Value: Name of the project material to check.
VB Example:
used = oMaterialMgr.IsUsed( "MyMaterial2" )

Python Syntax IsUsed(<ComboName>)


Python Example isused = oMaterialManager.IsUsed("mylib:mymaterial")

RemoveUnused [material manager]


Use: Remove all unused materials from the project.
Command: None
Syntax: RemoveUnused
Return Value: None
Parameters: None
VB Example:
oMaterialMgr.RemoveUnused()

Definition Manager Script Commands 32-264


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax RemoveUnused()


Python Example thereWereExtras = oMaterialManager.RemoveUnused()

Model Manager Script Commands


The model manager provides access to models in a project. The manager object is accessed via the definition manager.
Set oDefinitionManager = oProject.GetDefinitionManager()
Set oModelManager = oDefinitionManager.GetManager("Model")
The model manager script commands are listed below:
Add
ConvertToDynamic
ConvertToParametric
Edit
EditWithComps
Export
GetData
GetNames
IsUsed
Remove
RemoveUnused
Add [model manager]
Use: Add a model
Command: Tools > Edit Configured Libraries > Models > Add Model

Definition Manager Script Commands 32-265


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax: Add Array("NAME:<modelName>",


"ModTime:=", <ModifiedTimeInfo>,
"Library:=", "", // Library name
"LibLocation:=", "Project", // Project Location
<PinDefInfo>,
<PinDefInfo>,... // optional, to define pins
<GraphicsDataInfo>, // optional, to define graphics
<PropDisplayMapInfo>)) // optional, to define property displays

Return Value: <string>


// composite name of the model.
// If the name requested conflicts with the name of an existing
// model, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.

Parameters: <modelName>:
<string> // simple name of the model being added

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed

Definition Manager Script Commands 32-266


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

since 00:00 hours, Jan 1, 1970 UTC from the system clock.

<PinDefInfo>:
Array("NAME:PinDef",
"Pin:=", Array (<string>, // pin name
<real>, // x location
<real>, // y location
<real>, // angle in radians
<PinType>,
<real>, // line width
<real>, // line length
<bool>, // mirrored
<int>, // color
<bool>, // true if visible, false if not
<string>, // hidden net name
<OptionalPinInfo>, // optional info
<PropDisplayMapInfo>)) // optional

<PinType>:
<string> // "N" : normal pin
// "I" : input pin

Definition Manager Script Commands 32-267


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

// "O" : output pin

<OptionalPinInfo>:
// Specify both or neither
<bool>, // true if name is to be shown
<bool>, // true if number is to be shown

<PropDisplayMapInfo>:
Array("NAME:PropDisplayMap",
<PropDisplayInfo>,
<PropDisplayInfo>,...)

<PropDisplayInfo>:
<NameString>, Array(<DisplayTypeInfo>,
<DisplayLocationInfo>,
<int>, // optional, level number
<TextInfo>)
<NameString>:
<string> // PropertyName:=, where PropertyName is the name of

Definition Manager Script Commands 32-268


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

// the property to be displayed

<DisplayTypeInfo>:
<int> // 0 : No display
// 1 : Display name only
// 2 : Display value only
// 3 : Display both name and value
// 4: Display evaluated value only
// 5: Display both name and evaluated value

<DisplayLocationInfo>:
<int> // 0 : Left
// 1 : Top
// 2 : Right
// 3 : Bottom
// 4 : Center
// 5 : Custom placement

<GraphicsDataInfo>:
Array("NAME:Graphics",
// one or more of the following

Definition Manager Script Commands 32-269


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<RectInfo>,
<CircleInfo>,
<ArcInfo>,
<LineInfo>,
<PolygonInfo>,
<TextInfo>,
<ImageInfo>)

<RectInfo>:
"Rect:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // angle, in radians
<real>, // x position of center
<real>, // y position of center
<real>, // width
< real>) // height

<CircleInfo>:
"Circle:=", Array(<real>, // line width

Definition Manager Script Commands 32-270


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<int>, // fill pattern


<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>) // radius

<ArcInfo>:
"Arc:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>, // radius
<real>, // start angle, in radians
<end>) // end angle, in radians

<LineInfo>:
"Line:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<PointInfo>, // must specify at least 2 points

Definition Manager Script Commands 32-271


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<PointInfo>...)
<PointInfo>:
<real>, // x position
<real> // y position

<PolygonInfo>:
"Polygon:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<PointInfo>, // must specify at least 3 points
<PointInfo>...)

<TextInfo>:
"Text:=", Array(<real>, // x position
<real>, // y position
<real>, // angle, in radians
<Justification>,
<bool>, // is plotter font
<string>, // font name
<int>, // color

Definition Manager Script Commands 32-272


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<string>) // text string

<Justification>:
<int> // 0 : left top
// 1 : left base
// 2 : left bottom
// 3 : center top
// 4 : center base
// 5 : center bottom
// 6 : right top
// 7 : right base
// 8 : right bottom

<ImageInfo>:
"Image:=", Array(<RectInfo>,
<ImageData>,
<bool>) // is mirrored

<ImageData>:
<string>, // file path
<int>, // 0 : use the file path and link to it

Definition Manager Script Commands 32-273


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

// 1 : ignore file path and use next parameter


<string> // text data, only present if preceding int is 1

VB Example:
oModelManager.Add Array("NAME:MyModel",_
"ModTime:=", 1070989137, _
"Library:=", "", _
"LibLocation:=", "Project", _
Array("NAME:PinDef", _
"Pin:=", Array ("newpin0", _
0.00254, _
0, _
0, _
"N",_
0, _
0.00254, _
false, _
0, _
true, _
"",_
false, _

Definition Manager Script Commands 32-274


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

false)), _
Array("NAME:PinDef", _
"Pin:=", Array ("newpin1", _
-0.00254, _
0, _
3.14159265358979, _
"N",_
0, _
0.00254, _
false, _
0, _
true, _
"",_
false, _
false)),
Array("NAME:Graphics", _
"Rect:=", Array(0, _
0, _
12566272, _
0, _
4.33680868994202e-019, _

Definition Manager Script Commands 32-275


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

-0.000635, _
0.00508, _
0.002794), _
"Circle:=", Array(0, _
0, _
12566272, _
0.000127, _
-0.000635, _
0.000635)))
ConvertToDynamic
Use: Build a new dynamic model based on an existing parametric model.
Command: Right-click on a model under Definitions/Models in the Project Tree and choose ConvertToDynamic.
Syntax: ConvertToDynamic(defName, newname)
Return Value: <newname> // Name of the new model added
Parameters: <defName> // Model that is the base for the new conversion
VB Example:
Dim newname
newname = oModelManager.ConvertToDynamic([in] BSTR defName, [out, retval] BSTR* newName);
ConvertToParametric
Use: Build a new parametric model based on an existing dynamic model.

Definition Manager Script Commands 32-276


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Command: Right-click on a model under Definitions/Models in the Project Tree and choose ConvertToParametric.
Syntax: ConvertToParametric(defName, newname)
Return Value: <newname> // Name of the new model added
Parameters: <defName> // Model that is the base for the new conversion
VB Example: Dim newname
newname = oModelManager.ConvertToParametric([in] BSTR defName, [out, retval] BSTR* newName);
Edit [deprecated]
Deprecated command — please use EditWithComps.
EditWithComps [model manager]
Use: Edit an existing model.
Command: None
Syntax: EditWithComps <ModelName>,
Array("NAME:<NewModelName>",
"ModTime:=", <ModifiedTimeInfo>,
"Library:=", <string>, // Library name
"LibLocation:=", <string>, // Project Location
<PinDefInfo>,
<PinDefInfo>,... // optional, to define pins
<GraphicsDataInfo>, // optional, to define graphics
<PropDisplayMapInfo>), // optional, to define property displays
Array(<ListOfComponentNames>) // Component names

Definition Manager Script Commands 32-277


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value: <string>


// composite name of the model.
// If the name requested conflicts with the name of an existing
// model, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.

Parameters: <ModelName>:
<string> // composite name of the model being edited

<NewModelName>:
<string> // new simple name for the model

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.

<PinDefInfo>:
Array("NAME:PinDef",
"Pin:=", Array (<string>, // pin name

Definition Manager Script Commands 32-278


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<real>, // x location
<real>, // y location
<real>, // angle in radians
<PinType>,
<real>, // line width
<real>, // line length
<bool>, // mirrored
<int>, // color
<bool>, // true if visible, false if not
<string>, // hidden net name
<OptionalPinInfo>, // optional info
<PropDisplayMapInfo>)) // optional

<PinType>:
<string> // "N" : normal pin
// "I" : input pin
// "O" : output pin

<OptionalPinInfo>:
// Specify both or neither
<bool>, // true if name is to be shown

Definition Manager Script Commands 32-279


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<bool>, // true if number is to be shown

<PropDisplayMapInfo>:
Array("NAME:PropDisplayMap",
<PropDisplayInfo>,
<PropDisplayInfo>,...)

<PropDisplayInfo>:
<NameString>, Array(<DisplayTypeInfo>,
<DisplayLocationInfo>,
<int>, // optional, level number
<TextInfo>)

<NameString>:
<string> // PropertyName:=, where PropertyName is the name of
// the property to be displayed

<DisplayTypeInfo>:
<int> // 0 : No display
// 1 : Display name only

Definition Manager Script Commands 32-280


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

// 2 : Display value only


// 3 : Display both name and value
// 4: Display evaluated value only
// 5: Display both name and evaluated value

<DisplayLocationInfo>:
<int> // 0 : Left
// 1 : Top
// 2 : Right
// 3 : Bottom
// 4 : Center
// 5 : Custom placement

<GraphicsDataInfo>:
Array("NAME:Graphics",
// one or more of the following
<RectInfo>,
<CircleInfo>,
<ArcInfo>,
<LineInfo>,
<PolygonInfo>,

Definition Manager Script Commands 32-281


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<TextInfo>,
<ImageInfo>)

<RectInfo>:
"Rect:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // angle, in radians
<real>, // x position of center
<real>, // y position of center
<real>, // width
< real>) // height

<CircleInfo>:
"Circle:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>) // radius

Definition Manager Script Commands 32-282


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ArcInfo>:
"Arc:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>, // radius
<real>, // start angle, in radians
<end>) // end angle, in radians

<LineInfo>:
"Line:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<PointInfo>, // must specify at least 2 points
<PointInfo>...)
<PointInfo>:
<real>, // x position
<real> // y position

Definition Manager Script Commands 32-283


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<PolygonInfo>:
"Polygon:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<PointInfo>, // must specify at least 3 points
<PointInfo>...)

<TextInfo>:
"Text:=", Array(<real>, // x position
<real>, // y position
<real>, // angle, in radians
<Justification>,
<bool>, // is plotter font
<string>, // font name
<int>, // color
<string>) // text string

<Justification>:
<int> // 0 : left top
// 1 : left base

Definition Manager Script Commands 32-284


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

// 2 : left bottom
// 3 : center top
// 4 : center base
// 5 : center bottom
// 6 : right top
// 7 : right base
// 8 : right bottom

<ImageInfo>:
"Image:=", Array(<RectInfo>,
<ImageData>,
<bool>) // is mirrored

<ImageData>:
<string>, // file path
<int>, // 0 : use the file path and link to it
// 1 : ignore file path and use next parameter
<string> // text data, only present if preceding int is 1

<ListOfComponentNames>:
<string>,<string> ...

Definition Manager Script Commands 32-285


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

// The list may be empty. When not empty, each string that is listed is a component
// that references the model to be edited. Prior to editing, a clone of the model is
// made, and the components that are listed are modified so that they now refer to
// the clone.

VB Example:
Dim nam
oModelManager.EditWithComps_
("Nexxim Circuit Elements\Distributed\Distributed:bendo", _
Array("NAME:bendo new name", _
"ModTime:=", 1152722165, _
"Library:=", "Nexxim Circuit Elements\Distributed\Distributed", _
"LibLocation:=", "SysLibrary", _
Array("NAME:PinDef", _
"Pin:=", Array( "n1", _
-0.00254, _
0.00254, _
0, _
"N", _
0, _

Definition Manager Script Commands 32-286


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

0, _
false, _
0, _
true, _
"", _
false, _
false)), _
Array("NAME:PinDef", _
"Pin:=", Array( "n2", _
0.00254, _
-0.00254, _
1.5708, _
"N", _
0, _
0, _
false, _
0, _
true, _
"", _
false, _
false)), _

Definition Manager Script Commands 32-287


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:Graphics", _
"Polygon:=", Array( 0, 0, 12566272, 0, 0.00381, 0, .00127, 0.00127, _
0.00127, 0.00127, 0, 0.00381, 0, 0.00381, _
0.002032, 0.00127, 0.00381), _
"Line:=", Array(0, 1, 12566272, -0.00254, 0.00254, 0, .00254), _
"Line:=", Array(0, 1, 12566272, 0.00254, -0.00254, .00254, 0)), _
Array("NAME:PropDisplayMap", _
"W:=", Array(3, _
5, _
0, _
"Text:=", Array( 2.1684E-019, _
0.00504119, _
0, _
1, _
5, _
false, _
"Arial", _
0, _
"W=***"))))), _
rray("MY_COMP")

Definition Manager Script Commands 32-288


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Export [model manager]


Use: Exports model(s) to a library
Command: Tools > Edit Configured Libraries > Models > Export to Library
Syntax: Export Array("NAME:<LibraryName>",
<ModelName>,
<ModelName>...),
<LibraryLocation>
Return Value: None
Parameters: <LibraryName>:
<string> // name of the library

<ModelName>:
<string> // composite name of model to export

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

VB Example:
oModelManager.Export _
Array("NAME Nexxim Circuit Elements\Distributed\Distributed:bendo:mylib", _ "myModel"), "Per-
sonalLib"

Definition Manager Script Commands 32-289


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax Export (["NAME:<LibraryName>", <ComboName>, <ComboName>...], <LibraryLocation>)


Python Example oModelManager.Export (["NAME:mylib", "model1", "model2"])

GetData [model manager]


Use: Gets data that describes the definition.
Command: None
Syntax: GetData(<DefinitionName>)
Return Value: <DefinitionData> This is an array of data for the definition.
Parameters: <DefinitionName>:
<string> // composite name of the definition to edit
VB Example:
Dim ModelData
ModelData = oModelManager.GetData("Nexxim Circuit Elements\Hspice:nexx_bjt_npn")

Note:

GetData allows the user to access definition information, make modifications, and then use the Edit or EditWithComps
script commands to save the modified definition. Accordingly, for each type of definition, the array data returned to GetData
should be the same array information that is supplied to the Edit or EditWithComps commands.

Definition Manager Script Commands 32-290


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Python Syntax GetData(<ComboName>)


dataArray = oModelManager.GetData
Python Example
("mylib:mymodel")

GetNames [model manager]


Use: Returns the names of the models (used and unused) in a design. The following script command, IsUsed, can then be used to
separate used and unused models.
Command: None
Syntax: GetNames()
Return Value: An array of strings
Parameters: None
VB Example:
Dim modelNames
modelNames = oModelManager.GetNames()

Python Syntax GetNames()


Python Example modelnames = oModelManager.GetNames()

IsUsed [model manager]


Use: Used to determine if a model is used in the design.
Command: None
Syntax: IsUsed(<ModelName>)
Return Value: <Boolean> // true if the specified model is used in the design

Definition Manager Script Commands 32-291


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters: <ModelName>:
<string>
VB Example:
Dim isUsed
isUsed = oModelManager.IsUsed("MyModel")

Python Syntax IsUsed(<ComboName>)


Python Example isused = oModelManager.IsUsed ("mylib:mymodel")

Remove [model manager]


Use: Removes a model from a library
Command: Tools > Edit Configured Libraries > Models > Remove Model
Syntax: Remove <ModelName>,
<IsProjectModel>,
<LibraryName>,
<LibraryLocation>
Return Value: None
Parameters: <ModelName>:
<string> // composite name of the model to remove

<IsProjectModel>:

Definition Manager Script Commands 32-292


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<bool>

<LibraryName>:
<string> // name of the library

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

VB Example:
oModelManager.Remove "Nexxim Circuit Elements\Distributed\Distributed:bendo", true, "Project"

Python Syntax Remove (<ModelName>, <IsLocal>, <LibraryName>, <LibraryLocation>)


oModelManager.Export([
Python Example
"NAME:mylib", "model1", "model2"])

RemoveUnused [model manager]


Use: Removes models that are not used in the design.
Command: Project->Remove Unused Definitions is similar but operates slightly different and does not record script commands.
Syntax: RemoveUnused()
Return Value: <bool> True if one or more models are removed.
Parameters: None

Definition Manager Script Commands 32-293


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example:
Dim removedDefs
removedDefs = oModelManager.RemoveUnused()

Note:

The order of calls to RemoveUnused is significant. As a result, removing definitions in an unordered fashion may cause
other models in dependent definitions to be rendered unusable.

Also, the model and footprint of an unused component are not unusable until after the component itself is removed using
the Component Manager Remove script.

Python Syntax RemoveUnused()


Python Example thereWereExtras = oModelManager.RemoveUnused()

Network Data Explorer Manager Script Commands


The network data Explorer (NDE) Manager provides access to certain NDE data.
Set oDefinitionManager = oProject.GetDefinitionManager()
Set oNdExplorerManager = oDefinitionManager.GetManager("NdExplorer")
For NDE scripts accessed via the ndExplorer tool, see: Network Data Explorer Script Commands.
The topics for this section include:

Definition Manager Script Commands 32-294


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ExportFullWaveSpice
ExportNetworkData
ExportNMFData
ExportFullWaveSpice
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
"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", "Spectre", "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

Definition Manager Script Commands 32-295


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"PassivityType:=", "ConvexOptimization", // Passivity Type can be "ConvexOptimization",


// "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
Exports matrix solution data to a file. Available only for Driven solution types with ports.

UI Access N/A

Name Type Description


Parameters <DesignVariationKey> String Design variation key. Pass empty string for the current nominal vari-
ation.
<SolnSelectionArray> Array Array of selected solutions.

Definition Manager Script Commands 32-296


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array(<SolnSelector>, <SolnSelector>, ...)


If more than one array entry, this indicates a combined Interpolating
sweep.
<SolnSelector> String Solution setup name and solution name, separated by a colon.
<FileFormat> Integer File format value.
2 : Tab delimited spreadsheet format (.tab)
3 : Touchstone (.sNp)
4 : CitiFile (.cit)
7 : Matlab (.m)
8 : Terminal Z0 spreadsheet
<OutFile> String Full path to the file to write out.
<FreqsArray> Array The frequencies to export. The <FreqsArray> argument contains a
vector (e.g. "1GHz", "2GHz", ...) to use, or "all". To export all fre-
quencies, use Array("all"). If no frequencies are specified, all fre-
quencies are used.
<DoRenorm> Boolean Specifies whether to renormalize the data before export.
<RenormImped> Double Real impedance value in ohms, for renormalization. Required in syn-
tax, but ignored if DoRenorm is false.
<DataType> String Optional. Type: "S", "Y", or "Z". The matrix to export.
<pass> Integer Optional. 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> Integer Optional. Type: "0", "1", or "2"
The format to use for the exported data.
0 = Magnitude/Phase.
1= Real/Imaginary.
2= db/Phase.

Definition Manager Script Commands 32-297


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<Precision> Integer Optional. Touchstone number of digits precision. Default if not spe-
cified is 15.
<UseExportFreqs> Boolean Specifies whether to use export frequencies.
<IncludeGammaComments> Boolean Specifies whether to include Gamma and Impedance comments.
<SupportNonStdExport> Boolean Specifies whether to support non-standard Touchstone extensions
for mixed reference impedance.

Return Value None.

ExportNetworkData(<DesignVariationKey>, <SolnSelectionArray>, <SolnSelector>, <FileFormat>, <OutFile>, <Fre-


Python qsArray>, <DoRenorm>, <RenormImped>, [Optional <DataType>], [Optional <pass>], [Optional <ComplexFormat>],
Syntax [Optional <Precision>], [Optional <UseExportFreqs>], [Optional <IncludeGammaComments>], [Optional <Sup-
portNonStdExport>])
oModule.ExportNetworkData("", ["Setup1:Sweep1"], 3, "C://Documents/package_
Python HFSSDesign1.s4p",
Example
['all'], True, 50, "S", -1, 0, 15, True, True, True

ExportNetworkData <DesignVariationKey>, <SolnSelectionArray>, <SolnSelector>, <FileFormat>, <OutFile>,


<FreqsArray>, <DoRenorm>, <RenormImped>, [Optional <DataType>], [Optional <pass>], [Optional <Com-
VB Syntax
plexFormat>], [Optional <Precision>], [Optional <UseExportFreqs>], [Optional <IncludeGammaComments>],
[Optional <SupportNonStdExport>]
oModule.ExportNetworkData "width=’2in’", _
VB Example Array("Setup1:Sweep1"),2, "c:\mydir\out.tab", _
Array("all"), false, 0

Definition Manager Script Commands 32-298


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.ExportNetworkData "width=’2in’", _
Array("Setup1:Sweep1", "Setup1:Sweep2"), 3, _
"c:\mydir\out.s2p", Array(1.0e9, 1.5e9, 2.0e9), _
true, 50.0

ExportNMFData

Use:Exports s-parameters in neutral file format.


Command:In the matrix tab of the Solution dialog box, click Export->S-Parameter. Then select the Neutral Model file format.
Syntax: ExportNetworkData <SolutionName> <FileName> <ReduceMatrix><Reference Impedance> <FrequencyArray>
<DesignVariation> <Format> <Length> <PassNumber>
Return Value:None
Parameters:SolutionName>
Type: <String>
Format: <SetupName>:<SolutionName>
Solution that is exported.
<FileName>
Type:<String>
The name of the file. The file extension will determine the file format.
<ReduceMatrix>
Type: <string>
Either "Original" or one of the reduce matrix setup name
<Reference Impedance>

Definition Manager Script Commands 32-299


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Type: <Double>
Reference impedance
<FrequencyArray>
Type: <Array of doubles>
Value: Array(<double>,<double>….)
Frequency points in the sweep that is exported.
<DesignVariation>
Type: <String>
Design variation at which the solution is exported.
<Format>
Type: <String>
Values: "MagPhase", "RealImag", "DbPhase".
The format in which the sparameters will be exported.
<Length>
Type:<String>
Length for exporting sparameters.
<PassNumber>
Type:<integer>
Pass number.
VB Example:

Definition Manager Script Commands 32-300


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDesign.ExportNMFData "Setup7 : LastAdaptive", "C:/temp/neu.nmf", "Original", _ 50, Array


(10000000, 20000000, 30000000, 40000000, 50000000, 60000000, 70000000, _ 80000000, 90000000,
100000000), "", "MagPhase","7meter"

ExportNMFData(
"",
# Empty string.
1,
#The number 1.
"Name",
# This is the full path of the file from which the solution is loaded
"ExportFile",
# full path of file to export to
Python Syntax
["NAME:Frequencies"],
#optional, if none defined all frequencies are used
["NAME:NMFOptions",
#Export NMF options object
"DataTypes:=", ["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:=", "",

Definition Manager Script Commands 32-301


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

# 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:=", ["FF", "cap", "Rs"]
# Array of variables
"Variations:=", ["", "", ""]
# Array of variations to export solutions for
["NAME:ConstantVars"]
#Array of variables that are constant, can be empty
["NAME: DependentVars"]
#Array of variables that are dependent, can be empty

Definition Manager Script Commands 32-302


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"MatrixSize:=", 2,
#Matrix size, optional (used in nmf file header)
"CreateNPortModel:=", true
#Create a model based on the exported file true/false
])
oTool = oDesktop.GetTool("NdExplorer")
oTool.ExportNetworkData("", True,
"C:/.../100OHM.S2P", "$SYSLIB/Test.s2p", "",
[
"NAME:Frequencies",
500000000,
1000000000,
10000000000,
Python Example
25000000000,
50000000000,
75000000000,

100000000000
],
[
"NAME:TSOptions",

Definition Manager Script Commands 32-303


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"DataTypes:=" , ["S"],
"DisplayFormat:=" , "DB",
"FileType:=" , 3,
"Renormalize:=" , True,
"RefImpedance:=" , 50,
"Precision:=" , 6,
"UseMultipleCores:=" , False,
"NumberOfCores:=" , 1,
"Comments:=" , True,
"Noise:=" , False
])

Padstack Manager Script Commands


The padstack manager provides access to padstacks in a project. The manager object is accessed via the definition manager.
Set oDefinitionManager = oProject.GetDefinitionManager()
Set oPadstackManager = oDefinitionManager.GetManager("Padstack")
The padstack manager script commands are listed below.
Add
Edit
EditWithComps

Definition Manager Script Commands 32-304


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Export
GetData
GetNames
IsUsed
Remove
RemoveUnused
Add [padstack manager]
Use: Add a padstack
Command: Tools > Edit Configured Libraries > Padstacks > Add Padstack
Syntax: Add Array("NAME:<PadstackName>",
"ModTime:=", <ModifiedOnInfo>,
"Library:=", "", // name of the library
"LibLocation:=", "Project", // location of the named library
Array("NAME:psd",
"nam:= ", <PadstackName>,
"lib:=", "", // name of the library
"mat:=", "", // hole plating material
"plt:=", "0", // percent of hole's radius filled by plating
Array("NAME:pds",
<LayerGeometryArray>,
<LayerGeometryArray....),

Definition Manager Script Commands 32-305


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"hle:=", <PadInfo>
"hRg:=", <HoleRange>,
"sbsh:=", <SolderballShape>,
"sbpl:=", <SolderballPlacement>,
"sbr:=", <string>, // solderball diameter, real with units
"sb2:=", <string>, // solderball mid diameter, real with units
"sbn:=", <string>), // name of solderball material
"ppl:=", <PadPortLayerArray>)
Return Value: simple name of the added padstack
// If the name requested conflicts with the name of an existing
// padstack, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.

Parameters: <PadstackName>:
<string> // simple name of padstack to create

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.

Definition Manager Script Commands 32-306


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<LayerGeometryArray>:
Array("Name:lgm",
"lay:=", <string>, // definition layer name
"id:=", <int>, // definition layer id
"pad:=", <PadInfo>, // pad
"ant:=", <PadInfo>, // antipad
"thm:=", <PadInfo>, // themal pad
"X:=", <string>, // pad x connection, real with units
"Y:=", <string>, // pad y connection, real with units
"dir:=", <DirectionString>) // pad connection direction

<PadInfo>:
Array("shp:=", <PadShape>,
"Szs:=", <DimensionArray>,
"X:=", <string>, // x offset, real with units
"Y:=", <string>, // y offset, real with units
"R:=", <string>) // rotation, real with units

<PadShape>:
<string> one of these choices
"No" // no pad

Definition Manager Script Commands 32-307


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Cir" // Circle
"Sq" // Square
"Rct" // Rectangle
"Ov" // Oval
"Blt" // Bullet
"Ply" // Polygons
"R45" // Round 45 thermal
"R90" // Round 90 thermal
"S45" // Square 45 thermal
"S90" // Square 90 thermal

<DimensionArray>:
Array(<string>, ...) // each string is a real with units for one of the dimensions of the shape

<DirectionString>:
<string> one of these choices
"No" // no direction
"Any" // any direction
"0" // 0 degrees
"45" // 45 degrees

Definition Manager Script Commands 32-308


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"90" // 90 degrees
"135" // 135 degrees
"180" // 180 degrees
"225" // 225 degrees
"270" // 270 degrees
"315" // 315 degrees

<HoleRange>:
<string> one of these choices
"Thr" // through all layout layers
"Beg" // from upper pad layer to lowest layout layer
"End" // from upper layout layer to lowest pad layer
"UTL" // from upper pad layer to lowest pad layer
<SolderballShape>:
<string> one of these choices
"None" // no solderball
"Cyl" // cylinder solderball
"Sph" // spheroid solderball

<SolderballPlacement>:
<string> one of these choices
"abv" // above padstack

Definition Manager Script Commands 32-309


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"blw" // below padstack

<PadPortLayerArray>:
Array( <int>, <int>,....) where each int is a layer id
VB Example:

oPadstackManager.Add Array("NAME:Circle - through3", "ModTime:=", 1235765635, "Library:=", _


"", "LibLocation:=", "Project", Array("NAME:psd", "nam:=", "Circle - through3", "lib:=", _
"", "mat:=", "", "plt:=", "0", Array("NAME:pds", Array("NAME:lgm", "lay:=", "Top Signal", "id:=",
_
0, "pad:=", Array("shp:=", "Cir", "Szs:=", Array("2.5mm"), "X:=", "0mm", "Y:=", _
"0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir", "Szs:=", Array("3.5mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array("shp:=", "No", "Szs:=", Array(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", "0mm", "dir:=", "Any"), Array("NAME:lgm",
"lay:=", _
"SignalA", "id:=", 1, "pad:=", Array("shp:=", "Cir", "Szs:=", Array("2mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir", "Szs:=", Array( _
"3mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array("shp:=", "No", "Szs:=", Array(),
"X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", "0mm", "dir:=", "Any"), Array("NAME:lgm",
"lay:=", _
"SignalB", "id:=", 2, "pad:=", Array("shp:=", "Cir", "Szs:=", Array("2mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir", "Szs:=", Array( _

Definition Manager Script Commands 32-310


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"3mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0deg"), "thm:=", Array("shp:=", "No", "Szs:=", Array
(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", "0mm", "dir:=", "Any"), Array("NAME:lgm",
"lay:=", _
"Ground", "id:=", 3, "pad:=", Array("shp:=", "No", "Szs:=", Array(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "No", "Szs:=", Array(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array("shp:=", "R90", "Szs:=", Array( _
"3mm", "0.75mm", "1mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", _
"0mm", "dir:=", "Any"), Array("NAME:lgm", "lay:=", "Bottom signal", "id:=", 5, "pad:=", Array
("shp:=", _
"Cir", "Szs:=", Array("1mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array
("shp:=", _
"Cir", "Szs:=", Array("2mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0deg"), "thm:=", Array
("shp:=", _
"No", "Szs:=", Array(), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", _
"0mm", "dir:=", "Any")), "hle:=", Array("shp:=", "Cir", "Szs:=", Array("1.5mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "hRg:=", "End", "sbsh:=", "Sph", "sbpl:=", _
"abv", "sbr:=", "750um", "sb2:=", "1200um", "1200um", "sbn:=", "solder"), "ppl:=", Array( _
0, 1, 2, 3, 5))
Edit [padstack manager]
Use: Edit an existing padstack.
Command: Tools > Edit Configured Libraries > Padstacks > Edit Padstack
Syntax: Edit <PadstackName>,

Definition Manager Script Commands 32-311


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:<NewPadstackName>",
"ModTime:=", <ModifiedOnInfo>,
"Library:=", "", // name of the library
"LibLocation:=", "Project", // location of the named library
Array("NAME:psd",
"nam:= ", <PadstackName>,
"lib:=", "", // name of the library
"mat:=", "", // hole plating material
"plt:=", "0", // percent of hole's radius filled by plating
Array("NAME:pds",
<LayerGeometryArray>,
<LayerGeometryArray....),
"hle:=", <PadInfo>
"hRg:=", <HoleRange>,
"sbsh:=", <SolderballShape>,
"sbpl:=", <SolderballPlacement>,
"sbr:=", <string>, // solderball diameter, real with units
"sb2:=", <string>, // solderball mid diameter, real with units
"sbn:=", <string>), // name of solderball material
"ppl:=", <PadPortLayerArray>)

Definition Manager Script Commands 32-312


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Return Value: <string> // composite name of the padstack


// If the name requested conflicts with the name of an existing
// padstack, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.

Parameters: <PadstackName>:
<string> // composite name of padstack to edit

<NewPadstackName>:
<string> // new simple name for padstack

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.

<LayerGeometryArray>:
Array("Name:lgm",
"lay:=", <string>, // definition layer name
"id:=", <int>, // definition layer id
"pad:=", <PadInfo>, // pad
"ant:=", <PadInfo>, // antipad

Definition Manager Script Commands 32-313


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"thm:=", <PadInfo>, // themal pad


"X:=", <string>, // pad x connection, real with units
"Y:=", <string>, // pad y connection, real with units
"dir:=", <DirectionString>) // pad connection direction

<PadInfo>:
Array("shp:=", <PadShape>,
"Szs:=", <DimensionArray>,
"X:=", <string>, // x offset, real with units
"Y:=", <string>, // y offset, real with units
"R:=", <string>) // rotation, real with units

<PadShape>:
<string> one of these choices
"No" // no pad
"Cir" // Circle
"Sq" // Square
"Rct" // Rectangle
"Ov" // Oval
"Blt" // Bullet

Definition Manager Script Commands 32-314


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Ply" // Polygons
"R45" // Round 45 thermal
"R90" // Round 90 thermal
"S45" // Square 45 thermal
"S90" // Square 90 thermal

<DimensionArray>:
Array(<string>, ...) // each string is a real with units for one of the
// dimensions of the shape

<DirectionString>:
<string> one of these choices
"No" // no direction
"Any" // any direction
"0" // 0 degrees
"45" // 45 degrees
"90" // 90 degrees
"135" // 135 degrees
"180" // 180 degrees
"225" // 225 degrees
"270" // 270 degrees

Definition Manager Script Commands 32-315


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"315" // 315 degrees

<HoleRange>:
<string> one of these choices
"Thr" // through all layout layers
"Beg" // from upper pad layer to lowest layout layer
"End" // from upper layout layer to lowest pad layer
"UTL" // from upper pad layer to lowest pad layer

<SolderballShape>:
<string> one of these choices
"None" // no solderball
"Cyl" // cylinder solderball
"Sph" // spheroid solderball

<SolderballPlacement>:
<string> one of these choices
"abv" // above padstack
"blw" // below padstack

<PadPortLayerArray>:
Array( <int>, <int>,....) where each int is a layer id

Definition Manager Script Commands 32-316


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example:
oPadstackManager.Edit "Circle - through1", Array("NAME:Circle - through1", "ModTime:=", _
1235765635, "Library:=", "", "LibLocation:=", "Project", Array("NAME:psd", "nam:=", _
"Circle - through1", "lib:=", "", "mat:=", "", "plt:=", "0", Array("NAME:pds", Array("NAME:lgm",
"lay:=", _
"Top Signal", "id:=", 0, "pad:=", Array("shp:=", "Cir", "Szs:=", Array("2.5mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir", "Szs:=", Array( _
"3.5mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array("shp:=", "No", "Szs:=", Array
(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", "0mm", "dir:=", "Any"), Array("NAME:lgm",
"lay:=", _
"SignalA", "id:=", 1, "pad:=", Array("shp:=", "Cir", "Szs:=", Array("2mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir", "Szs:=", Array( _
"3mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array("shp:=", "No", "Szs:=", Array(),
"X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", "0mm", "dir:=", "Any"), Array("NAME:lgm",
"lay:=", _
"SignalB", "id:=", 2, "pad:=", Array("shp:=", "Cir", "Szs:=", Array("2mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir", "Szs:=", Array( _
"3mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0deg"), "thm:=", Array("shp:=", "No", "Szs:=", Array
(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", "0mm", "dir:=", "Any"), Array("NAME:lgm",
"lay:=", _

Definition Manager Script Commands 32-317


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Ground", "id:=", 3, "pad:=", Array("shp:=", "No", "Szs:=", Array(), "X:=", _


"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "No", "Szs:=", Array(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array("shp:=", "R90", "Szs:=", Array( _
"3mm", "0.75mm", "1mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", _
"0mm", "dir:=", "Any"), Array("NAME:lgm", "lay:=", "Bottom signal", "id:=", 5, "pad:=", Array
("shp:=", _
"Cir", "Szs:=", Array("1mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=",
_
"Cir", "Szs:=", Array("2mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0deg"), "thm:=", Array("shp:=",
_
"No", "Szs:=", Array(), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", _
"0mm", "dir:=", "Any")), "hle:=", Array("shp:=", "Cir", "Szs:=", Array("1.5mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "hRg:=", "End", "sbsh:=", "Sph", "sbpl:=", _
"abv", "sbr:=", "750um", "sb2:=", "1200um", "1200um", "sbn:=", "solder"), "ppl:=", Array( _
0, 1, 2, 3, 5))
EditWithComps [padstack manager]
Use: Edit an existing padstack.
Command: None
Syntax: EditWithComps <PadstackName>,
Array("NAME:<NewPadstackName>",
"ModTime:=", <ModifiedOnInfo>,

Definition Manager Script Commands 32-318


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Library:=", "", // name of the library


"LibLocation:=", "Project", // location of the named library
Array("NAME:psd",
"nam:= ", <PadstackName>,
"lib:=", "", // name of the library
"mat:=", "", // hole plating material
"plt:=", "0", // percent of hole's radius filled by plating
Array("NAME:pds",
<LayerGeometryArray>,
<LayerGeometryArray....),
"hle:=", <PadInfo>
"hRg:=", <HoleRange>,
"sbsh:=", <SolderballShape>,
"sbpl:=", <SolderballPlacement>,
"sbr:=", <string>, // solderball diameter, real with units
"sb2:=", <string>, // solderball mid diameter, real with units
"sbn:=", <string>), // name of solderball material
"ppl:=", <PadPortLayerArray>,
Array(<ListOfComponentNames>) // Component names

Return Value: <string>

Definition Manager Script Commands 32-319


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

// composite name of the padstack.


// If the name requested conflicts with the name of an existing
// padstack, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.

Parameters: <PadstackName>:
<string> // composite name of the padstack being edited

<NewPadstackName>:
<string> // new simple name for the padstack

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.

<LayerGeometryArray>:
Array("Name:lgm",
"lay:=", <string>, // definition layer name
"id:=", <int>, // definition layer id
"pad:=", <PadInfo>, // pad

Definition Manager Script Commands 32-320


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ant:=", <PadInfo>, // antipad


"thm:=", <PadInfo>, // themal pad
"X:=", <string>, // pad x connection, real with units
"Y:=", <string>, // pad y connection, real with units
"dir:=", <DirectionString>) // pad connection direction

<PadInfo>:
Array("shp:=", <PadShape>,
"Szs:=", <DimensionArray>,
"X:=", <string>, // x offset, real with units
"Y:=", <string>, // y offset, real with units
"R:=", <string>) // rotation, real with units

<PadShape>:
<string> one of these choices
"No" // no pad
"Cir" // Circle
"Sq" // Square
"Rct" // Rectangle
"Ov" // Oval
"Blt" // Bullet

Definition Manager Script Commands 32-321


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Ply" // Polygons
"R45" // Round 45 thermal
"R90" // Round 90 thermal
"S45" // Square 45 thermal
"S90" // Square 90 thermal

<DimensionArray>:
Array(<string>, ...) // each string is a real with units for one of the
// dimensions of the shape

<DirectionString>:
<string> one of these choices
"No" // no direction
"Any" // any direction
"0" // 0 degrees
"45" // 45 degrees
"90" // 90 degrees
"135" // 135 degrees
"180" // 180 degrees
"225" // 225 degrees

Definition Manager Script Commands 32-322


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"270" // 270 degrees


"315" // 315 degrees

<HoleRange>:
<string> one of these choices
"Thr" // through all layout layers
"Beg" // from upper pad layer to lowest layout layer
"End" // from upper layout layer to lowest pad layer
"UTL" // from upper pad layer to lowest pad layer

<SolderballShape>:
<string> one of these choices
"None" // no solderball
"Cyl" // cylinder solderball
"Sph" // spheroid solderball

<SolderballPlacement>:
<string> one of these choices
"abv" // above padstack
"blw" // below padstack

<PadPortLayerArray>:
Array( <int>, <int>,....) where each int is a layer id

Definition Manager Script Commands 32-323


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ListOfComponentNames>:
<string>,<string> ...
// The list may be empty. When not empty, each string that is listed is a component
// that references the padstack to be edited. Prior to editing, a clone of the padstack is
// made, and the components that are listed are modified so that they now refer to
// the clone.

VB Example:
oPadstackManager.EditWithComps "Circle - through1", Array("NAME:Circle - through1", "ModTime:=",
_
1235765635, "Library:=", "", "LibLocation:=", "Project", Array("NAME:psd", "nam:=", _
"Circle - through1", "lib:=", "", "mat:=", "", "plt:=", "0", Array("NAME:pds", Array("NAME:lgm",
"lay:=", _
"Top Signal", "id:=", 0, "pad:=", Array("shp:=", "Cir", "Szs:=", Array("2.5mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir", "Szs:=", Array( _
"3.5mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array("shp:=", "No", "Szs:=", Array
(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", "0mm", "dir:=", "Any"), Array("NAME:lgm",
"lay:=", _
"SignalA", "id:=", 1, "pad:=", Array("shp:=", "Cir", "Szs:=", Array("2mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir", "Szs:=", Array( _

Definition Manager Script Commands 32-324


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"3mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array("shp:=", "No", "Szs:=", Array(),
"X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", "0mm", "dir:=", "Any"), Array("NAME:lgm",
"lay:=", _
"SignalB", "id:=", 2, "pad:=", Array("shp:=", "Cir", "Szs:=", Array("2mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir", "Szs:=", Array( _
"3mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0deg"), "thm:=", Array("shp:=", "No", "Szs:=", Array
(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", "0mm", "dir:=", "Any"), Array("NAME:lgm",
"lay:=", _
"Ground", "id:=", 3, "pad:=", Array("shp:=", "No", "Szs:=", Array(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "No", "Szs:=", Array(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array("shp:=", "R90", "Szs:=", Array( _
"3mm", "0.75mm", "1mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", _
"0mm", "dir:=", "Any"), Array("NAME:lgm", "lay:=", "Bottom signal", "id:=", 5, "pad:=", Array
("shp:=", _
"Cir", "Szs:=", Array("1mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array
("shp:=", _
"Cir", "Szs:=", Array("2mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0deg"), "thm:=", Array
("shp:=", _
"No", "Szs:=", Array(), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", _
"0mm", "dir:=", "Any")), "hle:=", Array("shp:=", "Cir", "Szs:=", Array("1.5mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "hRg:=", "End", "sbsh:=", "Sph", "sbpl:=", _
"abv", "sbr:=", "750um", "sb2:=", "1200um", "1200um", "sbn:=", "solder"), "ppl:=", Array( _

Definition Manager Script Commands 32-325


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

0, 1, 2, 3, 5), Array("")
Export [padstack manager]
Use: Export a padstack to a library
Command: Tools > Edit Configured Libraries > Padstacks > Export to Library
Syntax: Export Array("NAME:<LibraryName>",
<PadstackName>,
<PadstackName>...),
<LibraryLocation>
Return Value: None
Parameters: <LibraryName>:
<string> // name of the library

<PadstackName>:
<string> // simple name of padstack to export

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

VB Example:

Definition Manager Script Commands 32-326


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oPadstackManager.Export Array("NAME:mylib", "myPadstack"), "PersonalLib"


GetData [padstack manager]
Use: Gets data that describes the definition.
Command: None
Syntax: GetData(<DefinitionName>)
Return Value: <DefinitionData> This is an array of data for the definition.
Parameters: <DefinitionName>:
<string> // composite name of the definition to edit
VB Example:
Dim padstackData
padstackData = oPadstackManager.GetData("NoPad SMT East")

Note:

GetData allows the user to access definition information, make modifications, and then use the Edit or EditWithComps
script commands to save the modified definition. Accordingly, for each type of definition, the array data returned to
GetData should be the same array information that is supplied to the Edit or EditWithComps commands.

GetNames [padstack manager]


Use: Returns the names of the padstack (used and unused) in a design. The following script command, IsUsed, can then be used to
separate used and unused padstacks.
Command: None
Syntax: GetNames()
Return Value: An array of strings

Definition Manager Script Commands 32-327


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Parameters: None
VB Example:
Dim padstackNames
padstackNames = oPadstackManager.GetNames()
IsUsed [padstack manager]
Use: Used to determine if a component is used in the design.
Command: None
Syntax: IsUsed(<PadstackName>)
Return Value: <Boolean> // true if the specified padstack is used in the design
Parameters: <PadstackName>:
<string>
VB Example:
Dim isUsed
isUsed = oPadstackManager.IsUsed("MyPadstack")
Remove [padstack manager]
Use: Removes a padstack from a library
Command: Tools > Edit Configured Libraries > Padstacks > Remove Padstacks
Syntax: Remove <PadstackName>,
<IsProjectPadstack>,
<LibraryName>,

Definition Manager Script Commands 32-328


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<LibraryLocation>
Return Value: None
Parameters: <PadstackName>:
<string> // simple name of the padstack to remove

<IsProjectPadstack>:
<bool>

<LibraryName>:
<string> // name of the library

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

VB Example:

oPadstackManager.Remove "Polygon SMT", true, "Padstacks", "Project"


oPadstackManager.Remove "Polygon SMT", false, "MyLib", "PersonalLib"
RemoveUnused [padstack manager]
Use: Removes padstacks that are not used in the design.
Command: Project->Remove Unused Definitions is similar but operates slightly different and does not record script commands.

Definition Manager Script Commands 32-329


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Syntax: RemoveUnused()
Return Value: <bool> True if one or more padstacks are removed.
Parameters: None
VB Example:
Dim removedDefs
removedDefs = oPadstackManager.RemoveUnused()

Note:

The order of calls to RemoveUnused is significant. As a result, removing definitions in an unordered fashion may cause
other padstacks in dependent definitions to be rendered unusable.

Script and Library Scripts


The definition manager provides access to materials in a project. The manager object is accessed via the definition manager.
Set oDefinitionManager = oProject.GetDefinitionManager()
The script and library script commands are listed below.
AddScript
EditScript
ExportScript
RemoveScript
ModifyLibraries

Definition Manager Script Commands 32-330


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AddScript
Adds a script to the definition manager.

UI Access N/A

Name Type Description


<AddScriptArray> Array Structured array.

Parameters Array("NAME:<string script name>",


"ScriptLang:=", <string "vbscript" or "javascript">
"ScriptText:=, <string text of script>)

Return Value None.

Python Syntax AddScript(<AddScriptArray>)


oDefinitionManager.AddScript(
["NAME:MyScript",
"ScriptLang:=", "vbscript",
Python Example
"ScriptText:=", "MsgBox(\"HelloWorld\")"
]
)

VB Syntax AddScript <AddScriptArray>

Definition Manager Script Commands 32-331


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDefinitionManager.AddScript Array("NAME:MyScript", "ScriptLang:=", "vbscript",


VB Example
"ScriptText:=", "MsgBox(""HelloWorld"")")

EditScript
Edits a script in the definition manager.

UI Access N/A

Name Type Description


<OriginalName> String Name of the script to be edited.
<EditScriptArray> Array Structured array.
Parameters Array("NAME:<string script name>",
"ScriptLang:=", <string "vbscript" or "javascript">
"ScriptText:=, <string text of script>)

Return Value None.

Python Syntax EditScript(<OriginalName>, <EditScriptArray>)

Definition Manager Script Commands 32-332


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oDefinitionManager.EditScript("MyScript",
["NAME:MyNewScript",
"ScriptLang:=", "vbscript",
Python Example
"ScriptText:=", "MsgBox(\"HelloAgain\")"
]
)

VB Syntax EditScript <OriginalName> <EditScriptArray>


oDefinitionManager.EditScript "MyScript" Array("NAME:MyNewScript",
VB Example
"ScriptLang:=", "vbscript", "ScriptText:=", "MsgBox(""HelloAgain"")")

ExportScript
Use: Export to Library in the script definition manager
Command: None
Syntax: ExportScript <ExportData>,<Library location>
Return Value: None
Parameters: <ExportData>
Array("NAME:<LibraryName>",<ScriptName>,<ScriptName>,…)
VB Example:
oProject.ExportComponent Array("NAME:mylib", "myscript"), "PersonalLib"

Python Syntax ExportScript( <ExportData>,<Library location>)

Definition Manager Script Commands 32-333


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oProject.ExportComponent
Python Example
(["NAME:mylib", "myscript"], "PersonalLib")

ModifyLibraries
Use: Configure Libraries on the Tools menu
Command: None
Syntax: ModifyLibraries <DesignName>,Array(<ConfigLibArray>)
Return Value: None
Parameters: <DesignName>
Type: <string>
<ConfigLibArray>
Array("NAME:<LibraryType>,<ConfiguredLib>,<ConfiguredLib>,…),…
<ConfiguredLib> // blank to leave unchanged
<DefinitionType>
Array("<libraryname >","<libraryname>",…)
VB Example:
oDefinitionManager.ModifyLibraries "MyCircuit", _
Array("NAME:PersonalLib"), _
Array("NAME:UserLib"), _
Array("NAME:SystemLib", _
"Symbols:=", Array( "Circuit Elements", "Symbols", _

Definition Manager Script Commands 32-334


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ParamExtraElements\PE_Symbols", _
"Vendor Elements\Nonlinear"))

Python Syntax ModifyLibraries (<DesignName>,[<ConfigLibArray>])


oDefinitionManager.ModifyLibraries(
"MyCircuit", _
["NAME:PersonalLib"], _
["NAME:UserLib"], _
Python Example
["NAME:SystemLib", _
"Symbols:=", [ "Circuit Elements", "Symbols",_
"ParamExtraElements\PE_Symbols", _
"Vendor Elements\Nonlinear"]])

RemoveScript
Use: Remove Script in the script definition manager
Command: None
Syntax: RemoveScript <ScriptName>,<IsProjectScript>, <LibraryName>,<LibraryLocation>
Return Value: None
Parameters: <ScriptName>
Type: <string>
<IsProjectScript>

Definition Manager Script Commands 32-335


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Type: <bool>
<LibraryName>
Type: <string>
<LibraryLocation>
Type: <string>
VB Example:
oDefinitionManager.RemoveScript "myscript", true, "Local", "Project"

Python Syntax RemoveScript (<ScriptName>,<IsProjectScript>, <LibraryName>,<LibraryLocation>)


oDefinitionManager.RemoveScript(
Python Example
"myscript", true, "Local", "Project")

Symbol Manager Script Commands


The symbol manager provides access to symbols in a project. The manager object is accessed via the definition manager.
Set oDefinitionManager = oProject.GetDefinitionManager()
Set oSymbolManager = oDefinitionManager.GetManager("Symbol")
The symbol manager script commands are listed below.
Add
BringToFront
Edit

Definition Manager Script Commands 32-336


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditWithComps
Export
GetData
GetNames
IsUsed
Remove
RemoveUnused
Add [symbol manager]
Use: Add a symbol
Command: Tools > Edit Configured Libraries > Symbols > Add Symbol
Syntax: Add Array("NAME:<SymbolName>",
"ModTime:=", <ModifiedTimeInfo>,
"Library:=", "", // Library name
"LibLocation:=", "Project", // Project Location
<PinDefInfo>,
<PinDefInfo>,... // optional, to define pins
<GraphicsDataInfo>, // optional, to define graphics
<PropDisplayMapInfo>)) // optional, to define property displays

Return Value: <string>


// composite name of the symbol.

Definition Manager Script Commands 32-337


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

// If the name requested conflicts with the name of an existing


// symbol, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.

Parameters: <SymbolName>:
<string> // simple name of the symbol being added

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.

<PinDefInfo>:
Array("NAME:PinDef",
"Pin:=", Array (<string>, // pin name
<real>, // x location
<real>, // y location
<real>, // angle in radians
<PinType>,
<real>, // line width
<real>, // line length

Definition Manager Script Commands 32-338


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<bool>, // mirrored
<int>, // color
<bool>, // true if visible, false if not
<string>, // hidden net name
<OptionalPinInfo>, // optional info
<PropDisplayMapInfo>)) // optional

<PinType>:
<string> // "N" : normal pin
// "I" : input pin
// "O" : output pin

<OptionalPinInfo>:
// Specify both or neither
<bool>, // true if name is to be shown
<bool>, // true if number is to be shown

<PropDisplayMapInfo>:
Array("NAME:PropDisplayMap",
<PropDisplayInfo>,

Definition Manager Script Commands 32-339


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<PropDisplayInfo>,...)

<PropDisplayInfo>:
<NameString>, Array(<DisplayTypeInfo>,
<DisplayLocationInfo>,
<int>, // optional, level number
<TextInfo>)
<NameString>:
<string> // PropertyName:=, where PropertyName is the name of
// the property to be displayed

<DisplayTypeInfo>:
<int> // 0 : No display
// 1 : Display name only
// 2 : Display value only
// 3 : Display both name and value
// 4: Display evaluated value only
// 5: Display both name and evaluated value

<DisplayLocationInfo>:

Definition Manager Script Commands 32-340


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<int> // 0 : Left
// 1 : Top
// 2 : Right
// 3 : Bottom
// 4 : Center
// 5 : Custom placement

<GraphicsDataInfo>:
Array("NAME:Graphics",
// one or more of the following
<RectInfo>,
<CircleInfo>,
<ArcInfo>,
<LineInfo>,
<PolygonInfo>,
<TextInfo>,
<ImageInfo>)

<RectInfo>:
"Rect:=", Array(<real>, // line width
<int>, // fill pattern

Definition Manager Script Commands 32-341


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<int>, // color
<real>, // angle, in radians
<real>, // x position of center
<real>, // y position of center
<real>, // width
< real>) // height

<CircleInfo>:
"Circle:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>) // radius

<ArcInfo>:
"Arc:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<real>, // x position of center

Definition Manager Script Commands 32-342


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<real>, // y position of center


< real>, // radius
<real>, // start angle, in radians
<end>) // end angle, in radians

<LineInfo>:
"Line:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<PointInfo>, // must specify at least 2 points
<PointInfo>...)
<PointInfo>:
<real>, // x position
<real> // y position

<PolygonInfo>:
"Polygon:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<PointInfo>, // must specify at least 3 points
<PointInfo>...)

Definition Manager Script Commands 32-343


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<TextInfo>:
"Text:=", Array(<real>, // x position
<real>, // y position
<real>, // angle, in radians
<Justification>,
<bool>, // is plotter font
<string>, // font name
<int>, // color
<string>) // text string

<Justification>:
<int> // 0 : left top
// 1 : left base
// 2 : left bottom
// 3 : center top
// 4 : center base
// 5 : center bottom
// 6 : right top
// 7 : right base

Definition Manager Script Commands 32-344


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

// 8 : right bottom

<ImageInfo>:
"Image:=", Array(<RectInfo>,
<ImageData>,
<bool>) // is mirrored

<ImageData>:
<string>, // file path
<int>, // 0 : use the file path and link to it
// 1 : ignore file path and use next parameter
<string> // text data, only present if preceding int is 1

VB Example:
oSymbolManager.Add Array("NAME:MySymbol",_
"ModTime:=", 1070989137, _
"Library:=", "", _
"LibLocation:=", "Project", _
Array("NAME:PinDef", _
"Pin:=", Array ("newpin0", _
0.00254, _ 0, _
0, _

Definition Manager Script Commands 32-345


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"N",_
0, _
0.00254, _
false, _
0, _
true, _
"",_
false, _
false)), _
Array("NAME:PinDef", _
"Pin:=", Array ("newpin1", _
-0.00254, _
0, _
3.14159265358979, _
"N",_
0, _
0.00254, _
false, _
0, _
true, _

Definition Manager Script Commands 32-346


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"",_
false, _
false)),
Array("NAME:Graphics", _
"Rect:=", Array(0, _
0, _
12566272, _
0, _
4.33680868994202e-019, _
-0.000635, _
0.00508, _
0.002794), _
"Circle:=", Array(0, _
0, _
12566272, _
0.000127, _
0.000635, _
0.000635)))

BringToFront [symbol manager]


Use: Changes the drawing for the symbol so that the specified objects are drawn on top of other overlapping objects.

Definition Manager Script Commands 32-347


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Command: Draw > Bring To Front


Syntax: BringToFront Array("NAME:Selections", "Selections:=", Array (<Object>, <Object>, ...))
Return Value: None
Parameters: <Object>
<string> // object to bring to the front
VB Example:
oDefinitionEditor.BringToFront Array("NAME:Selections", "Selections:=", Array( "SchObj@10"))

Edit [deprecated]
Deprecated command — please use EditWithComps.
EditWithComps [symbol manager]
Use: Edit an existing symbol.
Command: None
Syntax: EditWithComps <SymbolName>,
Array("NAME:<NewSymbolName>",
"ModTime:=", <ModifiedTimeInfo>,
"Library:=", <string>, // Library name
"LibLocation:=", <string>, // Project Location
<PinDefInfo>,
<PinDefInfo>,... // optional, to define pins

Definition Manager Script Commands 32-348


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<GraphicsDataInfo>, // optional, to define graphics


<PropDisplayMapInfo>), // optional, to define property displays
Array(<ListOfComponentNames>) // Component names

Return Value: <string>


// composite name of the symbol.
// If the name requested conflicts with the name of an existing
// symbol, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.

Parameters: <SymbolName>:
<string> // composite name of the symbol being edited

<NewSymbolName>:
<string> // new simple name for the symbol

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.

<PinDefInfo>:

Definition Manager Script Commands 32-349


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Array("NAME:PinDef",
"Pin:=", Array (<string>, // pin name
<real>, // x location
<real>, // y location
<real>, // angle in radians
<PinType>,
<real>, // line width
<real>, // line length
<bool>, // mirrored
<int>, // color
<bool>, // true if visible, false if not
<string>, // hidden net name
<OptionalPinInfo>, // optional info
<PropDisplayMapInfo>)) // optional

<PinType>:
<string> // "N" : normal pin
// "I" : input pin
// "O" : output pin

Definition Manager Script Commands 32-350


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<OptionalPinInfo>:
// Specify both or neither
<bool>, // true if name is to be shown
<bool>, // true if number is to be shown

<PropDisplayMapInfo>:
Array("NAME:PropDisplayMap",
<PropDisplayInfo>,
<PropDisplayInfo>,...)

<PropDisplayInfo>:
<NameString>, Array(<DisplayTypeInfo>,
<DisplayLocationInfo>,
<int>, // optional, level number
<TextInfo>)

<NameString>:
<string> // PropertyName:=, where PropertyName is the name of
// the property to be displayed

<DisplayTypeInfo>:

Definition Manager Script Commands 32-351


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<int> // 0 : No display
// 1 : Display name only
// 2 : Display value only
// 3 : Display both name and value
// 4: Display evaluated value only
// 5: Display both name and evaluated value

<DisplayLocationInfo>:
<int> // 0 : Left
// 1 : Top
// 2 : Right
// 3 : Bottom
// 4 : Center
// 5 : Custom placement

<GraphicsDataInfo>:
Array("NAME:Graphics",
// one or more of the following
<RectInfo>,
<CircleInfo>,

Definition Manager Script Commands 32-352


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ArcInfo>,
<LineInfo>,
<PolygonInfo>,
<TextInfo>,
<ImageInfo>)

<RectInfo>:
"Rect:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // angle, in radians
<real>, // x position of center
<real>, // y position of center
<real>, // width
< real>) // height

<CircleInfo>:
"Circle:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // x position of center

Definition Manager Script Commands 32-353


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<real>, // y position of center


< real>) // radius

<ArcInfo>:
"Arc:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>, // radius
<real>, // start angle, in radians
<end>) // end angle, in radians

<LineInfo>:
"Line:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<PointInfo>, // must specify at least 2 points
<PointInfo>...)
<PointInfo>:

Definition Manager Script Commands 32-354


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<real>, // x position
<real> // y position

<PolygonInfo>:
"Polygon:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<PointInfo>, // must specify at least 3 points
<PointInfo>...)

<TextInfo>:
"Text:=", Array(<real>, // x position
<real>, // y position
<real>, // angle, in radians
<Justification>,
<bool>, // is plotter font
<string>, // font name
<int>, // color
<string>) // text string

<Justification>:

Definition Manager Script Commands 32-355


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<int> // 0 : left top


// 1 : left base
// 2 : left bottom
// 3 : center top
// 4 : center base
// 5 : center bottom
// 6 : right top
// 7 : right base
// 8 : right bottom

<ImageInfo>:
"Image:=", Array(<RectInfo>,
<ImageData>,
<bool>) // is mirrored

<ImageData>:
<string>, // file path
<int>, // 0 : use the file path and link to it
// 1 : ignore file path and use next parameter
<string> // text data, only present if preceding int is 1

Definition Manager Script Commands 32-356


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<ListOfComponentNames>:
<string>,<string> ...
// The list may be empty. When not empty, each string that is listed is a component
// that references the symbol to be edited. Prior to editing, a clone of the symbol is
// made, and the components that are listed are modified so that they now refer to
// the clone.

VB Example:
Dim nam
oSymbolManager.EditWithComps _
("Nexxim Circuit Elements\Distributed\Distributed:bendo", _
Array("NAME:bendo new name", _
"ModTime:=", 1152722165, _
"Library:=", "Nexxim Circuit Elements\Distributed\Distributed", _
"LibLocation:=", "SysLibrary", _
Array("NAME:PinDef", _
"Pin:=", Array( "n1", _
-0.00254, _
0.00254, _
0, _

Definition Manager Script Commands 32-357


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"N", _
0, _
0, _
false, _
0, _
true, _
"", _
false, _
false)), _
Array("NAME:PinDef", _
"Pin:=", Array( "n2", _
0.00254, _
-0.00254, _
1.5708, _
"N", _
0, _
0, _
false, _
0, _
true, _

Definition Manager Script Commands 32-358


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"", _
false, _
false)), _
Array("NAME:Graphics", _
"Polygon:=", Array( 0, 0, 12566272, 0, 0.00381, 0, .00127, 0.00127, _
0.00127, 0.00127, 0, 0.00381, 0, 0.00381, _
0.002032, 0.00127, 0.00381), _
"Line:=", Array(0, 1, 12566272, -0.00254, 0.00254, 0, .00254), _
"Line:=", Array(0, 1, 12566272, 0.00254, -0.00254, .00254, 0)), _
Array("NAME:PropDisplayMap", _
"W:=", Array(3, _
5, _
0, _
"Text:=", Array( 2.1684E-019, _
0.00504119, _
0, _
1, _
5, _
false, _
"Arial", _
0, _

Definition Manager Script Commands 32-359


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"W=***"))))), _
Array("MY_COMP")

Export [symbol manager]


Use: Exports symbol(s) to a library
Command: Tools > Edit Configured Libraries > Symbols > Export to Library
Syntax: Export Array("NAME:<LibraryName>",
<SymbolName>,
<SymbolName>...),
<LibraryLocation>
Return Value: None
Parameters: <LibraryName>:
<string> // name of the library

<SymbolName>:
<string> // composite name of symbol to export

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

Definition Manager Script Commands 32-360


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Example:
oSymbolManager.Export _
Array("NAME Nexxim Circuit Elements\Distributed\Distributed:bendo:mylib", _ "mySymbol"), "Per-
sonalLib"
GetData [symbol manager]
Use: Gets data that describes the definition.
Command: None
Syntax: GetData(<DefinitionName>)
Return Value: <DefinitionData> This is an array of data for the definition.
Parameters: <DefinitionName>:
<string> // composite name of the definition to edit
VB Example:
Dim symbolData
symbolData = oSymbolManager.GetData("Nexxim Circuit Elements\Hspice:nexx_bjt_npn")

Note:

GetData allows the user to access definition information, make modifications, and then use the Edit or EditWithComps
script commands to save the modified definition. Accordingly, for each type of definition, the array data returned to
GetData should be the same array information that is supplied to the Edit or EditWithComps commands.

Definition Manager Script Commands 32-361


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetNames [symbol manager]


Use: Returns the names of the symbols (used and unused) in a design. The following script command, IsUsed, can then be used to
separate used and unused symbols.
Command: None
Syntax: GetNames()
Return Value: An array of strings
Parameters: None
VB Example:
Dim symbolNames
symbolNames = oSymbolManager.GetNames()
IsUsed [symbol manager]
Use: Used to determine if a symbol is used in the design.
Command: None
Syntax: IsUsed(<SymbolName>)
Return Value: <Boolean> // true if the specified symbol is used in the design
Parameters: <SymbolName>:
<string>
VB Example: Dim isUsed
isUsed = oSymbolManager.IsUsed("MySymbol")

Definition Manager Script Commands 32-362


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Remove [symbol manager]


Use: Removes a symbol from a library
Command: Tools > Edit Configured Libraries > Symbols > Remove Symbol
Syntax: Remove <SymbolName>,
<IsProjectSymbol>,
<LibraryName>,
<LibraryLocation>
Return Value: None
Parameters: <SymbolName>:
<string> // composite name of the symbol to remove

<IsProjectSymbol>:
<bool>

<LibraryName>:
<string> // name of the library

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

VB Example:

Definition Manager Script Commands 32-363


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oSymbolManager.Remove "Nexxim Circuit Elements\Distributed\Distributed:bendo", true, "Project"

RemoveUnused [symbol manager]


Use: Removes symbols that are not used in the design.
Command: Project->Remove Unused Definitions is similar but operates slightly different and does not record script commands.
Syntax: RemoveUnused()
Return Value: <bool> True if one or more symbols are removed.
Parameters: None
VB Example:
Dim removedDefs
removedDefs = oSymbolManager.RemoveUnused()

Note:

The order of calls to RemoveUnused is significant. As a result, removing definitions in an unordered fashion may cause
other symbols in dependent definitions to be rendered unusable.

Also, the symbol and footprint of an unused component are not unusable until after the component itself is removed using
the Component Manager Remove script.

Definition Manager Script Commands 32-364


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

33 - Design Verification Script Commands


The Design Verification (DV) module controls the use of DV rule sets and runs in a Circuit project. The DV module is accessed via the
design script object.
Set oDesign = oProject.GetActiveDesign()
Set oModule = oDesign.GetModule("DV")
The topics for this section include:
AddRuleSet
AddRun
DeleteRuleSet
DeleteRun
EditRuleSet
EditRun
RenameRuleSet
RenameRun
RunAllDV
RunAllRuleSetDV
RunDV

AddRuleSet
Use: Adds a rule set to the design
Command: Right-click Design Verification in the Project Tree and choose Add Rule Set
Syntax: AddRuleSet Array("NAME:<RuleSetName>",

Design Verification Script Commands 33-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ScriptNames:=", <ScriptInfo>,
"ScriptActiveFlags:=", <ScriptFlags>)
Return Value: None
Parameters: <RuleSetName>:
<string> // name of the rule set to create
<ScriptInfo>:
Array(<string>, <string>,...) // names of scripts to be in the rule set
<ScriptFlags>:
sequence of "t" and "f" characters
t indicates a script that is active (used in when the rule set is run)
f indicates a script is not currently active (used when the rule set is run)
applied to the scripts as ordered in <ScriptInfo>
<string>
VB Example:
oModule.AddRuleSet Array("NAME:Rule Set 9", _
"ScriptNames:=", Array("And", _
"Find Shorts"), _
"ScriptActiveFlags:=", "tf")

AddRun
Use: Adds a run to a rule set already in the design

Design Verification Script Commands 33-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Command: Right-click on a rule set item under Design Verification in the Project Tree and choose Add Run
Syntax: AddRun <RuleSetName>,
Array("NAME:<RunName>",
"TargetType:=", <TargetTypeInfo>, // optional
"TargetObjects:=", <TargetObjectsInfo>, // optional
"IgnoredObjects:=", <IgnoredObjectsInfo>, // optional
"ArcTolerance:=", <ToleranceString>) // optional
Return Value: None
Parameters: <RuleSetName>:
<string> // name of an existing rule set
<RunName>:
<string> // name of the run to create
<TargetTypeInfo>:
<int> // 0 for entire layout (default if not specified)
// 1 for specified portion of layout
<TargetObjectsInfo>:
objects on which to perform the check
may specify if TargetTypeInfo is 1 (specified portion of layout)
"<ObjectName>, <ObjectName>, ..."
<ObjectName>:
<string> // name of a layout object

Design Verification Script Commands 33-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<IgnoredObjectsInfo>:
objects which to ignore when performing the check
may specify if TargetTypeInfo is 0 (entire layout)
"<ObjectName>, <ObjectName>, ..."
<ToleranceString>:
<string> // real number and units
// if not specified, the current layout arc tolerance is used
VB Example:
oModule.AddRun "Rule Set 10", _
Array("NAME:All", _
"TargetType:=", 0)
oModule.AddRun "Rule Set 10", _
Array("NAME:Selected Objs2", _
"TargetType:=", 1, _
"TargetObjects:=", "line_975,line_1015")
oModule.AddRun "Rule Set 10", _
Array("NAME:Objects to Ignore2", _
"TargetType:=", 0, _
"IgnoredObjects:=", "via_209,line_736")

Design Verification Script Commands 33-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

DeleteRuleSet
Use: Deletes a rule set from the design
Command: Right-click on a rule set item under Design Verification in the Project Tree and choose Delete
Syntax: DeleteRuleSet <RuleSetName>
Return Value: None
Parameters: <RuleSetName>:
<string> // name of the rule set to delete
VB Example: oModule.DeleteRuleSet "Rule Set 9"

DeleteRun
Use: Deletes a run from an existing a rule set
Command: Right-click on a run item under Design Verification in the Project Tree and choose Delete
Syntax: DeleteRun <RuleSetName>, <RunName>
Return Value: None
Parameters: <RuleSetName>:
<string> // name of an existing rule set
<RunName>:
<string> // name of the run to delete
VB Example: oModule.DeleteRun "Rule Set 10", "All

EditRuleSet
Use: Edits a existing rule set

Design Verification Script Commands 33-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Command: Right-click on a rule set item under Design Verification in the Project Tree and choose Properties.
Syntax: EditRuleSet <ExistingRuleSetName>,
Array("NAME:<RuleSetName>",
"ScriptNames:=", <ScriptInfo>,
"ScriptActiveFlags:=", <ScriptFlags>)
Return Value: None
Parameters: <ExistingRuleSetName>:
<string> // name of the rule set to change
<RuleSetName>:
<string> // name of the rule set after change
<ScriptInfo>:
Array(<string>, <string>,...) // names of scripts to be in the rule set
<ScriptFlags>:
sequence of "t" and "f" characters
t indicates a script that is active (used in when the rule set is run)
f indicates a script is not currently active (used when the rule set is run)
applied to the scripts as ordered in <ScriptInfo>
<string>
VB Example: oModule.EditRuleSet "Rule Set 9", _
Array("NAME:Rule Set 10", _

Design Verification Script Commands 33-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ScriptNames:=", Array("And", _
"Find Shorts"), _
"ScriptActiveFlags:=", "tt")

EditRun
Use: Edits an existing run.
Command: Right-click on a run item under Design Verification in the Project Tree and choose Properties.
Syntax: EditRun <RuleSetName>,
<ExistingRunName>,
Array("NAME:<RunName>",
"TargetType:=", <TargetTypeInfo>, // optional
"TargetObjects:=", <TargetObjectsInfo>, // optional
"IgnoredObjects:=", <IgnoredObjectsInfo>, // optional
"ArcTolerance:=", <ToleranceString>) // optional
Return Value: None
Parameters: <RuleSetName>:
<string> // name of an existing rule set
<ExistingRunName>:
<string> // name of the run to change
<RunName>:
<string> // name of the run after the changes
<TargetTypeInfo>:

Design Verification Script Commands 33-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

<int> // 0 for entire layout (default if not specified)


// 1 for specified portion of layout
<TargetObjectsInfo>:
objects on which to perform the check
may specify if TargetTypeInfo is 1 (specified portion of layout)
"<ObjectName>, <ObjectName>, ..."
<ObjectName):
<string> // name of a layout object
<IgnoredObjectsInfo>:
objects which to ignore when performing the check
may specify if TargetTypeInfo is 0 (entire layout)
"<ObjectName>, <ObjectName>, ..."
<ToleranceString>:
<string> // real number and units
// if not specified, the current layout arc tolerance is used
VB Example:
oModule.EditRun "Rule Set 10", _
"All", _
Array("NAME:New All", _
"TargetType:=", 0)

Design Verification Script Commands 33-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oModule.EditRun "Rule Set 10", _


"New All", _
Array("NAME:Selected Objs2", _
"TargetType:=", 1, _
"TargetObjects:=", "line_975,line_1015")
oModule.EditRun "Rule Set 10", _
"Selected Objs2", _
Array("NAME:Objects to Ignore2", _
"TargetType:=", 0, _
"IgnoredObjects:=", "via_209,line_736")

RenameRuleSet
Use: Renames a existing rule set
Command: Right-click on a rule set item under Design Verification in the Project Tree and choose Rename
Syntax: RenameRuleSet <ExistingRuleSetName>, <NewRuleSetName>
Return Value: None
Parameters: <ExistingRuleSetName>:
<string> // name of the rule set to change
<NewRuleSetName>:
<string> // new name for the rule set
VB Example: oModule.RenameRuleSet "Rule Set 12", "Rule Set 30"

Design Verification Script Commands 33-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

RenameRun
Use: Renames an existing run.
Command: Right-click on a run item under Design Verification in the Project Tree and choose Rename
Syntax: RenameRun <RuleSetName>, <ExistingRunName>, <NewRunName>
Return Value: None
Parameters: <RuleSetName>:
<string> // name of an existing rule set
<ExistingRunName>:
<string> // name of the run to change
<NewRunName>:
<string> // new name for the run
VB Example: oModule.RenameRun "Rule Set 30", "New All", "Sel Objects"

RunAllDV
Use: Executes all runs in the Design Verification Project Tree item.
Command: Right-click on Design Verification in the Project Tree and choose Run All
Syntax: RunAllDV
Return Value: None
Parameters: None
VB Example: oModule.RunAllDV

Design Verification Script Commands 33-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

RunAllRuleSetDV
Use: Executes all runs in an existing rule set
Command: Right-click on a rule set item under Design Verification in the Project Tree and choose Run All
Syntax: RunAllRuleSetDV <RuleSetName>
Return Value: None
Parameters: <RuleSetName>:
<string> // name of an existing rule set
VB Example: oModule.RunAllRuleSetDV "Rule Set 30"

RunDV
Use: Executes the specified run in an existing rule set
Command: Right-click on a run item under Design Verification in the Project Tree and choose Run
Syntax: RunDV <RuleSetName>, <RunName>
Return Value: None
Parameters: <RuleSetName>:
<string> // name of an existing rule set
<RunName>:
<string> // name of the run to execute
VB Example: oModule.RunDV "Rule Set 30", "Run 2"

Design Verification Script Commands 33-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

33-12
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

34 - Core Global Script Context Commands


To run these commands:
import CoreGlobalScriptContextFunctions
CoreGlobalScriptContextFunctions.[CommandName]
The following are general script commands recognized by the CoreG-
lobalScriptContextFunctions object:
l AddErrorMessage
l AddFatalMessage
l AddInfoMessage
l AddWarningMessage
l LogDebug
l LogError

AddErrorMessage
Adds an error message to the Message Manager window. AddErrorMessageis a function of
CoreGlobalScriptContextFunctions.

UI Access N/A

Name Type Description


Parameters
<message> String Error message.

Return Value None.

Python AddErrorMessage(<message>)
Syntax

import CoreGlobalScriptContextFunctions
Python
Example CoreGlobalScriptContextFunctions.AddErrorMessage('My error
message.')

VB Syntax N/A
VB Example N/A. Script cannot be run in VBScript.

Core Global Script Context Commands 34-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AddFatalMessage
Adds a fatal error message to the Message Manager window. AddFatalMessageis a function of
CoreGlobalScriptContextFunctions.

UI Access N/A

Name Type Description


Parameters
<message> String Error message.

Return Value None.

Python AddFatalMessage(<message>)
Syntax

Python
import CoreGlobalScriptContextFunctions
Exampl- CoreGlobalScriptContextFunctions.AddFatalMessage('My fatal
e error message.')

VB Syntax N/A
VB Example N/A. Script cannot be run in VBScript.

AddInfoMessage
Adds an informational message to the Message Manager window. AddInfoMessageis a func-
tion of CoreGlobalScriptContextFunctions.

UI Access N/A

Name Type Description


Parameters
<message> String Informational message.

Return Value None.

Python AddInfoMessage(<message>)
Syntax

Python import CoreGlobalScriptContextFunctions


Example CoreGlobalScriptContextFunctions.AddInfoMessage('My info.')

Core Global Script Context Commands 34-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

VB Syntax N/A
VB Example N/A. Script cannot be run in VBScript.

AddWarningMessage
Adds a warning message to the Message Manager window. AddWarningMessageis a function
of CoreGlobalScriptContextFunctions.

UI Access N/A

Name Type Description


Parameters
<message> String Warning message.

Return Value None.

Python AddWarningMessge(<message>)
Syntax

import CoreGlobalScriptContextFunctions
Python
Example CoreGlobalScriptContextFunctions.AddWarningMessage('My warn-
ing.')

VB Syntax N/A
VB Example N/A. Script cannot be run in VBScript.

LogDebug
Adds a debug line to the log specified at Tools > Debug Logging. LogDebugis a function of
CoreGlobalScriptContextFunctions.

UI Access N/A

Name Type Description


Parameters
<message> String Debug message.

Return Value None.

Python LogDebug(<message>)
Syntax

Core Global Script Context Commands 34-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

import CoreGlobalScriptContextFunctions
Python
Example CoreGlobalScriptContextFunctions.LogDebug('My debug mes-
sage.')

VB Syntax N/A
VB Example N/A. Script cannot be run in VBScript.

LogError
Adds an error line to the log specified at Tools > Debug Logging. LogErroris a function of
CoreGlobalScriptContextFunctions.

UI Access N/A

Name Type Description


Parameters
<error> String Error to log.

Return Value None.

Python LogError(<error>)
Syntax

Python import CoreGlobalScriptContextFunctions


Example CoreGlobalScriptContextFunctions.LogError('My error.')

VB Syntax N/A
VB Example N/A. Script cannot be run in VBScript.

Core Global Script Context Commands 34-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

35 - Example Scripts
This section contains VBScript and IronPython example scripts.

VBScript Example Scripts


VBScript Examples:
l Variable Helix Script
l HFSS Data Export Script
l ExampleGetLayeredImpedanceBoundaryPropertyNamesandValues.htm

Data Export Script


The following sample script demonstrates how to export data and save it to a file. The output
data in the example script is in 3 columns. The first column is frequency in GHz, the second is the
Real part of S11, and the third is the Img part of S11. It uses a tab-delimited format. The output is
done using output variables.
The frequency sweep data must be entered correctly. If it is incorrect, the script will request a
freq point that does not exist and execution will stop.
The script includes comment lines, which are preceded by an apostrophe ( ') and offer explan-
ations for each subsequent line or lines.
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
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.
'

Example Scripts 35-1


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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")
Set ofile = oFS.CreateTextFile (path)
line = "Freq" & chr(9) & "RE(S11)" & chr(9) & "IMG(S11)"
ofile.WriteLine line
'
' Input the needed freq, solution, and sweep data and clean it
up.
'
msgbox("For the following input make sure it matches " & _
"the frequencies defined in your sweep")
range = inputbox("Input the range of frequencies in GHz " & _
"and number of points",_
"Frequency","8,12,10",50,50)
'
' The following 2 lines define the 2 output variables.
'
oDesign.CreateOutputVariable "re_S", "re(S(port1,port1))"
oDesign.CreateOutputVariable "im_S", "im(S(port1,port1))"
arr = split (range, ",")

Example Scripts 35-2


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

arr(0) = Trim(arr(0))
arr(1) = Trim(arr(1))
arr(2) = Trim(arr(2))
if cint(arr(2)) <> 1 then
del_f = (arr(1)-arr(0))/(arr(2)-1)
else
del_f = 0
end if
temp = InputBox("Input the Setup and Sweep number to use:"_
& chr(13) & "(e.g. input 1,2 for Setup1 and Sweep2)", _
"Solution Data","1,1",50,50)
arr2 = split(temp,",")
stn = arr2(0)
swn = arr2(1)
stn = Trim(stn)
swn = Trim(swn)
'
' Loop through the freq points.
'
for i=1 to arr(2) step 1
freq = arr(0) + (cint(i)-1)*del_f
x=freq
cfreq="Freq='" & freq & "Ghz'"
'
' Get the values of the output variables for the desired freq.
'
val = oDesign.GetOutputVariableValue("re_S","Setup" & _
stn & " :Sweep" & swn,cfreq, "")
y = val
val = oDesign.GetOutputVariableValue("im_S","Setup" & _

Example Scripts 35-3


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

stn & " : Sweep" & swn,cfreq, "")


z = val
'
' Create the line of text to send to the file and write it to the
file.
'
line = x & chr(9) & y & chr(9) &z
ofile.WriteLine line
Next
'
' Delete the 2 output variables before finishing.
'
oDesign.DeleteOutputVariable "re_S"
oDesign.DeleteOutputVariable "im_S"
'
' Close the file.
'
ofile.close
End if
Variable Helix Script
This sample script creates a tapered helix. Tapering helices is not supported from the interface.
The script includes comment lines, which are preceded by an apostrophe ( ') and offer explan-
ations for each subsequent line or lines.

Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")

Example Scripts 35-4


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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"
Case "mm"
Case "um"
Case "in"
Case "mil"
Case Else
MsgBox("Invalid Units - defaults to m")

Example Scripts 35-5


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Units = ""
End Select

’ Obtain the other user-defined parameters.

Turns = InputBox("Select the number of turns (must be
integer):","Variable Helix", 2,50,50)
PointsPerTurn = InputBox("Select the points per turn:", _
"Variable Helix",16,50,50)
R(0) = InputBox("Select the initial Radius: ", _
"Variable Helix",10,50,50)
R(1) = InputBox("Select the final Radius: ", _
"Variable Helix",10,50,50)
P(0) = InputBox("Select the initial Pitch: ", _
"Variable Helix", 4,50,50)
P(1) = InputBox("Select the final Pitch: ", _
"Variable Helix", 4,50,50)
NumPoints = Turns*PointsPerTurn

’ Initialize the points and segments arrays.

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)
Angle = (n-1)*2*Pi/PointsPerTurn

Example Scripts 35-6


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

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

XValue = cstr(Radius*cos(Angle)) & Units


YValue = cstr(Radius*sin(Angle)) & Units
ZValue = cstr(Rise) & Units
points(n) = Array("NAME:PLPoint", "X:=", XValue, "Y:=", _
YValue, "Z:=", ZValue)

’ Create the line segments between each of the pairs of points.

If n<=NumPoints Then
segments(n) = Array("NAME:PLSegment", "SegmentType:=", _
"Line", "StartIndex:=", (n-1), "NoOfPoints:=", 2)
End If
Next

’ Create the polyline.

oEditor.CreatePolyline _
Array("NAME:PolylineParameters", "IsPolylineCovered:=", true, _
"IsPolylineClosed:=", false, points, segments), _
Array("NAME:Attributes", "Name:=", "Line_Helix","Flags:=", _
"", "Color:=", "(132 132 193)", "Transparency:=",0.4, _
"PartCoordinateSystem:=", "Global", "MaterialName:=", _
"vacuum", "SolveInside:=", true)

’ Create the helix cross-section.

Example Scripts 35-7


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.CreateCircle _
Array("NAME:CircleParameters", "IsCovered:=", true, "XCenter:=",_
cstr(R(0))&Units, "YCenter:=", 0, "ZCenter:=", 0, "Radius:=", _
"1"&Units, "WhichAxis:=", "Y"), _
Array("NAME:Attributes", "Name:=", "Circle_Helix", "Flags:=", _
"", "Color:=", "(132 132 193)", "Transparency:=", 0.4, _
"PartCoordinateSystem:=", "Global", "MaterialName:=", "vacuum", _
"SolveInside:=", true)

’ Sweep the cross-section along the path.

oEditor.SweepAlongPath _
Array("NAME:Selections", "Selections:=", _
"Circle_Helix,Line_Helix"),
Array("NAME:PathSweepParameters", "DraftAngle:=", "0deg", _
"DraftType:=", "Round", "TwistAngle:=", "0deg")
GetPropNames and GetPropValues for Layered Impedance Boundary
Script
The following example script used Object Oriented commands to GetPropName for a Layered
Impedance Boundary, and then use the names to use GetPropValue for those properties.
' ----------------------------------------------
' Script Recorded by Ansys Electronics Desktop Version 2022.1.0
' 14:55:18 Oct 25, 2022
' ----------------------------------------------
Option Explicit
test_layered_impedance()
Sub test_layered_impedance()
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign

Example Scripts 35-8


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Dim oEditor
Dim oModule
Dim oBoundaries
Dim Layered_Boundaries
Dim single_boundary
Dim oBoundary
Dim Get_Boundary_Properties
Dim Layer_Name
Dim Layer_Type
Dim Layer_Roughness
Dim Layer_Inf_Ground_Plane
Dim Layer_Two_Sided
Dim Layer_Shell_Element
Dim Layer_Number_of_Layers
Dim Layer_L1_Thickness
Dim Layer_L1_Material
Dim Layer_L2_Thickness
Dim Layer_L2_Material
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop.2022.1")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("test1")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")

Set oBoundaries = oDesign.GetChildObject("Boundaries")


Layered_Boundaries = oModule.GetBoundariesOfType("Layered Imped-
ance")
For Each single_boundary In Layered_Boundaries
Set oBoundary = oBoundaries.GetChildObject(single_boundary)

Example Scripts 35-9


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

'Get_Boundary_Properties = oBoundary.GetPropNames()
Layer_Name = oBoundary.GetPropValue("Name")
Layer_Type = oBoundary.GetPropValue("Type")
Layer_Roughness = oBoundary.GetPropValue("Roughness")
Layer_Inf_Ground_Plane = oBoundary.GetPropValue("Inf Ground
Plane")
Layer_Two_Sided = oBoundary.GetPropValue("Two sided")
Layer_Shell_Element = oBoundary.GetPropValue("Shell Ele-
ment")
Layer_Number_of_Layers = oBoundary.GetPropValue("Number of
Layers")
Layer_L1_Thickness = oBoundary.GetPropValue("Layer 1/Thick-
ness")
Layer_L1_Material = oBoundary.GetPropValue("Layer 1/Ma-
terial")
Layer_L2_Thickness = oBoundary.GetPropValue("Layer 2/Thick-
ness")
Layer_L2_Material = oBoundary.GetPropValue("Layer 2/Ma-
terial")
MsgBox ("Name = " & Layer_Name & vbNewLine _
& "Type = " & Layer_Type & vbNewLine _
& "Roughness = " & Layer_Roughness & vbNewLine _
& "Inf Ground = " & Layer_Inf_Ground_Plane & vbNewLine _
& "Two-Sided = " & Layer_Two_Sided & vbNewLine _
& "Shell Element = " & Layer_Shell_Element & vbNewLine _
& "Number of Layers = " & Layer_Number_of_Layers & vbNewLine
_
& "Layer 1 Thickness = " & Layer_L1_Thickness & vbNewLine _
& "Layer 1 Material = " & Layer_L1_Material & vbNewLine _
& "Layer 2 Thickness = " & Layer_L2_Thickness & vbNewLine _
& "Layer 2 Material = " & Layer_L2_Material)
Next
End Sub

Example Scripts 35-10


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

IronPython Example Scripts


IronPython Examples:
l BH Coordinates Python Script
l HFSS Waveguide Array Python Script
l Equation Based Curve Python Script

BH Coordinates Python Script


This sample Python script adds a material ("Posco 35PN250") with BH coordinates from a spe-
cified file (Posco_BH_curve.tab):

To recreate this tab file, paste the text below the script into a text editor and save as Posco_BH_
curve.tab.
The script itself includes comment lines, which are preceded by # and offer explanations for the
subsequent line(s).
Script Contents
# specify path to the file with BH coordinates

Example Scripts 35-11


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

path_to_file = r"D:\Posco_BH_curve.tab"
# specify name of the material
material_name = "Posco 35PN250"
oProject = oDesktop.GetActiveProject()
oDefinitionManager = oProject.GetDefinitionManager()
""" create list with B and H points to pass to AddMaterial command
bh_coordinates list is a three dimensional array: 1D: name, 2D:
Coordinate list, 3D: BH point"""
bh_coordinates = ["NAME:BHCoordinates", ["NAME:DimUnits", "", ""]]
with open(path_to_file) as input_file:
for line in input_file:
h, b = line.split()

bh_coordinates.append(["NAME:Coordinate", [
"NAME:CoordPoint",
float(h),
float(b)
]
])
# create a new magnetic material with BH curve
oDefinitionManager.AddMaterial(
[
"NAME:" + material_name,
"CoordinateSystemType:=", "Cartesian",
"BulkOrSurfaceType:=" , 1,
[
"NAME:PhysicsTypes",
"set:=" , ["Electromagnetic"]
],
[

Example Scripts 35-12


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:permeability",
"property_type:=" , "nonlinear",
"BTypeForSingleCurve:=" , "normal",
"HUnit:=" , "A_per_meter", # unit can be specified as
variable
"BUnit:=" , "tesla", # unit can be specified as variable
"IsTemperatureDependent:=", False,
bh_coordinates,
[
"NAME:Temperatures"
]
],
"conductivity:=" , "1818181.82",
[
"NAME:magnetic_coercivity",
"property_type:=" , "VectorProperty",
"Magnitude:=" , "0A_per_meter",
"DirComp1:=" , "1",
"DirComp2:=" , "0",
"DirComp3:=" , "0"
]
])
Posco_BH_Curve.tab Contents
0 0.000
10 0.050
20 0.130
23 0.152
25 0.175
28 0.202
30 0.229

Example Scripts 35-13


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

33 0.257
35 0.287
38 0.318
40 0.356
43 0.395
45 0.435
48 0.477
52 0.523
56 0.574
60 0.626
66 0.683
72 0.740
78 0.795
87 0.850
97 0.906
112 0.964
130 1.024
151 1.084
175 1.140
200 1.189
225 1.228
252 1.258
282 1.283
317 1.304
357 1.324
402 1.343
450 1.360
500 1.375
550 1.387
602 1.398

Example Scripts 35-14


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

657 1.407
717 1.417
784 1.426
867 1.437
974 1.448
1117 1.461
1299 1.478
1515 1.495
1752 1.513
2000 1.529
2253 1.543
2521 1.557
2820 1.570
3167 1.584
3570 1.600
4021 1.617
4503 1.634
5000 1.652
5503 1.669
6021 1.685
6570 1.701
7167 1.717
7839 1.733
8667 1.749
9745 1.769
11167 1.793
12992 1.820
15146 1.851
17518 1.882
20000 1.909

Example Scripts 35-15


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

22552 1.931
25417 1.948
28906 1.961
33333 1.971
38932 1.981
Equation Based Curve Python Script
This sample Python script creates an equation based curve that produces a helix.
from math import pi, sin, cos

oProject = oDesktop.GetActiveProject()
oDesign = oProject.GetActiveDesign()
oEditor = oDesign.SetActiveEditor("3D Modeler")

Start_t = 0
End_t = pi*2

Npoint = 128
Nsection = Npoint-1

d_t = (End_t-Start_t)/Nsection

for n in range(1,Nsection):

P1 = Start_t+d_t*(n-1)
P2 = P1+d_t
X_t1 = cos(P1*6)
Y_t1 = sin(P1*6)
Z_t1 = P1
X_t2 = cos(P2*6)
Y_t2 = sin(P2*6)

Example Scripts 35-16


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Z_t2 = P2

oEditor.CreatePolyline(
[
"NAME:PolylineParameters",
"IsPolylineCovered:=" , True,
"IsPolylineClosed:=" , False,
[
"NAME:PolylinePoints",
[
"NAME:PLPoint",
"X:=" , '1mm*' + str(X_t1),
"Y:=" , '1mm*' + str(Y_t1),
"Z:=" , '1mm*' + str(Z_t1)
],
[
"NAME:PLPoint",
"X:=" , '1mm*' + str(X_t2),
"Y:=" , '1mm*' + str(Y_t2),
"Z:=" , '1mm*' + str(Z_t2)
]
],
[
"NAME:PolylineSegments",
[
"NAME:PLSegment",
"SegmentType:=" , "Line",
"StartIndex:=" , 0,
"NoOfPoints:=" , 2

Example Scripts 35-17


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

]
],
[
"NAME:PolylineXSection",
"XSectionType:=" , "None",
"XSectionOrient:=" , "Auto",
"XSectionWidth:=" , "0mm",
"XSectionTopWidth:=" , "0mm",
"XSectionHeight:=" , "0mm",
"XSectionNumSegments:=" , "0",
"XSectionBendType:=" , "Corner"
]
],
[
"NAME:Attributes",
"Name:=" , "Polyline"+str(n),
"Flags:=" , "",
"Color:=" , "(132 132 193)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"vacuum\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , True,
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])

Example Scripts 35-18


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

HFSS Waveguide Array Python Script


This sample Python script creates an HFSS Waveguide array. The script includes comment
lines, which are preceded by an apostrophe ( ’ ), that offer explanations for each subsequent line
or lines. The script includes examples of creating a 3D model, boundaries and excitation, solu-
tion setup and sweep, as well as reports.
You must insert an HFSS project before running the script. Running the script causes a series of
input dialogs to appear that lets you set parameters.
The first dialog asks for input for a and be dimensions and the waveguide length.

The next asks for the array frequency.

The next asks for start, stop and step values for in an interpolating frequency sweep.

Example Scripts 35-19


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

The last one asks for the array definition.

The following figure shows the waveguide array generated by the defaults.

Example Scripts 35-20


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

After running the simulation, the plots defined by the script shows the following results.

Example Scripts 35-21


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Example Scripts 35-22


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

The waveguide script in Python follows.

import clr
clr.AddReferenceByPartialName("Microsoft.VisualBasic")
from Microsoft.VisualBasic.Constants import
vbOKOnly,vbOKCancel,vbAbortRetryIgnore,vbYesNoCancel,vbYesNo,vbRetryC-
ancel
from Microsoft.VisualBasic.Constants import
vbOK,vbCancel,vbAbort,vbRetry,vbIgnore,vbYes,vbNo
from Microsoft.VisualBasic.Interaction import InputBox, MsgBox

oProject = oDesktop.GetActiveProject()
oDesign = oProject.GetActiveDesign()
oEditor = oDesign.SetActiveEditor("3D Modeler")

Example Scripts 35-23


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

# Ask for dimensions for waveguide dimensions


# -------------------------------------------------------------
dim = InputBox("Please enter the dimensions for the waveguide 'a' and
'b' dimensions "
+ "and the waveguide length in mm. Defaults are a = 23mm, b = 10mm,
WaveguideLength = 25mm",
"Waveguide array generator", "23,10,25")
Dimensions = dim.split(',')

a_str = Dimensions[0] + "mm"


b_str = Dimensions[1] + "mm"
b_over2 = float(Dimensions[1])/2

WaveguideLength_str = Dimensions[2] + "mm"

#Ask for the frequency of operation


#----------------------------------
Frequency = InputBox("Please enter the desired array frequency.
Distances will " +
"be based on the free space wavelength at this frequency",
"Waveguide array generator", "10GHz")

#Ask for the start, stop, and step of the interpolating frequency
sweep
#--------------------------------------------------------------------
--
inputText = InputBox("Please enter the start, stop, and step of the
interpolating " +
"frequency sweep.", "Waveguide array generator",
"8GHz,12GHz,50MHz")
StartFrequency, StopFrequency, StepFrequency = inputText.split(',')

Example Scripts 35-24


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

#Ask for the number of elements in the x and y directions


#--------------------------------------------------------
inputText = InputBox("Please enter the number of elements in the x
and y directions.",
"Waveguide array generator", "7,7")
numX, numY = [float(elem) for elem in inputText.split(',')]
TotalElements = numX*numY

# Make variables and set them equal to the values from the user input
# -------------------------------------------------------------------
oDesign.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:LocalVariableTab",
[
"NAME:PropServers",
"LocalVariables"
],
[
"NAME:NewProps",
[
"NAME:a", "PropType:=", "VariableProp", "UserDef:=", True,
"Value:=", a_str
],
[
"NAME:b", "PropType:=", "VariableProp", "UserDef:=", True,
"Value:=", b_str
],
[

Example Scripts 35-25


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"NAME:NumX", "PropType:=", "VariableProp", "UserDef:=", True,


"Value:=", numX
],
[
"NAME:NumY", "PropType:=", "VariableProp", "UserDef:=", True,
"Value:=", numY
],
[
"NAME:WaveguideLength", "PropType:=", "VariableProp", "User-
Def:=", True,
"Value:=", WaveguideLength_str
],
[
"NAME:Frequency", "PropType:=", "VariableProp", "UserDef:=",
True,
"Value:=", Frequency
],
[
"NAME:Lambda", "PropType:=", "VariableProp", "UserDef:=", True,
"Value:=", "c0/" + Frequency
],
[
"NAME:RadBoundDist", "PropType:=", "VariableProp", "UserDef:=",
True,
"Value:=", "Lambda/4"
]
]
]
])
#Create the radiation box
#------------------------

Example Scripts 35-26


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

oEditor.CreateBox(
[
"NAME:BoxParameters",
"XPosition:=" , "-a/2-RadBoundDist",
"YPosition:=" , "-b/2-RadBoundDist",
"ZPosition:=" , "0mm",
"XSize:=" , "NumX*a+(NumX-1)*Lambda/2+2*RadBoundDist",
"YSize:=" , "NumY*b+(NumY-1)*Lambda/2+2*RadBoundDist",
"ZSize:=" , "RadBoundDist"
],
[
"NAME:Attributes",
"Name:=" , "RadiationBox",
"Flags:=" , "",
"Color:=" , "(132 132 193)",
"Transparency:=" , 0.8,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"vacuum\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , True,
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])

oEditor.FitAll() # Zoom out


#Create first element
#--------------------
oEditor.CreateBox(

Example Scripts 35-27


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

[
"NAME:BoxParameters",
"XPosition:=" , "-a/2",
"YPosition:=" , "-b/2",
"ZPosition:=" , "0mm",
"XSize:=" , "a",
"YSize:=" , "b",
"ZSize:=" , "-WaveguideLength"
],
[
"NAME:Attributes",
"Name:=" , "Element1",
"Flags:=" , "",
"Color:=" , "(132 132 193)",
"Transparency:=" , 0.8,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"vacuum\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , True,
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])

# Define the port


# ---------------
# Get the numeric value of half of the b dimension of the port.
# The values fed in to the "Start" and "End" arrays cannot have math-
ematical operators. For example, if HFSS

Example Scripts 35-28


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

# has a variable 'b', and a desired coordinate is 'b/2', that value


cannot be entered here as "b/2". The number
# has to be computed explicitly in script and entered as a string
such as "-200mm".
oModule = oDesign.GetModule("BoundarySetup")

# get bottom face ID


element1FaceID = oEditor.GetFaceByPosition(
[
"NAME:Parameters",
"BodyName:=", "Element1",
"XPosition:=", "-a/2",
"YPosition:=", "-b/2",
"ZPosition:=", "-WaveguideLength"
])
oModule.AssignWavePort(
[
"NAME:WavePort1",
"Faces:=" , [element1FaceID],
"NumModes:=" , 1,
"RenormalizeAllTerminals:=", True,
"UseLineModeAlignment:=", False,
"DoDeembed:=" , False,
[
"NAME:Modes",
[
"NAME:Mode1",
"ModeNum:=" , 1,
"UseIntLine:=" , True,
[
"NAME:IntLine",

Example Scripts 35-29


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Start:=" , ["0mm", "-" +str(b_over2) + "mm", "-" + Wave-


guideLength_str],
"End:=" , ["0mm", str(b_over2) + "mm", "-" + WaveguideLength_str]
],
"AlignmentGroup:=" , 0,
"CharImp:=" , "Zpi"
]
],
"ShowReporterFilter:=" , False,
"ReporterFilter:=" , [True],
"UseAnalyticAlignment:=", False
])

#Set the radiation boundary


#--------------------------
# Get face IDs for further assignment
top_face_id = oEditor.GetFaceByPosition(["NAME:FaceParameters",
"BodyName:=", "RadiationBox",
"XPosition:=", "0mm",
"YPosition:=", "NumY*b-b/2+(NumY-1)*Lambda/2+RadBoundDist",
"ZPosition:=", "0mm"])

faceIDs = [int(elem) for elem in oEditor.GetFaceIDs("RadiationBox")


if elem != str(top_face_id)]
oModule.AssignRadiation(
[
"NAME:Radiation",
"Faces:=" , faceIDs,
"IsFssReference:=" , False,
"IsForPML:=" , False
])

Example Scripts 35-30


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

# Copy and paste elements/ports into a rectangular array.


# Duplicate boundaries with geometry" must be turned on under Tools-
>Options->HFSS Options
# -------------------------------------------------------------------
----------------------
ElementNum = 1
for i in range(1, int(numX)+1):
for j in range(1, int(numY)+1):
if ElementNum == 1:
pass

elif ElementNum <= numY: #If in the first column, only


oEditor.Copy(["NAME:Selections", "Selections:=", "Element1"])
oEditor.Paste()
oEditor.Move(["NAME:Selections", "Selections:=", "Element" + str
(ElementNum)],
["NAME:TranslateParameters", "CoordinateSystemID:=", -1,
"TranslateVectorX:=", "0mm",
"TranslateVectorY:=", str(j-1) + "*(b+Lambda/2)",
"TranslateVectorZ:=", "0mm"])

elif ElementNum > numY:


oEditor.Copy(["NAME:Selections", "Selections:=", "Element1"])
oEditor.Paste()
oEditor.Move(["NAME:Selections", "Selections:=", "Element" + str
(ElementNum)],
["NAME:TranslateParameters", "CoordinateSystemID:=", -1,
"TranslateVectorX:=", str(i-1) + "*(a+Lambda/2)",
"TranslateVectorY:=", str(j-1) + "*(b+Lambda/2)",
"TranslateVectorZ:=", "0mm"])

Example Scripts 35-31


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ElementNum += 1

#Create the setup and interpolating sweep


#----------------------------------------
oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup("HfssDriven",
[
"NAME:Setup1",
"AdaptMultipleFreqs:=" , False,
"Frequency:=" , Frequency,
"MaxDeltaS:=" , 0.02,
"PortsOnly:=" , False,
"UseMatrixConv:=" , False,
"MaximumPasses:=" , 15,
"MinimumPasses:=" , 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=" , 50,
"IsEnabled:=" , True,
"BasisOrder:=" , 1,
"DoLambdaRefine:=" , True,
"DoMaterialLambda:=" , True,
"SetLambdaTarget:=" , False,
"Target:=" , 0.3333,
"UseMaxTetIncrease:=" , False,
"PortAccuracy:=" , 2,
"UseABCOnPort:=" , False,
"SetPortMinMaxTri:=" , False,
"UseDomains:=" , False,
"UseIterativeSolver:=" , False,
"SaveRadFieldsOnly:=" , False,

Example Scripts 35-32


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"SaveAnyFields:=" , True,
"IESolverType:=" , "Auto",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True
])

oModule.InsertFrequencySweep("Setup1",
[
"NAME:InterpolatingSweep",
"IsEnabled:=" , True,
"RangeType:=" , "LinearStep",
"RangeStart:=" , StartFrequency,
"RangeEnd:=" , StopFrequency,
"RangeStep:=" , StepFrequency,
"Type:=" , "Interpolating",
"SaveFields:=" , False,
"InterpTolerance:=" , 0.5,
"InterpMaxSolns:=" , 50,
"InterpMinSolns:=" , 0,
"InterpMinSubranges:=" , 1,
"ExtrapToDC:=" , False,
"InterpUseS:=" , True,
"InterpUsePortImped:=" , False,
"InterpUsePropConst:=" , True,
"UseDerivativeConvergence:=", False,
"InterpDerivTolerance:=", 0.2,
"UseFullBasis:=" , True,
"EnforcePassivity:=" , True,
"PassivityErrorTolerance:=", 0.0001
])

Example Scripts 35-33


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

#Create a relative coordinate system centered on the array for radi-


ation pattern calculations
#--------------------------------------------------------------------
------------------------
oEditor.CreateRelativeCS(
[
"NAME:RelativeCSParameters",
"Mode:=" , "Axis/Position",
"OriginX:=" , "-a/2+NumX*a/2+(NumX-1)*Lambda/4",
"OriginY:=" , "-b/2+NumY*b/2+(NumY-1)*Lambda/4",
"OriginZ:=" , "0mm",
"XAxisXvec:=" , "1mm",
"XAxisYvec:=" , "0mm",
"XAxisZvec:=" , "0mm",
"YAxisXvec:=" , "0mm",
"YAxisYvec:=" , "1mm",
"YAxisZvec:=" , "0mm"
],
[
"NAME:Attributes",
"Name:=" , "RelativeCS1"
])
#Create an infinite sphere with fine theta resolution and phi cuts at
0 and 90 degrees
#--------------------------------------------------------------------
-----------------
oModule = oDesign.GetModule("RadField")
oModule.InsertFarFieldSphereSetup(
[
"NAME:Infinite Sphere1",
"UseCustomRadiationSurface:=", False,

Example Scripts 35-34


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"ThetaStart:=" , "-90deg",
"ThetaStop:=" , "90deg",
"ThetaStep:=" , "1deg",
"PhiStart:=" , "0deg",
"PhiStop:=" , "90deg",
"PhiStep:=" , "90deg",
"UseLocalCS:=" , True,
"CoordSystem:=" , "RelativeCS1"
])

#Create output plots for Ephi/Etheta real and imaginary components


for Phi = 0 and separately for Phi = 90
#--------------------------------------------------------------------
-------------------------------------
oModule = oDesign.GetModule("ReportSetup")
#For phi = 0
oModule.CreateReport("Etheta/Ephi Re/Im Components for Phi=0", "Far
Fields",
"Rectangular Plot", "Setup1 : LastAdaptive",
[
"Context:=" , "Infinite Sphere1"
],
[
"Theta:=" , ["All"],
"Phi:=" , ["0deg"],
"Freq:=" , ["All"],
"a:=" , ["Nominal"],
"b:=" , ["Nominal"],
"NumX:=" , ["Nominal"],
"NumY:=" , ["Nominal"],
"WaveguideLength:=" , ["Nominal"],

Example Scripts 35-35


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

"Frequency:=" , ["Nominal"]
],
[
"X Component:=" , "Theta",
"Y Component:=" , ["im(rEPhi)","re(rEPhi)","im(rETheta)","re
(rETheta)"]
], [])

#For phi = 90
#------------
oModule.CreateReport("Etheta/Ephi Re/Im Components for Phi=90", "Far
Fields",
"Rectangular Plot", "Setup1 : LastAdaptive",
[
"Context:=" , "Infinite Sphere1"
],
[
"Theta:=" , ["All"],
"Phi:=" , ["90deg"],
"Freq:=" , ["All"],
"a:=" , ["Nominal"],
"b:=" , ["Nominal"],
"NumX:=" , ["Nominal"],
"NumY:=" , ["Nominal"],
"WaveguideLength:=" , ["Nominal"],
"Frequency:=" , ["Nominal"]
],
[
"X Component:=" , "Theta",
"Y Component:=" , ["im(rEPhi)","re(rEPhi)","im(rETheta)","re
(rETheta)"]

Example Scripts 35-36


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

], [])

Example Scripts 35-37


Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

35-38
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Index Defeature 11-171


Delete 11-172

2 DeleteEmptyGroups 11-57

2.5D Via Commands 28-1 DeleteLastOperation 11-58


DeleteOperation 11-59
3 DeletePolylinePoint 11-5
3D Modeler editor commands 11-1 DetachEdges 11-61
AlignFaces 11-26 DetachFaces 11-62
AssignMaterial 11-27 DuplicateAlongLine 11-6
AssignSurfaceMaterial 11-164 DuplicateAroundAxi 11-9
Chamfer 11-30 DuplicateMirror 11-12
ChangeProperty 5-11, 11-167 EditEntityList 11-64
CleanUpModel 11-32 EditFaceCS 11-65
CloseAllWindows 11-170 EditObjectCS 11-71
Connect 11-33 EditRelativeCS 11-78
Copy 11-4 Export 11-80
CoverLines 11-34 ExportModelImagetoFile 11-82,
CoverSurfaces 11-35 13-65

CreateEntityList 11-36 Fillet 11-86

CreateFaceCS 11-37, 11-43 FlattenGroup 11-88

CreateGroup 11-42 GenerateAllUserDefinedModels


11-173
CreateObjectFromdges 11-50
GenerateHistory 11-89
CreateObjectFromFace 11-52
GenerateUserDefinedModel 11-
CreateObjectFromFaces 11-54 174
CreateRelativeCS 11-55 GetActiveCoordinateSystem 11-
90

Index-1
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetAct- GetPropertyValue 5-62, 7-27, 9-99, 11-


iveCoordin- 212, 13-89, 32-120
ateSystemTransform 11-90
GetPropEvaluatedValue 11-211
GetBodyNamesByPosition 11-
177 GetPropSIValue 11-215

GetCoordinateSystems 11-91 GetRelativeCoordinateSystems 11-217

GetEdgeByPosition 11-187 GetUser Position 11-219

GetEdgeIDFromNameForFirstOper- GetVertexIDFromNameForFirstOperation
ation 11-189 11-220

GetEdgeIDsfromFace 11-189 GetVertexIDsFromEdge 11-221

GetEdgeIDsfromObject 11-190 GetVertexIDsFromFace 11-221

GetEdgeLength 11-191 GetVertexIDsFromObject 11-222

GetEdgePos- GetVertexPosition 11-223


itionAtNormalizedParameter GetWireBodyNames 11-223
9-86
HealObject 11-92
GetEntityListIDByName 11-191
Import 11-96
GetFaceArea 11-193
ImportDXF 11-100
GetFaceByPosition 11-195
ImportFromClipboard 11-104
GetFaceCenter 11-194
ImportGDSII 11-105
GetFaceIDFromNameForFirstOper-
ation 11-196 Imprint 11-108
GetFaceIDs 11-197 ImprintProjection 11-109
GetFaceIDsOfSheet 11-198 Intersect 11-111
GetGeometryModelerMode 11- Mirror 11-15
198
Move 11-17
GetGroupSubmodelNames 11-
199 MoveCSToEnd 11-113

GetModelBoundingBox 11-200 MoveEntityToGroup 11-114

GetPartsForUserDefinedModel MoveFaces 11-115


11-210 OffsetFaces 11-18
GetPoints 11-211 PageSetup 11-225
GetProperties 5-61, 7-26, 9-97 ProjectSheet 11-117

Index-2
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

RemoveBadEdges 11-227 WrapSheet 11-143


RemoveBadFaces 11-227 WriteHistoryTreeLayoutForTest
11-235
RemoveBadVertices 11-228
3D Modeler editor object commands
RenamePart 11-229
GetNumObjects 11-202
Replacewith3DComponent 11-
119 GetObjectIDByName 11-202
Rotate 11-20 GetObjectName 11-203
Scale 11-22 GetObjectNameByEdgeID 11-204
Section 11-122 GetObjectNameByFaceID 11-204
SeparateBody 11-124 GetObjectNameByID 11-205
SetModelUnits 11-125 GetObjectNameByVertexID 11-
206
SetPropValue Modeler 11-230
GetObjectShapeType 11-207
SetTopDownViewDir-
ectionForActiveView 11-231 GetObjectVolume 11-209
SetTopDownViewDir- GetObjPath 11-209
ectionForAllViews 11-232
SetWCS 11-126 A

Simplify 11-128 Aborting Scripts 1-11

Split 11-131 Activate 30-39

Stitch 11-133 Activation and Deactivation


Methods 30-39
Subtract 11-135
Add 21-1, 21-8, 21-12, 21-18, 26-2,
SweepFacesAlongNormal 11- 27-2, 32-2, 32-33, 32-40, 32-
136, 11-136 137, 32-215, 32-265, 32-305,
ThickenSheet 11-138 32-337

UncoverFaces 11-140 AddAddSolverOnDemandModel 32-


164
Ungroup 11-142
AddAllEyeMeasurements 13-4
Unite 11-141
AddAntennaOverlay 20-11
UpdatePriorityList 11-232
AddAssignmentToBoundary 14-5
UpgradeVersion 11-233
AddCableToBundle 11-238
Validate3DComponent 11-235
AddCartesianLimitLine 13-5

Index-3
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AddCartesianLimitLineFromCurve AddPoint 30-56


13-7
AddPortsToAllNets 30-97, 30-97
AddCartesianLim-
itLineFromEquation 13-9 AddPortsToNet 30-97

AddCartesianXMarker 13-10 AddRadFieldSourceGroup 20-13

AddCartesianYMarker 13-11 AddRefPort 27-2, 30-98

AddCartesianYMarkerToStack 13- AddRefPortUsingEdges 27-4


12 AddRuleSet 33-1
AddCircuitRefPort 30-95 AddRun 33-3
AddDataset 5-3, 8-1, 9-5, 32-21 AddSweep 26-2
AddDefinitionFromBlock 11-147, AddTraceCharacteristics 13-17
32-24
AddTraces 13-19
AddDefinitionFromLibFile 11-152
AlignFaces 11-26
AddDeltaMarker 13-13
AlignHorizontal 31-56
AddDesignVari-
ablesForDynamicLink 9-8 AlignObjects 30-121
AddDiffPair 24-4 AlignPorts 30-100
AddDynamicNPortData 32-156 AlignVertical 31-57
AddHole 30-58 Analysis module commands
Additional Property Scripting Analyze 9-9
Example 7-34
AnalyzeAll 9-10
AddMarker 13-14
AnalyzeAllNominal 9-11
AddMaterial 5-6, 32-29, 32-67
CopyDrivenSetup 16-3
AddMessage 3-6
CopyEigenSetup 16-4
AddModelingProperties 9-9
CopySetup 16-3, 17-6, 17-80
AddNamedExpr 19-3
CopySweep 16-5, 16-98
AddNote 13-15
DeleteDrivenSweep 16-5
AddNPortData 32-159
DeleteSetups 16-6
AddPinGrounds 31-51
DoesSweepSetupExists 16-7
AddPinIPorts 31-53
EditDrivenSweep 16-9
AddPinPageConnectors 31-55

Index-4
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditFrequencySweep 16-10 Analyze 26-3, 26-3


EditSetup 16-12, 17-8, 17-82 Analysis module command 9-9
GetSetupCount 16-29 AnalyzeDistributed 9-12
GetSetups 16-29 AnalyzeSweep 26-3
GetSweepCount 16-31 Ansoft Application Object
commands 2-1
GetSweeps 16-32
GetAppDesktop 2-2
InsertDrivenSweep 16-33
ApplyMeshOps 9-12, 9-78
InsertFrequencySweep 16-40
ApplyReportTemplate 13-21
InsertSetup 16-47, 17-39, 17-
112 Area 30-63
InsertSetup Transient 16-82 AreMaterialPropertiesEqual 32-50
PasteDrivenSetup 16-90 AreSurfaceMaterialPropertiesEqual
32-51
PasteEigenSetup 16-90
arithmetic operators 1-6
PasteSetup 16-91
array variables 1-4
PasteSweep 16-91
AssignAnisotropicImpedance 14-38
RenameDrivenSweep 16-92
AssignAperture 14-41
RenameSetup 16-93
AssignArray 10-1
ResetToTimeZero 16-93
AssignCircuitPort 14-42
RevertAllToInitial 16-94
AssignCircuitRefPort 30-101, 30-103
RevertAllToInitialTemperature
16-95 AssignCloneOp 15-8
RevertAllToZeroDisplacement AssignCurrent 14-44
16-95
AssignCurvatureExtractionOp 15-10,
RevertSetupToInitial 16-96 15-45
RevertSetupToInitialTemperature AssignCurvilinearElementsOp 15-7,
16-97 15-30
RevertSetupToZeroDisplacement AssignCylindricalGapOp 15-11
16-97
AssignCylindricalWave 14-45
SolveSetup 16-99
AssignDCThickness 9-13
Analysis Setup Module Script Com-
mands 16-1 AssignDielectricCavity 14-48

Index-5
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AssignFarFieldWave 14-49 AssignMultiNonIdealGround;Bound-


ary/Excitation module com-
AssignFEBI 14-52
mands:AssignMultiNonIdealGround
AssignFiniteCond 14-53, 14-242 14-237

AssignFloquet 14-56 AssignMultipactionChargeRegion 14-100

AssignFresnel 14-63 AssignMultipactionDCBias 14-102

AssignGaussianBeam 14-64 AssignMultipactionSEE 14-106

AssignHalfSpace 14-68 AssignMultiSig-


nalLine;Boundary/Excitation module
AssignHertzianDipoleWave 14-69 commands:AssignMultiSignalLine
14-236
AssignHybridRegion 14-71
AssignNearFieldWave 14-107
AssignIERegion 14-73
AssignPartialDischargeDCBias 14-120
AssignImpedance 14-73
AssignPerfectE 14-111
AssignIncidentWave 14-75
AssignPerfectH 14-112
AssignLatticePair 14-79
AssignPlaneWave 14-113
AssignLayeredImp 14-81
AssignPrimary 14-117
AssignLengthOp 15-17
AssignRadiation 14-119
AssignLinearAntennaWave 14-84
AssignRotationalLayerOp 15-22
AssignLinkedImpedance 14-88
AssignScreeningImpedance 14-122
AssignLinkedRegion 14-91
AssignSecondary 14-125
AssignLumpedPort 14-92
AssignSkinDepthLayerSetting 15-23
AssignLumpedRLC 14-95
AssignSkinDepthOp 15-25
AssignMagneticBias 14-98
AssignSurfaceMaterial 11-164
AssignMaterial 11-27
AssignSurfPriorityForTauOp 15-26
AssignMeshRegion 15-19
AssignSymmetry 14-129
AssignModelResolutionOp 15-21
AssignTerminal 14-130
AssignMultiFloat-
ingLine;Boundary/Excitation AssignThinConductor 14-246
module com-
mand- AssignTrueSurfOp 15-28
s:AssignMultiFloatingLine 14-
AssignVoltage 14-131
235
AssignWavePort 14-133

Index-6
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AutoCreatePECCapforWavePort AssignFresnel 14-63


14-136
AssignGaussianBeam 14-64
AutoIdentifyLatticePair 14-6
AssignHalfSpace 14-68
AutoIdentifyNets 14-7
AssignHertzianDipoleWave 14-69
AutoIdentifyPorts 14-7
AssignHybridRegion 14-71
AutoIdentifyTerminals 14-8
AssignIERegion 14-73

B AssignImpedance 14-73

BBoxLL 30-60 AssignIncidentWave 14-75

BBoxUR 30-60 AssignLatticePair 14-79

Boolean Operations on AssignLayeredImp 14-81


Primitives 30-66 AssignLinearAntennaWave 14-84
Boundary and Excitation Module AssignLinkedImpedance 14-88
Script Commands 14-1
AssignLinkedRegion 14-91
Boundary module commands
AssignLumpedPort 14-92
AssignAperture 14-41
AssignLumpedRLC 14-95
EditAperture 14-141
AssignMagneticBias 14-98
Boundary/Excitation module com-
mands AssignMultipactionChargeRegion
14-100
AddAssignmentToBoundary 14-
5 AssignMultipactionDCBias 14-102
AssignAnisotropicImpedance AssignMultipactionSEE 14-106
14-38
AssignNearFieldWave 14-107
AssignCircuitPort 14-42
AssignPerfectE 14-111
AssignCurrent 14-44
AssignPerfectH 14-112
AssignCylindricalWave 14-45
AssignPlaneWave 14-113
AssignDCThickness 9-13
AssignPrimary 14-117
AssignDielectricCavity 14-48
AssignRadiation 14-119
AssignFarFieldWave 14-49
AssignRFDischargeDCBias 14-
AssignFEBI 14-52 120
AssignFiniteCond 14-53, 14-242 AssignScreeningImpedance 14-
122
AssignFloquet 14-56

Index-7
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

AssignSecondary 14-125 EditFiniteCond 14-150, 14-245


AssignSymmetry 14-129 EditFloquetPort 14-151
AssignTerminal 14-130 EditFresnel 14-158
AssignVoltage 14-131 EditGlobalMatEnv 14-159
AssignWavePort 14-133 EditHalfSpace 14-160
AutoCreatePECCapforWavePort EditHybridRegion 14-161
14-136
EditImpedance 14-162
AutoIdentifyLatticePair 14-6
EditIncidentWave 14-163
AutoIdentifyNets 14-7
EditLatticePair 14-166
AutoIdentifyPorts 14-7
EditLayeredImp 14-167
AutoIdentifyTerminals 14-8
EditLinkedImpedance 14-170
ChangeImpedanceMult 14-10
EditLinkedRegion 14-173
CircuitPortToLumpedPort 14-
138 EditLumpedPort 14-174

Con- EditLumpedRLC 14-177


ver- EditMagneticBias 14-179
tNportCircuitElementsToPorts
14-10 EditMultipactionChargeRegion 14-181
CreateNportCircuitElements 14- EditMultipactionDCBias 14-183
11
EditMultipactionSEE 14-186
CreatePML 14-226
EditNportCircuitElement 14-15
DeleteAllBoundaries 14-13
EditPerfectE 14-189
DeleteAllExcitations 14-14
EditPerfectH 14-191
DeleteBoundaries 14-15
EditPrimary 14-191
EditAnisotropicImpedance 14-
139 EditRadiation 14-193

EditCircuitPort 14-142 EditRFDischargeDCBias 14-188

EditCurrent 14-144 EditSecondary 14-195

EditDielectricCavity 14-146 EditSymmetry 14-197

EditDiffPairs 14-147 EditTerminal 14-198

EditFEBI 14-149 EditVoltage 14-199

Index-8
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditVoltageDrop 14-201 ReassignBoundary 14-29


EditWavePort 14-201 RecalculatePMLMaterials 14-234
GetBoundaries 14-17 RemoveAssignmentFromBoundary
14-30
GetBoundariesofType 14-17
RenameBoundary 14-31
GetBoundaryAssignment 14-18
ReprioritizeBoundaries 14-31
GetDefaultBaseName 14-19
SetAllHy-
GetDiffPairs 14-19 bridRegionsToOneWayCoupled
GetExcitations 14-20 14-206

GetExcitationsOfType 14-21 SetAllHy-


bridRegionsToTwoWayCoupled
GetHybridRegions 14-21 14-206
GetHybridRegionssofType 14- SetDefaultBaseName 14-33
22
SetHybridRegionCoupledGroup
GetNumBoundaries 14-23 14-207
GetNumBoundariesofType 14- SetHybridRegionsCoupling 14-
23 210
GetNumExcitations 14-24 SetSBRCreepingWaveSettings
14-211
GetNumExcitationsOfType 14-
25 SetSBRSources 14-213
GetNumHybridRegions 14-25 SetSBRSourcesBlockage 14-216
GetNumHybridRegionsOfType SetSBRTxRxSettings 14-217
14-26
SetSBRWedgeSettings 14-219
GetPortExcitationCounts 14-27
SetScatteredFieldFormulation 14-
IdentifyNets 14-27 211
ListNets 14-28 SetTerminalReferenceImpedances
14-222
LumpedPortToCircuitPort 14-
205 SetTotalFieldFormulation 14-223
ModifyPMLGroup 14-229 SwapCircuitPortDirection 14-223
PMLGroupCreated 14-231 SwapLatticePair 14-224
PMLGroupModified 14-232 UnassignIERegions 14-225
ReassignBoundaries 14-5, 14- boundary/excitation script
28 commands 14-3

Index-9
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

BreakUDMConnection 11-166 ChangeProperty 5-11, 5-15, 9-16, 11-167,


13-22, 31-107, 32-52
BringToFront 32-348
CircleIntersectsPolygon 30-63
C CircuitPortToLumpedPort 14-138
Cable Modeling commands ClcEval 19-10
AddCableToBundle 11-238 ClcMaterial 19-11
CreateCableBundle 11-239 ClcMaterialValue 19-11
CreateCableHarness 11-241 CleanUpModel 11-32
CreateClockSource 11-243 ClearAllMarkers 13-26
CreatePWLSource 11-245 ClearAllNamedExpr 19-12
CreateStraightWireCable 11- ClearAllTraceCharacteristics 13-26
247, 11-248
ClearDiffPairs 24-6
ExportCableLibrary 11-250
ClearLayerMappings 30-78
ImportCableLibrary 11-251
ClearMessages 3-7, 5-28
RemoveCables 11-251
ClearRefPort 30-105
UpdateCableHarness 11-252
ClearRelative 30-72
Cable Modeling Commands 11-237
ClearSolutionCache 32-165
CalcOp 19-4
ClipPlane 30-128
CalcRead (deprecated) 19-4
Clone 24-7
CalcStack 19-6
CloneMaterial 5-29, 32-65
CalculatorRead 19-5
CloneReportsFromDatasetSolution 13-27
CalculatorWrite 19-7
Close 5-30, 24-8
CalcWrite 19-8
CloseAllWindows 3-8, 11-170
Cascade 24-5
CloseEditor 31-60
Cavity Commands 29-1
CloseProject 3-8
Chamfer 11-30
CloseProjectNoForce 3-9
ChangeGeomSettings 19-9
ClosestPointOnLine 30-53
ChangeImpedanceMult 14-10
Combine 24-9
ChangeOptions 30-122
comment lines 1-12, 1-14

Index-10
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

comparison operators 1-7 CopyPlotSettings 13-28


CompInstance Functions 64 CopyRadFieldSetup 20-2
CompInstance Script Commands CopyReportDefinition 13-29
(multiple)
CopyReportsData 13-29
Component Manager Script Com-
mands 32-136 Copyright and Trademark
Information 2
conditional statements
CopySetup
If...Then... Else 1-8
Analysis module command 16-3,
Select Case 1-8 17-6, 17-80
types of 1-8 Optimetrics module command 16-
3, 17-6, 17-80
Connect 11-33, 30-32
CopySubdesign 31-62
ConstructVariationString 9-20
CopySweep 16-5
conventions
CopySweep, Analysis module com-
scripting help 1-1 mand 16-98
converting data types 1-10 CopyToPlanarEM 30-128
Con- CopyTraceDefinitions 13-30
ver-
tNportCircuitElementsToPorts CopyTracesData 13-31
14-10
Core Global Script Context Com-
ConvertPlaneToTrace 27-5 mands 34-1
ConvertToDynamic 32-276 Count 3-10
ConvertToParametric 32-276 CoupleEdgePorts 27-5
ConvertTraceToPlane 27-5 CoverLines 11-34
Coordinate System Methods 30-68 CoverSurfaces 11-35
Copy 11-4, 30-32, 31-60 CPython 1-72
CopyData 31-61 Create Primitives 30-2
CopyDesign 5-31 Create Voids in Primitives 30-12
CopyDrivenSetup 16-3 Create3DStructure 30-73
CopyEigenSetup 16-4 CreateArrayAirbox 10-4
CopyItemCommand 9-21 CreateCableBundle 11-239
CopyNamedExprToStack 19-13 CreateCableHarness 11-241

Index-11
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

CreateCircle 30-3 CreateOpenRegion 10-6


CreateCircleVoid 30-13 CreateOutputVariable 12-1
CreateCircuitPort 30-106 CreatePage 31-63
CreateClockSource 11-243 CreatePin 30-23
CreateComponent 30-18 CreatePinGroup 30-24
CreateCS 30-69 CreatePinGroupPort 30-24
CreateEdgePort 30-109 CreatePML 14-226
CreateEMLossTarget 9-22 CreatePolygon 30-8
CreateEntityList 11-36 CreatePolygonVoid 30-15
CreateFaceCS 11-37, 11-43 CreatePortInstancePorts 30-113
CreateGroundPortComponent 27-6 CreatePortsOnComponents 30-113
CreateGroup 11-42 CreatePWLSource 11-245
CreateGroupSelected 30-73 CreateRectangle 30-7
CreateHole 30-19 CreateRectangleVoid 30-16
CreateInterfaceGround 27-6 CreateRelativeCS 11-55
CreateInterfacePort 27-6 CreateReport 9-23, 13-32
CreateInterfacePortComponent 27- CreateReport [Designer] 13-47
7
CreateReportFromFile 13-52
CreateLine 30-4
CreateReportFromTemplate 13-53
CreateLineFromPolygon 30-48
CreateReportofAllQuantities 13-54
CreateLineVoid 30-14
CreateText 30-9
CreateMeasure 30-21
CreateTrace 30-24
CreateNetClass 30-87
CreateUserDefinedSolution 23-1
CreateNPort 30-111, 31-25
CreateVia 30-30
CreateNportCircuitElements 14-11
Cross 30-52
CreateObjectFromEdges 11-50
Cut 31-64
CreateObjectFromFace 11-52
CutDesign 5-31
CreateObjectFromFaces 11-54
CutOutSubDesign 30-129
CreateObjectFromPolygon 30-47

Index-12
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Definition Manager Script


D Commands 32-1
dataset commands Delete 11-172, 26-3, 27-7, 27-8, 30-
33, 30-33, 30-41, 30-41, 31-67
AddDataset 5-3, 8-1, 9-5, 32-21
Delete [Interface Port] 27-8
DeleteDataset 5-32, 8-4, 9-38,
32-66 DeleteAllBoundaries 14-13
EditDataset 5-35, 8-5, 32-95 DeleteAllExcitations 14-14
ExportDataset 5-47, 8-7, 9-57, DeleteAllReports 13-56
32-113
DeleteArray 10-7
HasDataset 8-8
DeleteBoundaries 14-15
ImportDataset 5-66, 8-9, 9-106,
32-121 DeleteDataset 5-32, 8-4, 9-38, 32-66

Dataset Script Commands 8-1 DeleteDesign 5-33

DeactivateOpen 30-40, 31-65 DeleteDrivenSweep 16-5

DeactivateShort 30-40, 31-66 DeleteEmptyGroups 11-57

DecoupleEdgePorts 27-7 DeleteFarFieldSetup 20-3

Deembed 24-10 DeleteFieldVariation 9-38

DeembedBack 24-11 DeleteFullVariation 9-39

DeembedFront 24-13 DeleteImportData 18-2

Defeature 11-171 DeleteLastOperation 11-58

DefeatureObjects 30-134 DeleteLinkedDataVariation 9-40

Definition Manager commands DeleteMarker 13-55

AddDefinitionFromBlock 11-147, DeleteNamedExpr 19-13


32-24 DeleteNearFieldSetup 20-4
AddDefinitionFromLibFile 11- DeleteOp 15-2
152
DeleteOperation 11-59
GetExtendedDefinitionObject
11-192 DeleteOutputVariable 9-41, 9-43, 12-
3
GetProjectMaterialNames 32-
119 DeletePinGroup 30-31
UpdateDefFromBlock 32-134 DeletePolylinePoint 11-5
DeleteProbePortAndVia 27-8

Index-13
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

DeleteProject 3-11 AnalyzeDistributed 9-12


DeleteReport 13-57 ApplyMeshOps 9-12, 9-78
DeleteRuleSet 33-5 CalculatorRead 19-5
DeleteRun 33-5 ClearAllMarkers 13-26
DeleteSetup 20-4 ClearAllTraceCharacteristics 13-26
DeleteSetups 16-6 CloseAllWindows 3-8
Analysis module command 16-6 CopyReportDefinition 13-29
Optimetrics module CreateOutputVariable 12-1
command 17-7, 17-80
CreateReportFromTemplate 13-53
DeleteSolutionVariation 9-42, 18-3
DeleteAllReports 13-56
DeleteSource [Interface
Source] 27-8 DeleteOutputVariable 9-41, 9-43, 12-3

DeleteSweep 26-4 DeleteReport 13-57

DeleteTraceCharacteristics 13-57 DeleteTraces 13-58

Deletetraces 13-58 DistributeAnalysis 9-44

DeleteUserDefinedSolutions 23-3 DoesOutputVariableExist 12-4

DeleteVariation 18-4 Edit Layout 9-51

DelNetClass 30-88 EditDesignSettings 9-45

Design object commands 13-76, EditMarker 13-62


13-77, 13-79, 13-79, 13-80, EditOutputVariable 12-5
13-95
ExportConvergence 9-56
AddCartesianLimitLine 13-5
ExportMeshStats 9-66
AddCartesianXMarker 13-10
ExportModelMeshToFile 11-85, 13-68
AddCartesianYMarker 13-11
ExportPlot3DToFile 13-69
AddDeltaMarker 13-13
ExportProfile 9-77
AddDesignVari-
ablesForDynamicLink 9-8 ExportReport 13-70
AddMarker 13-14 ExportToFile 13-73
AddNote 13-15 Fast Transformation 9-132, 9-133
AddTraceCharacteristics 13-17 GeometryCheckAndAutofix 11-175
AddTraces 13-19

Index-14
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetDesignValidationInfo 9-85 GetVariationVariableValue 9-105


GetDisplayType 13-84 GetVersion 3-41
GetLibraryDirectory 3-27 HasDataset 8-8
GetMatchedObjectName 11-200 ImportIntoReport 13-112
GetModelUnits 11-201 IsFeaturEnabled 3-41
GetModule 9-88, 9-90 PasteDesign 9-111
GetName 9-91, 13-87, 17-32, PasteReports 13-117
17-105
PasteReportsWithLegacyNames
GetObjectsByMaterial 11-206 13-118
GetObjectsInGroup 11-208 PasteTracesWithLegacyNames
13-119
GetObjPath 9-94, 13-88, 17-32,
17-106 Redo 9-115
GetOutputVariableValue 9-94, RenameDesignInstance 9-117
12-8
RenameReport 13-120
GetProjectDirectory 3-33
RenameTraces 13-121
GetProperties 5-61, 7-26, 9-97
RunToolkit 9-120
GetPropertyValue 5-62, 7-27, 9-
99, 11-212, 13-89, 32-120 SARSetup 9-121

GetPropEvaluatedValue 11-211 SavePlotSettingsAsDefault 13-122

GetPropNames 9-100, 20-7 SetActiveEditor 9-121

GetPropSIValue 11-215 SetAllowMaterialOverride 9-123

GetRegistryInt 3-35, 3-77 SetDesignSettings 9-125

GetRegistryString 3-36, 3-77 SetLibraryDirectory 3-65

GetSelections 11-218 SetProjectDirectoryVBCommand>


3-66
GetSolutionType 9-102
SetPropertyValue 5-83, 7-31, 9-
GetSolveInsideThreshold 9-103 140, 32-132
GetSubGroupsInGroup 11-218 SetSolutionType 9-143
GetTempDirectory 3-39 SetSolveInsideThreshold 9-145
GetVariables 5-65, 7-29, 9-103 SetTempDirectory 3-70
GetVariableValue 5-65, 7-30, 9- SetVariableValue 5-85, 7-32, 9-
104 147

Index-15
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Show Layout 9-142 GetChildNames 5-50, 9-79, 20-6


ShowWindow 11-127 GetChildNames Modeler 11-178
SimulateLink 9-147 GetChildTypes 5-52, 9-81, 11-185, 20-
7
Solve 9-148, 9-150
GetChildTypes Optimetrics 17-31, 17-
StopSimLink 9-149
105
UpdateAllReports 13-126
GetCustomMenuSet 3-21
ValidateDesign 9-152
GetDesigns 5-55
Design Object Script Commands 9-
GetDesktopConfiguration 3-24
1
GetDistributedAnalysisMachines 3-24
Design Object SCripting commands
GetDis-
ExportNetworkData 9-66
trib-
Design Verification Script Com- utedAna-
mands 33-1 lysisMachinesForDesignType 3-25

Desktop Commands For Registry GetPPELicensingEnabled 3-31


Values 3-74
GetProjectList 3-33
Desktop object commands
GetProjects 3-29, 3-34
AddMessage 3-6
GetPropNames 5-59, 17-35, 17-108
ClearMessages 3-7, 5-28
GetSchematicEnvironment 3-37
CloseProject 3-8
KeepDesktopResponsive 3-43
CloseProjectNoForce 3-9
LaunchJobMonitor 3-43
Count 3-10
NewProject 3-44
DeleteProject 3-11
OpenMultipleProjects 3-46
DownloadJobResults 3-12
OpenProject 3-47
EnableAutosave 3-15
PageSetup 3-48, 30-156
ExportOptionsFiles 3-16
PauseRecording 3-49
GetActiveProject 3-16
PauseScript 3-49
GetActiveScheduler 3-17
Print 3-50
GetActiveSchedulerInfo 3-18
QuitApplication 3-51
GetAutosaveEnabled 3-19
RefreshJobMonitor 3-51
GetBuildTimeDateString 3-20

Index-16
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ResetLogging 3-52 DoesSupportTraceCharacteristics


13-59
RestoreWindow 3-54
DoesSweepSetupExists 16-7
ResumeRecording 3-55
DumpAllReportsData 13-60
RunProgram 3-56
Duplicate 30-135
RunScript 3-57
DuplicateAcrossLyrs 30-81
SelectScheduler 3-60
DuplicateAlongLine 11-6
SetActiveProject 3-61
DuplicateAroundAxis 11-9
SetActiveProjectByPath 3-62
DuplicateMirror 11-12
SetCustomMenuSet 3-63
DynamicMeshOverlays 26-4
SetDesktopConfiguration 3-64
SetSchematicEnvironment 3-69 E
Sleep 3-71 Edit 9-50, 21-5, 21-10, 21-15, 21-22,
SubmitJob 3-72 26-4, 26-4, 27-9, 27-9, 30-34,
32-68, 32-107, 32-165, 32-237,
TileWindows 3-73 32-277, 32-311, 32-348
Desktop Object Script Edit Menu Commands 11-4
Commands 3-1
Edit3DComponentDefinition 30-136
Desktop Scripting Conventions 1-
85 EditAnisotropicImpedance 14-139

DetachEdges 11-61 EditAntennaArraySetup 20-56

DetachFaces 11-62 EditAntennaOverlay 20-15

DisableDiffPairs 24-14 EditAperture 14-141

Disconnect 30-33 EditArray 10-8

Distance 30-52 EditBoxSetup 20-17

DistanceFromLine 30-53 EditCartesianXMarker 13-61

DistributeAnalysis 9-44 EditCartesianYMarker 13-61

DistributedAnalyzeSetup, Opti- EditCircuitExcitations 27-9


metrics module command 17- EditCircuitPort 14-142
7, 17-81
EditCircuitPort [Interface Port] 27-9
DoesNamedExpressionExists 19-
14 EditCircuitSettings 16-8

DoesOutputVariableExist 12-4 EditCloneOp 15-31

Index-17
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditCoSimulationOptions 9-44 EditLatticePair 14-166


EditCurrent 14-144 EditLayeredImp 14-167
EditCurvatureExtractionOp 15-33 EditLayoutForLayoutComponent 9-51
EditCylindricalGapOp 15-34 EditLengthOp 15-39
EditDataset 5-35, 8-5, 32-95 EditLineSetup 20-23
EditDesignSettings 9-45 EditLinkedImpedance 14-170
EditDielectricCavity 14-146 EditLinkedRegion 14-173
EditDiffPairs 14-147 EditLumpedPort 14-174
EditDrivenSweep 16-9 EditLumpedRLC 14-177
EditEntityList 11-64 EditMagneticBias 14-179
EditFaceCS 11-65 EditMarker 13-62
EditFarFieldSphereSetup 20-19 EditMaterial 5-37, 32-97
EditFEBI 14-149 EditMeshRegion 15-41
EditFiniteCond 14-150, 14-245 EditModelResolutionOp 15-42
EditFloat- EditMultipactionChargeRegion 14-181
ingLine;Boundary/Excitation
module com- EditMultipactionDCBias 14-183
mands:EditFloatingLine 14- EditMultipactionSEE 14-186
241
EditNearFieldBoxSetup 20-25
EditFloquetPort 14-151
EditNearFieldLineSetup 20-27
EditFrequencySweep 16-10
EditNearFieldRectangleSetup 20-28
EditFresnel 14-158
EditNearFieldSphereSetup 20-30
EditGlobalMatEnv 14-159
EditNotes 9-52, 9-53
EditHalfSpace 14-160
EditNportCircuitElement 14-15
EditHybridRegion 14-161
EditObjectCS 11-71
EditImpedance 14-162
EditOptions 9-53
EditImportData 9-49
Editor object commands
EditIncidentWave 14-163
SetPropertyValue 5-83, 7-31, 9-140,
EditInfiniteArray 9-49 32-132
EditInfiniteSphereSetup 20-21 Editor Scripting IDs 31-4

Index-18
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditOutputVariable 12-5 EditSurfPriorityOp 15-47


EditPartialDischargeDCBias 14- EditSweep 26-4
188
EditSymmetry 14-197
EditPerfectE 14-189
EditTerminal 14-198
EditPerfectH 14-191
EditTrueSurfOp 15-48
EditPrimary 14-191
EditUserDefinedSolution 23-4
EditRadFieldSourceGroup 20-32
EditVoltage 14-199
EditRadiation 14-193
EditVoltageDrop 14-201
EditRectangleSetup 20-33
EditWavePort 14-201
EditRelativeCS 11-78
EditWithComps 32-192, 32-238, 32-
EditRotationalLayerOp 15-43 277, 32-318, 32-348
EditRuleSet 33-6 ElectricRuleCheck 31-69
EditRun 33-7 EMDesignOptions 9-54
EditSecondary 14-195 EnableAutoSave 3-15
EditSetup 16-12, 17-8, 17-82 EnableDiffPairs 24-15
optimization command 17-160 EnableSetup 17-20, 17-94
parametric command 17-152 EnterComplex 19-15
sensitivity command 17-177 EnterComplexVector 19-16
statistical command 17-188 EnterCoord 19-17
EditSignalLine;Boundary/Excitation EnterEdge 19-17
module com-
mands:EditSignalLine 14-239 EnterLine 19-18

EditSkinOp 15-46 EnterOutputVar 19-19

EditSolverOnDemandModel 32-192 EnterPoint 19-19

EditSources 18-4 EnterQty 19-20

EditSphereSetup 20-35 EnterScalar 19-21

EditSur- EnterScalarFunc 19-22


faceGround;Bound- EnterSurf 19-22
ary/Excitation module
com- EnterVector 19-23
mands:EditSurfaceGround
14-240 EnterVectorFunc 19-24

Index-19
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EnterVol 19-24 ExportImageToFile 13-64


EraseMeasurements 30-137 ExportMaterial 5-47, 32-115
Event Callback Scripting 1-89 ExportMatlab 24-19
Example Scripts 35-1 ExportMatrixData 9-62
Excitations Commands 27-1 ExportMesh Stats 9-66
Export 11-80, 32-114, 32-116, 32- ExportModelMeshToFile 11-85, 13-68
118, 32-204, 32-255, 32-289,
32-326, 32-360 ExportNCDrill 30-145

ExportCableLibrary 11-250 ExportNMFData 18-11

ExportCircuit 16-24 ExportOptimetricsProfile, Optimetrics mod-


ule command 17-22, 17-96
ExportCitiFile 24-16
ExportOptimetricsResults, Optimetrics
ExportConvergence 9-56 module command 17-23, 17-97
ExportDataset 5-47, 8-7, 9-57, 32- ExportOptionsFiles 3-16
113
ExportOutputVariables 12-6
ExportDXConfigFile, Optimetrics
module command 17-21, 17- ExportParametersToFile 20-65
95 ExportParametricResults, Optimetrics mod-
ExportDXF 30-137 ule command 17-24, 17-98

ExportEigenmodes 18-6 ExportPlot3DToFile 13-69

ExportEignemodes 18-6 ExportProfile 9-77

ExportElementPatternToFile 20-62 ExportRadiationFieldsToFile 20-67

ExportEyeMaskViolation 13-63 ExportRadiationParametersToFile 20-69

ExportFieldsToFile 20-63 ExportReport 13-70

ExportForHSpice 9-57, 18-7 ExportReportDataToFile 13-72

ExportForHSpice [HFSS 3D ExportRespSurfaceMinMaxTable 17-26,


Layout] 9-59 17-100

ExportForSpice [HFSS 3D ExportRespSurfaceRefinePoints 17-27,


Layout] 9-61 17-100

ExportFullWaveSpice 24-18, 32- ExportRespSurfaceResponsePoints 17-


295 27, 17-101

ExportGDSII 30-140 ExportRespSurfaceVerificationPoints 17-


28, 17-102
ExportGerber 30-142

Index-20
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ExportScript 32-117, 32-333 EnterOutputVar 19-19


ExportSpreadsheet 24-29 EnterPoint 19-19
ExportTableToFile 13-72 EnterQty 19-20
ExportToHFSS 26-5 EnterScalar 19-21
ExportToQ3D 26-5 EnterScalarFunc 19-22
ExportTouchstone 24-31 EnterSurf 19-22
ExportTouchstone2 24-34 EnterVector 19-23
ExportTransientData 18-12 EnterVectorFunc 19-24
ExportUniformPointsToFile 13-74 EnteVol 19-24
Extract 24-36 Fields Calculator commands
AddNamedExpr 19-2, 19-3
F
CalcOp 19-4
FFTONReport 18-13
CalcStack 19-6
Field Calculator commands
CalculatorWrite 19-7
DoesNamedExpressionExists
19-14 CalcWrite 19-8

Field Overlays module commands ChangeGeomSettings 19-9

AddNamedExpr 19-3 ClcEval 19-10

CalcOp 19-4 ClcMaterial 19-11

CalcStack 19-6 ClcMaterialValue 19-11

ChangeGeomSettings 19-9 ClearAllNamedExpr 19-12

ClcMaterial 19-11 CopyNamedExprToStack 19-13

ClearAllNamedExpr 19-12 DeleteNamedExpr 19-13

CopyNamedExprToStack 19-13 EnterComplex 19-15

DeleteNamedExpr 19-13 EnterComplexVector 19-16

EnterComplex 19-15 EnterCoord 19-17

EnterComplexVector 19-16 EnterEdge 19-17

EnterCoord 19-17 EnterLine 19-18

EnterEdge 19-17 EnterOutputVar 19-19

EnterLine 19-18 EnterPoint 19-19

Index-21
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EnterQty 19-20
G
EnterScalar 19-21
general method script commands 31-48
EnterScalarFunc 19-22
GenerateAllUserDefinedModels 11-173
EnterSurf 19-22
GenerateHistory 11-89
EnterVector 19-23
GenerateUserDefinedModel 11-174
EnterVectorFunc 19-24
GenerateVariationData Parametric, para-
EnterVol 19-24 metric command 17-29, 17-103, 17-
ExportOnGrid 19-25 154

ExportToFile 19-28 GeometryCheckAndAutofix 11-175

Fields Calculator Script GetActiveCoordinateSystem 11-90


Commands 19-1 GetActiveCoordinateSystemTransform
Fillet 11-86 11-90

FilterObjectList 30-44 GetActiveDesign 5-48

FindElements 31-71 GetActiveEditor [HFSS 3D Layout] 9-79

FindObjects 30-43 GetActiveProject 3-16

FindObjectsByPoint 30-47 GetActiveScheduler 3-17

FindObjectsByPolygon 30-46 GetActiveSchedulerInfo 3-18

FitToBorder 31-74 GetAdaptiveFreq 18-14

FlattenGroup 11-88 GetAdaptiveSettings 18-15

FlipHorizontal 30-37, 31-74 GetAllBoundariesList 27-12

FlipVertical 30-38, 31-76 GetAllCategories 13-76

footprint GetAllLayerNames 30-82

manager script commands 32- GetAllPortsList 27-12


214 GetAllQuantities 13-77
For...Next loop 1-9 GetAllReportNames 13-78
functions GetAllSolutionNames 26-5
VBScript procedures 1-10 GetAllSourceMagnitudes 18-16
GetAllSourceModes 18-16
GetAllSourcePhases 18-17

Index-22
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetAllSources 18-18 GetChildTypes Optimetrics 17-31,


17-105
GetAntennaParameters 18-18
GetChildTypes ReportSetup 13-83
GetArrayNames 10-12
GetClosestPoint 30-64
GetArrayVariables 5-49, 7-25
GetClosestPoints 30-64
GetAutoSaveEnabled 3-19
GetCompInstanceFromRefDes 30-
GetAvailableDisplayTypes 13-79 148
GetAvailableReportTypes 13-80 GetComponentInfo 30-147
GetAvailableSolutions 13-80 GetComponentName 64
GetAvailableVariations 18-19 GetComponentPinInfo 30-150
GetBBox 30-46 GetComponentPinLocation 31-120
GetBodyNamesByPosition 11-177 GetComponentPins 30-149
GetBoundaries 14-17 GetCoordinateSystems 11-91
GetBoundariesOfType 14-17 GetCSObjects
GetBoundaryAssignment 14-18 Coordinate Systems 30-45, 30-77
GetBoundingCircleCenter 30-62 GetCurvePropServerName 13-83
GetBoundingCircleRadius 30-62 GetData 32-205, 32-256, 32-261, 32-
GetBuildDateTimeString 3-20 290, 32-327, 32-361

GetChild Object (Report Setup), GetDataExpressions 13-97


Report module command 13- GetDataUnits 13-98
81
GetDefaultBaseName 14-19
GetChildNames 5-50, 9-79, 20-6
GetDefinitionManager 5-53
GetChildNames (Optimetrics),
Report module command 13- GetDependentFiles 5-53
81
GetDesignID 9-83
GetChildNames Modeler 11-178
GetDesignName 9-83
GetChildObject Design 5-51, 9-80
GetDesigns 5-55
GetChildObject Modeler 11-182
GetDesignType 9-84
GetChildObject Radiation 20-6
GetDesignValidationInfo 9-85
GetChildTypes 5-52, 9-81, 11-185,
20-7 GetDesignVariableNames 13-99
GetDesignVariableUnits 13-100

Index-23
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetDesignVariableValue 13-101 GetExcitations 14-20


GetDesignVariationKey 13-102 GetExcitationsOfType 14-21
GetDiffPairs 14-19 GetExeDir 3-26
GetDisplayType 13-84 GetExtendedDefinitionObect 11-192
GetDistributedAnalysisMachines 3- GetFaceArea 11-193
24
GetFaceByPosition 11-195
GetDis-
trib- GetFaceCenter 11-194
utedAna- GetFaceIDFromNameForFirstOperation
lysisMachinesForDesignType 11-196
3-25
GetFaceIDs 11-197
GetDocumentNames 22-8
GetFaceIDsOfSheet 11-198
GetDynLinkIntrinsicVariables 13-85
GetFieldType 18-21
GetDynLinkQtyValueState 13-85
GetFrequencies 24-37
GetDynLinkTraces 13-86
GetFrequencyCount 24-38
GetDynLinkVariableValues 13-87
GetGeometryModelerMode 11-198
GetEdgeByPosition 11-187
GetGroupSubmodelNames 11-199
GetEdgeIDFromNameForFirstOper-
ation 11-189 GetHoles 30-59
GetEdgeIDsFromFace 11-189 GetHybridRegions 14-21
GetEdgeIDsFromObject 11-190 GetHybridRegionsOfType 14-22
GetEdgeLength 11-191 GetImagDataValues 13-102
GetEdgePos- GetIncludePortPostProcessing 18-22
itionAtNormalizedParameter
9-86 GetInstanceID 65

GetEditor [HFSS 3D Layout] 9-87 GetInstanceName 66

GetEditorName [Layout] 30-151 GetIntersectionType 30-63

GetEditorName [Schematic] 31- GetLatticeVectors 10-12


121 GetLayerInfo 30-82
GetEditSourcesCount 9-87, 18-20 GetLibraryDirectory 3-27
GetEntityListIDByName 11-191 GetMatchedObjectName 11-200
GetEvaluatedPropertyValue 31- GetMaterialList 30-151
108

Index-24
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetMeshOpAssignment 15-3 GetObjectNameByID 11-205


GetModelBoundingBox 11-200 GetObjectNameByVertexID 11-206
GetModelUnits 11-201 GetObjectsByMaterial 11-206
GetModule 9-88, 9-90, 9-90 GetObjectShapeType 11-207
GetMultipactionBreakdown 18-22 GetObjectsIngroup 11-208
GetName 5-57, 9-91, 9-92, 13-87, GetObjectVolume 11-209
17-32, 17-105, 24-39
GetObjPath 5-58, 9-94, 11-209, 13-
GetNames 32-206, 32-257, 32-261, 88, 17-32, 17-106
32-291, 32-327, 32-362
GetOperationNames 15-3
GetNetClasses 30-89
GetOptimetricsResults, Optimetrics
GetNetClassNets 30-89 module command 17-34
GetNetConnections 30-89, 31-122 GetOutputVariableValue 9-94, 12-8
GetNetworkDataSolution 18-23 GetParentDesign 66
GetNetworkDataSolutionDefinition GetPartsForUserDefinedModel 11-
18-24 210
GetNetworkPostprocSetup 18-25 GetPath 5-59
GetNPortData 32-209 GetPerQuantityPrimarySweepValues
13-103
GetNumBoundaries 14-23
GetPersonalLibDirectory 3-31
GetNumBoundariesOfType 14-23
GetPoints 11-211, 30-58
GetNumExcitations 14-24
GetPolygon 30-45
GetNumExcitationsOfType 14-25
GetPolygonDef 30-46
GetNumHybridRegions 14-25
GetPortCount 24-40
GetNumHybridRegionsOfType 14-
26 GetPortExcitationCounts 14-27
GetNumObjects 11-202 GetPortInfo 30-114
GetNumPages 31-123 GetPortNumber 24-41
GetObjectIDByName 11-202 GetPostProcSettings 24-42
GetObjectName 11-203 GetPPELicensingEnabled 3-31
GetObjectNameByEdgeID 11-204 GetProcessID 3-32
GetObjectNameByFaceID 11-204 GetProjectDirectory 3-33

Index-25
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetProjectList 3-33 152


GetProjectMaterialNames 32-119 GetSetupCount 16-29
GetProjects 3-29, 3-34 GetSetupCount, Analysis module com-
mand 16-29
GetProperties 5-61, 7-26, 9-97, 30-
152, 31-109, 32-263 GetSetupData 26-6
GetPropertyValue 5-62, 7-27, 9-99, GetSetupNames 16-31, 20-5, 20-8
11-212, 13-89, 30-152, 32-
120 GetSetupNames (Optimetrics), Optimetrics
module command 17-30, 17-30, 17-
GetPropEvaluatedValue 11-211 36, 17-103, 17-104, 17-109
GetPropNames 5-59, 9-100, 13-90, GetSetupNamesByType (Optimetrics),
17-35, 17-108, 20-7 Optimetrics module command 17-
37, 17-110
GetPropNames Modeler 11-214
GetSetups 16-29, 16-30
GetPropServerName 67
Analysis module command 16-29
GetPropSIValue 11-215
GetSolutionContexts 13-94
GetPropValue Modeler 11-216
GetSolutionDataPerVariation 13-95
GetPropValue Optimetrics 17-36,
17-108 GetSolutionType 9-102
GetPropValue Project 5-60, 9-101, GetSolutionVariation 24-43
20-7
GetSolutionVersionID 18-25
GetPropValue Reporter 13-91
GetSolveInsideThreshold 9-103
GetQtyExpressionsForSourceTrace
13-92 GetSolveRangeInfo 18-26

GetRealDataValues 13-104 GetSolverOnDemandData 32-210

GetRegistryInt 3-35, 3-77 GetSolverOnDemandModelList 32-210

GetRegistryString 3-36, 3-77 GetSourceContexts 18-26

GetRelativeCoordinateSystems 11- GetSourceData 18-27


217 GetStackupLayerNames 30-84
GetRe- GetSubGroupsInGroup 11-218
portSum-
maryForRegressionTesting GetSweepCount 16-31
13-93
GetSweepCount, Analysis module com-
GetReportTraceNames 13-92 mand 16-31
GetSelections 9-102, 11-218, 30- GetSweepNames 13-105

Index-26
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

GetSweeps 16-32, 16-33 GetWireBodyNames 11-223


Analysis module command 16- GetX (Layout Editor) 30-50
32
GetY 30-50
GetSweepUnits 13-106
GridSetup 31-77
GetSweepValues 13-107
Group 30-73
GetSysLibDirectory 3-39
GroupPlotCurvesByGroupingStrategy
GetTempDirectory 3-39 13-111
GetTerminalExcitationType 18-27
H
GetTool 3-81
HasArcs 30-59
GetTopDesignList 5-64
HasDataset 8-8
GetTopEntryValue 19-31
HasFields 18-30
GetTransientSolveTimes 18-28
HasHoles 30-59
GetUserDefinedSolutionNames 23-
6 HasMatrixData 18-30

GetUserDefinedSolutionProperties HasSameData 24-45


23-6
HasSelfIntersections 30-60
GetUserLibDirectory 3-40
Heal (Layout Editor) 30-153
GetUserPosition 11-219
HealObject 11-92
GetValidISolutionList 18-29
hierarchy of variables in HFSS 1-76
GetVariables 5-65, 7-29, 9-103
HighlightNet 30-90
GetVariableValue 5-65, 7-30, 9-104
GetVariation 24-44 I

GetVariationVariableValue 9-105 Icepak boundary condition commands

GetVersion 3-41 CreateEMLossTarget 9-22

GetVer- ImportIDX 3-95


texIDFromNameForFirstOper- IdentifyNets 14-27
ation 11-220
If...Then... Else statement 1-8
GetVertexIDsFromEdge 11-221
Import (3D Modeler command) 11-96
GetVertexIDsFromFace 11-221
ImportANF 3-81, 3-83
GetVertexIDsFromObject 11-222
ImportAutoCAD 3-85
GetVertexPosition 11-223

Index-27
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ImportAWRMicrowaveOffice 3-85 InputBox function 1-11


ImportCableLibrary 11-251 InsertBoxSetup 20-37
ImportDataset 5-66, 8-9, 9-106, 32- InsertDesign 5-68, 5-69, 9-108
121
InsertDesignWithWorkflow 5-69
ImportDXF 11-100
InsertDrivenSweep 16-33
ImportEDB 3-87
InsertFarFieldSphereSetup 20-39
ImportExport Tool 3-81
InsertFrequencySweep 16-40
ImportExtracta 3-88
InsertInfiniteSphereSetup 20-41
ImportFromClipboard 11-104
InsertLineSetup 20-44
ImportGDSII 3-89, 3-90, 11-105
InsertNearFieldBoxSetup 20-45
ImportIDF 3-91, 3-94
InsertNearFieldLineSetup 20-47
ImportIDX 3-95
InsertNearFieldRectangleSetup 20-48
ImportIntoReport 13-112
InsertNearFieldSphereSetup 20-50
ImportIPC 3-98
InsertRectangleSetup 20-52
ImportODB 3-99
InsertSetup 16-47, 17-39, 17-112
ImportOutputVariables 12-9
Analysis module command 16-46, 17-
ImportReportDataIntoReport 13- 39, 17-112
113
optimization command 17-165
ImportSetup, Optimetrics module
command 17-38, 17-111 parametric command 17-78, 17-151,
17-154, 17-159
ImportSolution 18-32
sensitivity command 17-184
ImportTable 18-33
statistical command 17-191
ImportXFL 3-100
InsertSetup Transient, Analysis module
Imprint 11-108 command 16-82
ImprintProjection 11-109 InsertSphereSetup 20-54
include files Intersect 11-111, 30-65, 30-65, 30-67, 30-
67
scripts 1-11
IronPython 1-16
indentation, IronPython 1-21
indentation in 1-21
Information Method List 31-114
IsArc 30-51, 30-51, 30-61, 30-61
InitialMeshSettings 15-50

Index-28
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

IsArrayDefined 10-13 ListMatchingVariations 18-35


IsBox 30-62 ListNets 14-28
IsCircle 30-62 ListValuesOfVariable 18-36
IsClosed 30-56 ListVariations 18-37, 26-6
IsConvex 30-61 LoadNamedExpressions 19-32
IsDataComplex 13-108 LoadSolution 24-47
IsEqual 30-51 logical operators 1-8
IsFeatureEnabled 3-41 looping through code
IsFieldAvailableAt 18-34 Do ... Loop 1-9
IsParametric 30-60 For ... Next 1-9
IsPerQuantityPrimarySweep 13- LumpedPortToCircuitPort 14-205
109
IsPoint 30-61 M

IsSegment 30-61 Mag (Layout Editor) 30-52

IsUsed 32-210, 32-258, 32-264, 32- material commands


291, 32-328, 32-362
AddDefinitionFromBlock 11-147,
32-24
K
AddDefinitionFromLibFile 11-152
KeepDesktopResponsive 3-43
AddMaterial 5-6, 32-29, 32-67
keywords, VBScript 1-12, 1-14
AreMaterialPropertiesEqual 32-50

L AreSurfaceMaterialPropertiesEqual
32-51
LaunchJobMonitor 3-43
CloneMaterial 5-29, 32-65
Layers Methods 30-78
EditMaterial 5-37, 32-97
layout
ExportMaterial 5-47, 32-115
script interrogation methods 30-
41 GetExtendedDefinitionObject 11-
192
Layout Interrogation 30-41
RemoveMaterial 5-73, 32-126
Layout Scripting 1-89, 30-1, 30-119
UpdateDefFromBlock 32-134
Layout3DMeshOverlay 26-6
Materials Scripting Support 6-23
LayoutMeshOverlay 26-6

Index-29
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Mesh Operations module com- GetMeshOpAssignment 15-3


mands
GetOperationNames 15-3
AssignCloneOp 15-8
InitialMeshSettings 15-50
AssignCurvatureExtrationOp
15-10, 15-45 ReassignOp 15-4

AssignCurvilinearElementsOp RenameOp 15-5


15-7, 15-30 Mesh Operations Module Script Com-
AssignCylindricalGapOp 15-11 mands 15-1

AssignLengthOp 15-17 mesh operations script commands 15-2

AssignMeshRegion 15-19 method format, create schematic


objects 31-2
AssignModelResolutionOp 15-
21 Microsoft

AssignRotationalLayerOp 15-22 VBScript user’s guide 1-12

AssignSkinDepthLayerSetting Mirror 11-15


15-23 MirrorX 30-58
AssignSkinDepthOp 15-25 Model Manager Script Commands 32-265
AssignSurfPriorityForTauOp 15- Model Setup commands
26
AssignArray 10-1
AssignTrueSurfOp 15-28
CreateArrayAirbox 10-4
DeleteOp 15-2
CreateOpenRegion 10-6
EditCloneOp 15-31
DeleteArray 10-7
EditCurvatureExtractionOp 15-
33 EditArray 10-8
EditCylindricalGapOp 15-34 GetLatticeVectors 10-12
EditLengthOp 15-39 IsArrayDefined 10-13
EditMeshRegion 15-41 UpdateArrayAirbox 10-14
EditModelResolutionOp 15-42 UpdateOpenRegionPadding 10-16
EditRotationalLayerOp 15-43 Model Setup commands commands
EditSkinOp 15-46 GetArrayNames 10-12
EditSurfPriorityOp 15-47 Model Setup Script Commands 10-1
EditTrueSurfOp 15-48 Modeler Menu Commands 11-24

Index-30
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ModifyLibraries 32-334
O
ModifyNetClass 30-92
oAnsoftApp object 1-76
ModifyPMLGroup 14-229
Object Identifiers and Script Record-
module script commands ing 30-2
boundary/excitation 14-3 Object Movement and Modification
general method 31-48 Methods 30-31

mesh operations 15-2 Object Oriented Property Scripting 6-


1
radiation 20-2
oDesign object 1-76
ModuleHasMesh 18-31
oDesktop object 1-76
modules in HFSS scripting 1-76
oEditor object 1-76
Move 11-17, 30-38, 30-38, 30-38,
30-52, 30-52, 30-52, 30-57, OffsetFaces 11-18
30-57, 30-57 oModule object 1-76
MoveCSToEnd 11-113 Open 24-48
MoveEnityToGroup 11-114 OpenAndConvertProject 3-45
MoveFaces 11-115 OpenExternalEditor 11-224
MovePlotCurvestoGroup 13-113 OpenMultipleProjects 3-46
MovePlotCurvestoNewGroup 13- OpenProject 3-47
114
OpenWindowForAllReports 13-115
MsgBox function 1-11
OpenWindowForReports 13-116
N operators
Named Arguments 1-86 arithmetic 1-6
NameNets 31-81 categories in VBScript 1-5
NdExplorer comparison 1-7
Script Commands 24-1 concatenation 1-7
NetClass Methods 30-86 logical 1-8
Network Data Explorer Manager precedence of 1-5
Commands 32-294
oProject object 1-76
NewProject 3-44
Normalize 30-53

Index-31
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Optimetrics module commands 17-77, 17-80, 17-150, 17-


150
DeleteSetups 17-7, 17-81
Optimetrics Module Script Commands 17-
DistributeAnalyzeSetup 17-7,
1
17-81
optimization commands
EnableSetup 17-20, 17-94
EditSetup 17-160
ExportDXConfigFile 17-21, 17-
95 InsertSetup 17-165
ExportOptimetricsProfile 17-22, Optimization Script Commands 17-160
17-96
Other Creation Methods 30-17
ExportOptimetricsResults 17-
23, 17-97 Other oEditor Commands 11-144

ExportParametricResults 17-24, output variable commands


17-98 CreateOutputVariable 12-1
ExportRespSurfaceMinMaxTable DeleteOutputVariable 9-41, 9-43, 12-3
17-26, 17-100
DoesOutputVariableExist 12-4
ExportRespSurfaceRefinePoints
17-27, 17-100 EditOutputVariable 12-5
ExportRespSur- GetOutputVariableValue 9-94, 12-8
faceResponsePoints 17-27,
17-101 Output variable commands

ExportRespSur- ExportOutputVariables 12-6


faceVerificationPoints 17-28, ImportOutputVariables 12-9
17-102
Output Variable Script Commands 12-1
GetChildNames 17-30, 17-30,
17-104, 17-104 OverlayCurrents 9-109
GetOptimetricResult 17-33, 17- OverlayFarField 9-109
107
OverlayMesh 9-110
GetOptimetricsResults 17-34
OverlayNearField 9-110
GetSetupNames 17-36, 17-109
GetSetupNamesByType 17-37, P
17-110
Padstack Manager Script Commands 32-
ImportSetup 17-38, 17-111 304

RenameSetup 17-75, 17-148 PageBorders 31-83

SolveSetup 16-3, 17-6, 17-77, PageSetup 11-225

Index-32
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

PageSetup (Layout Editor) 3-48, PasteSweep 16-91


30-156
PasteTraces 13-119
Pan 31-84
PasteTracesWithLegacyNames 13-
parametric commands 119
EditSetup 17-152 PauseRecording 3-49
GenerateVariationData Para- PauseScript 3-49
metric 17-29, 17-103, 17-
154 PMLGroupCreated 14-231

InsertSetup 17-78, 17-151, 17- PMLGroupModified 14-232


154, 17-159 Point (Layout Editor) 30-42
Parametric Script Commands 17- Point Object 30-48
152
PointInPolygon 30-63
Paste 5-71, 11-247, 11-248, 30-38,
31-85 Polygon 30-42
Paste (Model Editor) 11-20 Polygon Object 30-54
Paste (Project Object) 5-71 Port Methods 30-94
PasteData 31-86 PositionRelative 30-74
PasteDesign 9-111 Print 3-50
PasteDesign (Schematic Editor) 31- Project object commands
87
AddDataset 5-3, 8-1, 9-5, 32-21
PasteDrivenSetup 16-90
AddMaterial 5-6, 32-29, 32-67
PasteEigenSetup 16-90
AreMaterialPropertiesEqual 32-50
PasteItemCommand 9-112
AreSurfaceMaterialPropertiesEqual
PastePlotSettings 13-117 32-51
PasteRadFieldSetup 20-9 ChangeProperty 5-15, 32-52
PasteReports 13-117 CloneMaterial 5-29, 32-65
PasteReportsWithLegacyNames Close 5-30
13-118
CopyDesign 5-31
PasteSetup
CutDesign 5-31
Analysis module command 16-
91 DeleteDataset 5-32, 8-4, 9-38, 32-
66
Optimetrics module
command 17-74, 17-147 DeleteDesign 5-33

Index-33
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditDataset 5-35, 5-46, 5-66, 8- GetPropvalue Project 5-60, 9-101


5, 8-7, 8-9, 9-57, 9-106,
32-95, 32-113, 32-121 GetPropvalue Radiation 20-7

EditMaterial 5-37, 32-97 GetPropvalue Reporter 13-91

ExportMaterial 5-47, 32-115 GetSolutionVariation 24-43

GetActiveDesign 5-48 GetTopDesignList 5-64

GetArrayVariables 5-49, 7-25 GetTopEntryValue 19-31

GetChildObject Design 5-51, 9- GetVariables 5-65, 7-29, 9-103


80 GetVariableValue 5-65, 7-30, 9-104
GetChildObject Modeler 11-182 InsertDesign 5-68, 9-108
GetChildObject Radiation 20-6 LoadSolution 24-47
GetDependentFiles 5-53 Paste 5-71, 5-71
GetDesignID 9-83 Redo 5-72
GetDesignName 9-83 RemoveAllUnusedDefinitions 5-72
GetDesignType 9-84 RemoveMaterial 5-73, 32-126
GetName 5-57 RemoveUnusedDefinitions 5-74, 32-
GetObjPath 5-58 131

GetPath 5-59 Rename 5-75

GetProjectMaterialNames 32- RestoreProjectArchive 3-53


119 Save 5-76
GetProperties 5-61, 7-26, 9-97, SaveAs 5-77
30-152
SaveAsStandAloneProject 5-79
GetPropertyValue 5-62, 7-27, 9-
99, 11-212, 13-89, 30-152, SaveProjectArchive 5-80
32-120
SetActiveDesign 5-82
GetPropEvaluatedValue 11-211
SetPhaseCenterPerPort 9-138, 14-33
GetPropNames Modeler 11-214
SetPropertyValue 5-83, 7-31, 9-140,
GetPropSIValue 11-215 30-161, 32-132
GetPropvalue Modeler 11-216 SetPropValue Design 9-139, 20-10
GetPropvalue Optimetrics 17- SetPropValue Optimetrics 17-76, 17-
36, 17-108 149
SetPropValue Project 5-82, 13-124

Index-34
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetSinglePhaseCenter 9-142, Property Script Commands 7-1


14-35
Conventions uSed in thie
SetVariableValue 5-85, 7-32, 9- Chapter 7-13
147
Object Script Property Function
SimulateAll 5-10, 5-86 Summary 7-3
Undo 5-87 PurgeHistory 11-118
UpdateDefinitions 5-87 PushExcitations 9-112, 30-157, 31-89
Project Object Script Commands 5- Layout Editor 9-112, 30-157, 31-89
1
ProjectSheet 11-117 Q

property commands QuitApplication 3-51

ChangeProperty 5-15, 32-52


R
GetArrayVariables 5-49, 7-25
Radiation boundary
GetProjectMaterialNames 32-
119 Infinite Sphere 21-1, 21-5

GetProperties 5-61, 7-26, 9-97, Near Field Line 21-8, 21-10


30-152 Near Field Plane 21-12, 21-15
GetPropertyValue 5-62, 7-27, 9- Near Field Sphere 21-18, 21-22
99, 11-212, 13-89, 30-152,
32-120 Radiation module commands
GetPropEvaluatedValue 11-211 AddAntennaOverlay 20-11
GetPropSIValue 11-215 AddRadFieldSourceGroup 20-13
GetTopEntryValue 19-31 CopyRadFieldSetup 20-2
GetVariables 5-65, 7-29, 9-103 DeleteFarFieldSetup 20-3
GetVariableValue 5-65, 7-30, 9- DeleteNearFieldSetup 20-4
104
DeleteSetup 20-4
SetPropertyValue 5-83, 7-31, 9-
140, 30-161, 32-132 EditAntennaArraySetup 20-56

SetVariableValue 5-85, 7-32, 9- EditAntennaOverlay 20-15


147 EditBoxSetup 20-17
Property Method List 31-107 EditFarFieldSphereSetup 20-19
EditInfiniteSphereSetup 20-21

Index-35
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

EditLineSetup 20-23 InsertSphereSetup 20-50, 20-54


EditNearFieldBoxSetup 20-25 PasteRadFieldSetup 20-9
EditNearFieldLineSetup 20-27 RenameSetup 20-9
EditNearFieldRectangleSetup Radiation Module Script Commands 20-1,
20-28 21-1
EditNearFieldSphereSetup 20- radiation script commands 20-2
30
ReassignBoundaries 14-5, 14-28
EditRadFieldSourceGroup 20-
32 ReassignBoundary 14-29

EditRa- ReassignOp 15-4


diatedPower- RecalculatePMLMaterials 14-234
CalculationMethod 20-5
Record Script and Edit Properties 7-33
EditRectangleSetup 20-33
Redo 9-116
EditSphereSetup 20-35
design-level command 9-115
ExportElementPatternToFile 20-
62 project-level command 5-72
ExportFieldsToFile 20-63 references, for VBScript 1-12
ExportParametersToFile 20-65 RefreshJobMonitor 3-51
ExportRadiationFieldsToFile 20- RefreshMeshOverlays 26-7
67
ReleaseData 13-110
ExportRadiationParametersToFile
20-69 Remove 32-124, 32-125, 32-127, 32-130,
32-211, 32-258, 32-292, 32-328, 32-
GetSetupNames 16-31, 20-8 363
InsertBoxSetup 20-37 RemoveAllUnusedDefinitions 5-72
InsertFarFieldSphereSetup 20- RemoveAssignmentFromBoundary 14-30
39
RemoveBadEdges 11-227
InsertInfiniteSphereSetup 20-41
RemoveBadFaces 11-227
InsertLineSetup 20-44
RemoveBadVertices 11-228
InsertNearFieldBoxSetup 20-45
RemoveCables 11-251
InsertNearFieldLineSetup 20-47
RemoveImportData 9-116
InsertNearFieldRectangleSetup
20-48 RemoveLayer 30-85

InsertRectangleSetup 20-52 RemoveMaterial 5-73, 32-126

Index-36
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

RemoveModelingProperties 9-117 Radiation module command 20-9


RemovePortsFromAllNets 30-117 RenameSource [Interface Source] 9-
119, 27-13
RemovePortsFromNet 30-118
RenameSweep 26-7
RemovePortsOnComponents 30-
118 RenameTraces 13-121
RemoveRefPort 27-13 Renormalize 24-50
RemoveScript 32-129, 32-335 Reorder 24-51, 24-52
RemoveSolverOnDemandModel Repeating a Statement Until a Condi-
32-212 tion Becomes True 1-10
RemoveUnused 32-213, 32-259, Repeating Statements While a Condi-
32-264, 32-293, 32-330, 32- tion is True 1-9
364
Replacewith3DComponent 11-119
RemoveUnusedDefinitions 5-74,
32-131 Report module commands

Rename 5-75, 24-49, 27-13 GetChildNames 13-81

Rename [Interface Port] 27-12 Reporter editor commands

RenameBoundary 14-31 AddAllEyeMeasurements 13-4

RenameDesignInstance 9-117, 9- AddCartesianLimitLine 13-5


118 AddCartesianLimitLineFromCurve
RenameDrivenSweep 16-92 13-7

RenameImportData 9-118 AddCartesianLimitLineFromEquation


13-9
RenameOp 15-5
AddCartesianXMarker 13-10, 13-
RenamePart 11-229 11
RenameReport 13-120 AddCartesianYMarkerToStack 13-
12
RenameRuleSet 33-9
AddDeltaMarker 13-13
RenameRun 33-10
AddMarker 13-14
RenameSetup 16-93
AddNote 13-15
Analysis module command 16-
93 AddTraceCharacteristics 13-17
Optimetrics module AddTraces 13-19
command 17-75, 17-148
ApplyReportTemplate 13-21

Index-37
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ChangeProperty 9-16, 13-22 ExportReport 13-70


ClearAllMarkers 13-26 ExportReportDataToFile 13-72
ClearAllTraceCharacteristics ExportTableToFile 13-72
13-26
ExportToFile 13-73, 13-112
CloneReportsFromDatasetSolution
13-27 ExportUniformPointsToFile 13-74

CopyPlotSettings 13-28 FFTOnReport 18-13

CopyReportDefinition 13-29 GetAllCategories 13-76

CopyReportsData 13-29 GetAllQuantities 13-77

CopyTraceDefinitions 13-30 GetAllReportNames 13-78

CopyTracesData 13-31 GetAvailableDisplayTypes 13-79

CreateReport 9-23, 13-32 GetAvailableReportTypes 13-80

CreateReportFromFile 13-52 GetAvailableSolutionss 13-80

CreateReportFromTemplate 13- GetChildTypes ReportSetup 13-83


53 GetCurvePropServerName 13-83
CreateReportOfAllQuantities GetDisplayType 13-84
13-54
GetDynLinkIntrinsicVariables 13-85
DeleteAllReports 13-56
GetDynLinkQtyValueState 13-85
DeleteReport 13-57
GetDynLinkTraces 13-86
DeleteTraceCharacteristics 13-
57 GetDynLinkVariableValues 13-87
DeleteTraces 13-58 GetPropNames 13-90
DoesSupportTraceCharacteristics GetQtyExpressionsForSourceTrace
13-59 13-92
DumpAllReportsData 13-60 GetReportSummaryForRegressionTesting
13-93
EditCartesianXMarker 13-61
GetReportTraceNames 13-92
EditCartesianYMarker 13-61
GetSolutionContexts 13-94, 13-95
EditMarker 13-62
GroupPlotCurvesByGroupingStrategy
ExportEyeMaskViolation 13-63 13-111
ExportImageToFile 13-64 ImportReportDataIntoReport 13-113
ExportPlot3DToFile 13-69 MovePlotCurvestoGroup 13-113

Index-38
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

MovePlotCurvestoNewGroup ResetLogging 3-52


13-114
ResetPlotSettings 13-122
OpenWindowForAllReports 13-
115 RestoreWindow 3-54

OpenWindowForReports 13-116 RestToTimeZero 16-93

PastePlotSettings 13-117 ResumeRecording 3-55

PasteReports 13-117 RevertAllToInitial 16-94

PasteReportsWithLegacyNames RevertAllToZeroDisplacement 16-95


13-118 RevertSetupToInitial 16-96
PasteTraces 13-119 RevertSetupToInitialTemperature 16-
PasteTracesWithLegacyNames 97
13-119 RevertSetupToZeroDisplacement 16-
RenameReport 13-120 97

RenameTraces 13-121 Rotate 11-20, 30-39, 30-53, 30-57,


31-92
ResetPlotSettings 13-122
RunAllDV 33-10
SavePlotSettingsAsDefault 13-
122 RunAllRuleSetDV 33-11

SetLinkOutputTraces 13-123 RunDV 33-11

UnGroupPlotCurvesInGroup 13- Running Instance Manager Script


125 Commands 4-1

UpdateAllReports 13-126 RunProgram 3-56

UpdateReports 13-126 RunScript 3-57

UpdateTraces 13-127 RunScriptWithArguments 3-59

UpdateTracesContextAndSweeps RunToolkit 9-120


13-130
S
Reporter Editor Script
Commands 13-1 sample scripts
Reporter module commands simple HFSS 1-12
GetChildObject 13-82 simple Q3D Extractor 1-14
ReportTemplates 9-119 variable helix 35-16
ReprioritizeBoundaries 14-31 waveguide 35-19
Reset 24-53 SARSetup 9-121

Index-39
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

Save 5-76 IronPython 1-16


SaveAs 5-77 overview 1-1
SaveAsStandAloneProject 5-79 pausing 1-81
SaveNamedExpressions 19-33 recording 1-82
SavePlotSettingsAsDefault 13-122 running 1-80
Scale 11-22, 30-57 stopping 1-81
Schematic Scripting 31-1 VBScript 1-2
Create Method List 31-6 Scripts and Locked Layers 1-89
Scope and Lifetime of Variables 1-4 Section 11-122
Script and Library Scripts 32-330 Select Case statement 1-8
script commands SelectAll 30-160, 31-94
boundary/excitation 14-3 SelectInLayout 27-13
general method script com- SelectPage 31-95
mands 31-48
SelectScheduler 3-12, 3-60
mesh operations 15-2
SendToBack 31-96
radiation 20-2
sensitivity commands
Script Commands for Creating and
Modifying PMLs 14-226 EditSetup 17-177

Script Commands for Creating and InsertSetup 17-184


Modifying Mesh Sensitivity Script Commands 17-176
Operations 15-6
SeparateBody 11-124
Script Commands for Creating and
Modifying Boundaries 14-35 Set 30-49
Script Commands for Creating and SetActiveDefinitionEditor 5-81
Modifying Radiation
Setups 20-11 SetActiveDesign 5-82

Script Commands for Exporting SetActiveEditor 9-121, 9-122, 9-129


Antenna Parameters and Max SetActiveProject 3-61
Field Parameters 20-61
SetActiveProjectByPath 3-62
Script Commands for Modifying
Antenna Array Setups 20-56 SetAllHybridRegionsToOneWayCoupled
14-206
scripts
CPython 1-72

Index-40
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetAllHy- SetPropertyValue 5-83, 7-31, 9-140,


bridRe- 30-161, 32-132
gionsToTwoWayCoupled 14-
206 SetPropValue Design 9-139, 20-10

SetAllowMaterialOverride 9-123 SetPropValue Modeler 11-230

SetAllPortImpedance 24-54 SetPropValue Optimetrics 17-76, 17-


149
SetArc (Layout Editor) 30-51
SetPropValue Project 5-82, 13-124
SetBackgroundMaterial 9-123
SetSBRCreepingWaveSettings 14-
SetClosed 30-56 211
SetCS 30-77 SetSBRSources 14-213
SetDefaultBaseName 14-33 SetSBRSourcesBlockage 14-216
SetDesignSettings 9-125 SetSBRTxRxSettings 14-217
SetFastTrans- SetSBRWedgeSettings 14-219
form-
ationForLayoutComponent 9- SetScatteredFieldFormulation 14-211
132, 9-133 SetShowLayoutForLayoutComponent
SetHybridRegionCoupledGroup 14- 9-142
207 SetSinglePhaseCenter 9-142, 14-35
SetHybridRegionsCoupling 14-210 SetSolutionType 9-143
SetLayerMapping 30-86 SetSolveInsideThreshold 9-145
SetLengthSettings 9-132 SetSourceContexts 9-146, 18-37
SetLibraryDirectory 3-65 SetTempDirectory 3-70
SetLinkOutputTraces 13-123 SetTerminalReferenceImpedances
SetModelUnits 11-125 14-222

SetPageData 31-97 Setting Numerical Values 1-88

SetPhaseCenterPerPort 9-138, 14- SetTopDownViewDir-


33 ectionForActiveView 11-231

SetPortDeembedDistance 24-56 SetTopDownViewDir-


ectionForAllViews 11-232
SetPortImpedance 24-57
SetTotalFieldFormulation 14-223
SetPostProcSettings 24-58
SetVariableValue 5-85, 7-32, 9-147
SetProjectDirectory 3-66
SetWCS 11-126

Index-41
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

SetX 30-49 ExportTransientData 18-12


SetY 30-50 GetAdaptiveFreq 18-14
SGetAppDesktop 2-2 GetAdaptiveSettings 18-15
ShowlWindow 11-127 GetAllSourceMagnitudes 18-16
ShowVariableBlock 31-100 GetAllSourceModes 18-16
simple and composite names 1-3 GetAllSourcePhases 18-17
Simplify 11-128 GetAllSources 18-18
SimulateAll 5-10, 5-86 GetAntennaParameters 18-18
SimulateLink 9-147 GetAvailableVariations 18-19
Simulation Setup Commands 26-1 GetFieldType 18-21
SimValueContext 12-10 GetIncludePortPostProcessing 18-22
Sleep 3-71 GetMultipactionBreakdown 18-22
Smooth 24-59 GetNetworkDataSolution 18-23
Solution module commands GetNetworkDataSolutionDefinition 18-
24
GetSourceContexts 18-26
GetNetworkPostprocSetup 18-25
SetSourceContexts 9-146, 18-
37 GetSolutionVersionID 18-25
Solutions module commands GetSolveRangeInfo 18-26
ConstructVariationString 9-20 GetTerminalExcitationType 18-27
DeleteFieldVariation 9-38 GetTransientSolveTimes 18-28
DeleteFullVariation 9-39 GetValidISolutionLIst 18-29
DeleteImportData 18-2 HasFields 18-30
DeleteLinkedDataVariation 9-40 HasMatrixData 18-30
DeleteSolutionVariation 9-42, ImportSolution 18-32
18-3
ImportTable 18-33
DeleteVariation 18-4
IsFieldAvailableAt 18-34
EditSources 18-4
ListMatchingVariations 18-35
ExportEigenmodes 18-6
ListValuesOfVariable 18-36
ExportForHSpice 9-57, 18-7
ListVariations 18-37
ExportNMF 18-11

Index-42
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

ModuleHasMesh 18-31 SwapCircuitPortDirection 14-223


TDROnReport 18-38 SwapLatticePair 14-224
Solutions Module commands SweepFacesAlongNormal 11-136,
11-136
ExportNetworkData 18-9
Symbol Manager Script
GetEditSourcesCount 9-87, 18- Commands 32-336
20
Solutions Module Script T
Commands 18-1
TDROnReport 18-38
Solve 9-148
Terminate 24-61
SolveAllSetup, Optimetrics module
command 17-77, 17-150 ThickenSheet 11-138

SolveSetup 16-99 ToggleCon-


ductor;Boundary/Excitation mod-
SolveSetup, Optimetrics module ule
command 17-77, 17-150 commands:ToggleConductor
SortComponents 31-100 14-239

Split 11-131 ToggleTerminal 14-248

StartAnalysis 9-149 U
statistical commands
UnassignIERegions 14-225
EditSetup 17-188
UncoverFaces 11-140
InsertSetup 17-191
underscore ( _ ) character 1-12, 1-14
Statistical Script Commands 17-188
Undo 9-151
Stitch 11-133
project-level command 5-86
StitchLines 30-161
Ungroup 11-142, 30-77
StopSimLink 9-149
UnGroupPlotCurvesInGroup 13-125
Stretch 24-60
Unite 11-141, 30-65, 30-65, 30-66,
string concatenation operator 1-7 30-66

Sub procedures 1-12, 1-14 UnselectAll 30-162

Sub Procedures 1-10 UpdateAllReports 13-126

SubmitJob 3-72 UpdateArrayAirbox 10-14

Subtract 11-135, 30-65, 30-65, 30- UpdateCableHarness 11-252


67, 30-67

Index-43
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide

UpdateDefFromBlock 32-134 variables


UpdateDefinitions, project-level array 1-4
command 5-87
assigning information 1-3
UpdateDynamicLink 32-214
declaring 1-3
UpdateOpenRegionPadding 10-16
hierarchy in HFSS 1-76
UpdatePriorityList 11-232
used as objects 1-12
UpdateReports 13-126
used in HFSS scripts 1-76
UpdateTraces 13-127
VBScript 1-2
UpdateTracesContextAndSweeps
13-130 Microsoft user’s guide 1-12

UpgradeVersion 11-233 operators 1-5

User defined documents module references 1-12


commands Sub procedures 1-12, 1-14
GetDocumentNames 22-8 VBScript Procedures 1-10
User defined solution module com-
mands W
CreateUserDefinedSolution 23- Wire (Schematic Editor) 31-101
1
WrapSheet 11-143
DeleteUserDefinedSolutions 23-
3 WriteHistoryTreeLayoutForTest 11-235
EditUserDefinedSolution 23-4
X
GetUserDefinedSolutionNames
23-6 Xor 30-66

GetUserDefinedSolutionProperties
23-6 Z

User Defined Solutions ZoomArea 31-102


Commands 23-1 ZoomIn 31-103
Using a Do Loop 1-9 ZoomOut 31-104
ZoomPrevious 31-105
V
ZoomToFit 30-162, 31-106
Validate3DComponent 11-235
ValidateDesign 9-152
Variable Naming Conventions 1-4

Index-44
Ansys Electromagnetics Suite 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.

You might also like