0% found this document useful (0 votes)
1K views

IcepakScriptingGuide PDF

Uploaded by

AniketKulkarni
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views

IcepakScriptingGuide PDF

Uploaded by

AniketKulkarni
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1002

Icepak Scripting Guide

  Release 2019 R3
ANSYS, Inc.   July 2019
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
Icepak Scripting Guide

Copyright and Trademark Information


© 1986-2019 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 doc-
umentation are furnished by ANSYS, Inc., its subsidiaries, or affiliates under a software license
agreement that contains provisions concerning non-disclosure, copying, length and nature of use,
compliance with exporting laws, warranties, disclaimers, limitations of liability, and remedies, and
other provisions. The software products and documentation may be used, disclosed, transferred,
or copied only in accordance with the terms and conditions of that software license agreement.
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 restric-
tions 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 con-
tact ANSYS, Inc.
Published in the U.S.A.

2
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Table of Contents
Table of Contents Contents-1
1 - 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-5
Arithmetic Operators 1-6
Comparison Operators 1-6
Logical Operators 1-6
Controlling Program Execution 1-7
Using If...Then...Else 1-7
Using Select Case 1-7
Looping Through Code 1-8
Using a For...Next Loop 1-8
Using a Do Loop 1-8
Repeating Statements While a Condition is True 1-8
Repeating a Statement Until a Condition Becomes True 1-8
VBScript Procedures 1-9
Function Procedures 1-9
Sub Procedures 1-9
Converting Between Data Types 1-9
Including Scripts 1-10
Aborting Scripts 1-10

Contents-1
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Interacting with a Script 1-10


Recommended VBScript References 1-11
2 - ANSYS Electronics Desktop and VBScript 2-2
Overview of ANSYS Electronics Desktop Script Variables 2-2
Recording a Script 2-7
Recording a Script to a File 2-9
Recording a Script to a Project 2-10
Working with Project Scripts 2-10
Stopping Script Recording 2-11
Running a Script 2-12
Pausing and Resuming a Script 2-13
Stopping a Script 2-14
Modifying a Script for Easier Playback 2-14
ANSYS Electronics Desktop Scripting Conventions 2-14
Syntax Conventions 2-15
Script Command Conventions 2-15
Named Arguments 2-17
Setting Numerical Values 2-18
ANSYS Electronics Desktop Layout Scripts and the Active Layer 2-18
Scripts and Locked Layers 2-19
Event Callback Scripting 2-19
Executing a Script from Within a Script 2-20
Editing Properties 2-21
3 - Desktop Scripting with IronPython 3-2
Introduction to IronPython 3-2
Scope 3-3
Python compatibility 3-3
Advantages of IronPython 3-3
IronPython Mini-cookbook 3-4
Comments 3-4

Contents-2
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Assigning/Creating Variables 3-4


Create Lists/Arrays 3-5
Create Dictionaries/Maps 3-5
Boolean Values 3-6
Converting Numbers to Strings and Vice Versa 3-6
String formatting/concatenation 3-6
Looping over lists 3-7
Looping over a range 3-7
A note about indentation 3-8
Obtaining more Information on Python 3-9
Discovering Methods 3-9
Help on a Method 3-10
Translating Script commands from VBScript to IronPython 3-11
Script Method Argument 3-11
Primitive Types 3-11
Named Array 3-12
Named Function 3-12
VBscript Method Call Types 3-12
Converting VBScript Function calls to IronPython Syntax 3-13
Return Values 3-14
Primitive Method Arguments 3-14
Named Array Argument 3-14
Named Array Values with All Key Value Pairs 3-16
Named Arrays with Nested Named Arrays 3-17
Function Blocks 3-18
Scripting Using Iron Python: Putting it all Together 3-19
Translating a script in VBScript to IronPython 3-19
Writing an IronPython script from scratch 3-19
IronPython Script Execution Environment 3-20
Script Argument for IronPython 3-20

Contents-3
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Script Objects for IronPython 3-21


Methods for IronPython 3-21
Methods for Manipulating Registry Values 3-23
Scripting using Embedded VBScript or JavaScript 3-24
Scripting with IronPython 3-27
IronPython Samples 3-28
Change property 3-28
Create a Cone using IronPython 3-29
Creating User Defined Primitives and User Defined Models in Python Scripts 3-33
Advantages Compared to C++ 3-33
Changes compared to C 3-33
Structures 3-33
Constants 3-34
Methods 3-34
Output Parameters 3-34
Comparison with C function: 3-35
'List Size' Parameters 3-35
Comparison with C function: 3-36
Added Parameters 3-37
Developing a UDM/UDP 3-37
Creation 3-38
Location 3-38
Organize 3-38
Edit/Reload 3-38
UDPExtension 3-38
Import 3-39
Main class: UDPExtension 3-39
IUDPExtension methods 3-39
Mandatory methods. 3-39
GetLengthParameterUnits() 3-39

Contents-4
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetPrimitiveTypeInfo() 3-39
GetPrimitiveParametersDefinition2() 3-39
AreParameterValuesValid2(errorMsg, udpParams) 3-39
CreatePrimitive2(funcLib, udpParams) 3-40
Optional methods 3-40
GetPrimitiveParameters() 3-40
GetRegisteredFaceNames() 3-40
GetRegisteredEdgeNames() 3-40
GetRegisteredVertexNames() 3-40
MapParametersDefinitionVersions2(oldVersion, oldUDPParams) 3-40
GetOldPrimitiveParametersDefinition2(version ) 3-41
Example UDP 3-41
UDPFunctionLibrary 3-41
Functions list: 3-42
UDMExtension 3-45
Import 3-45
Main class: UDMExtension 3-45
IUDMExtension methods 3-45
Mandatory methods. 3-45
GetInfo() 3-45
IsAttachedToExternalEditor() 3-45
CreateInstance(funcLib) 3-46
GetUnits(instanceId) 3-46
ReleaseInstance(instanceId) 3-46
GetAttribNameForEntityId() 3-47
GetAttribNameForPartId() 3-47
Optional methods 3-47
GetInstanceSourceInfo(instanceId) 3-48
ShouldAttachDefinitionFilesToProject() 3-48
Example UDM 3-48

Contents-5
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

UDMFunctionLibrary 3-48
Functions list: 3-49
UDP/UDM Structures and constants 3-50
UDP/UDM Structures 3-50
List of structures 3-51
UDP/UDM Constants 3-57
Enum constants: 3-57
Logging and Desktop Messaging 3-59
Collecting EBU Logs 3-59
Collecting WB Logs 3-60
Example Scripts for Python UDP and UDM 3-60
4 - Application Object Script Commands 4-2
GetAppDesktop 4-2
5 - Desktop Object Script Commands 5-2
AddMessage 5-4
ClearMessages 5-5
CloseAllWindows 5-5
CloseProject 5-6
CloseProjectNoForce 5-6
Count 5-7
DeleteProject 5-8
EnableAutoSave 5-9
ExportOptionsFiles 5-10
GetActiveProject 5-11
GetAutoSaveEnabled 5-12
GetBuildDateTimeString 5-13
GetDesigns 5-14
GetDistributedAnalysisMachines 5-16
GetDistributedAnalysisMachinesForDesignType 5-17
GetExeDir 5-18

Contents-6
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetLibraryDirectory 5-18
GetMessages 5-19
GetName [Desktop] 5-22
GetPersonalLibDirectory 5-24
GetProcessID 5-25
GetProjects 5-26
GetProjectDirectory 5-27
GetProjectList 5-28
GetSysLibDirectory 5-29
GetTempDirectory 5-30
GetUserLibDirectory 5-31
GetVersion 5-33
ImportANF 5-34
ImportAutoCAD 5-35
ImportGDSII 5-35
5-36
LaunchJobMonitor 5-37
NewProject 5-38
OpenAndConvertProject 5-39
OpenMultipleProjects 5-39
OpenProject 5-40
Paste (Project Object) 5-41
Paste (Project Object) 5-42
PauseRecording 5-44
PauseScript 5-44
Print 5-45
QuitApplication 5-46
RefreshJobMonitor 5-47
RestoreProjectArchive 5-49
RestoreWindow 5-50

Contents-7
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

ResumeRecording 5-51
RunProgram 5-52
RunScript 5-53
RunScriptWithArguments 5-54
SelectScheduler 5-55
SetActiveProject 5-56
SetActiveProjectByPath 5-57
SetLibraryDirectory 5-59
SetProjectDirectory 5-59
SetTempDirectory 5-60
Sleep 5-61
SubmitJob 5-61
TileWindows 5-62
Desktop Commands For Registry Values 5-63
DoesRegistryValueExist 5-64
GetRegistryInt 5-64
GetRegistryString 5-64
SetRegistryFromFile 5-65
SetRegistryInt 5-65
SetRegistryString 5-66
6 - Project Object Script Commands 6-2
AnalyzeAll [project] 6-3
ClearMessages 6-3
Close 6-4
CopyDesign 6-4
CutDesign 6-4
DeleteDesign 6-5
GetActiveDesign 6-6
GetDefinitionManager 6-6
GetDependentFiles 6-7

Contents-8
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetName [Project] 6-8


GetPath 6-8
GetTopDesignList 6-9
InsertDesign 6-9
InsertDesignWithWorkflow 6-12
Paste (Project Object) 6-14
Redo [Project Level] 6-15
Rename 6-16
RestoreProjectArchive 6-16
Save 6-17
SaveAs 6-18
SaveProjectArchive 6-20
SetActiveDefinitionEditor 6-22
SetActiveDesign 6-22
SimulateAll 6-23
Undo [Project] 6-24
UpdateDefinitions 6-24
7 - Material Script Commands 7-2
AddMaterial 7-2
EditMaterial 7-4
ExportMaterial 7-6
RemoveMaterial 7-6
8 - Property Script Commands 8-2
Conventions Used in this Chapter 8-2
GetArrayVariables 8-6
GetProperties 8-7
GetPropertyValue 8-8
GetVariables 8-11
GetVariableValue 8-11
SetPropertyValue 8-12

Contents-9
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

SetVariableValue 8-14
9 - Dataset Script Commands 9-2
AddDataset 9-2
DeleteDataset 9-3
EditDataset 9-4
ImportDataset 9-5
10 - Design Object Script Commands 10-2
ConstructVariationString 10-3
DeleteFieldVariation 10-4
DeleteFullVariation 10-6
DeleteLinkedDataVariation 10-7
DeleteVariation 10-9
ExportConvergence 10-9
ExportMeshStats 10-11
ExportProfile 10-12
GetDesignType 10-13
GetModule 10-14
GetName 10-15
GetNominalVariation 10-16
GetSelections 10-16
GetSolutionType 10-18
GetSolveInsideThreshold 10-18
GetSourceContexts 10-18
GetVariationVariableValue 10-19
GeometryCheckAndAutofix 10-19
PasteDesign (Design Object) 10-21
Redo [Design] 10-22
RenameDesignInstance 10-23
ResetToTimeZero 10-23
SARSetup 10-24

Contents-10
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

SetActiveEditor 10-25
SetBackgroundMaterial 10-26
SetLengthSettings 10-26
SetSolutionType 10-27
SetSolveInsideThreshold 10-28
SetSourceContexts 10-28
Solve 10-29
RunToolkit 10-30
Undo [Design] 10-34
ValidateDesign 10-34
11 - 3D Modeler Editor Script Commands 11-2
Draw Menu Commands 11-3
Create3D Component 11-4
CreateBondwire 11-6
CreateCutplane 11-7
CreateEquationCurve 11-7
CreateEquationSurface 11-10
CreateHelix 11-13
CreatePoint 11-14
CreateUserDefinedPart 11-14
CreateRegion 11-15
CreateRegularPolyhedron 11-19
CreateSpiral 11-20
CreateUserDefinedModel 11-21
CreateUserDefinedPart 11-23
Edit3DComponent 11-25
EditPolyline 11-26
Get3DComponentParameters 11-27
Get3DComponentDefinitionNames 11-27
Get3DComponentInstanceNames 11-28

Contents-11
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Get3DComponentMaterialNames 11-28
Get3DComponentMaterialProperties 11-29
Insert3DComponent 11-29
InsertPolylineSegment 11-30
SweepAlongPath 11-31
SweepAlongVector 11-32
SweepAroundAxis 11-33
SweepFacesAlongNormal 11-33
SweepFacesAlongNormalWithAttributes 11-35
UpdateComponentDefinition 11-36
Edit Menu Commands 11-37
Copy 11-37
DeletePolylinePoint 11-37
DuplicateAlongLine 11-38
DuplicateAroundAxis 11-39
DuplicateMirror 11-41
Mirror 11-43
Move 11-44
OffsetFaces 11-44
Paste (Model Editor) 11-45
Rotate 11-45
Scale 11-46
Modeler Menu Commands 11-46
AssignMaterial 11-48
Chamfer 11-48
Connect 11-50
CoverLines 11-50
CoverSurfaces 11-50
CreateEntityList 11-50
CreateFaceCS 11-51

Contents-12
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

CreateGroup 11-52
CreateObjectCS 11-54
CreateObjectFromEdges 11-57
CreateObjectFromFaces 11-58
CreateRelativeCS 11-59
DeleteEmptyGroups 11-60
DeleteLastOperation 11-61
DetachFaces 11-61
EditEntityList 11-62
EditFaceCS 11-63
EditObjectCS 11-63
EditRelativeCS 11-66
Export 11-67
ExportModelImageToFile 11-67
Fillet 11-69
FlattenGroup 11-71
GenerateHistory 11-71
HealObject 11-71
GetActiveCoordinateSystem 11-75
GetCoordinateSystems 11-75
Import 11-76
ImportDXF 11-78
ImportGDSII [Modeler Import] 11-81
Intersect 11-83
MoveCStoEnd 11-83
MoveEntityToGroup 11-84
MoveFaces 11-85
ProjectSheet 11-87
PurgeHistory 11-88
ReplaceWith3DComponent 11-88

Contents-13
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Section 11-91
SeparateBody 11-91
SetModelUnits 11-92
SetWCS 11-92
ShowWindow 11-93
Split 11-93
Subtract 11-94
SweepFacesAlongNormal 11-95
ThickenSheet 11-96
UncoverFaces 11-97
Unite 11-99
Unroup 11-99
WrapSheet 11-100
Other oEditor Commands 11-101
BreakUDMConnection 11-102
Delete 11-103
FitAll 11-103
GetBodyNamesByPosition 11-103
GetEdgeByPosition 11-104
GetEdgeIDsFromFace 11-105
GetEdgeIDsFromObject 11-105
GetFaceArea 11-106
GetFaceCenter 11-106
GetFaceByPosition 11-107
GetFaceIDs 11-108
GetMatchedObjectName 11-108
GetModelBoundingBox 11-109
GetModelUnits 11-109
GetNumObjects 11-110
GetObjectIDByName 11-110

Contents-14
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetObjectName 11-111
GetObjectNameByFaceID 11-111
GetObjectsByMaterial 11-112
GetObjectsInGroup 11-112
GetPropertyValue 11-113
GetSelections [Model Editor] 11-115
GetUserPosition 11-116
GetVertexIDsFromEdge 11-117
GetVertexIDsFromFace 11-117
GetVertexIDsFromObject 11-117
GetVertexPosition 11-118
OpenExternalEditor 11-118
PageSetup 11-119
RenamePart 11-119
12 - Output Variable Script Commands 12-1
CreateOutputVariable 12-1
DeleteOutputVariable 12-4
DoesOutputVariableExist 12-5
EditOutputVariable 12-6
GetOutputVariableValue 12-8
SimValueContext 12-17
13 - Reporter Editor Script Commands 13-2
AddCartesianLimitLine 13-5
AddCartesianXMarker 13-6
AddCartesianYMarker 13-6
AddDeltaMarker 13-7
AddMarker 13-8
AddNote 13-8
AddTraceCharacteristics 13-9
AddTraces 13-11

Contents-15
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

ClearAllMarkers 13-15
ClearAllTraceCharacteristics 13-17
CopyTracesData 13-18
CopyReportData 13-18
CopyReportDefinitions 13-19
CopyTraceDefinitions 13-20
CreateReport 13-20
CreateReport [Designer] 13-26
CreateReportFromTemplate 13-30
CreateReportOfAllQuantities 13-31
DeleteMarker 13-32
DeleteAllReports 13-33
DeleteReports 13-34
DeleteTraces 13-34
ExportImageToFile [Reporter] 13-35
ExportPlotImageToFile [Reporter] 13-36
ExportReport 13-38
ExportToFile 13-39
ExportToFile [Reporter] 13-40
ExportMarkerTable 13-40
FFTOnReport 13-41
GetAllCategories 13-43
GetAllReportNames 13-44
GetAllQuantities 13-46
GetAvailableDisplayTypes 13-46
GetAvailableReportTypes 13-47
GetAvailableSolutions 13-48
GetDataExpressions 13-48
GetDataUnits 13-49
GetDesignVariableNames 13-49

Contents-16
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetDesignVariableUnits 13-50
GetDesignVariableValue 13-50
GetDesignVariationKey 13-51
GetDisplayType 13-52
GetImagDataValues 13-52
GetPerQuantityPrimarySweepValues 13-53
GetPropertyValue 13-54
GetRealDataValues 13-56
GetReportTraceNames 13-57
GetSolutionContexts 13-58
GetSolutionDataPerVariation 13-59
GetSweepNames 13-61
GetSweepUnits 13-61
GetSweepValues 13-62
GroupPlotCurvesByGroupingStrategy 13-62
ImportIntoReport 13-64
IsDataComplex 13-64
IsPerQuantityPrimarySweep 13-65
MovePlotCurvesToGroup 13-65
MovePlotCurvesToNewGroup 13-66
PasteReports 13-67
PasteTraces 13-67
Release Data 13-68
RenameReport 13-68
RenameTrace 13-69
ResetPlotSettings 13-69
SavePlotSettingsAsDefault 13-70
UpdateTraces 13-71
UpdateTracesContextandSweeps 13-78
UpdateAllReports 13-80

Contents-17
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

UpdateReports 13-80
UnGroupPlotCurvesInGroup 13-81
14 - Boundary and Excitation Module Script Commands 14-1
General Commands Recognized by the Boundary/Excitations Module 14-2
AddAssignmentToBoundary 14-2
AutoIdentifyNets 14-4
AutoIdentifyPorts 14-4
AutoIdentifyTerminals 14-5
ChangeImpedanceMult 14-5
ConvertNportCircuitElementsToPorts 14-6
CreateNportCircuitElements 14-6
DeleteAllBoundaries 14-8
DeleteAllExcitations 14-8
DeleteBoundaries 14-9
GetBoundaryAssignment 14-10
GetBoundaries 14-10
GetBoundariesOfType 14-10
GetDefaultBaseName 14-11
GetExcitations 14-11
GetExcitationsOfType 14-11
GetNumBoundaries GetNumBoundaries 14-12
GetNumBoundariesOfType 14-12
GetNumExcitations 14-12
GetNumExcitationsOfType 14-13
GetPortExcitationCounts 14-13
ReassignBoundary 14-13
RemoveAssignmentFromBoundary 14-15
RenameBoundary 14-16
ReprioritizeBoundaries 14-17
SetDefaultBaseName 14-17

Contents-18
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Script Commands for Creating and Modifying Boundaries 14-18


AssignCircuitPort 14-19
AssignCurrent 14-21
AssignDielectricCavity 14-21
AssignFEBI 14-22
AssignFiniteCond 14-23
AssignFloquet 14-25
AssignHalfSpace 14-28
Assign Hybrid Region 14-29
AssignIERegion 14-30
AssignImpedance 14-31
AssignIncidentWave 14-32
AssignLayeredImp 14-33
AssignLinkedRegion 14-35
AssignLumpedPort 14-36
AssignLumpedRLC 14-38
AssignMagneticBias 14-39
AssignMaster 14-40
AssignPerfectE 14-41
AssignPerfectH 14-42
AssignRadiation 14-42
AssignScreeningImpedance 14-44
AssignSymmetry 14-46
AssignTerminal 14-47
AssignVoltage 14-48
AssignWavePort 14-49
CircuitPortToLumpedPort 14-51
EditCircuitPort [HFSS] 14-52
EditCurrent 14-53
EditDiffPairs 14-53

Contents-19
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

EditFiniteCond 14-54
EditHalfSpace 14-55
EditHybridRegion 14-56
EditImpedance 14-56
EditIncidentWave 14-56
EditLayeredImpedance 14-58
EditMaster 14-58
EditPerfectE 14-58
EditPerfectH 14-58
EditLumpedPort 14-59
EditLumpedRLC 14-60
EditMagneticBias 14-60
EditRadiation 14-60
EditSlave 14-62
EditSymmetry 14-62
EditTerminal 14-62
EditVoltage 14-63
EditWavePort 14-63
LumpedPortToCircuitPort 14-63
SetHybridRegionCoupledGroup 14-63
SetTerminalReferenceImpedances 14-66
SwapCircuitPortAssignment 14-66
UnassignIERegions 14-67
Script Commands for Creating and Modifying PMLs 14-68
CreatePML 14-68
ModifyPMLGroup 14-70
PMLGroupCreated 14-71
PMLGroupModified 14-71
RecalculatePMLMaterials 14-71
15 - Analysis Setup Module Script Commands 15-1

Contents-20
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

CopySetup 15-1
CopySweep 15-2
DeleteDrivenSweep 15-2
DeleteSetups 15-2
DeleteSweep [HFSS-IE] 15-3
EditFrequencySweep 15-3
EditSetup 15-4
EditSweep [HFSS-IE] 15-6
EditCircuitSettings 15-7
ExportCircuit 15-8
GetSetupCount 15-11
GetSetups 15-11
InsertFrequencySweep 15-12
InsertSetup 15-20
InsertSetup [HFSS-IE] 15-36
InsertSetup [Transient] 15-37
InsertSweep [HFSS-IE] 15-43
PasteSetup 15-46
PasteSweep 15-47
RenameDrivenSweep 15-47
RenameSetup 15-47
RenameSweep [HFSS-IE] 15-48
RevertAllToInitial 15-49
RevertSetupToInitial 15-49
SetMPIVendor 15-49
16 - Optimetrics Module Script Commands 16-1
General Commands Recognized by the Optimetrics Module 16-4
CopySetup 16-4
DeleteSetups [Optimetrics] 16-5
DistributedAnalyzeSetup 16-5

Contents-21
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

ExportDXConfigFile 16-6
ExportOptimetricsProfile 16-7
ExportOptimetricsResult 16-7
ExportParametricResults 16-8
GetSetupNames [Optimetrics] 16-9
GetSetupNamesByType [Optimetrics] 16-9
ImportSetup 16-10
PasteSetup [Optimetrics] 16-11
RenameSetup [Optimetrics] 16-12
SolveAllSetup 16-12
SolveSetup [Optimetrics] 16-13
Parametric Script Commands 16-13
EditSetup [Parametric] 16-13
GenerateVariationData (Parametric) 16-14
InsertSetup [Parametric] 16-14
Optimization Script Commands 16-18
EditSetup [Optimization] 16-18
InsertSetup [Optimization] 16-22
Sensitivity Script Commands 16-30
EditSetup [Sensitivity] 16-30
InsertSetup [Sensitivity] 16-35
Statistical Script Commands 16-38
EditSetup [Statistical] 16-38
InsertSetup [Statistical] 16-41
17 - Solutions Module Script Commands 17-1
DeleteSolutionVariation 17-1
18 - Field Overlays Module Script Commands 18-1
AddMarkerToPlot 18-1
CreateFieldPlot 18-2
DeleteFieldPlot 18-15

Contents-22
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetFieldPlotNames 18-15
ModifyFieldPlot 18-17
RenameFieldPlot 18-18
RenamePlotFolder 18-18
SetFieldPlotSettings 18-19
SetPlotFolderSettings 18-20
UpdateAllFieldsPlots 18-24
UpdateQuantityFieldsPlots 18-24
19 - Fields Calculator Script Commands 19-1
AddNamedExpression 19-2
AddNamedExpr 19-2
CalcOp 19-3
CalcRead(deprecated) 19-3
CalculatorRead 19-3
CalcStack 19-4
CalculatorWrite 19-5
ChangeGeomSettings 19-5
ClcEval 19-6
ClcMaterial 19-6
ClearAllNamedExpr 19-7
CopyNamedExprToStack 19-7
DeleteNamedExpr 19-7
EnterComplex 19-8
EnterComplexVector 19-8
EnterLine 19-9
EnterPoint 19-9
EnterQty 19-9
EnterScalar 19-10
EnterScalarFunc 19-10
EnterSurf 19-11

Contents-23
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

EnterVector 19-11
EnterVectorFunc 19-12
EnterVol 19-12
ExportOnGrid 19-12
ExportToFile [Fields Calculator] 19-14
GetTopEntryValue 19-15
LoadNamedExpressions 19-15
SaveNamedExpressions 19-16
20 - User Defined Solutions Commands 20-1
CreateUserDefinedSolution 20-1
DeleteUserDefinedSolutions 20-3
EditUserDefinedSolution 20-4
21 - NdExplorer Script Commands 21-1
NdExplorer Manager Script Commands 21-1
ExportFullWaveSpice [NdExplorer] 21-1
ExportNetworkData [NdExplorer] 21-2
ExportNMFData [NdExplorer] 21-3
22 - CompInstance Script Commands 22-1
Callback Scripting Using CompInstance Object 22-1
CompInstance Functions 22-1
GetComponentName 22-2
GetEditor [Component Instance] 22-2
GetInstanceID [Component Instance] 22-3
GetInstanceName [Component Instance] 22-3
GetParentDesign 22-4
GetPropServerName 22-4
23 - Definition Manager Script Commands 23-1
Component Manager Script Commands 23-1
Add [component manager] 23-2
AddDynamicNPortData [component manager] 23-15

Contents-24
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

AddNPortData [component manager] 23-17


ClearSolutionCache [component manager] 23-21
Edit [component manager] 23-21
EditWithComps [component manager] 23-40
Export [component manager] 23-48
GetData [component manager] 23-49
GetNames [component manager] 23-50
GetNPortData [component manager] 23-50
IsUsed [component manager] 23-52
Remove [component manager] 23-53
RemoveUnused [component manager] 23-54
Update Dynamic Link [component manager] 23-54
Component Manager SOD Script Commands 23-55
AddSolverOnDemandModel 23-55
EditSolverOnDemandModel 23-55
GetSolverOnDemandData 23-56
GetSolverOnDemandModelList 23-56
RemoveSolverOnDemandModel 23-56
odel Manager Script Commands 23-56
Add [model manager] 23-57
ConvertToDynamic 23-64
ConvertToParametric 23-64
Edit [deprecated] 23-65
EditWithComps [model manager] 23-65
Export [model manager] 23-73
GetData [model manager] 23-74
GetNames [model manager] 23-74
IsUsed [model manager] 23-75
Remove [model manager] 23-75
RemoveUnused [model manager] 23-76

Contents-25
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

ymbol Manager Script Commands 23-77


Add [symbol manager] 23-78
BringToFront [symbol manager] 23-85
Edit [deprecated] 23-85
EditWithComps [symbol manager] 23-85
Export [symbol manager] 23-93
GetData [symbol manager] 23-94
GetNames [symbol manager] 23-95
IsUsed [symbol manager] 23-95
Remove [symbol manager] 23-95
RemoveUnused [symbol manager] 23-96
Footprint Manager Script Commands 23-97
Add [footprint manager] 23-97
Edit [footprint manager] 23-113
EditWithComps [footprint manager] 23-113
Export [footprint manager] 23-125
GetData [footprint manager] 23-126
GetNames [footprint manager] 23-127
IsUsed [footprint manager] 23-127
Remove [footprint manager] 23-127
RemoveUnused [footprint manager] 23-128
adstack Manager Script Commands 23-129
AddPortsToAllNets [padstack manager] 23-129
AddPortsToNet [padstack manager] 23-130
Add [padstack manager] 23-130
Edit [padstack manager] 23-135
EditWithComps [padstack manager] 23-140
Export [padstack manager] 23-145
GetData [padstack manager] 23-146
GetNames [padstack manager] 23-147

Contents-26
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

IsUsed [padstack manager] 23-147


Remove [padstack manager] 23-147
RemovePortsFromAllNets [padstack manager] 23-148
RemovePortsFromNet [padstack manager] 23-148
RemoveUnused [padstack manager] 23-149
Material Manager Script Commands 23-149
Add [material manager] 23-150
Edit [Material Manager] 23-151
Export [material manager] 23-153
GetData [material manager] 23-154
GetNames [material manager] 23-154
GetProperties [material manager] 23-155
IsUsed [material manager] 23-156
Remove [material manager] 23-156
RemoveUnused [material manager] 23-158
NdExplorer Manager Script Commands 23-158
ExportFullWaveSpice [NdExplorer Manager] 23-158
ExportNetworkData [NdExplorer Manager] 23-160
ExportNMFData [NdExplorer Manager] 23-160
Script and Library Scripts 23-161
AddScript 23-162
EditScript 23-162
ExportScript 23-163
RemoveScript 23-164
ModifyLibraries 23-164
24 - Definition Editor Script Commands 24-1
Footprint Editor Scripts 24-1
AddLayer (Footprint Editor) 24-2
AddStackupLayer (Footprint Editor) 24-3
ChangeLayers (Footprint Editor) 24-5

Contents-27
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

ChangeOptions (Footprint Editor) 24-8


CloseEditor (Footprint Editor) 24-12
CreateCircle (Footprint Editor) 24-12
CreateCircleVoid (Footprint Editor) 24-13
CreateEdgePort (Footprint Editor) 24-13
CreateLine (Footprint Editor) 24-15
CreateLineVoid (Footprint Editor) 24-16
CreateMeasure (Footprint Editor) 24-16
CreatePolygonVoid (Footprint Editor) 24-18
CreatePin (Footprint Editor) 24-19
CreatePolygon (Footprint Editor) 24-19
CreateRectangle (Footprint Editor) 24-20
CreateText (Footprint Editor) 24-20
CreateVia (Footprint Editor) 24-20
Duplicate (Footprint Editor) 24-21
Edit (Footprint Editor) 24-21
EraseMeasurements (Footprint Editor) 24-22
FlipHorizontal (Footprint Editor) 24-22
FlipVertical (Footprint Editor) 24-22
GetAllLayerNames (Footprint Editor) 24-23
GetLayerInfo (Footprint Editor) 24-23
GetProperties (Footprint Editor) 24-24
GetStackupLayerNames (Footprint Editor) 24-24
Intersect (Footprint Editor) 24-25
Move (Footprint Editor) 24-25
PageSetup (Footprint Editor) 24-25
RemoveLayer (Footprint Editor) 24-26
RemovePort (Footprint Editor) 24-26
Rotate [Footprint Editor] 24-27
Save (Footprint Editor) 24-27

Contents-28
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

SetActiveDefinitionEditor (Footprint Editor) 24-27


SetPropertyValue (Footprint Editor) 24-28
Subtract (Footprint Editor) 24-28
ToggleViaPin (Footprint Editor) 24-28
Unite (Footprint Editor) 24-29
ZoomToFit (Footprint Editor) 24-29
25 - Design Verification Script Commands 25-1
AddRuleSet 25-1
AddRun 25-2
DeleteRuleSet 25-3
DeleteRun 25-4
EditRuleSet 25-4
EditRun 25-5
RenameRuleSet 25-6
RenameRun 25-7
RunAllDV 25-7
RunAllRuleSetDV 25-8
RunDV 25-8
26 - Example Scripts 26-1
VBScript Example Scripts 26-1
Data Export Script 26-1
Variable Helix Script 26-4
IronPython Example Scripts 26-8
BH Coordinates Python Script 26-8
Script Contents 26-9
Posco_BH_Curve.tab Contents 26-11
Equation Based Curve Python Script 26-13
HFSS Waveguide Array Python Script 26-16
Index Index-1

Contents-29
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Contents-30
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Introduction to VBScript 1-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

1 - Introduction to VBScript
ANSYS Electronics Desktop uses the Microsoft® Visual Basic® Scripting Edition (VBScript) script-
ing language to record macros. VBScript is based on the Microsoft Visual Basic programming lan-
guage.
Using scripts is a fast, effective way to accomplish tasks you want to repeat. When you execute a
script, the commands in the script are performed.
You can write a script using any text editor or you can record a script from within the ANSYS Elec-
tronics Desktop interface. After recording the script from within ANSYS Electronics Desktop, you
can then modify it if necessary using a text editor.
Although ANSYS Electronics Desktop records scripts in VBScript format, it can also execute
scripts in JavaScriptTM format. If you are running a script from a command prompt, the script can
be written in any language that provides the Microsoft COM methods. The ANSYS Electronics
Desktop scripting documentation refers to VBScript format only.
This chapter provides an overview of key VBScript components.
A Sample HFSS Script
A Sample Circuit Script
A Sample Q3D Script
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
For more details about VBScript, please see the Recommended VBScript References section at
the end of this chapter.

Introduction to VBScript 1-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Simple and Composite Names


Components, symbols, footprints, models, and padstacks possess either "simple" names or "com-
posite" names. Composite names are used to distinguish items from libraries that may possess 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 ori-
gin (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 composite 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. 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 por-
tion 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:
Dim box_xsize
After declaring a variable, you can assign information to it. For example:

Introduction to VBScript 1-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 gen-
erally 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 statement is avail-
able 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 vari-
able.
The lifetime of a variable depends on how long it exists. The script-level variables exist from declar-
ation until the end of the script. A procedure-level variable exists only as long as you are in the pro-
cedure 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 variable.
An array variable contains a series of values. For example:
Dim Primitives(2)
All arrays in VBScript are zero-based, so the array above actually contains 3 elements. You assign
data to each of the array’s elements using an index into the array. Data can be assigned to the ele-
ments of an array as follows:
Primitives(0) = "Box1"

Introduction to VBScript 1-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Primitives(1) = "Cone1"
Primitives(2) = "Cylinder1"
Similarly, the data can be retrieved from any element using an index into a particular array element.
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 con-
tents 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, com-
parison operators, and logical operators.
Please see the online VBScript User’s Guide for more details.
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.

Introduction to VBScript 1-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

When expressions contain operators from more than one category, arithmetic operators are eval-
uated first, comparison operators are evaluated next, and logical operators are evaluated last.
Comparison operators all have equal precedence, that is, they are evaluated in the left-to-right
order in which they appear. Arithmetic and logical operators are evaluated in the following order of
precedence.
Arithmetic Operators
Following is a list of VBScript’s arithmetic operators.

Symbol Description
^ Exponentiation
- Unary negation
* Multiplication
/ Division
\ Integer division
Mod Modulus arithmetic
+ Addition
- Subtraction
& String concatenation

Comparison Operators
Following is a list of 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

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

Symbol Description

Introduction to VBScript 1-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Not Logical negation


And Logical conjunction
Or Logical disjunction
Xor Logical exclusion
Eqv Logical equivalence
Imp Logical implication

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:
Select Case primitive_name
Case "Box1"
<statements to execute>
Case "Cylinder1"
<statements to execute>
Case Else
<statements to execute>
End Select

Introduction to VBScript 1-7


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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. Typically,
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
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.

Introduction to VBScript 1-8


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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).
Converts variablename to a double precision number. For example, it can be used to con-
vert the string "2.5" to the number 2.5.
CInt Syntax: CInt(variablename).
Converts variablename to an integer.

Introduction to VBScript 1-9


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 Definitions/Scripts dir-
ectory).
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 window
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. Terminating 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 window
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
users_string = InputBox ("text prompt", "title of the pop-up dialog
_
box", "default text for the input box")

Introduction to VBScript 1-10


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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.

Introduction to VBScript 1-11


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

PDF layout 1-12


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

ANSYS Electronics Desktop and VBScript 2-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

2 - ANSYS Electronics Desktop and


VBScript
This chapter provides an overview of ANSYS Electronics Desktop scripting using VBScript. Inform-
ation is included on the following topics:
Overview of ANSYS Electronics Desktop Script Variables
Recording a Script
Stopping Script Recording
Running a Script
Pausing and Resuming a Script
Modifying a Script for Easier Playback
ANSYS Electronics Desktop Scripting Conventions
ANSYS Electronics Desktop Layout Scripts and the Active Layer
Scripts and Locked Layers
Event Callback Scripting
Executing a Script from Within a Script
Editing Properties

Overview of ANSYS Electronics Desktop Script Variables


When you record an ANSYS Electronics Desktop script, the beginning of the script has some
standard commands as shown in the following chart. The commands in the chart are meant to
define the variables used by ANSYS Electronics Desktop in the script and assign values to the vari-
ables. The variables are used in the following hierarchy.

ANSYS Electronics Desktop and VBScript 2-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

First the commands are described followed by examples.


oAnsoftApp
The oAnsoftApp object provides a handle for VBScript to access the Ansoft.ElectronicsDesktop
product.
One example of accessing this object is:
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
oDesktop
The oDesktop object is used to perform desktop-level operations, including project management.
One example of accessing this object is:
Set oDesktop = oAnsoftApp.GetAppDesktop()
See the chapter Desktop Object Script Commands, for details about script commands recognized
by the oDesktop object.

ANSYS Electronics Desktop and VBScript 2-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oProject
The oProject object corresponds to one project open in the product. It is used to manipulate the pro-
ject and its data. Its data includes variables, material definitions and one or more designs. One
example of accessing this object is:
Set oProject = oDesktop.GetActiveProject()
See the following chapters for details about the script commands recognized by the oProject
object:

l Project Object Script Commands


l Material Script Commands
l Property Script Commands
l Dataset Script Commands

oDesign
The oDesign object corresponds to an instance of a design in the project. This object is used to
manipulate the design and its data. Its data includes variables, modules, and editors.
One example of accessing this object is:
Set oDesign = oProject.GetActiveDesign()
See the following chapters for details about the script commands recognized by the oDesign
object:

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 editors.
This object is used to add and modify data in the editor.
One example of accessing this object is:
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
A layout example of accessing this object is:
Set oEditor = oDesign.SetActiveEditor("Layout")
The Ansoft.ElectronicsDesktop product scripting supports the following editors:

Editor Name in Script


3D "3D Modeler"
Modeler

ANSYS Electronics Desktop and VBScript 2-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Editor
Reporter There is no Reporter editor object in the script. Instead, Reporter editor commands
Editor are executed by the ANSYS Electronics Desktop design object oDesign.

See the chapter 3D Modeler Editor Script Commands, for details about the script commands recog-
nized by the oEditor object and the chapter Reporter Editor Script Commands for details about
Reporter editor commands.
oModule
The oModule object corresponds to a module in the design. Modules are used to handle a set of
related functionality.
One example of accessing this object is:
Set oModule = oDesign.GetModule("BoundarySetup")
The software scripting supports the following modules:

Module Name in Script Chapter Title


Boundary/Excitations/Nets Module "BoundarySetup" Boundary and Excit-
ation Module Script
Corresponds to the Boundaries,Excitations or Commands
Nets branches in the project tree.

Mesh Operations Module "MeshSetup" Mesh Operations Mod-


ule Script Commands
Corresponds to the Mesh Operations branch in the
project tree.

Analysis Module "AnalysisSetup" Analysis Module Script


Commands
Corresponds to the Analysis branch in the project
tree.

Optimetrics Module "Optimetrics" Optimetrics Script Com-


mands
Corresponds to the Optimetrics branch in the pro-
ject tree.

Solutions Module "Solutions" Solutions Module Script


Commands
Corresponds to the operations in the Solution Data
dialog box, which is accessed by clicking Results>

ANSYS Electronics Desktop and VBScript 2-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Solution Data.

Field Overlays Module "FieldsReporter" Field Overlays Module


Script Commands
Corresponds to the Field Overlays branch in the pro-
ject tree.

Radiation Module "RadField" Radiation Module


Script Commands
Corresponds to the Radiation branch in the project
tree.

Reduce Matrix Module "ReduceMatrix" Reduce Matrices Mod-


ule Script Commands
Corresponds to the Reduce Matrix branch in the pro-
ject tree.

Examples of HFSS, Layout Editor, and Q3D Extractor scripts are described as follows.
Example: HFSS Script
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("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
Set oModule = oDesign.GetModule("BoundarySetup")

Example: HFSS Layout Editor Script


Dim oAnsoftApp

ANSYS Electronics Desktop and VBScript 2-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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("Project1")
oProject.InsertDesign "HFSS3D", "HFSS3D1", _
"C:\testinstall\HFSS\syslib\PCB - SingleSided.asty", ""
Set oDesign = oProject.SetActiveDesign("HFSS3D1")
Set oEditor = oDesign.SetActiveEditor("Layout")

Example: Q3D Extractor Script


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("")
Set oDesign = oProject.SetActiveDesign("")
Set oModule = oDesign.GetModule("Solutions")
The lines above define the variables used by the script and assigns values to the variables.

Recording a Script
After you begin to record a script, each subsequent interface action you take is recorded and saved
to a text file or project folder you have specified — i.e., each interface command is made up of one

ANSYS Electronics Desktop and VBScript 2-7


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

or more associated script commands, and each action is recorded and saved to a single script. The
recorded script is saved in the format you select, either IronPython Script format (.py, the
default) or VBScript format (.vbs).
To Record a Script to a File:

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

The Save As dialog box appears.

2. Use the file browser to locate and double-click the folder where you wish to save the script,
such as C:\Program Files\AnsysEM\<platform>\Scripts.
3. Type the name of the script in the File name text box and select the script type as
IronPython (*.py, the default) or or VBScript format (.vbs).
4. Then click Save.
4. Perform the steps you want to record.
5. When you have finished recording the script, click Tools >Stop Script Recording.
The recorded script is then saved to filename.py or filename.vbs in the folder specified folder.

To Record a Script to a Project:

1. Click Tools>Record Script to Project.

The Save Script to Project dialog box appears.

2. Type the name of the script in the text box and select the script type as IronPython (*.py, the
default) or or VBScript format (.vbs), then click OK.

Perform the steps you want to record.

3. When you have finished, click Tools >Stop Script Recording.

The recorded script is then saved to filename.py or scriptname.vbs in the Scripts library and
can be accessed by expanding the definitions/Scripts folder in the Project tree.

ANSYS Electronics Desktop and VBScript 2-8


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Recording a Script to a File


Once you start to record a script, your subsequent actions are added to the script. Each interface
com-mand has one or more associated script commands that are recorded to the script. The script
is recorded to a text file in either .py(Python) or .vbs (VBScript) file format or .js (Java Script
format).

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

The Save As dialog box appears.

2. Use the file browser to locate the folder in which you want to save the script, such as
C:\ANSYS\product name\Scripts, and then double-click the folder’s name.
3. Type the name of the script in the File name text box, or click its name, specify the file type:

4. Then click Save.

The script is saved in the folder you selected by the file name filename.pyor file-
name.vbs or filename.js.

5. Perform the steps that you want to record.


6. When you have finished recording the script, click Stop Script Recording on the Tools
menu.

ANSYS Electronics Desktop and VBScript 2-9


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Recording a Script to a Project


Once you start to record a script, your subsequent actions are added to the script. Each interface
command has one or more associated script commands that are recorded to the script. The script
is recorded to the project library.

1. On the Tools menu, click Record Script to Project or select the Automation tab and click
the Record Script icon and select Record Script to Project from the drop-down menu:

The Save Script to Project dialog box appears.

2. Enter a name for the script, and click OK to close the dialog and begin recording.
3. Perform the steps that you want to record.
4. When you have finished recording the script, click Stop Script Recording on the Tools
menu.

The script you recorded is saved to the current project’s scripts library. Refer to
Managing Library Contents for information on working with libraries.

Working with Project Scripts


l You can edit scripts stored in a project by right-clicking the desired script in the Defin-
itions>Scripts folder in the Project Manager window; then selecting Edit Script from
the context menu. The script will open in the Script Editor.
l You can execute a project script, by right-clicking the desired script in the Defin-
itions>Scripts folder in the Project Manager window; then selecting Run Script from
the context menu.
l You can also access project scripts by selecting the Automation tab for the ribbon, and
using the menu under the Run script icon:

ANSYS Electronics Desktop and VBScript 2-10


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Note:

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

Stopping Script Recording


l ClickTools>Stop Script Recording or select the Automation tab and click the Stop
Recording icon:

ANSYS Electronics Desktop stops recording to the script.

ANSYS Electronics Desktop and VBScript 2-11


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Running a Script
1. Click Tools>Run Script or click the Automation tab and click the Run Script icon:

The Open dialog box appears.

2. Use the file browser to locate the folder in which you saved the script, and then double-click
the folder’s name.

3. Type the name of the script in the File name text box, or click its name, specify the file type:

4. Then click Open.

ANSYS Electronics Desktop executes the script.


To supply script arguments when running from Tools>Run Script, use the Edit field at the bottom
of the file selection dialog. You can access the script arguments using the AnsoftScriptHost.ar-
guments collection from vbscript. This is a standard COM collection.
To run a script from a command line (as described in the ANSYS Electronics Desktop Help in the
Running ANSYS Electronics Desktop from a Command Line section), use:
-runscriptandexit or -runscript arguments to the ANSYS Electronics Desktop command
line syntax.
You can give -scriptargs parameter to the script and specify the arguments described in the
ANSYS Electronics Desktop help.

ANSYS Electronics Desktop and VBScript 2-12


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

If you run the script from DOS prompt as a .vbs file (that is, you do not launch ANSYS Electronics
Desktop, but just launch vbs directly, or use wscript.exe or cscript.exe), the arguments will be in the
WSH.arguments collection, not the AnsoftScriptHost.arguments collection. To handle this, use the
following script:
on error resume next
dim args
Set args = AnsoftScript.arguments
if(IsEmpty(args)) then
Set args = WSH.arguments
End if
on error goto 0
'At this point, args has the arguments no matter if you are running
'under windows script host or Ansoft script host
msgbox "Count is " & args.Count
for i = 0 to args.Count - 1
msgbox args(i)
next

Pausing and Resuming a Script


To pause a script during its execution:

l Click Tools>Pause Script or select the Automation tab and click the Pause Script icon.

To resume a script after pausing it:

l Click Tools>Resume Script.

ANSYS Electronics Desktop and VBScript 2-13


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Stopping a Script
l On the Tools menu, click Stop Script.

ANSYS Electronics Desktop stops executing the script that has been paused.

Modifying a Script for Easier Playback


In the sample scripts, note that the oProject variable is set to "Project1". That means that the script
must be played back within Project1 to operate correctly. Alternatively, oProject could be set to the
active project without specifying a project name.
For example:
Set oProject = oDesktop.GetActiveProject()
Using the line above, the script can be played back in any project.
The modified sample script is as follows:
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()
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
Set oModule = oDesign.GetModule("BoundarySetup")

ANSYS Electronics Desktop Scripting Conventions


A number of conventions exist for ANSYS Electronics Desktop regarding syntax, arguments and
numerical values. These conventions are as follows:

l Syntax Conventions
l Script Command Conventions
l Named Arguments

ANSYS Electronics Desktop and VBScript 2-14


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

l Setting Numerical Values


l ANSYS Electronics Desktop Layout Scripts and the Active Layer
l Scripts and Locked Layers
l Event Callback Scripting

Syntax Conventions
The following data types will be used throughout this scripting guide:

<string> A quoted string.


<bool> A boolean value. Should be set to either true or false (no quotes). Example 1: "SolveIn-
side:=", true
Example 2: "PortSolver:=", true
<double> A double precision value.
Example: 1.2
<int> An integer. Example: 1
<value> Can be a number, a VBScript variable, or a quoted string containing a valid ANSYS
Electronics Desktop expression.
Examples:
- "XSize:=", 1
- "XSize:=", "3mm"
- "XSize:=", VBScript_Var
- "XSize:=", "Hfss_Var + 10mm"

Script Command Conventions


The majority of this guide lists individual script commands. The following conventions are used to
describe them:
Script Command Name
Use:Describes the function of the script command.
Command:Lists the interface command that corresponds to the script command. Menu commands
are separated by ">". For example, HFSS>Excitations>Assign>Wave Port.
Syntax:Demonstrates the correct syntax for the command. Brackets < > enclose information or
arguments that you must enter.
Return Value:Describes the return value, if any.

ANSYS Electronics Desktop and VBScript 2-15


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Parameters:Describes the arguments or information in the syntax


description, if an explanation is needed.
VB Example:Provides a working example of the script command, if
needed.
Passing Arguments to Scripts
There are two ways to pass arguments to scripts:

1. When running from command line using -runscriptandexit or -runscript, give -scriptargs
parameters and specify arguments.

All arguments following the -scriptargs flag are enclosed in double quotes. For example
C:\AnsysEM\AnsysEMn\Win64\hfss.exe -RunScriptAndExit _
C:\scripts\test.vbs -scriptsargs "arg1 arg2 arg3"

2. When running from Tools>Run script, there is an edit field at the bottom of the file selection
dialog that you can use to enter script arguments.

You can access the script arguments using the AnsoftScriptHost.arguments collection from
vbscript. This is a standard COM collection.
If you run the script from DOS prompt as a .vbs file (that is, you do not open ANSYS Electronics
Desktop, but launch vbs directly, or use wscript.exe or cscript.exe), the arguments are in the
WSH.arguments collection, not the AnsoftScriptHost.arguments collection. To handle this,
write this script:
on error resume next
dim args
Set args = AnsoftScript.arguments
if(IsEmpty(args)) then
Set args = WSH.arguments
End if
on error goto 0

'At this point, args has the arguments no matter if you are running
'under windows script host or Ansoft script host
msgbox "Count is " & args.Count
for i = 0 to args.Count - 1
msgbox args(i)
next

ANSYS Electronics Desktop and VBScript 2-16


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Named Arguments
Many ANSYS Electronics Desktop script commands use named arguments. The names can
appear in three ways:
1. Named data, name precedes data.
For example: ...,"SolveInside:=", true, ...
2. Named Array, name precedes array.
For example: ...,"Attributes:=", Array(...),...
3. Named Array, name inside array.
For example: ..., Array("NAME:Attributes",...),...
In the first and second examples, the name is formatted as "<Name>:=". This signals ANSYS 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 ANSYS Electronics
Desktop which data is being given. The names must be included or the script will not play back cor-
rectly. 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 writ-
ing a script by hand, you can just add the data that changed and omit anything that you do not want
to change. ANSYS Electronics Desktop will use the names to determine which data you provided.
For example, when editing an impedance boundary, ANSYS Electronics Desktop records the ‘edit
impedance boundary’ command as follows:
oModule.EditImpedance "Imped1", Array("NAME:Imped1", _
"Resistance:=", "100", "Reactance:=", "50", _
"InfGroundPlane:=", false)
If you only want to change the resistance, then you can leave out the other data arguments when
you are manually writing a script:
oModule.EditImpedance "Imped1", Array("NAME:Imped1", _
"Resistance:=", "100")
Another example corresponding to ANSYS Electronics Desktop layout is described below:
When editing a port excitation, ANSYS Electronics Desktop records the ‘edit port’ command as fol-
lows:
oModule.Edit "Port1", Array("NAME:Port1",Array("NAME:Properties",
"PortSolver:=", "true", "Phase:=", "0deg", "Magnitude:=", "2mA",
"Impedance:=", "50Ohm", "Theta:=", "0deg", "Phi:=", "0deg", "PostPro-
cess:=", "false", "Renormalize:=", "50Ohm + 0i Ohm", "Deembed:=",
"0mm", "RefToGround:=", "false"), "Type:=", "EdgePort",

ANSYS Electronics Desktop and VBScript 2-17


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"IsGapSource:=", true, "UpperProbe:=", false, "LayoutObject:=",


"Port1", "Pin:=", "", "ReferencePort:=", "")
If you only want to change the magnitude, you can leave out the other data arguments when you
are manually writing a script:
oModule.Edit "Port1", Array("NAME:Port1", Array ("Magnitude:=",
"1mA"))
Setting Numerical Values
For script arguments that expect a number, the following options are possible:

l Pass in the number directly. For example:


oModule.EditVoltage "Voltage1", Array("NAME:Voltage1", _
"Voltage:=", 3.5)

l Pass in a string containing the number with units. For example:


oModule.EditVoltage "Voltage1", Array("NAME:Voltage1", _
"Voltage:=", "3.5V" )

l Pass in a defined variable name. For example:


oModule.EditVoltage "Voltage1", Array("NAME:Voltage1", _
"Voltage:=", "$var1" )

l Pass in a VBScript variable. For example:


vb_var = "3.5V"
oModule.EditVoltage "Voltage1", Array("NAME:Voltage1", _
"Voltage:=", vb_var)
ANSYS Electronics Desktop Layout Scripts and the Active Layer
The 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 will be an active layer, but it is not required and can not be assumed. Adding
operations are responsible for ensuring that the active layer exists and meets the particular require-
ments (such as layer type) for the operation. Adding operations may change the active layer to a dif-
ferent layer that meets requirements. The user is notified if the active layer is changed. If no layer is
available to be active, the operation is not done.
The active layer is not used during script adding operations. Script adding operations are respons-
ible 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

ANSYS Electronics Desktop and VBScript 2-18


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 parameter
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 a triggering event is detected, events such as placing a component or running a
simulation. When you define an Event Callback script, you specify one or more scripts that will be
run after a particular event is detected. For more information see Event Callbacks in the help.
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 func-
tions — 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.

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

ANSYS Electronics Desktop and VBScript 2-19


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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

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 Com-
pInstance’s functions can be called from ScriptName.

Executing a Script from Within a Script


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

l Personal library directory.

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

l User library directory.

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

l System library directory.

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

l ANSYS Electronics Desktop installation directory.

ANSYS Electronics Desktop and VBScript 2-20


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Editing Properties
Any data that is shown in the dockable Properties dialog box or in the modal Properties pop-up
window is called a property. For example, project and local variables are properties. The XSize of a
box in the Geometry editor is also a property. See the chapter, Property Script Commands, for an
explanation of how to manipulate properties in a script.

ANSYS Electronics Desktop and VBScript 2-21


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

PDF layout 2-22


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Desktop Scripting with IronPython 3-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

3 - Desktop Scripting with IronPython


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 Javascript.
Introduction to IronPython
IronPython Mini-cookbook
Translating Script commands from VBScript to IronPython
Scripting Using Iron Python: Putting it all Together
Standalone IronPython and Desktop IronPython
IronPython Samples
Creating User Defined Primitives and User Defined Models in Python 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 language syn-
tax 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.

Desktop Scripting with IronPython 3-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 document 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 tar-
gets 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 programming lan-
guage (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.
l The use of IronPython's technologies enables the ability to interactively script Desktop (fea-
ture in development). This allows better discovery of the scripting APIs as well as directly pro-
gramming 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 argu-
ments to the scripting methods.

Related Topics
IronPython Mini-cookbook
Translating Script commands from VBScript to IronPython
Scripting Using Iron Python: Putting it all Together
IronPython Samples

Desktop Scripting with IronPython 3-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

IronPython Mini-cookbook
While a tutorial on Python syntax is beyond the scope of this document, it will present simple coun-
terparts the VBScript constructs that users tend to regularly use.
Comments
Assigning/Creating variables
Create Lists/Arrays
Create Dictionaries/Maps
Boolean Values
Converting Numbers to Strings and Vice Versa
String Formatting/Concatenation
Looping over Lists
Looping over a Range
A Note About Indentation
Additional Sections:
Obtaining More Information
Discovering Methods
Help on a Method
Comments

VBScript IronPython
' Comments start with a single quote # Comments start with a sharp or hash
' like this line # symbol, like these lines

Assigning/Creating Variables

VBScript IronPython
' Declare with a Dim # No Set syntax. Simply create and assign
Dim oDesktop oDesktop = oApp.GetAppDesktop()

'Assignment needs a Set instruction


Set oDesktop = oApp.GetAppDesktop()

Desktop Scripting with IronPython 3-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Create Lists/Arrays

VBScript IronPython
' Declare as array of String with 11 # Declare an empty array
' indices from 0 through 10 myEmptyArray = []
Dim myArray(0 to 10) as String
myArray(0) = "Hello" # declare an array and initialize it with 5 ints
myArray(1) = "bye" myInitedArray = [ 1, 2, 3, 4, 5]

' Declare n array with no size # Python lists can have items of any type
Dim array2() as String # and there is no pre-declaration
# declare an array and init with mixed types
' Re-Dimension the array once size is mixed = ["hello", 1 ,2 ["nested"]]
' known
ReDim array2(0 to 2) as String # append to an array
array2(0) = "this" mixed.append( 3.5 )
array2(1) = "also"

Create Dictionaries/Maps

VBScript IronPython
' No direct equivalent is available as # an IronPython dictionary is a collection of
' far as the author knows # name value pairs. Just like arrays, there is
# no restriction on the keys or the values.
# For purposes of ANSYS EM scripting however,
# all keys must be strings

# delimiters are curly braces


# use a ":" between the key and the value
# separate key value pairs with a ","
myDict = {
"a" : 1,
"b" : "hello there",

Desktop Scripting with IronPython 3-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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 # use the integer() or float() or double()
' to convert the string representation # functions to cast a string CONTAINING the
' to the number representation. Use # string representation of whatever you are
' IsNumber to check before conversion # casting to.
Dim nStr = "100" strInt = "3"
Dim n = CInt(nStr) intVal = int(strVal)
floatVal = float(strVal)
' Use CStr to convert a number to
' its string representation # invoke the str() function with the int/float
Dim v, vStr # values as needed. You can alternately use
v = 100 # the string formatting method listed below
vStr = CStr(v) strVal = str(42)
strVal = str(42.345)

String formatting/concatenation

VBScript IronPython
' string concatenation uses the & # if you have two strings, you can always
' operator # concatenate then using the '+' operator
Dim allStr, str1 str1 = "hello"
str1 = " how are you" str2 = "world"
allStr = "Hello " & " There" & str1 str12 = str1 + " " + str2

Desktop Scripting with IronPython 3-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

' there seems to be no direct string # if you have different types though, string
' formatting function in VBScript # and int say, you must use the string
' using string concatenation or using # formatting commands. When formatting
' Replace are the two builtin options # multiple arguments, they must be entered
Dim fmt = "{1} climbs stalk {2}" # as a tuple ( item1, 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 # is of the form


Print i # for variable_name in array ':'
Next # < indent> statement1
# <indent> statement2
for i in vals:
print i
print " -> " process(i)

Looping over a range

VBScript IronPython
' Loop over a range, specify start, end # prints out values from 0 through 9
' and step for i in range(0, 10):
For i = 0 To 10 Step 1 print i
Print i
Next

Desktop Scripting with IronPython 3-7


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Related Topics
A Note About Indentation
Obtaining More Information
Discovering Methods
Help on a Method
Introduction to IronPython
Translating Script commands from VBScript to IronPython
Scripting Using Iron Python: Putting it all Together
IronPython Samples

A note about indentation


Python is one of the languages where whitespace (spaces, tabs etc) are syntactically significant.
You must understand the basics of indentation before scripting in python.
Any statement that introduces a block of code should be written such 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.
# define a function that starts at 0 indentation.
def multInt(a,b):
# every line following the def multInt which is expected
# to be a part of the function, must have the indent used
# by the first line of the function (3 spaces)
# here we introduce one more block, the if condition
# each line that belongs to the body of this func should
# have an indent that is more than the indent used by the
# if statement
If a%2 == 0:
# I am using an indent 2 more than the parent. i.e. 5
# spaces in total
return (a * b) + 100
else:
return (a * b) + 1000

Desktop Scripting with IronPython 3-8


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Sample Script 1: Describing python indentation

Related Topics
Obtaining More Information
Discovering Methods
Help on a Method
Introduction to IronPython
Translating Script commands from VBScript to IronPython
Scripting Using Iron Python: Putting it all Together
IronPython Samples

Obtaining more Information on Python


Reading a book and searching online are two of the standard options. There are several very good
python tutorials online and the command window is also a great way to quickly execute code and
learn by doing.
Much of the official python documentation is embedded into each python distribution and the com-
mand window can also be used to get more help. You can open the IronPython Command Window
by clicking Tools>Open Command Window. You can also aces the command window execut-
able, Ipy.exe, from the IronPython directory under the ANSYS EM product installation directory.
You can use this window to interactively enter python commands (any of the pure python samples
in this document)

Related Topics
Discovering Methods
Help on a Method
Introduction to IronPython
Translating Script commands from VBScript to IronPython
Scripting Using Iron Python: Putting it all Together
IronPython Samples

Discovering Methods
For instance, if you want to list all methods available in the string module, you would type in "import
string" to import the module first and then type in "dir(string)". You will get a list of all the methods
available (as well as some __somename__ internal names that can be ignored)

Desktop Scripting with IronPython 3-9


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Related Topics
Obtaining More Information
Help on a Method
Introduction to IronPython
Translating Script commands from VBScript to IronPython
Scripting Using Iron Python: Putting it all Together
IronPython Samples

Help on a Method
Once you know a function name, you can get more help on it using the builtin help method. For
instance, executing help(string.split) in the IronPython Command Window displays the fol-
lowing:

Obtaining More Information


Discovering Methods
Introduction to IronPython

Desktop Scripting with IronPython 3-10


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 chapter briefly describes Desktop scripting methods and arguments via VBScript samples.
The distinctions made here are significant and come in use later when translating scripts written in
VBScript to IronPython.

Related Topics
Script Method Argument
VBscript Method Call Types
VBScript Sub-Routines
Converting VBScript Function calls to IronPython Syntax
Introduction to IronPython
IronPython Mini-cookbook
Scripting Using Iron Python: Putting it all Together
IronPython Samples

Script Method Argument


Script method calls in VBscript are described later in this document, they generally take the form:
objectName .methodName ( arg1, arg2, ..)
The function call syntax is a standard followed by several programming languages, however, the
argument types in VBScript objects, when used for product scripting, are restricted to the following
Primitive types
Named Array
Named Function

Primitive Types
Primitive types are the standard bool, int, float, double and string

Desktop Scripting with IronPython 3-11


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Named Array
Named arrays are a special construct used very commonly and can be found in practically every
recorded script sample.
It starts with Array( "NAME:someName" and is followed by a collection of comma separated val-
ues which can be:

l A primitive value
l An array of primitive values
l Another named array
l A key, of the form "keyName:=" followed by
o A primitive value
o A function (described next)

Named Function
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 syntax
differences. These syntax differences are significant when converting VBScript to IronPython.
VBScript Functions
In VBScript terminology functions return values. The syntax for this is the one shared with prac-
tically all programming languages.
Set oDesktop = oAnsoftApp.GetAppDesktop()
Set oProject = oDesktop.NewProject
Sample Script 2: VBScript function call sample

Desktop Scripting with IronPython 3-12


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Note that the significant item here is that the method name is always followed by an argument list
enclosed in parentheses if there are arguments. If the argument list is empty as shown above for
the NewProject call, the parentheses can be omitted.
VBScript Sub-Routines
VBScript Sub-Routines 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()
Sample Script 3: VBScript Sub-Routine sample

Related Topics
Translating Script commands from VBScript to IronPython

Converting VBScript Function calls to IronPython Syntax


When converting functions, the important point to remember is that IronPython function names,
when used for scripting, are always followed by parentheses. So:

l If you see a VBScript snippet that looks like a VBScript Sub-Routine, remember to add par-
entheses.
l If you see a VBScript function that has no arguments and no parenthesis, 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.
Return Values
Primitive Method Arguments
Named Array Argument
Named Array Values with All Key Value Pairs
Named Arrays with Nested Named Arrays

Desktop Scripting with IronPython 3-13


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Function Blocks

Return Values
VBscript return values are sometimes assigned via the Set declaration. IronPython return values
are simple assignment (see the cookbook chapter)

Related Topics
Converting VBScript Function calls to IronPython Syntax

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
Converting VBScript Function calls to IronPython Syntax

Named Array Argument


The recommended approach here is to simply replace a VBScript array with a python array. The
mapping is quite simple:

l Change Array( to [ and close with a ] instead of the )


l Remove the line continuation symbols: _
l Map Boolean values correctly
oEditor.CreateCone Array("NAME:ConeParameters", "XCenter:=",
"0mm", _
"YCenter:=", "0mm", "ZCenter:=", "0mm", "WhichAxis:=", "Z",
"Height:=", "2mm",_ "BottomRadius:=", "1.56204993518133mm", "TopRa-
dius:=", "0mm"), Array("NAME:Attributes", "Name:=", "Cone1", "Flag-
s:=", "", "Color:=", _
"(132 132 193)", "Transparency:=", 0, "PartCoordinateSystem:=",
_
"Global", "UDMId:=", "", "MaterialValue:=", _
"" & Chr(34) & "vacuum" & Chr(34) & "", "SolveInside:=", true)
Sample Script 4: Create cone recorded snippet
For instance, method and named VBScript arrays in the snippet above are translated to
oEditor.CreateCone(
[

Desktop Scripting with IronPython 3-14


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"NAME: ConeParameters",
"XCenter:=" , "0mm",
"YCenter:=" , "0mm",
"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 5: Create a cone in IronPython
Note that the formatting (which helps readability immensely) is not really needed. All that had to be
done was

l Add the parentheses since the VBScript subroutine omits it


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, _

Desktop Scripting with IronPython 3-15


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Related Topics
Converting VBScript Function calls to IronPython Syntax

Named Array Values with All Key Value Pairs


While it is in general not allowed to replace the arrays and nested arrays with python dictionaries, in
the case where the named array consists entirely of key value pairs (like the sample above), one
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.
oEditor.CreateCone(
{
"NAME" : "ConeParameters",
"XCenter" : "0mm",
"YCenter" : "0mm",
"ZCenter" : "0mm",
"WhichAxis" : "Z",
"Height" : "2mm",
"BottomRadius": "1.56204993518133mm",
"TopRadius" : "0mm"
},
{
"NAME" : "Attributes",
"Name" : "Cone1",
"Flags" : "",
"Color" : "(132 132 193)",
"Transparency" : 0,
"PartCoordinateSystem": "Global",

Desktop Scripting with IronPython 3-16


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"UDMId" : "",
"MaterialValue" : "\"vacuum\"",
"SolveInside" : True
}
Sample Script 6: CreateCone in IronPython using dictionary syntax

Related Topics
Converting VBScript Function calls to IronPython Syntax

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 con-
verted 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 7: 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 8: Named array with nested named array as mixed dictionary + array
{ "NAME" : "name",

Desktop Scripting with IronPython 3-17


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"key1" : 1,
"key2" : 2,
"name2" : {"R" : 255}
}
Sample Script 9: Named array with nested named array in all dictionary syntax
{ "NAME" : "name",
"key1" : 1,
"key2" : 2,
"name2" : {
"NAME" : "name2",
"R" : 255
}
}
Sample Script 10: Nested named array with optional "NAME:" field

Related Topics
Converting VBScript Function calls to IronPython Syntax

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.

Note:

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

Desktop Scripting with IronPython 3-18


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Note:

When you see a function block, simply replace the Array( ) delimiters with the python
array delimiters [ ]

Related Topics
Converting VBScript Function calls to IronPython Syntax

Scripting Using Iron Python: Putting it all Together


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 via the Run methods
described later in this chapter.

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 trans-
lation. 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
Methods for Manipulating Registry Values
Scripting using Embedded VBScript or JavaScript
Scripting with IronPython
Standalone IronPython and Desktop IronPython

Related Topics
Introduction to IronPython
IronPython Mini-cookbook
Translating Script commands from VBScript to IronPython
Appendix: IronPython Samples

Desktop Scripting with IronPython 3-19


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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.
l Register an IronPython script as an external tool using the Tools > External Tools menu
item.

When desktop executes a script, it does so in an execution environment setup with predefined vari-
ables and functions. These predefined variables and functions are how the script communicates
with the desktop and they come in three flavors.
Script Argument for IronPython
Script Objects for IronPython
Methods for IronPython
Methods for Manipulating Registry Values

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.

Desktop Scripting with IronPython 3-20


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Figure 1: Run Script dialog and script arguments


Any argument specified here is communicated to the script being executed as the predefined vari-
able ScriptArgument.

Related Topics
IronPython Script Execution Environment

Script Objects for IronPython


The Desktop script objects are available to every IronPython script being run. The names used fol-
low the same convention as with VBScript.

l oAnsoftApplication is the script object representing the entire application.


l oDesktop is the script object representing the desktop. While this can be obtained from the
oAnsoftApplication using oAnsoftApplication.GetAppDesktop(), since this is a very com-
monly used script object, it is always made available.

The use of these objects is done as per the individual product scripting guides with some syntax
adjustments made for the parameters to account for the IronPython differences.

Related Topics
IronPython Script Execution Environment

Methods for IronPython


A collection of methods is made available to all python scripts to enable the use of existing scripts
written in VBScript or Javascript. Additional utility methods to add messages to the desktop mes-
sage window are also present.

l AddErrorMessage(str), AddWarningMessage(str), AddInfoMessage(str) and


AddFatalMessage(str) this family of methods allows a script to add messages to the
product's message window. All methods take a python string.
l RunScriptFile(filename, arguments) runs the contents of the supplied file as a script. The
type of the script (Javascript/VBScript) is deduced from the file extension. Script arguments

Desktop Scripting with IronPython 3-21


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

are passed as a single string with individual arguments separated by spaces. Each argu-
ment can optionally be enclosed by quotes to allow spaces within the argument.
l SetScriptingLanguageToJavascript(), SetScriptingLanguageToVBScript() allows
the script to change the syntax of the language being used in the Run*Command commands
listed below. Once set, the language choice remains for the rest of the script execution or till
it is changed. The default is VBScript.
l RunScriptCommand(CommandString) runs the supplied script text. The language of the
text is controlled by a previous call to SetScriptingLanguageToJavascript() or SetScript-
ingLanguageToVBScript()
l RunDesktopCOmmand(CommandString) runs the supplied script text. The text is expec-
ted to generally be a single line and be a method call on a oDesktop object. The oDesktop
object is initialized based on the supplied optional ProjectName Pparameter. If the Pro-
jectName parameter is not supplied, the active project is used.
l RunProjectCommand(CommandString,ProjectName=None, ProjectName=None)
runs the supplied script text. The oDesign object is initialized based on the supplied optional
parameters. If the ProjectName is not supplied, the active project is used to resolve the pro-
ject. If the DesignName is not supplied, the project’s active design or first design will be used
to resolve the oDesign object within the project.
l RunModuleCommand(CommandString,ModuleName, DesignName=None, Pro-
jectName=None) runs the supplied script text. The text is expected to be a single line and
be a method call on a oModule object. The design targeted is resolved using the supplied
optional DesignName and ProjectName parameters and the oModule object is initialized
using the supplied Module name on that resolved design.
l RunEditorCommand(CommandString, EditorName,DesignName=None, Pro-
jectName=None) runs the supplied script text. The text is expected to be a single line and
be a method call on a oEditor object. The design targeted is resolved using the supplied
optional DesignName and ProjectName parameters and the oEditor object is initialized
using the supplied Editor name on that resolved design.
l RunDefinitionManagerCommand(CommandString, ProjectName=None) runs the
supplies script text. The text is expected to be a single line and be a method call on a oDefin-
itionManager object. The oDefinitionManager object is created for the project specifie4d by
the optional ProjectName parameter.

Related Topics
IronPython Script Execution Environment

Desktop Scripting with IronPython 3-22


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Methods for Manipulating Registry Values


The ANSYS Registry is stored as an XML file format, file is located (by default) at C:\User-
s\<UserName>\Documents\Ansoft\<AnsysProductNameversion>\config\<PC_NAME>_user-
.XML. Most of the ANSYS product configuration information is stored in this XML file. So those six
methods allow a user to change the product configuration in VB-script or Python script.

l GetRegistryString("KeyPath") - returns the registry key string value, if successful.

Example:
value = oDesktop.GetRegistryString("Desktop/ActiveDSOConfigurations/HFSS")

l SetRegistryString (KeyPath", "string") - sets the registry key to the specified string
value.

Example:
oDesktop.SetRegistryString("Desktop/ActiveDSOConfigurations/HFSS", "Local")

l GetRegistryInt("KeyPath") - returns the registry key int value.

Example:
num = oDesktop.GetRegistryInt("Desktop/Set-
tings/ProjectOptions/HFSS/UpdateReportsDynamicallyOnEdits")

l SetRegistryInt("KeyPath", int) - Sets a registry key to a specified int value.

Example:
oDesktop.SetRegistryInt("Desktop/Set-
tings/ProjectOptions/HFSS/UpdateReportsDynamicallyOnEdits", 0)

l DoesRegistryValueExist("KeyPath") - returns a boolean true if a key exists, and false if


not.

Example:
bExist =oDesktop.DoesRegistryValueExist("Desktop/ActiveDSOConfigurations/HFSS")

l SetRegistryFromFile("FilePath") - full path to an Analysis Configuration File, which has


been exported from the HPC and Analysis Options panel.

Example:
oDesktop.SetRegistryFromFile("c:\\temp/test.acf")
Example for how to set the DSO & HPC analysis setup with Python script

1. In a PC start HFSS go to the DSO and HPC options dialog, create a setup name it as "test"
2. Export the setup to a file c:\tem\test.acf.

Desktop Scripting with IronPython 3-23


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

3. Copy the exported file to a target PC f:\temp\test.acf.


4. Run the following script.

#import the setup


oDesktop.SetRegistryFromFile("f:\\temp\\test.acf")
# Set Active Setup to "test"
oDesktop.SetRegistryString("Desktop/ActiveDSOConfigurations/HFSS", "test")

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 snip-
pets 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
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",_

Desktop Scripting with IronPython 3-24


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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
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

Desktop Scripting with IronPython 3-25


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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
# 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

Desktop Scripting with IronPython 3-26


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 limitation 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 functionality as
needed is a viable and option.
Access to the application scripting objects is provided via the predefined oDesktop object (as listed
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 syn-
tax. 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 arguments. The dif-
ferences are described in earlier chapters.

Note:

The typical VBScript calls to obtain the registered COM scripting interface via CreateOb-
ject calls and then obtain the oDesktop object from it using the GetAppDesktop() 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 par-
entheses 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.

Desktop Scripting with IronPython 3-27


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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

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]
]
]
])
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",

Desktop Scripting with IronPython 3-28


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

["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 arguments in nat-
ural python syntax.
oProject = oDesktop.GetActiveProject()
oDesign = oProject.InsertDesign("HFSS","Random","DrivenModal","")
oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateCone(
{
"NAME" : "ConeParameters",
"XCenter" : "0mm",
"YCenter" : "0mm",
"ZCenter" : "0mm",
"WhichAxis" : "Z",
"Height" : "2mm",
"BottomRadius" : "1.56204993518133mm",
"TopRadius" : "0mm"
},

Desktop Scripting with IronPython 3-29


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

{
"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 val-
ues from script methods. It creates a 5x5 grid of cones and also demonstrates the adding of inform-
ation 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"
coneBotRad = "1.5mm"
oEditor.CreateCone(
{
"NAME" : "ConeParameters",
"XCenter" : "0mm",
"YCenter" : "0mm",

Desktop Scripting with IronPython 3-30


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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
# position
if x == 0 and y == 0:
continue

# all other grid positions, replicate from the


# first one

Desktop Scripting with IronPython 3-31


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

# 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),
"TranslateVectorY" : "%d * 3 * %s" % (y, coneBotRad),
"TranslateVectorZ" : "0mm"
}
)

# Now fit the display to the created grid

Desktop Scripting with IronPython 3-32


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 possible,
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)
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.

Desktop Scripting with IronPython 3-33


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Constants
Enumeration/Enum constants have almost the same names as in C but the enum must be qualified
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, UDPFunc-
tionLibrary and UDMFunctionLibrary listed further in this document.
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 'success/failure'
boolean ('None' will be returned on failure and parameter variable - on success).
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.
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

Desktop Scripting with IronPython 3-34


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

(lRet, partIdsList) = udpFunctionLibrary.DetachFaces(nPartIds,


faceIdsList)
# 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:

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:

Desktop Scripting with IronPython 3-35


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

# 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: folded
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
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

Desktop Scripting with IronPython 3-36


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

C Python
parameters and nSize is the size of partIds. callbackData is omitted)

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++ geometry
library as the size of the List must be predefined and this size is different from the existing para-
meter’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,
double angle, (callbackData is omitted
int nClones, cloneIdsSize is a new parameter)
long* nClones,
void* callbackData);

Developing a UDM/UDP

Desktop Scripting with IronPython 3-37


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 implements
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 *

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 Logging section for more details.
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

Desktop Scripting with IronPython 3-38


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 methods
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

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.

Desktop Scripting with IronPython 3-39


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

CreatePrimitive2(funcLib, udpParams)

l funcLib is UDPFunction 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 UDPEx-
tension 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.

MapParametersDefinitionVersions2(oldVersion, oldUDPParams)

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

Desktop Scripting with IronPython 3-40


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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
...
...
For the full example, see Example Scripts for Python UDP and UDM.

UDPFunctionLibrary
UDPFunctionLibrary implements IUDPFunctionLib interface: The IUDPFunctionLib object is
passed as a parameter to Python script in functions CreatePrimitive2. You can call any of the func-
tions from the functions list (shown below).
udpFunctionLib.AddMessage(MessageSeverity.WarningMessage ,"New warn-
ing");
Considering that out variables are returned as members of the return tuple, sample code that calls
DetachFaces in Python script can look like this:

Desktop Scripting with IronPython 3-41


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

intVal = 10
inList = [..., ...]
(lret, outList) = udpFunctionLibrary.DetachFaces(intVal, inList)
As you can see outList output parameter is defined in the call to DetachFaces function. Unlike in C,
there is no need to define it before the function call.

Functions list:

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


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

Desktop Scripting with IronPython 3-42


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

19. int: iret = CreateCone(CoordinateSystemAxis: whichAxis, UDPPosition: centerPoint,


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

Desktop Scripting with IronPython 3-43


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

41. (int: iret , int: newPartID) = Split(int: partID, CoordinateSystemPlane: splitPlane,


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

Desktop Scripting with IronPython 3-44


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

63. string: str = GetUserLibDirPath()


64. string: str = GetPersonalLibDirPath()
65. string: str = GetInstallDirPath()
66. string: str = GetProjectPath()
67. (bool: bret, bool: abort) = SetProgress(UDPProgress: progress)

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.
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 meth-
ods 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

Desktop Scripting with IronPython 3-45


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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
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 par-


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

Desktop Scripting with IronPython 3-46


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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):
Replaces the old UDMDialogForDefinitionAndOptions method, which is still supported, but users
are urged to use UDMDialogForDefinitionOptionsAndParams. If both methods are present, applic-
ation 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. If it is True, applic-
ation 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. 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.

Desktop Scripting with IronPython 3-47


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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

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

Desktop Scripting with IronPython 3-48


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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.

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()

Desktop Scripting with IronPython 3-49


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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)

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 cor-
responds to an item in a different array from the original C API. The structure objects thus con-
structed 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,

Desktop Scripting with IronPython 3-50


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

ParamPropFlag.MustBeReal),
UDMParameter("cubeDistanceName", UnitType.LengthUnit,
UDPParam(ParamDataType.Double, cubeDistance),
ParamPropType.Value,
ParamPropFlag.MustBeReal),
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 UDPPara-
m.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, translationVector)

List of structures
You can use constructors to create a structure. You can also modify fields - directly or by provided
methods.

Desktop Scripting with IronPython 3-51


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Example:
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)

Desktop Scripting with IronPython 3-52


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Structure Construction Members


setString(string val)
setDouble(double val)
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)
UDPPolylineSegmentDefinition UDPPolylineSegmentDefinition( PolylineSegmentType Seg-
mentType
PolylineSegmentType seg-
mentType, int segmentStartIndex,
int segmentStartIndex, int numberOfPoints,
int numberOfPoints, double angle,
double angle, UDPPosition centerPoint,
UDPPosition centerPoint, CoordinateSystemPlane

Desktop Scripting with IronPython 3-53


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Structure Construction Members


CoordinateSystemPlane arcPlane)
arcPlane)

UDPPolylineDefinition UDPPolylineDefinition() int IsClosed


int IsCovered
UDPPolylineDefinition(
List_of_UDPPosition
List_of_UDPPosition positions, ArrayOfPosition
List_of_UDPPolylineSeg- List_of_UDPPolylineSeg-
mentDefinition segDefs, mentDefinition ArrayOfSeg-
int closed, mentDefinition

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,
double vEnd)
UDPHelixDefinition UDPHelixDefinition( int ProfileID
int profileID, UDPPosition PtOnAxis
UDPPosition ptOnAxis, UDPPosition AxisDir
UDPPosition axisDir, double NoOfTurns

Desktop Scripting with IronPython 3-54


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Structure Construction Members


double noOfTurns, bool IsRightHanded
bool isRightHanded, double Radi-
usChangePerTurn
double radiusChangePerTurn,
double Pitch
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 Radi-
usChangePerTurn
double radiusChangePerTurn)
UDPBLNDElements UDPBLNDElements( int PartID
int partID) List_of_int ListOfEdges
List_of_int ListOfFaces

UDPBLNDFilletOptions UDPBLNDFilletOptions( bool SupressFillet


bool supressFillet, BLNDFilletRadiusLaw Fil-
letRadiusLaw
BLNDFilletRadiusLaw fil-
letRadiusLaw, double FilletStartRadius
double filletStartRadius, double FilletEndRadius
double filletEndRadius, bool Fol-
lowSmoothEdgeSequence
bool fol-
lowSmoothEdgeSequence, BLNDFilletType FilletType
BLNDFilletType filletType, double SetbackDistance
double setbackDistance, double BulgeFactor
double bulgeFactor)
UDPBLNDChamferOptions UDPBLNDChamferOptions( bool SupressChamfer
bool supressChamfer, BLNDChamferRangeLaw
ChamferRangeLaw
BLNDChamferRangeLaw cham-
ferRangeLaw, double ChamferLeftRange
double chamferLeftRange, double Cham-

Desktop Scripting with IronPython 3-55


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Structure Construction Members


double chamferRightRange) ferRightRange

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

Desktop Scripting with IronPython 3-56


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Structure Construction Members


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
Double
String
Bool
Position
Unknown
ParamPropType Text
Menu
Number
Value
FileName
Checkbox
Position
Unknown

Desktop Scripting with IronPython 3-57


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

enum Constant Parameters


ParamPropFlag NoFlag
ReadOnly
MustBeInt
MustBeReal
Hidden
Unknown
CoordinateSystemAxis XAxis
YAxis
ZAxis
CoordinateSystemPlane XYPlane
YZPlane
ZXPlane
SweepDraftType ExtendedDraft
RoundDraft
NaturalDraft
MixedDraft
SplitWhichSideToKeep SplitKeepBoth
SplitKeepPositiveOnly
SplitKeepNegativeOnly
PolylineSegmentType LineSegment
ArcSegment
SplineSegment
AngularArcSegment
MessageSeverity WarningMessage
ErrorMessage
InfoMessage
IncompleteMessage
FatalMessage
BLNDFilletRadiusLaw BLNDConstantRadius
BLNDVariableRadius

Desktop Scripting with IronPython 3-58


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

enum Constant Parameters


BLNDFilletType BLNDRound
BLNDMitered
BLNDChamferRangeLaw BLNDConstantRange
BLNDVariableRange
PartPropertyFlags PropNonModel
PropDisplayWireFrame
PropReadOnly
PostprocessingGeometry
PropInvisible
PropShowDirection
PropDummy

Logging and Desktop Messaging


There is error logging and displaying script errors in Desktop Message Manager for UDP/UDM
Python scripts.
You can also add messages to Message Manager using the UDPFunctionLibrary AddMessage
method, but no logging is done in this case.

Collecting EBU Logs


The instructions below are for Windows, but they work similarly for Linux. On Linux, determine your
shell (execute echo $SHELL) and, based on that, use setenv or export to set the environment vari-
ables.

1. Create a directory that serves as a folder for the logs. Make sure that this directory is empty:
clean it out if it already has files. For this example, the name of the directory is c:\ans-
dir\ansdebug.
2. Start a new shell to set the environment. (You can set it permanently, but this is not recom-
mended.)
3. Set the following env variables in this shell:
l Set ANSOFT_DEBUG_MODE to 2. Set it to a higher number such as 4 or 5 if the
developer requests it.
l Set ANSOFT_DEBUG_LOG to a file in the previously created ansdebug directory: for
example, set ANSOFT_DEBUG_LOG=c:\ansdir\ansdebug\ansdebug.log.
l Set ANSOFT_DEBUG_LOG_SEPARATE to 1.

Desktop Scripting with IronPython 3-59


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

4. From the above shell, start the ANSYS Electromagnetics product and exercise the problem
scenario.
5. Zip all the log files in the c:\ansdir\ansdebug directory, and send them to the developer or sup-
port person requesting them.

Collecting WB Logs

1. Under WB, execute the Tools/Options menu option, and under the Journals And Logs sec-
tion, ensure the Write Workbench Log Files is checked.

Note the location of the log files. (On Windows this is typically %TEMP%\WorkbenchLogs.)
Navigate to that directory and remove all files.

2. Set up the EBU env vars if you need to collect those as well, following the instructions above.

3. Exercise the problem scenario.


4. Collect the WB log files and optionally the ANSYS Electromagnetics logs and, send them to
the developer or support person requesting them.

Example Scripts for Python UDP and UDM


The UDP example for Python creates a rectangular spiral.

1. Click Draw>User Defined Primitive>Examples>Rectangular Spiral (Python). The


User Defined Primitive Operation dialog box appears. You can set parameters such as
Xpos, Ypos, distance between turns, and Number of turns.

Desktop Scripting with IronPython 3-60


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Click OK to create the spiral.

The UDM example for Python creates an on die spiral inductor.

1. Click Draw>User Defined Model>OnDieSpiralInductor.

This opens a Properties dialog box in which you can set parameters.

Desktop Scripting with IronPython 3-61


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

2. Set the parameters and click OK to create the UDM.

Desktop Scripting with IronPython 3-62


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Application Object Script Commands 4-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

4 - Application Object Script Commands


The Application object commands permit you to get the AppDesktop. Application object commands
should be executed by the oAnsoftApp 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)
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

Application Object Script Commands 4-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Syn- GetAppDesktop()


tax

Python oDesktop = oAnsoftApp.GetAppDesktop()


Example

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

Application Object Script Commands 4-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

PDF layout 4-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Desktop Object Script Commands 5-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

5 - 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
"ExportOptionsFiles " on page 5-10
EnableAutoSave
GetActiveProject
GetAutoSaveEnabled
GetBuildDateTime
GetDesigns
GetDesignValidationInfo
GetDistributedAnalysisMachines
GetDistributedAnalysisMachincesForDesignType
GetExeDir
GetLibraryDirectory
GetMessages
GetName
GetPersonalLibDirectory
GetProcessID
GetProjects
GetProjectDirectory

Desktop Object Script Commands 5-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetProjectList
GetSysLibDirectory
GetTempDirectory
GetUserLibDirectory
GetVersion
ImportANF
ImportAutoCAD
ImportGDSII
ImportODB
LaunchJobMonitor
NewProject
OpenAndConvertProject
OpenMultipleProjects
OpenProject
Paste
PauseRecording
PauseScript
Print
QuitApplication
RefreshJobMonitor
RestoreProjectArchive
RestoreWindow
ResumeRecording
RunProgram
RunScript
RunScriptWithArguments
SelectScheduler
SetActiveProject
SetActiveProjectByPath
SetLibraryDirectory

Desktop Object Script Commands 5-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

SetProjectDirectory
SetTempDirectory
Sleep
SubmitJob
Tile Windows
Also see:
Desktop Commands For Registry Values

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

UI Access NA

Name Type Description


<severity> String One of "Error", "Warning" or "Info". Anything
other than the first two is treated as "Info" 0 =
Informational, 1 = Warning, 2 = Error, 3 =
Parameters
Fatal
<msg> String The message for the message window
<gotoID> String The instance name of a component instance
in the design

Return Value None

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


Syntax

Python oDesktop.AddMessage ("Project1", "HFSS1", 0, "This is a test


Examp- message")
le

VB  AddMessage <projectName>, <designName>, <severity>, <msg>, <gotoID>


Syntax

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


Examp- message"
le

Desktop Object Script Commands 5-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

ClearMessages
Clears the Message Window

UI Access NA

Name Type Description


Parameters
None

Return Value None

Python Syn- ClearMessages()


tax

Python oDesktop.ClearMessages()
Example

VB Syntax ClearMessages
VB Example oDesktop.ClearMessages

CloseAllWindows
Closes all MDI child windows on the desktop.

UI Access From main menu, Window>CloseAll.

Name Type Description


Parameters
None

Return Value None

Python Syn- CloseAllWindows()


tax

Python oDesktop.CloseAllWindows()
Example

VB Syntax CloseAllWindows()
VB Example oDesktop.CloseAllWindows()

Desktop Object Script Commands 5-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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.

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 Syn- CloseProject (<ProjectName>)


tax

Python oDesktop.CloseProject ("MyProject")


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 GetPro-
jectList 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

Python Syn- CloseProjectNoForce (<ProjectName>)


tax

Desktop Object Script Commands 5-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python oDesktop.CloseProjectNoForce ("MyProject")


Example

VB Syntax CloseProjectNoForce <ProjectName>


VB oDesktop.CloseProjectNoForce "MyProject"
Example

VB Example:
------------------------------------
Example Script
------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.CloseProjectNoForce "Project9"

Count
Use: Gets the total number of queried projects or designs obtained by GetProjects() and
GetDesigns() commands. See the example query.
Syntax:
Return Value: Returns an integer value.
Parameters: None
Example: set projects = oDesktop.GetProjects()
numprojects = projects.

Example:

Desktop Object Script Commands 5-7


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

---------------------------------------------------------
Example Script: iterate through using integer index
---------------------------------------------------------
Dim oAnsoftApp
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
Use: Deletes a project from disk.

UI Access Edit>Delete

Name Type Description


Parameters
<projectname> String Name of the project

Return Value None

Desktop Object Script Commands 5-8


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Syn- DeleteProject (<ProjectName>)


tax

Python oDesktop.DeleteProject ("MyProject")


Example

VB Syntax DeleteProject <ProjectName>


VB Example oDesktop.DeleteProject "MyProject"

VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2019.1.0
' 14:24:22 Aug 21, 2018
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.DeleteProject "Project8"

EnableAutoSave
Enable or disable autosave feature.

UI Access NA

Name Type Description


Parameters
<enable> Boolean True enables autosave and False disables it.

Return Value None

Desktop Object Script Commands 5-9


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Syn-  EnableAutoSave(<Enable>)


tax

Python oDesktop.EnableAutoSave(True)
Example

VB Syntax  EnableAutoSave(<Enable>)
VB Example oDesktop.EnableAutoSave(true)

--------------------------------------------------------------------
In this example message box returns 1 since autosave is enabled.
--------------------------------------------------------------------
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.GetActiveProject()
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
oDesktop.EnableAutoSave(true)
msgbox(oDesktop.GetAutoSaveEnabled())

ExportOptionsFiles
Copies the options config files to the DestinationDirectory.

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

Parameters Name Type Description

Desktop Object Script Commands 5-10


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<DestinationDirectory> String The path to the destination directory.

Return Value None

Python ExportOptionsFiles(  <
  DestinationDirectory>)
Syntax

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

VB Syntax ExportOptionsFiles <DestinationDirectory>


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

GetActiveProject
Obtain the object for the project that is currently active in the Desktop.

Note:

GetActiveProject returns normally if there are no active objects.

UI Access NA

Name Type Description


Parameters
None

Return Value Object, the project that is currently active in the desktop

Python Syn- GetActiveProject()


tax

Python oProject = oDesktop.GetActiveProject()


Example

VB Syntax GetActiveProject
VB Set oProject = oDesktop.GetActiveProject
Example

Desktop Object Script Commands 5-11


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Example:
------------------------------------
Example Script
------------------------------------
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.GetActiveProject()

GetAutoSaveEnabled
Checks to see if the autosave feature is enabled.

UI Access NA

Name Type Description


Parameters
None

Boolean
Return Value
True if autosave is enabled

Python Syn- GetAutoSaveEnabled()


tax

Python Enabled = oDesktop.GetAutoSaveEnabled()


Example

VB Syntax GetAutoSaveEnabled
VB Enabled = oDesktop.GetAutoSaveEnabled()

Desktop Object Script Commands 5-12


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Example

VB Example:
------------------------------------
Example Script
------------------------------------
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.GetActiveProject()
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
msgbox(oDesktop.GetAutoSaveEnabled())

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

UI Access NA

Name Type Description


Parameters
None

String
Return Value The build date and time. Format: year-month-day hour:minute:second, e.g.,
2019-01-18 21:59:33

Python Syn- GetBuildDateTimeString()


tax

Python oDesktop.GetBuildDateTimeString()
Example

Desktop Object Script Commands 5-13


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Syntax GetBuildDateTimeString
VB Example dnt = oDesktop.GetBuildDateTimeString

VB Example:
------------------------------------------------------
message box displays dat
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
msgbox(oDesktop.GetBuildDateTimeString())

GetDesigns
Returns the designs in a given project.
For querying designs within a queried project obtained by the GetProjects() command. Once you
have the designs you can iterate through them using standard VBScript methods. See the example
query.

UI Access NA

Name Type Description


Parameters
None

Return Value  A collection containing objects for all designs in the project

Python Syn- GetDesigns()

Desktop Object Script Commands 5-14


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

tax

for dsn in oProject.GetDesigns():


Python
Example AddInfoMessage(dsn.GetName())

VB Syntax GetDesigns
For each dsn in oProject.GetDesigns
VB Example MsgBox dsn.GetName()
next

Example:
--------------------------------------------------------------------
Object in design(0) is edited. designs(0) is one of several designs
in this project. design(0) implies first design; design(1) implies
second design and so on.
--------------------------------------------------------------------
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("Project9")
set projects = oDesktop.GetProjects()
set designs = projects(0).GetDesigns()
Set oEditor = designs(0).SetActiveEditor("3D Modeler")
oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:Geo-
metry3DCmdTab", Array("NAME:PropServers", _

Desktop Object Script Commands 5-15


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Box1:CreateBox:1"), Array("NAME:ChangedProps", Array("NAME:ZSize",


"Value:=", "1mm"))))

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

UI Access NA

Name Type Description


Parameters
None

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

Python GetDistributedAnalysisMachines()
Syntax

for machine in oDesktop.GetDistributedAnalysisMachines():


Python
Example AddInfoMessage(str(machine))

VB Syn- GetDistributedAnalysisMachines()
tax

For each machine in oDesktop.GetDistributedAnalysisMachines


VB ()
Exampl-
msgbox machine
e
next

VB Example:
------------------------------------
Example Script
------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign

Desktop Object Script Commands 5-16


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
for each machine in oDesktop.GetDistributedAnalysisMachines()
msgbox machine
next

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

UI Access NA

Name Type Description


<designTypeName> String The name of the type of design, such as
Parameters "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 Syn- GetDistributedAnalysisMachinesForDesignType (<designTypeName>)


tax

machineNames =oDesktop.
Python GetDistributedAnalysisMachinesForDesignType
Example
("HFSS")

VB Syntax GetDistributedAnalysisMachinesForDesignType <designTypeName>


VB Set machineNames =oDesktop.
Example

Desktop Object Script Commands 5-17


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetDistributedAnalysisMachinesForDesignType
("HFSS")

GetExeDir
Returns the path where the executable is located.

UI Access NA

Name Type Description


Parameters
None

String
Return Value path where executable is located, such as 'C:/Program Files/An-
sysEM/AnsysEM19.5/Win64/'

Python Syn- GetExeDir()


tax

Python oDesktop.GetExeDir()
Example

VB Syntax GetExeDir()
VB Example msgbox(oDesktop.GetExeDir())

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.

Python GetLibraryDirectory()
Syntax

Desktop Object Script Commands 5-18


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python AddInfoMessage(str(oDesktop.GetLibraryDirectory()))
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
msgbox(oDesktop.GetLibraryDirectory())

Python GetLibraryDirectory()
Syntax

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

GetMessages
Get the messages from a specified project and design.

UI Access NA

Name Type Description


Parameters < ProjectName> String Name of the project for which to collect mes-
sages. An incorrect project name results in no

Desktop Object Script Commands 5-19


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

messages (design is ignored). An empty pro-


ject 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
< Severity> Integer Severity is 0-3, and is tied in to info/warn-
ing/error/fatal types as follows:
0 is info and above
1 is warning and above
2 is error and fatal
3 is fatal only (rarely used)

Return Value  A simple array of strings.

Python Syn- GetMessages (<ProjectName>, <DesignName>, <Severity>)


tax

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

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


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

VB Example:
------------------------------------------------------
For severity =1, the message box returns the first
warning message for Project9, HFSSDesign1
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop

Desktop Object Script Commands 5-20


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Dim oseverity
Dim var
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
var = oDesktop.GetMessages(Project9,HFSSDesign1,1)
msgbox var(0)

VB Example:
----------------------------------------------------------
For severity =2, the message box returns the
first error message for Project9, HFSSDesign1
----------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Dim oseverity
Dim var
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")

Desktop Object Script Commands 5-21


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oDesktop = oAnsoftApp.GetAppDesktop()


oDesktop.RestoreWindow
var = oDesktop.GetMessages(Project9,HFSSDesign1,1)
msgbox var(0)

VB Example:
------------------------------------------------------
using for loop display all the messages for
Project9, HFSSDesign1
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Dim var
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
for each var in oDesktop.GetMessages("Project9","HFSSDesign1",1)
msgbox var
next

GetName [Desktop]
Use: Gets names of queried projects or designs obtained by GetProjects() and GetDesigns() com-
mands. See the example query.
Syntax: GetName()
Return Value: Returns a name of type string.

Desktop Object Script Commands 5-22


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Parameters: None
Example:
set projects = oDesktop.GetProjects()
project_name = projects(0).GetName()
Example:
--------------------------------------------------------------
In this example, message box returns project name. projects(0) is
the first of the several projects. Similarly projects(1) displays
name of second project
----------------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
set projects = oDesktop.GetProjects()
project_name = projects(0).GetName()
msgbox(project_name)
Example:
------------------------------------------------------
message box returns the names of the projects
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign

Desktop Object Script Commands 5-23


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Dim oEditor
Dim oModule
Dim oProjects
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
for each prj in oDesktop.GetProjects()
msgbox prj.GetName()
next

GetPersonalLibDirectory
Get the path to the PersonalLib directory.

UI Access NA

Name Type Description


Parameters
None

String
Return Value
The path to the PersonalLib directory

Python GetPersonalLibDirectory()
Syntax

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

VB Syntax GetPersonalLibDirectory
VB MsgBox oDesktop.GetPersonalLibDirectory
Example

VB Example:
------------------------------------------------------
message box returns the PersonalLib directory path
------------------------------------------------------

Desktop Object Script Commands 5-24


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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
sys = oDesktop.GetPersonalLibDirectory()
msgbox(oDesktop.GetPersonalLibDirectory())

GetProcessID
Returns the process ID of ansysedt.exe.

UI Access NA

Name Type Description


Parameters
None

String
Return Value
returns the process ID of ansysedt.exe, such as 12716

Python Syn- GetProcessID ()


tax

Python oDesktop.GetProcessID()
Example

VB Syntax GetProcessID()
VB Example msgbox(oDesktop.GetProcessID())

Desktop Object Script Commands 5-25


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetProjects
 Return a list of all the projects that are currently open in the Desktop. Once you have the projects
you can iterate through them using standard VBScript methods. See the example query.

UI Access NA

Name Type Description


Parameters
None

Return Value Returns a collection containing objects for all open projects in the Desktop

Python Syn- GetProjects()


tax

for pjt in oDesktop.GetProjects():


Python
Example AddInfoMessage(str(pjt.GetName()))

VB Syntax GetProjects
For each pjt in oDesktop.GetProjects
MsgBox pjt.GetName()
VB Example

Next

VB Example:
---------------------------------------------------
Example Script
----------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects

Desktop Object Script Commands 5-26


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")


Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
for each prj in oDesktop.GetProjects()
msgbox prj.GetName()
for each design in prj.GetDesigns()
msgbox design.GetName()
next
next

GetProjectDirectory
Gets the path to the Project directory.

UI Access NA

Name Type Description


Parameters
None

String
Return Value
The path to the Project directory.

Python GetProjectDirectory()
Syntax

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

VB Syntax GetProjectDirectory
VB Example MsgBox oDesktop.GetProjectDirectory

VB Example:
------------------------------------------------------
message box returns the project directory path
------------------------------------------------------
Dim oAnsoftApp

Desktop Object Script Commands 5-27


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
projdir = oDesktop.GetProjectDirectory()
msgbox(oDesktop.GetProjectDirectory())

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

UI Access NA

Name Type Description


Parameters
None

Return Value An array of strings, the names of all open projects in the Desktop.

Python Syn- GetProjectList()


tax

Python list_of_projects = oDesktop.GetProjectList()


Example

VB Syntax GetProjectList
VB list_of_projects = oDesktop.GetProjectList
Example

VB Example:
------------------------------------------------------
message box returns list of project names
------------------------------------------------------

Desktop Object Script Commands 5-28


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Dim lpj
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
for each lpj in oDesktop.GetProjectList()
msgbox lpj
next

Python Syn- GetProjectList()


tax

Python list_of_projects = oDesktop.GetProjectList()


Example

GetSysLibDirectory
Get the path to the SysLib directory.

UI Access NA

Name Type Description


Parameters
None

String
Return Value
The path to the SysLib directory.

Python GetSysLibDirectory()
Syntax

Desktop Object Script Commands 5-29


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python AddInfoMessage(str(oDesktop.GetSysLibDirectory))
Example

VB Syntax GetSysLibDirectory
VB Example MsgBox oDesktop.GetSysLibDirectory

VB Example:
------------------------------------------------------
message box returns system library directory path
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
sys = oDesktop.GetSysLibDirectory()
msgbox(oDesktop.GetSysLibDirectory())

Python GetSysLibDirectory()
Syntax

Python AddInfoMessage(str(oDesktop.GetSysLibDirectory))
Example

GetTempDirectory
Gets the path to the Temp directory.

UI Access NA

Name Type Description


Parameters
None

Desktop Object Script Commands 5-30


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

String
Return Value
The path to the Temp directory.

Python GetTempDirectory()
Syntax

Python AddInfoMessage(str(oDesktop.GetTempDirectory))
Example

VB Syntax GetTempDirectory
VB Example MsgBox oDesktop.GetTempDirectory

VB Example:
tempdir = oDesktop.GetTempDirectory
VB Example:
------------------------------------------------------
message box returns temp directory path
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
tempdir = oDesktop.GetTempDirectory()
msgbox(oDesktop.GetTempDirectory())

GetUserLibDirectory
Gets the path to the UserLib directory.

Desktop Object Script Commands 5-31


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

UI Access NA

Name Type Description


Parameters
None

String
Return Value
The path to the UserLib directory.

Python GetUserLibDirectory()
Syntax

Python AddInfoMesage(str(oDesktop.GetUserLibDirectory()))
Example

VB Syntax GetUserLibDirectory
VB Example MsgBox oDesktop.GetUserLibDirectory

VB Example:
------------------------------------------------------
message box returns userlib directory path
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
userlib = oDesktop.GetUserLibDirectory()
msgbox(oDesktop.GetUserLibDirectory())

Desktop Object Script Commands 5-32


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetVersion
Use: Returns a string representing the version.

UI Access NA

Name Type Description


Parameters
None

String
Return Value
The version string of the product.

Python Syn- GetVersion()


tax

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

VB Syntax GetVersion()
VB Example Msgbox oDesktop.GetVersion

VB Example:
------------------------------------------------------
message box displays version number
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow

Desktop Object Script Commands 5-33


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

msgbox(oDesktop.GetVersion())

ImportANF
Use:Import an ANF file into a new project.
Command:File > Import > ANF
Syntax:ImportANF<"ANF_filename">
Return Value:None
Parameters:<"ANF_filename">
Type: text
Example:
oDesktop.RestoreWindow()
Set oTool = oDesktop.GetTool("ImportExport")
oTool.ImportANF("C:/AnsTranslator/results/package 4.anf")
Example:
------------------------------------------------------
Example shows how to import an ANF file.
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
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")

Desktop Object Script Commands 5-34


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oTool.ImportANF("C:\Program Files\An-
sysEM\AnsysEM18.0\Win64\Examples\Package\package_board.anf")

ImportAutoCAD
Use:Import an AutoCAD file into a new project.
Command:File >Import > AutoCAD
Syntax:ImportAutoCAD <"AutoCADfilename">, <"Controlfilename">
Return Value:None
Parameters:<"AutoCADfilename">
Type: text
Description: name of the AutoCAD file to import
<"OutputEDBfilename">
Type: text
Description: name of the EDB file to create during the import.
<"Controlfilename">
Type: text
Description: name of the xml control file to use to guide the import.
This string can be empty ("") if no control file is to be used.
VB Example:
Set oTool = oDesktop.GetTool("ImportExport")
oTool.ImportDXF"a4lines.dxf", "a4lines.aedb.edb" "a4lines.xml"

ImportGDSII
Use:Import a GDSII file into a new project.
Command:File > Import > GDSII
Syntax:ImportGDSII
<"GDSIIfilename">
<"OutputEDBfilename">,
<"Controlfilename">,
<"PropertyMappingfilename">
Return Value:None
Parameters:<"GDSIIfilename">

Desktop Object Script Commands 5-35


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Type: text
Description: name of the GDSII file to import
<"OutputEDBfilename">
Type: text
Description: name of the EDB file to create during the import.
<"Controlfilename">
Type: text
Description: name of the xml control file to use to guide the import.
This string can be empty ("") if no control file is to be used.
<"PropertyMappingfilename">
Type: text
Description: name of the property mapping file to use to guide the import.
This string can be empty ("") if no control file is to be used.
VB Example:
Set oTool = oDesktop.GetTool("ImportExport")
oTool.ImportGDSII "test.gds", "test.aedb.edb", "test.xml",
"test.txt"

ImportGDSII ([
<"GDSIIfilename">
Python Syn- <"OutputEDBfilename">,
tax
<"Controlfilename">,
<"PropertyMappingfilename">
])
oTool.ImportGDSII
([
Python
Example "test.gds", "test.aedb.edb",
"test.xml", "test.txt"
])

ImportODB

Desktop Object Script Commands 5-36


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Use:Import an ODB++ file into a new project.


Command:File > Import > ODB++
Syntax:ImportODB++ <"ODB++filename">, <"OutputEDBfilename>, <"Controlfilename">
Return Value:None
Parameters:<"ODB++filename">
Type: text
Description: name of the ODB++ file to import
<"OutputEDBfilename">
Type: text
Description: name of the EDB file to create during the import.
<"Controlfilename">
Type: text
Description: name of the xml control file to use to guide the import.
This string can be empty ("") if no control file is to be used.
VB Example:
Set oTool = oDesktop.GetTool("ImportExport")
oTool.ImportODB "test.tgz", "test.aedb.edb", "test.xml"

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

UI Access Launch Job Monitor

Name Type Description


Parameters
projectPath: Path to the project file to be monitored

Return Value None

Python LaunchJobMonitor()
Syntax

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

Desktop Object Script Commands 5-37


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Syn- LaunchJobMonitor()
tax

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

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

UI Access File>New

Name Type Description


Parameters
None

Return Value Object, the project that is added.

Python Syn- NewProject()


tax

Python oProject = oDesktop.NewProject()


Example

VB Syntax NewProject
VB Example Set oProject = oDesktop.NewProject

VB Example:
------------------------------------------------------
Example creates a new project.
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects

Desktop Object Script Commands 5-38


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.NewProject

OpenAndConvertProject
Use:Opens a legacy project and converts or copies to .aedt format.
Command:Click File>Open, and choose a legacy project.
Return Value:An object reference to the newly-opened project which has the .aedt extension.
Syntax:OpenAndConvertProject(filePath, legacyChoice)
Parameters:filePath: full path of the legacy project to open
legacyChoice: integer with one of the following values:
0: show conversion dialog box, (same as File>Open of a legacy file)
1: convert, will convert the project/results to project/results with the .aedt extension in the
same directory, the original project will no longer be available
2: copy, will copy the project/results to a new project/results with the .aedt extension in
the same directory, the originals will still be available.

Warning: If project file / results with the same name and .aedt extension already exist in
the same directory, they will be overwritten.
VB Example:
' convert original to OptimTee.aedt
set oProject = oDesktop.OpenAndConvertProject("C:/leg-
acy/OptimTee.hfss", 1)
' create OptimTee.aedt, leave original
set oProject = oDesktop.OpenAndConvertProject("C:/leg-
acy/OptimTee.aedt", 2)

OpenMultipleProjects
Use: Opens all files of a specified type in a specified directory.
Command: Click File>Multiple Open
Syntax: OpenMultipleProjects <Directory> <FileType>

Desktop Object Script Commands 5-39


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Return Value: None


Parameters: <Directory>
Type: <string>
<FileType>
Type: <string>
VB Example:
oDesktop.OpenMultipleProjects "D:/Projects", "*.aedt"

OpenProject
Use: Opens a specified project.
Command: Click File>Open
Syntax: OpenProject <FileName>
Return Value: An object reference to the newly-opened project.
Parameters: <FileName>: Full path of the project to open.
Type: <string>
VB Example:
oDesktop.OpenProject "D:/Projects/Project1.aedt"
VB Example:
------------------------------------------------------
Example opens a specified project.
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()

Desktop Object Script Commands 5-40


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oDesktop.RestoreWindow
oDesktop.OpenProject "E:/helical_antenna.aedt"

Python OpenProject(<Filename>)
Syntax

Python oDesktop.OpenProject("C:/Projects/MyProject.aedt")
Example

Paste (Project Object)


Use:Pastes a design in the active project.

UI Access Edit>Paste

Name Type Description


Parameters
None

Return Value None

Python Syn- Paste()


tax

Python oProject.Paste()
Example

VB Syntax Paste
VB Example oProject.Paste

Example:
------------------------------------------------------
Example Script
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor

Desktop Object Script Commands 5-41


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject()
oProject.CopyDesign "Differential"
oProject.Paste

For Q3D Extractor, the Paste command works as follows:


Use: Pastes copied objects and returns an array of pasted objects from the 3D model editor.
Command: Edit>Paste
Syntax: Paste
Return Value: One dimensional array of pasted object names. The order is not guaranteed to be
alphabetical.
Parameters: None
Example: arrayEntities = oEditor.Paste

Paste (Project Object)


Pastes a design in the active project.

UI Access Edit>Paste

Name Type Description


Parameters
None

Return Value None

Python Syn- Paste()


tax

Python oProject.Paste()
Example

Desktop Object Script Commands 5-42


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Syntax Paste
VB Example oProject.Paste

VB Example:
------------------------------------------------------
Example Script
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject()
oProject.CopyDesign "Differential"
oProject.Paste

For Q3D Extractor the Paste command works as follows:


Pastes copied objects and returns an array of pasted objects from the 3D model editor.
Command: Edit>Paste
Syntax: Paste
Return Value: One dimensional array of pasted object names. The order is not guaranteed to be
alphabetical.
Parameters: None
VB Example: arrayEntities = oEditor.Paste

Desktop Object Script Commands 5-43


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

PauseRecording
Temporarily stop script recording.

UI Access NA

Name Type Description


Parameters
None

Return Value None

Python Syn- PauseRecording()


tax

Python oDesktop.PauseRecording()
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
Tools>Resume Script

UI Access Tools>Pause Script

Name Type Description


Parameters
<Message> String Any Text

Return Value None

Python PauseScript (<Message>)


Syntax

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


Example

Desktop Object Script Commands 5-44


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Syn- PauseScript <Message>


tax

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


Example

VB Example:
------------------------------------------------------
Example pauses a script. Resume script to run it.
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.PauseScript "Script is paused. Click OK to continue"
Set oProject = oDesktop.NewProject
oDesktop.OpenProject "E:/helical_antenna.aedt"

Print
Use: Prints the contents of the active view window.

UI Access File>Print

Name Type Description


Parameters
None

Return Value None

Desktop Object Script Commands 5-45


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Syn- Print()


tax

Python oDesktop.Print()
Example

VB Syntax Print
VB Example oDesktop.Print

VB Example:
------------------------------------------------------
Example prints the contents of the active window.
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.Print

QuitApplication
Exits the desktop.

UI Access File>Exit

Name Type Description


Parameters
None

Return Value None

Desktop Object Script Commands 5-46


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Syn- QuitApplication()


tax

Python oDesktop.QuitApplication()
Example

VB Syntax QuitApplication
VB Example oDesktop.QuitApplication

VB Example:
oDesktop.QuitApplication
------------------------------------------------------
Example : quit an application.
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.QuitApplication

RefreshJobMonitor
For use in monitoring a job.

UI Access Monitor Jobs

Desktop Object Script Commands 5-47


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Name Type Description


Parameters
None

A string specifing the job state. The result could be one of the following strings:
"Monitor Not Visible"
"Queued"
"Running"
Return Value "Shutting Down"
"Unknown"
"Completed"
"Not Monitoring"
"Starting Monitoring"

Python Syn- RefreshJobMonitor()


tax

Python oDesktop.RefreshJobMonitor()
Example

VB Syntax RefreshJobMonitor()
VB Example oDesktop.RefreshJobMonitor()

VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2016.0.0
' 13:12:25 Oct 12, 2015
' ----------------------------------------------
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run """C:\\Program Files\\An-
sysEM\\AnsysEM18.0\\Win64\\ansysedt.exe"" -ng -monitor -batchsolve
c:\\Projects\\basic.aedt"
'WshShell.Run "notepad"
Dim oAnsoftApp

Desktop Object Script Commands 5-48


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.LaunchJobMonitor "c:\\projects\\basic.aedt"
do
a = oDesktop.RefreshJobMonitor()
msg = "state is " + a
oDesktop.AddMessage "", "", 1, a
if a = "Monitor Not Visible" then
exit do
end if
loop
oDesktop.AddMessage "", "", 1, "Done monitoring"

RestoreProjectArchive
Restores a specified project archive to the specified file path.
Command: File>Restore Archive...
Syntax: RestoreProjectArchive <ArchiveFilePath>, <ProjectFilePath>, <OverwriteExistingFiles>,
<OpenProjectAfterRestore>;
Return Value: None
Parameters: <ArchiveFilePath>
Type: string
Archive file path.
<ProjectFilePath>,
Type: string

Desktop Object Script Commands 5-49


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<OverwriteExitingFiles>,
Type: Boolean
Whether to overwriting any existing files during extraction.
<OpenProjectAfterRestore>,
Type Boolean
Whether to open the project in the desktop.
VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2016.0.0
' 9:41:46 Feb 22, 2016
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.RestoreProjectArchive "C:\User-
s\kmchrist\Documents\OptimTee.aedtz", _
"C:\Documents\OptimTee.aedt", false, true

RestoreWindow
Restores a minimized Desktop window.

UI Access NA

Name Type Description


Parameters
None

Return Value None

Desktop Object Script Commands 5-50


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Syn- RestoreWindow()


tax

Python oDesktop.RestoreWindow()
Example

VB Syntax RestoreWindow
VB Example oDesktop.RestoreWindow

oDesktop.RestoreWindow
------------------------------------------------------
Example : restores minimized Desktop window.
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow

ResumeRecording
Resume recording a script.

UI Access NA

Name Type Description


Parameters
None

Return Value None

Desktop Object Script Commands 5-51


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Syn- ResumeRecording()


tax

Python oDesktop.ResumeRecording()
Example

VB Syntax ResumeRecording
VB Example oDesktop.ResumeRecording

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
Parameters string to use the system path.
<WorkPath> String Working directory in which program will start.
< ArgArray> Array of Arguments to pass to the program. If no argu-
Strings ments, pass in None

Return Value None

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


Syntax

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

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


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

Desktop Object Script Commands 5-52


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 spe-
cified, Twin Builder searches for the spe-
cified script in the following locations, in
this order:

1. Personal library directory.

This is the PersonalLib subdirectory in the


project directory. The project directory can be
specified in the General Options dialog box
(click Tools>Options>General Options to
open this dialog box) under the Project
Options tab.

2. User library directory.


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

3. System library directory.

This is the syslib subdirectory in the library dir-


ectory. The library directory can be speci-fied in
the General Options dialog box (click
Tools>Options>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 Syn- RunScript (<ScriptPath>)

Desktop Object Script Commands 5-53


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

tax

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

VB Syntax RunScript <ScriptPath>


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

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

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 locations:

l Personal library directory: "Per-


sonalLib". The PersonalLib directory
can be specified in Tools>Op-
tions>General Options on the 'Project
Options' tab.
Parameters l User library directory: directory "user-
lib". The UserLib directory can be spe-
cified 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.
l Software installation directory
<Arguments> String The arguments to supply to the specified
script.

Long
Return Value
the return code for the script method.

Desktop Object Script Commands 5-54


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Syn- RunScriptWithArguments (<ScriptPath>, <Arguments>)


tax

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

VB Syntax RunScriptWithArguments <ScriptPath>, <Arguments>


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

SelectScheduler
Select the scheduler used for batch job submission. It tries non-graphical selection of the sched-
uler, attempting to get version information from the scheduler in order to check for successful selec-
tion, and if unable to get the information, it then displays the Select Scheduler dialog, waiting for
the user to complete the settings.

UI Access Select Scheduler

Name Type Description


option: String for the string blank for remote RSM service
scheduler to select.
(Not case sensitive.) "RSM" for local RSM
"Windows HPC" for Windows HPC
"LSF" for Load-Sharing Facility
"SGE" for Grid Engine (GE, OGE, SGE,
UGE, etc.)
"PBS" for Portable Batch Scheduler/System
Parameters (PBSPro, Torque, Maui, etc.)
address (optional) string String specifying the IP address or hostname
of the head node (e.g. for Windows HPC), or
for the remote host running the RSM service.
username (optional) string Username string to use for remote RSM ser-
vice (or blank to use username stored in cur-
rent submission host user settings). If the
(non-blank) username doesn't match the
username stored in current submission host
user settings, then the Select Scheduler dia-
log is displayed to allow for password entry
prior to job submission.

Desktop Object Script Commands 5-55


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

forcePasswordEntry string Boolean used to force display of the Select


(optional) Scheduler GUI to allow for password entry
prior to job submission.

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

Python Select Scheduler(option, address, username, forcePasswordEntry)


Syntax

Python result = oDesktop.SelectScheduler("Windows HPC",


Example "headnode.win.example.com")

VB Syntax Select Scheduler(option, address, username, forcePasswordEntry)

VB result = oDesktop.SelectScheduler("Windows HPC",


Example "headnode.win.example.com")

SetActiveProject
Specify the name of the project that should become active in the desktop. Return that project.

UI Access NA

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 SetActiveProject (<ProjectName>)


Syntax

Python oProject = oDesktop.SetActiveProject ("Project1")


Example

VB Syn- SetActiveProject <ProjectName>


tax

VB Set oProject = oDesktop.SetActiveProject ("Project1")

Desktop Object Script Commands 5-56


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Example

Example:
------------------------------------------------------
Example sets an existing project as active.
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Dim lpj
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject ("Project9")
msgbox "Active Project Set to " + oDesktop.GetActiveProject
().GetName()

SetActiveProjectByPath
Specify the name of the project that should become active in the desktop. Return 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 unambiguous specification of the active pro-
ject.

UI Access NA

Name Type Description


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

Return Value Object, the project that is activated.

Desktop Object Script Commands 5-57


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Syn- SetActiveProjectByPath(ProjectName)


tax

oProject = oDesktop.SetActiveProjectByPath
Python
Example ("c:\Projects\MyProject.aedt")

VB Syntax SetActiveProjectByPath(ProjectName)
Set oProject = oDesktop.SetActiveProjectByPath
VB
Example
("c:\Projects\MyProject.aedt")

Example:
------------------------------------------------------
Example sets an existing project as active by path.
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProjectByPath("E:/helical_
antenna.aedt")
msgbox "Active Project Set to " + oDesktop.GetActiveProject
().GetName()

Desktop Object Script Commands 5-58


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 Syn-  SetLibraryDirectory (<DirectoryPath>)


tax

Python oDesktop.SetLibraryDirectory("c:\libraries")
Example

VB Syntax  SetLibraryDirectory <DirectoryPath>


VB oDesktop.SetLibraryDirectory"c:\libraries"
Example

SetProjectDirectory
UI Access NA

Name Type Description


Parameters < DirectoryPath> String The path to the Project directory. This should
be writeable by the user.

Return Value None

Python Syn- SetProjectDirectory (<DirectoryPath>)


tax

Python oDesktop.SetProjectDirectory("c:\projects")
Example

VB Syntax SetProjectDirectory <DirectoryPath>

Desktop Object Script Commands 5-59


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB oDesktop.SetProjectDirectory "c:\projects"
Example

SetTempDirectory
Sets the temp directory path. The directory will be automatically created if it does not already exist.

UI Access NA

Name Type Description


Parameters < DirectoryPath> String The path to the Temp directory. This should
be writeable by the user.

Return Value None

Python Syn- SetTempDirectory (<DirectoryPath>)


tax

Python oDesktop.SetTempDirectory("c:\tmp")
Example

VB Syntax SetTempDirectory <DirectoryPath>


VB Example oDesktop.SetTempDirectory "c:\tmp"

Example:
------------------------------------------------------
Example sets Temp directory path.
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")

Desktop Object Script Commands 5-60


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oDesktop = oAnsoftApp.GetAppDesktop()


oDesktop.RestoreWindow
oDesktop.SetTempDirectory("C:\temp")
msgbox "Temp Directory Set to " + oDesktop.GetTempDirectory()

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 sus-
liseconds> pended in milliseconds

Return Value None

Python Syn- Sleep (<TimeInMilliseconds>)


tax

Python oDesktop.Sleep(1000)
Example

VB Syntax Sleep <TimeInMilliseconds>


VB Example oDesktop.Sleep 1000

SubmitJob
To submit 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(), checking the result of
RefreshJobMonitor() in a loop until it returns completed ("Monitor Not Visible") status.

UI Access Submit Job

Name Type Description


settingsPath: string Path to the settings file (exported from the
Parameters
Submit Job GUI) to use for submission.
projectPath: string Path to the project file to use in the batch job.

Desktop Object Script Commands 5-61


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

This could be an archive (.aedtz 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).

Python SubmitJob(settingsPath, projectPath, design, setup)


Syntax

jobIDs = oDesktop.SubmitJob("C:\\hpc-settings\\Submit_
Job_Settings.areg", "C:\\projects\\basic.aedt"))
Python
moreIDs = oDesktop.SubmitJob("C:\\hpc-settings\\Submit_
Example
Job_Settings.areg", "C:\\projects\\basic.aedt",
"Design1", "Setup1")

VB Syn- SubmitJob(settingsPath, projectPath, design, setup)


tax

jobIDs = oDesktop.SubmitJob("C:\\hpc-settings\\Submit_
Job_Settings.areg", "C:\\projects\\basic.aedt"))
VB
moreIDs = oDesktop.SubmitJob("C:\\hpc-settings\\Submit_
Example
Job_Settings.areg", "C:\\projects\\basic.aedt",
"Design1", "Setup1")

TileWindows
Use: Arrange all open windows in a tiled format.
Command: From main menu, Window>Tile Horizontally or Window>Tile Vertically.
Syntax: TileWindows(<TilingFlag>)TileWindows(<)
Return Value: None
Parameters: <TilingFlag>
Type: <int>
Tile vertically when <TilingFlag> is 0 and horizontally when <TilingFlag> is 1
VB Example:

Desktop Object Script Commands 5-62


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oDesktop.CloseAllWindows()
VB Example:
------------------------------------
Example Script
------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.TileWindows(0)

Python Syn- TileWindows()


tax

Python oDesktop.TileWindows(0)
Example

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 configuration information is stored in this XML file. These
methods allow you to change the product configuration in VB-script or Python script.
For example, to set the DSO & HPC analysis setup for HFSS with Python script:

1. In a PC start HFSS go to the DSO and HPC options dialog, create a setup name it as "test"
2. Export the setup to a file c:\tem\test.acf.
3. Copy the exported file to a target PC f:\temp\test.acf.
4. Run the following script.

#import the setup


oDesktop.SetRegistryFromFile("f:\\temp\\test.acf")

Desktop Object Script Commands 5-63


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

# Set Active Setup to "test"


oDesktop.SetRegistryString("Desktop/ActiveDSOConfigurations/HFSS", "test")

DoesRegistryValueExist
GetRegistryInt
GetRegistryString
SetRegistryFromFile
SetRegistryInt
SetRegistryString
DoesRegistryValueExist
Use: Determine if a registry value exists.
Command: None
Syntax: DoesRegistryValueExist <KeyName>
Return Value: Boolean. True if key exists. False otherwise.
Parameters: <KeyName> - registry key name with the full path.
VB Example:
bExist = oDesktop.DoesRegistryValueExist("Desktop/Act-
iveDSOConfigurations/HFSS")
GetRegistryInt
Use: Obtain RegistryKey integer value.
Command: None
Syntax: GetRegistryIn(<KeyName>)
Return Value: Integer for success, if the integer value is found. Return as Bad-Argument-Value, if
Registry key does not exist or it is not an integer value.
Parameters: <KeyName>
Registry key name with the full path.
VB Example:
num = oDesktop.GetRegistryInt("Desktop/Set-
tings/ProjectOptions/HFSS/UpdateReportsDynamicallyOnEdits")
GetRegistryString
Use: Obtain RegistryKey string value.

Desktop Object Script Commands 5-64


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Command: None.
Syntax: GetRegistryString <KeyName> <PVal>
Return Value: String for success. Bad argument if they key is not defined or has an integer value.
Parameters: <KeyName>
Registry key name with the full path.
VB Example:
activeDSO = oDesktop.GetRegistryString("Desktop/ActiveDSOConfigurations/HFSS")

SetRegistryFromFile
Configures a registry by specifying an Analysis Configuration file which must have been exported
from the HPC and Analysis panel.
Command: None.
Syntax: SetRegistryFromFile "<filePath>"
Return Value: Success if Analysis configuration is imported. Bad argument value if the file is not
found or does not contain valid analysis configuration data.
Parameters: <filePath>
Full path to an Analysis Configuration file.
VB Example:
oDesktop.SetRegistryFromFile "c:/temp/test.acf"
SetRegistryInt
Sets a registry key with an integer value.
Command: None
Syntax: SetRegistryInt "<KeyName>", <int>
Return Value: 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 string.
Parameters: <KeyName>
Registry key name with full path.
<int>
New integer value.
VB Example:

Desktop Object Script Commands 5-65


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oDesktop.SetRegistryInt "Desktop/Set-
tings/ProjectOptions/HFSS/UpdateReportsDynamicallyOnEdits", 0
SetRegistryString
Sets a string value for a specified registry key.
Command: None.
Syntax: SetRegistryString "<KeyPath>" "<val>"
Return Value: Success, if the key is defined as a text string. Bad argument value if the key is not
defined or requires an integer value.
Parameters: <KeyName>
Registry key name with full path.
<val>
New string value.
VB Example:
oDesktop.SetRegistryString "Desktop/ActiveDSOConfigurations/HFSS",
"Local"

Desktop Object Script Commands 5-66


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Project Object Script Commands 6-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

6 - Project Object Script Commands


Project commands should be executed by the oProject object. One example of accessing this
object is:
Set oProject = oDesktop.GetActiveProject()
"AnalyzeAll [project]" on the facing page
ClearMessages
Close
CopyDesign
CutDesign
DeleteDesign
GetActiveDesign
GetDefinitionManager
GetDependentFiles
GetDesign
GetName [Project]
GetPath
GetTopDesignList
InsertDesign
InsertDesignWithWorkflow
Paste
Redo
Rename
Save
SaveAs
SetActiveDefinitionEditor
SetActiveDesign
SimulateAll
Undo
UpdateDefinitions
ValidateDesign

Project Object Script Commands 6-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

AnalyzeAll [project]
Runs the project-level script command from the script, which simulates all solution setups and Opti-
metrics 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

Name Type Description


Parameters
None

Return Value None

Python Syn- AnalyzeAll()


tax

Python oProject.AnalyzeAll()
Example

VB Syntax AnalyzeAll
VB Example oProject.AnalyzeAll

ClearMessages
Clears the Message Window

UI Access NA

Name Type Description


Parameters
None

Return Value None

Python Syn- ClearMessages()


tax

Python oproject.ClearMessages()
Example

Project Object Script Commands 6-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Syntax ClearMessages
VB Example oproject.ClearMessages

Close
Closes the active project. Unsaved changes will be lost.
Command: None
Syntax: Close
Return Value: None
Parameters: None
VB Example:
oProject.Close

CopyDesign
Copies a design

UI Access Edit>Copy

Name Type Description


Parameters
DesignName String Name of the design

Return Value Value

Python Syn- CopyDesign (<DesignName>)


tax

Python oProject.CopyDesign ("HFSSDesign1")


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 in any
Twin Builder project

Project Object Script Commands 6-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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 Syn- CutDesign (<DesignName> )


tax

Python oProject.CutDesign("SimplorerDesign1")
Example

VB Syntax CutDesign <DesignName>


VB Example oProject.CutDesign "SimplorerDesign1"

DeleteDesign
Deletes a specified design in the project.

UI Access Edit>Delete

Name Type Description


Parameters
<DesignName> String The name of the design

Return Value None

Python Syn- DeleteDesign (<DesignName>)


tax

Python oProject.DeleteDesign ("SimplorerDesign2")


Example

Project Object Script Commands 6-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Syntax DeleteDesign <DesignName>


VB oProject.DeleteDesign "SimplorerDesign2"
Example

GetActiveDesign
Returns the design in the active project

Note:

GetActiveDesign will return normally if there are no active objects.

UI Access NA

Name Type Description


Parameters
None

Return Value  The active design

Python Syn- GetActiveDesign()


tax

Python oDesign = oProject.GetActiveDesign()


Example

VB Syntax GetActiveDesign
VB Set oDesign = oProject.GetActiveDesign()
Example

GetDefinitionManager
Obtain the DefinitionManager object.

UI Access NA

Name Type Description


Parameters
None

Return Value Object for the DefinitionManager

Project Object Script Commands 6-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python GetDefinitionManager()
Syntax

Python oDefinitionManager = oProject.GetDefinitionManager()


Example

VB Syn- GetDefinitionManager
tax

VB Set oDefinitionManager = oProject.GetDefinitionManager


Example

GetDependentFiles
Provides a list of the external files referenced in the project, including characteristic (for example,
MDX) and coupled project files; does not include those in <libdir>/Data directories.

UI Access NA

Name Type Description


Parameters
None

Return Value The list of referenced files.

Python Syn- GetDependentFiles()


tax

Python files = oProject.GetDependentFiles()


Example

VB Syntax GetDependentFiles
VB Example files = oProject.GetDependentFiles

VB Example:
files = oProject.GetDependentFiles
for i = 0 to UBound(files)
msgbox files(i)
next

Project Object Script Commands 6-7


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetName [Project]
Obtain the project name

UI Access NA

Name Type Description


Parameters
None

Return Value String, the project name not including the path or extension.

Python Syn- GetName()


tax

Python AddInfoMessage (str(oProject.GetName()))


Example

VB Syntax GetName
VB Example MsgBox oProject.GetName ()

GetPath
Returns the location of the project on disk.

UI Access NA

Name Type Description


Parameters
None

String
Return Value
The path to the project, which does not include the project name.

Python Syn- GetPath()


tax

Python AddInfoMessage(str(oProject.GetPath()))
Example

Project Object Script Commands 6-8


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Syntax GetPath
VB Example MsgBox oProject.GetPath ()

GetTopDesignList
Returns a list of the names of the top-level designs.

UI Access NA

Name Type Description


Parameters
None

Return Value An array of strings that are the names of the top-level designs.

Python Syn- GetTopDesignList()


tax

name_list = oProject.GetTopDesignList()
Python for i in nameL
Example
AddInfoMessage(str(i))

VB Syntax GetTopDesignList
name_list = oProject.GetTopDesignList()
for each i in
VB
Example MsgBox i
Next

InsertDesign
Use: Inserts a new design in the project. In HFSS scripts, the last argument will always be empty.
Command: Project>Insert HFSS Design
Syntax: InsertDesign "HFSS", <DesignName>, <SolutionType>, ""
Return Value: Object
Parameters: <DesignName>
Type: <string>

Project Object Script Commands 6-9


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Name of the new design.

<SolutionType>
Type: <string>
Solution type of the new design. Can be "DrivenModal",
"DrivenTerminal", or "Eigenmode".
VB Example:
Set oDesign = oProject.InsertDesign("HFSS", "HFSSDesign3",_
"DrivenModal", "")

For Insert HFSS Layout Design and Insert Circuit Netlist, the command details are as fol-
lows.
Use: Inserts a new design in the project. In Circuit scripts, the last argument will always be empty.
Command: Project>Insert Circuit Design
Syntax: InsertDesign <DesignType>, <DesignName>, <TechnologyFile>:<SubCircuitID>,""
Return Value: None.
Parameters:
<DesignType>
Type: <string>
Possible Values:
"Circuit", "Nexxim Circuit", "System" , "Nexxim Netlist", "HFSS3D"

<DesignName>
Type: <string>
Name of the new design

<TechnologyFile>:<SubCircuitID>
Type: <string>
The path to the Circuit technology file to be used in this design. Use a pair of empty double quotes
("") for none. <SubCircuitID> is optional and must be preceded by a colon if included along with the
Technology File name. No colon is necessary when the subcircuit ID is omitted.

Project Object Script Commands 6-10


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Example: oProject.InsertDesign "Nexxim Circuit","MyDesigner",


"C:\Program Files\AnsysEM\Designer\"
oProject.InsertDesign "Nexxim Circuit","MyDesigner:12", "C:\Program
Files\AnsysEM\Designer\

For Q3D Extractor the InsertDesign command details are as follows:


Use: Inserts a new design in the project. In Q3D scripts, the last argument will always be empty.
Command: Project>Insert Q3D Extractor Design
Syntax: InsertDesign "Q3D Extractor", <DesignName>, "", ""
Return Value: None
Parameters: <DesignName>
Type: <string>
Name of the new design.
VB Example:
oProject.InsertDesign "Q3D Extractor","Q3DDesign2", "",

For Maxwell the InsertDesign command details are as follows:


Use: Inserts a new design in the project. In Maxwell scripts, the last argument will always be empty.
Command: Project>Insert Maxwell Design
Syntax: InsertDesign <DesignType>, <DesignName>, <SolutionType>, ""
Return Value: None
Parameters: <DesignType>
Type: <string>
Type of design to insert. Can be "Maxwell 2D", "Maxwell 3D", or "RMxprt"
<DesignName>
Type: <string>
Name of the new design.
<SolutionType>
Type: <string>

Project Object Script Commands 6-11


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Solution type of the new design where available types depend upon the DesignType
chosen.

DesignType Available SolutionType


Maxwell 3D "Magnetostatic", "EddyCurrent", "Transient", "Electrostatic", "DCConduction",
"ElectroDCConduction", "ElectricTransient"
Maxwell 2D "Magnetostatic", "EddyCurrent", "Transient", "Electrostatic", "ACConduction",
"DCConduction"
RMxprt "Three-Phase Induction Motor",
"Single-Phase Induction Motor",
"Three-Phase Synchronous Machine",
"Brushless Permanent-Magnet DC Motor",
"Adjust-Speed Synchronous Machine",
"Permanent-Magnet DC Motor",
"Switched Reluctance Motor",
"Line-Start Permanent-Magnet Synchronous Motor",
"Universal Motor",
"DC Machine",
"Claw-Pole Alternator",
"Three-Phase Non-Salient Synchronous Machine"
"Generic Rotating Machine"

InsertDesignWithWorkflow
Inserts a design with a named workflow and returns an IDispatch string.

NA, although Circuit Design has a Show workflow dialog on new design
UI Access
check box in Options.

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)'

Pytho- InsertDesignWithWorkflow(<type>, <workflowName>, <specName>, <fileName>,


n Syn- <libLoc>, <stationeryPath>)
tax

Pytho- oProject.InsertDesignWithWorkflow ("Circuit Design", "Serial


n Design",

Project Object Script Commands 6-12


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"PCIe3 Stressed", "LongChannel", "SysLib",


Exam- "C:\Program Files\AnsysEM\AnsysEM19.5\Win64\syslib\MS - RT_
ple duroid 6010 (Er=10.2)
0.010 inch, 0.5 oz copper.asty")

VB InsertDesignWithWorkflow (<type>, <workflowName>, <specName>, <fileName>,


Syn- <libLoc>, <stationeryPath>)
tax

oProject.InsertDesignWithWorkflow "Circuit Design", "Serial


Design", _
VB "PCIe3 Stressed", "LongChannel", "SysLib", _
Exam-
ple "C:\Program Files\AnsysEM\AnsysEM19.5\Win64\syslib\MS - RT_
duroid 6010 (Er=10.2" & _
") 0.010 inch, 0.5 oz copper.asty"

VB Example
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2019.2.0
' 17:50:12 Mar 04, 2019
' ----------------------------------------------
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("Project28")
oProject.InsertDesignWithWorkflow "Circuit Design", "Serial Design", _
"PCIe3 Stressed", "LongChannel", "SysLib", _

Project Object Script Commands 6-13


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"C:\Program Files\AnsysEM\AnsysEM19.5\Win64\syslib\MS - RT_duroid 6010 (Er=10.2" & _


") 0.010 inch, 0.5 oz copper.asty"

Paste (Project Object)


Pastes a design in the active project.

UI Access Edit>Paste

Name Type Description


Parameters
None

Return Value None

Python Syn- Paste()


tax

Python oProject.Paste()
Example

VB Syntax Paste
VB Example oProject.Paste

VB Example:
------------------------------------------------------
Example Script
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")

Project Object Script Commands 6-14


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oDesktop = oAnsoftApp.GetAppDesktop()


oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject()
oProject.CopyDesign "Differential"
oProject.Paste

For Q3D Extractor the Paste command works as follows:


Pastes copied objects and returns an array of pasted objects from the 3D model editor.
Command: Edit>Paste
Syntax: Paste
Return Value: One dimensional array of pasted object names. The order is not guaranteed to be
alphabetical.
Parameters: None
VB Example: arrayEntities = oEditor.Paste

Redo [Project Level]


Reapplies the last project-level command.

UI Access Edit>Redo

Name Type Description


Parameters
None

Return Value None

Python Syn- Redo()


tax

Python oProject.Redo()
Example

VB Syntax Redo
VB Example oProject.Redo

Project Object Script Commands 6-15


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Rename
Renames the project and saves it. Similar to SaveAs, except SaveAs requires a path.

UI Access Edit>Rename

Name Type Description


<NewName> String The desired name of the project. The path is
Parameters optional.
<OverWriteOk> Boolean Whether to overwrite the same named file on
disk if it exists. True to overwrite.

Return Value None

Python Rename (<NewName>,<OverWriteOK>)


Syntax

Python oProject.Rename("c:\projects\MyProject.aedt", True)


Example

VB Syn- Rename <NewName>,<OverWriteOK>


tax

VB oProject.Rename "c:\projects\MyProject.aedt", true


Example

RestoreProjectArchive
Restores a specified project archive to the specified file path.
Command: File>Restore Archive...
Syntax: RestoreProjectArchive <ArchiveFilePath>, <ProjectFilePath>, <OverwriteExistingFiles>,
<OpenProjectAfterRestore>;
Return Value: None
Parameters: <ArchiveFilePath>
Type: string
Archive file path.
<ProjectFilePath>,
Type: string
<OverwriteExitingFiles>,

Project Object Script Commands 6-16


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Type: Boolean
Whether to overwriting any existing files during extraction.
<OpenProjectAfterRestore>,
Type Boolean
Whether to open the project in the desktop.
VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2016.0.0
' 9:41:46 Feb 22, 2016
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.RestoreProjectArchive "C:\User-
s\kmchrist\Documents\OptimTee.aedtz", _
"C:\Documents\OptimTee.aedt", false, true

Save
Saves the active project.

UI Access File>Save

Name Type Description


Parameters
None

Return Value None

Project Object Script Commands 6-17


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Syn- Save()


tax

Python oProject.Save()
Example

VB Syntax Save
VB Example oProject.Save

SaveAs
Saves the project under a new name. Similar to Rename except SaveAs requires a path.

UI Access File>Save As

Name Type Description


< NewName> String The desired name of the project, with dir-
Parameters ectory and extension.
< OverWriteOK> Boolean Whether to overwrite the same-named file on
disk, if it exists. True to overwrite.

Return Value None

Python SaveAs <NewName> <OverWriteOK>


Syntax

Python oProject.SaveAs("D:/projects/project1.aedt", true)


Example

VB Syntax SaveAs <NewName> <OverWriteOK>


VB oProject.SaveAs "D:/projects/project1.aedt", true
Example

For Schematic and Layout editor related projects SaveAs functions as follows.
Use: Saves the project under a new name.
Command: File > Save As
Syntax: SaveAs <FileName> <OverWrite> <DefaultAction> <OverrideActions>
Return Value: None

Project Object Script Commands 6-18


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Parameters:
<FileName>
Type: <string>
New name for the file

<OverWrite>
Type: <bool>
Set to true if an existing project by that name should be overwritten
<DefaultAction>
Type: <string>
Set to one of the following action strings: ef_overwrite , ef_copy_no_overwrite, ef_
make_path_absolute or empty string

<OverrideActions>
Type: Array("Name: OverrideActions", <Files>, <Files>, ...)
<Files>
Type: Array("Name: <Action>", <FileName>, <FileName>, ...)

<DAction>
Type: <string>
Set to one of the following action strings: ef_overwrite , ef_copy_no_overwrite, ef_
make_path_absolute or empty string

VB Example:
oProject.SaveAs
"F:\Designer Projects\TA33097\HighSpeedChannel.aedt", true, "ef_over-
write", Array("NAME:OverrideActions",
Array("NAME:ef_copy_no_overwrite", Array("NAME:Files","$PROJECTDIR/-
circuit_models.inc")),
Array("NAME:ef_make_path_absolute", Array
("NAME:Files","$PROJECTDIR\SL_6s.sp")))

Project Object Script Commands 6-19


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Note:

The Action and DefaultAction strings correspond to the following actions:

• ef_overwrite — Copy File to New Project Directory and Overwrite

• ef_copy_no_overwrite — Copy File to New Project Directory and Don't Overwrite

• ef_make_path_absolute — Change Reference to Point to File in Old Project Directory

• empty string — Do Nothing

The DefaultAction is applied to all files that are NOT explicitly listed in the OverrideActions
array. Those in the OverrideActions array are separate arrays for actions that are dif-
ferent from the default action; those actions are applied to the files listed in the same
array:

• If OverrideActions are not specified, then DefaultAction is applied to ALL files in project
directory.

• If DefaultAction is not specified, then nothing is done (action is Do Nothing).

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 Whether to include external files asso-
ciated with the project, True or False
Parameters <IncludeResultsFiles> Boolean Whether to Iinclude simulation files asso-
ciated with the project, True or False
<AdditionalFiles> Array Whether to include additional specified
files
<ArchiveNotes> String A descriptive string about the archive

Return Value None

Pyth- SaveProjectArchive (<archivefilepath>, <IncludeExternalFiles>, <IncludeResultsFiles>,

Project Object Script Commands 6-20


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

on <AdditionalFiles>,<ArchiveNotes>)
Syn-
tax

Pyth- oProject.SaveProjectArchive("C:\\User-
on s\\Documents\\Ansoft\\Project27.aedtz", True, False, [], "")
Exa-
mpl-
e

VB oSaveProjectArchive (path>, <IncludeExternalFiles>, <IncludeResultsFiles>, <Addi-


Syntax tionalFiles>,<ArchiveNotes>)

VB
oProject.SaveProjectArchive "C:\Documents\OptimTee.aedtz",
Examp- true, _
le false, Array(), "My notes"

VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2016.0.0
' 9:41:46 Feb 22, 2016
' ----------------------------------------------
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("OptimTee")
oProject.Save
oProject.SaveProjectArchive "C:\\Documents\OptimTee.aedtz", true, _
false, Array(), "My notes"

Project Object Script Commands 6-21


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

SetActiveDefinitionEditor
Obtain a particular definition editor.

UI Access NA

Name Type Description


< EditorName> String Name of the definition editor to set
active, one of:
Parameters "SymbolEditor"
"FootprintEditor"
< DefinitionName> String The combination name for the symbol or foot-
print, < libname>:< defname>

Return Value Object for the definition to be edited.

Python SetActiveDefinitionEditor (<EditorName>, <DefinitionName>)


Syntax

oSymbolEditor=oProject.SetActiveDefinitionEditor("Sym-
Python bolEditor",
Exampl- "Simplorer Elements\Basic Elements\Circuit\Passive Ele-
e
ments:R")

VB SetActiveDefinitionEditor <EditorName>, <DefinitionName>


Syntax

Set oSymbolEditor = oProject. SetActiveDefinitionEditor


VB ("SymbolEditor",_
Exam-
ple "Simplorer Elements\Basic Elements\Circuit\Passive Ele-
ments:R")

SetActiveDesign
Sets a new design to be the active design. Specify the name of the design that should become act-
ive and return that design.

UI Access NA

Parameters Name Type Description

Project Object Script Commands 6-22


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<DesignName> String Name of the design to set as the active


design.

Return Value Object for the specified design .

Python SetActiveDesign (<DesignName>)


Syntax

Python oDesign = oProject.SetActiveDesign("SimplorerDesign2")


Example

VB Syn- SetActiveDesign <DesignName>


tax

VB Set oDesign = oProject.SetActiveDesign ("SimplorerDesign2")


Example

SimulateAll
Runs the SimulateAll project-level script command from the script, which will simulate all solution
setups and Optimetrics setups for all design instances in the project. Script processing only con-
tinues when all analyses are finished.

UI Access NA

Name Type Description


Parameters
None

Return Value None

Python Syn- SimulateAll()


tax

Python oProject.SimulateAll()
Example

VB Syntax SimulateAll
VB Example oProject.SimulateAll

Project Object Script Commands 6-23


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Undo [Project]
Cancels the last project-level command.

UI Access Edit>Undo

Name Type Description


Parameters
None

Return Value None

Python Syn- Undo()


tax

Python oProject.Undo()
Example

VB Syntax Undo
VB Example oProject.Undo

UpdateDefinitions
Updates all definitions. Warning messages are sent to the message window when definitions can't
be found, informational messages when definitions are updated.

The script method performs the same as if you ran Tools/Pro-


UI Access jectTools/Update Definitions (the dialog default is to list "newer" definitions),
then clicked Select All and then Update.

Name Type Description


Parameters
None

Return Value None

Python Syn- UpdateDefinitions()


tax

Python oProject.UpdateDefinitions()
Example

Project Object Script Commands 6-24


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Syntax UpdateDefinitions
VB Example oProject.UpdateDefinitions

Project Object Script Commands 6-25


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

PDF layout 6-26


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Material Script Commands 7-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

7 - Material Script Commands


Material commands other than the DoesMaterialExist command should be executed by the oPro-
ject object. The DoesMaterialExist command is executed by the oDefinitionManager object. Mater-
ial commands apply to all products.
Set oProject = oDesktop.SetActiveProject("Project1")
oProject.CommandName <args>

AddMaterial
CloneMaterial
DoesMaterialExist
EditMaterials
ExportMaterial
RemoveMaterial

AddMaterial
Adds a local material.
Command: Add Material command in the material editor .
Syntax: AddMaterial Array("NAME:<MaterialName>",
<MatProperty>, <MatProperty>, ...)
Return Value: None
Parameters: <MatProperty> (simple material)
"<PropertyName>:=", <value>

<MatProperty> (anisotropic material)


Array("NAME:<PropertyName>",
"property_type:=", "AnisoProperty",
"unit:=", <string>",
"component1:=", <value>,
"component2:=", <value>,
"component3:=", <value>))

Material Script Commands 7-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<PropertyName>
Type: <string>
Should be one of the following: "permittivity",
"permeability", "conductivity"
"dielectric_loss_tangent",
"magnetic_loss_tangent", "saturation_mag",
"lande_g_factor", "delta_H"

property_type
Type: <string>
Should be "AnisoProperty".

unit
Type: <string>
Possible values:
delta_H: "Oe"
saturation_mag: "Gauss", "uGauss", "Tesla", "uTesla"
other properties: "" (empty string)
VB Example:
Set oDefinitionManager = oProject.GetDefinitionManager()
oDefinitionManager.AddMaterial Array("NAME:Material2",_
"dielectric_loss_tangent:=", "44",
Array("NAME:saturation_mag",_
"property_type:=", "AnisoProperty",_
"unit:=", "Gauss",_
"component1:=", "11", _
"component2:=", "22", _
"component3:=", "33"), _
"delta_H:=", "44Oe")

Material Script Commands 7-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

An example related to Q3D Extractor is given below.


VB Example: oProject.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")

Python Syn- AddMaterial (["NAME:<MaterialName>",


tax
<MatProperty>, <MatProperty>, ...])

Python oDefinitionManager.AddMaterial(
Example ["permittivity:=", "2.2", "0.002"])

EditMaterial
Modifies an existing material.

UI Access View/Edit Materials command in the material editor

Name Type Description


Parameters <OriginalName> String Name of the material before editing
<NewName> String New name for the material

Return Value None

Python  EditMaterial (<OriginalName>, "NAME:<NewName>",


Syntax
<MatProperty>, <MatProperty>, ...)
oDefinitionManager.EditMaterial("alumina_92pct",
[
Python
Example "NAME:alumina_92pct",
"CoordinateSystemType:=", "Cartesian",

Material Script Commands 7-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"BulkOrSurfaceType:=" , 1,
[
"NAME:PhysicsTypes",
"set:=" , ["Electromagnetic","Thermal","Structur
],
"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"
])

VB Syn-  EditMaterial <OriginalName>, Array("NAME:<NewName>",


tax
<MatProperty>, <MatProperty>, ...)
oDefinitionManager.EditMaterial("alumina_92pct",
Array(
"NAME:alumina_92pct",
"CoordinateSystemType:=", "Cartesian",
"BulkOrSurfaceType:=", 1,
VB
Array("NAME:PhysicsTypes",
Exampl-
e "set:=", Array("Elec-
tromagnetic","Thermal","Structural")),
"permittivity:=", "9.3",
"dielectric_loss_tangent:=", "0.008",
"thermal_conductivity:=", "26",
"mass_density:=", "3720",

Material Script Commands 7-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"specific_heat:=", "790",
"youngs_modulus:=", "267000000000",
"poissons_ratio:=", "0.26",
"thermal_expansion_coeffcient:=", "7.2e-006"
))

ExportMaterial
Exports a local material to a library.

UI Access Export to Library command in the material editor

Name Type Description


<ExportData> Array Array("NAME:<LibraryName>",
Parameters
<MaterialName>, <MaterialName>,
...)

Return None
Value

Python ExportMaterial (<ExportData>, <Library location>)


Syntax

oDefinitionManager.ExportMaterial (["NAME:mo0907b",_
Python
Example "Material1", "Material2", "Material3"], "UserLib")

VB Syn- ExportMaterial <ExportData>, <Library location>


tax

VB
oDefinitionManager.ExportMaterial Array("NAME:mo0907b",_
Example "Material1", "Material2", "Material3"), "UserLib"

RemoveMaterial
Use: Removes a material from a library.
Command: Remove Material(s) command in the material editor .

Material Script Commands 7-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 (or )assumes the material is a
project material. In this case, the last two para-
Parameters meters will be ignored.
<LibraryName> String The name of the user or personal library
where the material resides.
<LibraryLocation> String Should be "UserLib" or "Per-
sonalLib".

Return Value None

Python Syn- RemoveMaterial (<MaterialName>, <IsProjectMaterial>,


tax
<LibraryName>, <LibraryLocation>)

Python oDefinitionManager.RemoveMaterial ([
Example "Material1", false, "mo0907","UserLib"])

RemoveMaterial <MaterialName>, <IsProjectMaterial>,


VB Syntax
<LibraryName>, <LibraryLocation>
oDefinitionManager.RemoveMaterial
VB Example
"Material1", false, "mo0907","UserLib"

Material Script Commands 7-7


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

PDF layout 7-8


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Property Script Commands 8-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

8 - Property Script Commands


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
GetProperties
GetPropertyValue
GetArrayVariables
GetVariables
SetPropertyValue
SetVariableValue
Additional Property Scripting Example
Example Use of Record Script and Edit Properties

Conventions Used in this Chapter


l Property

Refers to a single item that can be modified in the dockable Properties dialog box or in
the modal Properties pop-up window.

l <PropServer>

Refers to the item whose properties are being modified. This is usually a compound
name giving all the information needed by the editor, design, or project to locate the item
being edited.

l <PropTab>

Corresponds to one tab in the Property dialog box – the tab under which properties are
being edited.

l <PropName>

Name of a single property .

<PropServer> and <PropTab> Names

Property Script Commands 8-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Project
Project Variables:
<PropServer>
"ProjectVariables"

<PropTab>
"ProjectVariableTab"

AnsoftHfss, Maxwell Design. Design, and Q3D Extractor Design


Local Variables:
<PropServer>
"LocalVariables"

<PropTab>
"LocalVariableTab"
Passed Parameters
<PropServer>
"Instance:<name of circuit instance>"
<PropTab>
"PassedParameter Tab"
Definition Parameters
<PropServer>
"DefinitionParameters"
<PropTab>
"DefinitionParameters"
Modules and Editors
<PropServer>
Format is: <ModuleName>:<ItemName>, where <ItemName> is the
boundary name, solution setup name, etc., depending on which module
is being edited.

Property Script Commands 8-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Example: <PropServer> for the boundary "PerfE1" is


"BoundarySetup:PerfE1"

<PropTab>
Boundary module: "HfssTab"
Mesh Operations module: "MeshSetupTab"
Analysis module: "HfssTab"
Optimetrics module: "OptimetricsTab"
Solutions module: Does not support properties.
Field Overlays module: "FieldsPostProcessorTab"
Radiation module: "RadFieldSetupTab"
Circuit module: "CCircuitTab"
System module: "SystemTab"
HFSS 3D Layout module: "HFSS 3D LayoutTab"
Nexxim module: "NexximTab"
Layout elements: "BaseElementTab"
Schematic elements: "ComponentTab"
Optimetrics module: "OptimetricsTab"

3D Model Editor
Object in the module:
<PropServer>
Name of the object. For example: "Box1".

<PropTab>
"Geometry3DAttributeTab"

Operation on an object:
<PropServer>
Format is <ObjName>:<OperationName>:<int>

Property Script Commands 8-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Concatenation of object name, operation name, and the index of the operation.
For example: "Box2:CreateBox:2" refers to the second
"CreateBox" command in Box2’s history.

<PropTab>
"Geometry3DCmdTab"

Reporter
Operations on Report properties:
Format is <ReportSetup>
For example, to set the Company Name in the plot header to "My Company":
Set oModule = oDesign.GetModule("ReportSetup")
oModule.ChangeProperty Array("NAME:AllTabs",_ Array
("NAME:Header",_ Array("NAME:PropServers",_
"XY Plot1:Header"), Array("NAME:ChangedProps",_ Array("NAME:Com-
pany Name", "Value:=", "My Company"))))

Q3D Extractor Modules


<PropServer>
Format is: <ModuleName>:<ItemName>, where <ItemName> is the solu-
tion setup name, etc., depending on which module is being edited.
<PropTab>
Boundary module: "Q3D ExtractorTab" or "2D ExtractorTab"
Mesh Operations module: "MeshSetupTab"
Analysis module: "Q3D ExtractorTab" or "2D ExtractorTab"
Optimetrics module: "OptimetricsTab"
Solutions module: Does not support properties.
Field Overlays module: "FieldsPostProcessorTab"
Maxwell Modules
<PropServer>

Property Script Commands 8-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Format is: <ModuleName>:<ItemName>, where <ItemName> is the solu-


tion setup name, etc., depending on which module is being edited.

Example: <PropServer> for the boundary "PerfE1" is "Bound-


arySetup:PerfE1"

<PropTab>
Boundary module: "MaxwellTab"
Mesh Operations module: "MeshSetupTab"
Analysis module: "MaxwellTab"
Optimetrics module: "OptimetricsTab"
Solutions module: Does not support properties.
Field Overlays module: "FieldsPostProcessorTab"
Radiation module: "RadFieldSetupTab"

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.

GetArrayVariables
Use: Returns a list of array variables. To get a list of indexed Project variables, execute this com-
mand using oProject. To get a list of indexed local variables, use oDesign.
Syntax: GetArrayVariables()
Return Value: Variant array of strings – the names of the array variables.
VB Example:
Dim var_array
project_var_array = oProject.GetArrayVariables()
local_var_array = oDesign.GetArrayVariables()

Property Script Commands 8-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 NA

Name Type Description


<propTab> String One of the following, where tab titles
are shown in parentheses:
PassedParameterTab ("Parameter
Values")
DefinitionParameterTab (Para-
meter Defaults")
LocalVariableTab ("Variables" or
"Local Variables")
ProjectVariableTab ("Project vari-
ables")
Parameters
ConstantsTab ("Constants")
BaseElementTab ("Symbol" or
"Footprint")
ComponentTab ("General")
CustomTab ("Intrinsic Variables")
Quantities ("Quantities")
Signals ("Signals")
<propServer> String An object identifier, generally returned from
another script method, such as Comp-
Inst@R;2;3

Return Value Array of strings, the names of the appropriate properties.

Python GetProperties( <propTab>, <propServer> )


Syntax

selectionArray = oEditor.GetSelections()
for k in selectionArray:
Python
Example props = oEditor.GetProperties("PassedParameterTab",k)
...

Property Script Commands 8-7


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Syn- GetProperties( <propTab>, <propServer> )


tax

selectionArray = oEditor.GetSelections
for each k in selectionArray
VB
props = oEditor.GetProperties("PassedParameterTab",k)
Example
...
next

VB Example:
Dim all_props
all_props = oDesign.GetProperties("HfssTab",_
"BoundarySetup:WavePort1")

VB Example: Dim all_props


all_props = oDesign.GetProperties("BaseElementTab",_
"rect_1")

VB Example: Dim all_props


all_props = oDesign.GetProperties("Q3DTab",_
"BoundarySetup:Source1")

GetPropertyValue
Gets the value of a single property belonging to a specific serverName and PropTab. This function
is available with the Project, Design or Editor objects, including definition editors.
Use the script recording feature and edit a property, and then view the resulting script to
see the format for that property.

UI Access NA

Name Type Description


<propTab> String One of the following, where tab titles
Parameters are shown in parentheses:
PassedParameterTab ("Parameter

Property Script Commands 8-8


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Values")
DefinitionParameterTab (Para-
meter Defaults")
LocalVariableTab ("Variables" or
"Local Variables")
ProjectVariableTab ("Project vari-
ables")
ConstantsTab ("Constants")
BaseElementTab ("Symbol" or
"Footprint")
ComponentTab ("General")
CustomTab ("Intrinsic Variables")
Quantities ("Quantities")
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.

Return Value  String, the value of the property.

Python GetPropertyValue (<propTab>, <serverName>, <propName>)


Syntax

selectionArray = oEditor.GetSelections()
for k in selectionArray:
Python
Exampl- val = oEditor.GetPropertyValue("PassedParameterTab", k,
e "R")
...

VB GetPropertyValue (<propTab>, <serverName>, <propName>)


Syntax

VB selectionArray = oEd-
Examp- itor.GetSelections
le

Property Script Commands 8-9


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

for each k in selectionArray

val = oEditor.GetPropertyValue("PassedParameterTab", k,
"R")

...

next

Python Syn- GetPropertyValue ([ <array>])


tax

oModule = oDesign.GetModule("ReportSetup")
Python
Example oModule.GetPropertyValue("Trace", "S Parameter Plot
1:dB(S(1,1))","Y Axis")

VB Example:
value_string = _
oEditor.GetPropertyValue("Geometry3DCmdTab",_
"Box1:CreateBox:1", "XSize")

VB Example:value_string = _
oEditor.GetPropertyValue("BaseElementTab",_
"rect_1", "Name")

Example: (Query frequency and excitation)


freq = oDesign.GetPropertyValue("General", "AnalysisSetup:Setup1",
"Adaptive Freq")
sigType = oDesign.GetPropertyValue("Q3D", "BoundarySetup:via_1",
"Type")
sourceType = oDesign.GetPropertyValue("Q3D", "Bound-
arySetup:Source1", "Type")

Property Script Commands 8-10


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Example: (Query Trace values in a specified report)


oModule = oDesign.GetModule("ReportSetup")
oModule.GetPropertyValue("Trace", "S Parameter Plot 1:dB(S(1,1))","Y
Axis")

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 NA

Name Type Description


Parameters
None

Return Value Variant array of strings – the names of the variables.

Python Syn- GetVariables ()


tax

project_var_array = oProject.GetVariables()
Python
Example local_var_array = oDesign.GetVariables()

VB Syntax GetVariables ()

VB project_var_array = oProject.GetVariables()
Example local_var_array = oDesign.GetVariables()

GetVariableValue
Gets the value of a single variable. To get the value of Project variables, execute this command
using oProject. To get the value of local variables, use oDesign.

UI Access NA

Name Type Description


Parameters
<VarName> String Name of the variable to access

String
Return Value
A string representing the value of the variable.

Property Script Commands 8-11


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Syn- GetVariableValue(  <


  VarName> )
tax

Python oProject.GetVariableValue("var_name")
Example

VB Syntax GetVariableValue(  <
  VarName> )
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 sup-
ported 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 NA

Name Type Description


<propTab> String One of the following, where tab titles
are shown in parentheses:
PassedParameterTab ("Parameter
Values")
DefinitionParameterTab (Para-
meter Defaults")
LocalVariableTab ("Variables" or
"Local Variables")
Parameters
ProjectVariableTab ("Project vari-
ables")
ConstantsTab ("Constants")
BaseElementTab ("Symbol" or
"Footprint")
ComponentTab ("General")
CustomTab ("Intrinsic Variables")
Quantities ("Quantities")

Property Script Commands 8-12


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 SetPropertyValue (<propTab>, <propServer>, <propName>, <propValue>)


Syntax

selectionArray=oEditor.GetSelections()
for k in selectionArray:
...#filter for resistors
Python
Example oEditor.SetPropertyValue("PassedParameterTab",
k, "R", "2200")
...

VB Syn- SetPropertyValue (<propTab>, <propServer>, <propName>, <propValue>)


tax

selectionArray=oEditor.GetSelections
for each k in selectionArray
...'filter for resistors
VB
oEditor.SetPropertyValue("PassedParameterTab",
Example
k, "R", "2200")
...
next

VB Example: oEditor.SetPropertyValue _
"Geometry3DCmdTab","Box1:CreateBox:1",_
"XSize", "3mm"

Property Script Commands 8-13


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Example: oEditor.SetPropertyValue _
"BaseElementTab","rect_1",_
"LineWidth", "3mm"

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 NA

Name Type Description


Parameters
<VarValue> Value New value for the variable.

Return Value None

Python Syn- SetVariableValue (<VarName>, <VarValue>)


tax

Python oProject.SetVariableValue ("$Var1", "3mm")


Example

VB Syntax SetVariableValue <VarName>, <VarValue>


VB oProject.SetVariableValue "$Var1", "3mm"
Example

Property Script Commands 8-14


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Dataset Script Commands 9-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

9 - Dataset Script Commands


Dataset commands should be executed by the oProject object:
Set oProject = oDesktop.SetActiveProject("Project1")
oProject.CommandName <args>

AddDataSet
DeleteDataSet
EditDataSet
ImportDataSet

AddDataset
Adds a dataset.

UI Access Add command in the Datasets dialog box. Project>Datasets>Add

Name Type Description


<DatasetDataArray> Array Array("NAME:<DatasetName>",
Array("NAME:Coordinates", <Coordin-
ateArray>,
Parameters
<CoordinateArray>, ...)
<DatasetName> String Name of the dataset
<CoordinateArray> Array Array("NAME:Coordinate", "X:=", <double>,
"Y:=",<double>)

Return Value None

Python Syn- AddDataset <DatasetDataArray>


tax

oProject.AddDataset(
Python
[
Example
"NAME:$ds1",

Dataset Script Commands 9-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

[
"NAME:Coordinates",
[
"NAME:Coordinate",
"X:=", 2,
"Y:=", 4
],
[
"NAME:Coordinate",
"X:=", 6,
"Y:=", 8
]
]
])

VB Syntax AddDataset <DatasetDataArray>


oProject.AddDataset
Array("NAME:ds1",_
Array("NAME:Coordinates",_
VB
Array("NAME:Coordinate", "X:=", 1, "Y:=", 2,_
Example
Array("NAME:Coordinate", "X:=", 3, "Y:=", 4),_
Array("NAME:Coordinate", "X:=", 5, "Y:=", 7),_
Array("NAME:Coordinate", "X:=", 6, "Y:=", 20)))

DeleteDataset
Deletes the specified dataset.

UI Access Remove command in the Datasets dialog box.

Parameters Name Type Description

Dataset Script Commands 9-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<DatasetName> String Name of the dataset found in the project

Return Value None

Python Syn- DeleteDataset (<DatasetName>)


tax

Python oProject.DeleteDataset("$ds1")
Example

VB Syntax DeleteDataset <DatasetName>


VB Example oProject.DeleteDataset "$ds1"

EditDataset
Modifies a dataset. When a dataset is modified, its name as well as its data can be changed.

UI Access Edit command in the Datasets dialog box

Name Type Description


Parameters
<OriginalName> String Name of the dataset before editing.

Return Value None

Python EditDataset (<OriginalName> <DatasetDataArray>)


Syntax

oProject.EditDataset ("ds1" ["NAME:ds2",_


["NAME:Coordina
Python
Example "X:=", 1, "Y:="
"X:=", 3, "Y:=", 4]]])

VB Syn- EditDataset <OriginalName> <DatasetDataArray>


tax

VB oProject.EditDataset "ds1" Array("NAME:ds2",_


Example

Dataset Script Commands 9-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:Coor

"X:=", 1, "Y:=",
"X:=", 3, "Y:=", 4)))

ImportDataset
Imports a dataset from a named file.

UI Access Import command in the Datasets dialog box.

Name Type Description


Parameters <datasetFileFullPath> String The full path to the file containing the data-
set values.

Return Value None

Python Syn- ImportDataset (<datasetFileFullPath>)


tax

Python oProject.ImportDataset ("e:\tmp\dsdata.txt")


Example

VB Syntax ImportDataset <datasetFileFullPath>


VB oProject.ImportDataset ("e:\tmp\dsdata.txt")
Example

VB Example:
Set oProject = oDesktop.SetActiveProject("OptimTee")
oProject.ImportDataset "F:/work/BSR_1_dk.tab"

Where BSR_1_dk.tab contains a numbered list of tab separated data:

1 18.5
2 18.5
3 18.5
4 18.5

Dataset Script Commands 9-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

5 18.5
6 18.5
...
In the case of Q3D Extractor, the ImportDataset command details are as follows.
Imports a dataset.
Command: Project>Datasets>Import
Syntax: ImportDataset <DatasetFileFullPath>
Return Value: None
Parameters: <DatasetFileFullPath>
Type: <string>
The full path to the file containing the dataset values.
VB Example: oProject.ImportDataset ("e:\tmp\dsdata.txt")

Dataset Script Commands 9-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Design Object Script Commands 10-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

10 - Design Object Script Commands


Design object commands should be executed by the oDesign object.
oDesign.CommandName <args>
Another example is as follows:
Set oDesign = oProject.SetActiveDesign("Q3DExtractorDesign1")
oDesign.CommandName <args>
Conventions Used in this Chapter
<ModuleName>
Name used to access one of the following modules:

l Boundary module: "BoundarySetup"


l Mesh Operations module: "MeshSetup"
l Analysis module: "AnalysisSetup"
l Optimetrics module: "Optimetrics"
l Solutions module: "Solutions"
l Field Overlays module: "FieldsReporter"
l Radiation module: "RadField"

ApplyMeshOps
Analyze
AnalyzeDistributed
ConstructVariationString
DeleteVariation
DeleteFieldVariation
DeleteFullVariation
DeleteLinkedDataVariation
EditDesignSettings
ExportConvergence
ExportMeshStats
ExportProfile
GenerateMesh

Design Object Script Commands 10-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetDesignType
GetModule
GetName
GetNominalVariation
GetSelections
GetSolutionType
GetSolveInsideThreshold
GetSourceContexts
GetVariationVariableValue
PasteDesign
Redo
RenameDesignInstance
ResetToTimeZero
SetActiveEditor
SetDesignSettings
SetSolveInsideThreshold
SetSourceContexts
Solve
RunToolkit
Undo

ConstructVariationString
Lists and orders the variables and values associated with a design variation.
Command: None
Syntax: ConstructVariationString(<ArrayOfVariableNames>, <ArrayOfVari-
ableValuesIncludingUnits>)
Return Value: Returns variation string with the variables ordered to correspond to the order of vari-
ables in design variations. The values for the variables are inserted into the variation string.
Parameters: <ArrayOfVariableNames>
Type: string
<ArrayOfVariableValuesIncludingUnits>

Design Object Script Commands 10-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Type: string
VB Example:
varstring = oDesign.ConstructVariationString(Array("x_size", "y_
size"), Array("2mm", "1mm"))

Python ConstructVariationString(<ArrayOfVariableNames>, <ArrayOfVari-


Syntax ableValuesIncludingUnits>)

Python oDesign.ConstructVariationString(Array("x_size",
Example "y_size"), Array("2mm", "1mm"))

DeleteFieldVariation
Delete Field variations, field and mesh, or just field.
Command: [Solver]>Results>Clean Up Solutions
Syntax: DeleteFieldVariation [All | Array(<parameters>)], boolean, boolean, [boolean]
Return Value: None
Parameters: All
Deletes all Field and mesh variations
Array(<parameters>)
Deletes specified variation
boolean

VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2015.0.0
' 9:42:08 Oct 22, 2014
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor

Design Object Script Commands 10-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
oDesign.DeleteFieldVariation "All", true, false
VB Example:

' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2015.0.0
' 9:51:41 Oct 22, 2014
' ----------------------------------------------
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("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
oDesign.DeleteFieldVariation Array("offset=" & Chr(39) &
"0.0947046688081817in" & Chr(39) & ""), _
true, false

Python Syn- DeleteFieldVariation ([All | Array(<parameters>)], boolean, boolean, [boolean])


tax

Design Object Script Commands 10-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python oDesign.DeleteFieldVariation Array[("offset=" & Chr(39)


Example & "0.0947046688081817in" & Chr(39) & ""), True, False])

DeleteFullVariation
Use: Use to selectively make deletions or delete all solution data.
Command: [solver]>Results>Clean Up Solutions...
Syntax: DeleteFullVariation Array(<parameters>), boolean
Parameters: All | <DataSpecifierArray>
If, All, all data of existing variations is deleted.
Array(<DesignVariationKey>, )
<DesignVariationKey>
Type: <string>
Design variation string.
<Boolean>
Type: boolean
Whether to also delete linked data.
Example:
Set oDesign = oProject.SetActiveDesign("HFSSModel1")
oDesign.DeleteFullVariation Array(""), false
Example:
Set oDesign = oProject.SetActiveDesign("MaxwellModel1")
oDesign.DeleteFullVariation Array(""), false
Example:
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("ogive")
Set oDesign = oProject.SetActiveDesign("IEDesign1")
oDesign.DeleteFullVariation Array(""), true

Design Object Script Commands 10-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Example:
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Tee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
oDesign.DeleteFullVariation Array("offset=" &Chr(39) & "0.2in" _
& Chr(39) & "", "offset=" & Chr(39) & "0in" & Chr(39) & ""), false

Python DeleteFullVariation Array(<parameters>, <boolean>)


Syntax

Python oDesign.DeleteFullVariation ([Array(""), True])


Example

DeleteLinkedDataVariation
Deletes cached linked data, either all, or specified variations.
Command: [product_name]>Results>Clean Up Solutions
Syntax: DeleteLinkedDataVariation [All | <DesignVariationKey>, <DesignVariationKey>, …]
Return Value: None
Parameters: All
Deletes All Linked data.
<DesignVariationKey>
Type: <string>
Design variation string.
VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2015.0.0
' 13:37:16 Oct 22, 2014
' ----------------------------------------------
Dim oAnsoftApp

Design Object Script Commands 10-7


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
oDesign.DeleteLinkedDataVariation "All"

VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2015.0.0
' 13:56:43 Oct 22, 2014
' ----------------------------------------------
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("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
oDesign.DeleteLinkedDataVariation Array("offset=" & Chr(39) &
"0.0947046688081817in" & Chr(39) & "", _

Design Object Script Commands 10-8


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"offset=" & Chr(39) & "0.2in" & Chr(39) & "", "offset=" & Chr(39) &
"0.3in" & Chr(39) & "", _
"offset=" & Chr(39) & "0.4in" & Chr(39) & "", "offset=" & Chr(39) &
"0.5in" & Chr(39) & "", _
"offset=" & Chr(39) & "0.6in" & Chr(39) & "", "offset=" & Chr(39) &
"0.7in" & Chr(39) & "", _
"offset=" & Chr(39) & "0.8in" & Chr(39) & "", "offset=" & Chr(39) &
"0.9in" & Chr(39) & "", _
"offset=" & Chr(39) & "0in" & Chr(39) & "", "offset=" & Chr(39) &
"1in" & Chr(39) & "")

Python DeleteLinkedDataVariation ([All | <DesignVariationKey>, <DesignVariationKey>,


Syntax …])
oDesign.DeleteLinkedDataVariation (Array["offset="
& Chr(39) & "0.0947046688081817in" & Chr(39) & "", _
"offset=" & Chr(39) & "0.2in" & Chr(39)
& "", "offset=" & Chr(39) & "0.3in" & Chr(39) & "",
_
"offset=" & Chr(39) & "0.4in" & Chr(39)
& "", "offset=" & Chr(39) & "0.5in" & Chr(39) & "",
_
Python
"offset=" & Chr(39) & "0.6in" & Chr(39)
Example
& "", "offset=" & Chr(39) & "0.7in" & Chr(39) & "",
_
"offset=" & Chr(39) & "0.8in" & Chr(39)
& "", "offset=" & Chr(39) & "0.9in" & Chr(39) & "",
_
"offset=" & Chr(39) & "0in" & Chr(39)
& "", "offset=" & Chr(39) & "1in" & Chr(39) & ""])

DeleteVariation
Use:Obsolete. Use DeleteFullVariation, DeleteFieldVariation, DeleteLinkedDataVariation.

ExportConvergence
Use: Exports convergence data (max mag delta S, E, freq) to file for the given variation.

Design Object Script Commands 10-9


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Command: None
Syntax: ExportConvergence <SetupName>, <VariationString>, <FilePath> <overwriteIfExists>
Return Value: None
Parameters: <SetupName>
Type: <string>
Example: "Setup1 "
<VariationString>
Type: <string>
Example: "radius = 3mm"
The empty variation string ("") is interpreted to mean the current nominal variation.
<FilePath>
Type: <string>
Example: "c:\convergence.conv"
overwriteIfExists <Boolean>
If "overwriteIfExists" is TRUE, then the playback of the script overwrites an existing file. If
FALSE, it does not. The default is "TRUE".
Type: <string>
Example: overwriteIfExists=TRUE

VB Example:
oDesign.ExportConvergence "Setup1", "x_size = 2mm", "c:\-
convergence.conv"

For Q3D Extractor the ExportConvergence command details are as follows:


Use: Exports convergence data to file for the given variation.
Command: None
Syntax: ExportConvergence <SetupName>, <VariationString>, <SolnType>, <FilePath>
Return Value: None
Parameters: <SetupName>
Type: <string>
Example: "Setup1 "

Design Object Script Commands 10-10


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<VariationString>
Type: <string>
Example: "radius = 3mm"
The empty variation string ("") is interpreted to mean the current
nominal variation.
<SolnType>
Type: "CG", "DC RL" and "AC RL".
<FilePath>
Type: <string>
Example: "c:\convergence.conv"
overwriteIfExists <Boolean>
Type: <string>
Example: overwriteIfExists=TRUE
If "overwriteIfExists" is TRUE, then the playback of the script
overwrites an existing file. If FALSE, it does not. The default is
"TRUE".
VB Example: oDesign.ExportConvergence "Setup1", "x_size = 2mm", "AC
RL", "c:\convergence.conv"

Python ExportConvergence (<SetupName>, <VariationString>, <FilePath> <over-


Syntax writeIfExists>)
oDesign.ExportConvergence
Python
"Setup1", "x_size = 2mm", "AC RL", "c:\convergence.conv"
Example
])

ExportMeshStats
Use: Exports the mesh statistics to a file.
Command: None.
Parameters: <SetupName>
Type: <string>
Example: "Setup1 "
<VariationString>
Type: <string>

Design Object Script Commands 10-11


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Example: "radius = 3mm"


The empty variation string ("") is interpreted to mean the current nominal variation.
<FilePath>
Type: <string>
Example: "c:\convergence.conv"
overwriteIfExists <Boolean>
If "overwriteIfExists" is TRUE, then the playback of the script overwrites an existing file. If
FALSE, it does not. The default is "TRUE".
Type: <string>
Example: overwriteIfExists=TRUE
VB Example:
oDesign.ExportMeshStats ("Setup1", "offset=" & Chr(39) & "0.09in" &
Chr(39) & "","C:\mydir\meshstats.ms" "tat")

Python N/A
Syntax

oDesign.ExportMeshStats (["Setup1", "offset="


Python
& Chr(39) & "0.09in" & Chr(39) & "","C:\mydir\meshstats.ms"
Example
"tat"])

ExportProfile
Use: Exports a solution profile to file.
Syntax: ExportProfile <SetupName>, <VariationString>, <FilePath>, <overwriteIfExists>
Return Value: None
Parameters: <SetupName>
Type: <string>
Example: "Setup1"
<VariationString>
Type: <string>
Example: "radius = 3mm"
The empty variation string ("") is interpreted to mean the current nominal variation.

Design Object Script Commands 10-12


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<FilePath>
Type: <string>
Example: "c:\profile.prof"
overwriteIfExists <Boolean>
If "overwriteIfExists" is TRUE, then the playback of the script overwrites an existing file. If
FALSE, it does not. The default is "TRUE".
Type: <string>
Example: overwriteIfExists=TRUE
VB Example:
oDesign.ExportProfile "Setup1", "", "c:\profile.prof"

Python ExportProfile <SetupName>, <VariationString>, <FilePath>, <overwriteIfExists>)


Syntax

Python oDesign.ExportProfile (["Setup1", "", "c:\profile.prof"])


Example

GetDesignType
Use: Returns the design type of the active design.

UI Access NA
Parameters NA

String indicating the design type of the active design ("Circuit Design", "Circuit
Netlist", "HFSS 3D Layout Design", "HFSS", "HFSS-IE", "Icepak", "Maxwell
Return Value
2D", "Maxwell 3D", "Q2D Extractor", "Q3D Extractor", "RMxprt", "Twin
Builder")

Python Syn- GetDesignType()


tax

Python oDesign = oProject.GetActiveDesign()


Example oDesign.GetDesignType()

VB Syntax GetDesignType()

Design Object Script Commands 10-13


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Set oDesign = oProject.GetActiveDesign()


Example oDesign.GetDesignType()

GetModule
Use: Returns the IDispatch for the specified module.

UI Access NA

Name Type Description


Parameters <modulename> String Currently the only module name supported is
"SimSetup"

Return Value Module IDispatch

Python Syn- GetModule (<modulename>)


tax

Python oModule = oDesign.GetModule("SimSetup")


Example

VB Syntax GetModule <modulename>


VB set oModule = oDesign.GetModule("SimSetup")
Example

Parameters: Type: <string>


Name of the module. One of the following:
- Boundary module: "BoundarySetup"
- Mesh Operations module: "MeshSetup"
- Reduce Matrix module: "ReduceMatrix"
- Analysis module: "AnalysisSetup"
- Optimetrics module: "Optimetrics"
- Solutions module: "Solutions"
- Field Overlays module: "FieldsReporter"
- Radiation module: "RadField"
- Reporter module: "ReportSetup"

Design Object Script Commands 10-14


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Example:
Set oModule = oDesign.GetModule "BoundarySetup"
For Q3D Extractor the GetModule command details are as follows.
Use: Returns the IDispatch for the specified module.
Command: none
Syntax: GetModule <ModuleName>
Return Value: Module object.
Parameters: Type: <string>
Name of the module. One of the following:
- Boundary module: "BoundarySetup"
- Mesh Operations module: "MeshSetup"
- Reduce Matrix module: "ReduceMatrix"
- Analysis module: "AnalysisSetup"
- Optimetrics module: "Optimetrics"
- Solutions module: "Solutions"
- Field Overlays module: "FieldsReporter"
- Reporter module: "ReportSetup"
VB Example: Set oModule = oDesign.GetModule "MeshSetup"
Example:
oModule = oDesign.GetModule("ReportSetup")
oModule.GetPropertyValue("Trace", "S Parameter Plot 1:dB(S(1,1))","Y
Axis")

GetName
Returns the name of the Design.

UI Access NA

Name Type Description


Parameters
None

 String, the hierarchical name of the design, with the following format:
Return Value <id0>;<name0>[/<id1>;<name1>]*, where the id and name for a

Design Object Script Commands 10-15


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

design at any level of hierarchy can be seen as the values of the ID and Rep-
resentation properties on the General tab when the design is selected in the pro-
ject window. The first set of id and name identifies the top level design, the next
set identifies the design at the next level of hierarchy, and the remaining sets
identify further levels of hierarchy. Note that two instances of the same design
will have different ID values, so that the hierarchical name is specific to the
actual design instance responding to the script method.

Python Syn- GetName()


tax

Python dname = oDesign.GetName()


Example

VB Syntax GetName
VB Example dname = oDesign.GetName

GetNominalVariation
Use: Gets the nominal variation string
Command: None
Syntax: GetNominalVariation()
Return Value: Returns a string representing the nominal variation
Parameters: None
VB Example:
var = oDesign.GetNominalVariation()

Python Syn- GetNominalVariation(<>)


tax

Python oDesign.GetNominalVariation([])
Example

GetSelections
Use:Informational.
Command:None

Design Object Script Commands 10-16


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syntax:GetSelections
Return Value:array of names. When called after a copy/paste operation, it returns a list of the pas-
ted objects.
Parameters:None
VB Example:Set oProject = oDesktop.SetActiveProject("Project6")
Set oDesign = oProject.SetActiveDesign("Q3DDesign1")
Set oEditor = oDesign.SetActiveEditor("Modeler")
Dim A
A = Array()
A = oEditor.GetSelections
Dim B
B = Join(A,",")
'Debug.Write "The Selections are " &B
MsgBox(B)
Dim C
C = Array("NAME:Selections", "Selections:=", B)
oEditor.Delete C

Python Syn- GetSelections([])


tax

oEditor.GetSelections(
[
Dim B
B = Join(A,",")
'Debug.Write "The Selections are " &B
Python
Example MsgBox(B)
Dim C
C = Array("NAME:Selections", "Selections:=",
B)
oEditor.Delete C
])

Design Object Script Commands 10-17


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetSolutionType
Use: Returns the solution type for the design.
Command: none
Syntax: GetSolutionType
Return Value: <SolutionType>
Type: <string>
Possible values are: "DrivenModal", "DrivenTerminal", "Eigenmode", "Transient" or
"Transient Network".
VB Example:
oDesign.GetSolutionType

Python Syn- GetSolutionType()


tax

oProject = oDesktop.GetActiveProject()
Python
oDesign = oProject.GetActiveDesign()
Example
oDesign.GetSolutionType()

GetSolveInsideThreshold
Use: Returns the solve inside threshold. This command command does not apply to HFSS-IE.
Command: none
Syntax: GetSolveInsideThreshold
Return Value: Double representing the solve inside threshold.
VB Example:
oDesign.GetSolveInsideThreshold

GetSourceContexts
Use: Obtain sources currently enabled as context in the Edit Sources dialog Source Context tab.
Command: None
Syntax: GetSource Contexts

Design Object Script Commands 10-18


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Return Value: Array of enabled source names


Parameters: None
VB Example:
SetoModule = oDesign.GetModule("Solutions")
oModule.GetSourceContexts

Python Syn- GetSourceContexts(<>)


tax

Python oModule.GetSourceContexts([])
Example

GetVariationVariableValue
Use: Finds the value of a variable for a specific variation string.
Command: None
Syntax: GetVariationVariableValue(<VariationString>, <VariableName>)
Return Value: Returns a double precision value in SI units, interpreted to mean the value of the vari-
able contained in the variation string.
Parameters: <VariationString>
Type: string
<VariableName>
Type: string
VB Example:
Example: varval = _
oDesign.GetVariationVariableValue("x_size = 2mm y_size = 1mm",_ "y_
size")

GeometryCheckAndAutofix
Use: Runs Geometry Check and optionally applies autofixes.
Command: HFSS 3D Layout > Geometry Check
Syntax: GeometryCheckAndAutofix <ChecksArray>,

Design Object Script Commands 10-19


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

      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 consequently less prob-
lems 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"
— "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) option-
ally 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)"

Design Object Script Commands 10-20


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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", _
"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)")

PasteDesign (Design Object)


Use:Paste a design that has already been copied to the clipboard into another design to create a
subdesign.
Command:After copying a design from the project window, right-click Nexxim, HFSS 3D Layout
Design, or Simplorer Design, and then choose Paste. Or select one of those designs and choose
Edit>Paste menu or Ctrl-V shortcut. Or drag an appropriate design in the project window and drop
it on one of those designs.
Syntax:PasteDesign pasteOption
Return Value: None
Parameters:
pasteOption
Type: <Integer>
One of the following:

l 0 to link to the existing design that was copied

l 1 to create a new copy of the design that was copied but keep the original layers of the
design being copied

l 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:
' ----------------------------------------------

Design Object Script Commands 10-21


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

' Script Recorded by ANSYS Electronics Desktop Version 2016.0.0


' 6:44:39 Oct 02, 2015
' ----------------------------------------------
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 "B"
Set oDesign = oProject.SetActiveDesign("A")
oDesign.PasteDesign 1

Redo [Design]
Reapplies the last design-level command.

UI Access Edit>Redo

Name Type Description


Parameters
None

Return Value None

Python Syn- Redo()


tax

Python oDesign.Redo()
Example

VB Syntax Redo

Design Object Script Commands 10-22


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Example oDesign.Redo

RenameDesignInstance
Renames a design instance.

Right-click a design instance in the project tree, and then click Rename on the
UI Access
shortcut menu.

Name Type Description


<OldName> String The current name of the design, which must
Parameters be the design on which this command is
invoked.
<NewName> String The new name for the design.

Return Value None

Python RenameDesignInstance (<OldName>, <NewName>)


Syntax

Python oDesign.RenameDesignInstance("Design1", "Design2")


Example

VB Syntax RenameDesignInstance <OldName>, <NewName>

VB oDesign.RenameDesignInstance "HFSSDesign1",
Example "HFSSDesign2"

ResetToTimeZero
To reset a simulation to time zero.
Command: CleanStop
Syntax: ResetToTimeZero( "<name of setup>" )
Return Value: None
Parameters: <Name of Setup>
VB Example:
# ----------------------------------------------
# Script Recorded by ANSYS Electronics Desktop Version 2015.0.0
# 16:11:48 Nov 14, 2014

Design Object Script Commands 10-23


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

# ----------------------------------------------
import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oProject = oDesktop.SetActiveProject("TermPorts")
oDesign = oProject.SetActiveDesign("TermPorts2Active")
oDesign.AnalyzeAll()
oModule = oDesign.GetModule("AnalysisSetup")
oModule.ResetToTimeZero("Setup1")

Python Syn- ResetToTimeZero("<name of setup>")


tax

Python oModule.ResetToTimeZero(["Setup1"])
Example

SARSetup
Sets up for the specific absorption rate (SAR) computation.This command command does not
apply to HFSS-IE.
Command: HFSS>Fields>SAR Setting
Syntax: SARSetup <TissueMass>, <MaterialDensity>, <Tissue object List ID>, <voxel size>,
<Average SAR method>
Return Value: None
Parameters: <TissueMass>
Type: <double>
Double between 1 and 10 in grams.

<MaterialDensity>
Type: <double>
Positive double in gram/cm3.

<Tissue Object listID>

Design Object Script Commands 10-24


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Type: <integer>
The ID of an object list which will be treated as tissues for SAR calculation.

<voxel size>
Type: <double>
The size of a voxel in millimeters.

<Average SAR method>


Type: <integer>
0: IEEE std 1528.
1: Gridless, i.e. classical Ansoft method.
VB Example:
oDesign.SARSetup 1, 1, 678, 1, 0

SetActiveEditor
Sets the active editor.
Command: None
Syntax: SetActiveEditor(<EditorName>)
Return Value: Editor object
Parameters: <EditorName>
Type: <string>
The only choice is "3D Modeler"
VB Example:
Set oEditor = oDesign.SetActiveEditor("3D Modeler")

Python SetActiveEditor (<editorName>)


Syntax

Python oEditor = oDesign.SetActiveEditor("SchematicEditor")


Example

Design Object Script Commands 10-25


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

SetBackgroundMaterial
Use:Sets the background material of the design.
Command:Right click on the design in the project tree and choose "Set Background Material".
Syntax:SetBackgroundMaterial <MatName>
Return Value:None
Parameters:<MatName>
Type: <string>
The name of the background material
VB Example:oDesign.SetBackgroundMaterial "vacuum"

Note:

For a 2D project, you can run this command only if the following conditions are met:

• there is no surface ground in the design, and

• problem type is "open".

SetLengthSettings
Use:Sets the distributed and lumped length of the design.
Syntax:SetLengthSettings
Return Value:None
Parameters: <DistributedUnits>
Type:<String>
Value: Length units
Length Units used for post processing in the design.
<LumpedLength>
Type:<String>
Value: Length (double) with units.
Length of design used in post processing.
<RiseTime>
Type: <String>

Design Object Script Commands 10-26


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Value: Time with units.


Rise time used in post processing steps.
oDesign.SetLengthSettings "mm", "7meter", "1s"

SetSolutionType
Sets the solution type for the design. This command does not apply to HFSS-IE.
Command: HFSS>Solution Type
Syntax: SetSolutionType <SolutionType>, <AutoOpenMode>,<Model_Exterior_as_IE>
Return Value: None
Parameters: <SolutionType>
Type: <string>
Possible values are: "DrivenModal", "DrivenTerminal", "Transient", "Transient Network",
or "Eigenmode"
<AutoOpenMode>
Type: <Boolean>
Only applies for Driven Solution Type. Possible values are: True, False
<Model_Exterior_as_IE>
Type: <Boolean>
Only Applies for Driven Solution Type. Possible values are: True, False.

VB Example:
oDesign.SetSolutionType "DrivenModal", true, true

For Q3D Extractor the command details are as follows:


Sets the solution type for the design.
Command: 2D Extractor>Solution Type
Syntax: SetSolutionType <SolutionType>
Return Value: None
Parameters: <SolutionType>
Type: <string>
Possible values are: "Open", or "Closed"

Design Object Script Commands 10-27


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Example: oDesign.SetSolutionType ("Open")

Python Syn- SetSolutionType (<SolutionType>)


tax

Python oDesign.SetSolutionType
Example (["Open"])

SetSolveInsideThreshold
Set the solve inside threshold to the supplied double. This command command does not apply to
HFSS-IE.
Command: None
Syntax: SetSolveInsideThreshold(<threshold>)
Return Value: None
Parameters: <threshold>
Type: <double>
Siemens/m
VB Example:
oDesign.SetSolveInsideThreshold(100000)

SetSourceContexts
For Near or Far Field projects for Driven Modal or Driven Terminal Network Analysis Solutions,
specify the port name and all modes/terminals of that port to be enabled as Source Context.
Command: Fields>Edit Sources
Syntax: SetSourceContexts Array("<sourceID>",...)
Return Value: None.
Parameters: <sourceID>
Type: <string>
VB Example:
SetoModule = oDesign.GetModule("Solutions")
oModule.SetSourceContexts Array("Box1_T1", "Box1_T2", "Box1_T3",
"Current1", "IncPWave1")

Design Object Script Commands 10-28


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Syn- SetSourceContexts Array(<"<sourceID>",...>)


tax

oModule.SetSourceContexts Array([
Python "Box1_T1",
Example "Box1_T2", "Box1_T3", "Current1", "IncPWave1"
])

Solve
Performs a blocking simulation. The next script command will not be executed until the simulation is
complete.
Command: [product]>Analyze
Syntax: Solve <SetupNameArray>
Return Value: Type: <int>
-1: simulation error
0: normal completion
Parameters: <SetupNameArray>: Array(<SetupName>, <SetupName>, ...)
<SetupName>
Type: <string>
Name of the solution setup to solve.
VB Example:
return_status = oDesign.Solve Array("Setup1", "Setup2")

For Q3D Extractor Solve command details are as follows:

Performs a blocking simulation. The next script command will not be executed until the simulation is
complete.
Command: Q3D Extractor or 2D Extractor>Analyze. Or right-click the Analysis option in the
project tree and choose "Analyze".
Syntax: Solve <SetupNameArray>
Return Value: Type: <int>
-1: command execution error
1: simulation error

Design Object Script Commands 10-29


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

0: normal completion
Parameters: <SetupNameArray>: Array(<SetupName>, <SetupName>, ...)
<SetupName>
Type: <string>
Name of the solution setup to solve.
VB Example: return_status = oDesign.Solve Array("Setup1", "Setup2")

Python Syn- Solve (<SetupNameArray>)


tax

oDesign.Solve Array([
Python
"Setup1", "Setup2"
Example
])

RunToolkit
Use: Run a Python toolkit script, applying it to the Active Project. The script itself may have pre-
requisites, such as sweeps defined, or specific model characteristics, such as port definitions.
Command: [product]>Toolkit><IronPythonScript>
Syntax: RunToolkit "<LibName>", "<IronPythonScriptName>", Array()
Return Value: User Defined Solutions and user Defined Outputs.
Parameters: <LibName>
Type: <string>
Name of the library in which the script is located.
<IronPythonScriptName>
Type: <string>
Name of the IronPython script.
Array(<array>
Type: <Array>
Additional parameters or files required by the script.
VB Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 16.0.0
' 10:12:18 AM May 14, 2013

Design Object Script Commands 10-30


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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("test_HAC")
Set oDesign = oProject.SetActiveDesign("RCS1")
oDesign.RunToolkit "SysLib", "HearingAidCompliance", Array()
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertFrequencySweep "Setup1", Array("NAME:Sweep", "IsEn-
abled:=", true, "SetupType:=", _
"LinearStep", "StartValue:=", "1GHz", "StopValue:=", "10GHz", "StepS-
ize:=", _
"0.1GHz", "Type:=", "Interpolating", "SaveFields:=", false,
"SaveRadFields:=", _
false, "InterpTolerance:=", 0.5, "InterpMaxSolns:=", 250, "Inter-
pMinSolns:=", _
0, "InterpMinSubranges:=", 1, "ExtrapToDC:=", false, "InterpUseS:=",
true, "InterpUsePortImped:=", _
false, "InterpUsePropConst:=", true, "UseDerivativeConvergence:=",
false, "InterpDerivTolerance:=", _
0.2, "UseFullBasis:=", true, "EnforcePassivity:=", true, "Passiv-
ityErrorTolerance:=", _
0.0001)

For Q3D Extractor the RunToolkit command details are as follows:


Use: Run a Python toolkit script, applying it to the Active Project.
Command: Q3D Extractor or 2D Extractor>Toolkit

Design Object Script Commands 10-31


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syntax: RunToolkit "<LibName>", "<IronPythonScriptName>", Array()


Return Value: User Defined Solutions and user Defined Outputs.
Parameters: <LibName>
Type: <string>
Name of the library in which the script is located.
<IronPythonScriptName>
Type: <string>
Name of the IronPython script.
Array(<array>)
Type: <Array>
Additional parameters or files required by thescript.

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.
Currently, the script to launch the cable modeling dialog boxes is:
oDesign.RunToolkit "SysLib", "CableModeling/AutomotiveCableBundle",
Array()
oDesign.RunToolkit "SysLib", "CableModeling/Oil-GasCableBundle",
Array()

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("Project1")

Design Object Script Commands 10-32


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oProject.InsertDesign "Q3D Extractor", "Q3DDesign1", "", ""


oProject.SaveAs "E:\project_directories'3d\v13\user_stories_
R15\US53001_cable_modeling\auto_script.q3dx", true
Set oDesign = oProject.SetActiveDesign("Q3DDesign1")

oDesign.RunToolkit "SysLib", "CableModeling/AutomotiveCableBundle",


Array()
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AutoIdentifyNets

Set oModule = oDesign.GetModule("AnalysisSetup")


oModule.InsertSetup "Matrix", Array("NAME:Setup1", "AdaptiveFreq:=",
"1GHz", "SaveFields:=", _
true, "Enabled:=", true, Array("NAME:Cap", "MaxPass:=", 10,
"MinPass:=", 1, "MinConvPass:=", _
1, "PerError:=", 1, "PerRefine:=", 30, "AutoIn-
creaseSolutionOrder:=", true, "SolutionOrder:=", _
"Normal"), Array("NAME:DC", "Residual:=", 1E-005, "SolveResOnly:=",
false, Array("NAME:Cond", "MaxPass:=", _
10, "MinPass:=", 1, "MinConvPass:=", 1, "PerError:=", 1, "Per-
Refine:=", 30), Array("NAME:Mult", "MaxPass:=", _
1, "MinPass:=", 1, "MinConvPass:=", 1, "PerError:=", 1, "Per-
Refine:=", 30)), Array("NAME:AC", "MaxPass:=", _
10, "MinPass:=", 1, "MinConvPass:=", 1, "PerError:=", 1, "Per-
Refine:=", 30))
oProject.Save

Python RunToolkit ("<LibName>", "<IronPythonScriptName>", Array[] )


Syntax

oModule = oDesign.GetModule("AnalysisSetup")
Python oModule.InsertSetup "Matrix", Array("NAME:Setup1",
Examp- "AdaptiveFreq:=", "1GHz", "SaveFields:=", _
le
true, "Enabled:=", true, Array("NAME:Cap",
"MaxPass:=", 10, "MinPass:=", 1, "MinConvPass:=", _

Design Object Script Commands 10-33


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

1, "PerError:=", 1, "PerRefine:=", 30,


"AutoIncreaseSolutionOrder:=", true, "SolutionOrder:=", _
"Normal"), Array("NAME:DC", "Residual:=",
1E-005, "SolveResOnly:=", false, Array("NAME:Cond",
"MaxPass:=", _
10, "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:=", 1,
"PerError:=", 1, "PerRefine:=", 30))

Undo [Design]
Cancels the last design-level command.

UI Access Edit>Undo

Name Type Description


Parameters
None

Return Value None

Python Syn- Undo()


tax

Python oDesign.Undo()
Example

VB Syntax Undo
VB Example oDesign.Undo

ValidateDesign
Use: Returns the validation information to a named file.
Command: Validate

Design Object Script Commands 10-34


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syntax: ValidateDesign(r"filePath", True)


Return Value: If True, clears the file. If False, appends new error messages to the specified file.
Type: <string>

Python ValidateDesign(r"<filePath>", True)


Syntax

oProject = oDesktop.GetActiveProject()
Python
oDesign = oProject.GetActiveDesign()
Exampl-
e oDesign.ValidateDesign(r"C:/Users/agao/Desktop/f1.tmp",
True)

Design Object Script Commands 10-35


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

PDF layout 10-36


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

3D Modeler Editor Script Commands 11-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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 <args>

Conventions Used in this Chapter


<Attributes Array>
Array("NAME:Attributes",
"Name:=", <string>,
"Flags:=", <string>,
"Color:=", <string>,
"Transparency:=", <value>,
"PartCoordinateSystem:=", <string>,
"MaterialName:=", <string>,
"Solveinside:=", <bool>)
Flags
Format is a string containing any of the following flags separated by the # character:

l NonModel
l Wireframe

Example: "Flags:=", "NonModel#Wireframe"


Color
Format is a string containing an R,G,B triple formatted as "(R G B)".
Example: "Color:=", "(255 255 255)"
Transparency
Specify a number between 0 and 1.
PartCoordinateSystem
Orientation of the primitive. The name of one of the defined coordinate systems should
be specified.
<SelectionsArray>

3D Modeler Editor Script Commands 11-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:Selections",
"Selections:=", <string>)
Selections
Comma-separated list of parts on which to perform the operation.
Example: "Selections:=", "Rect1, Rect2"
The topics for this section include:
Draw Menu Commands
Edit Menu Commands
Modeler Menu Commands
Other oEditor Commands

Draw Menu Commands


Create3D Component
CreateBondWire
CreateBox
CreateCircle
CreateCone
CreateCutplane
CreateCylinder
CreateEllipse
CreateEquationCurve
CreateEquationSurface
CreateHelix
CreatePoint
CreatePolyline
CreateRectangle
CreateRegion
CreateRegularPolyhedron
CreateRegularPolygon
CreateSphere
CreateSpiral

3D Modeler Editor Script Commands 11-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

CreateTorus
CreateUserDefinedModel
CreateUserDefinedPart
Edit3DComponent
EditNativeComponentDefinition
EditPolyline
Get3DComponentParameters
Get3DComponentDefinitionNames
Get3DComponentInstanceNames
Get3DComponentMaterialNames
Get3DComponentMaterialProperties
Insert3DComponent
InsertPolylineSegment
SweepAlongPath
SweepAlongVector
SweepAroundAxis
SweepFacesAlongNormal
SweepFacesAlongNormalWithAttributes
UpdateComponentDefinition

Create3D Component
Use: Create a 3D component
Command: None
Syntax: Create3DComponent <Geometry Data>, <Design Data>, <File Name>, <Image File>
Return Value: None
Parameters: < Geometry Data>
Geometry data
< Design Data>
Design data
< File Name>
File name of 3D component

3D Modeler Editor Script Commands 11-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

< Image File>


File name of 3D component image
VB Example:
oEditor.Create3DComponent Array("NAME:GeometryData",
"ComponentName:=", "Connector",
"Owner:=", "", "Email:=", "", "Company:=", "",
"Version:=", "1.0", "Date:=", "11:41:01 AM Aug 28, 2014",
"Notes:=", "", "HasLabel:=", false,
"IncludedParts:=", Array( "Box1", "Cylinder1", "Cone1"),
"IncludedCS:=", Array("RelativeCS1"),
"ReferenceCS:=", "Global",
"IncludedParameters:=", Array("htcone", "lr", "htcyl", "zs",
"radcyl", "xs", "$rp", "$con"),
"ParameterDescription:=", Array()),
Array("NAME:DesignData", "Boundaries:=",
Array( "PerfE1", "FiniteCond1"),
"Excitations:=", Array("1"),
"MeshOperations:=", Array()),
"C:/tmp/Connector.a3dcomp",
Array("NAME:ImageFile", "ImageFile:=", "")

Python Create3DComponent (<Geometry Data>, <Design Data>, <File Name>, <Image


Syntax File>)
oEditor.Create3DComponent Array(["NAME:GeometryData",

"ComponentName:=", "Connector",
"Owner:=", "", "Email:=", "", "Company:=", "",
"Version:=", "1.0", "Date:=", "11:41:01 AM Aug 28, 2014",
"Notes:=", "", "HasLabel:=", false,
"IncludedParts:=", Array( "Box1", "Cylinder1", "Cone1"),
"IncludedCS:=", Array("RelativeCS1"),
Python "ReferenceCS:=", "Global",
Exampl- "IncludedParameters:=", Array("htcone", "lr", "htcyl",
e "zs",
"radcyl", "xs", "$rp", "$con"),
"ParameterDescription:=", Array()),
Array("NAME:DesignData", "Boundaries:=",
Array( "PerfE1", "FiniteCond1"),
"Excitations:=", Array("1"),
"MeshOperations:=", Array()),
"C:/tmp/Connector.a3dcomp",
Array("NAME:ImageFile", "ImageFile:=", "" ])

3D Modeler Editor Script Commands 11-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

CreateBondwire
Use: Creates a bondwire primitive.
Command: Draw>Bondwire
Syntax: CreateBondwire <ParametersArray>, <AttributesArray>
Return Value: The name of the newly created object.
Parameters: <ParametersArray>
Array("NAME:BondwireParameters",
"WireType:=", <string>,
"WireDiameter:=", <value>,
"NumSides:=", <value>,
"XPadPos:=", <value>,
"YPadPos:=", <value>,
"ZPadPos:=", <value>,
"XDir:=", <value>,
"YDir:=", <value>,
"ZDir:=", <value>,
"Distance:=", <value>,
"h1:=", <value>,
"h2:=", <value>,
"alpha:=", <value>,
"beta:=", <value>,
"WhichAxis:=", <string>)
WireType
Should be one of: "JEDEC_4Points", "JEDEC_5Points"
Example: "WireType:=", "JEDEC_4Points"
WhichAxis
Axis normal to the plane where the wire is drawn. Possible values are: "X", "Y", "Z"
Example: "WhichAxis:=", "Z" means the bond wire will be drawn on the XY plane.

3D Modeler Editor Script Commands 11-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

CreateCutplane
Use: Creates a cutplane. Only the name and color attributes from <AttributesArray> are sup-
ported.
Command: Draw>Plane
Syntax: CreateCutplane <CutplaneParametersArray>,
<AttributesArray>
Return Value: The name of the newly created object.
Parameters: <CutplaneParametersArray>
Array("NAME:PlaneParameters",
"PlaneBaseX:=", <value>,
"PlaneBaseY:=", <value>,
"PlaneBaseZ:=", <value>,
"PlaneNormalX:=", <value>,
"PlaneNormalY:=", <value>),
"PlaneNormalZ:=", <value>)

CreateEquationCurve
Use: Create an equation-based curve.
Command: Draw>Equation Based Curve
Syntax: CreateEquationCurve Array <Parameters> Array<Attributes>
Return Value: None
Parameters:
Array("NAME:EquationBasedCurveParameters",
"XtFunction:=", "<value>",
"YtFunction:=", "<value>",
"ZtFunction:=", "<value>",
"tStart:=", "<value>",
"tEnd:=", "<value>",
"NumOfPointsOnCurve:=", "<value>",
"Version:=", <ID>),

3D Modeler Editor Script Commands 11-7


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:Attributes",
"Name:=", "<textn>",
"Flags:=", "",
"Color:=", "(<int> <int> <int>)",
"Transparency:=", <value>,
"PartCoordinateSystem:=", "<id>",
"UDMId:=", "",
"MaterialValue:=", "" & Chr(34)
& "vacuum"
& Chr(34) & "",
"SolveInside:=", <boolean>)

Python Syn- CreatEquationCurve (<parameters>, <attributes> )


tax

oEditor.CreateEquationCurve(
[
"NAME:EquationBasedCurveParameters",
"XtFunction:=" , "sin(_t)",
"YtFunction:=" , "_t",
"ZtFunction:=" , "_t",
"tStart:=" , "0",

Python "tEnd:=" , "6",


Example "NumOfPointsOnCurve:=" , "10",
"Version:=" , 1,
[
"NAME:PolylineXSection",
"XSectionType:=" , "None",
"XSectionOrient:=" , "Auto",
"XSectionWidth:=" , "0",
"XSectionTopWidth:=" , "0",

3D Modeler Editor Script Commands 11-8


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"XSectionHeight:=" , "0",
"XSectionNumSegments:=" , "0",
"XSectionBendType:=" , "Corner"]
],
[
"NAME:Attributes",
"Name:=" , "EquationCurve1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False
])

3D Modeler Editor Script Commands 11-9


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

CreateEquationSurface
Use: Create an equation based surface. For descriptions of the parameters, see the online help for
the Draw>Equation Based Surface command. The parameters here correspond to the fields in
the dialog.

The attributes correspond to the object attributes in the Properties dialog.

Command: Draw>Create Equation Based Surface


Syntax: CreateEquationSurface Array <parameters> Array <attributes>
Return Value:
Parameters:
Array("NAME:EquationBasedSurfaceParameters",
"XuvFunction:=", "<equation containing Function, Operators and/or
quantities _u, _v, or PI>",

3D Modeler Editor Script Commands 11-10


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"YuvFunction:=", "<equation containing Function, Operators and/or


quantities _u, _v, or PI>",
"ZuvFunction:=", "<equation containing Function, Operators and/or
quantities _u, _v, or PI>",
"uStart:=", "<start value for _u>",
"uEnd:=", "<end value for _u",
"vStart:=", "<start value for _u>",
"vEnd:=", "<end value for _v",
"Version:=", 1),
Array("NAME:Attributes", "Name:=", "EquationSurface1",
"Flags:=", "",
"Color:=", "(132 132 193)",
"Transparency:=", 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=", "",
"MaterialValue:=", ""
& Chr(34)
& "vacuum"
& Chr(34)
& "", "SolveInside:=", true)
VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2019.1.0
' 15:16:36 Oct 10, 2018
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule

3D Modeler Editor Script Commands 11-11


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")


Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project74")
Set oDesign = oProject.SetActiveDesign("HFSS1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateEquationSurface Array("NAME:Equa-
tionBasedSurfaceParameters", "XuvFunction:=", _
"_u", "YuvFunction:=", "_v", "ZuvFunction:=", "sin(_u)+cos(_v)",
"uStart:=", "1", "uEnd:=", _
"10", "vStart:=", "1", "vEnd:=", "10", "Version:=", 1), Array
("NAME:Attributes", "Name:=", _
"EquationSurface1", "Flags:=", "", "Color:=", "(143 175 143)",
"Transparency:=", _
0, "PartCoordinateSystem:=", "Global", "UDMId:=", "", "Mater-
ialValue:=", _
"" & Chr(34) & "vacuum" & Chr(34) & "", "SurfaceMaterialValue:=", ""
& Chr(34) & "" & Chr(34) & "", "SolveInside:=", _
true, "IsMaterialEditable:=", true, "UseMaterialAppearance:=",
false, "IsLightweight:=", _
false)

Python Syn- CreateEquationSurface (<parameters>, <attributes> )


tax

oEditor.CreateEquationSurface(
[
"NAME:EquationBasedSurfaceParameters",
"XuvFunction:=" , "_u",

Python "YuvFunction:=" , "_v",


Example "ZuvFunction:=" , "sin(_u)+cos(_v)",
"uStart:=" , "1",
"uEnd:=" , "10",
"vStart:=" , "1",
"vEnd:=" , "10",

3D Modeler Editor Script Commands 11-12


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Version:=" , 1
],
[
"NAME:Attributes",
"Name:=" , "EquationSurface1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False
])

CreateHelix
Use: Creates a helix by sweeping the specified 2D objects.
Command: Draw>Helix
Syntax: CreateHelix <SelectionsArray>, <HelixParametersArray>
Return Value: The name of the newly created object.
Parameters: <SelectionsArray>
Array("NAME:Selections",
"Selections:=", <string>)
Selections
Comma-separated list of parts to sweep.
Example: "Selections:=", "Rect1, Rect2"
<HelixParametersArray>
Array("NAME:HelixParameters",
"XCenter:=", <value>,

3D Modeler Editor Script Commands 11-13


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"YCenter:=", <value>,
"ZCenter:=", <value>,
"XStartDir:=", <value>,
"YStartDir:=", <value>,
"ZStartDir:=", <value>,
"Thread:=", <value>,
"NumThread:=", <value>,
"RightHand:=", <bool>)

CreatePoint
Use: Creates a point. Only the name and color attributes from <AttributesArray> are supported.
Command: Draw>Point
Syntax: CreatePoint <PointParametersArray>, <AttributesArray>
Return Value: The name of the newly created object.
Parameters: <PointParametersArray>
Array("NAME:PointParameters",
"PointX:=", <value>,
"PointY:=", <value>,
"PointZ:=", <value>)

CreateUserDefinedPart
Use: Create User defined part.
Command: Draw>UserDefinedPrimitive
Syntax: CreateUserDefinedPart <UserDefinedParametersArray>, <AttributesArray>
Return Value: None
Parameters: <UserDefinedParametersArray>
Array("NAME:UserDefinedPrimitiveParameters",
"CoordinateSystemID:=", <value>,
"DllName:=", <string>,
"Library:=", <string>,
Array("NAME:ParamVector",

3D Modeler Editor Script Commands 11-14


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:Pair", "Name:=", <string>, "Value:=", <value>)…)

Python CreateUserDefinedPart ([ <UserDefinedParametersArray>, <AttributesArray>])


Syntax

oEditor.CreateUserDefinedPart [
(
Array("NAME:UserDefinedPrimitiveParameters",
"CoordinateSystemID:=", -1,
"DllName:=", "Examples/RectangularSpiral",
"NoOfParameters:=", 6, "Library:=", "syslib",

Array("NAME:ParamVector",

Array("NAME:Pair", "Name:=", "Xpos", "Value:=", "0mm"),

Array("NAME:Pair","Name:=", "Ypos", "Value:=", "0mm"),

Array("NAME:Pair", "Name:=", "TurnSep", "Value:=", "5mm"),

Array("NAME:Pair", "Name:=", "Turns", "Value:=", "2"),


Python
Example Array("NAME:Pair", "Name:=", "Width", "Value:=", "2mm"),

Array("NAME:Pair", "Name:=", "Height", "Value:=", "2mm"))),

Array("NAME:Attributes", "Name:=",
"RectangularSpiral1",
"Flags:=", "",
"Color:=", "(132 132 193)",
"Transparency:=", 0,
"PartCoordinateSystem:=", "Global",
"MaterialName:=", "copper",
"SolveInside:=", _
False)
)]

CreateRegion
Use: Defines a region containing the design.
Command: Draw>Create Region
Syntax: CreateRegion <RegionParameters> <RegionAttributes>
Return Value: The name of the newly created object.

3D Modeler Editor Script Commands 11-15


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Parameters: <RegionParameters>
Array("NAME:RegionParameters", _
"+XPaddingType:=", <Offset_Type>,
"+XPadding:=", "<X_value>", _
"-XPaddingType:=", <Offset_Type>,
"-XPadding:=", "<-X_value>", _
"+YPaddingType:=", <Offset_Type>,
"+YPadding:=", "<Y_value>",
"-YPaddingType:=", <Offset_Type>,
"-YPadding:=", "<-Y_value>", _
"+ZPaddingType:=", <Offset_Type>,
"+ZPadding:=", "<Z_value>", _
"-ZPaddingType:=", <Offset_Type>,
"-ZPadding:=", "<-Z_value>")
<Offset_Type>
Type: String
Can be one of:
"Percentage Offset",
"Absolute Offset",
"Absolute Position",
<RegionAttributes>
Array("NAME:Attributes",
"Name:=", "Region", _
"Flags:=", "Wireframe<# or >", _
"Color:=", "(<red_int> <green_int> <blue_int>)", _
"Transparency:=", <real>, _
"PartCoordinateSystem:=", "<ID>", _
"MaterialName:=", "<MaterialName>", _
"SolveInside:=", <Boolean>)

3D Modeler Editor Script Commands 11-16


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Example:
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateRegion Array("NAME:RegionParameters",
"+XPaddingType:=", "Absolute Offset", _
"+XPadding:=", "1um", _
"-XPaddingType:=", "Absolute Offset", _
"-XPadding:=", "1um", _
"+YPaddingType:=", "Absolute Offset", _
"+YPadding:=", "1um",
"-YPaddingType:=", "Absolute Offset", _
"-YPadding:=", "1um", _
"+ZPaddingType:=", "Absolute Offset", _
"+ZPadding:=", "1um", _
"-ZPaddingType:=", "Absolute Offset", _
"-ZPadding:=", "1um"),
Array("NAME:Attributes", "Name:=", _
"Region", "Flags:=", "Wireframe#", _
"Color:=", "(255 0 0)", _
"Transparency:=", 0, _
"PartCoordinateSystem:=", "Global", _
"MaterialValue:=", "" & Chr(34) & "vacuum" & Chr(34) & "", _
"SolveInside:=", true)

For Q3D Extractor the CreateRegion command details are as follows:


Use: Defines a region containing the design.
Command: Draw>Create Region
Syntax: CreateRegion <RegionParameters> <RegionAttributes>
Return Value: The name of the newly created object.
Parameters: <RegionParameters>
Array("NAME:RegionParameters", _

3D Modeler Editor Script Commands 11-17


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"CoordinateSystemID:=", <ID_number>_
"+XPadding:=", "<X_value>", _
"-XPadding:=", "<-X_value>", _
"+YPadding:=", "<Y_value>",
"-YPadding:=", "<-Y_value>", _
"+ZPadding:=", "<Z_value>", _
"-ZPadding:=", "<-Z_value>")
<RegionAttributes>
Array("NAME:Attributes",
"Name:=", "Region", _
"Flags:=", "Wireframe<# or >", _
"Color:=", "(<red_int> <green_int> <blue_int>)", _
"Transparency:=", <real>, _
"PartCoordinateSystem:=", "<ID>", _
"MaterialName:=", "<MaterialName>", _
"SolveInside:=", <Boolean>)
Set oEditor = oDesign.SetActiveEditor("3D Modeler") oEd-
itor.CreateRegion Array("NAME:RegionParameters", _ "Coordin-
ateSystemID:=", -1, _ "+XPadding:=", "0", "-XPadding:=", "0", _
"+YPadding:=", "0", "-YPadding:=", "0", _ "+ZPadding:=", "0", "-ZPad-
ding:=", "0"), _ Array("NAME:Attributes", "Name:=", "Region", _
"Flags:=", "Wireframe#", _ "Color:=", "(255 0 0)", _ "Trans-
parency:=", 0.400000005960464, _ "PartCoordinateSystem:=", "Global",
_ "MaterialName:=", "vacuum", _ "SolveInside:=", true)

Python Syn- CreateRegion ([ <RegionParameters>, <RegionAttributes> ])


tax

oEditor.CreateRegion (
[

Python
Array("NAME:RegionParameters",
Example "+XPaddingType:=", "Absolute Offset", _
"+XPadding:=", "1um", _
"-XPaddingType:=", "Absolute Offset", _

3D Modeler Editor Script Commands 11-18


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"-XPadding:=", "1um", _
"+YPaddingType:=", "Absolute Offset", _
"+YPadding:=", "1um",
"-YPaddingType:=", "Absolute Offset", _
"-YPadding:=", "1um", _
"+ZPaddingType:=", "Absolute Offset", _
"+ZPadding:=", "1um", _
"-ZPaddingType:=", "Absolute Offset", _
"-ZPadding:=", "1um"),
Array("NAME:Attributes", "Name:=", _
"Region", "Flags:=", "Wireframe#", _
"Color:=", "(255 0 0)", _
"Transparency:=", 0, _
"PartCoordinateSystem:=", "Global", _
"MaterialValue:=", "" & Chr(34) & "vacuum"
& Chr(34) & "", _
"SolveInside:=", True)
)]

CreateRegularPolyhedron
Use: Creates a regular polyhedron primitive.
Command: Draw>Regular Polyhedron
Syntax: CreateRegularPolyhedron <PolyhedronParametersArray>,
<AttributesArray>
Return Value: The name of the newly created object.
Parameters: <PolyhedronParametersArray>
Array("NAME:PolyhedronParameters",
"XCenter:=", <value>,
"YCenter:=", <value>,
"ZCenter:=", <value>,
"XStart:=", <value>,

3D Modeler Editor Script Commands 11-19


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"YStart:=", <value>,
"ZStart:=", <value>,
"Height:=", <value>,
"NumSides:=", <value>,
"WhichAxis:=", <string>)

NumSides:
Specify a number greater than 2.

WhichAxis
Axis of the polyhedron. Possible values are: "X", "Y", "Z"
Example: "WhichAxis:=", "Z"

CreateSpiral
Use: Creates a spiral by sweeping the specified 2D objects.
Command: Draw>Spiral
Syntax: CreateSpiral <SelectionsArray>, <SpiralParametersArray>
Return Value: The name of the newly created object.
Parameters: <SelectionsArray>
Array("NAME:Selections",
"Selections:=", <string>)
Selections
Comma separated list of parts to sweep.
Example: "Selections:=", "Rect1, Rect2"
<SpiralParametersArray>
Array("NAME:SpiralParameters",
"XCenter:=", <value>,
"YCenter:=", <value>,
"ZCenter:=", <value>,
"XStartDir:=", <value>,
"YStartDir:=", <value>,

3D Modeler Editor Script Commands 11-20


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"ZStartDir:=", <value>,
"NumThread:=", <value>,
"RightHand:=", <bool>,
"RadiusIncrement:=", <value>)

CreateUserDefinedModel
Command: Creates a SpaceClaimLink. Spaceclaim file path has to be included as "Geo-
metryFilePath" definition. Another definition named "IsSpaceClaimLinkUDM" needs to be there
with value equal to 1.
Syntax: UserDefinedModel <UserDefinedModelParameters>
Return Value: None
Parameters: <UserDefinedModelParameters>
Array("NAME:UserDefinedModelParameters
"DllName:=", "<modelName>", "Version:=", "2.0",
"ConnectionID:=", "", "Library:=", "<installLib>",
Array("NAME:Definition", Array("NAME:UDMParam",
"Name:=", "GeometryFilePath", "Value:=", "" & Chr(34) &
"<SpaceClaimFilePath>" & Chr(34) & "" & "",
"DataType:=", "String", "PropType2:=", 0,
"PropFlag2:=", 1),
Array("NAME:UDMParam", "Name:=", "IsSpaceClaimLinkUDM",
"Value:=", "1", "DataType:=", "Int", "PropType2:=", 5,
"PropFlag2:=", 8))
VB Example:
oEditor.CreateUserDefinedModel Array("NAME:User-
DefinedModelParameters",
"DllName:=", "SCIntegUDM", "Version:=", "2.0",
"ConnectionID:=", "", "Library:=", "installLib",
Array("NAME:Definition", Array("NAME:UDMParam",
"Name:=", "GeometryFilePath", "Value:=", "" & Chr(34) &
"G:\box.scdoc" & Chr(34) & "" & "",
"DataType:=", "String", "PropType2:=", 0, "PropFlag2:=", 1), Array
("NAME:UDMParam", "Name:=", "IsSpaceClaimLinkUDM",
"Value:=", "1", "DataType:=", "Int", "PropType2:=", 5,
"PropFlag2:=", 8)),
Array("NAME:Options", Array("NAME:UDMParam",
"Name:=", "Solid Bodies", "Value:=", "1",
"DataType:=", "Int", "PropType2:=", 5, "PropFlag2:=", 0), Array

3D Modeler Editor Script Commands 11-21


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

("NAME:UDMParam", "Name:=", "Surface Bodies", "Value:=", "1",


"DataType:=", "Int", "PropType2:=", 5, "PropFlag2:=", 0), Array
("NAME:UDMParam", "Name:=", "Line Bodies", "Value:=", "1",
"DataType:=", "Int", "PropType2:=", 5, "PropFlag2:=", 8), Array
("NAME:UDMParam", "Name:=", "Parameters", "Value:=", "1",
"DataType:=", "Int", "PropType2:=", 5, "PropFlag2:=", 0), Array
("NAME:UDMParam", "Name:=", "Parameter Key",
"Value:=", "" & Chr(34) & "" & Chr(34) & "", "DataType:=", "String",
"PropType2:=", 0, "PropFlag2:=", 0),
Array("NAME:UDMParam", "Name:=", "Named Selections", "Value:=", "1",
"DataType:=", "Int", "PropType2:=", 5, "PropFlag2:=", 8),
Array("NAME:UDMParam", "Name:=", "Rendering Attributes",
"Value:=", "1", "DataType:=", "Int", "PropType2:=", 5,
"PropFlag2:=", 0),
Array("NAME:UDMParam", "Name:=", "Material Assignment",
"Value:=", "1", "DataType:=", "Int", "PropType2:=", 5,
"PropFlag2:=", 0),
Array("NAME:UDMParam", "Name:=", "Explode Multi-Body Parts",
"Value:=", "1", "DataType:=", "Int", "PropType2:=", 5,
"PropFlag2:=", 8),
Array("NAME:UDMParam", "Name:=", "Smart CAD Update", "Value:=", "1",
"DataType:=", "Int", "PropType2:=", 5, "PropFlag2:=", 8)), Array
("NAME:GeometryParams"), Array("NAME:MaterialParams"), Array
("NAME:DesignParams"))

Pytho- UserDefinedModel ([ <UserDefinedModelParameters> ])


n Syn-
tax

oEditor.CreateUserDefinedModel [(
{Array("NAME:UserDefinedModelParameters",

"DllName:=", "SCIntegUDM", "Version:=", "2.0",


"ConnectionID:=", "", "Library:=", "installLib",
Array("NAME:Definition", Array("NAME:UDMParam",
Pytho- "Name:=", "GeometryFilePath", "Value:=", "" & Chr(34) &
n "G:\box.scdoc" & Chr(34) & "" & "",
Exam- "DataType:=", "String", "PropType2:=", 0, "PropFlag2:=", 1),
ple
Array("NAME:UDMParam",
"Name:=", "IsSpaceClaimLinkUDM",
"Value:=", "1", "DataType:=", "Int", "PropType2:=", 5,
"PropFlag2:=", 8)),
Array("NAME:Options", Array("NAME:UDMParam",
"Name:=", "Solid Bodies", "Value:=", "1",
"DataType:=", "Int", "PropType2:=", 5, "PropFlag2:=", 0),

3D Modeler Editor Script Commands 11-22


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:UDMParam",
"Name:=", "Surface Bodies", "Value:=", "1", "DataType:=",
"Int", "PropType2:=",
5, "PropFlag2:=", 0),
Array("NAME:UDMParam", "Name:=", "Line Bodies",
"Value:=", "1", "DataType:=", "Int", "PropType2:=", 5,
"PropFlag2:=",
8),
Array("NAME:UDMParam", "Name:=", "Parameters", "Value:=",
"1",
"DataType:=", "Int", "PropType2:=", 5, "PropFlag2:=", 0),
Array("NAME:UDMParam",
"Name:=", "Parameter Key",
"Value:=", "" & Chr(34) & "" & Chr(34) & "", "DataType:=",
"String", "PropType2:=", 0, "PropFlag2:=", 0),
Array("NAME:UDMParam", "Name:=", "Named Selections",
"Value:=", "1",
"DataType:=", "Int", "PropType2:=", 5, "PropFlag2:=", 8),
Array("NAME:UDMParam", "Name:=", "Rendering Attributes",
"Value:=", "1", "DataType:=", "Int", "PropType2:=", 5,
"PropFlag2:=", 0),
Array("NAME:UDMParam", "Name:=", "Material Assignment",
"Value:=", "1", "DataType:=", "Int", "PropType2:=", 5,
"PropFlag2:=", 0),
Array("NAME:UDMParam", "Name:=", "Explode Multi-Body Parts",
"Value:=",
"1", "DataType:=", "Int", "PropType2:=", 5,
"PropFlag2:=", 8),
Array("NAME:UDMParam", "Name:=", "Smart CAD Update",
"Value:=", "1",
"DataType:=", "Int", "PropType2:=", 5, "PropFlag2:=", 8)),
Array("NAME:GeometryParams"),
Array("NAME:MaterialParams"), Array("NAME:DesignParams")
])

CreateUserDefinedPart
Use: Create User defined part.
Command: Draw>UserDefinedPrimitive
Syntax: CreateUserDefinedPart <UserDefinedParametersArray>, <AttributesArray>

3D Modeler Editor Script Commands 11-23


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Return Value: None


Parameters: <UserDefinedParametersArray>
Array("NAME:UserDefinedPrimitiveParameters",
"CoordinateSystemID:=", <value>,
"DllName:=", <string>,
"Library:=", <string>,
Array("NAME:ParamVector",
Array("NAME:Pair", "Name:=", <string>, "Value:=", <value>)…)

Python CreateUserDefinedPart ([ <UserDefinedParametersArray>, <AttributesArray>])


Syntax

oEditor.CreateUserDefinedPart [
(
Array("NAME:UserDefinedPrimitiveParameters",
"CoordinateSystemID:=", -1,
"DllName:=", "Examples/RectangularSpiral",
"NoOfParameters:=", 6, "Library:=", "syslib",

Array("NAME:ParamVector",

Array("NAME:Pair", "Name:=", "Xpos", "Value:=", "0mm"),

Array("NAME:Pair","Name:=", "Ypos", "Value:=", "0mm"),

Array("NAME:Pair", "Name:=", "TurnSep", "Value:=", "5mm"),


Python
Example Array("NAME:Pair", "Name:=", "Turns", "Value:=", "2"),

Array("NAME:Pair", "Name:=", "Width", "Value:=", "2mm"),

Array("NAME:Pair", "Name:=", "Height", "Value:=", "2mm"))),

Array("NAME:Attributes", "Name:=",
"RectangularSpiral1",
"Flags:=", "",
"Color:=", "(132 132 193)",
"Transparency:=", 0,
"PartCoordinateSystem:=", "Global",
"MaterialName:=", "copper",
"SolveInside:=", _
False)

3D Modeler Editor Script Commands 11-24


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

)]

Edit3DComponent
Use:Edit 3D Component
Command:None
Syntax:Edit3DComponent <Component Name>
Return Value:None
Parameters:<Component Name>
Name of the 3D component
<Data>
Data of the 3D component
VB Example:
oEditor.Edit3DComponent "Connector1",
Array("NAME:EditComponentParametersData",
"NewComponentName:=", " Connector2",
"GeometryParameters:=", "",
"MaterialParameters:=", "",
"DesignParameters:=", "",
Array("NAME:Component Meshing", "MeshAssembly:=", false), Array("NAME:Ex-
citations", "Suppressed:=", Array()))

Pytho- Edit3DComponent (<Component Name>)


n Syn-
tax

3D Modeler Editor Script Commands 11-25


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oEditor.Edit3DComponent
([
"Connector1",
Array("NAME:EditComponentParametersData",
Pytho- "NewComponentName:=", " Connector2",
n "GeometryParameters:=", "",
Exam- "MaterialParameters:=", "",
ple "DesignParameters:=", "",
Array("NAME:Component Meshing", "MeshAssembly:=", false),
Array("NAME:Excitations",
"Suppressed:=", Array()))
])

EditPolyline
Modifies a polyline primitive. Specify the name of the polyline to modify and the new set of data for
the polyline.
Command: Draw>Line Segment>Insert Segment Before>Straight
Draw>Line Segment>Insert Segment Before>Spline
Draw>Line Segment>Insert Segment Before>3 Point Arc
Draw>Line Segment>Insert Segment Before>Center Point Arc
Draw>Line Segment>Insert Segment After>Straight
Draw>Line Segment>Insert Segment After>Spline
Draw>Line Segment>Insert Segment After>3 Point Arc
Draw>Line Segment>Insert Segment After>Center Point Arc
Edit>Delete Start Point
Edit>Delete End Point.
Syntax: EditPolyline <SelectionsArray>,
<PolylineParametersArray>,
Return Value: The name of the newly created object
Parameters: <SelectionsArray>
Array("NAME:Selections",
"Selections:=", "string")
Selections

3D Modeler Editor Script Commands 11-26


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Name of the polyline to modify. The name should be formatted as


"<PolylineName>:CreatePolyline:1".
Example: "Selections:=", "Polyline1:CreatePolyline:1"

Get3DComponentParameters
Use:Get parameters of 3D components
Command:none
Syntax:Get3DComponentParameters <Component Name>
Return Value:An array of component parameters.
Parameters:<Component Name>
Name of the 3D component
VB Example:
Dim paras
paras = oEditor.Get3DComponentParameters("Connector")

Python Syn- Get3DComponentParameters (<Component Name>)


tax

Python oEditor.Get3DComponentParameters("Connector")
Example

Get3DComponentDefinitionNames
Use:Get names of 3D component definitions
Command:None
Syntax:Get3DComponentDefinitionNames
Return Value:An array of component definition names.
Parameters:
VB Example:
Dim defNames
defNames = oEditor.Get3DComponentDefinitionNames()

Python Syn- Get3DComponentDefinitionNames ("")


tax

Python oEditor.Get3DComponentDefinitionNames("")
Example

3D Modeler Editor Script Commands 11-27


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Get3DComponentInstanceNames
Use:Get instance names of 3D component definitions.
Command:None
Syntax:An array of 3D component instance names.
Return Value:An array of 3D component instance names.
Parameters:<Definition Name>
Name of the 3D component definition
VB Example:
Dim instNames
instNames = oEditor.Get3DComponentInstanceNames("Connector")

Python Get3DComponentInstanceNames(<"Connector">)
Syntax

Python oEditor.Get3DComponentInstanceNames("Connector")
Example

Get3DComponentMaterialNames
Use:Get material names of 3D component.
Command:None.
Syntax:Get3DComponentMaterialNames <Component Instance Name>
Return Value:An array of material names.
Parameters:<Component Instance Name>
Name of the component
VB Example:
Dim materialNames
materialNames = oEditor.Get3DComponentMaterialNames("Connector1")

Python Get3DComponentMaterialNames(<"Connector1">)
Syntax

3D Modeler Editor Script Commands 11-28


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python oEditor.Get3DComponentMaterialNames("Connector1")
Example

Get3DComponentMaterialProperties
Use:Get material properties of 3D component material.
Command:None
Syntax:Get3DComponentMaterialProperties <Complete Material Name>
Return Value:An array of material properties.
Parameters:<Complete Material Name>
Name of the material with a complete format
VB Example:
Dim materialProperties
materialProperties = oEditor.Get3DComponentMaterialProperties("Con-
nector1:Material01")

Python Get3DComponentMaterialProperties(<"Connector1:Material01">)
Syntax

Python oEditor.Get3DComponentMaterialProperties("Con-
Exampl- nector1:Material01")
e

Insert3DComponent
Insert a 3D Component
Command: none
Syntax: Insert3DComponent <Data>
Return Value: None
Parameters: <Data>
Data of the 3D component
VB Example:
oEditor.Insert3DComponent Array("NAME:InsertComponentData",
"Parameters:=", "",
"TargetCS:=", "Global",
"ComponentFile:=", "C:\tmp\Connector.a3dcomp")

3D Modeler Editor Script Commands 11-29


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Insert3DComponent [(<Data>])


Syntax

oEditor.Insert3DComponent [
(
Array("NAME:InsertComponentData",
Python
Example "Parameters:=", "",
"TargetCS:=", "Global",
"ComponentFile:=", "C:\tmp\Connector.a3dcomp")
])

InsertPolylineSegment
Use: Inserts a polyline segment either before or after an existing segment of a polyline primitive.
Command: Draw>Line Segment>Insert Segment Before>Straight
Draw>Line Segment>Insert Segment Before>Spline
Draw>Line Segment>Insert Segment Before>3 Point Arc
Draw>Line Segment>Insert Segment Before>Center Point Arc
Draw>Line Segment>Insert Segment After>Straight
Draw>Line Segment>Insert Segment After>Spline
Draw>Line Segment>Insert Segment After>3 Point Arc
Draw>Line Segment>Insert Segment After>Center Point Arc
Syntax: InsertPolylineSegment <InsertPolylineSegmentArray>
Return Value: None
Parameters: <InsertPolylineSegmentArray>
Array("Name:Insert Polyline Segment",
"Selections:=", <string>,
"Segment Index:=", <value>,
"At Start:=", <bool>,
"SegmentType:=", <string>
<PolylinePointsArray>)

3D Modeler Editor Script Commands 11-30


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<PolylinePointsArray>
Array("Name:Polyline Points", <OnePointArray>,
<OnePointArray>, ...)

<OnePointArray>
Array("Name:PLPoint",
"X:=", <value>,
"Y:=", <value>,
"Z:=", <value>)

Selections
Name of the polyline to modify. The name should be formatted as
"<PolylineName>:CreatePolyline:1".
Example: "Selections:=", "Polyline1:CreatePolyline:1"

SegmentType
Can be "Line", "Arc", "Spline", or "AngularArc"

SweepAlongPath
Use: Sweeps the specified 1D or 2D parts along a path. The last 1D object specified is the path for
the sweep.
Command: Draw>Sweep>Along Path
Syntax: SweepAlongPath <SelectionsArray>,
<PathSweepParametersArray>
Return Value: None
Parameters: <PathSweepParametersArray>
Array("NAME:PathSweepParameters",
"DraftAngle:=", <value>,
"DraftType:=", <string>,
"TwistAngle:=", <value>)

3D Modeler Editor Script Commands 11-31


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

DraftType
Possible values are "Extended", "Round", "Natural"

VB Example: oEditor.SweepAlongPath _
Array("NAME:Selections", "Selections:=",
"Polygon1,Polyline1"),_
Array("NAME:PathSweepParameters", _
"DraftAngle:=", "0deg",_
"DraftType:=", "Round",_
"TwistAngle:=", "30deg")

SweepAlongPath ([
Python Syn-
tax
<SelectionsArray>, <PathSweepParametersArray>
])
oEditor.SweepAlongPath (
[
Array("NAME:Selections", "Selections:=",
"Polygon1,Polyline1"),_
Python
Array("NAME:PathSweepParameters", _
Example
"DraftAngle:=", "0deg",_
"DraftType:=", "Round",_
"TwistAngle:=", "30deg")
])

SweepAlongVector
Use: Sweeps the specified 1D or 2D parts along a vector.
Command: Draw>Sweep>Along Vector
Syntax: SweepAlongVector <SelectionsArray>,

3D Modeler Editor Script Commands 11-32


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<VecSweepParametersArray>
Return Value: None
Parameters: <VecSweepParametersArray>
Array("NAME:VectorSweepParameters",
"DraftAngle:=", <value>,
"DraftType:=", <string>,
"SweepVectorX:=", <value>, _
"SweepVectorY:=", <value>,
"SweepVectorZ:=", <value)

DraftType
Possible values are "Extended", "Round", "Natural"

SweepAroundAxis
Use: Sweeps the specified 1D or 2D parts around an axis.
Command: Draw>Sweep>Around Axis
Syntax: SweepAroundAxis <SelectionsArray>,
<AxisSweepParametersArray>
Return Value: None
Parameters: <AxisSweepParametersArray>
Array("NAME:AxisSweepParameters",
"DraftAngle:=", <value>,
"DraftType:=", <string>,
"SweepAxis:=", <string>,
"SweepAngle:=", <value>)
DraftType
Possible values are "Extended", "Round", "Natural"
SweepAxis
Possible values are "X", "Y", "Z"

SweepFacesAlongNormal
Use: Sweep a face along normal.

3D Modeler Editor Script Commands 11-33


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Command: Modeler>Sweep Faces Along Normal


Syntax: SweepFacesAlongNormal <selection> <parameters>
Return Value: None
Parameters: Array("NAME:Selections",
"Selections:=", "<faceID>",
"NewPartsModelFlag:=", ["Model" | "NonModel"]),
Array("NAME:Parameters",
Array("NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=", Array( <faceID>),
"LengthOfSweep:=", "<value><units>")
)
VB Example:
oEditor.SweepFacesAlongNormal
Array("NAME:Selections",
"Selections:=", "Rectangle1",
"NewPartsModelFlag:=", "Model"),
Array("NAME:Parameters",
Array("NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=",
Array( 57),
"LengthOfSweep:=", "0.5mm")
)

Python SweepFacesAlongNormal (<selection> <parameters>)


Syntax

oEditor.SweepFacesAlongNormal (
[

Python Array("NAME:Selections",
Example "Selections:=", "Rectangle1",
"NewPartsModelFlag:=", "Model"),

3D Modeler Editor Script Commands 11-34


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:Parameters",

Array("NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=",

Array( 57), "LengthOfSweep:=", "0.5mm")


])

SweepFacesAlongNormalWithAttributes
Use: Sweep selected faces along normal to create new object, user can specify the attributes of
the new object
Command: Recorded during PML creation
Syntax: SweepFacesAlongNormalWidthAttributes <SelectionsArray>, <ParametersArray>,
<AttributeArray>
Return Value: None
Parameters: <ParametersArray>
Array("NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=", Array(12),
"LengthOfSweep:=", "0.1mm"))
VB Example:
oEditor.SweepFacesAlongNormalWithAttributes Array("NAME:Selections",
"Selections:=","Box1",
"NewPartsModelFlag:=", "Model"),
Array("NAME:Parameters",
Array("NAME:SweepFaceAlongNormalToParameters", "FacesToDetach:=", Array(7),
"LengthOfSweep:=", "0.424865556413828mm")),
Array("NAME:Attributes", "Name:=", "PML_Box1_1", "Flags:=", "",
"Color:=", "(132 132 193)",
"Transparency:=", 0.899999976158142,
"PartCoordinateSystem:=", "FaceCS1",
"UDMId:=", "",
"MaterialValue:=", "" & Chr(34) & "vacuum" & Chr(34) & "",
"SolveInside:=", true)

Pytho- SweepFacesAlongNormalWidthAttributes (<SelectionsArray>, <ParametersArray>,


n Syn- <AttributeArray>)

3D Modeler Editor Script Commands 11-35


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

tax

oEditor.SweepFacesAlongNormalWithAttributes ([
Array("NAME:Selections","Selections:=","Box1",
"NewPartsModelFlag:=", "Model"),

Array("NAME:Parameters",

Array("NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=", Array(7),
Pytho- "LengthOfSweep:=", "0.424865556413828mm")),
n
Exam-
ple Array("NAME:Attributes", "Name:=", "PML_Box1_1", "Flags:=",
"",
"Color:=", "(132 132 193)",
"Transparency:=", 0.899999976158142,
"PartCoordinateSystem:=", "FaceCS1",
"UDMId:=", "",
"MaterialValue:=", "" & Chr(34) & "vacuum" & Chr(34) &
"",
"SolveInside:=", True)
])

UpdateComponentDefinition
Use:Update component definition
Command:None
Syntax:UpdateComponentDefinition <Data>
Return Value:none
Parameters:<Data> Component data
VB Example:
oEditor.UpdateComponentDefinition
Array("NAME:UpdateDefinitionData",
"DefinitionNames:=", " Connector, Magic_Tee",
"Passwords:=", Array("", ""))

Python Syn- UpdateComponentDefinition (<Data>)


tax

Python oEditor.UpdateComponentDefinition
Example

3D Modeler Editor Script Commands 11-36


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

([
Array("NAME:UpdateDefinitionData",
"DefinitionNames:=", " Connector, Magic_Tee",
"Passwords:=",
Array("", ""))
])

Edit Menu Commands


Copy
DeletePolyLinePoint
DuplicateAlongLine
DuplicateAroundAxis
DuplicateMirror
Mirror
Move
OffsetFaces
Paste (Model Editor)
Rotate
Scale

Copy
Use: Copies specified parts
Command: Edit>Copy
Syntax: Copy <SelectionsArray>
Return Value: None

DeletePolylinePoint
Use: Deletes either a start or end point from an existing polyline segment.
Command: Edit>Delete Start Point
Edit>Delete End Point
Syntax: DeletePolylinePoint <DeletePointArray>
Return Value: None
Parameters: <DeletePointArray>
Array("Name:Delete Point",

3D Modeler Editor Script Commands 11-37


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Selections:=", <string>,
"Segment Index:=", <value>,
"At Start:=", <bool>)

Selections
Name of the polyline to modify. The name should be formatted as
"<PolylineName>:CreatePolyline:1".
Example: "Selections:=", "Polyline1:CreatePolyline:1"

DuplicateAlongLine
Duplicates specified parts along line.
Command: Click Edit>Duplicate>Along Line
Syntax: DuplicateAlongLine <SelectionsArray>,
<DupLineParametersArray> <DupBoundariesArray>
Return Value: List with names of newly created objects.
Parameters: <DupLineParametersArray>
Array("NAME:DuplicateToAlongLineParameters",
"XComponent:=", <value>,
"YComponent:=", <value>,
"ZComponent:=", <value>,
"NumClones:=", <value>)
NumClones
Specify a number greater than 1.
<DupBoundariesArray>
Array("NAME:Options", "DuplicateBoundaries:=", <bool>)
VB Example:
oEditor.DuplicateAlongLine Array("NAME:Selections", _
"Selections:=", "Box1", _
"NewPartsModelFlag:=", "Model"), _
Array("NAME:DuplicateToAlongLineParameters", _

3D Modeler Editor Script Commands 11-38


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"CreateNewObjects:=", true, "XComponent:=", "0mm", _


"YComponent:=", "1.2mm", _
"ZComponent:=", "0mm", _
"NumClones:=", "2"), _
Array("NAME:Options", "DuplicateBoundaries:=", false)

DuplicateAlongLine (<SelectionsArray>, <DupLineParametersArray> <DupBound-


Python
Syntax
ariesArray>
)
oEditor.DuplicateAlongLine ([
Array("NAME:Selections",_
"Selections:=", "Box1", _
"NewPartsModelFlag:=", "Model"), _
Array("NAME:DuplicateToAlongLineParameters", _
Python "CreateNewObjects:=", true, "XComponent:=", "0mm",
Example _
"YComponent:=", "1.2mm", _
"ZComponent:=", "0mm", _
"NumClones:=", "2"), _
Array("NAME:Options", "DuplicateBoundaries:=", false)
])

DuplicateAroundAxis
Duplicates specified parts around an axis.
Command: Edit>Duplicate>Around Axis
Syntax: DuplicateAroundAxis <SelectionsArray>,
<DupAxisParametersArray> <DupBoundariesArray>
Return Value: None
Parameters: <DupAxisParametersArray>
Array("NAME:DuplicateAroundAxisParameters",
"WhichAxis:=", <string>,
"AngleStr:=", <value>,

3D Modeler Editor Script Commands 11-39


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"NumClones:=",<value>)

WhichAxis
Axis to duplicate around. Possible values are: "X", "Y", "Z"
Example: "WhichAxis:=", "Z"

NumClones:
Specify a number greater than 1.

<DupBoundariesArray>
Array("NAME:Options", "DuplicateBoundaries:=", <bool>)

VB Example:
oEditor.DuplicateAroundAxis Array("NAME:Selections", _
"Selections:=", "Box1", _
"NewPartsModelFlag:=", "Model"), _
Array("NAME:DuplicateAroundAxisParameters", _
"CreateNewObjects:=", false, _
"WhichAxis:=", "Z", _
(For Maxwell 2D XY Designs, "Whichaxis:=" should be set to "Z".)
(For Maxwell 2D RZ Designs, "Whichaxis:=" should be set to "Y".)
"AngleStr:=", "90deg", _
"NumClones:=", "2"), _
Array("NAME:Options", "DuplicateBoundaries:=", false)

DuplicateAroundAxis (<SelectionsArray>, <DupAxisParametersArray>


Python
Syntax
<DupBoundariesArray>
)

Python oEditor.DuplicateAroundAxis
Example ([

3D Modeler Editor Script Commands 11-40


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:Selections",_
"Selections:=", "Box1", _
"NewPartsModelFlag:=", "Model"), _

Array("NAME:DuplicateAroundAxisParameters", _
"CreateNewObjects:=", false, _
"WhichAxis:=", "Z", _
"AngleStr:=", "90deg", _
"NumClones:=", "2"), _

Array("NAME:Options", "DuplicateBoundaries:=", false)


])

DuplicateMirror
Duplicate specified parts according to a mirror plane.
Command: Edit>Duplicate>Mirror
Syntax: DuplicateMirror <SelectionsArray>,
<DupMirrorParametersArray>
Return Value: None
Parameters: <DupMirrorParametersArray>
Array("NAME:DuplicateToMirrorParameters",
"DuplicateMirrorBaseX:=", <value>,
"DuplicateMirrorBaseY:=", <value>,
"DuplicateMirrorBaseZ:=", <value>,
"DuplicateMirrorNormalX:=", <value>,
"DuplicateMirrorNormalY:=", <value>,
"DuplicateMirrorNormalZ:=", <value>)
(For Maxwell 2D XY Designs, Z parameters should be set to "0".)
(For Maxwell 2D RZ Designs, Y parameters should be set to "0".)

3D Modeler Editor Script Commands 11-41


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<DupBoundariesArray>
Array("NAME:Options", "DuplicateBoundaries:=", <bool>)

VB Example:
oEditor.DuplicateMirror Array("NAME:Selections", _
"Selections:=", "Box1", _
"NewPartsModelFlag:=", "Model"), _
Array("NAME:DuplicateToMirrorParameters", _
"DuplicateMirrorBaseX:=", "0mm", _
"DuplicateMirrorBaseY:=", "0mm", _
"DuplicateMirrorBaseZ:=", "0mm", _
"DuplicateMirrorNormalX:=", "0mm", _
"DuplicateMirrorNormalY:=", "-1mm", _
"DuplicateMirrorNormalZ:=", "0mm"), _
Array("NAME:Options", "DuplicateBoundaries:=", false)

Python DuplicateMirror (<SelectionsArray>, <DupMirrorParametersArray>


Syntax )
oEditor.DuplicateMirror ([
Array("NAME:Selections",_
"Selections:=", "Box1", _
"NewPartsModelFlag:=", "Model"), _
Array("NAME:DuplicateToMirrorParameters", _

Python "DuplicateMirrorBaseX:=", "0mm", _


Example "DuplicateMirrorBaseY:=", "0mm", _
"DuplicateMirrorBaseZ:=", "0mm", _
"DuplicateMirrorNormalX:=", "0mm", _
"DuplicateMirrorNormalY:=", "-1mm", _
"DuplicateMirrorNormalZ:=", "0mm"), _
Array("NAME:Options", "DuplicateBoundaries:=", false)

3D Modeler Editor Script Commands 11-42


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

])

Mirror
Use: Mirrors specified parts.
Command: Edit>Arrange>Mirror
Syntax: Mirror <SelectionsArray>, <MirrorParametersArray>
Return Value: None
Parameters: <MirrorParametersArray>
Array("NAME:MirrorParameters",
"MirrorBaseX:=", <value>,
"MirrorBaseY:=", <value>,
"MirrorBaseZ:=", <value>,
"MirrorNormalX:=", <value>,
"MirrorNormalY:=", <value>,
"MirrorNormalZ:=", <value>)
VB Example:
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.Mirror Array("NAME:Selections", "Selections:=", "Box1", _
"NewPartsModelFlag:=", "Model"), _
Array("NAME:MirrorParameters", _
"MirrorBaseX:=", "-0.8mm", _
"MirrorBaseY:=", "-1mm", _
"MirrorBaseZ:=", "0mm", _
"MirrorNormalX:=", "0.948683298050514mm", _
"MirrorNormalY:=", "-0.316227766016838mm", _
"MirrorNormalZ:=", "0mm")

Python Mirror (<SelectionsArray>, <MirrorParametersArray>)


Syntax

Python oEditor.Mirror
Example ([

3D Modeler Editor Script Commands 11-43


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:Selections", "Selections:=","Box1", _
"NewPartsModelFlag:=", "Model"), _

Array("NAME:MirrorParameters", _
"MirrorBaseX:=", "-0.8mm", _
"MirrorBaseY:=", "-1mm", _
"MirrorBaseZ:=", "0mm", _
"MirrorNormalX:=", "0.948683298050514mm", _
"MirrorNormalY:=", "-0.316227766016838mm", _
"MirrorNormalZ:=", "0mm")
])

Move
Use: Moves specified parts.
Command: Click Edit>Arrange>Move
Syntax: Move <SelectionsArray>, <MoveParametersArray>
Return Value: None
Parameters: <MoveParametersArray>
Array("NAME:TranslateParameters",
"TranslateVectorX:=", <value>,
"TranslateVectorY:=", <value>,
"TranslateVectorZ:=", <value>)
(For Maxwell 2D XY Designs, "TranslateVectorZ:=" should be set to "0".)
(For Maxwell 2D RZ Designs, "TranslateVectorY:=" should be set to "0".)

OffsetFaces
Use: Offsets faces of specified parts.
Command: Edit>Arrange>Offset
Syntax: OffsetFaces <SelectionsArray>, <OffsetParametersArray>
Return Value: None
Parameters: <OffsetParametersArray>
Array("NAME:OffsetParameters",

3D Modeler Editor Script Commands 11-44


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"OffsetDistance:=", <value>)

Paste (Model Editor)


Pastes copied objects and returns an array of pasted objects from the 3D model editor.
Command: Edit>Paste
Syntax: Paste
Return Value: One dimensional array of pasted object names. The order is not guaranteed to be
alphabetical.
Parameters: None.
VB Example:
arrayEntities = oEditor.Paste

Rotate
Use: Rotates specified parts.
Command: Edit>Arrange>Rotate
Syntax: Rotate <SelectionsArray>, <RotateParametersArray>
Return Value: None
Parameters: <RotateParametersArray>
Array("NAME:RotateParameters",
"RotateAxis:=", <string>
"RotateAngle:=", <value>)
RotateAxis
Possible values are: "X", "Y", "Z"
(For Maxwell 2D XY Designs, "RotateAxis:=" should be set to "Z".)
(For Maxwell 2D RZ Designs, "Whichaxis:=" should be set to "Y".)

Python Rotate()
Syntax

oEditor.Rotate (["NAME:Selections", "Selections:=",


Python
["CompInst@R;2;4", "CompInst@C;1;1"]],
Exampl-
e ["NAME:RotateParameters","Degrees:=", 90, "Disconnect:=",
_

3D Modeler Editor Script Commands 11-45


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

false, "Rubberband:=", false])

Scale
Use: Scales specified parts.
Command: Edit>Scale
Syntax: Scale <SelectionsArray>, <ScaleParametersArray>
Return Value: None
Parameters: <ScaleParametersArray>
Array("NAME:ScaleParameters",
"ScaleX:=", <value>,
"ScaleY:=", <value>,
"ScaleZ:=", <value>)
(For Maxwell 2D XY Designs, "ScaleZ:=" should be set to "0".)
(For Maxwell 2D RZ Designs, "ScaleY:=" should be set to "0".)

Modeler Menu Commands


AssignMaterial
Chamfer
Connect
CoverLines
CoverSurfaces
CreateEntityList
CreateFaceCS
CreateGroup
CreateObjectCS
CreateObjectFromEdge
CreateObjectFromFaces
CreateRelativeCS
DeleteEmptyGroups
DeleteLastOperation
DetachFaces

3D Modeler Editor Script Commands 11-46


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

EditEntityList
EditFaceCS
EditObjectCS
EditRelativeCS
Export
Fillet
FlattenGroup
Generate History
GetActiveCoordinateSystem
GetCoordinateSystems
Import
ImportDXF
ImportGDSII [Modeler]
Intersect
MoveCStoEnd
MoveEntityToGroup
MoveFaces
ProjectSheet
PurgeHistory
ReplaceWith3DComponent
Section
SeparateBody
SetModelUnits
SetWCS
ShowWindow
Split
Subtract
SweepFacesAlongNormal
ThickenSheet
UncoverFaces

3D Modeler Editor Script Commands 11-47


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Unite
Ungroup
Wrap Sheet

AssignMaterial
Use: Assigns a material to the specified objects. Only the MaterialName and SolveInside para-
meters of <AttributesArray> are supported.
Command: Modeler>Assign Material
Syntax: AssignMaterial <SelectionsArray>, <AttributesArray>
Return Value: None
VB Example:
oEditor.AssignMaterial _
Array("NAME:Selections", "Selections:=", "Polygon1"),
Array("NAME:Attributes", _
"MaterialName:=", "tungsten",_
"SolveInside:=", false)

Python AssignMaterial (<SelectionsArray>, <AttributesArray>)


Syntax

oEditor.AssignMaterial
([
Array("NAME:Selections", "Selections:=", "Polygon1"),

Python
Example Array("NAME:Attributes", _
"MaterialName:=", "tungsten",_
"SolveInside:=", false)
])

Chamfer
Use: Creates a chamfer.
Command: Modeler>Chamfer

3D Modeler Editor Script Commands 11-48


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syntax: Chamfer (<ObjectName> <ChamferParameters>)


Return Value: None
Parameters: <ObjectName>
Array("NAME:Selections", _
"Selections:=", <string>),
<ChamferParameters>
Array("NAME:Parameters", _
Array("NAME:ChamferParameters", _
"CoordinateSystemID:=", <value>,
"Edges:=", <ArrayOfEdgeIDs>,
"LeftRange:=", <value>))

VB Example:
oEditor.Chamfer Array("Name:Selections", _
"Selections:=", "Box1"), Array("NAME:Parameters", _ Array("NAME:Cham-
ferParameters", _
"CoordinateSystemID:=", -1, _
"Edges:=", Array(13), "LeftRange:=", "1mm"))

Pyt- Chamfer ([ <ObjectName>, <ChamferParameters> ])


hon
Syn-
tax

oEditor.Chamfer
([
Pyt-
hon
Array("Name:Selections", "Selections:=", "Box1"),
Exa- Array("NAME:Parameters",
mpl-
e Array("NAME:ChamferParameters", "CoordinateSystemID:=", -1,
"Edges:=", Array(13), "LeftRange:=", "1mm"))
])

3D Modeler Editor Script Commands 11-49


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Connect
Use: Connects specified 1D parts to form a sheet.
Command: Modeler>Surface>Connect
Syntax: Connect <SelectionsArray>
Return Value: None

CoverLines
Use: Covers the specified 1D objects to form a sheet.
Command: Modeler>Surface>Cover Lines
Syntax: CoverLines <SelectionsArray>
Return Value: None

CoverSurfaces
Use: Covers the specified objects to form a solid object.
Command: Modeler>Surface>Cover Faces
Syntax: CoverSurfaces <SelectionsArray>
Return Value: None

CreateEntityList
Use: Creates a list of entities. The list can contain objects or faces, but not both. Only the Name
attribute from <AttributesArray> is supported.
Command: Modeler>List>Create>Object List
Modeler>List>Create>Face List
Syntax: CreateEntityList <EntityListParametersArray>,
<AttributesArray>
Return Value: None
Parameters: <EntityListParametersArray>
Array("NAME:GeometryEntityListParameters",
"EntityType:=", <string>,
"EntityList:=", <array>
EntityType
Possible values are "Object", "Face"
EntityList

3D Modeler Editor Script Commands 11-50


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array of integers – the IDs of the objects or faces to put in the list. To get the IDs, use
GetObjectIDByName

CreateFaceCS
Use: Creates a face coordinate system. Only the Name attribute of the <AttributesArray> para-
meter is supported.
Command: Modeler>Coordinate System>Create>Face CS
Syntax: CreateFaceCS <FaceCSParametersArray>, <AttributesArray>
Return Value: None
Parameters: <FaceCSParametersArray>
Array("NAME:FaceCSParameters",
"FaceID:=", <int>,
"PartID:=", <int>,
Array("NAME:OriginPosn",
"IsAttachedToEntity:=", <bool>,
"EntityID:=", <value>,
"PositionType:=", <string>,
"UParam:=", <value>,
"VParam:=", <value>,
"XPosition:=", <value>,
"YPosition:=", <value>,
"ZPosition:=", <value>)
Array("NAME:AxisPosn",
"IsAttachedToEntity:=", <bool>
"EntityID:=", <value>
"PositionType:=", <string>,
"UParam:=", <value>,
"VParam:=", <value>,
"XPosition:=", <value>,
"YPosition:=", <value>,
"ZPosition:=", <value>)
"WhichAxis:=", <string>)

3D Modeler Editor Script Commands 11-51


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

FaceID
ID of the face on which to create the coordinate system.
PartID
ID of the object on which the face ID lies.
IsAttachedToEntity
Specifies whether the point is anchored (to a vertex, edge, or face).
If IsAttachedToEntity is true, provide the UParam and VParam
parameters. Otherwise, provide the XPosition, YPosition, and
ZPosition parameters.
EntityID
ID of the vertex, edge, or face to which the point is anchored.
PositionType
Place where the point is anchored.
Possible values are: "FaceCenter", "EdgeCenter", "OnVertex", "OnEdge", "OnFace"
UParam, VParam
Numbers between 0 and 1 representing the relative position of the point on the edge or
face.
Example: UParam = .5, VParam = .5 would be the center of a face.
XPosition, YPosition, ZPosition
Fixed position of the point.
WhichAxis
Possible values are "X", "Y", "Z"

CreateGroup
Use: Creates a group from specified objects in the history tree.
Command: Modeler>Group>Create
Syntax: CreateGroup Array(["NAME:GroupParameter", "ParentGroupID:=",
"Model", "Parts:=", "[objID],[objID], [objID]...", "Sub-
modelInstances:=", "", "Groups:=", "")
Return Value: None
Parameters: "Parts:=", "[objID],[objID], [objID]...",

3D Modeler Editor Script Commands 11-52


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

The object ID for the models to become part of the history tree group.
SubmodelInstances:=,"[submodelID]"
The object ID for any submodel instances.
Groups:=, " "
The name of a subgroup to be included in the history tree group
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("Project44")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateGroup Array("NAME:GroupParameter", "ParentGroupID:=",
"Model", _
"Parts:=", "Box1,Box2,Box3", "SubmodelInstances:=", "", "Groups:=",
"")

Pytho- CreateGroup ([Array(["NAME:GroupParameter", "ParentGroupID:=", "Model",


n Syn- "Parts:=", "[objID],[objID], [objID]...", "SubmodelInstances:=", "", "Groups:=", "")])
tax

oEditor.CreateGroup
Pytho- ([
n
Examp- Array("NAME:GroupParameter", "ParentGroupID:=", "Model", _
le
"Parts:=", "Box1,Box2,Box3", "SubmodelInstances:=", "",
"Groups:=", "")

3D Modeler Editor Script Commands 11-53


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

])

CreateObjectCS
Creates an Object coordinate system.
Command: Modeler>Coordinate System>Create>Object><Offset | Rotated | Both>
Syntax: CreateObjectCS <ParameterArrays>
Return Value: None
Parameters: Array("NAME:ObjectCSParameters",
"PartID:=", <ID>,
"ReverseXAxis:=", <Boolean>,
"ReverseYAxis:=", <Boolean>,
Array("NAME:Origin",
"IsAttachedToEntity:=", <Boolean>,
"EntityID:=", <ID>,
"PositionType:=", "<OnPositionID>,
String, one of OnVertex, FaceCenter, OnEdge, AbsolutePosition
"UParam:=", <integer>,
"VParam:=", <Integer>,
"XPosition:=", "<Integer>",
"YPosition:=", "<Integer>",
"ZPosition:=", "<Integer>"),
Array("NAME:xAxis",
"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", <Int>,
"FaceID:=", <Int>,
"xDirection:=", "<int>",
"yDirection:=", "<Int>",
"zDirection:=", "<Int>",
"UParam:=", <int>,
"VParam:=", <Int>),
Array("NAME:yAxis",

3D Modeler Editor Script Commands 11-54


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", <Int>,
"FaceID:=", <int>,
"xDirection:=", "<int>",
"yDirection:=", "<int>",
"zDirection:=", "<int>",
"UParam:=", <int>,
"VParam:=", <int>)),
Array("NAME:Attributes",
"Name:=", "<ObjectCSName>")
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("coax_bend")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateObjectCS Array("NAME:ObjectCSParameters",
"PartID:=", 24,
"ReverseXAxis:=", false,
"ReverseYAxis:=", false,
Array("NAME:Origin",
"IsAttachedToEntity:=",
true, "EntityID:=", 30,
"PositionType:=", "OnVertex",
"UParam:=", 0,
"VParam:=", 0,
"XPosition:=", "0",

3D Modeler Editor Script Commands 11-55


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"YPosition:=", "0",
"ZPosition:=", "0"),
Array("NAME:xAxis",
"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", -1,
"FaceID:=", -1,
"xDirection:=", "1",
"yDirection:=", "0",
"zDirection:=", "0",
"UParam:=", 0,
"VParam:=", 0),
Array("NAME:yAxis",
"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", -1,
"FaceID:=", -1,
"xDirection:=", "0",
"yDirection:=", "1",
"zDirection:=", "0",
"UParam:=", 0, "VParam:=", 0)),
Array("NAME:Attributes",
"Name:=", "ObjectCS1")

Python Syn- CreateObjectCS (<ParameterArrays>)


tax

oEditor.CreateObjectCS
([
Array("NAME:ObjectCSParameters",

"PartID:=", 24,
"ReverseXAxis:=", false,
"ReverseYAxis:=", false,
Array("NAME:Origin",
"IsAttachedToEntity:=",
Python true, "EntityID:=", 30,
Example "PositionType:=", "OnVertex",
"UParam:=", 0,
"VParam:=", 0,
"XPosition:=", "0",
"YPosition:=", "0",
"ZPosition:=", "0"),
Array("NAME:xAxis",
"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", -1,
"FaceID:=", -1,

3D Modeler Editor Script Commands 11-56


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"xDirection:=", "1",
"yDirection:=", "0",
"zDirection:=", "0",
"UParam:=", 0,
"VParam:=", 0),
Array("NAME:yAxis",
"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", -1,
"FaceID:=", -1,
"xDirection:=", "0",
"yDirection:=", "1",
"zDirection:=", "0",
"UParam:=", 0, "VParam:=", 0)),
Array("NAME:Attributes",
"Name:=", "ObjectCS1")
])

CreateObjectFromEdges
Use: Creates a polyline from the specified object edge.
Command: Modeler>Create Object From Edge
Syntax: CreateObjectFromEdges <SelectionsArray>,
<ObjFromEdgeParametersArray>
Return Value: None
Parameters: <SelectionsArray>
Array("NAME:Selections",
"Selections:=" <ObjName>)

<ObjFromEdgeParametersArray>
Array("NAME:Parameters",
<EdgeParametersArray>)

<EdgeParametersArray>
Array("Name:BodyFromEdgeToParameters",
"CoordinateSystemID:=", <int>,
"Edges:=", <EdgeIDarray>)
VB Example:

3D Modeler Editor Script Commands 11-57


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oEditor.CreateEdgeFromEdges _
Array("NAME:Selections", "Selections:=", "Box1"),_
Array("NAME:Parameters", _
Array("NAME:BodyFromEdgeToParameters", _
"CoordinateSystemID:=", -1, _
"Edges:=", Array(13)))

CreateObjectFromEdges ([
Python <SelectionsArray>,
Syntax
<ObjFromEdgeParametersArray>
])
oEditor.CreateEdgeFromEdges ([
Array("NAME:Selections", "Selections:=", "Box1"),_
Array("NAME:Parameters", _
Python
Array("NAME:BodyFromEdgeToParameters", _
Example
"CoordinateSystemID:=", -1, _
"Edges:=", Array(13)))
])

CreateObjectFromFaces
Use: Creates 2D objects from the specified faces.
Command: Modeler>Surface>Create Object From Face
Syntax: CreateObjectFromFaces <SelectionsArray>,
<ObjFromFaceParametersArray>
Return Value: None
Parameters: <ObjFromFaceParametersArray>
Array("NAME:Parameters",
<FacesOfOneObjToDetach>, <FacesOfOneObjToDetach>,
...)

<FacesOfOneObjToDetach>

3D Modeler Editor Script Commands 11-58


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("Name:BodyFromFaceToParameters",
"FacesToDetach:=", <array>)

FacesToDetach
Array of integers – the IDs of the faces to use to create objects.
VB Example:
oEditor.CreateObjectFromFaces _
Array("NAME:Selections", "Selections:=", "Box1"),_
Array("NAME:Parameters", _
Array("NAME:BodyFromFaceToParameters", _
"FacesToDetach:=", Array(185)))

CreateObjectFromFaces ([
Python <SelectionsArray>,
Syntax
<ObjFromFaceParametersArray>
])
oEditor.CreateObjectFromFaces ([
Array("NAME:Selections", "Selections:=", "Box1"),_

Python Array("NAME:Parameters", _
Example Array("NAME:BodyFromFaceToParameters", _
"FacesToDetach:=", Array(185)))
])

CreateRelativeCS
Use: Creates a relative coordinate system. Only the Name attribute of the <AttributesArray> para-
meter is supported.
Command: Modeler>Coordinate System>Create>Relative CS->Offset
Modeler>Coordinate System>Create>Relative CS->Rotated
Modeler>Coordinate System>Create>Relative CS->Both
Syntax: CreateRelativeCS <RelativeCSParametersArray>,

3D Modeler Editor Script Commands 11-59


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<AttributesArray>
Return Value: None
Parameters: <RelativeCSParametersArray>
Array("NAME:RelativeCSParameters",
"OriginX:=", <value>,
"OriginY:=", <value>,
"OriginZ:=", <value>,
"XAxisXvec:=", <value>,
"XAxisYvec:=", <value>,
"XAxisZvec:=", <value>,
"YAxisXvec:=", <value>,
"YAxisYvec:=", <value>,
"YAxisZvec:=", <value>)

DeleteEmptyGroups
Use: Removes a specified history tree group.
Command: Modeler>Group>Delete Empty
Syntax: DeleteEmptyGroups Array("Groups:=", Array("<GroupID>"))
Return Value: None
Parameters: <GroupID>,
The ID for the history tree groups to delete.
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow

3D Modeler Editor Script Commands 11-60


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oProject = oDesktop.SetActiveProject("Project44")


Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.DeleteEmptyGroups Array("Groups:=", Array("Group1"))

Python Syn- DeleteEmptyGroups ([ Array("Groups:=", Array("<GroupID>") ])


tax

oEditor.DeleteEmptyGroups

Python ([
Example Array("Groups:=", Array("Group1")
)])

DeleteLastOperation
Use: Deletes the last operation for specified objects.
Command: Modeler>Delete Last Operation
Syntax: DeleteLastOperation <SelectionsArray>
Return Value: None

DetachFaces
Detaches the specified faces.
Command: Modeler>Surface>Detach Faces
Syntax: DetachFaces <SelectionsArray>,
<DetachFacesParametersArray>
Return Value: None
Parameters: <DetachFacesParametersArray>
Array("NAME:Parameters",
<FacesOfOneObjToDetach>,
<FacesOfOneObjToDetach>, ...)

<FacesOfOneObjToDetach>
Array("Name:DetachFacesToParameters",
"FacesToDetach:=", <array>)

3D Modeler Editor Script Commands 11-61


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

FacesToDetach
An array of integers – the face IDs of the faces to detach.
VB Example:
oEditor.DetachFaces _
Array("NAME:Selections", "Selections:=",_
"Box5,Box4"),_
Array("NAME:Parameters", _
Array("NAME:DetachFacesToParameters", _
"FacesToDetach:=", Array(123, 122)),
Array("NAME:DetachFacesToParameters", _
"FacesToDetach:=", Array(94)))

DetachFaces ([
Python Syn- <SelectionsArray>,
tax
<DetachFacesParametersArray>
])
oEditor.DetachFaces
([
Array("NAME:Selections", "Selections:=",_
"Box5,Box4"),_

Python Array("NAME:Parameters", _
Example Array("NAME:DetachFacesToParameters", _
"FacesToDetach:=", Array(123, 122)),
Array("NAME:DetachFacesToParameters", _
"FacesToDetach:=", Array(94)))
])

EditEntityList
Modifies an entity list.
Command: Modeler>List>Reassign

3D Modeler Editor Script Commands 11-62


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syntax: EditEntityList <SelectionsArray>,


<EntityListParametersArray>
Return Value: None

EditFaceCS
Recreates an existing face coordinate system. The name of the coordinate system to modify
should be specified in the <AttributesArray> parameter.
Command: Modeler->Coordinate System->Edit
Syntax: EditFaceCS <FaceCSParametersArray>, <AttributesArray>
Return Value: None

EditObjectCS
Use: Edit an existing Object CS.
Command: Click Modeler>Coordinate System>Edit
Syntax: EditObjectCS <Array>
Return Value: None
Parameters: Array("NAME:ObjectCSParameters",
"PartID:=", <ID>,
"ReverseXAxis:=", <Boolean>,
"ReverseYAxis:=", <Boolean>,
Array("NAME:Origin",
"IsAttachedToEntity:=", <Boolean>,
"EntityID:=", <ID>,
"PositionType:=", "<OnPositionID>,
String, one of: OnVertex, FaceCenter, OnEdge, AbsolutePosition
"UParam:=", <integer>,
"VParam:=", <Integer>,
"XPosition:=", "<Integer>",
"YPosition:=", "<Integer>",
"ZPosition:=", "<Integer>"),
Array("NAME:xAxis",
"DirectionType:=", "AbsoluteDirection",

3D Modeler Editor Script Commands 11-63


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"EdgeID:=", <Int>,
"FaceID:=", <Int>,
"xDirection:=", "<int>",
"yDirection:=", "<Int>",
"zDirection:=", "<Int>",
"UParam:=", <int>,
"VParam:=", <Int>),
Array("NAME:yAxis",
"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", <Int>,
"FaceID:=", <int>,
"xDirection:=", "<int>",
"yDirection:=", "<int>",
"zDirection:=", "<int>",
"UParam:=", <int>,
"VParam:=", <int>)),
Array("NAME:Attributes",
"Name:=", "<ObjectCSName>")
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project53")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")

3D Modeler Editor Script Commands 11-64


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oEditor = oDesign.SetActiveEditor("3D Modeler")


oEditor.SetWCS Array("NAME:SetWCS Parameter",
"Working Coordinate System:=", "ObjectCS1")
oEditor.EditObjectCS Array("NAME:ObjectCSParameters",
"PartID:=", 6,
"ReverseXAxis:=", false,
"ReverseYAxis:=", false,
Array("NAME:Origin", "IsAttachedToEntity:=", false,
"EntityID:=", -1,
"PositionType:=", "AbsolutePosition",
"UParam:=", 0, "VParam:=", 0,
"XPosition:=", "0mm", "YPosition:=", "0mm",
"ZPosition:=", "0mm"),
Array("NAME:xAxisPos", "IsAttachedToEntity:=", true,
"EntityID:=", 13,
"PositionType:=", "OnEdge",
"UParam:=", 0.75, "VParam:=", 0,
"XPosition:=", "0", "YPosition:=", "0", "ZPosition:=", "0"), Array
("NAME:yAxisPos", "IsAttachedToEntity:=", true,
"EntityID:=", 7,
"PositionType:=", "FaceCenter",
"UParam:=", 0, "VParam:=", 0,
"XPosition:=", "0", "YPosition:=", "0", "ZPosition:=", "0")), Array
("NAME:Attributes", "Name:=", "ObjectCS1")

Python EditObjectCS (<Array>)


Syntax

oEditor.EditObjectCS

Python
([
Example Array("NAME:ObjectCSParameters",
"PartID:=", 6,

3D Modeler Editor Script Commands 11-65


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"ReverseXAxis:=", false,
"ReverseYAxis:=", false,
Array("NAME:Origin", "IsAttachedToEntity:=", false,
"EntityID:=", -1,
"PositionType:=", "AbsolutePosition",
"UParam:=", 0, "VParam:=", 0,
"XPosition:=", "0mm", "YPosition:=", "0mm",
"ZPosition:=", "0mm"),
Array("NAME:xAxisPos", "IsAttachedToEntity:=", true,
"EntityID:=", 13,
"PositionType:=", "OnEdge",
"UParam:=", 0.75, "VParam:=", 0,
"XPosition:=", "0", "YPosition:=", "0", "ZPosition:=",
"0"), Array("NAME:yAxisPos", "IsAttachedToEntity:=", true,
"EntityID:=", 7,
"PositionType:=", "FaceCenter",
"UParam:=", 0, "VParam:=", 0,
"XPosition:=", "0", "YPosition:=", "0", "ZPosition:=",
"0")), Array("NAME:Attributes", "Name:=", "ObjectCS1")
])

EditRelativeCS
Modifies a relative coordinate system. Use <AttributesArray> to indicate the name of the coordin-
ate system to modify.
Command: Modeler>Coordinate System>Edit
Syntax: EditRelativeCS <RelativeCSParametersArray>,
<AttributesArray>
Return Value: None
Parameters: <ParametersArray>
Array("NAME:RelativeCSParameters",
"OriginX:=", <value>,
"OriginY:=", <value>,

3D Modeler Editor Script Commands 11-66


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"OriginZ:=", <value>,
"XAxisXvec:=", <value>,
"XAxisYvec:=", <value>,
"XAxisZvec:=", <value>,
"YAxisXvec:=", <value>,
"YAxisYvec:=", <value>,
"YAxisZvec:=", <value>)

Export
Exports the model to a file.
Command: Modeler>Export
Syntax: Export <ExportParametersArray>
Return Value: None
Parameters: <ExportParametersArray>
Array("NAME:ExportParameters",
"File Name:=", <string>,
"Major Version:=", <int>,
"Minor Version:=", <int>)

Major Version
Can be –1 or any ACIS major version supported by HFSS software.
Minor Version
Can be –1 or any ACIS minor version supported by HFSS software.

ExportModelImageToFile
Use: Export an image of the model to a file. For high resolution images, you can set environment
variables to specify pixel width and height.
Command: Modeler>Export...
Syntax: ExportModelImageToFile "<path>/<imageName>.<formatsuffix>" 0,0, Array
(<SaveImageParams>)
Return Value: None
Parameters: <path>
<imagename>

3D Modeler Editor Script Commands 11-67


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<formatsuffix>, You can export the following graphics formats:

Extension Contents
.bmp Bitmap files.
.gif Graphics Interchange Format files.
.jpeg Joint Photographics Experts Group files.
.tiff Tagged Image File Format files.
.wrl Virtual Reality Modeling Language (VRML) files.

<width>,<height>,
For the default, use 0, 0. For higher resolution, set desired <width> and <height>, for
example for 8k export as: 7680, 4320.

Array("NAME:SaveImageParams",
"ShowAxis:=","<Boolean>",
"ShowGrid:=", "<Boolean>",
"ShowRuler:=", "<Boolean>"
"ShowRegions:=" "<Default>",
"Selections:=" ,"")
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 15.0.0
' 2:28:32 PM Jul 30, 2012
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("dra_diel")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")

3D Modeler Editor Script Commands 11-68


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oEditor = oDesign.SetActiveEditor("3D Modeler")


oEditor.ExportModelImageToFile _
"C:/MyPath/Downloads/dra_example.jpg", 0, 0,
Array("NAME:SaveImageParams", "ShowAxis:=", _
"Default", "ShowGrid:=", "Default", "ShowRuler:=", "Default")

Python Syn- ExportModelImageToFile (["<path>/<imageName>.<formatsuffix>" 0,0,


tax [(<SaveImageParams>)])
oEditor.ExportModelImageToFile
("C:/MyPath/Downloads/dra_example.jpg", 0, 0,
[
"NAME:SaveImageParams",
"ShowAxis:=" , "True",
Python
Example "ShowGrid:=" , "True",
"ShowRuler:=" , "True",
"ShowRegion:=" , "Default",
"Selections:=" , ""
])

oEditor.ExportModelImageToFile
("C:/Users/MyName/Documents/highresexample_image.jpg",
7680, 4320,
[
Python
"NAME:SaveImageParams",
Example
"ShowAxis:=" , "True",
using High
"ShowGrid:=" , "True",
Resolution
"ShowRuler:=" , "True",
settings.
"ShowRegion:=" ,
"Default",
"Selections:=" , ""
])

Fillet
Creates a fillet.
Command: Modeler>Fillet
Syntax: Fillet(<ObjectName> <FilletParameters>)
Return Value: None

3D Modeler Editor Script Commands 11-69


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Parameters: <ObjectName>
Array("NAME:Selections", _
"Selections:=", <string>),
<FilletParameters>
Array("NAME:Parameters", _
Array("NAME:FilletParameters", _
"CoordinateSystemID:=", <value>,
"Edges:=", <ArrayOfEdgeIDs>,
"Radius:=", <value>,
"Setback:=", <value>))

VB Example:
oEditor.Fillet Array("Name:Selections", "Selections:=", _
"Box1"), Array("NAME:Parameters", Array("NAME:FilletParameters", _
"CoordinateSystemID:=", -1, "Edges:=", Array(13), "Radius:=", _
"1mm", "Setback:=", "0mm"))

Python Fillet ([ <ObjectName> <FilletParameters> ])


Syntax

oEditor.Fillet
([
Array("Name:Selections", "Selections:=",
_
Python "Box1"), Array("NAME:Parameters", Array("NAME:Fil-
Exampl- letParameters",
e _
"CoordinateSystemID:=", -1, "Edges:=", Array(13),
"Radius:=", _
"1mm", "Setback:=", "0mm"))
])

3D Modeler Editor Script Commands 11-70


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

FlattenGroup
Use: Flattens a specified history tree group.
Command: Modeler>Group>Flatten
Syntax: FlattenGroup Array("Groups:=", Array("<GroupID>"))
Return Value: None
Parameters: <GroupID>,
The ID for the history tree groups to flatten.

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("Project44")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.Ungroup Array("Groups:=", Array("Group1"))

GenerateHistory
Generates the history for specified 1D objects.
Command: Modeler>Generate History
Syntax: GenerateHistory <SelectionsArray>
Return Value: None

HealObject
Use:To heal an imported object.
Command: Click Modeler>Model Healing>Heal

3D Modeler Editor Script Commands 11-71


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syntax:HealObject <parameters>
Return Value:None
Parameters:Array("NAME:Selections",
"Selections:=", "<objectID>",
"NewPartsModelFlag:=", ["Model" | "NonModel"]),
Array("NAME:ObjectHealingParameters",
"Version:=", 1,
"AutoHeal:=", <boolean>,
"TolerantStitch:=", <boolean>,
"SimplifyGeom:=", <boolean>,
"TightenGaps:=", <boolean>,
"StopAfterFirstStitchError:=", <boolean>,
"MaxStitchTol:=", <smallvalue>,
"ExplodeAndStitch:=", <boolean>,
"GeomSimplificationTol:=", <value>,
"MaximumGeneratedRadiusForSimplification:=", <value>,
"SimplifyType:=", 2,
"TightenGapsWidth:=", <value>,
"RemoveSliverFaces:=", <boolean>,
"RemoveSmallEdges:=", <boolean>,
"RemoveSmallFaces:=", <boolean>,
"SliverFaceTol:=", <value>,
"SmallEdgeTol:=", <value>,
"SmallFaceAreaTol:=", <value>,
"BoundingBoxScaleFactor:=", <value>,
"RemoveHoles:=", <boolean>,
"RemoveChamfers:=", <boolean>,
"RemoveBlends:=", <boolean>,
"HoleRadiusTol:=", <value>,
"ChamferWidthTol:=", <value>,

3D Modeler Editor Script Commands 11-72


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"BlendRadiusTol:=", <value>,
"AllowableSurfaceAreaChange:=", <value>,
"AllowableVolumeChange:=", <value>)

VB Example:
oEditor.HealObject Array("NAME:Selections",
"Selections:=", "Box1",
"NewPartsModelFlag:=", "Model"),
Array("NAME:ObjectHealingParameters",
"Version:=", 1,
"AutoHeal:=", false,
"TolerantStitch:=", true,
"SimplifyGeom:=", true,
"TightenGaps:=", true,
"StopAfterFirstStitchError:=", false,
"MaxStitchTol:=", 0.001,
"ExplodeAndStitch:=", true,
"GeomSimplificationTol:=", -1,
"MaximumGeneratedRadiusForSimplification:=", -1,
"SimplifyType:=", 2,
"TightenGapsWidth:=", 1E-006,
"RemoveSliverFaces:=", true,
"RemoveSmallEdges:=", true,
"RemoveSmallFaces:=", true,
"SliverFaceTol:=", 0,
"SmallEdgeTol:=", 0.1,
"SmallFaceAreaTol:=", 0.1,
"BoundingBoxScaleFactor:=", 1250,
"RemoveHoles:=", true,
"RemoveChamfers:=", true,

3D Modeler Editor Script Commands 11-73


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"RemoveBlends:=", true,
"HoleRadiusTol:=", 0.1,
"ChamferWidthTol:=", 0.1,
"BlendRadiusTol:=", 0.1,
"AllowableSurfaceAreaChange:=", 5,
"AllowableVolumeChange:=", 5)

Python HealObject (<parameters>)


Syntax

oEditor.HealObject
([
Array("NAME:Selections",
"Selections:=", "Box1",
"NewPartsModelFlag:=", "Model"),
Array("NAME:ObjectHealingParameters",
"Version:=", 1,
"AutoHeal:=", false,
"TolerantStitch:=", true,
"SimplifyGeom:=", true,
Python
"TightenGaps:=", true,
Example
"StopAfterFirstStitchError:=", false,
"MaxStitchTol:=", 0.001,
"ExplodeAndStitch:=", true,
"GeomSimplificationTol:=", -1,
"MaximumGeneratedRadiusForSimplification:=", -1,
"SimplifyType:=", 2,
"TightenGapsWidth:=", 1E-006,
"RemoveSliverFaces:=", true,
"RemoveSmallEdges:=", true,
"RemoveSmallFaces:=", true,

3D Modeler Editor Script Commands 11-74


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"SliverFaceTol:=", 0,
"SmallEdgeTol:=", 0.1,
"SmallFaceAreaTol:=", 0.1,
"BoundingBoxScaleFactor:=", 1250,
"RemoveHoles:=", true,
"RemoveChamfers:=", true,
"RemoveBlends:=", true,
"HoleRadiusTol:=", 0.1,
"ChamferWidthTol:=", 0.1,
"BlendRadiusTol:=", 0.1,
"AllowableSurfaceAreaChange:=", 5,
"AllowableVolumeChange:=", 5)
])

GetActiveCoordinateSystem
Get active coordinate system.
Command: None.
Syntax: GetActiveCoordinateSystem
Return Value: Active coordinate name.
Parameters: None.
VB Example:
Dim csName
csName = oEditor.GetActiveCoordinateSystem

Python Syn- GetActiveCoordinateSystem([])


tax

Python oEditor.GetActiveCoordinateSystem([])
Example

GetCoordinateSystems
Get coordinate system names.

3D Modeler Editor Script Commands 11-75


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Command: None
Syntax: GetCoordinateSystems
Return Value: An array of coordinate system names
Parameters: None
VB Example:
Dim csNames
csNames = oEditor.GetCoordinateSystems ()

Import
Imports a 3D model file.
Command: Modeler>Import
Syntax: Import <ImportParametersArray>
Return Value: None
Parameters: <ImportParametersArray>
Array("NAME:NativeBodyParameters",
"CoordinateSystemID:=", <ID>,
"HealOption:=", <integer>,
"HealSTL":=, <integer>,
"CheckModel:=", <boolean>,
"Options:=", "",
"FileType:=", "UnRecognized",
"MaxStitchTol:=", <value>,
"SourceFile:=", "string")

For Q3D Extractor the Import command details are as follows:


Imports a 3D model file.
Command: Modeler>Import
Syntax: Import <ImportParametersArray>
Return Value: None
Parameters: <ImportParametersArray>

3D Modeler Editor Script Commands 11-76


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:NativeBodyParameters",
"AutoHeal:=", <bool>,
"Options:=", <string>,
VB Example: oDesign.Import("SourceFile:=", <string>)

Example STL to HFSS


' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2019.2.0
' 15:18:19 Feb 22, 2019
' ----------------------------------------------
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("Project7")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.Import Array("NAME:NativeBodyParameters", "HealOption:=", 0,
"Options:=", "-1", "FileType:=", "UnRecognized", "MaxStitchTol:=", -
1,
"ImportFreeSurfaces:=", false, "GroupByAssembly:=", false,
"CreateGroup:=", true, "STLFileUnit:=", _
"Auto", "MergeFacesAngle:=", 0.02, "HealSTL:=", true,
"PointCoincidenceTol:=", 1E-06, "CreateLightweightPart:=", false,
"ImportMaterialNames:=", false,_
"SeparateDisjointLumps:=", false, _

3D Modeler Editor Script Commands 11-77


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"SourceFile:=", _
"D:\ANSYS Electronics Desktop Projects\TeeModelforSpaceClaim.stl")

Python Syn- Import (<ImportParametersArray>)


tax

oEditor = oDesign.SetActiveEditor("3D Modeler")


oEditor.Import(
[
"NAME:NativeBodyParameters",
"HealOption:=" , 0,
"Options:=" , "-1",
"FileType:=" , "UnRecognized",
"MaxStitchTol:=" , -1,
"ImportFreeSurfaces:=" , False,
"GroupByAssembly:=" , False,
Python
Example "CreateGroup:=" , True,
"STLFileUnit:=" , "Auto",
"MergeFacesAngle:=" , 0.02,
"HealSTL:=" , True,
"PointCoincidenceTol:=" , 1E-06,
"CreateLightweightPart:=", False,
"ImportMaterialNames:=" , False,
"SeparateDisjointLumps:=", False,
"SourceFile:=" , "D:\\ANSYS Electronics Desktop Pro-
jects\\TeeModelforSpaceClaim.stl"
])

ImportDXF
Imports an AutoCAD model file and a tech file. The tech file is an ASCII file that lists the units, the
layer name followed by tab delimited color, elevations and thickness.
Command: Modeler>Import

3D Modeler Editor Script Commands 11-78


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syntax: ImportDXF <ImportParametersArray>


Return Value: None
Parameters: <ImportParametersArray>
Array("NAME:options",
"FileName:=", <path>,
"Scale:=", <real>,
"UnionOverlapping:=", <boolean>,
"AutoDetectClosed:=", <boolean>,
"SelfStitch:=", <boolean>,
"DefeatureGeometry:=", <boolean>,
"DefeatureDistance:=", <real>,
"RoundCoordinates:=", <boolean>,
"RoundNumDigits:=", <integer>,
"WritePolyWithWidthAsFilledPoly:=", <boolean>,
"ImportMethod:=", <integer>,
"2DSheetBodies:=", <boolean>,
Array("NAME:LayerInfo",
Array("NAME:<layerName>",
"source:=", "<integer>",
"display_source:=", "<integer>",
"import:=", <boolean>,
"dest:=", "<integer>",
"dest_selected:=", <boolean>,
"layer_type:=", "<string>",
"paint:=", <boolean>),
Array("NAME:TechFileLayers", "layer:=",
Array("name:=", "ground",
"color:=", "purple",
"elev:=", 0,
"thick:=", 0.0001),

3D Modeler Editor Script Commands 11-79


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

)))
oEditor.Import Array("NAME:NativeBodyParameters",
"CoordinateSystemID:=", -1,
"HealOption:=", <integer>,
"CheckModel:=", <boolean>,
"Options:=", "",
"FileType:=", "UnRecognized",
"MaxStitchTol:=", <real>,
"SourceFile:=", "<path>" & ".sm3")

VB Example:
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.ImportDXF Array("NAME:options", "FileName:=", _
"C:/mymodel.dxf", ...
Array("NAME:TechFileLayers", ...
"layer:=", Array("name:=", "BOTTOMLAYER",
"color:=", "purple",
"elev:=", 0,
"thick:=", 200),
)))
oEditor.Import Array("NAME:NativeBodyParameters",
"CoordinateSystemID:=", -1,
"HealOption:=", 0,
"CheckModel:=", true,
"Options:=", "",
"FileType:=", "UnRecognized",
"MaxStitchTol:=", 0.001,
"SourceFile:=", "C:design." & ".sm3")

3D Modeler Editor Script Commands 11-80


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Syn- ImportDXF (<ImportParametersArray>)


tax

oEditor.ImportDXF ([
Array("NAME:options", "FileName:=",
_
"C:/mymodel.dxf", ...
Array("NAME:TechFileLayers", ...
Python "layer:=", Array("name:=", "BOTTOMLAYER",
Example
"color:=", "purple",
"elev:=", 0,
"thick:=", 200),
)))
])

ImportGDSII [Modeler Import]


Imports a GDSII 3D model file.
Command: Modeler>Import
Syntax: ImportGDSII <ImportParametersArray>
Return Value: None
Parameters:
"FileName:=", "<string>",
"NodeConversionType:=", "<string>",
"MaxLayerNumber:=", <integer>,
"ApproxPolyToCircle:=", <boolean>,
"FlattenHierarchy:=", <boolean>,
"ImportMethod:=", <integer>,
Array("NAME:LayerMap",
Array("NAME:LayerMapInfo",
"LayerNum:=", <integer>,
"Import:=", <booleaninteger>,
"IsVIA:=", <booleaninteger>,

3D Modeler Editor Script Commands 11-81


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"IsLayerNew:=", <booleanInteger>,
"DestLayer:=", "<string>",
"layer_type:=", "<string>",
"IsPresentInLayout:=", <boolean>),

"OrderMap:=", Array("entry:=",
Array("order:=", <integer>,
"layer:=", "<string>"),
"entry:=", Array("order:=",
<integer>, "layer:=", "Signal25"),
"entry:=", Array("order:=", <integer+1>,
"layer:=", "Signal30"),
...),
Array("NAME:Structs",
Array("NAME:GDSIIStruct", "ImportStruct:=", <boolean>,
"CreateNewCell:=", <boolean>,
"StructName:=", "string>",
Array("NAME:Elements")),
Array("NAME:GDSIIStruct", "ImportStruct:=",<boolean>,
"CreateNewCell:=", <boolean>,
"StructName:=", "<string>",
Array("NAME:Elements"))))

oEditor.Import Array("NAME:NativeBodyParameters",
"CoordinateSystemID:=", <ID>,
"HealOption:=", <integer>,
"CheckModel:=", <boolean>,
"Options:=", "",
"FileType:=", "UnRecognized",
"MaxStitchTol:=", <value>,

3D Modeler Editor Script Commands 11-82


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"SourceFile:=", "string")

VB Example:
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.ImportGDSII Array("NAME:options", ...

Intersect
Use: Intersects specified objects.
Command: Modeler>Boolean>Instersect
Syntax: Intersect <SelectionsArray>, <IntersectParametersArray>
Return Value: None
Parameters: <IntersectParametersArray>
Array("NAME:IntersectParameters",
"KeepOriginals:=", <bool>)

MoveCStoEnd
Moves the named ObjectCS to the end of the History tree.
Command: Modeler>Coordinate System>Move CS to End
Syntax: MoveCSToEnd Array("NAME:Selections",
"Selections:=", "<ObjectCSName>")
Return Value: None
Parameters: <ObjectCSName>
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")

3D Modeler Editor Script Commands 11-83


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oDesktop = oAnsoftApp.GetAppDesktop()


oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("coax_bend")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.MoveCSToEnd Array("NAME:Selections",
"Selections:=", "ObjectCS1")

Python MoveCSToEnd ([Array("NAME:Selections",


Syntax "Selections:=", "<ObjectCSName>"])

Python ooEditor.MoveCSToEnd ([Array("NAME:Selections",


Example "Selections:=", "ObjectCS1")])

MoveEntityToGroup
Use: Moves a specified entity to an existing history tree group.
Command: None.
Syntax: MoveEntityToGroup Array("Groups:=", Array("<entityID>")),
Array("ParentGroup:=", "<target_GroupID>")
Return Value: None
Parameters: <entityID>,
The ID for the models or groups to become part of the parent history tree group.
<target_GroupID>"
The parent history tree ID.
Groups:=, " "

Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule

3D Modeler Editor Script Commands 11-84


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")


Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project44")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.MoveEntityToGroup Array("Groups:=", Array("Box_Group1")), _
Array("ParentGroup:=", "Box_Group")

MoveFaces
Use: Moves the specified faces along normal or along a vector.
Command: Modeler>Surface>Move Faces>Along Normal
Modeler>Surface>Move Faces>Along Vector
Syntax: MoveFaces <SelectionsArray>, <MoveFacesParametersArray>
Return Value: None
Parameters: <MoveFacesParametersArray>
Array("NAME:Parameters",
<FacesOfOneObjToMove>, <FacesOfOneObjToMove>, ...)

<FacesOfOneObjToMove>
Array("Name:MoveFacesParameters",
"MoveAlongNormalFlag:=", <bool>,
"OffsetDistance:=", <value>,
"MoveVectorX:=", <value>,
"MoveVectorY:=", <value>,
"MoveVectorZ:=", <value>,
"FacesToMove:=", <array>)

MoveAlongNormalFlag
Specifies whether to move along the face normal or along a vector.
If false, provide the MoveVectorX, MoveVectorY, and MoveVectorZ parameters.

3D Modeler Editor Script Commands 11-85


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

FacesToMove
Array of integers – the IDs of the faces to move
VB Example:
oEditor.MoveFaces _
Array("NAME:Selections", "Selections:=", _
"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)))

Python Syn- MoveFaces (<SelectionsArray>, <MoveFacesParametersArray>)


tax

oEditor.MoveFaces
([
Array("NAME:Selections", "Selections:=", _

Python "Box2,Box1"), _
Example Array("NAME:Parameters", _
Array("NAME:MoveFacesParameters", _
"MoveAlongNormalFlag:=", true, _
"OffsetDistance:=", "1mm", _

3D Modeler Editor Script Commands 11-86


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"FacesToMove:=", Array(218)),
Array("NAME:MoveFacesParameters", _
"MoveAlongNormalFlag:=", false,_
"OffsetDistance:=", "1mm", _
"MoveVectorX:=", "1mm", _
"MoveVectorY:=", "0mm", _
"MoveVectorZ:=", "0mm", _
"FacesToMove:=", Array(185)))
])

ProjectSheet
Use: Project HFSS sheet object, typically for modeling thin conformal deposits. Typically followed
by Thicken Sheet.
Command: Click Modeler>Surface>Project Sheet
Syntax: ProjectSheet (Array("NAME:Selections",Selections:="...,...,""), Array("NAME:Pro-
jectSheetParameters")
Return Value: None
Parameters: None
VB Example:
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.ProjectSheet Array("NAME:Selections", "Selections:=",
"Box1,Box2,Polyline1"),
array("NAME:ProjectSheetParameters")

Python Syn- ProjectSheet ([(Array("NAME:Selections",Selections:="...,...,""), Array


tax ("NAME:ProjectSheetParameters")])
oEditor.ProjectSheet
([
Python
Example Array("NAME:Selections", "Selections:=",
"Box1,Box2,Polyline1"),
array("NAME:ProjectSheetParameters")

3D Modeler Editor Script Commands 11-87


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

])

PurgeHistory
Use:Purges the construction history of the selected object. For complex objects this simplifies the
object and can improve modeler speed.
Command:Click Modeler>Purge History
Syntax:PurgeHistory <PurgeHistoryArray>
Return Value:None
Parameters:<PurgeHistoryArray>
Array("Name:Selections",
"Selections:=", <string>,
"NewPartsModelFlag:=", ["Model" | "NonModel"])
Selections
Name of the object to purge.
NewPartsModelFlag
Flag to indicate model properties, Model or NonModel.
VB Example:
oEditor.PurgeHistory Array("NAME:Selections", _
"Selections:=", "Polygon1", "NewPartsModelFlag:=", "Model")

Python PurgeHistory (<PurgeHistoryArray>)


Syntax

oEditor.PurgeHistory
([
Python Array("NAME:Selections", _
Example
"Selections:=", "Polygon1", "NewPartsModelFlag:=",
"Model")
])

ReplaceWith3DComponent
Use: Replace selection with a 3D component

3D Modeler Editor Script Commands 11-88


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Command: Replace with 3D Component


Syntax: ReplaceWith3DComponent <Geometry Data>, <Design Data>, <File Name>, <Image
File>
Return Value: None
Parameters: < Geometry Data>
Geometry data
< Design Data>
Design data
< File Name>
File name of 3D component
< Image File>
File name of 3D component image
VB Example:
oEditor.ReplaceWith3DComponent Array("NAME:CreateData", "Com-
ponentName:=", _
"ConnectorOnly_wBCs", "Company:=", "", "Company URL:=", "", "Model
Number:=", "", "Help URL:=", _
"", "Version:=", "1.0", "Notes:=", "", "IconType:=", "", "Own-
er:=", _
"MyName", "Email:=", "[email protected]", "Date:=", "3:07:37 PM Jun 25,
2019", _
"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:=", ""), "IsLicensed:=", false, _

3D Modeler Editor Script Commands 11-89


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"LicensingDllName:=", "", "VendorComponentIdentifier:=", _


"", "PublicKeyFile:=", ""), Array("NAME:DesignData", "Bound-
aries:=", Array( _
"PinSurface", "Connect"), "Excitations:=", Array("1", "2"),
"MeshOperations:=", Array( _
"Length1", "SkinDepth1")), "", Array("NAME:ImageFile",
"ImageFile:=", "")

Python Syn- ReplaceWith3DComponent (<Geometry Data>, <Design Data>, <File Name>,


tax <Image File>)
oEditor.ReplaceWith3DComponent(
[
"NAME:ReplaceData",
"ComponentName:=" , "CoaxBend",
"Company:=" , "",
"Company URL:=" , "",
"Model Number:=" , "",
"Help URL:=" , "",
"Version:=" , "1.0",
"Notes:=" , "",
Python
Example "IconType:=" , "",
"Owner:=" , "Emily",
"Email:=" , "[email protected]",
"Date:=" , "3:46:31 PM Dec 26, 2018",
"HasLabel:=" , False,
"IncludedParts:=" , ["out-
er","teflon","inner","teflon_1"],
"HiddenParts:=" , [],
"IncludedCS:=" , [],
"ReferenceCS:=" , "Global",
"IncludedParameters:=" , ["bend_angle"],

3D Modeler Editor Script Commands 11-90


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"ParameterDescription:=", [ "bend_angle:=" , ""]


],
[
"NAME:DesignData",
"Excitations:=" , ["1","2"]
],
[
"NAME:ImageFile",
"ImageFile:=" , ""
])

Section
Use: Creates a 2D cross-section of the selection in the specified plane.
Command: Modeler>Surface>Section
Syntax: Section <SelectionsArray>, <SectionParametersArray>
Return Value: None
Parameters: <SectionParametersArray>
Array("NAME:SectionToParameters",
"SectionPlane:=", <string>)
Section Plane
Possible values are "XY", "YZ", "ZX"

SeparateBody
Use: Separates bodies of specified multi-lump objects.
Command: Modeler>Boolean>Separate Bodies
Syntax: SeparateBody <SelectionsArray>
Return Value: None
Parameters: <SelectionsArray>
Selections:=",<objectNames>"
"NewPartsModelFlag:=", ["Model" | "NonModel"]
Indicates the type of model properties in the geometry - Model or Non Model.
VB Example:

3D Modeler Editor Script Commands 11-91


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oDesign = oProject.SetActiveDesign("HFSSDesign1")


Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.SeparateBody Array("NAME:Selections",
"Selections:=", "Rectangle1,Circle1",
"NewPartsModelFlag:=", "Model")

Python Syn- SeparateBody (<SelectionsArray>)


tax

oEditor.SeparateBody
([
Python Array("NAME:Selections",
Example "Selections:=", "Rectangle1,Circle1",
"NewPartsModelFlag:=", "Model")
])

SetModelUnits
Use: Sets the model units.
Command: Modeler>Units
Syntax: SetModelUnits <ModelUnitsParametersArray>
Return Value: None
Parameters: <ModelUnitsParametersArray>
Array("NAME:Units Parameter",
"Units:=", <string>,
"Rescale:=", <bool>)
Units
Possible values are: "cm", "ft", "in", "meter", "mil", "mm", "nm", "uin", "um"

SetWCS
Use: Sets the working coordinate system.
Command: Modeler>Coordinate System>Set Working CS
Syntax: SetWCS <WCSParametersArray>
Return Value: None

3D Modeler Editor Script Commands 11-92


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Parameters: <WCSParametersArray>
Array("NAME:SetWCS Parameter",
"Working Coordinate System:=", <string>)
Working Coordinate System
Name of the coordinate system to set as the WCS.

ShowWindow
Opens the selected 3D model editor window.
Syntax: ShowWindow
Return Value: None
Parameters: None
VB Example:
Set oDesign = oProject.GetActiveDesign
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.ShowWindow

Python Syn- ShowWindow()


tax

Python oEditor.ShowWindow()
Example

Split
Use: Splits specified objects along a plane.
Command: Modeler->Boolean->Split
Syntax: Split <SelectionsArray>, <SplitParametersArray>
Return Value: None
Parameters: <SplitParametersArray>
Array("NAME:SplitToParameters",
"SplitPlane:=", <string>,
"WhichSide:=", <string>)
SplitPlane

3D Modeler Editor Script Commands 11-93


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Possible values are "XY", "YZ", "ZX"


Possible values for 2D XY Designs are "YZ", "ZX".
Possible values for 2D RZ Designs are "XY", "YZ".
WhichSide
Side to keep. Possible values are "Both", "PositiveOnly", "NegativeOnly"

Subtract
Use: Subtracts specified objects.
Command: Modeler->Boolean->Subtract
Syntax: Subtract <SubtractSelectionsArray>,
<SubtractParametersArray>
Return Value: None
Parameters: <SubtractSelectionsArray>
Array("NAME:Selections",
"Blank Parts:=", <string>,
"Tool Parts:=", <string>)
Blank Parts
Comma-separated list of parts to use as the blank in the subtract operation.
Example: "Blank Parts:=", "Box1, Box2"
Tool Parts
Comma-separated list of parts to use as the tool in the subtract operation.
Example: "Blank Parts:=", "Box3, Box4"
<SubtractParametersArray>
Array("NAME:SubtractParameters",
"KeepOriginals:=", <bool>)
VB Example:
oEditor.Subtract _
Array("NAME:Selections", _
"Blank Parts:=", "Polygon1",_
"Tool Parts:=", "Box1"),_
Array("NAME:SubtractParameters", _

3D Modeler Editor Script Commands 11-94


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"KeepOriginals:=", false)

Subtract ([
Python Syn- <SubtractSelectionsArray>,
tax
<SubtractParametersArray>
])
oEditor.Subtract
([
Array("NAME:Selections", _

Python "Blank Parts:=", "Polygon1",_


Example "Tool Parts:=", "Box1"),_
Array("NAME:SubtractParameters", _
"KeepOriginals:=", false)
])

SweepFacesAlongNormal
Use: Sweep a face along normal.
Command: Modeler>Sweep Faces Along Normal
Syntax: SweepFacesAlongNormal <selection> <parameters>
Return Value: None
Parameters: Array("NAME:Selections",
"Selections:=", "<faceID>",
"NewPartsModelFlag:=", ["Model" | "NonModel"]),
Array("NAME:Parameters",
Array("NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=", Array( <faceID>),
"LengthOfSweep:=", "<value><units>")
)
VB Example:
oEditor.SweepFacesAlongNormal
Array("NAME:Selections",

3D Modeler Editor Script Commands 11-95


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Selections:=", "Rectangle1",
"NewPartsModelFlag:=", "Model"),
Array("NAME:Parameters",
Array("NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=",
Array( 57),
"LengthOfSweep:=", "0.5mm")
)

Python SweepFacesAlongNormal (<selection> <parameters>)


Syntax

oEditor.SweepFacesAlongNormal (
[
Array("NAME:Selections",
"Selections:=", "Rectangle1",
"NewPartsModelFlag:=", "Model"),

Python
Array("NAME:Parameters",
Example

Array("NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=",

Array( 57), "LengthOfSweep:=", "0.5mm")


])

ThickenSheet
Use: Thicken a sheet object to convert it to a 3D object.
Command: Modeler>Surface>Thicken Sheet
Syntax: Thicken Sheet <SelectionParameters> <SheetThickenParameters>
Return Value: None
Parameters: Array("NAME:Selections",

3D Modeler Editor Script Commands 11-96


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Selections:=", "<objectID>",
"NewPartsModelFlag:=", ["Model" | "NonModel"]),
Array("NAME:SheetThickenParameters",
"Thickness:=", "<value><units>",
"BothSides:=", <boolean>)
VB Example:
oEditor.ThickenSheet Array("NAME:Selections",
"Selections:=", "Rectangle1",
"NewPartsModelFlag:=", "Model"),
Array("NAME:SheetThickenParameters",
"Thickness:=", "1.01mm",
"BothSides:=", false)

Python Syn- Thicken Sheet (<SelectionParameters> <SheetThickenParameters>)


tax

oEditor.ThickenSheet
{[
Array("NAME:Selections",
"Selections:=", "Rectangle1",
Python
"NewPartsModelFlag:=", "Model"),
Example
Array("NAME:SheetThickenParameters",
"Thickness:=", "1.01mm",
"BothSides:=", false)
])

UncoverFaces
Use: Uncovers specified faces.
Command: Modeler>Surface>Uncover Faces
Syntax: UncoverFaces <SelectionsArray>, <UncoverParametersArray>
Return Value: None

3D Modeler Editor Script Commands 11-97


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Parameters: <UncoverParametersArray>
Array("NAME:Parameters",
<FacesOfOneObjToUncover>,
<FacesOfOneObjToUncover>,...)

<FacesOfOneObjToUncover>
Array("Name:UncoverFacesParameters",
"FacesToUncover:=", <array>)

FacesToUncover
An array of integers – the face IDs of the faces to uncover.
VB Example:
oEditor.UncoverFaces _
Array("NAME:Selections", "Selections:=", _
"Box3,Box2"),_
Array("NAME:Parameters", _
Array("NAME:UncoverFacesParameters", _
"FacesToUncover:=", Array(69)),
Array("NAME:UncoverFacesParameters", _
"FacesToUncover:=", Array(36)))

Python Syn- UncoverFaces (<SelectionsArray>, <UncoverParametersArr)


tax

oEditor.UncoverFaces
([
Array("NAME:Selections", "Selections:=", _
Python
"Box3,Box2"),_
Example
Array("NAME:Parameters", _
Array("NAME:UncoverFacesParameters", _
"FacesToUncover:=", Array(69)),

3D Modeler Editor Script Commands 11-98


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:UncoverFacesParameters", _
"FacesToUncover:=", Array(36)))
])

Unite
Use: Unites the specified objects.
Command: Modeler>Boolean>Unite
Syntax: Unite <SelectionsArray>, <UniteParametersArray>
Return Value: None
Parameters: <UniteParametersArray>
Array("NAME:UniteParameters",
"KeepOriginals:=", <bool>)

Unroup
Use: Ungroups a specified history tree group.
Command: Modeler>Group>Ungroup
Syntax: DeleteEmptyGroups Array("Groups:=", Array("<GroupID>"))
Return Value: None
Parameters: <GroupID>,
The ID for the history tree group to ungroup.

Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow

3D Modeler Editor Script Commands 11-99


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oProject = oDesktop.SetActiveProject("Project44")


Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.Ungroup Array("Groups:=", Array("Group1"))

WrapSheet
Use: Wraps a sheet object to another object.
Command: Wrap Sheet
Syntax: WrapSheet Array("NAME:Selections", "Selections:=", "<SheetID>,<ObjectID>"), Array
("NAME:WrapSheetParameters", "Imprinted:=", <Boolean>)
Return Value: None
Parameters: <SheetID>
ID of sheet object.
<ObjectID>
ID of 3D object.
<Boolean>
true or false.
VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2015.0.0
' 13:58:45 Nov 13, 2014
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow

3D Modeler Editor Script Commands 11-100


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oProject = oDesktop.SetActiveProject("Project3")


Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.WrapSheet Array("NAME:Selections", "Selections:=", "Rect-
angle1,Box1"), Array("NAME:WrapSheetParameters", "Imprinted:=", _
true)

Python WrapSheet ([Array("NAME:Selections", "Selections:=", "<SheetID>,<ObjectID>"),


Syntax Array("NAME:WrapSheetParameters", "Imprinted:=", <Boolean>)])
oEditor.WrapSheet
([
Python Array("NAME:Selections", "Selections:=",
Examp- "Rectangle1,Box1"), Array("NAME:WrapSheetParameters",
le "Imprinted:=",
True)
])

Other oEditor Commands


BreakUDMConnection
ChangeProperty
Delete
FitAll
GetBodyNamesByPosition
GetEdgeByPosition
GetEdgeIDsFromObject
GetEdgeIDsFromFace
GetFaceArea
GetFaceByPosition
GetFaceCenter
GetFaceIDs
GetModelBoundingBox

3D Modeler Editor Script Commands 11-101


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetObjectIDByName
GetObjectName
GetObjectNameByFaceID
GetObjectsByMaterial
GetObjectsInGroup
GetMatchedObjectName
GetModelUnits
GetNumObjects
GetSelections
GetVertexIDsFromEdge
GetVertexIDsFromFace
GetVertexIDsFromObject
GetVertexPosition
GetUserPosition
OpenExternalEditor
PageSetup
RenamePart

BreakUDMConnection
Use:Break a current UDM connection to SpaceClaim.
Command:Break Connection.
Syntax:BreakUDMConnection <Array>
Return Value:
Parameters:<Array>
Array("NAME:Selections", "Selections:=", "")
VB Example:
oEditor.BreakUDMConnection Array("NAME:Selections", "Selections:=",
"")

Python BreakUDMConnection (<Array>)


Syntax

3D Modeler Editor Script Commands 11-102


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python oEditor.BreakUDMConnection ([Array("NAME:Selections",


Example "Selections:=", "")])

Delete
Use: Deletes specified objects, coordinate systems, points, planes, etc.
Command: None
Syntax: Delete <SelectionsArray>
Return Value: None

FitAll
Fits the design to the modeling area.

UI Access View > Fit All > All Views

Name Type Description


Parameters
None.

Return Value None.

Python Syn- FitAll()


tax

Python oEditor.FitAll()
Example

VB Syn- FitAll()
tax

VB Set oEditor = oDesign.SetActiveEditor("3D Modeler")


Example oEditor.FitAll()

GetBodyNamesByPosition
Gets the IDs of objects that contact the given point.
Command: None.
Syntax: GetBodyNamesByPosition(<positionParameters>).
Return Value: Retuurns a list of IDs.
Parameters: <PositionParameters>

3D Modeler Editor Script Commands 11-103


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:Parameters", _
"Xposition:=", <value>,
"YPosition:=", <value>,
"ZPosition:=", <value>)
VB Example:
oEditor.GetBodyNamesByPosition(Array("NAME:Parameters", _
"XPosition:=", "a", _
"YPosition:=", "0mm", _
"ZPosition:=", "0mm"))

Python GetBodyNamesByPosition ([<positionParameters>])


Syntax

Python oEditor.GetBodyNamesByPosition(["0.6mm","0.6mm","1mm"])
Exampl- ["Region"]
e

GetEdgeByPosition
Gets the edge ID corresponding to position input.
Syntax: GetEdgeByPosition(<PositionParameters>)
Return Value: Returns an integer edge ID.
Parameters: <PositionParameters>
Array("NAME:EdgeParameters", _
"BodyName:=", <string>,
"Xposition:=", <value>,
"YPosition:=", <value>,
"ZPosition:=", <value>)
For 2D XY Designs, ZPosition should be set to "0".
For 2D RZ Designs, YPosition should be set to "0".
VB Example:
oEditor.GetEdgeByPosition(Array("NAME:EdgeParameters", _
"BodyName:=", "Box1", "XPosition:=", "3.4mm", _

3D Modeler Editor Script Commands 11-104


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"YPosition:=", "2.8mm", "ZPosition:=", "0.4mm"))

Pyt- GetEdgeByPosition ([<PositionParameters>])


ho-
n
Sy-
nta-
x

Pyt- oEditor.GetEdgeByPosition
ho-
n (["NAME:EdgeParameters", "BodyName:=", "Box1", "XPosition:=",
Ex- "3.4mm", "YPosition:=", "2.8mm", "ZPosition:=", "0.4mm"
am-
ple
])

GetEdgeIDsFromFace
Get the edge IDs for a given face ID.
Command: None
Syntax: GetEdgeIDsFromFace <Face ID>
Return Value: An array of edge IDs
Parameters: <FaceID>
ID of the face
VB Example:
Dim oEdgeIDs
oEdgeIDs = Array()
oEdgeIDs = oEditor.GetEdgeIDsFromFace(10)

Python Syn- GetEdgeIDsFromFace (<Face ID>)


tax

Python oEditor.GetEdgeIDsFromFace("10")
Example

GetEdgeIDsFromObject
Get the edge IDs of given an object name
Command: None
Syntax: GetEdgeIDsFromObject <Object Name>

3D Modeler Editor Script Commands 11-105


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Return Value: An array of edge IDs


Parameters: <ObjectName>
Name of the object
VB Example: Example:
Dim oEdgeIDs
oEdgeIDs = Array()
oEdgeIDs = oEditor.GetEdgeIDsFromObject("Box1")

Python Syn- GetEdgeIDsFromObject (<Object Name>)


tax

Python oEditor.GetEdgeIDsFromObject("Box1")
Example

GetFaceArea
Get area of given face ID.
Command: None.
Syntax: GetFaceArea <face ID>
Return Value: Double value for face area.
Parameters: <FaceID>
Face ID
VB Example:
Dim oArea
oArea = oEditor.GetFaceArea(10)

Python Syn- GetFaceArea (<face ID>)


tax

Python oEditor.GetFaceArea("10")
Example

GetFaceCenter
Given a planar face ID, return the center position.
Command: none

3D Modeler Editor Script Commands 11-106


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syntax: GetFaceCenter <FaceID>


Return Value: An array containing planar face center position
Parameters: <PlanarFaceID>
VB Example:
Dim oFaceCenter
oFaceCenter = oEditor.GetFaceCenter(oFaceID)

Python Syn- GetFaceCenter (<PlanarFace ID>)


tax

Python oEditor.GetFaceCenter(oFaceID)
Example

GetFaceByPosition
Gets the face id corresponding to position input.
Syntax: GetFaceByPosition(<FaceByPositionParametersArray>)
Return Value: Returns an integer face id
Parameters: (<FaceByPositionParametersArray>)
Array("NAME:FaceParameters",
"BodyName:=", <string>,
"XPosition:=", <value>,
"YPosition:=", <value>,
"ZPosition:=", <value>)
For 2D XY Designs, ZPosition should be set to "0".
For 2D RZ Designs, YPosition should be set to "0".
BodyName
Name of the body on which the point lies.
The point should be on exactly one face, not at a vertex or edge where two or more faces
join. And the coordinates must be on the face.
VB Example:
Dim faceid
faceid = oEditor.GetFaceByPosition(Array("NAME:FaceParameters", _
"BodyName:=" "Box1", "XPosition:=", "3.4mm", "YPosition:=, _

3D Modeler Editor Script Commands 11-107


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"2.8mm", "ZPosition:=", "0.4mm"))

Python Syn- GetFaceByPosition ([(<FaceByPositionParametersArray>)])


tax

top_face_id = oEditor.GetFaceByPosition(["NAME:FacePara-
meters",
"BodyName:=", "Box",
Python
Example "XPosition:=", "0mm",
"YPosition:=", "0mm",
"ZPosition:=", "100mm"])

GetFaceIDs
Get the face IDs of given an object name
Command: None.
Syntax: GetFaceIDs <Object Name>
Return Value: An array of face IDs
Parameters: <ObjectName>
Name of the object
VB Example:
Dim oFaceIDs
oFaceIDs = Array()
oFaceIDs = oEditor.GetFaceIDs("Box1")

Python Syn- GetFaceIDs (<Object Name>)


tax

Python oEditor.GetFaceIDs("Box1")
Example

GetMatchedObjectName
Use: Gets all object names containing the input text string.
Syntax: GetMatchedObjectName(<ObjectNameWildcardText>)
Return Value: Array of object names containing wildcard text.

3D Modeler Editor Script Commands 11-108


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Parameters: <ObjectNameWildcardText>
Type: <string>
Text to be used for object name matching.
VB Example:
objectnames = oEditor.GetMatchedObjectName("Box*")

Python Syn- GetMatchedObjectName(<ObjectNameWildcardText>)


tax

Python oEditor.GetMatchedObjectName("Box*")
Example

GetModelBoundingBox
Gets the bounding box of the current model.
Syntax: GetModelBoundingBox()
Return Value: Returns the Xmin, Ymin, Zmin, Xmax, Ymax, Zmax values that define the bounding
box.
Parameters: None
VB Example:
Dim oBoundingBox
oBoundingBox = oEditor.GetModelBoundingBox()

Python Syn- GetModelBoundingBox ([ ])


tax

Python oEditor.GetModelBoundingBox([])
Example

GetModelUnits
Use: Get the model units.
Command: None.
Syntax: GetModelUnits
Return Value: A string contains current model units.
Parameters: None.
VB Example:

3D Modeler Editor Script Commands 11-109


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Dim oUnit
oUnit = oEditor.GetModelUnits()

Python Syn- GetModelUnits([])


tax

Python oEditor.GetModelUnits([])
Example

GetNumObjects
Use: Gets the number of objects in a design.
Syntax: GetNumObjects
Return Value: Returns the number of objects.
Type: <int>
Parameters: None
VB Example:
totalobjects = oEditor.GetNumObjects

Python Syn- GetNumObjects([])


tax

Python oEditor.GetNumObjects([])
Example

GetObjectIDByName
Use: Get Object IDs to provide for CreateEntityList.
Syntax: GetObjectIDByName("<objectName>")
Return Value: <Object ID>
Parameters: <objectName>
Type: <string>
VB Example:
oObjectID = oEditor.GetObjectIDByName("Box2")

3D Modeler Editor Script Commands 11-110


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Syn- GetObjectIDByName("<objectName>")


tax

Python oEditor.GetObjectIDByName("Box2")
Example

GetObjectName
Use: Gets an object name corresponding to the 0 base index of the creation order.
Syntax: GetObjectName(<Index>)
Return Value: Returns the object name of the corresponding object.
Parameters: <Index>
Type: <string>
The 0 base index of the creation order
VB Example:
objectname = oEditor.GetObjectName(3)

Python Syn- GetObjectName(<Index>)


tax

Python oEditor.GetObjectName("3")
Example

GetObjectNameByFaceID
Use: Gets an object name corresponding to the input face id.
Syntax: GetObjectNameByFaceID(<FaceID>)
Return Value: Returns the name of the corresponding object.
Parameters: <FaceID>
Type: <string>
VB Example:
objectname = oEditor.GetObjectNameByFaceID(Face10)

Python Syn- GetObjectNameByFaceID ("FaceID")


tax

3D Modeler Editor Script Commands 11-111


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python oEditor.GetObjectNameByFaceID("Face10")
Example

GetObjectsByMaterial
Use:Get objects by material name.
Command:None.
Syntax:GetObjectsByMaterial <Material Name>
Return Value:An array of object names.
Parameters:<Material Name>
Type: <string>
Material name/
VB Example:
Dim objNames
objNames = oEditor.GetObjectsByMaterial("vacuum")

Python Syn- GetObjectsByMaterial (<Material Name>)


tax

Python oEditor.GetObjectsByMaterial("vacuum")
Example

GetObjectsInGroup
Use: Returns the objects for the specified group.
Syntax: GetObjectsInGroup(<GroupName>)
Return Value: The objects in the group.
Parameters: <groupName>
Type: <string>
One of <materialName>, <assignmentName>, "Non Model", "Solids", "Unclassified",
"Sheets", "Lines"
VB Example:
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
Dim oObject
Dim oObjects

3D Modeler Editor Script Commands 11-112


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oObjects = oEditor.GetObjectsInGroup( "Sheets" )


For Each oObject in oObjects
MsgBox oObject
Next

Python Syn- GetObjectsInGroup (<GroupName>)


tax

Python oEditor.GetObjectsInGroup("Sheets")
Example

GetPropertyValue
Gets the value of a single property belonging to a specific serverName and PropTab. This function
is available with the Project, Design or Editor objects, including definition editors.
Use the script recording feature and edit a property, and then view the resulting script to
see the format for that property.

UI Access NA

Name Type Description


<propTab> String One of the following, where tab titles
are shown in parentheses:
PassedParameterTab ("Parameter
Values")
DefinitionParameterTab (Para-
meter Defaults")
LocalVariableTab ("Variables" or
"Local Variables")
Parameters ProjectVariableTab ("Project vari-
ables")
ConstantsTab ("Constants")
BaseElementTab ("Symbol" or
"Footprint")
ComponentTab ("General")
CustomTab ("Intrinsic Variables")
Quantities ("Quantities")
Signals ("Signals")

3D Modeler Editor Script Commands 11-113


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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, the value of the property.

Python GetPropertyValue (<propTab>, <serverName>, <propName>)


Syntax

selectionArray = oEditor.GetSelections()
for k in selectionArray:
Python
Exampl- val = oEditor.GetPropertyValue("PassedParameterTab", k,
e "R")
...

VB GetPropertyValue (<propTab>, <serverName>, <propName>)


Syntax

selectionArray = oEd-
itor.GetSelections

for each k in selectionArray

VB
Examp-
val = oEditor.GetPropertyValue("PassedParameterTab", k,
le
"R")

...

next

Python Syn- GetPropertyValue ([ <array>])


tax

Python oModule = oDesign.GetModule("ReportSetup")


Example

3D Modeler Editor Script Commands 11-114


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oModule.GetPropertyValue("Trace", "S Parameter Plot


1:dB(S(1,1))","Y Axis")

VB Example:
value_string = _
oEditor.GetPropertyValue("Geometry3DCmdTab",_
"Box1:CreateBox:1", "XSize")

VB Example:value_string = _
oEditor.GetPropertyValue("BaseElementTab",_
"rect_1", "Name")

Example: (Query frequency and excitation)


freq = oDesign.GetPropertyValue("General", "AnalysisSetup:Setup1",
"Adaptive Freq")
sigType = oDesign.GetPropertyValue("Q3D", "BoundarySetup:via_1",
"Type")
sourceType = oDesign.GetPropertyValue("Q3D", "Bound-
arySetup:Source1", "Type")

Example: (Query Trace values in a specified report)


oModule = oDesign.GetModule("ReportSetup")
oModule.GetPropertyValue("Trace", "S Parameter Plot 1:dB(S(1,1))","Y
Axis")

GetSelections [Model Editor]


Use: Informational.
Syntax: GetSelections
Return Value: Array of IDs.
Parameters: None
VB Example:
Set oProject = oDesktop.SetActiveProject("Project6")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")

3D Modeler Editor Script Commands 11-115


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Dim A
A = Array()
A = oEditor.GetSelections
Dim B
B = Join(A,",")
'Debug.Write "The Selections are " &B
MsgBox(B)
Dim C
C = Array("NAME:Selections", "Selections:=", B)
oEditor.Delete C

GetUserPosition
Use: Returns the coordinates of an interactive position input in the 3D model window.
Syntax: GetUserPosition(<PositionInputPrompt>)
Return Value: Array of coordinates
Parameters: <PositionInputPrompt>
Type: <string>
VB Example:
Dim position
Dim coord
position = oEditor.GetUserPosition("Enter a point")
For Each coord in position
Msgbox(coord)
Next

Python Syn- GetUserPosition(<PositionInputPrompt>)


tax

Python oEditor.GetUserPosition("Enter
Example a point")

3D Modeler Editor Script Commands 11-116


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetVertexIDsFromEdge
Use: Get the vertex IDs of given a edge ID.
Command: None.
Syntax: GetVertexIDsFromEdge <Edge ID>
Return Value: An array of edge IDs.
Parameters: <EdgeID>
ID of the edge.
VB Example:
Dim oVertexIDs
oVertexIDs = Array()
oVertexIDs = oEditor.GetVertexIDsFromEdge(10)

GetVertexIDsFromFace
Use: Get the vertex IDs of given a face ID.
Command: None.
Syntax: GetVertexIDsFromFace <Face ID>
Return Value: An array of vertex IDs
Parameters: <FaceID>
ID of the face
VB Example:
Dim oVertexIDs
oVertexIDs = Array()
oVertexIDs = oEditor.GetVertexIDsFromFace(10)

GetVertexIDsFromObject
Use: Get the vertex IDs of given an object name
Command: None.
Syntax: GetVertexIDsFromObject <Object Name>
Return Value: An array of edge IDs
Parameters: <ObjectName>

3D Modeler Editor Script Commands 11-117


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Name of the object


VB Example:
Dim oVertexIDs
oVertexIDs = Array()
oVertexIDs = oEditor.GetVertexIDsFromObject("Box1")

GetVertexPosition
Use: Returns a vector of vertex coordinates.
Syntax: GetVertexPosition(<VertexID>)
Return Value: Vector of coordinates
Parameters: <VertexID>
Type: <vector>
VB Example:
position = oEditor.GetVertexPosition(VertexIDs(0))

OpenExternalEditor
Use:Launch a SpaceClaim session.
Command:Launch SpaceClaim.
Syntax:OpenExternalEditor <Array>
Return Value:
Parameters:<Array>
Array("NAME:Selections", "Selections:=", "")
VB Example:
oEditor.OpenExternalEditor Array("NAME:Selections", "Selections:=",
"")

Python OpenExternalEditor (<Array>)


Syntax

Python oEditor.OpenExternalEditor Array([("NAME:Selections",


Example "Selections:=", "")])

3D Modeler Editor Script Commands 11-118


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

PageSetup
Use: Specifies the page settings for printing.
Command: File>Page Setup
Syntax: PageSetup <PageSetupParametersArray>
Return Value: None
Parameters: <PageSetupParametersArray>
Array("NAME:PageSetupData",
"margins:=",
Array("left:=", <value>,
"right:=", <value>,
"top:=", <value>,
"bottom:=", <value>))

RenamePart
Use: Renames an object.
Command: None
Syntax: RenamePart <RenameParametersArray>
Return Value: None
Parameters: <RenameParametersArray>
Array("NAME:Rename Data",
"Old Name:=", <string>,
"New Name:=", <string>)

3D Modeler Editor Script Commands 11-119


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

PDF layout 11-120


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

12 - Output Variable Script Commands


The 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>
List of commands are as follows:
CreateOutputVariable
DeleteOutputVariable
DoesOutputVariableExist
EditOutputVariable

CreateOutputVariable
Different forms of this command are documented for HFSS, Q3D Extractor and Schematic and
Layout Editors.

UI Access [product]>Results>Output Variables

Name Type Description


<OutputVarName> String Name of the output variable
<Expression> Value Value to assign to the variable
<SolutionName> String The name of the solution as seen in the output
Parameters variable UI.
<reportTypeName String The name of the report type as seen in the out-
> put variable UI.
<simValueCtxt> Variant Context for which the output variable expres-
sion is being evaluated.

Return Value None

Python CreateOutputVariable (<OutputVarName>, <Expression>, <Solution Name>,


Syntax <reportTypeName>, <simValueCtxt>)
oModule = oDesign.GetModule("OutputVariable")
oModule.CreateOutputVariable ("test", "normalize(R1_0.V)",
Python
Exampl-
_
e "TR", "Standard", ["NAME:Context", "SimValueContext:=", _
[ 1, 0, 2, 0, false, false, -1, 1, 0, 1, 1, "", 0, 0]])

Output Variable Script Commands 12-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB CreateOutputVariable <OutputVarName>, <Expression>, <Solution Name>,


Syntax <reportTypeName>, <simValueCtxt>
Set oModule = oDesign.GetModule("OutputVariable")
oModule.CreateOutputVariable "test", "normalize(R1_0.V)", _
VB
Exampl- "TR", "Standard", Array("NAME:Context", "SimValueCon-
e text:=", _
Array( 1, 0, 2, 0, false, false, -1, 1, 0, 1, 1, "", 0, 0))

Command details for HFSS are as follows:


Add a new output variable to the output variable list. Output variables are associated with a name
and an expression. The name of an output variable is not permitted to collide with design variables
or Sim values or with other output variable names. It cannot have spaces or any arithmetic or other
operators in it. The definitions cannot be cyclic. For example, A = 2*B, B=3*A is not allowed.
Command: HFSS>Results>Output Variable
Syntax: CreateOutputVariable <OutputVarName>, <Expression>, <Solution Name>,
<reportTypeName>, <ContextArray>
Return Value: None.
Parameters: <OutputVarName>
Type: <string>
Name of the output variable
<Expression>
Type: <value>
Value to assign to the variable
<SolutionName>
Type: <string>
The name of the solution as seen in the output variable UI.
<ReportTypeName >
Type: <string>
The name of the report type as seen in the output variable UI.

Output Variable Script Commands 12-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<ContextArray>
Type: <variant>
Context for which the output variable expression is being evaluated.
VB Example:
Set oModule = oDesign.GetModule("OutputVariable")
oModule.CreateOutputVariable "test","mag(S(WavePort1,WavePort1))", _
"Setup1 : LastAdaptive", "Modal Solution Data", _
Array("Domain:=", "Sweep")

For Layout Editor the CreateOutputVariable syntax and other details are as follows:

Syntax: CreateOutputVariable "<varName>", <Expression>, <SolutionName>, <SolutionType>,


<Domain>
Return Value: None
Parameters: <VarName>
Type: <string>
Name of the output variable.

<Expression>
Type: <value>
Value to assign to the variable.

<SolutionName>
Type: <string>
Name of the solution as listed in the output variable UI.
For example: "Setup1 : Last Adaptive"

<ReportTypeName>
Type: <string>
The name of the report type as seen in the output variable UI.

Output Variable Script Commands 12-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<SimValueContext>
Type: <variant>
Context for which the output variable expression is being evaluated. For more inform-
ation see SimValueContext.

VB Example: Set oModule = oDesign.GetModule("OutputVariable")


oModule.CreateOutputVariable "test","mag(S(WavePort1,WavePort1))", _
"Setup1 : LastAdaptive ", "Modal Solution Data", Array("Domain:=", _ "Sweep")

oModule.CreateOutputVariable "Var_" & OutputQuantity,_


OutputQuantity, Solution, "Far Fields", _
Array("Context:=", InfiniteSphere, "Domain:=", "Sweep")

For Q3D Extractor or a 2D Extractor the command and example are as follows:
Command: Q3D Extractor or 2D Extractor>Results>Output Variables
VB Example: Set oModule = oDesign.GetModule("OutputVariable") oMod-
ule.CreateOutputVariable "char_Z", _ "sqrt(ACL(via:via_source,vi-
a:via_source)/C(via,GroundPlane))", _ "Setup1 : LastAdaptive",
"Matrix", Array("Context:=", "Original")

DeleteOutputVariable
Deletes an existing output variable. The variable can only be deleted if it is not in use by any traces.

UI Access [product]>Results>Output Variables, dialog Delete Button

Name Type Description


Parameters
<OutputVarName> String Name of the output variable

Return Value None

Python Syn-  DeleteOutputVariable (<OutputVarName>)


tax

Python oModule = oDesign.GetModule("OutputVariable")

Output Variable Script Commands 12-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Example oModule.DeleteOutputVariable ("testNew")

VB Syntax  DeleteOutputVariable <OutputVarName>

VB
Set oModule = oDesign.GetModule("OutputVariable")
Example oModule.DeleteOutputVariable "testNew"

For Q3D Extractor, the DeleteOutputVariable command details are as follows.


Deletes an existing output variable. The variable can only be deleted if it is not in use by any traces.
Command: Delete command in the Output Variables dialog box. Click Q3D Extractor or 2D
Extractor>Results>Output Variables to open the Output Variables dialog box.
Syntax: DeleteOutputVariable <VarName>
Return Value: None
Parameters: <VarName>
Type: <string>
Name of the output variable.
VB Example: Set oModule = oDesign.GetModule("OutputVariable")
oModule.DeleteOutputVariable "Var_" & OutputQuantity

DoesOutputVariableExist
Verify that a named output variable exists.

UI Access NA

Name Type Description


Parameters
<outputVariableName> String Text string of the output variable name

Boolean
Return Value
True if the variable exists. False otherwise.

Python Syn- DoesOutputVariableExist(<outputVariableName>)


tax

Python
oProject = oDesktop.GetActiveProject()
Example oDesign = oProject.GetActiveDesign()

Output Variable Script Commands 12-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oModule = oDesign.GetModule("OutputVariable")
oModule.DoesOutputVariableExist("MyTestVar")

VB Syntax DoesOutputVariableExist(<outputVariableName>)
Set oProject = oDesktop.GetActiveProject()
Set oDesign = oProject.GetActiveDesign()
VB
Example Set oModule = oDesign.GetModule("OutputVariable")
Set oModule.DoesOutputVariableExist("MyTestVar")

EditOutputVariable
Changes the name or expression of an existing output variable.

UI Access NA

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"
<ReportTypeName> String The name of the report type as seen in the
output variable UI
<ContextArray> Variant Context for which the output vari-
able expression is being evaluated
Array("Context:=", <Context>)

Return Value None

Python EditOutputVariable (<OrigVarName>, <NewExpression>, <NewVarName>,


Syntax <SolutionName>, <reportTypeName>, <ContextArray>)

Python
oModule = oDesign.GetModule("OutputVariable")
Example oModule.EditOutputVariable ("test",

Output Variable Script Commands 12-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"normalize(R1_0.V)", "testNew", "TR", "Standard", [])

VB Syn- EditOutputVariable <OrigVarName>, <NewExpression>, <NewVarName>, <Solu-


tax tionName>, <reportTypeName>, <ContextArray>
Set oModule = oDesign.GetModule("OutputVariable")
VB
oModule.EditOutputVariable "test",
Example
"normalize(R1_0.V)", "testNew", "TR", "Standard", Array()

VB Example:
Set oModule = oDesign.GetModule("OutputVariable")
oModule.EditOutputVariable "test", "dB(S(WavePort1,WavePort1)) ", _
"testNew", "Setup1 : LastAdaptive", "Modal Solution Data", _ Array
("Domain:=", "Sweep")

For Q3D Extractor, the EditOutputVariable command details are as follows.


Changes the name or expression of an existing output variable.
Syntax: EditOutputVariable <OrigVarName> <NewExpression> <NewVarName> <Soult-
ionName> <SolutionType> <ContextArray>
Provide empty quotes "" as the NewVarName or NewExpression if it should not be
changed.
Return Value: None
Parameters: <OrigVarName>
Type: <string>
Original name of the variable.
<NewExpression>
Type: <value>
New value to assign to the variable.
<NewVarName>
Type: <string>
New name of the variable if any, or else pass an empty string.
<SolutionName>
Type: <string>

Output Variable Script Commands 12-7


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Name of the solution as seen in the output variable UI.


For example: "Setup1 : Last Adaptive"
<SolutionType>
Type: <string>
The name of the report type as seen in the output variable UI.
<ContextArray>
Type: <variant>
Context for which the output variable expression is being evaluated.
VB Example: oModule.EditOutputVariable "char_Z", _ "sqrt(ACL
(via:via_source,via:via_source)/C(via,via))", "char_Z", _ "Setup1 :
LastAdaptive", "Matrix", Array("Context:=", "Original")

GetOutputVariableValue
Gets the double value of an output variable. Only those expressions that return a double value are
supported. The expression is evaluated only for a single point.
Different forms of this command are documented for HFSS, Q3D Extractor as well Schematic and
Layout Editors.

UI Access NA

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 expression.
Example: "Freq='20GHz' Theta-
='20deg' Phi='30deg' in HFSS
Parameters "" in Q3D Extractor
<SolutionName> String Name of the solution as listed in the output
variable UI.
<ReportTypeName> String The name of the report type as seen in the
output variable UI.
<ContextArray> Array Context for which the output vari-
able expression is being eval-
uated. This can be empty if there is
no context.

Return Value Double value of the output variable .

Output Variable Script Commands 12-8


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Pytho- GetOutputVariableValue(<OutputVarName>, <IntrinsicVariation>, <SolutionName>,


n Syn- <ReportTypeName>, <ContextArray>
tax

Pytho- Val = oModule.GetOutputVariableValue("test","Freq = '20Ghz'


n Theta='20deg'
Exam- Phi='30deg'", "TR", "Standard", [])
ple

GetOutputVariableValue(<OutputVarName>, <IntrinsicVariation>, <Solu-


VB Syntax
tionName>, <ReportTypeName>, <ContextArray>)
Val = oModule.GetOutputVariableValue
VB
("test","Freq = '20Ghz' Theta='20deg'
Example
Phi='30deg'", "TR", "Standard", Array())

For HFSS, the command details are as follows:


Gets the double value of an output variable. Only those expressions that return a double value are
supported. The expression is evaluated only for a single point.
Syntax: GetOutputVariableValue(<OutputVarName>, <IntrinsicVariation>, <SolutionName>,
<ReportTypeName>, <ContextArray>)
Return Value: Double value of the output variable .
Parameters: <OutputVarName>
Type: <string>
Name of the output variable.
<IntrinsicVariation>
Type: <string>
A set of intrinsic variable value pairs to use when evaluating the output expression.
Example: "Freq='20GHz' Theta='20deg' Phi='30deg' in HFSS
"" in Q3D Extractor
<SolutionName>
Type: <string>
Name of the solution as listed in the output variable UI.

Output Variable Script Commands 12-9


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

For example: "Setup1 : Last Adaptive"


<ReportTypeName>
Type: <string>
The name of the report type as seen in the output variable UI. Possible HFSS values
are:
"Modal Solution Data" - Only for Driven Modal solution-type problems with ports.
"Terminal S Parameters" - Only for Driven Terminal solution-type problems with ports.
"Eigenmode Parameters" - Only for Eigenmode solution-type problems.
"Fields"
"Far Fields" - Only for problems with radiation or PML boundaries.
"Near Fields" - Only for problems with radiation or PML boundaries.
"Emission Test"
<ContextArray>
Type: Array
Context for which the output variable expression is being evaluated. This can be empty if
there is no context (for example, for S- parameters). The Reporter uses interpolation to
evaluate the values at the given special sweeps. If a requested special-sweep value is
outside the range the Reporter does not do extrapolation. Rather it issues an error mes-
sage indicating values outside the available range for a primary sweep.
Example:
Array("Context:=","Infinite Sphere1")
or Array("Context:=","Polyline1")
or Array()
VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2016.0.0
' MSG box displays value of the output variable
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign

Output Variable Script Commands 12-10


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Dim oEditor
Dim oModule
Dim var1
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project1")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("OutputVariable")
var1 = oModule.GetOutputVariableValue("p", "freq='1GHz'", _
"Setup1 : LastAdaptive", "Modal Solution Data", Array())
msgbox (var1)

VB Example:
' -----------------------------------------------------------
' Sample script to get output variable values in 2.0 products
' -----------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim projects
Dim oProject
Dim oDesign
Dim oModule
Dim val
' -----------------------------------------------------------
' Get all of the VBS objects needed to talk to the product
' -----------------------------------------------------------
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
Set projects = oDesktop.GetProjects()

Output Variable Script Commands 12-11


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oProject = projects(0)


Set oDesign = oProject.GetDesign ("HfssDesign1")
Set oModule = oDesign.GetModule("OutputVariable")
' -----------------------------------------------------------
' fieldOV calculated at a point so we don't need distance
' -----------------------------------------------------------
val = oModule.GetOutputVariableValue ( "fieldOV", "Freq='1GHz'",_
"Setup1 : LastAdaptive", "Fields", Array("Context:=", "Point1"))
' -----------------------------------------------------------
' SValue11 is a Hfss matrix parameter defined as
' S(WavePort1,WavePort1)
' it needs no context
' -----------------------------------------------------------
val = oModule.GetOutputVariableValue ( "SValue11", _
"Setup1 : LastAdaptive", _
"Freq='1GHz'",_
"Modal Solution Data", _
Array())

' -----------------------------------------------------------
' Now, look at the original output variable in a different design
' variation
' -----------------------------------------------------------
val = oModule.GetOutputVariableValue ( "fieldOV", _
"Distance='0' _
"Setup1 : LastAdaptive", "Fields", _
Freq='1GHz' xsize='0.4mm' ysize='4.1mm'", _
Array("Context:=", "Polyline1", "PointCount:=", 1 ) )
' -----------------------------------------------------------
' Look at the same variable at a position 1mm along the line

Output Variable Script Commands 12-12


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

' -----------------------------------------------------------
val = oModule.GetOutputVariableValue ( "fieldOV", _
"Distance='1mm'
"Setup1 : LastAdaptive", _
Freq='1GHz'", _
"Fields", _
Array("Context:=", "Polyline1", "PointCount:=", 3 ) _
)
MsgBox( "2 val " & FormatNumber(val) )

For HFSS Layout and Schematic Editor the command details are as follows:
Syntax: GetOutputVariableValue(<OutputVarName>, <VariationKey>, <SolutionName>,
<ReportType>, <ContextArray>)
Return Value: Double value of the output variable .
Parameters: <OutputVarName>
Type: <string>
Name of the output variable.

<VariationKey>
Type: <string>
Example: " ’F=’20GHz’ x_size=’1.0in’ "

<SolutionName>
Type: <string>
Name of the solution as listed in the output variable UI.
For example: "Setup1 : Last Adaptive"

<ReportType>
Type: <string>
Possible values are:

Output Variable Script Commands 12-13


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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

<ContextArray>
Type: Array
Context for the output variable. For more information see SimValueContext.

VB Example:
' ----------------------------------------------
' Script used by Ansys Designer Version 4.1.0
----------------------------------------------
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("MyTransientProject")
Set oDesign = oProject.SetActiveDesign("Nexxim1")
Set oModule = oDesign.GetModule("OutputVariable")
val1=oModule.GetOutputVariableValue("vout", "MyTransientSetup",
"time='3.9462ns'", "Standard", _

Output Variable Script Commands 12-14


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:Context", "SimValueContext:=", Array(1, 0, 2, 0, false,


false, -1, 1, 0, 1, 1, "", 0, 0)))
MsgBox val1

VB Example:
' ----------------------------------------------
' Script used by Ansys Designer Version 4.1.0
' ----------------------------------------------
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("MyLNAExample")
Set oDesign = oProject.SetActiveDesign("Nexxim1")
Set oModule = oDesign.GetModule("OutputVariable")
val1=oModule.GetOutputVariableValue("magS", _
"LinearFrequency", "F='1GHz'", "Standard", _
Array("NAME:Context", "SimValueContext:=", _
Array(3, 0, 2, 0, false, false, -1, 1, 0, 1, 1, "", 0, 0)))
MsgBox val1

For Q3D Extractor, the GetOutputVariableValue command details are as follows:


Gets the double value of an output variable. Only those expressions that return a double value are
supported. The expression is evaluated only for a single point.

Output Variable Script Commands 12-15


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syntax: GetOutputVariableValue(<OutputVarName>, <VariationKey>, <SolutionName>,


<ReportType>, <ContextArray>)
Return Value: Double value of the output variable .
Parameters: <OutputVarName>
Type: <string>
Name of the output variable.
<VariationKey>
Type: <string>
Example: "Freq=’20GHz’ x_size=’1.0in’"
<SolutionName>
Type: <string>
Name of the solution as listed in the output variable UI.
For example: "Setup1 : Last Adaptive"
<ReportType>
Type: <string>
Possible values are:
"Matrix"
"C Fields Report"
"DC R/L Fields Report"
"AC R/L Fields Report"
<ContextArray>
Type: Array
Context for which the output variable expression is being evaluated. This can be empty if
there is no context.
Example:
Array("Context:=","Original")
or Array("Context:=","Polyline1")
or Array()
VB Example:
Set oModule = oDesign.GetModule("OutputVariable")
Dim Val

Output Variable Script Commands 12-16


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Val=oModule.GetOutputVariableValue("OutVarTest",_ Freq=’500MHz’
"Setup1 : LastAdaptive", "Matrix", _
Array ("Context:= ",Original" ))

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,
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

Output Variable Script Commands 12-17


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Transient Time Domain 55809


Periodic AC Domain 55818
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.


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.

Output Variable Script Commands 12-18


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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:
"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

Output Variable Script Commands 12-19


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

b.Transient report context for Spectral domain in Transient analysis:

Description Key Name Is a string? Key Value


Start Time TS False 0ns
Stop Time TE False 10ns
Max Harmonics MH False 100
Window type WT False 0
Width Percentage WW False 100
Kaiser Parameter KP False 0
Adjust Coherent Gain CG False 0

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 Veri-
fEye and QuickEye analysis:

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:

Output Variable Script Commands 12-20


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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:

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

Output Variable Script Commands 12-21


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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

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-22


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Reporter Editor Script Commands 13-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

13 - Reporter Editor Script Commands


Reporter commands should be executed by the oDesign object. One example of accessing this
object is:
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("ReportSetup")

Another example of accessing this object in Q3D Extractor is:


Set oDesign = Project.SetActiveDesign("Q3DDesign1")
Set oModule = oDesign.GetModule("ReportSetup")

All Report and Trace properties can be edited using the ChangeProperty commands. This
includes Title properties, General properties, 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
AddQuickEyeAnalysis
AddDeltaMarker
AddMarker
AddNote
AddTraces
AddVerifEyeAnalysis
ChangeProperty [ReportSetup]
ClearAllMarkers
ClearAllTraceCharacteristics

Reporter Editor Script Commands 13-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

CopyTracesData
CopyReportData
CopyReportDefinitions
CopyTraceDefinitions
CreateReport
CreateReportFromFile
CreateReportFromTemplate
CreateReportOfAllQuantities
DeleteMarker
DeleteAllReports
DeleteReports
DeleteTraces
EditQuickEyeAnalysis
EditVerifEyeAnalysis
FFTOnReport
ExportImageToFile
ExportPlotImageToFile
ExportToFile
ExportMarkerTable
GetAllCategories
GetAllQuantities
GetAllReportNames
GetAvailableDisplayTypes
GetAvailableReportTypes
GetAvailableSolutions
GetDataExpressions
GetDataUnits
GetDesignVariableNames
GetDesignVariableUnits
GetDesignVariableValue

Reporter Editor Script Commands 13-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetDesignVariationKey
GetImagDataValues
GetPerQuantityPrimarySweepValues
GetRealDataValues
GetSolutionContexts
GetSolutionDataPerVariation
GetSweepNames
GetSweepUnits
GetSweepValues
GroupPlotCurvesByGroupingStrategy
ImportIntoReport
IsDataComplex
IsPerQuantityPrimarySweep
MovePlotCurvesToGroup
MovePlotCurvesToNew
PasteReport
PasteTraces
ReleaseData
RenameReport
RenameTrace
ResetPlotSettings
SavePlotSettingsAsDefault
UpdateAllFieldsPlots
UpdateAllReports
UpdateQuantityFieldsPlots
UpdateReports
UpdateTrace
UpdateTracesContextandSweeps
UnGroupPlotCurvesInGroup

Reporter Editor Script Commands 13-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

AddCartesianLimitLine
Adds a limit line to a report on the X axis.

UI Access Report2D>Add Limit Line

Name Type Description


<ReportName> String Name of Report
<XValues> Real Array of X coordinate values
Parameters
<XUnits> String Unit of measure for X values
<YValues> Real Array of Y coordinate values
<YUnits> String Unit of measure for Y values
<YAxisName> Real Name of the Y axis associated with the limit
line

Return Value None

AddCartesianLimitLine <ReportName>, [("NAME:CartesianLimitLine",


Python
Syntax
[("NAME:XValues",<XValues>)], "XUnits:=", "<XUnits>", [("NAME:YValues",
<YValues>)], "YUnits:=", "<YUnits>", "YAxis:=", "<YAxisName>"])
oModule.AddCartesianLimitLine("Project Outputs",
["NAME:CartesianLimitLine",

Python ["NAME:XValues",0, 2, 5, 7, 10, 15]


Example "XUnits:=", "s"
["NAME:YValues",0.05, 0.3, 0.65, 0.825, 0.95, 1],
"YUnits:=", "mV", "YAxis:=", "Y1"])

   AddCartesianLimitLine <ReportName>, Array("NAME:CartesianLimitLine",


VB Syn-
Array("NAME:XValues",<XValues>), "XUnits:=", "<XUnits>", Array("NAME:YVal-
tax
ues", <YValues>), "YUnits:=", "<YUnits>", "YAxis:=", "<YAxisName>")
oModule.AddCartesianLimitLine
"Project Output

VB
Example Array("NAME:CartesianLimitLine",
Array("NAME:XValues", 0, 2, 5, 7, 10,
15), "XUnits:="

Reporter Editor Script Commands 13-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

0.05, 0.3, 0.65, 0.825, 0.95,


1), "YUnits:=", "mV", "

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

Return Value None

Python AddCartesianXMarker ("<ReportName>", "<MXn>", <Xcoord>)


Syntax

Python oModule.AddCartesianXMarker ("XY Plot 1", "MX1", 0)


Example

VB Syntax AddCartesianXMarker "<ReportName>", "<MXn>", <Xcoord>


oModule.AddCartesianXMarker "XY
VB Example
Plot1", "MX1", 0

AddCartesianYMarker
Adds a marker to a report on the Y axis.
Command: Report2D>Marker>Add Y Marker
Syntax: AddCartesianYMarker <ReportName>, <MarkerID>, <Ycoord>
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.
<MarkerID>
Type: <string>
ID of the marker, for example: "Y1".
<YCoord>

Reporter Editor Script Commands 13-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Type: <real>
Y location for the marker.
VB Example:
oModule.AddCartesianYMarker "XY Plot1", "Y1", 0

Python AddCartesianYMarker ("<ReportName>", "<Yn>", <Ycoord>)


Syntax

Python oModule.AddCartesianYMarker ("XY Plot 1", "Y1", 0)


Example

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
Parameters
<MXn> String Name and n for the x marker
<XCoord> Real X location for the marker

Return Value None

Python AddDeltaMarker(  "  <ReportName>", "<mn>", "<traceID"> "<xcoord>" "<mn>",


Syntax "<traceID"> "<xcoord>"
oModule.AddDeltaMarker("XY Plot 1",
"m3", "GS1.VAL :
Python
Example TR4 : Cartesian", "1826000000ns",
"m4","GS1.VAL : TR4 : Cartesian", "2096000000ns")

AddDeltaMarker "<ReportName>", "<mn>", "<traceID"> "<xcoord>" "<mn>",


VB Syntax
"<traceID"> "<xcoord>"
oModule.AddDeltaMarker "XY Plot 1",
VB
"m3", "dB(S(LumpPort1 LumpPort1)):
Example
Setup1 : Sweep1 : Cartesian", _ "3.22GHz", _

Reporter Editor Script Commands 13-7


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"m4", "dB(S(LumpPort1 LumpPort1)):


Setup1 : Sweep1 : Cartesian",_ "3.93GHz"

AddMarker
Adds a marker to a trace on a report.

UI Access Report2D>Marker>Add Marker

Name Type Description


<ReportName> String Name of Report
Parameters
<MXn> String Name and n for the x marker.
<XCoord> Real X location for the marker

Return Value None

Python AddMarker(  "  <ReportName>", "<mn>", "<traceID"> "<xcoord>")


Syntax

oModule.AddMarker("XY Plot 1", "m5",


Python
Example "GS1.VAL : TR4 : Cartesian", "3.61599999999997s")

VB Syntax AddMarker "<ReportName>", "<mn>", "<traceID"> "<xcoord>"


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


<ReportName> String Name of report
Parameters <NoteDataArray> Array Array("NAME:<NoteDataName>", <NoteAr-
ray>)
<NoteDataName> String

Reporter Editor Script Commands 13-8


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<NoteArray> Array Array


("NAME:<NoteDataSourceName>",
"SourceName:=", <SourceName>,
"HaveDefaultPos:=", <boolean>,
"DefaultXPos:=", <XPos>,
"DefaultYPos:=", <YPos>,
"String:=", <Note>))

Return None
Value

Python AddNote (<ReportName> <NoteDataArray>)


Syntax

oModule = oDesign.GetModule("ReportSetup")
oModule.AddNote ("XY Plot1", ["NAME:NoteDataSource",

Python ["NAME:Note-
DataSource", "SourceName:=", "Note1",
Exampl-
e "HaveDefaultPos:=", true, "DefaultXPos:=",
1996, "DefaultYPos:=", _ 3177, "String:=", "This is a
note"]]

VB Syn- AddNote <ReportName> <NoteDataArray>


tax

Set oModule = oDesign.GetModule("ReportSetup")


oModule.AddNote "XY Plot1", Array("NAME:NoteDataSource",
VB
Array("NAME:Note-
DataSource", "SourceName:=", "Note1",
Exampl-
e "HaveDefaultPos:=", true, "DefaultXPos:=",
1996, "DefaultYPos:=", _ 3177, "String:=", "This is a
note"))

AddTraceCharacteristics
Adds a trace characteristics field to the legend on a report.
Command: Report2D>Trace Characteristics>All... for Add Trace Characteristics dialog.

Reporter Editor Script Commands 13-9


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syntax: AddTraceCharacteristics <ReportName>, <TraceCharID>, Array("<sub-quantity for spe-


cific trace characteristic>"), Array(<Range>)
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.
<TraceCharID>
Type: <string>
ID for the trace characteristic. These are listed in the Add Trace Characteristics dialog
and the online help.

<Subquantity for some trace characteristic>


Type: <string>
Some Trace Characteristics require or more associated quantities, such as such as "fre-
quency" for "distortion". These sub-quantities are listed in the Add Trace Char-
acteristics dialog when you select a quantity that requires one. For example the
deadtime trace characteristic requires a Tolerance quantity in addition to a Range:

Reporter Editor Script Commands 13-10


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<Range>
Either "Full" for the full sweep range, or "Specified", and "<start>", and "<end>" values
and units.

VB Example:
Set oModule = oDesign.GetModule("ReportSetup")
oModule.AddTraceCharacteristics "Rept2DRectFreq2", "min", Array(),
Array("Full")
VB Example:
Set oModule = oDesign.GetModule("ReportSetup")
oModule.AddTraceCharacteristics "Rept2DRectFreq", "distortion",
Array("0"), Array( "Specified", "19.5GHz", "20.4GHz")
oModule.AddTraceCharacteristics "Rept2DRectFreq2", "deadtime", Array
("0.1"), Array( "Full")

Pyth- AddTraceCharacteristics( "<ReportName>", "<CharacteristicID>", Array(),


on
Syn-
tax

Pyth-
oModule.AddTraceCharacteristics("Differential S-parameters",
on "pk2pk", [], ["Full"])
Exa- oModule.AddTraceCharacteristics("Differential S-parameters",
mple
"prms", ["0", "0"], ["Full"])

AddTraces
Creates a new trace and adds it to the specified report.

UI Access Modify Report>Add Trace

Name Type Description


Parameters <ReportName> String Name of Report
<SolutionName> String Name of the solution as listed in the Modify

Reporter Editor Script Commands 13-11


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Report dialog box.


< ContextArray> Array of Context for which the expression is
Strings being evaluated. This can be an
empty string if there is no context.
Array("Domain:=", <DomainType>)
<DomainType>
ex. "Sweep" or "Time"
Array("Context:=", <Geo-
metryType>)
<GeometryType>
ex. "Infinite Spheren", "Spheren", "Polylinen"
<FamiliesArray> Array of Contains sweep definitions for the
Strings report.
Array("<VariableName>:= ",
<ValueArray>)

<ValueArray>
Array("All") or Array("Value1", "Value2",
..."Valuen")
examples of <VariableName>
"Freq", "Theta", "Distance"
<ReportDataArray> Array of This array contains the report quant-
Strings ity and X, Y, and (Z) axis definitions.
Array("X Component:=", <Vari-
ableName>, "Y Component:=",
<VariableName> | <ReportQuant-
ityArray>)

<ReportQuantityArray>
ex. Array("dB(S(Port1, Port1))")

Return Value None

Python Add Traces (<ReportName>, <SolutionName> ,<ContextArray >,<FamiliesArray>,


Syntax <ReportDataArray>)

Reporter Editor Script Commands 13-12


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oModule.AddTraces ("XY Plot1", "Setup1 : Sweep1", _


["Domain:=", "Time", "HoldTime:=", 1, "RiseTime:=", 0, _
"StepTime:=", 6.24999373748E-012, "Step:=", false, _
"WindowWidth:=", 1, _
Python
"WindowType:=", 0, "KaiserParameter:=", 1, _
Exampl-
e "MaximumTime:=", 6.2437437437444E-009], _
["Time:=", ["All"], "OverridingValues:=", ["0s", _
"6.24999373748188e-012s", ... ]], ["X Component:=",
"Time",_
"Y Component:=", ["TDRZ(WavePort1)"]], [])

VB Add Traces <ReportName> <SolutionName> <ContextArray> <FamiliesArray>


Syntax <ReportDataArray>
oModule.AddTraces "XY Plot1", "Setup1 : Sweep1", _
Array("Domain:=", "Time", "HoldTime:=", 1, "RiseTime:=", 0,
_
"StepTime:=", 6.24999373748E-012, "Step:=", false, _
"WindowWidth:=", 1, _
VB
"WindowType:=", 0, "KaiserParameter:=", 1, _
Exampl-
e "MaximumTime:=", 6.2437437437444E-009), _
Array("Time:=", Array("All"), "OverridingValues:=", Array
("0s", _
"6.24999373748188e-012s", ... )), Array("X Component:=",
"Time",_
"Y Component:=", Array("TDRZ(WavePort1)")), Array()

An example for Q3D Extractor is as follows:


VB Example: oModule.AddTraces "XY Plot 1", "Setup1 : AdaptivePass",
Array("Context:=", _ "Original"), Array("Pass:=", Array("All"), "Fre-
q:=", Array("0.5GHz"), "viarad:=", Array( _ "Nominal"), "padrad:=",
Array("Nominal")), Array("X Component:=", "Pass", "Y Component:=",
Array( _"DCL(via:via_source,via:via_source)")), Array()

Reporter Editor Script Commands 13-13


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

For Circuit, the AddTraces command has the following details.


Creates a new trace and adds it to the specified report.
Command: Modify Report>Add Trace
Syntax: Add Traces <ReportName> <SolutionName> <ContextArray <FamiliesArray>
<ReportDataArray>
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.

<SolutionName>
Type: <string>
Name of the solution as listed in the Modify Report dialog box.
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>)
Context for the trace. For more information see SimValueContext.

<FamiliesArray>
Type: Array of strings
Contains sweep definitions for the report.

Reporter Editor Script Commands 13-14


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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:
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, _
"MaximumTime:=", 6.2437437437444E-009), _
Array("Time:=", Array("All"), "OverridingValues:=", _
Array("0s","6.24999373748188e-012s", ... )), _
Array("X Component:=", "Time", _
"Y Component:=", Array("TDRZ(WavePort1)")), _
Array()

ClearAllMarkers
Clears all markers from a report.

Reporter Editor Script Commands 13-15


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

UI Access Report2d>Markers>ClearAllMarkers

Name Type Description


Parameters
 <ReportName> String Name of Report

Return Value None

Python Syn- ClearAllMarkers ("<ReportName>")


tax

Python oModule.ClearAllMarkers ("XY Plot 1")


Example

VB Syntax ClearAllMarkers "<ReportName>"


VB Example oModule.ClearAllMarkers "XY Plot 1"

For Q3D Extractor the ClearAllMarkers command has the following details.
Clears all markers.
Command: Q3DExtractor>Fields>Fields>Marker>Clear All
Syntax: ClearAllMarkers
Return Value: none
Parameters: none
VB Example: Dim oAnsoftApp
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("Solenoid")

Reporter Editor Script Commands 13-16


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oDesign = oProject.SetActiveDesign("Solenoid")


Set oModule = oDesign.GetModule("FieldsReporter")
oModule.ClearAllMarkers

ClearAllMarkers (2D Extractor)


Clears all markers from a report.
Command: Report2d>Markers>ClearAllMarkers
Syntax: ClearAllMarkers "<ReportName>"
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.
VB Example:
Set oProject = oDesktop.SetActiveProject("dra_antenna")
Set oDesign = oProject.SetActiveDesign("Q3DDesign1")
Set oModule = oDesign.GetModule("ReportSetup")
oModule.ClearAllMarkers "XY Plot 1"

ClearAllTraceCharacteristics
Clears all trace characteristics from the legend in a report.

UI Access Report_Type>Trace Characteristics>Clear All

Name Type Description


Parameters
<plot name> String Name of the plot

Return Value None

Python ClearAllTraceCharacteristics (<plot name>)


Syntax

Python oModule.ClearAllTraceCharacteristics("XY Plot 1")


Example

Reporter Editor Script Commands 13-17


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Syntax ClearAllTraceCharacteristics <plot name>


VB oModule.ClearAllTraceCharacteristics "XY Plot 1"
Example

CopyTracesData
Copy trace data for a paste operation.
Command: Select a trace in the Project tree, right-click and select Copy Data
Syntax: CopyTracesData <ReportName> <TracesArray>)
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.
<TracesArray>
Type: Array of Strings
Trace definitions from which to copy corresponding data.
VB Example:
oModule.CopyTracesData "Transmission", Array("mag(S(Port1,Port2))")
An example related to Q3D Extractor is as follows:
VB Example: oModule.CopyTracesData "C11", Array("C (Box1,Box1))")

Python Syn- CopyTracesData( <ReportName> <TracesArray>)


tax

Python
oModule.CopyTracesData ("Transmission",
Example ["mag(S(Port1,Port2))"])

CopyReportData
Copy all data corresponding to the specified reports.

UI Access Select a report in the Project tree, right-click and select Copy Data

Name Type Description


Parameters
<ReportsArray> Array of Names of reports from which to copy data

Reporter Editor Script Commands 13-18


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

strings

Return Value None

Python CopyReportData (<ReportsArray>)


Syntax

Python oModule.CopyReportData (["Transmission","Reflection"])


Example

VB Syntax CopyReportData <ReportsArray>


oModule.CopyReportData
VB Example
Array("Transmission","Reflection")

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 of Names of reports from which to copy the defin-
strings itions

Return Value None

Python CopyReportDefinitions (<ReportsArray>)


Syntax

Python oModule.CopyReportDefinitions(["Transmission", "Reflec-


Exampl- tion"])
e

VB Syntax CopyReportDefinitions <ReportsArray>


oModule.CopyReportDefinitions
VB Example
Array("Transmission", "Reflection")

Reporter Editor Script Commands 13-19


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 of Trace definitions to copy
Strings

Return Value None

Python Syn- CopyTraceDefinitions( <ReportName>, <TracesArray>)


tax

Python
oModule.CopyTraceDefinitions ("Transmission",
Example ["mag(S(Port1,Port2))"])

VB Syntax CopyTraceDefinitions <ReportName> <TracesArray>

VB
oModule.CopyTraceDefinitions "Transmission",
Example Array("mag(S(Port1,Port2))")

The following example is applicable for Q3D Extractor.


VB Example: oModule.CopyTraceDefinitions "R11",
Array("R(via:source1, via:source1)")

CreateReport
Creates a new report with a single trace and adds it to the Results branch in the project tree.
Command: [product]>Results>Create <type> Report
Syntax: CreateReport <ReportName> <ReportType> <DisplayType> <SolutionName> <Con-
textArray> <FamiliesArray> <ReportDataArray>
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.

Reporter Editor Script Commands 13-20


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<ReportType>
Type: <string>
Possible values are:
"Modal S Parameters" - Only for Driven Modal solution-type problems with ports.
"Terminal S Parameters" - Only for Driven Terminal solution-type problems with ports.
"Eigenmode Parameters" - Only for Eigenmode solution-type problems.
"Fields"
"Far Fields" - Only for problems with radiation or PML boundaries.
"Near Fields" - Only for problems with radiation or PML boundaries.
"Emission Test"
<DisplayType>
Type: <string>
If ReportType is "Modal S Parameters", "Terminal S Parameters", or "Eigenmode Para-
meters", then set to one of the following:
"Rectangular Plot", "Polar Plot", "Radiation Pattern",
"Smith Chart", "Data Table", "3D Rectangular Plot", or "3D Polar
Plot".

If <ReportType> is "Fields", then set to one of the following:


"Rectangular Plot", "Polar Plot", "Radiation Pattern", "Rect-
angular Contour Plot", "Data Table", or "3D Rectangular Plot".

If <ReportType> is "Far Fields" or "Near Fields", then set to one of the following:
"Rectangular Plot", "Radiation Pattern", "Rectangular Contour
Plot" "Data Table",
"3D Rectangular Plot", or "3D Polar Plot"

If <ReportType> is "Emission Test", then set to one of the fol-


lowing:
"Rectangular Plot" or "Data Table"
<SolutionName>
Type: <string>

Reporter Editor Script Commands 13-21


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Name of the solution as listed in the Modify Report dialog box.


For example: "Setup1 : Last Adaptive"
<ContextArray>
Type: Array of strings
Context for which the expression is being evaluated. This can be an empty string if there
is no context.
Array("Domain:=", <DomainType>)
<DomainType>
ex. "Sweep" or "Time"

Array("Context:=", <GeometryType>)
<GeometryType>
ex. "Infinite Spheren", "Spheren", "Polylinen"

<FamiliesArray>
Type: Array of strings
Contains sweep definitions for the report.
Array("<VariableName>:= ", <ValueArray>)

<ValueArray>
Array("All") or Array("Value1", "Value2", ..."Valuen")
examples of <VariableName>
"Freq", "Theta", "Distance"

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

Reporter Editor Script Commands 13-22


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

ex. Array("dB(S(Port1, Port1))")


VB Example:
oModule.CreateReport "Rept2DRectFreq",_
"Modal Solution Data", "XY Plot", _
"Setup1 : Sweep1",_
Array("Domain:=", "Sweep"), _
Array("Freq:=", Array("All")), _
Array("X Component:=", "Freq",
"Y Component:=", _ Array("dB(S(LumpPort1,LumpPort1))")), _
Array()
VB Example:
Set oModule = oDesign.GetModule("ReportSetup")
oModule.CreateReport "3D Cartesian Plot1", "Far Fields",_
"3D Cartesian Plot", "Setup1 : LastAdaptive", _
Array("Context:=", "Infinite Sphere1", "Domain:=", "Sweep"), Array
("Theta:=", Array("All"), "Phi:=", Array("All"), _
"Freq:=", Array("10GHz")), _
Array("X Component:=", "Theta", _
"Y Component:=", "Phi", _
"Z Component:=", Array("rETotal")), _
Array()

VB Example:
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()

Reporter Editor Script Commands 13-23


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2016.0.0
' 15:14:58 Sep 08, 2015
' ----------------------------------------------
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("dra_diel")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("ReportSetup")
oModule.CreateReport "Rectangular Contour Plot 2", "Far Fields", _
"Rectangular Contour Plot", "Setup1 : LastAdaptive", Array("Con-
text:=", _
"Infinite Sphere1"), Array("_u:=", Array("All"), "_v:=", Array
("All"), "Freq:=", Array( _
"5GHz")), Array("X Component:=", "_u", "Y Component:=", "_v", "Z Com-
ponent:=", Array( _
"rETotal")), Array()

Python CreateReport (<ReportName>, <ReportType>, <DisplayType>, <SolutionName>,


Syntax <ContextArray>, <FamiliesArray>, <ReportDataArray>, <ExtendedInfo>)

Python Three examples are given below:(nominal, Optimetrics, spec-


Example tral)

Reporter Editor Script Commands 13-24


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Nominal Example:
oModule.CreateReport( "XY Plot 2", "Standard",_
"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", "SimValueContext:=",_
[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, "40ms", _
"TH", false, "40", "TS", false, "0ns", "UF", false, _
"0", "WT", false, "0", "WW", false, "100"]],_
["Spectrum:=", ["All"], "aaa:=",_
["Nominal"]], ["X Component:=","Spectrum", _
"Y Component:=", ["mag(E1.I)"]], [])

Reporter Editor Script Commands 13-25


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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> <Con-
textArray> <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.

<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"

Reporter Editor Script Commands 13-26


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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>)
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))")

Reporter Editor Script Commands 13-27


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Example:
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", "Lin-
earFrequency",_
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))")), Array()

VB Example:
oModule.CreateReport "3D Rectangular Plot 1", "Standard", "3D Rect-
angular 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 Rect-
angular Plot", _
"LinearFrequency", Array("NAME:Context", "SimValueContext:=", Array
(3, 0, 2, 0, _

Reporter Editor Script Commands 13-28


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 CreateReport(<data_block>)
Syntax

oModule = oDesign.GetModule("ReportSetup")
oModule.CreateReport("QuickEye Voltage Plot 1", "Eye Dia-
gram", "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","PCI-
D",
False,"3","PID",False,"0",
"WE",False,"49.99995us","WM",False,"49.99995us","WN",Fal-
se,
"0ps","WS",False,"0ps"]
Python ],
Example
[
"Time:=" , ["All"]
],
[
"Component:=" , ["aeyeprobe3"]
],
[
"Unit Interval:=" , "1e-009s",
"Offset:=" , "0",
"Auto Delay:=" , True,
"Manual Delay:=" , "0ps",
"AutoCompCrossAmplitude:=", True,

Reporter Editor Script Commands 13-29


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"CrossingAmplitude:=" , "0mV",
"AutoCompEyeMeasurementPoint:=", True,
"EyeMeasurementPoint:=" , "5e-010s"
])

CreateReportFromTemplate
Create a report from a saved template.

[product]>Results>Report Templates>
UI Access
PersonalLib><TemplateName>

Name Type Description


Parameters
<TemplatePath> String Path to report template

Return Value None

Python CreateReportFromTemplate(  "  <TemplatePath>")


Syntax

oProject = oDesktop.SetActiveProject("3PhaseRectifier")
oDesign = oProject.SetActiveDesign("3PhaseRectifier")

Python oModule = oDesign.GetModule("ReportSetup")


Examp-
le oModule.CreateReportFromTemplate ("C:\MyHFSSPro-
jects\PersonalLib\" _
& "ReportTemplates\TestTemplate.rpt")

VB CreateReportFromTemplate "<TemplatePath>"
Syntax

Set oProject = oDesktop.SetActiveProject("3PhaseRectifier")


Set oDesign = oProject.SetActiveDesign("3PhaseRectifier")
VB
Examp- Set oModule = oDesign.GetModule("ReportSetup")
le
oModule.CreateReportFromTemplate "C:\MyHFSSPro-
jects\PersonalLib\" _

Reporter Editor Script Commands 13-30


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

& "ReportTemplates\TestTemplate.rpt"

For Q3D Extractor, the command CreateReportFromTemplate details are as follows:


Create a report from a saved template.
Command: Q3D Extractor>Results>PersonalLib><TemplateName>
Syntax: CreateReportFromTemplate "<TemplatePath>"
Return Value: A new report.
Parameters: <TemplatePath>
Type: <string>
Path to report template.
VB Example: Set oProject = oDesktop.SetActiveProject("connector")
Set oDesign = oProject.SetActiveDesign("connector")
Set oModule = oDesign.GetModule("ReportSetup")
oModule.CreateReportFromTemplate _
"C:\MyQ3DProjects\PersonalLib\" & _
"ReportTemplates\TestTemplate.rpt"

CreateReportOfAllQuantities
Create a report including all quantities in a category. Cannot create a report with expressions.

UI Access NA

Name Type Description


reportTypeArg Report type name as input para-
meter
displayTypeArg Display type name as input
parameter
solutionNameArg Solution name as input para-
meter
Parameters simValueCtxtArg a context name, or array of
string that encoded the context
(I).
categoryNameArg a category name as
input parameter
pointSetArg Array of strings(II)
commonComponentsOfTracesArg Array of strings(III)
extTraceInfoArg Array of strings(IV)

Reporter Editor Script Commands 13-31


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Return Value  Report of all quantities in a category

CreateReportOfAllQuantities(reportNameArg, reportTypeArg, displayTypeArg, solu-


Python
Syntax
tionNameArg, simValueCtxtArg, categoryNameArg, pointSetArg, com-
monComponentsOfTracesArg, extTraceInfoArg)
solutions= oModule.CreateReportOfAllQuantities("Smith Chart
all",

Python Modal Solution Data", "Smith Chart", "Setup1 : LastAd-


Exampl- aptive",
e [],"S Parameter",["Freq:=", ["All"], "offset:=",
["All"],"a:=",
["Nominal"],"b:=", ["Nominal"]],[],[])

CreateReportOfAllQuantities(reportNameArg, reportTypeArg, displayTypeArg, solu-


VB
tionNameArg, simValueCtxtArg, categoryNameArg, pointSetArg, com-
Syntax
monComponentsOfTracesArg, extTraceInfoArg);
solutions= oModule.CreateReportOfAllQuantities("Smith Chart
all",

VB
"Modal Solution Data", "Smith Chart", "Setup1 : LastAd-
Exampl- aptive",
e [],"S Parameter",["Freq:=", ["All"], "offset:=",
["All"],"a:=",
["Nominal"],"b:=", ["Nominal"]],[],[])

DeleteMarker
Use:Deletes the specified marker.
Command:[product]>Fields>Fields>Marker>Delete Marker
Syntax:DeleteMarker <MarkerName>
Return Value:None
Parameters:<MarkerName>
Type: <string>
Name of the marker.
VB Example:Dim oAnsoftApp

Reporter Editor Script Commands 13-32


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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("Solenoid")
Set oDesign = oProject.SetActiveDesign("Solenoid")
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.DeleteMarker "m1"

DeleteAllReports
Deletes all existing reports.

Right-click the report to delete in the project tree, and then click Delete All
UI Access
Reports on the shortcut menu.

Name Type Description


Parameters
None

Return Value None

Python Syn- DeleteAllReports()


tax

Python oModule.DeleteAllReports()
Example

VB Syntax DeleteAllReports

VB Example oModule.DeleteAllReports

Reporter Editor Script Commands 13-33


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

DeleteReports
Deletes an existing report or reports.

Right-click the report to delete in the project tree, and then click Delete on the
UI Access
shortcut menu

Name Type Description


Parameters <ReportNameArray> Array of Array of all the report names that are to be
Strings deleted

Return Value None

Python Syn- DeleteReports(<ReportNameArray>)


tax

Python oModule.DeleteReports (["Rept2DRectFreq"])


Example

VB Syntax DeleteReports(<ReportNameArray>)
VB oModule.DeleteReports Array("Rept2DRectFreq")
Example

DeleteTraces
Deletes an existing traces or traces.

Right-click the Trace to delete in the project tree, and then click Delete on the
UI Access
shortcut menu

Name Type Description


<TraceSelectionArray> Array of Array("<ReportName>:=", <TracesAr-
Strings ray>, <TracesArray>,... )
<ReportName> String Name of Report
Parameters <TracesArray> Array of Contains the traces to delete within a
Strings report
Array(<Trace>, <Trace>, ...)
<Trace> String A specific trace that the user wishes to
delete

Return Value None

Reporter Editor Script Commands 13-34


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Syn- DeleteTraces(<TraceSelectionArray>)


tax

oModule.DeleteTraces (["XY Plot 1:=",


Python
Example ["dB(S(LumpPort1,Lump-
Port1))"],
"XY Plot 2:=", ["Mag_E"]])

VB Syntax DeleteTraces(<TraceSelectionArray>)
oModule.DeleteTraces Array("XY Plot 1:=",
VB
Array("dB(S(LumpPort1,Lump-
Port1))"),
Example
"XY Plot 2:=", Array("Mag_E"))

An example applicable for Q3D Extractor is as follows.


VB Example:
oModule.DeleteTraces Array("XY Plot 1:=", Array("R(via:source1, via:-
source1)"), "XY Plot 2:=", Array("char_imped"))

ExportImageToFile [Reporter]
Export an image in a specified format.
Command: None.
Syntax: ExportImageToFile(<ReportName>,<exportFileName>, <width>, <height>)
Parameters: <ReportName>
Type: <string>
Name of the image file.
<ExportFileName>
Type: <String>
Full path of the exported image file name; with extension of jpg, gif, tiff, tif, bmp, or wrl.
<width>
Type: <int>
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>

Reporter Editor Script Commands 13-35


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Type: <int>
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.
For the default, use 0, 0. For higher resolution, set the desired <width> and <height>, for
example for 8k export as 7680, 4320:
VB Example:
Set oProject = oDesktop.SetActiveProject("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
Set oModule = oDesign.GetModule("ReportSetup")
oModule.ExportImageToFile "Rectangular Contour Plot 1", "D:/-
work/2015/UV-Export/pp1.gif", 0, 0

Python Syn- ExportModelImageToFile (["<path>/<imageName>.<formatsuffix>" 0,0,


tax [(<SaveImageParams>)])

Python oModule.ExportImageToFile(" Plot 1", "C:/Users/kmchrist/Documents/Plot


Example 1.jpg", 0, 0)

Python oModule.ExportImageToFile(" Plot 1", "C:/Users/kmchrist/Documents/Plot


Example, 1.jpg", 7680, 4320)
High Res-
olution

ExportPlotImageToFile [Reporter]
Use: Create field plot exports of existing field plots from a given view points, and with the model
being auto-sized automatically for each view.
Command: None.
Syntax: ExportPlotImageToFile(<FileName>, "", <plotItemName>, <setViewTopDownDir-
ectionByRelativeCS>)
Return Value: An image file.
Parameters: <FileName>
Type: <string>
Full path plus file name.
""
Type: <EmptyString>
<PlotItemName>
Type: <string>

Reporter Editor Script Commands 13-36


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Name of fields to plot.


<SetViewTopDownDirectionByRelativeCS>
Type: <string>
Name of relative coordinate system to use for the field plot.

Example:
’This example demonstrates the creation of E-field plots ’of three
different orientations:
’Mag_E1 created in-plane with the XY-plane of the Global ’coordinate
system
’Mag_E2 created in-plane with the XY-plane of the RelativeCS1
coordinate system
’Mag_E3 created in-plane with the XY-plane of the RelativeCS2
coordinate system
Dim oAnsoftApp, oDesktop, oProject, oDesign, oEditor, oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject()
Set oDesign = oProject.GetActiveDesign()

Set oModule = oDesign.GetModule("FieldsReporter")


'First set the module "FieldsReporter"

oModule.ExportPlotImageToFile "C:\TestEPITF1.jpg", "", "Mag_E1",


"Global"
oModule.ExportPlotImageToFile "C:\TestEPITF2.jpg", "", "Mag_E2",
"RelativeCS1"
oModule.ExportPlotImageToFile "C:\TestEPITF3.jpg", "", "Mag_E3",
"RelativeCS2"

Reporter Editor Script Commands 13-37


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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
<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")

Reporter Editor Script Commands 13-38


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oDesign.ExportReport "Data Table 1", "table_test", "csv"

Python Syn- ExportReport(  <


  ReportName>, <FileName>)
tax

Python oDesign.ExportReport(
Example "Plot1", "c:\report1.dat")

ExportToFile

Note:

The ExportToFile script command has replaced the script command ExportReport.
ExportReport remains in order to retain backward compatibility for existing scripts, but it
is strongly recommended that you now use ExportToFile.

From a data table or plot, generates text format, comma delimited, tab delimited, or .dat type output
files.
Command: Right-click on report name in the Project tree and select Export Data.
Syntax: ExportToFile <ReportName>, <FileName>
Return Value: None
Parameters: <ReportName>
Type: string

<Filename>
Type: string

.txt Post processor format file


.csv Comma-delimited data file
.tab Tab-separated file
.dat ANSYS plot data file

VB Example: Set oModule = oDesign.GetModule(’ReportSetup’)


oModule.ExportToFile(‘Plot 1’,’c:\report1.dat’)

Reporter Editor Script Commands 13-39


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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
Supported formats

Parameters .txt Post processor format file


.csv Comma-delimited data file
.tab Tab-separated file
.dat ANSYS plot data file
.rdat ANSYS report data file

Return Value None

Python Syn- ExportToFile (<ReportName>, <FileName>)


tax

Python
oModule.ExportToFile(
Example "Plot1", "c:\report1.dat")

VB Syntax ExportToFile <ReportName>, <FileName>


oModule.ExportToFile
VB Example
"Plot1", "c:\report1.dat"

ExportMarkerTable
The documented command is applicable for Q3D Extractor.
Use:Exports the marker table to a .csv or .tab file.
Command:[product]>Fields>Fields>Marker>ExportMarkerTable
Syntax:ExportMarkerTable <pathandfilename>
Return Value:none

Reporter Editor Script Commands 13-40


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Parameters:<pathandfilename>
Example:Dim oAnsoftApp
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("Solenoid")
Set oDesign = oProject.SetActiveDesign("Solenoid")
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.ExportMarkerTable("C:/work/FieldMarkerTable.csv")

FFTOnReport
Use: Perform an FFT on a selected report.
Command: [product]>Results>Perform FFT on Report
Syntax: FFTOnReport "<plotName>", <FFTWindowType>, "<function>"
Return Value: Creates a plot named FFT "PlotName"
Parameters: <PlotName>
Type: string
<FFTWindowType>
Type: string
Rectangular, Tri, Van Hann, Hamming, Blackman,Lanczos, Weber, Welch.
<function>
Type: string
<none>, ang_deg, ang_rad, arg, cang_deg, cang_rad, dB, dB1 normalize, dB20nor-
malize, dBc, im, mag, normalize, re.

Reporter Editor Script Commands 13-41


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 3:39:35 PM Mar 16, 2011
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
Set oModule = oDesign.GetModule("Solutions")
oModule.FFTOnReport "XY Plot 1", "Rectangular", "dB"

For Q3D Extractor the details for FFTOnReports are as follows:


Use: Perform an FFT on a selected report.
Command: Q3D Extractor or 2D Extractor>Results>Perform FFT on Report
Syntax: "<plotName>", <FFTWindowType>, "<function>"
Return Value: Creates a plot named FFT "Plot Name".
Parameters: <PlotName>
Type: string
<FFTWindowType>
Type: string
Rectangular, Tri, Van Hann, Hamming, Blackman,Lanczos, Weber, Welch.
<Function>

Reporter Editor Script Commands 13-42


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Type: string
<none>, ang_deg, ang_rad, arg, cang_deg, cang_rad, dB, dB1 normalize, dB20nor-
malize, dBc, im, mag, normalize, re.
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("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
Set oModule = oDesign.GetModule("Solutions")
oModule.FFTOnReport "XY Plot 1", "Rectangular", "dB"

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


 <reportTypeArg> Report type name as input parameter
<displayTypeArg> Display type name as input parameter
Parameters <solutionNameArg> Solution name as input parameter
<simValueCtxtArg> A context name, or array of strings that
encode the contexts(I)
categoryName_ Output parameter for returning category
array names

Return Value Array of text strings

Reporter Editor Script Commands 13-43


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python GetAllCategories(reportTypeArg,displayTypeArg, solutionNameArg, simValueCtx-


Syntax tArg, categoryName_array)
categories= oModule.GetAllCategories("Far Fields",
Python "Rectangular Plot", "Setup1 :
Example
LastAdaptive", "Infinit

GetAllCategories(reportTypeArg,displayTypeArg, solutionNameArg,
VB Syntax
simValueCtxtArg, categoryName_array)
categories= oModule.GetAllCategories
VB
("Far Fields", "Rectangular Plot", "Setup1 :
Example
LastAdaptive", "Infini

GetAllReportNames
Gets the names of existing reports in a design

UI Access NA

Name Type Description


Parameters
None

Return Value Array of report names

Python GetAllReportNames()
Syntax

oReportModule = oDesign.GetModule("ReportSetup")
names = oReportModule.GetAllReportNames()
Python
Example for name in names:
AddInfoMessage(str(name))

VB Syntax GetAllReportNames()
VB Dim names

Reporter Editor Script Commands 13-44


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

names = oReportModule.GetAllReportNames
For index = 0 to UBound(names)
Example MsgBox(names(index))

Next

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.GetActiveProject
Set oDesign = oProject.GetActiveDesign
Set oReportModule = oDesign.GetModule("ReportSetup")
Dim names
names = oReportModule.GetAllReportNames
For index = 0 to UBound(names)
MsgBox(names(index))
Next
Set oFieldReportModule = oDesign.GetModule("FieldsReporter")
Set collection = oFieldReportModule.GetFieldPlotNames
For index = 0 to collection.Count-1
MsgBox(collection.Item(index))
Next

Reporter Editor Script Commands 13-45


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetAllQuantities
Gets all available quantity names in category, returned as an array of text strings.

UI Access NA

Name Type Description


<reportTypeArg> Report type name as input parameter
<displayTypeArg> Display type name as input parameter
<solutionNameArg> Solution name as input parameter
<simValueCtxtArg> A context name, or array of string that
Parameters encoded the contexts(I).
<categoryNameArg> A category name as input parameter. a cat-
egory name returned in GetAllCategories()
or "Vari-ables", or "Output Variables"
<quantityName_ Output parameter for returning quantity
array> names found in a category.

Return Value Array of text strings

Python Syn- GetAllQuantities(reportTypeArg, displayTypeArg, solutionNameArg,


tax
simValueCtxtArg, categoryNameArg, quantityName_array)
quantities= oModule.GetAllQuantities
Python ("Far Fields", "Rectangular Plot", "Setup1 :
Example
LastAdaptive", "Infinite Sphere1", "Gain")

GetAllQuantities(reportTypeArg, displayTypeArg, solutionNameArg,


VB Syntax
simValueCtxtArg, categoryNameArg, quantityName_array)
quantities= oModule.GetAllQuantities
VB
("Far Fields", "Rectangular Plot", "Setup1 :
Example
LastAdaptive", "Infinite Sphere1", "Gain")

GetAvailableDisplayTypes
All supported display types in report type as an array of text strings.

Reporter Editor Script Commands 13-46


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

UI Access NA

Name Type Description


Parameters
< reportTypeArg > Report type name as input parameter
<displayType_ Output parameter for returning display types
array>

Return Value Array of text strings

Python GetAvailableDisplayTypes(reportTypeArg,displayType_array)
Syntax

Python displayTypes = oModule .GetAvailableDisplayTypes("Far


Exampl- Fields")
e

VB Syn- GetAvailableDisplayTypes(reportTypeArg,displayType_array)
tax

VB displayTypes = oModule .GetAvailableDisplayTypes("Far


Exampl- Fields")
e

GetAvailableReportTypes
Get all available report types in the current Design as an array of text string.

UI Access NA

Name Type Description


Parameters
reportType_array Array Output parameter for returning report types

Return Value Array of text strings

Python GetAvailableReportTypes([out, retval] VARIANT* reportType_array)


Syntax

Python reportTypes = oModule.GetAvailableReportTypes()


Example

VB Syntax GetAvailableReportTypes([out, retval] VARIANT* reportType_array)

Reporter Editor Script Commands 13-47


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB reportTypes = oModule.GetAvailableReportTypes()
Example

GetAvailableSolutions
Get all available solutions in report type as an array of text strings.

UI Access NA

Name Type Description


Parameters
<reportTypeArg> Report type name as input parameter.
solution_array Output parameter for returning solution
names.

Return Value Array of text strings

Python GetAvailableSolutions(reportTypeArg,solution_array)
Syntax

Python solutions=oModule.GetAvailableSolutions("Far Fields")


Example

VB Syn- GetAvailableSolutions(reportTypeArg,solution_array)
tax

VB solutions= oModule.GetAvailableSolutions("Far Fields")


Example

GetDataExpressions
Returns data expressions.

UI Access NA
Parameters NA
Return Value Array of text strings

Python Syn- GetDataExpressions()


tax

Python expressions = oModule.GetDataExpressions()


Example

Reporter Editor Script Commands 13-48


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Syntax GetDataExpressions()

VB dim expressions
Example expressions = oModule.GetDataExpressions()

GetDataUnits
Returns text string containing units.

UI Access NA

Name Type Description


Parameters <expressionString> String Can be returned from GetDataEx-
pressions()

Return Value Text string of units; empty if no units

Python Syn- GetDataUnits(<expressionString>)


tax

Python oModule.GetDataUnits(expressions)
Example

VB Syntax GetDataUnits(<expressionString>)
VB Example oModule.GetDataUnits(expressions)

GetDesignVariableNames
Returns array of strings containing design variable names.

UI Access NA
Parameters NA
Return Value Array of strings

Python Syn- GetDesignVariableNames()


tax

Reporter Editor Script Commands 13-49


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python names = oModule.GetDesignVariableNames()


Example

VB Syntax GetDesignVariableNames()

VB dim names
Example names = oModule.GetDesignVariableNames()

GetDesignVariableUnits
Returns array of strings containing design variable units.

UI Access NA

Name Type Description


Parameters <varName> String Can be returned from GetDesignVari-
ableNames()

Return Text string of units; empty if no units.


Value

Python GetDesignVariableUnits(<varName>)
Syntax

Python units = oModule.GetDesignVariableUnits('Variable Name')


Example

VB Syn- GetDesignVariableUnits(<varName>)
tax

VB dim units
Example units = oModule.GetDesignVariableUnits("Variable Name")

GetDesignVariableValue
Returns a design variable's value.

UI Access NA

Name Type Description


Parameters
<varName> String Can be returned from GetDesignVari-

Reporter Editor Script Commands 13-50


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

ableNames()
<siValue> Boolean True to return SI-value; False to return
by GetDesignVariableUnits()

Return Double value


Value

Python GetDesignVariableValue(<varName>, <siValue>)


Syntax

Python value = oModule.GetDesignVariableValue('varName',1)


Example

VB Syn- GetDesignVariableValue(<varName>, <siValue>)


tax

VB dim value
Example value = oModule.GetDesignVariableValue("varName", True)

GetDesignVariationKey
Returns a design's Variation Key.

UI Access NA
Parameters NA
Return Value String containing Variation Key

Python Syn- GetDesignVariationKey()


tax

Python key = GetDesignVariationKey()


Example

VB Syntax GetDesignVariationKey()
dim key
VB Example
key = oModule.GetDesignVariationKey()

Reporter Editor Script Commands 13-51


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetDisplayType
Get the display type of a report.

UI Access NA

Name Type Description


Parameters
<ReportName> String Report name

Report <displaytype> of a report.


<DisplayType>

Type: <string>

Return Value If ReportType is "Standard", then returns one of the following:


"Rectangular Plot", "Polar Plot", "Radiation Pattern",
"Data Table", "3D Rectangular Plot", or "3D Polar
Plot", "Rectan-
gular Stacked Plot", "Bode Plot", "Rect-
angular Nyquist Plot", "Nyquist Plot", "Digital Plot".

Python Syn-  GetDisplayType ("<reportName>")


tax

Python GetDisplayType("Standard")
Example

VB Syntax  GetDisplayType "<reportName>"


VB Example GetDisplayType("Standard")

GetImagDataValues
Returns array of imaginary data values.

UI Access NA

Name Type Description


<expressionString> String Can be returned from GetDataEx-
pressions()
Parameters
<siValue> Boolean True to return SI-value; False to return
with units returned in GetSweepUnits
().

Reporter Editor Script Commands 13-52


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Return Value Array of doubles

Python GetImagDataValues(<expressionString>,<siValue>)
Syntax

Python imaginaryvalues = oModule.GetImagDataValues('expression',1)


Example

VB Syn- GetImagDataValues(<expressionString>,<siValue>)
tax

VB
dim imaginaryvalues
Exampl- imaginaryvalues = oModule.GetImagDataValues("expres-
e sion",True)

GetPerQuantityPrimarySweepValues
Returns per quantity primary sweep values.

UI Access NA

Name Type Description


<expressionString> String Can be returned from GetDataEx-
Parameters pressions().
<siValue> Boolean True to return SI-value; False to return
by GetSweepUnits().

Array of doubles if IsPerQuantityPrimarySweep() returned True; error if returned


Return Value
False

Pytho- GetPerQuantitySweepValues(<expressionString>, <siValue>)


n Syn-
tax

Pytho- sweepvalues = oModule.GetPerQuantitySweepValues


n ('0.111,0.201,0.345,0.231', 1)
Exam-
ple

VB GetPerQuantitySweepValues(<expressionString>, <siValue>)

Reporter Editor Script Commands 13-53


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syn-
tax

VB
dim sweepvalues
Exam- sweepvalues = oModule.GetPerQuantitySweepValues
ple ("0.111,0.201,0.345,0.231", True)

GetPropertyValue
Gets the value of a single property belonging to a specific serverName and PropTab. This function
is available with the Project, Design or Editor objects, including definition editors.
Use the script recording feature and edit a property, and then view the resulting script to
see the format for that property.

UI Access NA

Name Type Description


<propTab> String One of the following, where tab titles
are shown in parentheses:
PassedParameterTab ("Parameter
Values")
DefinitionParameterTab (Para-
meter Defaults")
LocalVariableTab ("Variables" or
"Local Variables")
ProjectVariableTab ("Project vari-
ables")
Parameters
ConstantsTab ("Constants")
BaseElementTab ("Symbol" or
"Footprint")
ComponentTab ("General")
CustomTab ("Intrinsic Variables")
Quantities ("Quantities")
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.

Return Value  String, the value of the property.

Reporter Editor Script Commands 13-54


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python GetPropertyValue (<propTab>, <serverName>, <propName>)


Syntax

selectionArray = oEditor.GetSelections()
for k in selectionArray:
Python
Exampl- val = oEditor.GetPropertyValue("PassedParameterTab", k,
e "R")
...

VB GetPropertyValue (<propTab>, <serverName>, <propName>)


Syntax

selectionArray = oEd-
itor.GetSelections

for each k in selectionArray

VB
Examp-
val = oEditor.GetPropertyValue("PassedParameterTab", k,
le
"R")

...

next

Python Syn- GetPropertyValue ([ <array>])


tax

oModule = oDesign.GetModule("ReportSetup")
Python
Example oModule.GetPropertyValue("Trace", "S Parameter Plot
1:dB(S(1,1))","Y Axis")

VB Example:
value_string = _
oEditor.GetPropertyValue("Geometry3DCmdTab",_

Reporter Editor Script Commands 13-55


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Box1:CreateBox:1", "XSize")

VB Example:value_string = _
oEditor.GetPropertyValue("BaseElementTab",_
"rect_1", "Name")

Example: (Query frequency and excitation)


freq = oDesign.GetPropertyValue("General", "AnalysisSetup:Setup1",
"Adaptive Freq")
sigType = oDesign.GetPropertyValue("Q3D", "BoundarySetup:via_1",
"Type")
sourceType = oDesign.GetPropertyValue("Q3D", "Bound-
arySetup:Source1", "Type")

Example: (Query Trace values in a specified report)


oModule = oDesign.GetModule("ReportSetup")
oModule.GetPropertyValue("Trace", "S Parameter Plot 1:dB(S(1,1))","Y
Axis")

GetRealDataValues
Returns array of real data values.

UI Access NA

Name Type Description


<expressionString> String Can be returned from GetDataEx-
pressions()
Parameters
<siValue> Boolean True to return SI-value; False to return
with units returned in GetSweepUnits
().

Return Value Array of doubles

Python GetRealDataValues(<expressionString>,<siValue>)
Syntax

Python realvalues = oModule.GetRealDataValues('expression',1)


Example

Reporter Editor Script Commands 13-56


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Syn- GetRealDataValues(<expressionString>,<siValue>)
tax

VB dim realvalues
Example realvalues = oModule.GetRealDataValues("expression",True)

GetReportTraceNames
Use: Gets the names of existing trace names in a plot.
Syntax: GetReportTraceNames("<plot name>")
Return Value: Array of trace names for a named plot.
Parameters: <PlotName>
Type: <string>
Name of plot.
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.GetActiveProject
Set oDesign = oProject.GetActiveDesign
Set oReportModule = oDesign.GetModule("ReportSetup")
Dim names
names = oReportModule.GetReportTraceNames("Sparameter Plot 1")
MsgBox(names(index))

Reporter Editor Script Commands 13-57


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python GetReportTraceNames()
Syntax

oReportModule = oDesign.GetModule("ReportSetup")
names = oReportModule.GetReportTraceNames("SParameter Plot
Python
Exampl-
1")
e for name in names:
AddInfoMessage(str(name))

GetSolutionContexts
Get all available solution context names in a solution as an array of text strings.

UI Access NA

Name Type Description


<reportTypeArg> Report type name as input parameter.
Parameters
<displayTypeArg> Display type name as input parameter.
<solutionNameArg> Solution name as input parameter.
<contextName_ Output parameter for returning context
array> names.

Return Value Array of text strings

Python Syn- GetSolutionContexts(reportTypeArg,displayTypeArg, solutionNameArg, con-


tax textName_array)
contexts= oModule.GetSolutionContexts
Python ("Far Fields", "Rectangular Plot", "Setup1:
Example
LastAdaptive")

GetSolutionContexts(reportTypeArg,displayTypeArg, solutionNameArg, con-


VB Syntax
textName_array);
contexts= oModule.GetSolutionContexts
VB
("Far Fields", "Rectangular Plot", "Setup1:
Example
LastAdaptive")

Reporter Editor Script Commands 13-58


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 para-
meter.
<solutionNameArg> String Solution name as input para-
meter.
Parameters
<simValueCtxtArg> Array of Strings Same as FamiliesArray values
created in the relevant CreateRe-
port script.
<expressionArg> String or Array of Output parameter for returning
Strings context names.

ARRAY of ISolutionDataResultComInterface objects, containing:

l GetSweepNames()
l GetSweepUnits()
l GetSweepValues()
l IsPerQuantityPrimarySweep()
l GetDataExpressions() – should be the same as <expressionArg>
l GetPerQuantityPrimarySweepValues()
l IsDataComplex()
Return Value
l GetDataUnits()
l GetRealDataValues()
l GetImagDataValues()
l ReleaseData()
l GetDesignVariableNames()
l GetDesignVariableUnits() 
l GetDesignVariableValue()
l GetDesignVariationKey()

Reporter Editor Script Commands 13-59


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 val-
ues.
l Boolean SI Value parameter defaults to True. When the pass in value is True,
return data values will be in Standard International 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].

Python Syn- GetSolutionDataPerVariation(reportTypeArg, solutionNameArg, simValueCtx-


tax tArg, pointSetArg, expressionArg)
oModule = oDesign.GetModule("ReportSetup")

Python arr = oModule.GetSolutionDataPerVariation('Modal Solu-


Example tion Data', 'Setup1 : Sweep', [['Domain:=', 'Sweep'],
['Freq:=', ['All'], 'offset:=', ['All']], ['S
(Port1,Port1)', 'dB(S(Port1,Port3))'])

GetSolutionDataPerVariation(reportTypeArg, solutionNameArg,
VB Syntax
simValueCtxtArg, pointSetArg, expressionArg)
dim domain (2)
domain(0) = "Domain:="
domain(1) = "Sweep"
dim all (1)
all(0) = "All"
VB Example dim freq (3)
freq(0) = "Freq:="
freq(1) = all
freq(2) = "offset:="
freq(3) = all
dim pointSetArg (2)

Reporter Editor Script Commands 13-60


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

pointSetArg(0) = domain
pointSetArg(1) = freq
dim expressionArg (2)
expressionArg(0) = "S(Port1,Port1)"
expressionArg(1) = "dB(S(Port1,Port3))"
dim solutionData = oMod-
ule.GetSolutionDataPerVariation("Modal Solution
Data", "Setup1 : Sweep", pointSetArg, expressionArg)

GetSweepNames
Returns array of text strings containing primary sweep name(s).

UI Access NA
Parameters NA
Return Value Array of text strings

Python Syn- GetSweepNames()


tax

Python sweepnames = oModule.GetSweepNames()


Example

VB Syntax GetSweepNames()
dim sweepnames
VB Example
sweepnames = oModule.GetSweepNames()

GetSweepUnits
Returns text string containing units.

UI Access NA

Name Type Description


Parameters
<sweepName> String Primary sweep name

Return Value Text string containing units

Reporter Editor Script Commands 13-61


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Syn- GetSweepUnits(<sweepName>)


tax

Python sweepunits = oModule.GetSweepUnits('Sweep 1')


Example

VB Syntax GetSweepUnits(<sweepName>)

VB dim sweepunits
Example sweepunits = oModule.GetSweepUnits("Sweep 1")

GetSweepValues
Returns sweep values.

UI Access NA

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 GetSweepValues(<sweepName>, <siValue>)


Syntax

Python sweepvalues = oModule.GetSweepValues('Sweep 1', 1)


Example

VB Syn- GetSweepValues(<sweepName>, <siValue>)


tax

VB dim sweepvalues
Example sweepvalues = oModule.GetSweepValues("Sweep 1", True)

GroupPlotCurvesByGroupingStrategy
Groups curves in a Stacked Plot automatically based on a curve grouping strategy.

Reporter Editor Script Commands 13-62


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Command: Group Curves By...


Syntax: GroupPlotCurvesByGroupingStrategy "<reportName>", "<curve_grouping_strategy>")
Return Value: None
Parameters: <ReportName>
Type: <string>
Report name.
<curve_grouping_strategy>
Type: <string>
Single, By Trace, By Units
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("CoaxBend14_1")
Set oDesign = oProject.SetActiveDesign("Transient")
Set oModule = oDesign.GetModule("ReportSetup")
oModule.GroupPlotCurvesByGroupingStrategy "Transient Plot 1", "By Units"

Pytho- GroupPlotCurvesByGroupingStrategy "<reportName>", "<curve_grouping_


n Syn- strategy>")
tax

Pytho- oModule.GroupPlotCurvesByGroupingStrategy("Transient Plot


n 1", "By Trace")
Exam-
ple

Reporter Editor Script Commands 13-63


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

ImportIntoReport
Imports .tab, .csv, and .dat format files into a report.

UI Access Right-click on report name in the Project tree and select Export Data.

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  ImportIntoReport (<ReportName>, <FileName>)


Syntax

Python oDesign.ImportIntoReport ("Plot1", "c:\report1.dat")


Example

VB Syn-  ImportIntoReport <ReportName>, <FileName>


tax

VB oDesign.ImportIntoReport "Plot1", "c:\report1.dat"


Example

IsDataComplex
Returns whether an expression is complex.

UI Access NA

Name Type Description


Parameters <expressionString> String Can be returned from GetDataEx-
pressions().

Return Value Boolean (True if expression is Complex data; False if not)

Python Syn- IsDataComplex(<expressionString>)


tax

Reporter Editor Script Commands 13-64


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python oModule.IsDataComplex('.001,.234,.455,.434')
Example

VB Syntax IsDataComplex(<expressionString>)
VB oModule.IsDataComplex('.001,.234,.455,.434')
Example

IsPerQuantityPrimarySweep
Returns whether data expressions have different primary sweep values.

UI Access NA
Parameters NA
Return Value Boolean (True if data expressions have different primary sweep values)

Python Syn- IsPerQuantityPrimarySweep()


tax

Python oModule.IsPerQuantityPrimarySweep()
Example

VB Syntax IsPerQuantityPrimarySweep()
VB Example oModule.IsPerQuantityPrimarySweep()

MovePlotCurvesToGroup
In a Stacked Plot move curve(s) from its stack(s) to an existing stack. Here term ‘group’ is syn-
onymous to ‘stack’ in the context of cartesian stacked plot.
Command: Move Plot Curves to Group
Syntax: MovePlotCurvesToGroup("<reportName>",["<curve1-name>", "<curve2-name>",...],
"<stack-name>")
Return Value: None
Parameters: <ReportName>
Type: <string>
Report name.

Reporter Editor Script Commands 13-65


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<curveN_name>
Type: <string>
Trace name.
<"stack-name">
Type: <string>
Stack name.

Pyth- oModule.MovePlotCurvesToGroup("<report-name>", ["<curve1-name>", "<curve2-


on name>",...], "<stack-name>")
Syn-
tax

Pyth- oModule.MovePlotCurvesToGroup("XY Stacked Plot 1", ["R2.V :


on TR", "R2.I : TR"], "Stack 2")
Exa-
mple

MovePlotCurvesToNewGroup
In a Stacked Plot move curve(s) from its stack(s) to anew stack. Here term ‘group’ is synonymous
to ‘stack’ in the context of Cartesian stacked plot.
Command: Move Plot Curves to New Group
Syntax: MovePlotCurvestoNewGroup("<reportName>",["<curve1-name>", "<curve2-name>",...],
"<stack-name>")
Return Value: None
Parameters: <ReportName>
Type: <string>
Report name.
<curveN_name>
Type: <string>
Trace name.
<"stack-name">
Type: <string>
Stack name.

Reporter Editor Script Commands 13-66


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Pyth- oModule.MovePlotCurvesToNewGroup("<report-name>", ["<curve1-name>",


on "<curve2-name>",...], "<stack-name>")
Syn-
tax

Pyth- oModule.MovePlotCurvesToNewGroup("XY Stacked Plot 1", ["R2.V


on : TR", "R2.I : TR"], "Stack 2")
Exa-
mple

PasteReports
Paste copied reports to results in the current project.

UI Access Edit>Paste

Name Type Description


Parameters
None

Return Value None

Python Syn- PasteReports ()


tax

Python oModule.PasteReports()
Example

VB Syntax PasteReports
VB Example oModule.PasteReports

PasteTraces
To paste copied traces to a named plot.

UI Access Paste

Name Type Description


Parameters
<plotName> String Name of plot

Return Value None

Python Syn- PasteTraces ("<plotName>")

Reporter Editor Script Commands 13-67


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

tax

Python oModule.PasteTraces ("XY Plot1")


Example

VB Syntax PasteTraces "<plotName>"


VB Example oModule.PasteTraces "XY Plot1"

Release Data
Releases all cached data. After this function is called, all subsequent function calls to the object will
fail.

UI Access NA
Parameters NA
Return Value NA

Python Syn- ReleaseData()


tax

Python oModule.ReleaseData()
Example

VB Syntax ReleaseData()
VB Example oModule.ReleaseData()

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

Reporter Editor Script Commands 13-68


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python RenameReport (<OldReportName>, <NewReportName>)


Syntax

Python oModule.RenameReport ("XY Plot1", "Reflection")


Example

VB Syntax RenameReport <OldReportName>, <NewReportName>


VB oModule.RenameReport "XY Plot1", "Reflection"
Example

RenameTrace
To rename a trace in a plot

UI Access NA

Name Type Description


<plotName> String Name of plot.
Parameters
<traceID> String Name of Trace
<newName> String New trace name.

Return Value None

Python Syn- RenameTrace ("<plotName>" "<traceID>" "<newName>")


tax

Python
oModule.RenameTrace ("XY Plot1",
Example "dB(S(WavePort1,WavePort1))1",_ "Port1dbS")

VB Syntax RenameTrace "<plotName>" "<traceID>" "<newName>"

VB
oModule.RenameTrace "XY Plot1",
Example "dB(S(WavePort1,WavePort1))1",_ "Port1dbS"

An example related to Q3D Extractor is as follows:


VB Example: oModule.RenameTrace "XY Plot1", "ACR(trace:src1, trace:src1)", "TraceRes"

ResetPlotSettings
Resets plot settings to defaults.

Reporter Editor Script Commands 13-69


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Command: Right-click on plot Edit>Reset Plot Settings


Syntax: ResetPlotSettings("PlotName")
Return Value: None
Parameters: <PlotName>
Type: <string>
Name of plot.
VB Example:
Set oModule = oDesign.GetModule("ReportSetup")
oModule.ResetPlotSettings "Differential S-parameters"

Python Syn- ResetPlotSettings( "<PlotName>")


tax

Python oModule = oDesign.GetModule("ReportSetup")


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
<Plot Name> String Name of plot to use for plot defaults.

Return Value A new report

Python SavePlotSettingsAsDefault ("<PlotName>")


Syntax

Python oModule.SavePlotSettingsAsDefault ("XY Plot1")


Example

VB Syntax SavePlotSettingsAsDefault "<PlotName>"


VB oModule.SavePlotSettingsAsDefault "XY Plot 1"
Example

Reporter Editor Script Commands 13-70


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2017.1.0
' 13:53:30 Feb 10, 2017
' ----------------------------------------------
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("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
Set oModule = oDesign.GetModule("ReportSetup")
oModule.SavePlotSettingsAsDefault "XY Plot 1"

UpdateTraces
Update the traces in a report for which traces are not automatically updated by the Report Traces
dialog, Update Report, Real Time selection.

UI Access Report dialog, Apply Traces button

Name Type Description


<ReportName> String Name of Report.
<SolutionName> String Name of the solution as lis-
ted in the Modify Report
dialog box.
Parameters For example: "Setup1
: Last Adaptive"
<ContextArray> Array of Context for which the expression is
Strings being evaluated. This can be an
empty string if there is no context.
<Domain> Array Array("Domain:=",

Reporter Editor Script Commands 13-71


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<DomainType>)
<DomainType>
ex. "Sweep" or "Time"
<Context> Array Array("Context:=", <Geo-
metryType>)
<GeometryType>
ex. "Infinite Spheren", "Spheren",
"Polylinen"
<FamiliesArray> Array of Contains sweep defin-
strings itions for the report.
Array("<Vari-
ableName>:= ", <ValueAr-
ray>)
<ValueArray> Array Array("All") or Array
("Value1", "Value2",
..."Valuen")
examples of <Vari-
ableName>
"Freq", "Theta",
"Distance"
<ReportDataArray> Array of This array contains the
Strings report quantity and X, Y,
and (Z) axis definitions.
Array("X Component:=",
<VariableName>, "Y
Component:=", <Vari-
ableName> |
<ReportQuantityArray>)
<ReportQuant- Array ex. Array("dB(S(Port1, Port1))")
ityArray>
Array() Empty Denotes the end of the
Array UpdateTraces Command

Return None
Value

Python UpdateTraces ("<plotName>" ["<TraceDef>"] [])


Syntax

Python oModule.UpdateTraces("XY Plot 1", ["NEG1.VAL"], "TR4",

Reporter Editor Script Commands 13-72


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

[
"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,"100s","TH",False,"40",
"TS",False,"0ns","UF",False,_
"0","WT",False,"0","WW",False,"100"]
Exampl-
],
e
[
"Spectrum:=", ["All"]
],
[
"X Component:=", "Spectrum",
"Y Component:=", ["mag(NEG1.VAL)"]
], [])

oModule.UpdateTraces "XY Plot1", Array("dB(S


(WavePort1,WavePort1))"), _
"Setup1 : Sweep1", Array("Domain:=", "Time", "HoldTime:=",
1, _
"RiseTime:=", 0, "StepTime:=", 0, "Step:=", false, _
VB
Examp-
"WindowWidth:=", 1, "WindowType:=", 0, "Kaiser-
le Parameter:=",1, _
"MaximumTime:=", 0), Array("Time:=", Array("All")),_
Array("X Component:=", "Time",_
"Y Component:=", Array("dB(S(WavePort1,WavePort1))")),_
Array()

For Circuit, the Update command details are as follows:

Reporter Editor Script Commands 13-73


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Update the traces in a report for which traces are not automatically updated by the Report Traces
dialog, Update Report, Real Time selection.
Command: Report dialog, Apply Traces button
Syntax: UpdateTraces "<plotName>" Array("<TraceDef>") Array()
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.

<SolutionName>
Type: <string>
Name of the solution as listed in the Modify Report dialog box.
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>)
Context for the trace. For more information see SimValueContext.

<FamiliesArray>
Type: Array of strings
Contains sweep definitions for the report.
Array("<VariableName>:= ", <ValueArray>)

Reporter Editor Script Commands 13-74


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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))")
Array()
Type: Empty array.
Denotes the end of the UpdateTraces command.

VB Example:
Set oModule = oDesign.GetModule("ReportSetup")
oModule.UpdateTraces "XY Plot1", _ Array("dB(S
(WavePort1,WavePort1))"), _
"Setup1 : Sweep1", _
Array("Domain:=", "Sweep"), _
Array("Freq:=", Array("All")), _
Array("X Component:=", "Freq", _
"Y Component:=", Array("dB(S(WavePort1,WavePort1))")), _
Array()

VB Example:
oModule.UpdateTraces "XY Plot 1", Array("dB(S
(WavePort1,WavePort1))"), _

Reporter Editor Script Commands 13-75


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Setup1 : Sweep1", _
Array("Domain:=", "Time", "HoldTime:=", 1, _
"RiseTime:=", 0, "StepTime:=", 0, "Step:=", false, _
"WindowWidth:=", 1, _
"WindowType:=", 0, "KaiserParameter:=", 1, _
"MaximumTime:=", 0), _
Array("Time:=", Array("All")), _
Array("X Component:=", "Time", _
"Y Component:=", Array("dB(S(WavePort1,WavePort1))")), _
Array()

For Q3D Extractor, the command details are as follows:


Update the traces in a report for which traces are not automatically updated by the Report Traces
dialog box, Update Report, Real Time selection.
Command: Report dialog, Apply Traces button
Syntax: UpdateTraces "<plotName>" Array("<TraceDef>") Array()
Return Value:
Parameters: <ReportName>
Type: <string>
Name of Report.
<SolutionName>
Type: <string>
Name of the solution as listed in the Modify Report dialog box.
For example: "Setup1 : Last Adaptive"
<ContextArray>
Type: Array of strings
Context for which the expression is being evaluated. This can be an empty string if there
is no context.
Array("Context:=", <DomainType>)
<DomainType>
ex. "Original" or "RM1"

Reporter Editor Script Commands 13-76


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("Context:=", <GeometryType>)
<GeometryType>
ex. "Spheren", "Polylinen"
<FamiliesArray>
Type: Array of strings
Contains sweep definitions for the report.
Array("<VariableName>:= ", <ValueArray>)
<ValueArray>
Array("All") or Array("Value1", "Value2", ..."Valuen")
examples of <VariableName>
"Freq"
<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("ACR(trace:src1, trace:src1)")
Array()
Type: Empty array.
Denotes the end of the UpdateTraces command.
VB Example: Set oModule = oDesign.GetModule("ReportSetup")
oModule.UpdateTraces "XY Plot1", _ Array("ACR(trace:src1,
trace:src1)"), _ "Setup1 : Sweep1", _
Array("Context:=", "Original"), _
Array("Freq:=", Array("All")), _
Array("X Component:=", "Freq", _
"Y Component:=", Array("ACR(trace:src1, trace:src1)"), _
Array()

Reporter Editor Script Commands 13-77


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

UpdateTracesContextandSweeps
Use this command to edit 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.
Array(<traceIDs>) String Name of Trace
<traceID>
<SolutionName> String Name of the solution as listed in the
Modify Report dialog box.
Parameters For example: "Setup1 : Last
Adaptive"
< ContextArray> String Context for which the expression is
being evaluated. This can be an empty
string if there is no context.
ex. "Sweep" or "Time"
Array<pointSet> String Point set for the selected traces, for example,
X and Y values for the plot.

Return Value None

Python UpdateTracesContextandSweeps()
Syntax

oModule.UpdateTracesContextAndSweeps_
("Active S Parameter Quick Report",_
["dB(ActiveS(Port1:1))", "dB(ActiveS(Port2:1))"],_
"Setup1 : Sweep1", [], _
["Freq:=", _
Python
Example ["9GHz", "9.05GHz", "9.1GHz",
"9.15GHz", "9.2GHz", _
"9.25GHz", "9.3GHz", "9.35GHz", _
"9.4GHz", "9.45GHz", "9.5GHz",
"9.55GHz", _

Reporter Editor Script Commands 13-78


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"9.6GHz", "9.65GHz", "9.7GHz",_


"9.75GHz", "9.8GHz", "9.85GHz",
"9.9GHz", "9.95GHz", "10GHz"],_
"off-
set:=",["All"]])

VB Syntax UpdateTracesContextandSweeps
oModule.UpdateTracesContextAndSweeps_
"Active S Parameter Quick Report",_
Array( _
"dB(ActiveS(Port1:1))", "dB(ActiveS(Port2:1))"),_
"Setup1 : Sweep1", Array(), _
Array("Freq:=", _
Array( _
"9GHz", "9.05GHz", "9.1GHz",
VB
Example "9.15GHz", "9.2GHz", _
"9.25GHz", "9.3GHz", "9.35GHz", _
"9.4GHz", "9.45GHz", "9.5GHz",
"9.55GHz", _
"9.6GHz", "9.65GHz", "9.7GHz",_
"9.75GHz", "9.8GHz", "9.85GHz",
"9.9GHz", "9.95GHz", "10GHz"),_

"off-
set:=", Array("All"))

An example related to Q3D Extractor is as follows:


VB Example: Set oProject = oDesktop.SetActiveProject("Via")
Set oDesign = oProject.SetActiveDesign("ViaModel")
Set oModule = oDesign.GetModule("ReportSetup")

Reporter Editor Script Commands 13-79


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oModule.UpdateTracesContextAndSweeps _
"C Matrix Quick Report", _
Array( _
"C(trace, trace)", "C(gnd, gnd)"), _
"Setup1 : Sweep1", Array ("Context:=", "Original")
Array("Freq:=", _
Array("All"))

UpdateAllReports
Updates all reports in the Results branch in the project tree.

UI Access Twin Builder>Results>Update All Reports

Name Type Description


Parameters
None

Return Value None

Python Syn- UpdateAllReports ()


tax

Python
oModule = oDesign.GetModule("ReportSetup")
Example oModule.UpdateAllReports()

VB Syntax UpdateAllReports ()

VB
Set oModule = oDesign.GetModule("ReportSetup")
Example oModule.UpdateAllReports

UpdateReports
Updates the specified reports in the Results branch in the project tree.
Update Report

UI Access NA

Name Type Description


Parameters
<plotname> String Name of plot

Reporter Editor Script Commands 13-80


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Return Value None

Python UpdateReports(["<plotname>"])
Syntax

Python oModule.UpdateReports (["XY Plot 1", "XY Plot 4"])


Example

VB Syn- UpdateReports Array("<plotname>")


tax

VB oModule.UpdateReports Array("XY Plot 1", "XY Plot 4")


Example

UnGroupPlotCurvesInGroup
From a Stacked Plot ungroup curves in a stack, that is, curves in that stack are ungrouped and are
shown in their own stacks.
Command: UnGroup Plot Curves in ...
Syntax: oModule.UngroupPlotCurvesInGroup("<report-name>", "<stack-name>")
Return Value: None
Parameters: <ReportName>
Type: <string>
Report name.
<"stack-name">
Type: <string>
Stack name.
Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2018.0.0
' 15:35:40 Nov 15, 2017
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop

Reporter Editor Script Commands 13-81


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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("CoaxBend14_1")
Set oDesign = oProject.SetActiveDesign("Transient")
Set oModule = oDesign.GetModule("ReportSetup")
oModule.GroupPlotCurvesByGroupingStrategy "Transient Plot 1", "Single"

Python oModule.MovePlotCurvesToGroup("<report-name>", ["<curve1-name>", "<curve2-


Syntax name>",...], "<stack-name>")
Python oModule.UngroupPlotCurvesInGroup("S Parameter Plot 3",
Exampl- "Stack 1"))
e

Reporter Editor Script Commands 13-82


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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>)

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
Script Commands for Creating and Modifying Boundaries in 2D Extractor
Script Commands for Creating and Modifying Boundaries in Q3D Extractor

Boundary and Excitation Module Script Commands 14-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

General Commands Recognized by the Bound-


ary/Excitations Module
AddAssignmentToBoundary
AutoIdentifyNets
AutoIdentifyPorts
AutoIdentifyTerminals
ChangeImpedanceMult
ConvertNPortCircuitElementToPorts
CreateNPortCircuitElement
DeleteAllBoundaries
DeleteAllExcitations
DeleteBoundaries
GetBoundaryAssignment
GetBoundaries
GetBoundariesOfType
GetExcitations
GetExcitationsOfType
GetNumBoundaries
GetNumBoundariesOfType
GetNumExcitations
GetNumExcitationsOfType
ReassignBoundary
RemoveAssignmentFromBoundary
RenameBoundary
ReprioritizeBoundaries
AddAssignmentToBoundary
Use: Adds a new geometry assignment to a boundary.
Command: Click Boundaries>Reassign or Excitations>Reassign
Syntax: AddAssignmentToBoundary Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,

Boundary and Excitation Module Script Commands 14-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Faces:=", <AssignmentFaces>)
Return Value: None
VB Example:
oModule.AddAssignmentTOBoundary Array("NAME:PerfE1",_
"Objects:=", Array("Box2", "Box3"),_
"Faces:=", Array(12, 11))
oModule.AddAssignmentToBoundary([ "NAME:SBR1", "Objects:=" , ["Fusel-
age"] ])
For Q3D Extractor, the command details are as follows:
Use: Specifies a new geometry assignment for a boundary.
Command: Q3D Extractor>Nets>Reassign>Net
Syntax: AddAssignmentToBoundary Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Return Value: None
VB Example: oModule.AddAssignmentToBoundary Array("NAME:Net1",_
"Objects:=", Array("Box2", "Box3"),_
"Objects:=", Array("Box3", "Box4"))

For 2D Extractor, the command details are as follows:


Use: Adds a new geometry assignment for a net/terminal.
Command: 2D Extractor>Conductor>Reassign
Syntax: AddAssignmentToBoundary Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Return Value: None
VB Example: oModule.ReassignBoundary Array("NAME:Rectangle2",
"Objects:=", Array("Rectangle3"))

Python Syn- AddAssignmentToBoundary("NAME:<BoundaryName>", "Faces:=" ,


tax [<FaceID>]])

Boundary and Excitation Module Script Commands 14-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oModule.AddAssignmentToBoundary ((
[
Python
"NAME:PerfE1",
Example
"Faces:=" , [12]
])

AutoIdentifyNets
Use: Automatically identifies nets.
Command: Q3D Extractor>Nets>Auto Identify Nets
Syntax: AutoIdentifyNets
Return Value: None
Command: oModule.AutoIdentifyNets

AutoIdentifyPorts
Use: Automatically assign ports and terminals in a terminal design.
Command: HFSS>Excitations>Assign>Wave Port|Lumped Port
Syntax: AutoIdentifyPorts <FaceIDArray> <IsWavePort>, <ReferenceConductorsArray>
<BaseNameforCreatedPorts> <UseConductorNamesAsBaseNameforTerminals>
Return Value: None.
Parameters: <FaceIDArray>
Array("NAME:Faces", <FaceID>, <FaceID>, ...)
<IsWavePort>
Type: Boolean
true = waveport, false = lumped port
<ReferenceConductorsArray>
Array("NAME:ReferenceConductors", <ConductorName>, <ConductorName>, ...)
<BaseNameforCreatedPorts>
Type: <string>
<empty string> = default name for the wave or lumped port, <string> = base name to
use for created ports
<UseConductorNamesAsBaseNameforTerminals>
Type: Boolean

Boundary and Excitation Module Script Commands 14-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

true = use conductor names, false = use port object name as base name

VB Example:
Set oModule = oDesign.GetModule("BoundarySetup"
oModule.AutoIdentifyPorts Array("NAME:Faces", 52), true, _ Array
("NAME:ReferenceConductors", "Conductor1") true

AutoIdentifyTerminals
Use: Automatically identify the terminals within the given ports.
Command: HFSS>Excitations>Assign>Auto Assign Terminals
Syntax: AutoIdentifyTerminals <ReferenceConductorsArray>, <PortNames> <UseCon-
ductorNamesAsBaseNameforTerminals>
Return Value: None
Parameters: <ReferenceConductors>
Array("NAME:ReferenceConductors", <ConductorName>, <ConductorName>, ...)
<portNames>
List of names.
<UseConductorNamesAsBaseNameforTerminals>
Type: Boolean
true = use conductor names, false = use port object name as base name
VB Example:
Set oModule = oDesign.GetModule("BoundarySetup"
oModule.AutoIdentifyTerminals Array("NAME:ReferenceConductors", "Con-
ductor1"), "WavePort1" true

ChangeImpedanceMult
Use: Modifies the port impedance multiplier.
Command: HFSS>Excitations>Edit Impedance Mult
Syntax: ChangeImpedanceMult <MultVal>
Return Value: None
Parameters: <MultVal>

Boundary and Excitation Module Script Commands 14-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Type: <value>
New value for the impedance multiplier.
VB Example:
oModule.ChangeImpedanceMult 0.5

ConvertNportCircuitElementsToPorts
Use: Converts one or more HFSS Circuit Element to one or more ports.
Command: Right-click on element and select Convert to HFSS Ports
Syntax: ConvertNportCircuitElementToHFSSPorts Array("<name> ")
Return Value: None
VB Example:
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.ConvertNportCircuitElementToPorts Array("Nport1")
oModule.ConvertNportCircuitElementToPorts Array("Nport2")

Python Syn- ConvertNportCircuitElementToPorts(<NportID>)


tax

oModule = oDesign.GetModule("BoundarySetup")
Python
oModule.ConvertNportCircuitElementToPorts(["Nport1"])
Example
oModule.ConvertNportCircuitElementToPorts(["Nport2"])

CreateNportCircuitElements
Use: Creates an HFSS Circuit Element from one or more ports..
Command: Right-click Circuit Elements>Create Single Port Model... or
Circuit Elements>Create Multi-Terminal Model...
Syntax: CreateNportCircuitElement("NAME:<Nportn>", "Definition:=" , "Model", [ "NAME:Assign-
ments", ["NAME: <ID>", Assign:=" , <ID>,] [...] ]
Return Value: None
VB Example:
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.CreateNportCircuitElement Array("NAME:Nport1", "Defin-
ition:=", "Model", Array("NAME:Assignments", Array("NAME:Model",
"Assign:=", "1")))

Boundary and Excitation Module Script Commands 14-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oModule.CreateNportCircuitElement Array("NAME:Nport2", "Defin-


ition:=", "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")))

Python Syn- ReassignBoundary("NAME:<BoundaryName>", "Faces:=" ,[<FaceID>]])


tax

oModule.CreateNportCircuitElement(
[
"NAME:Nport1",
"Definition:=" , "Model",
[
"NAME:Assignments",
[
"NAME:Model",
"Assign:=" , "1"
]
]
Python
])
Example
oModule.CreateNportCircuitElement(
[
"NAME:Nport2",
"Definition:=" , "Model2",
[
"NAME:Assignments",
[
"NAME:P01__NET179__T1",
"Assign:=" , "2"
],
[

Boundary and Excitation Module Script Commands 14-7


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"NAME:P02__NET178__T1",
"Assign:=" , "3"
],
[
"NAME:P03__NET178__T1",
"Assign:=" , "4"
],
[
"NAME:P04__NET179__T1",
"Assign:=" , "5"
]
]
])

DeleteAllBoundaries
Use: Deletes all boundaries.
Command: [product]>Boundaries>Delete All
Syntax: DeleteAllBoundaries
Return Value: None
VB Example: oModule.DeleteAllBoundaries
For Q3D Extractor or 2D Extractor, the DeleteAllBoundaries command has the following
details.
Use: Delete all the boundaries
Command: Q3D Extractor>Boundary>Delete All or 2D Extractor>Boundary>Delete All
Syntax: DeleteAllBoundaries
Return Value: None
VB Example: oModule.DeleteAllBoundaries

DeleteAllExcitations
Use: Deletes all excitations.
Command: [product]>Excitations>Delete All

Boundary and Excitation Module Script Commands 14-8


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syntax: DeleteAllExcitations
Return Value: None
VB Example:
oModule.DeleteAllExcitations

For Q3D Extractor or 2D Extractor, the DeleteAllExcitations command has the following
details.
Use: Deletes all excitations.
Command: Q3D Extractor>Nets>Delete All or 2D Extractor>Conductor>Delete All
Syntax: DeleteAllExcitations
Return Value: None
VB Example: oModule.DeleteAllExcitations

DeleteBoundaries
Use: Deletes the specified boundaries and excitations.
Command: Delete command in the List dialog box. Click [product]>List to open the List dialog
box.
Syntax: DeleteBoundaries <NameArray>
Return Value: None
Parameters: <NameArray>
Type: Array of strings
An array of boundary names.
VB Example:
oModule.DeleteBoundaries Array("PerfE1", "WavePort1")
For Q3D Extractor, the DeleteBoundaries command has the following details.
Use: Deletes the specified boundaries and excitations.
Command: Delete command in the List dialog box. Click Q3D Extractor or 2D Extractor>List
to open the List dialog box. Or, use the 2D Extractor>Conductor>Delete command.
Syntax: DeleteBoundaries <NameArray>
Parameters: <NameArray>
Type: Array of strings

Boundary and Excitation Module Script Commands 14-9


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

An array of boundary names.


VB Example: oModule.DeleteBoundaries Array("Net1", "Source1")

GetBoundaryAssignment
Use: Gets a list of face IDs associated with the given boundary or excitation assignment.
Syntax: GetBoundaryAssignment(<BoundaryName>)
Return Value: Returns integer array of face IDs.
Parameters: <BoundaryName>
Type: <string>
Previously defined boundary or excitation name.
VB Example:
list = oModule.GetBoundaryAssignment("Rad1")

GetBoundaries
Use: Gets boundary names for a project.
Syntax: GetBoundaries()
Return Value: Array of boundary names.
Parameters: None
VB Example:
bndinfo_array = oModule.GetBoundaries()

GetBoundariesOfType
Use: Gets boundary names of the given type.
Syntax: GetBoundariesOfType(<BoundaryType>)
Return Value: Array of boundary names of the given type.
Parameters: <BoundaryType>
Type:<string>
Name of legal boundary type.
For example: "Radiation".
VB Example:
bndname_array = oModule.GetBoundariesOfType("Perfect E")

Boundary and Excitation Module Script Commands 14-10


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetDefaultBaseName
Use: Gets the default base name for boundaries for a project.
Syntax: GetDefaultBaseName <BoundaryType>
Return Value: String of boundary default base name.
Parameters: <BoundaryType>
Type:<string>
Name of legal boundary type.
For example: "Radiation".
VB Example:
bnddefault_BaseName = oModule.GetDefaultBaseName "Radiation"

GetExcitations
Gets excitation port and terminal names for a model.
Syntax: GetExcitations()
Return Value: Pairs of strings. The first is the name of the excitation (e.g. "port1:1") and the second
is its type ("Wave Port")
Parameters: None
VB Example:
excite_name_array = oModule.GetExcitations()

For Q3D Extractor the command details are similar:


Return a listing of excitations
Command: none
Syntax: GetExcitations
Return Value: Variant array, excitation name paired with excitation type.
VB Example: oModule.GetExcitations

GetExcitationsOfType
Gets excitation names of the given type.
Syntax: GetExcitationsOfType(<ExcitationType>)

Boundary and Excitation Module Script Commands 14-11


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Return Value: Array of excitation names of the given type.


Parameters: <ExcitationType>
Type: <string>
Name of legal excitation type.
For example: "Plane Incident Wave.
VB Example:
excite_name_array = _
oModule.GetExcitationsOfType("Wave Port")

GetNumBoundaries GetNumBoundaries
Gets the number of boundaries in a design.
Syntax: GetNumBoundaries()
Return Value: Integer count
Parameters: None
VB Example:
numbound = oModule.GetNumBoundaries()

GetNumBoundariesOfType
Gets the number of boundaries of the given type.
Syntax: GetNumBoundariesOfType(<BoundaryType>)
Return Value: Integer count
Parameters: <BoundaryType>
Type: <string>
VB Example:
numbound = oModule.GetNumBoundariesOfType("Perfect E")

GetNumExcitations
Gets the number of excitations in a design, including all defined modes and terminals of ports.
Syntax: GetNumExcitations()
Return Value: Integer count

Boundary and Excitation Module Script Commands 14-12


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Parameters: None
VB Example:
numexcite = oModule.GetNumExcitations()

GetNumExcitationsOfType
Gets the number of excitations of the given type, including all defined modes and terminals of ports.
Syntax: GetNumExcitationsOfType(<ExcitationType>)
Return Value: Integer count
Parameters: <ExcitationType>
Type: <string>
VB Example:
numexcite = oModule.GetNumExcitationsOfType("Voltage")
GetPortExcitationCounts
Gets all port names and corresponding number of modes/terminals for each port excitation.
Syntax: GetPortExcitationCounts()
Return Value: Array of port names (Type: <string>) and corresponding mode/terminal counts
(Type: <integer>).
Parameters: None
VB Example:
portinfo = oModule.GetPortExcitationCounts()

ReassignBoundary
Use: Specifies a new geometry assignment for a boundary.
Command: Click Boundaries>Reassign or Excitations>Reassign
Syntax: ReassignBoundary Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Return Value: None
VB Example:
oModule.ReassignBoundary Array("NAME:PerfE1",_

Boundary and Excitation Module Script Commands 14-13


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Objects:=", Array("Box2", "Box3"),_


"Faces:=", Array(12, 11))
oModule.ReassignBoundary([ "NAME:SBR1", "Objects:=" , ["Fuselage"]
])
For Q3D Extractor, the command details are as follows:
Use: Specifies a new geometry assignment for a net/terminal.
Command: Q3D Extractor>Nets>Reassign>Net
Syntax: ReassignBoundary Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Return Value: None
VB Example: oModule.ReassignBoundary Array("NAME:Net1",_
"Objects:=", Array("Box2", "Box3"),_
"Objects:=", Array("Box3", "Box4"))

For 2D Extractor, the command details are as follows:


Use: Specifies a new geometry assignment for a net/terminal.
Command: 2D Extractor>Conductor>Reassign
Syntax: ReassignBoundary Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Return Value: None
VB Example: oModule.ReassignBoundary Array("NAME:Rectangle2",
"Objects:=", Array("Rectangle3"))

Python Syn- ReassignBoundary("NAME:<BoundaryName>", "Faces:=" ,[<FaceID>]])


tax

oModule.ReassignBoundary ((

Python [
Example "NAME:PerfE1",
"Faces:=" , [12]

Boundary and Excitation Module Script Commands 14-14


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

])

RemoveAssignmentFromBoundary
Use: Removes a geometry assignment from a boundary.
Command: Click Boundaries>Reassign or Excitations>Reassign
Syntax: RemoveAssignmentFromBoundary Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Return Value: None
VB Example:
oModule.RemoveAssignmentFromBoundary Array("NAME:PerfE1",_
"Objects:=", Array("Box2", "Box3"),_
"Faces:=", Array(12, 11))
oModule.RemoveAssignmentFromBoundary([ "NAME:SBR1", "Objects:=" ,
["Fuselage"] ])
For Q3D Extractor, the command details are as follows:
Use: Removes a geometry assignment from a boundary.
Command: Q3D Extractor>Nets>Reassign>Net
Syntax: RemoveAssignmentFromBoundary Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Return Value: None
VB Example: oModule.RemoveAssignmentFromBoundary Array("NAME:Net1",_
"Objects:=", Array("Box2", "Box3"),_
"Objects:=", Array("Box3", "Box4"))

For 2D Extractor, the command details are as follows:


Use: Removes a geometry assignment from a net/terminal.
Command: 2D Extractor>Conductor>Reassign
Syntax: RemoveAssignmentFromBoundary Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,

Boundary and Excitation Module Script Commands 14-15


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Faces:=", <AssignmentFaces>)
Return Value: None
VB Example: oModule.RemoveAssignmentFromBoundary Array("NAME:Rect-
angle2",
"Objects:=", Array("Rectangle3"))

Python Syn- RemoveAssignmentFromBoundary("NAME:<BoundaryName>", "Faces:=" ,


tax [<FaceID>]])
oModule.RemoveAssignmentFromBoundary ((
[
Python
"NAME:PerfE1",
Example
"Faces:=" , [12]
])

RenameBoundary
Use: Renames a boundary or excitation.
Command: Right-click a boundary in the project tree, and then click Rename on the shortcut
menu.
Syntax: RenameBoundary <OldName>, <NewName>
Return Value: None
Parameters: <OldName>
Type: <string>

<NewName>
Type: <string>
VB Example:
oModule.RenameBoundary "PerfE1" "PerfE"
For Q3D Extractor, the RenameBoundary command details are as follows:
Use: Renames an excitation.
Command: Right-click a net/terminal in the project tree, and then click Rename on the shortcut
menu.
Syntax: RenameBoundary <OldName>, <NewName>
Return Value: None

Boundary and Excitation Module Script Commands 14-16


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Parameters: <OldName>
Type: <string>
<NewName>
Type: <string>
VB Example: oModule.RenameBoundary "Net1" "Net2"
VB Example: oModule.RenameBoundary "Rectangle4" "VCC"
ReprioritizeBoundaries
Use: Specifies the order in which the boundaries and excitations are recognized by the solver. The
first boundary in the list has the highest priority. Note: this command is only valid if all defined bound-
aries and excitations appear in the list. All ports must be listed before any other boundary type.
Command: HFSS>Boundaries>Reprioritize
Syntax: ReprioritizeBoundaries <NewOrderArray>
Return Value: None
Parameters: <NewOrderArray>
Array("NAME:NewOrder", <BoundName>, <BoundName>, ...)
VB Example:
oModule.ReprioritizeBoundaries Array("NAME:NewOrder", _
"Imped1", "PerfE1", "PerfH1")

SetDefaultBaseName
Use: Sets the default base name for boundaries for a project.
Syntax: SetDefaultBaseName <BoundaryType>, <DefaultName>
Return Value: String of boundary default base name.
Parameters: <BoundaryType>
Type:<string>
Name of legal boundary type.
For example: "Radiation".
<NewName>
Type: <string>
VB Example:
bnddefault_BaseName = oModule.SetDefaultBaseName "Radiation",_

Boundary and Excitation Module Script Commands 14-17


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"RadBnd"

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 following commands, all named data can be included or excluded
as desired and may appear in any order.
AssignCircuitPort [HFSS]
AssignCurrent
AssignDielectricCavity
AssignFiniteCond
AssignFloquet
AssignHalfSpace
AssignHybridRegion
AssignIERegion
AssignImpedance
AssignIncidentWave
AssignLayeredImp
AssignLinkedRegion
AssignLumpedPort
AssignLumpedRLC
AssignMagneticBias
AssignMaster
AssignPerfectE
AssignPerfectH
AssignRadiation
AssignRadiation
AssignScreeningImpedance
AssignSymmetry
AssignTerminal
AssignVoltage
AssignWavePort

Boundary and Excitation Module Script Commands 14-18


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

CircuitPortToLumpedPort
EditCircuitPort [HFSS]
EditCurrent
EditDiffPairs
EditFiniteCond
EditHalfSpace
EditHybridRegion
EditImpedance
EditIncidentWave
EditLayeredImpedance
EditMaster
EditPerfectE
EditPerfectH
EditLumpedPort
EditLumpedRLC
EditMagneticBias
EditNPortCircuitElement
EditRadiation
EditSlave
EditSymmetry
EditTerminal
EditVoltage
EditWavePort
LumpedPortToCircuitPort
SetHybridRegionCoupledGroup
SetTerminalReferenceImpedances
SwapCircuitPortAssignment
UnassignIERegions

AssignCircuitPort
Use: Assigns a circuit port for a driven terminal or driven modal design in HFSS.

Boundary and Excitation Module Script Commands 14-19


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Command: HFSS>Excitations>Assign>Circuit Port...


Syntax: AssignCircuitPort <parameters>
Return Value: None
Parameters: <CircuitPortArray>
Array("NAME:<PortName>",
"Edges:=", [n1, n2],
"Impedance:=", "valueohm",
DoDeembed:=", <boolean>
"RenormalizeAllTerminals:=", <boolean>
"TerminalIDLit:=", Array()
)

VB Example:
oModule.AssignCircuitPort Array("NAME:1",
"Edges:=", Array(50, 56), _
"Impedance:=", "50ohm", _
"DoDeembed:=", true, _
"RenormalizeAllTerminals:=", true,_
"TerminalIDList:=", Array())

Python Syn- AssignCircuitPort (<parameters>)


tax

oModule.AssignCircuitPort(
[
"NAME:1",

Python "Edges:=" , [50,56],


Example "Impedance:=" , "50ohm",
"DoDeembed:=" , False,
"RenormalizeAllTerminals:=", True,
"TerminalIDList:=" , []

Boundary and Excitation Module Script Commands 14-20


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

])

AssignCurrent
Use: Creates a current source.
Command: [product]>Excitations>Assign>Current
Syntax: AssignCurrent <CurrentArray>
Return Value: None
Parameters: <CurrentArray>
Array("NAME:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Current:=", <value>,
<DirectionArray>,
"Faces:=", <AssignmentFaces>)

<DirectionArray>
Array("NAME:Direction",
"Start:=", <LineEndPoint>,
"End:=", <LineEndPoint>)
Example:
oModule.AssignCurrent Array("NAME:Current1",_
"Current:=", "1000mA",_
Array("NAME:Direction",_
"Start:=", Array(-0.4, 0.4, -1.6),_
"End:=", Array(-0.4, 0.4, 0)), _
"Faces:=", Array(12))

AssignDielectricCavity
Use: Assign a Hybrid Region as a Dielectric Cavity.
Command: HFSS>Hybrid>Assign Hybrid>Dielectric Cavity
Syntax: AssignDielectricCavity Array(<name><"geometryName">)
Return Value: None
Parameters: <GeometryName>

Boundary and Excitation Module Script Commands 14-21


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Type: String
Name of the FEBI Hybrid Region.
<GeometryName>
Type: String
Name of the geometry assigned as Dielectric Cavity Region.
<"geometryName">
VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2017.0.0
' 14:50:08 Aug 12, 2016
' ----------------------------------------------
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("Project17")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oModule.AssignDielectricCavity Array("NAME:Cavity1", "Objects:=",
Array("Cylinder1"))

AssignFEBI
Assign a Hybrid Region as a FEBI.
Command: HFSS>Hybrid>Assign Hybrid>FEBI
Syntax: AssignFEBI Array(<name><"geometryName">)
Return Value: None

Boundary and Excitation Module Script Commands 14-22


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Parameters: <name>
Type: String
Name of the FEBI Hybrid Region.
<name>
Type: String
Name of the geometry assigned as FEBI Hybrid Region.
<"geometryName">
VB Example:
' Script Recorded by ANSYS Electronics Desktop Version 2017.0.0
' 14:53:22 Aug 12, 2016
' ----------------------------------------------
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("Project17")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignFEBI Array("NAME:FE-BI1", "Objects:=", Array("Regu-
larPolyhedron1"))

AssignFiniteCond
Use: Assign a single finite conductivity boundary on selected edges.
Command: 2D Extractor>Boundary>Assign>Finite Conductivity
Syntax: AssignFiniteCond Array("NAME:<Name>", "Edges:=", Array(<edge ids>), <Fin-
iteCondParameters>)
Return Value: none

Boundary and Excitation Module Script Commands 14-23


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Parameters: <Name>
Type:<String>
Name of the boundary
<edge ids>
Type:<integer list>
List of edge ids, separated by comma.
<FiniteCondParameters>
Parameters:
"Roughness:=", "<Roughness>", "UseCoating:=", <UseCoating>, "Lay-
erThickness:=", "<Thickness>", "UseMaterial:=", <UseMaterial>,
"Material:=", "<MaterialName>"
<Roughness>
Type: <String>
Value: double with units of length
<UseCoating>
Type: <Boolean>
Value: true or false
<Thickness>
Type: String
Value: double with units of length
<UseMaterial>
Type:<Boolean>
Value: true or false
<MaterialName>
Type: String
Value: specify material name for coating.
<Radius>
Type: String
Value: double with units of length.
<Ratio>
Type: String

Boundary and Excitation Module Script Commands 14-24


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Value: double.

VB Example: This example is for the Hammerstad-Jensen surface rough-


ness model.

oModule.AssignFiniteCond Array("NAME:FiniteCond1", "Edges:=", Array


(7, 9), "Roughness:=", _ "2um", "UseCoating:=", true, "Lay-
erThickness:=", "1.2um", "UseMaterial:=", _ true, "Material:=", "Cop-
per")

VB Example: This example is for the Hurray surface roughness model.

oModule.AssignFiniteCond Array("NAME:FiniteCond1", "Edges:=", Array


(7), "UseCoating:=", _ false, "Radius:=", "0.5um", "Ratio:=", "2.9")

AssignFloquet
Create a Floquet port.
Command: HFSS>Excitations>Assign>Floquet
Syntax: AssignFloquetPort <FloquetPortArray>
Return Value: None.
Parameters: <FloquetPortArray>
Array("NAME:<BoundName>",
"Faces:=", <FaceIDArray>,
<ModesArray>,
"NumModes:=", <Int>,
"RenormalizeAllTerminals:=", <Boolean>,
"DoDeembed:=", <Boolean>,
Array("NAME:Modes", Array("NAME:Mode1",
"ModeNum:=", <Int>,
"UseIntLine:=", <Boolean>),
Array("NAME:Mode2", "ModeNum:=", <Int>,
"UseIntLine:=", <Boolean>)),
"ShowReporterFilter:=", <Boolean>,

Boundary and Excitation Module Script Commands 14-25


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"UseScanAngles:=", <Boolean>,
"Phi:=", "<numdeg>",
"Theta:=", "<numdeg>",
Array("NAME:LatticeAVector",
"Start:=", Array("<num><units>", "num><units>", "<num><units>"),
"End:=", Array("<num><units>", "num><units>", "<num><units>")),
Array("NAME:LatticeBVector",
"Start:=", Array("<num><units>", "num><units>", "<num><units>"),
"End:=", Array("<num><units>", "num><units>", "<num><units>")),
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"),
Array("NAME:ModesList",
Array("NAME:Mode",
"ModeNumber:=", <ModeID>,
"IndexM:=", <Index>,
"IndexN:=", <Index>,
"KC2:=", <value>,
"PropagationState:=", "Propagating",
"Attenuation:=", 0,
"PolarizationState:=", "TE",
"AffectsRefinement:=", <Boolean>),
Array("NAME:Mode",
"ModeNumber:=", <ModeID>,

Boundary and Excitation Module Script Commands 14-26


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"IndexM:=", <Index>,
"IndexN:=", <Index>,
"KC2:=", <value>,
"PropagationState:=", "<Propagating>",
"Attenuation:=", <value>,
"PolarizationState:=", "<TE or TM>",
"AffectsRefinement:=", <Boolean>)))

Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 13.0.0
' 1:54:11 PM Jun 15, 2010
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project44")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignFloquetPort Array("NAME:FloquetPort1",
"Faces:=", Array(7),
"NumModes:=", 2,
"RenormalizeAllTerminals:=", true,
"DoDeembed:=", false,

Boundary and Excitation Module Script Commands 14-27


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:Modes", Array("NAME:Mode1", "ModeNum:=", 1,


"UseIntLine:=", false),
Array("NAME:Mode2", "ModeNum:=", 2, "UseIntLine:=", false)),
"ShowReporterFilter:=", false,
"UseScanAngles:=", true, "Phi:=", "0deg", "Theta:=", "0deg",
Array("NAME:LatticeAVector", "Start:=", Array("0mm", "0mm",
"0.8mm"), "End:=", Array( "0mm", "0.6mm", "0.8mm")),
Array("NAME:LatticeBVector", "Start:=", Array("0mm", "0mm",
"0.8mm"), "End:=", Array("0.8mm", "0mm", "0.8mm")),
Array("NAME:ModesCalculator", "Frequency:=", "1GHz",
"FrequencyChanged:=", false,
"PhiStart:=", "0deg", "PhiStop:=", "0deg", "PhiStep:=", "0deg",
"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)))

AssignHalfSpace
Use: Assign a Half Space boundary, dividing the background material at a specified Z axis point.
You also assign a material, typically to the lower half.
Command: Assign Half Space

Boundary and Excitation Module Script Commands 14-28


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syntax: AssignHalfSpace Array("NAME:HalfSpacen", "ZLocation:=", "<intUnits>", "Material:=",


"<string>")
Return Value: None
Parameters: "NAME:<stringN>"
String
ZLocation
Z value and Units
Materials
<string> defining the material.
VB Example:
oModule.AssignHalfSpace Array("NAME:HalfSpace1", "ZLocation:=",
"2mm", "Material:=", "water_sea")

Assign Hybrid Region


Assign a Hybrid Region to a conductor, one of IE, PO, or SBR.
Command: Assign Hybrid Region
Syntax: AssignHybridRegion Array("Name:<Hybridn>", "Objects:=", Array("<geometryName>"),
"Type:=, "<HybridRegionType>", "IsLinkedRegion:=" <boolean>)
Return Value: None
Parameters: <Name>
Type: String
Name of the Hybrid Region.
<GeometryName>
Type: String
Name of the geometry assigned as Hybrid Region.
<HybridRegionType>
Type: String
One of "IE", "PO" or "SBR"
<boolean>
true, or false (default)
VB Example:
' ----------------------------------------------

Boundary and Excitation Module Script Commands 14-29


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

' Script Recorded by ANSYS Electronics Desktop Version 2017.0.0


' 14:43:40 Aug 12, 2016
' ----------------------------------------------
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("Project17")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignHybridRegion Array("NAME:Hybrid1", "Objects:=", Array
("RegularPolyhedron1"), "Type:=", "IE", _
"IsLinkedRegion:=", false)

AssignIERegion
Assign an IE Region to a conductor contained within a FEBI Radiation boundary.
Command: Assign IE Region
Syntax: AssignIERegion <"geometryName">
Return Value: None
Parameters: <GeometryName>
Type: String
Name of the geometry assigned as an IE Region.
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 2:26:27 PM Mar 07, 2011

Boundary and Excitation Module Script Commands 14-30


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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("Project58")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignIERegion "Box1"

AssignImpedance
Use: Creates an impedance boundary for an HFSS design.
Command: [product]>Boundaries>Assign>Impedance
Syntax: AssignImpedance <ImpedanceArray>
Return Value: None
Parameters: <ImpedanceArray>
Array("NAME:<BoundName>",
"Resistance:=", <value>,
"Reactance:=", <value>,
"InfGroundPlane:=", <bool>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
VB Example:
oModule.AssignImpedance Array("NAME:Imped1",_
"Resistance:=", "50",_

Boundary and Excitation Module Script Commands 14-31


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Reactance:=", "50",_
"InfGroundPlane:=", false,_
"Faces:=", Array(12))

AssignIncidentWave
Use: Creates an incident wave excitation.
Command: HFSS>Excitations>Assign>IncidentWave
Syntax: AssignIncidentWave <IncidentWaveArray>
Return Value: None
Parameters: <IncidentWaveArray>
Array("NAME:<BoundName>",
"IsCartesian:=",<bool>
"EoX:=", <value>,
"EoY:=", <value>,
"EoZ:=", <value>,
"kX:=", <value>,
"kY:=", <value>,
"kZ:=", <value>
"PhiStart:=",<value>,
"PhiStop:=", <value>,
"PhiPoints:=", <int>,
"ThetaStart:=", <value>,
"ThetaStop:=", <value>,
"ThetaPoints:=", <int>,
"EoPhi:=", <value>,
"EoTheta:=", <value>)

IsCartesian
If true, provide the EoX, EoY, EoZ, kX, kY, kZ parameters.

Boundary and Excitation Module Script Commands 14-32


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

If false, provide the PhiStart, PhiStop, PhiPoints, ThetaStart, ThetStop, ThetaPoints,


EoPhi, EoTheta parameters.
VB Example:
oModule.AssignIncidentWave Array("NAME:IncWave1",_
"IsCartesian:=", true,_
"EoX:=", "1", "EoY:=", "0", "EoZ:=", "0",_
"kX:=", "0", "kY:=", "0", "kZ:=", "1")
VB Example:
oModule.AssignIncidentWave Array("NAME:IncWave2",_
"IsCartesian:=", false,_
"PhiStart:=","0deg",_
"PhiStop:=", "90deg",_
"PhiPoints:=", 2,_
"ThetaStart:=", "0deg",_
"ThetaStop:=", "180deg",_
"ThetaPoints:=", 3, _
"EoPhi:=", "1", "EoTheta:=", "0")

AssignLayeredImp
Use: Creates a layered impedance boundary.
Command: HFSS>Boundaries>Assign>Layered Impedance
Syntax: AssignLayeredImp <LayeredImpArray>
Return Value: None
Parameters: <LayeredImpArray>
Array("NAME:<BoundName>",
"Frequency:=", <value>,
"Roughness:=", <value>,
"IsInternal:=", <bool>,
"IsTwoSided:=", <bool>,
"IsShellElement:=", <bool>,

Boundary and Excitation Module Script Commands 14-33


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<LayersArray>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)

<LayersArray>
Array("NAME:Layers",
<OneLayerArray>, <OneLayerArray>, ...)
<OneLayerArray>
Array("NAME:<LayerName>",
"LayerType:=", <LayerType>,
"Thickness:=",<value>,
"Material:=", <string>)
<LayerName>
Type: <string>
Specifies the layer number, such as "Layer1" or "Layer2"
<LayerType>
Type: <string>
Should be specified for the last layer only.
Possible values: "Infinite", "PerfectE", or "PerfectH"

Thickness
Thickness of the layer. Should be specified for all layers except the last layer.

Material
Material assigned on the layer. For the last layer, do not specify a material if the Lay-
erType is "PerfectE" or "PerfectH".
InfGroundPlane <boolean>
For HFSS designs, you can specify whether one layer is an infinite ground plane.
VB Example:
' ----------------------------------------------

Boundary and Excitation Module Script Commands 14-34


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

' Script Recorded by ANSYS Electronics Desktop Version 2016.0.0


' 10:55:39 Apr 28, 2015
' ----------------------------------------------
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("tune_coax_fed_patch")
Set oDesign = oProject.SetActiveDesign("HFSSDesign2")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignLayeredImp Array("NAME:Layered1",
"Objects:=", Array("Rectangle1"),
"Frequency:=", "0GHz",
"Roughness:=", "0um",
"IsTwoSided:=", true,
"IsShellElement:=", true,
Array("NAME:Layers", Array("NAME:Layer1",
"Thickness:=", "1um", "Material:=", "vacuum")),
"InfGroundPlane:=", false)

AssignLinkedRegion
Use: Assign a Hybrid Region as a Linked Region.
Command: HFSS>Hybrid>Assign Hybrid>Linked Region
Syntax: AssignLinkedRegion Array(<name><"geometryName">, Type:=, "IE", IsLinkedRegion:="
true))
Return Value: None
Parameters: <name>
Type: String

Boundary and Excitation Module Script Commands 14-35


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Name of the Linked Region.


<name>
Type: String
Name of the geometry assigned as a Linked Region.
<"geometryName">

VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2017.0.0
' 14:54:00 Aug 12, 2016
' ----------------------------------------------
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("Project17")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignLinkedRegion Array("NAME:Linked1", "Objects:=", Array(
_
"RegularPolyhedron1"), "Type:=", "IE", "IsLinkedRegion:=", true)

AssignLumpedPort
Creates a lumped port.
Command: HFSS>Excitations>Assign>Lumped Port
Syntax: AssignLumpedPort <LumpedPortArray>

Boundary and Excitation Module Script Commands 14-36


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Return Value: None


Parameters: <LumpedPortArray>
Array("NAME:<BoundName>",
"Faces:=", <FaceIDArray>,
"RenormalizeAllTerminals:=", <boolean>
"DoDeembed:="’ <boolean"
<ModesArray>,
"TerminalIDList:=", <TerminalsArray>,
"FullResistance:=", <value>,
"FullReactance:=", <value>,
)
Example:
oModule.AssignLumpedPort Array("NAME:LumpPort1",_
Array("NAME:Modes",_
"Resistance:=", "50Ohm",_
"Reactance:=","0Ohm",_
Array("NAME:Mode1",_
"ModeNum:=",1,_
"UseIntLine:=", true,_
Array("NAME:IntLine",_
"Start:=", Array(-0.4, 0.4, -1.6),_
"End:=", Array(-0.4, 0.4, 0)),_
"CharImp:=", "Zpv")),_
"Faces:=", Array(11))
Example:
oModule.AssignLumpedPort Array("NAME:LumpPort1", _
"Faces:=", Array(52), "TerminalIDList:=", Array(), _
"FullResistance:=", "50ohm", "FullReactance:=", "0ohm")
Example:
' ----------------------------------------------

Boundary and Excitation Module Script Commands 14-37


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

' Script Recorded by Ansoft HFSS Version 14.0.0


' 2:18:20 PM May 20, 2011
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("calib_modal_test")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignLumpedPort "lp2", Array("NAME:lp2",
"RenormalizeAllTerminals:=", true,
"DoDeembed:=", true,
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")

AssignLumpedRLC
Use: Creates a lumped RLC boundary.
Command: HFSS>Boundaries>Assign>Lumped RLC
Syntax: AssignLumpedRLC <LumpedRLCArray>
Return Value: None
Parameters: <LumpedRLCArray>

Boundary and Excitation Module Script Commands 14-38


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:<BoundName>",
"UseResist:=",<bool>,
"Resistance:=", <value>,
"UseInduct:=", <bool>,
"Inductance:=", <value>,
"UseCap:=", <bool>,
"Capacitance:=", <value>,
<CurrentLineArray>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)

<CurrentLineArray>
Array("NAME:CurrentLine", _
"Start:=", <LineEndPoint>,
"End:=", <LineEndPoint>)
VB Example:
oModule.AssignLumpedRLC Array("NAME:LumpRLC1",_
"UseResist:=", true,_
"Resistance:=", "10Ohm",_
"UseInduct:=", true,_
"Inductance:=", "10nH",_
"UseCap:=", true,_
"Capacitance:=","10pF",_
Array("NAME:CurrentLine", _
"Start:=", Array(-0.4, -1.2, -1.6),_
"End:=", Array(-0.4, -1.2, 0)),
"Faces:=", Array(12))

AssignMagneticBias
Use: Creates a magnetic bias source.
Command: HFSS>Excitations>Assign>Magnetic Bias

Boundary and Excitation Module Script Commands 14-39


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syntax: AssignMagneticBias <MagneticBiasArray>


Return Value: None
Parameters: <MagneticBiasArray>
Array("NAME:<BoundName>",
"IsUniformBias:=", <bool>,
"Bias:=", <value>,
"XAngle:=", <value>,
"YAngle:=", <value>,
"ZAngle:=", <value>,
"Project:=",<string>,
"Objects:=", <AssignmentObjects>)
IsUniformBias
If true, supply the Bias, XAngle, YAngle, and ZAngle parameters.
If false, supply the Project parameter.
VB Example:
oModule.AssignMagneticBias Array("NAME:MagBias1",_
"IsUniformBias:=", true,_
"Bias:=", "1",_
"XAngle:=", "10deg",_
"YAngle:=", "10deg",_
"ZAngle:=", "10deg",_
"Objects:=", Array("Box2"))
VB Example:
oModule.AssignMagneticBias Array("NAME:MagBias2",_
"IsUniformBias:=", false,_
"Project:=","D:/Maxwell/testing/m3dfs.pjt",_
"Objects:=", Array("Box2"))

AssignMaster
Use:Creates a master boundary.

Boundary and Excitation Module Script Commands 14-40


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Command:HFSS>Boundaries>Assign>Master
Syntax:AssignMaster <MasterArray>
Return Value:None
Parameters:<MasterArray>
Array("NAME:<BoundName>",
<CoordSysArray>,
"ReverseV:=", <bool>,
"Faces:=", <AssignmentFaces>)

<CoordSysArray>
Array("NAME:CoordSysVector",
"Origin:=", <CoordSysPoint>,
"UPos:=", <LineEndPoint>)
VB Example:
oModule.AssignMaster Array("NAME:Master1",_
Array("NAME:CoordSysVector",_
"Origin:=", Array(-1.4, -1.4, -0.8),_
"UPos:=", Array(-1.4, -1.4, 0)),_
"ReverseV:=", false,_
"Faces:=", Array(12))

AssignPerfectE
Use: Creates a perfect E boundary.
Command: HFSS>Boundaries>Assign>Perfect E
Syntax: AssignPerfectE <PerfectEArray>
Return Value: None
Parameters: <PerfectEArray>
Array("NAME:<BoundName>",
"InfGroundPlane:=", <bool>,
"Objects:=", <AssignmentObjects>,

Boundary and Excitation Module Script Commands 14-41


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Faces:=", <AssignmentFaces>)
VB Example:
oModule.AssignPerfectE Array("NAME:PerfE1",_
"InfGroundPlane:=", false,_
"Faces:=", Array(12))

AssignPerfectH
Creates a perfect H boundary.
Command:HFSS>Boundaries>Assign>PerfectH
Syntax: AssignPerfectH <PerfectHArray>
Return Value: None
Parameters: <PerfectHArray>
Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
VB Example:
oModule.AssignPerfectH Array("NAME:PerfH1",_
"Faces:=", Array(12))

AssignRadiation
Creates a radiation boundary.
Command: HFSS>Boundaries>Assign>Radiation
Syntax: AssignRadiation <RadiationArray>
Return Value: None
Parameters: <RadiationArray>
Array("NAME:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>
"IsIncidentField:=", <boolean>, _
"IsEnforcedHField:=", <boolean>, _

Boundary and Excitation Module Script Commands 14-42


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"IsEnforcedEField:=", <boolean>, _
"IsFssReference:=", <boolean>, _
"IsForPML:=", <boolean>, _
"UseAdaptiveIE:=", <boolean>, _
"IncludeInPostproc:=", <boolean>))
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 2:27:20 PM Sep 13, 2011
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project59")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignRadiation Array("NAME:Rad1", _
"Objects:=", Array("Box1"), _
"IsIncidentField:=", false, _
"IsEnforcedField:=", false, _
"IsFssReference:=", false, _
"IsForPML:=", false, _
"UseAdaptiveIE:=", true, _
"IncludeInPostproc:=", true)

Boundary and Excitation Module Script Commands 14-43


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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.
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",

Boundary and Excitation Module Script Commands 14-44


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:Params", "<variable>:=", "<value>"),


"ForceSourceToSolve:=", <Boolean>
"PreservePartnerSoln:=", <Boolean>,
"PathRelativeTo:=", "TargetProject"))
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("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:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 13.0.0
' 4:17:23 PM Oct 29, 2010
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign

Boundary and Excitation Module Script Commands 14-45


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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", "Object-
s:=", 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"))

AssignSymmetry
Use: Creates a symmetry boundary.
Command: HFSS>Boundaries>Assign>Symmetry
Syntax: AssignSymmetry <SymmetryArray>
Return Value: None
Parameters: <SymmetryArray>
Array("NAME:<BoundName>",
"IsPerfectE:=", <bool>

Boundary and Excitation Module Script Commands 14-46


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
VB Example:
oModule.AssignSymmetry Array("NAME:Sym1",_
"IsPerfectE:=", true,_
"Faces:=", Array(12))

AssignTerminal
Use: Assigning terminals to a port.
Command: HFSS>Excitations>Assign>Terminal
Syntax: AssignTerminal <TerminalArray>
Return Value: None
Parameters: <TerminalArray>
Array("NAME: <TerminalName>, "Edges:", <EdgeIDArray>, "ParentBndID":= ,
"<PortName>", "TeminalResistance:=", <value>)
<TerminalName>
Type: String
<EdgeIDArray>
Type: Array of strings
<PortName>
Type: String
Name of Port.
<value>
Type: string
Value and units for the resistance.
VB Example:
oModule.AssignTerminal Array("NAME:Rectangle1_T1", _
"Edges:=", Array(36), "ParentBndID:=", _
"WavePort1", "TerminalResistance:=", "50ohm")

Boundary and Excitation Module Script Commands 14-47


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

For Q3D Extractor the command details are as follows:


Use: Assigns 1D and 2D terminals.
Command: Q3D Extractor>Nets>AssignTerminals
Syntax: AssignTerminals <TerminalArray>
<TerminalArray>
Array("NAME:AssignTerminals",
Array("Name:SourceList", Array("Name:<SourceName>", "Net:=",
<NetObject>, "Objects:=", <Assignment 2D/1D>)),
Array("Name:SinkList", Array("Name:<SinkName>", "Net:=", <NetOb-
ject>, "Objects:=", <Assignment 2D/1D>)),
"Name:DeleteList", <Name Array>)
Return Value: None
VB Example: Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignTerminals Array("NAME:AssignTerminals", Array
("NAME:SourceList", Array("NAME:Polyline2", "Objects:=", Array(
"Polyline2"), "ParentBndID:=", "Box1", "Net:=", "Box1"), Array
("NAME:Rectangle1", "Objects:=", Array( "Rectangle1"), "Par-
entBndID:=", "Box1", "Net:=", "Box1")), Array("NAME:SinkList"),
"DeleteList:=", _ "")

AssignVoltage
Use: Creates a voltage source.
Command: HFSS>Excitations>Assign>Voltage
Syntax: AssignVoltage <VoltageArray>
Return Value: None
Parameters: <VoltageArray>
Array("NAME:<BoundName>",
"Voltage:=", <value>,
<DirectionArray>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)

<DirectionArray>

Boundary and Excitation Module Script Commands 14-48


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:Direction",_
"Start:=",<LineEndPoint>,
"End:=", <LineEndPoint>)
VB Example:
oModule.AssignVoltage Array("NAME:Voltage1",_
"Voltage:=", "1000mV",_
Array("NAME:Direction",_
"Start:=", Array(-0.4, -1.2, 0),_
"End:=", Array(-1.4, -1.2, 0)),_
"Faces:=", Array(7))

AssignWavePort
Use: Creates a wave port.
Command: HFSS>Excitations>Assign>Wave Port
Syntax: AssignWavePort <WavePortArray>
Return Value: None
Parameters: <WavePortArray>
Array("NAME:<BoundName>",
"Faces:=", <FaceIDArray>,
"NumModes:=", <int>,
"PolarizeEField:=",<bool>,
"DoDeembed:=", <bool>,
"DeembedDist:=", <value>,
"DoRenorm:=", <bool>,
"RenormValue:=",<value>,
<ModesArray>,
"TerminalIDList:=", <TerminalsArray>
)
NumModes
Number of modes for modal problems.

Boundary and Excitation Module Script Commands 14-49


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Number of terminals for terminal problems.

<ModesArray>
Specify for modal problems.
Array("NAME:Modes",
<OneModeArray>, <OneModeArray>, ...)

<OneModeArray>
Array("NAME:<ModeName>",
"ModeNum:=", <int>,
"UseIntLine:=", <bool>,
<IntLineArray>)

<ModeName>
Type: <string>
Name of the mode. Format is "Mode<int>". For example "Mode1".

<IntLineArray>
Array("NAME:IntLine",
"Start:=", <LineEndPoint>,
"End:=", <LineEndPoint>,
"CharImp:=", <string>)
CharImp
Characteristic impedance of the mode. Possible values are "Zpi", "Zpv", or "Zvi"
VB Example: Modal problem:
oModule.AssignWavePort Array("NAME:WavePort1",_
"NumModes:=", 2,_
"PolarizeEField:=",false,_
"DoDeembed:=", true,_
"DeembedDist:=", "10mil",_

Boundary and Excitation Module Script Commands 14-50


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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))
VB Example: Terminal problem:
oModule.AssignWavePort Array("NAME:WavePort1",_
"Faces:=", Array(11)
"NumModes:=", 2,_
"PolarizeEField:=", false,_
"DoDeembed:=", false,
"TeminalIDList:=", Array()
)

CircuitPortToLumpedPort
Use: Converts a circuit port to a lumped port for a driven terminal or driven modal design in HFSS.
Command: Convert to Lumped Port
Syntax: CIrcuitPortToLumpedPort ("<PortName>")
Return Value: None
Parameters: <PortName>

Boundary and Excitation Module Script Commands 14-51


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Example:
oModule.CircuitPortToLumpedPort("1")

Python Syn- CircuitPortToLumpedPort (<PortName>)


tax

Python CircuitPortToLumpedPort("1")
Example

EditCircuitPort [HFSS]
Use: Edits a circuit port for a driven terminal or driven modal design in HFSS.
Command: Properties
Syntax: EditCircuitPort <parameters>
Return Value: None
Parameters: <CircuitPortArray>
Array("NAME:<PortName>",
"Impedance:=", "valueohm",
DoDeembed:=", <boolean>
"RenormalizeAllTerminals:=", <boolean>
"TerminalIDLit:=", Array()
)

VB Example:
oModule.EditCircuitPort Array("NAME:1",
"Impedance:=", "50ohm", _
"DoDeembed:=", true, _
"RenormalizeAllTerminals:=", true,_
"TerminalIDList:=", Array())

Python Syn- EditCircuitPort (<parameters>)


tax

Python oModule.EditCircuitPort(
Example

Boundary and Excitation Module Script Commands 14-52


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

[
"NAME:1",
"Impedance:=" , "50ohm",
"DoDeembed:=" , False,
"RenormalizeAllTerminals:=", True,
"TerminalIDList:=" , []
])

EditCurrent
Use: Modifies a current source.
Command: Double-click the excitation in the project tree to modify its settings.
Syntax: EditCurrent <BoundName> <CurrentArray>
Return Value: None

EditDiffPairs
Use:Edits the properties of differential pairs defined from terminal excitations on wave ports.
Command:HFSS>Excitations>Differential Pairs
Syntax:EditDiffPairs <DifferentialPairsArray>
Return Value:None
Parameters:<DifferentialPairsArray>
Array("NAME:EditDiffPairs",
<OneDiffPairArray>, <OneDiffPairArray>,...)

<OneDiffPairArray>
Array("NAME:Pair1",_
"PosBoundary:=", <string>,
"NegBoundary:=", <string>,
"CommonName:=", <string>,
"CommonRefZ:=", <value>,
"DiffName:=", <string>,
"DiffRefZ:=", <value>,

Boundary and Excitation Module Script Commands 14-53


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"IsActive:=", <boolean>)

PosBoundary
Name of the terminal to use as the positive terminal.

NegBoundary
Name of the terminal to use as the negative terminal.

CommonName
Name for the common mode.

CommonRefZ
Reference impedance for the common mode.

DiffName
Name for the differential mode.

DiffRefZ
Reference impedance for the differential mode.
VB Example:
oModule.EditDiffPairs Array("NAME:EditDiffPairs", Array
("NAME:Pair1", "PosBoundary:=", _
"Rectangle1_T1", "NegBoundary:=", "Rectangle2_T1", _
"CommonName:=", "Comm1", "CommonRefZ:=", "25ohm", _
"DiffName:=", "Diff1", "DiffRefZ:=", "100ohm", "IsActive:=", true))

EditFiniteCond
Use: Edit parameters of single finite conductivity boundary.
Command: Double-click finite conductivity boundary in project tree.
Syntax: EditFiniteCond <BoundaryName>, Array("NAME:<Name>", <FiniteCondParameters>)

Boundary and Excitation Module Script Commands 14-54


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Return Value: none


Parameters: <BoundaryName>
Type: <String>
Name of the boundary to edit.
<Name>
Type:<String>
Name of the boundary
<FiniteCondParameters>
Parameters:
"Roughness:=", "<Roughness>", "UseCoating:=", <UseCoating>, "Lay-
erThickness:=", "<Thickness>", "UseMaterial:=", <UseMaterial>,
"Material:=", "<MaterialName>"
<Roughness>
Type: <String>
Value: double with units of length
<UseCoating>
Type: <Boolean>
Value: true or false
<Thickness>
Type: String
Value: double with units of length
<UseMaterial>
Type:<Boolean>
Value: true or false
<MaterialName>
Type: String
Value: specify material name for coating.
VB Example: oModule.EditFiniteCond "FiniteCond1", Array("NAME:Fin-
iteCond1", "Roughness:=", "2um", "UseCoating:=", _ false)

EditHalfSpace
Use: Edit a Half Space boundary name, Z location, and or materials.

Boundary and Excitation Module Script Commands 14-55


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Command: Edit Properties


Syntax: EditHalfSpace Array("NAME:HalfSpacen", "ZLocation:=", "<intUnits>", "Material:=",
"<string>")
Return Value: None
Parameters: "NAME:<stringN>"
String
ZLocation
Z value and Units
Materials
<string> defining the material.
VB Example:
oModule.EditHalfSpace "HalfSpace1", Array("NAME:HalfSpace1", "ZLoca-
tion:=", "3mm", "Material:=", "tungsten")

EditHybridRegion
Use:Edit a Hybrid Region boundary name.
Command: Edit Properties
Syntax:EditHybridRegion Array("<Name>", "NAME:<newName>",)
Return Value: None
Parameters: "NAME:<stringN>"
VB Example:
oModule.EditHybridRegion "SBR11", Array("NAME:SBR2")

EditImpedance
Use: Modifies an impedance boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditImpedance <BoundName> <ImpedanceArray>
Return Value: None

EditIncidentWave
Modifies an incident wave excitation.
Command: Double-click the excitation in the project tree to modify its settings.
Syntax: EditIncidentWave <BoundName> <IncidentWaveArray>

Boundary and Excitation Module Script Commands 14-56


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Return Value: None


Parameters:
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("Cube_RCS_00a")
Set oDesign = oProject.SetActiveDesign("PEC_d1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.EditIncidentWave "IncPWave1",
Array("NAME:IncPWave1", "IsCartesian:=", false,
"PhiStart:=", "$phi_inc",
"PhiStop:=", "$phi_inc",
"PhiPoints:=", 1,
"ThetaStart:=", "$theta_inc",
"ThetaStop:=", "$theta_inc",
"ThetaPoints:=", 1, "EoPhi:=", "$phi_pol",
"EoTheta:=", "$theta_pol",
"OriginX:=", "0mm",
"OriginY:=", "0mm",
"OriginZ:=", "0mm",
"TransientActive:=", 1,
"TimeProfile:=", "Broadband Pulse",
"HfssFrequency:=", "1GHz",

Boundary and Excitation Module Script Commands 14-57


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"MinFreq:=", "100MHz",
"MaxFreq:=", "1GHz",
"Delay:=", "0.2s",
"NumFreqsExtracted:=", 401,
"SweepMinFreq:=", "100MHz",
"SweepMaxFreq:=", "1GHz",
"IsPropagating:=", true,
"IsEvanescent:=", false, "IsEllipticallyPolarized:=", false)

EditLayeredImpedance
Use: Modifies a layered impedance boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditLayeredImp <BoundName> <LayeredImpArray>
Return Value: None

EditMaster
Use: Modifies a master boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: Edit <BoundName> <MasterArray>
Return Value: None

EditPerfectE
Use: Modifies a perfect E boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditPerfectE <BoundName>, <PerfectEArray>
Return Value: None

EditPerfectH
Use: Modifies a perfect H boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditPerfectH <BoundName> <PerfectHArray>
Return Value: None

Boundary and Excitation Module Script Commands 14-58


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

EditLumpedPort
Modifies a lumped port.
Command: Double-click the excitation in the project tree to modify its settings.
Syntax: EditLumpedPort <BoundName> <LumpedPortArray>
Parameters: <LumpedPortArray>
Array("NAME:<BoundName>",
"Faces:=", <FaceIDArray>,
"RenormalizeAllTerminals:=", <boolean>
"DoDeembed:="’ <boolean"
<ModesArray>,
"TerminalIDList:=", <TerminalsArray>,
"FullResistance:=", <value>,
"FullReactance:=", <value>,
)
Return Value: None
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 2:18:20 PM May 20, 2011
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("calib_modal_test")

Boundary and Excitation Module Script Commands 14-59


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oDesign = oProject.SetActiveDesign("HFSSDesign1")


Set oModule = oDesign.GetModule("BoundarySetup")
oModule.EditLumpedPort "lp2", Array("NAME:lp2", "RenormalizeAllTerminals:=", true,
"DoDeembed:=", _
true, 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
Use: Modifies a lumped RLC boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditLumpedRLC <BoundName> <LumpedRLCArray>
Return Value: None

EditMagneticBias
Use: Modifies a magnetic bias excitation.
Command: Double-click the excitation in the project tree to modify its settings.
Syntax: EditMagneticBias <BoundName> <MagneticBiasArray>
Return Value: None
Parameters:

EditRadiation
Modifies a radiation boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditRadiation <BoundName> <RadiationArray>
Return Value: None
Parameters: <RadiationArray>
Array("NAME:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>
"IsIncidentField:=", <boolean>, _

Boundary and Excitation Module Script Commands 14-60


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"IsEnforcedHField:=", <boolean>, _
"IsEnforcedEField:=", <boolean>, _
"IsFssReference:=", <boolean>, _
"IsForPML:=", <boolean>, _
"UseAdaptiveIE:=", <boolean>, _
"IncludeInPostproc:=", <boolean>))
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 2:34:08 PM Sep 13, 2011
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project59")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.EditRadiation "Rad1", _
Array("NAME:Rad1", _
"IsIncidentField:=", true, _
"IsEnforcedField:=", false, _
"IsFssReference:=", false, _
"IsForPML:=", false, _
"UseAdaptiveIE:=", false, _

Boundary and Excitation Module Script Commands 14-61


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"IncludeInPostproc:=", true)

EditSlave
Use: Modifies a slave boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditSlave <BoundName> <SlaveArray>
Return Value: None

EditSymmetry
Use: Modifies a symmetry boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditSymmetry <BoundName> <SymmetryArray>
Return Value: None

EditTerminal
Use: Modifies properties of a terminal
Command: Edit Properties for a selected terminal
Syntax: EditTerminal <TerminalArray>)
Return Value: None
Parameters: <TerminalArray>
Array("NAME: <TerminalName>", "ParentBndID:=", "<PortName>", "Ter-
minalResistance:=," <value>")
<TerminalName>
Type:String
<PortName>
Type: String
<value>
Type: <string>
Value and units of resistance.
VB Example:
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.EditTerminal "Rectangle2_T1", Array("NAME:Rectangle2_T1", _
"ParentBndID:=", "WavePort1", "TerminalResistance:=", "75ohm")

Boundary and Excitation Module Script Commands 14-62


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

EditVoltage
Use: Modifies a voltage source.
Command: Double-click the excitation in the project tree to modify its settings.
Syntax: EditVoltage <BoundName> <VoltageArray>
Return Value: None

EditWavePort
Use: Modifies a wave port.
Command: Double-click the excitation in the project tree to modify its settings.
Syntax: EditWavePort <BoundName> <WavePortArray>
Return Value: None
VB Example:

LumpedPortToCircuitPort
Use: Converts a lumped port to a circuit port for a driven terminal or driven modal design in HFSS.
Command: Convert to Circuit Port
Syntax: LumpedPortToCircuitPort ("<PortName>")
Return Value: None
Parameters: <PortName>

VB Example:
oModule.LumpedPortToCircuitPort("1")

Python Syn- LumpedPortToCircuitPort (<PortName>)


tax

Python LumpedPortToCircuitPort("1")
Example

SetHybridRegionCoupledGroup
Use: To set coupling for hybrid regions.
Command: HFSS>HybridRegions>Set Coupling
Syntax: SetHybridRegionCoupledGroup <value>

Boundary and Excitation Module Script Commands 14-63


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2017.0.0
' 14:43:34 Nov 08, 2016
' ----------------------------------------------
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
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2017.0.0
' 14:45:49 Nov 08, 2016
' ----------------------------------------------
Dim oAnsoftApp

Boundary and Excitation Module Script Commands 14-64


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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("Project35")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.SetHybridRegionCoupledGroup "TwoWayCoupled"
Setting Hybrid Region Groupings
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2017.0.0
' 14:38:14 Nov 08, 2016
' ----------------------------------------------
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")

Boundary and Excitation Module Script Commands 14-65


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oModule.SetHybridRegionCoupledGroup "Advanced", Array("One Way:=",


Array("Two Way:=", Array( _
"Hybrid1", "Hybrid2")))

SetTerminalReferenceImpedances
Use: To set the reference impedance for all terminals within a specified port.
Command: HFSS>Excitations>Set Terminal Reference Impedances or HFSS-IE>Ex-
citations>Set Terminal Reference Impedances
Syntax: SetTerminalReferenceImpedances <value>, <PortName>
Return Value: None
Parameters: <value>
Type: <string>
The value and units for the the impedance
<PortName>
Type: <string>
The name of the port.
VB Example:
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.SetTerminalReferenceImpedances "75ohm", "WavePort1"

SwapCircuitPortAssignment
Use: Swaps the terminal and reference assignments on a circuit port.
Command: Swap Direction
Syntax: SwapCircuitPortAssignment ("<PortName>")
Return Value: None
Parameters: <PortName>

VB Example:
oModule.SwapCircuitPortAssignment("1")

Boundary and Excitation Module Script Commands 14-66


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Syn- SwapCircuitPortAssignment (<PortName>)


tax

Python SwapCircuitPortAssignment("1")
Example

UnassignIERegions
Use: Unassign one or more IE Regions assigned to conducting objects.
Command: Unassign IE Regions
Syntax: UnassignIERegion Array (<"geometryName">)
Return Value: None
Parameters: <GeometryName>
Type: String
Name of one or more geometries assigned as an IE Region.
Example:

' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 2:51:43 PM Mar 07, 2011
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
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")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.UnassignIERegions Array("Box1")

Boundary and Excitation Module Script Commands 14-67


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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’ command that represents the work performed by the PML Setup wiz-
ard. 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
Use: Command to create a new PML group from the script. This is equivalent to creating a new
PML group in the user interface.
Command: None
Syntax: For manually created PMLs:
CreatePML Array("UserDrawnGroup:=", true,
"PMLObj:=", <string>,
"BaseObj:=", <string>,
"Thickness:=", <value>,
"Orientation:=", <string>,
"RadDist:=", <value>,
"UseFreq:=", <bool>,
"MinFreq:=", <value>,
"MinBeta:=", <double>)
"RadIncidentField:=", <bool>
"RadFssReference:=", <bool>

Boundary and Excitation Module Script Commands 14-68


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

For automatically created PMLs:


CreatePML Array("UserDrawnGroup:=", false,
"PMLFaces:=", <AssignmentFaces>,
"CreateJoiningObjs:=", <bool>,
"Thickness:=", <value>,
"RadDist:=", <value>,
"UseFreq:=", <bool>,
"MinFreq:=", <value>,
"MinBeta:=", <double>)
"RadIncidentField:=", <bool>
"RadFssReference:=", <bool>

Return Value: None


Parameters: PMLObj
Name of the object to use as the PML cover.

BaseObj
Name of the base object touching the PML cover object.

Orientation
String representing the orientation of the PML.
Possible values are: "XAxis", "YAxis", and "ZAxis"

UseFreq
If true, provide the MinFreq parameter.
If false, provide the MinBeta parameter.

VB Example:
oModule.CreatePML Array("UserDrawnGroup:=", false,_
"PMLFaces:=", Array(120), "CreateJoiningObjs:=",_ true,_

Boundary and Excitation Module Script Commands 14-69


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Thickness:=", "0.33mm", "RadDist:=", "1.6mm",_


"UseFreq:=", true, "MinFreq:=", "1GHz")
VB Example:
oModule.CreatePML Array("UserDrawnGroup:=", true,_
"PMLObj:=", "Box1", "BaseObj:=", "Box2", _
"Thickness:=", "0.3mm", "Orientation:=", "ZAxis", _
"RadDist:=", "1.6mm", "UseFreq:=", false, _
"MinBeta:=", "2")
ModifyPMLGroup
Use: Command to modify a PML group. Note: This is the scripting equivalent to clicking Update in
the PML Setup wizard. This does not actually modify the materials. It only modifies the data stored
by the PML Setup wizard.
Command: None
Syntax: ModifyPMLGroup Array("NAME:<GroupName>",
"RadDist:=", <value>,
"UseFreq:=", <bool>,
"MinFreq:=", <value>,
"MinBeta:=", <double>)
Return Value: None
Parameters: <GroupName>
Name of the PML group to modify.

UseFreq
If true, provide the MinFreq argument.
If false, provide the MinBeta argument.
VB Example:
oModule.ModifyPMLGroup Array("NAME:PMLGroup1",
"RadDist:=", "1.166666667mm",
"UseFreq:=", false, "MinBeta:=", 2)

Boundary and Excitation Module Script Commands 14-70


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

PMLGroupCreated
Use: Command added by HFSS after a PML has been created. It is not responsible for creating
the PML objects and materials. It just contains the information needed by the PML Setup wizard
for future modification of the PML. This script command is not intended to be modified by you.
Removing this command from the script will prevent future modification of the PML through the
user interface after the script is played back.
Command: HFSS>Boundaries>Assign>PML Setup Wizard
Syntax: PMLGroupCreated <args>
Return Value: None
PMLGroupModified
Use: Command added by HFSS after a PML’s parameters are modified. This updates the PML
Setup wizard’s data. This script command is not intended to be modified by you. Removing this
command from the script will prevent future modification of the PML through the user interface after
the script is played back.
Command: Modify existing PML in the PML Setup wizard.
Syntax: PMLGroupModified <args>
Return Value: None
RecalculatePMLMaterials
Use: Scripting equivalent to clicking Recalculate Materials in the PML Setup wizard. This will
update the PML materials to match the current state of the PML Setup wizard data.
Command: None
Syntax: RecalculatePMLMaterials
Return Value: None
VB Example:
oModule.RecalculatePMLMaterials

Boundary and Excitation Module Script Commands 14-71


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

PDF layout 14-72


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

15 - Analysis Setup Module Script Com-


mands
Icepak analysis setup commands should be executed by the Analysis module, referred to in Icepak
scripts as the "AnalysisSetup" module.
Set oModule = oDesign.GetModule("AnalysisSetup")

CopySetup
DeleteSetups
EditSetup
ExportCircuit
GetSetupCount
GetSetups
InsertFrequencySweep
InsertSetup
InsertSetup [Transient]
PasteSetup
PasteSweep
RenameDrivenSweep
RenameSetup
RevertAllToInitial
RevertSetupToInitial

CopySetup
Copy the specified Optimetrics setup.

UI Access NA

Name Type Description


Parameters
<SetupName> String Name of the setup

Return Value None

Analysis Setup Module Script Commands 15-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Syn- CopySetup (<SetupName>)


tax

Python oModule.CopySetup ("OptimizationSetup1")


Example

VB Syntax CopySetup <SetupName>


VB oModule.CopySetup "OptimizationSetup1"
Example

CopySweep
The documented command is applicable for Q3D Extractor.
Use: Copy a sweep.
Syntax: CopySweep <SetupName>, <SweepName>
Return Value: None
Parameters: <SetupName>
Type: <String>
Name of solve setup to which the sweep belongs.
<SweepName>
Type:<String>
Name of sweep copied.
oModule.CopySweep "Setup6", "Sweep1"

DeleteDrivenSweep
Use: Deletes a frequency sweep. For HFSS-IE use DeleteSweep.
Command: Right-click a frequency sweep in the project tree, and then click Rename on the short-
cut menu.
Syntax: DeleteDrivenSweep <SetupName>, <SweepName>
Return Value: None

DeleteSetups
Use: Deletes one or more solution setups, which are specified by an array of solution setup names.

Analysis Setup Module Script Commands 15-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Command: Right-click a solution setup in the project tree, and then click Delete on the shortcut
menu, or delete selected solution setups in the List dialog box.
Syntax: DeleteSetups <SetupArray>
Return Value: None
Parameters: <SetupArray>
Array(<name1>, <name2>, ...)
VB Example:
oModule.DeleteSetups Array("Setup1", "Setup2")

DeleteSweep [HFSS-IE]
Use: Deletes a frequency sweep.
Command: Right-click a frequency sweep in the project tree, and then click Rename on the short-
cut menu.
Syntax: DeleteSweep <SetupName>, <SweepName>
Return Value: None
For Q3D Extractor, the command details are as follows:
Use: Deletes a sweep.
Syntax: DeleteSweep <SetupName>, <SweepName>
Return Value: None
Parameters: <SetupName>
Type: <String>
Name of solve setup.
<SweepName>
Type: <String>
Name of sweep to be deleted.
oModule.DeleteSweep "Setup6", "Sweep1"

EditFrequencySweep
Use: Modifies an existing frequency sweep. For HFSS-IE use EditSweep [HFSS-IE]
Command: Double-click a frequency sweep in the project tree to modify its settings.
Syntax: EditFrequencySweep <SetupName>, <SweepName>, <AttributesArray>

Analysis Setup Module Script Commands 15-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Return Value: None


Parameters: <SetupName>
Type: <string>
Name of the solution setup containing the sweep to be edited.

<SweepName>
Type: <string>
Name of the sweep to be edited.

<Attributes Array>
Array("NAME:<SweepName>",
"IsEnabled:=", <boolean>,
"SetupType:=", <SetupType>,
<FrequencyInformation>,
"Type:=", <SweepType>,
<SaveFieldsList>
<DCExtrapInfo>)
See the InsertFrequencySweep command for details.
Example:
oModule.EditFrequencySweep "Setup1", "Sweep3", _
Array("NAME:Sweep3", "IsEnabled:=", true, _
"SetupType:=", "SinglePoints", _
"ValueList:=", Array("1GHz", "2GHz", "3GHz"), _
"Type:=", "Discrete", _
"SaveFieldsList:=", Array(false, false, false), _
"ExtrapToDC:=", false)

EditSetup
Use: Modifies an existing solution setup.
Command: Double-click a solution setup in the project tree to modify its settings.

Analysis Setup Module Script Commands 15-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syntax: EditSetup <SetupName>, <AttributesArray>


Return Value: None
Parameters: <SetupName>
Type: <string>
Name of the solution setup being edited.

<AttributesArray>
Array("NAME:<NewSetupName>", <NamedParameters>)
See the InsertSetup command for details and examples.
For Q3D Extractor, the EditSetup command has the following details.
Use: Edit an existing solution setup.
Command: Double-click a setup in the project tree to edit it.
Syntax: EditSetup <SetupName>, Array("NAME:<NewSetupName>, "Enabled:=",
<Enabled>,"AdaptiveFreq:=",<AdaptFreq>,<SolverParam>)
Return Value: None
Parameters: <SetupName>
Type: <string>
Name of the solve setup being edited.
<NewSetupName>
Type: <string>
New name of the solve setup being edited
<SaveFields>
Type: <string>
Flag to indicate whether the fields are saved for last adaptive
solution. (True or False).
<Enabled>
Type: <bool>
Flag to indicate whether the setup is enabled.
<AdaptFreq>
Type: <String>
Frequency with units.

Analysis Setup Module Script Commands 15-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<SolverParam>
See InsertSetup for details.
oModule.EditSetup "Setup1", Array("NAME:Setup1", "AdaptiveFreq:=",
"1GHz", "EnableDistribProbTypeOption:=", _ false, "SaveFields:=",
"true", "Enabled:=", true, Array("NAME:Cap", "MaxPass:=", 10,
"MinPass:=", 1, "MinConvPass:=", _ 2, "PerError:=", 1, "Per-
Refine:=", 30, "AutoIncreaseSolutionOrder:=", false, "Solu-
tionOrder:=", _ "Normal"), Array("NAME:DC", "Residual:=", 1E-005,
"SolveResOnly:=", _ false, Array("NAME:Cond", "MaxPass:=", 10,
"MinPass:=", 1, "MinConvPass:=", 1, "PerError:=", _ 1, "Per-
Refine:=", 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))

EditSweep [HFSS-IE]
Use: Modifies an existing sweep in HFSS-IE.
Command: Double-click a frequency sweep in the project tree to modify its settings.
Syntax: EditSweep <SetupName>, <SweepName>, <AttributesArray>
Return Value: None
Parameters: <SetupName>
Type: <string>
Name of the solution setup containing the sweep to be edited.

<SweepName>
Type: <string>
Name of the sweep to be edited.

<Attributes Array>
Array("NAME:<SweepName>",
"IsEnabled:=", <boolean>,
"SetupType:=", <SetupType>,
<FrequencyInformation>,
"Type:=", <SweepType>,
<SaveFieldsList>

Analysis Setup Module Script Commands 15-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<DCExtrapInfo>)
<additionalRanges>
Array( "SetupType:=", "<SetupType>",
"StartValue:=", "<ValueUnits>",
"StopValue:=", "<ValueUnits", "Count:=", <value>, ...)

See the InsertFrequencySweep command for details.


Example:
oModule.EditSweep "Setup1", "Sweep3", _
Array("NAME:Sweep3", "IsEnabled:=", true, _
"SetupType:=", "SinglePoints", _
"ValueList:=", Array("1GHz", "2GHz", "3GHz"), _
"Type:=", "Discrete", _
"SaveFieldsList:=", Array(false, false, false), _
"ExtrapToDC:=", false)

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", "User-
HasChangedSettings:=", true, "IncludeCap:=", true, "IncludeCond:=",
_ true, Array("NAME:CouplingLimits", "CouplingLimitType:=", "By Frac-
tion", "CapFraction:=", _ 0.01, "IndFraction:=", 0.01, "ResFrac-
tion:=", 0.01, "CondFraction:=", 0.01), "IncludeDCR:=", _ false,
"IncudeDCL:=", false, "IncludeACR:=", false, "IncludeACL:=", false,
"ADDResistance:=", _ true)

Analysis Setup Module Script Commands 15-7


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Example:oModule.EditCircuitSettings Array("NAME:CircuitData",
"MatrixName:=", "Original", "NumberOfCells:=", _ "1", "User-
HasChangedSettings:=", true, "IncludeCap:=", true, "IncludeCond:=",
_ true, Array("NAME:CouplingLimits", "CouplingLimitType:=", "By Frac-
tion", "CapFraction:=", _ 0.01, "IndFraction:=", 0.01, "ResFrac-
tion:=", 0.01, "CondFraction:=", 0.01), "IncludeR:=", _ false,
"IncludeL:=", false, "ExportDistributed:=", true, "LumpedLength:=",
_ "7meter", "RiseTime:=", "1s")

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

Analysis Setup Module Script Commands 15-8


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Model name or name of the sub circuit (Optional). If not specified


then <FileName> is considered as model name.
<Freq>
Type: <double>
Sweep frequecny in hz.
<ExportSettings>
Array("NAME:CircuitData", "MatrixName:=", _
<ReduceMatrix>, "NumberOfCells:=", <NumCell>, "User-
HasChangedSettings:=", <UserChangedSettings>, "IncludeCap:=",
<IncludeCap>, "IncludeCond:=", <IncludeCond>, Array("NAME:Coup-
lingLimits", <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.
<IncludeDCR>
Type: <bool>
Flag indicates whether to export DC resistance matrix.

Analysis Setup Module Script Commands 15-9


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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:=", _ <Coup-
lingLimitType>, <CouplingLimitsParameters>, 0.01, "CondFraction:=",
0.01)
<CouplingLimitType> = "None"
A rgument 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>

Analysis Setup Module Script Commands 15-10


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"CapLimit:=", <Limit>, "IndLimit:=", <Limit>, "ResLimit:=",


<Limit>,
"CondLimit:=", <Limit>,
Parameters:
<Limit>
Type: <string>
Value of the limit.
VB Example:oModule.ExportCircuit "Setup1 : LastAdaptive", "",
"C:/Project/Q3D/FourNets.cir", Array("NAME:CircuitData", "Mat-
rixName:=", _ "Original", "NumberOfCells:=", "1", "User-
HasChangedSettings:=", true, "IncludeCap:=", _ true,
"IncludeCond:=", true, Array("NAME:CouplingLimits", "Coup-
lingLimitType:=", _ "By Fraction", "CapFraction:=", 0.01, "IndFrac-
tion:=", 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.
Syntax: GetSetups()
Return Value: Number of setups.
Parameters: None
VB Example:
setupcount = oModule.GetSetupCount()

GetSetups
Gets the names of analysis setups in a design.
Syntax: GetSetups()
Return Value: Array of analysis setup names.
Parameters: None
VB Example:
setupnames = oModule.GetSetups()

Analysis Setup Module Script Commands 15-11


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

InsertFrequencySweep
Adds a frequency sweep to a Driven solution-type setup.
Command: HFSS>Analysis Setup>Add Sweep
Syntax: InsertFrequencySweep <SetupName>, <AttributesArray> [<additionalRanges>]
Return Value: None
Parameters: <SetupName>
Type: <string>
Name of the solution setup into which the sweep will be inserted.
<Attributes Array>
Array("NAME:Sweep",
"IsEnabled:=", <boolean>
"RangeType:=", <"LinearStep" | "LinearCount" | "LogScale">,
<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>,
"InterpMinSolns:=", <int>,
"InterpMinSubranges:=", <int>,
"ExtrapToDC:=", <boolean>,
"InterpUseS:=", <boolean>,
"InterpUsePortImped:=", <boolean>,

Analysis Setup Module Script Commands 15-12


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"InterpUsePropConst:=", <boolean>,
"UseDerivativeConvergence:=", true,
"InterpDerivTolerance:=", <real>,
"UseFullBasis:=", <boolean>,
"EnforcePassivity:=", <boolean>,
"PassivityErrorTolerance:=", <real>)
"EnforceCausality:=", <boolean>

<FastParametersArray>
"SaveFields:=", <boolean>,
"SaveRadFields:=", <boolean>,
"GenerateFieldsForAllFreqs:=", <boolean>,
"ExtrapToDC:=", <boolean>)

<DiscreteParametersArray>
"SaveFields:=", <boolean>,
"SaveRadFields:=", <boolean>,
"ExtrapToDC:=", <boolean>)

VB Example: Discrete Sweep

oModule.InsertFrequencySweep "Setup1", Array("NAME:Sweep",


"IsEnabled:=", true,
"RangeType:=", "LinearStep",
"RangeStart:=", "1GHz",
"RangeEnd:=", "10GHz",
"RangeStep:=", "0.1GHz",
"Type:=", "Discrete",
"SaveFields:=", false,
"SaveRadFields:=", false,
"ExtrapToDC:=", false)

VB Example: Fast Sweep

oModule.InsertFrequencySweep "Setup1",
Array("NAME:Sweep2", "IsEnabled:=", false,
"RangeType:=", "LinearStep",
"RangeStart:=", "1GHz",
"RangeEnd:=", "10GHz",
"RangeStep:=", "0.1GHz",

Analysis Setup Module Script Commands 15-13


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Type:=", "Fast",
"SaveFields:=", true,
"SaveRadFields:=", false,
"GenerateFieldsForAllFreqs:=", false,
"ExtrapToDC:=", false)

VB Example: 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", _
"StopValue:=", "100GHz", "Count:=", 91)

VB Example: Discrete sweeps with linear step and log scale:

oModule.InsertFrequencySweep "Setup1", Array("NAME:Sweep2", _


"IsEnabled:=", true,
"SetupType:=", "LinearStep", _

Analysis Setup Module Script Commands 15-14


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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)

VB Example: A Fast sweep, specified using the starting and stopping


frequencies and the step count:
oModule.InsertFrequencySweep "Setup1", Array("NAME:Sweep4", _
"IsEnabled:=", true, "SetupType:=", "LinearCount", _
"StartValue:=", "1GHz", _
"StopValue:=", "10GHz", _
"Count:=", 3, _
"Type:=", "Fast", _
"SaveFields:=", true, "ExtrapToDC:=", false)

For Q3D Extractor the command details are as follows:


Inserts a sweep in the selected solve setup.
Syntax: InsertSweep
Return Value: None
Parameters: oModule.InsertSweep <SetupName>, <SweepDataArray>
<SetupName>

Analysis Setup Module Script Commands 15-15


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Type: <String>
Name of the solve setup in which the sweep is added.
<SweepDataArray>
Array("NAME:<SweepName>", "IsEnabled:=", <EnableFlag>,
"SetupType:=", _
<SetupType>", <SetupTypeParameters>, "Type:=", <SweepType>,
"SaveFields:=", <SaveFields>, <InterpSweepParameters>)
Array("NAME:<SweepName>", "IsEnabled:=", <EnableFlag>,
"SetupType:=", _
<SetupType>", <SetupTypeParameters>, "Type:=", <SweepType>,
"SaveFieldsList:=", <SaveFieldsListParameters>, <Inter-
pSweepParameter>)
VB Example: Array("NAME:Sweep1", "IsEnabled:=", true,
"SetupType:=", _ "LinearStep", "StartValue:=", "1GHz",
"StopValue:=", "10GHz", "StepSize:=", _ "1GHz", "Type:=", "Dis-
crete", "SaveFields:=", true)
VB Example: Array("NAME:Sweep1", "IsEnabled:=", true,
"SetupType:=", _ "LinearCount", "StartValue:=", "1GHz",
"StopValue:=", "100GHz", "Count:=", 100, "Type:=", _ "Discrete",
"SaveFields:=", true)
VB Example: Array("NAME:Sweep1", "IsEnabled:=", true, "SetupType:=",
_ "LinearCount", "StartValue:=", "1GHz", "StopValue:=", "100GHz",
"Count:=", 100, "Type:=", _ "Discrete", "SaveFields:=", true)
VB Example: Array("NAME:Sweep1", "IsEnabled:=", true, "SetupType:=",
_ "SinglePoints", "ValueList:=", Array("1GHz", "2GHz", "5GHz"),
"Type:=", _ "Discrete", "SaveFieldsList:=", Array(false, false,
false)
VB Example: Array("NAME:Sweep2", "IsEnabled:=", true, "SetupType:=",
_ "LinearStep", "StartValue:=", "1GHz", "StopValue:=", "10GHz",
"StepSize:=", _ "1GHz", "Type:=", "Interpolating", "SaveFields:=",
false, "InterpTolerance:=", _ 0.01, "InterpMaxSolns:=", 9, "Inter-
pMinSolns:=", 4)

Parameters:
<SweepName>
Type: <String>
Sweep name
<EnableFlag>

Analysis Setup Module Script Commands 15-16


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Type:<bool>
Flag to tell whether sweep is enabled.
<SetupType>
Type:String>
Values: "LinearStep", "LinearCount", "LogScale", "SinglePoints"
<SetupTypeParameters>
Base on the value of setup type, setup type parameters varies.
<LinearStepParameters>
StartValue:=", <StartValue>, "StopValue:=", <StopValue>, "StepSize:=", <StepSize>
<StartValue>
Type:<String>
Start frequency.
<StopValue>
Type: <String>
Stop Frequency
<StepSize>
Type:<String>
Step frequency.
<LinearCountParameters>
StartValue:=", <StartValue>, "StopValue:=", <StopValue>, "Count:=", <Count>
<StartValue>
Type:<String>
Start frequency.
<StopValue>
Type: <String>
Stop Frequency
<Count>
Type:<integer>
Number of frequency points in the given range.
<LogScaleParameters>

Analysis Setup Module Script Commands 15-17


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"StartValue:=", <StartValue>,"StopValue:=",<StopValue>, "SamplesPerDecade:=", <Samples>


<StartValue>
Type:<String>
Start frequency.
<StopValue>
Type: <String>
Stop Frequency
<Samples>
Type:<integer>
Number of samples per decade.
<SinglePointsParameters>
"ValueList:=", Array(<FrequencyPoint>,<FrequencyPoint> ..),
<FrequencyPoint>
Type: <String>
Single frequency point.
<SweepType>
Type:<String>
Values: "Discrete", "Interpolating"
Type of sweep.
<SaveFields>
Type:<bool>
Flag, whether to save fields for the frequency points.
<SaveFieldsListParameters>
"SaveFieldsList:=", Array(<SaveFields>,<SaveFields>,…)
Type:Array of flags.
<InterpSweepParameter>

Note:

This parameter applies only to interpolating sweeps.

Analysis Setup Module Script Commands 15-18


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"InterpTolerance:=", <Tolerance>, "Inter-


pMaxSolns:=",<MaxSolutions>, "InterpMinSolns:=",<MinSolutions>,
<Tolerance>
Type: <double>
Tolerance for interpolating sweep.
<MaxSolutions>
Type:<Integer>
Maximum basis points for interpolating sweep.
<MinSolutions>
Type:<Integer>
Minimum basis points for interpolating sweep.
<InterpSweepParameter> (For 2D Extractor)
"InterpTolerance:=", <Tolerance>, "Inter-
pMaxSolns:=",<MaxSolutions>, "InterpMinSolns:=",<MinSolutions>,
"InterpMinSubranges:=", <InterpMinSubRanges>
<Tolerance>
Type: <double>
Tolerance for interpolating sweep.
<MaxSolutions>
Type:<Integer>
Maximum basis points for interpolating sweep.
<MinSolutions>
Type:<Integer>
Minimum basis points for interpolating sweep.
<InterpMinSubRanges>
Type:<Integer>
Minimum number of subranges in the interpolator.
VB Example: oModule.InsertSweep "Setup4", Array("NAME:Sweep2", "IsEn-
abled:=", true, "SetupType:=", _ "LinearStep", "StartValue:=",
"1GHz", "StopValue:=", "10GHz", "StepSize:=", _ "1GHz", "Type:=",
"Interpolating", "SaveFields:=", false, "InterpTolerance:=", _ 0.01,
"InterpMaxSolns:=", 9, "InterpMinSolns:=", 4, InterpMinSubranges:=",
2

Analysis Setup Module Script Commands 15-19


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Example: oModule.InsertSweep "Setup4", Array("NAME:Sweep1", "IsEn-


abled:=", true, "SetupType:=", _
"LinearStep", "StartValue:=", "1GHz", "StopValue:=", "10GHz", "StepS-
ize:=", _
"1GHz", "Type:=", "Discrete", "SaveFields:=", true)
VB Example: oModule.InsertSweep "Setup4", Array("NAME:Sweep2", "IsEn-
abled:=", true, "SetupType:=", _
"LinearStep", "StartValue:=", "1GHz", "StopValue:=", "10GHz", "StepS-
ize:=", _
"1GHz", "Type:=", "Interpolating", "SaveFields:=", false, "Inter-
pTolerance:=", _
0.01, "InterpMaxSolns:=", 9, "InterpMinSolns:=", 4)

InsertSetup
Use: Adds a new solution setup.
Command: [product]>Analysis Setup>Add Solution Setup
Syntax: InsertSetup <SetupType>, <AttributesArray>
Return Value: None
Parameters: <SetupType>
Type: <string>
"HfssDriven" or "HfssDrivenAuto" or "HfssEigen". Must match the HFSS solution type.

<AttributesArray>
Array("NAME:<SetupName>", <Named Parameters>)
<Named Parameters>
The named parameters will vary according to the solution type and the selections made.
The parameters correspond to fields in the Setup dialog. For example, here is default
dialog for an HFSS driven setup with one excitation assigned.

Analysis Setup Module Script Commands 15-20


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Some of the attributes Array correspond to these fields on the General tab of the Setup.
Array("NAME:Setup1", "AdaptMultipleFreqs:=", false, _
"Frequency:=", "5GHz", _
"MaxDeltaS:=", 0.02, _
"PortsOnly:=", false, _
"UseMatrixConv:=", false, _
"MaximumPasses:=", 6,_
Others correspond to fields on the Options tab.

Analysis Setup Module Script Commands 15-21


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

The script parameters corresponding to these Options tab fields are as follows:
"MinimumPasses:=", 1, _
"MinimumConvergedPasses:=", 1, _
"PercentRefinement:=", 30, _
"IsEnabled:=", true, _
"BasisOrder:=", 1, _
"DoLambdaRefine:=", true, _
"DoMaterialLambda:=", true, _
"SetLambdaTarget:=", false, _
"Target:=", 0.3333,
Still other parameters correspond to fields on the Advanced tab.

Analysis Setup Module Script Commands 15-22


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"PortAccuracy:=", 2,_
SaveRadFieldsOnly:=", false, _
"SaveAnyFields:=", true,
Still others parameters correspond to the Hybrid tab.

"IESolverType:=", "Auto",_
"LambdaTargetForIESolver:=", 0.15, _
"UseDefaultLambdaTgtForIESolver:=", true

Analysis Setup Module Script Commands 15-23


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

The choices made for solver, solution type, Ports Only, Single Frequency, Multi-Fre-
quencies, Broadband, Mesh Linking, and whether Expression Cash, or Derivatives, and
HPC are used will all affect the parameters array for a particular setup.
To see the required 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 para-
meters, see the Online help for the setup. See the examples below.
VB Example: An HFSS Driven project solution with Auto Solution.

Analysis Setup Module Script Commands 15-24


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oModule = oDesign.GetModule("AnalysisSetup")_


oModule.InsertSetup "HfssDrivenAuto", Array("NAME:Setup1", "IsEn-
abled:=", true, _
"AutoSolverSetting:=", "Balanced", _
Array("NAME:Sweeps", Array("NAME:Sweep", "RangeType:=", "Lin-
earCount", _
"RangeStart:=", "1GHz", "RangeEnd:=", "10GHz", "RangeCount:=",
"451")), _
"SaveRadFieldsOnly:=", false, "SaveAnyFields:=", false, "Type:=",
"Interpolating")

VB Example: A Driven solution type with a mesh link. References to


dependent solve in old scripts are converted to mesh link form.
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup "HfssDriven",
Array("NAME:Setup1",
"Frequency:=", "1GHz",
"MaxDeltaE:=", 0.1,
"MaximumPasses:=", 6,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"IsEnabled:=", true,
Array("NAME:MeshLink",
"Project:=", "Tee.aedt",
"Design:=", "TeeModel",
"Soln:=", "Setup1 : LastAdaptive",
Array("NAME:Params", "offset:=", "0in"),
"ForceSourceToSolve:=", false,
"PreservePartnerSoln:=", false,
"PathRelativeTo:=", "SourceProduct",
"ApplyMeshOp:=", true),

Analysis Setup Module Script Commands 15-25


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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)

VB Example: A Driven solution type with ports:


Set oModule = oDesign.GetModule("AnalysisSetup")
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,

Analysis Setup Module Script Commands 15-26


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"DoLambdaRefine:=", true,
"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)
VB Example: An Eigenmode solution type:
Set oProject = oDesktop.SetActiveProject("cavity")
Set oDesign = oProject.SetActiveDesign("HFSSModel1")
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup "HfssEigen",
Array("NAME:Setup2",
"MinimumFrequency:=", "1.77347GHz",
"NumModes:=", 1,
"MaxDeltaFreq:=", 10,
"ConvergeOnRealFreq:=", true,
"MaximumPasses:=", 3,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"IsEnabled:=", true,
"BasisOrder:=", 1,

Analysis Setup Module Script Commands 15-27


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"UseIterativeSolver:=", false,
"DoLambdaRefine:=", true,
"DoMaterialLambda:=", true,
"SetLambdaTarget:=", false,
"Target:=", 0.2,
"UseMaxTetIncrease:=", false,
"MaxTetIncrease:=", 1000000,
"UsingConstantDelta:=", 0,
"ConstantDelta:=", "0s",
"NumberSolveSteps:=", 1)

VB Example:
A Driven solution type with ports and matrix convergence:
Set oDesign = oProject.SetActiveDesign("packagehfss")
Set oModule = oDesign.GetModule("AnalysisSetup")
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)),
"MaximumPasses:=", 6,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"IsEnabled:=", true,

Analysis Setup Module Script Commands 15-28


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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)
VB Example:
An HFSS setup with an Hybrid Boundary type SBR.
oModule.EditSetup("SBRsetup1",
[
"NAME:SBRsetup1",
"AdaptBroadband:=" , False,
"Frequency:=" , "1GHz",
"MaxDeltaE:=" , 0.1,
"MaximumPasses:=" , 10,
"MinimumPasses:=" , 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=" , 30,
"IsEnabled:=" , True,
"BasisOrder:=" , 1,

Analysis Setup Module Script Commands 15-29


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"DoLambdaRefine:=" , True,
"DoMaterialLambda:=" , True,
"SetLambdaTarget:=" , False,
"Target:=" , 0.3333,
"UseMaxTetIncrease:=" , False,
"UseDomains:=" , True,
"UseIterativeSolver:=" , False,
"IterativeResidual:=" , 1E-
006,
"DDMSolverResidual:=" , 0.0001,
"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,
"IESolverType:=" , "Auto",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True
"SkipIERegionsSolveDuringAdaptivePasses:=", True
"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"InfiniteSphereSetup:=" , "Infinite Sphere1",
"SkipSBRSolveDuringAdaptivePasses:=", True,
"PTDUTDSimulationSettings:=", "PTD Correction + UTD Rays",
"PTDEdgeDensity:=" , 20
])
VB Example:
A Driven solution type with Multi-Frequencies specified.
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2017.0.0
' 14:10:43 Aug 26, 2016
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop

Analysis Setup Module Script Commands 15-30


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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("Project20")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup "HfssDriven", Array("NAME:Setup2", "AdaptMul-
tipleFreqs:=", 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, "Min-
imumPasses:=", 1, "MinimumConvergedPasses:=", _
1, "PercentRefinement:=", 30, "IsEnabled:=", true, "BasisOrder:=",
1, "DoLambdaRefine:=", _
true, "DoMaterialLambda:=", true, "SetLambdaTarget:=", false, "Tar-
get:=", _
0.3333, "UseMaxTetIncrease:=", false, "PortAccuracy:=", 2,
"UseABCOnPort:=", _
false, "SetPortMinMaxTri:=", false, "UseDomains:=", false, "UseIter-
ativeSolver:=", _
false, "SaveRadFieldsOnly:=", false, "SaveAnyFields:=", true,
"IESolverType:=", _
"Auto", "LambdaTargetForIESolver:=", 0.15, "UseDe-
faultLambdaTgtForIESolver:=", _
true, "RayDensityPerWavelength:=", 4, "MaxNumberOfBounces:=", 5)

VB Example:
An Driven Solution type with Broadband specified.
' ----------------------------------------------

Analysis Setup Module Script Commands 15-31


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

' Script Recorded by ANSYS Electronics Desktop Version 2017.0.0


' 14:12:13 Aug 26, 2016
' ----------------------------------------------
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("Project20")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup "HfssDriven", Array("NAME:Setup1", "AdaptMul-
tipleFreqs:=", true, Array("NAME:MultipleAdaptiveFreqsSetup", Array
("NAME:Broadband", "Low:=", _
"2GHz", "High:=", "20GHz")), "MaximumPasses:=", 6, "Min-
imumPasses:=", 1, "MinimumConvergedPasses:=", _
1, "PercentRefinement:=", 30, "IsEnabled:=", true, "BasisOrder:=",
1, "DoLambdaRefine:=", _
true, "DoMaterialLambda:=", true, "SetLambdaTarget:=", false, "Tar-
get:=", _
0.3333, "UseMaxTetIncrease:=", false, "PortAccuracy:=", 2,
"UseABCOnPort:=", _
false, "SetPortMinMaxTri:=", false, "UseDomains:=", false, "UseIter-
ativeSolver:=", _
false, "SaveRadFieldsOnly:=", false, "SaveAnyFields:=", true,
"IESolverType:=", _
"Auto", "LambdaTargetForIESolver:=", 0.15, "UseDe-
faultLambdaTgtForIESolver:=", _
true, "RayDensityPerWavelength:=", 4, "MaxNumberOfBounces:=", 5)

Analysis Setup Module Script Commands 15-32


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oModule.InsertFrequencySweep "Setup1", Array("NAME:Sweep", "IsEn-


abled:=", true, "RangeType:=", _
"LinearCount", "RangeStart:=", "2GHz", "RangeEnd:=", "20GHz",
"RangeCount:=", _
451, "Type:=", "Interpolating", "SaveFields:=", false, "SaveRadField-
s:=", _
false, "InterpTolerance:=", 0.5, "InterpMaxSolns:=", 250, "Inter-
pMinSolns:=", _
0, "InterpMinSubranges:=", 1, "ExtrapToDC:=", false, "InterpUseS:=",
true, "InterpUsePortImped:=", _
false, "InterpUsePropConst:=", true, "UseDerivativeConvergence:=",
false, "InterpDerivTolerance:=", _
0.2, "UseFullBasis:=", true, "EnforcePassivity:=", true, "Passiv-
ityErrorTolerance:=", _
0.0001)

Python Syn- InsertSetup("HfssDrivenAuto", [<parameters>])


tax

oModule.InsertSetup("HfssDrivenAuto",
[
"NAME:Setup1",
"IsEnabled:=" , True,
"AutoSolverSetting:=" , "Balanced",
[
"NAME:Sweeps",
Python
[
Example
"NAME:Sweep",
"RangeType:=" , "LinearStep",
"RangeStart:=" , "1GHz",
"RangeEnd:=" , "10GHz",
"RangeStep:=" , "1GHz"
]
],

Analysis Setup Module Script Commands 15-33


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,
"Type:=" , "Discrete"
])

Python Syn- InsertSetup("HfssDriven", [<parameters>])


tax

oModule.InsertSetup("HfssDriven",
[ "NAME:Setup2",
"AdaptMultipleFreqs:=" , False,
"Frequency:=" , "5GHz",
"MaxDeltaS:=" , 0.02,
"PortsOnly:=" , False,
"UseMatrixConv:=" , False,
"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,
Python "SetPortMinMaxTri:=" , False,
Example "UseDomains:=" , True,
"UseIterativeSolver:=" , False, "IterativeResidual:=" ,
1E-06,
"DDMSolverResidual:=" , 0.0001,
"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 ])

For Q3D Extractor, the command details are as follows:


Use: Adds a new solution setup.
Command: Q3D Extractor>Analysis Setup>Add Solution Setup

Analysis Setup Module Script Commands 15-34


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syntax: InsertSetup "Matrix", Array ("NAME:<SetupName>", "Enabled:=", <Enabled>, "Adapt-


iveFreq:=", <AdaptFreq>, <SolveParam>)
Return Value: None
Parameters: <SetupName>
Type: <string>
Name of the setup.
<SaveFields>
Type: <string>
Flag to indicate whether the fields are saved for last adaptive
solution. (True or False).
<Enabled>
Type: <bool>
Flag to indicate whether the setup is enabled.
<AdaptFreq>
Type: <String>
Frequency with units.
<SolverParam>
Array("NAME:Cap", "Residual:=", <Residual>, <AdaptParam>),
Array("NAME:DC", "Residual:=", <Residual>, "SolveResOnly:=",
<SolveResOnly>, Array("NAME:Cond", <AdaptParam>), Array("NAME:Mult",

<AdaptParam>)),
Array("NAME:AC", "Residual:=", 1E-005, Array("NAME:Cond",
<AdaptParam>), Array("NAME:Mult", <AdaptParam>))
Parameters:
<ACFreq>
Type: <string>
Frequency of the AC solution.
<Residual>
Type: <double>
Solver residual.
<SolveResOnly>

Analysis Setup Module Script Commands 15-35


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Type: <bool>
Solve resistance only for a DC solution.
<AdaptParam>
"MaxPass:=", <MaxPass>, "PerError:=", <PerError>,
"PerRefine:=", <PerRefine>
Parameters:
<MaxPass>
Type: <int>
Maximum pass for a solution
<PerError>
Type: <double>
Percentage error as stopping criteria.
<PerRefine>
Type: <double>
Mesh refinement at each pass in percentage.
VB Example:
oModule.InsertSetup "Matrix", Array("NAME:Setup1", "AdaptiveFreq:=",
"1GHz", "EnableDistribProbTypeOption:=", _ false, "SaveFields:=",
"true", "Enabled:=", true, Array("NAME:Cap", "MaxPass:=", 10,
"MinPass:=", 1, "MinConvPass:=", _ 1, "PerError:=", 1, "Per-
Refine:=", 30, "AutoIncreaseSolutionOrder:=", false, "Solu-
tionOrder:=", _ "Normal"), Array("NAME:DC", "Residual:=", 1E-005,
"SolveResOnly:=", _ false, Array("NAME:Cond", "MaxPass:=", 10,
"MinPass:=", 1, "MinConvPass:=", 1, "PerError:=", _ 1, "Per-
Refine:=", 30), Array("NAME:Mult", "MaxPass:=", 1, "MinPass:=", 1,
"MinConvPass:=", _ 1, "PerError:=", 1, "PerRefine:=", 30)), Array
("NAME:AC", "MaxPass:=", 10, "MinPass:=", _ 1, "MinConvPass:=", 1,
"PerError:=", 1, "PerRefine:=", 30))

InsertSetup [HFSS-IE]
Adds a new HFSS-IE solution setup.
Command: HFSS>Analysis Setup>Add Solution Setup
Syntax: InsertSetup <SetupType>, <AttributesArray> [<AdditionalSetups>]
Return Value: None

Analysis Setup Module Script Commands 15-36


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Parameters: <SetupType>
Type: <string>
"HFIESetup". Must match the HFSS solution type.

<AttributesArray>
Array("NAME:<SetupName>", <Named Parameters>)

<Named Parameters>
The named parameters will vary according to the solution type. To see the required para-
meters for a specific set of parameters and their format, use the record script function,
and view the resulting script in a text edtor. See the HFSS-IE example below.
<additionalRanges>
Array( "SetupType:=", "<SetupType>",
"StartValue:=", "<ValueUnits>",
"StopValue:=", "<ValueUnits", "Count:=", <value>, ...)

VB Example:
oModule.InsertSetup "HFIESetup", Array("NAME:Setup3",
"MaximumPasses:=", 6,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"Enabled:=", true,
"AdaptiveFreq:=", "1GHz",
"DoLambdaRefine:=", true,
"UseDefaultLambdaTarget:=", true,
"Target:=", 0.25,
"DoMaterialLambda:=", true,
"MaxDeltaS:=", 0.02,
"MaxDeltaE:=", 0.1,
"UsePOSolver:=", true)

InsertSetup [Transient]
Add a new solution setup to a Transient design
Command: HFSS>Analysis Setup>Add Solution Setup

Analysis Setup Module Script Commands 15-37


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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. 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 parameters and their
format, use the record script function, and view the resulting script in a text editor.

The first part of a vbs script corresponds to the fields and selections on the General tab:
Set oModule = oDesign.GetModule("AnalysisSetup")

Analysis Setup Module Script Commands 15-38


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oModule.InsertSetup "HfssTransient", Array("NAME:Setup1", "Fre-


quency:=", "5GHz", "MaxDeltaE:=", 0.1, _"MaximumPasses:=", 6, "UseIm-
plicitSolver:=", true, "IsEnabled:=", true,
The next parameters correspond to fields and selections on the Saved Fields tab:

Array("NAME:Transient", "ListsForFields:=", Array("integ-


rationloops", "groundplane"), _
"UseSaveCount:=", 1, "SaveCount:=", 256, _
"UseSaveStart:=", 1, "SaveStart:=", "0s", _
"UseSaveDelta:=", 1, "SaveDelta:=", "10ps", _
"SaveRadFields:=", 0, "SaveFDRadFields:=", 0, _
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.

Analysis Setup Module Script Commands 15-39


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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 Network Analysis solution
type includes the Input Signal tab.

Analysis Setup Module Script Commands 15-40


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

The vbs script for this setup includes parameters for this information.
Array("NAME:Transient", "TimeProfile:=", "Broadband Pulse", "HfssFre-
quency:=", "5GHz",
"MinFreq:=", "100MHz", "MaxFreq:=", "1GHz",
"NumFreqsExtracted:=", 401,
"SweepMinFreq:=", "100MHz", "SweepMaxFreq:=", "1GHz",
To see the parameters for a specific Setup and their format, use the record script func-
tion, 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"))

VB Example: Transient Network Solution Type


' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2019.1.0
' 11:05:31 Oct 31, 2018
' ----------------------------------------------

Analysis Setup Module Script Commands 15-41


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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("transient")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup "HfssTransient", Array("NAME:Setup1", "Fre-
quency:=", "5GHz", "MaxDeltaS:=", _
0.02, "MaximumPasses:=", 20, "UseImplicitSolver:=", true, "IsEn-
abled:=", true, "BasisOrder:=", _
-1, Array("NAME:Transient", "TimeProfile:=", "Broadband Pulse",
"HfssFrequency:=", _
"5GHz", "MinFreq:=", "100MHz", "MaxFreq:=", "1GHz", "NumFre-
qsExtracted:=", 401, "SweepMinFreq:=", _
"100MHz", "SweepMaxFreq:=", "1GHz", "ListsForFields:=", Array("Facel-
ist1"), "UseSaveCount:=", _
1, "SaveCount:=", 256, "UseSaveStart:=", 1, "SaveStart:=", "0s",
"UseSaveDelta:=", _
1, "SaveDelta:=", "10ps", "SaveRadFields:=", 0, "SaveFDRadFields:=",
0, "UseAutoTermination:=", _
1, "SteadyStateCriteria:=", 0.01, "UseMinimumDuration:=", 0, "Ter-
minateOnMaximum:=", _
1, "UseMaxTime:=", 1, "MaxTime:=", "20ns"))

Python Syn- InsertSetup("HfssTransient", [<parameters>])


tax

oModule.InsertSetup("HfssTransient",
Python
Example [ "NAME:Setup2", "Frequency:=" , "5GHz",

Analysis Setup Module Script Commands 15-42


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"MaxDeltaS:=" , 0.02, "MaximumPasses:=" , 20, "UseIm-


plicitSolver:=" , True, "IsEnabled:=" , True, "Bas-
isOrder:=" , -1, [
"NAME:Transient", "TimeProfile:=" , "Broadband
Pulse", "HfssFrequency:=" , "5GHz", "MinFreq:=" ,
"100MHz", "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, "UseMinimumDuration:=" , 0, "Ter-
minateOnMaximum:=" , 0 ]
])

InsertSweep [HFSS-IE]
Adds a frequency sweep to a Driven solution-type setup in HFSS-IE.
Command: HFSS-IE>Analysis Setup>Add Sweep
Syntax: InsertSweep <SetupName>, <AttributesArray>
Return Value: None
Parameters: <SetupName>
Type: <string>
Name of the solution setup into which the sweep will be inserted.

<Attributes Array>
Array("NAME:<SweepName>",
"IsEnabled:=", true,
"SetupType:=", <SetupType>,
"Type:=", <SweepType>,
<FrequencyInformation>,
<SaveFieldsList>
<DCExtrapInfo>)

<SweepType>

Analysis Setup Module Script Commands 15-43


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Type: <string>
Ex. "Discrete", "Fast", or "Interpolating".

<SetupType>
Type: <string>
Ex. "LinearSetup", "LinearCount", or "SinglePoints".

<FrequencyInformation>
This will vary based on the sweep and solution type. See the examples below.

<DCExtrapInfo>
Information about whether and how to perform DC extrapolation. This parameter is not
used for Discrete sweeps. See the examples below.
<additionalRanges>
Array( "SetupType:=", "<SetupType>",
"StartValue:=", "<ValueUnits>",
"StopValue:=", "<ValueUnits", "Count:=", <value>, ...)

VB Example: Discrete Sweep

oModule.InsertSweep "Setup1", Array("NAME:Sweep2", _


"IsEnabled:=", true,
"SetupType:=", "LinearStep", _
"StartValue:=", "19.5GHz", _
"StopValue:=", "20.4GHz", _
"StepSize:=", "0.1GHz", _
"Type:=", "Discrete", _
"SaveFields:=", false, "ExtrapToDC:=", false)

VB Example: Fast Sweep

Analysis Setup Module Script Commands 15-44


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oModule.InsertSweep "Setup1", Array("NAME:Sweep4", _


"IsEnabled:=", true,
"SetupType:=", "LinearStep", _
"StartValue:=", "0GHz", _
"StopValue:=", "20.4GHz", _
"StepSize:=", "0.1GHz", _
"Type:=", "Fast", "SaveFields:=", true, _
"ExtrapToDC:=", true, _
"MinSolvedFreq:=", "0.1GHz")

VB Example: Interpolating Sweep

oModule.InsertSweep "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)

VB Example: Discrete sweeps with linear step and log scale:

oModule.InsertSweep "Setup1", Array("NAME:Sweep2", _

Analysis Setup Module Script Commands 15-45


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"IsEnabled:=", true,
"SetupType:=", "LinearStep", _
"StartValue:=", "0.005GHz", _
"StopValue:=", "2.5GHz", _
"StepSize:=", "0.005GHz", _
"Type:=", "Discrete", "SaveFields:=", false, _
"ExtrapToDC:=", false)

oModule.InsertSweep "Setup1", Array("NAME:Sweep3", _


"IsEnabled:=", true, "SetupType:=", "LogScale", _
"StartValue:=", "1GHz", _
"StopValue:=", "10GHz", _
"SamplesPerDecade:=", 4, _
"Type:=", "Discrete", _
"SaveFields:=", false, "ExtrapToDC:=", false)

VB Example: A Fast sweep, specified using the starting and stopping


frequencies and the step count:
oModule.InsertSweep "Setup1", Array("NAME:Sweep4", _
"IsEnabled:=", true, "SetupType:=", "LinearCount", _
"StartValue:=", "1GHz", _
"StopValue:=", "10GHz", _
"Count:=", 3, _
"Type:=", "Fast", _
"SaveFields:=", true, "ExtrapToDC:=", false)

PasteSetup
Use: Paste a solve setup.
Syntax: PasteSetup
Return Value: None

Analysis Setup Module Script Commands 15-46


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Example: oModule.PasteSetup

PasteSweep
Use: Paste a sweep.
Syntax: PasteSweep <SetupName>
Return Value: None
Parameters: <SetupName>
Type: <String>
Name of solve setup where the copied sweep is pasted.
VB Example: oModule.PasteSweep "Setup6"

RenameDrivenSweep
Use: Renames an existing frequency sweep in HFSS. For HFSS-IE use RenameSweep.
Command: Right-click a frequency sweep in the project tree, and then click Rename on the short-
cut menu.
Syntax: RenameDrivenSweep <SetupName>, <OldSweepName>,
<NewSweepName>
Return Value: None
VB Example:
oModule.RenameDrivenSweep "Setup1", "Sweep1", _
"MySweep"

RenameSetup
Use: Renames an existing solution setup.
Command: Right-click a solution setup in the project tree, and then click Rename on the shortcut
menu.
Syntax: RenameSetup <OldName>, <NewName>
Return Value: None
Parameters: <OldName>
Type: <string>

Analysis Setup Module Script Commands 15-47


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Name of the solution setup being renamed.

<NewName>
Type: <string>
New name for the solution setup.
VB Example: oModule.RenameSetup "Setup1", "Setup2"

RenameSweep [HFSS-IE]
Use: Renames an existing frequency sweep in HFSS-IE.
Command: Right-click a frequency sweep in the project tree, and then click Rename on the short-
cut menu.
Syntax: RenameSweep <SetupName>, <OldSweepName>,
<NewSweepName>
Return Value: None
VB Example:
oModule.RenameSweep "Setup1", "Sweep1", _
"MySweep"

For Q3D Extractor, the command details are as follows:


Use: Rename an existing sweep.
Command: Right-click a sweep in the project tree, and then click Rename on the shortcut menu.
Syntax: RenameSweep <SetupName>, <OldSweepName>, <NewSweepName>
Return Value: None
Parameters: <SetupName>
Type: <string>
Name of the setup.
<OldSweepName>
Type: <String>
Name of sweep to be renamed.
<NewSweepName>

Analysis Setup Module Script Commands 15-48


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Type: <string>
New name for the sweep.
VB Example: oModule.RenameSweep "Setup6", "Sweep3", "NewSweep"

RevertAllToInitial
Use: Marks the current mesh for all solution setups as invalid. This will force the next simulation to
begin with the initial mesh.
Command: [product]>Analysis Setup>Revert to Initial Mesh
Syntax: RevertAllToInitial
Return Value: None
For Q3D Extractor and 2D Extractor, the command details are as follows:
Use: Marks the current mesh for all solution setups as invalid. This will force the next simulation to
begin with the initial mesh.
Command: Q3D Extractor or 2D Extractor>Analysis Setup>Revert to Initial Mesh
Syntax: RevertAllToInitial
Return Value: None
VB Example: oModule.RevertAllToInitial

RevertSetupToInitial
Use: Marks the current mesh for a solution setup as invalid. This will force the next simulation to
begin with the initial mesh.
Command: Right-click a setup in the project tree, and then click Revert to Initial Mesh on the
shortcut menu.
Syntax: RevertSetupToInitial <SetupName>
Return Value: None
Parameters: <SetupName>
The name of the solution setup you want to revert to.
VB Example: oModule.RevertSetupToInitial "Setup1"

SetMPIVendor
The documented command is applicable for Q3D Extractor.

Analysis Setup Module Script Commands 15-49


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Use:Specify vendor name.


Syntax:SetMPIVendor <vendorname>, <product name>
Return Value:None
Parameters:<vendorname>
Type: <String>
Name of MPI vendor. Possible values are "Intel", "Plat-
formComputing"
<product name>
Type: <String>
Valid value is "Q3D Extractor". It is optional input, if not spe-
cified the default value is "Q3D Extractor"
oAnsoftApp.SetMPIVendor "Intel", "Q3D Extractor"

Analysis Setup Module Script Commands 15-50


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

16 - 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>
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>:=",

Optimetrics Module Script Commands 16-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<VarValue>, .... "<VarName>:=", <VarValue>)


<SaveField>
Type: <bool>
Specifies whether HFSS will remove the non-nominal field solution.
<MaxIter>
Type: <int>
Maximum iteration allowed in an analysis.
<PriorSetup>
Type: <string>
The name of the embedded parametric setup.
<Precede>
Type: <bool>
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>

Optimetrics Module Script Commands 16-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Type: <double>
Inequality value.
<OptiGoalSpec>
"Solution:=", <Soln>, "Calculation:=", <Calc>,
"Context:=, <Geometry>
Array("NAME:Ranges",
"Range:", Array("Var:=",
<VarName>, "Type:=", <RangeType>, "Start:=",
<StartV>, "Stop:=", <StopV>), ...
"Range:", Array("Var:=", <VarName>, "Type:=",
<RangeType>, "Start:=", <StartV>, "Stop:=",
<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>.
<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.

Optimetrics Module Script Commands 16-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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

General Commands Recognized by the Optimetrics Module


Following are general script commands recognized by the Optimetricsmodule:
CopySetup
DeleteSetups (Optimetrics)
DistrbutedAnalyzeSetup
ExportDXConfigFile
ExportOptimetricsProfile
ExportOptimetricsResult
ExportParametricResults
GetSetupNames (Optimetrics)
GetSetupNamesByType (Optimetrics)
ImportSetup
PasteSetup
RenameSetup (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

Optimetrics Module Script Commands 16-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Syn- CopySetup (<SetupName>)


tax

Python oModule.CopySetup ("OptimizationSetup1")


Example

VB Syntax CopySetup <SetupName>


VB oModule.CopySetup "OptimizationSetup1"
Example

DeleteSetups [Optimetrics]
Deletes the specified Optimetrics setups.

Right-click the setup in the project tree, and then click Delete on the shortcut
UI Access
menu

Name Type Description


Parameters <NameArray> Array of An Array of Setup Names
Strings

Return Value None

Python Syn- DeleteSetups (<NameArray>)


tax

Python oModule.DeleteSetups (["OptimizationSetup1"])


Example

VB Syntax DeleteSetups <NameArray>


VB oModule.DeleteSetups Array("OptimizationSetup1")
Example

DistributedAnalyzeSetup
Distributes all variable value instances within a parametric sweep to different machines already spe-
cified from within the user interface

Right-click the parametric setup name in the project tree and select Distribute
UI Access
Analysis.

Optimetrics Module Script Commands 16-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Name Type Description


Parameters
 <ParametricSetupName> String Name of the Setup

Return Value None

Python DistributedAnalyzeSetup (<ParametricSetupName>)


Syntax

Python oModule.DistributedAnalyzeSetup("ParametricSetup1")
Example

VB Syn- DistributedAnalyzeSetup <ParametricSetupName>


tax

VB oModule.DistributedAnalyzeSetup "ParametricSetup1"
Example

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
UI Access
External Connector Addin Configuration…

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

Python ExportDXConfigFile (<SetupName>, <FileName>)


Syntax

oModule.ExportDXConfigFile ("DesignXplorerSetup1",
Python
Example "c:/exportdir/DXSetup1.xml")

VB Syn- ExportDXConfigFile <SetupName>, <FileName>


tax

Optimetrics Module Script Commands 16-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB
oModule.ExportDXConfigFile ("DesignXplorerSetup1",
Example "c:/exportdir/DXSetup1.xml")

ExportOptimetricsProfile
Export Optimetrics profile data

Right click on the Optimetrics setup in the project tree and choose View Ana-
UI Access lysis Result… On the Post Analysis Display dialog, click the Profile tab and
click on the Export button.

Name Type Description


<SetupName> String Must be one of the existing Parametric, Optim-
ization, Sensitivity, Statistical or
DesignXplorer setup names
Parameters <FileName> String Must be a valid file path and name with exten-
sion 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

Python ExportOptimetricsProfile (<SetupName>, <FileName>, [profileNum]


Syntax

oModule.ExportOptimetricsProfile
Python
Example ("StatisticalSetup1", "

VB Syntax ExportOptimetricsProfile <SetupName>, <FileName>, [profileNum]

VB oModule.ExportOptimetricsProfile
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
UI Access Analysis Result… On the Post Analysis Display dialog, click the Result tab,
then select Table view, and click on the Export button

Optimetrics Module Script Commands 16-7


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 val-
ues will be printed with units. This parameter
is ignored for Optimization and Statistical res-
ults.

Return Value None

Python ExportOptimetricsResult (<SetupName>, <FileName>, [useFullOutputName])


Syntax

Python oModule.ExportOptimetricsResult (
Example "StatisticalSetup1", "c:/exportdir/test.csv",false)

VB ExportOptimetricsResult <SetupName>, <FileName>, [useFullOutputName]


Syn-
tax

VB oModule.ExportOptimetricsResult "StatisticalSetup1", "c:/-


Exam- exportdir/test.csv",
ple false

ExportParametricResults
Export existing Parametric results.

Right click on the desired Parametric setup in the project tree and choose View
UI Access Analysis Result… On the Post Analysis Display dialog, 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 exten-
sion of csv, tab, dat or txt
<bOutputUnits> Boolean If set to true, values will be printed with units

Return Value None

Optimetrics Module Script Commands 16-8


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python ExportParametricResults (<SetupName>, <FileName>, <bOutputUnits>)


Syntax

Python oModule.ExportParametricResults (
Example "ParametricSetup1", "c:/exportdir/test.csv", False)

VB Syntax ExportParametricResults <SetupName>, <FileName>, <bOutputUnits>

VB oModule.ExportParametricResults
Example "ParametricSetup1", "c:/exportdir/test.csv",false

GetSetupNames [Optimetrics]
Gets a list of Optimetrics setup names

UI Access NA

Name Type Description


Parameters
None

Return Value Collection of Optimetrics setup names

Python Syn- GetSetupNames()


tax

oModule = oDesign.GetModule("Optimetrics")
Python
Example setupNames = oModule.GetSetupNames()

VB Syntax GetSetupNames()

VB
Set oModule = oDesign.GetModule("Optimetrics")
Example setupNames = oModule.GetSetupNames()

GetSetupNamesByType [Optimetrics]
Gets a list of Optimetrics setup names by type.

UI Access NA

Optimetrics Module Script Commands 16-9


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Name Type Description


Parameters <Optimetrics type> String Examples: parametric, optimization, stat-
istical, sensitivity

Return Value  Array of Optimetrics setup names of the given type.

Python GetSetupNamesByType (<Optimetrics type>)


Syntax

for name in oModule.GetSetupNamesByType("optimization")


Python
Example AddInfoMessage(str(name))

VB Syn- GetSetupNamesByType <Optimetrics type>


tax

For each name in oModule.GetSetupNamesByType("optim-


VB ization")
Exampl-
Msgbox name
e
Next

ImportSetup
Import an Optimetric setup from a file.

UI Access NA

Name Type Description


<SetupTypeName> String Must be one of "OptiParametric" , "OptiOp-
timization", "OptiSensitivity", "OptiStatistical",
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 16-10


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Return Value None

Python Syn- ImportSetup (<SetupTypeName>, <SetupInfo>)


tax

oModule.ImportSetup ("OptiStatistical",
Python ["NAME:StatisticalSetup1",
Example
"c:/importdir/mySetupInfoFile"])

VB Syntax ImportSetup <SetupTypeName>, <SetupInfo>


oModule.ImportSetup "OptiStatistical",
VB Array("NAME:StatisticalSetup1",
Example

"c:/importdir/mySetupInfoFile")

PasteSetup [Optimetrics]
Pastes the specified Optimetrics setup.

UI Access NA

Name Type Description


Parameters
<SetupName> String Name of the Setup

Return Value None

Python Syn- PasteSetup (<SetupName>)


tax

Python oModule.PasteSetup ("OptimizationSetup1")


Example

VB Syntax PasteSetup <SetupName>


VB oModule.PasteSetup "OptimizationSetup1"
Example

Optimetrics Module Script Commands 16-11


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

RenameSetup [Optimetrics]
Renames the specified Optimetrics setup.

Right-click the setup in the project tree, and then click Rename on the
UI Access
shortcut menu.

Name Type Description


Parameters <OldName> String The name that needs to be replaced
<NewName> String Replacement name

Return Value None

Python RenameSetup (<OldName> <NewName>)


Syntax

Python oModule.RenameSetup ("OptimizationSetup1" "MyOptimization")


Example

VB Syn- RenameSetup <OldName> <NewName>


tax

VB oModule.RenameSetup "OptimizationSetup1" "MyOptimization"


Example

SolveAllSetup
Solves all Optimetrics setups

 Right-click on Optimetrics in Project Manager and select Analyze>All from


UI Access
context menu

Name Type Description


Parameters
None

Return Value None

Python Syn- SolveAllSetup()


tax

Python oModule.SolveAllSetup()
Example

Optimetrics Module Script Commands 16-12


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Syntax SolveAllSetup
VB Example oModule.SolveAllSetup

SolveSetup [Optimetrics]
 Solves the specified Optimetrics setup.

Right-click the setup in the project tree, and then click Analyze on the shortcut
UI Access
menu.

Name Type Description


Parameters
<SetupName> String Name of the setup to be solved

Return Value None

Python Syn- SolveSetup (<SetupName>)


tax

Python oModule.SolveSetup ("OptimizationSetup1")


Example

VB Syntax SolveSetup <SetupName>


VB oModule.SolveSetup "OptimizationSetup1"
Example

Parametric Script Commands


EditSetup [Parametric]
GenerateVariationData [Parametric]
InsertSetup [Parametric]
EditSetup [Parametric]
Modifies an existing parametric setup

Right-click the setup in the project tree, and then click Properties on the short-
UI Access
cut menu.

Name Type Description


Parameters <SetupName> String Name of the Setup

Return Value None

Optimetrics Module Script Commands 16-13


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Syn- EditSetup (<SetupName>, <ParametricParams>)


tax

Python See EditSetup [Optimization]


Example

VB Syntax EditSetup <SetupName>, <ParametricParams>


VB Example See EditSetup [Optimization]

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.

Right-click the Optimetrics folder in the project tree, and then click Add> Para-
UI Access
metric on the shortcut menu.

Name Type Description


<Parametric Array Array("NAME:<SetupName>", "SaveField-
Params> s:=",
<SaveField>, <StartingPoint>, "Sim.
Setups:=",
Parameters
<SimSetups>,
<SweepDefs>, <SweepOps>,
Array("NAME:Goals", Array("NAME:Goal",
<OptiGoalSpec>), ... Array("NAME:Goal",

Optimetrics Module Script Commands 16-14


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<OptiGoalSpec>))
<SetupName> String Name of the parametric setup.
<SimSetups> Array of An array of Twin Builder solution setup
Strings names.
<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 syn-
chronized.
<SweepOps> Array("NAME:Sweep Operations",
"<OpType>:=,
Array(<VarValue>, …, <VarValue>), ...
<OpType>:=, Array(<VarValue>, …,
<VarValue>))
<OpType> String The sweep operation type.

Return Value None

Python Syn- InsertSetup ("OptiParametric", <ParametricParams>)


tax

oModule.InsertSetup(
"OptiParametric",
["NAME:ParametricSetup1", _
Python
"SaveFields:=", true, _
Example
["NAME:StartingPoint"], _
"Sim. Setups:=", ["Setup1"],_
["NAME:Sweeps", _

Optimetrics Module Script Commands 16-15


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

["NAME:SweepDefinition", _
"Variable:=", "$width", _
"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", _
["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>

Optimetrics Module Script Commands 16-16


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oModule.InsertSetup
"OptiParametric",
Array("NAME:ParametricSetup1", _
"SaveFields:=", true, _
Array("NAME:StartingPoint"), _
"Sim. Setups:=", Array("Setup1"),_
Array("NAME:Sweeps", _
Array("NAME:SweepDefinition", _
"Variable:=", "$width", _
"Data:=", "LIN 12mm 17mm 2.5mm", _
"OffsetF1:=", false, _
"Synchronize:=", 0),
Array("NAME:SweepDefinition", _
"Variable:=", "$length", _
VB
"Data:=", "LIN 8mm 12mm 2mm", _
Example
"OffsetF1:=", false, _
"Synchronize:=", 0)),
Array("NAME:Sweep Operations"), _
Array("NAME:Goals", _
Array("NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "returnloss", _
"Context:=", "",_
Array("NAME:Ranges", _
"Range:=", Array("Var:=", "Freq", "Type:=","s", _
"Start:=", "8GHz", "Stop:=", "8GHz"))), _
Array("NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect", _

Optimetrics Module Script Commands 16-17


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Context:=", "", _
Array("NAME:Ranges", _
"Range:=", Array("Var:=", "Freq", "Type:=","s", _
"Start:=", "8GHz", "Stop:=", "8GHz")))))

Optimization Script Commands


EditSetup [Optimization]
InsertSetup [Optimization]
EditSetup [Optimization]
Modifies an existing optimization setup.

Right-click the setup in the project tree, and then click Properties on the shortcut
UI Access
menu

Name Type Description


Parameters <SetupName> String Name of the Setup

Return Value None

Python EditSetup (<SetupName>, <OptimizationParams>)


Syntax

oModule.EditSetup("OptimizationSetup1",
[
"NAME:OptimizationSetup1",
"UseFastCalculationUpdateAlgo:=", False,
"FastCalcOptCtrledByUser:=", False,
Python "IsEnabled:=", True,
Example
"SaveSolutions:=", False,
[
"NAME:StartingPoint"
],
"Optimizer:=", "Quasi Newton",

Optimetrics Module Script Commands 16-18


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

[
"NAME:AnalysisStopOptions",
"StopForNumIteration:=" , True,
"StopForElapsTime:=", False,
"StopForSlowImprovement:=", False,
"StopForGrdTolerance:=", False,
"MaxNumIteration:=",1000,
"MaxSolTimeInSec:=",3600,
"RelGradientTolerance:=", 0,
"MinNumIteration:=", 10
],
"CostFuncNormType:=", "L2",
"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 16-19


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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,
"UpdateDesignWhenDone:=", True
])

VB EditSetup <SetupName>, <OptimizationParams>


Syn-
tax

Optimetrics Module Script Commands 16-20


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oModule.EditSetup "OptimizationSetup1",
Array("NAME:OptimizationSetup1", "UseFastCal-
culationUpdateAlgo:=", _
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:=", 1000, "MaxSolTimeInSec:=",
3600, "RelGradientTolerance:=", _
0, "MinNumIteration:=", 10), "CostFuncNormType:=",
"L2", "PriorPSetup:=", "", "PreSolvePSetup:=", _
VB true, Array("NAME:Variables"), Array("NAME:LCS"),
Exam-
ple Array("NAME:Goals", Array("NAME:Goal", "ReportType:=", _
"Standard", "Solution:=", "TR", Array("NAME:SimValueCon-
text",
"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)

Optimetrics Module Script Commands 16-21


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

InsertSetup [Optimization]
Use: Inserts a new optimization setup.

Right-click the Optimetrics folder in the project tree, and then click Add>Op-
UI Access
timization on the shortcut menu.

Name Type Description


<OptimizationParams> Array Array("NAME:<SetupName>",
"SaveFields:=",
<SaveField>, <StartingPoint>, "Optim-
izer:=",
<Optimizer>,
"MaxIterations:=", <MaxIter>, "Pri-
orPSetup:=",
<PriorSetup>, "PreSolvePSetup:=",
<Preceed>,
<OptimizationVars>, <Constraint>,
Array("NAME:Goals", Array
("NAME:Goal",
<OptiGoalSpec>, <Optim-
izationGoalSpec>), ...

Parameters Array("NAME:Goal", <OptiGoalSpec>,


<OptimizationGoalSpec>)),
"Acceptable_Cost:=", <Accept-
ableCost>, "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>,

Optimetrics Module Script Commands 16-22


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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 optim-
izer 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:=", <Optim-
izationCond>,
Array("NAME:GoalValue",
"GoalValeType:=",
<GoalValueType>,
"Format:=",
<GoalValueFormat>, "bG:=",
Array("v:=", <GoalValue>)),
"Weight:=", <Weight>)
<OptimizationCond> String Either "<=", "==", or ">="
<GoalValueType> String Either "Independent" or "Depend-
ent"
<GoalValueFormat> String Either "Real/Imag" or "Mag/Ang".
<GoalValue> String Value in string. Value can be a real num-
ber, complex number, or expression.

Return None
Value

Command: Right-click the Optimetrics folder in the project tree, and then click Add>Op-
timization 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>,

Optimetrics Module Script Commands 16-23


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:Goals", Array("NAME:Goal",
<OptiGoalSpec>, <OptimizationGoalSpec>), ...
Array("NAME:Goal", <OptiGoalSpec>,
<OptimizationGoalSpec>)),
"Acceptable_Cost:=", <AcceptableCost>, "Noise:=",
<Noise>, "UpdateDesignWhenDone:=", <UpdateDesign"

<OptimizationVars>
Array("NAME:Variables", "VarName:=", Array("i:=",
<IncludeVar>, "Min:=", <MinV>, "Max:=", <MaxV>,
"MinStep:=", <MinStepV>, "MaxStep:=", <MaxStepV>),
………………. "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.

<Noise>
Type: <double>
The noise of the design.

Optimetrics Module Script Commands 16-24


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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>
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",_

Optimetrics Module Script Commands 16-25


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:OptimizationSetup1", _
"SaveFields:=", false, _
Array("NAME:StartingPoint", "$length:=", "8mm", _
"$width:=", "14.5mm"), _
"Optimizer:=", "Quasi Newton", _
"MaxIterations:=", 100, _
"PriorPSetup:=", "ParametricSetup1", _
"PreSolvePSetup:=", true, _
Array("NAME:Variables", _
"$length:=", Array("i:=", true, "Min:=", "6mm", _
"Max:=", "18mm", _
"MinStep:=", "0.001mm", "MaxStep:=", _
"1.2mm"), _
"$width:=", Array("i:=", true, "Min:=", _
"6.5mm", "Max:=", "19.5mm", _
"MinStep:=", "0.001mm", "MaxStep:=", _
"1.3mm")), _
Array("NAME:LCS"), _
Array("NAME:Goals", _
Array("NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "reflect", _
"Context:=", "", _
Array("NAME:Ranges", _
"Range:=", Array("Var:=", "Freq", _
"Type:=", "s", _
"Start:=", "8GHz", "Stop:=", "8GHz")), _
"Condition:=", "<=", _
Array("NAME:GoalValue", _
"GoalValueType:=", "Independent", _

Optimetrics Module Script Commands 16-26


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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 Syn- InsertSetup ("OptiOptimization", <OptimizationParams>)


tax

oModule.InsertSetup(
"OptiOptimization",_
["NAME:OptimizationSetup1", _
"SaveFields:=", false, _
["NAME:StartingPoint", "$length:=", "8mm",_
"$width:=", "14.5mm"], _
"Optimizer:=", "Quasi Newton", _
"MaxIterations:=", 100, _
Python
"PriorPSetup:=", "ParametricSetup1", _
Example
"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", _

Optimetrics Module Script Commands 16-27


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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", _
"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>

VB
oModule.InsertSetup
Example "OptiOptimization",_

Optimetrics Module Script Commands 16-28


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:OptimizationSetup1", _
"SaveFields:=", false, _
Array("NAME:StartingPoint", "$length:=", "8mm",_
"$width:=", "14.5mm"), _
"Optimizer:=", "Quasi Newton", _
"MaxIterations:=", 100, _
"PriorPSetup:=", "ParametricSetup1", _
"PreSolvePSetup:=", true, _
Array("NAME:Variables", _
"$length:=", Array("i:=", true, "Min:=", "6mm",_
"Max:=", "18mm", _
"MinStep:=", "0.001mm", "MaxStep:=", _
"1.2mm"), _
"$width:=", Array("i:=", true, "Min:=", _
"6.5mm", "Max:=", "19.5mm", _
"MinStep:=", "0.001mm", "MaxStep:=", _
"1.3mm")), _
Array("NAME:LCS"), _
Array("NAME:Goals", _
Array("NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "reflect", _
"Context:=", "", _
Array("NAME:Ranges", _
"Range:=", Array("Var:=", "Freq", _
"Type:=", "s", _
"Start:=", "8GHz", "Stop:=", "8GHz")), _
"Condition:=", "&lt;=", _
Array("NAME:GoalValue", _

Optimetrics Module Script Commands 16-29


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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]
InsertSetup [Sensitivity]
EditSetup [Sensitivity]
Modifies an existing sensitivity setup.

Right-click the setup in the project tree, and then click Properties on the shortcut
UI Access
menu

Name Type Description


Parameters <SetupName> String Name of the Setup

Return Value None

Python EditSetup (<SetupName>, <SensitivityParams>)


Syntax

oModule.EditSetup("OptimizationSetup1",
[
Python
Exampl- "NAME:OptimizationSetup1",
e
"UseFastCalculationUpdateAlgo:=", False,
"FastCalcOptCtrledByUser:=", False,

Optimetrics Module Script Commands 16-30


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"IsEnabled:=", True,
"SaveSolutions:=", False,
[
"NAME:StartingPoint"
],
"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"
],
[
"NAME:LCS"
],
[
"NAME:Goals",
[

Optimetrics Module Script Commands 16-31


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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:=", "==",
[
"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 16-32


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"UpdateDesignWhenDone:=", True
])

VB Syntax EditSetup <SetupName>, <SensitivityParams>


oModule.EditSetup("OptimizationSetup1",
Array(
"NAME:OptimizationSetup1",
"UseFastCalculationUpdateAlgo:=", False,
"FastCalcOptCtrledByUser:=", False,
"IsEnabled:=", True,
"SaveSolutions:=", False,
Array(
"NAME:StartingPoint"
),
"Optimizer:=", "Quasi Newton",
Array(
VB
Example "NAME:AnalysisStopOptions",
"StopForNumIteration:=" , True,
"StopForElapsTime:=", False,
"StopForSlowImprovement:=", False,
"StopForGrdTolerance:=", False,
"MaxNumIteration:=", 1001,
"MaxSolTimeInSec:=", 3600,
"RelGradientTolerance:=", 0,
"MinNumIteration:=" , 10
),
"CostFuncNormType:=", "L2",
"PriorPSetup:=", "",

Optimetrics Module Script Commands 16-33


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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)
),
"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",

Optimetrics Module Script Commands 16-34


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"bG:=", Array("v:=", "Array(1;]")


),
"Weight:=", "Array(1;]"
)
),
"Acceptable_Cost:=", 0,
"Noise:=", 0.0001,
"UpdateDesign:=", False,
"UpdateIteration:=", 5,
"KeepReportAxis:=", True,
"UpdateDesignWhenDone:=", True
))

InsertSetup [Sensitivity]
Inserts a new sensitivity setup.

Right-click Optimetrics in the project tree, and then click Add>Sensitivity on


UI Access
the shortcut menu.

Name Type Description


<SensitivityParams> Array Array("NAME:<SetupName>", "SaveField-
s:=",
<SaveField>, <StartingPoint>, "MaxIter-
ations:=",
<MaxIter>, "PriorPSetup:=", <PriorSetup>,
"PreSolvePSetup:=", <Preceed>, <Sens-
itivityVars>,
Parameters
<Constraint>,
Array("NAME:Goals", Array("NAME:Goal",
<OptiGoalSpec>), ..., Array("NAME:Goal",
<OptiGoalSpec>)), "Master Goal:=". <Master-
GoalID>,
"MasterError:=", <MasterError>)
<SensitivityVars> Array Array("NAME:Variables",

Optimetrics Module Script Commands 16-35


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"VarName:=", Array("i:=", <IncludeVar>,


"Min:=", <MinV>, "Max:=", <MaxV>,
"IDisp:=", <InitialDisp>),...
"VarName:=", Array("i:=", <IncludeVar>,
"Min:=", <MinV>, "Max:=", <MaxV>,
"IDisp:=", <InitialDisp>))
<InitialDisp> VarValue Index of the master goal. Index starts from
zero.
<MasterError> Double Error associated with the master goal.

Return Value None

Python Syn- InsertSetup ("OptiSensitivity", <SensitivityParams>)


tax

oModule.InsertSetup(
"OptiSensitivity", _
["NAME:SensitivitySetup1",_
"SaveFields:=", true,_
["NAME:StartingPoint"], _
"MaxIterations:=", 20,_
"PriorPSetup:=", "",_
"PreSolvePSetup:=", true, _
Python
["NAME:Variables"], _
Example
["NAME:LCS"],_
"NAME:Goals",_
["NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "returnloss",_
"Context:=", "",_
["NAME:Ranges",_
"Range:=", ["Var:=", "Freq", "_

Optimetrics Module Script Commands 16-36


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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"]]]],_
"Master Goal:=", 1,_
"MasterError:=", 0.001])

VB Syntax InsertSetup "OptiSensitivity", <SensitivityParams>


oModule.InsertSetup
"OptiSensitivity", _
Array("NAME:SensitivitySetup1",_
"SaveFields:=", true,_
Array("NAME:StartingPoint"), _
"MaxIterations:=", 20,_
"PriorPSetup:=", "",_
VB
Example "PreSolvePSetup:=", true, _
Array("NAME:Variables"), _
Array("NAME:LCS"),_
Array("NAME:Goals",_
Array("NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "returnloss",_

Optimetrics Module Script Commands 16-37


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Context:=", "",_
Array("NAME:Ranges",_
"Range:=", Array("Var:=", "Freq", "_
Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz"))),_
Array("NAME:Goal",_
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect",_
"Context:=", "",_
Array("NAME:Ranges",_
"Range:=", Array("Var:=","Freq",_
"Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz")))),_
"Master Goal:=", 1,_
"MasterError:=", 0.001)

Statistical Script Commands


EditSetup [Statistical]
InsertSetup Statistical
EditSetup [Statistical]
Modifies an existing statistical setup.

Right-click the setup in the project tree, and clickProperties on the shortcut
UI Access
menu.

Name Type Description


Parameters <SetupName> String Name of the Setup

Return Value None

Python Syn- EditSetup (<SetupName>, <StatisticalParams>)


tax

Optimetrics Module Script Commands 16-38


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python See EditSetup [Optimization]


Example

VB Syntax EditSetup <SetupName>, <StatisticalParams>


VB Example See EditSetup [Optimization]

Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 13.0.0
' 3:04:05 PM May 18, 2010
' ----------------------------------------------
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:S-
tatisticalSetup1",
Array("NAME:ProdOptiSetupData",
"SaveFields:=", true, "CopyMesh:=", false),
Array("NAME:StartingPoint", "$length:=", "7.824547736mm",
"$width:=", "14.8570192mm"),
"MaxIterations:=", 50,
"PriorPSetup:=", "",
Array("NAME:Variables",
"$length:=", Array("i:=", true,

Optimetrics Module Script Commands 16-39


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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",
"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")))))

Optimetrics Module Script Commands 16-40


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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:=",
<SaveField>, <StartingPoint>,
"MaxIterations:=",
<MaxIter>, "PriorPSetup:=", <Pri-
orSetup>,
"PreSolvePSetup:=", <Preceed>,
<StatisticalVars>,
Array("NAME:Goals", Array
("NAME:Goal",
<OptiGoalSpec>), …, Array
("NAME:Goal",
<OptiGoalSpec>)))
<StatisticalVars> Array Array("NAME:Variables",
"VarName:=", Array("i:=",
Parameters
<IncludeVar>, "Dist:=",
<DistType>, "Tol:=", <Tol-
erance>,
"StdD:=", <StdD>, "Min:=",
<MinCutoff>, "Max:=",
<MaxCutoff>, ...
"VarName:=", Array("i:=",
<IncludeVar>, "Dist:=",
<DistType>, "Tol:=", <Tol-
erance>, "StdD:=",
<StdD>, "Min:=", <MinCutoff>,
"Max:=",
<MaxCutoff>))
<DistType> String Distrbution can be "Gaussian" or "Uni-
form".
<Tolerance> VarValue The tolerance for the variable when dis-

Optimetrics Module Script Commands 16-41


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

tribution is Uniform
<StdD> VarValue The standard deviation for the variable when
distribution is Gaussian.
<MinCutoff> Double The minimum cut-off for the variable when dis-
tribution is Gaussian.
<MaxCutoff> Double The maximum cut-off for the variable when dis-
tribution is Gaussian.

Return Value None

Python Syn- InsertSetup ("OptiStatistical", <StatisticalParams>)


tax

oModule.InsertSetup(
"OptiStatistical", _
["NAME:StatisticalSetup1", _
"SaveFields:=", true, _
["NAME:StartingPoint"],_
"MaxIterations:=", 50,_
"PriorPSetup:=", "", _
["NAME:Variables"], _
["NAME:Goals", _
["NAME:Goal", _
Python
Example "Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "returnloss", _
"Context:=", "", _
["NAME:Ranges", _
"Range:=", ["Var:=", "Freq", _
"Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz"]]],_
["NAME:Goal",_
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect",_

Optimetrics Module Script Commands 16-42


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Context:=", "", _
["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:=", "", _
Array("NAME:Variables"), _
Array("NAME:Goals", _
Array("NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive", _
VB
Example "Calculation:=", "returnloss", _
"Context:=", "", _
Array("NAME:Ranges", _
"Range:=", Array("Var:=", "Freq", _
"Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz"))),_
Array("NAME:Goal",_
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect",_
"Context:=", "", _
Array("NAME:Ranges",_

Optimetrics Module Script Commands 16-43


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Range:=", Array("Var:=", "Freq", "Type:=",_


"s", "Start:=", "8GHz", "Stop:=", "8GHz"))))

Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 13.0.0
' 3:29:39 PM May 18, 2010
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
oDesign.ChangeProperty Array("NAME:AllTabs",
Array("NAME:LocalVariableTab",
Array("NAME:PropServers", "LocalVariables"),
Array("NAME:ChangedProps",
Array("NAME:offset",
Array("NAME:Statistical", "Included:=", true)))))
Set oModule = oDesign.GetModule("Optimetrics")
oModule.InsertSetup "OptiStatistical", Array("NAME:S-
tatisticalSetup1",
Array("NAME:ProdOptiSetupData",
"SaveFields:=", false, "CopyMesh:=", false),
Array("NAME:StartingPoint", "offset:=", "0in"),
"MaxIterations:=", 50, "PriorPSetup:=", "",
Array("NAME:Variables",

Optimetrics Module Script Commands 16-44


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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",
"VarMax:=", "1in",
"Prob:=", "0.01",
"Mean:=", "0in")),

Array("NAME:Goals", Array("NAME:Goal",
"ReportType:=", "Modal Solution Data",
"Solution:=", "Setup1 : LastAdaptive", Array("NAME:SimValueCon-
text"),
"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 16-45


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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>
The standard deviation for the variable when distribution is
Gaussian.
<MinCutoff>
Type: <double>
The minimum cut-off for the variable when distribution is Gaus-
sian.
<MaxCutoff>
Type: <double>
The maximum cut-off for the variable when distribution is Gaus-
sian.
Example: oModule.InsertSetup "OptiStatistical", _

Optimetrics Module Script Commands 16-46


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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", _
"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 16-47


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

PDF layout 16-48


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

17 - Solutions Module Script Commands


Solutions commands should be executed by the "Solutions" module.
Set oModule = oDesign.GetModule("Solutions")
oModule.CommandName <args>
DeleteSolutionVariation

DeleteSolutionVariation
Deletes all solution data for specific solutions and design variations. This is obsolete and is sup-
ported only for backward compatibility. You should use DeleteFullVariation.
Command: [product]>Results>Clean Up Solutions
Syntax: DeleteSolutionVariation
Array(<DataSpecifierArray>, ...)
Return Value: None
Parameters: <DataSpecifierArray>
Array(<DesignVariationKey>, <SetupName>, <SolnName>)
<DesignVariationKey>
Type: <string>
Design variation string.

<SetupName>
Type: <string>
Name of the solution setup.

<SolnName>
Type: <string>
Name of the solutions within the solution setup.
VB Example:
oModule.DeleteSolutionVariation Array( _
Array("width=’2in’", "Setup1", "Adaptive_1") _
Array("width=’2in’", "Setup1", "Sweep1") )

Solutions Module Script Commands 17-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

For Q3D Extractor, the command details are as follows:


Deletes matrix solution data for specific solutions and design variations.
Command: Q3D Extractor or 2D Extractor>Results>Clean Up Solutions
Syntax: DeleteSolutionVariation Array(<DataSpecifierArray>, …)
Return Value: None
Parameters: <DataSpecifierArray>
Array(<DesignVariationKey>, <SetupName>, <SolnName>)
Parameters:
<DesignVariationKey>
Type: <string>
Design variation string.

<SetupName>
Type: <string>
Name of the solve setup.
<SolnName>
Type: <string>
Name of the solutions within the solve setup.
VB Example: oModule.DeleteSolutionVariation Array(Array("width-
='2in'", "Setup1", "Adaptive_1") _
Array("width='2in'", "Setup1", "LastAdaptive") )

Solutions Module Script Commands 17-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

18 - Field Overlays Module Script Com-


mands
Field overlay commands should be executed by the Field Overlays module, which is called "Field-
sReporter" in scripts.
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.CommandName <args>

CreateFieldPlot
DeleteFieldPlot
GetFieldPlotName
ModifyFieldPlot
RenameFieldPlot
RenamePlotFolder
SetFieldPlotSettings
SetPlotFolderSettings
UpdateAllFieldsPlots
UpdateQuantityFieldsPlots

AddMarkerToPlot
Use: Adds a marker to a trace on a named field plot.
Command: None.
Syntax: AddMarkerToPlot , <location>, <fieldPlotName>
Return Value: None
Parameters: <Location>
Type: <Coord>
X.Y, and Z coordinates for the marker.
<FieldPlotName>
Type: <string>
Name of the field plot.
VB Example:

Field Overlays Module Script Commands 18-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oModule = oDesign.GetModule("FieldsReporter")


oModule.AddMarkerToPlot(["0.290455877780914in", "-
0.616900205612183in", "1.77635683940025e-015in"], "Mag_E1")
oModule.AddMarkerToPlot(["-0.317279517650604in",
"1.22481322288513in", "0in"], "Mag_E1")
oModule.AddMarkerToPlot(["0.290455877780914in", "-
0.616900205612183in", "1.77635683940025e-015in"], "Mag_H1")
oModule.AddMarkerToPlot(["-0.317279517650604in",
"1.22481322288513in", "0in"], "Mag_H1")

CreateFieldPlot
Use: Creates a field/mesh plot "Field" or a visual ray trace ("VRT") plot.
Command: HFSS>Fields>Plot Fields>Mag_E
Command: Maxwell3D or Maxwell2D>Fields>Fields>E>Mag_E
Syntax: CreateFieldPlot <PlotParameterArray> ["Field" | "VRT"]
Return Value: None
Parameters: <PlotParameterArray> "Field"
Array("NAME:<PlotName>",
"SolutionName:=", <string>,
"QuantityName:=", <string>,
"PlotFolder:=", <string>,
"UserSpecifyName:=", <int>,
"UserSpecifyFolder:=", <int>,
"IntrinsicVar:=", <string>,
"PlotGeomInfo:=", <PlotGeomArray>,
"FilterBoxes:=", <FilterBoxArray>,
<PlotOnPointsSettings>,
<PlotOnLineSettings>,
<PlotOnSurfaceSettings>,
<PlotOnVolumeSettings>)

Field Overlays Module Script Commands 18-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

SolutionName
Name of the solution setup and solution formatted as:
"<SolveSetupName> : <WhichSolution>",
where <WhichSolution> can be "Adaptive_<n>",
"LastAdaptive", or "PortOnly".
For example: "Setup1 : Adaptive_2"
HFSS requires a space on either side of the ‘:’ character. If it is missing, the plot will not
be created.

QuantityName
Type of plot to create. Possible values are:
Mesh plots: "Mesh"
Field plots: "Mag_E", "Mag_H", "Mag_Jvol", "Mag_Jsurf",
"ComplexMag_E", "ComplexMag_H", "ComplexMag_Jvol",
"ComplexMag_Jsurf", "Vector_E", "Vector_H",
"Vector_Jvol", "Vector_Jsurf", "Vector_RealPoynting",
"Local_SAR", "Average_SAR"

PlotFolder
Name of the folder to which the plot should be added. Possible values
are: "E Field", "H Field", "Jvol", "Jsurf", "SAR
Field", and "MeshPlots".

UserSpecifyName
0 if default name for plot is used, 1 otherwise.
Not needed. <PlotName> will be respected regardless of whether this
flag is set.

UserSpecifyFolder
0 if default folder for plot is used, 1 otherwise.

Field Overlays Module Script Commands 18-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Not needed. The specified PlotFolder will be respected regardless of


whether this flag is set.

IntrinsicVar
Formatted string that specifies the frequency and phase at which to make the plot.
For example: "Freq='1GHz' Phase='30deg'"

<PlotGeomArray>
Array(<NumGeomTypes>, <GeomTypeData>,
<GeomTypeData>, ...)
For example: Array(4, "Volume", "ObjList", 1, "Box1",
"Surface", "FacesList", 1, "12", "Line", 1,
"Polyline1", "Point", 2, "Point1", "Point2")

<NumGeomTypes>
Type: <int>
Number of different geometry types (volume, surface, line, point)
plotted on at the same time.

<GeomTypeData>
<GeomType>, <ListType>, <NumIDs>, <ID>, <ID>, ...)

<GeomType>
Type: <string>
Possible values are "Volume", "Surface", "Line", "Point".

<ListType>
Type: <string>
Possible values are "ObjList", or "FacesList".
These are used for the GeomType of "Line" or "Point".

Field Overlays Module Script Commands 18-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<NumIDs>
Type: <int>
Number of IDs or object names that will follow.

<ID>
Type: <int> or <string>
ID of a face or name of an object, line, or point on which to plot.

<FilterBoxArray>
Array of names of objects to use to restrict the plot range.
Array(<NumFilters>, <ObjName>, <ObjName>, ...)
Example: Array(1, "Box1")
Example: Array(0) no filtering

<PlotOnPointSettings>
Array("NAME:PlotOnPointSettings",
"PlotMarker:=", <bool>,
"PlotArrow:=", <bool>)

<PlotOnLineSettings>
Array("NAME:PlotOnLineSettings",
Array("NAME:LineSettingsID",
"Width:=", <int>,
"Style:=", <string>),
"IsoValType:=", <string>,
"ArrowUniform:=", <bool>,
"NumofArrow:=", <int>)

Style

Field Overlays Module Script Commands 18-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Possible values are "Cylinder", "Solid", "Dashdash",


"Dotdot", "Dotdash"

IsoValType
Possible values are "Tone", "Fringe", "Gourard"

<PlotOnSurfaceSettings>
Array("NAME:PlotOnSurfaceSettings",
"Filled:=", <bool>,
"IsoValType:=", <string>,
"SmoothShade:=", <bool>,
"AddGrid:=", <bool>,
"MapTransparency:=", <bool>,
"Transparency:=", <doubl.e>,
"ArrowUniform:=", <bool>
"ArrowSpacing:=", <double>
"GridColor:=", Array(<int>, <int>, <int>)

IsoValType
Possible values are: "Tone", "Line", "Fringe", "Gourard"

GridColor
Array containing the R, G, B components of the color. Components
should be in the range 0 to 255.

<PlotOnVolumeSettings>
Array("NAME:PlotOnVolumeSettings",
"PlotIsoSurface:=", <bool>,
"CloudDensity:=", <double>,
"PointSize:=", <int>,

Field Overlays Module Script Commands 18-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"ArrowUniform:=", <bool>,
"ArrowSpacing:=", <double>)
Example Field Plot:
oModule.CreateFieldPlot Array("NAME:Mag_E1", _
"SolutionName:=", "Setup1 : LastAdaptive", _
"QuantityName:=", "Mag_E", _
"PlotFolder:=", "E Field1", _
"UserSpecifyName:=", 0, _
"UserSpecifyFolder:=", 0, _
"IntrinsicVar:=", "Freq='1GHz' Phase='0deg'",_
"PlotGeomInfo:=", Array( 1, "Surface",_
"FacesList", 1, "7"),_
"FilterBoxes:=", Array(0),
Array("NAME:PlotOnSurfaceSettings", _
"Filled:=", false, _
"IsoValType:=", "Fringe", _
"SmoothShade:=", true, _
"AddGrid:=", false, _
"MapTransparency:=", true, _
"Transparency:=", 0, _
"ArrowUniform:=", true, _
"ArrowSpacing:=", 0.100000001490116, _
"GridColor:=", Array(255, 255, 255)))

Parameters: <PlotParameterArray> "VRT"


Array("NAME:<PlotName>",
"SolutionName:=", <string>,
"QuantityName:=", <string>,
"PlotFolder:=", <string>,
"UserSpecifyName:=", <int>,

Field Overlays Module Script Commands 18-7


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"UserSpecifyFolder:=", <int>,
"IntrinsicVar:=", <string>,
"MaxFrequency:=", "<Number><FreqUnits>", _
"LaunchFrom:=", ["Launch from custom", |
"LaunchFromPointID:=",] _
18007, "RayDensity:=", <int>, _
"NumberBounces:=", <int>, _
"Multi-Bounce Ray Density Control:=", <Boolean>, _
"MBRD Max sub divisions:=", <int>, _
"ShootFilterType:=", ["All Rays" | _
"Rays by index", "start index:=", <int>, "stop index:=", <int>,
"index step:=", <int> |_
"Rays in box", "FilterBoxID:=", <objID> | _
"Single ray", "Ray elevation:=", "<real>deg", "Ray azimuth:=",
"<real>deg"
"),
"VRT"

Example VRT Plot:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2017.2.0
' 14:03:00 Jun 21, 2017
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()

Field Overlays Module Script Commands 18-8


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("abrams_1p5")
Set oDesign = oProject.SetActiveDesign("UseSbr")
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.CreateFieldPlot Array("NAME:VRT_Plot1", _
"SolutionName:=", "Setup1 : LastAdaptive", _
"QuantityName:=", "QuantityName_SBR", _
"PlotFolder:=", "Visual Ray Trace SBR", "UserSpecifyName:=", 0,
"UserSpecifyFolder:=", 0, _
"IntrinsicVar:=", "", "MaxFrequency:=", "1GHz", "LaunchFrom:=",
"Launch from custom", _
"LaunchFromPointID:=", 18007, "RayDensity:=", 2, "NumberBounces:=",
5, _
"Multi-Bounce Ray Density Control:=", false, "MBRD Max sub divi-
sions:=", 2, "ShootFilterType:=", "All Rays"), "VRT"

VB Example: oModule.CreateFieldPlot Array("NAME:Mag_E1", _


"SolutionName:=", "Setup1 : LastAdaptive", _
"QuantityName:=", "Mag_E", _
"PlotFolder:=", "E Field1", _
"UserSpecifyName:=", 0, _
"UserSpecifyFolder:=", 0, _
"IntrinsicVar:=", "Freq='1GHz' Phase='0deg'",_
"PlotGeomInfo:=", Array( 1, "Surface",_
"FacesList", 1, "7"),_
"FilterBoxes:=", Array(0),
Array("NAME:PlotOnSurfaceSettings", _
"Filled:=", false, _ "IsoValType:=", "Fringe", _
"SmoothShade:=", true, _
"AddGrid:=", false, _
"MapTransparency:=", true, _
"Transparency:=", 0, _

Field Overlays Module Script Commands 18-9


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"ArrowUniform:=", true, _
"ArrowSpacing:=", 0.100000001490116, _
"GridColor:=", Array(255, 255, 255))), "Field"

Example Mesh Plot


' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2017.2.0
' 14:34:34 Jun 21, 2017
' ----------------------------------------------
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("abrams_1p5")
Set oDesign = oProject.SetActiveDesign("UseSbr")
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.CreateFieldPlot Array("NAME:Mesh1", "SolutionName:=",
"Setup1 : LastAdaptive", "QuantityName:=", _
"Mesh", "PlotFolder:=", "MeshPlots", "FieldType:=", "Fields", "User-
SpecifyName:=", _
0, "UserSpecifyFolder:=", 0, "StreamlinePlot:=", false, "Intrins-
icVar:=", _
"Freq=" & Chr(39) & "2GHz" & Chr(39) & " Phase=" & Chr(39) & "0deg"
& Chr(39) & "" & _
"", "PlotGeomInfo:=", Array(1, "Surface", "FacesList", 1, "10568"),
"FilterBoxes:=", Array( _

Field Overlays Module Script Commands 18-10


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

0), "Real time mode:=", true, Array("NAME:MeshSettings", "Scale


factor:=", 100, "Transparency:=", _
0, "Mesh type:=", "Shaded", "Surface only:=", true, "Add grid:=",
true, "Refinement:=", _
0, "Use geometry color:=", true, "Mesh line color:=", Array(0, 0,
255), "Filled color:=", Array( _
255, 255, 255))), "Field"

For Q3D Extractor and 2D Extractor, the command details are as follows:

Use: Creates a field/mesh plot.


Command: Q3D Extractor or 2D Extractor>Fields
Syntax: CreateFieldPlot <PlotParameterArray>
Return Value: None
Parameters: <PlotParameterArray>
Array("NAME:<PlotName>",
"SolutionName:=", <string>,
"QuantityName:=", <string>,
"PlotFolder:=", <string>,
"UserSpecifyName:=", <int>,
"UserSpecifyFolder:=", <int>,
"IntrinsicVar:=", <string>,
"PlotGeomInfo:=", <PlotGeomArray>,
"FilterBoxes:=", <FilterBoxArray>,
<PlotOnPointSettings>, <PlotOnLineSettings>,
<PlotOnSurfaceSettings>, <PlotOnVolumeSettings>)
SolutionName
Name of the solution setup and solution formatted as:
"<SolveSetupName> : <WhichSolution>",
where <WhichSolution> can be "Adaptive_<n>",
"LastAdaptive", or "PortOnly".

Field Overlays Module Script Commands 18-11


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

For example: "Setup1 : Adaptive_2"


HFSS requires a space on both sides of the ‘:’ character. Other-
wise, the plot is not be created.
QuantityName
Type of plot to create. Possible values are:
Mesh plots: "Mesh"
Q3D Field Plots:

Field type Plot quantity names


AC R/L Fields "SurfaceJac", "Mag_SurfaceJac"
DC R/L PEC Fields "SurfaceJdc", "Mag_SurfaceJdc"
DC R/L Fields "VolumeJdc", "Mag_VolumeJdc", "Phidc"
C Fields "SmoothQ", "ABS_Q"

2D Extractor Field Plots:

Field Plot quantity names


type
CG "Mag_Phi", "PhiAtPhase", "Mag_E", "VectorE", "Mag_Jcg", "VectorJcg" and "energyCG"
Fields
RL "Flux Lines", "VectorA", "Mag_B", "VectorB", "Mag_H", "VectorH", "Jrl", "VectorJrl",
Fields "energyRL", "coenergy", "appenergy" and "emloss"

PlotFolder
Name of the folder to which the plot should be added. Possible
values are: "Q", "ABS_Q", "JDC Vol", "Phi", "JDC Surf", and "JAC".
UserSpecifyName
0 if default name for plot is used, 1 otherwise.
This parameter is not essential. <PlotName> is respected regard-
less of whether this flag is set.
UserSpecifyFolder
0 if the default folder for plot is used, 1 otherwise.
This parameter is not essential. The specified PlotFolder is
respected regardless of whether this flag is set.

Field Overlays Module Script Commands 18-12


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

IntrinsicVar
Formatted string that specifies the frequency and phase at which
to create the plot.
For example: "Freq='1GHz' Phase='30deg'"
<PlotGeomArray>
Array(<NumGeomTypes>, <GeomTypeData>,
<GeomTypeData>, ...)
For example: Array(4, "Volume", "ObjList", 1, "Box1",
"Surface", "FacesList", 1, "12", "Line", 1,
"Polyline1", "Point", 2, "Point1", "Point2")
<NumGeomTypes>
Type: <int>
Number of different geometry types (volume, surface, line, point)
plotted at the same time.
<GeomTypeData>
<GeomType>, <ListType>, <NumIDs>, <ID>, <ID>, ...)
<GeomType>
Type: <string>
Possible values are "Volume", "Surface", "Line", "Point".
<ListType>
Type: <string>
Possible values are "ObjList" or "FacesList".
These are used for GeomType values "Line" or "Point".
<NumIDs>
Type: <int>
Number of IDs or object names that will follow.
<ID>
Type: <int> or <string>
ID of a face or name of an object, line, or point on which to plot.
<FilterBoxArray>
Array of object names used to restrict the plot range.

Field Overlays Module Script Commands 18-13


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array(<NumFilters>, <ObjName>, <ObjName>, ...)


Example: Array(1, "Box1")
Example: Array(0) no filtering
<PlotOnPointSettings>
Array("NAME:PlotOnPointSettings",
"PlotMarker:=", <bool>,
"PlotArrow:=", <bool>)
<PlotOnLineSettings>
Array("NAME:PlotOnLineSettings",
Array("NAME:LineSettingsID",
"Width:=", <int>,
"Style:=", <string>),
"IsoValType:=", <string>,
"ArrowUniform:=", <bool>,
"NumofArrow:=", <int>)
Style
Possible values are "Cylinder", "Solid", "Dashdash",
"Dotdot", "Dotdash".
IsoValType
Possible values are "Tone", "Fringe", "Gourard".
<PlotOnSurfaceSettings>
Array("NAME:PlotOnSurfaceSettings",
"Filled:=", <bool>,
"IsoValType:=", <string>,
"SmoothShade:=", <bool>,
"AddGrid:=", <bool>,
"MapTransparency:=", <bool>,
"Transparency:=", <double>,
"ArrowUniform:=", <bool>
"ArrowSpacing:=", <double>

Field Overlays Module Script Commands 18-14


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"GridColor:=", Array(<int>, <int>, <int>)


IsoValType
Possible values are: "Tone", "Line", "Fringe", "Gourard".
GridColor
Array containing the R, G, B components of the color. Components
should be in the range 0 to 255.
<PlotOnVolumeSettings>
Array("NAME:PlotOnVolumeSettings",
"PlotIsoSurface:=", <bool>,
"CloudDensity:=", <double>,
"PointSize:=", <int>,
"ArrowUniform:=", <bool>,
"ArrowSpacing:=", <double>)

DeleteFieldPlot
Use: Deletes one or more plots.
Command: HFSS>Fields>Delete Plot
Command: Maxwell3D or Maxwell2D>Fields>Delete Plot
Command: Q3D Extractor or 2D Extractor>Fields>Delete Plot
Syntax: DeleteFieldPlot <NameArray>
Return Value: None
Parameters: <NameArray>
Array of strings – the names of the plots to delete.
VB Example:
oModule.DeleteFieldPlot Array("Mag_E1", "Vector_E1")

GetFieldPlotNames
Gets the names of field overlay plots defined in a design.
Syntax: GetFieldPlotNames()
Return Value: Array of field plot names.
Parameters: None

Field Overlays Module Script Commands 18-15


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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.GetActiveProject
Set oDesign = oProject.GetActiveDesign
Set oReportModule = oDesign.GetModule("ReportSetup")
Dim names
names = oReportModule.GetAllReportNames
For index = 0 to UBound(names)
MsgBox(names(index))
Next
Set oFieldReportModule = oDesign.GetModule("FieldsReporter")
Set collection = oFieldReportModule.GetFieldPlotNames
For index = 0 to collection.Count-1
MsgBox(collection.Item(index))
Next

For Q3D Extractor, the command details are as follows:

Gets the names of field overlay plots defined in a design.


Syntax: GetFieldPlotNames()
Return Value: Array of field plot names.
Parameters: None

Field Overlays Module Script Commands 18-16


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Example: Set plotnames = oModule.GetFieldPlotNames()


For Each name in plotnames
Msgbox name
Next

ModifyFieldPlot
Use: Modifies a plot definition.
Command: HFSS>Fields>Modify Plot
Command: Maxwell3D or Maxwell2D>Fields>Modify Plot
Command: Q3D Extractor or 2D Extractor>Fields>Modify Plot
Syntax: ModifyFieldPlot <OriginalName> <PlotParameterArray>
Return Value: None
VB Example:
oModule.ModifyFieldPlot "Vector_E1",_
Array("NAME:Vector_E2", _
"SolutionName:=", "Setup1 : LastAdaptive", _
"QuantityName:=", "Vector_E", _
"PlotFolder:=", "E Field1", _
"UserSpecifyName:=", 0, _
"UserSpecifyFolder:=", 0, _
"IntrinsicVar:=","Freq='1GHz' Phase='30deg'", _
"PlotGeomInfo:=", Array(1,_
"Surface","FacesList", 1, "7"), _
"FilterBoxes:=", Array(0), _
Array("NAME:PlotOnSurfaceSettings", _
"Filled:=", false, _
"IsoValType:=", "Fringe", _
"SmoothShade:=", true, _
"AddGrid:=", false, _
"MapTransparency:=", true, _

Field Overlays Module Script Commands 18-17


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Transparency:=", 0, _
"ArrowUniform:=", true, _
"ArrowSpacing:=", 0.100000001490116, _
"GridColor:=", Array(255, 255, 255)))

RenameFieldPlot
Use: Renames a plot.
Command: Right-click the plot you want to rename in the project tree, and then click Rename on
the shortcut menu.
Syntax: RenameFieldPlot <OldName> <NewName>
Return Value: None
Parameters: <OldName>
Type: <string>
Original name of the plot.

<NewName>
Type: <string>
New name of the plot.
VB Example:
oModule.RenameFieldPlot "Vector_E1", "Vector_E2"

RenamePlotFolder
Use: Renames a plot folder.
Command: Right-click a plot folder in the project tree, and then click Rename on the shortcut
menu.
Syntax: RenamePlotFolder <OldName> <NewName>
Return Value: None
Parameters: <OldName>
Type: <string>
Original name of the folder.

Field Overlays Module Script Commands 18-18


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<NewName>
Type: <string>
New name of the folder.
VB Example:
oModule.RenamePlotFolder "E Field", "Surface Plots"

SetFieldPlotSettings
Sets plot attributes.
Command: HFSS>Fields>Modify Plot Attributes, under the Plots tab.
Command: Maxwell3D or Maxwell2D>Fields>Modify Plot Attributes, under the Plots tab.
Command: Q3D Extractor or 2D Extractor>Fields>Modify Plot Attributes, under the Plots
tab.
Syntax: SetFieldPlotSettings <PlotName> <PlotItemAttributes>
Return Value: None
Parameters: <PlotName>
Type: <string>
Name of the plot to modify.

<PlotItemAttributes>
Array("NAME:FieldsPlotItemSettings",
<PlotOnPointsSettings>,
<PlotOnLineSettings>,
<PlotOnSurfaceSettings>,
<PlotOnVolumeSettings>)
See description of CreateFieldPlot command for details.
VB Example:
oModule.SetFieldPlotSettings "Mag_E2", _
Array("NAME:FieldsPlotItemSettings", _
Array("NAME:PlotOnLineSettings", _

Field Overlays Module Script Commands 18-19


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:LineSettingsID", _
"Width:=", 4,
"Style:=", "Cylinder"), _
"IsoValType:=", "Tone", _
"ArrowUniform:=", true, _
"NumofArrow:=", 100), _
Array("NAME:PlotOnSurfaceSettings", _
"Filled:=", false, _
"IsoValType:=", "Tone", _
"SmoothShade:=", true, _
"AddGrid:=", false, _
"MapTransparency:=", true, _
"Transparency:=", 0, _
"ArrowUniform:=", true, _
"ArrowSpacing:=", 0.100000001490116, _
"GridColor:=", Array(255, 255, 255)))

SetPlotFolderSettings
Sets the attributes of all plots in the specified folder.
Command: HFSS>Fields>Modify Plot Attributes
Command: Maxwell3D or Maxwell2D>Fields>Modify Plot Attributes
Command: Q3D Extractor or 2D Extractor>Fields>Modify Plot Attributes
Syntax: SetPlotFolderSettings <PlotFolderName> <PlotFolderAttributes>
Return Value: None
Parameters: <PlotFolderName>
Type: <string>
Name of the folder with the attributes to modify.

<PlotFolderAttributes>
Array("NAME:FieldsPlotSettings",

Field Overlays Module Script Commands 18-20


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Real time mode:=", <bool>,


<ColorMapSettings>,
<Scale3DSettings>,
<Marker3DSettings>,
<Arrow3DSettings>)

<ColorMapSettings>
Array("NAME:ColorMapSettings",
"ColorMapType:=", <string>,
"SpectrumType:=", <string>,
"UniformColor:=", Array(<int>, <int>, <int>),
"RampColor:=", Array(<int>, <int>, <int>)

ColorMapType
Possible values are "Uniform", "Ramp", "Spectrum"

SpectrumType
Possible values are "Rainbow", "Temperature", "Magenta", "Gray"

UniformColor, RampColor
Array containing the R, G, B components of the color. Components should be in the
range 0 to 255.

<Scale3DSettings>
Array("NAME:Scale3DSettings",
"m_nLevels:=", <int>,
"m_autoScale:=", <bool>,
"minvalue:=", <double>,
"maxvalue:=", <double>,
"log:=", <bool>,

Field Overlays Module Script Commands 18-21


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"IntrinsicMin:=", <double>,
"IntrinsicMax:=", <double>)

<Marker3DSettings>
Array("NAME:Marker3DSettings",
"MarkerType:=", <int>,
"MarkerMapSize:=", <bool>,
"MarkerMapColor:=", <bool>,
"MarkerSize:=", <double>)

MarkerType
9: Sphere
10: Box
11: Tetrahedron
12: Octahedron
default: Sphere

<Arrow3DSettings>
Array("NAME:Arrow3DSettings",
"ArrowType:=", <int>,
"ArrowMapSize:=", <bool>,
"ArrowMapColor:=", <bool>,
"ShowArrowTail:=", <bool>,
"ArrowSize:=", <double>)

ArrowType
0: Line
1: Cylinder
2: Umbrella
default: Line

Field Overlays Module Script Commands 18-22


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Example:
oModule. SetPlotFolderSettings "E Field1", _
Array("NAME:FieldsPlotSettings", _
"Real time mode:=", true, _
Array("NAME:ColorMapSettings", _
"ColorMapType:=", "Spectrum", _
"SpectrumType:=", "Rainbow", _
"UniformColor:=", Array(127, 255, 255), _
"RampColor:=", Array(255, 127, 127)), _
Array("NAME:Scale3DSettings", _
"m_nLevels:=", 27, _
"m_autoScale:=", true, _
"minvalue:=", 9.34379863739014, _
"maxvalue:=", 13683.755859375, _
"log:=", false, _
"IntrinsicMin:=", 9.34379863739014, _
"IntrinsicMax:=", 13683.755859375), _
Array("NAME:Marker3DSettings", _
"MarkerType:=", 0, _
"MarkerMapSize:=", true, _
"MarkerMapColor:=", false, _
"MarkerSize:=", 0.25), _
Array("NAME:Arrow3DSettings", _
"ArrowType:=", 1, _
"ArrowMapSize:=", true, _
"ArrowMapColor:=", true, _
"ShowArrowTail:=", true, _
"ArrowSize:=", 0.25))

Field Overlays Module Script Commands 18-23


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

UpdateAllFieldsPlots
Updates the All Fields Plots.
Command: None.
Syntax: UpdateAllFieldsPlots ()
Return Value: None
Parameters: None
VB Example:
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.UpdateAllFieldsPlots()

UpdateQuantityFieldsPlots
Use: Updates the Quantity Fields Plots.
Command: None.
Syntax: UpdateQuantityFieldsPlots (<quantity_folder_name>)
Return Value: None
Parameters: <quantity_folder_name>
Type: <string>
Folder containing the plotted quantities
VB Example:
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.UpdateQuantityFieldsPlots("fldplt")

Field Overlays Module Script Commands 18-24


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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
EnterPoint
EnterQty
EnterScalar
EnterScalarFunc
EnterSurf
EnterVector
EnterVectorFunc
EnterVol

Fields Calculator Script Commands 19-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

ExportOnGrid
ExportToFile
GetTopEntryValue
LoadNamedExpressions
SaveNamedExpressions

AddNamedExpression
Creates a named expression using the expression at the top of the stack.
Command: Click Add.
Syntax: AddNamedExpression <Name>
Return Value: None
Parameters: <ExpressionName> and <FieldType>.
Type: <string>
Name for the new named expression.
<FieldType>
Type: <string>
VB Example:
oModule.AddNamedExpression "Mag_JxE", "Fields"

AddNamedExpr
Creates a named expression using the expression at the top of the stack.
Command: Click Add.
Syntax: AddNamedExpr <Name>
Return Value: None
Parameters: <ExpressionName>
Type: <string>
Name for the new named expression.
<FieldType>
Type: <string>
VB Example:

Fields Calculator Script Commands 19-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oModule.AddNamedExpr "Mag_JxE", "Fields"

CalcOp
Use: Performs a calculator operation.
Command: Operation commands like Mag, +, etc.
Syntax: CalcOp <OperationString>
Return Value: None
Parameters: <OperationString>
Type: String
The text on the corresponding calculator button.
Examples: Mag, +

CalcRead(deprecated)
Use:Reads a file that is written out by the CalcWrite command, and puts the result into a calculator
numeric.
Syntax:CalcRead <FileName> <SolutionName> <VariablesArray>
Return Value:None
Parameters:<FileName>
Type: <string>
<SolutionName>
Type: <string>
<VariablesArray>
Array of variable name and value pairs.
oModule.CalcRead _
"c:\example.reg" "Setup1: LastAdaptive",_
Array ("Freq:=", "10GHz", "Phase:=", "0deg")

CalculatorRead
Use: Gets a register file and applies it to the calculator stack.
Command: Click Read
Syntax: CalculatorRead <InputFilePath>, <SolutionName>, <FieldType>, <VariablesArray>

Fields Calculator Script Commands 19-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Return Value: None


Parameters: <InputFilePath>
Path to and including name of input register file.

<SolutionName>
Type: <string>
Example: "Setup1 : LastAdaptive"

<FieldType>
Type: <string>

<VariablesArray>
Array of variable names, value pairs.
VB Example:
oModule.CalculatorRead "c:\test.reg", _
"Setup1 : LastAdaptive", "Fields", _
Array("Freq:=", "1GHz", "Phase:=", "0deg")
For Q3D Extractor, the command example is as follows:
VB Example: oModule.CalculatorRead "C:\Ansoft\smoothedtemper.fld",
"Setup1 : LastAdaptive", "Fields", Array("$conductivity:=",
"50000000")

CalcStack
Use: Performs an operation on the stack.
Command: Stack operation buttons such as Push and Pop.
Syntax: CalcStack <OperationString>
Return Value: None
Parameters: <Operation String>
Type: <string>
The text on the corresponding calculator button.
VB Example:
oModule.CalcStack "push"

Fields Calculator Script Commands 19-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

CalculatorWrite
Use: Writes contents of top register to file.
Command: Click Write
Syntax: CalculatorWrite <OutputFilePath>, <SolutionNameArray>, <VariablesArray>
Return Value: None
Parameters: <OutputFilePath>
Path to and including name of output register file.

<SolutionNameArray>
Array("Solution:=", <string>)

<VariablesArray>
Array of variable names, value pairs.
VB Example:
oModule.CalculatorWrite "c:\test.reg", _
Array("Solution:=", "Setup1 : LastAdaptive"), _
Array("Freq:=", "1GHz", "Phase:=", "0deg")

For Q3D Extractor, the command example is as follows:


VB Example: oModule.CalculatorWrite "C:\Ansoft\smoothedTemp.fld",
Array("Solution:=", "Setup1 : LastAdaptive"), Array("$con-
ductivity:=", "50000000")

ChangeGeomSettings
Use: Changes the line discretization setting.
Command: Geom Settings
Syntax: ChangeGeomSettings <int>
Return Value: None
Parameters: The line discretization setting.

Fields Calculator Script Commands 19-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

ClcEval
Use: Evaluates the expression at the top of the stack using the provided solution name and variable
values.
Command: Click Eval.
Syntax: ClcEval <SolutionName> <VariablesArray>
Return Value: None
Parameters: <SolutionName>
Type: <string>

<VariablesArray>
Array of variable name, value pairs.
VB Example:
oModule.ClcEval "Setup1: LastAdaptive", _
Array ("Freq:=", "10GHz",_
"Phase:=", "0deg")

ClcMaterial
Use: Performs a material operation on the top stack element.
Command: Click Matl.
Syntax: ClcMaterial <MaterialString>, <OperationString>
Return Value: None
Parameters: <Material String>
Type: <string>
The material property to apply.

<OperationString>
Type: <string>
Possible values are "mult", or "div".
VB Example:
oModule.ClcMaterial "Permeability (mu)" "mult"

Fields Calculator Script Commands 19-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

ClearAllNamedExpr
Use: Clears all user-defined named expressions from the list.
Command: Click ClearAll.
Syntax: ClearAllNamedExpr
Return Value: None
Parameters: None

CopyNamedExprToStack
Use: Copies the named expression selected to the calculator stack.
Command: Select a named expression and then click Copy to stack.
Syntax: CopyNamedExprToStack <Name>
Return Value: None
Parameters: <Name>
Type: <string>
The name of the expression to be copied to the top of the stack.
VB Example:
oModule.CopyNamedExprToStack "Mag_JxE"

DeleteNamedExpr
Use: Deletes the selected named expression from the list.
Command: Select a named expression and then click Delete.
Syntax: DeleteNamedExpr <Name>
Return Value: None
Parameters: <Name>
Type: <string>
The name of the named expression to be deleted.
VB Example:
oModule.DeleteNamedExpr "Mag_JxE"

Fields Calculator Script Commands 19-7


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

EnterComplex
Use: Enters a complex number onto the stack.
Command: Click Number, and then click Scalar. Complex option is selected.
Syntax: EnterComplex "<Real> + <Imaginary> j"
Return Value: None
Parameters: <Real>
Type: <double>
Real component of the scalar.

<Imaginary>
Type: <double>
Imaginary component of the scalar.
VB Example:
oModule.EnterComplex "1 + 2 j"

EnterComplexVector
Use: Enters a complex vector onto the stack.
Command: Click Number, and then click Vector. Complex option is selected.
Syntax: EnterComplexVector Array ("<X Re> + <X Im> j",
"<Y Re> + <Y Im> j", "<Z Re> + <Z Im> j")
Return Value: None
Parameters: <X Re>, <YRe>, <ZRe>
Type: <double>
Real components of the X, Y, and Z values respectively.

<X Im>, <YIm>, <ZIm>


Type: <double>
Imaginary components of the X, Y, and Z values respectively.

Fields Calculator Script Commands 19-8


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Example:
oModule.EnterComplexVector Array("1 + 2 j",_
"1 + 2 j",_
"1 + 2 j")

EnterLine
Use: Enters a line defined in the 3D Modeler editor.
Command: Click Geometry and then select Line.
Syntax: EnterLine <LineName>
Return Value: None
Parameters: <LineName>
Type: <string>
Name of a line defined in the 3D Modeler editor.
VB Example:
oModule.EnterLine "Line1"

EnterPoint
Use: Enters a point defined in the 3D Modeler editor.
Command: Click Geometry and then select Point.
Syntax: EnterPoint <PointName>
Return Value: None
Parameters: <PointName>
Type: <string>
Name of a point defined in the 3D Modeler editor.
VB Example:
oModule.EnterPoint "Point1"

EnterQty
Use: Enters a field quantity.

Fields Calculator Script Commands 19-9


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Command: Click Quantity, and then select from the list.


Syntax: EnterQty <FieldQuantityString>
Return Value: None
Parameters: <Field Quantity String>
Type: <string>
The field quantity to be entered onto the stack.
VB Example:
oModule.EnterQty "E"

EnterScalar
Use: Enters a scalar onto the stack.
Command: Click Number and then click Scalar. Complex option not selected.
Syntax: EnterScalar <Scalar>
Return Value: None
Parameters: <Scalar>
Type: <double>
The real number to enter onto the stack.

EnterScalarFunc
Use: Enters a scalar function.
Command: Click Function and then select Scalar.
Syntax: EnterScalarFunc <VarName>
Return Value: None
Parameters: <VarName>
Type: <string>
Name of a variable to enter as a scalar function onto the stack.
VB Example:
oModule.EnterScalarFunc "Phase"

Fields Calculator Script Commands 19-10


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

EnterSurf
Use: Enters a surface defined in the 3D Modeler editor.
Command: Click Geometry and then select Surface.
Syntax: EnterSurf <SurfaceName>
Return Value: None
Parameters: <SurfaceName>
Type: <string>
Name of a surface defined in the 3D Modeler editor.
VB Example:
oModule.EnterSurf "Rectangle1"

EnterVector
Use: Enters a vector onto the stack.
Command: Click Number, and then click Vector. Complex option not selected.
Syntax: EnterVector Array (<X>, <Y>, <Z>)
Return Value: None
Parameters: <X>
Type: <double>
X component of the vector.

<Y>
Type: <double>
Y component of the vector.

<Z>
Type: <double>
Z component of the vector.
VB Example:
oModule.EnterVector Array (1.0, 1.0, 1.0)

Fields Calculator Script Commands 19-11


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

EnterVectorFunc
Use: Enters a vector function.
Command: Click Function and then select Vector.
Syntax: EnterVectorFunc Array(<XVarName>, <YVarName>,
<ZVarName>)
Return Value: None
Parameters: <XVarName>, <YVarName>, <ZVarName>
Type: <string>
Name of a variable for the X, Y, and Z coordinates, respectively, to enter as a vector func-
tion on the stack.
VB Example:
oModuleEnterVectorFunc Array("X", "Y", "Z")

EnterVol
Use: Enters a volume defined in the 3D Modeler editor.
Command: Click Geometry and then select Volume.
Syntax: EnterVol <VolumeName>
Return Value: None
Parameters: <VolumeName>
Type: <string>
Name of a volume defined in the 3D Modeler editor.
VB Example:
oModule.EnterVol "Box1"

ExportOnGrid
Use: Evaluates the top stack element at a set of points specified by a grid and exports the data to a
file.
Command: Click Export, and then click On Grid.

Fields Calculator Script Commands 19-12


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syntax: ExportOnGrid <OutputFile> <MinArray> <MaxArray> <SpacingsArray>, <setup>,


<Boolean>, <coordinate system> [<CS Offset Array>]
Return Value: None
Parameters: <OutputFile>
Type: <string>
Name of the output file.
<MinArray>, <MaxArray>, <SpacingsArray>
Type: Array<double, double, double>
Min, Max, and Spacing for the coordinate components of the grid system, "Cartesian"
(default), "Cylindrical" or "Spherical".
<setup>
Type: <string>
Name of the simulation setup
<Setup Array>
Type: Array("Freq:=",<ValueUnits>", "Phase:=","<ValueDeg>"),
Freq
<Boolean>
Type: True, False
Whether a non-default coordinate system is specified
<Coordinate sytem>
Type: <string>,
["Cartesian" (default)| "Cylindrical" | "Spherical"]
<CS Offset Array>
Type: Array<double, double, double>
Origin for the offset coordinate system.
VB Example:
oModule.ExportOnGrid "J:\TestSuite\EdgeLossDensity\aaa.fld", Array(
"0mm", "0deg", "-25mm"),
Array("20mm", "90deg", "125mm"),
Array("10mm", "45deg", "50mm"),
"Setup1 : LastAdaptive",

Fields Calculator Script Commands 19-13


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("Freq:=", "10000Hz", "Phase:=", "0deg"),


true, "Cylindrical",
Array("0mm", "0mm", "0mm")

For Q3D Extractor the command details are as follows:


Use: Evaluates the top stack element at a set of points specified by a grid, and exports the data to a
file.
Command: Click Export, and then click On Grid.
Syntax: ExportOnGrid <OutputFile> <MinArray> <MaxArray> <SpacingsArray>
Return Value: None
Parameters: <OutputFile>
Type: <string>
Name of the output file.
<MinArray>, <MaxArray>, <SpacingsArray>
Type: Array<double, double, double>
Min, Max, and Spacing for the X, Y, and Z components of the grid.
VB Example: oModule.ExportOnGrid
"C:`3D Extractor6OutputFiles\GridExport.reg",_
Array("1", "1", "1"),_
Array("4", "4", "4"),_
Array("2", "2", "2")

ExportToFile [Fields Calculator]


Use: Evaluates the top stack element at a set of points specified in an external file and exports the
data to a file.
Command: Click Export, and then click To File.
Syntax: ExportToFile <OutputFile> <PtsFile>
Return Value: None
Parameters: <OutputFile>
Type: <string>

Fields Calculator Script Commands 19-14


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Name of the output file.

<PtsFile>
Type: <string>
Name of the file containing the points at which to evaluate the top stack element. The file
should contain tab- or space-separated x,y,z values of data points.

GetTopEntryValue
Use: Gets the value of the top entry of the calculator stack.
Syntax: GetTopEntryValue(<SolutionName>, <VariablesArray>)
Return Value: Returns an array of variants, which is either a scalar (one double) or a vector (3
doubles) based on the quantity on top of the stack.
Parameters: <SolutionName>
Type: <string>
Example: "Setup1: LastAdaptive"

<VariablesArray>
Array of variable name, value pairs.
VB Example:
dim topvalue
topvalue = _
oModule.GetTopEntryValue("Setup1:LastAdaptive", _
Array("Freq:=", "1GHz", "Phase:=", "0deg", _
"x_size:=", "2mm"))
If cdbl(topvalue(0)) <- 180.0 then ...

LoadNamedExpressions
Use:Loads a named expression definition from a saved file.
Command:In the Fields Calculator, click Load From... in the Library area.
Syntax:LoadNamedExpressions <FileName>, <FieldType>, <NamedExpressions>

Fields Calculator Script Commands 19-15


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Return Value:None
Parameters:<FileName>
Type:<String>
Filename and full path to the file to hold the named expression definition.
<FieldType>
Type:<String>
For products with just one filed type, it is set to "Fields".
<NamedExpressions>
Type: Array<string, string,...>
Array of strings containing the names of expression definitions to load from the file.
VB Example:
oModule.LoadNamedExpressions "C:\Ansoft\PersonalLib\smth.clc",
"Fields", Array("smoothedtemp")

SaveNamedExpressions
Use:Saves a named expression definition to a file.
Command:In the Fields Calculator, click Save To... in the Library area.
Syntax:SaveNamedExpressions <FileName>, <NamedExpressions>, <BooleanFlag>
Return Value:None
Parameters:<FileName>
Type:<String>
Filename and full path to the file to hold the named expression definition.
<NamedExpressions>
Type: Array<string, string,...>
Array of strings containing the names of expression definitions to load from the file.
<BooleanFlag>
Type:<Boolean>
True: Overwrite the file.
False: Append to the file.

Fields Calculator Script Commands 19-16


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Example:
oModule.SaveNamedExpressions "C:\Ansoft\PersonalLib\smth.clc", Array
("smoothedtemp"), true

Fields Calculator Script Commands 19-17


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

PDF layout 19-18


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

20 - User Defined Solutions Commands


User Defined Solution commands should be executed by the "UserDefinedSolutionModule" mod-
ule.

Set oDesign = oProject.SetActiveDesign("TestDesign1")


Set oModule =
oDesign.GetModule("UserDefinedSolutionModule")

CreateUserDefinedSolution
DeleteUserDefinedSolutions
EditUserDefinedSolution

CreateUserDefinedSolution
Creates a new user defined solution.
Command: Create User Defined Solution popup menu is available in the Result folder context
menu when applicable.
Syntax: CreateUserDefinedSolution <SolutionName>, <PluginFileLocation>, <Plu-
ginFileRelativePathName>, <PropertyValuesArray>, <ProbeSelectionArray>, <Dynam-
icProbesArray>
Return Value: The name of the user defined solution that was created. Note: if the requested user
defined solution name is not available because it is already in use, the user defined solution will be
created with a different name which will be returned.
Parameters: <SolutionName>
Type: String
Requested name of new user defined solution.

<PluginFileLocation>
Type: String
Indicates the library where the UDS plugin file is located. This parameter must be one of
the following values: "SysLib", "UserLib", "PersonalLib".
<PluginFileRelativePathName>
Type: String

User Defined Solutions Commands 20-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

The path of the UDS plugin file relative to the "UserDefinedOutputs" subdirectory of the
library specified by <PluginFileLocation>.
<PropertyValuesArray>
Type: Array of strings
Strings specify name-value pairs corresponding to the UDS properties specified in the
plugin file.
For example:
Array("multiply_factor:=", "2.0", "component_name:=", "resistor1")

<ProbeSelectionArray>
Type: Array of <ProbeSelection>'s (see below)
The probe specification array specifies how UDS probes are defined and mapped to
traces in the design.
<ProbeSelection>
Type: Array of strings representing how a single probe is defined by a trace. The array
contains the following items:
<ReportType>
Type: String
See the CreateReport command for more information.
<ProbeName>
Type: String
Name of the probe being specified. Note: this must match a probe name specified in the
UDS plugin file.
<SolutionName>
Type: String
See the CreateReport command for more information.
<SimulatedValueContexArray>
Type: Array of strings
See the CreateReport command for more information.
<PointSetDefinitionArray>
Type: Array of values with optional overriding values and optional variable values.
See the CreateReport command for more information.

User Defined Solutions Commands 20-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<TraceExpressionArray>
Type: Array of strings and values.
This is similar to the TracesExpressionsArray used in the CreateReport command, but
there will only be a single component expression named "Probe Component." See the
CreateReport command for more information.
<ExtendedTraceInformationArray>
Type: Array of strings and values
See the CreateReport command for more information.
<DynamicProbesArray>
Type: Array of <ProbeSelection>'s, representing the probes that are used by dynamic-
probes.
VB Example:
oModule.CreateUserDefinedSolution "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")),
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.
Command: 'Delete' button from the "User Defined Solutions" dialog.
Syntax: DeleteUserDefinedSolutions <UserDefinedSolutionNames>
Return Value: None
Parameters:
<UserDefinedSolutionNames>
Type: Array of strings
Name of User Defined Solutions to be deleted.

User Defined Solutions Commands 20-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Example: Example:
oModule.DeleteUserDefinedSolutions Array("Solution1", "Solution2")

Python DeleteUserDefinedSolutions (<UserDefinedSolutionNames>)


Syntax

Python oModule.DeleteUserDefinedSolutions(["Solution1", "Solu-


Exampl- tion2"])
e

EditUserDefinedSolution
Updates an existing user defined solution
Command: Command: 'Edit' button in the User Defined Solutions dialog
Syntax: Syntax: EditUserDefinedSolution <ExistingSolutionName>, <NewSolutionName>, <Plu-
ginFileLocation>, <PluginFileRelativePathName>, <PropertyValuesArray>, <ProbeSelec-
tionArray>, <DynamicProbesArray>
Return Value: Return Value: the name of the user defined solution after being updated. Note: if the
requested user defined solution name is not available because it is already in use, the user defined
solution will be created with a different name which will be returned.
Parameters:
<ExistingSolutionName>
Type: String
Name of the existing user defined solution
<NewSolutionName>
Type: String
Requested name for the updated user defined solution.
<PluginFileLocation>
See CreateUserDefinedSolution for more information.
<PluginFileRelativePathName>
See CreateUserDefinedSolution for more information.
<PropertyValuesArray>
See CreateUserDefinedSolution for more information.
<ProbeSelectionArray>

User Defined Solutions Commands 20-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

See CreateUserDefinedSolution for more information.


<DynamicProbesArray>
See CreateUserDefinedSolution for more information.
VB Example:
oModule.EditUserDefinedSolution "User Defined Solution 1", _
"User Defined Solution 2",
"SysLib", "Example", Array("multiplication_factor:=", "1.2"),
Array(Array("Modal Solution Data", "Probe 1",
"Setup1 : LastAdaptive", Array(),
Array("Freq:=", Array("All")),
Array("Probe Component:=", Array("dB(S(1,1))")), Array()),
Array( "Modal Solution Data", "Probe 2",
"Setup1 : LastAdaptive", Array(),
Array("Freq:=", Array( "All")),
Array("Probe Component:=", Array("mag(S(1,1))")), Array())), Array
(Array("Modal Solution Data",
"Dynamic Probe 1",
"Setup1 : LastAdaptive", Array(),
Array("Freq:=", Array("All")),
Array("Probe Component:=", Array("Freq")), Array()))

EditUserDefinedSolution (<ExistingSolutionName>, <NewSolutionName>, <Plu-


Python
Syntax
ginFileLocation>, <PluginFileRelativePathName>, <PropertyValuesArray>,
<ProbeSelectionArray>, <DynamicProbesArray>)
oModule.EditUserDefinedSolution (
"User Defined Solution 1", "User Defined Solution 2",
"SysLib", "Example", ["multiplication_factor:=",

"1.2"],[["Modal Solution Data", "Probe 1",


Python "Setup1 : LastAdaptive", [], ["Freq:=",
Exampl-
e
["All"]], ["Probe Component:=", ["dB(S(1,1))"]],
[]], ["Modal Solution Data", "Probe 2",
"Setup1 : LastAdaptive", [], ["Freq:=",
["All"]], ["Probe Component:=",
["mag(S(1,1))"]], []]], [["Modal _

User Defined Solutions Commands 20-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Solution Data", "Dynamic Probe 1", "Setup1 : LastAdaptive",


[], ["Freq:=", ["All"]],
["Probe Component:=", ["Freq"]], []]])

User Defined Solutions Commands 20-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

21 - NdExplorer Script Commands


The definition manager controls the use of NdExplorer for scripts.
Set oProject = oDesktop.SetActiveProject("Project1")
Set oDefinitionManager = oProject.GetDefinitionManager()

NdExplorer Manager Script Commands


The NdExplorer manager provides access to scripting for NdExplorer. The manager object is
accessed via the definition manager.
Set oDefinitionManager = oProject.GetDefinitionManager()
Set oNdExplorerManager = oDefinitionManager.GetManager("NdExplorer")

The NdExplorere manager script commands are listed below.


ExportFullWaveSpice [NdExplorer]
ExportNetworkData [NdExplorer]
ExportNMFData [NdExplorer]

ExportFullWaveSpice [NdExplorer]
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

NdExplorer Script Commands 21-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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 "Con-
vexOptimization",
                                          // "PassivityByPerturbation", or "IteratedFittingOfPV"
"ColumnFittingType:=", "Column", // Column FittingType can be "Column", "Entry", "Mat-
rix"
"SSFittingType:=", "TWA", // SS Fitting Type can be "TWA", "IterativeRational"
"RelativeErrorToleranc:=", false, // Relative error tolerance true/false
"TouchstoneFormat:=", "MA", // Touchstone Format "MA", "RI", "DB"
"TouchstoneUnits:=", "Hz", // Touchstone Units "Hz", "KHz", "MHz", "MHz"
"TouchStonePrecision:=", 8, // Touchstone precision
"ExportDirectory:=", "C:/Examples/LNA/", // Directory to export to
"ExportSpiceFileName:=", "Linckt_HBTest_2.sss", // Spice export file
"FullwaveSpiceFileName:=", "Linckt_HBTest.sss", // FWS file
"CreateNPortModel:=", true // Create a model based on the exported file true/false
)

ExportNetworkData [NdExplorer]
Use: Export the solution in a format of your choice (Citifile, Spreadsheet, Matlab, Touchstone, Neut-
ral)
Command: File > Export SYZ Data
Syntax: ExportNetworkData
"DesignName", // Design name. Can be left blank, if loading solution from a file.
true/false, // true - solution loaded from file, false- loaded from design
"Name", // If loading from design this is the solution name, else this is the
                  // full path of the file from which the solution is loaded
"ExportFile", // full path of file to export to
"variation", // Pick a particular variation. Leave blank if no variation
Array("NAME:Frequencies"), // optional, if none defined all frequencies are used

NdExplorer Script Commands 21-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Array("NAME:Options", // Export options object


"DataTypes:=", Array("S"), // DataTypes can be "S", "Y","Z", "G", and "Z0",
                                              // for S , Y, Z matrix, Gamma and Z0 (zero)
"DisplayFormat:=", "MA", // DisplayFormat "MA", "RI", "DB"
"FileType:=", "", // Export File Type
                               // 2 - Spreadsheet(*.tab)
// 3 - Touchstone(*.sNp)
// 4 - Citifile(*.cit)
// 6 - Neutral format(*.nmf)
// 7 - Matlab format(*.m)
"Renormalize:=", false, // Renormalize true/false
"RefImpedance:=",50, // Reference Impedance
"Precision:=", 8, // Number of digits Precision
"CreateNPortModel:=", true // Create a model based on the exported file true/false
)

ExportNMFData [NdExplorer]
Use: Export the solution in NMF format.
Command: File > Export SYZ Data
Syntax: ExportNMFData
"DesignName", // Design name. Can be left blank, if loading solution from a file.
true/false, // true - solution loaded from file, false- loaded from design
"Name", // If loading from design this is the solution name, else this is the
                 // full path of the file from which the solution is loaded
"ExportFile", // full path of file to export to
Array("NAME:Frequencies"), // optional, if none defined all frequencies are used
Array("NAME:NMFOptions", // Export NMF options object
"DataTypes:=", Array("S"), // DataTypes can be "S", "Y","Z", "G", and "Z0",
                                              // for S , Y, Z matrix, Gamma and Z0 (zero)
"DisplayFormat:=", "MA", // DisplayFormat "MA", "RI", "DB"

NdExplorer Script Commands 21-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"FileType:=", "", // Export File Type


// 2 - Spreadsheet(*.tab)
// 3 - Touchstone(*.sNp)
// 4 - Citifile(*.cit)
// 6 - Neutral format(*.nmf)
// 7 - Matlab format(*.m)
"Renormalize:=", false, // Renormalize true/false
"RefImpedance:=",50, // Reference Impedance
"Precision:=", 8, // Number of digits Precision
"Variables:=", ARRAY("FF", "cap", "Rs") // Array of variables
"Variations:=", ARRAY("", "", "") // Array of variations to export solutions for
Array("NAME:ConstantVars") // Array of variables that are constant, can be empty
Array("NAME: DependentVars") // Array of variables that are dependent, can be empty
"MatrixSize:=", 2, // Matrix size, optional (used in nmf file header)
"CreateNPortModel:=", true // Create a model based on the exported file true/false
)

NdExplorer Script Commands 21-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

22 - 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 CompInstance.
You can obtain an interface to a CompInstance in a schematic or layout by calling oEd-
itor.GetCompInstanceFromRefDes(refDes). For more information see Layout Scripting and
Schematic Scripting. This interface is also available as a CompInstance object in CompInstance
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
<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.

CompInstance Script Commands 22-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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

Name Type Description


Parameters
None

String
Return Value
name of component (e.g. MS_TRL) and stores it in "name"

Python Syn- GetComponentName()


tax

Python name = CompInstance.GetComponentName()


Example

VB Syntax GetComponentName()
VB Example name = CompInstance.GetComponentName()

GetEditor [Component Instance]


Use: Returns an interface to the editor requested — if the compInstance is contained within that
type of editor. Common editor names are "SchematicEditor" and "Layout".
Command: None
Syntax: GetEditor(<editorName>)
Return Value: Returns interface to editor requested.

CompInstance Script Commands 22-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

VB Example:
Set oLayout2 = CompInstance.GetEditor("Layout");
Returns the interface to the layout containing a selected component.
This interface can be used to call Layout Scripting functions.

Python Syn- GetEditor(<editorName>)


tax

Python oLayout2 = CompInstance.GetEditor("Layout")


Example

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 Syn- GetInstanceID()


tax

Python id = CompInstance.GetInstanceID()
Example

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.

CompInstance Script Commands 22-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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; for more information see Nexxim
Scripting or HFSS 3D Layout Scripting.

Python Syn- GetParentDesign()


tax

Python oDesign2 = CompInstance.GetParentDesign()


Example

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 Syn-  GetPropServerName()


tax

Python name = CompInstance.GetPropServerName()


Example

CompInstance Script Commands 22-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

23 - Definition Manager Script Commands


The definition manager controls the use of materials and scripts in a Circuit project. It also provides
access to the managers for symbols, footprints, padstacks, and components in a Circuit project.
Set oProject = oDesktop.SetActiveProject("Project1")
Set oDefinitionManager = oProject.GetDefinitionManager()
The topics for this section include:
Component Manager Script Commands
Component Manager SOD Script Commands
Model Manager Script Commands
Symbol Manager Script Commands
Footprint Manager Script Commands
Padstack Manager Script Commands
Material Manager Script Commands
NdExplorer Manager Script Commands
Script and Library Scripts

Component Manager Script Commands


The component manager provides access to components in a Circuit 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
ClearSolutionCache
Edit
EditWithComps
Export
GetData
GetNames

Definition Manager Script Commands 23-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetNPortData
IsUsed
Remove
RemoveUnused
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>),
Array("NAME:Properties", // any combo of the following
"CheckboxProp:=", <CheckBoxInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,

Definition Manager Script Commands 23-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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

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>,

Definition Manager Script Commands 23-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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 dia-
log, checking different boxes in the "Specify products for which this component 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 system 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

Definition Manager Script Commands 23-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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>:
<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,

Definition Manager Script Commands 23-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

// 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>)

<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()

Definition Manager Script Commands 23-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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>:
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

Definition Manager Script Commands 23-7


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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
<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 23-8


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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
<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 23-9


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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:=", "", _
"ModifiedOn:=", 1071096503, _
"Manufacturer:=", "Ansys", _
"Symbol:=", "bendo", _
"Footprint:=", "BENDO", _
"Description:=", "",_
"InfoTopic:=", "", _
"InfoHelpFile:=", "", _
"IconFile:=", "", _
"LibraryName:=", "", _
"OriginalLocation:=", "Project", _

Definition Manager Script Commands 23-10


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Author:=", "", _
"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, _
"", _
"Electrical"), _
Array("NAME:Parameters", _
"MenuProp:=", Array("CoSimulator", _
"D", _
"", _
"Default,HFSS 3D Layout,Circuit,Custom,Netlist", _
0), _
"ButtonProp:=", Array("CosimDefinition", _
"D", _

Definition Manager Script Commands 23-11


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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, _
"DefinitionCompName:=", ""), _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 3, _
"CosimDefName:=", "Netlist", _
"IsDefinition:=", true, _
"NetlistString:=", "")))

Definition Manager Script Commands 23-12


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Add [("NAME:<ComponentName>",
"Info:=", <ComponentInfo>,
"RefBase:=", <string>, // reference designator
"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>,

Python Syn- "SeparatorProp:=", <SeparatorInfo>,


tax
"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>,

Definition Manager Script Commands 23-13


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<CosimDefInfo>...]]

oComponentManager.Add(
[
"NAME:Component",
"Info:=", [
"Type:=", 0,
"NumTerminals:=", 0,
"DataSource:=", "",
"ModifiedOn:=", 1467910752,
"Manufacturer:=", "",
"Symbol:=", "Component",
"ModelNames:=", "",
"Footprint:=", "",
"Description:=" , "",

Python "InfoTopic:=", "",


Example
"InfoHelpFile:=", "",
"IconFile:=", "",
"Library:=", "",
"OriginalLocation:=", "Project",
"IEEE:=", "",
"Author:=", "",
"OriginalAuthor:=", "",
"CreationDate:=", 1467910746,
"ExampleFile:=", ""],
"Refbase:=", "U",
"NumParts:=", 1,
"ModSinceLib:=", True,
"CompExtID:=", 2
])

Definition Manager Script Commands 23-14


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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
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>...))
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 23-15


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

// 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
Array("NAME:ComponentData", _
"ComponentDataType:=", "DesignerData", _
"name:=", "DesignerData", _
"filename:=", _
"C:/Program Files/An-
sysEM/Designer/Examples/Projects/optiguides/optiguides.adsn", _
"numberofports:=", 2, _
"DesignName:=", "DesignerModel1", _
"SolutionName:=", "Setup1 : Adaptive_1", _
"Simulate:=", true, _
"CloseProject:=", false, _
"SaveProject:=", true, _

Definition Manager Script Commands 23-16


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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"), _
"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 23-17


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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",
// 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

Definition Manager Script Commands 23-18


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

// 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
// 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

Definition Manager Script Commands 23-19


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

// 3 : Extrapolate from data provided (not recommended)

<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, _
"NoiseDataTab:=", true, _
"DCBehaviorTab:=", true, _
"SolutionName:=", "", _
"displayformat:=", "MagnitudePhase", _
"datatype:=", "SMatrix", _
"ShowRefPin:=", true, _
"RefNodeCheckbox:=", false, _
"DCOption:=", 3, _

Definition Manager Script Commands 23-20


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"InterpOption:=", 1, _
"ExtrapOption:=", 3, _
"DataType:=", 2, _
"DCOption:=", 3, _
"InterpOption:=", 1, _
"ExtrapOption:=", 3, _
"DataType:=", 2)

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 com-
ponent
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>,
"Terminal:=", <TerminalInfo>, ...
// The remaining parameters are optional

Definition Manager Script Commands 23-21


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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",
"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>:

Definition Manager Script Commands 23-22


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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>,
"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 dia-
log, checking different boxes in the "Specify products for which this component 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 23-23


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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 system 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
"Electrical", "Magnetic", "Fluidic", "Translational",
"Translational_V", "Rotational", "Rotational_V",
""Radiant", "Thermal", or <VHDLPackageName>

<VHDLPackageName>:
<string> // in the form <Library>.<Package>

Definition Manager Script Commands 23-24


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<bool>) // value: true or false

<ButtonInfo>:
Array(<string>, // name
<FlagLetters>,

Definition Manager Script Commands 23-25


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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

<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>:

Definition Manager Script Commands 23-26


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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
"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>,

Definition Manager Script Commands 23-27


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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

<QuantityPropInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
<string>, // value
<TypeString>,
<TypeStringDependentInfo>)

<TypeString>:
<string> // "Across", "Through", or "Free"

Definition Manager Script Commands 23-28


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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",
// "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 23-29


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

final array member for Netlist:


"NetlistString:=", <string>
VB Example:
Dim name
name = oComponentManager.Edit ("Nexxim Circuit Ele-
ments\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", _
"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, _

Definition Manager Script Commands 23-30


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

0, _
"", _
"Electrical"), _
"Terminal:=", Array("base", _
"base", _
"A", _
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", _
"Name of model data reference", _
"required"), _
"VariableProp:=", Array("AREA", _
"D", _

Definition Manager Script Commands 23-31


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Emitter area multiplying factor, which affects curents, res-


istances, 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", _
"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-
B=@AREAB) *AREAC(AREAC=@" & _
"AREAC) *DTEMP(DTEMP=@DTEMP) *M(M=@M)", _
1, _
"ButtonPropClientData:=", Array()), _
"TextProp:=", Array( "ModelName", _
"HD", _
"", _

Definition Manager Script Commands 23-32


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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:=", "", _
"CreationDate:= ", 1147460679), _
"Refbase:=", "U", _
"NumParts:=", 1, _
"OriginalComponent:=", "", _
"Terminal:=", Array("n1", _
"n1", _
"A", _
false, _
0, _
0, _

Definition Manager Script Commands 23-33


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"", _
"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", _
"", _
"", _
"Edit", _
0, _
"ButtonPropClientData:=", Array())), _
Array("NAME:CosimDefinitions", _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 0, _
"CosimDefName:=", "HFSS3D", _
"IsDefinition:=", true, _
"CosimStackup:=", "Layout stackup", _
"CosimDmbedRatio:=", 3), _

Definition Manager Script Commands 23-34


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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:=", "")))

Edit <ComponentName>,
["NAME:<NewComponentName>",
"Info:=", <ComponentInfo>,
"RefBase:=", <string>, // reference designator
"NumParts:=", <int>, // parts per component
Pytho- "OriginalComponent:=", <string>
n Syn-
tax "Terminal:=", <TerminalInfo>,
"Terminal:=", <TerminalInfo>, ...
#The remaining parameters are optional
["NAME:Parameters", // any combo of the following
"VariableProp:=", <VariableInfo>,
"CheckboxProp:=", <CheckBoxInfo>,

Definition Manager Script Commands 23-35


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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>),
"VPointProp:=", <VPointInfo>,
"PointProp:=", <PointInfo>),
["Quantities",
"QuantityProp:=", <QuantityPropInfo>...],
["NAME:CosimDefinitions",
<CosimDefInfo>,
<CosimDefInfo>...])
name = oComponentManager.Edit ("Simplorer Circuit Ele-
ments\BJTs:Level01_NPN", _
["NAME:Level01_NPN", "Info:=", ["Type:=", 4294901764,_
"NumTerminals:=", 3, "DataSource:=", "Ansoft built-in com-
Pytho- ponent",_
n
"ModifiedOn:=", 1152722112, "Manufacturer:=", "", _
Exam-
ple "Symbol:=", "nexx_bjt_npn", "Footprint:=", "", _
"Description:=", "BJT, GP, NPN", "InfoTopic:=",
"NXBJT1.htm", _
"InfoHelpFile:=", "nexximcomponents.chm", "IconFile:=", "bjt-
sn.bmp", _

Definition Manager Script Commands 23-36


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Library:=", "Nexxim Circuit Elements\BJTs",_


"OriginalLocation:=", "SysLibrary ", "Author:=", "", _
"OriginalAuthor:=", "", "CreationDate:=", 1152722102], _
"Refbase:=", "Q", "NumParts:=", 1, "Terminal:=", ["col-
lector", _
"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
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=@" & _

Definition Manager Script Commands 23-37


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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", _

"Symbol:=", "bendo", "Footprint:=", "BENDO", _

Pytho- "Description:=", "", "InfoTopic:=", "", _


n
Exam-
ple
2 "InfoHelpFile:=", "", "IconFile:=", "", _

"LibraryName:=", "", "OriginalLocation:=", "Project", _

"Author:=", "", "OriginalAuthor:=", "", _

"CreationDate:= ", 1147460679], "Refbase:=", "U", _

"NumParts:=", 1, "OriginalComponent:=", "", _

"Terminal:=", ["n1", "n1", "A", false, 0, 0, "", _

Definition Manager Script Commands 23-38


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Electrical"], "Terminal:=", ["n2", "n2", "A", _

false, 1, 0, "", Electrical"], ["NAME:Parameters", _

"MenuProp:=", ["CoSimulator", "D", "", _

"Default,Custom,Netlist", 0], "ButtonProp:=", ["CosimDefin-


ition", _

"D", "", "", "Edit", 0, "ButtonPropClientData:=", []]], _

["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", _

Definition Manager Script Commands 23-39


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"IsDefinition:=", true, "DefinitionCompName:=", ""], _

["NAME:CosimDefinition", "CosimulatorType:=", 3, _

"CosimDefName:=", "Netlist", "IsDefinition:=", true, _

"NetlistString:=", ""]]])

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
<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>:

Definition Manager Script Commands 23-40


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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

<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
// "O" : output pin

Definition Manager Script Commands 23-41


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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>:
<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

Definition Manager Script Commands 23-42


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

// 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
<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 23-43


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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
<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 23-44


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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

<ImageInfo>:
"Image:=", Array(<RectInfo>,
<ImageData>,
<bool>) // is mirrored

<ImageData>:
<string>, // file path

Definition Manager Script Commands 23-45


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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> ...
// 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, _
0.00254, _
0, _
"N", _
0, _
0, _
false, _
0, _

Definition Manager Script Commands 23-46


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

true, _
"", _
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), _
"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, _

Definition Manager Script Commands 23-47


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

0.00504119, _
0, _
1, _
5, _
false, _
"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>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

VB Example:

Definition Manager Script Commands 23-48


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oComponentManager.Export Array("NAME:mylib", "Nexxim Circuit Ele-


ments\BJTs:Level01_NPN"),"PersonalLib"

Python Export(["NAME:<LibraryName>", <ComponentName>, <ComponentName>...],


Syntax <LibraryLocation>)
oComponentManager.Export(["NAME:mylib",
Python
"Simplorer Circuit Elements\BJTs:Level01_NPN"],
Example
"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")

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. Accord-
ingly, 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 GetData(<DefinitionName>)
Syntax

Python compData = oComponentManager.GetData("Level01_NPN")


Example

Definition Manager Script Commands 23-49


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetNames [component manager]


Returns the names of the components (used and unused) in a design. The following script com-
mand, 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()

Python Syn- GetNames()


tax

Python componentNames = oComponentManager.GetNames()


Example

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

Definition Manager Script Commands 23-50


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

curr = x(index)
If TypeName(curr) <> "Variant()" Then
If TypeName(curr) <> "Empty" And TypeName(curr) <> "Null"
Then
str = CStr(curr)
If str = "" Then
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
Dim index

Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")


Set oDesktop = oAnsoftApp.GetAppDesktop()

Definition Manager Script Commands 23-51


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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
index = index + 1
Next

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>
VB Example:
Dim isUsed
isUsed = oComponentManager.IsUsed("MyComponent")

Definition Manager Script Commands 23-52


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python  IsUsed(<ComponentName>)
Syntax

Python IsUsed = oComponentManager.IsUsed("MyComponent")


Example

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

<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 Remove (<ComponentName>, <IsProjectComponent>, <LibraryName>,

Definition Manager Script Commands 23-53


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syntax <LibraryLocation>)

Python oComponentManager.Remove ("Simplorer Circuit


Example Elements\BJTs:Level01_NPN", _ true, "Project")

RemoveUnused [component manager]


Removes components 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 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 RemoveUnused()
Syntax

Python removedDefs = oComponentManager.RemoveUnused()


Example

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 23-54


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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 com-
ponent
VB Example:
oComponentManager.UpdateDynamicLink("TeeModel_L1")

Component Manager SOD Script Commands


The component manager Solver On Demand (SOD) scripts provide access to components in a pro-
ject. The manager object is accessed via the definition manager.
Set oDefinitionManager = oProject.GetDefinitionManager()
Set oComponentManager = oDefinitionManager.GetManager("Component")
The component manager SOD script commands are listed below:
AddAddSolverOnDemandModel
EditSolverOnDemandModel
GetSolverOnDemandData
GetSolverOnDemandModelList
RemoveSolverOnDemandModel
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.
Return Value: Returns the name of the model added.
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.

Definition Manager Script Commands 23-55


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Parameters: BSTR component name.


Parameters: BSTR SOD model name.
Parameters: VARIANT which is the new SOD model data (can include
changed name).

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 component.
Parameters: BSTR component name.
Return Value: VARIANT which is a list of SOD model names.
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 com-
ponent.
Parameters: BSTR component name.
Parameters: BSTR SOD model name
Return Value: None.

odel 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

Definition Manager Script Commands 23-56


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

EditWithComps
Export
GetData
GetNames
IsUsed
Remove
RemoveUnused

Add [model manager]


Use: Add a model
Command: Tools > Edit Configured Libraries > Models > Add Model
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 23-57


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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
// "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>:

Definition Manager Script Commands 23-58


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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
// 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>:

Definition Manager Script Commands 23-59


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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

<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

Definition Manager Script Commands 23-60


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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

<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 23-61


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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

<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:
oModelManager.Add Array("NAME:MyModel",_
"ModTime:=", 1070989137, _
"Library:=", "", _

Definition Manager Script Commands 23-62


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"LibLocation:=", "Project", _
Array("NAME:PinDef", _
"Pin:=", Array ("newpin0", _
0.00254, _
0, _
0, _
"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, _
"",_
false, _
false)),
Array("NAME:Graphics", _

Definition Manager Script Commands 23-63


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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)))

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 Con-
vertToDynamic.
Syntax: ConvertToDynamic(defName, newname)
Return Value: <newname> // Name of the new model added
Parameters: <defName> // Model that is the base for the new con-
version
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.
Command: Right-click on a model under Definitions/Models in the Project Tree and choose Con-
vertToParametric.
Syntax: ConvertToParametric(defName, newname)

Definition Manager Script Commands 23-64


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Return Value: <newname> // Name of the new model added


Parameters: <defName> // Model that is the base for the new con-
version
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

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

Definition Manager Script Commands 23-65


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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

Definition Manager Script Commands 23-66


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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>:
<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

Definition Manager Script Commands 23-67


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

// 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
<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 23-68


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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>:
<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 23-69


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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
// 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

Definition Manager Script Commands 23-70


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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 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, _
0, _
false, _
0, _
true, _
"", _
false, _

Definition Manager Script Commands 23-71


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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), _
"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, _

Definition Manager Script Commands 23-72


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

5, _
false, _
"Arial", _
0, _
"W=***"))))), _
rray("MY_COMP")

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 Ele-
ments\Distributed\Distributed:bendo:mylib", _ "myModel"), "Per-
sonalLib"

Definition Manager Script Commands 23-73


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Python Export (["NAME:<LibraryName>", <ComboName>, <ComboName>...],


Syntax <LibraryLocation>)
Python oModelManager.Export (["NAME:mylib", "model1", "model2"])
Example

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 Ele-
ments\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. Accord-
ingly, 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 Syn- GetData(<ComboName>)


tax

Python dataArray = oModelManager.GetData


Example ("mylib:mymodel")

GetNames [model manager]


Use: Returns the names of the models (used and unused) in a design. The following script com-
mand, IsUsed, can then be used to separate used and unused models.
Command: None
Syntax: GetNames()

Definition Manager Script Commands 23-74


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Return Value: An array of strings


Parameters: None
VB Example:
Dim modelNames
modelNames = oModelManager.GetNames()

Python Syn- GetNames()


tax

Python modelnames = oModelManager.GetNames()


Example

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
Parameters: <ModelName>:
<string>
VB Example:
Dim isUsed
isUsed = oModelManager.IsUsed("MyModel")

Python IsUsed(<ComboName>)
Syntax

Python isused = oModelManager.IsUsed ("mylib:mymodel")


Example

Remove [model manager]


Use: Removes a model from a library
Command: Tools > Edit Configured Libraries > Models > Remove Model
Syntax: Remove <ModelName>,
<IsProjectModel>,

Definition Manager Script Commands 23-75


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<LibraryName>,
<LibraryLocation>
Return Value: None
Parameters: <ModelName>:
<string> // composite name of the model to remove

<IsProjectModel>:
<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 Ele-
ments\Distributed\Distributed:bendo", true, "Project"

Python Syn- Remove (<ModelName>, <IsLocal>, <LibraryName>, <LibraryLocation>)


tax

Python
oModelManager.Export([
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 23-76


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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 unus-
able.

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 RemoveUnused()
Syntax

Python thereWereExtras = oModelManager.RemoveUnused()


Example

ymbol 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
EditWithComps
Export
GetData
GetNames
IsUsed

Definition Manager Script Commands 23-77


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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

Definition Manager Script Commands 23-78


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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
<bool>, // true if number is to be shown

<PropDisplayMapInfo>:
Array("NAME:PropDisplayMap",
<PropDisplayInfo>,
<PropDisplayInfo>,...)

<PropDisplayInfo>:

Definition Manager Script Commands 23-79


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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>:
<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>,

Definition Manager Script Commands 23-80


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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

Definition Manager Script Commands 23-81


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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

<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 23-82


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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
// 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 23-83


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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, _
"",_
false, _
false)),
Array("NAME:Graphics", _
"Rect:=", Array(0, _
0, _
12566272, _
0, _
4.33680868994202e-019, _
-0.000635, _

Definition Manager Script Commands 23-84


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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.
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", "Selec-
tions:=", 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

Definition Manager Script Commands 23-85


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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 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>:
Array("NAME:PinDef",
"Pin:=", Array (<string>, // pin name
<real>, // x location
<real>, // y location
<real>, // angle in radians
<PinType>,
<real>, // line width

Definition Manager Script Commands 23-86


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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
<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>:

Definition Manager Script Commands 23-87


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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

<GraphicsDataInfo>:
Array("NAME:Graphics",
// one or more of the following
<RectInfo>,
<CircleInfo>,
<ArcInfo>,
<LineInfo>,
<PolygonInfo>,
<TextInfo>,
<ImageInfo>)

Definition Manager Script Commands 23-88


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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

<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 23-89


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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>,
<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

Definition Manager Script Commands 23-90


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

// 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> ...
// 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, _

Definition Manager Script Commands 23-91


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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, _
"", _
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 23-92


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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=***"))))), _
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

Definition Manager Script Commands 23-93


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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"

VB Example:
oSymbolManager.Export _
Array("NAME Nexxim Circuit Ele-
ments\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 Ele-
ments\Hspice:nexx_bjt_npn")

Definition Manager Script Commands 23-94


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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. Accord-
ingly, 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 [symbol manager]


Use: Returns the names of the symbols (used and unused) in a design. The following script com-
mand, 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")

Remove [symbol manager]


Use: Removes a symbol from a library
Command: Tools > Edit Configured Libraries > Symbols > Remove Symbol
Syntax: Remove <SymbolName>,
<IsProjectSymbol>,
<LibraryName>,

Definition Manager Script Commands 23-95


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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:
oSymbolManager.Remove "Nexxim Circuit Ele-
ments\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()

Definition Manager Script Commands 23-96


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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.

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
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",

Definition Manager Script Commands 23-97


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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
<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

Definition Manager Script Commands 23-98


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

// 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>:
<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

Definition Manager Script Commands 23-99


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

// "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)
<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

Definition Manager Script Commands 23-100


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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
<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 23-101


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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
<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 23-102


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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

<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>)

<Location>:
<string> specifying real number and units (may use variables)

Definition Manager Script Commands 23-103


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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

<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

Definition Manager Script Commands 23-104


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

// -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",
// 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>…)

<EdgePortArray>:

Definition Manager Script Commands 23-105


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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>

<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)

Definition Manager Script Commands 23-106


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<ComponentPropertyInfo>:
Array("NAME:CProps",
"VariableProp:=", <VariableInfo>,
"VariableProp:=", <VariableInfo>,
…)

<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

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 23-107


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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", _
"ID:=", 4, _
"T:=", "assembly", _
"TB:=", "top", _
"Col:=", 16711680, _
Pat:=", 3), _
"Layer:=", Array("N:=", "Silkscreen", _
"ID:=", 5, _
"T:=", "silkscreen", _
TB:=", "top", _
"Col:=", 8454143, _

Definition Manager Script Commands 23-108


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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:=", "")), _
"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", _

Definition Manager Script Commands 23-109


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Mat:=", "")), _
"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", _
"ID:=", 7, _
"T:=", "dielectric", _
"Col:=", 127, _
"Pat:=", 7), _
"Elev:=", "none", _
"SubL:=", Array("Th:=", "1mm", _
"LElev:=", "0mil", _
"R:=", "0mil", _

Definition Manager Script Commands 23-110


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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", _
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",

Definition Manager Script Commands 23-111


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"P:=", Array("Port:=", Array("Id:=", 3, "N:=", "n1"), _


"Pos:=", Array("x:=", "-P/2", "y:=", "0mm"), _
"VRt:=", "180deg", _
"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",_
"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"),_

Definition Manager Script Commands 23-112


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"HD:=", "1mm", _
"Ref:=", 5)), _
Array("NAME:Nets"), _
Array("NAME:CProps",
"VariableProp:=", Array("W", _
"UD", _
"", _
"1.5mm"),_
"VariableProp:=", Array("P", _
"UD", _
"", _
10mm"))))

Edit [footprint manager]


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>...),

Definition Manager Script Commands 23-113


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"ActLyr:=", <string>, // name of active layer


"Tol:=", <ToleranceArray> // optional
<PrimitivesInfo>, // optional
<PinsInfo>, // optional
<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.

<UnitType>:
<string> // default length units to use if units are not specified in other
// parameters

<LayerArray>:

Definition Manager Script Commands 23-114


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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>,
"SubL:=", Array("Th:=", <Dimension>,
"LElev:=", <Dimension>,
"R:=", <Dimension>,
"M:=", <MaterialInfo>))

<ElevationInfo>:
<string> // "top" - snap to top
// "mid" - snap to middle
// "bot" - snap to bottom

Definition Manager Script Commands 23-115


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

// "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)
<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

Definition Manager Script Commands 23-116


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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
<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 23-117


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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>: <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 23-118


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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
"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>:

Definition Manager Script Commands 23-119


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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

<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 23-120


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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>),
"VRt:=", <Angle>, // optional - rotation
<ImplementationInfo>

<EdgeportsInfo>:
Array("NAME:EPorts", <EdgePortArray>, <EdgePortArray>…)

<EdgePortArray>
Array("NAME:EP",
"LP:=", Array("Id:=", <int>, // port id

Definition Manager Script Commands 23-121


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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

<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",

Definition Manager Script Commands 23-122


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"VariableProp:=", <VariableInfo>,
"VariableProp:=", <VariableInfo>,
…)

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

VB Example:
Dim nam
oFootprintManager.EditWithComps _
("Nexxim Circuit Elements\Distributed\Distributed:bendo", _
Array("NAME:bendo new name", _
"ModTime:=", 1152722165, _

Definition Manager Script Commands 23-123


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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, _
"", _
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 23-124


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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=***"))))), _
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>,
<FootprintName>...),
<LibraryLocation>
Return Value: None
Parameters: <LibraryName>:

Definition Manager Script Commands 23-125


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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 Foot-
prints:BPAD"), "PersonalLib"

GetData [footprint manager]


FootprintGetData
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 footprintData
footprintData = oFootprintManager.GetData("Nexxim Circuit Ele-
ments\Distributed\Nexxim_Footprints: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. Accord-
ingly, 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 23-126


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetNames [footprint manager]


Use: Returns the names of the footprints (used and unused) in a design. The following script com-
mand, 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()

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 23-127


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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:
Dim removedDefs
removedDefs = oFootprintManager.RemoveUnused()

Definition Manager Script Commands 23-128


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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.

adstack 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.
AddPortsToAllNets
AddPortsToNet
Add
Edit
EditWithComps
Export
GetData
GetNames
IsUsed
Remove
RemovePortsFromAllNets
RemovePortsFromNet
RemoveUnused

AddPortsToAllNets [padstack manager]


Use: Adds ports to all the pins in all the nets.
Command: Layout tab under Nets r-click>Create Ports

Definition Manager Script Commands 23-129


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syntax: AddPortsToAllNets
Return Value: None
Parameters: None.
VB Example:
oEditor. AddPortsToAllNets
AddPortsToNet [padstack manager]
Use: Add ports to all the pins on the designated nets.
Command: In Layout r-click>Port>Create Ports on Net
Layout tab under Nets r-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.
VB Example:
oEditor.AddPortsToNet Array("NAME:Nets", "CB1", "CB5")

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 23-130


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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.

<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

Definition Manager Script Commands 23-131


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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
"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 23-132


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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>:
<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:=", _

Definition Manager Script Commands 23-133


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"", "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( _
"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:=", _

Definition Manager Script Commands 23-134


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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>,
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>,

Definition Manager Script Commands 23-135


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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: <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
"thm:=", <PadInfo>, // themal pad
"X:=", <string>, // pad x connection, real with units
"Y:=", <string>, // pad y connection, real with units

Definition Manager Script Commands 23-136


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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
"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

Definition Manager Script Commands 23-137


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Any" // any direction


"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>:
<string> one of these choices
"abv" // above padstack
"blw" // below padstack

<PadPortLayerArray>:
Array( <int>, <int>,....) where each int is a layer id

VB Example:

Definition Manager Script Commands 23-138


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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:=", _
"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( _

Definition Manager Script Commands 23-139


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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>,
"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 23-140


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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>,
Array(<ListOfComponentNames>) // Component names

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

Definition Manager Script Commands 23-141


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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
"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

Definition Manager Script Commands 23-142


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

// 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
"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 23-143


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"blw" // below padstack

<PadPortLayerArray>:
Array( <int>, <int>,....) where each int is a layer id

<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( _
"3mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array
("shp:=", "No", "Szs:=", Array(), "X:=", _

Definition Manager Script Commands 23-144


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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), Array("")

Export [padstack manager]


Use: Export a padstack to a library
Command: Tools > Edit Configured Libraries > Padstacks > Export to Library

Definition Manager Script Commands 23-145


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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:
oPadstackManager.Export Array("NAME:mylib", "myPadstack"), "Per-
sonalLib"

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")

Definition Manager Script Commands 23-146


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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. Accord-
ingly, 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 com-
mand, IsUsed, can then be used to separate used and unused padstacks.
Command: None
Syntax: GetNames()
Return Value: An array of strings
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>,

Definition Manager Script Commands 23-147


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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"

RemovePortsFromAllNets [padstack manager]


Use: Removes ports from all the pins in all the nets.
Command: Layout tab under Nets r-click>Remove Ports
Syntax: RemovePortsFromAllNets
Return Value: None
Parameters: None.
VB Example: oEditor.RemovePortsFromAllNets

RemovePortsFromNet [padstack manager]


Use: Removes ports from all the pins on the designated nets.
Command: In Layout r-click>Port>Remove Ports from Net

Definition Manager Script Commands 23-148


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Layout tab under Nets r-click>Remove Ports


Syntax: RemovePortsFromNet
Return Value: None
Parameters: None.
VB Example:
oEditor.RemovePortsFromNet

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

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 material manager script commands are listed below.
Add
Edit
Export

Definition Manager Script Commands 23-149


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetData
GetNames
GetProperties
IsUsed
Remove
RemoveUnused

Add [material manager]


Use: Add a material to the project.
Command: None.
Syntax: Add <material_name> <property1_name> <property1_value> <property2_name> <prop-
erty2_value> ...
Return Value: Name of the created material.
Parameters: <material_name>
Type: string
Value: A string made up of the keyword "NAME", followed by a colon and the name of
the material, e.g. "NAME:MyMaterial"
<property_name> <property_value>
Type: strings
Value: Arbitrary number of property-name/property-value pairs
Example:
createdMaterial = oMaterialMgr.Add( Array("NAME:MyMaterial1",
"CoordinateSystemType:=", "Cartesian", "permittivity:=", "0.123") )
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow

Definition Manager Script Commands 23-150


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oProject = oDesktop.NewProject


oProject.InsertDesign "Nexxim Circuit", "Nexxim1", "", ""
Set oMaterialMgr = oProject.GetDefinitionManager().GetManager("Mater-
ial")
Dim createdMat
createdMat = oMaterialMgr.Add( Array("NAME:MyMaterial1", "Coordin-
ateSystemType:=", "Cartesian", "permittivity:=", "0.123") )
Dim message
message = "Created material '" + createdMat + "'"
Msgbox message

Edit [Material Manager]


Edit properties of a project material.
Command: None.
Syntax: Edit <material_name> <material_data>
Return Value: None
Parameters: <material_name>
Type: string
Value: Name of the project material to edit.
<material_data>
Type: Array
Value: New material data.
Example:
oMaterialMgr.Edit( "MyMaterial2", Array("NAME:MyMaterial2_mod",
"CoordinateSystemType:=", _
"Cartesian", Array("NAME:AttachedData"), Array("NAME:ModifierData"),
"permittivity:=", _
"123", "permeability:=", "0.987654", "conductivity:=", "58000000",
"thermal_conductivity:=", _
"400", "mass_density:=", "8933", "specific_heat:=", "385", "youngs_
modulus:=", _
"120000000000", "poissons_ratio:=", "0.38", "thermal_expansion_coeff-
cient:=", "1.77e-005"))

Definition Manager Script Commands 23-151


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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.NewProject
oProject.InsertDesign "Nexxim Circuit", "Nexxim1", "", ""

Set oMaterialMgr = oProject.GetDefinitionManager().GetManager("Mater-


ial")

oMaterialMgr.Add Array("NAME:MyMaterial1", "Coordin-


ateSystemType:=","Cartesian", Array("NAME:AttachedData"), _
Array("NAME:ModifierData"),"permittivity:=", "0.123")
oMaterialMgr.Add Array("NAME:MyMaterial2", "CoordinateSystemType:=",
"Cartesian", Array("NAME:AttachedData"), _
Array("NAME:ModifierData"), "permittivity:=", "0.456")
oMaterialMgr.Add Array("NAME:MyMaterial3", "CoordinateSystemType:=",
"Cartesian", Array("NAME:AttachedData"), _
Array("NAME:ModifierData"), "permittivity:=", "0.789")

oMaterialMgr.Edit( "MyMaterial2", Array("NAME:MyMaterial2_mod",


"CoordinateSystemType:=", _
"Cartesian", Array("NAME:AttachedData"), Array("NAME:ModifierData"),
"permittivity:=", _
"123", "permeability:=", "0.987654", "conductivity:=", "58000000",
"thermal_conductivity:=", _
"400", "mass_density:=", "8933", "specific_heat:=", "385", "youngs_
modulus:=", _

Definition Manager Script Commands 23-152


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"120000000000", "poissons_ratio:=", "0.38", "thermal_expansion_coeff-


cient:=", "1.77e-005"))

Export [material manager]


Use: Export a material to a library.
Command: None
Syntax: Remove <material_data> <library_location>
Return Value: None
Parameters: <material_data>
Type: Array
Value: An array consisting of the string "NAME:", followed by the library name and the
name of the material to export.
<library_location>
Type: string
Value: Location of the library to export the material to ("UserLib" or "PersonalLib").
Example:
oMaterialMgr.Export Array("NAME:MyLib", "MyMaterial"), "UserLib"

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", "", ""

Definition Manager Script Commands 23-153


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oMaterialMgr = oProject.GetDefinitionManager().GetManager("Mater-


ial")
oMaterialMgr.Add( Array("NAME:MyMaterial1", "Coordin-
ateSystemType:=", "Cartesian", "permittivity:=", "0.123") )
oMaterialMgr.Export Array("NAME:MyLib", "MyMaterial1"), "UserLib"

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 Syn- GetData(<SimpleName>)


tax

Python dataArray = oMaterialManager.GetData


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:
materialNames = oMaterialMgr.GetNames()

Definition Manager Script Commands 23-154


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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.NewProject
oProject.InsertDesign "Nexxim Circuit", "Nexxim1", "", ""
Set oMaterialMgr = oProject.GetDefinitionManager().GetManager("Mater-
ial")
oMaterialMgr.Add( Array("NAME:MyMaterial1", "Coordin-
ateSystemType:=", "Cartesian", "permittivity:=", "0.123") )
oMaterialMgr.Add( Array("NAME:MyMaterial2", "Coordin-
ateSystemType:=", "Cartesian", "permittivity:=", "0.456")
Dim materialNames
materialNames = oMaterialMgr.GetNames()

Python Syn- GetNames()


tax

Python materialnames = oMaterialManager.GetNames()


Example

GetProperties [material manager]


Use: Get material properties. Differs from GetData in that only material properties available to the
user are returned by GetProperties.
Command: None
Syntax: GetProperties <material_name>
Return Value: Array of material data
Parameters: <material_name>
Type: string

Definition Manager Script Commands 23-155


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Value: Name of the project material


VB Example:
materialProps = oMaterialMgr.GetProperties( "MyMaterial2" )

Python Syn-  GetProperties (<materialname>)


tax

Python oMaterialManager.GetProperties("Gold")
Example

IsUsed [material manager]


Use: Checks if a project material is in use
Command: None
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 IsUsed(<ComboName>)
Syntax

Python isused = oMaterialManager.IsUsed("mylib:mymaterial")


Example

Remove [material manager]


Use: Remove a material from the project.
Command: None
Syntax: Remove <material_name> <local> <library_name> <library_location>
Return Value: None
Parameters: <material_name>
Type: string

Definition Manager Script Commands 23-156


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Value: Name of the material to remove


<local>
Type: boolean
Value: If 'true', the material will be removed from the project; if 'false' the material will be
removed from from a library.
<library_name> <library_location>
Type: string
Value: Name and location of the library to delete the material from ("UserLib" or "Per-
sonalLib").
If <local> is 'True',the parameters are ignored and the material is removed from the pro-
ject.
Example:
oMaterialMgr.Remove "MyMaterial1", true, "", "Project"

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("Mater-


ial")

Dim message
Dim createdMat

Definition Manager Script Commands 23-157


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

createdMat = oMaterialMgr.Add( Array("NAME:MyMaterial", "Coordin-


ateSystemType:=", "Cartesian", "permittivity:=", "0.123") )
message = "Created material '" + createdMat + "'"
Msgbox message

oMaterialMgr.Remove "MyMaterial1", true, "", "Project"

RemoveUnused [material manager]


Use: Remove all unused materials from the project.
Command: None
Syntax: RemoveUnused
Return Value: None
Parameters: None
VB Example:
oMaterialMgr.RemoveUnused()

Python  RemoveUnused()
Syntax

Python thereWereExtras = oMaterialManager.RemoveUnused()


Example

NdExplorer Manager Script Commands


The NdExplorer manager provides access to scripting in NdExplorer. The manager object is
accessed via the definition manager.
Set oDefinitionManager = oProject.GetDefinitionManager()
Set oNdExplorerManager = oDefinitionManager.GetManager("NdExplorer")
The NdExplorer manager script commands are listed below.
ExportFullWaveSpice
ExportNetworkData
ExportNMFData

ExportFullWaveSpice [NdExplorer Manager]


Use: Export FullWaveSpice data in a format of your choice.

Definition Manager Script Commands 23-158


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 "Con-
vexOptimization",
                                          // "PassivityByPerturbation", or "IteratedFittingOfPV"
"ColumnFittingType:=", "Column", // Column FittingType can be "Column", "Entry", "Mat-
rix"
"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
)

Definition Manager Script Commands 23-159


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

ExportNetworkData [NdExplorer Manager]


Use: Export the solution in a format of your choice (Citifile, Spreadsheet, Matlab)
Command: File > Export SYZ Data
Syntax: ExportNetworkData
"DesignName", // Design name. Can be left blank, if loading solution from a file.
true/false, // true - solution loaded from file, false- loaded from design
"Name", // If loading from design this is the solution name, else this is the
                  // full path of the file from which the solution is loaded
"ExportFile", // full path of file to export to
"variation", // Pick a particular variation. Leave blank if no variation
Array("NAME:Frequencies"), // optional, if none defined all frequencies are used
Array("NAME:Options", // Export options object
"DataTypes:=", Array("S"), // DataTypes can be "S", "Y","Z", "G", and "Z0",
                                              // for S , Y, Z matrix, Gamma and Z0 (zero)
"DisplayFormat:=", "MA", // DisplayFormat "MA", "RI", "DB"
"FileType:=", "", // Export File Type
                               // 2 - Spreadsheet(*.tab)
// 3 - Touchstone(*.sNp)
// 4 - Citifile(*.cit)
// 6 - Neutral format(*.nmf)
// 7 - Matlab format(*.m)
"Renormalize:=", false, // Renormalize true/false
"RefImpedance:=",50, // Reference Impedance
"Precision:=", 8, // Number of digits Precision
"CreateNPortModel:=", true // Create a model based on the exported file true/false
)

ExportNMFData [NdExplorer Manager]


Use: Export the solution in NMF format.
Command: File > Export SYZ Data

Definition Manager Script Commands 23-160


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syntax: ExportNMFData
"DesignName", // Design name. Can be left blank, if loading solution from a file.
true/false, // true - solution loaded from file, false- loaded from design
"Name", // If loading from design this is the solution name, else this is the
                 // full path of the file from which the solution is loaded
"ExportFile", // full path of file to export to
Array("NAME:Frequencies"), // optional, if none defined all frequencies are used
Array("NAME:NMFOptions", // Export NMF options object
"DataTypes:=", Array("S"), // DataTypes can be "S", "Y","Z", "G", and "Z0",
                                              // for S , Y, Z matrix, Gamma and Z0 (zero)
"DisplayFormat:=", "MA", // DisplayFormat "MA", "RI", "DB"
"FileType:=", "", // Export File Type
// 2 - Spreadsheet(*.tab)
// 3 - Touchstone(*.sNp)
// 4 - Citifile(*.cit)
// 6 - Neutral format(*.nmf)
// 7 - Matlab format(*.m)
"Renormalize:=", false, // Renormalize true/false
"RefImpedance:=",50, // Reference Impedance
"Precision:=", 8, // Number of digits Precision
"Variables:=", ARRAY("FF", "cap", "Rs") // Array of variables
"Variations:=", ARRAY("", "", "") // Array of variations to export solutions for
Array("NAME:ConstantVars") // Array of variables that are constant, can be empty
Array("NAME: DependentVars") // Array of variables that are dependent, can be empty
"MatrixSize:=", 2, // Matrix size, optional (used in nmf file header)
"CreateNPortModel:=", true // Create a model based on the exported file true/false
)

Script and Library Scripts


The definition manager provides access to materials in a project. The manager object is accessed
via the definition manager.

Definition Manager Script Commands 23-161


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oDefinitionManager = oProject.GetDefinitionManager()


The script and library script commands are listed below.
AddScript
EditScript
ExportScript
RemoveScript
ModifyLibraries

AddScript
Use: Add Script in the script definition manager
Command: None
Syntax: AddScript Array(<AddScriptArray>)
Return Value: None
Parameters: <AddScriptArray>
Array("NAME<ScriptName>", <string>,
<ScriptLanguage>,<string> ("vbscript" or "javascript")
<ScriptText>, <string> // text of script
VB Example: oDefinitionManager.AddScript Array("NAME:MyScript", _
"ScriptLang:=", "vbscript", _
"ScriptText:=", "MsgBox(" & Chr(34) & "Hello World" & Chr(34) & ")")

Python AddScript (<AddScriptArray>)


Syntax

oDefinitionManager.AddScript (["NAME:MyScript", _
Python
"ScriptLang:=", "vbscript", _
Examp-
le "ScriptText:=", "MsgBox(" & Chr(34) & "Hello World" & Chr
(34) &")"])

EditScript
Use: Edit Script in the script definition manager
Command: None
Syntax: EditScript <OriginalName>,Array("NAME:<NewName>", < ScriptText >)

Definition Manager Script Commands 23-162


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Return Value: None


Parameters: <OriginalName>
Type: <String>
Name of the script before editing.
<NewName>
Type: <String>
New name for the script.
<ScriptText>
Type: <string> // text of script
VB Example:
oDefinitionManager.EditScript "myscript",
Array("NAME:myscript", "ScriptLang:=", _
"vbscript", "ScriptText:=", _
"MsgBox(" & Chr(34) & "Hello Again" & Chr(34) & ")")

Python Syn- EditScript(<OriginalName>,["NAME:<NewName>", < ScriptText >])


tax

oDefinitionManager.EditScript ("myscript",
["NAME:myscript", "ScriptLang:=", _
Python
Example "vbscript", "ScriptText:=", _
"MsgBox(" & Chr(34) & "Hello Again"
& Chr(34) & ")"])

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 23-163


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oProject.ExportComponent Array("NAME:mylib", "myscript"), "Per-


sonalLib"

Python Syn-  ExportScript( <ExportData>,<Library location>)


tax

Python oProject.ExportComponent
Example (["NAME:mylib", "myscript"], "PersonalLib")

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 Syn- RemoveScript (<ScriptName>,<IsProjectScript>, <LibraryName>,<LibraryLoca-


tax tion>)

Python
oDefinitionManager.RemoveScript(
Example "myscript", true, "Local", "Project")

ModifyLibraries
Use: Configure Libraries on the Tools menu
Command: None
Syntax: ModifyLibraries <DesignName>,Array(<ConfigLibArray>)

Definition Manager Script Commands 23-164


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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", _
"ParamExtraElements\PE_Symbols", _
"Vendor Elements\Nonlinear"))

Python ModifyLibraries (<DesignName>,[<ConfigLibArray>])


Syntax

oDefinitionManager.ModifyLibraries(
"MyCircuit", _
["NAME:PersonalLib"], _
["NAME:UserLib"], _
Python
Example ["NAME:SystemLib", _
"Symbols:=", [ "Circuit Elements", "Symbols",_
"ParamExtraElements\PE_Symbols", _
"Vendor Elements\Nonlinear"]])

Definition Manager Script Commands 23-165


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

PDF layout 23-166


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

24 - Definition Editor Script Commands


The Definition Editor controls the use of materials and scripts in a project. Symbol editor script com-
mands and footprint editor script commands are accessed using the Definition Editor.
Set oDefinitionEditor = oProject.SetActiveDefinitionEditor("SymbolEditor", "MySymbol")
Set oDefinitionEditor = oProject.SetActiveDefinitionEditor("FootprintEditor", "MyFootprint")
The topics for this section include:
Symbol Editor Scripts
Footprint Editor Scripts

Footprint Editor Scripts


Footprint editor script commands are accessed with a definition editor.
Set oDefinitionEditor = oProject.SetActiveDefinitionEditor("Foot-
printEditor", "MyFootprint")
The footprint editor script commands are listed below.
AddLayer (Footprint Editor)
AddStackupLayer (Footprint Editor)
ChangeLayers (Footprint Editor)
ChangeOptions (Footprint Editor)
CloseEditor (Footprint Editor)
CreateCircle (Footprint Editor)
CreateCircleVoid (Footprint Editor)
CreateEdgePort (Footprint Editor)
CreateLine (Footprint Editor)
CreateLineVoid (Footprint Editor)
CreateMeasure (Footprint Editor)
CreatePolygonVoid (Footprint Editor)
CreatePin (Footprint Editor)
CreatePolygon (Footprint Editor)
CreateRectangle (Footprint Editor)
CreateText (Footprint Editor)
CreateVia (Footprint Editor)

Definition Editor Script Commands 24-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Duplicate (Footprint Editor)


Edit (Footprint Editor)
EraseMeasurements (Footprint Editor)
FlipHorizontal (Footprint Editor)
FlipVertical (Footprint Editor)
GetAllLayerNames (Footprint Editor)
GetLayerInfo (Footprint Editor)
GetProperties (Footprint Editor)
GetStackupLayerNames (Footprint Editor)
Intersect (Footprint Editor)
Move (Footprint Editor)
PageSetup (Footprint Editor)
RemoveLayer (Footprint Editor)
RemovePort (Footprint Editor)
Rotate (Footprint Editor)
Save (Footprint Editor)
SetActiveDefinitionEditor (Footprint Editor)
SetPropertyValue (Footprint Editor)
Subtract (Footprint Editor)
ToggleViaPin (Footprint Editor)
Unite (Footprint Editor)
ZoomToFit (Footprint Editor)

AddLayer (Footprint Editor)


Use:Adds a layer.
Command:Add Layer in a layout or footprint definition.
Syntax:AddLayer Array ("NAME:layer",
"Name:=", <LayerName>,
"Type:=", <Type>,
"Top Bottom:=" , <TB>,

Definition Editor Script Commands 24-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Color:=", <ColorNumber>,
"Pattern:=", <FillPattern>,
"Visible:=", <Visibility>,
"Selectable:=", <Selectability>,
"Locked:=", <Locked>)
Return Value:None.
Parameters:<LayerName>
Type: <String>
<Type >
Type: <String> (Same choices as in the layer dialog.)
<TB >
Type: <String> Choices are "Top"|"Neither"|"Bottom"|"Template"|"Invalid"
<ColorNumber>
Type: integer representing rbg in hex
<FillPattern>
Type: integer
<Visibility>
true | false
<Selectability>
true | false
<Locked>
true | false
VB Example:oDefinitionEditor.AddLayer Array("NAME:layer", "Name:=",
"junk footprint", _
"Type:=", "soldermask", "Top Bottom:=", "neither", "Color:=",
4144959, _
"Pattern:=", 1, "Visible:=", true, "Selectable:=", true, "Locked:=",
false)

AddStackupLayer (Footprint Editor)


Use: Adds a stackup layer.

Definition Editor Script Commands 24-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Command: Add Stackup Layer in a layout or footprint definition.


Syntax: AddStackupLayer Array ("NAME:layer",
"Name:=", <LayerName>,
"Type:=", <Type>,
"Top Bottom:=" , <TB>,
"Color:=", <ColorNumber>,
"Pattern:=", <FillPattern>,
"Visible:=", <Visibility>,
"Selectable:=", <Selectability>,
"Locked:=", <Locked>
"ElevationEditMode:=", <Elevation>, <SublayerArray>)
Return Value: None.
Parameters: <LayerName>
Type: <String>
<Type >
Type: <String> (Same choices as in the layer dialog.)
<TB >
Type: <String> Choices are "Top"|"Neither"|"Bottom"|"Template"|"Invalid"
<ColorNumber>
Type: integer representing rbg in hex
<FillPattern>
Type: integer
<Visibility>
true | false
<Selectability>
true | false
<Locked>
true | false
<Elevation>
Type: <String> Choices are "snap to middle" | "snap to top" | "snap to bottom" | "none"

Definition Editor Script Commands 24-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<SublayerArray>
Type: Array(("NAME:Sublayer", "Thickness:=", <Thickness>, "LowerElevation:=",
<Elevation>, "Roughness:=" , <Roughness>, "Material:=", <MaterialName)
<Thickness>
Type: <String> containing number and units (e.g. "0mil")
<Elevation>
Type: <String> containing number and units (e.g. "0mil")
<Roughness>
Type: <String> containing number and units (e.g. "0mil")
<Material>
Type: <String>
oEditor.AddStackupLayer Array("NAME:stackup layer", "Name:=",
"MyLayer2", _
"Type:=", "Signal", "Top Bottom:=", "neither", "Color:=", 127, "Pat-
tern:=", 7, _
"Visible:=", true, "Selectable:=", true, "Locked:=", false, "Elev-
ationEditMode:=", "none",_
Array("NAME:Sublayer", "Thickness:=", "25mil", "LowerElevation:=",
"0mil", _
"Roughness:=", "0mil", "Material:=", "Al2_O3_ceramic"), "UseR:=",
true, _
"RMdl:=", "Huray", "NR:=", "2mil", "HRatio:=", 2.8)

ChangeLayers (Footprint Editor)


Use: Causes changing of the layers.
Command: None.
Syntax: ChangeLayers
Array("NAME:layers",
<full_layer_description>, // 1st layer

<full_layer_description>, // 2nd layer

…) // etc
Return Value: None.

Definition Editor Script Commands 24-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Parameters: The LayoutComp's ID


Example:
oEditor.ChangeLayers Array("NAME:layers", "Mode:=", "Laminate",
Array("NAME:stackup layer", "Name:=", _
"Top", "ID:=", 7, "Type:=", "signal", "Top Bottom:=", "neither",
"Color:=", _
32512, "Transparency:=", 95, "Pattern:=", 1, "VisFlag:=", 31,
"Locked:=", false, "DrawOverride:=", 0, "ElevationEditMode:=", _
"none", Array("NAME:Sublayer", "Thickness:=", "0mil", "Lower-
Elevation:=", _
"124.992125984252mil", "Roughness:=", "0mil", "Material:=", "cop-
per", "FillMaterial:=", _
"FR4_epoxy"), "Usp:=", true, Array("NAME:Sp", "Sn:=", "HFSS",
"Sv:=", "so(si=1)"), Array("NAME:Sp", "Sn:=", _
"HFSS 3D Layout", "Sv:=", "so(ifg=1, vly=1)"), "UseEtch:=", true,
"UseR:=", true), Array("NAME:stackup layer", "Name:=", _
"Dielectric", "ID:=", 0, "Type:=", "dielectric", "Top Bottom:=",
"neither", "Color:=", _
127, "Pattern:=", 1, "VisFlag:=", 31, "Locked:=", false, "DrawOver-
ride:=", 0, "ElevationEditMode:=", _
"none", Array("NAME:Sublayer", "Thickness:=", "62mil", "Lower-
Elevation:=", _
"62.992125984252mil", "Roughness:=", "0mil", "Material:=", "FR4",
"FillMaterial:=", _
"FR4_epoxy")), Array("NAME:stackup layer", "Name:=", "Ground",
"ID:=", 6, "Type:=", _
"ground", "Top Bottom:=", "bottom", "Color:=", 4144959, "Pattern:=",
1, "VisFlag:=", _
31, "Locked:=", false, "DrawOverride:=", 0, "ElevationEditMode:=",
"none", Array("NAME:Sublayer", "Thickness:=", _
"0mil", "LowerElevation:=", "62.992125984252mil", "Roughness:=",
"0mil", "Material:=", _
"copper", "FillMaterial:=", "FR4_epoxy"), "Neg:=", true, "UseR:=",
true), Array("NAME:stackup layer", "Name:=", _
"Dielectric0", "ID:=", 9, "Type:=", "dielectric", "Top Bottom:=",
"neither", "Color:=", _

Definition Editor Script Commands 24-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

8421376, "Pattern:=", 1, "VisFlag:=", 31, "Locked:=", false,


"DrawOverride:=", _
0, "ElevationEditMode:=", "none", Array("NAME:Sublayer", "Thick-
ness:=", "1.6mm", "LowerElevation:=", _
"0", "Roughness:=", "0", "Material:=", "FR4")), Array("NAME:stackup
layer", "Name:=", _
"Signal", "ID:=", 10, "Type:=", "signal", "Top Bottom:=", "neither",
"Color:=", _
16512, "Pattern:=", 1, "VisFlag:=", 31, "Locked:=", false, "DrawOver-
ride:=", 0, "ElevationEditMode:=", _
"none", Array("NAME:Sublayer", "Thickness:=", "0mm", "Lower-
Elevation:=", "0", "Roughness:=", _
"0", "Material:=", "copper", "FillMaterial:=", "FR4_epoxy")), Array
("NAME:layer", "Name:=", _
"Measures", "ID:=", 8, "Type:=", "measures", "Top Bottom:=",
"neither", "Color:=", _
4144959, "Transparency:=", 0, "Pattern:=", 1, "VisFlag:=", 31,
"Locked:=", false, "DrawOverride:=", _
0), Array("NAME:layer", "Name:=", "Rats", "ID:=", 3, "Type:=",
"rat", "Top Bottom:=", _
"neither", "Color:=", 16711680, "Pattern:=", 1, "VisFlag:=", 0,
"Locked:=", _
false, "DrawOverride:=", 0), Array("NAME:layer", "Name:=", "Errors",
"ID:=", 4, "Type:=", _
"error", "Top Bottom:=", "neither", "Color:=", 255, "Pattern:=", 1,
"VisFlag:=", _
31, "Locked:=", true, "DrawOverride:=", 0), Array("NAME:layer",
"Name:=", "Symbols", "ID:=", _
5, "Type:=", "symbol", "Top Bottom:=", "neither", "Color:=",
8323199, "Pattern:=", _
1, "VisFlag:=", 31, "Locked:=", false, "DrawOverride:=", 0), Array
("NAME:layer", "Name:=", _
"Assembly Top", "ID:=", 2, "Type:=", "assembly", "Top Bottom:=",
"top", "Color:=", _
16711680, "Pattern:=", 1, "VisFlag:=", 31, "Locked:=", false,
"DrawOverride:=", _

Definition Editor Script Commands 24-7


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

0), Array("NAME:layer", "Name:=", "Silkscreen Top", "ID:=", 1,


"Type:=", "silkscreen", "Top Bottom:=", _
"top", "Color:=", 65280, "Pattern:=", 1, "VisFlag:=", 31,
"Locked:=", false, "DrawOverride:=", _
0))

ChangeOptions (Footprint 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)
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, _

Definition Editor Script Commands 24-8


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"SnapTargetIntersection_on:=", true, _
"SnapTargetGrid_on:=", false, _
"SnapSourceVertex_on:=", false, _
"SnapSourceEdgeCenter_on:=", false, _
"SnapSourceObjCenter_on:=", true, _
"SnapSourceEdge_on:=", true, _
"SnapSourceElecConnection_on:=", true, _
"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
l Local options are both script-able and undo-able
l Global options are neither script-able nor undo-able

Definition Editor Script Commands 24-9


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Option Description Installed default Registry, Scripting Names,


Data Type
Arc Drawing Controls drawing of Dynamic "useFixedDrawingResolution"
Resolution segments for arcs - 1
either dynamic and
"DrawingResolution" 2
based on current
zoom or fixed to spe-
cified value
Major and Spacing, color, and The grid is displayed. Spa- "MajorColor" 3
Minor Grid visibility cing based on current
lines default length units. Major "MinorColor" 3
grid lines are 10 minor grid
lines apart. The line colors "MajorSize" 2
are light blue grays, with
"MinorSize" 2
major grid lines being
darker. "ShowGrid" 1
Drawing Specifies size and Lower left of the layout is (- "PageExtent" 4
Extent coordinates of the 0.1, -0.1) and the upper right
layout is (0.1, 0.1)
Background Color of the layout white "background color" 3
color background
Sketch Fill patterns and cen- off "DefaultToSketchMode" 1
Mode ter lines are not
drawn.
Solid Mode Objects are filled in off "fillMode" 1
with solid color.
Draw Con- Display pin symbols off "show connection points" 1
nection in the layout.
Points
Draw Rats Display lines indic- on "draw rats" 1
ating missing phys-
ical connections in
nets
Label Ver- Display property text off "display vertex labels" 1
tices labeling the vertices
of selected polygons
and lines.
Net Color Color used for high- light yellow "NetColor" 3
lighting nets
Rectangle Specifies if rect- 2 points "rectangle description" 5
Description angles are
described with two
points or center
point, width, and

Definition Editor Script Commands 24-10


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

height
Default Hole Default size for 25 mil "defaultholesize" 2
Size actual holes in a PC
board
Align Snaps components on "snaptoport" 1
Microwave on entry.
Components
Symbol Foot- Used to size symbol Based on data extent and "sym footprint scaling" 6
print Scaling footprints placed in current length units.
layout.
Primary and Colors used to indic- Primary color is red, sec- "primary selectioncolor" 3
Secondary ate the first item ondary color is a darker red
Selection selected and other "secondary selection color" 3
Colors items currently selec-
ted.
Preview Highlight the object off "preview selection" 1
Selection that would be selec-
ted with a left mouse
button click in the
current location.
Snapping Choose snapping Snap distance is 20 pixels. "PixelSnapTolerance"7
options sources and targets Snapping sources are ver- "SnapTargetVertex_on"1
and the maximum tex, edge center, object cen- "SnapTargetEdgeCenter_
distance (in pixels) ter, & elec. conn. Snapping on"1
for snapping to targets are vertex, edge cen- "SnapTargetObjCenter_on"1
occur. Constrain ter, object center, elec. "SnapTargetEdge_on"1
edits to grid if conn, & grid. Edits are con- "SnapTargetElecConnection_
desired. strained to grid. on"1
"SnapTargetIntersection_on"1
"SnapTargetGrid_on"1
"SnapSourceVertex_on"1
Note: "SnapSourceEdgeCenter_
on"1
Off-grid "SnapSourceObjCenter_on"1
objects are "SnapSourceEdge_on"1
ignored if Con- "SnapSourceElecConnection_
on"1
strainToGrid is "ConstrainToGrid"1
asserted.

Always Controls display of off – Only show dialog when "AlwaysShowLayerMergeDlg"


Show Merge the layer merging the user must be involved. 1
Layers Dia- dialog.
log
Rotation During rotation, Based on current angle "anglesnap" 2

Definition Editor Script Commands 24-11


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Increment objects are rotated units.


by multiples of this
amount.
Allow Drag Selection and move false "AllowDragOnFirstClick" 1
on first click with one left 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

CloseEditor (Footprint Editor)


Use: Closes the active definition editor.
Command: None
Syntax: CloseEditor
Return Value: None
Parameters: None
VB Example: oDefinitionEditor.CloseEditor

CreateCircle (Footprint Editor)


Use: Draws a circle in the footprint editor
Command: None
Syntax: CreateCircle
Return Value: None
VB Example:
oDefinitionEditor.CreateCircle Array("NAME:Contents",
"circleGeometry:=", Array("Name:=", _
"circle_118", "LayerName:=", "Top", "lw:=", "0mm", _

Definition Editor Script Commands 24-12


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"x:=", "-3.23020108044147mm", "y:=", "1.49086199235171mm", _


"r:=", "0.605222899964955mm"))

CreateCircleVoid (Footprint Editor)


Use: Creates a circle void and adds it to a particular parent primitive. Returns the name of the
newly created object.
Syntax: CreateCircleVoid <circle_void_description>
<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",
"r:=", "1.41421356237309mm"))

CreateEdgePort (Footprint Editor)


Use: Creates an edge port using the specified edges.
Command: Draw > Port > Create
Right-click > Port > Create
Also available through Tool Bar icon
Syntax: CreateEdgePort

Definition Editor Script Commands 24-13


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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>:
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)

Definition Editor Script Commands 24-14


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<flag>
true if the port is an external port
false if the port is an internal port
VB Example:
oDefinitionEditor.CreateEdgePort Array("NAME:Contents", "edge:=",
Array("et:=",
"pe", "prim:=", "rect_6", "edge:=", 1), "edge:=", Array("et:=",
"pe", "prim:=",
"rect_6", "edge:=", 2), "external:=", true)

oDefinitionEditor.CreateEdgePort Array("NAME:Contents", "edge:=",


Array("et:=",
"pse", "sel:=", "via_4", "layer:=", 4, "sx:=", -0.0015, "sy:=",
0.0015, "ex:=", -0.0015,
"ey:=", -0.0015, "h:=", 0, "rad:=", 0), "edge:=", Array("et:=",
"pse", "sel:=", "via_4",
"layer:=", 4, "sx:=", 0.0015, "sy:=", 0.0015, "ex:=", -0.0015,
"ey:=", 0.0015, "h:=", 0,
"rad:=", 0), "external:=", true)

CreateLine (Footprint Editor)


Use: Draws a line in the footprint editor
Command: None
Syntax: CreateLine
Return Value: None
VB Example:
oDefinitionEditor.CreateLine Array("NAME:Contents", _
"lineGeometry:=", Array("Name:=", _
"line_160", "LayerName:=", "Top", "lw:=", "0.5mm", _
"endstyle:=", 0, "joinstyle:=", 1, "n:=", 3, _
"x0:=", "2.22709029912949mm", "y0:=", "0.819053850136697mm", _

Definition Editor Script Commands 24-15


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"x1:=", "-0.0527859515mm", "y1:=", "0.8894385mm ",


"x2:=", "1.63943274461105mm", "y2:=", "0.769682056256832mm"))

CreateLineVoid (Footprint Editor)


Use: Creates a line void and adds it to a specified as parameter parent primitive. Returns the name
of the newly created object.
Syntax: CreateLineVoid<line_void_description>
<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,
"n:=", 3,
"x0:=", "27mm", "y0:=", "5mm",
"x1:=", "35mm", "y1:=", "5mm",
"x2:=", "36mm", "y2:=", "9mm"))

CreateMeasure (Footprint Editor)


Use: Creates a measurement. Returns the name of the created object.
Syntax: CreateMeasure
Array("NAME:Contents",

Definition Editor Script Commands 24-16


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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>,
"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",

Definition Editor Script Commands 24-17


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"ey:=", "-11mm",
"name:=", "<DefaultAnnotation>",
"isPlot:=", false,
"font:=", "Arial",
"size:=", 10,
"angle:=", "0deg",
"weight:=", 3,
"just:=", 4,
"mirror:=", false,
"scales:=", false))

CreatePolygonVoid (Footprint Editor)


Use: Creates a polygon void and adds it to a specified as parameter parent primitive.
Syntax: CreatePolygonVoid<polygon_void_description>
<polygon_void_description>:
Array("NAME:Contents",
"owner:=", <object_name>, // owner name
"poly voidGeometry:=", <polygon_geometry>) // definition
Return Value: Returns the name of the newly created object.
VB Example:
oEditor.CreatePolygonVoid
Array("NAME:Contents",
"owner:=", "rect_4",
"poly voidGeometry:=",
Array("Layer:=", 6,
"Name:=", "poly void_18",
"LayerName:=", "Top",
"lw:=", "0mm",
"n:=", 5,
"x0:=", "21mm", "y0:=", "9mm",
"x1:=", "21mm", "y1:=", "5mm",

Definition Editor Script Commands 24-18


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"x2:=", "24mm", "y2:=", "7mm",


"x3:=", "24mm", "y3:=", "7mm",
"x4:=", "24mm", "y4:=", "7mm"))

CreatePin (Footprint Editor)


Use: Creates a pin in the footprint editor
Command: None
Syntax: CreatePin
Return Value: None
VB Example:
oDefinitionEditor.CreatePin Array("NAME:Contents", _
Array("NAME:Port", "Name:=", "Pin_123"), "Rotation:=", Array( _
"0deg"), "Offset:=", Array("x:=", "-0.310625357087702mm", "y:=", _
"1.4226520434022mm"), "Padstack:=", "NoPad SMT East")

CreatePolygon (Footprint Editor)


Use: Draws a polygon in the footprint editor
Command: None
Syntax: CreatePolygon
Return Value: None
VB Example:
oDefinitionEditor.CreatePolygon Array("NAME:Contents", _
"polyGeometry:=", Array("Name:=", _
"poly_164", "LayerName:=", "Top", "lw:=", "0mm", "n:=", 4,
"x0:=", "2.20868387259543mm", "y0:=", "-1.80972274392843mm", _
"x1:=", "1.43564445897937mm", "y1:=", "-2.56435642950237mm", _
"x2:=", "3.22099728509784mm", "y2:=", "-2.02138815075159mm", _
"x3:=", "2.40194355137646mm", "y3:=", "-2.07660533487797mm"))

Definition Editor Script Commands 24-19


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

CreateRectangle (Footprint Editor)


Use: Draws a rectangle in the footprint editor
Command: None
Syntax: CreateRectangle
Return Value: None
VB Example:
oDefinitionEditor.CreateRectangle Array("NAME:Contents", _
"rectGeometry:=", Array("Name:=", "rect_120", _
"LayerName:=", "Top", "lw:=", "0mm", "Ax:=", _
"-3.28541826456785mm", "Ay:=", _
"0.37731695920229mm", "Bx:=", "-2.42035021074116mm", "By:=", _
"-0.294491270324215mm", "ang:=", "0deg"))

CreateText (Footprint Editor)


Use: Draws text in the footprint editor
Command: None
Syntax: CreateText
Return Value: None
VB Example:
oDefinitionEditor.CreateText Array("NAME:Contents", _
"textGeometry:=", Array("Name:=", _
"text_165", "LayerName:=", "Top", _
"x:=", "-2.25469819270074mm", "y:=","-2.09501106292009mm", _
"ang:=", "0deg", "isPlot:=", true, "font:=", _
"RomanSimplex", "size:=", "5mm", "weight:=", 3, "just:=", 4, _
"mirror:=", false, "text:=", "My text"))

CreateVia (Footprint Editor)


Use: Creates a via in the footprint editor
Command: None
Syntax: CreateVia

Definition Editor Script Commands 24-20


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Return Value: Name of the created via.


VB Example:
oDefinitionEditor.CreateVia Array("NAME:Contents", "name:=", _
"", "vposition:=", _
Array("x:=", "2.28299549780786mm", _
"y:=", "1.18763139471412mm"), "rotation:=", 0, "overrides hole:=", _
false, "hole diameter:=", Array("0.50038mm"), _
"ReferencedPadstack:=", "Template 1mm/0.5mm", _
"highest_layer:=", "Top", "lowest_layer:=", "Top")

Duplicate (Footprint Editor)


Use: Duplicates footprint 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", <ele-
ment names>), Array( <x>, <y>)
Return Value: None
Parameters: <count data> is an integer
<element names> is one or more strings with the names of footprint 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)

Edit (Footprint Editor)


Use: Edits an object in the footprint editor
Command: None
Syntax: Edit
Return Value: None
VB Example:

Definition Editor Script Commands 24-21


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oDefinitionEditor.Edit Array("NAME:items", Array("NAME:item", _


"name:=", "poly118", Array("NAME:contents", _
"polyGeometry:=", Array("Name:=", _
"poly118", "LayerName:=", "Top", "lw:=", "0mm", "n:=", 5, "x0:=", _
"-9.58323911802614mil", "y0:=", "d + 0.000193052692338824", _
"x1:=", "-9.58323911802614mil", "y1:=", _
"W+d + 0.000193052692338824", "x2:=", "W+d", "y2:=", _
"0mil", "x3:=", "d", "y3:=", "0mil", "x4:=", "d", "y4:=", "d"))))

EraseMeasurements (Footprint Editor)


Use: Causes erasing of ALL measurements currently present.
Command: None.
Syntax: EraseMeasurements
Return Value: None.
Parameters: None.
VB Example: oEditor.EraseMeasurements

FlipHorizontal (Footprint Editor)


Use: Flips the selected object horizontally
Command: None
Syntax: FlipHorizontal
Return Value: None
VB Example:
oDefinitionEditor.FlipHorizontal Array("NAME:elements", "poly118"),
_
Array(0.00082250994243756, 0.00101975944723128)

FlipVertical (Footprint Editor)


Use: Flips the selected object vertically
Command: None
Syntax: FlipVertical

Definition Editor Script Commands 24-22


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Return Value: None


VB Example:
oDefinitionEditor.FlipVertical Array("NAME:elements", "poly118"), _
Array(0.00082250994243756, 0.00101975944723128)

GetAllLayerNames (Footprint 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.
Parameters: None.

GetLayerInfo (Footprint Editor)


Use: Informational.
Command: None.
Syntax: GetLayerInfo<layer_name>
Return Value: array of strings, as follows:
Type: typename
TopBottomAssociation: "Top"|"Neither"|"Bottom"|"Template"|"Invalid"
Color: integer [representing rgb in hex]
IsVisible: "true"|"false" [true if any type of object below is visible]
   IsVisibleShape: true [for stackup layer only]
   IsVisiblePath: true [for stackup layer only]
   IsVisiblePad: true [for stackup layer only]
   IsVisibleHole: true [for stackup layer only]
   IsVisibleComponent: true [for stackup layer only]
IsLocked: "true"|"false"
LayerId: integer [the ID for the layer]

The following are also in the array if the layer is a stackup layer:
Index: integer [the stackup order index]

Definition Editor Script Commands 24-23


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

LayerThickness: double [total layer thickness, in meters]


EtchFactor: double [won't show if the layer has no etch factor defined]
IsIgnored: "true"|"false"
NumberOfSublayers: 1 [always 1]
Material0: materialName
FillMaterial0: materialName
Thickness0: expression_with_units
LowerElevation0: expression_with_units
Roughness0Type: Groisse | Huray [won't show if the layer has no roughness defined]
Roughness0: expression_with_units | expression_with_units, double [Groisse rough-
ness or Huray roughness]
Parameters: The name of the layer

GetProperties (Footprint 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")

GetStackupLayerNames (Footprint Editor)


Use: Informational.
Command: None.
Syntax: GetStackupLayerNames
Return Value: array of strings which are the names of all layers in the layout, blackbox, or footprint.
Parameters: None.

Definition Editor Script Commands 24-24


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Intersect (Footprint 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")

Move (Footprint Editor)


Use: Moves an object in the footprint editor
Command: None
Syntax: Move
Return Value: None
VB Example:
oDefinitionEditor.Move Array("NAME:elements", "poly118"), _
Array(-0.000352530973032117, -0.000276988605037332)

PageSetup (Footprint 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()

Definition Editor Script Commands 24-25


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Set oDefinitionEditor = oProject.SetActiveDefinitionEditor("Foot-


printEditor", "Footprint")
oDefinitionEditor.PageSetup Array("NAME:PageSetupData", "margins:=",
Array("left:=", _
500, "right:=", 800, "top:=", 500, "bottom:=", 500), "border:=", 1,
"DesignVars:=", _
1)

RemoveLayer (Footprint Editor)


Use: Removes a layer or stackup layer.
Command: Remove Layer from a layout or footprint definition
Syntax: RemoveLayer (<LayerName>)
Return Value: None.
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.

RemovePort (Footprint Editor)


Use: Selected pins are changed to vias. Selected edge ports are removed.
Syntax: RemovePort <NAME:elements", <object_name> ... // objects to be removed
Return Value: None.
Parameters: <object_name>
Type: <String>
VB Example:
oEditor.RemovePort Array("NAME:elements", "via_195", "Port1")

Definition Editor Script Commands 24-26


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Rotate [Footprint Editor]


Use: Rotates the selected object
Command: None
Syntax: Rotate
Return Value: None
VB Example:
oDefinitionEditor.Rotate Array("NAME:elements", "poly118"),
Array( 0.000469978969405443, 0.000742770842193945)

Save (Footprint Editor)


Use: Saves changes during editing of symbols and footprints
Command: None
Syntax: Save
Return Value: None
Parameters: None
VB Example:
oDefinitionEditor.Save

SetActiveDefinitionEditor (Footprint Editor)


Use: Selects the symbol or footprint editor.
Command: None
Syntax: SetActiveDefinitionEditor < EditorName >,<Name>
Return Value: None
Parameters: <EditorName>
Type: <string>
Possible Values: SymbolEditor; FootprintEditor
<Name>
Type: <string>
Name of symbol or footprint to be modified
VB Example:

Definition Editor Script Commands 24-27


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oProject.SetActiveDefinitionEditor("SymbolEditor", "tqtrx_cap")

SetPropertyValue (Footprint Editor)


Use: Sets the value of one property. This is not supported for properties of the following types: But-
tonProp, 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"

Subtract (Footprint Editor)


Use: Causes boolean subtracting of one or more primitive (polygons, rectangles, lines, or circles)
object(s) from another one.
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")

ToggleViaPin (Footprint Editor)


Use: Selected pins are changed to vias. Selected vias are changed to pins.

Definition Editor Script Commands 24-28


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Syntax: ToggleViaPin <NAME:elements", <object_name> ... // objects to be toggled


Return Value: None.
Parameters: <object_name>
Type: <String>
VB Example: oEditor.ToggleViaPin Array("NAME:elements", "via_195")

Unite (Footprint 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")

ZoomToFit (Footprint Editor)


Use: Set the current zoom to fit the contents of the currently visible page
Command: None
Syntax: ZoomToFit()
Return Value: None

Definition Editor Script Commands 24-29


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

PDF layout 24-30


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

25 - 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>",
"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>:

Design Verification Script Commands 25-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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

Design Verification Script Commands 25-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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.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")

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>:

Design Verification Script Commands 25-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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

Design Verification Script Commands 25-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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", _
"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>:
<int> // 0 for entire layout (default if not specified)
// 1 for specified portion of layout

Design Verification Script Commands 25-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

<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)
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

Design Verification Script Commands 25-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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"

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 25-7


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak 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 25-8


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

26 - Example Scripts
This section contains VBScript and IronPython example scripts.

VBScript Example Scripts


VBScript Examples:

l Variable Helix Script


l HFSS Data Export Script

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 explanations
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.
'
path = inputbox("Input the file name" &chr(13) & _

Example Scripts 26-1


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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, ",")
arr(0) = Trim(arr(0))

Example Scripts 26-2


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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" & _
stn & " : Sweep" & swn,cfreq, "")

Example Scripts 26-3


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 explanations
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()

Example Scripts 26-4


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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")
Units = ""

Example Scripts 26-5


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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
Radius = R(0) + ((n-1)/NumPoints)*(R(1)-R(0))

Example Scripts 26-6


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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.

oEditor.CreateCircle _

Example Scripts 26-7


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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")

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):

Example Scripts 26-8


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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 sub-
sequent line(s).
Script Contents
# specify path to the file with BH coordinates
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", "", ""]]

Example Scripts 26-9


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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"]
],
[
"NAME:permeability",
"property_type:=" , "nonlinear",
"BTypeForSingleCurve:=" , "normal",
"HUnit:=" , "A_per_meter", # unit can be specified
as variable
"BUnit:=" , "tesla", # unit can be specified as vari-
able
"IsTemperatureDependent:=", False,
bh_coordinates,
[

Example Scripts 26-10


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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
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

Example Scripts 26-11


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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

Example Scripts 26-12


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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

Example Scripts 26-13


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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)
Z_t2 = P2

oEditor.CreatePolyline(
[
"NAME:PolylineParameters",
"IsPolylineCovered:=" , True,
"IsPolylineClosed:=" , False,
[

Example Scripts 26-14


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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
]
],
[
"NAME:PolylineXSection",
"XSectionType:=" , "None",
"XSectionOrient:=" , "Auto",
"XSectionWidth:=" , "0mm",
"XSectionTopWidth:=" , "0mm",
"XSectionHeight:=" , "0mm",

Example Scripts 26-15


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"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
])

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, solution 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.

Example Scripts 26-16


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

The next asks for the array frequency.

The next asks for start, stop and step values for in an interpolating frequency sweep.

The last one asks for the array definition.

Example Scripts 26-17


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

The following figure shows the waveguide array generated by the defaults.

After running the simulation, the plots defined by the script shows the following results.

Example Scripts 26-18


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Example Scripts 26-19


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

The waveguide script in Python follows.

import clr
clr.AddReferenceByPartialName("Microsoft.VisualBasic")
from Microsoft.VisualBasic.Constants import
vbOKOnly,vbOKCancel,vbAbortRetryIgnore,vbYesNoCancel,vbYesNo,vbRetry-
Cancel
from Microsoft.VisualBasic.Constants import
vbOK,vbCancel,vbAbort,vbRetry,vbIgnore,vbYes,vbNo
from Microsoft.VisualBasic.Interaction import InputBox, MsgBox

oProject = oDesktop.GetActiveProject()

Example Scripts 26-20


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oDesign = oProject.GetActiveDesign()
oEditor = oDesign.SetActiveEditor("3D Modeler")

# 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 " +

Example Scripts 26-21


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"frequency sweep.", "Waveguide array generator",


"8GHz,12GHz,50MHz")
StartFrequency, StopFrequency, StepFrequency = inputText.split
(',')

#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
],

Example Scripts 26-22


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

[
"NAME:b", "PropType:=", "VariableProp", "UserDef:=", True,
"Value:=", b_str
],
[
"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"
]

Example Scripts 26-23


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

]
]
])
#Create the radiation box
#------------------------
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
])

Example Scripts 26-24


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

oEditor.FitAll() # Zoom out


#Create first element
#--------------------
oEditor.CreateBox(
[
"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
])

Example Scripts 26-25


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

# 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
# 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",
[

Example Scripts 26-26


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"NAME:Mode1",
"ModeNum:=" , 1,
"UseIntLine:=" , True,
[
"NAME:IntLine",
"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(

Example Scripts 26-27


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

[
"NAME:Radiation",
"Faces:=" , faceIDs,
"IsFssReference:=" , False,
"IsForPML:=" , False
])

# 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()

Example Scripts 26-28


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

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"])

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,

Example Scripts 26-29


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"UseMaxTetIncrease:=" , False,
"PortAccuracy:=" , 2,
"UseABCOnPort:=" , False,
"SetPortMinMaxTri:=" , False,
"UseDomains:=" , False,
"UseIterativeSolver:=" , False,
"SaveRadFieldsOnly:=" , False,
"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,

Example Scripts 26-30


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"InterpUsePropConst:=" , True,
"UseDerivativeConvergence:=", False,
"InterpDerivTolerance:=", 0.2,
"UseFullBasis:=" , True,
"EnforcePassivity:=" , True,
"PassivityErrorTolerance:=", 0.0001
])

#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"
])

Example Scripts 26-31


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

#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,
"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"
],
[

Example Scripts 26-32


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"Theta:=" , ["All"],
"Phi:=" , ["0deg"],
"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)"]
], [])

#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"],

Example Scripts 26-33


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

"NumY:=" , ["Nominal"],
"WaveguideLength:=" , ["Nominal"],
"Frequency:=" , ["Nominal"]
],
[
"X Component:=" , "Theta",
"Y Component:=" , ["im(rEPhi)","re(rEPhi)","im(rETheta)","re
(rETheta)"]
], [])

Example Scripts 26-34


ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Index

CreateRelativeCS 11-59
.
CreateSpiral 11-20
.vbs file format 2-7
CreateUserDefinedModel 11-21
3 CreateUserDefinedPart 11-14, 11-
23
3D Modeler editor commands 11-2
Delete 11-103
AssignMaterial 11-48
DeleteEmptyGroups 11-60
Chamfer 11-48
DeleteLastOperation 11-61
Connect 11-50
DeletePolylinePoint 11-37
Copy 11-37
DetachFaces 11-61
CoverLines 11-50
DuplicateAlongLine 11-38
CoverSurfaces 11-50
DuplicateAroundAxi 11-39
Create3DComponent 11-4
DuplicateMirror 11-41
CreateBondwire 11-6
EditEntityList 11-62
CreateCutplane 11-7
EditFaceCS 11-63
CreateEntityList 11-50
EditObjectCS 11-63
CreateEquationCurve 11-7
EditPolyline 11-26
CreateEquationSurface 11-10
EditRelativeCS 11-66
CreateFaceCS 11-51, 11-54
Export 11-67
CreateGroup 11-52
ExportModelImagetoFile 11-67
CreateHelix 11-13
Fillet 11-69
CreateObjectFromdges 11-57
FlattenGroup 11-71
CreateObjectFromFaces 11-58
GenerateHistory 11-71
CreatePoint 11-14
GetActiveCoordinateSystem 11-75
CreateRegion 11-15
GetBodyNamesByPosition 11-103
CreateRegularPolyhedron 11-19

Index-1
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetCoordinateSystems 11-75 SeparateBody 11-91


GetEdgeByPosition 11-104 SetModelUnits 11-92
GetEdgeIDsfromFace 11-105 SetWCS 11-92
GetEdgeIDsfromObject 11-105 Split 11-93
GetFaceArea 11-106 Subtract 11-94
GetFaceByPosition 11-107 SweepAlongPath 11-31
GetFaceCenter 11-106 SweepAlongVector 11-32
GetFaceIDs 11-108 SweepAroundAxis 11-33
GetModelBoundingBox 11-109 SweepFacesAlongNormal 11-33, 11-
33, 11-95, 11-95
Import 11-76
SweepFacesAlongNormalWithAttributes
ImportDXF 11-78
11-35
ImportGDSII 11-81
ThickenSheet 11-96
Insert3DComponent 11-29
UncoverFaces 11-97
InsertPolylineSegment 11-30
Ungroup 11-99
Intersect 11-83
Unite 11-99
Mirror 11-43
WrapSheet 11-100
Move 11-44
MoveCSToEnd 11-83 A

MoveEntityToGroup 11-84 Aborting Scripts 1-10

MoveFaces 11-85 Add 23-2, 23-57, 23-78, 23-97, 23-130, 23-


150
OffsetFaces 11-44
Add Ground 7-2
PageSetup 11-119
AddAddSolverOnDemandModel 23-55
ProjectSheet 11-87
AddCartesianLimitLine 13-5
RenamePart 11-119
AddCartesianXMarker 13-6
Replacewith3DComponent 11-
88 AddCartesianYMarker 13-6

Rotate 11-45 AddDataset 9-2

Scale 11-46 AddDeltaMarker 13-7

Section 11-91 AddDynamicNPortData 23-15

Index-2
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

AddLayer 24-2 InsertSetup HFSS-IE 15-36


AddMarker 13-8 InsertSetup Transient 15-37
AddMarkerToPlot 18-1 PasteSetup 15-46
AddMaterial 7-2 PasteSweep 15-47
AddMessage 5-4 RenameDrivenSweep 15-47
AddNamedExpr 19-2 RenameSetup 15-47
AddNamedExpression 19-2 RevertAllToInitial 15-49
AddNote 13-8 RevertSetupToInitial 15-49
AddNPortData 23-17 Analysis Setup Module Script Com-
mands 15-1
AddPortsToAllNets 23-130, 23-130
Ansoft Application Object
AddPortsToNet 23-130 commands 4-2
AddRuleSet 25-1 GetAppDesktop 4-2
AddRun 25-2 arithmetic operators 1-6
AddScript 23-162 array variables 1-4
AddStackupLayer 24-4 AssignCircuitPort 14-19, 14-52
AddTraceCharacteristics 13-9 AssignCurrent 14-21
AddTraces 13-11, 13-18 AssignFEBI 14-21, 14-22
Analysis module commands AssignFiniteCond 14-23
CopySetup 15-1, 16-4 AssignFloquet 14-25
CopySweep 15-2, 15-49 AssignHalfSpace 14-28
DeleteDrivenSweep 15-2, 15-3 AssignHybridRegion 14-29
DeleteSetups 15-2 AssignIERegion 14-30
EditFrequencySweep 15-3, 15-6 AssignImpedance 14-31
EditSetup 15-4 AssignIncidentWave 14-32
GetSetupCount 15-11 AssignLayeredImp 14-33
GetSetups 15-11 AssignLinkedRegion 14-35
InsertFrequencySweep 15-12, AssignLumpedPort 14-36
15-43
AssignLumpedRLC 14-38
InsertSetup 15-20

Index-3
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

AssignMagneticBias 14-39 AssignLayeredImp 14-33


AssignMaster 14-41 AssignLumpedPort 14-36
AssignMaterial 11-48 AssignLumpedRLC 14-38
AssignPerfectE 14-41 AssignMagneticBias 14-39
AssignPerfectH 14-42 AssignMaster 14-41
AssignRadiation 14-42 AssignPerfectE 14-41
AssignScreeningImpedance 14-44 AssignPerfectH 14-42
AssignSymmetry 14-46 AssignRadiation 14-42
AssignTerminal 14-47 AssignScreeningImpedance 14-44
AssignVoltage 14-48 AssignSymmetry 14-46
AssignWavePort 14-49 AssignTerminal 14-47
AutoIdentifyNets 14-4 AssignVoltage 14-48
AutoIdentifyPorts 14-4 AssignWavePort 14-49
AutoIdentifyTerminals 14-5 AutoIdentifyNets 14-4
AutoIdentifyPorts 14-4
B
AutoIdentifyTerminals 14-5
Boundary and Excitation Module
Script Commands 14-1 ChangeImpedanceMult 14-5

Boundary/Excitation module com- CircuitPortToLumpedPort 14-51


mands
ConvertNportCircuittoPort 14-6
AssignCircuitPort 14-19, 14-52
DeleteAllBoundaries 14-8
AssignCurrent 14-21
DeleteAllExcitations 14-8
AssignFEBI 14-21, 14-22, 14-35
DeleteBoundaries 14-9
AssignFiniteCond 14-23
EditCurrent 14-53
AssignFloquet 14-25
EditFiniteCond 14-54
AssignHalfSpace 14-28
EditHalfSpace 14-55, 14-56
AssignHybridRegion 14-29
EditImpedance 14-56
AssignIERegion 14-30
EditIncidentWave 14-56
AssignImpedance 14-31
EditLayeredImpedance 14-58
AssignIncidentWave 14-32

Index-4
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

EditLumpedPort 14-59 SetHybridRegionCoupledGroup


14-63
EditLumpedRLC 14-60
SetTerminalReferenceImpedances
EditMagneticBias 14-60 14-66
EditMaster 14-58 SwapCircuitPortAssignment 14-66
EditPerfectE 14-58 UnassignIERegions 14-67
EditPerfectH 14-58 boundary/excitation script
EditRadiation 14-60 commands 14-2

EditSlave 14-62 BreakUDMConnection 11-102

EditSymmetry 14-62 BringToFront 23-85

EditTerminal 14-62
C
EditVoltage 14-63
CalcOp 19-3
EditWavePort 14-63
CalcRead (deprecated) 19-3
GetBoundaries 14-10
CalcStack 19-4
GetBoundariesofType 14-10
CalculatorRead 19-3
GetBoundaryAssignment 14-10
CalculatorWrite 19-5
GetDefaultBaseName 14-11
Chamfer 11-48
GetExcitations 14-11
ChangeGeomSettings 19-5
GetExcitationsOfType 14-11
ChangeImpedanceMult 14-5
GetNumBoundaries 14-12
ChangeLayers 24-5
GetNumBoundariesofType 14-12
ChangeOptions 24-8
GetNumExcitations 14-12
CircuitPortToLumpedPort 14-51
GetNumExcitationsOfType 14-13
ClcEval 19-6
GetPortExcitationsCounts 14-13
ClcMaterial 19-6
LumpedPortToCircuitPort 14-63
ClearAllMarkers 13-15
ReassignBoundaries 14-2, 14-6,
14-13, 14-15 ClearAllNamedExpr 19-7

RenameBoundary 14-16 ClearAllTraceCharacteristics 13-17

ReprioritizeBoundary 14-17 ClearMessages 5-5, 6-3

SetDefaultBaseName 14-17 ClearSolutionCache 23-21

Index-5
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Close 6-4 CopyReportDefinition 13-19


CloseAllWindows 5-5 Copyright and Trademark Information 2
CloseEditor 24-12 CopySetup
CloseProject 5-6 Analysis module command 15-1, 16-4
CloseProjectNoForce 5-6 Optimetrics module command 15-1, 16-
4
comparison operators 1-6
CopySweep, Analysis module
CompInstance Functions 22-1
command 15-2, 15-49
CompInstance Script
CopyTracesDefinitions 13-19
Commands 22-1
Count 5-7
Component Manager Script Com-
mands 23-1 CoverLines 11-50
Component Manager SOD Script CoverSurfaces 11-50
Commands 23-55
Create3DComponent 11-4
conditional statements
CreateBondwire 11-6
If...Then... Else 1-7
CreateCircle 24-12
Select Case 1-7
CreateCircleVoid 24-13
types of 1-7
CreateCutplane 11-7
Connect 11-50
CreateEdgePort 24-13
ConstructVariationString 10-3
CreateEntityList 11-50
conventions
CreateEquationCurve 11-7
command syntax 2-15
CreateEquationSurface 11-10
data types 2-15
CreateFaceCS 11-51, 11-54
script command 2-15
CreateFieldPlot 18-2
converting data types 1-9
CreateGroup 11-52
ConvertToDynamic 23-64
CreateHelix 11-13
ConvertToParametric 23-64
CreateLine 24-15
Copy 11-37
CreateLineVoid 24-16
CopyDesign 6-4
CreateMeasure 24-16
CopyNamedExprToStack 19-7
CreateObjectFromEdges 11-57
CopyReportData 13-18

Index-6
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

CreateObjectFromFaces 11-58 EditDataset 9-4


CreateOutputVariable 12-1 ImportDataset 9-5
CreatePin 24-19 Dataset Script Commands 9-2
CreatePML;Boundary/Excitation Definition Editor Script Commands 24-
module com- 1
mands:CreatePML 14-68
Definition Manager Script
CreatePoint 11-14 Commands 23-1
CreatePolygon 24-19 Delete 11-103
CreatePolygonVoid 24-18 DeleteAllBoundaries 14-8
CreateRectangle 24-20 DeleteAllExcitations 14-8
CreateRegion 11-15 DeleteAllReports 13-33
CreateRegularPolyhedron 11-19 DeleteBoundaries 14-9
CreateRelativeCS 11-59 DeleteDataset 9-3
CreateReport 13-20 DeleteDesign 6-5
CreateReport [Designer] 13-26 DeleteDrivenSweep 15-2, 15-3
CreateReportFromTemplate 13-30 DeleteEmptyGroups 11-60
CreateReportofAllQuantities 13-31 DeleteFieldPlot 18-15
CreateSpiral 11-20 DeleteFieldVariation 10-4
CreateText 24-20 DeleteFullVariation 10-6
CreateUserDefinedModel 11-21 DeleteLastOperation 11-61
CreateUserDefinedPart 11-14, 11- DeleteLinkedDataVariation 10-7
23
DeleteMarker 13-32
CreateUserDefinedSolution 20-1
DeleteNamedExpr 19-7
CreateVia 24-20
DeleteOutputVariable 12-4
CutDesign 6-4
DeletePolylinePoint 11-37

D DeleteProject 5-8

dataset commands DeleteReport 13-34

AddDataset 9-2 DeleteRuleSet 25-3

DeleteDataset 9-3 DeleteRun 25-4

Index-7
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

DeleteSetups CreateReportFromTemplate 13-30


Analysis module command 15-2 CreateReportOfAllQuantities 13-31
Optimetrics module DeleteAllReports 13-33
command 16-5
DeleteOutputVariable 12-4
DeleteSolutionVariation 17-1
DeleteReport 13-34
Deletetraces 13-34
DeleteTraces 13-34
DeleteUserDefinedSolution 20-3
DoesOutputVariableExist 12-5
DeleteVariation 10-9
DoesRegistryValueExist 5-64
Design object commands 13-43, 13-
44, 13-45, 13-46, 13-47, 13- EditOutputVariable 12-6
48, 13-57, 13-58, 13-58 ExportConvergence 10-9
AddCartesianLimitLine 13-5 ExportMeshStats 10-11
AddCartesianXMarker 13-6 ExportPlotImageToFile 13-35, 13-36
AddCartesianYMarker 13-6 ExportProfile 10-12
AddDeltaMarker 13-7 ExportReport 13-38
AddMarker 13-8 ExportToFile 13-39, 13-40
AddMarkerToPlot 18-1 FFTOnReport 13-41
AddNote 13-8 GeometryCheckAndAutofix 10-19
AddTraceCharacteristics 13-9 GetDisplayType 13-52
AddTraces 13-11, 13-18 GetLibraryDirectory 5-18
CalculatorRead 19-3, 19-5 GetMatchedObjectName 11-108
ClearAllMarkers 13-15 GetModelUnits 11-109
ClearAllTraceCharacteristics 13- GetModule 10-14
17
GetName 10-15
CloseAllWindows 5-5
GetNominalVariation 10-16
CopyReportData 13-18
GetNumObjects 11-110
CopyReportDefinition 13-19
GetObjectIDByName 11-110
CopyTracesData 13-19
GetObjectName 11-111, 11-111
CreateOutputVariable 12-1
GetObjectsByMaterial 11-112
CreateReport 13-20

Index-8
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetObjectsInGroup 11-112 ResetPlotSettings 13-69


GetOutputVariableValue 12-8 ResetToTimeZero 10-23
GetProjectDirectory 5-27 RunToolkit 10-30
GetRegistryInt 5-64 SARSetup 10-24
GetRegistryString 5-64 SavePlotSettingsAsDefault 13-70
GetSelections 11-115 SetActiveEditor 10-25
GetSolutionType 10-18 SetLibraryDirectory 5-59
GetSolveInsideThreshold 10-18 SetProjectDirectoryVBCommand>
5-59
GetSourceContexts 10-18
SetRegistryFromFile 5-65
GetTempDirectory 5-30
SetRegistryInt 5-65
GetUser Position 11-116
SetRegistryString 5-66
GetVariationVariableValue 10-19
SetSolutionType 10-27
GetVersion 5-33
SetSolveInsideThreshold 10-28
GetVertexIDsFromEdge 11-117
SetSourceContexts 10-28
GetVertexIDsFromFace 11-117
SetTempDirectory 5-60
GetVertexIDsFromObject 11-117
ShowWindow 11-93
GetVertexPosition 11-118
Solve 10-29, 10-34
GroupPlotCurvesByGroup-
ingStrategy 13-62 UnGroupPlotCurvesInGroup 13-81
ImportIntoReport 13-64 UpdateAllReports 13-80
MovePlotCurvesToGroup 13-65 UpdateReports 13-80
MovePlotCurvesToNewGroup UpdateTraces 13-71
13-66
UpdateTracesContextandSweeps
PasteDesign 10-21 13-78
PasteReports 13-67 ValidateDesign 10-34
PasteTraces 13-67 Design Object Script Commands 10-2
Redo 10-22 Design Verification Script
Commands 25-1
RenameDesignInstance 10-23
Desktop Commands For Registry Val-
RenameReport 13-68 ues 5-63
RenameTraces 13-69

Index-9
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Desktop object commands Print 5-45


AddMessage 5-4 QuitApplication 5-46
ClearMessages 5-5, 6-3 RefreshJobMonitor 5-47
CloseProject 5-6 RestoreWindow 5-50
CloseProjectNoForce 5-6 RunProgram 5-52
Count 5-7 RunScript 5-53
DeleteProject 5-8 SelectScheduler 5-55
EnableAutosave 5-9 SetActiveProject 5-56
ExportOptionsFiles 5-10 SetActiveProjectByPath 5-57
GetActiveProject 5-11 Sleep 5-61
GetAutosaveEnabled 5-12 SubmitJob 5-61
GetBuildTimeDateString 5-13 TileWindows 5-62
GetDesigns 5-14 Desktop Object Script Commands 5-2
GetDistributedAnalysisMachines Desktop Scripting Conventions 2-14
5-16
DetachFaces 11-61
GetDis-
trib- DistributedAnalyzeSetup, Optimetrics mod-
utedAna- ule command 16-5
lysisMachinesForDesignType DoesOutputVariableExist 12-5
5-17
DoesRegistryValueExist 5-64
GetName 5-22
Draw Menu commands 11-3
GetProjectList 5-28
Duplicate 24-21
GetProjects 5-19, 5-26
DuplicateAlongLine 11-38
LaunchJobMonitor 5-37
DuplicateAroundAxis 11-39
NewProject 5-38
DuplicateMirror 11-41
OpenMultipleProjects 5-39
OpenProject 5-40 E
PageSetup 24-25 Edit 23-21, 23-65, 23-65, 23-85, 23-85, 23-
PasteDesign 5-41 113, 23-135, 23-151

PauseRecording 5-44 Edit Menu Commands 11-37

PauseScript 5-44 Edit3DComponent 11-25

Index-10
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

EditCircuitSettings 15-7 EditSetup


EditCurrent 14-53 Analysis module command 15-4
EditDataset 9-4 optimization command 16-18
EditDiffPairs 14-53 parametric command 16-13
EditEntityList 11-62 sensitivity command 16-30
EditFaceCS 11-63 statistical command 16-38
EditFiniteCond 14-54 EditSlave 14-62
EditFrequencySweep 15-3, 15-6 EditSolverOnDemandModel 23-55
EditHalfSpace 14-55, 14-56 EditSymmetry 14-62
EditImpedance 14-56 EditTerminal 14-62
EditIncidentWave 14-56 EditUserDefinedSolution 20-4
Editing Properties 2-21 EditVoltage 14-63
EditLayeredImpedance 14-58 EditWavePort 14-63
EditLumpedPort 14-59 EditWithComps 23-40, 23-65, 23-85,
23-113, 23-140
EditLumpedRLC 14-60
EnableAutoSave 5-9
EditMagneticBias 14-60
EnterComplex 19-8
EditMaster 14-58
EnterComplexVector 19-8
EditMaterial 7-4
EnterLine 19-9
EditObjectCS 11-63
EnterPoint 19-9
EditOutputVariable 12-6
EnterQty 19-9
EditPerfectE 14-58
EnterScalar 19-10
EditPerfectH 14-58
EnterScalarFunc 19-10
EditPolyline 11-26
EnterSurf 19-11
EditRadiation 14-60
EnterVector 19-11
EditRelativeCS 11-66
EnterVectorFunc 19-12
EditRuleSet 25-4
EnterVol 19-12
EditRun 25-5
EraseMeasurements 24-22
EditScript 23-162
Event Callback Scripting 2-19

Index-11
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Example Scripts 26-1


F
Executing a Script from Within a
Script 2-20 FFTONReport 13-41
Export 11-67, 23-48, 23-73, 23-93, Field Overlay module commands,
23-125, 23-145, 23-153 GetFieldPlotNames 18-15
ExportCircuit 15-8 field overlay script commands 18-1
ExportConvergence 10-9 Field Overlays module commands
ExportDXConfigFile, Optimetrics AddNamedExpr 19-2
module command 16-6
AddNamedExpression 19-2
ExportFullWaveSpice 21-1, 23-158
CalcOp 19-3
ExportMarkerTable 13-40
CalcStack 19-4
ExportMaterial 7-6
ChangeGeomSettings 19-5
ExportMesh Stats 10-11
ClcEval 19-6
ExportModelImagetoFile 11-67
ClcMaterial 19-6
ExportNetworkData 21-2, 23-160
ClearAllNamedExpr 19-7
ExportNMFData 21-3, 23-160
CopyNamedExprToStack 19-7
ExportOnGrid 19-12
CreateFieldPlot 18-2
ExportOptimetricsProfile, Opti-
metrics module command 16- DeleteFieldPlot 18-15
7 DeleteNamedExpr 19-7
ExportOptimetricsResults, Opti- EnterComplex 19-8
metrics module command 16-
7 EnterComplexVector 19-8
ExportOptionsFiles 5-10 EnterLine 19-9
ExportParametricResults, Opti- EnterPoint 19-9
metrics module command 16-
8 EnterQty 19-9

ExportPlotImageToFile 13-35, 13- EnterScalar 19-10


36 EnterScalarFunc 19-10
ExportProfile 10-12 EnterSurf 19-11
ExportReport 13-38 EnterVector 19-11
ExportScript 23-163 EnterVectorFunc 19-12
ExportToFile 13-39, 13-40, 19-14

Index-12
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

EnteVol 19-12 EnterVol 19-12


ExportOnGrid 19-12 ExportOnGrid 19-12
ExportToFile 19-14 ExportToFile 19-14
ModifyFieldPlot 18-17 Fields Calculator Script
Commands 19-1
RenameFieldPlot 18-18
Fillet 11-69
RenamePlotFolder 18-18
FlattenGroup 11-71
SetFieldPlotSettings 18-19
FlipHorizontal 24-22
SetPlotFolderSettings 18-20
FlipVertical 24-22
UpdateAllFieldsPlots 18-24
footprint
UpdateQuantityFieldsPlots 18-24
editor scripts 24-1
Fields Calculator commands
manager script commands 23-97
AddNamedExpr 19-2, 19-2, 19-7
For...Next loop 1-8
CalcOp 19-3
functions
CalcStack 19-4
VBScript procedures 1-9
ChangeGeomSettings 19-5
ClcEval 19-6 G
ClcMaterial 19-6 GenerateHistory 11-71
CopyNamedExprToStack 19-7 GenerateVariationData Parametric,
DeleteNamedExpr 19-7 parametric command 16-14

EnterComplex 19-8 GeometryCheckAndAutofix 10-19

EnterComplexVector 19-8 Get3DComponentDefinitionNames


11-27
EnterLine 19-9
Get3DComponentInstanceNames 11-
EnterPoint 19-9 28
EnterQty 19-9 Get3DComponentMaterialNames 11-
28
EnterScalar 19-10
Get3DComponentMaterialProperties
EnterScalarFunc 19-10 11-29
EnterSurf 19-11 Get3DComponentParameters 11-27
EnterVector 19-11 GetActiveCoordinateSystem 11-75
EnterVectorFunc 19-12

Index-13
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetActiveDesign 6-6 GetDesignVariableValue 13-50


GetActiveProject 5-11 GetDesignVariationKey 13-51
GetAllCategories 13-43 GetDisplayType 13-52
GetAllLayerNames 24-23 GetDistributedAnalysisMachines 5-16
GetAllQuantities 13-46 GetDis-
trib-
GetAllReportNames 13-44
utedAna-
GetArrayVariables 8-6 lysisMachinesForDesignType 5-17

GetAutoSaveEnabled 5-12 GetEdgeByPosition 11-104

GetAvailableDisplayTypes 13-46 GetEdgeIDsFromFace 11-105

GetAvailableReportTypes 13-47 GetEdgeIDsFromObject 11-105

GetAvailableSolutions 13-48 GetEditor [Component] 22-2

GetBodyNamesByPosition 11-103 GetExcitations 14-11

GetBoundaries 14-10 GetExcitationsOfType 14-11

GetBoundariesOfType 14-10 GetExeDir 5-18

GetBoundaryAssignment 14-10 GetFaceArea 11-106

GetBuildDateTimeString 5-13 GetFaceByPosition 11-107

GetComponentName 22-2 GetFaceCenter 11-106

GetCoordinateSystems 11-75 GetFaceIDs 11-108

GetData 23-49, 23-74, 23-94, 23- GetFieldPlotNames, Field Overlay module


126, 23-146, 23-154 command 18-15

GetDataExpressions 13-48 GetImagDataValues 13-52

GetDataUnits 13-49 GetInstanceID 22-3

GetDefaultBaseName 14-11 GetInstanceName 22-3

GetDefinitionManager 6-6 GetLayerInfo 24-23

GetDependentFiles 6-7 GetLibraryDirectory 5-18

GetDesigns 5-14 GetMatchedObjectName 11-108

GetDesignType 10-13 GetModelBoundingBox 11-109

GetDesignVariableNames 13-49 GetModelUnits 11-109

GetDesignVariableUnits 13-50 GetModule 10-14

Index-14
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetName 5-22, 6-8, 10-15 GetRealDataValues 13-56


GetNames 23-50, 23-74, 23-95, 23- GetRegistryInt 5-64
127, 23-147, 23-154
GetRegistryString 5-64
GetNominalVariation 10-16
GetReportTraceNames 13-57
GetNPortData 23-52
GetSelections 10-16, 11-115
GetNumBoundaries 14-12
GetSetupCount, Analysis module com-
GetNumBoundariesOfType 14-12 mand 15-11
GetNumExcitations 14-12 GetSetupNames (Optimetrics), Opti-
metrics module command 16-9
GetNumExcitationsOfType 14-13
GetSetupNamesByType (Optimetrics),
GetNumObjects 11-110 Optimetrics module
GetObjectIDByName 11-110 command 16-9

GetObjectName 11-111, 11-111 GetSetups

GetObjectsByMaterial 11-112 Analysis module command 15-11

GetObjectsIngroup 11-112 GetSolutionContexts 13-58

GetOutputVariableValue 12-8 GetSolutionDataPerVariation 13-59

GetParentDesign 22-4 GetSolutionType 10-18

GetPath 6-8 GetSolveInsideThreshold 10-18

GetPer- GetSolverOnDemandData 23-56


QuantityPrimarySweepValues GetSolverOnDemandModelList 23-56
13-53
GetSourceContexts 10-18
GetPersonalLibDirectory 5-24
GetStackupLayerNames 24-24
GetPortExcitationsCounts 14-13
GetSweepNames 13-61
GetProcessID 5-25
GetSweepUnits 13-61
GetProjectDirectory 5-27
GetSweepValues 13-62
GetProjectList 5-28
GetSysLibDirectory 5-29
GetProjects 5-19, 5-26
GetTempDirectory 5-30
GetProperties 8-7, 23-155, 24-24
GetTopDesignList 6-9
GetPropertyValue 8-8, 11-113, 13-
54 GetTopEntryValue 19-15
GetPropServerName 22-4 GetUserLibDirectory 5-31

Index-15
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetUserPosition 11-116 indentation, IronPython 3-8


GetVariables 8-11 InputBox function 1-10
GetVariableValue 8-11 Insert3DComponent 11-29
GetVariationVariableValue 10-19 InsertDesign 6-9
GetVersion 5-33 InsertDesignWithWorkflow 6-12
GetVertexIDsFromEdge 11-117 InsertFrequencySweep 15-12, 15-43
GetVertexIDsFromFace 11-117 InsertPolylineSegment 11-30
GetVertexIDsFromObject 11-117 InsertSetup
GetVertexPosition 11-118 Analysis module command 15-20
GroupPlotCurvesByGroup- optimization command 16-21
ingStrategy 13-62
parametric command 16-14
H sensitivity command 16-35

HealObject 11-71 statistical command 16-40

hierarchy of variables in HFSS 2-2 InsertSetup HFSS-IE, Analysis module com-


mand 15-36
I InsertSetup Transient, Analysis module com-
mand 15-37
If...Then... Else statement 1-7
Intersect 11-83, 24-25
Import (3D Modeler command) 11-
76 IronPython 3-2
ImportANF 5-34 IronPython, indentation 3-8
ImportAutoCAD 5-35 IsDataComplex 13-64
ImportDataset 9-5 IsPerQuantityPrimarySweep 13-65
ImportDXF 11-78 IsUsed 23-52, 23-75, 23-95, 23-127, 23-
147, 23-156
ImportGDSII 5-35, 11-81
ImportIntoReport 13-64 J
ImportODB 5-36 JavaScript, format 1-2
ImportSetup, Optimetrics module
command 16-10 L
include files LaunchJobMonitor 5-37
scripts 1-10

Index-16
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Layout Scripting 2-18 module script commands


LoadNamedExpressions 19-15 boundary/excitation 14-2
logical operators 1-6 field overlay 18-1
looping through code modules in HFSS scripting 2-2
Do ... Loop 1-8 Move 11-44, 24-25
For ... Next 1-8 MoveCSToEnd 11-83
LumpedPortToCircuitPort 14-63 MoveEnityToGroup 11-84
MoveFaces 11-85
M
MovePlotCurvestoGroup 13-65
material commands
MovePlotCurvestoNewGroup 13-66
AddMaterial 7-2
MsgBox function 1-10
EditMaterial 7-4
ExportMaterial 7-6 N
RemoveMaterial 7-6 Named Arguments 2-17
Material Manager Script NdExplorer
Commands 23-149
Manager Script Commands 23-158
Material Script Commands 7-2
Script Commands 21-1
Microsoft
NewProject 5-38
VBScript user’s guide 1-11
Microsoft Visual Basic 1-2 O

Mirror 11-43 oAnsoftApp object 2-2

Model Manager Script oDesign object 2-2


Commands 23-56
oDesktop object 2-2
Modeler Menu Commands 11-46
oEditor object 2-2
ModifyFieldPlot 18-17
OffsetFaces 11-44
modifying a script 2-14
oModule object 2-2
ModifyLibraries 23-164
OpenAndConvertProject 5-39
Modi-
OpenExternalEditor 11-118
fyPMLGroup;Bound-
ary/Excitation module OpenMultipleProjects 5-39
commands:ModifyPMLGroup
14-70

Index-17
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

OpenProject 5-40, 24-25 output variable commands


operators CreateOutputVariable 12-1
arithmetic 1-6 DeleteOutputVariable 12-4
categories in VBScript 1-5 DoesOutputVariableExist 12-5
comparison 1-6 EditOutputVariable 12-6
logical 1-6 GetOutputVariableValue 12-8
precedence of 1-5 Output Variable Script Commands 12-1
oProject object 2-2
P
Optimetrics module commands
Padstack Manager Script Commands 23-
DeleteSetups 16-5 129
DistributeAnalyzeSetup 16-5 PageSetup 11-119
ExportDXConfigFile 16-6 parametric commands
ExportOptimetricsProfile 16-7 EditSetup 16-13
ExportOptimetricsResults 16-7 GenerateVariationData Parametric 16-
ExportParametricResults 16-8 14

GetSetupNames 16-9 InsertSetup 16-14

GetSetupNamesByType 16-9 Parametric Script Commands 16-13

ImportSetup 16-10 Paste 5-41, 5-42, 6-14, 10-21

RenameSetup 16-12 Paste (Model Editor) 11-45

SolveSetup 15-1, 16-4, 16-12, Paste (Project Object) 5-42, 6-14


16-13 PasteDesign 5-41, 10-21
Optimetrics Module Script Com- PasteReports 13-67
mands 16-1
PasteSetup
optimization commands
Analysis module command 15-46
EditSetup 16-18
Optimetrics module command 16-11
InsertSetup 16-22
PasteSweep, Analysis module
Optimization Script Commands 16- command 15-47
18
PasteTraces 13-67
Other oEditor Commands 11-101
PauseRecording 5-44

Index-18
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

PauseScript 5-44 GetPropertyValue 8-8, 11-113, 13-


54
pausing a script 2-13
GetTopDesignList 6-9
PMLGroupCreated;Bound-
ary/Excitation module com- GetTopEntryValue 19-15
mands:PMLGroupCreated 14-
70 GetVariables 8-11

PMLGroupModi- GetVariableValue 8-11


fied;Boundary/Excitation mod- InsertDesign 6-9
ule
com- Paste 5-41, 5-42, 5-42, 6-14, 6-14,
mands:PMLGroupModified 10-21
14-71
Redo 6-15
Print 5-45
RemoveMaterial 7-6
Project object commands
Rename 6-16
AddDataset 9-2
RestoreProjectArchive 5-49, 6-16
AddMaterial 7-2
Save 6-17
Close 6-4
SaveAs 6-18
CopyDesign 6-4
SaveProjectArchive 6-20
CutDesign 6-4
SetActiveDesign 6-22
DeleteDataset 9-3
SetPropertyValue 8-12, 24-28
DeleteDesign 6-5
SetVariableValue 8-14
EditDataset 9-4, 9-5
SimulateAll 6-3, 6-23
EditMaterial 7-4
Undo 6-24
ExportMaterial 7-6
UpdateDefinitions 6-24
GetActiveDesign 6-6
Project Object Script Commands 6-2
GetArrayVariables 8-6
ProjectSheet 11-87
GetDependentFiles 6-7
property commands
GetDesignType 10-13
GetArrayVariables 8-6
GetName 6-8
GetProperties 8-7, 24-24
GetPath 6-8
GetPropertyValue 8-8, 11-113, 13-
GetProperties 8-7, 24-24 54
GetTopEntryValue 19-15

Index-19
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

GetVariables 8-11 RemoveLayer 24-26


GetVariableValue 8-11 RemoveMaterial 7-6
SetPropertyValue 8-12, 24-28 RemovePort 24-26
SetVariableValue 8-14 RemovePortsFromAllNets 23-148
Property Script Commands 8-2 RemovePortsFromNet 23-149
Conventions uSed in thie RemoveScript 23-164
Chapter 8-2
RemoveSolverOnDemandModel 23-56
PurgeHistory 11-88
RemoveUnused 23-54, 23-76, 23-96, 23-
128, 23-149, 23-158
Q
Rename 6-16
QuitApplication 5-46
RenameBoundary 14-16
R RenameDesignInstance 10-23
ReassignBoundaries 14-2, 14-6, 14- RenameDrivenSweep 15-47
6, 14-13, 14-15
RenameFieldPlot 18-18
Recal-
culatePMLMa- RenamePart 11-119
terials;Boundary/Excitation RenamePlotFolder 18-18
module com-
mand- RenameReport 13-68
s:RecalculatePMLMaterials
14-71 RenameRuleSet 25-7

recording a script 2-7, 2-9 RenameRun 25-7

to a file 2-7 RenameSetup

to a project 2-7 Analysis module command 15-47

Redo Optimetrics module command 16-11

design-level command 10-22 RenameSweep 15-48

project-level command 6-15 RenameTraces 13-69

references, for VBScript 1-11 Repeating a Statement Until a Condition


Becomes True 1-8
RefreshJobMonitor 5-47
Repeating Statements While a Condition is
ReleaseData 13-68 True 1-8
Remove 23-53, 23-75, 23-95, 23- Replacewith3DComponent 11-88
127, 23-147, 23-156

Index-20
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

Reporter editor commands GetAvailableReportTypes 13-47


AddCartesianLimitLine 13-5 GetAvailableSolutionss 13-48
AddCartesianXMarker 13-6, 13-6 GetDisplayType 13-52
AddDeltaMarker 13-7 GetReportTraceNames 13-57
AddMarker 13-8 GetSolutionContextss 13-58, 13-58
AddMarkerToPlot 18-1 GroupPlotCurvesByGroupingStrategy
13-62
AddNote 13-8
MovePlotCurvestoGroup 13-65
AddTraceCharacteristics 13-9
MovePlotCurvestoNewGroup 13-
AddTraces 13-11, 13-18 66
ClearAllMarkers 13-15 PasteReports 13-67
ClearAllTraceCharacteristics 13- PasteTraces 13-67
17
RenameReport 13-68
CopyReportDefinition 13-18, 13-
19 RenameTraces 13-69
CopyTracesData 13-19 ResetPlotSettings 13-69
CreateReport 13-20, 13-31 SavePlotSettingsAsDefault 13-70
CreateReportFromTemplate 13- UnGroupPlotCurvesInGroup 13-81
30
UpdateAllReports 13-80
DeleteAllReports 13-33
UpdateReports 13-80
DeleteReport 13-34
UpdateTraces 13-71
DeleteTraces 13-34
UpdateTracesContextandSweeps
ExportPlotImageToFile 13-35, 13-78
13-36
Reporter Editor Script Commands 13-
ExportReport 13-38 2
ExportToFile 13-39, 13-40, 13-63 ReprioritizeBoundary 14-17
FFTOnReport 13-41 ResetPlotSettings 13-69
GetAllCategories 13-43 RestoreWindow 5-50
GetAllQuantities 13-46 RestToTimeZero 10-23
GetAllReportNames 13-44 ResumeRecording 5-51
GetAvailableDisplayTypes 13-46 resuming a script 2-13

Index-21
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

RevertAllToInitial 15-49 Script Commands for Creating and Modi-


fying Boundaries 14-18
RevertSetupToInitial 15-49
scripting, IronPython 3-2
Rotate 11-45, 24-27
scripts
RunAllDV 25-7
in JavaScript format 1-2
RunAllRuleSetDV 25-8
modifying for easier playback 2-14
RunDV 25-8
pausing 2-13
running a script 2-12
recording 2-8, 2-9
RunProgram 5-52
resuming 2-13
RunScript 5-53
running 2-12
RunScriptWithArguments 5-54
running from command prompt 1-2
RunToolkit 10-30
stop recording 2-11
S stopping execution of 2-13
sample scripts Scripts and Locked Layers 2-19
variable helix 26-13 Section 11-91
waveguide 26-16 Select Case statement 1-7
SARSetup 10-24 SelectScheduler 5-55
Save 6-17, 24-27 sensitivity commands
SaveAs 6-18 EditSetup 16-30
SaveNamedExpressions 19-16 InsertSetup 16-35
SavePlotSettingsAsDefault 13-70 Sensitivity Script Commands 16-30
Scale 11-46 SeparateBody 11-91
Scope and Lifetime of Variables 1-4 SetActiveDefinitionEditor 6-22, 24-27
Script and Library Scripts 23-161 SetActiveDesign 6-22
script commands SetActiveEditor 10-25
boundary/excitation 14-2 SetActiveProject 5-56
field overlay 18-1 SetActiveProjectByPath 5-57
Script Commands for Creating and SetBackgroundMaterial 10-26
Modifying PMLs 14-68
SetDefaultBaseName 14-17

Index-22
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

SetFieldPlotSettings 18-19 DeleteFullVariation 10-6


SetHybridRegionCoupledGroup 14- DeleteLinkedDataVariation 10-7
63
DeleteSolutionVariation 17-1
SetLengthSettings 10-26
Solutions Module Script
SetLibraryDirectory 5-59 Commands 17-1
SetModelUnits 11-92 Solve 10-29
SetPlotFolderSettings 18-20 SolveAllSetup, Optimetrics module
command 16-12
SetProjectDirectory 5-59
SolveSetup, Optimetrics module com-
SetPropertyValue 8-12, 24-28 mand 16-13
SetRegistryFromFile 5-65 Split 11-93
SetRegistryInt 5-65 statistical commands
SetRegistryString 5-66 EditSetup 16-38
SetSolutionType 10-27 InsertSetup 16-41
SetSolveInsideThreshold 10-28 Statistical Script Commands 16-38
SetSourceContexts 10-28 stopping a script 2-14
SetTempDirectory 5-60 stopping script recording 2-11
SetTerminalReferenceImpedances Sub Procedures 1-9
14-66
SubmitJob 5-61
Setting Numerical Values 2-18
Subtract 11-94, 24-28
SetVariableValue 8-14
SwapCircuitPortAssignment 14-66
SetWCS 11-92
SweepAlongPath 11-31
SGetAppDesktop 4-2
SweepAlongVector 11-32
ShowlWindow 11-93
SweepAroundAxis 11-33
simple and composite names 1-3
SweepFacesAlongNormal 11-33, 11-
SimulateAll 6-3, 6-23 33, 11-95, 11-95
SimValueContext 12-17 Sweep-
Sleep 5-61 FacesAlongNormalWithAt-
tributes 11-35
Solutions module commands
Symbol Manager Script
ConstructVariationString 10-3 Commands 23-77
DeleteFieldVariation 10-4

Index-23
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide

DeleteUserDefinedSolution 20-3
T
EditUserDefinedSolution 20-4
ThickenSheet 11-96
Using a Do Loop 1-8
TileWindows 5-62
ToggleViaPin 24-28 V
ValidateDesign 10-34
U
Variable Naming Conventions 1-4
UnassignIERegions 14-67
variables
UncoverFaces 11-97
array 1-4
Undo
assigning information 1-3
design-level command 10-34
declaring 1-3
project-level command 6-23
hierarchy in HFSS 2-2
Ungroup 11-99
used in HFSS scripts 2-2
UnGroupPlotCurvesInGroup 13-81
VBScript 2-2
Unite 11-99, 24-29
.vbs file format 2-7
UpdateAllFieldsPlots 18-24
Microsoft user’s guide 1-11
UpdateAllReports 13-80
operators 1-5
UpdateComponentDefinition 11-36
overview 1-2
UpdateDefinitions, project-level com-
mand 6-24 references 1-11

UpdateDynamicLink 23-55 VBScript Procedures 1-9

UpdateQuantityFieldsPlots 18-24
W
UpdateReports 13-80
WrapSheet 11-100
UpdateTraces 13-71
UpdateTracesContextandSweeps Z
13-78
ZoomToFit 24-29
User Defined Solutions
Commands 20-1
UserDefinedSolutions module com-
mands
CreateUserDefinedSolution 20-1

Index-24
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.

You might also like