0% found this document useful (0 votes)
42 views1,696 pages

Maxwell Scripting Guide

The Maxwell Scripting Guide for ANSYS Electromagnetics Suite 2024 R1 provides comprehensive information on scripting using VBScript and IronPython, including variable types, control structures, and procedures. It covers the integration of user-defined models and primitives, along with examples and best practices for scripting within the ANSYS environment. The document also includes legal disclaimers and trademark information relevant to the software and its usage.

Uploaded by

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

Maxwell Scripting Guide

The Maxwell Scripting Guide for ANSYS Electromagnetics Suite 2024 R1 provides comprehensive information on scripting using VBScript and IronPython, including variable types, control structures, and procedures. It covers the integration of user-defined models and primitives, along with examples and best practices for scripting within the ANSYS environment. The document also includes legal disclaimers and trademark information relevant to the software and its usage.

Uploaded by

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

Maxwell Scripting Guide

Release 2024 R1
ANSYS, Inc. January 2024
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
Maxwell Scripting Guide

Copyright and Trademark Information


© 1986-2024 ANSYS, Inc. Unauthorized use, distribution or duplication is prohibited.
ANSYS, Ansys Workbench, AUTODYN, CFX, FLUENT and any and all ANSYS, Inc. brand,
product, service and feature names, logos and slogans are registered trademarks or trademarks
of ANSYS, Inc. or its subsidiaries located in the United States or other countries. ICEM CFD is a
trademark used by ANSYS, Inc. under license. All other brand, product, service and feature
names or trademarks are the property of their respective owners. FLEXlm and FLEXnet are
trademarks of Flexera Software LLC.
Disclaimer Notice
THIS ANSYS SOFTWARE PRODUCT AND PROGRAM DOCUMENTATION INCLUDE TRADE
SECRETS AND ARE CONFIDENTIAL AND PROPRIETARY PRODUCTS OF ANSYS, INC.,
ITS SUBSIDIARIES, OR LICENSORS. The software products and documentation are furnished
by ANSYS, Inc., its subsidiaries, or affiliates under a software license agreement that contains
provisions concerning non-disclosure, copying, length and nature of use, compliance with export-
ing laws, warranties, disclaimers, limitations of liability, and remedies, and other provisions. The
software products and documentation may be used, disclosed, transferred, or copied only in
accordance with the terms and conditions of that software license agreement.
ANSYS, Inc. and ANSYS Europe, Ltd. are UL registered ISO 9001: 2015 companies.
U.S. Government Rights
For U.S. Government users, except as specifically granted by the ANSYS, Inc. software license
agreement, the use, duplication, or disclosure by the United States Government is subject to
restrictions stated in the ANSYS, Inc. software license agreement and FAR 12.212 (for non-
DOD licenses).
Third-PartySoftware
See the legal information in the product help files for the complete Legal Notice for Ansys pro-
prietary software and third-party software. If you are unable to access the Legal Notice, please
contact ANSYS, Inc.

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

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

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

Converting Between Data Types 1-10


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

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

Script Method Argument 1-20


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

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

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

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

GetOldPrimitiveParametersDefinition2(version ) 1-47
Example UDP 1-47
UDMExtension 1-47
Import 1-47
Main class: UDMExtension 1-48
IUDMExtension methods 1-48
Mandatory methods. 1-48
GetInfo() 1-48
IsAttachedToExternalEditor() 1-48
CreateInstance(funcLib) 1-48
GetUnits(instanceId) 1-48
ReleaseInstance(instanceId) 1-49
GetAttribNameForEntityId() 1-49
GetAttribNameForPartId() 1-49
Optional methods 1-49
GetInstanceSourceInfo(instanceId) 1-50
ShouldAttachDefinitionFilesToProject() 1-50
Example UDM 1-50
UDMFunctionLibrary 1-51
Functions list: 1-52
UDM/UDP Functions 1-53
Return Values for Each UDM and UDP Function 1-53
UDP/UDM Structures and Constants 1-56
UDP/UDM Structures 1-56
List of structures 1-57
UDP/UDM Constants 1-63
Enum constants: 1-63
UDP Python Example 1-65
Introduction to CPython 1-70
Creating an External Script 1-70

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

Start ansysedt as GRPC server 1-71


Connect Functions: 1-72
Example: 1-72
Launching Electronics Desktop 1-72
Connecting with a Running Instance of Electronics Desktop 1-73
Closing Electronics Desktop/Ending the Script 1-73
-grpcsrv Flag 1-73
Ansys Electronics Desktop Scripting 1-74
Overview of Electronics Desktop Scripting Objects 1-74
oAnsoftApp 1-75
oDesktop 1-75
oProject 1-76
oDesign 1-76
oEditor 1-76
oModule 1-77
Example Script Opening 1-77
GetActiveProject and GetActiveDesign for Wider Use 1-78
Running a Script 1-78
Within Electronics Desktop 1-78
From the Command Line 1-79
Direct Launch 1-80
Recording a Script 1-80
Recording a Script to File 1-81
Recording a Script to a Project 1-81
Working with Project Scripts 1-82
Executing a Script from Within a Script 1-83
Electronics Desktop Scripting Conventions 1-84
Named Arguments 1-84
VBscript Example 1-85
IronPython Example 1-85

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

Setting Numerical Values 1-86


Event Callback Scripting 1-87
2 - Object-Oriented Property Scripting 2-1
Object-Oriented Scripting 2-1
Material Properties and Examples 2-9
Body Properties and Modification 2-11
Retrieving Variables 2-11
Retrieve Datasets and Values 2-12
GetSolutionData API 2-14
Summary 2-14
Additional Details Specific to AEDT Solvers 2-18
Additional details on Boundaries/Excitations 2-20
3D component encapsulation 2-21
Additional details on Solve setup 2-22
Materials Scripting Support 2-23
Object Oriented Scripting for Materials 2-27
Examples showing change to material property type: 2-28
Examples showing change to a vector component value 2-28
Change choice property value 2-29
Change choice property value 2-30
Project Object Script Commands 2-31
AnalyzeAll [project] 2-34
ClearMessages 2-35
Close 2-36
CopyDesign 2-37
CutDesign 2-37
DeleteDesign 2-38
DeleteToolObject 2-39
GetActiveDesign 2-40
GetConfigurableData (Project) 2-41

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

GetDefinitionManager 2-41
GetDependentFiles 2-42
GetDesign 2-42
GetEDBHandle 2-43
GetLegacyName 2-43
GetName [Project] 2-44
GetPath 2-45
GetTopDesignList 2-46
InsertDesign 2-46
InsertDesignWithWorkflow 2-47
InsertToolObject 2-49
Paste (Project Object) 2-49
Redo [Project Level] 2-50
Rename 2-50
RestoreProjectArchive 2-51
Save 2-52
SaveAs 2-53
SaveAsStandAloneProject 2-55
SaveProjectArchive 2-56
SetActiveDefinitionEditor 2-57
SetActiveDesign 2-58
SimulateAll 2-58
Undo [Project] 2-59
UpdateDefinitions 2-60
3 - Application Object Script Commands 3-1
GetAppDesktop 3-2
GetApp 3-2
4 - Desktop Object Script Commands 4-1
AddMessage 4-5
ClearMessages 4-7

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

CloseAllWindows 4-11
CloseProject 4-11
CloseProjectNoForce 4-12
Count 4-13
DeleteProject 4-14
EnableAutoSave 4-15
ExportOptionsFiles 4-16
GetActiveProject 4-16
GetAutoSaveEnabled 4-17
GetBuildDateTimeString 4-18
GetCustomMenuSet 4-19
GetDefaultUnit 4-19
GetDesigns 4-22
GetDesktopConfiguration 4-23
GetDistributedAnalysisMachines 4-23
GetDistributedAnalysisMachinesForDesignType 4-24
GetExeDir 4-25
GetGDIObjectCount 4-26
GetLibraryDirectory 4-26
GetLocalizationHelper 4-28
GetMessages 4-28
GetName [Desktop] 4-30
GetPersonalLibDirectory 4-31
GetProcessID 4-32
GetProjects 4-32
GetProjectDirectory 4-33
GetProjectList 4-34
GetSchematicEnvironment 4-35
GetScriptingToolsHelper 4-35
GetSysLibDirectory 4-36

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

GetTempDirectory 4-37
GetUserLibDirectory 4-38
GetVersion 4-38
ImportANF 4-39
ImportAutoCAD 4-40
ImportGDSII 4-41
ImportODB 4-42
LaunchJobMonitor 4-43
NewProject 4-44
OpenAndConvertProject 4-45
OpenMultipleProjects 4-46
OpenProject 4-47
OpenProjectWithConversion 4-47
Paste (Project Object) 4-48
Paste (Project Object) 4-48
PauseRecording 4-49
PauseScript 4-50
Print 4-50
QuitApplication 4-51
RefreshJobMonitor 4-52
ResetLogging 4-53
RestoreProjectArchive 4-54
RestoreWindow 4-55
ResumeRecording 4-55
RunACTWizardScript 4-56
RunProgram 4-56
RunScript 4-57
RunScriptWithArguments 4-59
SelectScheduler 4-60
SetActiveProject 4-62

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

SetActiveProjectByPath 4-63
SetCustomMenuSet 4-63
SetDesktopConfiguration 4-65
SetLibraryDirectory 4-66
SetProjectDirectory 4-66
SetSchematicEnvironment 4-67
SetTempDirectory 4-68
ShowDockingWindow 4-69
Sleep 4-69
SubmitJob 4-70
TileWindows 4-71
Desktop Commands For Registry Values 4-72
DoesRegistryValueExist 4-73
GetRegistryInt 4-74
GetRegistryString 4-75
SetRegistryFromFile 4-76
SetRegistryInt 4-76
SetRegistryString 4-77
5 - Running Instances Manager Script Commands 5-1
GetAllRunningInstances 5-1
GetRunningInstanceByProcessID 5-2
GetRunningInstancesMgr 5-2
6 - Property Script Commands 6-1
Object Script Property Function Summary 6-3
Object Path 6-3
Property Object 6-4
Project Object 6-5
Design Object 6-6
3D Modeler Object 6-7
Variable Object 6-7

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

Optimetrics Module Object: 6-9


Optimetrics Setup Object 6-9
ReportSetup(Results) Module Object: 6-10
ReportSetup(Results) Module Child Objects: 6-11
Radiation Module Object: 6-12
Radiation Module Child Objects: 6-12
Conventions Used in this Chapter 6-13
GetArrayVariables 6-26
GetProperties 6-26
GetPropertyValue 6-28
GetVariables 6-30
GetVariableValue 6-30
SetPropertyValue 6-31
SetVariableValue 6-33
7 - Design Object Script Commands 7-1
ApplyMeshOps 7-5
Analyze 7-6
AnalyzeAll (Maxwell menu) 7-6
AnalyzeDistributed 7-7
ClearLinkedData (Design) 7-8
ConfigureFluentConductivityCoupling 7-8
ConstructVariationString 7-9
CreateParametricCircuit 7-10
Create3DDesign [Maxwell] 7-11
DeleteFieldVariation 7-12
DeleteFullVariation 7-13
DeleteLinkedDataVariation 7-13
DeleteVariation 7-14
EditNotes 7-14
EnableHarmonicForceCalculation 7-15

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

ExportConvergence 7-24
ExportElementBasedHarmonicForce 7-25
ExportHarmonicTransientForce 7-26
ExportMeshStats 7-28
ExportProfile 7-28
GetConfigurableData 7-29
GetData 7-30
GetDesignValidationInfo 7-30
GetGeometryMode 7-31
GetManagedFilesPath 7-32
GetModule 7-33
GetName 7-34
GetNominalVariation 7-35
GetNoteText 7-35
GetPostProcessingVariables 7-36
GetSelections [Design] 7-37
GetSolutionType 7-37
GetVariationVariableValue 7-37
InitializeSystemCoupling 7-38
Is2D 7-39
Is3D 7-39
Redo [Design] 7-40
RenameDesignInstance 7-41
ResetToTimeZero 7-41
SetActiveEditor 7-42
SetConductivityThreshold 7-43
SetDesignSettings [Maxwell] 7-43
SetFastTransformationForLayoutComponent 7-57
SetObjectAttributesForLayoutComponent 7-58
SetObjectDeformation 7-60

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

SetObjectTemperature 7-63
SetShowAllLayoutComponents 7-65
SetShowLayoutForLayoutComponent 7-65
SetSolutionType (Maxwell) 7-66
Solve 7-67
StopSimLink 7-67
RunToolkit 7-68
Undo [Design] 7-70
ValidateDesign 7-70
ValidateLink 7-71
8 - 3D Modeler Editor Script Commands 8-1
Conventions Used in this Chapter: 8-1
<AttributesArray> 8-1
<SelectionsArray> 8-2
Draw Menu Commands 8-4
Create3DComponent 8-6
CreateBondwire 8-10
CreateBox 8-14
CreateCircle 8-16
CreateCone 8-19
CreateCutplane 8-22
CreateCylinder 8-24
CreateEllipse 8-26
CreateEquationCurve 8-29
CreateEquationSurface 8-33
CreateHelix 8-36
CreatePoint 8-38
CreateUserDefinedPart 8-40
CreatePolyline 8-47
CreateRectangle 8-53

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

CreateRegion 8-55
CreateRegularPolyhedron 8-59
CreateRegularPolygon 8-62
CreateSphere 8-65
CreateSpiral 8-67
CreateTorus 8-69
CreateUserDefinedModel 8-72
CreateUserDefinedPart 8-79
Edit3DComponent 8-87
[Beta] EditNativeComponentDefinition [Maxwell] 8-89
EditPolyline 8-92
Get3DComponentParameters 8-97
Get3DComponentDefinitionNames 8-97
Get3DComponentInstanceNames 8-98
Get3DComponentMaterialNames 8-99
Get3DComponentMaterialProperties 8-99
Insert3DComponent 8-100
InsertNativeComponent [Layout Component to Maxwell with CS] 8-101
InsertPolylineSegment 8-105
SweepAlongPath 8-107
SweepAlongVector 8-109
SweepAroundAxis 8-112
SweepFacesAlongNormal 8-114
SweepFacesAlongNormalWithAttributes 8-116
UpdateComponentDefinition 8-119
Edit Menu Commands 8-120
Copy 8-120
DeletePolylinePoint 8-121
DuplicateAlongLine 8-122
DuplicateAroundAxis 8-125

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

DuplicateMirror 8-128
Mirror 8-131
Move 8-133
OffsetFaces 8-134
Paste (Model Editor) 8-136
Rotate 8-137
Scale 8-138
Modeler Menu Commands 8-140
AssignMaterial 8-142
Chamfer 8-145
Connect 8-147
CoverLines 8-148
CoverSurfaces 8-149
CreateEntityList 8-150
CreateFaceCS 8-152
CreateGroup 8-157
CreateObjectCS 8-158
CreateObjectFromEdges 8-165
CreateObjectFromFaces 8-166
CreateRelativeCS 8-168
DeleteEmptyGroups 8-170
DeleteLastOperation 8-171
DetachFaces 8-172
EditEntityList 8-173
EditFaceCS 8-175
EditObjectCS 8-181
EditRelativeCS 8-188
Export 8-190
ExportModelImageToFile 8-192
Fillet 8-196

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

FlattenGroup 8-198
GenerateHistory 8-199
HealObject 8-200
GetActiveCoordinateSystem 8-204
GetCoordinateSystems 8-205
Import 8-206
ImportDXF [Modeler] 8-209
ImportGDSII [Modeler] 8-213
Intersect 8-217
MoveCStoEnd 8-218
MoveEntityToGroup 8-219
MoveFaces 8-220
ProjectSheet 8-223
PurgeHistory 8-224
Section 8-225
SeparateBody 8-226
SetModelUnits 8-227
SetWCS 8-229
ShowWindow 8-230
Split 8-230
Subtract 8-233
SweepFacesAlongNormal 8-235
ThickenSheet 8-236
UncoverFaces 8-238
Unite 8-240
Ungroup 8-241
WrapSheet 8-242
Other oEditor Commands 8-243
AddDefinitionFromBlock 8-246
AddDefinitionFromLibFile 8-251

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

AddViewOrientation 8-255
BreakUDMConnection 8-262
ChangeProperty 8-263
Delete 8-270
GetBodyNamesByPosition 8-271
GetEdgeByPosition 8-272
GetEdgeIDsFromFace 8-274
GetEdgeIDsFromObject 8-275
GetFaceArea 8-275
GetFaceCenter 8-276
GetFaceByPosition 8-277
GetFaceIDs 8-278
GetGeometryModelerMode 8-279
GetModelBoundingBox 8-280
GetObjectIDByName 8-280
GetObjectName 8-281
GetObjectNameByFaceID 8-281
GetObjectsByMaterial 8-282
GetObjectsInGroup 8-283
GetMatchedObjectName 8-284
GetModelUnits 8-285
GetNumObjects 8-285
GetSelections [Model Editor] 8-286
GetUserPosition 8-287
GetVertexIDsFromEdge 8-287
GetVertexIDsFromFace 8-288
GetVertexIDsFromObject 8-289
GetVertexPosition 8-289
OpenExternalEditor 8-290
PageSetup 8-291

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

RenamePart 8-293
9 - Output Variable Script Commands 9-1
CreateOutputVariable (Maxwell) 9-1
DeleteOutputVariable 9-3
DoesOutputVariableExist 9-3
EditOutputVariable 9-4
GetOutputVariableValue 9-6
10 - Reporter Editor Script Commands 10-1
AddCartesianLimitLine 10-4
AddCartesianXMarker 10-6
AddCartesianYMarker 10-7
AddDeltaMarker 10-8
AddMarker 10-9
AddNote 10-10
AddTraceCharacteristics 10-12
AddTraces 10-13
ChangeProperty[ReportSetup] 10-16
ClearAllMarkers 10-20
ClearAllTraceCharacteristics 10-20
CopyTracesData 10-21
CopyReportsData 10-22
CopyReportDefinitions 10-23
CopyTraceDefinitions 10-23
CreateReportFromFile 10-24
CreateReport (Maxwell) 10-25
CreateReportFromTemplate 10-35
CreateReportOfAllQuantities 10-36
DeleteMarker 10-37
DeleteAllReports 10-38
DeleteReports 10-39

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

DeleteTraces 10-39
ExportImageToFile [Reporter] 10-40
ExportPlotImageToFile 10-41
ExportReport 10-43
ExportToFile 10-44
ExportToFile [Reporter] 10-46
ExportMarkerTable 10-47
FFTOnReport 10-47
GetAllReportNames 10-48
GetAllCategories 10-49
GetAllQuantities 10-50
GetAvailableDisplayTypes 10-51
GetAvailableReportTypes 10-52
GetAvailableSolutions 10-52
GetDataExpressions 10-53
GetDataUnits 10-54
GetDesignVariableNames 10-55
GetDesignVariableUnits 10-56
GetDesignVariableValue 10-57
GetDesignVariationKey 10-58
GetDisplayType (Maxwell) 10-59
GetImagDataValues 10-59
GetPerQuantityPrimarySweepValues 10-60
GetPropertyValue 10-61
GetRealDataValues 10-63
GetReportTraceNames 10-64
GetSolutionContexts 10-65
GetSolutionDataPerVariation 10-66
GetSweepNames 10-68
GetSweepUnits 10-69

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

GetSweepValues 10-70
GroupPlotCurvesByGroupingStrategy 10-71
ImportIntoReport 10-72
IsDataComplex 10-72
IsPerQuantityPrimarySweep 10-73
MovePlotCurvesToGroup 10-74
MovePlotCurvesToNewGroup 10-75
PasteReports 10-76
PasteTraces 10-77
Release Data 10-78
RenameReport 10-79
RenameTrace 10-79
ResetPlotSettings 10-80
SavePlotSettingsAsDefault 10-81
UpdateAllReports 10-82
UpdateReports 10-82
UpdateTraces 10-83
UpdateTracesContextAndSweeps 10-86
UnGroupPlotCurvesInGroup 10-88
11 - Boundary and Excitation Module Script Commands in Maxwell 11-1
General Commands Recognized by the Boundary/Excitations Module 11-2
AddAssignmentToBoundary 11-3
DeleteAllBoundaries 11-4
DeleteAllExcitations 11-5
DeleteBoundaries 11-5
GetBoundaryAssignment 11-6
GetBoundaries 11-7
GetBoundariesOfType 11-7
GetCoreLossEffect 11-8
GetCoreLossEffectOnField 11-9

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

GetDisplacementCurrent 11-9
GetEddyEffect 11-9
GetExcitations 11-10
GetExcitationsOfType 11-11
GetNumBoundaries 11-11
GetNumBoundariesOfType 11-12
GetNumExcitations 11-13
GetNumExcitationsOfType 11-13
ReassignBoundary 11-14
RemoveAssignmentFromBoundary 11-15
RenameBoundary 11-16
ReprioritizeBoundaries 11-17
Script Commands for Creating and Modifying Boundaries in Maxwell 11-18
AssignCylindricalHField 11-19
AssignDependent (2D) 11-20
AssignDependent (3D) 11-21
AssignFluxTangential 11-23
AssignImpedance (Maxwell) 11-23
AssignIndependent (Maxwell) 11-24
AssignInsulating 11-26
AssignRadiation (Maxwell) 11-26
AssignResistiveSheet 11-27
For 3D Magnetostatic, Eddy Current, and Transient designs 11-28
AssignSymmetry (Maxwell) 11-29
AssignTangentialHField 11-29
AssignThinLayer 11-30
AssignTouching 11-34
AssignVectorPotential 11-35
AssignZeroTangentialHField 11-36
EditCylindricalHField 11-36

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

EditDependent (Maxwell) 11-37


EditFluxTangential 11-37
EditImpedance (Maxwell) 11-38
EditIndependent (Maxwell) 11-39
EditInsulating 11-39
EditRadiation (Maxwell) 11-40
EditResistiveSheet 11-40
EditSymmetry 11-42
EditTangentialHField 11-43
EditThinLayer 11-43
EditTouching 11-46
EditVectorPotential 11-47
EditZeroTangentialHField 11-48
Script Commands for Creating and Modifying Excitations in Maxwell 11-48
AddTerminalsToWinding 11-50
AssignCharge 11-50
AssignCoilGroup 11-51
AssignCoilTerminal 11-52
AssignCoilTerminalGroup 11-53
AssignCurrent 11-54
AssignCurrentDensity 11-55
AssignCurrentDensityGroup 11-56
AssignCurrentDensityTerminal 11-57
AssignCurrentDensityTerminalGroup 11-57
AssignCurrentGroup 11-57
AssignFloating 11-58
AssignSink (Maxwell) 11-58
AssignVoltage (Maxwell) 11-59
AssignVoltageAPhi 11-59
AssignVoltageDrop 11-61

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

AssignVoltageDropGroup 11-61
AssignVoltageGroup 11-61
AssignVolumeChargeDensity 11-62
AssignWindingGroup 11-62
EditCharge 11-63
EditCoilTerminal 11-64
EditCurrent 11-64
EditCurrentDensity 11-65
EditCurrentDensityTerminal 11-65
EditExternalCircuit 11-66
EditFloating 11-66
EditSink 11-66
EditVoltage 11-67
EditVoltageAPhi 11-68
EditVoltageDrop 11-69
EditVolumeChargeDensity 11-70
EditWindingGroup 11-70
SetCoreLoss 11-70
SetEddyEffect 11-71
SetMagnetizationCompute 11-72
SetMinimumTimeStep 11-73
ShowWindow 11-74
12 - Mesh Operations Module Script Commands 12-1
General Commands Recognized by the Mesh Operations Module 12-2
DeleteOp 12-2
GetOperationNames 12-3
RenameOp 12-3
Script Commands for Creating and Modifying Mesh Operations 12-4
AssignCylindricalGapOp 12-5
AssignDensityControlOp 12-8

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

AssignEdgeCutLayerOp 12-11
AssignLengthOp 12-12
AssignModelResolutionOp 12-15
AssignSkinDepthLayerSetting 12-17
AssignSkinDepthOp 12-18
AssignTrueSurfOp 12-19
EditCylindricalGapOp 12-22
EditDensityControlOp 12-24
EditEdgeCutLayerOp 12-26
EditLengthOp 12-27
EditModelResolutionOp 12-30
EditSkinDepthOp 12-31
EditTrueSurfOp 12-33
InitialMeshSettings 12-35
13 - Analysis Setup Module Script Commands 13-1
ClearLinkedData (Module) 13-2
CopySetup 13-2
DeleteSetups 13-3
EditSetup [Maxwell] 13-4
VB Example: 3D ElectricTransient EditSetup: 13-8
VB Example: 3D Transient EditSetup: 13-8
VB Example: 3D ACConduction EditSetup: 13-9
VB Example: 2D DCConduction EditSetup: 13-9
VB Example: 2D Transient EditSetup: 13-10
Python Example: Transient EditSetup: 13-11
ExportCircuit 13-12
ExportIcepak 13-17
ExportSolnData 13-17
GetSetupCount 13-19
GetSetups 13-19

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

GetSweepCount 13-20
GetSweeps 13-21
InsertSetup [Maxwell] 13-21
Example: 3D Magnetostatic solve setup: 13-24
Python Example: 3D EddyCurrent solve setup: 13-25
VB Example:3D EddyCurrent solve setup: 13-27
Example: 3D Transient solve setup: 13-29
Example: 3D Electrostatic solve setup 13-30
Example:3D DCConduction solve setup 13-30
Example: 3D ElectroDCConduction solve setup 13-31
Example: 3D ElectricTransient solve setup 13-31
VB Example: 3D ACConduction solve setup 13-31
Python Example:3D ACConduction solve setup 13-32
Example:2D Magnetostatic solve setup 13-33
Example:2D EddyCurrent solve setup 13-34
Example: 2D Transient solve setup 13-34
Example: 2D Electrostatic solve setup: 13-36
Example: 2D ACConduction solve setup: 13-36
Example: 2D DCConduction solve setup: 13-36
PasteSetup 13-37
PasteSweep 13-37
RenameSetup 13-38
ResetAllToTimeZero 13-38
ResetSetupToTimeZero 13-39
RevertAllToInitial 13-39
RevertAllToInitialTemperature 13-40
RevertSetupToInitial 13-41
RevertSetupToInitialTemperature 13-41
14 - Optimetrics Module Script Commands 14-1
General Commands Recognized by the Optimetrics Module 14-6

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

CopySetup 14-7
DeleteSetups [Optimetrics] 14-8
DistributedAnalyzeSetup 14-8
ExportDXConfigFile 14-9
ExportOptimetricsProfile 14-10
ExportOptimetricsResult 14-11
ExportParametricResults 14-12
GetSetupNames [Optimetrics] 14-13
GetSetupNamesByType [Optimetrics] 14-13
ImportSetup 14-14
PasteSetup [Optimetrics] 14-16
RenameSetup [Optimetrics] 14-16
SolveSetup [Optimetrics] 14-17
SolveAllSetup 14-18
Parametric Script Commands 14-18
EditSetup [Parametric] 14-19
ExportParametricSetupTable 14-19
GenerateVariationData [Parametric] 14-20
InsertSetup [Parametric] 14-21
Optimization Script Commands 14-28
EditSetup [Optimization] 14-28
InsertSetup [Optimization] 14-35
Sensitivity Script Commands 14-43
EditSetup [Sensitivity] 14-43
InsertSetup [Sensitivity] 14-50
Statistical Script Commands 14-54
EditSetup [Statistical] 14-54
InsertSetup [Statistical] 14-57
15 - Solutions Module Script Commands 15-1
DeleteSolutionVariation 15-1

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

GetValidISolutionList 15-2
16 - Field Overlays Module Script Commands 16-1
AddMarkerToPlot 16-2
CreateFieldPlot 16-4
Maxwell Field Line Trace Plot Examples 16-26
DeleteFieldPlot 16-36
EditSurfaceMeshSummaryData 16-36
ExportPlotImageWithViewToFile [Reporter] 16-40
ExportSurfaceMeshSummary 16-42
GetFieldPlotNames 16-43
ModifyFieldPlot 16-43
ModifyInceptionParameters 16-46
RenameFieldPlot 16-47
RenamePlotFolder 16-48
SetFieldPlotSettings 16-49
SetPlotFolderSettings 16-52
SetPlotsViewSolutionContext 16-57
UpdateAllFieldsPlots 16-58
UpdateQuantityFieldsPlots 16-59
17 - Fields Calculator Script Commands 17-1
AddNamedExpression 17-2
AddNamedExpr 17-3
CalcOp 17-4
CalcRead(deprecated) 17-4
CalculatorRead 17-5
CalcStack 17-6
CalculatorWrite 17-7
ChangeGeomSettings 17-8
ClcEval 17-9
ClcMaterial 17-10

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

ClearAllNamedExpr 17-11
CopyNamedExprToStack 17-11
DeleteNamedExpr 17-12
EnterComplex 17-13
EnterComplexVector 17-13
EnterLine 17-14
EnterPoint 17-15
EnterQty 17-16
EnterScalar 17-16
EnterScalarFunc 17-17
EnterSurf 17-18
EnterVector 17-18
EnterVectorFunc 17-19
EnterVol 17-20
ExportOnGrid [Fields Calculator] 17-20
ExportToFile [Fields Calculator] 17-23
GetTopEntryValue 17-26
LoadNamedExpressions 17-27
SaveNamedExpressions 17-28
18 - Motion Setup Script Commands A
DeleteMotionSetup A
ReassignMoving B
Commands to Create and Edit the Band B
AssignBand B
EditMotionSetup E
GetMotionSetupNames G
Other Commands Recognized By the ModelSetup Module G
GetSymmetryMultiplier H
SetSymmetryMultiplier H
19 - Parameter Setup Script Commands 19-1

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

General Parameter Setup Script Commands 19-1


Commands to Create and Edit Parameters 19-2
AddReduceOp 19-2
AssignForce 19-4
[Beta] AssignLayoutForce 19-5
AssignMatrix 19-7
AssignTorque 19-9
DeleteAllParameters 19-10
DeleteParameters 19-10
DeleteReduceMatrix 19-11
DeleteReduceOp 19-11
EditForce 19-12
[Beta] EditLayoutForce 19-12
EditMatrix 19-15
EditReduceOp 19-15
EditTorque 19-16
ReassignParameter 19-16
RenameParameter 19-17
RenameReduceMatrix 19-17
RenameReduceOp 19-18
20 - User Defined Document Script Commands 20-1
AddDocument 20-1
DeleteAllDocuments 20-4
DeleteDocument 20-5
EditDocument 20-5
GetDocumentDefinitionNames 20-7
GetDocumentNames 20-8
RenameDocument 20-8
SaveHtmlDocumentAs 20-9
SavePdfDocumentAs 20-10

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

UpdateAllDocuments 20-10
UpdateDocument 20-11
ViewHtmlDocument 20-12
ViewPdfDocument 20-13
Explication of a Sample UDD Script 20-13
Example Python Script: Defining a Document 20-15
21 - User Defined Solutions Commands 21-1
CreateUserDefinedSolution 21-1
DeleteUserDefinedSolutions 21-3
EditUserDefinedSolution 21-4
22 - Network Data Explorer Script Commands 22-1
AddDiffPair 22-4
Cascade (SPISim) 22-5
ClearDiffPairs 22-6
Clone 22-7
Close 22-8
Combine (SPISim) 22-9
Deembed (SPISim) 22-10
DeembedBack (SPISim) 22-11
DeembedFront (SPISim) 22-13
DisableDiffPairs 22-14
EnableDiffPairs 22-15
ExportCitiFile 22-16
ExportMatlab 22-18
ExportSpreadsheet 22-20
ExportTouchstone 22-22
ExportTouchstone2 22-24
Extract (SPISim) 22-27
GetFrequencies 22-28
GetFrequencyCount 22-29

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

GetName 22-30
GetPortCount 22-30
GetPortNumber 22-31
GetPostProcSettings 22-32
GetVariation 22-33
HasSameData 22-34
LoadSolution 22-36
Open 22-37
Rename (SPISim) 22-38
Renormalize (SPISim) 22-39
Reorder 22-41
Reorder (SPISim) 22-42
Reset 22-43
SetAllPortImpedances 22-44
SetPortDeembedDistance 22-45
SetPortImpedance 22-46
SetPostProcSettings 22-47
Smooth 22-48
Stretch (SPISim) 22-49
Terminate 22-51
23 - CompInstance Script Commands 23-1
Callback Scripting Using CompInstance Object 23-1
CompInstance Functions 23-2
GetComponentName 23-2
GetInstanceID [Component Instance] 23-3
GetInstanceName [Component Instance] 23-4
GetParentDesign 23-4
GetPropHost 23-5
GetPropServerName 23-5
24 - Schematic Scripting 24-1

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

Method Format 24-2


Editor Scripting IDs 24-4
Format of IDs for different schematic objects: 24-4
Format for Components 24-5
Create Method List 24-6
CreateArc (Schematic Editor) 24-7
CreateCircle (Schematic Editor) 24-10
CreateComponent (Schematic Editor) 24-13
CreateGlobalPort (Schematic Editor) 24-15
CreateGround (Schematic Editor) 24-19
CreateLine (Schematic Editor) 24-22
CreatePagePort (Schematic Editor) 24-25
CreateIPort (Schematic Editor) 24-28
CreatePolygon (Schematic Editor) 24-31
CreateRectangle (Schematic Editor) 24-34
CreateText (Schematic Editor) 24-38
CreateWire (Schematic Editor) 24-42
General Method List 24-45
Activate (Schematic Editor) 24-47
AddPinGrounds (Schematic Editor) 24-48
AddPinIPorts (Schematic Editor) 24-51
AddPinPageConnectors (Schematic Editor) 24-52
AlignHorizontal (Schematic Editor) 24-53
AlignVertical (Schematic Editor) 24-54
BringToFront (Schematic Editor) 24-55
CloseEditor (Schematic Editor) 24-57
Copy (Schematic Editor) 24-57
CopyData [Schematic Editor] 24-58
CopySubdesign [Schematic Editor] 24-59
CreatePage (Schematic Editor) 24-60

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

Cut (Schematic Editor) 24-61


DeactivateOpen (Schematic Editor) 24-62
DeactivateShort (Schematic Editor) 24-63
Delete (Schematic Editor) 24-64
DeletePage (Schematic Editor) 24-65
ElectricRuleCheck (Schematic Editor) 24-66
ExportImage (Schematic Editor) 24-67
ExportNetlist 24-68
FindElements (Schematic Editor) 24-69
FitToBorder [Schematic Editor] 24-71
GridSetup (Schematic Editor) 24-72
FlipHorizontal (Schematic Editor) 24-75
FlipVertical (Schematic Editor) 24-76
Move (Schematic Editor) 24-78
NameNets (Schematic Editor) 24-79
PageBorders (Schematic Editor) 24-81
Pan (Schematic Editor) 24-81
Paste (Schematic Editor) 24-83
PasteData [Schematic Editor] 24-84
PasteDesign (Schematic Editor) 24-85
PushExcitations 24-87
Rotate (Schematic Editor) 24-90
SelectAll (Schematic Editor) 24-92
SelectPage (Schematic Editor) 24-93
SetPageData [Schematic Editor] 24-94
SendToBack 24-97
ShowVariableBlock (Schematic Editor) 24-98
SortComponents (Schematic Editor) 24-98
Wire (Schematic Editor) 24-99
ZoomArea (Schematic Editor) 24-100

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

ZoomIn (Schematic Editor) 24-101


ZoomOut (Schematic Editor) 24-102
ZoomPrevious (Schematic Editor) 24-103
ZoomToFit (Schematic Editor) 24-104
Property Method List 24-105
ChangeProperty (Schematic Editor) 24-105
GetEvaluatedPropertyValue (Schematic Editor) 24-106
GetProperties (Schematic Editor) 24-107
GetPropertyAttribute [Schematic Editor] 24-109
GetPropertyValue (Schematic Editor) 24-110
SetPropertyValue (Schematic Editor) 24-111
Information Method List 24-112
GetAllPorts 24-113
GetCompInstanceFromRefDes (Schematic Editor) 24-113
GetComponentInfo (Schematic Editor) 24-114
GetComponentPins (Schematic Editor) 24-116
GetComponentPinInfo (Schematic Editor) 24-117
GetComponentPinLocation [Schematic Editor] 24-118
GetEditorName (Schematic Editor) 24-119
GetNetConnections (Schematic Editor) 24-120
GetNumPages [Schematic Editor] 24-121
GetPortInfo (Schematic Editor) 24-122
GetSelections (Schematic Editor) 24-123
GetSignals (Schematic Editor) 24-124
GetWireConnections (Schematic Editor) 24-126
GetWireInfo (Schematic Editor) 24-128
GetWireSegments (Schematic Editor) 24-130
25 - Definition Manager Script Commands 25-1
AddMaterial (Maxwell) 25-2
Additional Properties for Nonlinear Property Type 25-6

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

Additional Properties for Vector Property Type 25-7


Additional Examples 25-8
CloneMaterial 25-12
ComputeCoreLossCoefficients 25-13
DoesMaterialExist 25-15
EditMaterial (Maxwell) 25-16
Example: Nonlinear Conductivity 25-16
Example using a Thermal Modifier for Electrical Steel Core Loss properties 25-17
Example: Set oProject = oDesktop.SetActiveProject("example_magnetostatic") 25-20
VB Example (Young's Modulus and Poisson's Ratio): 25-21
Additional Python Examples 25-22
Python Example (Young's Modulus and Poisson's Ratio): 25-22
Example: Magnetostrictive stress and deformation with full magnetostriction matrix
[3x3] 25-23
Python Example: Core Loss Y Parameter for Electrical Steel (Simple Property) 25-26
Python Example: Core Loss Y Parameter for Electrical Steel (Anisotropic Property) 25-28
Additional VB Examples 25-30
Example:Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop") 25-30
Example:Litz Wire 25-32
Example: Thermal Modifier 25-32
Example: B-P Curve Core Loss Model 25-34
GetProjextMaterialNames 25-36
ExportMaterial 25-37
RemoveMaterial 25-38
RemoveUnusedDefinitions 25-39
Component Manager Script Commands 25-40
Add [component manager] 25-41
AddDynamicNPortData [component manager] 25-60
AddNPortData [component manager] 25-63
AddSolverOnDemandModel 25-69

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

ClearSolutionCache [component manager] 25-69


Edit [component manager] 25-69
EditSolverOnDemandModel 25-96
EditWithComps [component manager] 25-96
Export [component manager] 25-108
GetData [component manager] 25-109
GetNames [component manager] 25-110
GetNPortData [component manager] 25-111
GetSolverOnDemandData 25-114
GetSolverOnDemandModelList 25-114
IsUsed [component manager] 25-115
Remove [component manager] 25-115
RemoveSolverOnDemandModel 25-117
RemoveUnused [component manager] 25-117
Update Dynamic Link [component manager] 25-118
Material Manager Script Commands 25-119
GetData [material manager] 25-119
GetNames [material manager] 25-120
GetProperties [material manager] 25-121
IsUsed [material manager] 25-122
RemoveUnused [material manager] 25-123
Model Manager Script Commands 25-123
Add [model manager] 25-124
ConvertToDynamic 25-135
ConvertToParametric 25-135
Edit [deprecated] 25-135
EditWithComps [model manager] 25-136
Export [model manager] 25-147
GetData [model manager] 25-148
GetNames [model manager] 25-149

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

IsUsed [model manager] 25-150


Remove [model manager] 25-151
RemoveUnused [model manager] 25-152
Network Data Explorer Manager Script Commands 25-153
ExportFullWaveSpice 25-153
ExportNetworkData 25-155
ExportNMFData 25-158
Symbol Manager Script Commands 25-158
Add [symbol manager] 25-159
BringToFront [symbol manager] 25-169
Edit [deprecated] 25-170
EditWithComps [symbol manager] 25-170
Export [symbol manager] 25-181
GetData [symbol manager] 25-182
GetNames [symbol manager] 25-183
IsUsed [symbol manager] 25-184
Remove [symbol manager] 25-184
RemoveUnused [symbol manager] 25-185
Add [footprint manager] 25-186
Edit [footprint manager] 25-209
EditWithComps [footprint manager] 25-209
Export [footprint manager] 25-227
GetData [footprint manager] 25-228
GetNames [footprint manager] 25-228
IsUsed [footprint manager] 25-229
Remove [footprint manager] 25-229
RemoveUnused [footprint manager] 25-231
Add [padstack manager] 25-231
Edit [padstack manager] 25-238
EditWithComps [padstack manager] 25-245

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

Export [padstack manager] 25-252


GetData [padstack manager] 25-253
GetNames [padstack manager] 25-254
IsUsed [padstack manager] 25-254
Remove [padstack manager] 25-255
RemoveUnused [padstack manager] 25-256
Script and Library Scripts 25-257
AddScript 25-257
EditScript 25-258
ExportScript 25-259
RemoveScript 25-260
ModifyLibraries 25-261
26 - Definition Editor Script Commands 26-1
Symbol Editor Scripts 26-1
AddLevel (Symbol Editor) 26-3
AlignHorizontal (Symbol Editor) 26-4
AlignVertical (Symbol Editor) 26-5
BringToFront (Symbol Editor) 26-6
ChangeProperty (Symbol Editor) 26-6
CloseEditor (Symbol Editor) 26-19
Copy (Symbol Editor) 26-20
CreateArc (Symbol Editor) 26-20
CreateCircle (Symbol Editor) 26-21
CreateImage (Symbol Editor) 26-22
CreateLine (Symbol Editor) 26-23
CreatePin (Symbol Editor) 26-24
CreatePolygon (Symbol Editor) 26-25
CreateRectangle (Symbol Editor) 26-26
CreateText (Symbol Editor) 26-27
Cut (Symbol Editor) 26-27

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

Delete (Symbol Editor) 26-28


DisplayPinNames (Symbol Editor) 26-29
ExportFile (Symbol Editor) 26-29
FlipHorizontal (Symbol Editor) 26-30
FlipVertical (Symbol Editor) 26-31
GetProperties (Symbol Editor) 26-31
GetPropertyValue (Symbol Editor) 26-32
GetVisibleLevels (Symbol Editor) 26-32
GridSetup (Symbol Editor) 26-33
Move (Symbol Editor) 26-34
Pan (Symbol Editor) 26-35
Paste (Symbol Editor) 26-35
Redo (Symbol Editor) 26-36
RemoveLevels (Symbol Editor) 26-37
RemovePort (Symbol Editor) 26-37
Rotate (Symbol Editor) 26-38
Save (Symbol Editor) 26-39
SelectAll (Symbol Editor) 26-39
SendToBack (Symbol Editor) 26-40
SetActivelLevel (Symbol Editor) 26-40
SetInitialLevels (Symbol Editor) 26-41
SetPropertyValue (Symbol Editor) 26-42
SetVisibleLevels (Symbol Editor) 26-42
ToggleLevel (Symbol Editor) 26-43
Undo (Symbol Editor) 26-44
ZoomArea (Symbol Editor) 26-45
ZoomIn (Symbol Editor) 26-46
ZoomOut (Symbol Editor) 26-46
ZoomPrevious (Symbol Editor) 26-47
ZoomToFit (Symbol Editor) 26-47

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

27 - Core Global Script Context Commands 27-1


AddErrorMessage 27-1
AddFatalMessage 27-2
AddInfoMessage 27-2
AddWarningMessage 27-3
LogDebug 27-3
LogError 27-4
28 - Example Scripts 28-1
VBScript Example Scripts 28-1
Variable Helix Script 28-1
Data Export Script 28-5
IronPython Example Scripts 28-8
BH Coordinates Python Script 28-8
Script Contents 28-9
Posco_BH_Curve.tab Contents 28-11
Equation Based Curve Python Script 28-13
Index Index-1

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

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

1 - Introduction to Scripting
Using scripts is a fast, effective way to accomplish tasks you want to repeat. When you execute a
script, the commands in the script are performed in the order in which they appear.
Electronics Desktop can record scripts in VBScript or IronPython, and can run external scripts
written in VBScript, IronPython, CPython, or JavaScript. Additionally, it contains an IronPython
command shell for executing scripts.
When running Ansys Electronics Desktop from the command line, scripts can be written in any
language that provides Microsoft COM methods.
The following sections contain more information about scripting:
l Scripting Help Conventions – explains the layout of the scripting help.
l Introduction to VBscript – provides a broad overview of VBscript
l Introduction to IronPython – provides a broad overview of IronPython.
l Introduction to C-Python – provides guidance on using C-Python for Ansys Electronics
Desktop scripts.
l Ansys Electronics Desktop Scripting – details instructions and tips for running, recording,
and working with scripts in Electronics Desktop.
l PyAEDT (Beta) – a Python library that interacts directly with the AEDT API to make script-
ing simpler for the end user.

Scripting Help Conventions


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

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

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

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

Introduction to Scripting 1-1


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

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


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

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

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

Introduction to Scripting 1-2


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

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

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

Introduction to Scripting 1-3


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

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

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

Scope and Lifetime of Variables


Variables at the script level are available to all procedures within the script. At the procedure
level, variables are available only within the procedure. It has local scope and is a procedure-
level variable.
The lifetime of a variable depends on how long it exists. The script-level variables exist from
declaration until the end of the script. A procedure-level variable exists only as long as you are in
the procedure and is destroyed when the procedure exits.
Array Variables
Create an array variable when you want to assign more than one related value to a single vari-
able. An array variable contains a series of values. For example:
Dim Primitives(2)

Introduction to Scripting 1-4


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

All arrays in VBScript are zero-based, so the array above actually contains 3 elements. You
assign data to each of the array’s elements using an index into the array. Data can be assigned
to the elements of an array as follows:
Primitives(0) = "Box1"
Primitives(1) = "Cone1"
Primitives(2) = "Cylinder1"
Similarly, the data can be retrieved from any element using an index into a particular array ele-
ment. For example:
one_prim = Primitives(1)

You can also use the Array function to assign an array of elements to a variable. For example:
Dim Primitives
Primitives = Array ("Box1", "cone1", "Cylinder1")

Note:

When using the Array function, do not use parentheses on the variable when it is
declared. For example, use Dim myarray, not Dim myarray().

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

Introduction to Scripting 1-5


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

Operator Precedence
When several operations occur in an expression, each part is evaluated and resolved in a pre-
determined order, called operator precedence. You can use parentheses to override the order of
precedence and force some parts of an expression to be evaluated before others. Operations
within parentheses are always performed before those outside the parentheses. Within par-
entheses, however, standard operator precedence is maintained.
When an expression contains operators from more than one category, they are evaluated in the
following order:

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

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

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

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

Symbol Description
^ Exponentiation
- Unary negation
* Multiplication
/ Division

Introduction to Scripting 1-6


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

\ Integer division
Mod Modulus arithmetic
+ Addition
- Subtraction

Note:

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

Comparison Operators
Following is a list of VBScript’s comparison operators:

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

Note:

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

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

Symbol Description
Not Logical negation
And Logical conjunction
Or Logical disjunction
Xor Logical exclusion

Introduction to Scripting 1-7


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

Eqv Logical equivalence


Imp Logical implication

Note:

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

Controlling Program Execution


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

Using If...Then...Else
Following is an example that demonstrates the If...Then...Else conditional statement:
If obj = "Box1" Then
<statements to execute>
ElseIf obj = "Cylinder1" Then
<statements to execute>
Else
<statements to execute>
End If
Using Select Case
Following is an example that demonstrates the Select Case conditional statement:
Select Case primitive_name
Case "Box1"
<statements to execute>
Case "Cylinder1"
<statements to execute>
Case Else
<statements to execute>

Introduction to Scripting 1-8


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

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

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


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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
convert the string "2.5" to the number 2.5.
CInt Syntax: CInt(variablename).
Converts variablename to an integer.

Including Scripts
You can include one script within another using the following command:

Introduction to Scripting 1-10


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

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

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

Interacting with a Script


VBScript provides two functions that enable you to interact with a script while it is running:
the InputBox function and the MsgBox function.
The InputBox function displays a dialog box with an input field. The value that is typed into the
input field is returned. For example:
Dim users_string
users_string = InputBox ("text prompt", "title of the pop-up dialog _
box", "default text for the input box")

The last two arguments to the function are optional.

The MsgBox function shows a message and returns a number based on the button the user
presses. For example:

Introduction to Scripting 1-11


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

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

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

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

Advantages of IronPython
The advantages that IronPython use provides are significant:
l Python has a large eco-system with plenty of supporting libraries, Visual IDEs and debug-
gers. It is actively developed and enhanced.

Introduction to Scripting 1-12


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

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
(feature in development). This allows better discovery of the scripting APIs as well as dir-
ectly programming to the scripting API in python, a language more tractable and platform
independent compared with VBScript.
l The Python syntax of dictionaries is somewhat easier to read and write when supplying
arguments to the scripting methods.

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

The document assumes that you know how desktop scripting works using VBScript or Javas-
cript.
Introduction to IronPython
IronPython Mini Cookbook
Translating Script Commands from VBScript to IronPython
Scripting Using Iron Python
Standalone IronPython and Desktop IronPython
IronPython Examples
Creating User Defined Primitives and User Defined Models in Python Scripts

Introduction to Scripting 1-13


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

Introduction to IronPython
IronPython is an implementation of the Python programming language targeting the .NET
runtime. What this means in practical terms is that IronPython uses the Python programming lan-
guage syntax and standard python libraries and can additionally use .NET classes and objects
to give one the best of both worlds. This usage of .NET classes is fairly seamless in that a class
defined in a .NET assembly can be used as a base class of a python class.
Scope
Functioning as a tutorial on Python or IronPython is way out of the scope of this document.
There are several excellent resources online that do a very good job in that regard. This doc-
ument only attempts to provide a limited introduction to IronPython as used to script Ansys EM
products.
This document is also not a tutorial on the scripting of Ansys EM products. It complements the
existing scripting guide (available from a product's Help menu) and provides a pythonic inter-
pretation of that information. The reader might have to refer to either the scripting guide or recor-
ded samples of VBScript to follow some of the sections.
Python compatibility
The version of IronPython in use is 2.7 and built on the .NET framework version 4.0: this version
targets Python 2.7 language compatibility. While most python files will execute under
IronPython with no changes, python libraries that make use of extensions written in the C pro-
gramming language (NumPy or SciPy for instance), are not expected to work under IronPython.
In such cases, it might be possible to locate .NET implementation of such libraries or explore the
use of IronClad.
(http://code.google.com/p/ironclad/).
Advantages of IronPython
The advantages that IronPython use provides are significant:
l Python has a large eco-system with plenty of supporting libraries, Visual IDEs and debug-
gers. It is actively developed and enhanced.
l IronPython, in addition, has access to the entire .NET eco system. This allows us, for
instance, to create a modern GUI using the System.Windows.Forms assembly from
IronPython code and call any other .NET assembly for that matter.
l The use of IronPython's technologies enables the ability to interactively script Desktop
(feature in development). This allows better discovery of the scripting APIs as well as dir-
ectly programming to the scripting API in python, a language more tractable and platform
independent compared with VBScript.
l The Python syntax of dictionaries is somewhat easier to read and write when supplying
arguments to the scripting methods.

Introduction to Scripting 1-14


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

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

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

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

Introduction to Scripting 1-15


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

Assigning/Creating Variables

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

Create Lists/Arrays

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

Introduction to Scripting 1-16


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

Create Dictionaries/Maps

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

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


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

Boolean Values

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

Converting Numbers to Strings and Vice Versa

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

Introduction to Scripting 1-17


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

String Formatting/Concatenation

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

Looping over Lists

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

For Each i in myArray for i in vals:


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

Looping over a Range

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

Introduction to Scripting 1-18


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

Related Topics:

Indentation in IronPython

Methods in IronPython

Introduction to IronPython

Translating Script commands from VBScript to IronPython

Scripting Using Iron Python

IronPython Samples

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

Note:

Python recommends the use of spaces over tabs.

Indenting Functions

Define a function that starts at 0 indentation:


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

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

Introduction to Scripting 1-19


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

Methods in IronPython
Finding Methods

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


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

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

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

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

Introduction to Scripting 1-20


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

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

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

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

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

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

Introduction to Scripting 1-21


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

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

Note:

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

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

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

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

Introduction to Scripting 1-22


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

Return Values

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

Replace each VBScript primitive with an equivalent IronPython primitive.


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

Formatting helps readability immensely but is not required.


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

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

Introduction to Scripting 1-23


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

Named Arrays with Nested Named Arrays

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


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

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

Introduction to Scripting 1-24


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

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

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

Important:

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

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

Introduction to Scripting 1-25


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

Standalone IronPython and Desktop IronPython

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

l Tools > Run Script menu item, select "IronPython" from the file type drop-down list.
l Launch the product with a script argument.
o Maxwell -runscript someScript.py to keep Maxwell GUI open after completing script
execution.
o Maxwell -features=beta -ng -runscriptandexit someScript.py to run Maxwell in a
non-graphical mode and exit after script completion. Note that this is a beta feature.
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
variables and functions. These predefined variables and functions are how the script

Introduction to Scripting 1-26


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

communicates with the desktop, and they come in four flavors addressed in the following sub-
topics:
Script Argument for IronPython
Script Argument for IronPython

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

Figure 1: Run Script dialog and script arguments


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

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

Introduction to Scripting 1-27


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

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

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

#import the CLR references


import clr

Introduction to Scripting 1-28


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

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

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


DockStyle

# the GUI form to show some text


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

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

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

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

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

Introduction to Scripting 1-29


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

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

# This makes it a modal dialog.


gui.ShowDialog()

# the following will make it a non-modal dialog


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

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

Introduction to Scripting 1-30


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

Note:

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

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

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

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

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

Introduction to Scripting 1-31


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

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

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

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

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

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

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

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

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


for modules and files.

l import ScriptEnv

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

l ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")

or ScriptEnv.InitializeNew(NonGraphical=True)

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

You must end the script with:

Introduction to Scripting 1-32


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

l ScriptEnv.Shutdown()

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

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

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

Introduction to Scripting 1-33


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

"Flags:= ", "",


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

Change property

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

Introduction to Scripting 1-34


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

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

Create a Cone using IronPython

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

Introduction to Scripting 1-35


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

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

# create the first cone


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

Introduction to Scripting 1-36


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

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

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


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

Introduction to Scripting 1-37


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

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

# all other grid positions, replicate from the


# first one

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

# paste it and capture the pasted name


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

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


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

Introduction to Scripting 1-38


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

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


"TranslateVectorZ" : "0mm"
}
)

# Now fit the display to the created grid


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

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

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

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

l Structures have the same names as in C implementation.


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

Introduction to Scripting 1-39


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

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

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

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

Constants

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

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


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

The rule for the output parameters is as follows:


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

Introduction to Scripting 1-40


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

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

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


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

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

where udmDefinition is an output


parameter

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


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

where partIds is an output para-


meter

'List Size' Parameters

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

Introduction to Scripting 1-41


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

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

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

# output list, output list size


faceIdList = udmFunctionLibrary.GetAllFaces(PartId)

# output list, input list size


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

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

(ignore numObjects as redundant: fol-


where numObjects and objectIds are input parameters ded into objectIds

Introduction to Scripting 1-42


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

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

(nSize is not ignored,


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

Added Parameters

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


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

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

Introduction to Scripting 1-43


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

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

Developing a UDM/UDP

Creation

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

Location

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

Organize

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

Introduction to Scripting 1-44


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

Edit/Reload

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

Import

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

Main class: UDPExtension

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

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

Mandatory methods.

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

GetLengthParameterUnits()

l returns string.

GetPrimitiveTypeInfo()

l returns UDPPrimitiveTypeInfo.

GetPrimitiveParametersDefinition2()

l returns a list of UDPPrimitiveParameterDefinition2 or None on failure

Introduction to Scripting 1-45


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

AreParameterValuesValid2(errorMsg, udpParams)

l errorMsg is a c# list of strings


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

CreatePrimitive2(funcLib, udpParams)

l funcLib is UDMFunction library


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

Optional methods

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


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

GetPrimitiveParameters()

l returns Python list of strings or NULL

GetRegisteredFaceNames()

l returns Python list of strings or NULL

GetRegisteredEdgeNames()

l returns Python list of strings or NULL

GetRegisteredVertexNames()

l returns Python list of strings or NULL

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

Introduction to Scripting 1-46


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

MapParametersDefinitionVersions2(oldVersion, oldUDPParams)

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

GetOldPrimitiveParametersDefinition2(version )

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

import sys
class UDPExtension(IUDPExtension):

def GetLengthParameterUnits(self):
return "mm"

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

return typeInfo
...
...
UDMExtension
Import

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

Introduction to Scripting 1-47


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

from UDM import *


Main class: UDMExtension

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

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

Mandatory methods.

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

GetInfo()

l returns UDMInfo object populated with appropriate UDM information.

IsAttachedToExternalEditor()

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


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

CreateInstance(funcLib)

l funcLib is UDMFunctionLibrary
l returns UDMParameters.

GetUnits(instanceId)

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

Refresh(funcLib, udmInParams, updatedParams, refreshModifiedPartsOnly,


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

Introduction to Scripting 1-48


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

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

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

returns True on success, False on failure.

ReleaseInstance(instanceId)

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

GetAttribNameForEntityId()

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

GetAttribNameForPartId()

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

Optional methods

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

Introduction to Scripting 1-49


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

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


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

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

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


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

class UDMExtension(IUDMExtension):

def IsAttachedToExternalEditor(self):
return False

Introduction to Scripting 1-50


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

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

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

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

(bret, udpPositionLow, udpPositionHigh) = udmFunc-


tionLibrary.GetBoundingBox(partId, exact);

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

Introduction to Scripting 1-51


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

Functions list:

1. List_of_UDMDefinition: udmDefinitionList = GetDefinition()


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

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

Introduction to Scripting 1-52


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

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

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

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


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

Introduction to Scripting 1-53


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

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


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

Introduction to Scripting 1-54


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

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


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

Introduction to Scripting 1-55


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

65. string: path = GetInstallDirPath()


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

UDP/UDM Structures and Constants


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

UDP/UDM Structures

Differences compared to C API


l UDMDefinition
l UDMOptions
l UDMParameters

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

Example (creating UDMParameter list):

udmParamList = [

UDMParameter(

"cubeSizeName", UnitType.LengthUnit,

UDPParam(ParamDataType.Double, cubeSize),

ParamPropType.Value,

ParamPropFlag.MustBeReal),

UDMParameter(

"cubeDistanceName", UnitType.LengthUnit,

UDPParam(ParamDataType.Double, cubeDistance),

ParamPropType.Value,

ParamPropFlag.MustBeReal),

Introduction to Scripting 1-56


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

UDMParameter("numCubesName", UnitType.LengthUnit,

UDPParam(ParamDataType.Int, numCubes),

ParamPropType.Number,

ParamPropFlag.MustBeInt]

l UDPParam
l UDPParamData

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

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

Example:

nCubesParam = UDPParam(ParamDataType.Int, numCubes)

nCubes = nCubesParam.Data

distanceParam = UDPParam()

distanceParam.setDouble(10.5)

doubleDistance = distanceParam.Data * 2

l UDP3x3Matrix

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

Example:

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

udpFunctionLib.Transform(partId, rotationMatrix, trans-


lationVector)

List of structures

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

Introduction to Scripting 1-57


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

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

Structure Construction Members


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

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

Introduction to Scripting 1-58


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

Structure Construction Members


setPosition(UDPPosition
val)

UDPPrim- UDPPrim- string Name


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

Introduction to Scripting 1-59


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

Structure Construction Members


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

Introduction to Scripting 1-60


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

Structure Construction Members


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

UDPBLNDFilletOptions UDPBLNDFilletOptions( bool SupressFillet /* Reserved for


future */

Introduction to Scripting 1-61


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

Structure Construction Members


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

Introduction to Scripting 1-62


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

Structure Construction Members


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

UDP/UDM Constants

Full names of enum constants must be used in scripts.


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

enum Constant Parameters


UnitType NoUnit
LengthUnit
AngleUnit
ParamDataType Int

Introduction to Scripting 1-63


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

enum Constant Parameters


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

Introduction to Scripting 1-64


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

enum Constant Parameters


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

UDP Python Example


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

Introduction to Scripting 1-65


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

purpose="Fillet Chamfer Example",


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

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

Introduction to Scripting 1-66


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

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

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

# points on the middle of 4 vertical edges


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

Introduction to Scripting 1-67


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

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

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


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

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


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

# select your geometry to which to apply operations


blend_element = UDPBLNDElements(box)

# specify attribute ListOfEdges to which edges to apply fil-


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

# redeclare attribute ListOfEdges to which edges to apply


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

# Provide to the user Info message indicating success


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

def GetPrimitiveTypeInfo(self):
return primitive_info

Introduction to Scripting 1-68


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

def GetLengthParameterUnits(self):
return length_units

def GetPrimitiveParametersDefinition2(self):
return primitive_param_definitions

def AreParameterValuesValid2(self, error, udp_params):


return True

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

def get_param_dict(self, param_values):


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

Introduction to Scripting 1-69


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

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

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

One advantage of CPython is the large set of libraries and tools that are available. See below for
instructions on modifying a script so that it can be launched with CPython interpreters.
CPython Script Engine and ansysedt process are comunicated using GRPC, the ansysedt pro-
cess started as GRPC server, the Script Script Engine acted as the GRPC clinet.

Important:

(Supported on both Windows and Linux in 24R1)

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


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

Connect() to an opened project in remote machine needs to use a share network path.

Creating an External Script


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

Introduction to Scripting 1-70


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

# Imports the sys module containing system-specific func-


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

Start ansysedt as GRPC server


But default ansysedt process will be started as GRPC server. When there is no argument
provided ansysedt.exe it start listening on the first available port from 50051.
-grpcsrv Flag
ansysedt -grpcsrv <optional port number or port range>.
ansysedt –grpcsrv
If no Port Number specified, same as the default like no grpcsrv flag
ansysedt –grpcsrv portNumber
ansysedt process will be listening on the port number, but report error as the port is used
by other application.
ansysedt –grpcsrv FirstPortNumber:LastPortNumber
ansysedt process will be listening on the first available port within the port range, but
report error if all ports in the range used.
ansysedt –grpcsrv FirstPortNumber:NumberOfPorts
ansysedt process will be listening on the first available port within the port range, but
report error if all ports in the range used.
Note: If the last number if smaller than the first number the last number will be treated as the
number of ports. (50051: 50250 has the same range as 50051:200)

Introduction to Scripting 1-71


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

Connect Functions:
1. Connect(projectPath)

a. Connect to the opened project.


b. Launch ansysedt.exe, open the project, then connect to it.
c. Error if the project does not exist.
2. Connect(portNumber) Connect to running ansysedt process in the local machine. Error if
no ansysedt process listening on this port.
3. Connect(machine, projectPath) connect to an open project in remote Machine. pro-
jectPath must be a network path. Error if no ansysedt process opened the project.
4. Connect(machine, portNumber) connect to a running ansysedt process on the remote
machine. Error if no ansysedt process listening on this port.

Example:
import sys
sys.path.append(r"<InstallationPath>/PythonFiles/DesktopPlugin")
import ScriptEnv
ScriptEnv.Connect(r”c:\myProjects\Project1.aedt”)
oProject = oDesktop.GetActiveProject()
print(oProject.GetName())

Launching Electronics Desktop


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

Introduction to Scripting 1-72


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

Note:

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

Connecting with a Running Instance of Electronics Desktop


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

Closing Electronics Desktop/Ending the Script


To close Electronics Desktop, add the following line to the end of the script:
ScriptEnv.Shutdown()
# This stops ScriptEnv.py. If you are running multiple
scripts, include this only at the end of the last script.

-grpcsrv Flag
This flag will launch the application in a mode where the executable serves as a scripting server
that can be used for CPython scripting in conjunction with the CPython stand alone scripting
instructions that were mentioned earlier. The
-ng flag can be combined with -grpcsrv.
On Windows:
ansysedt.exe -grpcsrv <optional port number>.
On Linux:
ansysedt -grpcsrv <optional port number>.
If the port number is omitted, the default of 50051 will be used.

Introduction to Scripting 1-73


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

With -grpcsrv, a message will be displayed in the Messages window indicating that the server
was started. If the requested port is in use by another application, starting the sever may fail.

Related Topics:

Standalone Scripting in Iron Python

Ansys Electronics Desktop Scripting


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

Introduction to Scripting 1-74


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

The commands are described below, followed by examples.


oAnsoftApp
The oAnsoftApp object provides a handle for Iron Python or VBscript to access the
Ansoft.ElectronicsDesktop product.
In Iron Python, for example:
oAnsoftApp = CreateObject('Ansoft.ElectronicsDesktop')
In VBscript, for example:
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
oDesktop
The oDesktop object is used to perform desktop-level operations, including project man-
agement.
In Iron Python, for example:
oDesktop = oAnsoftApp.GetAppDesktop()
In VBscript, for example:
Set oDesktop = oAnsoftApp.GetAppDesktop()

Introduction to Scripting 1-75


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

Consult the following for details about script commands recognized by oDesktop:
l Desktop Object Script Commands.

oProject
The oProject object corresponds to one project open in Electronics Desktop. It is used to
manipulate the project and its data. Its data includes variables, material definitions, and one or
more designs.
In Iron Python, for example:
oProject = oDesktop.GetActiveProject()
In VBscript, for example:
Set oProject = oDesktop.GetActiveProject()
Consult the following for details about script commands recognized by oProject:
l Project Object Script Commands

oDesign
The oDesign object corresponds to a design in the project. This object is used to manipulate
the design and its data, including variables, modules, and editors.
In Iron Python, for example:
oDesign = oProject.GetActiveDesign()
In VBscript, for example:
Set oDesign = oProject.GetActiveDesign()
Consult the following for details about script commands recognized by oDesign:
l Design Object Script Commands
l Output Variable Script Commands
l Reporter Editor Script Commands

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

Introduction to Scripting 1-76


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

l 3D Modeler Editor Script Commands


l Schematic Editor Script Commands

Important:

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

See: Reporter Editor Script Commands.

oModule
The oModule object corresponds to a module in the design. Modules are used to handle a set of
related functionalities.
In IronPython, for example:
oModule = oDesign.GetModule('BoundarySetup')
In VBscript, for example:
Set oModule = oDesign.GetModule("BoundarySetup")
Consult the following for details about script commands recognized by oModule:
l Analysis Module Script Commands
l Boundary and Excitation Module Script Commands
l Field Overlays Module Script Commands
l Mesh Operations Module Script Commands
l Optimetrics Module Script Commands
l Radiation Module Script Commands
l Reduce Matrix Module Script Commands
l Solutions Module Script Commands

Example Script Opening


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

Introduction to Scripting 1-77


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

In VBscript, this would be:


Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
Set oProject = oDesktop.SetActiveProject("Project1")
Set oDesign = oProject.SetActiveDesign("Design1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
Set oModule = oDesign.GetModule("BoundarySetup")
GetActiveProject and GetActiveDesign for Wider Use
The sample script above only works for "Design1" within "Project1". To create a script that is
usable for any open project, you can use one or both of GetActiveProject and GetAct-
iveDesign.
In IronPython:
oProject = oDesktop.GetActiveProject()
oDesign = oProject.GetActiveDesign()
In VBscript:
Set oProject = oDesktop.GetActiveProject()
Set oDesign = oProject.GetActiveDesign()
Running a Script
Electronics Desktop scripts can be run from within the software or from the command line.
Within Electronics Desktop
To run scripts in Electronics Desktop:

Introduction to Scripting 1-78


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

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

The Run Script file browser appears.

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

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

4. Click Open.

Electronics Desktop executes the script.

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

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

From the Command Line


To run a script from a command line, add the -runscriptandexit or -runscript argument
to the Electronics Desktop command line syntax.
To use script arguments, add the -scriptargs parameter and specify the arguments. For
example:
ansysedt.exe -scriptargs "hello there"

Introduction to Scripting 1-79


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

In Iron Python, the command line parameter following -scriptargs is passed without modi-
fication as a single string in the ScriptArgument python variable.
In VBscript, the command line parameter following -scriptargs is split into multiple strings
and converted to a VBscript collection which is accessible via the AnsoftScript.Arguments
collection. To access these arguments, for example:
msgbox AnsoftScript.Arguments(0) // Returns 'hello'
msgbox AnsoftScript.Arguments(1) // Returns 'there'
For more information about running a script from the command line, consult the Maxwell help
topic "Running Maxwell from the Command Line".
Direct Launch
If you run a script directly from the command line without launching Electronics Desktop, script
arguments will be in the WSH.arguments collection instead of the AnsoftScriptHost.ar-
guments collection. The following script ensures the arguments are accessed regardless of the
collection in which they reside:
on error resume next
dim args
Set args = AnsoftScript.arguments
if(IsEmpty(args)) then
Set args = WSH.arguments
End if
on error goto 0
// At this point, args has the arguments regardless of col-
lection
msgbox "Count is " & args.Count
for i = 0 to args.Count - 1
msgbox args(i)
next
Recording a Script
Electronics Desktop can record a script based on UI actions and save this script in either
IronPython (*.py) or VBscript (*.vbs) format.
Scripts can be saved to an external file, or to the project.

Introduction to Scripting 1-80


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

Important:

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

Recording a Script to File


To record a script to file:

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

A Save As file browser appears.

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


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

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

6. Perform the steps you want to record.


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

The recorded script is saved to the folder you specified.

Recording a Script to a Project

Introduction to Scripting 1-81


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

To record a script to a project:

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

The Save Script to Project dialog box appears:

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

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

Working with Project Scripts


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

Introduction to Scripting 1-82


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

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

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

Note:

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

Executing a Script from Within a Script


Electronics Desktop provides a script command that enables you to launch another script from
within the script that is being executed.
In IronPython:
oDesktop.RunScript(<ScriptName>)
In VBscript:
oDesktop.RunScript <ScriptName>

Introduction to Scripting 1-83


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

If the full path to the script is not specified, Electronics Desktop searches for the specified script
in the following locations, in order:

1. Personal Library Directory (PersonalLib)


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

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

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

1. Named data, where name precedes data.

For example:

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

2. Named Array, where name precedes array.

For example:

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

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

For example:

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

In the first and second examples, the name is formatted as "<Name>:=". This signals to Elec-
tronics Desktop that this is a name for the next argument in the script command. In the third
example, the name is formatted as "NAME:<name>" and is the first element of the array.

Introduction to Scripting 1-84


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

The names are used both to identify what the data means to you and to inform Electronics
Desktop which data is being given. The names must be included or the script will not play back
correctly. However, if you are writing a script, you do not need to pass in every piece of data that
the command can take. For example, if you are modifying a boundary, the script will be recorded
to include every piece of data needed for the boundary, whether or not it was modified. If you are
writing a script by hand, you can add only the data that changed and omit anything that you do
not want to change. Electronics Desktop will use the names to determine which data you
provided.
VBscript Example
For example, when editing an impedance boundary, Electronics Desktop records the EditIm-
pedance command as follows in VBscript:
oModule.EditImpedance "Imped1", Array("NAME:Imped1",
"Resistance:=", "100", "Reactance:=", "50",
"InfGroundPlane:=", false)
If you only wish to change the resistance, you can leave out the other data arguments when
manually writing a script:
oModule.EditImpedance "Imped1", Array("NAME:Imped1",
"Resistance:=", "100")
IronPython Example
When editing a port excitation, Electronics Desktop records the Edit command as follows
in IronPython:
oModule.Edit("Port1",
["NAME:Port1",
["NAME:Properties",
"PortSolver:=", "true",
"Phase:=", "0deg",
"Magnitude:=", "2mA",
"Impedance:=", "50Ohm",
"Theta:=", "0deg",
"Phi:=", "0deg",
"PostProcess:=", "false",
"Renormalize:=", "50Ohm + 0i Ohm",
"Deembed:=", "0mm",
"RefToGround:=", "false"

Introduction to Scripting 1-85


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

],
"Type:=", "EdgePort",
"IsGapSource:=", true,
"UpperProbe:=", false,
"LayoutObject:=", "Port1",
"Pin:=", "",
"ReferencePort:=", ""
]
)
If you only wish to change the magnitude, you can leave out the other data arguments when
manually writing a script:
oModule.Edit("Port1",
["NAME:Port1",
["Magnitude:=", "1mA"]
]
)
Setting Numerical Values
For script arguments that expect a number, the following options are possible:
l Pass in the number directly.

In IronPython:

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

In VBscript:

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


"Voltage:=", 3.5)

l Pass in a string containing the number with units.

In IronPython:

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

Introduction to Scripting 1-86


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

In VBscript:

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


"Voltage:=", "3.5V" )

l Pass in a variable name.

In IronPython:

var = 3.5

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

In VBscript:

dim var

var = "3.5V"

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


"Voltage:=", var)

Event Callback Scripting


Event Callback scripting allows you to define custom JavaScript and VBScript routines that will
run automatically after detecting a triggering event, such as placing a component or running a
simulation. When defining an Event Callback script, specify one or more scripts that will be run
after a particular event is detected.
A callback script can only access functions and other scripts defined by its callback definition.
For example, a Simplorer callback script can call PropHost.GetValue — and all other PropHost
functions — but only from scripts defined in the Property Dialog callback. As a result, "PropHost"
is a Simplorer script item that is only visible in "Property" callback scripts. For more information,
see Callback Scripting Using PropHost Object and Callback Scripting Using CompInstance
Object.
The following table lists allowable callback events, items that are visible from the associated call-
back script, and the set of accessible functions that can be called.

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-

Introduction to Scripting 1-87


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

pInstance identification name that can be used in oEditor prop-


erty-method scripts, such as GetPropertyValue(), SetProp-
ertyValue(), etc.

CompInstance.GetComponentName() — Returns the com-


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

CompInstance.GetProgress() – Returns the completion per-


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

CompInstance.GetRunStatus() — Returns the status number


of the specified design simulation.

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


ulation.

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


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

Introduction to Scripting 1-88


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

2 - Object-Oriented Property Scripting


Object-oriented scripting enhances scripting in AEDT by allowing object-oriented access to retrieve or modify object properties. The
primary gain is the ease with which properties of various existing objects in an AEDT project or design can be read, modified, and set.
This feature also allows for much less code to be written to access object properties and enables much more readable code for users,
avoiding complex array input.
This topic covers the following:
l Logic/syntax
l Basic attributes of project and design properties
l Example Scripts

Object-Oriented Scripting
There are five basic functions in object-oriented scripting for retrieving and setting properties:

1. GetChildNames()
2. GetChildObjects()
3. GetPropNames()
4. GetPropValue()
5. SetPropValue()

At a high level, use GetChildNames() to determine what object instances exist for a given object. An example is shown below to
demonstrate for an AEDT Project shown that has two Designs.

Object Oriented Property Scripting 2-1


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

If you open the Command Window that allows for executing python code, you first define the Project Object, oProject, and the Design
Object, oDesign, as shown:

Once the objects have been defined, you can use GetChildNames() to learn what object instances exist for each. As an example,
observe the Child Names of oProject, and you see a list of the Designs in the AEDT Project, per the GUI.

As another example, retrieve the names of the Object Instances available in oDesign, to see the various objects associated with a
Design setup:

Object Oriented Property Scripting 2-2


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

These names are what you would expect based on the Project Manager Layout:

In the Project Manager above, any object that has the ‘+’ symbol is populated with children that you can query. Once you know the
name of the object you want, you can instance it via the GetChildObject() command. This defines the instance to the desired object.
As an example, set an instance for the Excitations:

Object Oriented Property Scripting 2-3


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

You now have an object, oExcitations defined to be the oDesign Child Object ‘Excitations’. What does this mean? If you expand the
Excitations dialogue in the Project Manager, you expect that the Child Names of this object would be the names of the Excitations as
defined, in this case six ports:

Object Oriented Property Scripting 2-4


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

Object Oriented Property Scripting 2-5


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

There is clear logic to the Object Child Names as the children of the oExcitations object as the ports that have been defined in HFSS.
Looking at the Project tree can help you to conceive and retrieve desired information.
Expand the first port to see its expected Child Object, its Terminal, in the Project Manager Window:

Through scripting, first define the Port Object (in this example, oPort) using the ‘GetChildObject()’ command for the first port, ‘BAW_
module1_SE1.’ Then determine its Object Child Name, the terminal definition:

Object Oriented Property Scripting 2-6


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

As the use and logic for GetChildNames() and GetChildObject() have been demonstrated, you can now explore the properties of each
of these objects, if they exist. The function to determine what properties exist is GetPropNames(). Use this to determine what prop-
erties exist to be retrieved or modified for a given object. The properties available are readily identifiable in the Property window, by
default located beneath the Project Manager window. For example, if you select a given port object, ‘BAW_module1_SE1’ the Prop-
erty window populates as shown:

If you execute the GetPropNames() function on the previously defined object, oPort, you see the same Property Names as available
in the Properties window:

Object Oriented Property Scripting 2-7


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

Once you identify the desired object and you know the desired property, you can access the value via GetPropValue(). For example, if
you want to retrieve the name of the object oPort:

To change the value of the property, use the SetPropValue() function. The arguments for this function are (‘Property Name’,’New
Value’). For example, to change the name of the port to ‘Bob’:

This function returns a Boolean ‘True’ if successful. The Project Manager window updates accordingly:

Object Oriented Property Scripting 2-8


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

This approach for retrieving and setting properties is general and can be used for many aspects of an Ansys Electronics Desktop sim-
ulation. This Object-Oriented method of property identification and modification operates only on existing objects. Object-Oriented
scripting cannot create new instances; you must revert to the functions in a given Module to do that. Not all Children of a given object
may be accessible via the GetChildNames() command just yet. An example is given for Material property modification later in this App
Note. However, if you need specific objects you can reference details in the Scripting Help or reach out to an Application Engineer.

Material Properties and Examples


This section discusses the material properties and how to access and modify them. Because materials are globally defined, the
objects are children of the Project, oProject, as shown below:

Object Oriented Property Scripting 2-9


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

All materials with a Project Definition, or assigned to an object, in the Project are accessible. For example, assume you want to see the
conductivity of ‘copper.’ Follow the same flow as in the previous section:

The Material Property of interest is "Bulk Conductivity." So you create a "Cond" object to store the value and use the GetPropValue
function to obtain in. Then name the Cond object to see the value:

Object Oriented Property Scripting 2-10


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

To change the conductivity, use the SetPropValue() function as shown below:

Body Properties and Modification


The following example shows how to retrieve the properties of a Body in the model, in this case a Region object. Once you identity the
desired property, you can modify it as needed.

Retrieving Variables
Retrieving defined variables in a Design or Project is a common effort for automation. There are two types of variables, Design and
Project. Project variables are preceded with a ‘$’ symbol and are retrieved in the Project object as it is globally defined to all Designs.
Design variables do not have any preceding symbols and are retrieved in the Design object as their scope is limited to a given Design.
The following example demonstrates the retrieval of Project Variable names and values, and then Design variable names and val-
ues.:

Object Oriented Property Scripting 2-11


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

Retrieve Datasets and Values


The GetChildObject, GetChildTypes and GetChildNames functions operate on the oDesktop objects. This allows you to retrieve and
view datasets and values. The dataset script wrapper store all values internally in SI units, and converts them back to user-supplied
units when you request non-SI property values.For example, if you assigned a dataset to the example OptimTee project in HFSS, you
could use these functions in the command window:
>>>oDesktop.GetChildTypes()
['Projects']
>>>oDesktop.GetChildNames()
['OptimTee']
>>>arrProjectNames = oDesktop.GetChildNames()
>>>tp = oDesktop.GetChildObject('OptimTee')
>>>tp.GetChildTypes()

Object Oriented Property Scripting 2-12


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

['Design', 'Project Data']


>>>tp.GetChildNames('Project Data')
['Variables', 'Materials', 'Surface Materials', 'Datasets']
>>>ds = tp.GetChildObject('datasets')
>>>ds.GetChildNames()
['$ds1']
>>>ds1=ds.GetChildObject('$ds1')
>>>ds1.GetPropValue('[:,:]')
[[1.0, 4.0], [2.0, 5.0], [3.0, 6.0]]
>>>ds1.GetPropSIValue()
[[1.0, 4.0], [2.0, 5.0], [3.0, 6.0]]
>>>ds1.DimUnits
>>>ds1.DimUnits = ['mm','mm']
>>>ds1.DimUnits
['mm', 'mm']
>>>ds1.GetPropSIValue()
[[0.001, 0.0040000000000000001], [0.002, 0.0050000000000000001], [0.0030000000000000001,
0.0060000000000000001]]
>>>ds1.GetPropValue('[:,:]')
[[1.0, 4.0], [2.0, 5.0], [3.0, 6.0]]

Object Oriented Property Scripting 2-13


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

GetSolutionData API
Many users want to use scripts to extract solution data from Ansys Electronics Desktop for custom Post Processing. Scripting includes
a new method to do this without having to export data to a file and then re-import it for use in a script. The new function is accessible
via the “ReportSetup” Module. The function call is “GetSolutionDataPerVariation()”. A code snippet to extract Terminal S Parameter
data is shown:

The above code shows how you can extract the Dependent and Independent data to variables for easy manipulation. For more inform-
ation on other functions available for this, see GetSolutionDataPerVariation.

Summary
Scripting has been advancing in Ansys Electronics Desktop to better allow you to customize and automate their repetitive or complex
simulations. The ability to easily retrieve and set property values via the Object-Oriented scripting allows for ease or both writing and

Object Oriented Property Scripting 2-14


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

reading. The ability to extract solution data within a script execution is a new functionality that markedly enables more advanced post
processing.
Object oriented property scripting presents an easy to use, intuitive and object oriented representation of the data model. The frame-
work supports query of objects and their properties including the edits of the data model in an object oriented fashion. With the new
scripting framework, data exposure is intuitive and provides maximum coverage.
Each exposed script object supports the following COM functions:
l GetName
o Return name of the object as text string
o e.g. name of a design, solve setup, boundary, etc
l GetChildTypes
o An object can have different types of children.
o Return array of text string. Can be empty if the object’s children are NOT categorized into different types.

For example, a design object has 3 children types. The following examples show how the commands run in the Tools > Open
Command Window for IronPython.
>>> design.GetChildTypes()
['Module', 'Editor', ‘Design Data’]

l GetChildNames
o Input: [String – Type]. Default = “Module” and “Editor” for design script object. ‘All’ for other script objects.
o Return an array of immediate children’s names, of a given type if specified

For example, a Mechanical design object has these children.


>>> design.GetChildNames()
['Boundaries', 'Excitations', 'Optimetrics', 'Results', '3D Modeler']
Four of the children are of “Module” type

Object Oriented Property Scripting 2-15


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

>>> design.GetChildNames("module")
['Boundaries', 'Excitations', 'Optimetrics', 'Results']

l GetChildObject
o Input: String -- Object path. The path may include multiple generations.
o Return the child object if found

For example,
>>> d = project.GetChildObject("hfss")
>>> d.GetChildObject("3d modeler").GetChildNames()
['Box1', 'Box1_1', 'Box1_1_1']
>>> project.GetChildObject("hfss/3d modeler").GetChildNames()
['Box1', 'Box1_1', 'Box1_1_1']

l GetPropNames
o Input: [BOOL - IncludeReadOnly] -- default to true
o Return an array of the object’s properties

For example,
>>> geom = project.GetChildObject("hfss/3d modeler").GetChildObject("Box1")
>>> geom.GetPropNames()
['Name', 'Material', 'Material/SIValue', 'Material/EvaluatedValue', 'Solve Inside', 'Ori-
entation', 'Orientation/Choices', 'Model', 'Group', 'Display Wireframe', 'Material Appearance',
'Color', 'Color/Red', 'Color/Green', 'Color/Blue', 'Transparent']

Object Oriented Property Scripting 2-16


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

l GetPropValue
o Input: String – Property Path. The path may include multiple generations.
o Return the property value as VARIANT

For example,
>>> geom.GetPropValue("material")
'"vacuum"’
>>> geom.GetPropValue("xsize")
'3mm'
>>> op.GetPropValue("attach to original object")
False

l • SetPropValue
o Input: String – Property Path. The path may include multiple generations.
o Input: String – Data. New value of the property.
o Return -- True if property data is updated successfully. False if failed to assign the new value.

For example,
>>> geom.SetPropValue("model", False)
>>> boxcmd.SetPropValue("ysize", "4mm")

l GetPropEvaluatedValue (<PropName>)

For example,
oVar = oDesign.GetChildObject(" Variables/var")
oVar.GetPropEvaluatedValue()

Object Oriented Property Scripting 2-17


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

l GetPropSIValue (<PropName>

For example,
oCreateBox = oDesign.GetChildObject("3D Modeler/Box1/CreateBox:1")
oCreateBox.GetPropValue("xSize")
return "length / 2"
oCreateBox.GetPropEvaluatedValue("xSize")
return '0.4mm'
oCreateBox.GetPropSIValue("xSize")
return 0.0004

Additional Details Specific to AEDT Solvers


“3D Modeler” of 3D products and “Machine” of RMxprt are exposed as “Editor” type children of a design script object.
“Variables” and “Design Settings” are exposed as “Design Data” type children of a design script object.
The following “Module” types are exposed as “Module” type children of a design script object.
HFSS
l Boundaries, Excitations, Circuit Elements, Hybrid Regions, Analysis, Radiation, Field Overlays, Optimetrics, Results

HFSS 3D Layout
l Boundaries, Excitations, Circuit Elements, Analysis, Radiation, Field Overlays, Optimetrics, Results

Maxwell 3D/2D
l Boundaries, Excitations, Analysis, Field Overlays, Optimetrics, Results

Object Oriented Property Scripting 2-18


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

RMxprt
l Analysis, Field Overlays, Optimetrics, Results

Q3D
l Boundaries, Nets, Analysis, Optimetrics,

Q2D
l Boundaries, Conductors, Analysis, Field Overlays, Optimetrics,

Icepak
l Thermal, Monitor, Mesh, Analysis, Field Overlays, Optimetrics, Results

Mechanical
l Boundaries, Excitations, Analysis, Field Overlays, Optimetrics, Results

Circuit
l Optimetrics, Results

Circuit Netlist
l Results

EMIT
l Coupling

Simplorer/Twin Builder
l Analysis, Optimetrics, Results

Object Oriented Property Scripting 2-19


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

Additional details on Boundaries/Excitations


Each design type presents its boundaries/excitations data in the project tree as different groups. For example, an HFSS design has
Boundaries, Excitations, Circuit Elements and Hybrid Regions while a Icepak design has just a “Thermal” project tree folder.
These module script objects do not have properties
>>> project.GetChildObject("icepak/thermal").GetPropNames()
[]
GetChildTypes of these module script objects returns the types of its immediate children
>>> d = p.GetChildObject("q2d")
>>> d.GetChildObject("conductors").GetChildTypes()
['NonIdealGround', 'SignalLine']
GetChildNames of these module object returns its immediate children
>>> p.GetChildObject("icepak/thermal").GetChildNames()
['Source1', 'Resistance1', 'ConductingPlate1', 'Source2', 'Resistance2', 'ConductingPlate2',
'Source3', 'Resistance3', 'ConductingPlate3']
GetChildNames can be invoked with a “type” and the returns will be filtered by that given type.
>>> p.GetChildObject("icepak/thermal").GetChildNames("resistance")
['Resistance1', 'Resistance2', 'Resistance3']
Children of a module object are scriptable objects and have properties.
>>> port = p.GetChildObject("hfss/excitations/1")
>>> port.GetPropNames(False)
['Name', 'Deembed', 'Deembed Dist', 'Renorm All Terminals']

Object Oriented Property Scripting 2-20


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

You can query/edit these properties


>>> port.GetPropValue("deembed")
False
>>> port.SetPropValue("deembed", True)
True
>>> port.GetPropValue("deembed")
True
A boundary/excitation script object can also have children. For example, HFSS terminal is a child of its port. Q3D source/sink can be
children of a net.
>>> port.GetChildNames()
['Box1_T1']
>>> port.GetChildTypes()
['Terminal']
>>> p.GetChildObject("q3d/nets/s2").GetChildNames()
['Source2', 'Sink2']
>>> p.GetChildObject("q3d/nets/s2").GetChildTypes()
['Sink', 'Source']

3D component encapsulation
These script interfaces are compliant with encapsulation. For example,

Object Oriented Property Scripting 2-21


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

l Design.GetChildObject(“boundaries”).GetChildNames() will not return component boundaries


l SetPropValues of component excitations can only be used to edit post processing settings such as 'Deembed', 'Deembed Dist'
of a HFSS port.

Additional details on Solve setup


All solve setups are children of the “Analysis” script object. This parent script object is also of the type “Module”.
>>> d = oDesktop.GetActiveProject().GetChildObject("hfss")
>>> d.GetChildNames()
['Boundaries', 'Excitations', 'Hybrid Regions', 'Circuit Elements', 'Analysis', 'Opti-
metrics', 'RadField', 'Results', '3D Modeler']
>>> setups = d.GetChildObject("analysis")
This module script object has no property
>>> setups.GetPropNames()
[]
The children of this module script object in a 3D design is not categorized into different types because the solve setup type is one-to-
one to the solution type of a 3D design.
>>> setups.GetChildTypes()
[]
The children of this module script object in a 3DLayout and Simplorer/TwinBuilder design is categorized into different solve setup
types, such as “Transient”, “AC” and “DC” in a Simplorer/TwinBuilder design and “HFSS”, “PlanarEM”, “SIwave” in a 3D layout design.
A solve setup script object can also have children. Children are typically frequency sweeps.
>>> setup.GetChildNames()

Object Oriented Property Scripting 2-22


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

['Sweep', 'Sweep1', 'Sweep2']


>>> setup.GetChildTypes()
['Discrete', 'Interpolating']
>>> sweep1 = setup.GetChildObject("sweep")

Related Topics
Example: GetPropNames and GetPropValues for Layered Impedance Boundary Script

Materials Scripting Support


Supported material properties are shown in a Property window for the material item.

Object Oriented Property Scripting 2-23


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

Some Material Properties like Relatively Permittivity may have values assigned as BH Curves or Tensors, as discussed in the Assign-
ing Materials chapter of the online help.

Object Oriented Property Scripting 2-24


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

Object Oriented Property Scripting 2-25


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

With this feature enabled you can then:


l Get/Set Simple material property
l Get/Set Anisotropic material property
l Get/Set Nonlinear material property
l Get/Set Vector material property
l Components hide/shown as needed
l Get/Set Tensor material property
l Get/Set Choice material property
l AddDefinitionFromBlock
l AddDefiniitonFromLibFile
l GetExtendedDefinitionObect

A new Toolkit allows you to select materials from the Granta materials gateway, such that project materials will automatically be added
when you select a material from the gateway, and that the gateway itself is easily accessed from the materials.

Object Oriented Property Scripting 2-26


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

What is not supported:


l Change of property type
l Custom material property, due to its complexity

Object Oriented Scripting for Materials


Materials are Child objects of the Active Project. In the IronPython command window, you can execute GetPropNames() for a spe-
cified material as follows:
>>> omats = oDesktop.GetActiveProject().GetChildObject("Materials")
>>> omat = omats.GetChildObject("vacuum")
>>> omat.GetPropNames()
['Coordinate System Type', 'Coordinate System Type/Choices', 'Relative Permeability Type',
'Relative Permeability Type/Choices', 'Relative Permeability', 'Relative Permeability/SIValue',

Object Oriented Property Scripting 2-27


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

'Relative Permeability/EvaluatedValue', 'Bulk Conductivity Type', 'Bulk Conductivity


Type/Choices', 'Bulk Conductivity', 'Bulk Conductivity/SIValue', 'Bulk Con-
ductivity/EvaluatedValue', 'Magnetic Coercivity Type', 'Magnetic Coercivity Magnitude', 'Magnetic
Coercivity Magnitude/SIValue', 'Magnetic Coercivity Magnitude/EvaluatedValue', 'Composition',
'Composition/Choices', "Young's Modulus Type", "Young's Modulus Type/Choices", "Young's Modulus",
"Young's Modulus/SIValue", "Young's Modulus/EvaluatedValue", "Poisson's Ratio Type", "Poisson's
Ratio Type/Choices", "Poisson's Ratio", "Poisson's Ratio/SIValue", "Poisson's Ratio/E-
valuatedValue"]

Examples showing change to material property type:


>>> omat.GetPropValue("Relative Permeability Type/Choices")
['Simple', 'Anisotropic', 'Tensor', 'Nonlinear']
>>> omat.GetPropValue("Relative Permeability Type")
'Nonlinear'
>>> omat.SetPropValue("Relative Permeability Type", "Simple")
True
>>> omat.GetPropValue("Relative Permeability Type")
'Simple'
>>> omat.SetPropValue("Relative Permeability", 10)
True

Examples showing change to a vector component value


>>> omat.GetPropValue("Magnetic Coercivity Magnitude")
'0A_per_meter'
>>> omat.SetPropValue("Magnetic Coercivity Magnitude", "-1A_per_meter")

Object Oriented Property Scripting 2-28


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

True
>>> omat.GetPropNames()
['Coordinate System Type', 'Coordinate System Type/Choices', 'Relative Permeability Type',
'Relative Permeability Type/Choices', 'Relative Permeability', 'Relative Permeability/SIValue',
'Relative Permeability/EvaluatedValue', 'Bulk Conductivity Type', 'Bulk Conductivity
Type/Choices', 'Bulk Conductivity', 'Bulk Conductivity/SIValue', 'Bulk Con-
ductivity/EvaluatedValue', 'Magnetic Coercivity Type', 'Magnetic Coercivity Magnitude', 'Mag-
netic Coercivity Magnitude/SIValue', 'Magnetic Coercivity Magnitude/EvaluatedValue', 'Magnetic
Coercivity Components', 'Magnetic Coercivity Components/Component1', 'Magnetic Coercivity Com-
ponents/Component2', 'Magnetic Coercivity Components/Component3', 'Composition', 'Com-
position/Choices', '- Stacking Factor Type', '- Stacking Factor', '- Stacking Factor/SIValue',
'- Stacking Factor/EvaluatedValue', '- Stacking Direction', '- Stacking Direction/Choices',
"Young's Modulus Type", "Young's Modulus Type/Choices", "Young's Modulus", "Young's Mod-
ulus/SIValue", "Young's Modulus/EvaluatedValue", "Poisson's Ratio Type", "Poisson's Ratio
Type/Choices", "Poisson's Ratio", "Poisson's Ratio/SIValue", "Poisson's Ratio/EvaluatedValue"]
>>> omat.SetPropValue("Magnetic Coercivity Components/Component2", 2)
True
>>> omat.GetPropValue("Magnetic Coercivity Components")
['Component1:=', '2', 'Component2:=', '2', 'Component3:=', '0']

Change choice property value


>>> omat.GetPropValue("Composition/Choices")
['Solid', 'Lamination', 'Litz Wire']
>>> omat.SetPropValue("Composition", "Lamination")
True
>>> omat.GetPropNames()

Object Oriented Property Scripting 2-29


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

['Coordinate System Type', 'Coordinate System Type/Choices', 'Relative Permeability Type',


'Relative Permeability Type/Choices', 'Relative Permeability', 'Relative Permeability/SIValue',
'Relative Permeability/EvaluatedValue', 'Bulk Conductivity Type', 'Bulk Conductivity
Type/Choices', 'Bulk Conductivity', 'Bulk Conductivity/SIValue', 'Bulk Con-
ductivity/EvaluatedValue', 'Magnetic Coercivity Type', 'Magnetic Coercivity Magnitude', 'Magnetic
Coercivity Magnitude/SIValue', 'Magnetic Coercivity Magnitude/EvaluatedValue', 'Magnetic Coer-
civity Components', 'Magnetic Coercivity Components/Component1', 'Magnetic Coercivity Com-
ponents/Component2', 'Magnetic Coercivity Components/Component3', 'Composition',
'Composition/Choices', '- Stacking Factor Type', '- Stacking Factor', '- Stacking Fact-
or/SIValue', '- Stacking Factor/EvaluatedValue', '- Stacking Direction', '- Stacking Dir-
ection/Choices', "Young's Modulus Type", "Young's Modulus Type/Choices", "Young's Modulus",
"Young's Modulus/SIValue", "Young's Modulus/EvaluatedValue", "Poisson's Ratio Type", "Poisson's
Ratio Type/Choices", "Poisson's Ratio", "Poisson's Ratio/SIValue", "Poisson's Ratio/E-
valuatedValue"]
>>> omat.SetPropValue("Magnetic Coercivity Components/Component2", 2)
True
>>> omat.GetPropValue("Magnetic Coercivity Components")
['Component1:=', '2', 'Component2:=', '2', 'Component3:=', '0']

Change choice property value


>>> omat.GetPropValue("Composition/Choices")
['Solid', 'Lamination', 'Litz Wire']
>>> omat.SetPropValue("Composition", "Lamination")
True
>>> omat.GetPropNames()

Object Oriented Property Scripting 2-30


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

['Coordinate System Type', 'Coordinate System Type/Choices', 'Relative Permeability Type',


'Relative Permeability Type/Choices', 'Relative Permeability', 'Relative Permeability/SIValue',
'Relative Permeability/EvaluatedValue', 'Bulk Conductivity Type', 'Bulk Conductivity
Type/Choices', 'Bulk Conductivity', 'Bulk Conductivity/SIValue', 'Bulk Con-
ductivity/EvaluatedValue', 'Magnetic Coercivity Type', 'Magnetic Coercivity Magnitude', 'Mag-
netic Coercivity Magnitude/SIValue', 'Magnetic Coercivity Magnitude/EvaluatedValue', 'Magnetic
Coercivity Components', 'Magnetic Coercivity Components/Component1', 'Magnetic Coercivity Com-
ponents/Component2', 'Magnetic Coercivity Components/Component3', 'Composition', 'Com-
position/Choices', '- Stacking Factor Type', '- Stacking Factor', '- Stacking Factor/SIValue',
'- Stacking Factor/EvaluatedValue', '- Stacking Direction', '- Stacking Direction/Choices',
"Young's Modulus Type", "Young's Modulus Type/Choices", "Young's Modulus", "Young's Mod-
ulus/SIValue", "Young's Modulus/EvaluatedValue", "Poisson's Ratio Type", "Poisson's Ratio
Type/Choices", "Poisson's Ratio", "Poisson's Ratio/SIValue", "Poisson's Ratio/EvaluatedValue"]
>>>

Project Object Script Commands


Project commands should be executed by the oProject object.
One example of accessing this object is:
Set oProject = oDesktop.GetActiveProject()
Dataset Script Commands:
AddDataset
DeleteDataset
EditDataset
ExportDataset
HasDataset
ImportDataset
Other Project Object Script Commands:

Object Oriented Property Scripting 2-31


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

AddMaterial
AnalyzeAll
ChangeProperty
ClearMessages
CloneMaterial
Close
CopyDesign
CutDesign
DeleteDesign
DeleteToolObject
EditMaterial
ExportMaterial
GetActiveDesign
GetArrayVariables
GetChildNames [Project]
GetChildObject [Project]
GetChildTypes [Project]
GetConfigurableData
GetDefinitionManager
GetDependentFiles

Object Oriented Property Scripting 2-32


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

GetDesign
GetDesign
GetDesigns
GetEDBHandle
GetLegacyName
GetName [Project]
GetObjPath [Project]
GetPath
GetPropEvaluatedValue
GetPropNames [Project]
GetPropSIValue
GetPropValue [Project]
GetProperties
GetPropertyValue
GetTopDesignList
GetVariableValue
GetVariables
InsertDesign
InsertDesign (PlanarEM)
InsertDesignWithWorkflow
InsertToolObject

Object Oriented Property Scripting 2-33


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

Paste [Project Object]


Redo [Project Level]
RemoveAllUnusedDefinitions
RemoveMaterial
RemoveUnusedDefinitions
Rename
RunToolkit
Save
SaveAs
SaveAsStandAloneProject
SaveProjectArchive
SetActiveDefinitionEditor
SetActiveDesign
SetPropValue [Project]
SetPropertyValue
SetVariableValue
SimulateAll
Undo [Project]
UpdateDefinitions

AnalyzeAll [project]

Object Oriented Property Scripting 2-34


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

Runs the project-level script command from the script, which simulates all solution setups and Optimetrics setups for all design
instances in the project. The UI waits until simulation is finished before continuing with the script.

UI Access Project > Analyze All.


Parameters None.
Return Value None.

Python Syntax AnalyzeAll()


oProject.AnalyzeAll()
Python Example

VB Syntax AnalyzeAll
VB Example oProject.AnalyzeAll

ClearMessages
Clears information in the Messages window.

Note:

Additional options are available when using the Desktop-level ClearMessages command.

UI Access N/A
Parameters None.

Object Oriented Property Scripting 2-35


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

Return Value None.

Python Syntax ClearMessages()


Python Example oProject.ClearMessages()

VB Syntax ClearMessages
VB Example oProject.ClearMessages

Close
Closes the active project.

Warning:

Unsaved changes will be lost.

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

Python Syntax Close()

Object Oriented Property Scripting 2-36


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

Python Example oProject.Close()

VB Syntax Close
VB Example oProject.Close

CopyDesign
Copies a specified design.

UI Access Edit > Copy.

Name Type Description


Parameters
<DesignName> String Name of the design to copy from.

Return Value None.

Python Syntax CopyDesign (<DesignName>)


oProject.CopyDesign ("HFSSDesign1")
Python Example

VB Syntax CopyDesign <DesignName>


VB Example oProject.CopyDesign "HFSSDesign1"

CutDesign
Cuts a design from the active project. The design is stored in memory and can be pasted.

Object Oriented Property Scripting 2-37


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

Warning:

This is a legacy command that is no longer supported and should not be used as it may have unintended effects on solved
designs.

UI Access Edit > Cut.

Name Type Description


Parameters
<DesignName> String Name of the design.

Return Value None.

Python Syntax CutDesign (<DesignName>)


oProject.CutDesign("SimplorerDesign1")
Python Example

VB Syntax CutDesign <DesignName>


VB Example oProject.CutDesign "SimplorerDesign1"

DeleteDesign
Deletes a specified design in the project.

UI Access Edit > Delete, or Delete in the ribbon.

Object Oriented Property Scripting 2-38


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

Name Type Description


Parameters
<DesignName> String Name of the design.

Return Value None.

Python Syntax DeleteDesign (<DesignName>)


oProject.DeleteDesign("MaxwellDesign2")
Python Example

VB Syntax DeleteDesign <DesignName>


VB Example oProject.DeleteDesign "MaxwellDesign2"

DeleteToolObject

Note:
This command is for internal Ansys use only.

UI Access N/A

Name Type Description


Parameters
<ObjectName> String Name of the tool object.

Return Value None.

Object Oriented Property Scripting 2-39


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

Python Syntax DeleteToolObject(<ObjectName>)


Python Example oProject.DeleteToolObject("object1")

VB Syntax DeleteToolObject <ObjectName>


VB Example oProject.DeleteToolObject "object1"

GetActiveDesign
Returns the design in the active project

Note: GetActiveDesign will return normally if there are no active objects.

UI Access N/A
Parameters None.
Return Value Object of the active design.

Python Syntax GetActiveDesign()


oDesign = oProject.GetActiveDesign()
Python Example

VB Syntax GetActiveDesign
VB Example Set oDesign = oProject.GetActiveDesign

Object Oriented Property Scripting 2-40


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

GetConfigurableData (Project)

Note:
This command is for internal Ansys use only.

Python Syntax GetConfigurableData()


Python Example oProject.GetConfigurableData()

GetDefinitionManager
Gets the DefinitionManager object.

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

Python Syntax GetDefinitionManager()


Python Example oDefinitionManager = oProject.GetDefinitionManager()

VB Syntax GetDefinitionManager
VB Example Set oDefinitionManager = oProject.GetDefinitionManager

Object Oriented Property Scripting 2-41


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

GetDependentFiles
Provides a list of the external files referenced in the project, including characteristic (for example, MDX) and coupled project files.

UI Access N/A
Parameters None.
Return Value List of referenced files.

Python Syntax GetDependentFiles()


files = oProject.GetDependentFiles()
Python Example

VB Syntax GetDependentFiles
VB Example files = oProject.GetDependentFiles

GetDesign
Use: Returns the specified design.
Command: None
Syntax: GetDesign <DesignName>
Return Value: The specified design.
Parameters: <DesignName>

Object Oriented Property Scripting 2-42


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

Type: <string>
Name of the design to return.
VB Example: Set oDesign = oProject.GetDesign ("Maxwell3DDesign1")
GetEDBHandle
Returns the EDB handle for the project.

Important:

This script is for internal Ansys use only.

UI Access N/A
Parameters None.
Return Value String indicating the EDB handle for the project.

Python Syntax GetEDBHandle()


Python Example oProject.GetEDBHandle()

VB Syntax GetEDBHandle
VB Example oProject.GetEDBHandle

GetLegacyName
Obtains the legacy name of a project.

Object Oriented Property Scripting 2-43


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

Note:
This command is for internal Ansys use only.

UI Access N/A
Parameters None.
Return Value String containing the legacy project name.

Python Syntax GetLegacyName()


Python Example oProject.GetLegacyName()

VB Syntax GetLegacyName
VB Example oProject.GetLegacyName

GetName [Project]
Obtains the project name

UI Access N/A
Parameters None.
Return Value String containing the project name, not including the path or extension.

Object Oriented Property Scripting 2-44


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

Python Syntax GetName()


oProject.GetName()
Python Example

VB Syntax GetName
VB Example oProject.GetName

GetPath
Returns the location of the project on disk.

UI Access N/A
Parameters None.
Return Value String containing the path to the project, not including the project name.

Python Syntax GetPath()


oProject.GetPath()
Python Example

VB Syntax GetPath
VB Example oProject.GetPath

Object Oriented Property Scripting 2-45


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

GetTopDesignList
Returns a list of top-level design names.

UI Access N/A
Parameters None.
Return Value List of strings containing name of top-level designs.

Python Syntax GetTopDesignList()


oProject.GetTopDesignList()
Python Example

VB Syntax GetTopDesignList
VB Example oProject.GetTopDesignList

InsertDesign
Inserts a new design in the project. For Maxwell scripts, the last argument will always be empty.

UI Access Project > [Insert Maxwell 3D Design / Insert Maxwell 2D Design / Insert RMxprt Design].

Name Type Description


<DesignType> String Design type."Maxwell 2D", "Maxwell 3D", or "RMxprt".
Parameters
<DesignName> String Design name.
<SolutionType> String Dependent on design type.

Object Oriented Property Scripting 2-46


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

For Maxwell 3D, can be: "Magnetostatic", "EddyCurrent", "Transient", "Elec-


trostatic", "DCConduction", "ElectroDCConduction", or "ElectricTransient".
For Maxwell 2D, can be: "Magnetostatic", "EddyCurrent", "Transient", "Elec-
trostatic", "ACConduction", or "DCConduction".
For RMxprt, can be: "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 Syn-
chronous Motor", "Universal Motor", "DC Machine", "Claw-Pole Alternator",
"Three-Phase Non-Salient Synchronous Machine", or "Generic Rotating
Machine".
"" None Empty argument.

Return Value None.

Python Syntax InsertDesign (<DesignType>, <DesignName>, <SolutionType>,'')


oProject.InsertDesign('Maxwell 3D','MyDesign',
Python Example
'ElectricTransient', '')

VB Syntax InsertDesign <DesignType>, <DesignName>, <SolutionType>,""


oProject.InsertDesign "Maxwell 3D","MyDesign",
VB Example
"ElectricTransient", ""

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

Object Oriented Property Scripting 2-47


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

UI Access N/A

Name Type Description


<type> String Type of design.
<workflowName> String Name of the workflow.
Parameters <specName> String Name of the spec.
<fileName> String Name of the file.
<libLoc> String Type of library, such as SysLib.
<stationaryPath> String Path.

Return Value IDispatch string, such as 'IDispatch(IAltraSimScript)'

Python Syntax InsertDesignWithWorkflow(<type>, <workflowName>, <specName>, <fileName>, <libLoc>, <stationaryPath>)


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

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


Example "C:\\Program Files\\AnsysEM\\v241\\Win64\\syslib\\MS - RT_duroid 6010 (Er=10.2)
0.010 inch, 0.5 oz copper.asty")

VB Syntax InsertDesignWithWorkflow <type>, <workflowName>, <specName>, <fileName>, <libLoc>, <stationaryPath>


oProject.InsertDesignWithWorkflow "Circuit Design", "Serial Design", _
VB Example "PCIe3 Stressed", "LongChannel", "SysLib", _
"C:\Program Files\AnsysEM\v241\Win64\syslib\MS - RT_duroid 6010" & _

Object Oriented Property Scripting 2-48


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

" (Er=10.2) 0.010 inch, 0.5 oz copper.asty"

InsertToolObject

Note:
This command is for internal Ansys use only.

Python Syntax InsertToolObject()


Python Example oProject.InsertToolObject()

Paste (Project Object)


Pastes a design in the active project.

UI Access Edit > Paste.


Parameters None.
Return Value None

Python Syntax Paste()


Python Example oProject.Paste()

VB Syntax Paste
VB Example oProject.Paste

Object Oriented Property Scripting 2-49


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

Redo [Project Level]


Reapplies the last project-level command.

UI Access Edit > Redo.


Parameters None.
Return Value None.

Python Syntax Redo()


Python Example oProject.Redo()

VB Syntax Redo
VB Example oProject.Redo

Rename
Renames the project and saves it. Similar to SaveAs().

UI Access Edit > Rename.

Name Type Description


<NewName> String Desired name of the project. The path is optional.
Parameters <OverWriteOk> Boolean l True - overwrite the file on disk if it exists.

l False - prevent overwrite.

Object Oriented Property Scripting 2-50


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

Return Value None.

Python Syntax Rename(<NewName>,<OverWriteOK>)


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

VB Syntax Rename <NewName>,<OverWriteOK>


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

RestoreProjectArchive
Restores a previously archived project to a specified path.

UI Access File > Restore Archive.

Name Type Description


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

Return Value None.

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


Syntax

Object Oriented Property Scripting 2-51


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

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


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

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


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

Save
Saves the active project.

UI Access File > Save.


Parameters None.
Return Value None.

Python Syntax Save()


oProject.Save()
Python Example

VB Syntax Save

Object Oriented Property Scripting 2-52


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

VB Example oProject.Save

SaveAs
Saves the project under a new name. Requires a full path.

Note:

This script takes two parameters for non-schematic/layout designs and four parameters for schematic/layout designs.

UI Access File > Save As.

Name Type Description


<NewName> String The desired name of the project, with directory and extension.
<OverWriteOK> Boolean True to overwrite the file of the same name, if it exists. False to prevent over-
write.
<DefaultAction> String For Schematic/Layout projects only. Otherwise omit. See note below.

Parameters Valid actions: ef_overwrite , ef_copy_no_overwrite, ef_make_path_abso-


lute, or empty string.
<OverwriteActions> Array For Schematic/Layout projects only. Otherwise omit. See note below.
Structured array: Array("Name: <Action>", <FileName>, <FileName>, ...)
Valid actions: ef_overwrite , ef_copy_no_overwrite, ef_make_path_abso-
lute, or empty string.

Return Value None.

Pytho- For non-Schematic/Layout project: SaveAs ( <NewName> <OverWriteOK>)


n Syn-
tax For Schematic/Layout project: SaveAs (<NewName> <OverWriteOK> <DefaultAction> <OverrideActions>)

Object Oriented Property Scripting 2-53


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

oProject.SaveAs('D:/projects/project1.aedt', True)

Pytho- ----
n oProject.SaveAs('D:/Projects/Project1.aedt', True, 'ef_overwrite', ['NAME:Over-
Exam- rideActions', ['NAME:ef_copy_no_overwrite', ['NAME:Files',
ple
'$PROJECTDIR/circuit_models.inc']], ['NAME:ef_make_path_absolute', ['NAME:Files',
'$PROJECTDIR/SL_6s.sp']]])

VB Syn- For non-Schematic/Layout project: SaveAs <NewName> <OverWriteOK>


tax For Schematic/Layout project: SaveAs <NewName> <OverWriteOK> <DefaultAction> <OverrideActions>
oProject.SaveAs "D:/projects/project1.aedt", true
----
oProject.SaveAs
VB
Exampl- "F:\Designer Projects\TA33097\HighSpeedChannel.aedt", true, "ef_overwrite", Array
es ("NAME:OverrideActions",
Array("NAME:ef_copy_no_overwrite", Array("NAME:Files","$PROJECTDIR/circuit_mod-
els.inc")),
Array("NAME:ef_make_path_absolute", Array("NAME:Files","$PROJECTDIR\SL_6s.sp")))

Object Oriented Property Scripting 2-54


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

Important:

The DefaultAction and OverrideActions strings correspond to the following actions:

l ef_overwrite – Copy file to new project directory and overwrite.


l ef_copy_no_overwrite – Copy file to new project directory and don't overwrite.
l ef_make_path_absolute – Change reference to point to file in old project directory.
l Empty String – Do nothing.

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

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

SaveAsStandAloneProject
Saves the project as a standalone copy.

Note:

This script is not supported when the application is being controlled by Ansys Workbench.

UI Access N/A

Name Type Description


Parameters
<projectName> String The desired name of the project, with directory and extension.

Return Value None.

Object Oriented Property Scripting 2-55


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

Python Syntax SaveAsStandAloneProject( <projectName>)


Python Example oProject.SaveAsStandAloneProject('D:/projects/project1.aedt')

VB Syntax SaveAsStandAloneProject <projectName>

VB Examples oProject.SaveAsStandAloneProject "D:/projects/project1.aedt"

SaveProjectArchive
Saves the active project as an archive to the specified file path.

UI Access File > Archive.

Name Type Description


<archiveFilePath> String Path to archived file.
<IncludeExternalFiles> Boolean True to include external files; False to exclude.
Parameters <IncludeResultsFiles> Boolean True to include simulation files associated with the project; False to
exclude.
<AdditionalFiles> Array Additional specified files to include.
<ArchiveNotes> String String describe the archive.

Return Value None.

Python SaveProjectArchive(<archivefilepath>, <IncludeExternalFiles>, <IncludeResultsFiles>, <AdditionalFiles>,


Syntax <ArchiveNotes>)

Python oProject.SaveProjectArchive("C:\\Users\\Documents\\Ansoft\\Project27.aedtz", True,


Example False, [], "")

Object Oriented Property Scripting 2-56


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

VB Syn- SaveProjectArchive <archivefilepath>, <IncludeExternalFiles>, <IncludeResultsFiles>, <AdditionalFiles>,


tax <ArchiveNotes>

VB oProject.SaveProjectArchive "C:\Documents\OptimTee.aedtz", true, false, Array(), "My


Example notes"

SetActiveDefinitionEditor
Obtains a specified definition editor.

UI Access N/A

Name Type Description


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

Return Value Object for the definition to be edited.

Python Syntax SetActiveDefinitionEditor(<EditorName>, <DefinitionName>)


oProject.SetActiveDefinitionEditor("SymbolEditor",
Python Example "Simplorer Elements\Basic Elements\Circuit\Passive Elements:R")

VB Syntax SetActiveDefinitionEditor <EditorName>, <DefinitionName>

Object Oriented Property Scripting 2-57


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

oProject.SetActiveDefinitionEditor "SymbolEditor",_
VB Example
"Simplorer Elements\Basic Elements\Circuit\Passive Elements:R"

SetActiveDesign
Sets a design to be the active design.

UI Access N/A

Name Type Description


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

Return Value None.

Python Syntax SetActiveDesign (<DesignName>)


Python Example oDesign = oProject.SetActiveDesign("SimplorerDesign2")

VB Syntax SetActiveDesign <DesignName>


VB Example Set oDesign = oProject.SetActiveDesign "SimplorerDesign2"

SimulateAll
Simulates all solution setups and Optimetrics setups for all design instances in the project. Script processing only continues when all
analyses are finished.

UI Access N/A

Object Oriented Property Scripting 2-58


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

Parameters None.
Return Value None.

Python Syntax SimulateAll()


oProject.SimulateAll()
Python Example

VB Syntax SimulateAll
VB Example oProject.SimulateAll

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

UI Access Edit > Undo.


Parameters None.
Return Value None.

Python Syntax Undo()


oProject.Undo()
Python Example

Object Oriented Property Scripting 2-59


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

VB Syntax Undo
VB Example oProject.Undo

UpdateDefinitions
Updates all definitions. The Messages window reports when definitions are updated, or warns when definitions cannot be found.

UI Access Tools > Project Tools > Update Definitions. Click Select All, then Update.
Parameters None.
Return Value None.

Python Syntax UpdateDefinitions()


oProject.UpdateDefinitions()
Python Example

VB Syntax UpdateDefinitions
VB Example oProject.UpdateDefinitions

Object Oriented Property Scripting 2-60


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

3 - Application Object Script Commands


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

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

Application Object Script Commands 3-1


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

l SetNumberOfProcessors (deprecated)
l SetUseHPCForMP (deprecated)

GetAppDesktop
GetAppDesktop is a function of oAnsoftApp. This function does not take an input and it returns an object. The object is assigned to the
variable oDesktop.

UI Access NA

Name Type Description


Parameters
None

Return Value Object

Python Syntax GetAppDesktop()


Python Example oDesktop = oAnsoftApp.GetAppDesktop()

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

GetApp
Obtains the product application object.

Application Object Script Commands 3-2


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

UI Access NA

Name Type Description


Parameters <productname> String One of "Twin Builder", "HFSS", "Maxwell", "Q3D Extractor". "Maxwell Circuit
Editor", "Designer"

Return Value Object

Python Syntax GetApp(<productname>)


Python Example oHFSSApp = oAnsoftApp.GetApp("HFSS")

VB Syntax GetApp(<productname>)
Dim oHFSSApp
VB Example
oHFSSApp = oAnsoftApp.GetApp("HFSS")

Application Object Script Commands 3-3


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

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

4 - 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. See: Object Oriented Property Scripting.
Set oDesktop =
CreateObject("Ansoft.ElectronicsDesktop")
oDesktop.CommandName <args>
AddMessage
AreThereSimulationsRunning
ClearMessages
CloseAllWindows
CloseProject
CloseProjectNoForce
Count
DeleteProject
DeleteRegistryEntry
DoesRegistryValueExist
DownloadJobResults
EnableAutoSave
ExportOptionsFiles
GenerateMetadata
GetActiveProject

Desktop Object Script Commands 4-1


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

GetActiveScheduler
GetActiveSchedulerInfo
GetAutoSaveEnabled
GetBuildDateTimeString
GetCustomMenuSet
GetDefaultUnit
GetDesktopConfiguration
GetDistributedAnalysisMachines
GetDistributedAnalysisMachinesForDesignType
GetExeDir
GetFullGeometry
GetGDIObjectCount
GetGrpcServerPort
GetHashcode
GetIsGrpcServer
GetIsNongraphical
GetLibraryDirectory
GetLocalizationHelper
GetMessages
GetMonitorData

Desktop Object Script Commands 4-2


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

GetPersonalLibDirectory
GetProcessID
GetProjectDirectory
GetProjectList
GetProjects
GetRegistryInt
GetRegistryString
GetRunningInstancesMgr
GetSchematicEnvironment
GetScriptingToolsHelper
GetSysLibDirectory
GetTempDirectory
GetTool
GetUserLibDirectory
GetVersion
IsFeatureEnabled
KeepDesktopResponsive
LaunchJobMonitor
NewProject
OpenAndConvertProject
OpenMultipleProjects

Desktop Object Script Commands 4-3


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

OpenProject
OpenProjectWithConversion
PageSetup
PauseRecording
PauseScript
Print
QuitApplication
RefreshJobMonitor
RefreshToolkitUI
ResetLogging
RestoreProjectArchive
RestoreWindow
ResumeRecording
RunACTWizardScript
RunProgram
RunScript
RunScriptWithArguments
SelectScheduler
SetActiveProject
SetActiveProjectByPath

Desktop Object Script Commands 4-4


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

SetCustomMenuSet
SetDesktopConfiguration
SetLibraryDirectory
SetProjectDirectory
SetRegistryFromFile
SetRegistryInt
SetRegistryString
SetSchematicEnvironment
SetTempDirectory
ShowDockingWindow
Sleep
StopSimulations
SubmitJob
TileWindows
WaitForSimulationsToBeDone

Related Topics:

Desktop Commands For Registry Values

ImportExport Tool Commands

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

Desktop Object Script Commands 4-5


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

UI Access N/A

Name Type Description


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

Return Value None.

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


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

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


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

Desktop Object Script Commands 4-6


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

ClearMessages
For a specified project and design, this command clears all messages in a specified severity range. The user-specified integral sever-
ity level is interpreted as:
0 => info, 1 => warning, 2 => error, and 3 => fatal error.
The ClearMessages function accepts four input arguments. The first two specifies project and design, respectively. This function
clears messages in the range specified by the third (interpreted as start severity) and fourth (interpreted as stop severity) arguments.
The fourth argument has a default value of 0. The last two arguments need not be specified in any given order, i.e., they can indicate
either ascending or descendingtrend. The function clears all messages having severity level within this specified range. The start and
stop severity need not be specified in any given order (i.e., they can indicate either ascending or descending severity).

UI Access In Message Manager, right-click and select Clear messages for [ProjectName]...

Name Type Description


<projectName> String Name of the project from which to clear messages.
<designName> String Name of the design under the <projectName> from which to clear messages.
<startSeverity> Integer User-specified severity level at which messages start getting cleared:
l 0 = informational
l 1 = warning
l 2 = error
Parameters
3 = fatal error
l

<stopSeverity> Integer Optional. User-specified stop severity level until which messages will be
cleared.
l 0 = informational
l 1 = warning
l 2 = error
l 3 = fatal error

Desktop Object Script Commands 4-7


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

If not specified, <stopSeverity> has a default value of 0.

Return Value None.

Python Syntax ClearMessages(<projectName>, <designName>, <startSeverity>, <stopSeverity>)

Preserve Current Functionality; stopSeverity = 0 (DEFAULT VALUE)


# startSeverity = 0; clears just the Info messages
oDesktop.ClearMessages("Ex_EC_1_Asymmetrical_Conductor", "Maxwell3DDesign1", 0)
# startSeverity = 1; clears all the Info and Warning messages
oDesktop.ClearMessages("Ex_EC_1_Asymmetrical_Conductor", "Maxwell3DDesign1", 1)
# startSeverity = 2; clears all the Info, Warning, Error
oDesktop.ClearMessages("Ex_EC_1_Asymmetrical_Conductor", "Maxwell3DDesign1", 2)
# startSeverity = 3; clears all messages, i.e., Info, Warning, Error, Fatal
Python Example
oDesktop.ClearMessages("Ex_EC_1_Asymmetrical_Conductor", "Maxwell3DDesign1", 3)
Extend the current functionality by enabling range-based deletion
# startSeverity = 0; clears the Info messages;
oDesktop.ClearMessages("Ex_EC_1_Asymmetrical_Conductor", "Maxwell3DDesign1", 0)
# startSeverity = 0 and stopSeverity = 0; clears all the Info messages
oDesktop.ClearMessages("Ex_EC_1_Asymmetrical_Conductor", "Maxwell3DDesign1", 0,
0)
# startSeverity = 0 and stopSeverity = 1; clears all the Info and Warning mes-

Desktop Object Script Commands 4-8


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

sages
oDesktop.ClearMessages("Ex_EC_1_Asymmetrical_Conductor", "Maxwell3DDesign1", 0,
1)
# startSeverity = 0 and stopSeverity = 2; clears all the Info, Warning, and Error
messages
oDesktop.ClearMessages("Ex_EC_1_Asymmetrical_Conductor", "Maxwell3DDesign1", 0,
2)
# startSeverity = 0 and stopSeverity = 3; clears all the Info, Warning, Error,
and Fatal messages
oDesktop.ClearMessages("Ex_EC_1_Asymmetrical_Conductor", "Maxwell3DDesign1", 0,
3)

# startSeverity = 1; clears all the Info and Warning messages;


oDesktop.ClearMessages("Ex_EC_1_Asymmetrical_Conductor","Maxwell3DDesign1",1)
# startSeverity = 1 and stopSeverity = 1; clears all the Warning messages
oDesktop.ClearMessages("Ex_EC_1_Asymmetrical_Conductor","Maxwell3DDesign1",1, 1)
# startSeverity = 1 and stopSeverity = 2; clears all the Warning and Error mes-
sages
oDesktop.ClearMessages("Ex_EC_1_Asymmetrical_Conductor","Maxwell3DDesign1",1, 2)
# startSeverity = 1 and stopSeverity = 3; clears all the Warning, Error, and
Fatal messages
oDesktop.ClearMessages("Ex_EC_1_Asymmetrical_Conductor","Maxwell3DDesign1",1, 3)

# startSeverity = 2; clears all the Info, Warning, and Error messages;

Desktop Object Script Commands 4-9


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

oDesktop.ClearMessages("Ex_EC_1_Asymmetrical_Conductor","Maxwell3DDesign1",2)
# startSeverity = 2 and stopSeverity = 2; clears all the Error messages
oDesktop.ClearMessages("Ex_EC_1_Asymmetrical_Conductor","Maxwell3DDesign1",2, 2)
# startSeverity = 2 and stopSeverity = 3; clears all the Error and Fatal messages
oDesktop.ClearMessages("Ex_EC_1_Asymmetrical_Conductor","Maxwell3DDesign1",2, 3)
# startSeverity = 2 and stopSeverity = 0; clears all the Info, Warning, and Error
messages
oDesktop.ClearMessages("Ex_EC_1_Asymmetrical_Conductor","Maxwell3DDesign1",2, 0)

# startSeverity = 3; clears all the Info, Warning, Error, and Fatal messages;
oDesktop.ClearMessages("Ex_EC_1_Asymmetrical_Conductor","Maxwell3DDesign1",3)
# startSeverity = 3 and stopSeverity = 3; clears all the Fatal error messages
oDesktop.ClearMessages("Ex_EC_1_Asymmetrical_Conductor","Maxwell3DDesign1",3, 3)
# startSeverity = 3 and stopSeverity = 0; clears all the Info, Warning, Error,
and Fatal messages
oDesktop.ClearMessages("Ex_EC_1_Asymmetrical_Conductor","Maxwell3DDesign1",3, 0)

VB Syntax ClearMessages <projectName>, <designName>, <startSeverity>, <stopSeverity>


Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
VB Example
Set oDesktop = oAnsoftApp.GetAppDesktop()

Desktop Object Script Commands 4-10


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

oDesktop.ClearMessages "MyProject", "MyDesign", 0, 3

CloseAllWindows
Closes all MDI child windows on the desktop.

UI Access From main menu, Window > CloseAll.


Parameters None.
Return Value None.

Python Syntax CloseAllWindows()


Python Example oDesktop.CloseAllWindows()

VB Syntax CloseAllWindows
VB Example oDesktop.CloseAllWindows

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

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

Desktop Object Script Commands 4-11


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

Return Value None

Python Syntax CloseProject (<ProjectName>)


oDesktop.CloseProject("MyProject")
Python Example

VB Syntax CloseProject <ProjectName>


VB Example oDesktop.CloseProject "MyProject"

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

UI Access File > Close

Name Type Description


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

Return Value None

Python Syntax CloseProjectNoForce (<ProjectName>)

Desktop Object Script Commands 4-12


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

oDesktop.CloseProjectNoForce("MyProject")
Python Example

VB Syntax CloseProjectNoForce <ProjectName>


VB Example oDesktop.CloseProjectNoForce "MyProject"

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

UI Access N/A
Parameters None.
Return Value Integer

Python Syntax Count


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

VB Syntax Count
Dim oAnsoftApp
Dim oDesktop
VB Example Dim oProject
Dim oDesign
Dim oEditor

Desktop Object Script Commands 4-13


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

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

DeleteProject
Deletes a project from disk.

UI Access Edit > Delete

Parameters Name Type Description

Desktop Object Script Commands 4-14


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

<ProjectName> String Name of the project

Return Value None

Python Syntax DeleteProject (<ProjectName>)


oDesktop.DeleteProject("MyProject")
Python Example

VB Syntax DeleteProject <ProjectName>


VB Example oDesktop.DeleteProject "MyProject"

EnableAutoSave
Enable or disable autosave feature.

UI Access N/A

Name Type Description


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

Return Value None.

Python Syntax EnableAutoSave(<enable>)


oDesktop.EnableAutoSave(True)
Python Example

Desktop Object Script Commands 4-15


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

VB Syntax EnableAutoSave <enable>


VB Example oDesktop.EnableAutoSave True

ExportOptionsFiles
Copies the options config files to the DestinationDirectory.

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

Name Type Description


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

Return Value None

Python Syntax ExportOptionsFiles( <DestinationDirectory>)


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

VB Syntax ExportOptionsFiles <DestinationDirectory>


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

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

Desktop Object Script Commands 4-16


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

Note:

GetActiveProject returns normally if there are no active objects.

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

Python Syntax GetActiveProject()


oProject = oDesktop.GetActiveProject()
Python Example

VB Syntax GetActiveProject
VB Example Set oProject = oDesktop.GetActiveProject

GetAutoSaveEnabled
Checks whether the autosave feature is enabled.

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

Desktop Object Script Commands 4-17


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

l 0 – Autosave is not enabled.

Python Syntax GetAutoSaveEnabled()


Enabled = oDesktop.GetAutoSaveEnabled()
Python Example

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

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

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

Python Syntax GetBuildDateTimeString()


oDesktop.GetBuildDateTimeString()
Python Example

Desktop Object Script Commands 4-18


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

VB Syntax GetBuildDateTimeString
VB Example dnt = oDesktop.GetBuildDateTimeString

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

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

Python Syntax GetCustomMenuSet ()


oDesktop.GetCustomMenuSet()
Python Example

VB Syntax GetCustomMenuSet
VB Example Set oProject = oDesktop.GetCustomMenuSet

GetDefaultUnit
Returns the default unit for a physical quantity.

UI Access Tools > Options > General Options > Default Units. Note that this menu only displays units that can be

Desktop Object Script Commands 4-19


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

changed, while the script can be used to view additional default units.

Name Type Description


<type> String String containing a type of measurement.
Valid strings are (case insensitive):
l "Acceleration"
l "Angle"
l "AngularAcceleration"
l "AngularDamping"
l "AngularSpeed"
l "Capacitance"
l "Conductance"
Parameters
l "Current"
l "CurrentChangeRate"
l "DataRate"
l "DeltaH" (Magnetic Field Strength)
l "Density"
l "Flux"
l "Force"
l "Frequency"
l "Inductance"
l "Length"

Desktop Object Script Commands 4-20


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

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

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

Python Syntax GetDefaultUnit(<type>)


Python Example oDesktop.GetDefaultUnit("Length")

Desktop Object Script Commands 4-21


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

VB Syntax GetDefaultUnit <type>


VB Example oDesktop.GetDefaultUnit("Length")

GetDesigns
Obtains all designs in the current project.

UI Access N/A
Parameters None.
Return Value List of objects for all designs in the project.

Python Syntax GetDesigns()


oProject.GetDesigns()
Python Example

VB Syntax GetDesigns
VB Example oProject.GetDesigns

Desktop Object Script Commands 4-22


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

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

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

Python Syntax GetDesktopConfiguration()


oDesktop.GetDesktopConfiguration()
Python Example

VB Syntax GetDesktopConfiguration
VB Example Set oProject = oDesktop.GetDesktopConfiguration

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

UI Access N/A
Parameters None.
Return Value Returns a collection of names of machines used for distributed analysis.

Desktop Object Script Commands 4-23


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

Python Syntax GetDistributedAnalysisMachines()


oDesktop.GetDistributedAnalysisMachines()
Python Example

VB Syntax GetDistributedAnalysisMachines
VB Example oDesktop.GetDistributedAnalysisMachines()

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

UI Access NA

Name Type Description


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

Return Value Object; returns a collection of machine names.

Python Syntax GetDistributedAnalysisMachinesForDesignType (<designTypeName>)


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

Desktop Object Script Commands 4-24


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

VB Syntax GetDistributedAnalysisMachinesForDesignType <designTypeName>


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

GetExeDir
Returns the path where the executable is located.

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

Python Syntax GetExeDir()


Python Example oDesktop.GetExeDir()

VB Syntax GetExeDir
VB Example oDesktop.GetExeDir

Desktop Object Script Commands 4-25


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

GetGDIObjectCount

Note:
This command is for internal Ansys use only.

Python Syntax GetGDIObjectCount()


Python Example oDesktop.GetGDIObjectCount()

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

GetLibraryDirectory
Get the path to the SysLib directory.

UI Access NA

Name Type Description


Parameters
None

String
Return Value
The path to the SysLib directory.

Desktop Object Script Commands 4-26


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

Python Syntax GetLibraryDirectory()


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

VB Syntax GetLibraryDirectory
VB Example MsgBox oDesktop.GetLibraryDirectory

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

Desktop Object Script Commands 4-27


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

GetLocalizationHelper

Note:
This command is for internal Ansys use only.

Returns the object for the localization helper.

UI Access NA

Name Type Description


Parameters
None

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

Python Syntax GetLocalizationHelper()


Python Example oDesktop.GetLocalizationHelper()

VB Syntax GetLocalizationHelper
VB Example oDesktop.GetLocalizationHelper()

GetMessages
Get the messages from a specified project and design.

Desktop Object Script Commands 4-28


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

UI Access NA

Name Type Description


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

Return Value Array of string messages.

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


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

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


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

Desktop Object Script Commands 4-29


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

GetName [Desktop]
Gets names of queried projects or designs obtained by GetProjects() and GetDesigns() commands. See the example query.

UI Access N/A
Parameters N-
o-
Return Value String containing name.
n-
e-
.

Python Syntax GetName()


set projects = oDesktop.GetProjects()
Python Example
project_name = projects(0).GetName()

VB Syntax GetName()
--------------------------------------------------------------
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

VB Example ----------------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject

Desktop Object Script Commands 4-30


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

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)

GetPersonalLibDirectory
Get the path to the PersonalLib directory.

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

Python Syntax GetPersonalLibDirectory()


oDesktop.GetPersonalLibDirectory()
Python Example

Desktop Object Script Commands 4-31


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

VB Syntax GetPersonalLibDirectory
VB Example oDesktop.GetPersonalLibDirectory

GetProcessID
Returns the process ID of ansysedt.exe.

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

Python Syntax GetProcessID ()


Python Example oDesktop.GetProcessID()

VB Syntax GetProcessID
VB Example oDesktop.GetProcessID

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

Desktop Object Script Commands 4-32


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

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

Python Syntax GetProjects()


oDesktop.GetProjects()
Python Example

VB Syntax GetProjects
VB Example oDesktop.GetProjects

GetProjectDirectory
Gets the path to the Project directory.

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

Python Syntax GetProjectDirectory()


oDesktop.GetProjectDirectory()
Python Example

Desktop Object Script Commands 4-33


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

VB Syntax GetProjectDirectory
VB Example oDesktop.GetProjectDirectory

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

UI Access N/A
Parameters None.
Return Value Array of strings containing the names of all open projects in Electronics Desktop.

Python Syntax GetProjectList()


list_of_projects = oDesktop.GetProjectList()
Python Example

VB Syntax GetProjectList
VB Example list_of_projects = oDesktop.GetProjectList

Desktop Object Script Commands 4-34


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

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

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

Python Syntax GetSchematicEnvironment()


oDesktop.GetSchematicEnvironment()
Python Example

VB Syntax GetSchematicEnvironment
VB Example Set oProject = oDesktop.GetSchematicEnvironment

GetScriptingToolsHelper

Note:
This command is for internal Ansys use only.

Desktop Object Script Commands 4-35


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

Returns the object for the scripting tools helper.

UI Access NA

Name Type Description


Parameters
None

Object
Return Value
ScriptingTools helper object

Python Syntax GetScriptingToolsHelper()


Python Example oDesktop.GetScriptingToolsHelper()

VB Syntax GetScriptingToolsHelper
VB Example oDesktop.GetScriptingToolsHelper()

GetSysLibDirectory
Get the path to the SysLib directory.

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

Desktop Object Script Commands 4-36


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

Python Syntax GetSysLibDirectory()


oDesktop.GetSysLibDirectory()
Python Example

VB Syntax GetSysLibDirectory
VB Example oDesktop.GetSysLibDirectory

GetTempDirectory
Gets the path to the Temp directory.

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

Python Syntax GetTempDirectory()


oDesktop.GetTempDirectory()
Python Example

VB Syntax GetTempDirectory
VB Example oDesktop.GetTempDirectory

Desktop Object Script Commands 4-37


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

GetUserLibDirectory
Gets the path to the UserLib directory.

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

Python Syntax GetUserLibDirectory()


oDesktop.GetUserLibDirectory()
Python Example

VB Syntax GetUserLibDirectory
VB Example oDesktop.GetUserLibDirectory

GetVersion
Returns a string representing the version.

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

Desktop Object Script Commands 4-38


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

Python Syntax GetVersion()


oDesktop.GetVersion()
Python Example

VB Syntax GetVersion()
VB Example oDesktop.GetVersion

ImportANF
Imports an ANF file into a new project. For older ANFv2 files, use ImportANFv2.

UI Access File > Import > ANF.

Name Type Description


Parameters
<ANFfilename> String Full path of ANF file.

Return Value None.

Python Syntax ImportANF(<ANFfilename>)


oDesktop.RestoreWindow()
Python Example Set oTool = oDesktop.GetTool('ImportExport')
oTool.ImportANF('C:\\AnsTranslator\\results\\package4.anf')

Desktop Object Script Commands 4-39


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

VB Syntax ImportANF <ANFfilename>


Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
VB Example
Dim omachine
Dim oTool
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oTool = oDesktop.GetTool("ImportExport")
oTool.ImportANF("%UserProfile%\Documents\HFSS Examples\package.anf")

ImportAutoCAD
Imports an AutoCAD file into a new project.

UI Access File > Import > AutoCAD.

Parameters Name Type Description

Desktop Object Script Commands 4-40


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

<dxfFileName> String Full path of DXF file.


<outputPathFileName> String Full path of EDB file to create during import.
<controlFileName> String Full path of XML control file. Pass empty string if none.

Return Value None.

Python Syntax ImportAutoCAD (<dxfFileName>, <outputPathFileName>, <controlFileName>)


Set oTool = oDesktop.GetTool('ImportExport')
Python Example oTool.ImportAutoCAD('C:/MyPath/a4lines.dxf', 'C:/MyPath/a4lines.aedb.edb',
'C:/MyPath/a4lines.xml')

VB Syntax ImportAutoCAD <dxfFileName>, <outputPathFileName>, <controlFileName>


Set oTool = oDesktop.GetTool("ImportExport")
VB Example oTool.ImportAutoCAD "C:/MyPath/a4lines.dxf", "C:/MyPath/a4lines.aedb.edb",
"C:/MyPath/a4lines.xml"

ImportGDSII
Imports a GDSII file into a new project.

UI Access File > Import > GDSII.

Name Type Description


<gdsiiFileName> String Full path of GDSII file.
Parameters
<outputPathName> String Full path of EDB file to create during import.
<controlFileName> String Optional. Full path of XML control file. Pass empty string if none.

Desktop Object Script Commands 4-41


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

<propertyFileName> String Optional. Full path to property mapping file. Pass empty string if none.

Return Value None.

Python Syntax ImportGDSII(<gdsiiFileName>, <outputPathName>, <controlFileName>, <propertyFileName>)


oDesktop.RestoreWindow()
Set oTool = oDesktop.GetTool('ImportExport')
Python Example
oTool.ImportGDSII('C:/Files/test.gds', 'C:/Files/test.aedb.edb',
'C:/Files/test.xml', 'C:/Files/test.txt')

VB Syntax ImportGDSII <gdsiiFileName>, <outputPathName>, <controlFileName>, <propertyFileName>


Set oTool = oDesktop.GetTool("ImportExport")
VB Example oTool.ImportGDSII "C:/Files/test.gds", "C:/Files/test.aedb.edb", _
"C:/Files/test.xml", "C:/Files/test.txt"

ImportODB
Imports an ODB++ file into a new project.

UI Access File > Import > ODB++.

Parameters Name Type Description

Desktop Object Script Commands 4-42


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

<odbFileName> String Full path of ODB++ file.


<outputPathName> String Full path of EDB file to create during import.
<controlFileName> String Optional. Full path of XML control file. Pass empty string if none.

Return Value None.

Python Syntax ImportODB(<odbFileName>, <outputPathName>, <controlFileName>)


oDesktop.RestoreWindow()
Set oTool = oDesktop.GetTool('ImportExport')
Python Example
oTool.ImportODB('C:/Files/test.odb', 'C:/Files/test.aedb',
'C:/Files/test.xml')

VB Syntax ImportODB <odbFileName>, <outputPathName>, <controlFileName>


Set oTool = oDesktop.GetTool("ImportExport")
VB Example oTool.ImportODB "C:/Files/test.odb", "C:/Files/test.aedb", _
"C:/Files/test.xml

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> String Path to the project file to be monitored

Desktop Object Script Commands 4-43


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

Return Value None

Python Syntax LaunchJobMonitor()


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

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

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

UI Access File > New.


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

Python Syntax NewProject()


oProject = oDesktop.NewProject()
Python Example

Desktop Object Script Commands 4-44


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

VB Syntax NewProject
VB Example Set oProject = oDesktop.NewProject

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

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

Name Type Description


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

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

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

Python Syntax OpenAndConvertProject(filePath, legacyChoice)


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

Desktop Object Script Commands 4-45


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

VB Syntax OpenAndConvertProject(filePath, legacyChoice)


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

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

UI Access N/A

Name Type Description


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

Return Value None.

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


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

VB Syntax OpenAndConvertProject <filePath>, < legacyChoice>


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

Desktop Object Script Commands 4-46


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

OpenProject
Opens a specified project.

UI Access Click File > Open.

Name Type Description


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

Return Value An object reference to the newly opened project.

Python Syntax OpenProject(<FileName>)


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

VB Syntax OpenProject <FileName>


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

OpenProjectWithConversion

Note:
This command is for internal Ansys use only.

Python Syntax OpenProjectWithConversion()


Python Example oDesktop.OpenProjectWithConversion()

Desktop Object Script Commands 4-47


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

Paste (Project Object)


Pastes a design in the active project.

UI Access Edit > Paste


Parameters None
Return Value None

Python Syntax Paste()


oProject.Paste()
Python Example

VB Syntax Paste
VB Example oProject.Paste

Paste (Project Object)


Pastes a design in the active project.

UI Access Edit > Paste.


Parameters None.

Desktop Object Script Commands 4-48


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

Return Value None

Python Syntax Paste()


Python Example oProject.Paste()

VB Syntax Paste
VB Example oProject.Paste

PauseRecording
Temporarily stop script recording.

UI Access NA

Name Type Description


Parameters
None

Return Value None

Python Syntax PauseRecording()


oDesktop.PauseRecording()
Python Example

Desktop Object Script Commands 4-49


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

VB Syntax PauseRecording
VB Example oDesktop.PauseRecording

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

UI Access Tools > Pause Script

Name Type Description


Parameters
<Message> String Any Text.

Return Value None

Python Syntax PauseScript (<Message>)


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

VB Syntax PauseScript <Message>


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

Print
Prints the contents of the active view window.

Desktop Object Script Commands 4-50


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

UI Access File > Print.


Parameters None.
Return Value None.

Python Syntax Print()


oDesktop.Print()
Python Example

VB Syntax Print
VB Example oDesktop.Print

QuitApplication
Exits the desktop.

UI Access File > Exit.


Parameters None.
Return Value None.

Python Syntax QuitApplication()


oDesktop.QuitApplication()
Python Example

Desktop Object Script Commands 4-51


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

VB Syntax QuitApplication
VB Example oDesktop.QuitApplication

RefreshJobMonitor
For use in monitoring a job.

UI Access Tools > Job Management > Monitor Jobs.


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

Desktop Object Script Commands 4-52


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

Python Syntax RefreshJobMonitor()


Python Example oDesktop.RefreshJobMonitor()

VB Syntax RefreshJobMonitor
VB Example oDesktop.RefreshJobMonitor

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

UI Access N/A

Name Type Description


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

Return Value None.

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


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

VB Syntax ResetLogging <logFile>, <logLevel>

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

Desktop Object Script Commands 4-53


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

RestoreProjectArchive
Restores a previously archived project to a specified path.

UI Access File > Restore Archive.

Name Type Description


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

Return Value None.

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


Syntax

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


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

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


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

Desktop Object Script Commands 4-54


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

RestoreWindow
Restores a minimized Desktop window.

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

Python Syntax RestoreWindow()


oDesktop.RestoreWindow()
Python Example

VB Syntax RestoreWindow
VB Example oDesktop.RestoreWindow

ResumeRecording
Resume recording a script.

UI Access N/A
Parameters None.
Return Value None

Desktop Object Script Commands 4-55


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

Python Syntax ResumeRecording()


oDesktop.ResumeRecording()
Python Example

VB Syntax ResumeRecording
VB Example oDesktop.ResumeRecording

RunACTWizardScript

Note:
This command is for internal Ansys use only.

Python Syntax RunACTWizardScript()


Python Example oDesktop.RunACTWizardScript()

RunProgram
Runs an external program.

UI Access NA

Parameters Name Type Description

Desktop Object Script Commands 4-56


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

<ProgName> String Name of the program to run.


<ProgPath> String Location of the program. Pass in an empty 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 arguments, pass in None
Strings

Return Value None

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


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

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


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

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

UI Access Tools>Run Script

Parameters Name Type Description

Desktop Object Script Commands 4-57


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

<SCriptPath> String Name or full path of the script to execute.


If the full path to the script is not specified, Twin Builder searches for the
specified script in the following locations, in this order:

1. Personal library directory.

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

2. User library directory.

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

3. System library directory.

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

4. HFSS installation directory.

Long
Return Value
the return code for the script method.

Desktop Object Script Commands 4-58


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

Python Syntax RunScript (<ScriptPath>)


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

VB Syntax RunScript <ScriptPath>


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

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

UI Access NA

Name Type Description


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

Desktop Object Script Commands 4-59


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

Software installation directory


l

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

Long
Return Value
the return code for the script method.

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


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

VB Syntax RunScriptWithArguments <ScriptPath>, <Arguments>


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

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

UI Access Tools > Job Management > Select Scheduler.

Name Type Description


Parameters
<option> String One of the following options (not case sensitive):

Desktop Object Script Commands 4-60


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

l Empty string for remote RSM service


l "RSM" for local RSM
l "Windows HPC" for Windows HPC
l "LSF" for Load-Sharing Facility
l "SGE" for Grid Engine (GE, OGE, SGE, UGE, etc.)
l "PBS" for Portable Batch Scheduler/System (PBSPro, Torque, Maui,
etc.)
l"Ansys Cloud" for Ansys Cloud
<address (optional)> String String specifying the IP address or hostname of the head node or for the
remote host running the RSM service.
<username (optional)> String Username string to use for remote RSM service (or blank to use username
stored in current submission host user settings). If the (non-blank) user-
name doesn't match the username stored in current submission host user
settings, then the Select Scheduler dialog is displayed to allow for pass-
word entry prior to job submission.
<forcePasswordEntry String Boolean used to force display of the Select Scheduler GUI to allow for pass-
(optional)> word entry prior to job submission.

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

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


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

Desktop Object Script Commands 4-61


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

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


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

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

UI Access N/A

Name Type Description


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

Return Value Object, the project that is activated.

Python Syntax SetActiveProject (<ProjectName>)


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

VB Syntax SetActiveProject <ProjectName>


VB Example Set oProject = oDesktop.SetActiveProject "Project1"

Desktop Object Script Commands 4-62


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

SetActiveProjectByPath
Specifies the name of the project that should become active in the desktop. Returns that project. If a user has two projects open with
the same name, the result of SetActiveProject is ambiguous (the first one listed in selected). This command permits unam-
biguous specification of the active project.

UI Access N/A

Name Type Description


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

Return Value Object, the project that is activated.

Python Syntax SetActiveProjectByPath(<ProjectName>)


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

VB Syntax SetActiveProjectByPath <ProjectName>


VB Example Set oProject = oDesktop.SetActiveProjectByPath "c:\Projects\MyProject.aedt"

SetCustomMenuSet
Sets the custom menu set for Electronics Desktop.

Navigate to Tools > Options > General Options > General > Desktop Configuration. Select a configuration
UI Access
using the Custom Menu Set drop-down menu.

Desktop Object Script Commands 4-63


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

Name Type Description


<customMenuSet> String Name of desired menu set. Can be one of:
l 'Default'
l 'EM'
l 'RF'
Parameters l 'RF.0'
l 'SI'
l 'SI1.0'
l 'SI2.0'
l 'Twin Builder'

Return Value None

Python Syntax SetCustomMenuSet(<customMenuSet>)


oDesktop.SetCustomMenuSet('Default')
Python Example

VB Syntax SetCustomMenuSet(<customMenuSet>)
VB Example Set oProject = oDesktop.SetCustomMenuSet "EM"

Desktop Object Script Commands 4-64


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

SetDesktopConfiguration
Sets the desktop configuration.

Navigate to Tools > Options > General Options > General > Desktop Configuration. Select a configuration
UI Access
using the Set targeted configuration drop-down menu.

Name Type Description


<configName> String Name of desired Desktop configuration. Can be one of:
l 'All'

Parameters
l 'EM'
l 'RF'
l 'SI'
l 'Twin Builder'

Return Value None

Python Syntax SetDesktopConfiguration (<configName>)


oDesktop.SetDesktopConfiguration('RF')
Python Example

VB Syntax SetDesktopConfiguration(<configName>)
VB Example Set oProject = oDesktop.SetDesktopConfiguration "SI"

Desktop Object Script Commands 4-65


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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 Syntax SetLibraryDirectory (<DirectoryPath>)


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

VB Syntax SetLibraryDirectory <DirectoryPath>


VB Example oDesktop.SetLibraryDirectory"c:\libraries"

SetProjectDirectory
Sets the project directory path.

UI Access N/A

Name Type Description


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

Desktop Object Script Commands 4-66


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

Return Value None.

Python Syntax SetProjectDirectory (<DirectoryPath>)


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

VB Syntax SetProjectDirectory <DirectoryPath>


VB Example oDesktop.SetProjectDirectory "c:\projects"

SetSchematicEnvironment
Sets the schematic environment for Electronics Desktop.

Navigate to Tools > Options > General Options > General > Desktop Configuration. Select a schematic
UI Access
environment using the Custom Menu Set drop-down menu.

Name Type Description


<schEnv> Integer Desired schematic environment. Can be one of:
Parameters
l 0 (Circuit)
l 1 (Twin Builder)
l 2 (Maxwell Circuit)

Return Value None

Desktop Object Script Commands 4-67


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

Python Syntax SetSchematicEnvironment(<schEnv>)


oDesktop.SetSchematicEnvironment(1)
Python Example

VB Syntax SetSchematicEnvironment(<schEnv>)
VB Example Set oProject = oDesktop.SetSchematicEnvironment 2

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

UI Access N/A

Name Type Description


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

Return Value None.

Python Syntax SetTempDirectory (<DirectoryPath>)


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

VB Syntax SetTempDirectory <DirectoryPath>

Desktop Object Script Commands 4-68


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

VB Example oDesktop.SetTempDirectory "c:\tmp"

ShowDockingWindow
Shows or hides a docking window.

UI Access Right click docking window > Show/Hide.

Name Type Description


Parameters
<windowName> String The window name (for example, "Message Manager", "Component Libraries",
"Properties")
<show> Boolean True to show; False to hide.

Return Value None.

Python Syntax ShowDockingWindow (<windowName>, <show>)


oDesktop.ShowDockingWindow('Message Manager',False)
Python Example

VB Syntax ShowDockingWindow <windowName> <show>


VB Example oDesktop.ShowDockingWindow "Message Manager" False

Sleep
Suspends execution of HFSS for the specified number of milliseconds, up to 60,000 milliseconds (1 minute).

UI Access NA

Desktop Object Script Commands 4-69


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

Name Type Description


Parameters <TimeInMil- Integer The time that the execution should be suspended in milliseconds
liseconds>

Return Value None

Python Syntax Sleep (<TimeInMilliseconds>)


oDesktop.Sleep(1000)
Python Example

VB Syntax Sleep <TimeInMilliseconds>


VB Example oDesktop.Sleep 1000

SubmitJob
Submits a batch job to a scheduler. When submitting the same project file multiple times, you should have the script wait for each job
(or jobs for multi-step) to finish, which can be done via the monitoring functions LaunchJobMonitor() and RefreshJobMonitor(), check-
ing the result of RefreshJobMonitor() in a loop until it returns completed ("Monitor Not Visible") status.

UI Access Tools > Job Management > Submit Job.

Name Type Description


<settingsPath> String Path to the settings file (exported from the Submit Job GUI) to use for sub-
Parameters mission.
<projectPath> String Path to the project file to use in the batch job. This could be an archive (.ae-
dtz file) or an un-archived project.

Desktop Object Script Commands 4-70


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

<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 Syntax SubmitJob(<settingsPath>, <projectPath>, <design>, <setup>)


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

VB Syntax SubmitJob <settingsPath>, <projectPath>, <design>, <setup>


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

TileWindows
Arrange all open windows in a tiled format.

Desktop Object Script Commands 4-71


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

UI Access From main menu, Window >Tile Horizontally or Window >Tile Vertically.

Name Type Description


Parameters <TilingFlag> Integer l 0 – Tile vertically.

l 1 – Tile horizontally.

Return Value None.

Python Syntax TileWindows(<TilingFlag>)


Python Example oDesktop.TileWindows(0)

VB Syntax TileWindows <TilingFlag>


VB Example oDesktop.TileWindows 0

Desktop Commands For Registry Values


The Ansys Registry is stored as XML format file. By default it is located at C:\User-
s\<UserName>\Documents\Ansoft\<AnsysProductNameversion>\config\<PC_NAME>_user.XML. Most of the Ansys product con-
figuration information is stored in this XML file. These methods allow you to change the product configuration in VB or Python.
For example, to set the DSO & HPC analysis setup for HFSS using a Python script:

1. Start Maxwell.
2. Go to the DSO and HPC options and create a setup named "test".
3. Export the setup to a file (for example, c:\temp\test.acf).

Desktop Object Script Commands 4-72


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

4. Copy the exported file to a target PC (for example, f:\temp\test.acf).


5. Run the following script:

#import the setup

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

# Set Active Setup to "test"

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

See the following subtopics:


DeleteRegistryEntry
DoesRegistryValueExist
GetRegistryInt
GetRegistryString
SetRegistryFromFile
SetRegistryInt
SetRegistryString
DoesRegistryValueExist
Determines whether a registry value exists.

UI Access N/A

Name Type Description


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

Return Value Boolean:

Desktop Object Script Commands 4-73


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

l True – Key exists.


l False – Key does not exist.

Python Syn- DoesRegistryValueExist(<KeyName>)


tax

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


Example

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

GetRegistryInt
Obtains registry key integer value.

UI Access N/A

Name Type Description


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

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

Python GetRegistryInt(<KeyName>)

Desktop Object Script Commands 4-74


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

Syntax

Python num = oDesktop.GetRegistryInt('Desktop/Settings/ProjectOptions/Maxwell/Up-


Exampl- dateReportsDynamicallyOnEdits')
e

VB Syn- GetRegistryInt(<KeyName>)
tax

VB num = oDesktop.GetRegistryInt("Desktop/Settings/ProjectOptions/Maxwell/Up-
Exampl- dateReportsDynamicallyOnEdits")
e

GetRegistryString
Obtains registry key string value.

UI Access N/A

Name Type Description


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

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

Python Syntax GetRegistryString(<KeyName>)


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

Desktop Object Script Commands 4-75


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

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

SetRegistryFromFile
Configures registry by specifying an Analysis Configuration file which must have been exported from the HPC and Analysis panel.

UI Access N/A

Name Type Description


Parameters
<filePath> String Full file path of registry file.

Success if configuration is imported. Bad argument value if the file is not found or does not contain valid analysis
Return Value
configuration data.

Python Syntax SetRegistryFromFile(<filePath>)


oDesktop.SetRegistryFromFile('c:/temp/test.acf')
Python Example

VB Syntax SetRegistryFromFile <filePath>


VB Example oDesktop.SetRegistryFromFile "c:/temp/test.acf"

SetRegistryInt
Sets registry key to an integer value.

Desktop Object Script Commands 4-76


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

UI Access N/A

Name Type Description


Parameters <KeyName> String Full name of registry key, including path.
<int> Integer Integer value to be assigned to registry key.

Success if the key is defined as an integer. Bad argument value if a key is not defined, or if the value is a text
Return Value
string.

Python SetRegistryInt(<KeyName>, <int>)


Syntax

Python oDesktop.SetRegistryInt('Desktop/Settings/ProjectOptions/Maxwell/Up-
Example dateReportsDynamicallyOnEdits', 0)

VB Syn- SetRegistryInt <KeyName> <int>


tax

VB oDesktop.SetRegistryInt "Desktop/Settings/ProjectOptions/Maxwell/Up-
Example dateReportsDynamicallyOnEdits", 0

SetRegistryString
Sets registry key to a string value.

UI Access N/A

Name Type Description


Parameters <KeyName> String Full name of registry key, including path.
<value> String String value to be assigned to registry key.

Desktop Object Script Commands 4-77


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

Success if the key is defined as a text string. Bad argument value if the key is not defined or requires an integer
Return Value
value.

Python Syntax SetRegistryString(<KeyName>, <value>)


oDesktop.SetRegistryString('Desktop/ActiveDSOConfigurations/Maxwell', 'Local')
Python Example

VB Syntax SetRegistryString <KeyName>, <value>


VB Example oDesktop.SetRegistryString "Desktop/ActiveDSOConfigurations/Maxwell", "Local"

Desktop Object Script Commands 4-78


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

5 - Running Instances Manager Script Commands


The Running Instances Manager is a scripting object that lets you identify and connect to all running instances of Electronics Desktop.
oDesktop objects that are returned provide full scripting functionality. Running Instances Manager commands should be executed by
the oDesktop object. For example:
Set oRunningInstances = oDesktop.GetRunningInstancesMgr()
GetAllRunningInstances
GetRunningInstanceByProcessID
GetRunningInstanceByProject

GetAllRunningInstances
Returns a list of running instances of Ansys Electronics Desktop.

UI Access N/A
Parameters None.
Return Value Array containing list of Ansys Electronics Desktop instances.

Python Syntax GetAllRunningInstances()


Python Example obj = oRunningInstances.GetAllRunningInstances()

VB Syntax GetAllRunningInstances
VB Example set obj = oRunningInstances.GetAllRunningInstances()

Running Instances Manager Script Commands 5-1


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

GetRunningInstanceByProcessID
Returns the instance of Ansys Electronics Desktop that is running a specified process.

UI Access N/A

Name Type Description


Parameters
<processID> Integer Process ID

Return Value String of the returned instance.

Python Syntax GetRunningInstanceByProcessID(<processID>)


Python Example obj = oRunningInstances.GetRunningInstanceByProcessID(12345)

VB Syntax GetRunningInstanceByProcessID <processID>


VB Example set obj = oRunningInstances.GetRunningInstanceByProcessID(12345)

GetRunningInstancesMgr
Returns the object of the Running Instances Manager.

UI Access N/A

Name Type Description


Parameters
None

Running Instances Manager Script Commands 5-2


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

Object
Return Value
Running instances manager object

Python Syntax GetRunningInstancesMgr()


Python Example oRunningInstances = oDesktop.GetRunningInstancecMgr()

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

Running Instances Manager Script Commands 5-3


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

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

6 - Property Script Commands


Property script commands allow you to navigate through all objects and properties in a project. You can get and set all properties for
all objects in the Project tree with simple data types.
Property Object is the base class defined for all script objects that support the properties Get and Set.
GetName()

l Returns the name of the object.


GetChildTypes()

l An object may have different types of children. For example, a design may have variables, modules, and editors.
l Returns an array of text strings; may be empty if the children are not divided into different types.
GetChildNames(<type>)

l <type> – Child type name. By default, returns all children names for all types.
l Returns an array of immediate children names, belonging to a type if specified.
GetChildObject(<objPath>)

l <objPath> – A child object path; can contain multiple generations (for example, designObject/moduleObject/SetupObject).
l Returns a child property object if the object is found.
GetPropNames(<bIncludeReadOnly>)

l <bIncludeReadOnly) – Optional; defaults to true. True includes read-only properties; False excludes read-only properties.
l Returns an array of the object's property names.
GetPropValue(<propertyPath>)

Property Script Commands 6-1


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

l <propertyPath> – The property's path; may be a child object's path appended with a property name (for example, TeeModel/Off-
set/SIValue).
l Returns the property value if found. Otherwise causes script error.
SetPropValue(<propertyPath>, <data>)

l <propertyPath> – The property's path; may be a child object's path appended with a property name (for example, TeeModel/Off-
set/SIValue).
l <data> – New data; type depends on property type.
l Returns True if updated successfully; False if new data is invalid.

For a detailed summary of how Property script commands are used in a range of contexts, including Variable objects, see: Object
Script Property Function Summary. Additional examples for these commands are listed under Project Objects, Design Objects, 3D
Modeler, Optimetrics, Radiation Module and Reporter.

Note:

Older property commands should be executed by the oProject object.

Set oProject = oDesktop.SetActiveProject("Project1")

oProject.CommandName <args>

Some of the topics covered in this chapter are as follows:


Object Script Property Function Summary
Conventions Used in this Chapter
ChangeProperty
GetArrayVariables

Property Script Commands 6-2


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

GetProperties
GetPropertyValue
GetVariables
GetVariableValue
SetPropertyValue
SetVariableValue
Example Use of Record Script and Edit Properties
Additional Property Scripting Example

Object Script Property Function Summary


Object Path
The Object path can be used to navigate through objects and properties in an Ansys EM project.
l An Object path consisted of one or multiple Object-ID-Nodes separated by "/" .
l Object-ID-Node; may exist in the following forms:
l A simple object name or property name.
l Type[Name] for object; Tab[name] for property.
l Name[attr1="v1", attr2 = "v2", ...]. When more than one child object have the same name, use attributes to specify the dif-
ference.
l ArrayName[index]. For example, in an Optimetric setup with multiple calculations, "Calculation[0]" could be used to
identify the first calculation.
l Name beginning with '@' character denoted as a property name, when an object has a child and property with the same
name.

Property Script Commands 6-3


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

Property Object
The Property Object is the base class defined for all script object that support property Get & Set.
l GetName()
l Returns the name of the object.
l GetChildTypes()
l An object may have different type of children. For example, a design may have variables, modules, and editors.
l Returns array of text strings; may be empty if the children are not divided to different types.
l GetChildNames(<type>)
l <type> – children type name; default returns all children names for all types.
l Returns an array of immediate children names, belonging to the type if specified.
l GetChildObject(<objPath>)
l <objPath> – A child object path. The path may include multiple generations, such as (designOb-
ject/moduleObj/SetupObject).
l Returns a child property object if the object found.
l GetPropEvaluatedValue(<propName>)
l Return the Evaluated-Value for Value-Property and Variable.
l Return the Property-value as text string for other property types.
l GetPropSIValue(<propName>)
l Return the SI-Value for Value-Property and Variable.
l Return NAN for other property type if its value is cannot be converted to a double-floating point value.

Property Script Commands 6-4


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

l GetPropNames(<bIncludeReadOnly>);
l <bIncludeReadOnly> – optional, default to true; True will include read-only properties, False will exclude read-only prop-
erties.
l Returns an array of the object’s property names.
l GetPropValue(<propertyPath>)
l <propertyPath> – the property's full path. A property name or child object’s path appended with a property name, like
“TeeModel/Offset/SIValue”
l Returns the property value if the property is foun; otherwise causes script error.
l SetPropValue(<propertyPath>, <data>)
l <propertyPath> – the property's full path. A property name or child object’s path appended with a property name, like
“TeeModel/Offset/Value”
l <data> – new data, type is dependent on property type.
l Returns True if property data is updated successfully; False if the new data is invalid.

Project Object
Project Object inherited all functions defined in the Property Object. But it doesn't have property, GetPropValue() & SetPropValue()
function can be used to set its child object's property.
l GetChildTypes() always return [“Design”, “Variable”].
l GetChildNames(type)
GetChildNames() & GetChildName(“Design”) will return all Design names of the project.
GetChildNames(“Variable”) return all project variable names.
l GetChildObject(objPath)

oDesign = oProject("TeeModel")

oVariable = oProject.GetChildObject("VariableName")

Property Script Commands 6-5


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

oReport = oProject.GetChildObject("TeeModel/Results/S Parameter Plot 1")

l GetPropNames(bIncludeReadOnly) always return empty array since the project has no property.
l GetPropValue(propertyPath)

oProject.GetPropValue("TeeModel/offset") //get the offset variable value in the TeeModel Design


oProject.GetPropValue("TeeModel/Results/S Parameter Plot 1/Display Type") // Get the report display type.

l SetPropValue(propertyPath, newValue)

oProject.SetPropValue("TeeModel/offset", "2mm") //Set the offset variable value to "2mm" in the TeeModel Design
oProject.SetPropValue("TeeModel/Results/S Parameter Plot 1/Display Type", "Data Table) // Set the report display type to data
table.

Design Object
Design Object inherited all functions defined in the Property Object. But it doesn't have property, GetPropValue() & SetPropValue()
function can be used to set its child object's property..
l GetChildTypes() always return ['Module', 'Editor', 'Variable'].
l GetChildNames(type)
GetChildNames() will return modules & editor child names.
GetChildNames(“Variable”) will return all variable names
GetChildNames(“Module”) will return all module names that support property-object-script like ['Optimetrics', 'RadField', 'Res-
ults']
GetChildNames(“Editor”) will return a 3D editor name for all 3D Designs
l GetChildObject()
oVariable = oDesign.GetChildObject("VariableName")

Property Script Commands 6-6


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

oReport = oDesign.GetChildObject("Results/S Parameter Plot 1")


oRptModule = oDesign.GetChildObject("ReportSetup")
l GetPropNames(bIncludeReadOnly) always return empty array since the design has no property.
l GetPropValue()
oDesign GetPropValue("offset/SIValue") //get the offset variable SI value in the DesignoDesign GetPropValue("off-
set/SIValue") //get the offset variable SI value in the Design
oDesign.GetPropValue("Results/S Parameter Plot 1/Display Type") // Get the report display type
l SetPropValue()
oDesign.SetPropValue("offset", "2mm") //Set the offset variable value to "2mm" in the Design
oDesign.SetPropValue("Results/S Parameter Plot 1/Display Type", "Data Table) // Set the report display type to data table.

3D Modeler Object
GetChild commands returns the appropriate properties for modeler objects. For 3D Components and UDMs, these commands do not
return parts, coordinate systems, plans, as top-level modeler children.
oModeler = oDesktop.GetActiveProject().GetActiveDesign().GetChildObject("3D Modeler")
oModeler.GetChildNames()
oModeler.GetChildNames("ModelParts")
oModeler.GetChildNames("AllParts")
oModeler.GetChildNames("NonModelParts")
oModeler.GetChildNames("Planes")
oModeler.GetChildNames("CoordinateSystems")

Variable Object
Is a Property Object that has no child. It also provides quick function call to get/set it properties by adding functions with property name
appended to Get_ & Set_ prefix. To find what functions it provided enter dir(oVar) the command window. It can accessed by the pro-
ject or design object’s GetChildObject(VariableName) function.
oProjVar = oProject.GetChildObject(“$VarName”)
oVar = oProject.GetChildObject(“DesignName/VarName”)
oVar = oDesign.GetChildObject(“variableName”)

Property Script Commands 6-7


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

oProject..GetChildNames(“Variable”) will return all project variable names.


oDesign.GetChildNames(Variable”) will return all Design Variable names.
l GetChildTypes() always return empty array.
l GetChildNames() always return empty array , since variable has no child.
l GetChildObject(objPath) it has no child.
l GetPropNames(bIncludeReadOnly) ['EvaluatedValue', 'SIValue'] are read-only properties
l Independent variable :['Value', 'EvaluatedValue', 'SIValue', 'Description', 'ReadOnly', 'Hidden', 'Sweep', 'Optim-
ization/Included', 'Optimization/Min', 'Optimization/Max', 'Sensitivity/Included', 'Sensitivity/Min', 'Sensitivity/Max', 'Sens-
itivity/IDisp', 'Statistical', 'Statistical/Included', 'Tuning/Included', 'Tuning/Step', 'Tuning/Min', 'Tuning/Max'].
l Dependent variable ['Value', 'EvaluatedValue', 'SIValue', 'Description', 'ReadOnly', 'Hidden', 'Sweep']
l GetPropValue(propName)
oVar.GetPropValue() return the variable value as text string.
oVar.GetPropValue(“Value”) return the variable value as text string.
oVar.GetPropValue(“SIValue”) return the SI-value of variable as number.
oVar.Get_SIValue()also return the SI value.
l SetPropValue(propName, newValue)
oVar.SetPropValue(“Value", 888)
oVar.SetPropValue("Sensitivity'/Included", True)
oVar.SetPropValue("Sensitivity/Max”, '1.8pF'])
oVar.Set_Sensitivity_Max( '1.8pF') also works as last call.
oVar.SetPropValue("Sensitivity", ['Min:=', '0.8pF', 'Max:=', '1.8pF'])
//set multiple attributes at one call:
oVar.SetPropValue("@", ['Value:=',288, 'Sensitivity', ['Included', True,'Min', '0.0']])
oVar.SetPropValue("", ['Value:=',288, 'Sensitivity', ['Included', True,'Min', '0.0']])

Property Script Commands 6-8


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

Optimetrics Module Object:


Optimetrics Module Object inherited all functions defined in the Property Object. But it doesn't have property, GetPropValue() &
SetPropValue() function can be used to set its child object's property..
l GetChildTypes() there are six type of children, they are ['OptiParametric', 'OptiOptimization', 'OptiSensitivity', 'OptiStatistical',
'OptiDesignExplorer', 'OptiDXDOE']. But the return array only included those that have setup defined, so it may be an empty
array if no optimetrics setup is defined. The GetChildNames(type) function also recognized the type name without the prefix
“Opti”.
l GetChildNames(type)
GetChildNames() will return all setup for all types.
GetChildNames(“OptiOptimization”) & GetChildNames(“Optimization”) will return all Optimization setup.
l GetChildObject()
oParamSetup = oOptModule.GetChildObject('ParametricSetup1') get the
oOptSetup = oOptModule.GetChildObject('OptimizationSetup1')
l GetPropNames(bIncludeReadOnly) always return empty array since the it has no property.
l GetPropValue(propPath) may be used to get its child’s property value
oOptModule.GetPropValue("OptimizationSetup1\Optimizer") get the optimizer name for OptimizationSetup1
l SetPropValue(propPath, newValue) may be used to set its child’s property value
oOptModule.SetPropValue(ParametricSetup1\Enabled", False) //disable ParametricSetup1

Optimetrics Setup Object


This is a new Object inherited all functions defined in the Property Object. But it doesn't have child. It is accessible through its parents.
oOptSetup = oOptModule.GetChildObject('OptimizationSetup1')
oOptSetup = oDesign.GetChildObject('Optimetrics\OptimizationSetup1')
oOptSetup = oProject.GetChildObject('TeeModel\Optimetrics\OptimizationSetup1')

Property Script Commands 6-9


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

l GetChildTypes() always return empty array.


l GetChildNames(type) always return empty array
l GetChildObject()
l GetPropNames(bIncludeReadOnly) will return the property names listed in the property window when the setup is selected.
l GetPropValue(propName)
oOptSetup.GetPropValue("Optimizer") return the selected optimizer name.
oOptSetup.GetPropValue("Optimizer/Choices") return all optimizer names.
l SetPropValue(propName, newValue)
oOptSetup.SetPropValue("Optimizer", “NotAnOptimzerName”; will return false.
oOptSetup.SetPropValue("Optimizer", “Quasi Newton”; return true, since “Quasi Newton” is one of the optimizer name returned
as the Optimizer Choices.
l HasResult() return true if the setup is solved. Otherwise return false.
l Validate() return true if the setup is valid for analyze. Otherwise return false. Calling the SetPropValue() function to change the
property may invalid the setup.

ReportSetup(Results) Module Object:


ReportSetup module Object inherited all functions defined in the Property Object. But it doesn't have property, GetPropValue() &
SetPropValue() function can be used to get/set its child object's property..
l GetChildTypes() always empty array.
l GetChildNames(type)
GetChildNames() return all report names
l •GetChildObject(objPath)
oRpt = oRptModule.GetChildObject("S Parameter Plot 1") return the report property object

Property Script Commands 6-10


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

oTrace = oRptModule.GetChildObject("S Parameter Plot 1/dB(S(Port1,Port1))") return the trace property object
oAxisX = oRptModule.GetChildObject("S Parameter Plot 1/AxisX") return the axis X property object
l GetPropNames(bIncludeReadOnly) always return empty array since the it \has no property.
l GetPropValue()
oRptModule.GetPropValue(“S Parameter Plot 1/Display Type”)
l SetPropValue()
oRptModule.SetPropValue(“S Parameter Plot 1/Display Type”, “DataTable”)

ReportSetup(Results) Module Child Objects:


These are Property Objects. Its first level of child object is report. Report has trace, axis, header, Legend, and more children. Trace
has curve as child etc.
Those child objects can be accessed by calling all levels of parent object’s GetChildObject(path) function.
oRpt = oRptModule.GetChildObject(reportName)
oRpt = oDesign.GetChildObject(“Results/reportName”)
oTrace = oRpt.GetChildObject(traceName)
oTrace = oRptModule.GetChildObject(ReportName/TraceName)
l GetChildTypes() always return empty array.
l GetChildNames() get the object’s child names. What will be returned will depended on the object instance.
l GetChildObject(objPath)
l GetPropNames(bIncludeReadOnly) will return the property names listed in the property window when the object is selected.
l GetPropValue(propName)
oRpt.GetPropValue("Display Type") return the report’s display type.
oOptSetup.GetPropValue("Display Type/Choices") return all optimizer names.
oTrace.GetPropValue(“X Component”)

Property Script Commands 6-11


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

l SetPropValue(propName, newValue)
oTrace.SetPropValue(“Primary sweep”, “Freq”)

Radiation Module Object:


This inherited all functions defined in the Property Object. But it doesn't have property, GetPropValue() & SetPropValue() function can
be used to set its child object's property.
l GetChildTypes() always return empty array, now its children
l GetChildNames(type)
GetChildNames() return all setup names.
l GetChildObject(setupName) return the setup object as Property object.
oOverlay= oRadModule.GetChildObject('Antenna Parameter Overlay1')
oSphere = oRadModule.GetChildObject('Infinite Sphere1')
l GetPropNames() return empty array; it has no property.
l GetPropValue()
oRadModule.GetPropValue('Line1/Num Points') //Get the the Line1 setups’ “Num Points” property value.
l SetPropValue()
oRadModule.SetPropValue('Line1/Num Points', 100) ; Set the Line1 setups’ “Num Points” property to 100.

Radiation Module Child Objects:


These are Property Objects. It also provides quick function call to get/set its properties by adding functions with property name appen-
ded to Get_ & Set_ prefix. To find what functions it provides enter dir(oVar) the command window.
Those child objects can be access by call all levels of parent object’s GetChildObject(path) function.
oRadSetup = oRadModule.GetChildObject(setupName)
oRadSetup = oDesign.GetChildObject(RadField/setupName)

Property Script Commands 6-12


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

l GetChildTypes() always return empty array.


l GetChildNames() always return empty array , since Radiation setup has no child.
l GetChildObject(objPath) it has no child.
l GetPropNames(bIncludeReadOnly) will return the property names listed in the property window when the setup is selected.
l GetPropValue(propName)
oRadSetup.GetPropValue(”Num Points") return the line setup’s “Num Points” property value.
oRadSetup.Get_NumPoints() will also get the same value.
l SetPropValue(propName, newValue)
oRadSetup.SetPropValue('Num Points', 888)
oRadSetup.Set_NumPoints(888)

Conventions Used in this Chapter


General Definitions:

Property A single item that can be modified in the Properties window or in the modal Properties pop-up window.
The item whose properties are being modified. This is usually a compound name, giving all information needed
<PropServer>
by the editor, design, or project in order to locate the item.
<PropTab> Corresponds to one tab in the Properties window, the one under which properties are being edited.
<PropName> The name of a single property.

The following tables list specific <PropServer> and <PropTab> values for different property types.
For Project Variables:

<PropServer> "ProjectVariables"
<PropTab> "ProjectVariableTab"

For Local Variables:

<PropServer> "LocalVariables"

Property Script Commands 6-13


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

<PropTab> "LocalVariableTab"

For Passed Parameters:

<PropServer> "Instance:<Name of Circuit Instance>"


<PropTab> "PassedParameter Tab"

For Definition Parameters:

<PropServer> "DefinitionParameters"
<PropTab> "DefinitionParameters"

For Modules and Editors:

<ModuleName>:<ItemName> where <ItemName is the boundary name, solution setup name, etc.
<PropServer>
For example, "BoundarySetup:PerfE1"
Boundary Module: "HfssTab"
Mesh Operations Module: "MeshSetupTab"
Analysis Module: "HfssTab"
Optimetrics Module: "OptimetricsTab"
Solutions Module: Does not support properties.
<PropTab>
Field Overlays Module: "FieldsPostProcessorTab"
Radiation Module: "RadFieldSetupTab"
Circuit Module: "CCircuitTab"
System Module: "SystemTab"
HFSS 3D Layout Module: "HFSS 3D LayoutTab"

Property Script Commands 6-14


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

Nexxim Module: "NexximTab"


Layout elements: "BaseElementTab"
Schematic elements: "ComponentTab"
Optimetrics Module: "OptimetricsTab"

For 3D Model Editor objects:

<PropServer> Name of the object. For example, "Box1".


<PropTab> "Geometry3DAttributeTab"

For 3D Model Editor operations:

<ObjName>:<OperationName>:<int> where <int> is the operation's history index.


<PropServer>
For example, "Box2:CreateBox:2" refers to the second "CreateBox" operation in Box2's history.
<PropTab> "Geometry3DCmdTab"

For Reporter operations on Report properties:

<PropServer> <ReportSetup>
Array. For example, to set the company name in a plot header to "My Company":
Set oModule = oDesign.GetModule("ReportSetup")

<ChangeProperty> oModule.ChangeProperty Array("NAME:AllTabs",_ Array("NAME:Header",_ Array


("NAME:PropServers",_
"XY Plot1:Header"), Array("NAME:ChangedProps",_ Array("NAME:Company Name",
"Value:=", "My Company"))))

For Maxwell Modules:

<PropServer> <ModuleName>:<ItemName> where <ItemName> is the solution setup name.


<PropTab> Boundary module: "MaxwellTab"

Property Script Commands 6-15


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

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.

ChangeProperty (HFSS and Maxwell)


Use: Changes to properties are scripted using the ChangeProperty command. This command can be executed by the oEditor to
change editor properties, by the oDesign to change design level properties, and by the oProject to change project level properties. The
command can be used to create, edit, and/or remove properties. In HFSS and Maxwell, only Variable and Separator properties can be
deleted.
Use the script recording feature and edit a property, and then view the resulting script entry or use GetPropertyValue for the
desired property to see the expected format.
Command: None
Syntax: ChangeProperty Array("Name:AllTabs", <PropTabArray>, <PropTabArray>, ...)
ChangeProperty(<modulename>:<setup name>:<sweep name>)
Return Value: None
Parameters: <PropTabArray>

Property Script Commands 6-16


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

Array("Name:<PropTab>",
<PropServersArray>,
<NewPropsArray>,
<ChangedPropsArray>,
<DeletedPropsArray>)

<PropServersArray>
Array("Name:PropServers", <PropServer>,
<PropServer>, ...)

<NewPropsArray>
Array("Name:NewProps", <PropDataArray>,
<PropDataArray>,...)

<ChangedPropsArray>
Array("Name:ChangedProps",<PropDataArray>,
<PropDataArray>, ...)

<DeletedPropsArray>
Array("Name:DeletedProps", <PropName>,
<PropName>, ...)

Property Script Commands 6-17


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

<PropDataArray>
Array("NAME:<PropName>",
"PropType:=", <PropType>,
"NewName:=", <string>,
"Description:=", <string>,
"NewRowPosition:=", <int>,
"ReadOnly:=", <bool>,
"Hidden:=", <bool>,
<PropTypeSpecificArgs>)

<PropType>
Type: string
Identifies the type of property when a new property is added. In HFSS and Maxwell, only separator properties and variable prop-
erties can be added.
"SeparatorProp"
"VariableProp"
"TextProp"
"NumberProp"
"ValueProp"
"CheckboxProp"

Property Script Commands 6-18


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

"MenuProp"
"PointProp"
"VPointProp"
"V3DPointProp"
"ButtonProp"

NewName
Specify the new name of a property if the property’s name is being edited. In HFSS and Maxwell, the name can only be
changed for separators and variables.

Description
Specify a description of the property. In HFSS and Maxwell, the description can only be changed for separators and vari-
ables.

NewRowPosition
Used to reorder rows in the Property dialog box.
In HFSS, this only applies to the Project>Project Variables panel and the Hfss>DesignProperties panel.
In Maxwell, this only applies to the Project>Project Variables panel and the Maxwell3D>DesignProperties, Max-
well2D>Design Properties, or RMxprt>Design Properties panels.
Specify the new zero-based row index of the variable or separator.

ReadOnly

Property Script Commands 6-19


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

Used to mark a property as "read only" so it can not be modified. In HFSS and Maxwell, this flag can only be set for variables
and separators.

Hidden
Used to hide a property so it can not be viewed outside of the Property dialog box. In HFSS and Maxwell, this flag can only
be set for variables and separators.

<PropTypeSpecificArgs>
SeparatorProp: no arguments
TextProp: "Value:=", <string>
NumberProp: "Value:=", <double>
ValueProp: "Value:=", <value>
CheckboxProp: "Value:=", <bool>
MenuProp: "Value:=", <string>
PointProp "X:=", <double>, "Y:=", <double>
VPointProp: "X:=", <value>, "Y:=", <value>
V3DPointProp: "X:=",<value>, "Y:=",<value>, "Z:=",<value>
Material Button: "Material:=", <string>
Color Button: "R:=",<int>,"G:=",<int>,"B:=",<int>
Transparency Button: "Value:=", <double>

Property Script Commands 6-20


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

<PropTypeSpecificArgs> for VariableProps


Syntax:
"Value:=", <value>, <OptimizationFlagsArray>,
<TuningFlagsArray>, <SensitivityFlagsArray>,
<StatisticsFlagsArray>

Parameters:
<OptimizationFlagsArray>
Array("NAME:Optimization",
"Included:=", <bool>,
"Min:=", <value>,
"Max:=", <value>)

<Tuning flagsArray>
Array("NAME:Tuning",
"Included:=", <bool>,
"Step:=", <value>,
"Min:=", <value>,
"Max:=", <value>)

<SensitivityFlagsArray>

Property Script Commands 6-21


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

Array("NAME:Sensitivity",
"Included:=", <bool>,
"Min:=", <value>,
"Max:=", <value>,
"IDisp:=", <value> )

<StatisticsFlagsArray>
Array("NAME:Statistical",
"Included:=", <bool>,
"Dist:=", <Distribution>,
"StdD:=", <value>,
"Min:=", <value>,
"Max:=", <value>,
"Tol:=", <string>)

<Distribution>
Type: string
Value should be "Gaussian" or "Uniform"

StdD

Property Script Commands 6-22


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

Standard deviation.

Min
Low cut-off for the distribution.

Max
High cut-off for the distribution.

Tol
Tolerance for uniform distributions. Format is "<int>%".
Example: "20%".

VB Example: Adding a new project level variable "$width":


oProject.ChangeProperty Array("NAME:AllTabs",_
Array("NAME:ProjectVariableTab",_
Array("NAME:PropServers", "ProjectVariables"),_
Array("NAME:NewProps",_
Array("NAME:$width",_
"PropType:=", "VariableProp",_
"Value:=", "3mm",_

Property Script Commands 6-23


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

"Description:=", "my new variable"))))

VB Example: Deleting the design level variable "height":


oDesign.ChangeProperty Array("NAME:AllTabs",_
Array("NAME:LocalVariableTab",_
Array("NAME:PropServers", "DefinitionParameters"),_
Array("NAME:DeletedProps", "height"))

VB Example: Changing a property’s value. If the following command were executed, then the value
of the property "XSize" of the PropServer "Box1:CreateBox:1" on the "Geometry3DCmdTab" tab would
be changed. (oEditor is the Geometry3D editor in HFSS.)
oEditor.ChangeProperty Array("NAME:AllTabs", _
Array("NAME:Geometry3DCmdTab", _
Array("NAME:PropServers","Box1:CreateBox:1"), _
Array("NAME:ChangedProps", _
Array("NAME:XSize", "Value:=", "1.4mil"))))

Property Script Commands 6-24


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

VB Example: Changing the Company Name, Design Name, the background color, and the Axis scaling
in a Report.
Set oProject = oDesktop.SetActiveProject("wgcombiner")
Set oDesign = oProject.SetActiveDesign("HFSSDesign2")
Set oModule = oDesign.GetModule("ReportSetup")
oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:Header", _
Array("NAME:PropServers", "XY Plot1:Header"), _
Array("NAME:ChangedProps", Array("NAME:Company Name", _
"Value:=", "My Company"))))
oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:Header", _
Array("NAME:PropServers", "XY Plot1:Header"), _
Array("NAME:ChangedProps", Array("NAME:Design Name", _
"Value:=", "WG Combiner"))))
oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:General", _
Array("NAME:PropServers", "XY Plot1:General"), _
Array("NAME:ChangedProps", Array("NAME:Back Color", _
"R:=", 128, "G:=", 255, "B:=", 255))))
oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:Axis", _
Array("NAME:PropServers", "XY Plot1:AxisX"), _
Array("NAME:ChangedProps", Array("NAME:Axis Scaling", _
"Value:=", "Log"))))

Property Script Commands 6-25


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

GetArrayVariables
Returns a list of array variables. To get a list of indexed project variables, execute with oProject. To get a list of indexed local variables,
use oDesign.

UI Access N/A
Parameters None.
Return Value Array of strings containing names of variables.

Python Syntax GetArrayVariables()


oProject.GetArrayVariables()
Python Example
oDesign.GetArrayVariables()

VB Syntax GetArrayVariables
oProject.GetArrayVariables
VB Example
oDesign.GetArrayVariables

GetProperties
Gets a list of all the properties belonging to a specific <PropServer> and <PropTab>. This can be executed by the oProject, oDesign,
or oEditor variables.

Property Script Commands 6-26


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

UI Access N/A

Name Type Description


<PropTab> String One of the following, where tab titles are shown in parentheses:
l PassedParameterTab ("Parameter Values")
l DefinitionParameterTab (Parameter Defaults")
l LocalVariableTab ("Variables" or "Local Variables")
l ProjectVariableTab ("Project variables")
l ConstantsTab ("Constants")
Parameters l BaseElementTab ("Symbol" or "Footprint")
l ComponentTab ("General")
l Component("Component")
l CustomTab ("Intrinsic Variables")
l Quantities ("Quantities")
Signals ("Signals")
l

<PropServer> String An object identifier, generally returned from another script method, such as
Comp-Inst@R;2;3

Return Value Array of strings containing the names of the appropriate properties.

Python Syntax GetProperties( <PropTab>, <PropServer> )


Python Example oEditor.GetProperties('PassedParameterTab', 'k')

VB Syntax GetProperties <PropTab>, <PropServer>

Property Script Commands 6-27


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

VB Example oEditor.GetProperties "PassedParameterTab", "k"

GetPropertyValue
Returns the value of a single property belonging to a specific <PropServer> and <PropTab>. This function is available with the Project,
Design or Editor objects, including definition editors.

Tip:

Use the script recording feature and edit a property, and then view the resulting script to see the format for that property.

UI Access N/A

Name Type Description


<PropTab> String One of the following, where tab titles are shown in parentheses:
l PassedParameterTab ("Parameter Values")
l DefinitionParameterTab (Parameter Defaults")
l LocalVariableTab ("Variables" or "Local Variables")
l ProjectVariableTab ("Project variables")
Parameters l ConstantsTab ("Constants")
l BaseElementTab ("Symbol" or "Footprint")
l ComponentTab ("General")
l Component("Component")
l CustomTab ("Intrinsic Variables")
l Quantities ("Quantities")

Property Script Commands 6-28


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

Signals ("Signals")
l

<PropServer> String An object identifier, generally returned from another script method, such as
Comp-Inst@R;2;3
<PropName> String Name of the property.

Return Value String value of the property.

Python Syntax GetPropertyValue (<PropTab>, <PropServer>, <PropName>)


selectionArray = oEditor.GetSelections()
for k in selectionArray:
Python Example
val = oEditor.GetPropertyValue("PassedParameterTab", k, "R")
...

VB Syntax GetPropertyValue (<PropTab>, <PropServer>, <PropName>)


selectionArray = oEditor.GetSelections
for k in selectionArray:
VB Example
val = oEditor.GetPropertyValue("PassedParameterTab", k, "R")
...

Property Script Commands 6-29


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

GetVariables
Returns a list of all defined variables. To get a list of project variables, execute this command using oProject. To get a list of local
variables, use oDesign.

UI Access N/A
Parameters None.
Return Value Array of strings containing the variables.

Python Syntax GetVariables ()


oProject.GetVariables()
Python Example
oDesign.GetVariables()

VB Syntax GetVariables
oProject.GetVariables
VB Example
oDesign.GetVariables

GetVariableValue
Gets the value of a single specified variable. To get the value of project variables, execute this command using oProject. To get the
value of local variables, use oDesign.

Property Script Commands 6-30


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

UI Access N/A

Name Type Description


Parameters
<VarName> String Name of the variable to access.

Return Value String represents the value of the variable.

Python Syntax GetVariableValue( <VarName> )


oProject.GetVariableValue("var_name")
Python Example

VB Syntax GetVariableValue <VarName>


VB Example oProject.GetVariableValue "var_name"

SetPropertyValue
Sets the value of a single propertybelonging to a specific PropServer and PropTab. This function is available with the Project, Design
or Editor objects, including definition editors.This is not supported for properties of the following types: ButtonProp, PointProp,
V3DPointProp, and VPointProp. Only the ChangeProperty command can be used to modify these properties.
Use the script recording feature and edit a property, and then view the resulting script entry or use GetPropertyValue for the desired
property to see the expected format.

UI Access N/A

Name Type Description


Parameters <propTab> String One of the following, where tab titles are shown in parentheses:
l PassedParameterTab ("Parameter Values")

Property Script Commands 6-31


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

l DefinitionParameterTab (Parameter Defaults")

l LocalVariableTab ("Variables" or "Local Variables")

l ProjectVariableTab ("Project variables")

l ConstantsTab ("Constants")

l BaseElementTab ("Symbol" or "Footprint")

l ComponentTab ("General")

l Component("Component")

l CustomTab ("Intrinsic Variables")

l Quantities ("Quantities")

l Signals ("Signals")
<propServer> String An object identifier, generally returned from another script method, such as
Comp-Inst@R;2;3
<propName> String Name of the property.
<propValue> String The value for the property

Return Value None.

Python Syntax SetPropertyValue(<propTab>, <propServer>, <propName>, <propValue>)


Python Example oEditor.SetPropertyValue("PassedParameterTab", "k", "R", "2200")

Property Script Commands 6-32


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

VB Syntax SetPropertyValue <propTab>, <propServer>, <propName>, <propValue>


VB Example oEditor.SetPropertyValue "PassedParameterTab", "k", "R", "2200"

SetVariableValue
Sets the value of a variable. To set the value of a project variable, execute this command using oProject. To set the value of a local
variable, use oDesign.

UI Access N/A

Name Type Description


Parameters <VarName> String Variable name.
<VarValue> Value New value for the variable.

Return Value None.

Python Syntax SetVariableValue (<VarName>, <VarValue>)


Python Example oProject.SetVariableValue('$Var1', '3mm')

VB Syntax SetVariableValue <VarName>, <VarValue>


VB Example oProject.SetVariableValue "$Var1", "3mm"

Property Script Commands 6-33


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

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

7 - Design Object Script Commands


Design object commands should be executed by the oDesign object.
oDesign.CommandName <args>
For example:
Set oDesign = oProject.SetActiveDesign("MaxwellDesign1")
Conventions Used in this Chapter
<ModuleName> is a placeholder for any one of the following modules:
l Analysis Module – "AnalysisSetup"
l Boundary Module – "BoundarySetup"
l Field Overlays Module – "FieldsReporter"
l Mesh Module – "MeshSetup"
l Optimetrics Module – "Optimetrics"
l Radiation Module – "RadField"
l Reduce Matrix Module – "ReduceMatrix"
l Reporter Module – "ReportSetup"
l Simulation Setup Module – "SimSetup"
l Solutions Module – "Solutions"

AnalyzeAll (Maxwell)
AnalyzeDistributed
ApplyMeshOps
ClearLinkedData

Design Object Script Commands 7-1


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

ConfigureFluentConductivityCoupling
ConstructVariationString
Create3DDesign
DeleteFieldVariation
DeleteFullVariation
DeleteLinkedDataVariation
EditNotes
EnableHarmonicForceCalculation
ExportArrayMetadata
ExportConvergence
ExportElementBasedHarmonicForce
ExportHarmonicTransientForce
ExportMatrixData
ExportMeshStats
ExportProfile
ExportReport
GenerateMesh
GetActiveEditor
GetAllPorts
GetChildNames [Design]

Design Object Script Commands 7-2


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

GetChildObject [Design]
GetChildTypes [Design]
GetConfigurableData
GetData
GetDesignName
GetDesignType
GetDesignValidationInfo
GetGeometryMode
GetManagedFilesPath
GetModule
GetName
GetNominalVariation
GetNoteText
GetPostProcessingVariables
GetPropNames [Design]
GetPropValue [Design]
GetSelections
GetSolutionType
InitializeSystemCoupling
Is2D
Is3D

Design Object Script Commands 7-3


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

PasteDesign
Redo
RenameDesignInstance
RenameSource
RunToolkit
SetActiveEditor
SetConductivityThreshold
SetDesignSettings (Maxwell)
SetFastTransformationForLayoutComponent
SetObjectDeformation
SetObjectTemperature
SetPropValue [Design]
SetPropertyValue
SetShowLayoutForLayoutComponent
SetSolutionType (Maxwell)
Solve
StartAnalysis
StopSimLink
Undo
ValidateCircuit

Design Object Script Commands 7-4


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

ValidateDesign
ValidateLink

ApplyMeshOps
If any mesh operations were defined and not yet performed in the current variation for the specified solution setups, they will be
applied to the current mesh. If necessary, an initial mesh will be computed first. No further analysis will be performed.

Important:

This is a legacy script. Use GenerateMesh instead.

UI Access Maxwell > Analysis Setup > Generate Mesh.

Name Type Description


Parameters
<SetupNameArray> Array Array containing the string names of setups.

Integer value:
Return Value l 0 – Success
l Else – Error

Python Syntax ApplyMeshOps(<SetupNameArray>)


Python Example oDesign.ApplyMeshOps(['Setup1','Setup2'])

VB Syntax ApplyMeshOps(<SetupNameArray>)
VB Example status = oDesign.ApplyMeshOps Array("Setup1","Setup2")

Design Object Script Commands 7-5


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

Analyze
Solves a single solution setup and all of its frequency sweeps.

UI Access Right-click a solution setup in the project tree, and select Analyze.

Name Type Description


Parameters
<setup> String Setup name.

Integer value:
Return Value l 0 – Success
l Else – Error

Python Syntax Analyze (<setup>)


Python Example oDesign.Analyze("Setup1")

VB Syntax Analyze <setup>


VB Example oDesign.Analyze "Setup1"

AnalyzeAll (Maxwell menu)


Analyzes the nominal problems and all the Optimetrics problems for all the setups under the selected design.

UI Access Click Maxwell > Analyze All, or right-click a design instance in the project tree and select Analyze All.

Design Object Script Commands 7-6


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

Parameters None.
Return Value None.

Python Syntax AnalyzeAll ()


Python Example oDesign.AnalyzeAll()

VB Syntax AnalyzeAll
VB Example oDesign.AnalyzeAll

AnalyzeDistributed
Performs a distributed analysis.

UI Access N/A

Name Type Description


Parameters
<SetupName> String String name of the setup to be analyzed.

Integer value:
Return Value l 0 – Success
l Else – Error

Python Syntax AnalyzeDistributed(<SetupName>)


Python Example oDesign.AnalyzeDistributed('Setup1')

Design Object Script Commands 7-7


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

VB Syntax AnalyzeDistributed <SetupName>


VB Example oDesign.AnalyzeDistributed "Setup1"

ClearLinkedData (Design)
Clear the linked data of all the solution setups. Similar to the ClearLinkedData command for the module level.

UI Access [Product] > Analysis Setup > Clear Linked Data.


Parameters None.
Return Value None.

Python Syntax ClearLinkedData()


Python Example oDesign.ClearLinkedData()

VB Syntax ClearLinkedData
VB Example oDesign.ClearLinkedData

ConfigureFluentConductivityCoupling
Use: Configures the directory for the conductivity coupling between a Maxwell 3D magnetostatic design and Ansys Fluent.
Command: Right-click on the solution setup under Analysis in the project tree and choose Configure Fluent Conductivity Coupling.

Design Object Script Commands 7-8


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

Syntax: ConfigureFluentConductivityCoupling <SolveSetupName>, <Pathofcouplingdirectory>


Return Value: None
Parameters: <SolveSetupName>
Type: <string>
Name of the solution setup.
<PathOfCouplingDirectory>
Type: string
Path of the coupling directory.
Example:
Set oProject = oDesktop.SetActiveProject("Project18")
Set oDesign = oProject.SetActiveDesign("Maxwell3DDesign1")
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.ConfigureFluentConductivityCoupling "Setup1",
"C:\Users\test\Documents\Ansys\Maxwell\"

ConstructVariationString
Lists and orders the variables and values associated with a design variation.

UI Access N/A

Name Type Description


Parameters
<ArrayOfVariableNames> Array of Strings List of variable names.
<ArrayOfVariableValuesIncludingUnits> Array of Strings List of variable values, including units, in
the same order as the list of names.

Design Object Script Commands 7-9


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

Returns variation string with the variables ordered to correspond to the order of variables in design variations.
Return Value The values for the variables are inserted into the variation string. For an example of how Con-
structionVariationString can be used, see the Python example.

Python Syntax ConstructVariationString(<ArrayOfVariableNames>, <ArrayOfVariableValuesIncludingUnits>)


varStr = oDesign.ConstructVariationString(["xx", "yy"], ["2mm", "1mm"])
Python Example
oDesign.ExportProfile("Setup1", varStr, "C:\profile.prof")

VB Syntax ConstructVariationString <ArrayOfVariableNames>, <ArrayOfVariableValuesIncludingUnits>


VB Example oDesign.ConstructVariationString Array("x_size","y_size"), Array("2mm", "1mm")

CreateParametricCircuit

Note:
This command is for internal Ansys use only.

Python Syntax CreateParametricCircuit()


Python Example oDesign.CreateParametricCircuit()

Design Object Script Commands 7-10


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

Create3DDesign [Maxwell]
Use: Create a Maxwell 3D design from a Maxwell 2D design.
Command: Click Maxwell2D>Create 3D Design, or right-click a Maxwell 2D design instance in the project tree and select Create 3D
Design.
Syntax: Create3DDesign <DesignSettingsArray>
Return Value: None
Parameters: <DesignSettingsArray>
For a 2D design in "Cartesian, XY" geometry mode:
Array("NAME:Parameters",
"ZLength:=", <value>,
"PararmetrizeZLength:=", <bool>,
For a 2D design in "Cylindrical about Z" geometry mode:
Array("NAME:Parameters",
"SweepAngle:=", <value>,
"PararmetrizeSweepAngle:=", <bool>,
"DraftAngle:=", <value>,
"DraftType:=", <string>, (one of: "Extended", "Round", "Natural")
"NumberOfSegments:=", <integer>)
Example:
For a 2D design in "Cartesian, XY" geometry mode:

Design Object Script Commands 7-11


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

oDesign.Create3DDesign Array("NAME:Parameters", "ZLength:=", "12mm", "PararmetrizeZLength:=",


true)
For a 2D design in "Cylindrical about Z" geometry mode:
oDesign.Create3DDesign Array("NAME:Parameters", "SweepAngle:=", "120deg", "Parar-
metrizeSweepAngle:=", true, "DraftAngle:=", "30deg", "DraftType:=", "Round", "Num-
berOfSegments:=", "4")

DeleteFieldVariation
Deletes field variations, fields and meshes, or fields and meshes for specified variations.

UI Access [Solver] > Results > Clean Up Solutions > [Fields Only / Fields and Meshes].

Name Type Description


<variationKeys> Array Array containing either "All" string to select all variations, or strings of vari-
Parameters ations to include.
<deleteMesh> Boolean When true, deletes mesh data.
<deleteLinkedData> Boolean When true, deletes linked data.

Return Value None.

Python Syntax DeleteFieldVariation(<variationKeys>, <deleteMesh>, <deleteLinkedData>


oProject = oDesktop.GetActiveProject()
oDesign = oProject.GetActiveDesign()
Python Example
Design.DeleteFieldVariation(['All'], True, False)

Design Object Script Commands 7-12


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

VB Syntax DeleteFieldVariation <variationKeys>, <deleteMesh>, <deleteLinkedData>


Set oProject = oDesktop.SetActiveProject "OptimTee"
Set oDesign = oProject.SetActiveDesign "TeeModel"
VB Example
oDesign.DeleteFieldVariation Array("offset=" &
Chr(39) & "0.0947046688081817in" & Chr(39) & ""), true, false

DeleteFullVariation
Deletes either all solution data, or selected variation data.

UI Access [Maxwell] > Results > Clean Up Solutions.

Name Type Description


Parameters
<variationKeys> Array Array containing either "All" string to select all variations, or strings of vari-
ations to include.
<deleteLinkedData> Boolean When true, deletes linked data as well.

Return Value None.

Python Syntax DeleteFullVariation(<variationKeys>, <deleteLinkedData>)


Python Example oDesign.DeleteFullVariation(['All']), false)

VB Syntax DeleteFullVariation <variationKeys>, <deleteLinkedData>


VB Example oDesign.DeleteFullVariation Array('All'), false

DeleteLinkedDataVariation
Deletes the linked data of specified variations.

Design Object Script Commands 7-13


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

UI Access [Maxwell] > Results > Clean Up Solutions.

Name Type Description


Parameters <DesignVariationKeys> Array Array containing strings of the variations keys whose linked data are going
to be deleted.

Return Value None.

Python Syntax DeleteLinkedDataVariation(<DesignVariationKeys>)


Python Example oDesign.DeleteLinkedDataVariation(["current=\'0.9mA\'", "current=\'1.0mA\'"])

VB Syntax DeleteLinkedDataVariation <DesignVariationKeys>


VB Example oDesign.DeleteLinkedDataVariation Array("current=\'0.9mA\'", "current=\'1.0mA\'")

DeleteVariation
Deletes a variation.

Important:

This script is obsolete. Use DeleteFullVariation, DeleteFieldVariation, or DeleteLinkedDataVariation.

EditNotes
Updates the notes for the design.

Design Object Script Commands 7-14


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

UI Access Maxwell > Edit Notes.

Name Type Description


Parameters
<DesignNotes> String New design notes that are applied, replacing any current notes.

Return Value None.

Python Syntax EditNotes(<DesignNotes>)


Python Example oDesign.EditNotes("My design notes.")

VB Syntax EditNotes <DesignNotes>


VB Example oDesign.EditNotes "My design notes."

EnableHarmonicForceCalculation
This command sets the objects for harmonic force calculation. It is used only for Maxwell designs opened in the Ansys Workbench
environment, and therefore the commands are only available for Maxwell designs opened in Ansys Workbench.

Maxwell 3D > Enable Harmonic Force Calculation, Maxwell 2D > Enable Harmonic Force Calculation, or
UI Access
right-click a design instance in the project tree and select Enable Harmonic Force Calculation

Name Type Description


<ObjectArray> String List of object names for force calculations; for example,
Array("EnabledObjects:=", Array("Magnet", "Steel"))
Parameters <ForceType> Integer 0, ObjectBased; 1, Element Based (Surface); 2, Element
Based (Volumetric)
<NumberOfRepeatedWindows> Integer The number of repeated windows; it can also be a variable
that evaluates to an integer.

Design Object Script Commands 7-15


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

<UseNumberOfLastCycles> Boolean Use number of last cycles for force calculations


<NumberOfLastCycles> Integer Number of last cycles
<StartTime> Double The start time of data collection
<UseNumberOfCyclesForStopTime> Boolean Use number of cycles or time to define the stop time. True if
user wants to use the number of cycles for the stop time; oth-
erwise, False.
<NumberOfCyclesForStopTime> String Number of cycles after the start time to make the stop time.
<StopTime> Double Sets specific stop time. Should be greater than the
<StartTime>
<CouplingSteps> String Specify "All", "Steps from end", or "Range of steps"
<ThirdParty> String Third-party output file type. Specify "LMS", "Romax", or
"UNV"
<OutputDir> String Specify the path to the output directory for third-party files
<WindowFunctionType> String Specify "Rectangular","Tri","Van Hann", "Hamming", "Black-
man", "Lanczos", or "Welch"
<OutputFreqRangeType> String Specify “Use Range”, “Use Number”, or “Use All”
<OutputFreqRangeStop> Double Specify the output range stop frequency (with unit)
<OutputFreqRangeStart> Double Specify the output range start frequency (with unit)
<OutputFreqRangeNum> Integer Number count of frequencies. The number count starts from
the start frequency from FFT results.
<CaculateForceType> String "Harmonic Force" or "Transient Force"
<EnableInverterFeedback> Boolean Specify switching and maximum frequency to mimic
inverter-fed machine
<SwitchingFrequency> String Input, must be greater than zero
<MaximumFrequency> String Input, must be less that switching frequency

Return Value None.

Design Object Script Commands 7-16


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

EnableHarmonicForceCalculation (<ObjectArray>, <ForceType>, <NumberOfRepeatedWindows>, <UseNum-


berOfLastCycles>, <NumberOfLastCycles>, <StartTime>, <UseNumberOfCyclesForStopTime>, <Num-
Python
Syntax
berOfCyclesForStopTime>, <StopTime>, <CouplingSteps>, <ThirdParty>, <OutputDir>,
<WindowFunctionType>,<OutputFreqRangeType>, <OutputFreqRangeStop>, <OutputFreqRangeStart>, <Out-
putFreqRangeNum>, <CalculateForceType>,<EnableInverterFeedback>,<MaximumFrequency>)
Python Example 1: Sample script for setting WindowFunctionType options for a Tran-
sient design.
oDesign.EnableHarmonicForceCalculation(
[
"EnabledObjects:=", ["Cylinder1","Cylinder2","Cylinder3"],
"ForceType:=", 0,
"NumberOfRepeatedSamples:=", "1",
"UseNumberOfLastCycles:=", False,
"NumberOfLastCycles:=", 1,
Python
Example "StartTime:=", "0s",
"UseNumberOfCyclesForStopTime:=", False,
"NumberOfCyclesForStopTime:=", 1,
"StopTime:=", "0.01s",
"WindowFunctionType:=", "Rectangular",
])
Example 2: Sample script for using inverter feedback
oDesign.EnableHarmonicForceCalculation(
[

Design Object Script Commands 7-17


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

"EnabledObjects:=" , ["Cylinder1"],
"ForceType:=" , 0,
"WindowFunctionType:=" , "Rectangular",
"NumberOfRepeatedSamples:=", "1",
"UseNumberOfLastCycles:=", True,
"NumberOfLastCycles:=" , 1,
"StartTime:=" , "0s",
"UseNumberOfCyclesForStopTime:=", True,
"NumberOfCyclesForStopTime:=", 1,
"StopTime:=" , "0.01s",
"OutputFreqRangeType:=" , "Use All",
"CaculateForceType:=" , "Harmonic Force",
"EnableInverterFeedback:=", True,
"SwitchingFrequency:=" , "4000Hz",
"MaximumFrequency:=" , "8000Hz"
])
Example 3: Sample script for setting OutputFreqRangeType to "Use Range".
oDesign.EnableHarmonicForceCalculation(
[
"EnabledObjects:=" , ["Cylinder1","Cylinder2"],

Design Object Script Commands 7-18


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

"ForceType:=" , 0,
"WindowFunctionType:=" , "Rectangular",
"NumberOfRepeatedSamples:=", "1",
"UseNumberOfLastCycles:=", False,
"NumberOfLastCycles:=" , 1,
"StartTime:=" , "0s",
"UseNumberOfCyclesForStopTime:=", False,
"NumberOfCyclesForStopTime:=", 1,
"StopTime:=" , "0.01s",
"OutputFreqRangeStart:=" , "1Hz",
"OutputFreqRangeStop:=" , "3Hz",
"OutputFreqRangeType:=" , "Use Range"
])
Python Example 4: Sample script for setting OutputFreqRangeType to "Use Number".
oDesign.EnableHarmonicForceCalculation(
[
"EnabledObjects:=" , ["Cylinder1","Cylinder2"],
"ForceType:=" , 0,
"WindowFunctionType:=" , "Rectangular",
"NumberOfRepeatedSamples:=", "1",
"UseNumberOfLastCycles:=", False,

Design Object Script Commands 7-19


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

"NumberOfLastCycles:=" , 1,
"StartTime:=" , "0s",
"UseNumberOfCyclesForStopTime:=", False,
"NumberOfCyclesForStopTime:=", 1,
"StopTime:=" , "0.01s",
"OutputFreqRangeStart:=" , "1Hz",
"OutputFreqRangeNum:=" , "43",
"OutputFreqRangeType:=" , "Use Number"
])
Python Example 5: Sample script for setting OutputFreqRangeType to "Use All".
oDesign.EnableHarmonicForceCalculation(
[
"EnabledObjects:=" , ["Cylinder1","Cylinder2"],
"ForceType:=" , 0,
"WindowFunctionType:=" , "Rectangular",
"NumberOfRepeatedSamples:=", "1",
"UseNumberOfLastCycles:=", False,
"NumberOfLastCycles:=" , 1,
"StartTime:=" , "0s",
"UseNumberOfCyclesForStopTime:=", False,

Design Object Script Commands 7-20


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

"NumberOfCyclesForStopTime:=", 1,
"StopTime:=" , "0.01s",
" OutputFreqRangeType:=" , "Use All"
])
Python Example 6: Sample script for setting layout force nets and layers sets.
oDesign.EnableHarmonicForceCalculation(
[
"ForceType:=" , 0,
"WindowFunctionType:=" , "Rectangular",
"NumberOfRepeatedSamples:=", "1",
"UseNumberOfLastCycles:=", True,
"NumberOfLastCycles:=" , 1,
"StartTime:=" , "0s",
"UseNumberOfCyclesForStopTime:=", True,
"NumberOfCyclesForStopTime:=", 1,
"StopTime:=" , "0.01s",
"OutputFreqRangeType:=" , "Use All",
"CaculateForceType:=" , "Harmonic Force",
[
"NAME:NetsAndLayersChoices",
[

Design Object Script Commands 7-21


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

"NAME:LC1_1",
[
"NAME:NetLayerSetMap",
[
"NAME:net1",
"LayerSet:=" , ["Top"]
],
[
"NAME:net2",
"LayerSet:=" , ["Top"]
]
]
]
]
])
```

EnableHarmonicForceCalculation Array(<ObjectArray>, <ForceType>, <NumberOfRepeatedWindows>, <UseNum-


VB
berOfLastCycles>, <NumberOfLastCycles>, <StartTime>, <UseNumberOfCyclesForStopTime>, <Num-
Syn-
tax
berOfCyclesForStopTime>, <StopTime>, <CouplingSteps>, <ThirdParty>, <OutputDir>,
<WindowFunctionType>,<OutputFreqRangeType>, <OutputFreqRangeStop>, <OutputFreqRangeStart>, <Out-

Design Object Script Commands 7-22


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

putFreqRangeNum>, <CalculateForceType>,<EnableInverterFeedback>,<MaximumFrequency>)
VB Example 1: Sample script for setting EnableHarmonicForceCalculation options for a 2D
Transient design with element based force type.
oDesign.EnableHarmonicForceCalculation Array(
"EnabledObjects:=", Array("Rectangle1", "Rectangle2"),
"ForceType:=", 2,
"NumberOfRepeatedWindows:=", 3,
"UseNumberOfLastCycles:=", true,
"NumberOfLastCycles:=", 1,
"StartTime:=", "0s",
"UseNumberOfCyclesForStopTime:=", true,
VB
Exa- "NumberOfCyclesForStopTime:=", 1, "StopTime:=", "0.01s",
mpl-
e "WindowFunctionType:=", "Rectangular")
Example 2: Sample Workbench script for setting EnableHarmonicForceCalculation options.
SetScriptVersion(Version="16.0")
system1 = GetSystem(Name="Maxwell2DDesign3")
Ansoft.EditSystem(System=system1)
string1 = Ansoft.ExecuteGenericDesktopCommand(
System=system1,
CommandClass="WB_ACTIVATE_GIVEN_SYSTEMID",
Argument="Maxwell",
ExecuteOnlyIfSystemIsAlreadyOpenInDesktop=True)

Design Object Script Commands 7-23


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

system1.SendAnsoftCommand(PyCommand="""oDesktop.SetActiveProject(\"test_project_from_
CADFEM\").SetActiveDesign(\"Maxwell2DDesign3\").EnableHarmonicForceCalculation(
[
\"EnabledObjects:=\ ", [\"IntegLine_0\",\"IntegLine_0_1\"],
\"UseNumberOfLastCycles:=\", False,
\"NumberOfLastCycles:=\ ", 2,
\"StartTime:=\ ", \"0.002s\",
\"UseNumberOfCyclesForStopTime:=\", False,
\"NumberOfCyclesForStopTime:=\", 2,
\"StopTime:=\ ", \"0.003s\"
\"WindowFunctionType:=\ ", \"Rectangular\"
])""")

ExportConvergence
For a given variation, exports convergence data (max mag delta S, E, freq) to *.conv file.

UI Access Results > Solution Data. Select Convergence tab and click Export.

Name Type Description


<Setup> String Setup name.
Parameters
<VariationKeys> String The variation. Pass empty string for the current nominal variation.
<FilePath> String Full path to desired *.conv file location.

Design Object Script Commands 7-24


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

Return Value None.

Python Syntax ExportConvergence(<Setup>, <VariationKeys>, <FilePath> <OverwriteIfExists>)


Python Example oDesign.ExportConvergence('Setup1', 'x_size = 2mm', 'c:\convergence.conv')

VB Syntax ExportConvergence <Setup>, <VariationKeys>, <FilePath> <OverwriteIfExists>


oDesign.ExportConvergence "Setup1", "x_size
VB Example
= 2mm", "c:\convergence.conv"

ExportElementBasedHarmonicForce
Exports a element-based harmonic force data to a .csv file.

UI Access Maxwell 3D > Export Transient / Harmonic Force

Name Type Description


<outputDirectory> String The path for the output directory.
<solveSetupName> String The name of the solution setup.
<number1> ,<number2> Possible values for number1 and number2:

Parameters l When frequencyOption is 1, number1 is –1, number2 is -1


l When frequencyOption is 2, number1 is startFrequency<double>,
number2 is endFrequency<double>
l When frequencyOption is 3, number1 is number of
frequencies<int>, number2 is -1

Return Value None.

Design Object Script Commands 7-25


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

ExportElementBasedHarmonicForce(<outputDirectory>, <solveSetupName>, <fre-


Python Syntax
quencyOption>, <number1>, <number2>)

ExportElementBasedHarmonicForce("E:\\tmp", "Setup1", 1, -1, -1)


Python Example ExportElementBasedHarmonicForce("E:\\tmp", "Setup1", 2, 2.3, 10.5)
ExportElementBasedHarmonicForce("E:\\tmp", "Setup1", 3, 4, -1)

ExportElementBasedHarmonicForce <outputDirectory>, <solveSetupName>, <fre-


VB Syntax
quencyOption>, <number1>, <number2>

ExportElementBasedHarmonicForce "E:\\tmp", "Setup1", 1, -1, -1


VB Example ExportElementBasedHarmonicForce "E:\\tmp", "Setup1", 2, 2.3, 10.5
ExportElementBasedHarmonicForce "E:\\tmp", "Setup1", 3, 4, -1

ExportHarmonicTransientForce
Exports harmonic force solution data from transient designs for use by Ansys Motion and third-party software.

UI Access Maxwell 2D (or 3D)>Export Harmonic/Transient Force...

Name Type Description


<ExportType> string One of:

Parameters l UNV
l Romax
l LMS

Design Object Script Commands 7-26


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

l Ansys Motion
Ansys Mechanical
l

<Para- string The name of the parametric setup whose solution data is to be exported
metricSetupName>
<ExportDirectory> string The path for the exported files
<SolverSetupName> string The name of the design setup whose solution data is to be exported. If no solu-
tion setup is specified, all solve setups under the specified parametric setup
will be exported.
<ExportTimeOption> integer Export time steps: 0 for All steps, 1 for Steps from end, 2 for Range of steps.
<ExportBeginStep> integer Integer value for begin step, only valid for ExportTimeOption: Range of steps
<ExportEndStep> integer Integer value for end step, only valid for ExportTimeOption: Range of steps

Return Value None

Python ExportHarmonicTransientForce (<ExportType>, <ParametricSetupName>, <ExportDirectory>, <SolverSetupName>,


Syntax <ExportTimeOption>, <ExportBeginStep>, <ExportEndStep>)
Python oDesign.ExportHarmonicTransientForce("Ansys Motion", " ParametricSetup1",
Exampl- "$PROJECTDIR", "Setup1", 0, -1, -1)
e

VB Syn- ExportHarmonicTransientForce <ExportType>, <ParametricSetupName>, <ExportDirectory>, <SolverSetupName>,


tax <ExportTimeOption>, <ExportBeginStep>, <ExportEndStep>
VB oDesign.ExportHarmonicTransientForce "Ansys Motion", "ParametricSetup1",
Exampl- "$PROJECTDIR", "Setup1", 0, -1, -1
e

Design Object Script Commands 7-27


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

ExportMeshStats
Exports mesh statistics to a file.

UI Access N/A

Name Type Description


<setupName> String Name of the solution setup.
<variationString> String Name of the variation. An empty string is interpreted as the current nom-
Parameters inal variation.
<filePath> String Full file path, including extension *.ms.
<overwriteIfExists> Boolean (Optional). Defaults to True. If True, script overwrites any existing file of
the same name. If False, no overwrite.

Return Value None.

Python Syntax ExportMeshStats(<setupName>, <variationString>, <filePath>, <overwriteIfExists>)


oDesign.ExportMeshStats ("Setup1", "radius=3mm", "C:\mydir\meshstats.ms",
Python Example
True)

VB Syntax ExportMeshStats <setupName>, <variationString>, <filePath>, <overwriteIfExists>


oDesign.ExportMeshStats "Setup1", "radius=3mm", "C:\mydir\meshstats.ms",
VB Example
true

ExportProfile
Exports a solution profile to file.

Design Object Script Commands 7-28


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

UI Access N/A

Name Type Description


<SetupName> String Text of the design's notes.
Parameters
<VariationString> String Variation name. Pass empty string for the current nominal variation.
<filePath> String Full file path, including extension *.prof.

Return Value None.

Python Syntax ExportProfile(<SetupName>, <VariationString>, <filePath>, <overwriteIfExists>)


Python Example oDesign.ExportProfile('Setup1', 'radius=3mm', 'C:\Files\Profile.prof', True)

VB Syntax ExportProfile <SetupName>, <VariationString>, <filePath>, <overwriteIfExists>


VB Example oDesign.ExportProfile "Setup1", "radius=3mm", "C:\Files\Profile.prof", True

GetConfigurableData
Obtains configurable data of a specified type

Note:
This command is for internal Ansys use only.

UI Access N/A

Name Type Description


Parameters
<type> String Specified type.

Return Value None.

Design Object Script Commands 7-29


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

Python Syntax GetConfigurableData(<type>)


Python Example oDesign.GetConfigurableData("model")

VB Syntax GetConfigurableData <type>


VB Example oDesign.GetConfigurableData "model"

GetData

Note:
This command is for internal Ansys use only.

Python Syntax GetData()


Python Example oDesign.GetData()

GetDesignValidationInfo
Copies a validation cache file that is generated by oDesign.ValidateDesign() or doing design validation from UI to a file. This file con-
tains more information besides messages. It also has validation results of some validation check items.

Design Object Script Commands 7-30


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

If there is no validation cache file, a file won't be generated. This happens if GetDesignValidationInfo is executed and no Val-
idateDesign was performed.

UI Access NA

Name Type Description


Parameters
None

Integer
Return Value 0 if invalid
1 if valid

Python Syntax GetDesignValidationInfo()


oProject = oDesktop.GetActiveProject()
Python Example oDesign = oProject.GetActiveDesign()
oDesign.GetDesignValidationInfo()

GetGeometryMode
Returns the geometry mode for the design. For Maxwell 2D only.

UI Access N/A

Name Type Description


Parameters
None

Design Object Script Commands 7-31


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

String
Return Value "XY" if design is "Cartesian, XY"
"about Z" if design is "Cylindrical about Z"

Python Syntax GetGeometryMode()


oProject = oDesktop.GetActiveProject()
Python Example oDesign = oProject.GetActiveDesign()
oDesign.GetGeometryMode()

GetManagedFilesPath
Get the path to the project's results folder.

UI Access N/A
Parameters None.
Return Value String containing path where project results are located.

Python Syntax oDesign.GetManagedFilesPath()


Python Example oDesign.GetManagedFilesPath()

Design Object Script Commands 7-32


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

VB Syntax oDesign.GetManagedFilesPath
VB Example oDesign.GetManagedFilesPath

GetModule
Returns the IDispatch for the specified module.

UI Access N/A

Name Type Description


<modulename> String One of the following:
l Analysis Module – "AnalysisSetup"
l Boundary Module – "BoundarySetup"
l Field Overlays Module – "FieldsReporter"
l Mesh Module – "MeshSetup"
Parameters
l Optimetrics Module – "Optimetrics"
l Radiation Module – "RadField"
l Reduce Matrix Module – "ReduceMatrix"
l Reporter Module – "ReportSetup"
l Simulation Setup Module – "SimSetup"
l Solutions Module – "Solutions"

Return Value Module IDispatch

Python Syntax GetModule (<modulename>)

Design Object Script Commands 7-33


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

Python Example oModule = oDesign.GetModule("SimSetup")

VB Syntax GetModule <modulename>


VB Example set oModule = oDesign.GetModule "SimSetup"

GetName
Returns the name of the active design.

UI Access N/A
Parameters None.
Return Value String indicating the name of the active design.

Python Syntax GetName()


Python Example design_name = oDesign.GetName()

VB Syntax GetName
VB Example design_name = oDesign.GetName

Design Object Script Commands 7-34


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

GetNominalVariation
Returns the current nominal variation.

UI Access N/A
Parameters None.
Return Value String containing current nominal variation.

Python Syntax GetNominalVariation()


Python Example oDesign.GetNominalVariation()

VB Syntax GetNominalVariation
VB Example oDesign.GetNominalVariation

GetNoteText
Returns the text of the note attached to a design.

UI Access N/A
Parameters None.
Return Value String: text of the design note.

Design Object Script Commands 7-35


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

Python Syntax GetNoteText()


Python Example oDesign.GetNoteText()

VB Syntax GetNoteText
VB Example oDesign.GetNoteText

GetPostProcessingVariables
Returns the list of post-processing variables.

UI Access N/A
Parameters None.
Return Value Returns array containing variables.

Python Syntax GetPostProcessingVariables()


Python Example oDesign.GetPostProcessingVariables()

VB Syntax GetPostProcessingVariables
VB Example oDesign.GetPostProcessingVariables

Design Object Script Commands 7-36


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

GetSelections [Design]
This script serves no function at the Design level. See: GetSelections (Layout Editor), GetSelections (Model Editor), or Get Selections
(Schematic Editor).

GetSolutionType
Returns solution type of the design.

UI Access N/A
Parameters None.
String containing the solution type.
Return Value Possible values are: "SBR+", "HFSS [Modal | Terminal] [ Network | Composite]","Transient [Network | Com-
posite]","Eigenmode", or "Characteristic".

Python Syntax GetSolutionType()


Python Example oDesign.GetSolutionType()

VB Syntax GetSolutionType
VB Example oDesign.GetSolutionType

GetVariationVariableValue
Returns the value for a specified variation's variable.

UI Access N/A

Design Object Script Commands 7-37


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

Name Type Description


Parameters <VariationString> String The name of the design variation.
<VariableName> String The name of the variable.

Returns a double precision value in SI units, interpreted to mean the value of the variable contained in the vari-
Return Value
ation string.

Python Syntax GetVariationVariableValue(<VariationString>, <VariableName>)


oDesign.GetVariationVariableValue('x_size
Python Example
= 2mm y_size = 1mm', 'y_size')

VB Syntax GetVariationVariableValue <VariationString>, <VariableName>


varval = oDesign.GetVariationVariableValue "x_size
VB Example
= 2mm y_size = 1mm", "y_size"

InitializeSystemCoupling
Used for system coupling workflow.

Design Object Script Commands 7-38


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

Note:
This command is for internal Ansys use only.

If you have a SystemCouplingSetupn under Optimetrics and you right-click and select Generation Configuration Files, a
system coupling configuration (.sp) file and .a py file are generated automatically. The .py file contains this line oDesign.Ini-
tializeSystemCoupling("Optimetrics:SystemCouplingSetupn") and must be preserved.

Python Syntax InitializeSystemCoupling()


Python Example oDesign.InitializeSystemCoupling()

Is2D
Use: Determines whether the current design is 2D.
Command: None
Syntax: Is2D
Return Value: Boolean
True if the design is 2D.
Parameters: None
Example: oDesign.Is2D

Is3D
Use: Determines whether the current design is 3D.

Design Object Script Commands 7-39


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

Command: None
Syntax: Is3D
Return Value: Boolean
True if the design is 3D.
Parameters: None
Example: oDesign.Is3D

Redo [Design]
Reapplies the last design-level command.

UI Access Edit > Redo.


Parameters None.
Return Value None.

Python Syntax Redo()


oDesign.Redo()
Python Example

VB Syntax Redo
VB Example oDesign.Redo

Design Object Script Commands 7-40


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

RenameDesignInstance
Renames a design instance.

UI Access Right-click a design instance in the project tree, and then click Rename on the shortcut menu.

Name Type Description


Parameters
<OldName> String The current name of the design, which must be the design on which this com-
mand is invoked.
<NewName> String The new name for the design.

Return Value None.

Python Syntax RenameDesignInstance (<OldName>, <NewName>)


Python Example oDesign.RenameDesignInstance("Design1", "Design2")

VB Syntax RenameDesignInstance <OldName>, <NewName>


VB Example oDesign.RenameDesignInstance "Design1", "Design2"

ResetToTimeZero
Resets a simulation to time zero.

UI Access CleanStop when running Electronics Desktop in Batchmode.

Name Type Description


Parameters
<setupName> String Name of the simulation setup to be reset.

Design Object Script Commands 7-41


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

Return Value None.

Python Syntax ResetToTimeZero(<setupName>)


Python Example oModule.ResetToTimeZero("Setup1")

VB Syntax ResetToTimeZero <setupName>


VB Example oModule.ResetToTimeZero "Setup1"

SetActiveEditor
Sets the active editor.

UI Access N/A.

Name Type Description


Parameters
<EditorName> String Text of the design's notes.

Return Value Editor object.

Python Syntax SetActiveEditor(<EditorName>)


Python Example oDesign.SetActiveEditor('3D Modeler')

VB Syntax SetActiveEditor <EditorName>


VB Example oDesign.SetActiveEditor "3D Modeler"

Design Object Script Commands 7-42


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

SetConductivityThreshold
Use: Sets the thresholds for a perfect conductor and an insulator/conductor.
Command: Maxwell>Set Material Thresholds or right click on design instance in project tree and choose "Set Material
Thresholds"
Syntax:SetConductivityThreshold <PerfectConductorThreshold> <Insulator/ConductorThreshold>
Return Value: None
Parameters: <PerfectConductorThreshold>
Type: <double>
Perfect conductor threshold
<Insulator/ConductorThreshold>
Type: <double>
Insulator/conductor threshold
Example: oDesign.SetConductivityThreshold 1E+030, 1.00

SetDesignSettings [Maxwell]
Use: Sets design settings for the active design. Settings vary with solution type.
Command: Click Maxwell 3D > Design Settings, Maxwell 2D > Design Settings, or right-click a design instance in the project tree
and select Design Settings.
Syntax:SetDesignSettings <DesignSettingsArray>
Return Value: None.
Parameters: <DesignSettingsArray>
For 3D Transient solution type:
Array("NAME:Design Settings Data",

Design Object Script Commands 7-43


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Allow Material Override:=", <bool>,


"Perform Minimal validation:=", <bool>,
"PreservTranSolnAfterDatasetEdit:=", <bool>,
"ComputeTransientInductance:=", <bool>,
"ComputeIncrementalMatrix:=", <bool>,
"PerfectConductorThreshold:=", <real>,
"InsulatorThreshold:=", <real>,
"UseSkewModel:", <bool>,
"EnableTranTranLinkWithSimplorer:=", <bool>,
"SolveFraction:=" , <bool>, //"True" enables solve using circumferential fraction. Set to “False” by default.
"FractionNumber:=" , <int>, //Fraction number to generate the partial model. (Used when "Solve Fraction" is "True".) Set
to 1 by default.
"HalfPeriodicField:=" , <bool>, //"True" enables half-periodic field. (Used when "Solve Fraction" is "True".) Set to
“False” by default.
"HalfAxialGeometry:=" , <bool>, //"True" cuts the original geometry in half in the axial direction. (Used when "Solve Frac-
tion" is "True".) Set to “False” by default.
"Multiplier:=", <int>), //Symmetry multiplier value used when "Solve Fraction" is "False".
"SkipMeshChecks:=" , <bool>
Array("NAME:Model Validation Settings",
"EntityCheckLevel:=" , "Strict", //One of "Strict", "None", "WarningOnly", "Basic"
"IgnoreUnclassifiedObjects:=", <bool>,

Design Object Script Commands 7-44


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"SkipIntersectionChecks:=", <bool>
Example:
oDesign.SetDesignSettings(
[
"NAME:Design Settings Data",
"Allow Material Override:=", True,
"Perform Minimal validation:=", False,
"EnabledObjects:=" , [],
"PreserveTranSolnAfterDatasetEdit:=", True,
"ComputeTransientInductance:=", True,
"ComputeIncrementalMatrix:=", False,
"PerfectConductorThreshold:=", 1E+30,
"InsulatorThreshold:=" , 2500000,
"UseSkewModel:=" , False,
"EnableTranTranLinkWithSimplorer:=", False,
"SolveFraction:=" , True,
"FractionNumber:=" , "4",
"HalfPeriodicField:=" , True,
"HalfAxialGeometry:=" , True
"SkipMeshChecks:=" , False
],

Design Object Script Commands 7-45


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

[
"NAME:Model Validation Settings",
"EntityCheckLevel:=" , "Strict",
"IgnoreUnclassifiedObjects:=", True,
"SkipIntersectionChecks:=", False
])
For 3D Magnetostatic solution type:
Array("NAME:Design Settings Data",
"Allow Material Override:=", <bool>,
"ComputeIncrementalMatrix:=", <bool>,
"PerfectConductorThreshold:=", <real>,
"InsulatorThreshold:=", <real>,
"SkipMeshChecks:=" , <bool>)
For 3D Eddy Current solution type:
Array("NAME:Design Settings Data",
"Allow Material Override:=", <bool>,
"PerfectConductorThreshold:=", <real>,
"InsulatorThreshold:=", <real>,
"SymmetryMultiplier=", <real>,
"SkipMeshChecks:=" , <bool>)

Design Object Script Commands 7-46


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

For 3D Electrostatic solution type:


Array("NAME:Design Settings Data",
"Allow Material Override:=", <bool>,
"PerfectConductorThreshold:=", <real>,
"InsulatorThreshold:=", <real>,
"Multiplier:=", <int>,
"SkipMeshChecks:=" , <bool>)
For 3D DC Conduction solution type:
Array("NAME:Design Settings Data",
"Allow Material Override:=", <bool>,
"PerfectConductorThreshold:=", <real>,
"InsulatorThreshold:=", <real>,
"SkipMeshChecks:=" , <bool>)
For 3D Electric Transient solution type:
Array("NAME:Design Settings Data",
"Allow Material Override:=", <bool>,
"PreservTranSolnAfterDatasetEdit:=", <bool>,
"SkipMeshChecks:=" , <bool>)
For 3D AC Conduction solution type:
Array("NAME:Design Settings Data",
"Allow Material Override:=", <bool>,

Design Object Script Commands 7-47


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"PerfectConductorThreshold:=", <real>,
"InsulatorThreshold:=", <real>,
"SkipMeshChecks:=" , <bool>)
For 2D Transient solution type:
Array("NAME:Design Settings Data",
"PreserveTranSolnAfterDatasetEdit:=", <bool>,
"ComputeTransientInductance:=", <bool>,
"PerfectConductorThreshold:=", <real>,
"InsulatorThreshold:=", <real>,
"ModelDepth:=", <real>,
"UseSkewModel:=", <bool>,
"SkewModelType:=", <string>
//possible values are: "Continuous", "Step", "V-Shape", "User Defined"
"SkewPart:=", <string>
//possible values are: "Stator", "Rotor"
"SkewAngle:=", <real>,
//for "Continuous", "Step", "V-Shape" model types only
"SkewAngleUnit:=", <string>,
//for "User Defined" model type only; possible values are: "rad", "degsec", "degmin", "deg"
"NumberOfSlices:=", <int>,

Design Object Script Commands 7-48


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

//SkewSliceTable array below is for skew model type "User Defined" only.
Array("NAME:SkewSliceTable",
Array("NAME:OneSliceInfo", "SkewAngle:=", <real>, "SliceLength:=", <real>,
...
Array("NAME:OneSliceInfo", "SkewAngle:=", <real>, "SliceLength:=", <real>,))

"EnableTranTranLinkWithSimplorer:=", <bool>,
"BackgroundMaterialName:=", <string>
"Multiplier:=", <int>)
For 2D Magnetostatic solution type:
Array("NAME:Design Settings Data",
"PerfectConductorThreshold:=", <real>,
"InsulatorThreshold:=", <real>,
"ModelDepth:=", <real>,
"ComputeIncrementalMatrix:=", <bool>,
"BackgroundMaterialName:=", <string>)
For 2D Eddy Current, Electrostatic, DC Conduction, and AC Conduction solution types:
Array("NAME:Design Settings Data",
"PerfectConductorThreshold:=", <real>,
"InsulatorThreshold:=", <real>,
"SymmetryMultiplier:=", <int>,

Design Object Script Commands 7-49


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ModelDepth:=", <real>,
"BackgroundMaterialName:=", <string>)
For all solution types:
Array("NAME:Validation Options",
"EntityCheckLevel:=", "Strict",
//possible values are: Strict, Basic, Warning Only, None
"IgnoreUnclassifiedObjects:=", <bool>,
"SkipIntersectionChecks:=", <bool>),
"Design Validation Settings:=", "Perform full validations"
//possible values are: Perform full validations, Perform minimal validations
Example: oDesign.SetDesignSettings(
[
"NAME:Design Settings Data",
"Perform Minimal validation:=", False,
"EnabledObjects:=" , [],
"PreserveTranSolnAfterDatasetEdit:=", False,
"ComputeTransientInductance:=", False,
"ComputeIncrementalMatrix:=", False,
"PerfectConductorThreshold:=", 1E+30,
"InsulatorThreshold:=" , 1,

Design Object Script Commands 7-50


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ModelDepth:=" , "1mm",
"UseSkewModel:=" , True,
"SkewModelType:=" , 0,
"SkewAngle:=" , "6deg",
"NumberOfSlices:=" , "5",
"EnableTranTranLinkWithSimplorer:=", False,
"BackgroundMaterialName:=", "vacuum",
"Multiplier:=" , "fractions"
],
[
"NAME:Model Validation Settings",
"EntityCheckLevel:=" , "Strict",
"IgnoreUnclassifiedObjects:=", True,
"SkipIntersectionChecks:=", False
])

Python Examples: 2D Transient solution type


oDesign.SetDesignSettings(
[
"NAME:Design Settings Data",
"Perform Minimal validation:=", False,

Design Object Script Commands 7-51


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"EnabledObjects:=" , [],
"PreserveTranSolnAfterDatasetEdit:=", False,
"ComputeTransientInductance:=", False,
"ComputeIncrementalMatrix:=", False,
"PerfectConductorThreshold:=", 1E+30,
"InsulatorThreshold:=" , 1,
"ModelDepth:=" , "1meter",
"UseSkewModel:=" , True,
"SkewType:=" , "Continuous",
"SkewPart:=" , "Stator",
"SkewAngle:=" , "5deg",
"NumberOfSlices:=" , "3",
"EnableTranTranLinkWithSimplorer:=", False,
"BackgroundMaterialName:=", "vacuum",
"SolveFraction:=" , False,
"Multiplier:=" , "1"
]
oDesign.SetDesignSettings(
[

Design Object Script Commands 7-52


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"SkewType:=" , "Step",
"SkewPart:=" , "Stator",
"SkewAngle:=" , "0.6rad",
"NumberOfSlices:=" , "2",

]
oDesign.SetDesignSettings(
[

"SkewType:=" , "V-Shape",
"SkewPart:=" , "Rotor",
"SkewAngle:=" , "5deg",
"NumberOfSlices:=" , "7",

]
oDesign.SetDesignSettings(
[
..
"SkewType:=" , "User Defined",
"SkewPart:=" , "Rotor",
"SkewAngleUnit:=" , "deg",

Design Object Script Commands 7-53


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NumberOfSlices:=" , "4",
[
"NAME:SkewSliceTable",
[
"NAME:OneSliceInfo",
"SkewAngle:=" , 0.6,
"SliceLength:=" , 0.1
],
[
"NAME:OneSliceInfo",
"SkewAngle:=" , -0.9,
"SliceLength:=" , 0.2
],
[
"NAME:OneSliceInfo",
"SkewAngle:=" , 4,
"SliceLength:=" , 0.3
],
[
"NAME:OneSliceInfo",

Design Object Script Commands 7-54


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"SkewAngle:=" , 18,
"SliceLength:=" , 0.4
]
],

]
VBExamples: 2D Transient solution type
oDesign.SetDesignSettings
Array("NAME:Design Settings Data",
"Perform Minimal validation:=", false,
"EnabledObjects:=", Array(),
"PreserveTranSolnAfterDatasetEdit:=", false, "ComputeTransientInductance:=", false, "Com-
puteIncrementalMatrix:=", false,
"PerfectConductorThreshold:=", 1E+30,
"InsulatorThreshold:=", 1,
"ModelDepth:=", "1meter",
"UseSkewModel:=", true,
"SkewType:=", "Continuous",
"SkewPart:=", "Rotor",
"SkewAngle:=", "3rad",
"NumberOfSlices:=", "3",
"EnableTranTranLinkWithSimplorer:=", false, "BackgroundMaterialName:=", "vacuum",
"SolveFraction:=", false,
"Multiplier:=", "1"),
Array("NAME:Model Validation Settings",
"EntityCheckLevel:=", "Strict",
"IgnoreUnclassifiedObjects:=", false,
"SkipIntersectionChecks:=", false)

Design Object Script Commands 7-55


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oDesign.SetDesignSettings
Array(

"ModelDepth:=", "1meter",
"UseSkewModel:=", true,
"SkewType:=", "Step",
"SkewPart:=", "Stator",
"SkewAngle:=", "3rad",
"NumberOfSlices:=", "4",

)

oDesign.SetDesignSettings
Array(

"ModelDepth:=", "1meter",
"UseSkewModel:=", true,
"SkewType:=", "V-Shape",
"SkewPart:=", "Stator",
"SkewAngle:=", "3rad",
"NumberOfSlices:=", "5",

)

oDesign.SetDesignSettings
Array(

"ModelDepth:=", "1meter", "UseSkewModel:=", true,
"SkewType:=", "User Defined",
"SkewPart:=", "Rotor",

Design Object Script Commands 7-56


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"SkewAngleUnit:=", "deg",
"NumberOfSlices:=", "5",
Array("NAME:SkewSliceTable",
Array("NAME:OneSliceInfo", "SkewAngle:=", "10", "SliceLength:=", "0.3"),
Array("NAME:OneSliceInfo", "SkewAngle:=", "-2.7", "SliceLength:=", "0.2"),
Array("NAME:OneSliceInfo", "SkewAngle:=", "-1.8", "SliceLength:=", "0.25"),
Array("NAME:OneSliceInfo", "SkewAngle:=", "-0.3", "SliceLength:=", "0.15"),
Array("NAME:OneSliceInfo", "SkewAngle:=", "3", "SliceLength:=", "0.1"))

)

SetFastTransformationForLayoutComponent
Toggles whether layout components in Maxwell show outlines of objects across layers during view changes. This improves the visu-
alization performance.

UI Access Fast Transformation

Name Type Description


Parameters <Layout ComponentName> String Name of the Layout Component.
Boolean String True or False

Return Value None.

Python Syntax SetFastTransformationForLayoutComponent ("<LayoutComponentName", <boolean> )


Python Example oDesign.SetFastTransformationForLayoutComponent ("LC1_1", False)

Design Object Script Commands 7-57


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

SetObjectAttributesForLayoutComponent
Sets visualization attributes for layout components in Maxwell for a named component for layers, nets, and objects.

UI Access Object Attributes

Name Type Description


Parameters
<Layout ComponentName> String Name of the Layout Component.

Return Value None.

SetObjectAttributesForLayoutComponent (["<LayoutComponentName",[ <ObjectAttributesinNetMode>][


Python Syntax
<ObjectAttributesinLayerMode>],[ <ObjectAttributesinObjectMode>])
oDesign.SetObjectAttributesForLayoutComponent (
[
"Name:=" , "LC1_1",
"ShowDielectric:=" , False,
"DisplayMode:=" , 2,
Python Example
[
"NAME:ObjectAttributesInLayerMode",
"GND_1_L2:=" , [True,True,0],
"GND_2_L4:=" , [True,True,0],
"GND_3_L6:=" , [True,True,0],

Design Object Script Commands 7-58


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"GND_4_L9:=" , [True,True,0],
"GND_5_L11:=" , [True,True,0],
"Inner_Layer_3_L10:=" , [True,True,0],
"Top_L1:=" , [True,True,100],
"VCC1_L7:=" , [True,True,0],
"VCC2_L8:=" , [True,True,0]
],
[
"NAME:ObjectAttributesInNetMode",
"GND:=" , [True,True,29],
"VCC:=" , [True,True,0],
"neg:=" , [True,True,67],
"pos:=" , [True,True,67]
],
[
"NAME:ObjectAttributesInObjectMode",
"line_1:=" , [True,True,0],
"line_2:=" , [True,True,0],
"line_3:=" , [True,True,100],
"line_4:=" , [True,True,100],
"rect_6:=" , [True,True,0],

Design Object Script Commands 7-59


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"rect_17:=" , [True,True,0],
"rect_18:=" , [True,True,0],
"rect_19:=" , [True,True,0],
"rect_20:=" , [True,True,0],
"rect_21:=" , [True,True,0],
"rect_22:=" , [True,True,0],
"line_24:=" , [True,True,100],
"via_0:=" , [True,True,100],
"via_1:=" , [True,True,100],
"via_2:=" , [True,True,100],
"via_3:=" , [True,True,100]
]
])

SetObjectDeformation
Sets the deformation of objects when calling Ansys Electronics Desktop from Ansys Workbench.
For Maxwell magnetostatic, transient, electrostatic, and eddy current designs, sets the deformation of objects when calling Ansys Elec-
tronics Desktop from Ansys Workbench. (Can also be used for setting deformation of objects in Maxwell 2D/3D magnetostatic and
transient standalone designs.)

UI Access N/A

Design Object Script Commands 7-60


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


<ObjectArray> Array Array containing the following parameters:
l "EnabledStressObjectsName:= "The names of objects that are
enabled for deformation.

l Optionally, for Maxwell 2D magnetostatic and transient


designs:

" Enabled2DXYStress<double array>:=" Every 3 numbers are a


group of initial stress data (real with unit) for one object in the
EnabledStressObjectsName list. (Applies only to 2D mag-
Parameters netostatic and transient XY designs.)

" Enabled2DRZStress<double array>:=" Every 3 numbers are a


group of initial stress data (real with unit) for one object in the
EnabledStressObjectsName list. (Applies only to 2D mag-
netostatic and transient RZ designs.)

l Optionally, for Maxwell 3D magnetostatic and transient


designs:

"Enabled3DStress<double array>:=" Every 6 real numbers with


unit are a group of initial stress data for one object in the
EnabledStressObjectsName list.

Return Value None.

Python SetObjectDeformation(<ObjectArray>)
Syntax

Design Object Script Commands 7-61


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python oDesign.SetObjectDeformation(["EnabledStressObjectsName:=" , ["Cylinder1",


Example "Sphere1"]])

For Maxwell 3D Magnetostatic and Transient designs with initial stress

Python Syntax SetObjectDeformation(<ObjectArray>)


oDesign.SetObjectDeformation(
["EnabledStressObjectsName:=" , ["Cylinder1", "Sphere1"],
"Enabled3DStressXXObjects:=", ["12.35psi","30.64psi"],
"Enabled3DStressYYObjects:=", ["5.72psi","16.93psi"],
"Enabled3DStressZZObjects:=", ["14.75psi","12.22psi"],
Python Example
"Enabled3DStressXYObjects:=", ["64.3psi","28.13psi"],
"Enabled3DStressYZObjects:=", ["19.43psi","58.67psi"],
"Enabled3DStressXZObjects:=", ["27.63psi","40.31psi"]
])

For Maxwell 2D Magnetostatic and Transient XY designs with initial stress

Python Syntax SetObjectDeformation(<ObjectArray>)


oDesign.SetObjectDeformation(
["EnabledStressObjectsName:=" , ["Cylinder1", "Sphere1"],
Python Example
"Enabled2DXYStressXXObjects:=", ["12.35psi","30.64psi"],
"Enabled2DXYStressYYObjects:=", ["5.72psi","16.93psi"],

Design Object Script Commands 7-62


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Enabled2DXYStressXYObjects:=", ["64.3psi","28.13psi"],
])

For Maxwell 2D Magnetostatic and Transient RZ designs with initial stress

Python Syntax SetObjectDeformation(<ObjectArray>)


oDesign.SetObjectDeformation(
["EnabledStressObjectsName:=" , ["Cylinder1", "Sphere1"],
"Enabled2DRZStressRRObjects:=", ["12.35psi","30.64psi"],
Python Example "Enabled2DRZStressZZObjects:=", ["5.72psi","16.93psi"],
"Enabled2DRZStressRZObjects:=", ["64.3psi","28.13psi"],
])

VB Syn- SetObjectDeformation <ObjectArray>


tax

VB oDesign.SetObjectDeformation Array("EnabledStressObjectsName:=" , Array("Cylinder1",


Example "Sphere1"))

SetObjectTemperature
Sets the temperature of objects.

UI Access Maxwell > Set Object Temperature

Name Type Description


Parameters
<TemperatureSettings> Array ["NAME": <SettingName>,

Design Object Script Commands 7-63


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"IncludeTemperatureDependence:=", <boolean, True


to include temperature dependence. False to not
include.>,
"EnableFeedback:=", <boolean, True to enable feed-
back. False to not enable feedback.>,
"Temperatures:=", <Temperatures>]
<Temperatures> Array Objects and temperatures.

Return Value None.

Python Syntax oDesign.SetObjectTemperature(<TemperatureSettings>)


oDesign.SetObjectTemperature(
[
"NAME:TemperatureSettings",
Python Example "IncludeTemperatureDependence:=", True,
"EnableFeedback:=" , False,
"Temperatures:=" , ["RegularPolyhedron1","22cel","Polygon1","22cel"
])

VB Syn- oDesign.SetObjectTemperature <TemperatureSettings>


tax

Design Object Script Commands 7-64


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oDesign.SetObjectTemperature Array(

VB "NAME:TemperatureSettings", "IncludeTemperatureDependence:=", _
Example true, "EnableFeedback:=", true, "Temperatures:=", Array("RegularPolyhedron1", _
"22cel", "Polygon1", "22cel"))

SetShowAllLayoutComponents
This command will show/hide all layout components in a Maxwell design.

UI Access Edit Layout... View > Visibility > Show All or Hide All

Name Type Description


Parameters
Boolean String True or False

Return Value None

Python Syntax SetShowAllLayoutComponents ( <boolean> )


oDesign = oProject.GetActiveDesign()
Python Example
oDesign.SetShowAllComponentLayouts(True)

SetShowLayoutForLayoutComponent
Layout visualization, rather than bounding box, for a Layout Component in a Maxwell design.

UI Access Edit Layout...

Design Object Script Commands 7-65


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


Parameters <Layout ComponentName> String Name of the Layout Component.
Boolean String True or False

Return Value None.

Python Syntax SetShowLayoutForLayoutComponent ("<LayoutComponentName", <boolean> )


Python Example oDesign.SetShowLayoutForLayoutComponent ("LC1_1", True)

SetSolutionType (Maxwell)
Use: Sets the solution type for the design.
Command: Click Maxwell3D>Solution Type, Maxwell2D>Solution Type, or right-click a design instance in the project tree and
select Solution Type.
Syntax:SetSolutionType <SolutionType>, <GeomMode>
Return Value: None
Parameters: <SolutionType>
Type: <string>
Possible values for 3D designs are: "Magnetostatic", "EddyCurrent", "Transient", "Elec-
trostatic", "DCConduction", "ElectroDCConduction", "ElectricTransient"
Possible values for 2D designs are: "Magnetostatic", "EddyCurrent", "Transient", "Elec-
trostatic", "DCConduction", "ACConduction"
<GeomMode>

Design Object Script Commands 7-66


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Type: <string>
Possible values for 2D geometry mode: "XY", "about Z"
Example: oDesign.SetSolutionType "ElectroDCConduction" oDesign.SetSolutionType "Electrostatic",
"XY" oDesign.SetSolutionType "EddyCurrent", "about Z"

Solve
Performs one or more simulation. The next script command will not be executed until the simulation(s) are complete.

UI Access Select solution setup(s). Right-click and select Analyze.

Name Type Description


Parameters
<SimulationNames> Array Array containing string simulation names.

Integer:
l 0 – Simulation(s) completed.
Return Value
l 1 – Simulation error.
l -1 – Command execution error.

Python Syntax Solve <SimulationNames>


Python Example oDesign.Solve(['Setup1','Setup2','Setup3'])

VB Syntax Solve <SimulationNames>


VB Example oDesign.Solve Array("Setup1", "Setup2", "Setup3")

StopSimLink
Stops linked simulation.

Design Object Script Commands 7-67


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access N/A

Name Type Description


<simId> Integer ID of specified simulation.
Parameters <abort> Boolean Whether to stop the running simulation:
l True - abort the running simulation.
l False - do not abort running simulation.

Return Value None.

Python Syntax StopSimLink(<simId>, <abort>)


Python Example oDesign.StopSimLink(18, True)

VB Syntax StopSimLink <simId>, <abort>


VB Example oDesign.StopSimLink 18, true

RunToolkit
Runs a Python toolkit script, applying it to the active design. The toolkit script itself may have prerequisites, such as sweeps defined, or
specific model characteristics, such as port definitions.

Design Object Script Commands 7-68


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Important:

Full scripting for cable modeling is not supported and no arguments are allowed in the script. The RunToolkit command
will not automatically create a cable bundle, but will simply open the Cable Modeling dialog box. You will have to manually
input your parameters.

UI Access [Maxwell] > Toolkit > [Script Name].

Name Type Description


<LibraryType> String Name of the library in which the script is located.
Parameters
<ToolkitName> String Name of the Python script.
<ToolkitArg> Array Structured array containing arguments required by the toolkit script.

Return Value User-defined solution(s) and/or output(s).

Python Syntax RunToolkit(<LibraryType>, <ToolkitName>, <ToolkitArg>)


oDesign.RunToolkit("SysLib", "Cable Modeling/Automotive Cable Bundle",
[])
Python Example
oDesign.RunToolkit("SysLib", "Cable Modeling/Oil-Gas Cable Bundle",
[])

VB Syntax RunToolkit <LibraryType>, <ToolkitName>, <ToolkitArg>


oDesign.RunToolkit "SysLib", "Cable Modeling/Automotive Cable Bundle", Array()
VB Example oDesign.RunToolkit "SysLib", "Cable Modeling/Oil-Gas Cable Bundle",
Array()

Design Object Script Commands 7-69


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Undo [Design]
Cancels the last design-level command.

UI Access Edit > Undo


Parameters None.
Return Value None.

Python Syntax Undo()


Python Example oDesign.Undo()

VB Syntax Undo
VB Example oDesign.Undo

ValidateDesign
Returns whether a design is valid.

UI Access Maxwell > Validation Check.


Parameters None.
Integer:
Return Value
l 1 – Validation passed.

Design Object Script Commands 7-70


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

l 0 – Validation failed.

Python Syntax ValidateDesign()


Python Example oDesign.ValidateDesign()

VB Syntax ValidateDesign
VB Example oDesign.ValidateDesign

ValidateLink

Note:
This command is for internal Ansys use only.

Python Syntax ValidateLink()


Python Example oDesign.ValidateLink()

Design Object Script Commands 7-71


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

7-72
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

8 - 3D Modeler Editor Script Commands


3D Modeler commands should be executed by the "3D Modeler" editor:
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.<CommandName>

Conventions Used in this Chapter:


<AttributesArray>
<AttributesArray> takes the following structure:
Array("NAME:Attributes",
"Name:=", <string>,
"Flags:=", <string>,
"Color:=", <string>,
"Transparency:=", <value>,
"PartCoordinateSystem:=", <string>,
"UDMId:=", <string>,
"MaterialValue:=", <string>,
"SurfaceMaterialValue:=", <string>,
"Solveinside:=", <boolean>,
"ShellElement:=", <boolean>,
"ShellElementThickness:=", <string>,
"IsMaterialEditable:=", <boolean>,

3D Modeler Editor Script Commands 8-1


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"UseMaterialAppearance:=", <boolean>,
"IsLightweight:=", <boolean>)
Where:
l Flags – Takes a string containing "NonModel" and/or "Wireframe", separated by the # character. For example,
"NonModel#Wireframe".
l Color – Takes a string containing an RGB triple, formatted as "(<RGB>)". For example, "(255 255 255)".
l Transparency – Takes a value between 0 and 1.
l PartCoordinateSystem – Orientation of the primitive. The name of one of the defined coordinate systems should be specified.
l UDMId – Takes a string containing an ID.
l MaterialValue – Takes a string of the material name.
l SurfaceMaterialValue – Takes a string of the surface material name.
l Solveinside – Takes a boolean value.
l ShellElement – Takes a boolean value specifying whether or not a shell element is present.
l ShellElementThickness – Takes a string containing the shell element thickness. If element is not present, pass empty string.
l IsMaterialEditable – Takes a boolean value.
l IsLightweight – Takes a boolean value.

<SelectionsArray>
<SelectionsArray> typically takes the following structure:
Array("NAME:Selections",
"Selections:=", <string>)
Where:

3D Modeler Editor Script Commands 8-2


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

l Selections – Takes a comma-separated list of parts on which to perform the action. For example, "Rect1, Rect2, Rect3".

In some cases, <SelectionsArray> takes additional parameters:


Array("NAME:Selections",
"AllowRegionDependentPartSelectionForPMLCreation:=", <boolean>,
"AllowRegionSelectionForPMLCreation:=", <boolean>,
"Selections:=", <string>,
"NewPartsModelFlag:=" , <string>,
"UseCurrentCS:=", <boolean>)
Where:
l AllowRegionDependentPartSelectionForPMLCreation – Takes a boolean value. See individual script for whether this para-
meter is required.
l AllowRegionSelectionForPMLCreation – Takes a boolean value. See individual script for whether this parameter is required.
l Selections – Takes a comma-separated list of parts on which to perform the action. For example, "Rect1, Rect2, Rect3".
l NewPartsModelFlag – Takes either string "Model" or string "Nonmodel". See individual script for whether this parameter is
required.
l UseCurrentCS – Takes a boolean value. See individual script for whether this parameter is required. Use GetAct-
iveCoordinateSystem to determine the current CS.

Note:

Selections is the only parameter required in all 3D Modeler Editor scripts. See individual scripts for additional required para-
meters.

Organization

3D Modeler Editor Script Commands 8-3


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

3D Modeler editor scripts are organized into the following categories:


Draw Menu Commands
Edit Menu Commands
Modeler Menu Commands
Cable Modeling Commands
Other oEditor Commands

Draw Menu Commands


Create3DComponent
CreateBondwire
CreateBox
CreateCircle
CreateCone
CreateCutplane
CreateCylinder
CreateEllipse
CreateEquationCurve
CreateEquationSurface
CreateHelix
CreatePoint
CreatePolyline

3D Modeler Editor Script Commands 8-4


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

CreateRectangle
CreateRegion
CreateRegularPolygon
CreateRegularPolyhedron
CreateSphere
CreateSpiral
CreateSubregion
CreateTorus
CreateUserDefinedModel
CreateUserDefinedPart
Edit3DComponent
EditPolyline
Get3DComponentDefinitionNames
Get3DComponentInstanceNames
Get3DComponentMaterialNames
Get3DComponentMaterialProperties
Get3DComponentParameters
Insert3DComponent
InsertPolylineSegment
SweepAlongPath
SweepAlongVector

3D Modeler Editor Script Commands 8-5


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

SweepAroundAxis
SweepFacesAlongNormal
SweepFacesAlongNormalWithAttributes
UpdateComponentDefinition
Create3DComponent
Create a 3D component.

UI Access Draw>3D Component Library>Create 3D Component

Name Type Description


<NAME> string CreateData
<ComponentName> string The name of the component
<Company> string Company name
<Company URL> string Company website address
<Model Number> string Component model designation
<Help URL> string Help link address
<Version> string Component version
<Notes> string Notes about the component
Parameters
<IconType> string
<Owner> string Owner name
<Email> string Email address
<Date> string Component creation date
<HasLabel> bool
<IsEncrypted> bool Is the component encrypted?
<AllowEdit> bool Permit component to be edited?
<SecurityMessage> string Security information
<Password> string Enter password

3D Modeler Editor Script Commands 8-6


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<EditPassword> string
<PasswordType> string
<HideContents> bool Hide selected contents?
<ReplaceNames> bool Allow replacement of object and material names?
<ComponentOutline> string "None" or "Bounding Box"
<IncludedParts> list Array of included parts
<HiddenParts> list Array of hidden parts
<IncludedCS> list Array of included coordinate system(s)
<ReferenceCS> string Reference coordinate system
<IncludedParameters> list Array of included parameters
<ParameterDescription> list Array of parameter descriptions
<IsLicensed> bool Is the component licensed?
<LicensingDllName> string License name
<Ven- string Vendor component Identifier
dorComponentIdentifier>
<PublicKeyFile> string Public Key filename - including path to the key
<NAME> string
<Excitations> list Array of excitations
<Filename> string Path and name of component being saved.
<NAME> string
<ImageFile> string

Return Value None

Python Syntax Create3DComponent (ComponentParameters)


oEditor.Create3DComponent(
[
Python Example

3D Modeler Editor Script Commands 8-7


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NAME:CreateData",
"ComponentName:=" , "CoilWindingsNew",
"Company:=" , "",
"Company URL:=" , "",
"Model Number:=" , "",
"Help URL:=" , "",
"Version:=" , "1.0",
"Notes:=" , "",
"IconType:=" , "",
"Owner:=" , "J Doe",
"Email:=" , "jdoe@",
"Date:=" , "4:40:58 PM Oct 14, 2019",
"HasLabel:=" , False,
"IsEncrypted:=" , False,
"AllowEdit:=" , False,
"SecurityMessage:=" , "",
"Password:=" , "",
"EditPassword:=" , "",
"PasswordType:=" , "UnknownPassword",
"HideContents:=" , True,
"ReplaceNames:=" , True,
"ComponentOutline:=" , "None",
"IncludedParts:=" , ["Coil_1st_Section1",
"Coil_2nd_Section1"],
"HiddenParts:=" , [],
"IncludedCS:=" , [],
"ReferenceCS:=" , "Global",
"IncludedParameters:=" , ["nCond","wCurrent","wPhase"],
"ParameterDescription:=", ["nCond:=", "", "wCurrent:=", "",
"wPhase:=", ""],
"IsLicensed:=" , False,
"LicensingDllName:=" , "",
"VendorComponentIdentifier:=", "",
"PublicKeyFile:=", ""

3D Modeler Editor Script Commands 8-8


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Excitations:=" , ["CoilTerminal1","CoilTerminal2",
"Winding1","Winding2"]
], "C:/work/3DComponents/CoilWindingsNew.a3dcomp",
[
"NAME:ImageFile",
"ImageFile:=" , ""
])

VB Create3DComponent (ComponentParameters)
Syn-
tax

oEditor.Create3DComponent Array("NAME:CreateData", "ComponentName:=", "CoilWindings",


"Company:=", _
"", "Company URL:=", "", "Model Number:=", "", "Help URL:=", "", "Version:=", _
"1.0", "Notes:=", "", "IconType:=", "", "Owner:=", "J Doe", "Email:=", "jdoe@", "Date:=",
_
"4:33:50 PM Oct 14, 2019", "HasLabel:=", false, "IsEncrypted:=", false, "AllowEdit:=",
_
VB
false, "SecurityMessage:=", "", "Password:=", "", "EditPassword:=", "", "PasswordType:=",
Exa-
_
mple
"UnknownPassword", "HideContents:=", true, "ReplaceNames:=", true, "ComponentOutline:=",
_
"None", "IncludedParts:=", Array("Coil_1st_Section1", "Coil_2nd_Section1"), "Hid-
denParts:=", Array(), "IncludedCS:=", Array(), "ReferenceCS:=", _
"Global", "IncludedParameters:=", Array("nCond", "wCurrent", "wPhase"), "Para-
meterDescription:=", Array("nCond:=", _
"", "wCurrent:=", "", "wPhase:=", ""), "IsLicensed:=", false, "LicensingDllName:=", _

3D Modeler Editor Script Commands 8-9


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"", "VendorComponentIdentifier:=", "", "PublicKeyFile:=", ""), Array("NAME:DesignData",


"Excitations:=", Array( _
"CoilTerminal1", "CoilTerminal2", "Winding1", "Winding2")), _
"C:/work/3Dcomponents/CoilWindings.a3dcomp,Array("NAME:ImageFile", "ImageFile:=", "")

CreateBondwire
Creates a bondwire.

UI Access Draw > Bondwire.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:BondwireParameters",
"WireType:=", <string("JEDEC_4Points", "JEDEC_
5Points", or "LOW")>,
"WireDiameter:=", <string>,
"NumSides:=", <value>,
Parameters
"XPadPos:=", <value>,
"YPadPos:=", <value>,
"ZPadPos:=", <value>,
"XDir:=", <value>,
"YDir:=", <value>,
"ZDir:=", <value>,

3D Modeler Editor Script Commands 8-10


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Distance:=", <value>,
"h1:=", <value>,
"h2:=", <value>,
"alpha:=", <value>,
"beta:=", <value>,
"WhichAxis:=", <string("X","Y", or "Z")>,
"ReverseDirection:=", <boolean>)
<AttributesArray> Array Structured array. See: AttributesArray.

Return Value None.

Python Syntax CreateBondwire(<Parameters>, <Attributes>)


oEditor.CreateBondwire(
["NAME:BondwireParameters",
"WireType:=" , "JEDEC_4Points",
"WireDiameter:=" , "0.025mm",
"NumSides:=" , "6",
Python Example
"XPadPos:=" , "1.6mm",
"YPadPos:=" , "-0.2mm",
"ZPadPos:=" , "0mm",
"XDir:=" , "-2.2mm",
"YDir:=" , "-1.4mm",

3D Modeler Editor Script Commands 8-11


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ZDir:=" , "0mm",
"Distance:=" , "2.60768096208106mm",
"h1:=" , "0.2mm",
"h2:=" , "0mm",
"alpha:=" , "80deg",
"beta:=" , "0",
"WhichAxis:=" , "Z",
"ReverseDirection:=" , True
],
["NAME:Attributes",
"Name:=" , "Bondwire1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"vacuum\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , True,
"ShellElement:=" , False,

3D Modeler Editor Script Commands 8-12


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ShellElementThickness:=", "0mm",
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])

VB CreateBondwire <Parameters>, <Attributes>


Syntax

oEditor.CreateBondwire Array("NAME:BondwireParameters", "WireType:=", "LOW", "WireDia-


meter:=", _
"0.025mm", "NumSides:=", "6", "XPadPos:=", "6mm", "YPadPos:=", "-2.5mm", "ZPadPos:=", _
"0mm", "XDir:=", "-10mm", "YDir:=", "4mm", "ZDir:=", "0mm", "Distance:=", _
"10.770329614269mm", "h1:=", "0.2mm", "h2:=", "0mm", "alpha:=", "80deg", "beta:=", _
"80deg", "WhichAxis:=", "Z", "ReverseDirection:=", false), Array("NAME:Attributes",
VB
"Name:=", _
Exampl- "Bondwire2", "Flags:=", "", "Color:=", "(143 175 143)", "Transparency:=", 0,
e "PartCoordinateSystem:=", _
"Global", "UDMId:=", "", "MaterialValue:=", "" & Chr(34) & "copper" & Chr(34) & "",
"SurfaceMaterialValue:=", _
"" & Chr(34) & "" & Chr(34) & "", "SolveInside:=", false, "ShellElement:=", _
false, "ShellElementThickness:=", "0mm", "IsMaterialEditable:=", true, "UseMa-
terialAppearance:=", _
false, "IsLightweight:=", false)

3D Modeler Editor Script Commands 8-13


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

CreateBox
Creates a box.

UI Access Draw > Box.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:BoxParameters",
"XPosition:=", <string>,
"YPosition:=", <string>,
Parameters
"ZPosition:=", <string>,
"XSize:=" , <string>,
"YSize:=" , <string>,
"ZSize:=" , <string>)
<AttributesArray> Array Structured array. See: AttributesArray.

Return Value None.

Python Syntax CreateBox(<Parameters>, <Attributes>)


oEditor.CreateBox(
Python Example ["NAME:BoxParameters",
"XPosition:=" , "0.5mm",

3D Modeler Editor Script Commands 8-14


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"YPosition:=" , "-6.5mm",
"ZPosition:=" , "0mm",
"XSize:=" , "2mm",
"YSize:=" , "1.5mm",
"ZSize:=" , "1.5mm"
],
["NAME:Attributes",
"Name:=" , "Box3",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=" , "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=" , "\"\"",
"SolveInside:=" , False,
"ShellElement:=" , False,
"ShellElementThickness:=", "0mm",
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False

3D Modeler Editor Script Commands 8-15


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

])

VB Syn- CreateBox <Parameters>, <Attributes>


tax

oEditor.CreateBox Array("NAME:BoxParameters", "XPosition:=", "0mm", "YPosition:=", _


"4mm", "ZPosition:=", "0mm", "XSize:=", "-4mm", "YSize:=", "1mm", "ZSize:=", _
"2mm"), Array("NAME:Attributes", "Name:=", "Box4", "Flags:=", "", "Color:=", _
"(143 175 143)", "Transparency:=", 0, "PartCoordinateSystem:=", "Global", "UDMId:=",
VB _
Example "", "MaterialValue:=", "" & Chr(34) & "copper" & Chr(34) & "", "Sur-
faceMaterialValue:=", _
"" & Chr(34) & "" & Chr(34) & "", "SolveInside:=", false, "ShellElement:=", _
false, "ShellElementThickness:=", "0mm", "IsMaterialEditable:=", true, _
"UseMaterialAppearance:=", false, "IsLightweight:=", false)

CreateCircle
Creates a circle.

UI Access Draw > Circle.

Name Type Description


Parameters <Parameters> Array Structured array.
Array("NAME:CircleParameters",

3D Modeler Editor Script Commands 8-16


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"IsCovered:=", <boolean>,
"XCenter:=", <value>,
"YCenter:=", <value>,
"ZCenter:=", <value>,
"Radius:=", <value>,
"WhichAxis:=", <string>
"NumSegments:=", <string containing integer>)
<AttributesArray> Array Structured array. See: AttributesArray.

Return Value None.

Python Syntax CreateCircle(<Parameters>, <Attributes>)


oEditor.CreateCircle(
["NAME:CircleParameters",
"IsCovered:=" , True,
"XCenter:=" , "5.5mm",
"YCenter:=" , "-3mm",
Python Example
"ZCenter:=" , "0mm",
"Radius:=" , "0.707106781186548mm",
"WhichAxis:=" , "Z",
"NumSegments:=" , "0"
],

3D Modeler Editor Script Commands 8-17


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["NAME:Attributes",
"Name:=" , "Circle1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"ShellElement:=" , False,
"ShellElementThickness:=", "0mm",
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])

VB CreateCircle <Parameters>, <Attributes>


Syntax

VB oEditor.CreateCircle Array("NAME:CircleParameters", "IsCovered:=", true, "XCenter:=", _


Exampl-

3D Modeler Editor Script Commands 8-18


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"7mm", "YCenter:=", "-6mm", "ZCenter:=", "0mm", "Radius:=", "0.5mm", "WhichAxis:=", _


"Z", "NumSegments:=", "0"), Array("NAME:Attributes", "Name:=", "Circle2", "Flags:=", _
"", "Color:=", "(143 175 143)", "Transparency:=", 0, "PartCoordinateSystem:=", _
"Global", "UDMId:=", "", "MaterialValue:=", "" & Chr(34) & "copper" & Chr(34) & "", "Sur-
e faceMaterialValue:=", _
"" & Chr(34) & "" & Chr(34) & "", "SolveInside:=", false, "ShellElement:=", _
false, "ShellElementThickness:=", "0mm", "IsMaterialEditable:=", true, "UseMa-
terialAppearance:=", _
false, "IsLightweight:=", false)

CreateCone
Creates a cone.

UI Access Draw > Cone.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:ConeParameters",
"XCenter:=", <string>,
"YCenter:=", <string>,
Parameters
"ZCenter:=", <string>,
"WhichAxis:=", <string>,
"Height:=", <string>,
"BottomRadius:=", <string>,
"TopRadius:=", <string>)

3D Modeler Editor Script Commands 8-19


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<AttributesArray> Array Structured array. See: AttributesArray.

Return Value None.

Python Syntax CreateCone(<Parameters>, <Attributes>)


oEditor.CreateCone(
["NAME:ConeParameters",
"XCenter:=" , "3mm",
"YCenter:=" , "-4.5mm",
"ZCenter:=" , "0mm",
"WhichAxis:=" , "Z",
"Height:=" , "2.5mm",
"BottomRadius:=" , "2.82842712474619mm",
Python Example
"TopRadius:=" , "2.23606797749979mm"
],
["NAME:Attributes",
"Name:=" , "Cone1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",

3D Modeler Editor Script Commands 8-20


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"ShellElement:=" , False,
"ShellElementThickness:=", "0mm",
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])

VB CreateCone <Parameters>, <Attributes>


Syntax

oEditor.CreateCone Array("NAME:ConeParameters", "XCenter:=", "3mm", "YCenter:=", _


"-3mm", "ZCenter:=", "0mm", "WhichAxis:=", "Z", "Height:=", "4mm", "BottomRadius:=", _
"1.11803398874989mm", "TopRadius:=", "2.06155281280883mm"), Array("NAME:Attributes",
"Name:=", _
VB
"Cone1", "Flags:=", "", "Color:=", "(143 175 143)", "Transparency:=", 0, "PartCoordin-
Exampl-
ateSystem:=", _
e
"Global", "UDMId:=", "", "MaterialValue:=", "" & Chr(34) & "copper" & Chr(34) & "",
"SurfaceMaterialValue:=", _
"" & Chr(34) & "" & Chr(34) & "", "SolveInside:=", false, "ShellElement:=", _
false, "ShellElementThickness:=", "0mm", "IsMaterialEditable:=", true, "UseMa-

3D Modeler Editor Script Commands 8-21


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

terialAppearance:=", _
false, "IsLightweight:=", false)

CreateCutplane
Creates a cutplane.

UI Access Draw > Plane.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:PlaneParameters",
"PlaneBaseX:=", <string>,
"PlaneBaseY:=", <string>,
Parameters "PlaneBaseZ:=", <string>,
"PlaneNormalX:=", <string>,
"PlaneNormalY:=", <string>),
"PlaneNormalZ:=", <string>)
<AttributesArray> Array See: AttributesArray. CreateCutplane only takes the Name and Color
attributes.

Return Value None.

Python Syntax CreateCutplane(<Parameters>, <Attributes>)


Python Example oEditor.CreateCutplane(

3D Modeler Editor Script Commands 8-22


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["NAME:PlaneParameters",
"PlaneBaseX:=" , "-0.6mm",
"PlaneBaseY:=" , "-0.8mm",
"PlaneBaseZ:=" , "0mm",
"PlaneNormalX:=" , "1.2mm",
"PlaneNormalY:=" , "0.2mm",
"PlaneNormalZ:=" , "0mm"
],
["NAME:Attributes",
"Name:=" , "Plane1",
"Color:=" , "(143 175 143)"
])

VB Syn- CreateCutplane <Parameters>, <Attributes>


tax

oEditor.CreateCutplane Array("NAME:PlaneParameters", "PlaneBaseX:=", "0.6mm",


"PlaneBaseY:=", _

VB "1.2mm", "PlaneBaseZ:=", "0mm", "PlaneNormalX:=", "0.4mm", "PlaneNormalY:=", _


Example "0.6mm", "PlaneNormalZ:=", "0mm"), Array("NAME:Attributes", "Name:=", "Plane2", "Col-
or:=", _
"(143 175 143)")

3D Modeler Editor Script Commands 8-23


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

CreateCylinder
Creates a cylinder.

UI Access Draw > Cylinder.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:CylinderParameters",
"XCenter:=", <string>,
"YCenter:=", <string>,
Parameters "ZCenter:=", <string>,
"Radius:=", <string>,
"Height:=", <string>,
"WhichAxis:=", <string>,
"NumSides:=", <string containing integer>)
<AttributesArray> Array Structured array. See: AttributesArray.

Return Value None.

Python Syntax CreateCylinder(<Parameters>, <Attributes>)


oEditor.CreateCylinder(
Python Example ["NAME:CylinderParameters",
"XCenter:=" , "6mm",

3D Modeler Editor Script Commands 8-24


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"YCenter:=" , "-4.5mm",
"ZCenter:=" , "0mm",
"Radius:=" , "0.5mm",
"Height:=" , "4.5mm",
"WhichAxis:=" , "Z",
"NumSides:=" , "0"
],
["NAME:Attributes",
"Name:=" , "Cylinder1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"ShellElement:=" , False,
"ShellElementThickness:=", "0mm",
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,

3D Modeler Editor Script Commands 8-25


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"IsLightweight:=" , False
])

VB CreateCylinder <Parameters>, <Attributes>


Syntax

oEditor.CreateCylinder Array("NAME:CylinderParameters", "XCenter:=", "1.5mm", "YCen-


ter:=", _
"6.5mm", "ZCenter:=", "0mm", "Radius:=", "1mm", "Height:=", "1mm", "WhichAxis:=", _
"Z", "NumSides:=", "0"), Array("NAME:Attributes", "Name:=", "Cylinder2", "Flags:=", _

VB
"", "Color:=", "(143 175 143)", "Transparency:=", 0, "PartCoordinateSystem:=", _
Exampl- "Global", "UDMId:=", "", "MaterialValue:=", "" & Chr(34) & "copper" & Chr(34) & "", "Sur-
e faceMaterialValue:=", _
"" & Chr(34) & "" & Chr(34) & "", "SolveInside:=", false, "ShellElement:=", _
false, "ShellElementThickness:=", "0mm", "IsMaterialEditable:=", true, "UseMa-
terialAppearance:=", _
false, "IsLightweight:=", false)

CreateEllipse
Creates an ellipse.

UI Access Draw > Ellipse.

Name Type Description


Parameters
<Parameters> Array Structured array.

3D Modeler Editor Script Commands 8-26


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:EllipseParameters",
"IsCovered:=", <string>,
"XCenter:=", <string>,
"YCenter:=", <string>,
"ZCenter:=", <string>,
"MajRadius:=", <string>,
"Ratio:=", <string>,
"WhichAxis:=", <string>,
"NumSegments:=", <string>)
<AttributesArray> Array Structured array. See: AttributesArray.

Return Value None.

Python Syntax CreateEllipse(<Parameters>, <Attributes>)


oEditor.CreateEllipse(
["NAME:EllipseParameters",
"IsCovered:=" , True,
"XCenter:=" , "0.6mm",
Python Example
"YCenter:=" , "-0.6mm",
"ZCenter:=" , "0mm",
"MajRadius:=" , "0.2mm",
"Ratio:=" , "7",

3D Modeler Editor Script Commands 8-27


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"WhichAxis:=" , "Z",
"NumSegments:=" , "0"
],
["NAME:Attributes",
"Name:=" , "Ellipse1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"ShellElement:=" , False,
"ShellElementThickness:=", "0mm",
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])

3D Modeler Editor Script Commands 8-28


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB CreateEllipse <Parameters>, <Attributes>


Syntax

oEditor.CreateEllipse Array("NAME:EllipseParameters", "IsCovered:=", true, "XCenter:=",


_
"-0.4mm", "YCenter:=", "-3.2mm", "ZCenter:=", "0mm", "MajRadius:=", "0.4mm", "Ratio:=",
_
"0.5", "WhichAxis:=", "Z", "NumSegments:=", "0"), Array("NAME:Attributes", "Name:=", _

VB
"Ellipse2", "Flags:=", "", "Color:=", "(143 175 143)", "Transparency:=", 0,
Exampl- "PartCoordinateSystem:=", _
e "Global", "UDMId:=", "", "MaterialValue:=", "" & Chr(34) & "copper" & Chr(34) & "",
"SurfaceMaterialValue:=", _
"" & Chr(34) & "" & Chr(34) & "", "SolveInside:=", false, "ShellElement:=", _
false, "ShellElementThickness:=", "0mm", "IsMaterialEditable:=", true, "UseMa-
terialAppearance:=", _
false, "IsLightweight:=", false)

CreateEquationCurve
Creates an equation-based curve.

UI Access Draw > Equation-Based Curve.

Name Type Description


<Parameters> Array Structured array.

Parameters Array("NAME:EquationBasedCurveParameters",
"XtFunction:=", <string>,
"YtFunction:=", <string>,

3D Modeler Editor Script Commands 8-29


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ZtFunction:=", <string>,
"tStart:=", <string>,
"tEnd:=", <string>,
"NumOfPointsOnCurve:=", <string>,
"Version:=", <integer>),
<polylineArray(optional)>)
<AttributesArray> Array Structured array. See: AttributesArray.

Return Value None.

Python Syntax CreateEquationCurve(<Parameters>, <Attributes>)


oEditor.CreateEquationCurve(
["NAME:EquationBasedCurveParameters",
"XtFunction:=" , "1",
"YtFunction:=" , "3",
"ZtFunction:=" , "32",
Python Example
"tStart:=" , "1",
"tEnd:=" , "3",
"NumOfPointsOnCurve:=" , "0",
"Version:=" , 1,
["NAME:PolylineXSection",

3D Modeler Editor Script Commands 8-30


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"XSectionType:=" , "None",
"XSectionOrient:=" , "Auto",
"XSectionWidth:=" , "0",
"XSectionTopWidth:=" , "0",
"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,
"ShellElement:=" , False,
"ShellElementThickness:=", "0mm",

3D Modeler Editor Script Commands 8-31


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])

VB CreateEquationCurve <Parameters>, <Attributes>


Syntax

oEditor.CreateEquationCurve Array("NAME:EquationBasedCurveParameters", "XtFunction:=",


_
"1", "YtFunction:=", "3", "ZtFunction:=", "32", "tStart:=", "1", "tEnd:=", "3",
"NumOfPointsOnCurve:=", _
"0", "Version:=", 1, Array("NAME:PolylineXSection", "XSectionType:=", "None", "XSec-
tionOrient:=", _
"Auto", "XSectionWidth:=", "0", "XSectionTopWidth:=", "0", "XSectionHeight:=", _
VB "0", "XSectionNumSegments:=", "0", "XSectionBendType:=", "Corner")), Array("NAME:At-
Examp- tributes", "Name:=", _
le
"EquationCurve2", "Flags:=", "", "Color:=", "(143 175 143)", "Transparency:=", _
0, "PartCoordinateSystem:=", "Global", "UDMId:=", "", "MaterialValue:=", _
"" & Chr(34) & "copper" & Chr(34) & "", "SurfaceMaterialValue:=", "" & Chr(34) & "" &
Chr(34) & "", "SolveInside:=", _
false, "ShellElement:=", false, "ShellElementThickness:=", "0mm", "IsMa-
terialEditable:=", _
true, "UseMaterialAppearance:=", false, "IsLightweight:=", false)

3D Modeler Editor Script Commands 8-32


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

CreateEquationSurface
Creates an equation-based surface.

UI Access Draw > Equation-Based Surface.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:EquationBasedSurfaceParameters",
"XuvFunction:=" , <string equation containing
Function, Operators and/or quantities _u, _v, or PI>,
"YuvFunction:=" , <string equation containing
Function, Operators and/or quantities _u, _v, or PI>,

Parameters "ZuvFunction:=" , <string equation containing


Function, Operators and/or quantities _u, _v, or PI>,
"uStart:=" , <string>,
"uEnd:=" , <string>,
"vStart:=" , <string>,
"vEnd:=" , <string>,
"Version:=" , <integer>)
<AttributesArray> Array Structured array. See: AttributesArray.

Return Value None.

Python Syntax CreateEquationSurface(<Parameters>, <Attributes>)


Python Example oEditor.CreateEquationSurface(

3D Modeler Editor Script Commands 8-33


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["NAME:EquationBasedSurfaceParameters",
"XuvFunction:=" , "_u",
"YuvFunction:=" , "_v",
"ZuvFunction:=" , "sin(_u)+cos(_v)",
"uStart:=" , "1",
"uEnd:=" , "10",
"vStart:=" , "1",
"vEnd:=" , "10",
"Version:=" , 1
],
["NAME:Attributes",
"Name:=" , "EquationSurface1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,

3D Modeler Editor Script Commands 8-34


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ShellElement:=" , False,
"ShellElementThickness:=", "0mm",
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])

VB CreateEquationSurface <Parameters>, <Attributes>


Syntax

oEditor.CreateEquationSurface Array("NAME:EquationBasedSurfaceParameters", "XuvFunc-


tion:=", _
"_u", "YuvFunction:=", "_v", "ZuvFunction:=", "sin(_u)+cos(_v)", "uStart:=", "1",
"uEnd:=", _
"10", "vStart:=", "1", "vEnd:=", "10", "Version:=", 1), Array("NAME:Attributes",
"Name:=", _
VB
Examp- "EquationSurface2", "Flags:=", "", "Color:=", "(143 175 143)", "Transparency:=", _
le 0, "PartCoordinateSystem:=", "Global", "UDMId:=", "", "MaterialValue:=", _
"" & Chr(34) & "copper" & Chr(34) & "", "SurfaceMaterialValue:=", "" & Chr(34) & "" &
Chr(34) & "", "SolveInside:=", _
false, "ShellElement:=", false, "ShellElementThickness:=", "0mm", "IsMa-
terialEditable:=", _
true, "UseMaterialAppearance:=", false, "IsLightweight:=", false)

3D Modeler Editor Script Commands 8-35


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

CreateHelix
Creates a helix based on a sweep of specified objects.

UI Access Draw > Helix.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Array("NAME:HelixParameters",
"XCenter:=" , <string>,
"YCenter:=" , <string>,
"ZCenter:=" , <string>,
Parameters "XStartDir:=" , <string>,
"YStartDir:=" , <string>,
"ZStartDir:=" , <string>,
"NumThread:=" , <string>,
"RightHand:=" , <boolean>,
"RadiusIncrement:=" , <string>,
"Thread:=" , <string>)

Return Value None.

Python Syntax CreateHelix(<SelectionsArray>, <Parameters>)

3D Modeler Editor Script Commands 8-36


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oEditor.CreateHelix(
["NAME:Selections",
"Selections:=" , "EquationSurface2",
"NewPartsModelFlag:=" , "Model"
],
["NAME:HelixParameters",
"XCenter:=" , "10000mm",
"YCenter:=" , "40000mm",
Python Example "ZCenter:=" , "0mm",
"XStartDir:=" , "0mm",
"YStartDir:=" , "10000mm",
"ZStartDir:=" , "0mm",
"NumThread:=" , "1",
"RightHand:=" , True,
"RadiusIncrement:=" , "0mm",
"Thread:=" , "1mm"
])

VB Syn- CreateHelix <SelectionsArray>, <Parameters>


tax

VB oEditor.CreateHelix Array("NAME:Selections", "Selections:=", "EquationSurface1",


Exampl- "NewPartsModelFlag:=", _

3D Modeler Editor Script Commands 8-37


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Model"), Array("NAME:HelixParameters", "XCenter:=", "1000mm", "YCenter:=", "10000mm",


"ZCenter:=", _
"2.39945573144418mm", "XStartDir:=", "-41000mm", "YStartDir:=", "-10000mm",
e "ZStartDir:=", _
"-2.39945573144418mm", "NumThread:=", "1", "RightHand:=", true, "RadiusIncrement:=", _
"0mm", "Thread:=", "1mm")

CreatePoint
Creates a point.

UI Access Draw > Point.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:PointParameters",
"PointX:=", <value>,
Parameters
"PointY:=", <value>,
"PointZ:=", <value>)
<AttributesArray> Array Structured array. See: AttributesArray. CreatePoint takes only the Name
and Color attributes.

Return Value None.

Python Syntax CreatePoint(<Parameters>, <Attributes>)

Python Example oEditor.CreatePoint(

3D Modeler Editor Script Commands 8-38


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["NAME:PointParameters",
"PointX:=" , "0.2mm",

"PointY:=" , "-0.2mm",

"PointZ:=" , "0mm"
],
["NAME:Attributes",

"Name:=" , "Point1",

"Color:=" , "(143 175 143)"

])

VB Syntax CreatePoint <Parameters>, <Attributes>


oEditor.CreatePoint
Array("NAME:PointParameters",
"PointX:=" , "0.2mm",
VB Example
"PointY:=" , "-0.2mm",
"PointZ:=" , "0mm") ,
Array("NAME:Attributes",

3D Modeler Editor Script Commands 8-39


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Name:=" , "Point1",
"Color:=" , "(143 175 143)")

CreateUserDefinedPart
Creates a user-defined part.

UI Access Draw > User-Defined Primitive > [Part].

Name Type Description


<Parameters> Array Structured array.
Array("NAME:UserDefinedPrimitiveParameters",
"DllName:=" , <string>,
"Version:=" , <string>,
"NoOfParameters:=" , <integer>,
"Library:=" , <string>,
Parameters <paramVectorArray>)
<paramVectorArray> Array Structured array containing arrays for each pair:
Array("NAME:ParamVector",
<pair>, <pair>, <pair>,...
)
<pair> Array Structured array:
Array("NAME:Pair",
"Name:=" , <string>,

3D Modeler Editor Script Commands 8-40


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Value:=" , <string>)
<Attributes> Array Structured array. See: AttributesArray.

Return Value None.

Python Syntax CreateUserDefinedPart(<Parameters>, <Attributes>)


oEditor.CreateUserDefinedPart(
["NAME:UserDefinedPrimitiveParameters",
"DllName:=" , "RMxprt/LapCoil.dll",
"Version:=" , "16.0",
"NoOfParameters:=" , 22,
"Library:=" , "syslib",
["NAME:ParamVector",
["NAME:Pair",
Python Example
"Name:=" , "DiaGap",
"Value:=" , "100mm"
],
["NAME:Pair",
"Name:=" , "DiaYoke",
"Value:=" , "20mm"
],
["NAME:Pair",

3D Modeler Editor Script Commands 8-41


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Name:=" , "Length",
"Value:=" , "100mm"
],
["NAME:Pair",
"Name:=" , "Skew",
"Value:=" , "0deg"
],
["NAME:Pair",
"Name:=" , "Slots",
"Value:=" , "18"
],
["NAME:Pair",
"Name:=" , "SlotType",
"Value:=" , "1"
],
["NAME:Pair",
"Name:=" , "Hs0",
"Value:=" , "1mm"
],
["NAME:Pair",

3D Modeler Editor Script Commands 8-42


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Name:=" , "Hs1",
"Value:=" , "1mm"
],
["NAME:Pair",
"Name:=" , "Hs2",
"Value:=" , "10mm"
],
["NAME:Pair",
"Name:=" , "Bs0",
"Value:=" , "2.5mm"
],
["NAME:Pair",
"Name:=" , "Bs1",
"Value:=" , "8mm"
],
["NAME:Pair",
"Name:=" , "Bs2",
"Value:=" , "5mm"
],
["NAME:Pair",
"Name:=" , "Rs",

3D Modeler Editor Script Commands 8-43


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Value:=" , "0mm"
],
["NAME:Pair",
"Name:=" , "FilletType",
"Value:=" , "0"
],
["NAME:Pair",
"Name:=" , "Layers",
"Value:=" , "2"
],
["NAME:Pair",
"Name:=" , "CoilPitch",
"Value:=" , "4"
],
["NAME:Pair",
"Name:=" , "EndExt",
"Value:=" , "5mm"
],
["NAME:Pair",
"Name:=" , "SpanExt",

3D Modeler Editor Script Commands 8-44


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Value:=" , "25mm"
],
["NAME:Pair",
"Name:=" , "BendAngle",
"Value:=" , "0deg"
],
["NAME:Pair",
"Name:=" , "SegAngle",
"Value:=" , "10deg"
],
["NAME:Pair",
"Name:=" , "LenRegion",
"Value:=" , "200mm"
],
["NAME:Pair",
"Name:=" , "InfoCoil",
"Value:=" , "0"
]
]
],
["NAME:Attributes",

3D Modeler Editor Script Commands 8-45


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Name:=" , "LapCoil1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"ShellElement:=" , False,
"ShellElementThickness:=", "0mm",
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])

VB CreateUserDefinedPart <Parameters>, <Attributes>


Syntax

VB
oEditor.CreateUserDefinedPart Array("NAME:UserDefinedPrimitiveParameters", "DllName:=",
Exampl- _
e "SegmentedHelix/RectHelix.dll", "Version:=", "1.0", "NoOfParameters:=", 8, "Library:=",

3D Modeler Editor Script Commands 8-46


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

_
"syslib", Array("NAME:ParamVector", Array("NAME:Pair", "Name:=", "RectHeight",
"Value:=", _
"1mm"), Array("NAME:Pair", "Name:=", "RectWidth", "Value:=", "2mm"), Array("NAME:Pair",
"Name:=", _
"StartHelixRadius", "Value:=", "10mm"), Array("NAME:Pair", "Name:=", "RadiusChange",
"Value:=", _
"0mm"), Array("NAME:Pair", "Name:=", "Pitch", "Value:=", "3mm"), Array("NAME:Pair",
"Name:=", _
"Turns", "Value:=", "2"), Array("NAME:Pair", "Name:=", "SegmentsPerTurn", "Value:=", _
"36"), Array("NAME:Pair", "Name:=", "RightHanded", "Value:=", "1"))), Array("NAME:At-
tributes", "Name:=", _
"RectHelix1", "Flags:=", "", "Color:=", "(143 175 143)", "Transparency:=", 0,
"PartCoordinateSystem:=", _
"Global", "UDMId:=", "", "MaterialValue:=", "" & Chr(34) & "copper" & Chr(34) & "", "Sur-
faceMaterialValue:=", _
"" & Chr(34) & "" & Chr(34) & "", "SolveInside:=", false, "ShellElement:=", _
false, "ShellElementThickness:=", "0mm", "IsMaterialEditable:=", true, "UseMa-
terialAppearance:=", _
false, "IsLightweight:=", false)

CreatePolyline
Creates a polyline.

UI Access Draw > Line.

3D Modeler Editor Script Commands 8-47


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


<Parameters> Array Structured array.
Array("NAME:PolylineParameters",
"IsPolylineCovered:=", <bool>,
"IsPolylineClosed:=", <bool>,
<PolylinePointsArray>,
<PolylineSegmentsArray>)
<PolylinePointsArray> Array Array("NAME:PolylinePoints", <OnePointArray>,
<OnePointArray>, ...)
<OnePointArray> Array Array("NAME:PLPoint",
"X:=", <value>,
Parameters
"Y:=", <value>,
"Z:=", <value>))
<PolylineSegmentsArray> Array <PolylineSegmentsArray>
Array("NAME:PolylineSegments",
<OneSegmentArray>, <OneSegmentArray>, ...)
<OneSegmentArray> Array Array("NAME:PLSegment",
"SegmentType:=", <"Line", "Arc", "Spline", or
"AngularArc">,
"StartIndex:=", <value>,
"NoOfPoints:=", <value>)
<AttributesArray> Array Structured array. See: AttributesArray.

3D Modeler Editor Script Commands 8-48


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value None.

Python Syntax CreatePolyline(<Parameters>, <Attributes>)


oEditor.CreatePolyline(
["NAME:PolylineParameters",
"IsPolylineCovered:=" , True,
"IsPolylineClosed:=" , False,
["NAME:PolylinePoints",
["NAME:PLPoint",
"X:=" , "20000mm",
"Y:=" , "-20000mm",
"Z:=" , "0mm"
Python Example
],
["NAME:PLPoint",
"X:=" , "-90000mm",
"Y:=" , "20000mm",
"Z:=" , "0mm"
],
["NAME:PLPoint",
"X:=" , "10000mm",
"Y:=" , "-140000mm",

3D Modeler Editor Script Commands 8-49


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Z:=" , "0mm"
]
],
["NAME:PolylineSegments",
["NAME:PLSegment",
"SegmentType:=" , "Line",
"StartIndex:=" , 0,
"NoOfPoints:=" , 2
],
["NAME:PLSegment",
"SegmentType:=" , "Line",
"StartIndex:=" , 1,
"NoOfPoints:=" , 2
]
],
["NAME:PolylineXSection",
"XSectionType:=" , "None",
"XSectionOrient:=" , "Auto",
"XSectionWidth:=" , "0mm",
"XSectionTopWidth:=" , "0mm",

3D Modeler Editor Script Commands 8-50


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"XSectionHeight:=" , "0mm",
"XSectionNumSegments:=" , "0",
"XSectionBendType:=" , "Corner"
]],
["NAME:Attributes",
"Name:=" , "Polyline1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"ShellElement:=" , False,
"ShellElementThickness:=", "0mm",
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])

3D Modeler Editor Script Commands 8-51


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB CreatePolyline <Parameters>, <Attributes>


Syntax

oEditor.CreatePolyline Array("NAME:PolylineParameters", "IsPolylineCovered:=", true,


"IsPolylineClosed:=", _
false, Array("NAME:PolylinePoints", Array("NAME:PLPoint", "X:=", "40000mm", "Y:=", _
"50000mm", "Z:=", "0mm"), Array("NAME:PLPoint", "X:=", "-150000mm", "Y:=", "-50000mm",
"Z:=", _
"0mm")), Array("NAME:PolylineSegments", Array("NAME:PLSegment", "SegmentType:=", "Line",
"StartIndex:=", _
0, "NoOfPoints:=", 2)), Array("NAME:PolylineXSection", "XSectionType:=", "None", "XSec-
tionOrient:=", _
VB "Auto", "XSectionWidth:=", "0mm", "XSectionTopWidth:=", "0mm", "XSectionHeight:=", _
Exampl-
e "0mm", "XSectionNumSegments:=", "0", "XSectionBendType:=", "Corner")), Array("NAME:At-
tributes", "Name:=", _
"Polyline2", "Flags:=", "", "Color:=", "(143 175 143)", "Transparency:=", 0,
"PartCoordinateSystem:=", _
"Global", "UDMId:=", "", "MaterialValue:=", "" & Chr(34) & "copper" & Chr(34) & "", "Sur-
faceMaterialValue:=", _
"" & Chr(34) & "" & Chr(34) & "", "SolveInside:=", false, "ShellElement:=", _
false, "ShellElementThickness:=", "0mm", "IsMaterialEditable:=", true, "UseMa-
terialAppearance:=", _
false, "IsLightweight:=", false)

3D Modeler Editor Script Commands 8-52


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

CreateRectangle
Creates a rectangle.

UI Access Draw > Rectangle.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:RectangleParameters",
"IsCovered:=" , <boolean>,
"XStart:=" , <string>,
Parameters "YStart:=" , <string>,
"ZStart:=" , <string>,
"Width:=" , <string>,
"Height:=" , <string>,
"WhichAxis:=" , <string "X", "Y", or "Z">)
<AttributesArray> Array Structured array. See: AttributesArray.

Return Value None.

Python Syntax CreateRectangle(<Parameters>, <Attributes>)


oEditor.CreateRectangle(
["NAME:RectangleParameters",
Python Example
"IsCovered:=" , True,
"XStart:=" , "-80000mm",

3D Modeler Editor Script Commands 8-53


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"YStart:=" , "-90000mm",
"ZStart:=" , "0mm",
"Width:=" , "20000mm",
"Height:=" , "30000mm",
"WhichAxis:=" , "Z"
],
["NAME:Attributes",
"Name:=" , "Rectangle1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"ShellElement:=" , False,
"ShellElementThickness:=", "0mm",
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,

3D Modeler Editor Script Commands 8-54


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"IsLightweight:=" , False
])

VB CreateRectangle <Parameters>, <Attributes>


Syntax

oEditor.CreateRectangle Array("NAME:RectangleParameters", "IsCovered:=", true,


"XStart:=", _
"10000mm", "YStart:=", "-40000mm", "ZStart:=", "0mm", "Width:=", "40000mm", "Height:=",
_
"10000mm", "WhichAxis:=", "Z"), Array("NAME:Attributes", "Name:=", "Rectangle2", "Flag-
s:=", _
VB
Exampl- "", "Color:=", "(143 175 143)", "Transparency:=", 0, "PartCoordinateSystem:=", _
e "Global", "UDMId:=", "", "MaterialValue:=", "" & Chr(34) & "copper" & Chr(34) & "",
"SurfaceMaterialValue:=", _
"" & Chr(34) & "" & Chr(34) & "", "SolveInside:=", false, "ShellElement:=", _
false, "ShellElementThickness:=", "0mm", "IsMaterialEditable:=", true, "UseMa-
terialAppearance:=", _
false, "IsLightweight:=", false)

CreateRegion
Creates a region containing the design.

UI Access Draw > Region.

Name Type Description


Parameters
<Parameters> Array Structured array.

3D Modeler Editor Script Commands 8-55


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:RegionParameters",
"+XPaddingType:=", <string "Percentage Offset",
"Absolute Offset", or "Absolute Position">,
"+XPadding:=", <string X value>,
"-XPaddingType:=", <string "Percentage Offset",
"Absolute Offset", or "Absolute Position">,
"-XPadding:=", <string -X value>,
"+YPaddingType:=", <string "Percentage Offset",
"Absolute Offset", or "Absolute Position">,
"+YPadding:=", <string Y value>,
"-YPaddingType:=", <string "Percentage Offset",
"Absolute Offset", or "Absolute Position">,
"-YPadding:=", <string -Y value>,
"+ZPaddingType:=", <string "Percentage Offset",
"Absolute Offset", or "Absolute Position">,
"+ZPadding:=", <string Z value>,
"-ZPaddingType:=", <string "Percentage Offset",
"Absolute Offset", or "Absolute Position">,
"-ZPadding:=", <string -Z value>)
<AttributesArray> Array Structured array. See: AttributesArray.

Return Value None.

3D Modeler Editor Script Commands 8-56


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax CreateRegion(<Parameters>, <Attributes>)


oEditor.CreateRegion(
["NAME:RegionParameters",
"+XPaddingType:=" , "Percentage Offset",
"+XPadding:=" , "0",
"-XPaddingType:=" , "Percentage Offset",
"-XPadding:=" , "0",
"+YPaddingType:=" , "Percentage Offset",
"+YPadding:=" , "0",
"-YPaddingType:=" , "Percentage Offset",
"-YPadding:=" , "0",
Python Example
"+ZPaddingType:=" , "Percentage Offset",
"+ZPadding:=" , "0",
"-ZPaddingType:=" , "Percentage Offset",
"-ZPadding:=" , "0"
],
["NAME:Attributes",
"Name:=" , "Region",
"Flags:=" , "Wireframe#",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,

3D Modeler Editor Script Commands 8-57


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"vacuum\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"ShellElement:=" , False,
"ShellElementThickness:=", "nan ",
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])

VB CreateRegion <Parameters>, <Attributes>


Syntax

oEditor.CreateRegion Array("NAME:RegionParameters", "+XPaddingType:=", _


"Percentage Offset", "+XPadding:=", "0", "-XPaddingType:=", "Percentage Offset", "-XPad-
ding:=", _
VB
"0", "+YPaddingType:=", "Percentage Offset", "+YPadding:=", "0", "-YPaddingType:=", _
Examp-
le "Percentage Offset", "-YPadding:=", "0", "+ZPaddingType:=", "Percentage Offset", "+ZPad-
ding:=", _
"0", "-ZPaddingType:=", "Percentage Offset", "-ZPadding:=", "0"), Array("NAME:At-
tributes", "Name:=", _

3D Modeler Editor Script Commands 8-58


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Region", "Flags:=", "Wireframe#", "Color:=", "(143 175 143)", "Transparency:=", _


0, "PartCoordinateSystem:=", "Global", "UDMId:=", "", "MaterialValue:=", _
"" & Chr(34) & "vacuum" & Chr(34) & "", "SurfaceMaterialValue:=", "" & Chr(34) & "" &
Chr(34) & "", "SolveInside:=", _
false, "ShellElement:=", false, "ShellElementThickness:=", "nan ", "IsMa-
terialEditable:=", _
true, "UseMaterialAppearance:=", false, "IsLightweight:=", false)

CreateRegularPolyhedron
Creates a regular polyhedron.

UI Access Draw > Regular Polyhedron.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:PolyhedronParameters",
"XCenter:=" , <string>,
"YCenter:=" , <string>,
"ZCenter:=" , <string>,
Parameters
"XStart:=" , <string>,
"YStart:=" , <string>,
"ZStart:=" , <string>,
"Height:=" , <string>,
"NumSides:=" , <string containing number greater
than 2>,

3D Modeler Editor Script Commands 8-59


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"WhichAxis:=" , <string "X", "Y", or "Z">)


<AttributesArray> Array Structured array. See: AttributesArray.

Return Value None.

Python Syntax CreateRegularPolyhedron(<Parameters>, <Attributes>)


oEditor.CreateRegularPolyhedron(
["NAME:PolyhedronParameters",
"XCenter:=" , "40000mm",
"YCenter:=" , "-80000mm",
"ZCenter:=" , "0mm",
"XStart:=" , "50000mm",
"YStart:=" , "-70000mm",
Python Example "ZStart:=" , "0mm",
"Height:=" , "50000mm",
"NumSides:=" , "8",
"WhichAxis:=" , "Z"
],
["NAME:Attributes",
"Name:=" , "RegularPolyhedron1",
"Flags:=" , "",

3D Modeler Editor Script Commands 8-60


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Color:=" , "(143 175 143)",


"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"ShellElement:=" , False,
"ShellElementThickness:=", "0mm",
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])

VB Syn- CreateRegularPolyhedron <Parameters>, <Attributes>


tax

oEditor.CreateRegularPolyhedron Array("NAME:PolyhedronParameters", "XCenter:=", _


"-10000mm", "YCenter:=", "-50000mm", "ZCenter:=", "0mm", "XStart:=", "0mm", "YStart:=",
_
VB
Example "-50000mm", "ZStart:=", "0mm", "Height:=", "90000mm", "NumSides:=", "8", "WhichAxis:=",
_
"Z"), Array("NAME:Attributes", "Name:=", "RegularPolyhedron2", "Flags:=", "", "Col-
or:=", _

3D Modeler Editor Script Commands 8-61


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"(143 175 143)", "Transparency:=", 0, "PartCoordinateSystem:=", "Global", "UDMId:=", _


"", "MaterialValue:=", "" & Chr(34) & "copper" & Chr(34) & "", "Sur-
faceMaterialValue:=", _
"" & Chr(34) & "" & Chr(34) & "", "SolveInside:=", false, "ShellElement:=", _
false, "ShellElementThickness:=", "0mm", "IsMaterialEditable:=", true, "UseMa-
terialAppearance:=", _
false, "IsLightweight:=", false)

CreateRegularPolygon
Creates a regular polygon.

UI Access Draw > Regular Polygon.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:RegularPolygonParameters",
"IsCovered:=" , <boolean>,
"XCenter:=" , <string>,
Parameters
"YCenter:=" , <string>,
"ZCenter:=" , <string>,
"XStart:=" , <string>,
"YStart:=" , <string>,
"ZStart:=" , <string>,

3D Modeler Editor Script Commands 8-62


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NumSides:=" , <string containing number greater


than 2>,
"WhichAxis:=" , <string "X", "Y", or "Z")
<AttributesArray> Array Structured array. See: AttributesArray.

Return Value None.

Python Syntax CreateRegularPolygon(<Parameters>, <Attributes>)


oEditor.CreateRegularPolygon(
["NAME:RegularPolygonParameters",
"IsCovered:=" , True,
"XCenter:=" , "-70000mm",
"YCenter:=" , "-100000mm",
"ZCenter:=" , "0mm",
"XStart:=" , "-50000mm",
Python Example "YStart:=" , "-80000mm",
"ZStart:=" , "0mm",
"NumSides:=" , "12",
"WhichAxis:=" , "Z"
],
["NAME:Attributes",
"Name:=" , "Polygon1",
"Flags:=" , "",

3D Modeler Editor Script Commands 8-63


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Color:=" , "(143 175 143)",


"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"ShellElement:=" , False,
"ShellElementThickness:=", "0mm",
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])

VB Syn- CreateRegularPolygon <Parameters>, <Attributes>


tax

oEditor.CreateRegularPolygon Array("NAME:RegularPolygonParameters", "IsCovered:=", _


true, "XCenter:=", "-60000mm", "YCenter:=", "40000mm", "ZCenter:=", "0mm", "XStart:=",
VB
_
Example
"-50000mm", "YStart:=", "50000mm", "ZStart:=", "0mm", "NumSides:=", "8", "WhichAxis:=",
_

3D Modeler Editor Script Commands 8-64


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Z"), Array("NAME:Attributes", "Name:=", "Polygon2", "Flags:=", "", "Color:=", _


"(143 175 143)", "Transparency:=", 0, "PartCoordinateSystem:=", "Global", "UDMId:=", _
"", "MaterialValue:=", "" & Chr(34) & "copper" & Chr(34) & "", "Sur-
faceMaterialValue:=", _
"" & Chr(34) & "" & Chr(34) & "", "SolveInside:=", false, "ShellElement:=", _
false, "ShellElementThickness:=", "0mm", "IsMaterialEditable:=", true, "UseMa-
terialAppearance:=", _
false, "IsLightweight:=", false)

CreateSphere
Creates a sphere.

UI Access Draw > Sphere.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:SphereParameters",
"XCenter:=", <string>,
Parameters
"YCenter:=", <string>,
"ZCenter:=", <string>,
"Radius:=", <string>)
<AttributesArray> Array Structured array. See: AttributesArray.

Return Value None.

Python Syntax CreateSphere(<Parameters>, <Attributes>)

3D Modeler Editor Script Commands 8-65


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oEditor.CreateSphere(
["NAME:SphereParameters",
"XCenter:=" , "-40000mm",
"YCenter:=" , "-130000mm",
"ZCenter:=" , "0mm",
"Radius:=" , "22360.6797749979mm"
],
["NAME:Attributes",
"Name:=" , "Sphere1",
"Flags:=" , "",
Python Example
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"ShellElement:=" , False,
"ShellElementThickness:=", "0mm",
"IsMaterialEditable:=" , True,

3D Modeler Editor Script Commands 8-66


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])

VB CreateSphere <Parameters>, <Attributes>


Syntax

oEditor.CreateSphere Array("NAME:SphereParameters", "XCenter:=", "-120000mm", "YCen-


ter:=", _
"90000mm", "ZCenter:=", "0mm", "Radius:=", "10000mm"), Array("NAME:Attributes",
"Name:=", _
"Sphere2", "Flags:=", "", "Color:=", "(143 175 143)", "Transparency:=", 0, "PartCoordin-
VB ateSystem:=", _
Exampl-
"Global", "UDMId:=", "", "MaterialValue:=", "" & Chr(34) & "copper" & Chr(34) & "",
e
"SurfaceMaterialValue:=", _
"" & Chr(34) & "" & Chr(34) & "", "SolveInside:=", false, "ShellElement:=", _
false, "ShellElementThickness:=", "0mm", "IsMaterialEditable:=", true, "UseMa-
terialAppearance:=", _
false, "IsLightweight:=", false)

CreateSpiral
Creates a spiral by sweeping the specified object(s).

UI Access Draw > Spiral.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

3D Modeler Editor Script Commands 8-67


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<Parameters> Array Structured array.


Array("NAME:SpiralParameters",
"XCenter:=" , <string>,
"YCenter:=" , <string>,
"ZCenter:=" , <string>,
"YStartDir:=" , <string>,
"ZStartDir:=" , <string>,
"NumThread:=" , <string>,
"RightHand:=" , <boolean>,
"RadiusIncrement:=" , <string>)

Return Value None.

Python Syntax CreateSpiral(<Parameters>, <Attributes>)


oEditor.CreateSpiral(
["NAME:Selections",
"Selections:=" , "Polygon2",
Python Example "NewPartsModelFlag:=" , "Model"
],
["NAME:SpiralParameters",
"XCenter:=" , "-70000mm",

3D Modeler Editor Script Commands 8-68


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"YCenter:=" , "50000mm",
"ZCenter:=" , "0mm",
"XStartDir:=" , "-60000mm",
"YStartDir:=" , "-10000mm",
"ZStartDir:=" , "0mm",
"NumThread:=" , "1",
"RightHand:=" , True,
"RadiusIncrement:=" , "1mm"
])

VB Syn- CreateSpiral <Parameters>, <Attributes>


tax

oEditor.CreateSpiral Array("NAME:Selections", "Selections:=", "Rectangle2",


"NewPartsModelFlag:=", _
"Model"), Array("NAME:SpiralParameters", "XCenter:=", "30000mm", "YCenter:=", _
VB
"-30000mm", "ZCenter:=", "0mm", "XStartDir:=", "-90000mm", "YStartDir:=", _
Example
"-30000mm", "ZStartDir:=", "0mm", "NumThread:=", "1", "RightHand:=", false, "Radi-
usIncrement:=", _
"1mm")

CreateTorus
Creates a torus.

3D Modeler Editor Script Commands 8-69


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access Draw > Torus.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:TorusParameters",
"XCenter:=" , <string>,
"YCenter:=" , <string>,
Parameters
"ZCenter:=" , <string>,
"MajorRadius:=" , <string>,
"MinorRadius:=" , <string>,
"WhichAxis:=" , <string "X", "Y", or "Z">)
<AttributesArray> Array Structured array. See: AttributesArray.

Return Value None.

Python Syntax CreateTorus(<Parameters>, <Attributes>)


oEditor.CreateTorus(
["NAME:TorusParameters",
"XCenter:=" , "0.6mm",
Python Example
"YCenter:=" , "-0.6mm",
"ZCenter:=" , "0mm",
"MajorRadius:=" , "0.365028153987289mm",

3D Modeler Editor Script Commands 8-70


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"MinorRadius:=" , "0.0821854415126694mm",
"WhichAxis:=" , "Z"
],
["NAME:Attributes",
"Name:=" , "Torus1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"ShellElement:=" , False,
"ShellElementThickness:=", "0mm",
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])

VB CreateTorus <Parameters>, <Attributes>


Syntax

3D Modeler Editor Script Commands 8-71


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oEditor.CreateTorus Array("NAME:TorusParameters", "XCenter:=", "0.6mm", "YCenter:=", _


"-2mm", "ZCenter:=", "0mm", "MajorRadius:=", "0.365028153987288mm", "MinorRadius:=", _
"0.0821854415126694mm", "WhichAxis:=", "Z"), Array("NAME:Attributes", "Name:=", _
"Torus2", "Flags:=", "", "Color:=", "(143 175 143)", "Transparency:=", 0, "PartCoordin-
VB
ateSystem:=", _
Exampl- "Global", "UDMId:=", "", "MaterialValue:=", "" & Chr(34) & "copper" & Chr(34) & "",
e "SurfaceMaterialValue:=", _
"" & Chr(34) & "" & Chr(34) & "", "SolveInside:=", false, "ShellElement:=", _
false, "ShellElementThickness:=", "0mm", "IsMaterialEditable:=", true, "UseMa-
terialAppearance:=", _
false, "IsLightweight:=", false)

CreateUserDefinedModel
Creates a user-defined model.

UI Access Draw > User-Defined Model > [Model].

Name Type Description


<Parameters> Array Structured array.
Array("NAME:UserDefinedModelParameters",

Parameters <definitionArray>,
<optionsArray>,
<geometryParamsArray>,
"DllName:=", <string filepath>,

3D Modeler Editor Script Commands 8-72


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Library:=", <string>,
"Version:=", <string>
"ConnectionID:=", <string>)
<definitionArray> Array Structured array containing string "NAME:Definition".
<optionsArray> Array Structured array containing string "NAME:Options".
<geometryParamsArray> Array Structured array containing arrays for individual parameters:
Array("NAME:GeometryParameters",
Array("NAME:UDMParam",
"Name:=" , <string>,
"Value:=" , <string>,
"PropType2:=" , <integer>,
"PropFlag2:=" , <integer>))
Required UDM parameters depend on the UDM being created. To see
which properties apply to a UDM, right-click the UDM in the Project
Tree and select Properties. Then select the Parameters tab.
PropType2 can be any of the following:
l 0 – Property takes a string value.
l 1 – Property is a menu option.
l 2 – Property takes a number (integer or double).
l 3 – Property takes a value (numbers, variables, or expressions).
l 4 – Property is a file name.
l 5 – Property corresponds to a check box.
l 6 – Property specifies a 3D position.

3D Modeler Editor Script Commands 8-73


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

PropFlag2 can be any of the following:


l 0 – No flags
l 1 – Read-only
l 2 – Must be integer
l 4 – Must be real
l 8 – Hidden

PropFlag2 values can be combined. For example, a read-only prop-


erty that must be an integer would take the value 3. A hidden property
that must be real would take the value 12.
These values are further described in the User-
DefinedPrimitiveStructures.h file included with the installation
under AnsysEM[Ver-
sion]\Win64\UserDefinedPrimitives\Examples\Headers\

Return Value None.

Pytho- CreateUserDefinedModel(<Parameters>)
n Syn-
tax

oEditor.CreateUserDefinedModel(

Pytho- ["NAME:UserDefinedModelParameters",
n
["NAME:Definition"],
Exam-
ple ["NAME:Options"],
["NAME:GeometryParams",

3D Modeler Editor Script Commands 8-74


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["NAME:UDMParam",
"Name:=" , "ILD Thickness (ILD)",
"Value:=" , "0.006mm",
"PropType2:=" , 3,
"PropFlag2:=" , 4
],
["NAME:UDMParam",
"Name:=" , "Line Spacing (LS)",
"Value:=" , "0.004mm",
"PropType2:=" , 3,
"PropFlag2:=" , 4
],
["NAME:UDMParam",
"Name:=" , "Line Thickness (LT)",
"Value:=" , "0.005mm",
"PropType2:=" , 3,
"PropFlag2:=" , 4
],
["NAME:UDMParam",
"Name:=" , "Line Width (LW)",
"Value:=" , "0.004mm",

3D Modeler Editor Script Commands 8-75


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"PropType2:=" , 3,
"PropFlag2:=" , 4
],
["NAME:UDMParam",
"Name:=" , "No. of Turns (N)",
"Value:=" , "2",
"PropType2:=" , 3,
"PropFlag2:=" , 2
],
["NAME:UDMParam",
"Name:=" , "Outer Diameter (OD)",
"Value:=" , "0.15mm",
"PropType2:=" , 3,
"PropFlag2:=" , 4
],
["NAME:UDMParam",
"Name:=" , "Substrate Thickness",
"Value:=" , "0.2mm",
"PropType2:=" , 3,
"PropFlag2:=" , 4

3D Modeler Editor Script Commands 8-76


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

],
["NAME:UDMParam",
"Name:=" , "Inductor Type",
"Value:=" , "\"Square,Square,Octagonal,Circular,Square-Differential,Octagonal-
Differential,Circular-Differential\"",
"DataType:=" , "String",
"PropType2:=" , 1,
"PropFlag2:=" , 0
],
["NAME:UDMParam",
"Name:=" , "Underpass Thickness (UT)",
"Value:=" , "0.001mm",
"PropType2:=" , 3,
"PropFlag2:=" , 4
],
["NAME:UDMParam",
"Name:=" , "Via Thickness (VT)",
"Value:=" , "0.001mm",
"PropType2:=" , 3,
"PropFlag2:=" , 4
]
],

3D Modeler Editor Script Commands 8-77


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"DllName:=" , "Maxwell3D/OnDieSpiralInductor.py",
"Library:=" , "syslib",
"Version:=" , "2.0",
"ConnectionID:=" , ""
])

VB Syn- CreateUserDefinedModel <Parameters>


tax

oEditor.CreateUserDefinedModel Array("NAME:UserDefinedModelParameters", Array


("NAME:Definition"), Arra
("NAME:Options"), Array("NAME:GeometryParams", Array("NAME:UDMParam", "Name:=", _
"ILD Thickness (ILD)", "Value:=", "0.006mm", "PropType2:=", 3, "PropFlag2:=", _
4), Array("NAME:UDMParam", "Name:=", "Line Spacing (LS)", "Value:=", "0.004mm",
"PropType2:=", _
VB
3, "PropFlag2:=", 4), Array("NAME:UDMParam", "Name:=", "Line Thickness (LT)",
Exampl-
"Value:=", _
e
"0.005mm", "PropType2:=", 3, "PropFlag2:=", 4), Array("NAME:UDMParam", "Name:=", _
"Line Width (LW)", "Value:=", "0.004mm", "PropType2:=", 3, "PropFlag2:=", 4), Array
("NAME:UDMParam",
"Name:=", _
"No. of Turns (N)", "Value:=", "2", "PropType2:=", 3, "PropFlag2:=", 2), Array
("NAME:UDMParam", "Name:=",

3D Modeler Editor Script Commands 8-78


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

_
"Outer Diameter (OD)", "Value:=", "0.15mm", "PropType2:=", 3, "PropFlag2:=", 4), Array
("NAME:UDMParam",
"Name:=", _
"Substrate Thickness", "Value:=", "0.2mm", "PropType2:=", 3, "PropFlag2:=", 4), Array
("NAME:UDMParam",
"Name:=", _
"Inductor Type", "Value:=", _
"" & Chr(34) & "Square,Square,Octagonal,Circular,Square-Differential,Octagonal-" & _
"Differential,Circular-Differential" & Chr(34) & "", "DataType:=", "String",
"PropType2:=", _
1, "PropFlag2:=", 0), Array("NAME:UDMParam", "Name:=", "Underpass Thickness (UT)",
"Value:=", _
"0.001mm", "PropType2:=", 3, "PropFlag2:=", 4), Array("NAME:UDMParam", "Name:=", _
"Via Thickness (VT)", "Value:=", "0.001mm", "PropType2:=", 3, "PropFlag2:=", 4)),
"DllName:=", _
"Maxwell3D/OnDieSpiralInductor.py", "Library:=", "syslib", "Version:=", "2.0", "Con-
nectionID:=", _
"")

CreateUserDefinedPart
Creates a user-defined part.

UI Access Draw > User-Defined Primitive > [Part].

3D Modeler Editor Script Commands 8-79


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


<Parameters> Array Structured array.
Array("NAME:UserDefinedPrimitiveParameters",
"DllName:=" , <string>,
"Version:=" , <string>,
"NoOfParameters:=" , <integer>,
"Library:=" , <string>,
<paramVectorArray>)
Parameters <paramVectorArray> Array Structured array containing arrays for each pair:
Array("NAME:ParamVector",
<pair>, <pair>, <pair>,...
)
<pair> Array Structured array:
Array("NAME:Pair",
"Name:=" , <string>,
"Value:=" , <string>)
<Attributes> Array Structured array. See: AttributesArray.

Return Value None.

Python Syntax CreateUserDefinedPart(<Parameters>, <Attributes>)


Python Example oEditor.CreateUserDefinedPart(

3D Modeler Editor Script Commands 8-80


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["NAME:UserDefinedPrimitiveParameters",
"DllName:=" , "RMxprt/LapCoil.dll",
"Version:=" , "16.0",
"NoOfParameters:=" , 22,
"Library:=" , "syslib",
["NAME:ParamVector",
["NAME:Pair",
"Name:=" , "DiaGap",
"Value:=" , "100mm"
],
["NAME:Pair",
"Name:=" , "DiaYoke",
"Value:=" , "20mm"
],
["NAME:Pair",
"Name:=" , "Length",
"Value:=" , "100mm"
],
["NAME:Pair",
"Name:=" , "Skew",
"Value:=" , "0deg"

3D Modeler Editor Script Commands 8-81


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

],
["NAME:Pair",
"Name:=" , "Slots",
"Value:=" , "18"
],
["NAME:Pair",
"Name:=" , "SlotType",
"Value:=" , "1"
],
["NAME:Pair",
"Name:=" , "Hs0",
"Value:=" , "1mm"
],
["NAME:Pair",
"Name:=" , "Hs1",
"Value:=" , "1mm"
],
["NAME:Pair",
"Name:=" , "Hs2",
"Value:=" , "10mm"

3D Modeler Editor Script Commands 8-82


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

],
["NAME:Pair",
"Name:=" , "Bs0",
"Value:=" , "2.5mm"
],
["NAME:Pair",
"Name:=" , "Bs1",
"Value:=" , "8mm"
],
["NAME:Pair",
"Name:=" , "Bs2",
"Value:=" , "5mm"
],
["NAME:Pair",
"Name:=" , "Rs",
"Value:=" , "0mm"
],
["NAME:Pair",
"Name:=" , "FilletType",
"Value:=" , "0"
],

3D Modeler Editor Script Commands 8-83


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["NAME:Pair",
"Name:=" , "Layers",
"Value:=" , "2"
],
["NAME:Pair",
"Name:=" , "CoilPitch",
"Value:=" , "4"
],
["NAME:Pair",
"Name:=" , "EndExt",
"Value:=" , "5mm"
],
["NAME:Pair",
"Name:=" , "SpanExt",
"Value:=" , "25mm"
],
["NAME:Pair",
"Name:=" , "BendAngle",
"Value:=" , "0deg"
],

3D Modeler Editor Script Commands 8-84


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["NAME:Pair",
"Name:=" , "SegAngle",
"Value:=" , "10deg"
],
["NAME:Pair",
"Name:=" , "LenRegion",
"Value:=" , "200mm"
],
["NAME:Pair",
"Name:=" , "InfoCoil",
"Value:=" , "0"
]
]
],
["NAME:Attributes",
"Name:=" , "LapCoil1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",

3D Modeler Editor Script Commands 8-85


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"ShellElement:=" , False,
"ShellElementThickness:=", "0mm",
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])

VB CreateUserDefinedPart <Parameters>, <Attributes>


Syntax

oEditor.CreateUserDefinedPart Array("NAME:UserDefinedPrimitiveParameters", "DllName:=",


_
"SegmentedHelix/RectHelix.dll", "Version:=", "1.0", "NoOfParameters:=", 8, "Library:=",
_
VB
"syslib", Array("NAME:ParamVector", Array("NAME:Pair", "Name:=", "RectHeight",
Exampl-
"Value:=", _
e
"1mm"), Array("NAME:Pair", "Name:=", "RectWidth", "Value:=", "2mm"), Array("NAME:Pair",
"Name:=", _
"StartHelixRadius", "Value:=", "10mm"), Array("NAME:Pair", "Name:=", "RadiusChange",
"Value:=", _

3D Modeler Editor Script Commands 8-86


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"0mm"), Array("NAME:Pair", "Name:=", "Pitch", "Value:=", "3mm"), Array("NAME:Pair",


"Name:=", _
"Turns", "Value:=", "2"), Array("NAME:Pair", "Name:=", "SegmentsPerTurn", "Value:=", _
"36"), Array("NAME:Pair", "Name:=", "RightHanded", "Value:=", "1"))), Array("NAME:At-
tributes", "Name:=", _
"RectHelix1", "Flags:=", "", "Color:=", "(143 175 143)", "Transparency:=", 0,
"PartCoordinateSystem:=", _
"Global", "UDMId:=", "", "MaterialValue:=", "" & Chr(34) & "copper" & Chr(34) & "", "Sur-
faceMaterialValue:=", _
"" & Chr(34) & "" & Chr(34) & "", "SolveInside:=", false, "ShellElement:=", _
false, "ShellElementThickness:=", "0mm", "IsMaterialEditable:=", true, "UseMa-
terialAppearance:=", _
false, "IsLightweight:=", false)

Edit3DComponent
Edits a specified 3D component.

UI Access N/A

Name Type Description


<compName> String Component name.
<Parameters> Array Structured array.
Array("NAME:EditComponentParametersData",
Parameters
"NewComponentName:=", <string>,
"GeometryParameters:=", <string>,
"MaterialParameters:=", <string>,

3D Modeler Editor Script Commands 8-87


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"DesignParameters:=", <string>,
<ComponentMeshing>,
<Excitations>)
<ComponentMeshing> Array Structured array.
Array("NAME:Component Meshing",
"MeshAssembly:=", <boolean>)
<Excitations> Array Structured array containing array of suppressed excitations.
Array("NAME:Excitations",
"Suppressed:=", <array>)

Return Value None.

Python Syntax Edit3DComponent (<compName>, <Parameters>)


oEditor.Edit3DComponent(
"Connector1",
["NAME:EditComponentParametersData",
"NewComponentName:=", "Connector2",
Python Example
"GeometryParameters:=", "",
"MaterialParameters:=", "",
"DesignParameters:=", "",
["NAME:Component Meshing",

3D Modeler Editor Script Commands 8-88


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"MeshAssembly:=", False],
["NAME:Excitations",
"Suppressed:=", []]
]
)

VB Syntax Edit3DComponent <compName>, <Parameters>


oEditor.Edit3DComponent
"Connector1",
Array("NAME:EditComponentParametersData",
"NewComponentName:=", "Connector2",
"GeometryParameters:=", "",
"MaterialParameters:=", "",
VB Example
"DesignParameters:=", "",
Array("NAME:Component Meshing",
"MeshAssembly:=", false),
Array("NAME:Excitations",
"Suppressed:=", Array())
)

[Beta] EditNativeComponentDefinition [Maxwell]


Edit a native component definition.

3D Modeler Editor Script Commands 8-89


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access In the Project Manager, expand 3D Components, right-click on the component, and select Edit Definition.

Name Type Description


Parameters
<LinkParameters> Array Data of the 3D component.

Return Value None.

Python Syntax EditNativeComponentDefinition (<LinkParameters>)


oEditor.EditNativeComponentDefinition(
[
"NAME:EditNativeComponentDefinitionData",
"DefinitionName:=" , "LC1",
[
"NAME:GeometryDefinitionParameters",
Python Example [
"NAME:VariableOrders"
]
],
[
"NAME:DesignDefinitionParameters",
[

3D Modeler Editor Script Commands 8-90


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NAME:VariableOrders"
]
],
[
"NAME:MaterialDefinitionParameters",
[
"NAME:VariableOrders"
]
],
"NextUniqueID:=" , 0,
"MoveBackwards:=" , False,
"DatasetType:=" , "ComponentDatasetType",
[
"NAME:DatasetDefinitions"
],
[
"NAME:NativeComponentDefinitionProvider",
"Type:=" , "Layout Component",
"Unit:=" , "mm",
"Version:=" , 1.1,
"EDBDefinition:=" , "EdgeCircuitPort_Inductor1",

3D Modeler Editor Script Commands 8-91


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

[
"NAME:VariableMap"
],
"ReferenceCS:=" , "U0",
"CSToImport:=" , ["Global","U0"]
],
"ComponentName:=" , "LC1",
"Company:=" , "",
"Company URL:=" , "",
"Model Number:=" , "",
"Help URL:=" , "",
"Version:=" , "1.0",
"Notes:=" , "",
"IconType:=" , "Layout Component"
])

EditPolyline
Modifies a specified polyline. See: CreatePolyline.

UI Access N/A

3D Modeler Editor Script Commands 8-92


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Array("NAME:PolylineParameters",
"IsPolylineCovered:=", <bool>,
"IsPolylineClosed:=", <bool>,
<PolylinePointsArray>,
<PolylineSegmentsArray>)
<PolylinePointsArray> Array Array("NAME:PolylinePoints", <OnePointArray>,
<OnePointArray>, ...)
<OnePointArray> Array Array("NAME:PLPoint",
Parameters
"X:=", <value>,
"Y:=", <value>,
"Z:=", <value>))
<PolylineSegmentsArray> Array <PolylineSegmentsArray>
Array("NAME:PolylineSegments",
<OneSegmentArray>, <OneSegmentArray>, ...)
<OneSegmentArray> Array Array("NAME:PLSegment",
"SegmentType:=", <"Line", "Arc", "Spline", or
"AngularArc">,
"StartIndex:=", <value>,
"NoOfPoints:=", <value>)

Return Value None.

3D Modeler Editor Script Commands 8-93


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax EditPolyline(<SelectionsArray>, <Parameters>)


oEditor.EditPolyline(
["NAME:Selections",
"Selections:=", "Polyline1"]
["NAME:PolylineParameters",
"IsPolylineCovered:=" , True,
"IsPolylineClosed:=" , False,
["NAME:PolylinePoints",
["NAME:PLPoint",
"X:=" , "20000mm",
Python Example
"Y:=" , "-20000mm",
"Z:=" , "0mm"
],
["NAME:PLPoint",
"X:=" , "-90000mm",
"Y:=" , "20000mm",
"Z:=" , "0mm"
],
["NAME:PLPoint",

3D Modeler Editor Script Commands 8-94


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"X:=" , "10000mm",
"Y:=" , "-140000mm",
"Z:=" , "0mm"
]
],
["NAME:PolylineSegments",
["NAME:PLSegment",
"SegmentType:=" , "Line",
"StartIndex:=" , 0,
"NoOfPoints:=" , 2
],
["NAME:PLSegment",
"SegmentType:=" , "Line",
"StartIndex:=" , 1,
"NoOfPoints:=" , 2
]
],
["NAME:PolylineXSection",
"XSectionType:=" , "None",
"XSectionOrient:=" , "Auto",
"XSectionWidth:=" , "0mm",

3D Modeler Editor Script Commands 8-95


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"XSectionTopWidth:=" , "0mm",
"XSectionHeight:=" , "0mm",
"XSectionNumSegments:=" , "0",
"XSectionBendType:=" , "Corner"
]]
)

VB EditPolyline <SelectionsArray>, <Parameters>


Syn-
tax

oEditor.EditPolyline Array("NAME:Selections", "Selections:=", "Polyline1") Array


("NAME:PolylineParameters", "IsPolylineCovered:=", true, "IsPolylineClosed:=", _
false, Array("NAME:PolylinePoints", Array("NAME:PLPoint", "X:=", "40000mm", "Y:=", _
"50000mm", "Z:=", "0mm"), Array("NAME:PLPoint", "X:=", "-150000mm", "Y:=", "-50000mm",
"Z:=", _

VB
"0mm")), Array("NAME:PolylineSegments", Array("NAME:PLSegment", "SegmentType:=", "Line",
Exa- "StartIndex:=", _
mple 0, "NoOfPoints:=", 2)), Array("NAME:PolylineXSection", "XSectionType:=", "None", "XSec-
tionOrient:=", _
"Auto", "XSectionWidth:=", "0mm", "XSectionTopWidth:=", "0mm", "XSectionHeight:=", _
"0mm", "XSectionNumSegments:=", "0", "XSectionBendType:=", "Corner")), Array("NAME:At-
tributes", "Name:=", _
"Polyline2", "Flags:=", "", "Color:=", "(143 175 143)", "Transparency:=", 0, "PartCoordin-

3D Modeler Editor Script Commands 8-96


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

ateSystem:=", _
"Global", "UDMId:=", "", "MaterialValue:=", "" & Chr(34) & "copper" & Chr(34) & "", "Sur-
faceMaterialValue:=", _
"" & Chr(34) & "" & Chr(34) & "", "SolveInside:=", false, "ShellElement:=", _
false, "ShellElementThickness:=", "0mm", "IsMaterialEditable:=", true, "UseMa-
terialAppearance:=", _
false, "IsLightweight:=", false)

Get3DComponentParameters
Returns parameters for a specified 3D component.

UI Access N/A

Name Type Description


Parameters
<compName> String 3D component name.

Return Value Array containing component parameters.

Python Syntax Get3DComponentParameters(<compName>)


Python Example oEditor.Get3DComponentParameters('Connector')

VB Syntax Get3DComponentParameters <compName>


VB Example oEditor.Get3DComponentParameters "Connector"

Get3DComponentDefinitionNames
Gets names of 3D component definitions.

3D Modeler Editor Script Commands 8-97


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access N/A
Parameters None.
Return Value Array of strings containing component definition names.

Python Syntax Get3DComponentDefinitionNames()


Python Example oEditor.Get3DComponentDefinitionNames()

VB Syntax Get3DComponentDefinitionNames()
Dim defNames
VB Example
defNames = oEditor.Get3DComponentDefinitionNames()

Get3DComponentInstanceNames
Returns instance names of 3D component definitions.

UI Access N/A

Name Type Description


Parameters
<DefinitionName> String Definition name.

Return Value Array containing instance names.

Python Syntax Get3DComponentInstanceNames(<DefinitionName>)

3D Modeler Editor Script Commands 8-98


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Example oEditor.Get3DComponentInstanceNames("Connector")

VB Syntax Get3DComponentInstanceNames <DefinitionName>


VB Example oEditor.Get3DComponentInstanceNames "Connector"

Get3DComponentMaterialNames
Returns material names for a specified *.a3dcomp format 3D component.

UI Access N/A

Name Type Description


Parameters
<InstanceName> String Component instance name.

Return Value Array containing material names.

Python Syntax Get3DComponentMaterialNames(<InstanceName>)


Python Example oEditor.Get3DComponentMaterialNames("Connector1.a3dcomp")

VB Syntax Get3DComponentMaterialNames <InstanceName>


VB Example oEditor.Get3DComponentMaterialNames "Connector1.a3dcomp"

Get3DComponentMaterialProperties
Returns material properties for a specified 3D component.

UI Access N/A

3D Modeler Editor Script Commands 8-99


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


Parameters
<MaterialName> String Material name.

Return Value Array containing material properties.

Python Syntax Get3DComponentMaterialProperties(<MaterialName>)


Python Example oEditor.Get3DComponentMaterialProperties('Connector1:Material01')

VB Syntax Get3DComponentMaterialProperties <MaterialName>


VB Example oEditor.Get3DComponentMaterialProperties "Connector1:Material01"

Insert3DComponent
Inserts a 3D component.

UI Access Draw > 3D Component Library > Browse > [Component].

Name Type Description


<ComponentData> Array Structured array.
Array("NAME:InsertComponentData",
Parameters
"Parameters:=", <string>,
"TargetCS:=", <string>,
"ComponentFile:=", <string filepath>)

3D Modeler Editor Script Commands 8-100


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value None.

Python Syntax Insert3DComponent(<ComponentData>)


oEditor.Insert3DComponent(
["NAME:InsertComponentData",
Python Example "Parameters:=", "",
"TargetCS:=", "Global",
"ComponentFile:=", "C:\tmp\Connector.a3dcomp"])

VB Syntax Insert3DComponent <ComponentData>


oEditor.Insert3DComponent
Array("NAME:InsertComponentData",
VB Example "Parameters:=", "",
"TargetCS:=", "Global",
"ComponentFile:=", "C:\tmp\Connector.a3dcomp")

InsertNativeComponent [Layout Component to Maxwell with CS]


Inserts a Layout Component to Maxwell 3D with custom coordinate system definitions.

UI Access Create Layout Component ...

Name Type Description


Parameters
<LinkParameters> Array Structured array containing data of inserted layout component.

3D Modeler Editor Script Commands 8-101


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value None.

Python Syntax InsertNativeComponent (<LinkedParameters>)


Python oEditor.InsertNativeComponent(
Example
[
"NAME:InsertNativeComponentData",
"TargetCS:=" , "Global",
"SubmodelDefinitionName:=", "LC1",
[
"NAME:ComponentPriorityLists"
],
"NextUniqueID:=" , 0,
"MoveBackwards:=" , False,
"DatasetType:=" , "ComponentDatasetType",
[
"NAME:DatasetDefinitions"
],
[
"NAME:BasicComponentInfo",

3D Modeler Editor Script Commands 8-102


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ComponentName:=" , "LC1",
"Company:=" , "",
"Company URL:=" , "",
"Model Number:=" , "",
"Help URL:=" , "",
"Version:=" , "1.0",
"Notes:=" , "",
"IconType:=" , "Layout Component"
],
[
"NAME:GeometryDefinitionParameters",
[
"NAME:VariableOrders"
]
],
[
"NAME:DesignDefinitionParameters",
[
"NAME:VariableOrders"
]
],

3D Modeler Editor Script Commands 8-103


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

[
"NAME:MaterialDefinitionParameters",
[
"NAME:VariableOrders"
]
],
"DefReferenceCSID:=" , 1,
"MapInstanceParameters:=", "DesignVariable",
"UniqueDefinitionIdentifier:=", "27e7d8f5-da68-409b-8c4d-bf2bc6d95f69",
"OriginFilePath:=" , "",
"IsLocal:=" , False,
"ChecksumString:=" , "",
"ChecksumHistory:=" , [],
"VersionHistory:=" , [],
[
"NAME:NativeComponentDefinitionProvider",
"Type:=" , "Layout Component",
"Unit:=" , "mm",
"EDBDefinition:=" , "EdgeCircuitPort_Inductor1",
[

3D Modeler Editor Script Commands 8-104


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NAME:VariableMap"
],
"ReferenceCS:=" , "Global",
"CSToImport:=" , ["Global","U0"]
],
[
"NAME:InstanceParameters",
"GeometryParameters:=" , "",
"MaterialParameters:=" , "",
"DesignParameters:=" , ""
]
])

InsertPolylineSegment
Insets a polyline segment before or after a specified existing segment.

UI Access Draw > Line Segment > [Selection].

Name Type Description


<Parameters> Array Structured array.

Parameters Array("NAME:Insert Polyline Segment",


"Selections:=" , <string>,
"Segment Indices:=" , <array containing

3D Modeler Editor Script Commands 8-105


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

integers>,
"At Start:=" , <boolean>,
"SegmentType:=" , <string "Line", "Arc",
"Spline", or "AngularArc">,
<PolylinePointsArray>
<PolylinePointsArray> Array Structured array. See: CreatePolyline.

Return Value None.

Python Syntax InsertPolylineSegment(<Parameters>)


oEditor.InsertPolylineSegment(
["NAME:Insert Polyline Segment",
"Selections:=" , "Polyline1:CreatePolyline:1",
"Segment Indices:=" , [0],
"At Start:=" , True,
Python Example "SegmentType:=" , "Line",
["NAME:PolylinePoints",
["NAME:PLPoint",
"X:=" , "1.1mm",
"Y:=" , "0.8mm",
"Z:=" , "0mm"

3D Modeler Editor Script Commands 8-106


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

],
["NAME:PLPoint",
"X:=" , "0.6mm",
"Y:=" , "-0.8mm",
"Z:=" , "0mm"
]
]
])

VB Syn- InsertPolylineSegment <Parameters>


tax

oEditor.InsertPolylineSegment Array("NAME:Insert Polyline Segment", "Selections:=", _


"Polyline1:CreatePolyline:1", "Segment Indices:=", Array(1), "At Start:=", _
false, "SegmentType:=", "Spline", Array("NAME:PolylinePoints", Array("NAME:PLPoint",
"X:=", _
VB
Example "-1.4mm", "Y:=", "0.4mm", "Z:=", "0mm"), Array("NAME:PLPoint", "X:=", "0.5mm", "Y:=",
_
"1.1mm", "Z:=", "0mm"), Array("NAME:PLPoint", "X:=", "0.7mm", "Y:=", "-2.1mm", "Z:=",
_
"0mm"), Array("NAME:PLPoint", "X:=", "0.4mm", "Y:=", "-1.1mm", "Z:=", "0mm")))

SweepAlongPath
Sweeps the specified 1D or 2D parts along a path. The last 1D object specified is the path for the sweep.

3D Modeler Editor Script Commands 8-107


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access Draw > Sweep > Along Path.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<PathSweepParametersArray> Array Array("NAME:PathSweepParameters",
"DraftAngle:=", <value>,

Parameters "DraftType:=", <string>,


"CheckFaceFaceIntersection:=", <bool>,
"TwistAngle:=", <value>)
Possible values for DraftType are "Extended", "Round", and "Nat-
ural".

Return Value None.

Python Syntax SweepAlongPath(<SelectionsArray>, <PathSweepParametersArray>)


oEditor.SweepAlongPath(
[
"NAME:Selections",
Python Example "Selections:=" , "Rectangle1,Polyline1",
"NewPartsModelFlag:=" , "Model"
],
[

3D Modeler Editor Script Commands 8-108


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NAME:PathSweepParameters",
"DraftAngle:=" , "0deg",
"DraftType:=" , "Round",
"CheckFaceFaceIntersection:=", False,
"TwistAngle:=" , "0deg"
])

VB Syntax SweepAlongPath <SelectionsArray>, <PathSweepParametersArray>


oEditor.SweepAlongPath
Array("NAME:Selections", "Selections:=",
"Polygon1,Polyline1"),_
Array("NAME:PathSweepParameters", _
VB Example
"DraftAngle:=", "0deg",_
"DraftType:=", "Round",_
"CheckFaceFaceIntersection:=", False,_
"TwistAngle:=", "30deg")

SweepAlongVector
Sweeps the specified 1D or 2D parts along a vector.

UI Access Draw > Sweep > Along Vector.

3D Modeler Editor Script Commands 8-109


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<VecSweepParametersArray> Array Array("NAME:VectorSweepParameters",
"DraftAngle:=", <value>,
"DraftType:=", <string>,

Parameters "CheckFaceFaceIntersection:=", <bool>,


"SweepVectorX:=", <value>
"SweepVectorY:=", <value>
"SweepVectorZ:=", <value>)
Possible values for DraftType are "Extended", "Round", and "Nat-
ural".

Return Value None.

Python Syntax SweepAlongVector(<SelectionsArray>, <VecSweepParametersArray>)


oEditor.SweepAlongVector(
[
"NAME:Selections",
Python Example
"Selections:=" , "Rectangle1",
"NewPartsModelFlag:=" , "Model"
],

3D Modeler Editor Script Commands 8-110


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

[
"NAME:VectorSweepParameters",
"DraftAngle:=" , "0deg",
"DraftType:=" , "Round",
"CheckFaceFaceIntersection:=", False,
"SweepVectorX:=" , "0mm"
"SweepVectorY:=" , "0mm"
"SweepVectorX:=" , "12mm"
])

VB Syntax SweepAlongVector <SelectionsArray>, <VecSweepParametersArray>


oEditor.SweepAlongPath
Array("NAME:Selections",_
"Selections:=", "Rectangle1",_
"NewPartsModelFlag:=" , "Model")
Array("NAME:VectorSweepParameters", _
VB Example
"DraftAngle:=", "0deg",_
"DraftType:=", "Round",_
"CheckFaceFaceIntersection:=", False,_
"SweepVectorX:=" , "0mm",_
"SweepVectorY:=" , "0mm",_

3D Modeler Editor Script Commands 8-111


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"SweepVectorZ:=" , "12mm")

SweepAroundAxis
Sweeps the specified 1D or 2D parts around an axis.

UI Access Draw > Sweep > Around Axis.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<AxisSweepParametersArray> Array Array("NAME:AxisSweepParameters",
"DraftAngle:=", <value>,
"DraftType:=", <string>,
"CheckFaceFaceIntersection:=", <bool>,
Parameters
"SweepAxis:=", <value>
"SweepAngle:=", <value>
"NumOfSegments:=", <value>)
Possible values for DraftType are "Extended", "Round", and "Nat-
ural".
Possible values for SweepAxis are "X", "Y", and "Z".

Return Value None.

Python Syntax SweepAroundAxis(<SelectionsArray>, <AxisSweepParametersArray>)


Python Example oEditor.SweepAroundAxis(

3D Modeler Editor Script Commands 8-112


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

[
"NAME:Selections",
"Selections:=" , "Rectangle1",
"NewPartsModelFlag:=" , "Model"
],
[
"NAME:AxisSweepParameters",
"DraftAngle:=" , "0deg",
"DraftType:=" , "Round",
"CheckFaceFaceIntersection:=", False,
"SweepAxis:=" , "X"
"SweepAngle:=" , "360deg"
"NumOfSegments:=" , "12"
])

VB Syntax SweepAroundAxis <SelectionsArray>, <AxisSweepParametersArray>


oEditor.SweepAroundAxis
Array("NAME:Selections",_
VB Example "Selections:=", "Rectangle1",_
"NewPartsModelFlag:=" , "Model")
Array("NAME:AxisSweepParameters", _

3D Modeler Editor Script Commands 8-113


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"DraftAngle:=", "0deg",_
"DraftType:=", "Round",_
"CheckFaceFaceIntersection:=", False,_
"SweepAxis:=" , "X",_
"SweepAngle:=" , "360deg",_
"NumOfSegments:=" , "12")

SweepFacesAlongNormal
Sweep the specified face(s) along normal.

UI Access Modeler > Surface > Sweep Faces Along Normal

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<parameters> Array Structured array.
Array("NAME:Parameters",
Parameters
"NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=", <faceIDarray>,
"LengthOfSweep:=", "<value><units>")

Return Value None

Python Syntax SweepFacesAlongNormal(<SelectionsArray> <parameters>)

3D Modeler Editor Script Commands 8-114


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oEditor.SweepFacesAlongNormal(
["NAME:Selections",
"Selections:=", "Rectangle1",
"NewPartsModelFlag:=", "Model"],
Python Example ["NAME:Parameters",
"NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=", [183],
"LengthOfSweep:=", "0.1mm"])

VB Syntax SweepFacesAlongNormal <SelectionsArray> <parameters>


oEditor.SweepFacesAlongNormal
Array("NAME:Selections",
"Selections:=", "Rectangle1",
"NewPartsModelFlag:=", "Model"),
VB Example Array("NAME:Parameters",
"NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=", Array(57),
"LengthOfSweep:=", "0.5mm")
)

3D Modeler Editor Script Commands 8-115


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

SweepFacesAlongNormalWithAttributes
Sweep a face along normal, and specify attributes of the new object.

UI Access Modeler > Surface > Sweep Faces Along Normal

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<parameters> Array Array("NAME:Parameters",

Parameters "NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=", <faceIDarray>,
"LengthOfSweep:=", "<value><units>")
<AttributesArray> Array Structured array. See: AttributesArray.

Return Value None

Python Syntax SweepFacesAlongNormalWithAttributes(<SelectionsArray>, <parameters>, <AttributesArray>)


oEditor.SweepFacesAlongNormalWithAttributes(
["NAME:Selections",
"Selections:=", "Rectangle1",
Python Example "NewPartsModelFlag:=", "Model"],
["NAME:Parameters",
"NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=", [183],

3D Modeler Editor Script Commands 8-116


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"LengthOfSweep:=", "0.1mm"],
["NAME:Attributes",
"Name:=", "Box3",
"Flags:=", "",
"Color:=", "(143 175 143)",
"Transparency:=", 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=", "",
"MaterialValue:=", "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=", False,
"ShellElement:=", False,
"ShellElementThickness:=", "0mm",
"IsMaterialEditable:=", True,
"UseMaterialAppearance:=", False,
"IsLightweight:=", False])

VB Syntax SweepFacesAlongNormalWithAttributes <SelectionsArray>, <parameters>, <AttributesArray>


oEditor.SweepFacesAlongNormalWithAttributes
VB Example
Array("NAME:Selections",

3D Modeler Editor Script Commands 8-117


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Selections:=", "Rectangle1",
"NewPartsModelFlag:=", "Model"),
Array("NAME:Parameters",
"NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=", Array(57),
"LengthOfSweep:=", "0.5mm"),
Array("NAME:Attributes",
"Name:=" , "Box3",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , false,
"ShellElement:=" , false,
"ShellElementThickness:=", "0mm",
"IsMaterialEditable:=" , true,
"UseMaterialAppearance:=", false,

3D Modeler Editor Script Commands 8-118


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"IsLightweight:=" , false)
)

UpdateComponentDefinition
Updates a 3D component's definition.

UI Access Draw > 3D Component Library > Definitions.

Name Type Description


<data> Array Structured array.

Parameters Array("NAME:UpdateDefinitionData",
"DefinitionNames:=", <string>,
"Passwords:=", <array of strings>)

Return Value None.

Python Syntax UpdateComponentDefinition(<data>)


oEditor.UpdateComponentDefinition(
['NAME:UpdateDefinitionData',
'DefinitionNames:=', 'Connector, Magic_Tee',
Python Example
'Passwords:=', ['','']
]
)

VB Syntax UpdateComponentDefinition <data>

3D Modeler Editor Script Commands 8-119


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oEditor.UpdateComponentDefinition
Array("NAME:UpdateDefinitionData",
VB Example
"DefinitionNames:=", " Connector, Magic_Tee",
"Passwords:=", Array("", ""))

Edit Menu Commands


Copy
DeletePolylinePoint
DuplicateAlongLine
DuplicateAroundAxis
DuplicateMirror
Mirror
Move
OffsetFaces
Paste
Rotate
Scale
Copy
Copies specified part(s) to the clipboard.

UI Access N/A

3D Modeler Editor Script Commands 8-120


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

Python Syntax Copy(<SelectionsArray>)


oEditor.Copy([
Python Example "NAME:Selections",
"Selections:=", "Box1"])

VB Syntax Copy <SelectionsArray>


oEditor.Copy Array(
VB Example "NAME:Selections",
"Selections:=", "Box1")

DeletePolylinePoint
Deletes either a start point or an end point from an existing polyline segment.

UI Access Edit > Delete [Start/End] Point

Name Type Description


<DeletePointArray> Array Structured array.
Parameters Array("NAME:Delete Point",
"Selections:=", <string
"<PolylineName>:<PolylineAction>:<int>">,

3D Modeler Editor Script Commands 8-121


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Segment Index:=", <integer>,


"At Start:=", <bool True for start point; False
for end point>)

Return Value None.

Python Syntax DeletePolylinePoint (<DeletePointArray>)


oEditor.DeletePolylinePoint(["NAME:Delete Point",
"Selections:=", "Polyline1:CreatePolyline:1",
Python Example
"Segment Index:=", 1,
"At Start:=", True])

VB Syn- DeletePolylinePoint <DeletePointArray>


tax

oEditor.DeletePolylinePoint Array("NAME:Delete Point", "Selections:=",


VB "Polyline1:CreatePolyline:1",
Example
"Segment Index:=", 1, "At Start:=", True)

DuplicateAlongLine
Duplicates specified parts along a line.

UI Access Edit > Duplicate > Along Line.

Parameters Name Type Description

3D Modeler Editor Script Commands 8-122


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<SelectionsArray> Array Structured array.


Array("NAME:Selections",
"Selections:=" , <string>,
"NewPartsModelFlag:=" , <string>)
<ParametersArray> Array Structured array.
Array("NAME:DuplicateToAlongLineParameters",
"CreateNewObjects:=" , <boolean>,
"XComponent:=" , <string>,
"YComponent:=" , <string>,
"ZComponent:=" , <string>,
"NumClones:=" , <string containing number greater
than 1>)
<OptionsArray> Array Structured array.
Array("NAME:Options",
"DuplicateAssignments:=", <boolean>)
<CreateGroup> Array Optional. Structured array.
Array("CreateGroupsForNewObjects:=", <boolean>)

Return Value None.

Python Syntax DuplicateAlongLine (<SelectionsArray>, <ParametersArray>, <OptionsArray>, <CreateGroup>)


oEditor.DuplicateAlongLine(
Python Example
["NAME:Selections",

3D Modeler Editor Script Commands 8-123


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Selections:=" , "Box1",
"NewPartsModelFlag:=" , "Model"
],
["NAME:DuplicateToAlongLineParameters",
"CreateNewObjects:=" , False,
"XComponent:=" , "1mm",
"YComponent:=" , "-0.7mm",
"ZComponent:=" , "0mm",
"NumClones:=" , "2"
],
["NAME:Options",
"DuplicateAssignments:=", False
],
["CreateGroupsForNewObjects:=", False
])

VB Syntax DuplicateAlongLine <SelectionsArray>, <ParametersArray>, <OptionsArray>, <CreateGroup>


oEditor.DuplicateAlongLine
VB Example
Array( "NAME:Selections",

3D Modeler Editor Script Commands 8-124


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Selections:=", "Box1",
"NewPartsModelFlag:=", "Model")
Array( "NAME:DuplicateToAlongLineParameters",
"CreateNewObjects:=", false,
"XComponent:=", "1mm",
"YComponent:=", "-0.7mm",
"ZComponent:=", "0mm",
"NumClones:=", "2")
Array( "NAME:Options",
"DuplicateAssignments:=", false)
Array( "CreateGroupsForNewObjects:=", false)

DuplicateAroundAxis
Duplicates specified parts around an axis.

UI Access Edit > Duplicate > Around Axis.

Name Type Description


<SelectionsArray> Array Structured array.
Array("NAME:Selections",
Parameters "Selections:=" , <string>,
"NewPartsModelFlag:=" , <string>)
<ParametersArray> Array Structured array.
Array("NAME:DuplicateAroundAxisParameters",

3D Modeler Editor Script Commands 8-125


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"CreateNewObjects:=" , <boolean>,
"WhichAxis:=" , <string>,
"AngleStr:=" , <string>,
"NumClones:=" , <string containing number greater
than 1>)
<OptionsArray> Array Structured array.
Array("NAME:Options",
"DuplicateAssignments:=", <boolean>)
<CreateGroup> Array Optional. Structured array.
Array("CreateGroupsForNewObjects:=", <boolean>)

Return Value None.

Python Syntax DuplicateAroundAxis (<SelectionsArray>, <ParametersArray>, <OptionsArray>, <CreateGroup>)


oEditor.DuplicateAroundAxis(
["NAME:Selections",
"Selections:=" , "Box1",
Python Example "NewPartsModelFlag:=" , "Model"
],
["NAME:DuplicateAroundAxisParameters",
"CreateNewObjects:=" , True,

3D Modeler Editor Script Commands 8-126


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"WhichAxis:=" , "Z",
"AngleStr:=" , "90deg",
"NumClones:=" , "2"
],
["NAME:Options",
"DuplicateAssignments:=", False
],
["CreateGroupsForNewObjects:=", False
])

VB Syntax DuplicateAroundAxis <SelectionsArray>, <ParametersArray>, <OptionsArray>, <CreateGroup>


oEditor.DuplicateAroundAxis
Array("NAME:Selections",
"Selections:=", "Box1",
"NewPartsModelFlag:=", "Model")
Array("NAME:DuplicateAroundAxisParameters",
VB Example
"CreateNewObjects:=", true,
"WhichAxis:=", "Z",
"AngleStr:=", "90deg",
"NumClones:=", "2")
Array("NAME:Options",

3D Modeler Editor Script Commands 8-127


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"DuplicateAssignments:=", false)
Array("CreateGroupsForNewObjects:=", false)

DuplicateMirror
Duplicates specified parts according to a mirror plane.

UI Access Edit > Duplicate > Mirror.

Name Type Description


<SelectionsArray> Array Structured array.
Array("NAME:Selections",
"Selections:=" , <string>,
"NewPartsModelFlag:=" , <string>)
<ParametersArray> Array Structured array.
Array("NAME:DuplicateToMirrorParameters",

Parameters "DuplicateMirrorBaseX:=", <string>,


"DuplicateMirrorBaseY:=", <string>,
"DuplicateMirrorNormalX:=", <string>,
"DuplicateMirrorNormalY:=", <string>,
"DuplicateMirrorNormalZ:=", <string>)
For Maxwell 2D XY designs, Z parameters should be set to "0".
For Maxwell 2D RZ designs, Y parameters should be set to "0".
<OptionsArray> Array Structured array.

3D Modeler Editor Script Commands 8-128


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:Options",
"DuplicateAssignments:=", <boolean>)
<CreateGroup> Array Optional. Structured array.
Array("CreateGroupsForNewObjects:=", <boolean>)

Return Value None.

Python Syntax DuplicateMirror (<SelectionsArray>, <ParametersArray>, <OptionsArray>, <CreateGroup>)


oEditor.DuplicateMirror(
["NAME:Selections",
"Selections:=" , "Box1",
"NewPartsModelFlag:=" , "Model"
],
["NAME:DuplicateToMirrorParameters",
"DuplicateMirrorBaseX:=", "-0.4mm",
Python Example
"DuplicateMirrorBaseY:=", "-1.2mm",
"DuplicateMirrorBaseZ:=", "0mm",
"DuplicateMirrorNormalX:=", "0.124034734589208mm",
"DuplicateMirrorNormalY:=", "0.992277876713668mm",
"DuplicateMirrorNormalZ:=", "0mm"
],
["NAME:Options",

3D Modeler Editor Script Commands 8-129


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"DuplicateAssignments:=", False
],
["CreateGroupsForNewObjects:=", False
])

VB Syntax DuplicateMirror <SelectionsArray>, <ParametersArray>, <OptionsArray>, <CreateGroup>


oEditor.DuplicateMirror
Array("NAME:Selections",
"Selections:=", "Box1",
"NewPartsModelFlag:=", "Model)
Array("NAME:DuplicateToMirrorParameters",
"DuplicateMirrorBaseX:=", "-0.4mm",
VB Example "DuplicateMirrorBaseY:=", "-1.2mm",
"DuplicateMirrorBaseZ:=", "0mm",
"DuplicateMirrorNormalX:=", "0.124034734589208mm",
"DuplicateMirrorNormalY:=", "0.992277876713668mm",
"DuplicateMirrorNormalZ:=", "0mm")
Array("NAME:Options",
"DuplicateAssignments:=", false)

3D Modeler Editor Script Commands 8-130


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("CreateGroupsForNewObjects:=", false)

Mirror
Mirrors specified part(s).

UI Access Edit > Arrange > Mirror.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<MirrorParameters> Array Structured array.
Array("NAME:MirrorParameters",
"MirrorBaseX:=" , <string>,
Parameters "MirrorBaseY:=" , <string>,
"MirrorBaseZ:=" , <string>,
"MirrorNormalX:=" , <string>,
"MirrorNormalY:=" , <string>,
"MirrorNormalZ:=" , <string>)

Return Value None.

Python Syntax Mirror(<SelectionsArray>, <MirrorParameters>)


oEditor.Mirror(
["NAME:Selections",
Python Example
"Selections:=" , "Box1_1",
"NewPartsModelFlag:=" , "Model"

3D Modeler Editor Script Commands 8-131


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

],
["NAME:MirrorParameters",
"MirrorBaseX:=" , "-0.2mm",
"MirrorBaseY:=" , "-1.2mm",
"MirrorBaseZ:=" , "0mm",
"MirrorNormalX:=" , "-0.316227766016838mm",
"MirrorNormalY:=" , "0.948683298050514mm",
"MirrorNormalZ:=" , "0mm"
])

VB Syntax Mirror <SelectionsArray> <MirrorParameters>


oEditor.Mirror
Array("NAME:Selections",
"Selections:=", "Box1_1",
"NewPartsModelFlag:=", "Model")
VB Example Array("NAME:MirrorParameters",
"MirrorBaseX:=", "-0.2mm",
"MirrorBaseY:=", "-1.2mm",
"MirrorBaseZ:=", "0mm",
"MirrorNormalX:=", "-0.316227766016838mm",

3D Modeler Editor Script Commands 8-132


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"MirrorNormalY:=", "0.948683298050514mm",
"MirrorNormalZ:=", "0mm")

Move
Moves specified part(s).

UI Access Edit > Arrange > Move.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<TranslateParameters> Array Structured array.
Array(["NAME:TranslateParameters",
"TranslateVectorX:=" , <string>,
Parameters
"TranslateVectorY:=" , <string>,
"TranslateVectorZ:=" , <string>)
For Maxwell 2D XY designs, "TranslateVectorZ:=" should be set to "0".
For Maxwell 2D RZ designs, "TranslateVectorY:=" should be set to "0".

Return Value None.

Python Syntax Move(<SelectionsArray>, <TranslateParameters>)


oEditor.Move(
Python Example ["NAME:Selections",
"Selections:=" , "Box1_1",

3D Modeler Editor Script Commands 8-133


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NewPartsModelFlag:=" , "Model"
],
["NAME:TranslateParameters",
"TranslateVectorX:=" , "-0.5mm",
"TranslateVectorY:=" , "0.1mm",
"TranslateVectorZ:=" , "0mm"
])

VB Syntax Move <SelectionsArray> <TranslateParameters>


oEditor.Move
Array("NAME:Selections",
"Selections:=", "Box1_1",
"NewPartsModelFlag:=", "Model")
VB Example
Array("NAME:TranslateParameters",
"TranslateVectorX:=", "-0.5mm",
"TranslateVectorY:=", "0.1mm",
"TranslateVectorZ:=", "0mm")

OffsetFaces
Offsets the faces of selected part(s).

3D Modeler Editor Script Commands 8-134


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access Edit > Arrange > Offset.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<OffsetParameters> Array Structured array.
Parameters
Array("NAME:OffsetParameters",
"OffsetDistance:=" , <string>)

Return Value None.

Python Syntax OffsetFaces (<SelectionsArray>, <OffsetParameters>)


oEditor.OffsetFaces(
["NAME:Selections",
"Selections:=", "Box1_1",
"NewPartsModelFlag:=", "Model"
Python Example
],
["NAME:OffsetParameters",
"OffsetDistance:=", "16mm"
])

VB Syntax OffsetFaces <SelectionsArray> <OffsetParameters>


oEditor.OffsetFaces
VB Example
Array("NAME:Selections",

3D Modeler Editor Script Commands 8-135


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Selections:=", "Box1_1",
"NewPartsModelFlag:=", "Model")
Array("NAME:OffsetParameters",
"OffsetDistance:=", "16mm")

Paste (Model Editor)


Pastes previously copied object(s). See: Copy.

UI Access Edit > Paste.


Parameters None.
Return Value None.

Python Syntax Paste()


oEditor.Copy(
["NAME:Selections",
Python Example "Selections:=" , "Box1_2"
])
oEditor.Paste()

VB Syntax Paste
VB Example oEditor.Copy Array("NAME:Selections", "Selections:=" , "Box1_2")

3D Modeler Editor Script Commands 8-136


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oEditor.Paste

Rotate
Rotates specified object(s).

UI Access Edit > Arrange > Rotate.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<RotateParameters> Array Structured array.
Array("NAME:RotateParameters",
Parameters "RotateAxis:=" , <string "X", "Y", or "Z">,
"RotateAngle:=" , <string>)
For Maxwell 2D XY Designs, "RotateAxis:=" should be set to "Z".
For Maxwell 2D RZ Designs, "RotateAxis:=" should be set to "Y".

Return Value None.

Python Syntax Rotate(<SelectionsArray>, <RotateParameters>)


oEditor.Rotate(
["NAME:Selections",
"Selections:=", "Box1_1",
Python Example
"NewPartsModelFlag:=", "Model"
],
["NAME:RotateParameters",

3D Modeler Editor Script Commands 8-137


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"RotateAxis:=", "Z",
"RotateAngle:=", "90deg"
])

VB Syntax Rotate <SelectionsArray> <RotateParameters>


oEditor.Rotate
Array("NAME:Selections",
"Selections:=", "Box1_1",
VB Example "NewPartsModelFlag:=", "Model")
Array("NAME:RotateParameters",
"RotateAxis:=", "Z",
"RotateAngle:=", "90deg")

Scale
Scales specified object(s).

UI Access Edit > Scale.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<ScaleParameters> Array Structured array.
Parameters
Array("NAME:ScaleParameters",
"ScaleX:=" , <string containing scale factor>,

3D Modeler Editor Script Commands 8-138


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ScaleY:=" , <string containing scale factor>,


"ScaleZ:=" , <string containing scale factor>)
For Maxwell 2D XY Designs, "ScaleZ:=" should be set to "0".
For Maxwell 2D RZ Designs, "ScaleY:=" should be set to "0".

Return Value None.

Python Syntax Scale (<SelectionsArray>, <ScaleParameters>)


oEditor.Scale(
["NAME:Selections",
"Selections:=", "Box1",
"NewPartsModelFlag:=", "Model"
],
Python Example
["NAME:ScaleParameters",
"ScaleX:=", "2",
"ScaleY:=", "2",
"ScaleZ:=", "2"
])

VB Syntax Scale <SelectionsArray> <ScaleParameters>


oEditor.Scale
VB Example
Array("NAME:Selections",

3D Modeler Editor Script Commands 8-139


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Selections:=", "Box1",
"NewPartsModelFlag:=", "Model")
Array("NAME:ScaleParameters",
"ScaleX:=", "2",
"ScaleY:=", "2",
"ScaleZ:=", "2")

Modeler Menu Commands


AssignMaterial
Chamfer
Connect
CoverLines
CoverSurfaces
CreateEntityList
CreateFaceCS
CreateGroup
CreateObjectCS
CreateObjectFromEdges
CreateObjectFromFaces
CreateRelativeCS
DeleteEmptyGroups

3D Modeler Editor Script Commands 8-140


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

DeleteLastOperation
DetachFaces
EditEntityList
EditFaceCS
EditObjectCS
EditRelativeCS
Export
ExportModelImageToFile
ExportModelMeshToFile
Fillet
FlattenGroup
Generate History
GetActiveCoordinateSystem
GetCoordinateSystems
HealObject
Import
ImportDXF
ImportGDSII [Modeler]
Intersect
MoveCStoEnd
MoveEntityToGroup

3D Modeler Editor Script Commands 8-141


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

MoveFaces
ProjectSheet
PurgeHistory
ReplaceWith3DComponent
Section
SeparateBody
SetModelUnits
SetWCS
ShowWindow
Split
Subtract
SweepFacesAlongNormal
ThickenSheet
UncoverFaces
Unite
Ungroup
WrapSheet
AssignMaterial
Assigns a material to specified object(s).

UI Access Modeler > Assign Material.

3D Modeler Editor Script Commands 8-142


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<AttributesArray> Array Structured array. See: AttributesArray.
This script supports the following attributes:
l MaterialValue

Parameters l SolveInside
l ShellElement
l ShellElementThickness
l IsMaterialEditable
l UseMaterialAppearance
l IsLightweight

Return Value None.

Python Syntax AssignMaterial(<SelectionsArray>, <AttributesArray>)

3D Modeler Editor Script Commands 8-143


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oEditor.AssignMaterial(
["NAME:Selections",
"AllowRegionDependentPartSelectionForPMLCreation:=", True,
"AllowRegionSelectionForPMLCreation:=", True,
"Selections:=" , "Box1"
],
["NAME:Attributes",
Python Example "MaterialValue:=" , "diamond",
"SolveInside:=" , False,
"ShellElement:=" , False,
"ShellElementThickness:=" , "nan",
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=" , False,
"IsLightweight:=" , False
])

VB Syntax AssignMaterial <SelectionsArray> <AttributesArray>

3D Modeler Editor Script Commands 8-144


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oEditor.AssignMaterial
Array("NAME:Selections",
"AllowRegionDependentPartSelectionForPMLCreation:=", true,
"AllowRegionSelectionForPMLCreation:=", true,
"Selections:=" , "Box1")
Array("NAME:Attributes",
VB Example "MaterialValue:=" , "diamond",
"SolveInside:=" , false,
"ShellElement:=" , false,
"ShellElementThickness:=" , "nan",
"IsMaterialEditable:=" , true,
"UseMaterialAppearance:=" , false,
"IsLightweight:=" , false)

Chamfer
Creates a chamfer.

UI Access Modeler > Chamfer.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Parameters
Array("NAME:Parameters",
Array("NAME:ChamferParameters",

3D Modeler Editor Script Commands 8-145


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Edges:=" , <array containing integer>,


"Vertices:=" , <array>,
"LeftDistance:=" , <string>,
"RightDistance:=" , <string>,
"ChamferType:=" , <string "Symmetric",
"Left Distance-Angle", "Right Distance-Angle", or
"Left Distance-Right Distance">)
)

Return Value None.

Python Syntax Chamfer(<SelectionsArray>, <Parameters>)


oEditor.Chamfer(
["NAME:Selections",
"Selections:=" , "Box2",
"NewPartsModelFlag:=" , "Model"
],
Python Example
["NAME:Parameters",
["NAME:ChamferParameters",
"Edges:=" , [42],
"Vertices:=" , [],
"LeftDistance:=" , "0.1mm",

3D Modeler Editor Script Commands 8-146


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"RightDistance:=" , "0.1mm",
"ChamferType:=" , "Symmetric"
]
])

VB Syntax Chamfer <SelectionsArray> <Parameters>


oEditor.Chamfer
Array("NAME:Selections",
"Selections:=" , "Box2",
"NewPartsModelFlag:=" , "Model")
Array("NAME:Parameters",
VB Example Array("NAME:ChamferParameters",
"Edges:=" , [42],
"Vertices:=" , [],
"LeftDistance:=" , "0.1mm",
"RightDistance:=" , "0.1mm",
"ChamferType:=" , "Symmetric"))

Connect
Connects two or more 1D polyline objects or 2D sheet objects.

UI Access Modeler > Surface > Connect.

3D Modeler Editor Script Commands 8-147


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

Python Syntax Connect(<SelectionsArray>)


oEditor.Connect(
Python Example ["NAME:Selections",
"Selections:=", "Polyline2,Polyline1"])

VB Syntax Connect <SelectionsArray>


oEditor.Connect Array(
VB Example "NAME:Selections",
"Selections:=", "Polyline2,Polyline1")

CoverLines
Covers two or more 1D objects to form a sheet.

UI Access Modeler > Surface > Cover Lines.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

3D Modeler Editor Script Commands 8-148


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax CoverLines(<SelectionsArray>)


oEditor.CoverLines([
"NAME:Selections",
Python Example
"Selections:=", "Polyline3,Polyline4",
"NewPartsModelFlag:=", "Model"])

VB Syntax CoverLines <SelectionsArray>


oEditor.CoverLines Array(
"NAME:Selections",
VB Example
"Selections:=", "Polyline3,Polyline4",
"NewPartsModelFlag:=", "Model")

CoverSurfaces
Covers two or more faces to form a solid object.

UI Access Modeler > Surface > Cover Faces.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

Python Syntax CoverSurfaces (<SelectionsArray>)


Python Example oEditor.CoverSurfaces(

3D Modeler Editor Script Commands 8-149


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["NAME:Selections",
"Selections:=", "Obj1_Face1,Obj2_Face2",
"NewPartsModelFlag:=", "Model"
])

VB Syntax CoverSurfaces <SelectionsArray>


oEditor.CoverSurfaces Array(
"NAME:Selections",
VB Example
"Selections:=", "Obj1_Face1,Obj2_Face2",
"NewPartsModelFlag:=", "Model")

CreateEntityList
Creates a list of entities containing objects or faces (not both).

UI Access Modeler > List > Create > [Object / Face] List.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:GeometryEntityListParameters",
Parameters
"EntityType:=" , <string "Object" or "Face">,
"EntityList:=" , <string of object names or IDs>)
See GetObjectIDByName for returning object IDs.

3D Modeler Editor Script Commands 8-150


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<AttributesArray> Array Structured array. See: AttributesArray. CreateEntityList takes only


the "Name" parameter.

Return Value None.

Python Syntax CreateEntityList(<Parameters>,<AttributesArray>)


oEditor.CreateEntityList(
["NAME:GeometryEntityListParameters",
"EntityType:=", "Object",
"EntityList:=", "Bondwire1,Bondwire2"
Python Example
],
["NAME:Attributes",
"Name:=", "Objectlist1"
])

VB Syntax CreateEntityList<Parameters> <AttributesArray>


oEditor.CreateEntityList Array(
"NAME:GeometryEntityListParameters",
"EntityType:=", "Object",
VB Example
"EntityList:=", "Bondwire1,Bondwire2")
Array("NAME:Attributes",
"Name:=", "Objectlist1")

3D Modeler Editor Script Commands 8-151


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

CreateFaceCS
Creates a Face Coordinate System from a selected face.

UI Access Modeler > Coordinate System > Create > FaceCS.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:FaceCSParameters",
<OriginArray>,
"MoveToEnd:=", <boolean>,
"FaceID:=", <integer>,
<AxisPosnArray>,
"WhichAxis:=" , <string "X", "Y", or "Z">,
Parameters "ZRotationAngle:=" , <string>,
"XOffset:=" , <string>,
"YOffset:=" , <string>,
"AutoAxis:=" , <boolean>)
<OriginArray> Array Structured array.
Array("NAME:Origin",
"IsAttachedToEntity:=" , <boolean>,
"EntityID:=" , <integer>,
"FacetedBodyTriangleIndex:=", <integer>,

3D Modeler Editor Script Commands 8-152


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"TriangleVertexIndex:=" , <integer>,
"PositionType:=" , <string "FaceCenter",
"EdgeCenter", "OnVertex", "OnEdge", or "OnFace">,
"UParam:=" , <float between 0 and 1 representing
the relative position of the point on the edge or
face>,
"VParam:=" , <float between 0 and 1 representing
the relative position of the point on the edge or
face>,
"XPosition:=" , <string>,
"YPosition:=" , <string>,
"ZPosition:=" , <string>)
IsAttachedToEntity specifies whether the point is anchored to a vertex,
edge, or face. If True, provide UParam and VParam. If False, provide
XPosition, YPosition, and ZPosition to provide fixed position. Pass "0" for
unused parameters.
<AxisPosnArray> Array Structured array.
Array("NAME:AxisPosn",
"IsAttachedToEntity:=" , <boolean>,
"EntityID:=" , <integer>,
"FacetedBodyTriangleIndex:=", <integer>,
"TriangleVertexIndex:=" , <integer>,
"PositionType:=" , <string "FaceCenter",
"EdgeCenter", "OnVertex", "OnEdge", or "OnFace">,
"UParam:=" , <float>,

3D Modeler Editor Script Commands 8-153


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"VParam:=" , <float>,
"XPosition:=" , <string>,
"YPosition:=" , <string>,
"ZPosition:=" , <string>)
<AttributesArray> Array Structured array. See: AttributesArray.

Return Value None.

Python Syntax CreateFaceCS(<Parameters>,<AttributesArray>)


oEditor.CreateFaceCS(
["NAME:FaceCSParameters",
["NAME:Origin",
"IsAttachedToEntity:=" , True,
"EntityID:=" , 46,
"FacetedBodyTriangleIndex:=", -1,
Python Example
"TriangleVertexIndex:=" , -1,
"PositionType:=" , "FaceCenter",
"UParam:=" , 0,
"VParam:=" , 0,
"XPosition:=" , "0",
"YPosition:=" , "0",

3D Modeler Editor Script Commands 8-154


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ZPosition:=" , "0"
],
"MoveToEnd:=" , False,
"FaceID:=" , 46,
["NAME:AxisPosn",
"IsAttachedToEntity:=" , True,
"EntityID:=" , 46,
"FacetedBodyTriangleIndex:=", -1,
"TriangleVertexIndex:=" , -1,
"PositionType:=" , "OnFace",
"UParam:=" , 0.487129134674319,
"VParam:=" , 0.308528523557527,
"XPosition:=" , "1292.27748080459mm",
"YPosition:=" , "-814.882885865484mm",
"ZPosition:=" , "0mm"
],
"WhichAxis:=" , "X",
"ZRotationAngle:=" , "0deg",
"XOffset:=" , "0mm",
"YOffset:=" , "0mm",
"AutoAxis:=" , False

3D Modeler Editor Script Commands 8-155


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

],
["NAME:Attributes",
"Name:=" , "FaceCS1",
"PartName:=" , "Rectangle1"
])

VB Syn- CreateFaceCS <Parameters> <AttributesArray>


tax

oEditor.CreateFaceCS Array("NAME:FaceCSParameters", Array("NAME:Origin", "IsAt-


tachedToEntity:=", _
true, "EntityID:=", 58, "FacetedBodyTriangleIndex:=", -1, "TriangleVertexIndex:=", _
-1, "PositionType:=", "FaceCenter", "UParam:=", 0, "VParam:=", 0, "XPosition:=", _
"0", "YPosition:=", "0", "ZPosition:=", "0"), "MoveToEnd:=", false, "FaceID:=", _
58, Array("NAME:AxisPosn", "IsAttachedToEntity:=", true, "EntityID:=", 58,
VB "FacetedBodyTriangleIndex:=", _
Exampl-
e -1, "TriangleVertexIndex:=", -1, "PositionType:=", "OnFace", "UParam:=", _
0.0664066713146499, "VParam:=", 0.407014331135309, "XPosition:=", _
"1826.56266852586mm", "YPosition:=", "-1355.79140131881mm", "ZPosition:=", "0mm"),
"WhichAxis:=", _
"X", "ZRotationAngle:=", "0deg", "XOffset:=", "0mm", "YOffset:=", "0mm", "AutoAxis:=",
_
false), Array("NAME:Attributes", "Name:=", "FaceCS2", "PartName:=", "Rectangle2")

3D Modeler Editor Script Commands 8-156


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

CreateGroup
Creates a group from objects specified in the history tree.

UI Access Modeler > Group > Create.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:GroupParameter",

Parameters "ParentGroupID:=" , <string>,


"Parts:=" , <string>,
"SubmodelInstances:=" , <string>,
"Groups:=" , <string>)

Return Value None.

Python Syntax CreateGroup(<Parameters>)


oEditor.CreateGroup(
["NAME:GroupParameter",
"ParentGroupID:=" , "Model",
Python Example "Parts:=" , "Box1,Box2,Box3",
"SubmodelInstances:=" , "",
"Groups:=" , ""
])

3D Modeler Editor Script Commands 8-157


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax CreateGroup <Parameters>


oEditor.CreateGroup Array("NAME:GroupParameter", "ParentGroupID:=", "Model", _
VB Example
"Parts:=", "Box1,Box2,Box3", "SubmodelInstances:=", "", "Groups:=", "")

CreateObjectCS
Creates an object coordinate system from a selected object.

UI Access Modeler > Coordinate System > Create > Object > [Offset / Rotated / Both].

Name Type Description


<Parameters> Array Structured array.
Array("NAME:ObjectCSParameters",
<OriginArray>
"MoveToEnd:=" , <boolean>,
"ReverseXAxis:=" , <boolean>,
Parameters
"ReverseYAxis:=" , <boolean>,
<xAxisArray / xAxisPosArray>
<yAxisArray / yAxisPosArray>)
Note: xAxisArray and xAxisPosArray differ. Use xAxisArray for absolute
position and xAxisPosArray for relative position. Do the same for yAx-
isArray and yAxisPosArray.
<OriginArray> Array Structured array.

3D Modeler Editor Script Commands 8-158


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:Origin",
"IsAttachedToEntity:=" , <boolean>,
"EntityID:=" , <integer>,
"FacetedBodyTriangleIndex:=", <integer>,
"TriangleVertexIndex:=" , <integer>,
"PositionType:=" , <string "OnVertex",
"EdgeCenter", "FaceCenter", "OnEdge", or "Abso-
lutePosition">,
"UParam:=" , <float between 0 and 1 representing
the relative position of the point on the edge or
face>,
"VParam:=" , <float between 0 and 1 representing
the relative position of the point on the edge or
face>,
"XPosition:=" , <string>,
"YPosition:=" , <string>,
"ZPosition:=" , <string>)
IsAttachedToEntity specifies whether the point is anchored. If True,
provide UParam and VParam. If False, provide XPosition, YPosition, and
ZPosition to provide fixed position. Pass "0" for unused parameters.
<xAxisArray> Array Structured array for absolute position:
Array("NAME:xAxis",
"DirectionType:=" , "AbsoluteDirection",
"EdgeID:=" , <integer>,
"FaceID:=" , <integer>,

3D Modeler Editor Script Commands 8-159


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"xDirection:=" , <string>,
"yDirection:=" , <string>,
"zDirection:=" , <string>,
"UParam:=" , <float>,
"VParam:=" , <float>)
<xAxisPosArray> Array Structured array for relative position:
Array("NAME:xAxisPos",
"IsAttachedToEntity:=" , <boolean>,
"EntityID:=" , <integer>,
"FacetedBodyTriangleIndex:=", <integer>,
"TriangleVertexIndex:=" , <integer>,
"PositionType:=" , <string "OnVertex",
"EdgeCenter", "FaceCenter", or "OnEdge">,
"UParam:=" , <float>,
"VParam:=" , <float>,
"XPosition:=" , <string>,
"YPosition:=" , <string>,
"ZPosition:=" , <string>)
<yAxisArray> Array Structured array for absolute position:
Array("NAME:yAxis",
"DirectionType:=" , "AbsoluteDirection",

3D Modeler Editor Script Commands 8-160


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"EdgeID:=" , <integer>,
"FaceID:=" , <integer>,
"xDirection:=" , <string>,
"yDirection:=" , <string>,
"zDirection:=" , <string>,
"UParam:=" , <float>,
"VParam:=" , <float>)
<yAxisPosArray> Array Structured array for relative position:
Array("NAME:yAxisPos",
"IsAttachedToEntity:=" , <boolean>,
"EntityID:=" , <integer>,
"FacetedBodyTriangleIndex:=", <integer>,
"TriangleVertexIndex:=" , <integer>,
"PositionType:=" , <string "OnVertex",
"EdgeCenter", "FaceCenter", or "OnEdge">,
"UParam:=" , <float>,
"VParam:=" , <float>,
"XPosition:=" , <string>,
"YPosition:=" , <string>,
"ZPosition:=" , <string>)
<AttributesArray> Array Structured array. See: AttributesArray.

Return Value None.

3D Modeler Editor Script Commands 8-161


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax CreateObjectCS(<Parameters>,<AttributesArray>)


oEditor.CreateObjectCS(
["NAME:ObjectCSParameters",
["NAME:Origin",
"IsAttachedToEntity:=" , True,
"EntityID:=" , 59,
"FacetedBodyTriangleIndex:=", -1,
"TriangleVertexIndex:=" , -1,
"PositionType:=" , "OnVertex",
"UParam:=" , 0,
Python Example
"VParam:=" , 0,
"XPosition:=" , "0",
"YPosition:=" , "0",
"ZPosition:=" , "0"
],
"MoveToEnd:=" , False,
"ReverseXAxis:=" , False,
"ReverseYAxis:=" , False,
["NAME:xAxis",

3D Modeler Editor Script Commands 8-162


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"DirectionType:=" , "AbsoluteDirection",
"EdgeID:=" , -1,
"FaceID:=" , -1,
"xDirection:=" , "1",
"yDirection:=" , "0",
"zDirection:=" , "0",
"UParam:=" , 0,
"VParam:=" , 0
],
["NAME:yAxis",
"DirectionType:=" , "AbsoluteDirection",
"EdgeID:=" , -1,
"FaceID:=" , -1,
"xDirection:=" , "0",
"yDirection:=" , "1",
"zDirection:=" , "0",
"UParam:=" , 0,
"VParam:=" , 0
]
],
["NAME:Attributes",

3D Modeler Editor Script Commands 8-163


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Name:=" , "ObjectCS1",
"PartName:=" , "Box2"
])

VB Syn- CreateObjectCS <Parameters> <AttributesArray>


tax

oEditor.CreateObjectCS Array("NAME:ObjectCSParameters", Array("NAME:Origin", "IsAt-


tachedToEntity:=", _
false, "EntityID:=", -1, "FacetedBodyTriangleIndex:=", -1, "TriangleVertexIndex:=", _
-1, "PositionType:=", "AbsolutePosition", "UParam:=", 0, "VParam:=", 0, "XPosition:=",
_
"0mm", "YPosition:=", "0mm", "ZPosition:=", "0mm"), "MoveToEnd:=", false, "ReverseXAx-
is:=", _
false, "ReverseYAxis:=", false, Array("NAME:xAxisPos", "IsAttachedToEntity:=", true,
VB "EntityID:=", _
Exampl-
e 80, "FacetedBodyTriangleIndex:=", -1, "TriangleVertexIndex:=", -1, "PositionType:=", _
"EdgeCenter", "UParam:=", 0, "VParam:=", 0, "XPosition:=", "0", "YPosition:=", _
"0", "ZPosition:=", "0"), Array("NAME:yAxisPos", "IsAttachedToEntity:=", true,
"EntityID:=", _
69, "FacetedBodyTriangleIndex:=", -1, "TriangleVertexIndex:=", -1, "PositionType:=", _
"EdgeCenter", "UParam:=", 0, "VParam:=", 0, "XPosition:=", "0", "YPosition:=", _
"0", "ZPosition:=", "0")), Array("NAME:Attributes", "Name:=", "ObjectCS2",
"PartName:=", _

3D Modeler Editor Script Commands 8-164


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Box3")

CreateObjectFromEdges
Creates an object from the specified object edge.

UI Access Modeler > Edge > Create Object From Edge

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<ParametersArray> Array Structured array.
Array("NAME:Parameters",
Array("NAME:BodyFromEdgeToPara-
meters",
"Edges:=" , <array containing
Parameters
integer edges>
)
)
<CreateGroupsForNewObjects> Array Structured array.
Array("CreateGroupsForNewObjects:=",
<boolean True to create groups for new
objects; else False>)

Return Value None.

Python Syntax CreateObjectFromEdges(<SelectionsArray>, <ParametersArray>, <CreateGroupsForNewObjects>)


Python Example oEditor.CreateObjectFromEdges(

3D Modeler Editor Script Commands 8-165


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["NAME:Selections",
"Selections:=", "Box2",
"NewPartsModelFlag:=", "Model"
],
["NAME:Parameters",
["NAME:BodyFromEdgeToParameters",
"Edges:=", [41] ]
],
["CreateGroupsForNewObjects:=", False
])

VB Syn- CreateObjectFromEdges <SelectionsArray> <ParametersArray> <CreateGroupsForNewObjects>


tax

oEditor.CreateObjectFromEdges Array("NAME:Selections", "Selections:=", "Box1",


VB "NewPartsModelFlag:=", _
Exampl- "Model"), Array("NAME:Parameters", Array("NAME:BodyFromEdgeToParameters", "Edges:=",
e Array( _
13))), Array("CreateGroupsForNewObjects:=", false)

CreateObjectFromFaces
Creates 2D objects from specified face(s).

3D Modeler Editor Script Commands 8-166


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access Modeler > Surface > Create Object from Face

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Array("NAME:Parameters",
Parameters
<BodyFromFaceToParameters>)
<CreateGroupsForNewObjects> Array Structured array.
Array("CreateGroupsForNewObjects:=",
<boolean>)

Return Value None.

Python Syntax CreateObjectFromFaces (<SelectionsArray>,<Parameters>, <CreateGroupsForNewObjects>)


oEditor.CreateObjectFromFaces(
["NAME:Selections",
"Selections:=" , "Box3",
"NewPartsModelFlag:=" , "Model"
],
Python Example
["NAME:Parameters",
["NAME:BodyFromFaceToParameters",
"FacesToDetach:=" , [68]
]
],

3D Modeler Editor Script Commands 8-167


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["CreateGroupsForNewObjects:=", False
])

VB Syn- CreateObjectFromFaces <SelectionsArray> <Parameters> <CreateGroupsForNewObjects>


tax

oEditor.CreateObjectFromFaces Array("NAME:Selections", "Selections:=", "Box3",


"NewPartsModelFlag:=" ,
VB
Exampl- "Model") Array("NAME:Parameters", Array("NAME:BodyFromFaceToParameters",
e "FacesToDetach:=", Array(68)))
Array("CreateGroupsForNewObjects:=", False)

CreateRelativeCS
Creates a Relative Coordinate System.

UI Access Modeler > Coordinate System > Create > Relative CS > [Offset / Rotated / Both].

Name Type Description


<Parameters> Array Structured array.
Array("NAME:RelativeCSParameters",
"Mode:=" , "Axis/Position",
Parameters
"OriginX:=" , <string>,
"OriginY:=" , <string>,
"OriginZ:=" , <string>,
"XAxisXvec:=" , <string>,

3D Modeler Editor Script Commands 8-168


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"XAxisYvec:=" , <string>,
"XAxisZvec:=" , <string>,
"YAxisXvec:=" , <string>,
"YAxisYvec:=" , <string>,
"YAxisZvec:=" , <string>)
<AttributesArray> Array Structured array. See: AttributesArray. CreateRelativeCS supports only
the "Name" parameter.

Return Value None.

Python Syntax CreateRelativeCS(<Parameters>,<AttributesArray>)


oEditor.CreateRelativeCS(
["NAME:RelativeCSParameters",
"Mode:=" , "Axis/Position",
"OriginX:=" , "0.62mm",
"OriginY:=" , "-0.7mm",
"OriginZ:=" , "0mm",
Python Example
"XAxisXvec:=" , "1mm",
"XAxisYvec:=" , "0mm",
"XAxisZvec:=" , "0mm",
"YAxisXvec:=" , "0mm",
"YAxisYvec:=" , "1mm",
"YAxisZvec:=" , "0mm"

3D Modeler Editor Script Commands 8-169


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

],
["NAME:Attributes",
"Name:=" , "RelativeCS1"
])

VB Syn- CreateRelativeCS <Parameters> <AttributesArray>


tax

oEditor.CreateRelativeCS Array("NAME:RelativeCSParameters", "Mode:=", "Axis/Position",


"OriginX:=", _
"0mm", "OriginY:=", "0mm", "OriginZ:=", "0mm", "XAxisXvec:=", "0.66mm", "XAxisYvec:=",
VB _
Example
"0.28mm", "XAxisZvec:=", "0mm", "YAxisXvec:=", "0.06mm", "YAxisYvec:=", "0.14mm", "YAx-
isZvec:=", _
"0mm"), Array("NAME:Attributes", "Name:=", "RelativeCS1")

DeleteEmptyGroups
Deletes group(s) from the history tree.

UI Access Modeler > Group > Delete Empty.

Name Type Description


Parameters <Parameters> Array Structured array.
Array("Groups:=" , <array of string group IDs>)

Return Value None.

3D Modeler Editor Script Commands 8-170


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax DeleteEmptyGroups(<Parameters>)


oEditor.DeleteEmptyGroups([
Python Example "Groups:=", ["Group1","Group2","Group3"]
])

VB Syntax DeleteEmptyGroups <Parameters>


VB Example oEditor.DeleteEmptyGroups Array("Groups:=", Array("Group1","Group2","Group3"))

DeleteLastOperation
Deletes the last operation performed on the specified object(s).

UI Access Modeler > Delete Last Operation.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

Python Syntax DeleteLastOperation(<SelectionsArray>)


oEditor.DeleteLastOperation([
"NAME:Selections",
Python Example "Selections:=", "Box3",
"NewPartsModelFlag:=", "Model"
])

3D Modeler Editor Script Commands 8-171


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syn- DeleteLastOperation <SelectionsArray>


tax

VB oEditor.DeleteLastOperation Array("NAME:Selections", "Selections:=", "Box3",


Exampl- "NewPartsModelFlag:=", "Model")
e

DetachFaces
Detaches the specified face(s) from an object.

UI Access Modeler > Surface > Detach Faces.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Array("NAME:Parameters",
Parameters <DetachFacesArray>)
<DetachFacesArray> Array Structured array.
Array("NAME:DetachFacesToParameters",
"FacesToDetach:=" , <array containing integer
face IDs>)

Return Value None.

Python Syntax DetachFaces(<SelectionsArray>, <Parameters>)


Python Example oEditor.DetachFaces(

3D Modeler Editor Script Commands 8-172


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["NAME:Selections",
"Selections:=", "Box3",
"NewPartsModelFlag:=", "Model"
],
["NAME:Parameters",
["NAME:DetachFacesToParameters",
"FacesToDetach:=", [68,67]
]
])

VB Syn- DetachFaces <SelectionsArray> <Parameters>


tax

oEditor.DetachFaces Array("NAME:Selections", "Selections:=", "Box3",


VB "NewPartsModelFlag:=", "Model")
Example Array("NAME:Parameters", Array("NAME:DetachFacesToParameters", "FacesToDetach:=",
[68,67]))

EditEntityList
Modifies an entity list.

UI Access Modeler > List > Reassign.

Name Type Description


Parameters <SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.

3D Modeler Editor Script Commands 8-173


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:GeometryEntityListParameters",
"EntityType:=" , <string "Object" or
"Face">,
"EntityList:=" , <string list>
)

Return Value None.

Python Syntax EditEntityList(<SelectionsArray>, <Parameters>)


oEditor.EditEntityList(
["NAME:Selections",
"Selections:=" , "Objectlist1"
],
Python Example
["NAME:GeometryEntityListParameters",
"EntityType:=" , "Object",
"EntityList:=" , "Box1, Box2, Box3"
])

VB Syntax EditEntityList <SelectionsArray> <Parameters>


oEditor.EditEntityList
VB Example
Array("NAME:Selections",

3D Modeler Editor Script Commands 8-174


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Selections:=", "Objectlist1")
Array("NAME:GeometryEntityListParameters",
"EntityType:=", "Object",
"EntityList:=", "Box1, Box2, Box3")

EditFaceCS
Recreates an existing face coordinate system. See: CreateFaceCS.

UI Access Modeler > Coordinate System > Edit.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:FaceCSParameters",
<OriginArray>,
"MoveToEnd:=", <boolean>,
"FaceID:=", <integer>,
<AxisPosnArray>,
Parameters
"WhichAxis:=" , <string "X", "Y", or "Z">,
"ZRotationAngle:=" , <string>,
"XOffset:=" , <string>,
"YOffset:=" , <string>,
"AutoAxis:=" , <boolean>)
<OriginArray> Array Structured array.
Array("NAME:Origin",

3D Modeler Editor Script Commands 8-175


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"IsAttachedToEntity:=" , <boolean>,
"EntityID:=" , <integer>,
"FacetedBodyTriangleIndex:=", <integer>,
"TriangleVertexIndex:=" , <integer>,
"PositionType:=" , <string "FaceCenter",
"EdgeCenter", "OnVertex", "OnEdge", or "OnFace">,
"UParam:=" , <float between 0 and 1 representing
the relative position of the point on the edge or
face>,
"VParam:=" , <float between 0 and 1 representing
the relative position of the point on the edge or
face>,
"XPosition:=" , <string>,
"YPosition:=" , <string>,
"ZPosition:=" , <string>)
IsAttachedToEntity specifies whether the point is anchored to a vertex,
edge, or face. If True, provide UParam and VParam. If False, provide
XPosition, YPosition, and ZPosition to provide fixed position. Pass "0" for
unused parameters.
<AxisPosnArray> Array Structured array.
Array("NAME:AxisPosn",
"IsAttachedToEntity:=" , <boolean>,
"EntityID:=" , <integer>,

3D Modeler Editor Script Commands 8-176


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"FacetedBodyTriangleIndex:=", <integer>,
"TriangleVertexIndex:=" , <integer>,
"PositionType:=" , <string "FaceCenter",
"EdgeCenter", "OnVertex", "OnEdge", or "OnFace">,
"UParam:=" , <float>,
"VParam:=" , <float>,
"XPosition:=" , <string>,
"YPosition:=" , <string>,
"ZPosition:=" , <string>)
<AttributesArray> Array Structured array. See: AttributesArray. Use to select the coordinate sys-
tem to edit.

Return Value None.

Python Syntax EditFaceCS (<Parameters>, <AttributesArray>)


oEditor.EditFaceCS(
["NAME:FaceCSParameters",
["NAME:Origin",
"IsAttachedToEntity:=" , True,
Python Example
"EntityID:=" , 12,
"FacetedBodyTriangleIndex:=", -1,
"TriangleVertexIndex:=" , -1,
"PositionType:=" , "FaceCenter",

3D Modeler Editor Script Commands 8-177


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"UParam:=" , 0,
"VParam:=" , 0,
"XPosition:=" , "0",
"YPosition:=" , "0",
"ZPosition:=" , "0"
],
"MoveToEnd:=" , False,
"FaceID:=" , 12,
["NAME:AxisPosn",
"IsAttachedToEntity:=" , True,
"EntityID:=" , 12,
"FacetedBodyTriangleIndex:=", -1,
"TriangleVertexIndex:=" , -1,
"PositionType:=" , "OnFace",
"UParam:=" , 0.62951717774066,
"VParam:=" , 0.226514925559344,
"XPosition:=" , "1200mm",
"YPosition:=" , "-354.697014888131mm",
"ZPosition:=" , "125.903435548132mm"
],

3D Modeler Editor Script Commands 8-178


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"WhichAxis:=" , "X",
"ZRotationAngle:=" , "0deg",
"XOffset:=" , "0mm",
"YOffset:=" , "0mm",
"AutoAxis:=" , False
],
["NAME:Attributes",
"Name:=" , "FaceCS1",
"PartName:=" , "Box1"
])

VB Syntax EditFaceCS <Parameters> <AttributesArray>


oEditor.EditFaceCS
Array("NAME:FaceCSParameters",
Array("NAME:Origin",
"IsAttachedToEntity:=" , True,
VB Example "EntityID:=" , 12,
"FacetedBodyTriangleIndex:=", -1,
"TriangleVertexIndex:=" , -1,
"PositionType:=" , "FaceCenter",
"UParam:=" , 0,

3D Modeler Editor Script Commands 8-179


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"VParam:=" , 0,
"XPosition:=" , "0",
"YPosition:=" , "0",
"ZPosition:=" , "0"),
"MoveToEnd:=" , False,
"FaceID:=" , 12,
Array("NAME:AxisPosn",
"IsAttachedToEntity:=" , True,
"EntityID:=" , 12,
"FacetedBodyTriangleIndex:=", -1,
"TriangleVertexIndex:=" , -1,
"PositionType:=" , "OnFace",
"UParam:=" , 0.62951717774066,
"VParam:=" , 0.226514925559344,
"XPosition:=" , "1200mm",
"YPosition:=" , "-354.697014888131mm",
"ZPosition:=" , "125.903435548132mm"),
"WhichAxis:=" , "X",
"ZRotationAngle:=" , "0deg",
"XOffset:=" , "0mm",

3D Modeler Editor Script Commands 8-180


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"YOffset:=" , "0mm",
"AutoAxis:=" , False)
Array("NAME:Attributes",
"Name:=" , "FaceCS1",
"PartName:=" , "Box1")

EditObjectCS
Edits an existing object coordinate system. See: CreateObjectCS.

UI Access Modeler > Coordinate System > Edit.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:ObjectCSParameters",
<OriginArray>
"MoveToEnd:=" , <boolean>,
"ReverseXAxis:=" , <boolean>,

Parameters "ReverseYAxis:=" , <boolean>,


<xAxisArray / xAxisPosArray>
<yAxisArray / yAxisPosArray>)
Note: xAxisArray and xAxisPosArray differ. Use xAxisArray for absolute
position and xAxisPosArray for relative position. Do the same for yAx-
isArray and yAxisPosArray.
<OriginArray> Array Structured array.
Array("NAME:Origin",

3D Modeler Editor Script Commands 8-181


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"IsAttachedToEntity:=" , <boolean>,
"EntityID:=" , <integer>,
"FacetedBodyTriangleIndex:=", <integer>,
"TriangleVertexIndex:=" , <integer>,
"PositionType:=" , <string "OnVertex",
"EdgeCenter", "FaceCenter", "OnEdge", or "Abso-
lutePosition">,
"UParam:=" , <float between 0 and 1 representing
the relative position of the point on the edge or
face>,
"VParam:=" , <float between 0 and 1 representing
the relative position of the point on the edge or
face>,
"XPosition:=" , <string>,
"YPosition:=" , <string>,
"ZPosition:=" , <string>)
IsAttachedToEntity specifies whether the point is anchored. If True,
provide UParam and VParam. If False, provide XPosition, YPosition, and
ZPosition to provide fixed position. Pass "0" for unused parameters.
<xAxisArray> Array Structured array for absolute position:
Array("NAME:xAxis",
"DirectionType:=" , "AbsoluteDirection",
"EdgeID:=" , <integer>,

3D Modeler Editor Script Commands 8-182


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"FaceID:=" , <integer>,
"xDirection:=" , <string>,
"yDirection:=" , <string>,
"zDirection:=" , <string>,
"UParam:=" , <float>,
"VParam:=" , <float>)
<xAxisPosArray> Array Structured array for relative position:
Array("NAME:xAxisPos",
"IsAttachedToEntity:=" , <boolean>,
"EntityID:=" , <integer>,
"FacetedBodyTriangleIndex:=", <integer>,
"TriangleVertexIndex:=" , <integer>,
"PositionType:=" , <string "OnVertex",
"EdgeCenter", "FaceCenter", or "OnEdge">,
"UParam:=" , <float>,
"VParam:=" , <float>,
"XPosition:=" , <string>,
"YPosition:=" , <string>,
"ZPosition:=" , <string>)
<yAxisArray> Array Structured array for absolute position:
Array("NAME:yAxis",
"DirectionType:=" , "AbsoluteDirection",

3D Modeler Editor Script Commands 8-183


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"EdgeID:=" , <integer>,
"FaceID:=" , <integer>,
"xDirection:=" , <string>,
"yDirection:=" , <string>,
"zDirection:=" , <string>,
"UParam:=" , <float>,
"VParam:=" , <float>)
<yAxisPosArray> Array Structured array for relative position:
Array("NAME:yAxisPos",
"IsAttachedToEntity:=" , <boolean>,
"EntityID:=" , <integer>,
"FacetedBodyTriangleIndex:=", <integer>,
"TriangleVertexIndex:=" , <integer>,
"PositionType:=" , <string "OnVertex",
"EdgeCenter", "FaceCenter", or "OnEdge">,
"UParam:=" , <float>,
"VParam:=" , <float>,
"XPosition:=" , <string>,
"YPosition:=" , <string>,
"ZPosition:=" , <string>)
<AttributesArray> Array Structured array. See: AttributesArray. Use to select the coordinate sys-

3D Modeler Editor Script Commands 8-184


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

tem to edit.

Return Value None.

Python Syntax EditObjectCS(<Parameters>,<AttributesArray>)


oEditor.EditObjectCS(
["NAME:ObjectCSParameters",
["NAME:Origin",
"IsAttachedToEntity:=" , True,
"EntityID:=" , 59,
"FacetedBodyTriangleIndex:=", -1,
"TriangleVertexIndex:=" , -1,
"PositionType:=" , "OnVertex",
Python Example "UParam:=" , 0,
"VParam:=" , 0,
"XPosition:=" , "0",
"YPosition:=" , "0",
"ZPosition:=" , "0"
],
"MoveToEnd:=" , False,
"ReverseXAxis:=" , False,
"ReverseYAxis:=" , False,

3D Modeler Editor Script Commands 8-185


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["NAME:xAxis",
"DirectionType:=" , "AbsoluteDirection",
"EdgeID:=" , -1,
"FaceID:=" , -1,
"xDirection:=" , "1",
"yDirection:=" , "0",
"zDirection:=" , "0",
"UParam:=" , 0,
"VParam:=" , 0
],
["NAME:yAxis",
"DirectionType:=" , "AbsoluteDirection",
"EdgeID:=" , -1,
"FaceID:=" , -1,
"xDirection:=" , "0",
"yDirection:=" , "1",
"zDirection:=" , "0",
"UParam:=" , 0,
"VParam:=" , 0
]

3D Modeler Editor Script Commands 8-186


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

],
["NAME:Attributes",
"Name:=" , "ObjectCS1",
"PartName:=" , "Box2"
])

VB Syn- EditObjectCS <Parameters> <AttributesArray>


tax

oEditor.EditObjectCS Array("NAME:ObjectCSParameters", Array("NAME:Origin", "IsAt-


tachedToEntity:=", _
false, "EntityID:=", -1, "FacetedBodyTriangleIndex:=", -1, "TriangleVertexIndex:=", _
-1, "PositionType:=", "AbsolutePosition", "UParam:=", 0, "VParam:=", 0, "XPosition:=",
_
"0mm", "YPosition:=", "0mm", "ZPosition:=", "0mm"), "MoveToEnd:=", false, "ReverseXAx-
is:=", _
false, "ReverseYAxis:=", false, Array("NAME:xAxisPos", "IsAttachedToEntity:=", true,
VB "EntityID:=", _
Example
80, "FacetedBodyTriangleIndex:=", -1, "TriangleVertexIndex:=", -1, "PositionType:=", _
"EdgeCenter", "UParam:=", 0, "VParam:=", 0, "XPosition:=", "0", "YPosition:=", _
"0", "ZPosition:=", "0"), Array("NAME:yAxisPos", "IsAttachedToEntity:=", true,
"EntityID:=", _
69, "FacetedBodyTriangleIndex:=", -1, "TriangleVertexIndex:=", -1, "PositionType:=", _
"EdgeCenter", "UParam:=", 0, "VParam:=", 0, "XPosition:=", "0", "YPosition:=", _
"0", "ZPosition:=", "0")), Array("NAME:Attributes", "Name:=", "ObjectCS2",

3D Modeler Editor Script Commands 8-187


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"PartName:=", _
"Box3")

EditRelativeCS
Edits an existing Relative Coordinate System. See: CreateRelativeCS.

UI Access Modeler > Coordinate System > Edit.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:RelativeCSParameters",
"Mode:=" , "Axis/Position",
"OriginX:=" , <string>,
"OriginY:=" , <string>,
"OriginZ:=" , <string>,
Parameters "XAxisXvec:=" , <string>,
"XAxisYvec:=" , <string>,
"XAxisZvec:=" , <string>,
"YAxisXvec:=" , <string>,
"YAxisYvec:=" , <string>,
"YAxisZvec:=" , <string>)
<AttributesArray> Array Structured array. See: AttributesArray. Use to select the coordinate sys-
tem to edit.

3D Modeler Editor Script Commands 8-188


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value None.

Python Syntax EditRelativeCS(<Parameters>,<AttributesArray>)


oEditor.EditRelativeCS(
["NAME:RelativeCSParameters",
"Mode:=" , "Axis/Position",
"OriginX:=" , "0.62mm",
"OriginY:=" , "-0.7mm",
"OriginZ:=" , "0mm",
"XAxisXvec:=" , "1mm",
"XAxisYvec:=" , "0mm",
Python Example
"XAxisZvec:=" , "0mm",
"YAxisXvec:=" , "0mm",
"YAxisYvec:=" , "1mm",
"YAxisZvec:=" , "0mm"
],
["NAME:Attributes",
"Name:=" , "RelativeCS1"
])

VB Syn- EditRelativeCS <Parameters> <AttributesArray>


tax

3D Modeler Editor Script Commands 8-189


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oEditor.EditRelativeCS Array("NAME:RelativeCSParameters", "Mode:=", "Axis/Position",


"OriginX:=", _
"0mm", "OriginY:=", "0mm", "OriginZ:=", "0mm", "XAxisXvec:=", "0.66mm", "XAxisYvec:=",
VB _
Example
"0.28mm", "XAxisZvec:=", "0mm", "YAxisXvec:=", "0.06mm", "YAxisYvec:=", "0.14mm", "YAx-
isZvec:=", _
"0mm"), Array("NAME:Attributes", "Name:=", "RelativeCS1")

Export
Exports the model to a file.

Note:

This script does not export image file types or GDSII files. See: ExportModelImageToFile and ExportGDSII.

UI Access Modeler > Export.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:ExportParameters",

Parameters "AllowRe-
gionDependentPartSelectionForPMLCreation:=",
<boolean>,
"AllowRegionSelectionForPMLCreation:=",
<boolean>,

3D Modeler Editor Script Commands 8-190


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Selections:=" , <string list>,


"File Name:=" , <string filepath>,
"Major Version:=" , <integer (-1 if not applic-
able)>,
"Minor Version:=" , <integer (-1 if not applic-
able)>)

Return None.
Value

Python Syntax Export(<Parameters>)


oEditor.Export(
["NAME:ExportParameters",
"AllowRegionDependentPartSelectionForPMLCreation:=", True,
"AllowRegionSelectionForPMLCreation:=", True,
Python Example "Selections:=" , "Box1,Box2,Box3",
"File Name:=" , "C:/Users/jdoe/Desktop/export.sab",
"Major Version:=" , 25,
"Minor Version:=" , 0
])

VB Syntax Export <Parameters>


VB Example oEditor.Export

3D Modeler Editor Script Commands 8-191


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:ExportParameters",
"AllowRegionDependentPartSelectionForPMLCreation:=", True,
"AllowRegionSelectionForPMLCreation:=", True,
"Selections:=" , "Box1,Box2,Box3",
"File Name:=" , "C:/Users/jdoe/Desktop/export.sab",
"Major Version:=" , 25,
"Minor Version:=" , 0)

ExportModelImageToFile
Exports the model as an image file (*.avz, *.bmp, *.gif, *.jpeg, *.tiff, *.wrl). In Release 23.1, this command is fully supports -ng (non-
graphical) mode. To export to Ensight use *.avz. For export to Ensight in -ng mode, the corresponding version of Ensight must be
installed. On Linux, it might need manual set environment variable AWP_ROOT212 to its installation path, e.g. AWP_ROOT212-
2=/installations/ansys_inc/v212/ for AnsysEDT v21.2 and Ensight 21.2.
ExportModelImageToFile supports export overlay of polar plot 3D with existing transformation (scaling, rotation and translation) in -ng
(non-graphical) mode.

UI Access Modeler > Export.

Name Type Description


<path> String Full file path including extension.
<width> Integer Width in pixels (use 0 for default).
<height> Integer Height in pixels (use 0 for default).
Parameters
<Parameters> Array Structured array.
Array("NAME:SaveImageParams",
"ShowAxis:=" , <string containing

3D Modeler Editor Script Commands 8-192


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

boolean>,
"ShowGrid:=" , <string containing
boolean>,
"ShowRuler:=" , <string containing
boolean>,
"ShowRegion:=" , <string>,
"Selections:=" , <string>,
"FieldPlotSelections:=", <string>' #
Comma delimited string. #Use to set which
field plot to show.
"FitToSelections:=" , "",

Note: "FitToSelections" specify geometry objects


for the "Fit" operation.

"FitToFieldPlotSelection:=" , ""

Note: "FitToFieldPlotSelections" specifies field plots


for the "Fit" operation.

"AutoFit:=" , "True",

3D Modeler Editor Script Commands 8-193


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note: If FitToSlections or FitToFieldPlotSelections


are used , then then AutoFit is true, it makes sure
color key does not overlap field plot. It is true by
default. If neither is used, then "AutoFit" will "Fit" to
full model.

"Orientation:=" , <string>
"ShowOrientationGadget:=" , <False>

Return Value None.

Python Syntax ExportModelImageToFile(<path> <width> <height> <Parameters>)


oEditor.ExportModelImageToFile
("C:/Users/jdoe/Desktop/export.bmp",
1920,
1080,
[
Python Example
"NAME:SaveImageParams",
"ShowAxis:=" , "True",
"ShowGrid:=" , "True",
"ShowRuler:=" , "True",
"ShowRegion:=" , "Default",

3D Modeler Editor Script Commands 8-194


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Selections:=" , "",
"FieldPlotSelections:=" , "",
"FitToSelections:=" , "",
"FitToFieldPlotSelections:=", "",
"AutoFit:=" , "True",
"Orientation:=" , ""
])

VB Syntax ExportModelImageToFile <path> <width> <height> <Parameters>


oEditor.ExportModelImageToFile
"C:/Users/jdoe/Desktop/export.bmp",
1383,
512,
Array("NAME:SaveImageParams",
"ShowAxis:=", "True",
VB Example
"ShowGrid:=", "True",
"ShowRuler:=", "True",
"ShowRegion:=", "Default",
"Selections:=", "",
"FitToFieldPlotSelections:=", "",
"AutoFit:=" , "True",

3D Modeler Editor Script Commands 8-195


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Orientation:=", ""

Fillet
Performs a fillet on specified edge(s).

UI Access Modeler > Fillet.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Array("NAME:Parameters",
<FilletParametersArray>)
<FilletParametersArray> Array Structured array.
Parameters Array("NAME:FilletParameters",
"Edges:=" , <array containing integer
edge IDs>,
"Vertices:=" , <empty array>,
"Radius:=" , <string>,
"Setback:=" , <string>)

Return Value None.

Python Syntax Fillet(<SelectionsArray>, <Parameters>)


Python Example oEditor.Fillet(

3D Modeler Editor Script Commands 8-196


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["NAME:Selections",
"Selections:=" , "Box1",
"NewPartsModelFlag:=" , "Model"
],
["NAME:Parameters",
["NAME:FilletParameters",
"Edges:=" , [13],
"Vertices:=" , [],
"Radius:=" , "1mm",
"Setback:=" , "0mm"
]
])

VB Syntax Fillet <SelectionsArray> <Parameters>


oEditor.Fillet
Array("NAME:Selections",
"Selections:=" , "Box1",
VB Example "NewPartsModelFlag:=" , "Model")
Array("NAME:Parameters",
Array("NAME:FilletParameters",
"Edges:=" , Array(13),

3D Modeler Editor Script Commands 8-197


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Vertices:=" , Array(),
"Radius:=" , "1mm",
"Setback:=" , "0mm"))

FlattenGroup
Flattens a specified history tree group.

UI Access Modeler > Group > Flatten.

Name Type Description


<GroupID> Array Structured array.
Parameters
Array("Groups:=", Array(<string list of group
IDs>))

Return Value None.

Python Syntax FlattenGroup (<GroupID>)


Python Example oEditor.FlattenGroup(["Groups:=", ["Group1"]])

VB Syntax FlattenGroup <GroupID>


VB Example oEditor.FlattenGroup Array("Groups:=", Array("Group1"))

3D Modeler Editor Script Commands 8-198


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GenerateHistory
Generates the history for specified 1D object(s).

UI Access Modeler > Generate History.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

Python Syntax GenerateHistory (<SelectionsArray>)


oEditor.GenerateHistory(
["NAME:Selections",
"Selections:=" , "Polyline1",
Python Example
"NewPartsModelFlag:=" , "Model",
"UseCurrentCS:=" , True
])

VB Syntax GenerateHistory <SelectionsArray>

3D Modeler Editor Script Commands 8-199


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oEditor.GenerateHistory Array("NAME:Selections",
"Selections:=" , "Polyline1",
VB Example
"NewPartsModelFlag:=" , "Model",
"UseCurrentCS:=" , True)

HealObject
Heals an imported object.

UI Access Modeler > Model Preparation > Heal.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Array("NAME:ObjectHealingParameters",
"Version:=" , <integer>,
"AutoHeal:=" , <boolean>,
Parameters "TolerantStitch:=" , <boolean>,
"SimplifyGeom:=" , <boolean>,
"TightenGaps:=" , <boolean>,
"HealToSolid:=" , <boolean>,
"StopAfterFirstStitchError:=", <boolean>,
"MaxStitchTol:=" , <float>,

3D Modeler Editor Script Commands 8-200


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ExplodeAndStitch:=" , <boolean>,
"GeomSimplificationTol:=", <integer>,
"Max-
imumGeneratedRadiusForSimplification:=",
<integer>,
"SimplifyType:=" , <integer>,
"TightenGapsWidth:=" , <float>,
"RemoveSliverFaces:=" , <boolean>,
"RemoveSmallEdges:=" , <boolean>,
"RemoveSmallFaces:=" , <boolean>,
"SliverFaceTol:=" , <integer>,
"SmallEdgeTol:=" , <integer>,
"SmallFaceAreaTol:=" , <integer>,
"BoundingBoxScaleFactor:=", <integer>,
"RemoveHoles:=" , <boolean>,
"RemoveChamfers:=" , <boolean>,
"RemoveBlends:=" , <boolean>,
"HoleRadiusTol:=" , <integer>,
"ChamferWidthTol:=" , <integer>,
"BlendRadiusTol:=" , <integer>,
"AllowableSurfaceAreaChange:=",
<integer>,

3D Modeler Editor Script Commands 8-201


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"AllowableVolumeChange:=", <integer>)

Return Value None.

Python Syntax HealObject(<SelectionsArray>, <Parameters>)


oEditor.HealObject(
["NAME:Selections",
"Selections:=" , "Box1",
"NewPartsModelFlag:=" , "Model"
],
["NAME:ObjectHealingParameters",
"Version:=" , 1,
"AutoHeal:=" , True,
Python Example
"TolerantStitch:=" , True,
"SimplifyGeom:=" , True,
"TightenGaps:=" , True,
"HealToSolid:=" , False,
"StopAfterFirstStitchError:=", False,
"MaxStitchTol:=" , 0.001,
"ExplodeAndStitch:=" , True,
"GeomSimplificationTol:=", -1,

3D Modeler Editor Script Commands 8-202


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"MaximumGeneratedRadiusForSimplification:=", -1,
"SimplifyType:=" , 2,
"TightenGapsWidth:=" , 1E-06,
"RemoveSliverFaces:=" , False,
"RemoveSmallEdges:=" , False,
"RemoveSmallFaces:=" , False,
"SliverFaceTol:=" , 0,
"SmallEdgeTol:=" , 0,
"SmallFaceAreaTol:=" , 0,
"BoundingBoxScaleFactor:=", 1250,
"RemoveHoles:=" , False,
"RemoveChamfers:=" , False,
"RemoveBlends:=" , False,
"HoleRadiusTol:=" , 0,
"ChamferWidthTol:=" , 0,
"BlendRadiusTol:=" , 0,
"AllowableSurfaceAreaChange:=", 5,
"AllowableVolumeChange:=", 5
])

VB Syn- HealObject <SelectionsArray> <Parameters>


tax

3D Modeler Editor Script Commands 8-203


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oEditor.HealObject Array("NAME:Selections", "Selections:=", "Box2",


"NewPartsModelFlag:=", _
"Model"), Array("NAME:ObjectHealingParameters", "Version:=", 1, "AutoHeal:=", false,
"TolerantStitch:=", _
true, "SimplifyGeom:=", true, "TightenGaps:=", true, "HealToSolid:=", false, "StopAfter-
FirstStitchError:=", _
false, "MaxStitchTol:=", 0.001, "ExplodeAndStitch:=", true, "GeomSimplificationTol:=",
_
VB -1, "MaximumGeneratedRadiusForSimplification:=", -1, "SimplifyType:=", 2,
Exampl- "TightenGapsWidth:=", _
e
1E-06, "RemoveSliverFaces:=", false, "RemoveSmallEdges:=", false, "RemoveSmallFaces:=",
_
false, "SliverFaceTol:=", 0, "SmallEdgeTol:=", 0, "SmallFaceAreaTol:=", 0, "Bound-
ingBoxScaleFactor:=", _
1250, "RemoveHoles:=", false, "RemoveChamfers:=", false, "RemoveBlends:=", _
false, "HoleRadiusTol:=", 0, "ChamferWidthTol:=", 0, "BlendRadiusTol:=", 0, "Allow-
ableSurfaceAreaChange:=", _
5, "AllowableVolumeChange:=", 5)

GetActiveCoordinateSystem
Returns the active coordinate system.

UI Access None.
Parameters None.

3D Modeler Editor Script Commands 8-204


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value String name of active coordinate system.

Python Syntax GetActiveCoordinateSystem()


Python Example oEditor.GetActiveCoordinateSystem()

VB Syntax GetActiveCoordinateSystem
dim csName
VB Example
csName = oEditor.GetActiveCoordinateSystem

GetCoordinateSystems
Returns the names of coordinate systems in the design.

UI Access None.
Parameters None.
Return Value Array containing string names of coordinate systems.

Python Syntax GetCoordinateSystems()


Python Example oEditor.GetCoordinateSystems()

VB Syntax GetCoordinateSystems()
dim csNames
VB Example
csNames = oEditor.GetCoordinateSystems

3D Modeler Editor Script Commands 8-205


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Import
Imports a 3D model file.

Note:

This script does not import DXF or GDSII models. See: ImportDXF and ImportGDSII.

UI Access Modeler > Import.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:NativeBodyParameters",
"HealOption:=" , <integer>,
"Options:=" , <string>,
"FileType:=" , <string "UnRecognized">,
"MaxStitchTol:=" , <integer>,
Parameters
"ImportFreeSurfaces:=" , <boolean>,
"GroupByAssembly:=" , <boolean>,
"CreateGroup:=" , <boolean>,
"STLFileUnit:=" , <string>,
"MergeFacesAngle:=" , <float>,
"HealSTL:=" , <boolean>,
"ReduceSTL:=" , <boolean>,

3D Modeler Editor Script Commands 8-206


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ReduceMaxError:=" , <integer>,
"ReducePercentage:=" , <integer>,
"PointCoincidenceTol:=" , <float>,
"CreateLightweightPart:=", <boolean>,
"ImportMaterialNames:=" , <boolean>,
"SeparateDisjointLumps:=", <boolean>,
"SourceFile:=" , <string>)

Return Value None.

Python Syntax Import(<Parameters>)


oEditor.Import(
["NAME:NativeBodyParameters",
"HealOption:=" , 0,
"Options:=" , "-1",
"FileType:=" , "UnRecognized",
Python Example "MaxStitchTol:=" , -1,
"ImportFreeSurfaces:=" , False,
"GroupByAssembly:=" , False,
"CreateGroup:=" , True,
"STLFileUnit:=" , "Auto",
"MergeFacesAngle:=" , 0.02,

3D Modeler Editor Script Commands 8-207


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"HealSTL:=" , False,
"ReduceSTL:=" , False,
"ReduceMaxError:=" , 0,
"ReducePercentage:=" , 100,
"PointCoincidenceTol:=" , 1E-06,
"CreateLightweightPart:=", False,
"ImportMaterialNames:=" , False,
"SeparateDisjointLumps:=", False,
"SourceFile:=" , "C:\\Users\\jdoe\\Desktop\\export.model"
])

VB Syntax Import <Parameters>


oEditor.Import Array("NAME:NativeBodyParameters",
"HealOption:=" , 0,
"Options:=" , "-1",
"FileType:=" , "UnRecognized",
VB Example
"MaxStitchTol:=" , -1,
"ImportFreeSurfaces:=" , False,
"GroupByAssembly:=" , False,
"CreateGroup:=" , True,

3D Modeler Editor Script Commands 8-208


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"STLFileUnit:=" , "Auto",
"MergeFacesAngle:=" , 0.02,
"HealSTL:=" , False,
"ReduceSTL:=" , False,
"ReduceMaxError:=" , 0,
"ReducePercentage:=" , 100,
"PointCoincidenceTol:=" , 1E-06,
"CreateLightweightPart:=", False,
"ImportMaterialNames:=" , False,
"SeparateDisjointLumps:=", False,
"SourceFile:=" , "C:\\Users\\jdoe\\Desktop\\export.model")

ImportDXF [Modeler]
Imports a DXF model file.

UI Access Modeler > Import.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:options",

Parameters "FileName:=" , <string>,


"Scale:=" , <float>,
"AutoDetectClosed:=" , <boolean>,
"SelfStitch:=" , <boolean>,

3D Modeler Editor Script Commands 8-209


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"DefeatureGeometry:=" , <boolean>,
"DefeatureDistance:=" , <integer>,
"RoundCoordinates:=" , <boolean>,
"RoundNumDigits:=" , <integer>,
"WritePolyWithWidthAsFilledPoly:=", <boolean>,
"ImportMethod:=" , <integer>,
"2DSheetBodies:=" , <boolean>,
<layersArray>)
<layersArray> Array Structured array.
Array("NAME:LayerInfo",
<layer>, <layer>, <layer>,...)
<layer> Array Structured array.
Array("NAME:<layerName>",
"source:=" , <string>,
"display_source:=" , <string>,
"import:=" , <boolean>,
"dest:=" , <string>,
"dest_selected:=" , <boolean>,
"layer_type:=" , <string>)

Return Value None.

3D Modeler Editor Script Commands 8-210


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax ImportDXF(<Parameters>)


oEditor.ImportDXF(
["NAME:options",
"FileName:=", "C:/Users/jdoe/Desktop/export.dxf",
"Scale:=" , 0.001,
"AutoDetectClosed:=" , True,
"SelfStitch:=" , True,
"DefeatureGeometry:=" , False,
"DefeatureDistance:=" , 0,
"RoundCoordinates:=" , False,
"RoundNumDigits:=" , 4,
Python Example
"WritePolyWithWidthAsFilledPoly:=", False,
"ImportMethod:=" , 1,
"2DSheetBodies:=" , False,
["NAME:LayerInfo",
["NAME:0",
"source:=" , "0",
"display_source:=" , "0",
"import:=" , True,
"dest:=" , "0",
"dest_selected:=" , False,

3D Modeler Editor Script Commands 8-211


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"layer_type:=" , "signal"
],
["NAME:LAYER_1",
"source:=" , "LAYER_1",
"display_source:=" , "LAYER_1",
"import:=" , True,
"dest:=" , "LAYER_1",
"dest_selected:=" , False,
"layer_type:=" , "signal"
],
["NAME:LAYER_2",
"source:=" , "LAYER_2",
"display_source:=" , "LAYER_2",
"import:=" , True,
"dest:=" , "LAYER_2",
"dest_selected:=" , False,
"layer_type:=" , "signal"
]
]
])

3D Modeler Editor Script Commands 8-212


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syn- ImportDXF <Parameters>


tax

oEditor.ImportDXF Array("NAME:options", "FileName:=", _


"C:/Users/jdoe/Desktop/export.dxf", "Scale:=", 0.001, "AutoDetectClosed:=", _
true, "SelfStitch:=", true, "DefeatureGeometry:=", false, "DefeatureDistance:=", _
0, "RoundCoordinates:=", false, "RoundNumDigits:=", 4,
"WritePolyWithWidthAsFilledPoly:=", _
false, "ImportMethod:=", 1, "2DSheetBodies:=", false, Array("NAME:LayerInfo", Array
VB
("NAME:0", "source:=", _
Exampl- "0", "display_source:=", "0", "import:=", true, "dest:=", "0", "dest_selected:=", _
e
false, "layer_type:=", "signal"), Array("NAME:LAYER_1", "source:=", "LAYER_1", "dis-
play_source:=", _
"LAYER_1", "import:=", true, "dest:=", "LAYER_1", "dest_selected:=", false, "layer_
type:=", _
"signal"), Array("NAME:LAYER_2", "source:=", "LAYER_2", "display_source:=", "LAYER_2",
"import:=", _
true, "dest:=", "LAYER_2", "dest_selected:=", false, "layer_type:=", "signal")))

ImportGDSII [Modeler]
Imports a GDSII model file.

UI Access Modeler > Import.

Name Type Description


Parameters
<Parameters> Array Structured array.

3D Modeler Editor Script Commands 8-213


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:options",
"FileName:=" , <string>,
"FlattenHierarchy:=" , <boolean>,
"ImportMethod:=" , <integer>,
<layerMapArray>, <layerMapArray>, <layerMapArray>,...
"OrderMap:=" ,
[ "entry:=" ,
<entry>, <entry>, <entry>,...
]
])
<layerMapArray> Array Structured array.
Array("NAME:LayerMapInfo",
"LayerNum:=" , <integer>,
"DestLayer:=" , <string>,
"layer_type:=" , <string>)
<entry> Array Structured array.
Array("order:=" , <integer LayerNum>, "layer:=" ,
<string DestLayer>)

Return Value None.

Python Syntax ImportGDSII(<Parameters>)

3D Modeler Editor Script Commands 8-214


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oEditor.ImportGDSII(
["NAME:options",
"FileName:=", "C:/Users/coil2.gds",
"FlattenHierarchy:=" , True,
"ImportMethod:=" , 1,
["NAME:LayerMap",
["NAME:LayerMapInfo",
"LayerNum:=" , 12,
"DestLayer:=" , "Signal12",
"layer_type:=" , "signal"
Python Example ],
["NAME:LayerMapInfo",
"LayerNum:=" , 13,
"DestLayer:=" , "Signal13",
"layer_type:=" , "signal"
],
["NAME:LayerMapInfo",
"LayerNum:=" , 14,
"DestLayer:=" , "Signal14",
"layer_type:=" , "signal"
]

3D Modeler Editor Script Commands 8-215


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

],
"OrderMap:=",
[
"entry:=",
["order:=", 0, "layer:=", "Signal12"],
"entry:=",
["order:=", 1, "layer:=", "Signal13"],
"entry:=",
["order:=", 2, "layer:=", "Signal14"]
]
])

VB Syntax ImportGDSII <Parameters>


oEditor.ImportGDSII Array("NAME:options",
"FileName:=", "C:/export.gds",
"FlattenHierarchy:=", True,
VB Example "ImportMethod:=", 1,
Array("NAME:LayerMap",
Array("NAME:LayerMapInfo",
"LayerNum:=", 1,

3D Modeler Editor Script Commands 8-216


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"DestLayer:=", "Signal1",
"layer_type:=", "signal"]))
"OrderMap:=", Array(
"entry:=", Array(
"order:=", 0,
"layer:=", "Signal1")))

Intersect
Intersects specified objects.

UI Access Modeler > Boolean > Intersect.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Parameters
Array("NAME:IntersectParameters",
"KeepOriginals:=" , <boolean True to
keep original objects; False to delete>)

Return Value None.

Python Syntax Intersect(<SelectionsArray>, <Parameters>)


oEditor.Intersect(
Python Example ["NAME:Selections",
"Selections:=", "Rectangle1,Rectangle2"

3D Modeler Editor Script Commands 8-217


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

],
["NAME:IntersectParameters",
"KeepOriginals:=", False
])

VB Syntax Intersect <SelectionsArray> <Parameters>


oEditor.Intersect
Array("NAME:Selections",
VB Example "Selections:=", "Rectangle1,Rectangle2")
Array("NAME:IntersectParameters",
"KeepOriginals:=", False)

MoveCStoEnd
Moves a specified Object Coordinate System to the end of the History tree.

UI Access Modeler > Coordinate System > Move CS to End.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

3D Modeler Editor Script Commands 8-218


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax MoveCStoEnd (<SelectionsArray>)


oEditor.MoveCSToEnd(
["NAME:Selections",
Python Example
"Selections:=" , "ObjectCS1"
])

VB Syntax MoveCStoEnd <SelectionsArray>


VB Example oEditor.MoveCSToEnd Array("NAME:Selections", "Selections:=", "ObjectCS1")

MoveEntityToGroup
Moves a specified entity or entities to a specified group.

UI Access Drag item into the group in the history tree.

Name Type Description


<Objects> Array Structured array. Selects the entity/entities to move.
Array("Objects:=" , <array containing string
Parameters
object IDs>)
<MoveEntityToGroup> Array Structured array.
Array("ParentGroup:=" , <string group name>)

Return Value None.

Python Syntax MoveEntityToGroup (<Objects>, <MoveEntityToGroup>)

3D Modeler Editor Script Commands 8-219


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oEditor.MoveEntityToGroup(
Python Example ["Objects:=", ["Box3"]],
["ParentGroup:=", "Box_Group"])

VB Syntax MoveEntityToGroup <Objects> <MoveEntityToGroup>


oEditor.MoveEntityToGroup
VB Example Array("Objects:=", Array("Box3"))
Array("ParentGroup:=", "Box_Group")

MoveFaces
Moves the specified faces along normal or along a vector.

UI Access Modeler > Surface > Move Faces > Along [Normal/Vector].

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<MoveFacesParametersArray> Array Structured array.
Array("NAME:Parameters",
Parameters <FacesOfOneObjToMove>, <FacesOfOneOb-
jToMove>, ...)
<FacesOfOneObjToMove> Array Structured array.
Array("Name:MoveFacesParameters",
"MoveAlongNormalFlag:=", <boolean>,

3D Modeler Editor Script Commands 8-220


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"OffsetDistance:=", <string>,
"MoveVectorX:=", <string>,
"MoveVectorY:=", <string>,
"MoveVectorZ:=", <string>,
"FacesToMove:=", <array>)
MoveAlongNormalFlag specifies whether to move along the
face normal or along a vector. If false, provide the MoveVectorX,
MoveVectorY, and MoveVectorZ parameters.
FacesToMove is an array of integers (the IDs of the faces to
move).

Return Value None

Python Syntax MoveFaces (<SelectionsArray>, <MoveFacesParametersArray>)


oEditor.MoveFaces(
[
"NAME:Selections",
"Selections:=" , "Rectangle1",
"NewPartsModelFlag:=" , "Model"
],
[
Python Example "NAME:Parameters",
[
"NAME:MoveFacesParameters",
"MoveAlongNormalFlag:=" , True,
"OffsetDistance:=" , "1mm",
"MoveVectorX:=" , "0mm",
"MoveVectorY:=" , "0mm",

3D Modeler Editor Script Commands 8-221


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"MoveVectorZ:=" , "0mm",
"FacesToMove:=" , [183]
]
])

VB Syntax MoveFaces <SelectionsArray>, <MoveFacesParametersArray>


oEditor.MoveFaces _
Array("NAME:Selections", "Selections:=", _
"Box2,Box1"), _
Array("NAME:Parameters", _
Array("NAME:MoveFacesParameters", _
"MoveAlongNormalFlag:=", true, _
"OffsetDistance:=", "1mm", _
VB Example "FacesToMove:=", Array(218)),
Array("NAME:MoveFacesParameters", _
"MoveAlongNormalFlag:=", false,_
"OffsetDistance:=", "1mm", _
"MoveVectorX:=", "1mm", _
"MoveVectorY:=", "0mm", _
"MoveVectorZ:=", "0mm", _
"FacesToMove:=", Array(185)))

3D Modeler Editor Script Commands 8-222


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

ProjectSheet
Project a sheet object, typically for modeling thin conformal deposits. Typically followed by Thicken Sheet.

UI Access Click Modeler > Surface > Project Sheet.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
Parameters <Parameters> Array Array containing string.
Array("NAME:ProjectSheetParameters")

Return Value None.

Python Syntax ProjectSheet (<SelectionsArray>, <Parameters>)


oEditor.ProjectSheet(
['NAME:Selections',
Python Example 'Selections:=','Box1,Box2,Polyline1'],
['NAME:ProjectSheetParameters']
)

VB Syntax ProjectSheet <SelectionsArray> <Parameters>


oEditor.ProjectSheet
VB Example Array("NAME:Selections",
"Selections:=", "Box1,Box2,Polyline1"),

3D Modeler Editor Script Commands 8-223


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:ProjectSheetParameters")

PurgeHistory
Purges the history of a specified object.

UI Access Modeler > Purge History.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

Python Syntax PurgeHistory (<SelectionsArray>)


oEditor.PurgeHistory(
["NAME:Selections",
Python Example "Selections:=", "Box2",
"NewPartsModelFlag:=", "Model"
])

VB Syntax PurgeHistory <SelectionsArray>


oEditor.PurgeHistory
VB Example
Array("NAME:Selections",

3D Modeler Editor Script Commands 8-224


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Selections:=", "Box2",
"NewPartsModelFlag:=", "Model")

Section
Creates a 2D cross-section of the selection in the specified plane.

UI Access Modeler > Surface > Section.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Array("NAME:SectionToParameters",
Parameters
"CreateNewObjects:=" , <boolean>,
"SectionPlane:=" , <string "XY", "YZ", or
"ZX">,
"SectionCrossObject:=" , <boolean>)

Return Value None.

Python Syntax Section (<SelectionsArray>, <Parameters>)


oEditor.Section(
["NAME:Selections",
Python Example "Selections:=" , "Cone1",
"NewPartsModelFlag:=" , "Model"
],

3D Modeler Editor Script Commands 8-225


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["NAME:SectionToParameters",
"CreateNewObjects:=" , True,
"SectionPlane:=" , "XY",
"SectionCrossObject:=" , False
])

VB Syntax Section <SelectionsArray> <Parameters>


oEditor.Section
Array("NAME:Selections",
"Selections:=" , "Cone1",
"NewPartsModelFlag:=" , "Model")
VB Example
Array("NAME:SectionToParameters",
"CreateNewObjects:=" , True,
"SectionPlane:=" , "XY",
"SectionCrossObject:=" , False)

SeparateBody
Separates the bodies of specified multi-lump objects.

UI Access Modeler > Boolean > Separate Bodies.

3D Modeler Editor Script Commands 8-226


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

Python Syntax SeparateBody (<SelectionsArray>)


oEditor.SeparateBody(
["NAME:Selections",
Python Example "Selections:=", "Rectangle1,Circle1",
"NewPartsModelFlag:=", "Model"
])

VB Syntax SeparateBody <SelectionsArray>


oEditor.SeparateBody
Array("NAME:Selections",
VB Example
"Selections:=", "Rectangle1,Circle1",
"NewPartsModelFlag:=", "Model")

SetModelUnits
Sets the model units.

UI Access Modeler > Units.

3D Modeler Editor Script Commands 8-227


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


<Parameters> Array Structured array.
Array("NAME:Units Parameter",
Parameters "Units:=", <string>,
"Rescale:=", <boolean True to rescale model;
else False>)
To see valid unit strings, select Modeler > Units.

Return Value None.

Python Syntax SetModelUnits (<Parameters>)


oEditor.SetModelUnits(
["NAME:Units Parameter",
Python Example "Units:=", "km",
"Rescale:=", False
])

VB Syntax SetModelUnits <Parameters>


oEditor.SetModelUnits
VB Example
Array("NAME:Units Parameter",

3D Modeler Editor Script Commands 8-228


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Units:=", "km",
"Rescale:=", False)

SetWCS
Sets the working coordinate system.

UI Access Modeler > Coordinate System > Set Working CS.

Name Type Description


<Parameters> Array Structured array.
Array("NAME:SetWCS Parameter",
Parameters
"Working Coordinate System:=", <string CS name>,
"RegionDepCSOk:=" , <boolean True if region-depend-
ent; else False)

Return Value None.

Python Syntax SetWCS (<Parameters>)


oEditor.SetWCS(
["NAME:SetWCS Parameter",
Python Example "Working Coordinate System:=", "Global",
"RegionDepCSOk:=", False
])

3D Modeler Editor Script Commands 8-229


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax SetWCS <Parameters>


oEditor.SetWCS
Array("NAME:SetWCS Parameter",
VB Example
"Working Coordinate System:=", "Global",
"RegionDepCSOk:=", False)

ShowWindow
Opens the active 3D Modeler window.

UI Access None.
Parameters None.
Return Value None.

Python Syntax ShowWindow


Python Example oEditor.ShowWindow()

VB Syntax ShowWindow
VB Example oEditor.ShowWindow

Split
Splits the specified object(s) along a plane.

3D Modeler Editor Script Commands 8-230


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access Modeler > Boolean > Split.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Array("NAME:SplitToParameters",
"SplitPlane:=" , <string "XY", "YZ", "ZX", or
"Dummy">,
"WhichSide:=" , <string "PositiveOnly", "Neg-
ativeOnly" or "Both">,
"ToolType:=" , <string "PlaneTool" or
"FaceTool">,
"ToolEntityID:=" , <-1 if using SplitPlane; else
FaceID>,
Parameters "SplitCrossingObjectsOnly:=", <boolean>,
"DeleteInvalidObjects:=", <boolean>)
You can split an object either along an existing plane , or by creating a
plane using an edge.
For existing plane:
l SplitPlane is "XY", "YZ", or "ZX"
l ToolType is "PlaneTool"
l ToolEntityID is -1

Possible values for 2D XY designs are "YZ", "ZX".


Possible values for 2D RZ designs are "XY", "YZ".
For an edge:

3D Modeler Editor Script Commands 8-231


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

l SplitPlane is "Dummy"
l ToolType is "EdgeTool"
l ToolEntityID is the face ID

Return Value None.

Python Syntax Split(<SelectionsArray>, <Parameters>)


oEditor.Split(
["NAME:Selections",
"Selections:=" , "Box1",
"NewPartsModelFlag:=" , "Model"
],
["NAME:SplitToParameters",
Python Example "SplitPlane:=" , "XY",
"WhichSide:=" , "PositiveOnly",
"ToolType:=" , "PlaneTool",
"ToolEntityID:=" , -1,
"SplitCrossingObjectsOnly:=", False,
"DeleteInvalidObjects:=", True
])

3D Modeler Editor Script Commands 8-232


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax Split <SelectionsArray> <Parameters>


oEditor.Split
Array("NAME:Selections",
"Selections:=" , "Box1",
"NewPartsModelFlag:=" , "Model")
Array("NAME:SplitToParameters",
VB Example "SplitPlane:=" , "XY",
"WhichSide:=" , "PositiveOnly",
"ToolType:=" , "PlaneTool",
"ToolEntityID:=" , -1,
"SplitCrossingObjectsOnly:=", False,
"DeleteInvalidObjects:=", True)

Subtract
Subtracts the specified object(s).

UI Access Modeler > Boolean > Subtract.

Name Type Description


<Selections> Array Structured array.
Array("NAME:Selections",
Parameters
"Blank Parts:=" , <string object name(s)>,
"Tool Parts:=" , <string object name(s)>)
The Tool Parts object is the object being removed.

3D Modeler Editor Script Commands 8-233


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

The Blank Parts object has any Tool Parts overlap removed.
Either string can contain more than one object.
<Parameters> Array Structured array.
Array("NAME:SubtractParameters",
"KeepOriginals:=" , <boolean>)

Return Value None.

Python Syntax Subtract(<Selections>, <Parameters>)


oEditor.Subtract(
["NAME:Selections",
"Blank Parts:=", "Rectangle1",
"Tool Parts:=", "Rectangle2"
Python Example
],
["NAME:SubtractParameters",
"KeepOriginals:=", False
])

VB Syntax Subtract <Selections> <Parameters>


oEditor.Subtract
VB Example
Array("NAME:Selections",

3D Modeler Editor Script Commands 8-234


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Blank Parts:=", "Rectangle1",


"Tool Parts:=", "Rectangle2")
Array("NAME:SubtractParameters",
"KeepOriginals:=", false)

SweepFacesAlongNormal
Sweep the specified face(s) along normal.

UI Access Modeler > Surface > Sweep Faces Along Normal

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<parameters> Array Structured array.
Array("NAME:Parameters",
Parameters
"NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=", <faceIDarray>,
"LengthOfSweep:=", "<value><units>")

Return Value None

Python Syntax SweepFacesAlongNormal(<SelectionsArray> <parameters>)


oEditor.SweepFacesAlongNormal(
Python Example ["NAME:Selections",
"Selections:=", "Rectangle1",

3D Modeler Editor Script Commands 8-235


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NewPartsModelFlag:=", "Model"],
["NAME:Parameters",
"NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=", [183],
"LengthOfSweep:=", "0.1mm"])

VB Syntax SweepFacesAlongNormal <SelectionsArray> <parameters>


oEditor.SweepFacesAlongNormal
Array("NAME:Selections",
"Selections:=", "Rectangle1",
"NewPartsModelFlag:=", "Model"),
VB Example Array("NAME:Parameters",
"NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=", Array(57),
"LengthOfSweep:=", "0.5mm")
)

ThickenSheet
Thickens a sheet object to convert it to a 3D object.

3D Modeler Editor Script Commands 8-236


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access Modeler > Surface > Thicken Sheet

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<parameters> Array Structured array.
Parameters Array("NAME:SheetThickenParameters",
"Thickness:=" , <string>,
"BothSides:=" , <boolean>)

Return Value None.

Python Syntax ThickenSheet (<SelectionsArray> <parameters>)


oEditor.ThickenSheet(
["NAME:Selections",
"Selections:=" , "Rectangle3",
"NewPartsModelFlag:=" , "Model"
Python Example ],
["NAME:SheetThickenParameters",
"Thickness:=" , "0.01mm",
"BothSides:=" , False
])

3D Modeler Editor Script Commands 8-237


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax ThickenSheet <SelectionsArray> <parameters>


oEditor.ThickenSheet
Array("NAME:Selections",
"Selections:=" , "Rectangle3",
VB Example "NewPartsModelFlag:=" , "Model")
Array("NAME:SheetThickenParameters",
"Thickness:=" , "0.01mm",
"BothSides:=" , false)

UncoverFaces
Uncovers the specified face(s).

UI Access Modeler > Surface > Uncover Faces

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<parameters> Array Structured array.

Parameters Array("NAME:Parameters",
Array("NAME:UncoverFacesParameters",
"FacesToUncover:=" , <array of face
IDs>))

Return Value None.

3D Modeler Editor Script Commands 8-238


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax UncoverFaces(<SelectionsArray> <parameters>)


oEditor.UncoverFaces(
["NAME:Selections",
"Selections:=" , "Box1",
"NewPartsModelFlag:=" , "Model"
],
Python Example
["NAME:Parameters",
["NAME:UncoverFacesParameters",
"FacesToUncover:=" , [12,16,18]
]
])

VB Syntax UncoverFaces <SelectionsArray> <parameters>


oEditor.UncoverFaces
Array("NAME:Selections",
"Selections:=" , "Box1",
VB Example "NewPartsModelFlag:=" , "Model")
Array("NAME:Parameters",
Array("NAME:UncoverFacesParameters",
"FacesToUncover:=" , Array(12,16,18)))

3D Modeler Editor Script Commands 8-239


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Unite
Unites the specified objects.

UI Access Modeler > Boolean > Unite

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<parameters> Array Structured array.
Array("NAME:UniteParameters",
"KeepOriginals:=" , <boolean>,

Parameters "TurnOnNBodyBoolean:=", <boolean>)

Note:

TurnOnNBodyBoolean is set to True by default.


Enabled by Parasolid, this unites n bodies in a
single step, rather than uniting them one by one.

Return Value None.

Python Syntax Unite(<SelectionsArray>, <parameters>)


oEditor.Unite(
Python Example ["NAME:Selections",
"Selections:=", "Rectangle1,Rectangle2"

3D Modeler Editor Script Commands 8-240


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

],
["NAME:UniteParameters",
"KeepOriginals:=", False,
"TurnOnNBodyBoolean:=", True
])

VB Syntax Unite <SelectionsArray> <parameters>


oEditor.Unite
Array("NAME:Selections",
"Selections:=", "Rectangle1,Rectangle2")
VB Example
Array("NAME:UniteParameters",
"KeepOriginals:=", false,
"TurnOnNBodyBoolean:=", true)

Ungroup
Ungroups a specified history tree group.

UI Access Modeler > Group > Ungroup

Name Type Description


Parameters <Groups> Array Structured array.
Array("Groups:=", <array of group names to ungroup>)

Return Value None

3D Modeler Editor Script Commands 8-241


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax Ungroup(<Groups>)


Python Example oEditor.Ungroup(["Groups:=", ["Group1"]] )

VB Syntax Ungroup <Groups>


VB Example oEditor.Ungroup Array("Groups:=", Array("Group1"))

WrapSheet
Wraps a sheet object to another object.

UI Access None.

Name Type Description


<SelectionsArray> Array Structured array. See: SelectionsArray.
<Parameters> Array Structured array.
Parameters
Array("NAME:WrapSheetParameters",
"Imprinted:=", <boolean>)

Return Value None.

Python Syntax WrapSheet (<SelectionsArray>, <Parameters>)


Python Example oEditor.WrapSheet(

3D Modeler Editor Script Commands 8-242


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["NAME:Selections",
"Selections:=","Rectangle1,Box1"
],
["NAME:WrapSheetParameters",
"Imprinted:=", True
]
)

VB Syntax WrapSheet <SelectionsArray> <Parameters>


oEditor.WrapSheet
Array("NAME:Selections",
VB Example "Selections:=", "Rectangle1,Box1"),
Array("NAME:WrapSheetParameters",
"Imprinted:=", true)

Other oEditor Commands


AddDefinitionFromBlock
AddDefinitionFromLibFile
AddViewOrientation
BreakUDMConnection
ChangeProperty

3D Modeler Editor Script Commands 8-243


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Delete
FitAll
GetBodyNamesByPosition
GetChildNames [Modeler]
GetChildOjbect [Modeler]
GetChildTypes [Modeler]
GetEdgeByPosition
GetEdgeIDsFromObject
GetEdgeIDsFromFace
GetEntityListIDByName
GetExtendedDefinitionObject
GetFaceArea
GetFaceByPosition
GetFaceCenter
GetFaceIDs
GetGeometryModelerMode
GetMatchedObjectName
GetModelBoundingBox
GetModelUnits
GetNumObjects

3D Modeler Editor Script Commands 8-244


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetObjectIDByName
GetObjectName
GetObjectNameByFaceID
GetObjectsByMaterial
GetObjectsInGroup
GetObjectVolume
GetPropertyValue
GetPropEvaluatedValue
GetPropNames
GetPropSIValue
GetPropValue
GetSelections
GetUserPosition
GetVertexIDsFromEdge
GetVertexIDsFromFace
GetVertexIDsFromObject
GetVertexPosition
OpenExternalEditor
PageSetup
RenamePart
SetPropValue [Modeler]

3D Modeler Editor Script Commands 8-245


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AddDefinitionFromBlock
Adds a material definition from block text (same definition format as would be contained in the material library file) by library type
(using definition folder name). This scripting command directly supports the .AMAT (or .ASURF) definition formats.

UI Access N/A

Name Type Description

<defBlock> String Text of the new material definition in block form.


Parameters <defFolderName> String Library type (by definition folder name)
<newTimeStamp> String New timestamp (time_t as integer number of seconds since 1/1/1970 12:00am,
as string), default is current time
<replaceExisting> Boolean True to replace existing, False to choose a new unique name if an existing defin-
ition is found

Return Value A property scripting object for the definition.

P- AddDefinitionFromBlock(<defBlock>,<defFolderName>, <newTimeStamp>, <replaceExisting>)


yt-
h-
o-
n
S-
y-
nt-
ax

P- oProject = oDesktop.NewProject()
yt-
h- oProject.InsertDesign("HFSS", "HFSSDesign1", "DrivenModal", "")

3D Modeler Editor Script Commands 8-246


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oDesign = oProject.SetActiveDesign("HFSSDesign1")
oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateBox(

"NAME:BoxParameters",

"XPosition:=" , "-0.4mm",
"YPosition:=" , "-1mm",
o-
n "ZPosition:=" , "0mm",
E-
x- "XSize:=" , "1.4mm",
a-
m- "YSize:=" , "1.6mm",
pl-
e
"ZSize:=" , "0.6mm"
],

"NAME:Attributes",
"Name:=" , "Box1",

"Flags:=" , "",

"Color:=" , "(143 175 143)",

3D Modeler Editor Script Commands 8-247


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Transparency:=" , 0,

"PartCoordinateSystem:=", "Global",

"UDMId:=" , "",

"MaterialValue:=" , "\"vacuum\"",

"SurfaceMaterialValue:=", "\"\"",

"SolveInside:=" , True,

"ShellElement:=" , False,

"ShellElementThickness:=", "0mm",

"IsMaterialEditable:=" , True,

"UseMaterialAppearance:=", False,

"IsLightweight:=" , False

])

3D Modeler Editor Script Commands 8-248


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oDefinitionManager = oProject.GetDefinitionManager()
defBlock = "$begin 'vacuum2' $begin 'AttachedData' $begin 'MatAppearanceData' property_data-
='appearance_data' Red=230 Green=230 Blue=230 Transparency=0.95 $end 'MatAppearanceData'
$end 'AttachedData' simple('permittivity', 1) ModTime=1499970477 $end 'vacuum2'"
added = oDefinitionManager.AddDefinitionFromBlock(defBlock, "Materials", "10101010", True)
addedName = ''
if isinstance(added, basestring):
addedName = added
elif isinstance(added, list):
addedName = added[0]
else:

addedName = added.GetName().replace("Materials:", "")


AddInfoMessage(os.path.basename(__file__) + " result: " + addedName)
materialNameInQuotes = "\"" + addedName + "\""
oEditor.ChangeProperty(
[

"NAME:AllTabs",

"NAME:Geometry3DAttributeTab",

3D Modeler Editor Script Commands 8-249


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NAME:PropServers",

"Box1"

],

"NAME:ChangedProps",

"NAME:Material",

"Value:=", materialNameInQuotes

]
]
]
])

3D Modeler Editor Script Commands 8-250


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AddDefinitionFromLibFile
Adds a material definition from a library file (e.g. AMAT file), by name and library type (using definition folder name) . This scripting
command directly supports the .AMAT (or .ASURF) definition formats.

UI Access N/A

Name Type Description

<FilePath> String Path of the library file (i.e. AMAT file or ASURF file)
<defName> String Which definition to use, required because a lib file can have multiple definitions.
Parameters
<defFolderName> String Library type (by definition folder name).
<newTimeStamp> String New timestamp string (time_t as integer, number of seconds since 1/1/1970
12:00am), default is current time
<replaceExisting> Boolean True to replace existing, False to choose a new unique name if an existing defin-
ition is found, default is False

Return Value Property scripting object for the definition.

Python AddDefinitionFromLibFile(<FilePath>, <defName>, <defFolderName>, <newTimeStamp>,<replaceExisting>)


Syntax

oProject = oDesktop.NewProject()
oProject.InsertDesign("HFSS", "HFSSDesign1", "DrivenModal", "")

Python oDesign = oProject.SetActiveDesign("HFSSDesign1")


Example
oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateBox(

3D Modeler Editor Script Commands 8-251


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NAME:BoxParameters",

"XPosition:=" , "-0.4mm",
"YPosition:=" , "-1mm",
"ZPosition:=" , "0mm",
"XSize:=" , "1.4mm",
"YSize:=" , "1.6mm",
"ZSize:=" , "0.6mm"
],

"NAME:Attributes",
"Name:=" , "Box1",

"Flags:=" , "",

"Color:=" , "(143 175 143)",

"Transparency:=" , 0,

3D Modeler Editor Script Commands 8-252


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"PartCoordinateSystem:=", "Global",

"UDMId:=" , "",

"MaterialValue:=" , "\"vacuum\"",

"SurfaceMaterialValue:=", "\"\"",

"SolveInside:=" , True,

"ShellElement:=" , False,

"ShellElementThickness:=", "0mm",

"IsMaterialEditable:=" , True,

"UseMaterialAppearance:=", False,

"IsLightweight:=" , False

])
oDefinitionManager = oProject.GetDefinitionManager()
scriptDir = os.path.dirname(os.path.realpath(__file__))
amatFilePath = scriptDir + '/material0.txt'
materialName = "material0"

3D Modeler Editor Script Commands 8-253


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

materialNameInQuotes = "\"" + materialName + "\""


added = oDefinitionManager.AddDefinitionFromLibFile(amatFilePath, materialName, "Mater-
ials", "")
addedName = ''
if isinstance(added, basestring):
addedName = added
elif isinstance(added, list):
addedName = added[0]
else:
addedName = added.GetName().replace("Materials:", "")
AddInfoMessage(os.path.basename(__file__) + " result: " + addedName)
oEditor.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Geometry3DAttributeTab",
[
"NAME:PropServers",
"Box1"
],

3D Modeler Editor Script Commands 8-254


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

[
"NAME:ChangedProps",
[
"NAME:Material",
"Value:=", materialNameInQuotes
]
]
]
])

AddViewOrientation
Creates a new orientation using a script. Input parameters can be either vector components or angles. Local view orientation specific
to a design can be saved in project by calling Save() on the project object.

Note:

You cannot use the name of an existing view. Default views include: top, bottom, right, left, front, back, trimetric, dimetric,
and isometric.

UI Access View > Modify Attributes > Orientation List. Enter parameters and click Add.

Name Type Description


<orientationName> String Name of the new orientation.
Parameters <isGlobalOrientation> Long 1 to save global; else 0.
<OrientationVectorComponents> Array Structured array. Use either <Ori-
entationVectorComponents> or <OrientationAnglesArray>.

3D Modeler Editor Script Commands 8-255


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:OrientationVectorComponents",
Array("NAME:Direction",
<float>,
<float>,
<float>,
Array("NAME:Up",
<float>,
<float>,
<float>))
<OrientationAnglesArray> Array Structured array. Use either <Ori-
entationVectorComponents> or <OrientationAnglesArray>.
Array("NAME:OrientationAngles",
"Psi:=" , <float>,
"Theta:=" , <float>,
"Phi:=" , <float>)
<ProjectionParams> Array Optional. Structured array containing arrays of four optional
parameters: Scaling, Translation, Projection Type, and
Projection Limits.
Array("NAME:ProjectionParams",
Array("NAME:Scaling",
<float>,
<float>,

3D Modeler Editor Script Commands 8-256


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<float>
),
Array("NAME:Translation",
<float>,
<float>,
<float>
),
"ProjectionType:=" ,
<string "Orthographic" or "Perspective">,
Array("NAME:ProjectionLimits",
<float>,
<float>,
<float>,
<float>,
<float>,
<float>
)
)

Return Value None.

Python Syntax AddViewOrientation(<orientationName>, <isGlobalOrientation>, <OrientationVectorComponents or Ori-

3D Modeler Editor Script Commands 8-257


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

entationAnglesArray>, <ProjectionParams>)

Example Using Angles and Projection Parameters:


oEditor.AddViewOrientation("orientation3", 0,
["NAME:OrientationAngles",
"Psi:=" , -161.565002441406,
"Theta:=" , 32.3115005493164,
"Phi:=" , 0 ],

["NAME:ProjectionParams",

["NAME:Scaling",
Python Example
0.591607987880707,

0.591607987880707,

0.591607928276062
],

["NAME:Translation",

0,
2.38418579101563E-07,

3D Modeler Editor Script Commands 8-258


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

-5.7486834526062
],
"ProjectionType:=" , "Orthographic",

["NAME:ProjectionLimits",

-2.44362282752991,
2.44362282752991,

-1,

1,
0.625207424163818,
10.8721580505371
]
]
)
Example Using Vector without Projection Parameters:
oEditor.AddViewOrientation("orientation6", 0,
["NAME:OrientationVectorComponents",
["NAME:Direction",
-0.801783978939056,
-0.267262011766434,

3D Modeler Editor Script Commands 8-259


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

-0.534521996974945
],
["NAME:Up",
-0.507091999053955,
-0.169030994176865,
0.845155000686646
]
])

AddViewOrientation <orientationName>, <isGlobalOrientation>, <OrientationVectorComponents or Ori-


VB Syntax
entationAnglesArray>, <ProjectionParams>

Example Using Angles and Projection Parameters:


oEditor.AddViewOrientation "orientation3", 0,
Array("NAME:OrientationAngles",
"Psi:=" , -161.565002441406,

VB Example "Theta:=" , 32.3115005493164,


"Phi:=" , 0 ),

Array("NAME:ProjectionParams",

Array("NAME:Scaling",

3D Modeler Editor Script Commands 8-260


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

0.591607987880707,

0.591607987880707,

0.591607928276062
),

Array("NAME:Translation",

0,
2.38418579101563E-07,
-5.7486834526062
),
"ProjectionType:=" , "Orthographic",

Array("NAME:ProjectionLimits",

-2.44362282752991,
2.44362282752991,

-1,

1,

3D Modeler Editor Script Commands 8-261


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

0.625207424163818,
10.8721580505371
)
)
Example Using Vector without Projection Parameters:
oEditor.AddViewOrientation "orientation6", 0,
Array("NAME:OrientationVectorComponents",
Array("NAME:Direction",
-0.801783978939056,
-0.267262011766434,
-0.534521996974945
),
Array("NAME:Up",
-0.507091999053955,
-0.169030994176865,
0.845155000686646
)
)

BreakUDMConnection
Breaks a current UDM connection to SpaceClaim.

3D Modeler Editor Script Commands 8-262


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access Break Connection.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

Python Syntax BreakUDMConnection (<SelectionsArray>)


oEditor.BreakUDMConnection(
[
Python Example "NAME:Selections",
"Selections:=" , "SpaceClaim1"
])

VB Syntax BreakUDMConnection <SelectionsArray>


oEditor.BreakUDMConnection Array("NAME:Selections",
VB Example
"Selections:=", "")

ChangeProperty
Changes the properties of an object in the history tree.

UI Access Right-click an object in the History Tree and select Properties.

Name Type Description


Parameters
<propertyArgs> Array Structured array. The properties vary depending on the

3D Modeler Editor Script Commands 8-263


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

object. Due to the number of potential configurations, it is


recommended that you generate this script using the UI's
Automation tab.

Return Value None.

Python Syntax ChangeProperty(<propertyArgs>)

Example Changing the Position of a Box:


oEditor.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Geometry3DCmdTab",
[
"NAME:PropServers" ,
"Box1:CreateBox:1"
],
Python Example [
"NAME:ChangedProps",
[
"NAME:Position",
"X:=" , "0.35in",
"Y:=" , "0.55in",
"Z:=" , "0in"
]
]
]
])

3D Modeler Editor Script Commands 8-264


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Example Changing a Box's Material and Wireframe Display:


oEditor.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Geometry3DAttributeTab",
[
"NAME:PropServers" ,
"Box1"
],
[
"NAME:ChangedProps",
[
"NAME:Material",
"Value:=" , "\"vacuum\""
],
[
"NAME:Display Wireframe",
"Value:=" , True
]
]
]
])
Example Changing the Model Depth:
oEditor.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Maxwell2D",
[
"NAME:PropServers",
"Design Settings"

3D Modeler Editor Script Commands 8-265


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

],
[
"NAME:ChangedProps",
[
"NAME:Model settings/Depth",
"Value:=" , "2.4mm"
]
]
]
])
Example Changing 2D Transient Use of Band Mapping Angle:
oEditor.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:MeshSetupTab",
[
"NAME:PropServers",
"MeshSetup:CylindricalGap1"
],
[
"NAME:ChangedProps",
[
"NAME:Use Band Mapping Angle",
"Value:=" , True
]
]
]
])
oEditor.ChangeProperty(

3D Modeler Editor Script Commands 8-266


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

[
"NAME:AllTabs",
[
"NAME:MeshSetupTab",
[
"NAME:PropServers",
"MeshSetup:CylindricalGap1"
],
[
"NAME:ChangedProps",
[
"NAME:Band Mapping Angle",
"Value:=" , "2deg" ]
]
]
])
Example Edit VirtualPort Excitation by changing component properties:
oEditor.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Component Data",
[
"NAME:PropServers",
"BoundarySetup:LC1_1_Port1"
],
[
"NAME:ChangedProps",
[
"NAME:Voltage",
"Value:=" , "10mV" ]
]
]

3D Modeler Editor Script Commands 8-267


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

])
...

VB Syntax ChangeProperty <propertyArgs>

Example Changing the Position of a Box:


oEditor.ChangeProperty
Array("NAME:AllTabs",
Array("NAME:Geometry3DCmdTab",
Array("NAME:PropServers" ,
"Box1:CreateBox:1"
),
Array("NAME:ChangedProps",
Array("NAME:Position",
"X:=" , "0.35in",
"Y:=" , "0.55in",
"Z:=" , "0in"
VB Example )
)
)
)
Example Changing a Box's Material and Wireframe Display:
oEditor.ChangeProperty(
Array("NAME:AllTabs",
Array("NAME:Geometry3DAttributeTab",
Array("NAME:PropServers",
"Box1"
),

3D Modeler Editor Script Commands 8-268


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:ChangedProps",
Array("NAME:Material",
"Value:=", "\"vacuum\""
),
Array("NAME:Display Wireframe",
"Value:=", True
)
)
)
)
Example Changing the Model Depth:
oEditor.ChangeProperty
Array("NAME:AllTabs",
Array("NAME:Maxwell2D",
Array("NAME:PropServers"
"Design Settings"
),
Array("NAME:ChangedProps",
Array("NAME:Model settings/Depth",
"Value:=", "2.4mm"
)
)
)
)
Example Changing 2D Transient Use of Band Mapping Angle:
oEditor.ChangeProperty
Array("NAME:AllTabs",
Array("NAME:MeshSetupTab",
Array("NAME:PropServers"
"MeshSetup:CylindricalGap1"
),
Array("NAME:ChangedProps",

3D Modeler Editor Script Commands 8-269


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:Use Band Mapping Angle",


"Value:=", True
)
)
)
)
oEditor.ChangeProperty
Array("NAME:AllTabs",
Array("NAME:MeshSetupTab",
Array("NAME:PropServers"
"MeshSetup:CylindricalGap1"
),
Array("NAME:ChangedProps",
Array("NAME:Band Mapping Angle",
"Value:=", "2deg" )
)
)
)

Delete
Deletes the specified object(s).

UI Access Edit > Delete.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

3D Modeler Editor Script Commands 8-270


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax Delete(<SelectionsArray>)


oEditor.Delete(
["NAME:Selections",
Python Example
"Selections:=", "Rectangle1,Rectangle2"
])

VB Syntax Delete <SelectionsArray>


VB Example oEditor.Delete Array("NAME:Selections", "Selections:=", "Rectangle1,Rectangle2")

GetBodyNamesByPosition
Returns the names of objects that contact a specified point.

UI Access N/A

Name Type Description


<positionParameters> Array Structured array containing position coordinates for active coordinate sys-
tem.
Array("NAME:Parameters",
Parameters
"XPosition:=", <string>,
"YPosition:=", <string>,
"ZPosition:=", <string>)

Return Value Array containing string object names.

3D Modeler Editor Script Commands 8-271


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetBodyNamesByPosition (<positionParameters>)


oEditor.GetBodyNamesByPosition(
["NAME:Parameters",
"XPosition:=","0mm",
Python Example "YPosition:=","15mm",
"ZPosition:=","0mm"
]
)

VB Syntax GetBodyNamesByPosition <positionParameters>


oEditor.GetBodyNamesByPosition Array("NAME:Parameters", _
"XPosition:=", "0mm", _
VB Example
"YPosition:=", "15mm", _
"ZPosition:=", "0mm")

GetEdgeByPosition
Returns the ID for edge(s) that contact a specified point.

UI Access N/A

Name Type Description


Parameters
<positionParameters> Array Structured array.

3D Modeler Editor Script Commands 8-272


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:EdgeParameters",
"BodyName:=", <string object name>,
"Xposition:=", <string>,
"YPosition:=", <string>,
"ZPosition:=", <string>)
Note:
For 2D XY Designs, ZPosition should be set to "0".
For 2D RZ Designs, YPosition should be set to "0".

Return Value Array containing string edge IDs.

Python Syntax GetEdgeByPosition (<positionParameters>)


oEditor.GetEdgeByPosition(
["NAME:EdgeParameters",
"BodyName:=", "Box1",
"Xposition:=", "10mm",
Python Example
"YPosition:=", "0mm",
"ZPosition:=", "10mm"
]
)

3D Modeler Editor Script Commands 8-273


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax GetEdgeByPosition <positionParameters>


oEditor.GetEdgeByPosition Array("NAME:EdgeParameters",
"BodyName:=", "Box1",
VB Example "Xposition:=", "10mm",
"YPosition:=", "0mm",
"ZPosition:=", "10mm")

GetEdgeIDsFromFace
Returns the edge IDs for a specified Face ID.

UI Access N/A

Name Type Description


Parameters
<faceID> Integer ID of the specified face.

Return Value Array containing string edge IDs.

Python Syntax GetEdgeIDsFromFace (<faceID>)


Python Example oEditor.GetEdgeIDsFromFace(20)

VB Syntax GetEdgeIDsFromFace <faceID>


VB Example oEditor.GetEdgeIDsFromFace 20

3D Modeler Editor Script Commands 8-274


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetEdgeIDsFromObject
Returns the edge IDs for a specified object.

UI Access N/A

Name Type Description


Parameters
<object> String Object name.

Return Value Array containing string edge IDs.

Python Syntax GetEdgeIDsFromObject (<object>)


Python Example oEditor.GetEdgeIDsFromObject("Box1")

VB Syntax GetEdgeIDsFromObject <object>


VB Example oEditor.GetEdgeIDsFromObject "Box1"

GetFaceArea
Returns the area of a specified face.

UI Access N/A

Name Type Description


Parameters
<faceID> Integer ID of specified face.

Return Value Long integer of face area.

3D Modeler Editor Script Commands 8-275


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetFaceArea (<faceID>)


Python Example oEditor.GetFaceArea(19)

VB Syntax GetFaceArea <faceID>


VB Example oEditor.GetFaceArea 19

GetFaceCenter
Returns the center position of a specified face.

UI Access N/A

Name Type Description


Parameters
<planarFaceID> Long Face ID

Return Value Array containing string X, Y, Z coordinates.

Python Syntax GetFaceCenter (<planarFaceID>)


Python Example oEditor.GetFaceCenter(12)

VB Syntax GetFaceCenter <planarFaceID>


VB Example oEditor.GetFaceCenter 12

3D Modeler Editor Script Commands 8-276


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetFaceByPosition
Returns the face ID located at a specified position.

Note:

The coordinates must point to exactly one face, not a vertex or edge where two or more faces join.

UI Access N/A

Name Type Description


<FaceParameters> Array Structured Array.
Array("NAME:FaceParameters",
"BodyName:=", <string>,

Parameters "XPosition:=", <string>,


"YPosition:=", <string>,
"ZPosition:=", <string>)
For 2D XY Designs, ZPosition should be set to "0".
For 2D RZ Designs, YPosition should be set to "0".

Return Value Integer Face ID.

Python Syntax GetFaceByPosition(<FaceParameters>)


oEditor.GetFaceByPosition(
Python Example
["NAME:FaceParameters",

3D Modeler Editor Script Commands 8-277


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"BodyName:=", "Box1",
"XPosition:=", "0.2mm",
"YPosition:=", "-0.2mm",
"ZPosition:=", "0.4mm"
])

VB Syntax GetFaceByPosition <FaceParameters>


dim FaceID
FaceID = oEditor.GetFaceByPosition Array("NAME:FaceParameters",
"BodyName:=", "Box1",
VB Example
"XPosition:=", "0.2mm",
"YPosition:=", "-0.2mm",
"ZPosition:=", "0.4mm")

GetFaceIDs
Returns the face IDs associated with a specified object.

UI Access N/A

Name Type Description


Parameters
<objectName> String Object name.

Return Value Array containing string face IDs.

3D Modeler Editor Script Commands 8-278


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetFaceIDs (<objectName>)


Python Example oEditor.GetFaceIDs('Box1')

VB Syntax GetFaceIDs <objectName>


VB Example oEditor.GetFaceIDs "Box1"

GetGeometryModelerMode
Returns the modeler mode (3D or XY) for the current design. This lets you know whether the current model is 2D or 3D.

UI Access N/A
Parameters None.
Return Value String containing the modeling mode ("3D" or "XY").

Python Syntax GetGeometryModelerMode()


Python Example oEditor.GetGeometryModelerMode()

VB Syntax GetGeometryModelerMode
VB Example oEditor.GetGeometryModelerMode

3D Modeler Editor Script Commands 8-279


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetModelBoundingBox
Returns the bounding box of the current model.

UI Access N/A
Parameters None.
Return Value Array containing string Xmin, Ymin, Zmin, Xmax, Ymax, and Zmax values of the bounding box.

Python Syntax GetModelBoundingBox()


Python Example oEditor.GetModelBoundingBox()

VB Syntax GeModelBoundingBox
VB Example oEditor.GetModelBoundingBox

GetObjectIDByName
Given an object's name, returns its ID. IDs are used with CreateEntityList.

UI Access N/A

Name Type Description


Parameters
<objectName> String Object name.

Return Value Integer object ID.

3D Modeler Editor Script Commands 8-280


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetObjectIDByName(<objectName>)


Python Example oEditor.GetObjectIDByName('Box1')

VB Syntax GetObjectIDByName <objectName>


VB Example oEditor.GetObjectIDByName "Box1"

GetObjectName
Returns an object's name from its specified base index (creation order).

UI Access N/A

Name Type Description


Parameters
<index> Integer Base index (where '0' is the first item created)

Return Value String containing object name.

Python Syntax GetObjectName(<index>)


Python Example oEditor.GetObjectName(3)

VB Syntax GetObjectName <index>


VB Example oEditor.GetObjectName 3

GetObjectNameByFaceID
Returns an object name given a face ID.

3D Modeler Editor Script Commands 8-281


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access N/A

Name Type Description


Parameters
<FaceID> Integer The face ID.

Return Value String containing object name.

Python Syntax GetObjectNameByFaceID (<FaceID>)


Python Example oEditor.GetObjectNameByFaceID(88)

VB Syntax GetObjectNameByFaceID <FaceID>


VB Example oEditor.GetObjectNameByFaceID 10

GetObjectsByMaterial
Returns a list of objects of a specified material.

UI Access N/A

Name Type Description


Parameters
<material> String Material name.

Return Value Array containing string object names.

3D Modeler Editor Script Commands 8-282


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetObjectsByMaterial (<material>)


Python Example oEditor.GetObjectsByMaterial('copper')

VB Syntax GetObjectsByMaterial <material>


VB Example oEditor.GetObjectsByMaterial "copper"

GetObjectsInGroup
Returns a list of objects in a specified group.

UI Access N/A

Name Type Description


<group> String Group name.
One of:
l "<materialName>"
l "<assignmentName>"
Parameters
l "Non Model"
l "Solids"
l "Unclassified"
l "Sheets"
l "Lines"

Return Value Array containing string object names.

3D Modeler Editor Script Commands 8-283


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetObjectsInGroup (<group>)


Python Example oEditor.GetObjectsInGroup('Sheets')

VB Syntax GetObjectsInGroup <group>


VB Example oEditor.GetObjectsInGroup "Sheets"

GetMatchedObjectName
Returns all object names containing the input text string.

UI Access N/A

Name Type Description


Parameters
<wildcardText> String Text string present in object name(s).

Return Value Array containing string object names.

Python Syntax GetMatchedObjectName (<wildcardText>)


oEditor.GetMatchedObjectName('Box*')
Python Example
oEditor.GetMatchedObjectName('?ox?')

VB Syntax GetMatchedObjectName <wildcardText>

3D Modeler Editor Script Commands 8-284


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Example oEditor.GetMatchedObjectName "Box*"

GetModelUnits
Returns the model's unit of measure.

UI Access N/A
Parameters None.
Return Value String containing unit of measure.

Python Syntax GetModelUnits()


Python Example oEditor.GetModelUnits()

VB Syntax GetModelUnits
VB Example oEditor.GetModelUnits

GetNumObjects
Returns the number of objects in a design.

UI Access N/A
Parameters None.
Return Value Integer number of objects.

3D Modeler Editor Script Commands 8-285


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetNumObjects()


Python Example oEditor.GetNumObjects()

VB Syntax GetNumObjects
VB Example oEditor.GetNumObjects(

GetSelections [Model Editor]


Returns an array of currently selected objects.

UI Access N/A
Parameters None.
Return Value Array containing object IDs

Python Syntax GetSelections()


Python Example oEditor.GetSelections()

VB Syntax GetSelections
VB Example oEditor.GetSelections

3D Modeler Editor Script Commands 8-286


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetUserPosition
Returns a user's current coordinates in the 3D Modeler window.

UI Access N/A

Name Type Description


Parameters
<prompt> String "Enter a point." Then click a point in the 3D Modeler window.

Return Value Array containing X, Y, Z coordinates.

Python Syntax GetUserPosition(<prompt>)


Python Example oEditor.GetUserPosition("Enter a point.")

VB Syntax GetUserPosition <prompt>


VB Example oEditor.GetUserPosition "Enter a point."

GetVertexIDsFromEdge
Returns vertex IDs associated with a specified edge.

UI Access N/A

Name Type Description


Parameters
<edgeID> Integer Edge ID.

Return Value Array containing string vertex IDs.

3D Modeler Editor Script Commands 8-287


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetVertexIDsFromEdge(<edgeID>)


Python Example oEditor.GetVertexIDsFromEdge(10)

VB Syntax GetVertexIDsFromEdge <edgeID>


VB Example oEditor.GetVertexIDsFromEdge 10

GetVertexIDsFromFace
Returns vertex IDs associated with a specified face.

UI Access N/A

Name Type Description


Parameters
<faceID> Integer Face ID.

Return Value Array containing string vertex IDs.

Python Syntax GetVertexIDsFromFace(<faceID>)


Python Example oEditor.GetVertexIDsFromFace(10)

VB Syntax GetVertexIDsFromFace <faceID>


VB Example oEditor.GetVertexIDsFromFace 10

3D Modeler Editor Script Commands 8-288


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetVertexIDsFromObject
Returns vertex IDs associated with a specified object.

UI Access N/A

Name Type Description


Parameters
<objectName> String Object name.

Return Value Array containing string vertex IDs.

Python Syntax GetVertexIDsFromObject(<objectName>)


Python Example oEditor.GetVertexIDsFromObject('Box1')

VB Syntax GetVertexIDsFromObject <objectName>


VB Example oEditor.GetVertexIDsFromObject "Box1"

GetVertexPosition
Returns an array of coordinates for a specified vertex.

UI Access N/A

Name Type Description


Parameters
<vertexID> Integer Vertex ID.

Return Value Array containing X, Y, Z coordinates.

3D Modeler Editor Script Commands 8-289


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetVertexPosition(<vertexID>)


Python Example oEditor.GetVertexPosition(1)

VB Syntax GetVertexPosition <vertexID>


VB Example oEditor.GetVertexPosition 1

OpenExternalEditor
Launches a SpaceClaim session.

UI Access Modeler > SpaceClaim Link > Connect to Active Session.

Name Type Description


Parameters
<SelectionsArray> Array Structured array. See: SelectionsArray.

Return Value None.

Python Syntax OpenExternalEditor (<SelectionsArray>)


oEditor.OpenExternalEditor(
[
Python Example "NAME:Selections",
"Selections:=" , "SpaceClaim1"
])

3D Modeler Editor Script Commands 8-290


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax OpenExternalEditor <SelectionsArray>


oEditor.OpenExternalEditor Array("NAME:Selections",
VB Example
"Selections:=", "")

PageSetup
Specifies page settings for printing.

UI Access File > Page Setup.

Name Type Description


<Parameters> Array Structured array.
[
"NAME:PageSetupData",
"margins:=", <SetupArray>
]
<SetupArray> Array Structured Array
Parameters [
"left:=", <string>,
"right:=", <string>,
"top:=", <string>,
"bottom:=", <string>)
]

3D Modeler Editor Script Commands 8-291


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value None.

Python Syntax PageSetup(<Parameters>)


oEditor.PageSetup([
"NAME:PageSetupData",
"margins:=",
["left:=", "10mm",
Python Example
"right:=", "10mm",
"top:=", "10mm",
"bottom:=", "10mm"]
])

VB Syntax PageSetup <Parameters>


oEditor.PageSetup Array("NAME:PageSetupData",
"margins:=",
Array("left:=", "10mm",
VB Example "right:=", "10mm",
"top:=", "10mm",
"bottom:=", "10mm"
)

3D Modeler Editor Script Commands 8-292


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

RenamePart
Renames an object.

UI Access Enter new name in Name field.

Name Type Description


<renameParametersArray> Array Structured array.
Array("NAME:Rename Data",
Parameters
"Old Name:=", <string>,
"New Name:=", <string>
)

Return Value None.

Python Syntax oEditor.RenamePart(<renameParametersArray>)


oEditor.RenamePart(
[
'NAME:Rename Data',
Python Example 'Old Name:=', 'partname',
'New Name:=', 'newpartname',
]
)

3D Modeler Editor Script Commands 8-293


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax oEditor.RenamePart <RenameParametersArray>


oEditor.RenamePart Array("NAME:Rename Data",
"Old Name:=", "partname",
VB Example
"New Name:=", "newpartname",
)

3D Modeler Editor Script Commands 8-294


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

9 - Output Variable Script Commands


Output variable commands should be executed by the "OutputVariable" module.
First, obtain the output variable module from oDesign and use it for output variable commands:
Set oModule = oDesign.GetModule("OutputVariable")
oModule.<CommandName><args>
The commands are:
CreateOutputVariable
DeleteOutputVariable
DoesOutputVariableExist
EditOutputVariable
GetOutputVariableValue
GetOutputVariableValue
SimValueContext

CreateOutputVariable (Maxwell)
Use: Adds 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, Sim values, or other output variable names. It cannot have
spaces or any arithmetic or other operators. The definitions cannot be cyclic. For example, A = 2*B, B=3*A is not allowed.
Command: Maxwell3D>Results>Output Variables, Maxwell2D>Results>Output Variables, or RMxprt>Results>Output Vari-
ables.
Syntax:CreateOutputVariable <OutputVarName>, <Expression>, <SolutionName>, <ReportTypeName>, <simValueContext>
Return Value: None

Output Variable Script Commands 9-1


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Parameters: <OutputVarName>
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.
<simValueContext>
Type: <variant>
Context for which the output variable expression is being evaluated
Example: Set oModule = oDesign.GetModule("OutputVariable")
oModule.CreateOutputVariable "magforce", "mag(Force1.Force_x)", _
"Setup1 : LastAdaptive", "Magnetostatic", Array()

Output Variable Script Commands 9-2


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

DeleteOutputVariable
Deletes an existing output variable. The variable can only be deleted if it is not in use by any traces.

UI Access Maxwell > Results > Output Variables. In the Output Variables window, click Delete.

Name Type Description


Parameters
<OutputVarName> String Name of the output variable.

Return Value None.

Python Syntax DeleteOutputVariable (<OutputVarName>)


oModule = oDesign.GetModule("OutputVariable")
Python Example
oModule.DeleteOutputVariable ("testNew")

VB Syntax DeleteOutputVariable <OutputVarName>


Set oModule = oDesign.GetModule("OutputVariable")
VB Example
oModule.DeleteOutputVariable "testNew"

DoesOutputVariableExist
Verifies whether or not a named output variable exists.

UI Access N/A

Name Type Description


Parameters
<outputVariableName> String The output variable name.

Output Variable Script Commands 9-3


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value Boolean True if the variable exists; False if it does not.

Python Syntax DoesOutputVariableExist(<outputVariableName>)


oProject = oDesktop.GetActiveProject()
oDesign = oProject.GetActiveDesign()
Python Example oModule = oDesign.GetModule("OutputVariable")
oModule.DoesOutputVariableExist("MyTestVar")

VB Syntax DoesOutputVariableExist(<outputVariableName>)
Set oModule = oDesign.GetModule "OutputVariable"
VB Example
oModule.DoesOutputVariableExist "MyTestVar"

EditOutputVariable
Changes the name or expression of an existing output variable.

UI Access N/A

Name Type Description


<OrigVarName> String Name of the original output variable.
Parameters <NewExpression> String New value to assign to the variable.
<NewVarName> String New name of the variable if any, else pass empty
string.

Output Variable Script Commands 9-4


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<SolutionName> String Name of the solution as seen in the output variable UI.
For example, "Setup1 : Last Adaptive".
<ReportType> String The name of the report type as seen in the output vari-
able UI.
<ContextArray> Array Structured array containing context for which the output
variable expression is being evaluated.
Array("Context:=", <string>)

Return Value None

Python EditOutputVariable (<OrigVarName>, <NewExpression>, <NewVarName>, <SolutionName>, <ReportType>, <Con-


Syntax textArray>)
oModule = oDesign.GetModule("OutputVariable")
Python
Example oModule.EditOutputVariable ("test", "normalize(R1_0.V)", "testNew", "TR", "Standard",
[])

EditOutputVariable <OrigVarName>, <NewExpression>, <NewVarName>, <SolutionName>, <ReportType>,


VB Syntax
<ContextArray>
Set oModule = oDesign.GetModule("OutputVariable")
VB Example oModule.EditOutputVariable "test", "dB(S(WavePort1,WavePort1)) ", "testNew",
"Setup1 : LastAdaptive", "Modal Solution Data", Array("Domain:=", "Sweep")

Output Variable Script Commands 9-5


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetOutputVariableValue
Use: Gets the double value of an output variable. Only those expressions that return a double value are supported. The expression is
evaluated only for a single point.
Syntax:GetOutputVariableValue(<OutputVarName>, <IntrinsicVariation>, <SolutionName>, <ReportTypeName>, <SimValueCon-
text>)
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. If no variables are present, a null string
must be used.The Eddy Current solution type requires at least the specification of frequency as shown here while the tran-
sient solver will require Time as a minimum entry.
For example: "" (Null String)
"freq=‘60’" (Eddy current example)
<SolutionName>
Type: <string>
Name of the solution as listed in the output variables dialog box as shown in SimValueContext.
For example: "Setup1 : Last Adaptive" or "Setup1 : Transient"
<ReportTypeName>

Output Variable Script Commands 9-6


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Type: <string>
The name of the report type as seen in the output variable dialog box.

Note:

If the Output Variable is based upon a field quantity, then the ReportTypeName must be set to "Fields".

<SimValueContext>
Type: <Array>
Context for which the output variable expression is being evaluated. This section is related to the Parameters or Geometry
fields in the UI that specify a context for extracting data quantities. This can be an empty string if there is no context.
The Context section of the Output Variables dialog box contains the information that is required when getting the value of
the Output Variable. Note these values when using the dialog box to create an Output Variable.

Output Variable Script Commands 9-7


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Hint Variation variables can be identified by doing a Data Table report and viewing the variable specifications in the table header.
For example:

Output Variable Script Commands 9-8


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Also, as shown below, the Trace and Families tabs on the Report dialog box can be used as illustrated to identify variation vari-
ables.

Output Variable Script Commands 9-9


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Example:
Dim Val
Val= oModule.GetOutputVariableValue("tempmag", "freq='60' coilcurrent='1000' gapsize='-0.001'",
"Setup1 : LastAdaptive", "EddyCurrent", "")
Val= oModule.GetOutputVariableValue("tempmag", "coilcurrent='1000' gapsize='-0.001'", "Setup1 :
LastAdaptive", "Magnetostatic", "")
Val= oModule.GetOutputVariableValue("BFieldMag", "", "Setup1 : LastAdaptive", "Fields", "")
Val= oModule.GetOutputVariableValue("MagBatPoint1", "freq='60' coilcurrent='1000' gapsize='-
0.001' Phase=’0deg’", "Setup1 : LastAdaptive", "Fields", Array("Context:=", "Point1"))

Output Variable Script Commands 9-10


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

10 - Reporter Editor Script Commands


Reporter commands should be executed by the oDesign object.
For example:
Set oDesign = Project.SetActiveDesign("MaxwellDesign1")
Set oModule = oDesign.GetModule("ReportSetup")
All Report and Trace properties can be edited using the ChangeProperty commands. This includes Title properties, General prop-
erties, and Background properties such as border color, fonts, X and Y axis scaling, and number display.

Note:

When you execute Tools > Record Script, operations performed in the Reporter are automatically recorded.

The list of commands is as follows:


AddCartesianLimitLine
AddCartesianXMarker
AddCartesianYMarker
AddCartesianYMarkerToStack
AddDeltaMarker
AddMarker
AddNote
AddTraces
AddVerifEyeAnalysis
ClearAllMarkers

Reporter Editor Script Commands 10-1


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

ClearAllTraceCharacteristics
CopyReportDefinitions
CopyReportData
CopyTraceDefinitions
CopyTracesData
CreateReport
CreateReportFromFile
CreateReportFromTemplate
CreateReportOfAllQuantities
DeleteMarker
DeleteAllReports
DeleteReports
DeleteTraces
EditQuickEyeAnalysis
EditVerifEyeAnalysis
FFTOnReport
ExportFieldsToFile
ExportImageToFile
ExportModelImageToFile
ExportModelMeshToFile

Reporter Editor Script Commands 10-2


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

ExportToFile [Reporter]
ExportMarkerTable
GetAllCategories
GetAllQuantities
GetAllReportNames
GetAvailableDisplayTypes
GetAvailableReportTypes
GetAvailableSolutions
GetChildNames
GetChildObject
GetChildTypes
GetDisplayType
GetPropertyValue
GetReportTraceNames
GetSolutionContexts
GetSolutionDataPerVariation
GroupPlotCurvesByGroupingStrategy
ImportIntoReport
MovePlotCurvesToGroup
MovePlotCurvesToNewGroup
PasteReports

Reporter Editor Script Commands 10-3


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

PasteTraces
RenameReport
RenameTrace
ResetPlotSettings
SavePlotSettingsAsDefault
SetPropValue
UpdateAllFieldsPlots
UpdateAllReports
UpdateQuantityFieldsPlots
UpdateReports
UpdateTraces
UpdateTracesContextandSweeps
UnGroupPlotCurvesInGroup

AddCartesianLimitLine
Adds a limit line to a report on the X axis.

UI Access Report2D > Add Limit Line> Specify Points...

Name Type Description


<ReportName> String Name of the report.
Parameters <Def> Array Structured array:
Array("NAME:CartesianLimitLine",

Reporter Editor Script Commands 10-4


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:XValues", <integer X values>),


"XUnits:=", <string unit of measure for X>,
Array("NAME:YValues", <integer Y values>),
"YUnits:=", "<string unit of measure for Y>",
"YAxis:=", <string name of associated Y axis>
)

Return Value None.

Python Syntax AddCartesianLimitLine (<ReportName>, <Def>)


oModule.AddCartesianLimitLine("Project Outputs",
["NAME:CartesianLimitLine",
["NAME:XValues",0, 2, 5, 7, 10, 15],
"XUnits:=", "s",
Python Example
["NAME:YValues",0.05, 0.3, 0.65, 0.825, 0.95, 1],
"YUnits:=", "mV", "YAxis:=", "Y1"
]
)

VB Syntax AddCartesianLimitLine <ReportName>, <Def>


VB Example oModule.AddCartesianLimitLine "Project Outputs",

Reporter Editor Script Commands 10-5


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:CartesianLimitLine",
Array("NAME:XValues",0, 2, 5, 7, 10, 15),
"XUnits:=", "s",
Array("NAME:YValues",0.05, 0.3, 0.65, 0.825, 0.95, 1),
"YUnits:=", "mV", "YAxis:=", "Y1"
)

AddCartesianXMarker
Adds a marker to a report on the X axis.

UI Access Report2D > Marker > Add X Marker.

Name Type Description


<ReportName> String Name of report.
Parameters
<MarkerName> String Marker name, including any trailing number.
<XValue> Double X coordinate.

Return Value None

Python Syntax AddCartesianXMarker (<ReportName>, <MarkerName>, <XValue>)


oModule.AddCartesianXMarker ("XY Plot 1", "MX1", 0)
Python Example

Reporter Editor Script Commands 10-6


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax AddCartesianXMarker <ReportName>, <MarkerName>, <XValue>


VB Example oModule.AddCartesianXMarker "XY Plot1", "MX1", 0

AddCartesianYMarker
Adds a marker to a report on the Y axis.

UI Access Report2D > Marker > Add Y Marker.

Name Type Description


<ReportName> String Name of report.
<MarkerName> String Marker name, including any trailing number.
Parameters
<AxisName> String Name of axis.
<YValue> Double Y coordinate.
<CurveName> String Name of curve.

Return Value None

Python Syntax AddCartesianYMarker (<ReportName>, <MarkerName>, <AxisName>, <YValue>, <CurveName>)


oModule.AddCartesianYMarker("XY Plot 1", "MY1", "Y1", 0,
Python Example
"dB() : Setup1 : Sweep1")

VB Syntax AddCartesianYMarker <ReportName>, <MarkerName>, <AxisName>, <YValue>, <CurveName>


oModule.AddCartesianYMarker "XY Plot 1", "MY1", "Y1", 0, _
VB Example
"dB() : Setup1 : Sweep1"

Reporter Editor Script Commands 10-7


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AddDeltaMarker
Add markers to calculate differences between two trace points on a plot.

UI Access Report2D > Marker > Add Delta Marker.

Name Type Description


<ReportName> String Name of report.
<MarkerName1> String Marker name, including any trailing number, for the first marker.
<CurveName1> String Full trace name for the first marker.
Parameters
<PrimarySweepValue1> String Frequency, including unit, for the first marker's sweep.
<MarkerName2> String Marker name, including any trailing number, for the second marker.
<CurveName2> String Full trace name for the second marker.
<PrimarySweepValue2> String Frequency, including unit, for the second marker's sweep.

Return Value None

AddDeltaMarker(<ReportName>, <MarkerName1>, <CurveName1>, <PrimarySweepValue1>,


Python Syntax
<MarkerName2>, <CurveName2>, <PrimarySweepValue2>)
oModule.AddDeltaMarker("S Parameter Plot 1", "m1",
"dB(S(Port1 Port1)) : Setup1 : Sweep1 : Cartesian",
Python Example "8.45GHz", "m2",
"dB(S(Port1 Port1)) : Setup1 : Sweep1 : Cartesian",
"9.5GHz")

Reporter Editor Script Commands 10-8


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AddDeltaMarker <ReportName>, <MarkerName1>, <CurveName1>, <PrimarySweepValue1>,


VB Syntax
<MarkerName2>, <CurveName2>, <PrimarySweepValue2>
oModule.AddDeltaMarker "S Parameter Plot 1", "m1",
"dB(S(Port1 Port1)) : Setup1 : Sweep1 : Cartesian", "8.45GHz",
VB Example
"m2", "dB(S(Port1 Port1)) : Setup1 : Sweep1 : Cartesian",
"9.5GHz"

AddMarker
Adds a marker to a trace on a report.

UI Access Report2D > Marker > Add Marker.

Name Type Description


<ReportName> String Name of report.
Parameters <MarkerName> String Marker name, including any trailing number.
<CurveName> String Full trace name.
<PrimarySweepValue> String Primary sweep value, including unit.

Return Value None

Python Syntax AddMarker( <ReportName>, <MarkerName>, <CurveName>, <PrimarySweepValue>)


oModule.AddMarker("XY Plot 1", "m5",
Python Example "GS1.VAL : TR4 : Cartesian", "3.61599999999997s")

Reporter Editor Script Commands 10-9


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax AddMarker <ReportName>, <MarkerName>, <CurveName>, <PrimarySweepValue>


Set oModule = oDesign.GetModule("ReportSetup")
oModule.AddMarker "XY Plot1","m1",
VB Example
"mag(S(Port1 Port1)) : Setup1:
LastAdaptive : Cartesian", "0.3in"

AddNote
Adds a note at a specified location to a given report.

UI Access Right-click on the plot and select Add Note.

Name Type Description


<ReportName> String Name of report
<NoteDataArray> Array Structured array.
Array("NAME:<StringDataName>", <NoteArray>)
<NoteArray> Array Structured array:
Array("NAME:<NoteDataSourceName>",
Parameters "SourceName:=", <string source name>,
"HaveDefaultPos:=", <boolean True for position 0,0;
False to specify below>,
"DefaultXPos:=", <int X position for note; 0 for
default>,
"DefaultYPos:=", <int Y position for note; 0 for
default>,

Reporter Editor Script Commands 10-10


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"String:=", <string note text>)

Return Value None

Python Syntax AddNote (<ReportName>, <NoteDataArray>)


oModule.AddNote("XY Plot1",
["NAME:NoteDataSource",
"SourceName:=", "Note1",
"HaveDefaultPos:=", False,
Python Example "DefaultXPos:=", 1996,
"DefaultYPos:=", 3177,
"String:=", "This is a note."
]
)

VB Syntax AddNote <ReportName> <NoteDataArray>


oModule.AddNote "XY Plot1", _
Array("NAME:NoteDataSource", _
VB Example "SourceName:=", "Note1", _
"HaveDefaultPos:=", false, _
"DefaultXPos:=", 1996, _

Reporter Editor Script Commands 10-11


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"DefaultYPos:=", 3177, _
"String:=", "This is a note.")

AddTraceCharacteristics
Adds a trace characteristics field to the legend on a report.

UI Access Report2D > Trace Characteristics > All. This opens the Add Trace Characteristics dialog box.

Name Type Description


<ReportName> String Name of report.
<FunctionName> String The function name. See the Functions column of the Add Trace Char-
acteristics dialog box.
<FunctionArgs> Array Array containing string values for any function arguments. Pass empty array if
no arguments exist.
To see which argument(s) a function takes, see the bottom of the Add
Trace Characteristics dialog box.

Parameters For function with one argument:


Array(<value>)
For function with multiple arguments:
Array(<value>, <value>, ...)
<RangeArgs> Array Required. Array containing either string "Full" for a full sweep range, or "Spe-
cified" and strings containing the start and end values for the frequency range.
For example:
Array("Specified", "19.5GHz", "24.4GHz")

Return Value None.

Reporter Editor Script Commands 10-12


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python AddTraceCharacteristics (<ReportName>, <FunctionName>, <FunctionArgs>, <RangeArgs>)


Syntax

oModule.AddTraceCharacteristics("XY Plot 2", "delaytime", ["0"], ["Full"])


Python oModule.AddTraceCharacteristics("Differential S-parameters", "prms", ["0", "0"],
Exampl- ["Full"])
e
oModule.AddTraceCharacteristics("Rept2DRectFreq", "distortion", ["0"], ["Specified",
"19.5GHz", "20.4GHz"])

VB AddTraceCharacteristics <ReportName>, <FunctionName>, <FunctionArgs>, <RangeArgs


Syntax

oModule.AddTraceCharacteristics "XY Plot 2", "delaytime", Array("0"), Array("Full")


VB oModule.AddTraceCharacteristics "Differential S-parameters", "prms", Array("0", "0"),
Examp- Array("Full")
le
oModule.AddTraceCharacteristics "Rept2DRectFreq", "distortion", Array("0"), Array( "Spe-
cified", "19.5GHz", "20.4GHz")

AddTraces
Creates a new trace and adds it to the specified report.

UI Access Modify Report > Add Trace.

Name Type Description


Parameters <ReportName> String Name of Report
<SolutionName> String Name of the solution as listed in the Modify Report dialog box.

Reporter Editor Script Commands 10-13


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<ContextArray> Array Context for which the expression is being evaluated. This can be an
empty string if there is no context.
Array("Domain:=", <DomainType>)
<DomainType> ex. "Sweep" or "Time"
Array("Context:=", <GeometryType>)
<GeometryType> ex. "Infinite Spheren",
"Spheren", "Polylinen"
<FamiliesArray> Array Contains sweep definitions for the report.
Array("<VariableName>:= ", <ValueArray>)
<ValueArray>
Array("All") or Array("Value1", "Value2",
..."Valuen")
examples of <VariableName> "Freq", "Theta",
"Distance"
<ReportDataArray> Array This array contains the report quantity and X, Y, and (Z) axis definitions.
Array("X Component:=", <VariableName>,
"Y Component:=", <VariableName> | <ReportQuant-
ityArray>)
<ReportQuantityArray> ex. Array("dB(S(Port1,
Port1))")

Return Value None

Reporter Editor Script Commands 10-14


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax Add Traces(<ReportName>, <SolutionName>, <ContextArray >, <FamiliesArray>, <ReportDataArray>)


oModule.AddTraces("XY Plot1", "Setup1 : Sweep1",
["Domain:=", "Time", "HoldTime:=", 1, "RiseTime:=", 0,
"StepTime:=", 6.24999373748E-012, "Step:=", False,
"WindowWidth:=", 1,
Python Example "WindowType:=", 0, "KaiserParameter:=", 1,
"MaximumTime:=", 6.2437437437444E-009],
["Time:=", ["All"], "OverridingValues:=", ["0s",
"6.24999373748188e-012s", ... ]], ["X Component:=", "Time",
"Y Component:=", ["TDRZ(WavePort1)"]], [])

VB Syntax Add Traces <ReportName> <SolutionName> <ContextArray> <FamiliesArray> <ReportDataArray>


oModule.AddTraces "XY Plot1", "Setup1 : Sweep1", _
Array("Domain:=", "Time", "HoldTime:=", 1, "RiseTime:=", 0, _
"StepTime:=", 6.24999373748E-012, "Step:=", false, _
"WindowWidth:=", 1, _
VB Example "WindowType:=", 0, "KaiserParameter:=", 1, _
"MaximumTime:=", 6.2437437437444E-009), _
Array("Time:=", Array("All"), "OverridingValues:=", _
Array("0s","6.24999373748188e-012s", ...)), _
Array("X Component:=", "Time", _

Reporter Editor Script Commands 10-15


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Y Component:=", Array("TDRZ(WavePort1)")), _


Array()

ChangeProperty[ReportSetup]
Change the properties for a Report.

UI Access Double-click on a report to change its properties.

Name Type Description


Parameters <PropertyArray> Array Varies, depending on the properties associated with the select object com-
mand.

Return Value None.

Python Syntax ChangeProperty(<PropertyArray>)


oModule = oDesign.GetModule("ReportSetup")
oModule.ChangeProperty(
[
"NAME:AllTabs",
Python Example
[
"NAME:General",
[
"NAME:PropServers",

Reporter Editor Script Commands 10-16


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"XY Plot 1:General"


],
[
"NAME:ChangedProps",
[
"NAME:Use Scientific Notation",
"Value:=", True
]
]
]
])

oModule = oDesign.GetModule("ReportSetup")
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:Legend",
[
"NAME:PropServers",
"S Parameter Plot 1:Legend"

Reporter Editor Script Commands 10-17


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

],
[
"NAME:ChangedProps",
[
"NAME:Legend Name",
"Value:=" , "Ansys"
]
]
]
])
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:General",
[
"NAME:PropServers",
"S Parameter Plot 1:General"
],
[

Reporter Editor Script Commands 10-18


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NAME:ChangedProps",
[
"NAME:Auto Scale Fonts",
"Value:=" , False
]
]
]
])

VB ChangeProperty <PropertyArray>
Syntax

oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:Cartesian", Array


("NAME:PropServers", _
"XY Plot 1:CartesianDisplayTypeProperty"), Array("NAME:ChangedProps", Array("NAME:Show X
Scrollbar", "Value:=", _
VB true))))
Examp-
le oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:General", Array("NAME:PropServ-
ers", _
"XY Plot 1:General"), Array("NAME:ChangedProps", Array("NAME:Use Scientific Notation",
"Value:=", _
true))))

Reporter Editor Script Commands 10-19


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

ClearAllMarkers
Clears all markers from a report.

UI Access Report2D > Markers > Clear All.

Name Type Description


Parameters
<ReportName> String Name of Report

Return Value None

Python Syntax ClearAllMarkers(<ReportName>)


Python Example oModule.ClearAllMarkers("XY Plot 1")

VB Syntax ClearAllMarkers <ReportName>


VB Example oModule.ClearAllMarkers "XY Plot 1"

ClearAllTraceCharacteristics
Clears all trace characteristics from the legend in a report.

UI Access Report2D > Trace Characteristics > Clear All.

Name Type Description


Parameters
<PlotName> String Name of the plot

Reporter Editor Script Commands 10-20


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value None

Python Syntax ClearAllTraceCharacteristics(<PlotName>)


oModule.ClearAllTraceCharacteristics("XY Plot 1")
Python Example

VB Syntax ClearAllTraceCharacteristics <PlotName>


VB Example oModule.ClearAllTraceCharacteristics "XY Plot 1"

CopyTracesData
Copies trace data for a paste operation.

UI Access Select a trace in the Project tree, right-click and select Copy Data.

Name Type Description


Parameters <ReportName> String Name of Report.
<TraceArray> Array Trace definitions from which to copy corresponding data.

Return Value None.

Python Syntax CopyTracesData(<ReportName>, <TracesArray>)


oModule.CopyTracesData ("Transmission",
Python Example
["mag(S(Port1,Port2))"])

Reporter Editor Script Commands 10-21


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax CopyTracesData <ReportName>, <TracesArray>


oModule.CopyTracesData _
VB Example
"C11", Array("mag(S(Port1,Port2))")

CopyReportsData
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 Names of reports from which to copy data

Return Value None

Python Syntax CopyReportsData (<ReportsArray>)


Python Example oModule.CopyReportsData (["Transmission","Reflection"])

VB Syntax CopyReportsData <ReportsArray>


oModule.CopyReportsData _
VB Example
Array("Transmission","Reflection")

Reporter Editor Script Commands 10-22


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

CopyReportDefinitions
Copy the definition of a report for paste operations.

UI Access Select a report in the Project tree, right-click and select Copy Definition

Name Type Description


Parameters
<ReportsArray> Array Names of reports from which to copy the definitions

Return Value None

Python Syntax CopyReportDefinitions(<ReportsArray>)


oModule.CopyReportDefinitions(["Transmission", "Reflection"])
Python Example

VB Syntax CopyReportDefinitions <ReportsArray>


oModule.CopyReportDefinitionsv _
VB Example
Array("Transmission", "Reflection")

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

Reporter Editor Script Commands 10-23


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<TracesArray> Array Trace definitions to copy

Return Value None

Python Syntax CopyTraceDefinitions(<ReportName>, <TracesArray>)


oModule.CopyTraceDefinitions ("Transmission",
Python Example
["mag(S(Port1,Port2))"])

VB Syntax CopyTraceDefinitions <ReportName>, <TracesArray>


oModule.CopyTraceDefinitions "Transmission", _
VB Example
Array("mag(S(Port1,Port2))")

CreateReportFromFile
Creates a new report from an .rdat file.

UI Access Right-click on Results > Create Report From File...

Name Type Description


Parameters
<FilePathName> String Path to .rdat file.

Return Value None.

Reporter Editor Script Commands 10-24


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax CreateReportFromFile(<FilePathName>)


Python Example oModule.CreateReportFromFile("C:/Users/MyDir/Documents/Return_Loss.rdat")

VB Syntax CreateReportFromFile <FilePathName>


VB Example oModule.CreateReportFromFile "C:/Users/MyDir/Documents/Return_Loss.rdat"

CreateReport (Maxwell)
Use: Creates a new report with a single trace and adds it to the Results branch in the project tree. To add more traces, use the
AddTraces command. To edit the display properties, use the ChangeProperty Script command.
Command: Maxwell2D or Maxwell3D>Results>Create<type> Report
Syntax: CreateReport <ReportName> <ReportType> <DisplayType> <SolutionName> <ContextArray> <Fam-
iliesArray><ReportDataArray>
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.
ReportType
Some possible values are:
"TransientAPhiFormulation"
"Fields"
"Noise Vibration"
"Time Averaged Fields"

Reporter Editor Script Commands 10-25


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Matrix".
"DC R/L Fields".
"AC R/L Fields".
"C Fields"
"Harmonic Force"
DisplayType
"Rectangular Plot", "Rectangular Stacked Plot", "Data Table", "3D Rectangular Plot", "Rect-
angular Contour Plot".
<TraceArray>
Array("NAME:Traces",
<OneTraceArray>, <OneTraceArray>,...)
<OneTraceArray>
Array("NAME:<TraceName>,
"SolutionName:=","string",
"Context:=","string",
<DisplayTypeDependentData>)
<SolutionName>
Name of the solution as listed in the Traces dialog box.
For example: "Setup1 : Last Adaptive"
<Context> Array
Context for which the output variable expression is being evaluated.

Reporter Editor Script Commands 10-26


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("Domain:=", <DomainType>)
<DomainType>
ex. "Sweep" or "Time"
This can be an empty string if there is no context.
Example: "Line1" or ""
Field reports usually require a polyline (e.g. "Line1") unless they are integrations..
<DisplayTypeDependentData>
This data varies according to the display type. See the examples below.
<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> | <ReportQuant-
ityArray>)
<ReportQuantityArray>

Reporter Editor Script Commands 10-27


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

ex. Array("dB(S(Port1, Port1))")

Example: oDesign.CreateReport Array("NAME:Rept2DRectTime",_


"ReportType:=","Matrix",
"DisplayType:=","Rectangular Plot",
Array("NAME:Traces",
Array("NAME:Trace1",
"SolutionName:=",
"Setup1 : Adaptive_2",
"Context:=","Original",
"XComponent:=", "Pass",
"YComponent:=", "C(Box1, Box1)",
"YAxis:=", 1)))

Python Example: oModule.CreateReport("Loss Plot 1", "Transient", "Rectangular Plot", "Setup1 :


Transient",
[
"Domain:=" , "Average and RMS",
"npoles:=" , "2",
"alignment:=" , "0deg",
"orientation:=" , "CounterClockwise",

Reporter Editor Script Commands 10-28


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"losses:=" , "0W",
"speed:=" , "0rpm",
"Resistance(PhA):=" , "0ohm",
"Resistance(PhB):=" , "0ohm",
"Resistance(PhC):=" , "0ohm",
"Inductance(PhA):=" , "0H",
"Inductance(PhB):=" , "0H",
"Inductance(PhC):=" , "0H"
],
[
"Im:=" , ["All"],
"Gamma:=" , ["Nominal"],
"speed_rpm:=" , ["Nominal"],
"poles:=" , ["Nominal"]
],
[
"X Component:=" , "Im",
"Y Component:=" , ["AvgCoreLoss"]
], [])

Reporter Editor Script Commands 10-29


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Example for Transient A-phi Formulation: oModule.CreateReport("Loss Plot 1", "Tran-
sientAPhiFormulation", "Rectangular Plot", "Setup1 : Transient",
[
"Domain:=" , "Sweep"
],
[
"Time:=" , ["All"],
"$HcRef:=" , ["Nominal"],
"$MagnetTemperature:=" , ["Nominal"]
],
[
"X Component:=" , "Time",
"Y Component:=" , ["TerminalVoltage(Voltage1)","TerminalVoltage(Voltage2)"]
])

[Beta] Python Example for Transient A-phi Formulation, LayoutForce plot: oModule.CreateReport
("LayoutForce Plot 1", "TransientAPhiFormulation", "Rectangular Plot", "Setup1 : Transient",
[
"Domain:=" , "Sweep"
],
[

Reporter Editor Script Commands 10-30


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Time:=" , ["All"]
],
[
"X Component:=" , "Time",
"Y Component:=" , ["LayoutForce1.Force_mag"]
])
```

Python Example for Average_Surface_Loss_Density:


oModule.CreateReport("Calculator Expressions Plot 1", "Time Averaged Fields", "Rectangular
Plot", "Setup1 : Transient",
[
"Context:=" , "Point1",
"PointCount:=" , 1001,
"Time0:=" , "0s"
],
[
"Time:=" , ["All"]
],
[
"X Component:=" , "Time",
"Y Component:=" , ["Average_Surface_Loss_Density"]

Reporter Editor Script Commands 10-31


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

])

Python Example for Transient and Eddy Current Per-Winding Losses:


oModule.CreateReport("Loss Plot 4", "Transient", "Rectangular Plot", "Setup1 : Transient",
[
"Domain:=" , "Sweep"
],
[
"Time:=" , ["All"]
],
[
"X Component:=" , "Time",
"Y Component:=" , ["PerWindingSolidLoss(WindingV1_Solid)"]
])
oModule.AddTraces("Loss Plot 4", "Setup1 : Transient",
[
"Domain:=" , "Sweep"
],
[
"Time:=" , ["All"]

Reporter Editor Script Commands 10-32


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

],
[
"X Component:=" , "Time",
"Y Component:=" , ["PerWindingStrandedLoss(WindingI3_Litz)"]
])
oModule.AddTraces("Loss Plot 4", "Setup1 : Transient",
[
"Domain:=" , "Sweep"
],
[
"Time:=" , ["All"]
],
[
"X Component:=" , "Time",
"Y Component:=" , ["PerWindingStrandedLossAC(WindingI3_Litz)"]
])

Python Example for Harmonic Force Report Type:


oModule.CreateReport("Harmonic Force Plot 5", "Harmonic Force", "3D Rectangular Bar Plot",
"Setup1 : Transient",
[
"Freq:=" , ["All"],

Reporter Editor Script Commands 10-33


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"SpatialOrder:=" , ["All"],
"fractions:=" , ["Nominal"],
"halfAxial:=" , ["Nominal"],
"endRegion:=" , ["Nominal"],
"RPM:=" , ["1500rpm"],
"ppairs:=" , ["Nominal"]
],
[
"X Component:=" , "Freq",
"Y Component:=" , "SpatialOrder",
"Z Component:=" , ["re(HarmonicForce_a)"]
])

Python Example for Thin Layer (Air Gap) Report Type:


oModule.CreateReport("Magnetic Energy Table 1", "Magnetostatic", "Data Table", "Setup1 : LastAd-
aptive", [],
[
"$Current:=" , ["All"]
],
[
"X Component:=" , "$Current",

Reporter Editor Script Commands 10-34


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Y Component:=" , ["MagneticEnergy(ThinLayer1)"]


])

VB Example for Thin Layer (Air Gap) Report Type:


oModule.CreateReport "Magnetic Energy Table 1", "Magnetostatic", "Data Table" "Setup1 : LastAd-
aptive", Array(), Array("$Current:=", Array("All")), Array("X Component:=", "$Current", "Y Com-
ponent:=", Array("MagneticEnergy(ThinLayer1)"))

CreateReportFromTemplate
Creates a report from a saved template.

UI Access [product] > Results > Report Templates > PersonalLib > [TemplateName]

Name Type Description


Parameters
<TemplatePath> String Path to report template

Return Value None

Python Syntax CreateReportFromTemplate( <TemplatePath>)


oModule.CreateReportFromTemplate(
Python Example
"C:/MyHFSSProjects/PersonalLib/ReportTemplates/TestTemplate.rpt")

VB Syntax CreateReportFromTemplate <TemplatePath>


VB Example oModule.CreateReportFromTemplate "C:/MyHFSSProjects/PersonalLib/" _

Reporter Editor Script Commands 10-35


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ReportTemplates/TestTemplate.rpt"

CreateReportOfAllQuantities
Creates a report including all quantities in a category. Cannot create a report with expressions.

UI Access NA

Name Type Description


<ReportType> String Report type name as input parameter
<DisplayType> String Display type name as input parameter
<SolutionName> String Solution name as input parameter
Parameters <SimValueCtxt> String A context name, or array of string that encoded the context(I).
<CategoryName> String Category name as input parameter
<PointSet> Array Array of strings(II)
<CommonComponentsOfTraces> Array Array of strings(III)
<ExtTraceInfo> Array Array of strings(IV)

Return Value None.

CreateReportOfAllQuantities(<ReportNameArg>, <ReportType>, <DisplayType>,


Python Syntax <SolutionName>, <SimValueCtxt>, <CategoryName>,
<PointSet>, <CommonComponentsOfTraces>, <ExtTraceInfo>)
oModule.CreateReportOfAllQuantities("Smith Chart all",
Python Example "Modal Solution Data", "Smith Chart", "Setup1 : LastAdaptive",
[],"S Parameter",["Freq:=", ["All"], "offset:=", ["All"],"a:=",

Reporter Editor Script Commands 10-36


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["Nominal"],"b:=", ["Nominal"]],[],[])

CreateReportOfAllQuantities <ReportNameArg>, <ReportType>, <DisplayType>,


VB Syntax <SolutionName>, <SimValueCtxt>, <CategoryName>,
<PointSet>, <CommonComponentsOfTraces>, <ExtTraceInfo>
oModule.CreateReportOfAllQuantities "Smith Chart all", _
"Modal Solution Data", "Smith Chart", "Setup1 : LastAdaptive", _
Array(),"S Parameter", _
VB Example Array("Freq:=", Array("All"), "offset:=", Array("All"), _
"a:=", Array("Nominal"),"b:=", Array("Nominal")), _
Array(), Array()

DeleteMarker
Use:Deletes the specified marker.

UI Access [product] > Fields > Fields > Marker > Delete Marker.

Name Type Description


Parameters
<MarkerName> String Name of the marker.

Return Value None.

Reporter Editor Script Commands 10-37


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax DeleteMarker(<MarkerName>)


Python Example oModule.DeleteMarker("m1")

VB Syntax DeleteMarker <MarkerName>


VB Example oModule.DeleteMarker "m1"

DeleteAllReports
Deletes all existing reports.

UI Access Right-click the report to delete in the project tree, and then click Delete All Reports on the shortcut menu.
Parameters None.
Return Value None.

Python Syntax DeleteAllReports()


Python Example oModule.DeleteAllReports()

VB Syntax DeleteAllReports
VB Example oModule.DeleteAllReports

Reporter Editor Script Commands 10-38


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

DeleteReports
Deletes an existing report or reports.

UI Access Right-click the report to delete in the project tree, and then click Delete on the shortcut menu

Name Type Description


Parameters
<ReportNameArray> Array Array of report names to be deleted

Return Value None.

Python Syntax DeleteReports(<ReportNameArray>)


Python Example oModule.DeleteReports (["Rept2DRectFreq"])

VB Syntax DeleteReports <ReportNameArray>


VB Example oModule.DeleteReports Array("Rept2DRectFreq")

DeleteTraces
Deletes an existing traces or traces.

UI Access Right-click the Trace to delete in the project tree, and then click Delete on the shortcut menu

Name Type Description


<TraceSelection> Array Structured array define selections.
Parameters
Array("<ReportName>:=", <TracesArray>, <TracesAr-
ray>,... )

Reporter Editor Script Commands 10-39


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<ReportName> String Name of Report


<TracesArray> Array Contains the traces to delete within a report
Array(<Trace>, <Trace>, ...)
<Trace> String A specific trace that the user wishes to delete

Return Value None.

Python Syntax DeleteTraces(<TraceSelection>)


oModule.DeleteTraces (["XY Plot 1:=",
Python Example ["dB(S(LumpPort1,Lump-
Port1))"],
"XY Plot 2:=", ["Mag_E"]])

VB Syntax DeleteTraces <TraceSelection>


oModule.DeleteTraces Array("XY Plot 1:=", _
VB Example Array("dB(S(LumpPort1,Lump-
Port1))"), )
"XY Plot 2:=", Array("Mag_E"))

ExportImageToFile [Reporter]
Exports a report image in a specified format. In Release 23.1, this command is fully supports -ng (non-graphical) mode.

UI Access N/A

Reporter Editor Script Commands 10-40


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


<ReportName> String Name of report to be exported.
<FileName> String Full path of the exported image file name; with extension of jpg, gif, tiff, tif, bmp,
Parameters
or wrl.
<Width> Integer Image width in pixels; if width or height is less or equal to zero, use the report
window width, or 500 pixels if report window is closed.
<Height> Integer Image height in pixels; if width or height is less or equal to zero, use the report
window height, or 500 pixels report window is closed.

Return Value None.

Python Syntax ExportImageToFile(<ReportName>, <FileName>, <Width>, <Height>)


oModule.ExportImageToFile(
"Rectangular Contour Plot 1",
Python Example
"D:/work/2015/UV-Export/pp1.gif",
0, 0)

VB Syntax ExportImageToFile <ReportName>, <FileName>, <Width>, <Height>


oModule.ExportImageToFile _
VB Example "Rectangular Contour Plot 1", _
"D:/work/2015/UV-Export/pp1.gif", 0, 0

ExportPlotImageToFile
Deprecated. Use ExportPlotImageWithViewToFile.

Reporter Editor Script Commands 10-41


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Creates field plot exports of existing field plots from a given view points, and with the model being auto-sized automatically for each
view.

UI Access N/A

Name Type Description


<FileName> String Full path plus file name.
Parameters
<FolderName> String Plot folder name.
<ItemName> String Name of fields to plot.
<SetViewTopDownDirectionByRCS> String Optional. Name of relative coordinate system to use for the
field plot.

Return Value None.

Python Syntax ExportPlotImageToFile(<FileName>, <FolderName>, <ItemName>, <SetViewTopDownDirectionByRCS>)


oModule.ExportPlotImageToFile(
Python Example "C:\TestEPITF2.jpg", "",
"Mag_E2", "RelativeCS1")

VB Syntax ExportPlotImageToFile <FileName>, <FolderName>, <ItemName>, <SetViewTopDownDirectionByRCS>


oModule.ExportPlotImageToFile _
VB Example "C:\TestEPITF2.jpg", "", _
"Mag_E2", "RelativeCS1"

Reporter Editor Script Commands 10-42


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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

Reporter Editor Script Commands 10-43


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Dim oModule

Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")


Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow

Set oProject = oDesktop.SetActiveProject("BJTinverter")


Set oDesign = oProject.SetActiveDesign("Nexxim1")
oDesign.ExportReport "Data Table 1", "table_test", "csv"

Python Syntax ExportReport( <ReportName>, <FileName>)


oDesign.ExportReport(
Python 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.

Reporter Editor Script Commands 10-44


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access Right-click on report name in the project tree and select Export Data.

Name Type Description


<ReportName> String Name of report to be exported.
<FileName> String Full path of the exported image file name; with extension of
.txt - Post processor format file
.csv - Comma-delimited data file
Parameters .tab - Tab-separated file
.dat - Ansys plot data file

<UnitSpec> String For example, “kV, Mhz, yd”


<UseTraceNumberFormat> Boolean "True", "False"

Return Value None.

Python Syntax ExportToFile(<ReportName>, <FileName>)

oModule.ExportToFile("rETotal", "C:/Users/Documents/rETotal.csv")
Python Example
oModule.ExportToFile("S Parameter Table 1", "D:/Users/Documents/cftt.csv", False, " kV, MHz, yd ", True)

VB Syntax ExportToFile <ReportName>, <FileName>


VB Example oModule.ExportToFile "rETotal", "C:/Documents/rETotal.csv"

Reporter Editor Script Commands 10-45


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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 Syntax ExportToFile (<ReportName>, <FileName>)


oModule.ExportToFile(
Python Example
"Plot1", "c:\report1.dat")

VB Syntax ExportToFile <ReportName>, <FileName>

Reporter Editor Script Commands 10-46


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oModule.ExportToFile
VB Example
"Plot1", "c:\report1.dat"

ExportMarkerTable
Exports the marker table to a .csv or .tab file.

UI Access [product] > Fields > Plot Fields > Marker > Export Marker Table.

Name Type Description


Parameters
<FileName> String Name of export file include path.

Return Value None.

Python Syntax ExportMarkerTable(<FileName>)


Python Example oModule.ExportMarkerTable("C:/work/FieldMarkerTable.csv")

VB Syntax ExportMarkerTable <FileName>


VB Example oModule.ExportMarkerTable "C:/work/FieldMarkerTable.csv"

FFTOnReport
Performs an FFT on a selected report.

UI Access Right-click on Results in the project tree, select Perform FFT On Report...

Parameters Name Type Description

Reporter Editor Script Commands 10-47


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<ReportName> String Name of specified report.


<WindowName> String Name of window to apply for FFT. Possible values are "Rectangular", "Tri",
"Van Hann", "Hamming", "Blackman", "Lanczos", "Weber", "Welch".
<Function> String Function to apply on transformation values. Possible values are "none", "ang_
deg", "ang_rad", "arg", "cang_deg", "cang_rad", "dB", "dB1 normalize",
"dB20normalize", "dBc", "im", "mag", "normalize", "re".

Return Value None.

Python Syntax FFTOnReport <ReportName>, <WindowName>, <Function>


Python Example oModule.FFTOnReport("XY Plot 1", "Rectangular", "dB")

VB Syntax FFTOnReport(<ReportName>, <WindowName>, <Function>)


VB Example oModule.FFTOnReport "XY Plot 1", "Rectangular", "dB"

GetAllReportNames
Gets the names of existing reports in a design

UI Access N/A
Parameters None.
Return Value Array of report names

Reporter Editor Script Commands 10-48


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetAllReportNames()


Python Example oModule.GetAllReportNames()

VB Syntax GetAllReportNames
VB Example oModule.GetAllReportNames

GetAllCategories
Get all available category names (not including variable and output-variables) in a solution for a report type and display type, returned
as an array of text strings.

UI Access NA

Name Type Description


<ReportType> String Report type name.
Parameters <DisplayType> String Name of display type.
<SolutionName> String Name of solution.
<SimValueCtxt> Array A context name, or array of strings that encode the contexts.

Return Value Array of text strings

Python Syntax GetAllCategories(<ReportType>, <DisplayType>, <SolutionName>, <SimValueCtxt>)


oModule.GetAllCategories("Far Fields",
Python Example
"Rectangular Plot", "Setup1 : LastAdaptive", "Infinite Sphere1")

Reporter Editor Script Commands 10-49


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax GetAllCategories <ReportType>, <DisplayType>, <SolutionName>, <SimValueCtxt>


oModule.GetAllCategories _
VB Example "Far Fields", "Rectangular Plot", _
"Setup1 : LastAdaptive", "Infinite Sphere1"

GetAllQuantities
Gets all available quantity names in category, returned as an array of text strings.

UI Access NA

Name Type Description


<ReportType> String Report type name.
<DisplayType> String Display type name.
Parameters <SolutionName> String Name of solution.
<SimValueCtxt> Array A context name, or array of string that encoded the contexts(I).
<CategoryName> String A category name as input parameter. a category name returned in GetAllCat-
egories() or "Vari-ables", or "Output Variables"

Return Value Array of text strings

Python Syntax GetAllQuantities(<ReportType>,<DisplayType>, <SolutionName>, <SimValueCtxt>, <CategoryName>)


oModule.GetAllQuantities(
Python Example "Far Fields", "Rectangular Plot",
"Setup1 : LastAdaptive",

Reporter Editor Script Commands 10-50


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Infinite Sphere1", "Gain")

VB Syntax GetAllQuantities <ReportType>,<DisplayType>, <SolutionName>, <SimValueCtxt>, <CategoryName>


oModule.GetAllQuantities _
"Far Fields", "Rectangular Plot", _
VB Example "Setup1 : LastAdaptive", )
"Infinite Sphere1", "Gain"

GetAvailableDisplayTypes
Retrieves all supported display types in report type as an array of text strings.

UI Access N/A

Name Type Description


Parameters
<ReportType> String Report type name.

Return Value Array of text strings

Python Syntax GetAvailableDisplayTypes(<ReportType>)


Python Example oModule.GetAvailableDisplayTypes("Far Fields")

Reporter Editor Script Commands 10-51


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax GetAvailableDisplayTypes <ReportType>


VB Example oModule.GetAvailableDisplayTypes "Far Fields"

GetAvailableReportTypes
Retrieves all available report types in the current Design as an array of text string.

UI Access N/A
Parameters None.
Return Value Array of text strings

Python Syntax GetAvailableReportTypes()


Python Example oModule.GetAvailableReportTypes()

VB Syntax GetAvailableReportTypes
VB Example oModule.GetAvailableReportTypes

GetAvailableSolutions
Gets all available solutions in report type as an array of text strings.

UI Access N/A

Reporter Editor Script Commands 10-52


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


Parameters
<ReportType> String Report type name.

Return Value Array of text strings

Python Syntax GetAvailableSolutions(<ReportType>)


Python Example oModule.GetAvailableSolutions("Far Fields")

VB Syntax GetAvailableSolutions <ReportType>


VB Example oModule.GetAvailableSolutions "Far Fields"

GetDataExpressions
Returns data expressions.

Important:

This is a member function of ISolutionDataResultComInterface object, which is the element of the returned array from func-
tion GetSolutionDataPerVariation.

UI Access N/A
Parameters N/A
Return Value Array of text strings

Reporter Editor Script Commands 10-53


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetDataExpressions()


expressions = oModule.GetDataExpressions()
Python Example

VB Syntax GetDataExpressions()
dim expressions
VB Example
expressions = oModule.GetDataExpressions()

GetDataUnits
Returns text string containing units.

Important:

This is a member function of ISolutionDataResultComInterface object, which is the element of the returned array from func-
tion GetSolutionDataPerVariation.

UI Access N/A

Name Type Description


Parameters
<expressionString> String Can be returned from GetDataExpressions()

Return Value Text string of units; empty if no units

Reporter Editor Script Commands 10-54


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetDataUnits(<expressionString>)


oModule.GetDataUnits(expressions)
Python Example

VB Syntax GetDataUnits(<expressionString>)
VB Example oModule.GetDataUnits(expressions)

GetDesignVariableNames
Returns array of strings containing design variable names.

Important:

This is a member function of ISolutionDataResultComInterface object, which is the element of the returned array from func-
tion GetSolutionDataPerVariation.

UI Access NA
Parameters NA
Return Value Array of strings

Python Syntax GetDesignVariableNames()


names = oModule.GetDesignVariableNames()
Python Example

Reporter Editor Script Commands 10-55


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax GetDesignVariableNames()
dim names
VB Example
names = oModule.GetDesignVariableNames()

GetDesignVariableUnits
Returns array of strings containing design variable units.

Important:

This is a member function of ISolutionDataResultComInterface object, which is the element of the returned array from func-
tion GetSolutionDataPerVariation.

UI Access N/A

Name Type Description


Parameters
<varName> String Can be returned from GetDesignVariableNames()

Return Value Text string of units; empty if no units.

Python Syntax GetDesignVariableUnits(<varName>)


units = oModule.GetDesignVariableUnits('Variable Name')
Python Example

VB Syntax GetDesignVariableUnits(<varName>)

Reporter Editor Script Commands 10-56


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

dim units
VB Example
units = oModule.GetDesignVariableUnits("Variable Name")

GetDesignVariableValue
Returns a design variable's value.

Important:

This is a member function of ISolutionDataResultComInterface object, which is the element of the returned array from func-
tion GetSolutionDataPerVariation.

UI Access N/A

Name Type Description


Parameters <varName> String Can be returned from GetDesignVariableNames()
<siValue> Boolean True to return SI-value; False to return by GetDesignVariableUnits()

Return Value Double value

Python Syntax GetDesignVariableValue(<varName>, <siValue>)


value = oModule.GetDesignVariableValue('varName',1)
Python Example

VB Syntax GetDesignVariableValue(<varName>, <siValue>)


VB Example dim value

Reporter Editor Script Commands 10-57


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

value = oModule.GetDesignVariableValue("varName", True)

GetDesignVariationKey
Returns a design's Variation Key.

Important:

This is a member function of ISolutionDataResultComInterface object, which is the element of the returned array from func-
tion GetSolutionDataPerVariation.

UI Access N/A
Parameters N/A
Return Value String containing variation key.

Python Syntax GetDesignVariationKey()


oModule.GetDesignVariationKey()
Python Example

VB Syntax GetDesignVariationKey()
dim key
VB Example
set key = oModule.GetDesignVariationKey()

Reporter Editor Script Commands 10-58


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetDisplayType (Maxwell)
Use: Get Display type of a report.
Command: None
Syntax:GetDisplayType <ReportName>
Return Value: String for display type
Parameters:
<ReportName>
Type: string
The name of report to find the display type for.
Example: Dim displayType
displayType = oModule.GetDisplayType("XY Plot 1")

GetImagDataValues
Returns array of imaginary data values.

Important:

This is a member function of ISolutionDataResultComInterface object, which is the element of the returned array from func-
tion GetSolutionDataPerVariation.

UI Access N/A

Name Type Description


Parameters
<expressionString> String Can be returned from GetDataExpressions()

Reporter Editor Script Commands 10-59


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<siValue> Boolean True to return SI-value; False to return with units returned in
GetSweepUnits().

Return Value Array of doubles

Python Syntax GetImagDataValues(<expressionString>,<siValue>)


imaginaryvalues = oModule.GetImagDataValues('expression',1)
Python Example

VB Syntax GetImagDataValues(<expressionString>,<siValue>)
dim imaginaryvalues
VB Example
imaginaryvalues = oModule.GetImagDataValues("expression",True)

GetPerQuantityPrimarySweepValues
Returns per quantity primary sweep values.

Important:

This is a member function of ISolutionDataResultComInterface object, which is the element of the returned array from func-
tion GetSolutionDataPerVariation.

UI Access N/A

Parameters Name Type Description

Reporter Editor Script Commands 10-60


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<expressionString> String Can be returned from GetDataExpressions().


<siValue> Boolean True to return SI-value; False to return by GetSweepUnits().

Return Value Array of doubles if IsPerQuantityPrimarySweep() returned True; error if returned False

Python Syntax GetPerQuantitySweepValues(<expressionString>, <siValue>)


sweepvalues = oModule.GetPerQuantitySweepValues('0.111,0.201,0.345,0.231', 1)
Python Example

VB Syntax GetPerQuantitySweepValues(<expressionString>, <siValue>)


dim sweepvalues
VB Example
sweepvalues = oModule.GetPerQuantitySweepValues("0.111,0.201,0.345,0.231", True)

GetPropertyValue
Returns the value of a single property belonging to a specific <PropServer> and <PropTab>. This function is available with the Pro-
ject, Design or Editor objects, including definition editors.

Tip:

Use the script recording feature and edit a property, and then view the resulting script to see the format for that property.

UI Access N/A

Name Type Description


Parameters
<PropTab> String One of the following, where tab titles are shown in parentheses:

Reporter Editor Script Commands 10-61


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

l PassedParameterTab ("Parameter Values")


l DefinitionParameterTab (Parameter Defaults")
l LocalVariableTab ("Variables" or "Local Variables")
l ProjectVariableTab ("Project variables")
l ConstantsTab ("Constants")
l BaseElementTab ("Symbol" or "Footprint")
l ComponentTab ("General")
l Component("Component")
l CustomTab ("Intrinsic Variables")
l Quantities ("Quantities")
Signals ("Signals")
l

<PropServer> String An object identifier, generally returned from another script method, such as
Comp-Inst@R;2;3
<PropName> String Name of the property.

Return Value String value of the property.

Python Syntax GetPropertyValue (<PropTab>, <PropServer>, <PropName>)


selectionArray = oEditor.GetSelections()
for k in selectionArray:
Python Example
val = oEditor.GetPropertyValue("PassedParameterTab", k, "R")
...

Reporter Editor Script Commands 10-62


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax GetPropertyValue (<PropTab>, <PropServer>, <PropName>)


selectionArray = oEditor.GetSelections
for k in selectionArray:
VB Example
val = oEditor.GetPropertyValue("PassedParameterTab", k, "R")
...

GetRealDataValues
Returns array of real data values.

Important:

This is a member function of ISolutionDataResultComInterface object, which is the element of the returned array from func-
tion GetSolutionDataPerVariation.

UI Access N/A

Name Type Description


Parameters
<expressionString> String Can be returned from GetDataExpressions()
<siValue> Boolean True to return SI-value; False to return with units returned in
GetSweepUnits().

Return Value Array of doubles

Reporter Editor Script Commands 10-63


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetRealDataValues(<expressionString>,<siValue>)


realvalues = oModule.GetRealDataValues('expression',1)
Python Example

VB Syntax GetRealDataValues(<expressionString>,<siValue>)
dim realvalues
VB Example
realvalues = oModule.GetRealDataValues("expression",True)

GetReportTraceNames
Gets the names of existing trace names in a plot.

UI Access N/A

Name Type Description


Parameters
<PlotName> String Name of specified plot.

Return Value Array of strings containing trace names.

Python Syntax GetReportTraceNames(<PlotName>)


Python Example oModule.GetReportTraceNames("SParameter Plot 1")

VB Syntax GetReportTraceNames <PlotName>

Reporter Editor Script Commands 10-64


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Example oModule.GetReportTraceNames "SParameter Plot 1"

GetSolutionContexts
Gets all available solution context names in a solution as an array of text strings.

UI Access N/A

Name Type Description


<ReportType> String Report type name.
Parameters
<DisplayType> String Display type name.
<SolutionName> String Name of solution.

Return Value Array of text strings

Python Syntax GetSolutionContexts(<ReportType>, <DisplayType>, <SolutionName>)


oModule.GetSolutionContexts(
Python Example
"Far Fields", "Rectangular Plot", "Setup1:LastAdaptive")

VB Syntax GetSolutionContexts <ReportType>, <DisplayType>, <SolutionName>


oModule.GetSolutionContexts _
VB Example "Far Fields", "Rectangular Plot", _
"Setup1:LastAdaptive"

Reporter Editor Script Commands 10-65


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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 parameter.
<solutionNameArg> String Solution name as input parameter.
<simValueCtxtArg> Structured Array Same as ContextArray values created in the relevant
Parameters CreateReport script.
<familiesArg> Array of Strings Same as FamiliesArray values created in the relevant
CreateReport script.
<expressionArg> String or Array of Text string or array of text strings; valid expression, may val-
Strings idate it as the data-table Y-component.

ARRAY of ISolutionDataResultComInterface objects, containing:


l GetSweepNames()
l GetSweepUnits()
l GetSweepValues()
l IsPerQuantityPrimarySweep()
Return Value
l GetDataExpressions() – should be the same as <expressionArg>
l GetPerQuantityPrimarySweepValues()
l IsDataComplex()
l GetDataUnits()
l GetRealDataValues()

Reporter Editor Script Commands 10-66


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

l GetImagDataValues()
l ReleaseData()
l GetDesignVariableNames()
l GetDesignVariableUnits()
l GetDesignVariableValue()
l GetDesignVariationKey()

Note:
l This command is not recordable from the UI, but its parameters are similar to CreateReport, so you may record a
CreateReport script to get the parameter values.
l For the returned ISolutionDataResultComInterface object, some of its functions have an optional boolean para-
meter: SIValue. SIValue defaults to True. When the pass in value is True, return data values will be in Standard Inter-
national values; when False, return data values will be in the current units.

Example: Freq Sweep with [1GHz, 2GHz,3GHz], GetSweepUnits(“Freq”) return “GHz”; GetSweepValues(“Freq”,
True) return [1000000,2000000,3000000]; GetSweepValues(“Freq”, False) return [1,2,3].

GetSolutionDataPerVariation(reportTypeArg, solutionNameArg, simValueCtxtArg, familiesArg, expres-


Python Syntax
sionArg)
oModule = oDesign.GetModule("ReportSetup")

Python Example arr = oModule.GetSolutionDataPerVariation('Modal Solution Data', 'Setup1 :


Sweep', ['Domain:=', 'Sweep'], ['Freq:=', ['All'], 'offset:=', ['All']], ['S
(Port1,Port1)', 'dB(S(Port1,Port3))'])

Reporter Editor Script Commands 10-67


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetSolutionDataPerVariation(reportTypeArg, solutionNameArg, simValueCtxtArg, familiesArg, expres-


VB Syntax
sionArg)
set solutionData = oModule.GetSolutionDataPerVariation(
"Modal Solution Data",
"Setup1 : Sweep",
VB Example Array("Domain:=", "Sweep"),
Array("Freq:=", Array("All"), "offset:=", Array("All")),
Array("S(Port1,Port1)", "dB(S(Port1,Port3))")
)

GetSweepNames
Returns array of text strings containing primary sweep name(s).

Important:

This is a member function of ISolutionDataResultComInterface object, which is the element of the returned array from func-
tion GetSolutionDataPerVariation.

UI Access N/A
Parameters N/A
Return Value Array of text strings

Reporter Editor Script Commands 10-68


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetSweepNames()


sweepnames = arr[0].GetSweepNames()
Python Example

VB Syntax GetSweepNames()
dim sweepnames
VB Example
sweepnames = arr[0].GetSweepNames()

GetSweepUnits
Returns text string containing units.

Important:

This is a member function of ISolutionDataResultComInterface object, which is the element of the returned array from func-
tion GetSolutionDataPerVariation.

UI Access N/A

Name Type Description


Parameters
<sweepName> String Primary sweep name

Return Value Text string containing units

Python Syntax GetSweepUnits(<sweepName>)


Python Example sweepunits = oModule.GetSweepUnits('Sweep 1')

Reporter Editor Script Commands 10-69


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax GetSweepUnits(<sweepName>)
dim sweepunits
VB Example
sweepunits = oModule.GetSweepUnits("Sweep 1")

GetSweepValues
Returns sweep values.

Important:

This is a member function of ISolutionDataResultComInterface object, which is the element of the returned array from func-
tion GetSolutionDataPerVariation.

UI Access N/A

Name Type Description


Parameters <sweepName> String Primary sweep name
<siValue> Boolean True to return SI-value; False to return by GetSweepUnits().

Return Value Array of doubles

Python Syntax GetSweepValues(<sweepName>, <siValue>)

Reporter Editor Script Commands 10-70


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

sweepvalues = oModule.GetSweepValues('Sweep 1', True)


Python Example

VB Syntax GetSweepValues(<sweepName>, <siValue>)


dim sweepvalues
VB Example
sweepvalues = oModule.GetSweepValues("Sweep 1", True)

GroupPlotCurvesByGroupingStrategy
Groups curves in a Stacked Plot automatically based on a curve grouping strategy.

UI Access N/A

Name Type Description


Parameters <ReportName> String Name of report.
<GroupStrategy> String Strategy for grouping, "Single", "By Trace" or "By Units".

Return Value None.

Python Syntax GroupPlotCurvesByGroupingStrategy(<ReportName>, <GroupStrategy>)


Python Example oModule.GroupPlotCurvesByGroupingStrategy("Transient Plot 1", "By Trace")

VB Syntax GroupPlotCurvesByGroupingStrategy <ReportName>, <GroupStrategy>


VB Example oModule.GroupPlotCurvesByGroupingStrategy "Transient Plot 1", "By Trace"

Reporter Editor Script Commands 10-71


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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 Import....

Name Type Description


<ReportName> String Name of the Report
<FileName> String Path and File Name
Parameters
.csv Comma-delimited data file
.tab Tab-separated file
.dat Ansys plot data file

Return Value None

Python Syntax ImportIntoReport (<ReportName>, <FileName>)


oDesign.ImportIntoReport ("Plot1", "c:\report1.dat")
Python Example

VB Syntax ImportIntoReport <ReportName>, <FileName>


VB Example oDesign.ImportIntoReport "Plot1", "c:\report1.dat"

IsDataComplex
Returns whether an expression is complex.

Reporter Editor Script Commands 10-72


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Important:

This is a member function of ISolutionDataResultComInterface object, which is the element of the returned array from func-
tion GetSolutionDataPerVariation.

UI Access NA

Name Type Description


Parameters
<expressionString> String Can be returned from GetDataExpressions().

Return Value Boolean (True if expression is Complex data; False if not)

Python Syntax IsDataComplex(<expressionString>)


oModule.IsDataComplex('.001,.234,.455,.434')
Python Example

VB Syntax IsDataComplex(<expressionString>)
VB Example oModule.IsDataComplex('.001,.234,.455,.434')

IsPerQuantityPrimarySweep
Returns whether data expressions have different primary sweep values.

Reporter Editor Script Commands 10-73


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Important:

This is a member function of ISolutionDataResultComInterface object, which is the element of the returned array from func-
tion GetSolutionDataPerVariation.

UI Access N/A
Parameters N/A
Return Value Boolean (True if data expressions have different primary sweep values)

Python Syntax IsPerQuantityPrimarySweep()


var = oModule.IsPerQuantityPrimarySweep()
Python Example

VB Syntax IsPerQuantityPrimarySweep()
dim var
VB Example
var = oModule.IsPerQuantityPrimarySweep()

MovePlotCurvesToGroup
In a Stacked Plot move curve(s) from its stack(s) to an existing stack. Here term ‘group’ is synonymous to ‘stack’ in the context of
cartesian stacked plot.

Reporter Editor Script Commands 10-74


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access N/A

Name Type Description


<ReportName> String Name of report.
Parameters
<CurveArray> Array Array of curve names to move.
<StackName> String Name of stack to move to.

Return Value None.

Python MovePlotCurvesToGroup(<ReportName>, <CurveArray>, <StackName>)


Syntax

Python oModule.MovePlotCurvesToGroup("XY Stacked Plot 1", ["R2.V : TR", "R2.I : TR"], "Stack
Example 2")

VB Syntax MovePlotCurvesToGroup <ReportName>, <CurveArray>, <StackName>


oModule.MovePlotCurvesToGroup _
"XY Stacked Plot 1", _
VB Example
Array("R2.V : TR", "R2.I : TR"), _
"Stack 2"

MovePlotCurvesToNewGroup
Move curve(s) from its stack(s) to a new stack. Here term ‘group’ is synonymous to ‘stack’ in the context of Cartesian stacked plot.

UI Access N/A

Reporter Editor Script Commands 10-75


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


Parameters <ReportName> String Name of report.
<CurveArray> Array Array of curve names to move.

Return Value None.

Python Syntax MovePlotCurvesToNewGroup (<ReportName>, <CurveArray>)


oModule.MovePlotCurvesToNewGroup(
Python Example "XY Stacked Plot 1",
["R2.V : TR", "R2.I : TR"])

VB Syntax MovePlotCurvesToNewGroup <ReportName>, <CurveArray>


oModule.MovePlotCurvesToNewGroup _
VB Example "XY Stacked Plot 1", _
Array("R2.V : TR", "R2.I : TR")

PasteReports
Paste copied reports to results in the current project.

UI Access Edit > Paste


Parameters None.

Reporter Editor Script Commands 10-76


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value None.

Python Syntax PasteReports ()


oModule.PasteReports()
Python Example

VB Syntax PasteReports
VB Example oModule.PasteReports

PasteTraces
Pastes copied traces to a named plot.

UI Access Paste

Name Type Description


Parameters
<ReportName> String Name of plot

Return Value None

Python Syntax PasteTraces (<ReportName>)


Python Example oModule.PasteTraces ("XY Plot1")

Reporter Editor Script Commands 10-77


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax PasteTraces <ReportName>


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.

Important:

This is a member function of ISolutionDataResultComInterface object, which is the element of the returned array from func-
tion GetSolutionDataPerVariation.

UI Access N/A
Parameters N/A
Return Value N/A

Python Syntax ReleaseData()


oModule.ReleaseData()
Python Example

VB Syntax ReleaseData()
VB Example oModule.ReleaseData()

Reporter Editor Script Commands 10-78


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

RenameReport
Renames an existing report.

UI Access Select a report on the Project tree, right-click and select Rename

Name Type Description


Parameters <OldReportName> String Old Report Name
<NewReportName> String New Report Name

Return Value None.

Python Syntax RenameReport (<OldReportName>, <NewReportName>)


oModule.RenameReport("XY Plot1", "Reflection")
Python Example

VB Syntax RenameReport <OldReportName>, <NewReportName>


VB Example oModule.RenameReport "XY Plot1", "Reflection"

RenameTrace
To rename a trace in a plot

UI Access N/A

Name Type Description


Parameters <ReportName> String Name of report.
<TraceName> String Name of Trace

Reporter Editor Script Commands 10-79


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<NewName> String New trace name.

Return Value None.

Python Syntax RenameTrace(<ReportName>, <TraceName>, <NewName>)


oModule.RenameTrace ("XY Plot1",
Python Example
"dB(S(WavePort1,WavePort1))1", "Port1dbS")

VB Syntax RenameTrace <ReportName>, <TraceName>, <NewName>


oModule.RenameTrace "XY Plot1", _
VB Example "dB(S(WavePort1,WavePort1))1", _
"Port1dbS"

ResetPlotSettings
Resets plot settings to defaults.

UI Access Right-click on a plot, select Edit > Reset Plot Settings

Name Type Description


Parameters
<PlotName> String Name of specified plot.

Return Value None.

Reporter Editor Script Commands 10-80


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax ResetPlotSettings(<PlotName>)


Python Example oModule.ResetPlotSettings("Differential S-parameters")

VB Syntax ResetPlotSettings <PlotName>


VB Example oModule.ResetPlotSettings("Differential S-parameters")

SavePlotSettingsAsDefault
Saves report plot settings as default.

UI Access Report Templates > Save Settings as Default

Name Type Description


Parameters
<PlotName> String Name of plot to use for plot defaults.

Return Value None.

Python Syntax SavePlotSettingsAsDefault ("<PlotName>")


Python Example oModule.SavePlotSettingsAsDefault ("XY Plot1")

VB Syntax SavePlotSettingsAsDefault "<PlotName>"


VB Example oModule.SavePlotSettingsAsDefault "XY Plot 1"

Reporter Editor Script Commands 10-81


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UpdateAllReports
Updates all reports in the Results branch in the project tree.

UI Access Right-click on Results in the project tree, select Update All Reports
Parameters None
Return Value None

Python Syntax UpdateAllReports()


Python Example oModule.UpdateAllReports()

VB Syntax UpdateAllReports
VB Example oModule.UpdateAllReports

UpdateReports
Updates specified reports.

UI Access N/A

Name Type Description


Parameters
<ReportNames> Array Array of strings containing report names.

Return Value None.

Reporter Editor Script Commands 10-82


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax UpdateReports(<ReportNames>)


Python Example oModule.UpdateReports (["XY Plot 1", "XY Plot 4"])

VB Syntax UpdateReports <ReportNames>


VB Example oModule.UpdateReports Array("XY Plot 1", "XY Plot 4")

UpdateTraces
Update the traces in a report for which traces are not automatically updated by the Report Traces dialog box, Update Report, Real
Time selection.

UI Access In Report dialog, click Apply Traces button

Name Type Description


<ReportName> String Name of Report.
<TraceNames> Array Array of strings containing trace names.
<SolutionName> String Name of the solution.
<ContextArray> Array Context for which the expression is being evaluated. This can be an empty
string if there is no context.
Parameters Array("Domain:=", <DomainType>)
<DomainType> ex. "Sweep" or "Time"
Array("Context:=", <GeometryType>)
<GeometryType> ex. "Infinite Spheren", "Spheren",
"Polylinen"
<FamiliesArray> Array Contains sweep definitions for the report.

Reporter Editor Script Commands 10-83


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("<VariableName>:= ", <ValueArray>)


<ValueArray>
Array("All") or Array("Value1", "Value2", ..."Valuen")
examples of <VariableName> "Freq", "Theta", "Distance"
<ReportDataArray> Array This array contains the report quantity and X, Y, and (Z) axis definitions.
Array("X Component:=", <VariableName>,
"Y Component:=", <VariableName> | <ReportQuant-
ityArray>)
<ReportQuantityArray> ex. Array("dB(S(Port1, Port1))")
<ExtTraceInfo> Array Optional. Array defines extended trace information.

Return Value None.

Python Syntax UpdateTraces(<ReportName>, <SolutionName>, <ContextArray >, <FamiliesArray>, <ReportDataArray>)


oModule.UpdateTraces("XY Plot 1", ["NEG1.VAL"], "TR4",
[
"NAME:Context",
Python Example
"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",

Reporter Editor Script Commands 10-84


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"TS",False,"0ns","UF",False,
"0","WT",False,"0","WW",False,"100"]
],
[
"Spectrum:=", ["All"]
],
[
"X Component:=", "Spectrum",
"Y Component:=", ["mag(NEG1.VAL)"]
], [])

VB Syntax UpdateTraces <ReportName>, <SolutionName>, <ContextArray >, <FamiliesArray>, <ReportDataArray>


oModule.UpdateTraces "XY Plot1", Array("dB(S(WavePort1,WavePort1))"), _
"Setup1 : Sweep1", Array("Domain:=", "Time", "HoldTime:=", 1, _
"RiseTime:=", 0, "StepTime:=", 0, "Step:=", false, _
"WindowWidth:=", 1, "WindowType:=", 0, "KaiserParameter:=",1, _
VB Example
"MaximumTime:=", 0), Array("Time:=", Array("All")), _
Array("X Component:=", "Time",_
"Y Component:=", Array("dB(S(WavePort1,WavePort1))")), _
Array()

Reporter Editor Script Commands 10-85


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UpdateTracesContextAndSweeps
Edits sweeps and context of multiple traces without affecting their component expressions.

UI Access Modify Report with multiple traces selected.

Name Type Description


<ReportName> String Name of Report.
<TraceNames> Array Array of strings containing trace names.
<SolutionName> String Name of the solution as listed in the Modify Report dialog box.
Parameters For example: "Setup1 : Last Adaptive"
<ContextArray> Array Context for which the expression is being evaluated. This can be an empty
string if there is no context.
ex. "Sweep" or "Time"
<PointSet> Array Point set for the selected traces, for example, X and Y values for the plot.

Return Value None

UpdateTracesContextAndSweeps(<ReportName>, <TraceNames>, <SolutionName>, <ContextArray>,


Python Syntax
<PointSet>)
oModule.UpdateTracesContextAndSweeps_
("Active S Parameter Quick Report",
Python Example ["dB(ActiveS(Port1:1))", "dB(ActiveS(Port2:1))"],
"Setup1 : Sweep1", [],
["Freq:=", ["9GHz", "9.05GHz", "9.1GHz",

Reporter Editor Script Commands 10-86


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"9.15GHz", "9.2GHz",
"9.25GHz", "9.3GHz", "9.35GHz",
"9.4GHz", "9.45GHz", "9.5GHz",
"9.55GHz",
"9.6GHz", "9.65GHz", "9.7GHz",
"9.9GHz", "9.95GHz", "10GHz"],
"off-
set:=",["All"]])

UpdateTracesContextAndSweeps <ReportName>, <TraceNames>, <SolutionName>, <ContextArray>,


VB Syntax
<PointSet>
oModule.UpdateTracesContextAndSweeps _
"Active S Parameter Quick Report",_
Array("dB(ActiveS(Port1:1))", "dB(ActiveS(Port2:1))"),_
"Setup1 : Sweep1", Array(), _
Array("Freq:=", _
VB Example
Array("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 10-87


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"9.6GHz", "9.65GHz", "9.7GHz", _


"9.75GHz", "9.8GHz", "9.85GHz", _
"9.9GHz", "9.95GHz", "10GHz"),_
"off-
set:=", Array("All"))

UnGroupPlotCurvesInGroup
From a Stacked Plot, ungroups curves in a stack.

UI Access N/A

Name Type Description


Parameters <ReportName> String Name of report.
<GroupName> String Stack group name.

Return Value None.

Python Syntax UnGroupPlotCurvesInGroup(<ReportName>, <GroupName>)


Python Example oModule.UngroupPlotCurvesInGroup("S Parameter Plot 3", "Stack 1")

VB Syntax UnGroupPlotCurvesInGroup <ReportName>, <GroupName>


VB Example oModule.UngroupPlotCurvesInGroup "S Parameter Plot 3", "Stack 1"

Reporter Editor Script Commands 10-88


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

11 - Boundary and Excitation Module Script Commands in


Maxwell
Boundary and excitation commands should be executed by the BoundarySetup module.
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.CommandName <args>
Conventions Used in this Chapter
<BoundName>
Type: string.
Name of a boundary.
<BoundNameArray>
Type: Array of strings
An array of the names in a boundary/excitation group.
<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
Modeler>Measure>Area command. The face ID is given in the Measure Information dialog box.
<LineEndPoint>

Boundary and Excitation Module Script Commands in Maxwell 11-1


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array(<double>, <double>, <double>)


<CoordSysArray>
Array("NAME:CoordSysVector",
"Origin:=", <CoordSysPoint>,
"UPos:=", <LineEndPoint>)

Related Topics
General Commands Recognized by the Boundary/Excitations Module
Script Commands for Creating and Modifying Boundaries in Maxwell
Script Commands for Creating and Modifying Excitations in Maxwell

General Commands Recognized by the Boundary/Excitations Module


AddAssignmentToBoundary
DeleteAllBoundaries
DeleteAllExcitations
DeleteBoundaries
GetBoundaryAssignment
GetBoundaries
GetBoundariesOfType
GetCoreLossEffect
GetCoreLossEffectOnField

Boundary and Excitation Module Script Commands in Maxwell 11-2


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetDisplacementCurrent
GetEddyEffect
GetExcitations
GetExcitationsOfType
GetHybridRegions
GetHybridRegionsOfType
GetNumBoundaries
GetNumBoundariesOfType
GetNumExcitations
GetNumExcitationsOfType
ReassignBoundary
RemoveAssignmentFromBoundary
RenameBoundary
ReprioritizeBoundaries
AddAssignmentToBoundary
Adds a new geometry assignment to a boundary.

UI Access N/A

Name Type Description


<Assignment> Array Structured array.
Parameters
Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,

Boundary and Excitation Module Script Commands in Maxwell 11-3


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Faces:=", <AssignmentFaces>)

Return Value None.

Python Syntax AddAssignmentToBoundary(<Assignment>)


oModule.AddAssignmentToBoundary((
Python Example ["NAME:PerfE1",
"Faces:=", [12]])

VB Syntax AddAssignmentToBoundary <Assignment>


oModule.AddAssignmentTOBoundary Array("NAME:PerfE1", _
VB Example "Objects:=", Array("Box2", "Box3"), _
"Faces:=", Array(12, 11))

DeleteAllBoundaries
Deletes all boundaries.

UI Access [product] > Boundaries > Delete All


Parameters None.
Return Value None.

Boundary and Excitation Module Script Commands in Maxwell 11-4


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax DeleteAllBoundaries()


Python Example oModule.DeleteAllBoundaries()

VB Syntax DeleteAllBoundaries
VB Example oModule.DeleteAllBoundaries

DeleteAllExcitations
Deletes all excitations.

UI Access [product] > Excitations > Delete All


Parameters None.
Return Value None.

Python Syntax DeleteAllExcitations()


Python Example oModule.DeleteAllExcitations()

VB Syntax DeleteAllExcitations
VB Example oModule.DeleteAllExcitations

DeleteBoundaries
Deletes the specified boundaries and excitations.

Boundary and Excitation Module Script Commands in Maxwell 11-5


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access Delete command in the List dialog box. Click [product] > List to open the List dialog box.

Name Type Description


Parameters
<NameArray> Array Array of boundary condition names.

Return Value None.

Python Syntax DeleteBoundaries(<NameArray>)


Python Example oModule.DeleteBoundaries(["PerfE1", "WavePort1"])

VB Syntax DeleteBoundaries <NameArray>


VB Example oModule.DeleteBoundaries Array("PerfE1", "WavePort1")

GetBoundaryAssignment
Gets a list of face IDs associated with the given boundary or excitation assignment.

UI Access N/A

Name Type Description


Parameters
<BoundaryName> String Name of the specified boundary or excitation.

Return Value Array of face IDs or object IDs.

Python Syntax GetBoundaryAssignment(<BoundaryName>)

Boundary and Excitation Module Script Commands in Maxwell 11-6


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Example oModule.GetBoundaryAssignment("Rad1")

VB Syntax GetBoundaryAssignment <BoundaryName>


VB Example oModule.GetBoundaryAssignment "Rad1"

GetBoundaries
Gets boundary names in the current design.

UI Access N/A
Parameters None.
Return Value Array of boundary names.

Python Syntax GetBoundaries()


Python Example oModule.GetBoundaries()

VB Syntax GetBoundaries
VB Example oModule.GetBoundaries

GetBoundariesOfType
Gets boundary names of the given type.

UI Access N/A

Boundary and Excitation Module Script Commands in Maxwell 11-7


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


Parameters
<BoundaryType> String Name of boundary type.

Return Value Array of boundary names of the given type.

Python Syntax GetBoundariesOfType(<BoundaryType>)


Python Example oModule.GetBoundariesOfType("PerfectE")

VB Syntax GetBoundariesOfType <BoundaryType>


VB Example oModule.GetBoundariesOfType "PerfectE"

GetCoreLossEffect
Use: Returns whether the core loss is included in the simulation for the object. Applicable to 2D and 3D Transient and to 3D Eddy Cur-
rent solution types.
Command: None
Syntax: GetCoreLossEffect(<ObjectName>)
Return Value: Returns true or false based on the check box selection. True if checked.
Parameters: <ObjectName>
Type:<string>
Object name.
For example: "inner_arm"

Boundary and Excitation Module Script Commands in Maxwell 11-8


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Example: oModule.GetCoreLossEffect("inner_arm")
GetCoreLossEffectOnField
Use: Returns whether the core loss effect on the field is being considered. Applicable to 2D and 3D Transient solution types.
Command: None
Syntax: GetCoreLossEffectOnField()
Return Value: Returns true or false based on the check box selection. True if checked.
Parameters: None
Example: oModule.GetCoreLossEffectOnField()
GetDisplacementCurrent
Use: Returns whether the displacement current calculation is activated for the object. Applicable to Eddy Current solution type.
Command: None
Syntax: GetDisplacementCurrent(<ObjectName>)
Return Value: Returns true or false based on the check box selection. True if checked.
Parameters: <ObjectName>
Type:<string>
Object name.
For example: "coil1"
Example: oModule.GetDisplacementCurrent("coil1")
GetEddyEffect
Use: Returns whether the eddy effect is activated for the object. Applicable to 2D and 3D Transient and to Eddy Current solution
types.
Command: None

Boundary and Excitation Module Script Commands in Maxwell 11-9


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Syntax: GetEddyEffect(<ObjectName>)
Return Value: Returns true or false based on the given object name. True if checked.
Parameters: <ObjectName>
Type:<string>
Object name.
For example: "inner_arm"
Example: oModule.GetEddyEffect("outer_arm")
GetExcitations
Gets excitation port and terminal names for a model.

UI Access N/A
Parameters None.
Return Value Array of excitation name paired with excitation type.

Python Syntax GetExcitations()


Python Example oModule.GetExcitations()

VB Syntax GetExcitations
VB Example oModule.GetExcitations

Boundary and Excitation Module Script Commands in Maxwell 11-10


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetExcitationsOfType
Gets excitation names of the given type.

UI Access N/A

Name Type Description


Parameters
<ExcitationType> String Name of excitation type.

Return Value Array of excitation names of the given type.

Python Syntax GetExcitationsOfType(<ExcitationType>)


Python Example oModule.GetExcitationsOfType("Wave Port")

VB Syntax GetExcitationsOfType <ExcitationType>


VB Example oModule.GetExcitationsOfType "Wave Port"

GetNumBoundaries
Gets the number of boundaries in a design.

UI Access N/A
Parameters None.
Return Value Integer number of boundaries.

Boundary and Excitation Module Script Commands in Maxwell 11-11


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetNumBoundaries()


Python Example oModule.GetNumBoundaries()

VB Syntax GetNumBoundaries
VB Example oModule.GetNumBoundaries

GetNumBoundariesOfType
Gets the number of boundaries of the given type.

UI Access N/A

Name Type Description


Parameters
<BoundaryType> String Specified boundary type.

Return Value Integer number of boundaries.

Python Syntax GetNumBoundariesOfType(<BoundaryType>)


Python Example oModule.GetNumBoundariesOfType("PerfectE")

VB Syntax GetNumBoundariesOfType <BoundaryType>


VB Example oModule.GetNumBoundariesOfType "PerfectE"

Boundary and Excitation Module Script Commands in Maxwell 11-12


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetNumExcitations
Gets the number of excitations in a design.

UI Access N/A
Parameters None.
Return Value Integer number of excitations.

Python Syntax GetNumExcitations()


Python Example oModule.GetNumExcitations()

VB Syntax GetNumExcitations
VB Example oModule.GetNumExcitations

GetNumExcitationsOfType
Gets the number of excitations of the given type, including all defined modes and terminals of ports.

UI Access N/A

Name Type Description


Parameters
<ExcitationType> String Specified type of excitation.

Return Value Integer number of excitations.

Boundary and Excitation Module Script Commands in Maxwell 11-13


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetNumExcitationsOfType(<ExcitationType>)


Python Example oModule.GetNumExcitationsOfType("Voltage")

VB Syntax GetNumExcitationsOfType <ExcitationType>


VB Example oModule.GetNumExcitationsOfType "Voltage"

ReassignBoundary
Specifies a new geometry assignment for a boundary.

UI Access Right-click Boundaries > Reassign or Excitations > Reassign

Name Type Description


<AssignmentArray> Array Structured array.

Parameters Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)

Return Value None.

Python Syntax ReassignBoundary(<AssignmentArray>)


oModule.ReassignBoundary(
Python Example
[

Boundary and Excitation Module Script Commands in Maxwell 11-14


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NAME:PerfH12",
"Faces:=", [17]
])

VB Syntax ReassignBoundary <AssignmentArray>


oModule.ReassignBoundary _
VB Example Array("NAME:PerfH12", _
"Faces:=", Array(17))

RemoveAssignmentFromBoundary
Removes a geometry assignment from a boundary.

UI Access Right-click on a boundary or an excitation, select Remove from Assignment.

Name Type Description


<AssignmentArray> Array Structured array.

Parameters Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)

Return Value None.

Python Syntax RemoveAssignmentFromBoundary(<AssignmentArray>)

Boundary and Excitation Module Script Commands in Maxwell 11-15


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oModule.RemoveAssignmentFromBoundary(
[
Python Example "NAME:Rad1",
"Faces:=", [11]
])

VB Syntax RemoveAssignmentFromBoundary <AssignmentArray>


oModule.RemoveAssignmentFromBoundary _
VB Example Array("NAME:Rad1", _
"Faces:=", Array(11))

RenameBoundary
Renames a boundary or excitation.

UI Access Right-click a boundary in the project tree, and then click Rename on the shortcut menu.

Name Type Description


Parameters <OldName> String Name of the boundary to be renamed.
<NewName> String New name for the boundary.

Return Value None.

Python Syntax RenameBoundary(<OldName>, <NewName>)

Boundary and Excitation Module Script Commands in Maxwell 11-16


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Example oModule.RenameBoundary("Rad2", "Rad3")

VB Syntax RenameBoundary <OldName>, <NewName>


VB Example oModule.RenameBoundary "Rad2", "Rad3"

ReprioritizeBoundaries
Specifies the order in which the boundaries and excitations are recognized by the solver. The first boundary in the list has the highest
priority.
Note: this command is only valid if all defined boundaries and excitations appear in the list. All ports must be listed before any other
boundary type.

UI Access [product] > Boundaries > Reprioritize

Name Type Description


<NewOrderArray> Array Structured array.
Parameters
Array("NAME:NewOrder",
<BoundName>, <BoundName>, ...)

Return Value None.

Python Syntax ReprioritizeBoundaries(<NewOrderArray>)


oModule.ReprioritizeBoundaries(
Python Example ["NAME:NewOrder",
"Imped1",

Boundary and Excitation Module Script Commands in Maxwell 11-17


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"PerfE1",
"PerfH1"])

VB Syntax ReprioritizeBoundaries <NewOrderArray>


oModule.ReprioritizeBoundaries Array("NAME:NewOrder", _
VB Example
"Imped1", "PerfE1", "PerfH1")

Script Commands for Creating and Modifying Boundaries in Maxwell


Following are script commands for creating and modifying boundaries that are recognized by the "BoundarySetup" module. In the fol-
lowing commands, all named data can be included/excluded as desired and may appear in any order.
l AssignZeroTangentialHField
l EditZeroTangentialHField
l AssignFluxTangential
l EditFluxTangential
l AssignInsulating
l EditInsulating
l AssignSymmetry
l EditSymmetry
l AssignIndependent
l AssignDependent (2D)
l AssignDependent (3D)

Boundary and Excitation Module Script Commands in Maxwell 11-18


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

l EditIndependent
l EditDependent
l AssignRadiation
l EditRadiation
l AssignImpedance
l EditImpedance
l AssignTangentialHField
l EditTangentialHField
l AssignVectorPotential
l EditVectorPotential
l AssignCylindricalHField
l EditCylindricalHField
l AssignResistiveSheet
l EditResistiveSheet
l AssignTouching
l EditTouching
l AssignThinLayer
l EditThinLayer

AssignCylindricalHField
Use: Creates an H-Field boundary on a cylindrical face.
Command: Maxwell>Boundaries>Assign>Tangential H Field
Syntax:AssignCylindricalHField <CylindricalHFieldArray>
Return Value: None

Boundary and Excitation Module Script Commands in Maxwell 11-19


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Parameters: <CylindricalHFieldArray>
Array("NAME:<BoundName>",
"ComponentPhiReal:=", <value>,
"ComponentPhiImg:=", <value>,
"ComponentZReal:=", <value>,
"ComponentZImg:=", <value>,
"ReverseZ:=", <bool>,
"Origin:=", <LineEndPoint>)
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentObjects>)
Example: oModule.AssignCylindricalHField Array("NAME:TangentialHField4", "ComponentPhiReal:=", _
"1", "ComponentPhiImg:=", "2", "ComponentZReal:=", "3", _ "ComponentZImg:=", "4", "ReverseZ:=",
false, _ "ReferencePosDefined:=", true, "Origin:=", _ Array("1.36568542494924mm", "0.6mm",
"0mm"), _
"Faces:=", Array(75))
AssignDependent (2D)
Use: Creates a dependent boundary.
Command: Maxwell2D>Boundaries>Assign>Matching>Dependent
Syntax:AssignDependent ([DependentArray])
Return Value: None
Parameters: <DependentArray>
["NAME:<BoundName>",

Boundary and Excitation Module Script Commands in Maxwell 11-20


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Either:
l "Edges:=" , <Edge ID list>, the IDs of the edges which the boundary is assigned to.
l "Objects:=" , <list of objects>, the name(s) of the polylines the boundary is assigned to.

"ReverseU:=", <bool>,
"Independent:=", <string, name of independent>,
"RelationIsSame:=", <bool>
(where:bool == True for Hdep = Hind, False for Hdep = -Hind, and so on)
]
Example command applied to polyline:
oModule.AssignDependent(["NAME:Dependent1",
"Objects:=" , ["Dependent"],
"ReverseU:=" , False,
"Independent:=" , "Independent1",
"RelationIsSame:=" , False])
Example command applied to edge:
oModule.AssignDependent(["NAME:Dependent1",
"Edges:=" , [8],
"ReverseU:=" , True,
"Independent:=" , "Independent1",
"RelationIsSame:=" , False])
AssignDependent (3D)
Use: Creates a dependent boundary.
Command: Maxwell3D>Boundaries>Assign>Matching>Dependent
Syntax:AssignDependent ([DependentArray])
Return Value: None
Parameters: <DependentArray>

Boundary and Excitation Module Script Commands in Maxwell 11-21


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

[("NAME:<BoundName>",
Either:
l "Faces:=" , <Face ID list>, the IDs of the faces which the boundary is assigned to.
l "Objects:=" <list of objects>, the name(s) of the sheets the boundary is assigned to.

<CoordSysArray>, ["NAME:CoordSysVector", "Origin:=", <list of coordinates>, "UPos:=", <list of


coordinates>,]
"ReverseV:=", <bool>,
"Independent:=", <string, name of independent>,
"RelationIsSame:=", <bool>,
//(bool == True for Hdep = Hind, bool == False for Hdep = -Hind, and so on)]

Example command applied to sheet:


oModule.AssignDependent(["NAME:Dependent1",
"Objects:=" , ["DependentSheet"],
["NAME:CoordSysVector","Origin:=" , ["0mm","0mm","0mm"],
"UPos:=" , ["3.67394039744206e-15mm","60mm","0mm"]],
"ReverseV:=" , True,
"Independent:=" , "Independent1",
"RelationIsSame:=" , False])
Example command applied to face:
oModule.AssignDependent(["NAME:Dependent1",
"Faces:=" , [9],
["NAME:CoordSysVector","Origin:=" , ["0.6mm","-0.6mm","1mm"],
"UPos:=" , ["-0.8mm","-0.6mm","0mm"] ],
"ReverseV:=" , False,
"Independent:=" , "Independent1",
"RelationIsSame:=" , False])

Boundary and Excitation Module Script Commands in Maxwell 11-22


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AssignFluxTangential
Assigns a Flux Tangential boundary condition to the selected face(s).

UI Access Boundaries>Assign>Flux Tangential

Name Type Description


Parameters <NAME> string Name of the flux tangential boundary
<Faces> list List of face identifiers

Return Value None

Python Syntax AssignFluxTangential (<NAME>, <Faces>)


oModule.AssignFluxTangential(
[
Python Example "NAME:FluxTangential2",
"Faces:=", [285,313]
])

oModule.AssignFluxTangential Array("NAME:FluxTangential2",
VB Example
"Faces:=", Array(285, 313))

AssignImpedance (Maxwell)
Use: Creates an impedance boundary.
Command: Maxwell3D or Maxwell2D>Boundaries>Assign>Impedance
Syntax:AssignImpedance <ImpedanceArray>

Boundary and Excitation Module Script Commands in Maxwell 11-23


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value: None


Parameters: <ImpedanceArray>
Array("NAME:<BoundName>",
"Faces:=", <AssignmentFaces>)
"Conductivity:=",<value>,
"Permeability:=", <value>,
"UseMaterial:=", <true or false>,
"MaterialName:=", <Material name>,
"NonlinearCoefficient:=", <number>,
"IsPermeabilityNonlinear:=", <true or false>,
"Objects:=", <AssignmentObjects>,

Example: oModule.AssignImpedance Array("NAME:Impedance5", "Faces:=", Array(29), "Conductivity:=",


_"2128000", "Permeability:=", "1", "UseMaterial:=", true, "MaterialName:=", _"Alnico5", "Non-
linearCoefficient:=", 5, "IsPermeabilityNonlinear:=", true)
AssignIndependent (Maxwell)
Use: Creates an independent boundary.
Command: Maxwell3D or Maxwell2D>Boundaries>Assign>Matching>Independent
Syntax:AssignIndependent <IndependentArray>
Return Value: None
Parameters: <IndependentArray>

Boundary and Excitation Module Script Commands in Maxwell 11-24


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:<BoundName>",
<CoordSysArray>,
"ReverseV:=", <bool>,
Either:
l For 2D - <Edge ID list>: the IDs of the edges which the boundary is assigned to. The value
is a list of edge numbers.

l For 3D - "Faces:=", <AssignmentFaces>,

l <Object>: the name(s) of the objects the boundary is assigned to.

For 2D, objects are Polylines. For 3D, objects can be sheets.
Example AssignIndependent 2D:
oModule.AssignIndependent(["NAME:Independent1",
"Edges:=" , [20], "ReverseU:=" , False])
Example command applied to polyline:
oModule.AssignIndependent(["NAME:Independent1",
"Objects:=" , ["Independent"],"ReverseU:=" , False])
Example AssignIndependent 3D:
oModule.AssignIndependent(["NAME:Independent1",
"Faces:=" , [25],["NAME:CoordSysVector",
"Origin:=" , ["0mm","0mm","82.1090449266692mm"],
"UPos:=" , ["0mm","60mm","82.1090449266692mm"]],
"ReverseV:=" , False])
Example command applied to sheet:
oModule.AssignIndependent(["NAME:Independent1",
"Objects:=" , ["IndependentSheet"],
["NAME:CoordSysVector","Origin:=" , ["0mm","0mm","0mm"],
"UPos:=" , ["60mm","0mm","0mm"]],
"ReverseV:=" , True])

Boundary and Excitation Module Script Commands in Maxwell 11-25


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AssignInsulating
Use: Creates an insulating boundary.
Command: Maxwell3D>Boundaries>Assign>Insulating
Syntax:AssignInsulating <InsulatingArray>
Return Value: None
Parameters: <InsulatingArray>
Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>
"Permittivity:=", <double value>
"Thickness:=", <value><unit>
Example: oModule.AssignInsulating Array("NAME:Insulating2", "Faces:=", Array(9), "Per-
mittivity:=", "3", "Thickness:=", "5mm")
AssignRadiation (Maxwell)
Use: Creates a radiation boundary.
Command: Maxwell3D>Boundaries>Assign>Radiation
Syntax:AssignRadiation <RadiationArray>
Return Value: None
Parameters: <RadiationArray>
Array("NAME:<BoundName>",

Boundary and Excitation Module Script Commands in Maxwell 11-26


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Example: oModule.AssignRadiation Array("NAME:Radiation1", _ "Faces:=", Array(12, 11))
AssignResistiveSheet
Use: For Maxwell 3D Magnetostatic, Eddy Current and Transient designs, creates a resistive sheet boundary between two con-
ductors.
For 3D Eddy Current and Transient designs, the user specifies a Boundary name, boundary face ID list, and a resistance value with
unit.
For 3D Magnetostatic designs, the user specifies a Boundary name, boundary face ID list, and nonlinear anode and cathode coef-
ficients.

Note: For more information on the nonlinear resistive sheet boundary condition, see Assigning a Resistive Sheet Bound-
ary for the 3D Magnetostatic Solver in the Maxwell Help.

UI Access Maxwell 3D > Boundaries > Assign > Resistive Sheet

Name Type Description


<Name> String Boundary name
<Objects> List Name of objects or faces to apply boundary condition; it can be a list of names
Parameters
or integers.
<Nonlinear> Boolean If set to True, designates a nonlinear resistive sheet boundary condition, and
user must specify A, B, C, and D inputs (double values) for anode and cathode
coefficients (see examples).
<Resistance> String Specifies resistance value with unit; not available if Nonlinear set to True.

Return Value None

Boundary and Excitation Module Script Commands in Maxwell 11-27


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

For 3D Magnetostatic, Eddy Current, and Transient designs

Python Syntax AssignResistiveSheet ([<NAME>, <Objects>, <Nonlinear>,<Resistance>])


oModule.AssignResistiveSheet(
[
"NAME:ResistiveSheet2",
"Faces:=", [93],
"Nonlinear:=", False,
"Resistance:=", "2ohm"
])

oModule.AssignResistiveSheet(
[
"NAME:ResistiveSheet1",
Python Example
"Objects:=" , ["Circle1"],
"Nonlinear:=" , True,
"AnodeParA:=" , "300000000",
"AnodeParB:=" , "5",
"AnodeParC:=" , "110000000000000",
"AnodeParD:=" , "2",
"CathodeParA:=" , "300000000",
"CathodeParB:=" , "10",
"CathodeParC:=" , "110000000000000",

Boundary and Excitation Module Script Commands in Maxwell 11-28


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"CathodeParD:=" , "2"
])

VB Syn- AssignResistiveSheet Array (<NAME>, <Faces>, <Nonlinear>,<Resistance>)


tax

oModule.AssignResistiveSheet Array("NAME:ResistiveSheet4", "Faces:=", Array(93), "Non-


VB
linear:=", False,
Example
"Resistance:=", "2ohm")

AssignSymmetry (Maxwell)
Use: Creates a symmetry boundary.
Command: Maxwell3D or Maxwell2D>Boundaries>Assign>Symmetry
Syntax:AssignSymmetry <SymmetryArray>
Return Value: None
Parameters: <SymmetryArray>
Array( "NAME:<BoundName>",
"IsOdd:=",<bool>,//true for odd, false for even
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Example: oModule.AssignSymmetry Array("NAME:Symmetry1", _ "IsOdd:=", true, "Faces:=", Array(35))
AssignTangentialHField
Use: Creates an H-Field boundary on a planar face.

Boundary and Excitation Module Script Commands in Maxwell 11-29


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Command: Maxwell3D>Boundaries>Assign>Tangential H Field


Syntax:AssignTangentialHField <TangentialHFieldArray>
Return Value: None
Parameters: <TangentialHFieldArray>
Array("NAME:<BoundName>",
"ComponentXReal:=", <value>,
"ComponentXImg:=", <value>,
"ComponentYReal:=", <value>,
"ComponentYImg:=", <value>,
<CoordSysArray>
"ReverseV:=", <bool>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentObjects>)
Example: oModule.AssignTangentialHField Array("NAME:TangentialHField2", "ComponentXReal:=", _
"1", "ComponentXImg:=", "2", "ComponentYReal:=", "3", _ "ComponentYImg:=", "4", Array
("NAME:CoordSysVector", _ "Origin:=", Array( "-0.4mm", "-1.4mm", "1mm"), "UPos:=", _
Array("-0.4mm", "-0.8mm", "1mm")), "ReverseV:=", true, _ "Faces:=", Array(7))
AssignThinLayer
Use: For Maxwell 3D AC Conduction, 3D DC Conduction, 3D Magnetostatic, 3D Eddy Current, and 3D Transient designs, creates a
thin layer boundary between two conductors.

UI Access Maxwell 3D>Boundaries>Assign>Thin Layer

Boundary and Excitation Module Script Commands in Maxwell 11-30


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


<ThinLayerArray> Array l For 3D AC Conduction designs: Array containing the boundary name,

boundary face ID array, and permittivity, conductivity, thickness value


with unit.

l For 3D DC Conduction designs: Array containing the boundary name,


boundary face ID array, and conductivity and thickness value with unit.
Parameters l For 3D Magnetostatic, and 3D Transient (T-Omega only): Create an air
gap boundary between two non-conductors. Array containing the bound-
ary name, and thickness value with unit.

l For 3D Eddy Current: Array containing the boundary name, AirGap


(bool);If AirGap=False, include boundary face ID array, conductivity, rel-
ative permeability, and thickness value with unit. If AirGap=true, include
only thickness value with unit.

Return Value None

For 3D AC Conduction designs

Python Syntax AssignThinLayer ([<NAME>, <Faces>, <Permittivity>, <Conductivity>, <Thickness>])


oModule.AssignThinLayer(
[
"NAME:ThinLayer1",
"Faces:=", [40],
Python Example
"Permittivity:=", "1"
"Conductivity:=", "1S_per_m"
"Thickness:=", "1mm"
])

Boundary and Excitation Module Script Commands in Maxwell 11-31


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AssignThinLayer Array (<NAME>, <Faces>, <Permittivity>, <Conductivity>,


VB Syntax
<Thickness>)
oModule.AssignThinLayer Array("NAME:ThinLayer1", "Faces:=", Array40),
VB Example "Permittivity:=", "1", "Conductivity:=", "1S_per_m", "Thickness:=", "1mm")

For 3D DC Conduction designs

Python Syntax AssignThinLayer ([<NAME>, <Faces>, <Conductivity>, <Thickness>])


oModule.AssignThinLayer(
[
"NAME:ThinLayer1",
Python Example "Faces:=", [40],
"Conductivity:=", "1S_per_m"
"Thickness:=", "1mm"
])

AssignThinLayer Array (<NAME>, <Faces>, <Conductivity>,


VB Syntax
<Thickness>)
oModule.AssignThinLayer Array("NAME:ThinLayer1", "Faces:=", Array40),
VB Example "Conductivity:=", "1S_per_m", "Thickness:=", "1mm")

For 3D Magnetostatic and 3D Transient designs

Python Syntax AssignThinLayer ([<NAME>, <Thickness>])


oModule.AssignThinLayer(
Python Example
[

Boundary and Excitation Module Script Commands in Maxwell 11-32


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NAME:ThinLayer1",
"Thickness:=", "1mm"
])

VB Syntax AssignThinLayer Array (<NAME>, <Thickness>)


oModule.AssignThinLayer Array("NAME:ThinLayer1", "Thickness:=", "1mm")
VB Example

For 3D Eddy Current designs

Python Syntax AssignThinLayer ([<NAME>, <Faces>, <AirGap>, <Conductivity>, <RelativePermeability>, <Thickness>])


oModule.AssignThinLayer(
[
"NAME:ThinLayer1",
"Faces:=", [40],
Python Example "AirGap:=", False,
"Conductivity:=", "50000000000S_per_m"
"RelativePermeability:=", "1"
"Thickness:=", "0.02mm"
])

VB Syn- AssignThinLayer Array (<NAME>, <Faces>, <AirGap>, <Conductivity>, <RelativePermeability>, <Thickness>)


tax

oModule.AssignThinLayer Array("NAME:ThinLayer1", "Faces:=", Array(40), "AirGap:=",


False,
VB "Conductivity:=", "50000000000S_per_m", "RelativePermeability:=", "1", "Thickness:=",
Example "0.02mm")

Boundary and Excitation Module Script Commands in Maxwell 11-33


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AssignTouching
Use: For Maxwell 3D Transient designs with translational motion with a moving part touching stationary part, assigns a touching
boundary condition to a face of the moving part that touches a stationary part.

UI Access Maxwell 3D>Boundaries>Assign>Touching

Name Type Description


Parameters <NAME> string The name of the boundary
<Faces> list Array of face IDs

Return Value None

Python Syntax AssignTouching (<NAME>, <Faces>)


oModule.AssignTouching(
[
Python Example "NAME:Touching3",
"Faces:=", [210]
])

VB Syntax AssignTouching (<NAME>, <Faces>)


oModule.AssignTouching
VB Example
Array("NAME:Touching3", "Faces:=", Array(210))

Boundary and Excitation Module Script Commands in Maxwell 11-34


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AssignVectorPotential
Use: For Maxwell 2D Eddy Current, Magnetostatic, and Transient designs, assigns a vector potential boundary condition to the spe-
cified edges.

UI Access Maxwell 2D>Boundaries>Assign>Vector Potential

Name Type Description


<NAME> string The name of the boundary
<Edges> list Array of edge IDs
Parameters <Phase> string Phase angle with unit (for 2D Eddy Current designs only)
<Value> string Vector potential value in weber/m
<Coordin- string Name of the reference coordinate system if the vector potential value is a spa-
ateSystem> tial dependent function such as z+2

Return Value None

AssignVectorPotential (<NAME>, <Edges>, <Phase>, <Value>,


Python Syntax
<CoordinateSystem>)
oModule.AssignVectorPotential(
[
"NAME:VectorPotential2",
"Edges:=", [21],
Python Example "Phase:=", "60deg",
"Value:=", "Z+2",
"CoordinateSystem:=", "Global"

])

Boundary and Excitation Module Script Commands in Maxwell 11-35


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AssignVectorPotential (<NAME>, <Edges>, <Phase>, <Value>,


VB Syntax
<CoordinateSystem>)
oModule.AssignVectorPotential Array("NAME:VectorPotential3",
VB Example "Edges:=", Array(21), "Phase:=", "60deg", "Value:=", "Z+2"),
"CoordinateSystem:=", "Global"

AssignZeroTangentialHField
Use: Creates a zero tangential H-Field boundary.
Command: Maxwell>Boundaries>Assign>Zero Tangential H Field
Syntax:AssignZeroTangentialHField <ZeroTangentialHFieldArray>
Return Value: None
Parameters: <ZeroTangentialHFieldArray>
Array("NAME:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Example: oModule.AssignZeroTangentialHField Array("NAME:ZeroTangentialHField1", "Faces:=", Array
(7))
EditCylindricalHField
Use: Edits a cylindrical H-Field boundary.
Command: Double-click the boundary in the project tree to edit it.
Syntax:EditCylindricalHField <BoundName> <CylindricalHFieldArray>
Return Value: None

Boundary and Excitation Module Script Commands in Maxwell 11-36


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Script Commands for Creating and Modifying Excitations


EditDependent (Maxwell)
Use: Modifies a dependent boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditDependent <BoundName> <DependentArray>
Return Value: None

Note: Refer to AssignDependent (2D) and AssignDependent (3D) examples for syntax details.

EditFluxTangential
Edits a Flux Tangential boundary condition name.

UI Access Double-click the Flux Tangential Boundaries item in the Project tree to edit the name.

Name Type Description


Parameters
<NAME> string The edited name

Return Value None

Python Syntax EditFluxTangential_1 (<NAME>)


oModule.EditFluxTangential("FluxTangential1",
[
Python Example
"NAME:FluxTangential_New"
])

Boundary and Excitation Module Script Commands in Maxwell 11-37


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oModule.EditFluxTangential "FluxTangential1",
VB Example
Array("NAME:FluxTangential_New")

EditImpedance (Maxwell)
Use: Edits an impedance boundary.
Command: Double-click the boundary in the project tree to edit it.
Syntax:EditImpedance <BoundName> <ImpedanceArray>
Return Value: None
Parameters: <BoundName>, string name of boundary
<ImpedanceArray>
Array("NAME:<BoundName>",
"Faces:=", <AssignmentFaces>)
"Conductivity:=",<value>,
"Permeability:=", <value>,
"UseMaterial:=", <true or false>,
"MaterialName:=", <Material name>,
"NonlinearCoefficient:=", <number>,
"IsPermeabilityNonlinear:=", <true or false>,
"Objects:=", <AssignmentObjects>,
Example: (UseMaterial= true)

Boundary and Excitation Module Script Commands in Maxwell 11-38


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oModule.EditImpedance "Impedance5", Array("NAME:Impedance5", "UseMaterial:=", true, "Mater-


ialName:=", _"Ceramic8D", "IsPermeabilityNonlinear:=", true, "NonlinearCoefficient:=", 6, "Con-
ductivity:=", _"0.0001")
Example: (use constant; UseMaterial false)
oModule.EditImpedance "Impedance5", Array("NAME:Impedance5", "UseMaterial:=", false, "Per-
meability:=", _"2", "Conductivity:=", "3")
EditIndependent (Maxwell)
Use: Modifies an independent boundary.
Command: Double-click the boundary in the Project Manager to modify its settings.
Syntax: Edit <BoundName> <PrimaryArray>
Return Value: None

Note: Refer to AssignIndependent examples for syntax details.

EditInsulating
Use: Edits an insulating boundary.
Command: Double-click the boundary in the project tree to edit it.
Syntax:EditInsulating <BoundName> <InsulatingArray>
Return Value: None
Parameters: <BoundName> , string name of boundary
<InsulatingArray>
Array("Name:<BoundName>",
"Permittivity:=", <double value>

Boundary and Excitation Module Script Commands in Maxwell 11-39


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Thickness:=", <value><unit>
Example: oModule.EditInsulating "Insulating2", Array("NAME:Insulating2", "Permittivity:=", "5",
"Thickness:=", "7meter")
EditRadiation (Maxwell)
Use: Edits a radiation boundary.
Command: Double-click the boundary in the project tree to edit it.
Syntax:EditRadiation <BoundName> <RadiationArray>
Return Value: None
EditResistiveSheet
Use: For Maxwell 3D Magnetostatic, Eddy Current, Transient designs, edits a resistive sheet boundary. A nonlinear boundary con-
dition can be used in a Maxwell 3D Magnetostatic design.

UI Access Double-click the boundary in the project tree to edit it.

Name Type Description


<BoundName> String The name of the boundary.
<Res- Array For 3D Eddy Current and Transient designs: Array containing the boundary
Parameters istiveSheetArray> name, and resistance value with unit.
For 3D Magnetostatic designs: Array containing the boundary name, and non-
linear boundary condition. If the nonlinear boundary condition is selected, the
user has to specify inputs (double values) for anode and cathode coefficients.

Return Value None

For 3D Magnetostatic, Eddy Current, and Transient designs

Boundary and Excitation Module Script Commands in Maxwell 11-40


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax EditResistiveSheet (<BoundName>, [<NAME>, <Nonlinear>,<Resistance>])


oModule.EditResistiveSheet("ResistiveSheet1",
[
"NAME:ResistiveSheet1",
"Nonlinear:=", False,
"Resistance:=", "3ohm"
])

With a nonlinear boundary condition:


oModule.EditResistiveSheet("ResistiveSheet1",
[
"NAME:ResistiveSheet1",
Python Example
"Nonlinear:=", True,
"AnodeParA:=", "200000000",
"AnodeParB:=", "7.1",
"AnodeParC:=", "120000000000000",
"AnodeParD:=", "6",
"CathodeParA:=", "100000000",
"CathodeParB:=", "12",
"CathodeParC:=", "120000000000000",
"CathodeParD:=", "4"
])

Boundary and Excitation Module Script Commands in Maxwell 11-41


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syn- EditResistiveSheet <BoundName>, Array (<NAME>, <Nonlinear>,<Resistance>)


tax

oModule.EditResistiveSheet "ResistiveSheet2", Array("NAME:ResistiveSheet2", "Non-


VB
linear:=", False,
Example
"Resistance:=", "3ohm")

EditSymmetry
Modifies a symmetry boundary.

UI Access Double-click the symmetry boundary in the project tree to edit its settings.

Name Type Description


<BoundaryName> String Name of the symmetry boundary to be edited.
<SymmetryArray> Array Structured array.
Parameters
Array("NAME:<BoundName>",
"IsPerfectE:=", <boolean>)

Return Value None.

Python Syntax EditSymmetry(<BoundaryName>, <SymmetryArray>)


oModule.EditSymmetry("Sym1",
Python Example ["NAME:Sym1After",
"IsPerfectE:=", True

Boundary and Excitation Module Script Commands in Maxwell 11-42


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

])

VB Syntax EditSymmetry <BoundaryName>, <SymmetryArray>


oModule.EditSymmetry "Sym1", _
VB Example Array("NAME:Sym1After",_
"IsPerfectE:=", true)

EditTangentialHField
Use: Edits a tangential H-Field boundary.
Command: Double-click the boundary in the project tree to edit it.
Syntax:EditTangentialHField <BoundName> <TangentialHFieldArray>
Return Value: None
EditThinLayer
Use: For Maxwell 3D AC Conduction, 3D DC Conduction, 3D Magnetostatic, 3D Eddy Current, and 3D Transient designs, edit a thin
layer boundary.

UI Access Double-click the boundary in the project tree to edit it.

Name Type Description


<BoundName> String The name of the boundary.
<ThinLayerArray> Array l For 3D AC Conduction designs: Array containing the boundary name,

Parameters boundary face ID array, and permittivity, conductivity, thickness value


with unit.

l For 3D DC Conduction designs: Array containing the boundary name,

Boundary and Excitation Module Script Commands in Maxwell 11-43


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

boundary face ID array, and conductivity and thickness value with unit.

l For 3D Magnetostatic and 3D Transient (T-Omega only): An air gap


boundary between two non-conductors. Array containing the boundary
name, and thickness value with unit.

l For 3D Eddy Current: Array containing the boundary name, AirGap


(bool);If AirGap=False, include conductivity, relative permeability, and
thickness value with unit. If AirGap=true, include only thickness value
with unit.

Return Value None

For 3D AC Conduction and 3D DC Conduction designs

EditThinLayer (BoundName [<NAME>, <Faces>, <Permittivity(AC Conduction)>, <Conductivity>,


Python Syntax
<Thickness>])
oModule.EditThinLayer("ThinLayer1"
[
"NAME:ThinLayer1",
"Faces:=", [40],
Python Example
"Permittivity:=", "1"
"Conductivity:=", "1S_per_m"
"Thickness:=", "1mm"
])

EditThinLayer BoundName Array (<NAME>, <Faces>, <Permittivity>, <Conductivity>,


VB Syntax
<Thickness>)

VB Example oModule.EditThinLayer Array("NAME:ThinLayer1", "Faces:=", Array40),

Boundary and Excitation Module Script Commands in Maxwell 11-44


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Permittivity:=", "1", "Conductivity:=", "1S_per_m", "Thickness:=", "1mm")

For 3D Magnetostatic and 3D Transient designs

Python Syntax EditThinLayer (BoundName [<NAME>, <Thickness>])


oModule.EditThinLayer("ThinLayer1"
[
Python Example "NAME:ThinLayer1",
"Thickness:=", "1mm"
])

VB Syntax EditThinLayer BoundName Array (<NAME>, <Thickness>)


oModule.EditThinLayer Array("NAME:ThinLayer1", "Thickness:=", "1mm")
VB Example

For 3D Eddy Current designs

Python Syntax EditThinLayer (BoundName [<NAME>, <AirGap>, <Conductivity>, <RelativePermeability>, <Thickness>])


oModule.EditThinLayer("ThinLayer1"
[
"NAME:ThinLayer1",
"AirGap:=", False,
Python Example
"Conductivity:=", "50000000000S_per_m"
"RelativePermeability:=", "1"
"Thickness:=", "0.02mm"
])

VB Syn- EditThinLayer BoundName Array (<NAME>, <AirGap>, <Conductivity>, <RelativePermeability>, <Thickness>)


tax

Boundary and Excitation Module Script Commands in Maxwell 11-45


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oModule.EditThinLayer "ThinLayer1", Array("NAME:ThinLayer1", "AirGap:=", False,


VB
"Conductivity:=", "50000000000S_per_m", "RelativePermeability:=", "1", "Thickness:=",
Example "0.02mm")

EditTouching
Use: For Maxwell 3D Transient designs with translational motion with a moving part touching stationary part, edits a touching bound-
ary condition.

UI Access Double-click a touching boundary condition in the Project Manager to open the Touching Boundary dialog box.

Name Type Description


Parameters
<NAME> string The name of the boundary

Return Value None

Python Syntax EditTouching (<NAME>)


oModule.EditTouching(
[
Python Example
"NAME:Touching3"
])

VB Syntax EditTouching (<NAME>)


oModule.EditTouching
VB Example
Array("NAME:Touching3")

Boundary and Excitation Module Script Commands in Maxwell 11-46


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

EditVectorPotential
Use: For Maxwell 2D Eddy Current, Magnetostatic, and Transient designs, edits a vector potential boundary condition.

UI Access
Double-click a vector potential boundary condition in the Project Manager to open the Vector Potential Bound-
ary dialog box.

Name Type Description


<NAME> string The name of the boundary
<Edges> list Array of edge IDs
Parameters <Phase> string Phase angle with unit (for 2D Eddy Current designs only)
<Value> string Vector potential value in weber/m
<Coordin- string Name of the reference coordinate system if the vector potential value is a spa-
ateSystem> tial dependent function such as z+2

Return Value None

EditVectorPotential (<NAME>, <Edges>, <Phase>, <Value>,


Python Syntax
<CoordinateSystem>)
oModule.EditVectorPotential(
[
"NAME:VectorPotential2",
"Edges:=", [21],
Python Example
"Phase:=", "60deg",
"Value:=", "z+2",
"CoordinateSystem:=", "Global"
])

VB Syntax EditVectorPotential (<NAME>, <Edges>, <Phase>, <Value>,

Boundary and Excitation Module Script Commands in Maxwell 11-47


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<CoordinateSystem>)
oModule.EditVectorPotential Array("NAME:VectorPotential3",
VB Example "Edges:=", Array(21), "Phase:=", "60deg", "Value:=", "z+2",
"CoordinateSystem:=", "Global")

EditZeroTangentialHField
Use: Edits a zero tangential H-Field boundary.
Command: Double-click the boundary in the project tree to edit it.
Syntax:EditZeroTangentialHField <BoundName>, <PerfectEArray>
Return Value: None

Script Commands for Creating and Modifying Excitations in Maxwell


Following are script commands for creating and modifying excitations that are recognized by the "BoundarySetup" module. In the fol-
lowing commands, all named data can be included/excluded as desired and may appear in any order.
l AddTerminalsToWinding
l AssignCharge
l AssignCoilTerminal
l AssignCoilTerminalGroup
l AssignCurrent
l AssignCurrentDensity
l AssignCurrentDensityGroup
l AssignCurrentDensityTerminal
l AssignCurrentDensityTerminalGroup

Boundary and Excitation Module Script Commands in Maxwell 11-48


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

l AssignCurrentGroup
l AssignFloating
l AssignSink
l AssignVoltage
l AssignVoltageAPhi
l AssignVolumeChargeDensity
l AssignVoltageDrop
l AssignVoltageDropGroup
l AssignVoltageGroup
l Assign Winding Group
l EditCharge
l EditCoilTerminal
l EditCurrent
l EditCurrentDensity
l EditCurrentDensityTerminal
l EditExternalCircuit
l EditFloating
l EditSink
l EditVoltage
l EditVoltageAPhi
l EditVolumeChargeDensity
l EditVoltageDrop
l EditWindingGroup

Boundary and Excitation Module Script Commands in Maxwell 11-49


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

l SetCoreLoss
l SetEddyEffect
l SetMagnetizationCompute
l SetMinimumTimeStep

AddTerminalsToWinding
Use: Adds existing terminal(s) to the selected winding.
Command: Right-click a winding item in the project tree, and then select Add Terminals.
Syntax:AddTerminalsToWinding <AddTerminalsToWindingArray>
Return Value: None
Parameters: < AddTerminalsToWindingArray >
Array(" NAME:AddTerminalsToWinding", <BoundListArray>)
<BoundListArray> Array("NAME:BoundaryList",<CoilTerminalArray>)
Example:
oModule.AddTerminalstoWinding Array("NAME:AddTerminalsToWinding", _
Array("NAME:BoundaryList", Array("NAME:CoilTerminal1", _
"Point out of terminal:=", false, "Conductor number:=", _
"1", "Winding:=", "Winding1", "Faces:=", Array(12)), _
Array("NAME:CoilTerminal2", "Point out of terminal:=", _
false, "Conductor number:=", "1", "Winding:=", _
"Winding1", "Faces:=", Array(7))))
AssignCharge
Use: Creates a charge excitation.
Command: Maxwell>Excitations>Assign>Charge

Boundary and Excitation Module Script Commands in Maxwell 11-50


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Syntax:AssignCharge <ChargeArray>
Return Value: None
Parameters: <ChargeArray>
Array("NAME:<BoundName>",
"Value:=", <value>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Example: oModule.AssignCharge Array("NAME:Charge1", "Value:=", _ "1", "Faces:=", Array(11))
AssignCoilGroup
Use: For Maxwell 2D designs, creates a group of coil excitations. The coil excitations can be assigned on 2D objects.

Select the desired objects (coils) on the model or in the History tree. Then, select Maxwell 2D> Excit-
ations>Assign>Coil to open the Coil Excitation dialog where you can enter the base Name for the group of
UI Access
excitations being created, the number of conductors, and the polarity to be assigned to each of the new excit-
ations.

Name Type Description


<NAME> string The name of the coil group
Parameters <Objects> list List of objects to which the excitations are applied
<Conductor number> int The number of conductors
<Polarity type> string Positive or Negative

Return Value None

Python Syntax AssignCoilGroup (CoilGroupArray, <NAME>, <Objects>, <Conductor number>, <Polarity type>)

Boundary and Excitation Module Script Commands in Maxwell 11-51


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oModule.AssignCoilGroup(["terminal_A_plus", "terminal_A_plus_1"],
[
Python Example "NAME:terminal_A_plus",
"Objects:=" , ["terminal_A_plus","terminal_A_plus_1"],
"Conductor number:=" , "10",
"PolarityType:=", Positive ])

VB Syntax AssignCoilGroup CoilGroupArray, <NAME>, <Objects>, <Conductor number>, <Polarity type>


OModule.AssignCoilGroup Array("terminal_A_plus", "terminal_A_plus_1"),
Array(NAME:terminal_A_plus", "Objects:=",
VB Example
Array("terminal_A_plus","terminal_A_plus_1"),
"Conductor number:=" , "10", "Polarity type:=", Positive)

AssignCoilTerminal
Use: Assigns 2D terminals
Command: Maxwell>Excitations>Assign>Coil Terminal
Syntax:AssignCoilTerminal <TerminalArray>
Parameters: <TerminalArray>
Array("NAME:AssignTerminals",
Array("Name:SourceList", Array("Name:<SourceName>",
"Excitation:=", <NetObject>, "Objects:=", <Assignment 2D>)),
Array("Name:SinkList", Array("Name:<SinkName>",
"Excitation:=", <NetObject>, "Objects:=", <Assignment 2D>)),

Boundary and Excitation Module Script Commands in Maxwell 11-52


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Name:DeleteList", <Name Array>)


Return Value: None
Example: OModule.Assign2DTerminals Array("NAME:AssignTerminals", Array("NAME:SourceList", Array
("NAME:Source2", "Net:=",_ "Box2", "Objects:=", Array("Rectangle1"))), _ Array("NAME:SinkList",
Array("NAME:Sink1", "Net:=", _ "Box1", "Objects:=", Array("Rectangle2"))), _ "DeleteList:=", "")
oModule.AssignPerfectH Array("NAME:PerfH1", "Faces:=", _ Array(12))
AssignCoilTerminalGroup
Use: For Maxwell 3D designs, creates a group of coil terminal excitations. The coil terminals can be assigned on the faces of 3D
objects or directly on sheet objects.

Select the desired objects (coils) on the model or in the History tree. Then, select Maxwell 3D> Excit-
ations>Assign>Coil Terminal to open the Coil Terminal Excitation dialog where you can enter the base
UI Access
Name for the group of excitations being created, the number of conductors, and use the Swap Direction button
to set the current direction to be assigned to each of the new excitations.

Name Type Description


<NAME> string The name of the coil terminal group
<Objects> list List of faces or sheet objects to which the excitations are applied
Parameters <Conductor num- int The number of conductors
ber>
<Point out of ter- bool True sets the current direction out of the terminal
minal>

Return Value None

AssignCoilTerminalGroup (TerminalGroupArray, <NAME>, <Objects>, <Conductor number>, <Point out of ter-


Python Syntax
minal>)
Python Example oModule.AssignCoilTerminalGroup(["CoilTerminal_1", "CoilTerminal_2"],

Boundary and Excitation Module Script Commands in Maxwell 11-53


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

[
"NAME:CoilTerminal_1",
"Objects:=" , ["terminal_A_plus","terminal_A_plus_1"],
"Conductor number:=" , "10",
"Point out of terminal:=", False
])

AssignCoilTerminalGroup TerminalGroupArray, <NAME>, <Objects>, <Conductor number>, <Point out of ter-


VB Syntax
minal>
OModule.AssignCoilTerminalGroup Array("CoilTerminal_1", "CoilTerminal_2"),
Array(NAME:CoilTerminal_1", "Objects:=",
VB Example
Array("terminal_A_plus","terminal_A_plus_1"),
"Conductor number:=" , "10", "Point out of terminal:=", False)

AssignCurrent
Creates a current source.

UI Access Excitations>Assign>Current

Name Type Description


<NAME> string The name of the excitation
<Faces> list List of faces to which the excitation is applied
<Current> string Current value with unit
Parameters <IsSolid> bool True if type is Solid; False if Stranded
<Cur- int 0 for Single Potential
rentExcitationModel>
1 for Double Potentials
2 for Double Potentials with Ground

Boundary and Excitation Module Script Commands in Maxwell 11-54


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<Point out of terminal> bool True sets the current direction out of the terminal

Return Value None

AssignCurrent_1 (<NAME>, <Faces>, <Current>, <IsSolid>, <CurrentExcitationModel>, <Point out of


Python Syntax
terminal>)
oModule.AssignCurrent(
[
"NAME:Current6",
"Faces:=" , [260],
Python Example "Current:=" , "0mA",
"IsSolid:=" , True,
"CurrentExcitationModel:=", 0,
"Point out of terminal:=", False
])

oModule.AssignCurrent Array("NAME:Current6", "Faces:=", Array(952),


VB Example "Current:=", "0mA", "IsSolid:=", true, "CurrentExcitationModel:=", 0,
"Point out of terminal:=", false)

AssignCurrentDensity
Use: Creates a current density excitation.
Command: Maxwell>Excitations>Assign>Current Density
Syntax:AssignCurrentDensity <CurrentDensityArray>
Return Value: None
Parameters: <CurrentDensityArray>

Boundary and Excitation Module Script Commands in Maxwell 11-55


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:<BoundName>",
"CurrentDensityX:=", <value>,
"Phase:=", <value>,//for eddy current solution type
"CurrentDensityY:=", <value>,
"CurrentDensityZ:=", <bool>,
"CoordinateSystem Name:=", <string>,
"CoordinateSystem Type:=", <string>,
"Objects:=", <AssignmentObjects>)
Example: oModule.AssignCurrentDensity Array("NAME:CurrentDensity1", "CurrentDensityX:=", _
"1", "CurrentDensityY:=", "2", "CurrentDensityZ:=", _ "3", "CoordinateSystem Name:=", "Global",
_ "CoordinateSystem Type:=", "Cartesian", "Objects:=", _ Array("Box1"))
Example: oModule.AssignCurrentDensity Array("NAME:CurrentDensity1", "Phase:=", "12", _ "Cur-
rentDensityX:=", "1", "CurrentDensityY:=", _
"2", "CurrentDensityZ:=", "3", _
"CoordinateSystem Name:=", "Global",
"CoordinateSystem Type:=", "Cartesian", "Objects:=", _ Array("Box1"))
AssignCurrentDensityGroup
Use: Creates a group of current density excitations.
Command: Maxwell>Excitations>Assign>Current Density
Syntax:AssignCurrentDensityGroup <BoundNameArray> <CurrentDensityArray>
Return Value: None

Boundary and Excitation Module Script Commands in Maxwell 11-56


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AssignCurrentDensityTerminal
Use: Creates a current density terminal excitation.
Command: Maxwell>Excitations>Assign>Current Density Terminal
Syntax:AssignCurrentDensityTerminal <CurrentDensityTerminalArray>
Return Value: None
Parameters: <CurrentDensityTerminalArray>
Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Example: oModule.AssignCurrentDensityTerminal Array("NAME:CurrentDensityTeminal1", "Faces:=",
Array(7))
AssignCurrentDensityTerminalGroup
Use: Creates a group of current density terminal excitations.
Command: Maxwell>Excitations>Assign>Current Density Terminal
Syntax:AssignCurrentDensityTerminalGroup <BoundNameArray> <CurrentDensityTerminalArray>
Return Value: None
AssignCurrentGroup
Use: Creates a group of current excitations.
Command: Maxwell>Excitations>Assign>Current
Syntax:AssignCurrentGroup <BoundNameArray> <CurrentArray>
Return Value: None

Boundary and Excitation Module Script Commands in Maxwell 11-57


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AssignFloating
Use: Creates a floating excitation.
Command: Maxwell>Boundaries>Assign>Floating
Syntax:AssignFloating <FloatingArray>
Return Value: None
Parameters: <FloatingArray>
Array("NAME:<BoundName>",
"Value:=", <value>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Example: oModule.AssignFloating Array("NAME:Floating1", _ "Value:=", "1", "Faces:=", Array(11))
AssignSink (Maxwell)
Use: Creates a sink.
Command: Maxwell>Excitations>Assign>Sink
Syntax:AssignSink <SinkArray>
Return Value: None
Parameters: <SinkArray>
Array("NAME:<SinkName>",
"Faces:=", <AssignmentFaces>)

Boundary and Excitation Module Script Commands in Maxwell 11-58


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Example: oModule.AssignSink Array("NAME:Sink1",_


"Faces:=", Array(12))
AssignVoltage (Maxwell)
Use: Creates a voltage excitation.
Command: Maxwell>Excitations>Assign>Voltage
Syntax:AssignVoltage <SourceArray>
Return Value: None
Parameters: <SourceArray>
Array("NAME:<SourceName>",
"Faces:=", <AssignmentFaces>)
Example: oModule.AssignVoltage Array("NAME:Source1",_
"Faces:=", Array(12))
AssignVoltageAPhi
Assigns a voltage excitation for 3D transient A-Phi solutions.

UI Access Excitations>Assign>Voltage

Name Type Description


<NAME> string The name of the voltage excitation
<Objects> list List of objects to which the excitation is applied
<VoltageAPhi> string Voltage value with unit
Parameters <VoltageAPhiInitialCurrent> string Initial current value with unit
<VoltageAPhiHasIni- bool True if Initial Current is used.
tialCurrent>
<VoltageAPhiEx- int 0 for Single Potential
citationModel>

Boundary and Excitation Module Script Commands in Maxwell 11-59


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

1 for Double Potentials


2 for Double Potentials with Ground
<VoltageAPhi_Point_out_of_ bool True sets the voltage direction out of the terminal
terminal>

Return Value None

AssignVoltageAPhi (<NAME>, <Objects>, <VoltageAPhi>, <VoltageAPhiInitialCurrent>, <VoltageAPhiHasIni-


Python Syntax
tialCurrent>, <VoltageAPhiExcitationModel>, <VoltageAPhi_Point_out_of_terminal>)
oModule.AssignVoltageAPhi(
[
"NAME:Voltage4",
"Objects:=" , ["Cylinder1"],
"VoltageAPhi:=" , "0mV",
Python Example
"VoltageAPhiInitialCurrent:=", "0mA",
"VoltageAPhiHasInitialCurrent:=", False,
"VoltageAPhiExcitationModel:=", 0,
"VoltageAPhi_Point_out_of_terminal:=", False
])

oModule.AssignVoltageAPhi Array("NAME:Voltage4", "Objects:=", Array("Cylinder1"),


"VoltageAPhi:=", "0mV", "VoltageAPhiInitialCurrent:=", "0mA",
VB Example
"VoltageAPhiHasInitialCurrent:=", false, "VoltageAPhiExcitationModel:=", 0,
"VoltageAPhi_Point_out_of_terminal:=", false)

Boundary and Excitation Module Script Commands in Maxwell 11-60


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AssignVoltageDrop
Use: Creates a voltage drop excitation.
Command: Maxwell>Excitations>Assign>Voltage Drop
Syntax:AssignVoltageDrop <VoltageDropArray>
Return Value: None
Parameters: <VoltageDropArray>
Array("NAME:<BoundName>",
"Voltage Drop:=", <value>,
"Point out of terminal:=", <bool>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Example: oModule.AssignVoltageDrop Array("NAME:VoltageDrop1", _ "Voltage Drop:=", "1kV", "Point
out of terminal:=", _ true, "Faces:=", Array(7))
AssignVoltageDropGroup
Use: Creates a group of voltage drop excitations.
Command: Maxwell>Excitations>Assign>Voltage Drop
Syntax:AssignVoltageDropGroup <BoundNameArray> <VoltageDropArray>
Return Value: None
AssignVoltageGroup
Use: Creates a group of voltage excitations. The size of the bound name array must be identical to the size of assignment. This com-
mand is not supported for the Electric solution types.
Command: Maxwell>Excitations>Assign>Voltage

Boundary and Excitation Module Script Commands in Maxwell 11-61


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Syntax:AssignVoltageGroup <BoundNameArray> <VoltageArray>


Return Value: None
Example: oModule.AssignVoltageGroup Array("VoltageSrc2_1", _ "VoltageSrc2_2"), Array
("NAME:VoltageSrc2_1", _ "Voltage:=", "0V", "Faces:=", Array(12, 11))
AssignVolumeChargeDensity
Use: Creates a volume charge density excitation.
Command: Maxwell>Excitations>Assign>Volume Charge Density
Syntax:AssignVolumeChargeDensity <VolumeChargeDensityArray>
Return Value: None
Parameters: <VolumeChargeDensityArray>
Array("NAME:<BoundName>",
"Value:=", <value>,
"CoordinateSystem :=", <string>,
"Objects:=", <AssignmentObjects>)
Example: oModule.AssignVolumeChargeDensity Array("NAME:VolumeChargeDenstiy1", "Value:=", "1", _
"CoordinateSystem:=", "", "Objects:=", Array("Box1"))
Example: oModule.AssignVolumeChargeDensity Array("NAME:x", _ "Value:=", "y", "Coordin-
ateSystem:=", "Global", _ "Objects:=", Array("Box2"))
AssignWindingGroup
Use: Creates a winding group.
Command: Maxwell>Excitations>Add Winding

Boundary and Excitation Module Script Commands in Maxwell 11-62


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Syntax:AssignWindingGroup <WindingGroupArray >


Return Value: None
Parameters:
<WindingGroupArray>
Array("NAME:<BoundName>",
"Type:=",<WindingType>,
"IsSolid:=", <bool>, //true for solid, false for stranded
"Current:=", <value>,
"Resistance:=", <value>,
"Inductance:=", <value>,
"Voltage:=", <value>,
)
Example:
oModule.AssignWindingGroup Array("NAME:Winding1", _ "Type:=", "Voltage", "IsSolid:=", _false, _
"Current:=", "4A", "Resistance:=", "5Ohm", _
"Inductance:=", "6mH", "Voltage:=", "7V")
Example: oModule.AssignWindingGroup Array("NAME:Winding2", _ "Type:=", "Current", "IsSolid:=",
false, "Current:=", _ "1A", "Resistance:=", "0Ohm", "Inductance:=", "0mH", _ "Voltage:=", "0V")
Example: oModule.AssignWindingGroup Array("NAME:Winding3", _ "Type:=", "External", "IsSolid:=",
true, "Current:=", _ "1A", "Resistance:=", "0Ohm", "Inductance:=", "0mH", _ "Voltage:=", "0V")
EditCharge
Use: Edits a charge excitation.
Command: Double-click the excitation in the project tree to edit it.
Syntax:EditCharge <BoundName> <ChargeArray>

Boundary and Excitation Module Script Commands in Maxwell 11-63


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value: None


EditCoilTerminal
Use: Edits a coil terminal excitation.
Command: Double-click the excitation in the project tree to edit it.
Syntax:EditCoilTerminal <BoundName> <CoilTerminalArray>
Return Value: None
EditCurrent
Modifies a current source.

UI Access placeholder

Name Type Description


<NAME> string The name of the excitation
<Current> string Current value with unit
<IsSolid> bool True if type is Solid; False if Stranded
Parameters <Cur- int 0 for Single Potential
rentExcitationModel>
1 for Double Potentials
2 for Double Potentials with Ground
<Point out of terminal> bool True sets the current direction out of the terminal

Return Value None

Python Syntax EditCurrent_1 (<NAME>, <Current>, <IsSolid>, <CurrentExcitationModel>, <Point out of terminal>)

Boundary and Excitation Module Script Commands in Maxwell 11-64


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oModule.EditCurrent("Current7",
[
"NAME:Current7",
"Current:=" , "0mA",
Python Example
"IsSolid:=" , True,
"CurrentExcitationModel:=", 1,
"Point out of terminal:=", False
])

oModule.EditCurrent "Current7", Array("NAME:Current7",


VB Example "Current:=", "0mA", "IsSolid:=", true, "CurrentExcitationModel:=", 1,
"Point out of terminal:=", false)

EditCurrentDensity
Use: Edits a current density excitation.
Command: Double-click the excitation in the project tree to edit it.
Syntax:EditCurrentDensity <BoundName> <CurrentDensityArray>
Return Value: None
EditCurrentDensityTerminal
Use: Edits a current density terminal excitation.
Note:Double-click the excitation in the project tree to edit it.
Syntax:EditCurrentDensityTerminal <BoundName> <CurrentDensityTerminalArray>
Return Value: None

Boundary and Excitation Module Script Commands in Maxwell 11-65


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

EditExternalCircuit
Use: Edits the external circuit for the winding. The SourceNameArray and SourceTypeArray parameters must be of the same size and
be a one-to-one match.
Command: Maxwell>Excitations>External Circuit>Edit External Circuit
Syntax:EditExternalCircuit <fileName> <SourceNameArray> <SourceTypeArray>
Return Value: None
Parameters: <SourceNameArray> Array(<string>)
<SourceTypeArray> Array(<srcTypeEnum>)<srcTypeEnum>
1- Time dependent 2-Position dependent 3- Speed dependent
Example: oModule.EditExternalCircuit "C:\TestProjects\Tdslink\extnlckt00.ckt", Array("VC1", _
"VSA1_0", "VSA1_1", "VSA1_2"), Array(1, 2, 1, 3)
EditFloating
Use: Edits a floating excitation.
Command: Double-click the excitation in the project tree to edit it.
Syntax:EditFloating <BoundName> <FloatingArray>
Return Value: None
EditSink
Use: Edits a sink excitation.
Command: Double-click the excitation in the project tree to edit it.
Syntax:EditSink <BoundName> <SinkArray>
Return Value: None

Boundary and Excitation Module Script Commands in Maxwell 11-66


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

EditVoltage
Modifies a voltage source.

UI Access Double-click the excitation in the project tree to modify its settings.

Name Type Description


<BoundaryName> String Name of the voltage source to be edited.
<VoltageArray> Array Structured array.
Array("NAME:<BoundName>",
"Voltage:=", <value>,
Parameters
<DirectionArray>)
<DirectionArray> Array Structured array.
Array("NAME:Direction",
"Start:=",<LineEndPoint>,
"End:=", <LineEndPoint>)

Return Value None.

Python Syntax EditVoltage(<BoundaryName>, <VoltageArray>)


oModule.EditVoltage("Voltage1",
["NAME:Voltage1After",
Python Example "Voltage:=", "1000mV",
["NAME:Direction",
"Start:=", [-0.4, -1.2, 0],

Boundary and Excitation Module Script Commands in Maxwell 11-67


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"End:=", [-1.4, -1.2, 0]


]
)

VB Syntax EditVoltage <BoundaryName>, <VoltageArray>


oModule.EditVoltage "Voltage1", _
Array("NAME:Voltage1After",_
"Voltage:=", "1000mV",_
VB Example
Array("NAME:Direction",_
"Start:=", Array(-0.4, -1.2, 0),_
"End:=", Array(-1.4, -1.2, 0)))

EditVoltageAPhi
Edits a voltage excitation for 3D transient A-Phi solutions.

UI Access Double-click the Voltage Excitations item in the Project tree to edit.

Name Type Description


<NAME> string The name of the voltage excitation
<VoltageAPhi> string Voltage value with unit
Parameters <VoltageAPhiInitialCurrent> string Initial current value with unit
<VoltageAPhiHasIni- bool True if Initial Current is used.
tialCurrent>
<VoltageAPhiEx- int 0 for Single Potential

Boundary and Excitation Module Script Commands in Maxwell 11-68


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

citationModel> 1 for Double Potentials


2 for Double Potentials with Ground
<VoltageAPhi_Point_out_of_ bool True sets the voltage direction out of the terminal
terminal>

Return Value None

EditVoltageAPhi (<NAME>, <VoltageAPhi>, <VoltageAPhiInitialCurrent>, <VoltageAPhiHasInitialCurrent>,


Python Syntax
<VoltageAPhiExcitationModel>, <VoltageAPhi_Point_out_of_terminal>)
oModule.EditVoltageAPhi("Voltage1",
[
"NAME:Voltage1",
"VoltageAPhi:=" , "0mV",
Python Example "VoltageAPhiInitialCurrent:=", "0mA",
"VoltageAPhiHasInitialCurrent:=", True,
"VoltageAPhiExcitationModel:=", 1,
"VoltageAPhi_Point_out_of_terminal:=", True
])

oModule.EditVoltageAPhi "Voltage1", Array("NAME:Voltage1", "VoltageAPhi:=", "0mV",


VB Example "VoltageAPhiInitialCurrent:=", "0mA", "VoltageAPhiHasInitialCurrent:=", false,
"VoltageAPhiExcitationModel:=", 0, "VoltageAPhi_Point_out_of_terminal:=", false)

EditVoltageDrop
Use: Edits a voltage drop excitation.
Command: Double-click the excitation in the project tree to edit it.
Syntax:EditVoltageDrop <BoundName> <VoltageDropArray>

Boundary and Excitation Module Script Commands in Maxwell 11-69


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value: None


EditVolumeChargeDensity
Use: Edits a volume charge density excitation.
Command: Double-click the excitation in the project tree to edit it.
Syntax:EditVolumeChargeDensity <BoundName> <VolumeChargeDensityArray>
Return Value: None
EditWindingGroup
Use: Edits a winding group.
Command: Double-click the winding group item in the project tree to edit it.
Syntax:EditWindingGroup <BoundName> <WindingGroupArray>
Return Value: None
SetCoreLoss
Use: Turns on the core loss effect. Please list all the objects that need to turn on the core loss effect. If an object is not in the list, then it
is treated as core loss effect "off". This setting only takes effect if the object has the corresponding core loss definition in the material
library.
Command: Maxwell>Excitation>Set Core Loss
Syntax:SetCoreLoss <ObjectNameArray>
Return Value: None
Parameters: < ObjectNameArray >
Array("<objectName>"), <bool>, //true to apply core loss effect on field, false means do not
apply core loss effect. Default is false.

Boundary and Excitation Module Script Commands in Maxwell 11-70


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<objectName> string
Example: oModule.SetCoreLoss Array("Box1", "Box2"), true
SetEddyEffect
Use: Sets the eddy effect for an excitation.
Command: Maxwell>Excitations>Set Eddy Effects
Syntax:SetEddyEffect <EddyEffectSettingArray>
Return Value: None
Parameters:
<EddyEffectSettingArray>
Array("NAME:Eddy Effect Setting", <EddyEffectVectorArray>)
<EddyEffectVectorArray>
Array("NAME:EddyEffectVector", Array<EddyEffectDataArray>)
<EddyEffectDataArray>
Array(("NAME:Data",
"Object Name:=", <string>,
"Eddy Effect:=", <bool>,
"DisplacementCurrent:=", <bool>)
Example:
oModule.SetEddyEffect Array("NAME:Eddy Effect Setting", _
Array("NAME:EddyEffectVector", Array("NAME:Data", _
"Object Name:=", "Box1", "Eddy Effect:=", true, _
"Displacement Current:=", true), Array("NAME:Data", _
"Object Name:=", "Box1_1", "Eddy Effect:=", true, _
"Displacement Current:=", false)))

Boundary and Excitation Module Script Commands in Maxwell 11-71


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Example: oModule.SetEddyEffect Array("NAME:Eddy Effect Setting", _


Array("NAME:EddyEffectVector", Array("NAME:Data", _
"Object Name:=", "Box1", "Eddy Effect:=", true), _
Array("NAME:Data", "Object Name:=", "Box1_1", _
"Eddy Effect:=", false)))
SetMagnetizationCompute
Use: Specifies Magnetization Computation Points settings.
Command: Maxwell > Excitations > Set Magnetization Computation
Syntax:SetMagnetizationCompute <MagnetizationComputationArray>
Return Value: None
Parameters: <MagnetizationComputationArray>
Array("NAME:<Magnetization>",
"IsTarget:=", <bool>,
"ForDemagComputation:=", <bool>,
"Project:=", <string>,
"Design:=", <string>,
"Soln:=", <string>,
Array("NAME:Params", )
"ForceSourceToSolve:=", <bool>,
"PreservePartnerSoln:=", <bool>,
"PathRelativeTo:=", <string>,)

Boundary and Excitation Module Script Commands in Maxwell 11-72


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Example: Set oModule = oDesign.GetModule("BoundarySetup")


oModule.SetMagnetizationCompute Array("NAME:Magnetization", "IsTarget:=", true, "ForDemagCom-
putation:=", true, "Project:=", "test_magnetization_link.aedt", "Design:=", "mag_hystereis_only_
source", "Soln:=", "Setup1 : Transient", Array("NAME:Params", "$Temp:=", "20cel", "Cur:=",
"0A"), "ForceSourceToSolve:=", false, "PreservePartnerSoln:=", false, "PathRelativeTo:=", "Tar-
getProject")
Other BoundarySetup Module Script Commands
Following are additional script commands that are recognized by the BoundarySetupmodule:

Note:

In the following commands, all named data can be included/excluded as desired and may appear in any order.

l AssignWindingGroup
l EditWindingGroup
l AddTerminalsToWinding
l EditExternalCircuit
l SetCoreLoss
l SetEddyEffect
l SetMinimumTimeStep

SetMinimumTimeStep
Use: Sets the minimum time step for an external circuit excitation.
Command: Maxwell>Excitations>External Circuit>Set Minimum Time Step
Syntax:SetMinimumTimeStep <value>
Return Value: None

Boundary and Excitation Module Script Commands in Maxwell 11-73


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Parameters: None
Example: oModule.SetMinimumTimeStep "1ps"
ShowWindow
Use: Sets up a Y connection among voltage windings. It will connect their negative voltage terminals to a common node of the circuit.
Only one Y Connection is allowed per design.
Syntax:SetupYConnection <YConnectionArray>
Return Value: None
Parameters: <YConnectionArray>
Type: Array of strings
When the YConnectionArray is empty, it is used to delete the Y Connection.
Array(<YConnection>)
<YConnection>
Type: Array of strings
Array("Name:YConnection", "Windings:=", <WindingNames>)
<WindingNames>
Type: String
A list of winding names separated by commas
VB Example:
Add Y Connection:

Boundary and Excitation Module Script Commands in Maxwell 11-74


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oModule.SetupYConnection Array(Array("NAME:YConnection", "Windings:=", "Wind-


ing1,Winding2,Winding3,Winding4"))
Delete Y Connection:
oModule.SetupYConnection

Python Syntax SetupYConnection(<YConnectionArray>)

Add Y Connection
oModule.SetupYConnection(
[
[
"NAME:YConnection",
"Windings:=" , "Winding1,Winding2,Winding3,Winding4"
Python Example
]
])

Delete Y Connection
oModule.SetupYConnection()

Boundary and Excitation Module Script Commands in Maxwell 11-75


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

11-76
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

12 - Mesh Operations Module Script Commands


Commands for mesh setup and operations should be executed by the "MeshSetup" module.
Set oModule = oDesign.GetModule("MeshSetup")
oModule.CommandName <args>
Conventions Used in this Chapter
<OpName>
Type: <string>
Name of a mesh operation.
<AssignmentObjects>
Type: Array of strings
An array of object names.
<AssignmentFaces>
Type: Array of integers.
An array of face IDs. The ID of a face can be determined through the user interface using the 3DModeler>Measure>Area
command. The face ID is given in the Measure Information dialog box.

The topics for this section include:


General Commands Recognized by the Mesh Operations Module
Script Commands for Creating and Modifying Mesh Operations

Mesh Operations Module Script Commands 12-1


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

General Commands Recognized by the Mesh Operations Module


General commands recognized by the Mesh Operations Module:
DeleteOp
GetMeshOpAssignment
GetOperationName
RenameOp
DeleteOp
Deletes the specified mesh operations.

UI Access Delete command in the List dialog box.

Name Type Description


Parameters
<NameArray> Array Array of mesh operation names.

Return Value None.

Python Syntax DeleteOp(<NameArray>)


Python Example oModule.DeleteOp(["Length1", "SkinDepth1","Length2"])

VB Syntax DeleteOp <NameArray>


VB Example oModule.DeleteOp Array("Length1", "SkinDepth1",_

Mesh Operations Module Script Commands 12-2


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Length2")

GetOperationNames
Gets the names of mesh operations defined in a design.

UI Access N/A

Name Type Description


Parameters
<OperationType> String Specified operation type.

Return Value Array of strings containing mesh operation names.

Python Syntax GetOperationNames(<OperationType>)


Python Example oModule.GetOperationNames("Length Based")

VB Syntax GetOperationNames <OperationType>


VB Example oModule.GetOperationNames "Length Based"

RenameOp
Renames a mesh operation.

UI Access Right-click the mesh operation in the project tree, and then click Rename on the shortcut menu.

Name Type Description


Parameters <OldName> String Old name for the mesh operation.
<NewName> String New name for the mesh operation.

Mesh Operations Module Script Commands 12-3


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value None.

Python Syntax RenameOp(<OldName>, <NewName>)


Python Example oModule.RenameOp("SkinDepth1", "NewName")

VB Syntax RenameOp <OldName>, <NewName>


VB Example oModule.RenameOp "SkinDepth1", "NewName"

Script Commands for Creating and Modifying Mesh Operations


Script commands for creating and modifying mesh operations are as follows:
"AssignCylindricalGapOp " on the facing page
"AssignCylindricalGapOp " on the facing page
AssignLengthOp
AssignModelResolutionOp
"AssignSkinDepthLayerSetting " on page 12-17
AssignSkinDepthOp
AssignTrueSurfOp
"EditCylindricalGapOp " on page 12-22
"EditDensityControlOp" on page 12-24

Mesh Operations Module Script Commands 12-4


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

EditEdgeCutLayerOp
EditLengthOp
EditModelResolutionOp
EditSkinDepthOp
EditTrueSurfOp
"InitialMeshSettings " on page 12-35
AssignCylindricalGapOp
3D Designs
For 3D designs, assigns a cylindrical gap 3D mesh operation to enable use of Clone Mesh and associated Band Mapping Angle. For
Maxwell 2D designs, see below.
=======
Assigns a cylindrical gap 3D mesh operation to enable use of Clone Mesh and associated Band Mapping Angle.

UI Access Maxwell3D > Mesh > Assign Mesh Operation > Cylindrical Gap Treatment

Name Type Description


<CylindricalGapOpParams> Array Structured array.
Array("NAME:<OpName>",
"CloneMesh:=", <bool>,
Parameters "BandMappingAngle:=", <value> [use if CloneMesh is
"true"]
"MovingSideLayers:=", <integer>,
"StaticSideLayers:=", <integer>,
"Objects:=", <AssignmentObjects>)

Mesh Operations Module Script Commands 12-5


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value None.

Python Syntax AssignCylindricalGapOp(<CylindricalGapOpParams>)


oModule.AssignCylindricalGapOp
([
"NAME:CylindricalGap1",
"CloneMesh:=", True,
Python Example "BandMappingAngle:=", 3deg,
"MovingSideLayers:=", 1,
"StaticSideLayers:=", 3,
"Objects:=", ["Box2"]
])

VB Syntax AssignCylindricalGapOp <CylindricalGapOpParams>


oModule.AssignCylindricalGapOp _
Array("NAME:CylindricalGap1", _
VB Example "CloneMesh:=", true, _
"BandMappingAngle:=", 3deg, _
"MovingSideLayers:=", 1, _

Mesh Operations Module Script Commands 12-6


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"StaticSideLayers:=", 3, _
"Objects:=", Array("Box2"))
oModule.AssignCylindricalGapOp _
Array("NAME:CylindricalGap1", _
"CloneMesh:=", false, _
"Objects:=", Array("Box2"))

Maxwell 2D Designs
For Maxwell 2D Designs, assigns a cylindrical gap 2D mesh operation.

UI Access Maxwell 2D > Mesh > Assign Mesh Operation > Cylindrical Gap Treatment

Name Type Description


<CylindricalGapOpParams> Array Structured array.
Array("NAME:<OpName>",
Parameters "UseBandMappingAngle:=" , <bool>,
"BandMappingAngle:=", <value> [use if UseBandMap-
pingAngle is "true". Range is 0.0005deg through 3deg inclusive]
"Objects:=", <AssignmentObjects>)

Return Value None.

Python Syntax AssignCylindricalGapOp(<CylindricalGapOpParams>)


Python Example oModule.AssignCylindricalGapOp

Mesh Operations Module Script Commands 12-7


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

([
"NAME:CylindricalGap1",
"UseBandMappingAngle:=" , True,
"BandMappingAngle:=" , "3deg",
"Objects:=", ["Circle2"]
])

VB Syntax AssignCylindricalGapOp <CylindricalGapOpParams>


oModule.AssignCylindricalGapOp
Array("NAME:CylindricalGap1",
VB Example "UseBandMappingAngle:=" , True,
"BandMappingAngle:=" , "3deg",
"Objects:=", Array("Circle2"))

AssignDensityControlOp
Assigns a density control mesh operation to specify refinement of clone mesh.

UI Access Maxwell3D > Mesh > Assign Mesh Operation > Inside Selection > Clone Mesh Density

Name Type Description


Parameters <DensityControlParams> Array Structured array.
Array("NAME:<OpName>",

Mesh Operations Module Script Commands 12-8


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"RefineInside:=", <bool>,
"Objects:=", <AssignmentObjects>,
"RestrictMaxElemLength:=", <bool>,
"MaxElemLength:=", <value>,
"RestrictLayersNum:=", <bool>,
"LayersNum:=", <integer>)
RefineInside
If true, Objects should be specified. Implies
apply restrictions to tetrahedra inside the
object.
If false, Faces and/or Objects can be spe-
cified. Implies apply restrictions to triangles
on the surface of the face or object.
RestrictMaxElemLength
If true, MaxElemLength should be specified.
RestrictLayersNum
If true, LayersNum should be specified.

Return Value None.

Python Syntax AssignDensityControlOp(<DensityControlParams>)


oModule.AssignDensityControlOp(
Python Example
[

Mesh Operations Module Script Commands 12-9


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NAME:Clone Mesh Density3",


"RefineInside:=" , True,
"Objects:=" , ["Inner_arm"],
"RestrictMaxElemLength:=", True,
"MaxElemLength:=" , "0.015mm",
"RestrictLayersNum:=" , True,
"LayersNum:=" , "15"
])

VB Syntax AssignDensityControlOp <DensityControlParams>


oModule.AssignDensityControlOp _
Array("NAME:Clone Mesh Density3", _
"RefineInside:=", true, _
"Objects:=", Array("Inner_arm"), _
VB Example
"RestrictMaxElemLength:=", true, _
"MaxElemLength:=", "0.015mm", _
"RestrictLayersNum:=", true, _
"LayersNum:=", "15")

Mesh Operations Module Script Commands 12-10


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AssignEdgeCutLayerOp
Assigns the edge cut mesh operation to specify refinement of layer mesh.

UI Access Maxwell 3D > Mesh > Assign Mesh Operation > Inside Selection > Edge Cut Based

Name Type Description


<EdgeCutLayerOpParams> Array Structured array.

Parameters Array("NAME:<OpName>",
"Objects:=", <AssignmentObjects>,
"Layer Thickness:=", <value>)

Return Value None.

Python Syntax AssignEdgeCutLayerOp(<EdgeCutLayerOpParams>)


oModule.AssignEdgeCutLayerOp(
[
"NAME:EdgeCut1",
Python Example
"Objects:=" , ["Rotor"],
"Layer Thickness:=" , "0.55mm"
])

VB Syntax AssignEdgeCutLayerOp <EdgeCutLayerOpParams>


VB Example oModule.AssignEdgeCutLayerOp _

Mesh Operations Module Script Commands 12-11


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:EdgeCut1", _
"Objects:=", Array("Rotor"), _
"Layer Thickness:=", "0.55mm")

AssignLengthOp
Assigns length-based operations to the selection.

UI Access Maxwell 3D > Mesh > Assign Mesh Operation > On Selection | Inside Selection > Length Based

Name Type Description


<LengthOpParams> Array Structured array.
Array("NAME:<OpName>",
"RefineInside:=", <bool>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>,
"Edges:=", <AssignmentEdges>,
Parameters
"RestrictElem:=", <bool>
"NumMaxElem:=", <integer>
"RestrictLength:=", <bool>
"MaxLength:=", <value>
"ApplyToInitialMesh:=", <bool>)
RefineInside
If true, Objects should be specified. Implies apply restrictions to tet-

Mesh Operations Module Script Commands 12-12


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

rahedra inside the object.


If false, Edges, Faces and/or Objects can be specified. Implies
apply restrictions to triangles on the surface of the face or object.
RestrictElem
If true, NumMaxElem should be specified.
RestrictLength
If true, MaxLength should be specified.

Return Value None.

Python Syntax AssignLengthOp(<LengthOpParams>)


oModule.AssignLengthOp
([
"NAME:Length1",
"RefineInside:=", True,
"Objects:=", ["Box1"],
Python Example "RestrictElem:=", True,
"NumMaxElem:=", 1000,
"RestrictLength:=", True,
"MaxLength:=", "1mm"
"ApplyToInitialMesh:=", True
])

Mesh Operations Module Script Commands 12-13


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oModule.AssignLengthOp
([
"NAME:Length1",
"RefineInside:=", False,
"Edges:=", [58,73],
"RestrictElem:=", True,
"NumMaxElem:=", 1000,
"RestrictLength:=", True,
"MaxLength:=", "1mm"
"ApplyToInitialMesh:=", True
])

VB Syntax AssignLengthOp <LengthOpParams>


oModule.AssignLengthOp Array("NAME:Length1", _
"RefineInside:=", true,
VB Example "Objects:=", Array("Box1"),
"RestrictElem:=", true,
"NumMaxElem:=", 1000,

Mesh Operations Module Script Commands 12-14


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"RestrictLength:=", true,
"MaxLength:=", "1mm")
"ApplyToInitialMesh:=", True

oModule.AssignLengthOp Array("NAME:Length1", _
"RefineInside:=", false,
"Edges:=", Array(58,73),
"RestrictElem:=", true,
"NumMaxElem:=", 1000,
"RestrictLength:=", true,
"MaxLength:=", "1mm")
"ApplyToInitialMesh:=", True

AssignModelResolutionOp
Assigns a model resolution name, value and unit for mesh operations, or specify to UseAutoFeaturelength. If UseAutoFeature length
is true, the Defeature length is not used.

UI Access Maxwell 3D > Mesh > Assign Mesh Operation > Model Resolution

Name Type Description


<ModelResParams> Array Structured array.

Parameters Array("NAME:<ModelResName>",
"Objects:=", <array of object names>,
"UseAutoLength:=", <boolean>,

Mesh Operations Module Script Commands 12-15


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"DefeatureLength:=", "<value><units>")

Return Value None.

Python Syntax AssignModelResolutionOp(<ModelResParams>)


oModule.AssignModelResolutionOp
([
"NAME:ModelResolution1",
Python Example "Objects:=", ["waveguide"],
"UseAutoLength:=", True,
"DefeatureLength:=", "71.5891053163818mil"
])

VB Syntax AssignModelResolutionOp <ModelResParams>


oModule.AssignModelResolutionOp _
Array("NAME:ModelResolution1", _
VB Example "Objects:=", Array( "waveguide"), _
"UseAutoLength:=", true, _
"DefeatureLength:=", "71.5891053163818mil")

Mesh Operations Module Script Commands 12-16


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AssignSkinDepthLayerSetting
Use: Assigns a skin-depth layer settings to the selected edges.
Command: Click Mesh > Assign Mesh Operation > On Selection > Skin Depth Based
Syntax: AssignSkinDepthLayerSetting Array("NAME:<LayerSettingName>", "Enabled:=", <SettingEnabled>, "Edges:=", Array
(<EdgeIDArray>), "SkinDepth:=", "<SkinDepthValue>", "NumLayers:=", "<LayerNumber>")
Return Value: None
Parameters: <LayerSettingName>
The name of the skin depth layer setting.
<SettingEnabled>
Boolean: "Enabled:=", true
<EdgeIDArray>
Array of edge IDs. "Edges:=", Array(10, 12, 13)
<SkinDepthValue>
Skin depth value with unit. "SkinDepth:=", "1mm"
<LayerNumber>
Integer, the number of layers. "NumLayers:=", "2"
Example: oModule.AssignSkinDepthLayerSetting Array("NAME:SkinDepthLayer1",
"Enabled:=", true
"Edges:=", Array(10, 12, 13),
"SkinDepth:=", "1mm",
"NumLayers:=", 2)

Mesh Operations Module Script Commands 12-17


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AssignSkinDepthOp
Assigns a skin-depth based operations to the selection.

UI Access Maxwell 3D > Mesh > Assign Mesh Operation > On Selection > Skin Depth Based

Name Type Description


<SkinDepthOpParams> Array Structured array.
Array("NAME:<OpName>",
"Faces:=", <AssignmentFaces>,
"RestrictElem:=", <bool>,

Parameters "NumMaxElem:=", <int>,


"SkinDepth:=", <value>,
"SurfTriMaxLength:=", <value>,
"NumLayers:=", <int>)
RestrictElem
If true, NumMaxElem should be specified.

Return Value None.

Python Syntax AssignSkinDepthOp(<SkinDepthOpParams>)


oModule.AssignSkinDepthOp
Python Example
([

Mesh Operations Module Script Commands 12-18


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NAME:SkinDepth1",
"Faces:=", [7],
"RestrictElem:=", True,
"NumMaxElem:=", 1000,
"SkinDepth:=", "1mm",
"SurfTriMaxLength:=", "1mm",
"NumLayers:=", 2
])

VB Syntax AssignSkinDepthOp <SkinDepthOpParams>


oModule.AssignSkinDepthOp Array("NAME:SkinDepth1", _
"Faces:=", Array(7), _
"RestrictElem:=", true, _
VB Example "NumMaxElem:=", 1000, _
"SkinDepth:=", "1mm", _
"SurfTriMaxLength:=", "1mm", _
"NumLayers:=", 2)

AssignTrueSurfOp
Assigns a true surface-based mesh operation on the selection.

UI Access Maxwell 3D > Mesh > Assign Mesh Operation > Surface Approximation

Mesh Operations Module Script Commands 12-19


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


<TrueSurfOpParams> Array Structured array.
Array("NAME:<OpName>",
"Faces:=", <AssignmentFaces>,
"SurfDevChoice:=", <RadioOption>,
"SurfDev:=", <value>,
"NormalDevChoice:=", <RadioOption>,
"NormalDev:=", <value>,
Parameters
"AspectRatioChoice:=", <RadioOption>,
"AspectRatio:=", <double>)

<RadioOption>
Type: <int>
0: Ignore
1: Use defaults
2: Specify the value

Return Value None.

Python Syntax AssignTrueSurfOp(<TrueSurfOpParams>)

Mesh Operations Module Script Commands 12-20


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oModule.AssignTrueSurfOp
([
"NAME:TrueSurf1",
"Faces:=", [9],
"SurfDevChoice:=", 2,
Python Example
"SurfDev:=", "0.04123105626mm",
"NormalDevChoice:=", 2,
"NormalDev:=", "15deg",
"AspectRatioChoice:=", 1
])

VB Syntax AssignTrueSurfOp <TrueSurfOpParams>


oModule.AssignTrueSurfOp Array("NAME:TrueSurf1",
"Faces:=", Array(9), _
"SurfDevChoice:=", 2, _
VB Example "SurfDev:=", "0.04123105626mm", _
"NormalDevChoice:=", 2, _
"NormalDev:=", "15deg", _
"AspectRatioChoice:=", 1)

Mesh Operations Module Script Commands 12-21


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

EditCylindricalGapOp
Modifies an existing cylindrical gap 3D mesh operation to enable/disable use of Clone Mesh and associated Band Mapping Angle.
Modifies an existing cylindrical gap 2D mesh operation to enable/disable use of Band Mapping Angle.

UI Access Double-click the operation in the project tree to modify its settings.

Name Type Description


<OpName> String Name of the operation to be edited.
<CylindricalGapOpParams> Array Structured array for 3D mesh.
Array("NAME:<OpName>",
"CloneMesh:=", <bool>,
"BandMappingAngle:=", <value> [use if CloneMesh is
"true"]
Parameters "MovingSideLayers:=", <integer>,
"StaticSideLayers:=", <integer>)
Structured array for 2D mesh.
Array("NAME:<OpName>",
"UseBandMappingAngle:=", <bool>,
"BandMappingAngle:=", <real>) [range is
0.0005deg through 3deg inclusive]

Return Value None

Mesh Operations Module Script Commands 12-22


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax EditCylindricalGapOp(<OpName>, <CylindricalGapOpParams>)


oModule.EditCylindricalGapOp("CylindricalGap1",
["NAME:CylindricalGap1",
"CloneMesh:=", True,
"BandMappingAngle:=", 3deg,
"MovingSideLayers:=", 1,
"StaticSideLayers:=", 3]
Python Example )
Maxwell 2D Example
oModule.EditCylindricalGapOp("CylindricalGap1",
["NAME:CylindricalGap1",
"UseBandMappingAngle:=", True,
"BandMappingAngle:=", 3deg,
)

VB Syntax EditCylindricalGapOp <OpName>, <CylindricalGapOpParams>


oModule.EditCylindricalGapOp "CylindricalGap1",
Array("NAME:CylindricalGap1",
VB Example "CloneMesh:=", true,
"BandMappingAngle:=", 3deg,
"MovingSideLayers:=", 1,

Mesh Operations Module Script Commands 12-23


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"StaticSideLayers:=", 3)
Maxwell 2D Example
oModule.EditCylindricalGapOp "CylindricalGap1", _
Array("NAME:CylindricalGap1",
"UseBandMappingAngle:=", true,
"BandMappingAngle:=", 3deg)

EditDensityControlOp
Edits an existing density control operation. This cannot be used to modify assignments. Instead, the mesh operation should be deleted
and a new one created.

UI Access Double-click the operation in the project tree to modify its settings.

Name Type Description


<OpName> String Name of the operation to be edited.
<DensityControlParams> Array Structured array.
Array("NAME:<OpName>",
"RefineInside:=", <bool>,
Parameters "RestrictMaxElemLength:=", <bool>,
"MaxElemLength:=", <value>,
"RestrictLayersNum:=", <bool>,
"LayersNum:=", <integer>)
RefineInside

Mesh Operations Module Script Commands 12-24


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

If true, Objects should be specified. Implies


apply restrictions to tetrahedra inside the
object.
If false, Faces and/or Objects can be specified.
Implies apply restrictions to triangles on the
surface of the face or object.
RestrictMaxElemLength
If true, MaxElemLength should be specified.
RestrictLayersNum
If true, LayersNum should be specified.

Return Value None.

Python Syntax EditDensityControlOp(<OpName>, <DensityControlOpParams>)


oModule.EditDensityControlOp("Clone Mesh Density1",
[
"NAME:Clone Mesh Density1",
"RefineInside:=" , True,
Python Example "RestrictMaxElemLength:=", True,
"MaxElemLength:=" , "0.02mm",
"RestrictLayersNum:=" , True,
"LayersNum:=" , "15"
])

Mesh Operations Module Script Commands 12-25


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax EditDensityControlOp <OpName>, <DensityControlOpParams>


oModule.EditDensityControlOp "Clone Mesh Density1", _
Array("NAME:Clone Mesh Density1", _
"RefineInside:=", true, _
VB Example "RestrictMaxElemLength:=", true, _
"MaxElemLength:=", "0.015mm", _
"RestrictLayersNum:=", true, _
"LayersNum:=", "15")

EditEdgeCutLayerOp
Edits an existing edge cut operation. This cannot be used to modify assignments. Instead, the mesh operation should be deleted and
a new one created.

UI Access Double-click the operation in the project tree to modify its settings.

Name Type Description


<OpName> String Name of the operation to be edited.
<EdgeCutLayerOpParams> Array Structured array.
Parameters
Array("NAME:<OpName>",
"Layer Thickness:=", <value>)

Return Value None.

Mesh Operations Module Script Commands 12-26


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax EditEdgeCutLayerOp(<OpName>, <EdgeCutLayerOpParams>)


oModule.EditEdgeCutLayerOp("EdgeCut1",
[
Python Example "NAME:EdgeCut1",
"Layer Thickness:=" , "0.66mm"
])

VB Syntax EditEdgeCutLayerOp <OpName>, <EdgeCutLayerOpParams>


oModule.EditEdgeCutLayerOp "EdgeCut1", _
VB Example Array("NAME:EdgeCut1", _
"Layer Thickness:=", "0.66mm")

EditLengthOp
Edits an existing length-based operation. This cannot be used to modify assignments. Instead, the mesh operation should be deleted
and a new one created.

UI Access Double-click the operation in the project tree to modify its settings.

Name Type Description


<OpName> String Name of the operation to be edited.
<LengthOpParams> Array Structured array.
Parameters Array("NAME:<OpName>",
"RefineInside:=", <bool>,
"Objects:=", <AssignmentObjects>,

Mesh Operations Module Script Commands 12-27


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Faces:=", <AssignmentFaces>,
"Edges:=", <AssignmentEdges>,
"RestrictElem:=", <bool>,
"NumMaxElem:=", <integer>,
"RestrictLength:=", <bool>,
"MaxLength:=", <value>
"ApplyToInitialMesh:=", <bool>)
RefineInside
If true, Objects should be specified. Implies apply restrictions to tet-
rahedra inside the object.
If false, Edges, Faces and/or Objects can be specified. Implies
apply restrictions to triangles on the surface of the face or object.
RestrictElem
If true, NumMaxElem should be specified.
RestrictLength
If true, MaxLength should be specified.

Return Value None.

Python Syntax EditLengthOp(<OpName>, <LengthOpParams>)


Python Example oModule.EditLengthOpK("Length1",

Mesh Operations Module Script Commands 12-28


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

[
"NAME:Length1",
"RefineInside:=", True,
"Objects:=", ["Circle2", "Rectangle1"],
"RestrictElem:=", False,
"NumMaxElem:=", 1000,
"RestrictLength:=", True,
"MaxLength:=", "2mm",
"ApplyToInitialMesh:=", False
])

VB Syntax EditLengthOp <OpName>, <LengthOpParams>


oModule.EditLengthOpK "Length1", Array("NAME:Length1", _
"RefineInside:=", false,
"Objects:=", Array("Box1"),
"RestrictElem:=", false,
VB Example
"NumMaxElem:=", 1000,
"RestrictLength:=", true,
"MaxLength:=", "2mm"
"ApplyToInitialMesh:=", False)

Mesh Operations Module Script Commands 12-29


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

EditModelResolutionOp
Assigns a model resolution name, value and unit for mesh operations. If UseAutoLength is true, the Defeature length is not used.

UI Access Double-click the operation in the project tree to modify its settings.

Name Type Description


<OpName> String Name of the operation to be edited.
<ModelResParams> Array Structured array.
Parameters Array("NAME:<ModelResName>",
"UseAutoLength:=", <boolean>,
"DefeatureLength:=", "<value><units>")

Return Value None.

Python Syntax EditModelResolutionOp(<OpName>, <ModelResParams>


oModule.EditModelResolutionOp("ModelResolution1",
[
"NAME:ModelResolution1",
Python Example
"UseAutoLength:=", False,
"DefeatureLength:=", "71.5891053163818mil"
])

Mesh Operations Module Script Commands 12-30


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax EditModelResolutionOp <OpName>, <ModelResParams>


oModule.EditModelResolutionOp "ModelResolution1", _
VB Example Array("NAME:ModelResolution1", "UseAutoLength:=", false, _
"DefeatureLength:=", "71.5891053163818mil")

EditSkinDepthOp
Modifies an existing skin-depth based mesh operation. Assignments cannot be changed using this command. To change the assign-
ment, you must delete operation and create it using a new assignment.

UI Access Double-click the operation in the project tree to modify its settings.

Name Type Description


<OpName> String Name of the operation to be edited.
<SkinDepthOpParams> Array Structured array.
Array("NAME:<OpName>",
"RestrictElem:=", <bool>,
"NumMaxElem:=", <int>,
Parameters
"SkinDepth:=", <value>,
"SurfTriMaxLength:=", <value>,
"NumLayers:=", <int>)
RestrictElem
If true, NumMaxElem should be specified.

Return Value None.

Mesh Operations Module Script Commands 12-31


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax EditSkinDepthOp(<OpName>, <SkinDepthOpParams>)


oModule.EditSkinDepthOp("SkinDepth1",
[
"NAME:SkinD",
"RestrictElem:=", False,
Python Example
"SkinDepth:=", "2mm",
"SurfTriMaxLength:=", "1mm",
"NumLayers:=", 2
])

VB Syntax EditSkinDepthOp <OpName>, <SkinDepthOpParams>


oModule.EditSkinDepthOp "SkinDepth1",
Array("NAME:SkinD",_
"RestrictElem:=", false, _
VB Example
"SkinDepth:=", "2mm", _
"SurfTriMaxLength:=", "1mm", _
"NumLayers:=", 2)

Mesh Operations Module Script Commands 12-32


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

EditTrueSurfOp
Modifies an existing true surface approximation-based mesh operation. Assignments cannot be changed using this command. To
change the assignment, delete this operation and create it using a new assignment.

UI Access Double-click the operation in the project tree to modify its settings.

Name Type Description


<OpName> String Name of the operation to be edited.
<TrueSurfOpParams> Array Structured array.
Array("NAME:<OpName>",
"SurfDevChoice:=", <RadioOption>,
"SurfDev:=", <value>,
"NormalDevChoice:=", <RadioOption>,
"NormalDev:=", <value>,
Parameters "AspectRatioChoice:=", <RadioOption>,
"AspectRatio:=", <double>)

<RadioOption>
Type: <int>
0: Ignore
1: Use defaults
2: Specify the value

Return Value None.

Mesh Operations Module Script Commands 12-33


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax EditTrueSurfOp(<OpName>, <TrueSurfOpParams>)


oModule.EditTrueSurfOp("TrueSurf2",
[
"NAME:trusurf",
"SurfDevChoice:=", 2,
Python Example "SurfDev:=","0.03mm",
"NormalDevChoice:=", 1,
"AspectRatioChoice:=", 2,
"AspectRatio:=", 10
])

VB Syntax EditTrueSurfOp <OpName>, <TrueSurfOpParams>


oModule.EditTrueSurfOp "TrueSurf2",
Array("NAME:trusurf", _
"SurfDevChoice:=", 2, _
VB Example
"SurfDev:=","0.03mm", _
"NormalDevChoice:=", 1, _
"AspectRatioChoice:=", 2, _

Mesh Operations Module Script Commands 12-34


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"AspectRatio:=", 10)

InitialMeshSettings
Assigns a true surface-based mesh operation to the selection.

UI Access Mesh > Initial Mesh Settings

Name Type Description


<InitialMeshSettingsParams> Array Structured array.
Array("NAME:<MeshSettings>",
"CurvedSurfaceApproxChoice:=", <"UseSlider"
or "Manual Settings">
"SliderMeshSettings:=", <integer 1 through
9>,
Parameters "UseLegacyFaceterForTauVolumeMesh:=",
<boolean>,
"DynamicSurfaceResolution:=", <boolean>,
"UseFlexMeshingForTAUvolumeMesh:=",
<boolean>,
"UseAlternativeMeshMethodsAsFallBack:=",
<boolean>,
"AllowPhiForLayeredGeometry:=", <boolean>)

Return Value None.

Python Syntax InitialMeshSettings(<InitialMeshSettingsParams>)

Mesh Operations Module Script Commands 12-35


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oModule.InitialMeshSettings
([
"NAME:MeshSettings",
[
"NAME:GlobalSurfApproximation",
"CurvedSurfaceApproxChoice:=", "UseSlider",
"SliderMeshSettings:=" , 5
],
[
"NAME:GlobalCurvilinear",
Python Example
"Apply:=", False
],
[
"NAME:GlobalModelRes",
"UseAutoLength:=", True
],
[
"NAME:GlobalLengthMeshSetup",
"RefineInside:=", True,
"ID:=", -1,

Mesh Operations Module Script Commands 12-36


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Type:=", "LengthBased",
"RestrictElem:=", False,
"NumMaxElem:=", "1000",
"RestrictLength:=", True,
"MaxLength:=", "45mm",
"ApplyToInitialMesh:=", True,
"IsGlobal:=", True
],
"MeshMethod:=", "Auto",
"UseLegacyFaceterForTAUVolumeMesh:=", False,
"DynamicSurfaceResolution:=", False,
"UseFlexMeshingForTAUvolumeMesh:=", False,
"UseAlternativeMeshMethodsAsFallBack:=", False,
"AllowPhiForLayeredGeometry:=", True
])

VB Syn- InitialMeshSettings <InitialMeshSettingsParams>


tax

oModule.InitialMeshSettings Array("NAME:MeshSettings", Array("NAME:G-


VB lobalSurfApproximation",
Example
"CurvedSurfaceApproxChoice:=", "UseSlider", "SliderMeshSettings:=", 5),

Mesh Operations Module Script Commands 12-37


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:GlobalCurvilinear", "Apply:=", false),


Array("NAME:GlobalModelRes", "UseAutoLength:=", true), "MeshMethod:=", "Auto",
"UseLegacyFaceterForTauVolumeMesh:=", false,
"DynamicSurfaceResolution:=", false,
"UseFlexMeshingForTAUvolumeMesh:=", true,
"UseAlternativeMeshMethodsAsFallBack:=", false,
"AllowPhiForLayeredGeometry:=", true)
oModule.InitialMeshSettings Array("NAME:MeshSettings",
Array("NAME:GlobalSurfApproximation",
"CurvedSurfaceApproxChoice:=",
"ManualSettings",
"SurfDevChoice:=", 2,
"SurfDev:=", "0.01mm",
"NormalDevChoice:=", 2,
"NormalDev:=", "22.5deg",
"AspectRatioChoice:=", 2, "AspectRatio:=", "10"),
Array("NAME:GlobalCurvilinear", "Apply:=", false),
Array("NAME:GlobalModelRes", "UseAutoLength:=", true),
Array("GlobalLengthMeshSetup", "RefineInside:=" , True, "ID:=", -1,
"Type:=", "LengthBased", "RestrictElem:=", False, "NumMaxElem:=", "1000",
"RestrictLength:=", True, "MaxLength:=", "45mm",

Mesh Operations Module Script Commands 12-38


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ApplyToInitialMesh:=", True, "IsGlobal:=", True)


"MeshMethod:=", "Auto",
"UseLegacyFaceterForTauVolumeMesh:=", false,
"DynamicSurfaceResolution:=", false,
"UseFlexMeshingForTAUvolumeMesh:=", true,
"UseAlternativeMeshMethodsAsFallBack:=", false,
"AllowPhiForLayeredGeometry:=", true)

Mesh Operations Module Script Commands 12-39


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

12-40
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

13 - Analysis Setup Module Script Commands


Maxwell analysis setup commands should be executed by the Analysis module, referred to in Maxwell scripts as the "AnalysisSetup"
module.
Set oModule = oDesign.GetModule("AnalysisSetup")
ClearLinkedData
CopySetup
DeleteSetups
EditSetup
ExportCircuit
ExportIcepak
ExportSolnData
GetSetupCount
GetSetups
GetSweepCount
GetSweeps
PasteSetup
PasteSweep
RenameSetup
ResetAllToTimeZero
ResetSetupToTimeZero
RevertAllToInitial

Analysis Setup Module Script Commands 13-1


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

RevertAllToInitialTemperature
RevertSetupToInitial
RevertSetupToInitialTemperature

ClearLinkedData (Module)
Clear the linked data of all the solution setups. Similar to the ClearLinkedData command for the design level.
Right-click menu of individual setups under the Analysis item.

UI Access Project Manager > Design name > Analysis > right-click Setup name > Clear Linked Data

Name Type Description


Parameters
<SetupNameArray> Array Specify the name of the setups whose linked data are to be cleaned

Return Value None

Python Syntax ClearLinkedData(<SetupNameArray>)


Python Example oModule.ClearLinkedData(["setup1"])

VB Syntax ClearLinkedData <SetupNameArray>


VB Example oModule.ClearLinkedData Array("setup1")

CopySetup
Copy the specified Optimetrics setup.

Analysis Setup Module Script Commands 13-2


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access NA

Name Type Description


Parameters
<SetupName> String Name of the setup.

Return Value None.

Python Syntax CopySetup (<SetupName>)


Python Example oModule.CopySetup ("OptimizationSetup1")

VB Syntax CopySetup <SetupName>


VB Example oModule.CopySetup "OptimizationSetup1"

DeleteSetups
Deletes one or more solution setups, which are specified by an array of solution setup names.

Right-click a solution setup in the project tree and then click Delete on the shortcut menu, or delete selected solu-
UI Access
tion setups in the List dialog box.

Name Type Description


Parameters
<SetupArray> Array Array of solution setup names.

Return Value None.

Python Syntax DeleteSetups (<SetupArray>)

Analysis Setup Module Script Commands 13-3


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Example oModule.DeleteSetups(["Setup1", "Setup2"])

VB Syntax DeleteSetups <SetupArray>


VB Example oModule.DeleteSetups Array("Setup1", "Setup2")

EditSetup [Maxwell]
Modifies an existing solution setup.

UI Access Double-click a solution setup in the Project Manager tree to modify its settings.

Name Type Description


<SetupName> String Name of the solve setup being edited.
<Attributes> Array Structured array.
Parameters
Array("NAME:<NewSetupName>", <NamedParameters>)
See the "InsertSetup [Maxwell]" on page 13-21 command for details and
examples.

Return Value None.

Note: For Eddy Current designs, Frequency also supports use of variables and expressions.

Python Syntax EditSetup (<SetupName>, <Attributes>)

3D Eddy Current:
Python Example
oModule.EditSetup("EddyCurrent",

Analysis Setup Module Script Commands 13-4


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

[
"NAME:EddyCurrent",
"Enabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],
"MaximumPasses:=" , 4,
"MinimumPasses:=" , 2,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=" , 30,
"SolveFieldOnly:=" , False,
"PercentError:=" , 0.1,
"SolveMatrixAtLast:=" , True,
"UseNonLinearIterNum:=" , False,
[
"NAME:ExpressionCache",
[
"NAME:CacheItem",
"Title:=" , "eddy_loss1",
"Expression:=" , "eddy_loss",

Analysis Setup Module Script Commands 13-5


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Intrinsics:=" , "Phase=\'0deg\'",
"ReportType:=" , "Fields",
[
"NAME:ExpressionContext"
]
]
],
"UseCacheFor:=" , ["Pass"],
"UseIterativeSolver:=" , False,
"RelativeResidual:=" , 0.0001,
"NonLinearResidual:=" , 0.0001,
"SmoothBHCurve:=" , False,
"Frequency:=" , "200Hz",
"HasSweepSetup:=" , False,
"UseHighOrderShapeFunc:=", False,
"UseMuLink:=" , False,
"LossAdaptiveCtrl:=" , "0.3"
])

VB Syntax EditSetup <SetupName>, <Attributes>

Analysis Setup Module Script Commands 13-6


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

3D Eddy Current:
oModule.EditSetup "Setup1",
Array("NAME:Setup1", "Enabled:=", true,
Array("NAME:MeshLink", "ImportMesh:=", false),
"MaximumPasses:=", 10,
"MinimumPasses:=", 2,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"SolveFieldOnly:=", false,
"PercentError:=", 1,
"SolveMatrixAtLast:=", true,
"UseNonLinearIterNum:=", false,
"UseCacheFor:=", Array("Pass"),
"UseIterativeSolver:=", false,
"RelativeResidual:=", 1E-05,
"NonLinearResidual:=", 0.0001,
VB Example "SmoothBHCurve:=", true,
"Frequency:=", "60Hz",
"HasSweepSetup:=", true,
Array("NAME:SweepRanges",
Array("NAME:Subrange",
"RangeType:=", "LinearStep",
"RangeStart:=", "10Hz"
"RangeEnd:=", "1000Hz",
"RangeStep:=", "10Hz"),
Array("NAME:Subrange",
"RangeType:=", "SinglePoints",
"RangeStart:=", "1000Hz",
"RangeEnd:=", "1000Hz",
"SaveSingleField:=", false)),
"SaveAllFields:=", true,
"UseHighOrderShapeFunc:=", false,
"UseMuLink:=", false)

Analysis Setup Module Script Commands 13-7


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Example: 3D ElectricTransient EditSetup:


oModule.EditSetup "Setup1",
Array("NAME:Setup1",
"Tolerance:=", 0.005,
Array("NAME:Data",
"SaveField:=", true,
"Stop:=", "100s",
"InitialStep:=", "0.01s",
"MaxStep:=", "0.5s"),
"Initial Voltage:=", "0V",
"NumberOfOutputVars:=", 0)

VB Example: 3D Transient EditSetup:


oModule.EditSetup "Setup1",
Array("NAME:Setup1", "Enabled:=", true,
Array("NAME:MeshLink", "ImportMesh:=", false),
"NonlinearSolverResidual:=", "0.005",
"ScalarPotential:=", "Second Order",
"SmoothBHCurve:=", false,
"StopTime:=", "10000000ns",
"TimeStep:=", "2000000ns",
"OutputError:=", false,
"OutputPerObjectCoreLoss:=", true,
"OutputPerObjectSolidLoss:=", false,
"UseControlProgram:=", false,
"ControlProgramName:=", " ",
"ControlProgramArg:=", " ",
"CallCtrlProgAfterLastStep:=", false,
"FastReachSteadyState:=", false,
"AutoDetectSteadyState:=", false,
"IsGeneralTransient:=", true,
"IsHalfPeriodicTransient:=", false,

Analysis Setup Module Script Commands 13-8


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"SaveFieldsType:=", "None",
"UseNonLinearIterNum:=", false,
"CacheSaveKind:=", "Count",
"NumberSolveSteps:=", 1,
"RangeStart:=", "0s",
"RangeEnd:=", "0.1s")

VB Example: 3D ACConduction EditSetup:


oModule.EditSetup "Setup1",
Array("NAME:Setup1", "Enabled:=", true,
Array("NAME:MeshLink", "ImportMesh:=", false),
"MaximumPasses:=", 10,
"MinimumPasses:=", 2,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"SolveFieldOnly:=", false,
"PercentError:=", 1,
"SolveMatrixAtLast:=", true,
"UseNonLinearIterNum:=", true,
"MinIterNum:=", 1,
"MaxIterNum:=", 100,
"CacheSaveKind:=", "Delta",
"ConstantDelta:=", "0s",
"UseIterativeSolver:=", false,
"RelativeResidual:=", 1E-06,
"NonLinearResidual:=", 0.001,
"Frequency:=", "60Hz",
"HasSweepSetup:=", false)

VB Example: 2D DCConduction EditSetup:


oModule.EditSetup "Setup1",
Array("NAME:Setup1",
"MaximumPasses:=", 20,
"MinimumPasses:=", 2,

Analysis Setup Module Script Commands 13-9


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"SolveFieldOnly:=", false,
"PercentError:=", 1,
"SolveMatrixAtLast:=", true,
"UseOutputVariable:=", false,
"PreAdaptMesh:=", false)

VB Example: 2D Transient EditSetup:


Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.EditSetup "Setup1",
Array("NAME:Setup1",
"Enabled:=", true,
"NonlinearSolverResidual:=", "0.0001",
"TimeIntegrationMethod:=", "BackwardEuler",
"SmoothBHCurve:=", true,
"StopTime:=", "0.2s",
"TimeStep:=", "0.0002s",
"OutputError:=", false,
"OutputPerObjectCoreLoss:=", true,
"OutputPerObjectSolidLoss:=", false,
"UseControlProgram:=", false,
"ControlProgramName:=", " ",

Analysis Setup Module Script Commands 13-10


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ControlProgramArg:=", " ",


"CallCtrlProgAfterLastStep:=", false,
"FastReachSteadyState:=", true,
"AutoDetectSteadyState:=", true,
"FrequencyOfAddedVoltageSource:=", "50Hz",
"StopCriterion:=", 0.005,
"IsGeneralTransient:=", false,
"IsHalfPeriodicTransient:=", true,
"HasSweepSetup:=", true,
"SaveFieldsType:=" , "Custom",
"Sweep Ranges:="
[
"SweepSetupType:=" , "LinearStep",
"StartValue:=" , "0",
"StopValue:=" , "200ms",
"StepSize:=" , "25ms"
]

Python Example: Transient EditSetup:


oModule.EditSetup("Setup1",
[
"NAME:Setup1",
"Enabled:=" , True,
"NonlinearSolverResidual:=", "0.9",

Analysis Setup Module Script Commands 13-11


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ScalarPotential:=" , "Second Order",


"TimeIntegrationMethod:=", 0,
"SmoothBHCurve:=" , True,
"StopTime:=" , "200ms",
"TimeStep:=" , "10ms",
"OutputError:=" , False,
"UseControlProgram:=" , False,
"ControlProgramName:=" , " ",
"ControlProgramArg:=" , " ",
"CallCtrlProgAfterLastStep:=", False,
"FastReachSteadyState:=", False,
"AutoDetectSteadyState:=", False,
"IsGeneralTransient:=" , True,
"IsHalfPeriodicTransient:=", False,
"HasSweepSetup:=" , True,
"SaveFieldsType:=" , "Every N Steps",
"N Steps:=", , "$MyStepCount"
])

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>

Analysis Setup Module Script Commands 13-12


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name of the setup where circuit is being exported


<SolutionName>
Type: <String>
Name of the solution.
<Variation>
Type: <string>
The variation where circuit is being exported
<FileName>
Type: <string>
The name of the file where circuit is being exported
<ModelName>
Type: <String>
Model name or name of the sub circuit (Optional). If not specified then <FileName> is con-
sidered as model name.
<Freq>
Type: <double>
Sweep frequency in hz.
<ExportSettings>
Array("NAME:CircuitData", "MatrixName:=", _
<ReduceMatrix>, "NumberOfCells:=", <NumCell>, "UserHasChangedSettings:=", <User-
ChangedSettings>, "IncludeCap:=", <IncludeCap>, "IncludeCond:=", <IncludeCond>, Array
("NAME:CouplingLimits", <CouplingLimitsArray>, "IncludeDCR:=", <IncludeDCR>, "IncludeDCL:=",

Analysis Setup Module Script Commands 13-13


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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.wirebond
<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 13-14


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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:=", <CouplingLimitType>, _
<CouplingLimitsParameters>, 0.01, "CondFraction:=", 0.01)
<CouplingLimitType> = "None"
Argument not needed
<CouplingLimitType> = "ByFraction"

Analysis Setup Module Script Commands 13-15


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<CouplingLimitsParameters>
"CapFraction:=", <Fraction>, "IndFraction:=", <Fraction>,
"ResFraction:=", <Fraction>,"CondFraction:=",<Fraction>,
Parameters:
<Fraction>
Type: <double>
Fraction of the self term
<CouplingLimitType> = "ByValue"
<CouplingLimitsParameters>
"CapLimit:=", <Limit>, "IndLimit:=", <Limit>, "ResLimit:=", <Limit>,
"CondLimit:=", <Limit>,
Parameters:
<Limit>
Type: <string>
Value of the limit.
VB Example:
oModule.ExportCircuit
"Setup1 : LastAdaptive", "", "C:/Project/Q3D/FourNets.cir", Array("NAME:CircuitData", _
"MatrixName:=", "Original", "NumberOfCells:=", "1", "UserHasChangedSettings:=", true, _
"IncludeCap:=", true, "IncludeCond:=", true, Array("NAME:CouplingLimits", "CouplingLimitType:=",
_
"By Fraction", "CapFraction:=", 0.01, "IndFraction:=", 0.01, "ResFraction:=", 0.01, _

Analysis Setup Module Script Commands 13-16


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"CondFraction:=", 0.01), "IncludeDCR:=", false, IncudeDCL:=", false, "IncludeACR:=", false, _


"IncludeACL:=", false, "ADDResistance:=", true), "", 2000000000000

ExportIcepak
Use: Exports Icepak data to the specified output directory.
Command: Right-click a setup under Analysis in the project tree, and select Create Icepak Design. From the dialog box, select an
appropriate solution setup and variation, enter the path to the output dierctory, and click the OK button.
Syntax: ExportIcepak <SetupName>, <Variation>, <Output Directory>
Return Value: None
Parameters: <SetupName>
Type: string
Setup name.
<Variation>
Type: string
Variation values.
<Output Directory>
Type: string
Path to the output directory in which the Icepak design files will be saved.
Example: oModule.ExportIcepak "Setup1", "air_gap=’1mm’ diameter=’120mm", "D:\Work\Icepak\"

ExportSolnData
Use: Exports solution data to a file.
Command: Right-click a parameter setup under Parameters in the project tree, and select ViewSolution. From the dialog box,
select an appropriate solution type, and click the Export Solution button.

Analysis Setup Module Script Commands 13-17


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Syntax:ExportSolnData <SetupName>, <SolutionName>, <IsPostProcessed>, <Variation>, <ExportFileName>,


Return Value: None
Parameters: <SetupName>
Type: string
Setup name.
<SolutionName>
Type: string
Solution setup name.
<IsPostProcessed>
Type: bool
Is post processed (true/false).
<Variation>
Type: string
Variation values.
<ExportFileName>
Type: string
Export file name.
Example: oModule.ExportSolnData "Setup1", "Matrix1", false, "", _
"C:/Maxwell/Projects/Export/OutputSolution.txt"

Analysis Setup Module Script Commands 13-18


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetSetupCount
Gets the number of analysis setups in a design.

UI Access N/A
Parameters None.
Return Value Integer containing number of setups.

Python Syntax GetSetupCount ()


Python Example oModule.GetSetupCount()

VB Syntax GetSetupCount
VB Example oModule.GetSetupCount

GetSetups
Gets the names of analysis setups in a design.

UI Access N/A
Parameters None.
Return Value Array of analysis setup names

Analysis Setup Module Script Commands 13-19


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetSetups ()


Python Example oModule.GetSetups()

VB Syntax GetSetups
VB Example oModule.GetSetups

GetSweepCount
Gets the number of sweeps in a specified analysis setup.

UI Access N/A

Name Type Description


Parameters
<SetupName> String Name of specified setup.

Return Value Integer containing number of sweeps for the named setup.

Python Syntax GetSweepCount (<SetupName>)


Python Example oModule.GetSweepCount("Setup1")

VB Syntax GetSweepCount <SetupName>


VB Example oModule.GetSweepCount "Setup1"

Analysis Setup Module Script Commands 13-20


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetSweeps
Gets the names of all sweeps in a given analysis setup.

UI Access N/A

Name Type Description


Parameters
<SetupName> String Name of specified setup.

Return Value Array of sweep names.

Python Syntax GetSweeps (<SetupName>)


Python Example oModule.GetSweeps("Setup1")

VB Syntax GetSweeps <SetupName>


VB Example oModule.GetSweeps "Setup1"

InsertSetup [Maxwell]
Use: Adds a new solution setup.
Command: Maxwell 3D or Maxwell 2D > Analysis Setup > Add Solution Setup
Syntax: InsertSetup <SetupType>, <AttributesArray>
Return Value: None
Parameters:
<SetupType>

Analysis Setup Module Script Commands 13-21


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Type: <string>
Possible values for 3D designs are: "Magnetostatic", "EddyCurrent", "Transient", "Electrostatic", "DCConduction", "Elec-
troDCConduction",
"ElectricTransient", and "ACConduction".
Possible values for 2D designs are: "Magnetostatic", "EddyCurrent", "Transient", "Electrostatic",
"ACConduction", "DCConduction".
<AttributesArray>
Array("NAME:<SetupName>", <NamedParameters>)
<NamedParameters>
The named parameters vary according to the setup type and settings selected for a setup. Please see the typical examples below for
each solution type. The parameters correspond to fields in the Setup dialog box. For example, here is a default dialog for a Maxwell 3D
Magnetostatic design.

Analysis Setup Module Script Commands 13-22


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Some of the attributes Array correspond to these fields on the General tab of the Setup.
oModule.InsertSetup "Magnetostatic", Array("NAME:Setup1",
"MaximumPasses:=", 10,
...
"SolveMatrixAtLast:=", true,
Other parameters correspond to fields in the Convergence tab of the Setup.

Analysis Setup Module Script Commands 13-23


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"MinimumPasses:=", 2,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
Still other parameters correspond to fields in the Solver tab of the Setup.
"NonLinearResidual:=", 0.001,
UseNonLinearIterNum:=" , True,
"MinIterNum:=" , 5,
"MaxIterNum:=" , 10,
Each different example below corresponds to the fields for each different setup.

Example: 3D Magnetostatic solve setup:


oModule.InsertSetup "Magnetostatic", Array("NAME:Setup1",
"MaximumPasses:=", 10,
"MinimumPasses:=", 2,

Analysis Setup Module Script Commands 13-24


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"SolveFieldOnly:=", false,
"PercentError:=", 1,
"SolveMatrixAtLast:=", true,
"UseOutputVariable:=", false,
"PreAdaptMesh:=", false,
"UseNonLinearIterNum:=" , True,
"MinIterNum:=" , 5,
"MaxIterNum:=" , 10,
"NonLinearResidual:=", 0.001,
"MuNonLinearBH:=", true,
"ComputeHc:=", false,
"HcNonLinearBH:=", true,
"UserOverrideMu:=", true,
"UserExePath:=", "E:\views\projects\ucp.exe",
"UserExeArg:=", "-3D")

Python Example: 3D EddyCurrent solve setup:


oModule.InsertSetup("EddyCurrent",
[
"NAME:EddyCurrent_03",
"Enabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],
"MaximumPasses:=" , 4,
"MinimumPasses:=" , 2,

Analysis Setup Module Script Commands 13-25


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"MinimumConvergedPasses:=", 1,
"PercentRefinement:=" , 30,
"SolveFieldOnly:=" , False,
"PercentError:=" , 0.1,
"SolveMatrixAtLast:=" , True,
"UseNonLinearIterNum:=" , False,
[
"NAME:ExpressionCache",
[
"NAME:CacheItem",
"Title:=" , "eddy_loss1",
"Expression:=" , "eddy_loss",
"Intrinsics:=" , "Phase=\'0deg\'",
"ReportType:=" , "Fields",
[
"NAME:ExpressionContext"
]
]
],
"UseCacheFor:=" , ["Pass"],

Analysis Setup Module Script Commands 13-26


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"UseIterativeSolver:=" , False,
"RelativeResidual:=" , 0.0001,
"NonLinearResidual:=" , 0.0001,
"SmoothBHCurve:=" , False,
"Frequency:=" , "200Hz",
"HasSweepSetup:=" , False,
"UseHighOrderShapeFunc:=", False,
"UseMuLink:=" , False,
"LossAdaptiveCtrl:=" , "0.3"
])

VB Example:3D EddyCurrent solve setup:


oModule.InsertSetup "EddyCurrent", Array("NAME:Setup1",
"Enabled:=", true,
"MaximumPasses:=", 10,
"MinimumPasses:=", 2,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"SolveFieldOnly:=", false,
"PercentError:=", 1,
"SolveMatrixAtLast:=", true,
"UseNonLinearIterNum:=" , True,
"MinIterNum:=" , 5,
"MaxIterNum:=" , 10,
"UseIterativeSolver:=", true,
"RelativeResidual:=", 0.00013,
"ComputeForceDensity:=", false,
"ComputePowerLoss:=", false,

Analysis Setup Module Script Commands 13-27


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ThermalFeedback:=", true,
"Frequency:=", "60Hz",

Note: For Eddy Current designs, Frequency also supports use of variables and expressions.

"HasSweepSetup:=", true,
Array("NAME:SweepRanges", Array("NAME:Subrange", "RangeType:=", "LinearStep", "RangeStart:=",
"10Hz", "RangeEnd:=", "1000Hz", "RangeStep:=", "10Hz"),
Array("NAME:Subrange", "RangeType:=", "SinglePoints", "RangeStart:=", "1000Hz", "RangeEnd:=",
"1000Hz", "SaveSingleField:=", false)), "SaveAllFields:=", true,
"UseHighOrderShapeFunc:=", false)

Analysis Setup Module Script Commands 13-28


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Example: 3D Transient solve setup:


oModule.InsertSetup "Transient",
Array("NAME:Setup1", "Enabled:=", true,
"NonlinearSolverResidual:=", 0.005,
"ScalarPotential:=", "First Order",
"TimeIntegrationMethod:=", -1,
Array("NAME:PrevSoln", "Project:=", "This Project*",
"Product:=", "Maxwell",
"Design:=", "NL_V_ED1_Link",
"Soln:=", "Setup1 : LastAdaptive",
Array("NAME:Params"), "ForceSourceToSolve:=", false,
"PreservePartnerSoln:=", false,
"PathRelativeTo:=", "TargetProject"),
"StopTime:=", "10000000ns",
"TimeStep:=", "2000000ns",
"OutputError:=", true,
"OutputPerObjectCoreLoss:=", true,
"OutputPerObjectSolidLoss:=", false,
"UseControlProgram:=", false,
"ControlProgramName:=", "",
"ControlProgramArg:=", " ",
"CallCtrlProgAfterLastStep:=", false,
"FastReachSteadyState:=", true,
"FrequencyOfAddedVoltageSource:=", "60Hz",
"AutoDetectSteadyState:=", false,
"StopCriterion:=", "0.005",
"IsGeneralTransient:=", true,
"IsHalfPeriodicTransient:=", false,
"SaveFieldsType:=", "Every N Steps", "N Steps:=", "10", "Steps From:=", "0s", "Steps To:=",
"10000000ns",
"UseNonLinearIterNum:=" , True,
"MinIterNum:=" , 5,
"MaxIterNum:=" , 10,

Analysis Setup Module Script Commands 13-29


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"CacheSaveKind:=", "Count", "NumberSolveSteps:=", 1, "RangeStart:=", "0s", "RangeEnd:=",


"0.1s")

Example: 3D Electrostatic solve setup


oModule.InsertSetup "Electrostatic", Array("NAME:Setup1",
"MaximumPasses:=", 10,
"MinimumPasses:=", 2,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"SolveFieldOnly:=", false,
"PercentError:=", 1,
"SolveMatrixAtLast:=", true,
"UseOutputVariable:=", false,
"PreAdaptMesh:=", false)

Example:3D DCConduction solve setup


oModule.InsertSetup "DCConduction", Array("NAME:Setup2",
"MaximumPasses:=", 10,
"MinimumPasses:=", 2,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"SolveFieldOnly:=", false,
"PercentError:=", 1,
"SolveMatrixAtLast:=", true,
"UseOutputVariable:=", false,
"PreAdaptMesh:=", false)

Analysis Setup Module Script Commands 13-30


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Example: 3D ElectroDCConduction solve setup


oModule.InsertSetup "ElectroDCConduction", Array("NAME:Setup3",
"MaximumPasses:=", 10,
"MinimumPasses:=", 2,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"SolveFieldOnly:=", false,
"PercentError:=", 1,
"SolveMatrixAtLast:=", true,
"UseOutputVariable:=", false,
"PreAdaptMesh:=", false)

Example: 3D ElectricTransient solve setup


oModule.InsertSetup "ElectricTransient", Array("NAME:Setup1",
"Tolerance:=", 0.005,
Array("NAME:Data",
"SaveField:=", true,
"Stop:=", "100s",
"InitialStep:=", "0.01s",
"MaxStep:=", "5s"),
"Initial Voltage:=", "0V",
"NumberOfOutputVars:=", 0)

VB Example: 3D ACConduction solve setup


oModule.InsertSetup "ACConduction", Array("NAME:Setup2", "Enabled:=", true,
Array("NAME:MeshLink", "ImportMesh:=", false),
"MaximumPasses:=", 10,
"MinimumPasses:=", 2,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"SolveFieldOnly:=", false,
"PercentError:=", 1,
"SolveMatrixAtLast:=", true,

Analysis Setup Module Script Commands 13-31


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"UseNonLinearIterNum:=", true,
"MinIterNum:=", 1,
"MaxIterNum:=", 100,
"UseIterativeSolver:=", false,
"RelativeResidual:=", 1E-06,
"NonLinearResidual:=", 0.001,
"Frequency:=", "60Hz",
"HasSweepSetup:=", false)

Python Example:3D ACConduction solve setup


oModule.InsertSetup("ACConduction",
[
"NAME:Setup2",
"Enabled:=" , True,
[
"NAME:MeshLink",
"ImportMesh:=" , False
],
"MaximumPasses:=" , 10,
"MinimumPasses:=" , 2,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=" , 30,
"SolveFieldOnly:=" , False,
"PercentError:=" , 1,

Analysis Setup Module Script Commands 13-32


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"SolveMatrixAtLast:=" , True,
"UseNonLinearIterNum:=" , True,
"MinIterNum:=" , 1,
"MaxIterNum:=" , 100,
"UseIterativeSolver:=" , False,
"RelativeResidual:=" , 1E-06,
"NonLinearResidual:=" , 0.001,
"Frequency:=" , "60Hz",
"HasSweepSetup:=" , False
])

Example:2D Magnetostatic solve setup


oModule.InsertSetup "Magnetostatic", Array("NAME:Setup1",
"MaximumPasses:=", 10,
"MinimumPasses:=", 2,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"SolveFieldOnly:=", false,
"PercentError:=", 1,
"SolveMatrixAtLast:=", true,
"UseNonLinearIterNum:=" , True,
"MinIterNum:=" , 5,
"MaxIterNum:=" , 10,
"UseOutputVariable:=", false,
"PreAdaptMesh:=", false,
"NonLinearResidual:=", 0.0001,
"MuNonLinearBH:=", true,
"ComputeHc:=", false,
"HcNonLinearBH:=", true

Analysis Setup Module Script Commands 13-33


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"UserOverrideMu:=", true,
"UserExePath:=", "E:\views\projects\ucp.exe",
"UserExeArg:=", "-3D")

Example:2D EddyCurrent solve setup


oModule.InsertSetup "EddyCurrent", Array("NAME:Setup1",
"MaximumPasses:=", 10,
"MinimumPasses:=", 2,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"SolveFieldOnly:=", false,
"PercentError:=", 1,
"SolveMatrixAtLast:=", true,
"UseNonLinearIterNum:=" , True,
"MinIterNum:=" , 5,
"MaxIterNum:=" , 10,
"UseOutputVariable:=", false,
"PreAdaptMesh:=", false,
"Frequency:=", "60Hz",

Note: For Eddy Current designs, Frequency also supports use of variables and expressions.

"NonLinearResidual:=", 0.0001,
"HasSweepSetup:=", false)

Example: 2D Transient solve setup


oModule.InsertSetup "Transient",
Array("NAME:Setup1",
"Enabled:=", true,
"NonlinearSolverResidual:=", "0.0001",
"TimeIntegrationMethod:=", "RungeKutta",

Analysis Setup Module Script Commands 13-34


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"StopTime:=", "0.02s",
"TimeStep:=", "0.0005s",
"OutputError:=", false,
"OutputPerObjectCoreLoss:=", true,
"OutputPerObjectSolidLoss:=", false,
"UseControlProgram:=", false,
"ControlProgramName:=", "",
"ControlProgramArg:=", " ",
"CallCtrlProgAfterLastStep:=", false,
"FastReachSteadyState:=", false,
"FrequencyOfAddedVoltageSource:=", "60Hz",
"AutoDetectSteadyState:=", false,
"StopCriterion:=", "0.005",
"IsGeneralTransient:=", true,
"IsAutoSubDivision:=", true,
"HasSweepSetup:=", true,
"SweepSetupType:=", "LinearStep",
"StartValue:=", "0s",
"StopValue:=", "0.1s",
"StepSize:=", "0.005s",
"UseNonLinearIterNum:=" , True,
"MinIterNum:=" , 5,
"MaxIterNum:=" , 10,
"UseAdaptiveTimeStep:=", false,
"InitialTimeStep:=", "0.002s",
"MinTimeStep:=", "0.001s",
"MaxTimeStep:=", "0.003s",
"TimeStepErrTolerance:=", 0.0001)

Analysis Setup Module Script Commands 13-35


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Example: 2D Electrostatic solve setup:


oModule.InsertSetup "Electrostatic", Array("NAME:Setup1",
"MaximumPasses:=", 10,
"MinimumPasses:=", 2,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"SolveFieldOnly:=", false,
"PercentError:=", 1,
"SolveMatrixAtLast:=", true,
"UseOutputVariable:=", false,
"PreAdaptMesh:=", false)

Example: 2D ACConduction solve setup:


oModule.InsertSetup "ACConduction", Array("NAME:Setup1",
"MaximumPasses:=", 10,
"MinimumPasses:=", 2,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"SolveFieldOnly:=", false,
"PercentError:=", 1,
"SolveMatrixAtLast:=", true,
"UseOutputVariable:=", false,
"PreAdaptMesh:=", false,
"Frequency:=", "60Hz",
"HasSweepSetup:=", false)

Example: 2D DCConduction solve setup:


oModule.InsertSetup "DCConduction", Array("NAME:Setup1",
"MaximumPasses:=", 10,
"MinimumPasses:=", 2,
"MinimumConvergedPasses:=", 1,

Analysis Setup Module Script Commands 13-36


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"PercentRefinement:=", 30,
"SolveFieldOnly:=", false,
"PercentError:=", 1,
"SolveMatrixAtLast:=", true,
"UseOutputVariable:=", false,
"PreAdaptMesh:=", false)

PasteSetup
Use: Paste a solve setup.
Syntax: PasteSetup
Return Value: None
VB Example: oModule.PasteSetup

PasteSweep
Pastes a copied sweep.

UI Access Right-click on a setup, select Paste

Name Type Description


Parameters
<SetupName> String Name of setup where the copied sweep is pasted to.

Return Value None.

Python Syntax PasteSweep (<SetupName>)


Python Example oModule.PasteSweep("Setup1")

Analysis Setup Module Script Commands 13-37


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax PasteSweep <SetupName>


VB Example oModule.PasteSweep "Setup1"

RenameSetup
Renames an existing solution setup.

UI Access Right-click a solution setup in the Project Manager and then click Rename on the shortcut menu.

Name Type Description


Parameters <OldSetupName> String Name of the solution setup being renamed.
<NewSetupName> String New name for the solution setup.

Return Value None.

Python Syntax RenameSetup (<OldSetupName>, <NewSetupName>)


Python Example oModule.RenameSetup("Setup1", "MySetup")

VB Syntax RenameSetup <OldSetupName>, <NewSetupName>


VB Example oModule.RenameSetup "Setup1", "MySetup"

ResetAllToTimeZero
Forces the next solve to start from time 0 for all setups. Applies only to the Transient solution type.
Command: Right-click Analysis in the project tree, and select Revert to Time Zero.

Analysis Setup Module Script Commands 13-38


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Syntax:ResetAllToTimeZero
Return Value: None
Parameters: None
Example: oModule.ResetAllToTimeZero

ResetSetupToTimeZero
Use: Forces the next solve to start from time 0 for a given setup. Applies only to the Transient solution type.
Command: Right-click a setup in the project tree, and select Revert to Time Zero.
Syntax:ResetSetupToTimeZero <SetupName>
Return Value: None
Parameters: <SetupName>
Type: string
Setup name
Example: oModule.ResetSetupToTimeZero "Setup1"

RevertAllToInitial
Marks the current mesh for all solution setups as invalid. This will force the next simulation to begin with the initial mesh.

UI Access Maxwell > Analysis Setup > Revert to Initial Mesh.


Parameters None.
Return Value None.

Analysis Setup Module Script Commands 13-39


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax RevertAllToInitial ()


Python Example oModule.RevertAllToInitial()

VB Syntax RevertAllToInitial
VB Example oModule.RevertAllToInitial

RevertAllToInitialTemperature
Reverts all setups to their initial temperature. Used when coupling with thermal designs.

Maxwell > Set Object Temperature > Enable Feedback. Then in the Project Manager, right-click Analysis
UI Access
> Revert to Initial Temperature. Repeat for all setups.
Parameters None.
Return Value None.

Python Syntax RevertAllToInitialTemperature()


Python Example oModule.RevertAllToInitialTemperature()

VB Syntax RevertAllToInitialTemperature
VB Example oModule.RevertAllToInitialTemperature

Analysis Setup Module Script Commands 13-40


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

RevertSetupToInitial
Marks the current mesh for a solution setup as invalid. This will force the next simulation to begin with the initial mesh.

UI Access Right-click a solution setup in the Project Manager and then click Rename on the shortcut menu.

Name Type Description


Parameters
<SetupName> String Name of specified setup.

Return Value None.

Python Syntax RevertSetupToInitial (<SetupName>)


Python Example oModule.RevertSetupToInitial("Setup1")

VB Syntax RevertSetupToInitial <SetupName>


VB Example oModule.RevertSetupToInitial "Setup1"

RevertSetupToInitialTemperature
Reverts a specified setup to its initial temperature. Used when coupling with thermal designs.

Maxwell > Set Object Temperature > Enable Feedback. Then in the Project Manager, right-click Analysis
UI Access
> Revert to Initial Temperature.

Name Type Description


Parameters
<setupName> String Name of solution setup.

Return Value None

Analysis Setup Module Script Commands 13-41


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax RevertSetupToInitialTemperature(<setupName>)


Python Example oModule.RevertSetupToInitialTemperature('Setup1')

VB Syntax RevertSetupToInitialTemperature <setupName>


VB Example oModule.RevertSetupToInitialTemperature "Setup1"

Analysis Setup Module Script Commands 13-42


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

14 - 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.

Optimetrics Module Script Commands 14-1


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<MaxV>
Type: <VarValue>
The maximum value of a variable.
<IncludeVar>
Type: <bool>
Specifies whether the variable is included in the analysis.
<StartingPoint>
Array("NAME:StartingPoint", "<VarName>:=",
<VarValue>, .... "<VarName>:=", <VarValue>)
<SaveField>
Type: <bool>
Specifies whether HFSS will remove the non-nominal field solution.
<MaxIter>
Type: <int>
Maximum iteration allowed in an analysis.
<PriorSetup>
Type: <string>
The name of the embedded parametric setup.
<Precede>
Type: <bool>

Optimetrics Module Script Commands 14-2


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

If true, the embedded parametric setup will be solved before the


analysis begins.
If false, the embedded parametric setup will be solved during each
iteration of the analysis.
<Constraint>
Array("NAME:LCS",
"lc:=", Array("<VarName>:=",
<Coeff>, …"<VarName>:=", <Coeff>, "rel:=", <Cond>, "rhs:=", <Rhs>), ...
"lc:=", Array("<VarName>:=", <Coeff>, ..."
<VarName>:=", <Coeff>, "rel:=", <Cond>, "rhs:=",
<Rhs>))
<Coeff>
Type: <double>
Coefficient for a variable in the linear constraint.
<Cond>
Type: <string>
Inequality condition.
<Rhs>
Type: <double>
Inequality value.
<OptiGoalSpec>

Optimetrics Module Script Commands 14-3


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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>

Optimetrics Module Script Commands 14-4


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Type: <string>
Name of geometry needed in the evaluation of <Calc>.
<RangeType>
Type: <string>
if "r", start and stop values specify a range for the variable.
if "s", start values specify the single value for the variable.
EditSetup
EditSetup [Optimization]
EditSetup [Sensitivity]
EditSetup [Statistical]
GetPropNames [Optimetrics]
GetPropValue [Optimetrics]
GetSetupNames [Optimetrics]
GetSetupNamesByType [Optimetrics]
InsertSetup [Parametric]
InsertSetup [Optimization]
InsertSetup [Sensitivity]
InsertSetup [Statistical]
PasteSetup [Optimetrics]
RenameSetup [Optimetrics]
SetPropValue [Optimetrics]

Optimetrics Module Script Commands 14-5


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

SolveSetup [Optimetrics]
The topics for this section include:
General Commands Recognized by the Optimetrics Module
Parametric Script Commands
Optimization Script Commands
Sensitivity Script Commands
Statistical Script Commands

General Commands Recognized by the Optimetrics Module


Following are general script commands recognized by the Optimetrics module:
CopySetup
DistrbutedAnalyzeSetup
EditSetup
ExportDXConfigFile
ExportOptimetricsProfile
ExportOptimetricsResult
ExportParametricResults
GetOptimetricResult
GetPropNames [Optimetrics]
GetPropValue [Optimetrics]
GetSetupNames [Optimetrics]

Optimetrics Module Script Commands 14-6


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetSetupNamesByType [Optimetrics]
ImportSetup
PasteSetup [Optimetrics]
RenameSetup [Optimetrics]
SetPropValue [Optimetrics]
SolveSetup [Optimetrics]
SolveAllSetup
CopySetup
Copy the specified Optimetrics setup.

UI Access NA

Name Type Description


Parameters
<SetupName> String Name of the setup.

Return Value None.

Python Syntax CopySetup (<SetupName>)


Python Example oModule.CopySetup ("OptimizationSetup1")

VB Syntax CopySetup <SetupName>


VB Example oModule.CopySetup "OptimizationSetup1"

Optimetrics Module Script Commands 14-7


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

DeleteSetups [Optimetrics]
Deletes the specified Optimetrics setups.

UI Access Right-click the setup in the project tree, and then click Delete on the shortcut menu

Name Type Description


Parameters
<NameArray> Array of Strings An Array of Setup Names

Return Value None

Python Syntax DeleteSetups (<NameArray>)


oModule.DeleteSetups (["OptimizationSetup1"])
Python Example

VB Syntax DeleteSetups <NameArray>


VB Example oModule.DeleteSetups Array("OptimizationSetup1")

DistributedAnalyzeSetup
Distributes all variable value instances within a parametric sweep to different machines already specified from within the user interface

UI Access Right-click the parametric setup name in the project tree and select Distribute Analysis.

Name Type Description


Parameters
<ParametricSetupName> String Name of the Setup

Optimetrics Module Script Commands 14-8


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value None

Python Syntax DistributedAnalyzeSetup (<ParametricSetupName>)


oModule.DistributedAnalyzeSetup("ParametricSetup1")
Python Example

VB Syntax DistributedAnalyzeSetup <ParametricSetupName>


VB Example oModule.DistributedAnalyzeSetup "ParametricSetup1"

ExportDXConfigFile
Create an xml file with the setup information for Design Xplorer

Right click on the Design Xplorer setup in the project tree and choose Export External Connector Addin Con-
UI Access
figuration…

Name Type Description


Parameters <SetupName> String Must be one of existing DesignExplorer setup names
<FileName> String Must be a valid file path and name

Return Value None

Python Syntax ExportDXConfigFile (<SetupName>, <FileName>)


oModule.ExportDXConfigFile ("DesignXplorerSetup1",
Python Example
"c:/exportdir/DXSetup1.xml")

Optimetrics Module Script Commands 14-9


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax ExportDXConfigFile <SetupName>, <FileName>


oModule.ExportDXConfigFile ("DesignXplorerSetup1",
VB Example
"c:/exportdir/DXSetup1.xml")

ExportOptimetricsProfile
Export Optimetrics profile data

Right click on the Optimetrics setup in the project tree and choose View Analysis Result… On the Post Ana-
UI Access
lysis Display dialog box, click the Profile tab and click on the Export button.

Name Type Description


<SetupName> String Must be one of the existing Parametric, Optimization, Sensitivity, Statistical or
DesignXplorer setup names
Parameters
<FileName> String Must be a valid file path and name with extension of csv, tab, dat, or txt
[profileNum] String Must be a numeric string. Optional: defaulted to last profile number. It should
be a zero indexed profile number.

Return Value None

Python Syntax ExportOptimetricsProfile (<SetupName>, <FileName>, [profileNum]


oModule.ExportOptimetricsProfile
Python Example
("StatisticalSetup1", "c:/exportdir/test.csv")

Optimetrics Module Script Commands 14-10


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax ExportOptimetricsProfile <SetupName>, <FileName>, [profileNum]


oModule.ExportOptimetricsProfile
VB Example
"StatisticalSetup1", "c:/exportdir/test.csv"

ExportOptimetricsResult
Export an existing Optimization, Sensitivity, Statistical or DesignXplorer result. (Does not export Parametric results.)

Right click on the desired Optimetrics setup in the project tree and choose View Analysis Result… On the
UI Access
Post Analysis Display dialog box, click the Result tab, then select Table view, and click on the Export button

Name Type Description


<SetupName> String Must be one of the existing Optimization, Sensitivity, Statistical, or
DesignXplorer setup names
Parameters
<FileName> String Must be a valid file path and name with extension of csv, tab, dat, or txt..
[useFullOutputName] Boolean Optional: defaulted to false. If set to true values will be printed with units.
This parameter is ignored for Optimization and Statistical results.

Return Value None

Python Syntax ExportOptimetricsResult (<SetupName>, <FileName>, [useFullOutputName])


oModule.ExportOptimetricsResult (
Python Example
"StatisticalSetup1", "c:/exportdir/test.csv",false)

Optimetrics Module Script Commands 14-11


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax ExportOptimetricsResult <SetupName>, <FileName>, [useFullOutputName]


oModule.ExportOptimetricsResult "StatisticalSetup1", "c:/exportdir/test.csv",
VB Example
false

ExportParametricResults
Export existing Parametric results.

Right click on the desired Parametric setup in the project tree and choose View Analysis Result… On the Post
UI Access
Analysis Display dialog box, click the Result tab, then select Table view, and click on the Export button.

Name Type Description


<SetupName> String Must be one of the existing Parametric setup names
Parameters
<FileName> String Must be a valid file path and name with extension of csv, tab, dat or txt
<bOutputUnits> Boolean If set to true, values will be printed with units

Return Value None

Python Syntax ExportParametricResults (<SetupName>, <FileName>, <bOutputUnits>)


oModule.ExportParametricResults (
Python Example
"ParametricSetup1", "c:/exportdir/test.csv", False)

VB Syntax ExportParametricResults <SetupName>, <FileName>, <bOutputUnits>

Optimetrics Module Script Commands 14-12


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oModule.ExportParametricResults
VB 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 IAnsoftCollectionObj – a collection of Optimetrics setup names

Python Syntax GetSetupNames()


oModule = oDesign.GetModule("Optimetrics")
Python Example setupNames = oModule.GetSetupNames()

VB Syntax GetSetupNames()
Set oModule_opt = oDesign.GetModule("Optimetrics")
VB Example Set opt_setup_list = oModule.GetSetupNames()
numsetups = setupnames.Count

GetSetupNamesByType [Optimetrics]
Gets a list of Optimetrics setup names by type.

Optimetrics Module Script Commands 14-13


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access NA

Name Type Description


Parameters
<Optimetrics type> String Examples: parametric, optimization, statistical, sensitivity

Return Value Array of Optimetrics setup names of the given type.

Python Syntax GetSetupNamesByType (<Optimetrics type>)


for name in oModule.GetSetupNamesByType("optimization")
Python Example AddInfoMessage(str(name))

VB Syntax GetSetupNamesByType <Optimetrics type>


For each name in oModule.GetSetupNamesByType("optimization")
VB Example Msgbox name
Next

ImportSetup
Import an Optimetric setup from a file.

UI Access NA

Name Type Description


Parameters
<SetupTypeName> String Must be one of "OptiParametric" , "OptiOptimization", "OptiSensitivity", "OptiS-

Optimetrics Module Script Commands 14-14


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

tatistical", or "OptiDesignExplorer".
<SetupInfo> Array Array("NAME:<SetupName>", "FilePath")
<SetupName>
Type: <string>
Name of the setup.
<FilePath>
Type : <string: file path>
Must be a valid file path and name.

Return Value None

Python Syntax ImportSetup (<SetupTypeName>, <SetupInfo>)


oModule.ImportSetup ("OptiStatistical",
["NAME:StatisticalSetup1",
Python Example
"c:/importdir/mySetupInfoFile"])

VB Syntax ImportSetup <SetupTypeName>, <SetupInfo>


oModule.ImportSetup "OptiStatistical",
Array("NAME:StatisticalSetup1",
VB Example

"c:/importdir/mySetupInfoFile")

Optimetrics Module Script Commands 14-15


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

PasteSetup [Optimetrics]
Pastes the specified Optimetrics setup.

UI Access NA

Name Type Description


Parameters
<SetupName> String Name of the Setup

Return Value None

Python Syntax PasteSetup (<SetupName>)


oModule.PasteSetup ("OptimizationSetup1")
Python Example

VB Syntax PasteSetup <SetupName>


VB Example oModule.PasteSetup "OptimizationSetup1"

RenameSetup [Optimetrics]
Renames the specified Optimetrics setup.

UI Access Right-click the setup in the project tree, and then click Rename on the shortcut menu.

Name Type Description


Parameters <OldName> String The name that needs to be replaced
<NewName> String Replacement name

Optimetrics Module Script Commands 14-16


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value None

Python Syntax RenameSetup (<OldName> <NewName>)


oModule.RenameSetup ("OptimizationSetup1" "MyOptimization")
Python Example

VB Syntax RenameSetup <OldName> <NewName>


VB Example oModule.RenameSetup "OptimizationSetup1" "MyOptimization"

SolveSetup [Optimetrics]
Solves the specified Optimetrics setup.

UI Access Right-click the setup in the project tree, and then click Analyze on the shortcut menu.

Name Type Description


Parameters
<SetupName> String Name of the setup to be solved

Return Value None

Python Syntax SolveSetup (<SetupName>)


oModule.SolveSetup ("OptimizationSetup1")
Python Example

Optimetrics Module Script Commands 14-17


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax SolveSetup <SetupName>


VB Example oModule.SolveSetup "OptimizationSetup1"

SolveAllSetup
Solves all Optimetrics setups

UI Access Right-click on Optimetrics in Project Manager and select Analyze>All from context menu

Name Type Description


Parameters
None

Return Value None

Python Syntax SolveAllSetup()


oModule.SolveAllSetup()
Python Example

VB Syntax SolveAllSetup
VB Example oModule.SolveAllSetup

Parametric Script Commands


EditSetup [Parametric]
ExportParametricSetupTable

Optimetrics Module Script Commands 14-18


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GenerateVariationData [Parametric]
InsertSetup [Parametric]
EditSetup [Parametric]
Modifies an existing parametric setup

UI Access Right-click the setup in the project tree, and then click Properties on the shortcut menu.

Name Type Description


Parameters
<SetupName> String Name of the Setup
<ParametricParams> List List that defines the parameters of the parametric setup; examples are listed
below.

Return Value None

Python Syntax EditSetup (<SetupName>, <ParametricParams>)


See EditSetup [Optimization]
Python Example

VB Syntax EditSetup <SetupName>, <ParametricParams>


VB Example See EditSetup [Optimization]

ExportParametricSetupTable
Exports the parametric setup table as a CSV file.

UI Access Double-click parametric setup. Select Table tab. Click Export.

Optimetrics Module Script Commands 14-19


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


Parameters <SetupName> String Name of the setup.
<filePath> String Full path for file export.

Return Value None

Python ExportParametricSetupTable (<SetupName>, <filePath>)


Syntax

oModule.ExportParametricSetupTable('ParametricSetup1', 'E:/Files/ParametricSetup1_
Python
Table.csv')
Example

VB Syn- ExportParametricSetupTable <SetupName>, <filePath>


tax

VB obj.ExportParametricSetupTable "ParametricSetup1", "E:/Files/ParametricSetup1_


Example Table.csv"

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>

Optimetrics Module Script Commands 14-20


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name of the setup.


VB Example:
oModule.GenerateVariationData "ParametricSetup1"
InsertSetup [Parametric]
Inserts a new parametric setup.

UI Access Right-click the Optimetrics folder in the project tree, and then click Add> Parametric on the shortcut menu.

Name Type Description


<Parametric Array Array("NAME:<SetupName>", "SaveFields:=",
Params>
<SaveField>, <StartingPoint>, "Sim. Setups:=",
<SimSetups>,
<SweepDefs>, <SweepOps>,
Array("NAME:Goals", Array("NAME:Goal",
<OptiGoalSpec>), ... Array("NAME:Goal",
Parameters <OptiGoalSpec>))
<SetupName> String Name of the parametric setup.
<SimSetups> Array of An array of Twin Builder solution setup names.
Strings
<SweepDefs> Array Array("NAME:Sweeps",
Array("NAME:SweepDefinition", "Variable:=",
<VarName>, "Data:=", <SweepData>,
"Synchronize:=", <SyncNum>), ...
Array("NAME:SweepDefinition", "Variable:=",

Optimetrics Module Script Commands 14-21


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<VarName>, "Data:=", <SweepData>,


"Synchronize:=", <SyncNum>))
<SweepData> String "<SweepType>, <StartV>, <StopV>, <StepV>"
<SweepType> String The type of sweep data.
<SyncNum> Integer SweepDatas with the same value are synchronized.
<SweepOps> Array("NAME:Sweep Operations", "<OpType>:=,
Array(<VarValue>, …, <VarValue>), ...
<OpType>:=, Array(<VarValue>, …, <VarValue>))
<OpType> String The sweep operation type.

Return Value None

Python Syntax InsertSetup ("OptiParametric", <ParametricParams>)


oModule.InsertSetup("OptiParametric",
[
"NAME:ParametricSetup1",
"SaveFields:=", true,
Python Example [
"NAME:StartingPoint"
],
"Sim. Setups:=", ["Setup1"],
[

Optimetrics Module Script Commands 14-22


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NAME:Sweeps",
[
"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",

Optimetrics Module Script Commands 14-23


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

[
"NAME:Goal",
"Solution:=", "Setup1 : LastAdaptive",
"Calculation:=", "returnloss",
"Context:=", ""
[
"NAME:Ranges",
"Range:=",
[
"Var:=", "Freq", "Type:=","s"
"Start:=", "8GHz",
"Stop:=", "8GHz"
]
],
[
"NAME:Goal",
"Solution:=", "Setup1 : LastAdaptive"
"Calculation:=", "reflect",
"Context:=", "",
[

Optimetrics Module Script Commands 14-24


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NAME:Ranges",
"Range:=",
[
"Var:=", "Freq",
"Type:=","s",
"Start:=", "8GHz",
"Stop:=", "8GHz"
]
]
]
]
]
])
Example: Parametric Setup with Harmonic Distortions
oModule.InsertSetup("OptiParametric",
[
"NAME:ParametricSetup1",
"IsEnabled:=" , True,
[
"NAME:ProdOptiSetupDataV2",
"SaveFields:=" , False,

Optimetrics Module Script Commands 14-25


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"CopyMesh:=" , False,
"SolveWithCopiedMeshOnly:=", False
],
"InterpolationPoints:=" , 0,
"HarmonicDistortionNum:=", 10,
[
"NAME:StartingPoint"
],
"Sim. Setups:=" , ["Setup1"],
[
"NAME:Sweeps"
],
[
"NAME:Sweep Operations"
],
[
"NAME:Goals"
]
])

Optimetrics Module Script Commands 14-26


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax InsertSetup "OptiParametric", <ParametricParams>


oModule.InsertSetup
"OptiParametric",
Array("NAME:ParametricSetup1", _
"SaveFields:=", true, _
Array("NAME:StartingPoint"), _
"Sim. Setups:=", Array("Setup1"),_
Array("NAME:Sweeps", _
Array("NAME:SweepDefinition", _
"Variable:=", "$width", _

VB Example "Data:=", "LIN 12mm 17mm 2.5mm", _


"OffsetF1:=", false, _
"Synchronize:=", 0),
Array("NAME:SweepDefinition", _
"Variable:=", "$length", _
"Data:=", "LIN 8mm 12mm 2mm", _
"OffsetF1:=", false, _
"Synchronize:=", 0)),
Array("NAME:Sweep Operations"), _
Array("NAME:Goals", _

Optimetrics Module Script Commands 14-27


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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")))))

Optimization Script Commands


EditSetup [Optimization]
InsertSetup [Optimization]
EditSetup [Optimization]
Modifies an existing optimization setup.

Optimetrics Module Script Commands 14-28


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access Right-click the setup in the Project Manager tree, and then click Properties from the shortcut menu

Name Type Description


Parameters <SetupName> String Name of the Setup
<OptimizationParams> List Parameters that define the setup; examples are listed below.

Return Value None

Python Syntax EditSetup (<SetupName>, <OptimizationParams>)


oModule.EditSetup("OptimizationSetup1",
[
"NAME:OptimizationSetup1",
"UseFastCalculationUpdateAlgo:=", False,
"FastCalcOptCtrledByUser:=", False,
"IsEnabled:=", True,
"SaveSolutions:=", False,
Python Example
[
"NAME:StartingPoint"
],
"Optimizer:=", "Quasi Newton",
[
"NAME:AnalysisStopOptions",
"StopForNumIteration:=" , True,

Optimetrics Module Script Commands 14-29


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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",

Optimetrics Module Script Commands 14-30


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

[
"NAME:Goal",
"ReportType:=", "Standard",
"Solution:=", "TR",
[
"NAME:SimValueContext",
"SimValueContext:=", [1,0,2,0,False,False,-1,1,0,1,1,"",0,0
]
],
"Calculation:=", "acosh(Time)",
"Name:=", "Time",
[
"NAME:Ranges",
"Range:=", ["Var:=", "Time","Type:=", "a"]
],
"Condition:=", "==",
[
"NAME:GoalValue",
"GoalValueType:=", "Independent",
"Format:=", "Real/Imag",
"bG:=", ["v:=", "[1;]"]

Optimetrics Module Script Commands 14-31


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

],
"Weight:=", "[1;]"
],
"Acceptable_Cost:=" , 0,
"Noise:=", 0.0001,
"UpdateDesign:=", False,
"UpdateIteration:=", 5,
"KeepReportAxis:=", True,
"UpdateDesignWhenDone:=", True
])

Example with Harmonic Distortions


oModule.EditSetup("ParametricSetup1",
[
"NAME:ParametricSetup1",
"IsEnabled:=" , True,
[
"NAME:ProdOptiSetupDataV2",
"SaveFields:=" , False,
"CopyMesh:=" , False,
"SolveWithCopiedMeshOnly:=", False

Optimetrics Module Script Commands 14-32


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

],
"InterpolationPoints:=" , 0,
"HarmonicDistortionNum:=", 12,
[
"NAME:StartingPoint"
],
"Sim. Setups:=" , ["Setup1"],
[
"NAME:Sweeps"
],
[
"NAME:Sweep Operations"
],
[
"NAME:Goals"
]
])

VB Syntax EditSetup <SetupName>, <OptimizationParams>


oModule.EditSetup "OptimizationSetup1",
VB Example
Array("NAME:OptimizationSetup1", "UseFastCalculationUpdateAlgo:=", _

Optimetrics Module Script Commands 14-33


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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:=", _
true, Array("NAME:Variables"), Array("NAME:LCS"),
Array("NAME:Goals", Array("NAME:Goal", "ReportType:=", _
"Standard", "Solution:=", "TR", Array("NAME:SimValueContext",
"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:=", _

Optimetrics Module Script Commands 14-34


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Real/Imag", "bG:=", Array("v:=", "[1;]")),


"Weight:=", "[1;]")), "Acceptable_Cost:=", _
0, "Noise:=", 0.0001, "UpdateDesign:=", false,
"UpdateIteration:=", 5, "KeepReportAxis:=", _
true, "UpdateDesignWhenDone:=", true)

InsertSetup [Optimization]
Use: Inserts a new optimization setup.

UI Access Right-click the Optimetrics folder in the project tree, and then click Add > Optimization on the shortcut menu.

Name Type Description


<OptimizationParams> Array Array("NAME:<SetupName>", "SaveFields:=",
<SaveField>, <StartingPoint>, "Optimizer:=",
<Optimizer>,
"MaxIterations:=", <MaxIter>, "PriorPSetup:=",
<PriorSetup>, "PreSolvePSetup:=", <Preceed>,

Parameters <OptimizationVars>, <Constraint>,


Array("NAME:Goals", Array("NAME:Goal",
<OptiGoalSpec>, <OptimizationGoalSpec>), ...
Array("NAME:Goal", <OptiGoalSpec>,
<OptimizationGoalSpec>)),
"Acceptable_Cost:=", <AcceptableCost>, "Noise:=",
<Noise>, "UpdateDesignWhenDone:=", <UpdateDesign>

Optimetrics Module Script Commands 14-35


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<OptimizationVars> Array Array("NAME:Variables", "VarName:=", Array("i:=",


<IncludeVar>, "Min:=", <MinV>, "Max:=", <MaxV>,
"MinStep:=", <MinStepV>, "MaxStep:=", <MaxStepV>),
………………. "VarName:=", Array("i:=", <IncludeVar>,
"Min:=", <MinV>, "Max:=", <MaxV>,
"MinStep:=", <MinStepV>, "MaxStep:=", <MaxStepV>))
<MinStepV> VarValue The minimum step of the variable.
<MaxStepV> VarValue The maximum step of the variable.
<AcceptableCost> Double The acceptable cost value for the optimizer to stop.
<Noise> Double The noise of the design.
<UpdateDesign> Boolean Specifies whether or not to apply the optimal variation to the design after
the optimization is done.
<OptimizationGoalSpec> Array "Condition:=", <OptimizationCond>,
Array("NAME:GoalValue", "GoalValeType:=",
<GoalValueType>,
"Format:=", <GoalValueFormat>, "bG:=",
Array("v:=", <GoalValue>)), "Weight:=", <Weight>)
<OptimizationCond> String Either "<=", "==", or ">="
<GoalValueType> String Either "Independent" or "Dependent"
<GoalValueFormat> String Either "Real/Imag" or "Mag/Ang".
<GoalValue> String Value in string. Value can be a real number, complex number, or expres-
sion.

Return Value None

Optimetrics Module Script Commands 14-36


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<MinStepV>
Type : <VarValue>
The minimum step of the variable.
<MaxStepV>
Type: <VarValue>
The maximum step of the variable.
<AcceptableCost>
Type: <double>
The acceptable cost value for the optimizer to stop.
<Noise>
Type: <double>
The noise of the design.
<UpdateDesign>
Type: <bool>
Specifies whether or not to apply the optimal variation to the design after the optimization is done.
<OptimizationGoalSpec>
"Condition:=", <OptimizationCond>,
Array("NAME:GoalValue", "GoalValueType:=",
<GoalValueType>,
"Format:=", <GoalValueFormat>, "bG:=",
Array("v:=", <GoalValue>)), "Weight:=", <Weight>)

Optimetrics Module Script Commands 14-37


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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.

Python Syntax InsertSetup ("OptiOptimization", <OptimizationParams>)


oModule.InsertSetup("OptiOptimization",
["NAME:OptimizationSetup1",
"SaveFields:=", false, _
Python Example
["NAME:StartingPoint", "$length:=", "8mm",
"$width:=", "14.5mm"],
"Optimizer:=", "Quasi Newton",

Optimetrics Module Script Commands 14-38


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"MaxIterations:=", 100,
"PriorPSetup:=", "ParametricSetup1",
"PreSolvePSetup:=", true,
["NAME:Variables",
"$length:=", ["i:=", true, "Min:=", "6mm",
"Max:=", "18mm",
"MinStep:=", "0.001mm", "MaxStep:=",
"1.2mm"],
"$width:=", ["i:=", true, "Min:=",
"6.5mm", "Max:=", "19.5mm",
"MinStep:=", "0.001mm", "MaxStep:=",
"1.3mm"]],
["NAME:LCS"],
["NAME:Goals",
["NAME:Goal",
"Solution:=", "Setup1 : LastAdaptive",
"Calculation:=", "reflect",
"Context:=", "",
["NAME:Ranges",
"Range:=", ["Var:=", "Freq",

Optimetrics Module Script Commands 14-39


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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>


oModule.InsertSetup
VB Example
"OptiOptimization",_

Optimetrics Module Script Commands 14-40


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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", _

Optimetrics Module Script Commands 14-41


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Solution:=", "Setup1 : LastAdaptive", _


"Calculation:=", "reflect", _
"Context:=", "", _
Array("NAME:Ranges", _
"Range:=", Array("Var:=", "Freq", _
"Type:=", "s", _
"Start:=", "8GHz", "Stop:=", "8GHz")), _
"Condition:=", "&lt;=", _
Array("NAME:GoalValue", _
"GoalValueType:=", "Independent", _
"Format:=", "Real/Imag", _
"bG:=", Array("v:=", "[0.0001]")), _
"Weight:=", "[1]")),
"Acceptable_Cost:=", 0.0002, _
"Noise:=", 0.0001, _
"UpdateDesign:=", true, _
"UpdateIteration:=", 5, _
"KeepReportAxis:=", true, _
"UpdateDesignWhenDone:=", true)

Optimetrics Module Script Commands 14-42


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Sensitivity Script Commands


EditSetup [Sensitivity]
InsertSetup [Sensitivity]
EditSetup [Sensitivity]
Modifies an existing sensitivity setup.

UI Access Right-click the setup in the project tree, and then click Properties on the shortcut menu

Name Type Description


Parameters <SetupName> String Name of the Setup

Return Value None

Python Syntax EditSetup (<SetupName>, <SensitivityParams>)


oModule.EditSetup("OptimizationSetup1",
[
"NAME:OptimizationSetup1",
"UseFastCalculationUpdateAlgo:=", False,
Python Example
"FastCalcOptCtrledByUser:=", False,
"IsEnabled:=", True,
"SaveSolutions:=", False,
[

Optimetrics Module Script Commands 14-43


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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"

Optimetrics Module Script Commands 14-44


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

],
[
"NAME:LCS"
],
[
"NAME:Goals",
[
"NAME:Goal",
"ReportType:=", "Standard",
"Solution:=", "TR3",
[
"NAME:SimValueContext",
"SimValueContext:=", [1,0,2,0,False,False,-1,1,0,1,1,"",0,0]
],
"Calculation:=", "mag(DIFF1.VAL)",
"Name:=", "DIFF1.VAL",
[
"NAME:Ranges",
"Range:=", [
"Var:=", "Time","Type:=", "a"]
],

Optimetrics Module Script Commands 14-45


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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 Syntax EditSetup <SetupName>, <SensitivityParams>

Optimetrics Module Script Commands 14-46


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oModule.EditSetup("OptimizationSetup1",
Array(
"NAME:OptimizationSetup1",
"UseFastCalculationUpdateAlgo:=", False,
"FastCalcOptCtrledByUser:=", False,
"IsEnabled:=", True,
"SaveSolutions:=", False,
Array(
"NAME:StartingPoint"
),

VB Example "Optimizer:=", "Quasi Newton",


Array(
"NAME:AnalysisStopOptions",
"StopForNumIteration:=" , True,
"StopForElapsTime:=", False,
"StopForSlowImprovement:=", False,
"StopForGrdTolerance:=", False,
"MaxNumIteration:=", 1001,
"MaxSolTimeInSec:=", 3600,
"RelGradientTolerance:=", 0,
"MinNumIteration:=" , 10

Optimetrics Module Script Commands 14-47


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

),
"CostFuncNormType:=", "L2",
"PriorPSetup:=", "",
"PreSolvePSetup:=", True,
Array(
"NAME:Variables"
),
Array(
"NAME:LCS"
),
Array(
"NAME:Goals",
Array(
"NAME:Goal",
"ReportType:=", "Standard",
"Solution:=", "TR3",
Array(
"NAME:SimValueContext",
"SimValueContext:=",

Optimetrics Module Script Commands 14-48


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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",
"bG:=", Array("v:=", "Array(1;]")
),
"Weight:=", "Array(1;]"
)
),
"Acceptable_Cost:=", 0,
"Noise:=", 0.0001,
"UpdateDesign:=", False,

Optimetrics Module Script Commands 14-49


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"UpdateIteration:=", 5,
"KeepReportAxis:=", True,
"UpdateDesignWhenDone:=", True
))

InsertSetup [Sensitivity]
Inserts a new sensitivity setup.

UI Access Right-click Optimetrics in the project tree, and then click Add>Sensitivity on the shortcut menu.

Name Type Description


<SensitivityParams> Array Array("NAME:<SetupName>", "SaveFields:=",
<SaveField>, <StartingPoint>, "MaxIterations:=",
<MaxIter>, "PriorPSetup:=", <PriorSetup>,
"PreSolvePSetup:=", <Preceed>, <SensitivityVars>,
<Constraint>,
Parameters Array("NAME:Goals", Array("NAME:Goal",
<OptiGoalSpec>), ..., Array("NAME:Goal",
<OptiGoalSpec>)), "Primary Goal:=". <PrimaryGoalID>,
"PrimaryError:=", <PrimaryError>)
<SensitivityVars> Array Array("NAME:Variables",
"VarName:=", Array("i:=", <IncludeVar>,
"Min:=", <MinV>, "Max:=", <MaxV>,

Optimetrics Module Script Commands 14-50


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"IDisp:=", <InitialDisp>),...
"VarName:=", Array("i:=", <IncludeVar>,
"Min:=", <MinV>, "Max:=", <MaxV>,
"IDisp:=", <InitialDisp>))
<InitialDisp> VarValue Index of the Primary goal. Index starts from zero.
<PrimaryError> Double Error associated with the Primary goal.

Return Value None

Python Syntax InsertSetup ("OptiSensitivity", <SensitivityParams>)


oModule.InsertSetup(
"OptiSensitivity", _
["NAME:SensitivitySetup1",_
"SaveFields:=", true,_
["NAME:StartingPoint"], _
"MaxIterations:=", 20,_
Python Example
"PriorPSetup:=", "",_
"PreSolvePSetup:=", true, _
["NAME:Variables"], _
["NAME:LCS"],_
"NAME:Goals",_
["NAME:Goal", _

Optimetrics Module Script Commands 14-51


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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"]]]],_
"Primary Goal:=", 1,_
"PrimaryError:=", 0.001])

VB Syntax InsertSetup "OptiSensitivity", <SensitivityParams>

Optimetrics Module Script Commands 14-52


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oModule.InsertSetup
"OptiSensitivity", _
Array("NAME:SensitivitySetup1",_
"SaveFields:=", true,_
Array("NAME:StartingPoint"), _
"MaxIterations:=", 20,_
"PriorPSetup:=", "",_
"PreSolvePSetup:=", true, _
Array("NAME:Variables"), _
Array("NAME:LCS"),_

VB Example 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",_

Optimetrics Module Script Commands 14-53


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Calculation:=", "reflect",_
"Context:=", "",_
Array("NAME:Ranges",_
"Range:=", Array("Var:=","Freq",_
"Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz")))),_
"Primary Goal:=", 1,_
"PrimaryError:=", 0.001)

Statistical Script Commands


EditSetup [Statistical]
InsertSetup Statistical
EditSetup [Statistical]
Modifies an existing statistical setup.

UI Access Right-click the setup in the project tree, and clickProperties on the shortcut menu.

Name Type Description


Parameters <SetupName> String Name of the Setup

Return Value None

Optimetrics Module Script Commands 14-54


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax EditSetup (<SetupName>, <StatisticalParams>)


Python Example See EditSetup [Optimization]

VB Syntax EditSetup <SetupName>, <StatisticalParams>


VB Example See EditSetup [Optimization]

Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("optiguides")
Set oDesign = oProject.SetActiveDesign("HFSSModel1")
Set oModule = oDesign.GetModule("Optimetrics")
oModule.EditSetup "StatisticalSetup1", Array("NAME:StatisticalSetup1",
Array("NAME:ProdOptiSetupData",

Optimetrics Module Script Commands 14-55


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"SaveFields:=", true, "CopyMesh:=", false),


Array("NAME:StartingPoint", "$length:=", "7.824547736mm",
"$width:=", "14.8570192mm"),
"MaxIterations:=", 50,
"PriorPSetup:=", "",
Array("NAME:Variables",
"$length:=", Array("i:=", true,
"int:=", false,
"Dist:=", "Uniform",
"Tol:=", "10%", "StdD:=", "0.2mm", "Min:=", "-3",
"Max:=", "3", "Shape:=", "1", "Scale:=", "0.04mm",
"Location:=", "0.4mm",
"Dataset:=", "", "LatinHypercube:=", "true", "VarMin:=", "0.2mm", "VarMax:=", "0.6mm", "Prob:=",
"0.01",
"Mean:=", "0.4mm"),
"$width:=", Array("i:=", true,
"int:=", false,
"Dist:=", "Gaussian",
"Tol:=", "10%",
"StdD:=", "0.2mm",
"Min:=", "-3", "Max:=", "3",
"Shape:=", "1",
"Scale:=", "0.04mm",
"Location:=", "0.4mm",
"Dataset:=", "",
"LatinHypercube:=", "true",
"VarMin:=", "0.2mm", "VarMax:=", "0.6mm",
"Prob:=", "0.02",
"Mean:=", "0.4mm")),

Array("NAME:Goals", Array("NAME:Goal",
"ReportType:=", "Modal Solution Data",

Optimetrics Module Script Commands 14-56


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Solution:=", "Setup1 : PortOnly",


Array("NAME:SimValueContext", "Domain:=", "Sweep"),
"Calculation:=", "returnloss",
"Name:=", "returnloss",
Array("NAME:Ranges",
"Range:=", Array("Var:=", "Freq",
"Type:=", "s",
"Start:=", "8.2GHz", "Stop:=", "0"))),

Array("NAME:Goal",
"ReportType:=", "Modal Solution Data",
"Solution:=", "Setup1 : PortOnly",
Array("NAME:SimValueContext",
"Domain:=", "Sweep"),
"Calculation:=", "reflect",
"Name:=", "reflect",
Array("NAME:Ranges",
"Range:=", Array("Var:=", "Freq",
"Type:=", "s",
"Start:=", "8.2GHz", "Stop:=", "0")))))
InsertSetup [Statistical]
Inserts a new statistical setup.

UI Access Right-click Optimetrics in the project tree, and then click Add>Statistical on the shortcut menu.

Name Type Description


<StatisticalParams> Array Array("NAME:<SetupName>", "SaveFields:=",

Parameters <SaveField>, <StartingPoint>, "MaxIterations:=",


<MaxIter>, "PriorPSetup:=", <PriorSetup>,
"PreSolvePSetup:=", <Preceed>, <StatisticalVars>,

Optimetrics Module Script Commands 14-57


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:Goals", Array("NAME:Goal",
<OptiGoalSpec>), …, Array("NAME:Goal",
<OptiGoalSpec>)))
<StatisticalVars> Array Array("NAME:Variables",
"VarName:=", Array("i:=", <IncludeVar>, "Dist:=",
<DistType>, "Tol:=", <Tolerance>,
"StdD:=", <StdD>, "Min:=", <MinCutoff>, "Max:=",
<MaxCutoff>, ...
"VarName:=", Array("i:=", <IncludeVar>, "Dist:=",
<DistType>, "Tol:=", <Tolerance>, "StdD:=",
<StdD>, "Min:=", <MinCutoff>, "Max:=",
<MaxCutoff>))
<DistType> String Distrbution can be "Gaussian" or "Uniform".
<Tolerance> VarValue The tolerance for the variable when distribution is Uniform
<StdD> VarValue The standard deviation for the variable when distribution is Gaussian.
<MinCutoff> Double The minimum cut-off for the variable when distribution is Gaussian.
<MaxCutoff> Double The maximum cut-off for the variable when distribution is Gaussian.

Return Value None

Python Syntax InsertSetup ("OptiStatistical", <StatisticalParams>)


Python Example oModule.InsertSetup(

Optimetrics Module Script Commands 14-58


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"OptiStatistical", _
["NAME:StatisticalSetup1", _
"SaveFields:=", true, _
["NAME:StartingPoint"],_
"MaxIterations:=", 50,_
"PriorPSetup:=", "", _
["NAME:Variables"], _
["NAME:Goals", _
["NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "returnloss", _
"Context:=", "", _
["NAME:Ranges", _
"Range:=", ["Var:=", "Freq", _
"Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz"]]],_
["NAME:Goal",_
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect",_
"Context:=", "", _

Optimetrics Module Script Commands 14-59


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["NAME:Ranges",_
"Range:=", ["Var:=", "Freq", "Type:=",_
"s", "Start:=", "8GHz", "Stop:=", "8GHz"]]]])

VB Syntax InsertSetup "OptiStatistical", <StatisticalParams>


oModule.InsertSetup
"OptiStatistical", _
Array("NAME:StatisticalSetup1", _
"SaveFields:=", true, _
Array("NAME:StartingPoint"),_
"MaxIterations:=", 50,_
"PriorPSetup:=", "", _
VB Example
Array("NAME:Variables"), _
Array("NAME:Goals", _
Array("NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "returnloss", _
"Context:=", "", _
Array("NAME:Ranges", _

Optimetrics Module Script Commands 14-60


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Range:=", Array("Var:=", "Freq", _


"Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz"))),_
Array("NAME:Goal",_
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect",_
"Context:=", "", _
Array("NAME:Ranges",_
"Range:=", Array("Var:=", "Freq", "Type:=",_
"s", "Start:=", "8GHz", "Stop:=", "8GHz"))))

Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()

Optimetrics Module Script Commands 14-61


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
oDesign.ChangeProperty Array("NAME:AllTabs",
Array("NAME:LocalVariableTab",
Array("NAME:PropServers", "LocalVariables"),
Array("NAME:ChangedProps",
Array("NAME:offset",
Array("NAME:Statistical", "Included:=", true)))))
Set oModule = oDesign.GetModule("Optimetrics")
oModule.InsertSetup "OptiStatistical", Array("NAME:StatisticalSetup1",
Array("NAME:ProdOptiSetupData",
"SaveFields:=", false, "CopyMesh:=", false),
Array("NAME:StartingPoint", "offset:=", "0in"),
"MaxIterations:=", 50, "PriorPSetup:=", "",
Array("NAME:Variables",
"offset:=", Array("i:=", true,
"int:=", false,
"Dist:=", "Gaussian",
"Tol:=", "10%",
"StdD:=", ".5in",
"Min:=", "-3",
"Max:=", "3",
"Shape:=", "1",
"Scale:=", "0in",
"Location:=", "0in",
"Dataset:=", "",
"LatinHypercube:=", "true",
"VarMin:=", "-1in",

Optimetrics Module Script Commands 14-62


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"VarMax:=", "1in",
"Prob:=", "0.01",
"Mean:=", "0in")),

Array("NAME:Goals", Array("NAME:Goal",
"ReportType:=", "Modal Solution Data",
"Solution:=", "Setup1 : LastAdaptive", Array("NAME:SimValueContext"),
"Calculation:=", "Power11",
"Name:=", "Power11",
Array("NAME:Ranges",
"Range:=", Array("Var:=", "Freq", "Type:=", "d",
"DiscreteValues:=", "10GHz")))))

For Q3D Extractor and Circuit the command details are as follows:
Inserts a new statistical setup.
Command: Right-click Optimetrics in the project tree, and then click Add>Statistical on the shortcut menu.
Syntax: InsertSetup "OptiStatistical", <StatisticalParams>
Return Value: None
Parameters: <StatisticalParams>
Array("NAME:<SetupName>", "SaveFields:=",
<SaveField>, <StartingPoint>, "MaxIterations:=",
<MaxIter>, "PriorPSetup:=", <PriorSetup>,
"PreSolvePSetup:=", <Preceed>, <StatisticalVars>,
Array("NAME:Goals", Array("NAME:Goal",
<OptiGoalSpec>), …, Array("NAME:Goal",

Optimetrics Module Script Commands 14-63


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<OptiGoalSpec>))),
<StatisticalVars>
Array("NAME:Variables",
"VarName:=", Array("i:=", <IncludeVar>, "Dist:=",
<DistType>, "Tol:=", <Tolerance>,
"StdD:=", <StdD>, "Min:=", <MinCutoff>, "Max:=",
<MaxCutoff>, ...
"VarName:=", Array("i:=", <IncludeVar>, "Dist:=",
<DistType>, "Tol:=", <Tolerance>, "StdD:=",
<StdD>, "Min:=", <MinCutoff>, "Max:=",
<MaxCutoff>))
Parameters:
<DistType>
Type : <string>
Distrbution can be "Gaussian" or "Uniform".
<Tolerance>
Type: <VarValue>
The tolerance for the variable when distribution is Uniform.
<StdD>
Type: <VarValue>

Optimetrics Module Script Commands 14-64


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

The standard deviation for the variable when distribution is Gaussian.


<MinCutoff>
Type: <double>
The minimum cut-off for the variable when distribution is Gaussian.
<MaxCutoff>
Type: <double>
The maximum cut-off for the variable when distribution is Gaussian.
Example: oModule.InsertSetup "OptiStatistical", _
Array("NAME:StatisticalSetup1", _
"SaveFields:=", true, _
Array("NAME:StartingPoint"),_
"MaxIterations:=", 50,_
"PriorPSetup:=", "", _
Array("NAME:Variables"), _
Array("NAME:Goals", _
Array("NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "returnloss", _
"Context:=", "", _
Array("NAME:Ranges", _
"Range:=", Array("Var:=", "Freq", _

Optimetrics Module Script Commands 14-65


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz"))),_
Array("NAME:Goal",_
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect",_
"Context:=", "", _
Array("NAME:Ranges",_
"Range:=", Array("Var:=", "Freq", "Type:=", _
"s", "Start:=", "8GHz", "Stop:=", "8GHz"))))

Optimetrics Module Script Commands 14-66


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

15 - Solutions Module Script Commands


Solutions commands should be executed by the "Solutions" module.
Set oModule = oDesign.GetModule("Solutions")
oModule.CommandName <args>
DeleteSolutionVariation
ExportNetworkData
GetAvailableVariations
GetValidISolutionList
TDROnReport

DeleteSolutionVariation
Deletes all solution data for specific solutions and design variations. This is obsolete and is supported only for backward compatibility.
You should use DeleteFullVariation. See also DeleteVariation.

UI Access Right-click on Results, select Browse Solutions..., click Delete button in the dialog.

Name Type Description


<SoluParams> Array Structured array.
Array(<DataSpecifierArray>, ...)
Parameters
<DataSpecifierArray> Array Structured array.
Array(<DesignVariationKey>, <SetupName>, <Sol-
nName>)

Return Value None.

Solutions Module Script Commands 15-1


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax DeleteSolutionVariation(<SoluParams>)


oModule.DeleteSolutionVariation([
["width=’2in’", "Setup1", "Adaptive_1"],
Python Example
["width=’2in’", "Setup1", "Sweep1"]
])

VB Syntax DeleteSolutionVariation <SoluParams>


oModule.DeleteSolutionVariation Array( _
VB Example Array("width=’2in’", "Setup1", "Adaptive_1"), _
Array("width=’2in’", "Setup1", "Sweep1"))

GetValidISolutionList
Gets all available solution names that exist in a design.

UI Access N/A

Name Type Description


Parameters <IncludeImportedSolutions> Boolean Optional. Specifies whether to include imported solutions. Default is
false.

Return Value Array of strings containing solution names.

Solutions Module Script Commands 15-2


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetValidISolutionList([Optional <IncludeImportedSolutions>])


Python Example oModule.GetValidISolutionList()

VB Syntax GetValidISolutionList [Optional <IncludeImportedSolutions>]


VB Example oModule.GetValidISolutionList

Solutions Module Script Commands 15-3


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

15-4
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

16 - Field Overlays Module Script Commands


Field overlay commands should be executed by the Field Overlays module, which is called "FieldsReporter" in scripts.
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.CommandName <args>

AddMarkerToPlot
AddNamedExpr
CreateFieldPlot
DeleteFieldPlot
EditSurfaceMeshSummaryData
ExportMarkerTable
ExportPlotImageWithViewToFile
ExportSurfaceMeshSummary
GetFieldPlotName
ModifyFieldPlot
ModifyInceptionParameters
RenameFieldPlot
RenamePlotFolder
SetFieldPlotSettings
SetPlotFolderSettings

Field Overlays Module Script Commands 16-1


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

SetPlotsSolutionsContext
SetPlotsViewSolutionContext
UpdateAllFieldsPlots
UpdateQuantityFieldsPlots

AddMarkerToPlot
Adds a marker to a trace on a named field plot.

UI Access N/A

Name Type Description


Parameters <Location> Array Array of strings containing X.Y, and Z coordinates for the marker.
<PlotName> String Name of the field plot.

Return Value None.

Python Syntax AddMarkerToPlot( <Location>, <PlotName>)


oModule.AddMarkerToPlot
(["0.290455877780914in", "-0.616900205612183in",
"1.77635683940025e-015in"],
Python Example
"Mag_H1")
oModule.AddMarkerToPlot
(["-0.317279517650604in",

Field Overlays Module Script Commands 16-2


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"1.22481322288513in", "0in"],
"Mag_H1")

VB Syntax AddMarkerToPlot <Location>, <PlotName>


oModule.AddMarkerToPlot _
Array("0.290455877780914in", _
"-0.616900205612183in", "1.77635683940025e-015in"), _
"Mag_E1"
VB Example
oModule.AddMarkerToPlot _
Array("-0.317279517650604in", _
"1.22481322288513in", "0in"), _
"Mag_E1"

Field Overlays Module Script Commands 16-3


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

CreateFieldPlot

Note: Use in conjunction with GetGeometryIdsForNetLayerCombinations and GetGeo-


metryIdsForAllNetLayerCombinations.

l
GetGeometryIdsForNetLayerCombinations returns ID numbers of all faces and edges of the active design related to
the current target combination of nets and layers.

l
GetGeometryIdsForAllNetLayerCombinations returns ID numbers for all possible combinations of nets and layers it
is possible to choose.

Use: Creates a field/mesh plot "Field" or a visual ray trace ("VRT") plot.
Command: HFSS>Fields>Plot Fields><field_quantity>
Command: Maxwell3D or Maxwell2D>Fields>Fields><field_quantity>
Command: Maxwell3D>Fields>Fields>Field Line Trace (for 3D Electrostatic designs - see Examples below)
Command:Icepak>Fields>Plot Fields><field_quantity>
Syntax: CreateFieldPlot <PlotParameterArray> ["Field" | "VRT"]
Return Value: None
Parameters: <PlotParameterArray> "Field"
Array("NAME:<PlotName>",
"SolutionName:=", <string>,
"QuantityName:=", <string>,

Field Overlays Module Script Commands 16-4


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"PlotFolder:=", <string>,
"UserSpecifyName:=", <int>,
"UserSpecifyFolder:=", <int>,
"IntrinsicVar:=", <string>,
"PlotGeomInfo:=", <PlotGeomArray>,
"FilterBoxes:=", <FilterBoxArray>,
<PlotOnPointsSettings>,
<PlotOnLineSettings>,
<PlotOnSurfaceSettings>,
<PlotOnVolumeSettings>)

SolutionName
Name of the solution setup and solution formatted as:
"<SolveSetupName>: <WhichSolution>",
where <WhichSolution> can be "Adaptive_<n>",
"LastAdaptive", or "PortOnly".
For example: "Setup1 : Adaptive_2"
HFSS and Maxwell require 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 include:

Field Overlays Module Script Commands 16-5


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Mesh plots: "Mesh"


Field plots (HFSS) include:
"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"
Field plots (Maxwell) include:
"Mag_E", "Mag_H", "E_Vector", "H_Vector", "Mag_J", "J_Vector",
"ComplexMag_J", "Mag_Jc", "Jc_Vector", "ComplexMag_Jc",
"Energy", "coEnergy", "appEnergy","Ohmic_Loss", "Total_Loss",
""Hysteresis_Loss", Dielectric_Loss", "Temperature", "Volume_Force_Density", Average_Sur-
face_Loss_Density
"Surface_Force_Density", "Demag_Coef", "QuantityName_FieldLineTrace", "Surface_Loss_Dens-
ity", QSurf
Field plots (Mechanical) include - (dependent on solution type):
"Mag_Displacement", "Displacement_Vector", "Temperature", "HeatFlux",
"Mag_HeatFlux", "Surface Loss Density", "Volume Loss Density",
"Linked Heat Transfer Coefficient", "Equivalent Stress"

PlotFolder

Field Overlays Module Script Commands 16-6


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name of the folder to which the plot should be added. (Values vary with the design type.) Some
possible values include:
"E Field", "H Field", "Jvol", "Jsurf", "SAR Field", "Jc", "Surface-Loss", QSurf, Tem-
perature, Energy, Average-Surface-Loss-Density, "Dielectric_Loss", "MeshPlots", "Heat Flux", and
"Displacement".

UserSpecifyName
0 if default name for plot is used, 1 otherwise.
Not needed. <PlotName> will be respected regardless of whether
thisflag is set.

UserSpecifyFolder
0 if default folder for plot is used, 1 otherwise.
Not needed. The specified PlotFolder will be respected regardless
of whether this flag is set.

IntrinsicVar
Formatted string that specifies the frequency and phase at which to make the plot.
For example: "Freq='1GHz' Phase='30deg'"

IntrinsicVar (Maxwell)
Formatted string that specifies the skew slice number at which to make the plot.
For example: "IntrinsicVar:=" , "Slice=\'2\' Time=\'0.00020000000000000001s\'"

Field Overlays Module Script Commands 16-7


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

PlotGeomInfo
Creating field plot on selected layer-net pairs:
For example, Maxwell: "PlotGeomInfo :=" , [1,"Volume","ObjList",2,"LC1_1:Top","LC1_1:Top#L1"]
HFSS example with "Plot on surface" option is not checked
"PlotGeomInfo:=" , [1,"Volume","LayerNets",2,​ "Top",2,"net1","net2",_
"Ground",1,"GND"]
The command creates field plot on 2 layer-nets combinations. It starts with type "Volume", and subtype "LayerNets", fol-
lowed by the number of layer-nets combinations which is 2 in this example.
The two layer-nets combinations are (1) "Top" layer, 2 nets, net names are "net1" and "net2", i.e., [Top, net1] pair, and [Top,
net2] pair. (2) "Ground" layer and 1 net, net name is "GND", i.e., [Ground, GND] pair.
HFSS example with "Plot on surface" option is checked
"PlotGeomInfo:=" , [1,"Surface","LayerNetsExtFace",2,"Top",2,"net1","net2",_
"Ground",1,"GND"],
​The command creates field plot on 2 layer-nets combinations. It starts with type "Surface", and subtype "Lay-
erNetsExtFace", followed by the number of layer-nets combinations which is 2 in this example.
The two layer-nets combinations are (1) "Top" layer, 2 nets, net names are "net1" and "net2", i.e., [Top, net1] pair, and [Top,
net2] pair. (2) "Ground" layer and 1 net, net name is "GND", i.e., [Ground, GND] pair.
Limitation:
No Layer/Nets name is supported for field plot command recording
Should be able to add it based on this change.
No Layer/Nets name support for pure Layout design field plot command.
=======

Field Overlays Module Script Commands 16-8


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

PlotGeomInfo (Maxwell)
For example: "PlotGeomInfo :=" , [1,"Volume","ObjList",2,"LC1_1:Top","LC1_1:Top#L1"]

>>>>>>> a6f178b1c03cf1dde1d916fb666faa1c78256640 =======


PlotGeomInfo (Maxwell)
For example: "PlotGeomInfo :=" , [1,"Volume","ObjList",2,"LC1_1:Top","LC1_1:Top#L1"]

>>>>>>> a6f178b1c03cf1dde1d916fb666faa1c78256640
<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>, ...)

Field Overlays Module Script Commands 16-9


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<GeomType>
Type: <string>
Possible values are "Volume", "Surface", "Line", "Point".

<ListType>
Type: <string>
Possible values are "ObjList", or "FacesList".
These are used for the GeomType of "Line" or "Point".

<NumIDs>
Type: <int>
Number of IDs or object names that will follow.

<ID>
Type: <int> or <string>
ID of a face or name of an object, line, or point on which to plot.

<FilterBoxArray>
Array of names of objects to use to restrict the plot range.

Field Overlays Module Script Commands 16-10


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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"

Field Overlays Module Script Commands 16-11


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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

Field Overlays Module Script Commands 16-12


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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>)

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"),_

Field Overlays Module Script Commands 16-13


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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)))

Example Demag_Coef Field Plot:


oModule.CreateFieldPlot Array("NAME:Demag_Coef2", "SolutionName:=", _
"Setup1 : Transient", "UserSpecifyName:=", 0, "UserSpecifyFolder:=", 0, _
"QuantityName:=", "Demag_Coef", "PlotFolder:=", "Demag-Coef", "StreamlinePlot:=", _
false, "AdjacentSidePlot:=", false, "FullModelPlot:=", false, "IntrinsicVar:=", _
"Time=" & Chr(39) & "0s" & Chr(39) & "", "PlotGeomInfo:=", Array( 1, _
"Volume", "ObjList", 1, "Mag2_0"), "FilterBoxes:=", Array(1, "Mag1_0"), _
Array("NAME:PlotOnVolumeSettings", "PlotIsoSurface:=", true, "PointSize:=", 1, _

Field Overlays Module Script Commands 16-14


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Refinement:=", 0, "CloudSpacing:=", 0.5, "CloudMinSpacing:=", -1, _


"CloudMaxSpacing:=", -1, Array( "NAME:Arrow3DSpacingSettings", "ArrowUniform:=", _
true, "ArrowSpacing:=", 0, "MinArrowSpacing:=", 0, "MaxArrowSpacing:=", 0)), _
"EnableGaussianSmoothing:=", false), "Field"

Parameters: <PlotParameterArray> "VRT"


Array("NAME:<PlotName>",
"SolutionName:=", <string>,
"QuantityName:=", <string>,
"PlotFolder:=", <string>,
"UserSpecifyName:=", <int>,
"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>, |_

Field Overlays Module Script Commands 16-15


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"index step:=", <int> "Rays in box", "FilterBoxID:=", <objID> | _


"Single ray", "Ray elevation:=", "<real>deg", "Ray azimuth:=", "<real>deg"
"),
"VRT"

Example VRT Plot:


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:VRT_Plot1", _
"SolutionName:=", "Setup1 : LastAdaptive", _

Field Overlays Module Script Commands 16-16


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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 divisions:=", 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, _

Field Overlays Module Script Commands 16-17


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"AddGrid:=", false, _
"MapTransparency:=", true, _
"Transparency:=", 0, _
"ArrowUniform:=", true, _
"ArrowSpacing:=", 0.100000001490116, _
"GridColor:=", Array(255, 255, 255))), "Field"

Example Electron Density Plot


oModule = oDesign.GetModule("FieldsReporter")
oModule.CreateFieldPlot(
[
"NAME:Electron_Density3",
"SolutionName:=" , "AIR : RFDischarge",
"UserSpecifyName:=" , 0,
"UserSpecifyFolder:=" , 0,
"QuantityName:=" , "Electron_Density",
"PlotFolder:=" , "RF Discharge Fields",
"StreamlinePlot:=" , False,
"AdjacentSidePlot:=" , False,
"FullModelPlot:=" , False,

Field Overlays Module Script Commands 16-18


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"IntrinsicVar:=" , "Freq=\'0.20000000000000001GHz\' GasPressure=\'0.02kPascal\'",


"PlotGeomInfo:=" , [1,"Surface","FacesList",1,"48"],
"FilterBoxes:=" , [0],
[
"NAME:PlotOnSurfaceSettings",
"Filled:=" , False,
"IsoValType:=" , "Tone",
"AddGrid:=" , False,
"MapTransparency:=" , True,
"Refinement:=" , 0,
"Transparency:=" , 0,
"SmoothingLevel:=" , 0,
"ShadingType:=" , 0,
[
"NAME:Arrow3DSpacingSettings",
"ArrowUniform:=" , True,
"ArrowSpacing:=" , 0,
"MinArrowSpacing:=" , 0,
"MaxArrowSpacing:=" , 0
],
"GridColor:=" , [255,255,255]

Field Overlays Module Script Commands 16-19


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

],
"EnableGaussianSmoothing:=", False,
"SurfaceOnly:=" , False
], "Field")

Example Mesh Plot


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", _

Field Overlays Module Script Commands 16-20


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"UserSpecifyName:=", 0, "UserSpecifyFolder:=", 0, "StreamlinePlot:=", false, _


"IntrinsicVar:=", "Freq=" & Chr(39) & "2GHz" & Chr(39) & " Phase=" _
& Chr(39) & "0deg" & Chr(39) & "" & "", "PlotGeomInfo:=", Array(1, _
"Surface", "FacesList", 1, "10568"), "FilterBoxes:=", Array(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"

VB Example: Maxwell Plot with Skew Slice


oModule.CreateFieldPlot Array("NAME:energy2", "SolutionName:=", "Setup1 : Transient", "User-
SpecifyName:=", 0, "UserSpecifyFolder:=", 0, "QuantityName:=", "energy", "PlotFolder:=",
"Energy", "StreamlinePlot:=", false, "AdjacentSidePlot:=", false, "FullModelPlot:=", false,
"IntrinsicVar:=", "Slice=" & Chr(39) & "2" & Chr(39) & " Time=" & Chr(39) &
"0.00020000000000000001s" & Chr(39) & "",…)

Python Example: Maxwell Plot with Skew Slice


oModule.CreateFieldPlot(
[
"NAME:Mesh1",
"SolutionName:=", "Setup1 : Transient",
"UserSpecifyName:=", 0,
"UserSpecifyFolder:=", 0,

Field Overlays Module Script Commands 16-21


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"QuantityName:=" "Mesh",
"PlotFolder:=", "MeshPlots",
"FieldType:=", "Fields",
"StreamlinePlot:=" , False,
"AdjacentSidePlot:=" , False,
"FullModelPlot:=", False,
"IntrinsicVar:=", "Slice=\'2\' Time=\'0.00020000000000000001s\'",
"PlotGeomInfo:=", [1,"Surface","FacesList",1,"2955"],
"FilterBoxes:=", [0],
…]

Python Example: Maxwell Average_Surface_Loss_Density Plot


oModule.CreateFieldPlot(
[
"NAME:Average_Surface_Loss_Density1",
"SolutionName:=" , "Setup1 : Transient",
"UserSpecifyName:=" , 0,
"UserSpecifyFolder:=" , 0,
"QuantityName:=" , "Average_Surface_Loss_Density",
"PlotFolder:=" , "Average-Surface-Loss-Density",

Field Overlays Module Script Commands 16-22


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"StreamlinePlot:=" , False,
"AdjacentSidePlot:=" , False,
"FullModelPlot:=" , False,
"IntrinsicVar:=" , "Time=\'4us\' Time0=\'0s\'",
"PlotGeomInfo:=" , [1,"Surface","FacesList",1,"6"],

])

Python Examples: Maxwell ACConduction Design Plot


oModule.CreateFieldPlot(
[
"NAME:Mag_Jc1",
"SolutionName:=", "Setup1 : LastAdaptive",
"UserSpecifyName:=", 0,
"UserSpecifyFolder:=", 0,
"QuantityName:=", "Mag_Jc",
"PlotFolder:=", "Jc",
"StreamlinePlot:=", False,
"AdjacentSidePlot:=", False,
"FullModelPlot:=", False,
"IntrinsicVar:=", "Freq=\'1000000Hz\' Phase=\'0deg\'",

Field Overlays Module Script Commands 16-23


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"PlotGeomInfo:=", [1,"Volume","ObjList",1,"Box1"],
"FilterBoxes:=", [1,""],
[
"NAME:PlotOnVolumeSettings",
"PlotIsoSurface:=", True,
"PointSize:=", 1,
"Refinement:=", 0,
"CloudSpacing:=", 0.5,
"CloudMinSpacing:=", -1,
"CloudMaxSpacing:=", -1,
"ShadingType:=", 0,
[
"NAME:Arrow3DSpacingSettings",
"ArrowUniform:=", True,
"ArrowSpacing:=", 0,
"MinArrowSpacing:=", 0,
"MaxArrowSpacing:=", 0
]
],
"EnableGaussianSmoothing:=", False

Field Overlays Module Script Commands 16-24


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

], "Field")

oModule.CreateFieldPlot(
[
"NAME:ComplexMag_Jc1",
"SolutionName:=", "Setup1 : LastAdaptive",
"UserSpecifyName:=", 0,
"UserSpecifyFolder:=", 0,
"QuantityName:=", "ComplexMag_Jc",
"PlotFolder:=", "Jc",
…)

oModule.CreateFieldPlot(
[
"NAME:Jc_Vector2",
"SolutionName:=", "Setup1 : LastAdaptive",
"UserSpecifyName:=", 0,
"UserSpecifyFolder:=", 0,
"QuantityName:=", "Jc_Vector",
"PlotFolder:=", "Jc",
]

Field Overlays Module Script Commands 16-25


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

…)

oModule.CreateFieldPlot(
[
"NAME:Dielectric_Loss1",
"SolutionName:=", "Setup1 : LastAdaptive",
"UserSpecifyName:=", 0,
"UserSpecifyFolder:=", 0,
"QuantityName:=", "Dielectric_Loss",
"PlotFolder:=", "Dielectric-Loss",
]
…)

Maxwell Field Line Trace Plot Examples


VB Example: Maxwell Field Line Trace Plot
oModule.CreateFieldPlot
Array("NAME:FieldLineTrace_Plot3",
"SolutionName:=", "Setup1 : LastAdaptive",
"UserSpecifyName:=", 0,
"UserSpecifyFolder:=", 0,
"QuantityName:=", "QuantityName_FieldLineTrace",
"PlotFolder:=", "Field line trace plot",
"IntrinsicVar:=", "",

Field Overlays Module Script Commands 16-26


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Trace Step Length:=", "0.001mm",


"Use Adaptive Step:=", true,
"Seeding Faces:=", Array( 1, 15091),
"Seeding Markers:=", Array(0),
"Surface Tracing Objects:=", Array(1, 15),
"Volume Tracing Objects:=", Array(1, 36),
"Seeding Sampling Option:=", true,
"Seeding Points Number:=", 15,
"Fractional of Maximal:=", 0.8,
"Discrete Seeds Option:=", "Marker Point",
Array("NAME:InceptionEvaluationSettings",
"Gas Type:=", 0, "Gas Pressure:=", 1),
Array("NAME:FieldLineTracePlotSettings",
Array("NAME:LineSettingsID",
"Width:=", 1,
"Style:=", "Solid"),
"IsoValType:=", "Tone"))
"FieldLineTrace")

oModule.ModifyInceptionParameters "FieldLineTrace_Plot3",
Array("NAME:InceptionEvaluationSettings",
"Gas Type:=", 2, "Gas Pressure:=", 1,
"Use Inception:=" , True,
"Potential U0:=" , 0,
"Potential K:=" , 1,
"Potential A:=" , 1
"Critical Value:=", 5.9426,
"Streamer Constant:=", 6.5,
"Ionization Coefficient Dataset:=", Array( 0))

Python Example: Maxwell Field Line Trace Plot


oModule.CreateFieldPlot(

Field Overlays Module Script Commands 16-27


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

[
"NAME:FieldLineTrace_Plot3",
"SolutionName:=", "Setup1 : LastAdaptive",
"UserSpecifyName:=", 0,
"UserSpecifyFolder:=", 0,
"QuantityName:=", "QuantityName_FieldLineTrace",
"PlotFolder:=", "Field line trace plot",
"IntrinsicVar:=", "",
"Trace Step Length:=", "0.001mm",
"Use Adaptive Step:=", True,
"Seeding Faces:=", [1,15091],
"Seeding Markers:=", [0],
"Surface Tracing Objects:=", [1,15],
"Volume Tracing Objects:=", [1,36],
"Seeding Sampling Option:=", True,
"Seeding Points Number:=", 15,
"Fractional of Maximal:=", 0.8,
"Discrete Seeds Option:=", "Marker Point",
[
"NAME:InceptionEvaluationSettings",

Field Overlays Module Script Commands 16-28


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Gas Type:=", 0,
"Gas Pressure:=", 1
"Use Inception:=" , True,
"Potential U0:=" , 0,
"Potential K:=" , 1,
"Potential A:=" , 1
],
[
"NAME:FieldLineTracePlotSettings",
[
"NAME:LineSettingsID",
"Width:=", 1,
"Style:=", "Solid"
],
"IsoValType:=", "Tone"
]
], "FieldLineTrace")

For Q3D Extractor and 2D Extractor, the command details are as follows:

Use: Creates a field/mesh plot.

Field Overlays Module Script Commands 16-29


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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 16-30


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

For example: "Setup1 : Adaptive_2"


HFSS requires a space on both sides of the ‘:’ character. Otherwise, the plot is not be cre-
ated.
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 Fields "Flux Lines", "VectorA", "Mag_B", "VectorB", "Mag_H", "VectorH", "Jrl", "VectorJrl", "energyRL", "coenergy", "appenergy"
and "emloss

PlotFolder

Field Overlays Module Script Commands 16-31


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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 regardless 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.
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>

Field Overlays Module Script Commands 16-32


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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.
Array(<NumFilters>, <ObjName>, <ObjName>, ...)
Example: Array(1, "Box1")
Example: Array(0) no filtering

Field Overlays Module Script Commands 16-33


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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>,

Field Overlays Module Script Commands 16-34


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"IsoValType:=", <string>,
"SmoothShade:=", <bool>,
"AddGrid:=", <bool>,
"MapTransparency:=", <bool>,
"Transparency:=", <double>,
"ArrowUniform:=", <bool>
"ArrowSpacing:=", <double>
"GridColor:=", Array(<int>, <int>, <int>)
IsoValType
Possible values are: "Tone", "Line", "Fringe", "Gourard".
GridColor
Array containing the R, G, B components of the color. Components should be in the range 0 to
255.
<PlotOnVolumeSettings>
Array("NAME:PlotOnVolumeSettings",
"PlotIsoSurface:=", <bool>,
"CloudDensity:=", <double>,
"PointSize:=", <int>,
"ArrowUniform:=", <bool>,
"ArrowSpacing:=", <double>)

Field Overlays Module Script Commands 16-35


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

DeleteFieldPlot
Deletes one or more field plots.

UI Access Right-click on one filed plot, select Delete.

Name Type Description


Parameters
<NameArray> Array Array of strings containing the names of the plots to delete.

Return Value None.

Python Syntax DeleteFieldPlot(<NameArray>)


Python Example oModule.DeleteFieldPlot(["Mag_E1", "Vector_E1"])

VB Syntax DeleteFieldPlot <NameArray>


VB Example oModule.DeleteFieldPlot Array("Mag_E1", "Vector_E1")

EditSurfaceMeshSummaryData
Use: Defines or Edits Surface Mesh Summary Data.
Command: Create Surface Mesh Summary, Setup...
Syntax: EditSurfaceMeshSummaryData Array(Array(<Parameters Array>))
Return Value: None
Parameters:

Field Overlays Module Script Commands 16-36


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NAME:SurfaceMeshSummary"
Type: <string>
"NAME:SurfaceMeshSummary"
"SolutionName:=" <string>
Type: <string>
Solution Name.
"Variation Name:=" <string>
Type: <string>
Variation name.
<RowItemsArray>
Array<MeshRowItems>
Row data.
<ItemPerRow>
Array<EntityPerRow>
Enity ID.
<MeshDataPer Item>
Array<Mesh Data Category and Stats>

VB Example:
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.EditSurfaceMeshSummaryData Array(Array("NAME:SurfaceMeshSummary", "SolutionName:=", _

Field Overlays Module Script Commands 16-37


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Setup1 : LastAdaptive", "Variation:=", "Nominal", Array("NAME:MeshRowItems", Array("NAME:ItemPer-


Row", "EntityPerRow:=", _
"annular_rng", Array("NAME:MeshDataPerItem", "Min Edge Len:=", 0.000166961133900917, "Max Edge
Len:=", _
0.00145730991671888, "Mean Edge Len:=", 0.000524160923260581, "Std Devn Edge Len:=", _
0.000217758706109324, "Min Tri Area:=", 3.4982570283924E-09, "Max Tri Area:=", _
3.73116346661249E-07, "Mean Tri Area:=", 8.91526236529066E-08, "Std Devn Tri Area:=", _
6.89482807990471E-08, "DataState:=", 2)), Array("NAME:ItemPerRow", "EntityPerRow:=", _
"gap", Array("NAME:MeshDataPerItem", "Min Edge Len:=", 0.000105681286042456, "Max Edge Len:=", _
0.000362084671538928, "Mean Edge Len:=", 0.000233090954707978, "Std Devn Edge Len:=", _
7.55387369793154E-05, "Min Tri Area:=", 1.74640378345369E-09, "Max Tri Area:=", _
3.78166789228631E-08, "Mean Tri Area:=", 1.56497981245286E-08, "Std Devn Tri Area:=", _
1.04691637802914E-08, "DataState:=", 2)))))

Python Syntax RenameReport (<OldReportName>, <NewReportName>)


oModule.EditSurfaceMeshSummaryData(
[
Python Example [
"NAME:SurfaceMeshSummary",
"SolutionName:=" , "Setup1 : LastAdaptive",

Field Overlays Module Script Commands 16-38


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Variation:=" , "Nominal",
[
"NAME:MeshRowItems",
[
"NAME:ItemPerRow",
"EntityPerRow:=" , "annular_rng",
[
"NAME:MeshDataPerItem",
"Min Edge Len:=" , 0.000166961133900917,
"Max Edge Len:=" , 0.00145730991671888,
"Mean Edge Len:=" , 0.000524160923260581,
"Std Devn Edge Len:=" , 0.000217758706109324,
"Min Tri Area:=" , 3.4982570283924E-09,
"Max Tri Area:=" , 3.73116346661249E-07,
"Mean Tri Area:=" , 8.91526236529066E-08,
"Std Devn Tri Area:=" , 6.89482807990471E-08,
"DataState:=" , 2
]
],
[
"NAME:ItemPerRow",

Field Overlays Module Script Commands 16-39


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"EntityPerRow:=" , "gap",
[
"NAME:MeshDataPerItem",
"Min Edge Len:=" , 0.000105681286042456,
"Max Edge Len:=" , 0.000362084671538928,
"Mean Edge Len:=" , 0.000233090954707978,
"Std Devn Edge Len:=" , 7.55387369793154E-05,
"Min Tri Area:=" , 1.74640378345369E-09,
"Max Tri Area:=" , 3.78166789228631E-08,
"Mean Tri Area:=" , 1.56497981245286E-08,
"Std Devn Tri Area:=" , 1.04691637802914E-08,
"DataState:=" , 2
]
]
]
]
])

ExportPlotImageWithViewToFile [Reporter]
Exports a field plot image to a specified file.

Field Overlays Module Script Commands 16-40


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note:

This script replaces ExportPlotImageToFile, which is deprecated.

UI Access N/A

Name Type Description


<FileName> String Full path of file to export.
<PlotQuantityName> String Name of quantity to plot.
Parameters <PlotItemName> String Name of fields to plot.
<PixelSizeX> Integer Desired image width, in pixels.
<PixelSizeY> Integer Desired image height, in pixels.
<ViewOrientation> String Optional. Name of orientation to use for plot.

Return Value Image file is exported to the specified path.

Python ExportPlotImageWithViewToFile(<FileName>, <PlotQuantityName>, <PlotItemName>, <PixelSizeX>, <PixelSizeY>,


Syntax <ViewOrientation>)

Python oModule.ExportPlotImageWithViewToFile("E:/MyDir/OptimToutput/magE2.gif", "E Field",


Example "Mag_E2", 1920, 1080, "newot2")

VB Syn- ExportPlotImageWithViewToFile <FileName>, <PlotQuantityName>, <PlotItemName>, <PixelSizeX>, <PixelSizeY>,


tax <ViewOrientation>

VB oModule.ExportPlotImageWithViewToFile "E:/MyDir/OptimToutput/magE2.gif", "E Field", _


Example "Mag_E2", 1920, 1080, "newot2"

Field Overlays Module Script Commands 16-41


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

ExportSurfaceMeshSummary
Use: Exports a Surface Mesh Summary.
Command: Create Surface Mesh Summary.
Syntax: ExportSurfaceMeshSummary Array(<SolutionName>, <DesignVariationKey> <ExportFileName>)
Return Value: None
Parameters: <SolutionName>
Type: <string>
Original name of the plot.

<DesignVariationKey>
Type: <string>
New name of the plot.
VB Example:
oModule.ExportSurfaceMeshSummary Array("SolutionName:=", "Setup1 : LastAdaptive", "DesignVari-
ationKey:=", _
"Nominal", "ExportFileName:=", "D:\documents\surfaceMeshSummaryReport.csv")

Python Syntax ExportSurfaceMeshSummary (<SolutionName>, <DesignVariationKey>, <ExportFileName>)


oModule.ExportSurfaceMeshSummary(
Python Example [
"SolutionName:=" , "Setup1 : LastAdaptive",

Field Overlays Module Script Commands 16-42


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"DesignVariationKey:=" , "Nominal",
"ExportFileName:=" , "D:\\Program Files\\Docu-
ments\surfaceMeshSummaryReport.csv"
])

GetFieldPlotNames
Gets the names of field overlay plots defined in a design.

UI Access N/A
Parameters None.
Return Value Array of strings containing field plots names.

Python Syntax GetFieldPlotNames()


Python Example oModule.GetFieldPlotNames()

VB Syntax GetFieldPlotNames
VB Example oModule.GetFieldPlotNames

ModifyFieldPlot
Modifies a plot definition.

UI Access [product] > Fields > Modify Plot

Field Overlays Module Script Commands 16-43


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


Parameters <OriginalName> String Name of the plot to be modified.
<PlotParams> Array Array containing modified settings.

Return Value None.

Python Syntax ModifyFieldPlot(<OriginalName>, <PlotParams>)

oModule.ModifyFieldPlot("Vector_E1" ,
["NAME:Vector_E2",
"SolutionName:=", "Setup1 : LastAdaptive",
"QuantityName:=", "Vector_E",
"PlotFolder:=", "E Field1",
"UserSpecifyName:=", 0,
Python Example
"UserSpecifyFolder:=", 0,
"IntrinsicVar:=","Freq='1GHz' Phase='30deg'",
"PlotGeomInfo:=", [1, "Surface","FacesList", 1, "7"],
"FilterBoxes:=", [0],
["NAME:PlotOnSurfaceSettings",
"Filled:=", False,
"IsoValType:=", "Fringe",

Field Overlays Module Script Commands 16-44


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"SmoothShade:=", True,
"AddGrid:=", False,
"MapTransparency:=", True,
"Transparency:=", 0, _
"ArrowUniform:=", True,
"ArrowSpacing:=", 0.100000001490116,
"GridColor:=", [255, 255, 255]]
])

VB Syntax ModifyFieldPlot <OriginalName>, <PlotParams>


oModule.ModifyFieldPlot "Vector_E1" ,_
Array("NAME:Vector_E2", _
"SolutionName:=", "Setup1 : LastAdaptive", _
"QuantityName:=", "Vector_E", _
"PlotFolder:=", "E Field1", _
VB Example "UserSpecifyName:=", 0, _
"UserSpecifyFolder:=", 0, _
"IntrinsicVar:=","Freq='1GHz' Phase='30deg'", _
"PlotGeomInfo:=", Array(1, "Surface","FacesList", 1, "7"), _
"FilterBoxes:=", Array(0), _
Array("NAME:PlotOnSurfaceSettings", _

Field Overlays Module Script Commands 16-45


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Filled:=", false, _
"IsoValType:=", "Fringe", _
"SmoothShade:=", true, _
"AddGrid:=", false, _
"MapTransparency:=", true, _
"Transparency:=", 0, _
"ArrowUniform:=", true, _
"ArrowSpacing:=", 0.100000001490116, _
"GridColor:=", Array(255, 255, 255)))

ModifyInceptionParameters
Use: For field line trace plots, allows you to set inception voltage evaluation parameters.

UI Access Right-click on a Field Line Trace Plot in the project tree and select Inception Voltage Evaluation

Name Type Description


<NAME> string The name of the inception value settings
<Gas Type> int 0 for Dry Air, 1 for SF6, 2 for User Defined
<Gas Pressure> int Gas pressure in Bar
Parameters
<Use Inception> bool True to use the inception parameters U0, K, A
<Potential U0> int U0 parameter
<Potential K> int Streamer constant (empirical value)
<Potential A> int A parameter

Return Value None

Field Overlays Module Script Commands 16-46


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

ModifyInceptionParameters (<NAME>, <Gas Type>, <Gas Pressure>, <Use Inception>, <Potential U0>,
Python Syntax
<Potential K>, <Potential A>)
oModule.ModifyInceptionParameters("FieldLineTrace_Plot1",
[
"NAME:InceptionEvaluationSettings",
"Gas Type:=" , 1,
"Gas Pressure:=" , 1,
Python Example
"Use Inception:=" , True,
"Potential U0:=" , 0,
"Potential K:=" , 1,
"Potential A:=" , 1
])

ModifyInceptionParameters (<NAME>, <Gas Type>, <Gas Pressure>, <Use Inception>, <Potential U0>,
VB Syntax
<Potential K>, <Potential A>)
oModule.ModifyInceptionParameters "FieldLineTrace_Plot1",
Array("NAME:InceptionEvaluationSettings",
VB Example
"Gas Type:=", 1, "Gas Pressure:=", 1, "Use Inception:=", false,
"Potential U0:=", 0, "Potential K:=", 1, "Potential A:=", 1)

RenameFieldPlot
Renames a plot.

UI Access Right-click the plot you want to rename in the project tree, and then click Rename on the shortcut menu.

Name Type Description


Parameters
<OldName> String Original name of the plot.

Field Overlays Module Script Commands 16-47


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<NewName> String New name of the plot.

Return Value None.

Python Syntax RenameFieldPlot(<OldName>, <NewName>)


oModule.RenameFieldPlot(
Python Example
"Vector_E1", "Vector_E2")

VB Syntax RenameFieldPlot <OldName>, <NewName>


oModule.RenameFieldPlot _
VB Example
"Vector_E1", "Vector_E2"

RenamePlotFolder
Renames a plot folder.

UI Access Right-click a plot folder in the project tree, and then click Rename on the shortcut menu.

Name Type Description


Parameters <OldName> String Original name of the folder.
<NewName> String New name of the folder.

Return Value None.

Field Overlays Module Script Commands 16-48


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax RenamePlotFolder(<OldName>, <NewName>)


oModule.RenamePlotFolder(
Python Example
"E Field", "Surface Plots")

VB Syntax RenamePlotFolder <OldName>, <NewName>


oModule.RenamePlotFolder _
VB Example
"E Field", "Surface Plots"

SetFieldPlotSettings
Sets plot attributes.

UI Access [product] > Fields > Modify Plot Attributes

Name Type Description


<PlotName> String Name of the plot to modify.
<PlotItemAttributes> Array Structured array.
Array("NAME:FieldsPlotItemSettings",
<PlotOnPointsSettings>,
Parameters
<PlotOnLineSettings>,
<PlotOnSurfaceSettings>,
<PlotOnVolumeSettings>)
See description of CreateFieldPlot command for details.

Return Value None.

Field Overlays Module Script Commands 16-49


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax SetFieldPlotSettings(<PlotName> <PlotItemAttributes>)


oModule.SetFieldPlotSettings("Mag_E2",
["NAME:FieldsPlotItemSettings",
["NAME:PlotOnLineSettings",
["NAME:LineSettingsID",
"Width:=", 4,
"Style:=", "Cylinder"),
"IsoValType:=", "Tone",
"ArrowUniform:=", True,
"NumofArrow:=", 100),
Python Example
["NAME:PlotOnSurfaceSettings",
"Filled:=", False,
"IsoValType:=", "Tone",
"SmoothShade:=", True,
"AddGrid:=", False,
"MapTransparency:=", True,
"Transparency:=", 0,
"ArrowUniform:=", True,
"ArrowSpacing:=", 0.100000001490116,

Field Overlays Module Script Commands 16-50


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"GridColor:=", [255, 255, 255]]]


)

VB Syntax SetFieldPlotSettings <PlotName> <PlotItemAttributes>


oModule.SetFieldPlotSettings "Mag_E2", _
Array("NAME:FieldsPlotItemSettings", _
Array("NAME:PlotOnLineSettings", _
Array("NAME:LineSettingsID", _
"Width:=", 4, _
"Style:=", "Cylinder"), _
"IsoValType:=", "Tone", _
"ArrowUniform:=", true, _
VB Example "NumofArrow:=", 100), _
Array("NAME:PlotOnSurfaceSettings", _
"Filled:=", false, _
"IsoValType:=", "Tone", _
"SmoothShade:=", true, _
"AddGrid:=", false, _
"MapTransparency:=", true, _
"Transparency:=", 0, _
"ArrowUniform:=", true, _

Field Overlays Module Script Commands 16-51


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ArrowSpacing:=", 0.100000001490116, _
"GridColor:=", Array(255, 255, 255)))

SetPlotFolderSettings
Sets the attributes of all plots in the specified folder.

UI Access [product] > Fields > Modify Plot Attributes

Name Type Description


<PlotFolderName> String Name of the folder with the attributes to modify.
<PlotFolderAttributes> Array Structured array.
Array("NAME:FieldsPlotSettings",
"Real time mode:=", <bool>,
<ColorMapSettings>,
<Scale3DSettings>,
<Marker3DSettings>,
Parameters
<Arrow3DSettings>)
<ColorMapSettings> Array Structured array.
Array("NAME:ColorMapSettings",
"ColorMapType:=", <string Possible values are
"Uniform", "Ramp", "Spectrum">,
"SpectrumType:=", <string Possible values are
"Rainbow", "Temperature", "Magenta", "Gray">,
"UniformColor:=", <array containing the R, G, B

Field Overlays Module Script Commands 16-52


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

components of the color. Components should be in


the range 0 to 255.>,
"RampColor:=", <array containing the R, G, B com-
ponents of the color. Components should be in
the range 0 to 255.>)
<Scale3DSettings> Array Structured array.
Array("NAME:Scale3DSettings",
"m_nLevels:=", <int>,
"m_autoScale:=", <bool>,
"minvalue:=", <double>,
"maxvalue:=", <double>,
"log:=", <bool>,
"IntrinsicMin:=", <double>,
"IntrinsicMax:=", <double>)
<Marker3DSettings> Array Structured array.
Array("NAME:Marker3DSettings",
"MarkerType:=", <integer
9:Sphere
10: Box
11: Tetrahedron
12: Octahedron
default: Sphere>,
"MarkerMapSize:=", <bool>,

Field Overlays Module Script Commands 16-53


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"MarkerMapColor:=", <bool>,
"MarkerSize:=", <double>)
<Arrow3DSettings> Array Structured array.
Array("NAME:Arrow3DSettings",
"ArrowType:=", <integer
0: Line
1: Cylinder
2: Umbrella
default: Line>,
"ArrowMapSize:=", <bool>,
"ArrowMapColor:=", <bool>,
"ShowArrowTail:=", <bool>,
"ArrowSize:=", <double>)

Return Value None.

Python Syntax SetPlotFolderSettings(<PlotFolderName>, <PlotFolderAttributes>)


oModule.SetPlotFolderSettings("E Field1",
Python Example ["NAME:FieldsPlotSettings",
"Real time mode:=", True,

Field Overlays Module Script Commands 16-54


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["NAME:ColorMapSettings",
"ColorMapType:=", "Spectrum",
"SpectrumType:=", "Rainbow",
"UniformColor:=", [127, 255, 255],
"RampColor:=", [255, 127, 127]],
["NAME:Scale3DSettings",
"m_nLevels:=", 27,
"m_autoScale:=", True,
"minvalue:=", 9.34379863739014,
"maxvalue:=", 13683.755859375,
"log:=", False,
"IntrinsicMin:=", 9.34379863739014,
"IntrinsicMax:=", 13683.755859375),
["NAME:Marker3DSettings",
"MarkerType:=", 0,
"MarkerMapSize:=", True,
"MarkerMapColor:=", False,
"MarkerSize:=", 0.25],
["NAME:Arrow3DSettings",
"ArrowType:=", 1,
"ArrowMapSize:=", True,

Field Overlays Module Script Commands 16-55


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ArrowMapColor:=", True,
"ShowArrowTail:=", True,
"ArrowSize:=", 0.25]]
)

VB Syntax SetPlotFolderSettings <PlotFolderName>, <PlotFolderAttributes>


oModule.SetPlotFolderSettings "E Field1", _
Array("NAME:FieldsPlotSettings", _
"Real time mode:=", true, _
Array("NAME:ColorMapSettings", _
"ColorMapType:=", "Spectrum", _
"SpectrumType:=", "Rainbow", _
VB Example "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, _

Field Overlays Module Script Commands 16-56


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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))

SetPlotsViewSolutionContext
Sets the context of named field overlay plots to the specified time using the intrinsic Time value of the active window. Also updates the
associated view solution context for each plot.

UI Access [product] > Fields > Set Context to Active Window

Name Type Description


<Plots> Array Names of the plots to modify.
Parameters
<SolName> String Name of a transient analysis solution.
<SolTime> String Intrinsic variable name (must be "Time") and value.

Field Overlays Module Script Commands 16-57


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value None.

Python Syntax SetPlotsViewSolutionContext(<Plots>, <SolName>, <SolTime>)


oModule.SetPlotsViewSolutionContext(
Python Example ["Flux_Lines1", "Mag_H1"],
"Setup1 : Transient", "Time=-1")

VB Syntax SetPlotsViewSolutionContext <Plots>, <SolName>, <SolTime>


oModule.SetPlotsViewSolutionContext _
VB Example Array("Flux_Lines1", "Mag_H1"), _
"Setup1 : Transient", "Time=-1"

UpdateAllFieldsPlots
Updates the All Fields Plots.

UI Access N/A
Parameters None.
Return Value None.

Field Overlays Module Script Commands 16-58


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax UpdateAllFieldsPlots()


Python Example oModule.UpdateAllFieldsPlots()

VB Syntax UpdateAllFieldsPlots
VB Example oModule.UpdateAllFieldsPlots

UpdateQuantityFieldsPlots
Updates the Quantity Fields Plots.

UI Access N/A

Name Type Description


Parameters
<FolderName> String Folder containing the plotted quantities.

Return Value None.

Python Syntax UpdateQuantityFieldsPlots(<FolderName>)


Python Example oModule.UpdateQuantityFieldsPlots("fldplt")

VB Syntax UpdateQuantityFieldsPlots <FolderName>


VB Example oModule.UpdateQuantityFieldsPlots "fldplt"

Field Overlays Module Script Commands 16-59


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

16-60
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

17 - Fields Calculator Script Commands


Fields Calculator commands should be executed by the Field Overlays module, which is called "FieldsReporter" in Maxwell scripts.
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.CommandName <args>
The command associated with each of the following scripting commands will be a button pressed in the Fields Calculator.
AddNamedExpression
AddNamedExpr
CalcOp
CalculatorRead
CalcStack
CalculatorWrite
ChangeGeomSettings
ClcEval
ClcMaterial
ClearAllNamedExpr
CopyNamedExprToStack
DeleteNamedExpr
EnterComplex
EnterComplexVector
EnterLine

Fields Calculator Script Commands 17-1


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

EnterPoint
EnterQty
EnterScalar
EnterScalarFunc
EnterSurf
EnterVector
EnterVectorFunc
EnterVol
ExportOnGrid [Fields Calculator]
ExportToFile [Fields Calculator]
GetTopEntryValue
LoadNamedExpressions
SaveNamedExpressions

AddNamedExpression
Creates a named expression using the expression at the top of the stack.

UI Access Click Add in the Fields Calculator dialogue.

Name Type Description


Parameters <ExprName> String Name for the new named expression.
<FieldType> String Type of field.

Return Value None.

Fields Calculator Script Commands 17-2


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax AddNamedExpression(<ExprName>, <FieldType>)


Python Example oModule.AddNamedExpression("Mag_JxE", "Fields")

VB Syntax AddNamedExpression <ExprName>, <FieldType>


VB Example oModule.AddNamedExpression "Mag_JxE", "Fields"

AddNamedExpr
Creates a named expression using the expression at the top of the stack.

UI Access Click Add in the Fields Calculator dialogue.

Name Type Description


Parameters
<ExprName> String Name for the new named expression.

Return Value None.

Python Syntax AddNamedExpr(<ExprName>)


Python Example oModule.AddNamedExpr("Mag_JxE")

VB Syntax AddNamedExpr <ExprName>


VB Example oModule.AddNamedExpr "Mag_JxE"

Fields Calculator Script Commands 17-3


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

CalcOp
Performs a calculator operation.

UI Access Operation commands like Mag, +, etc.

Name Type Description


Parameters
<OpString> String The text on the corresponding calculator button.

Return Value None.

Python Syntax CalcOp(<OpString>)


Python Example oModule.CalcOp("+")

VB Syntax CalcOp <OpString>


VB Example oModule.CalcOp "+"

CalcRead(deprecated)
Reads a file that is written out by the CalcWrite command, and puts the result into a calculator numeric.

UI Access Click Read... in the Fields Calculator dialog.

Name Type Description


Parameters <FileName> String Name of the file to be read.
<SoluName> String Specified solution to read in.

Fields Calculator Script Commands 17-4


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<VarArray> Array Array of variables to read.

Return Value None.

Python Syntax CalcRead(<FileName>, <SoluName>, <VarArray>)


oModule.CalcRead(
"c:\example.reg",
Python Example
"Setup1: LastAdaptive",
["Freq:=", "10GHz", "Phase:=", "0deg"])

VB Syntax CalcRead <FileName>, <SoluName>, <VarArray>


oModule.CalcRead _
"c:\example.reg", _
VB Example
"Setup1: LastAdaptive", _
Array("Freq:=", "10GHz", "Phase:=", "0deg")

CalculatorRead
Gets a register file and applies it to the calculator stack.

UI Access Click Read... in the Fields Calculator dialog.

Name Type Description


Parameters
<FileName> String Path to and including name of input register file.

Fields Calculator Script Commands 17-5


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<SoluName> String Specified solution to read in.


<FieldType> String Type of specified field.
<VarArray> Array Array of variable names, value pairs.

Return Value None.

Python Syntax CalculatorRead(<FileName>, <SoluName>, <FieldType>, <VarArray>)


oModule.CalculatorRead(
"c:\example.reg",
Python Example
"Setup1: LastAdaptive", "Fields",
["Freq:=", "10GHz", "Phase:=", "0deg"])

VB Syntax CalculatorRead <FileName>, <SoluName>, <FieldType>, <VarArray>


oModule.CalculatorRead _
"c:\example.reg", _
VB Example
"Setup1: LastAdaptive", "Fields", _
Array("Freq:=", "10GHz", "Phase:=", "0deg")

CalcStack
Performs an operation on the stack.

Fields Calculator Script Commands 17-6


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access Stack operation buttons such as Push and Pop.

Name Type Description


Parameters
<OpString> String The text on the corresponding calculator button.

Return Value None.

Python Syntax CalcStack(<OpString>)


Python Example oModule.CalcStack("push")

VB Syntax CalcStack <OpString>


VB Example oModule.CalcStack "push"

CalculatorWrite
Writes contents of top register to file.

UI Access Click Write... in the Fields Calculator dialog.

Name Type Description


<OutputFilePath> String Path to and including name of output register file.
Parameters
<SoluNameArray> Array Array of strings containing solution names.
<VarArray> Array Array of variable names, value pairs.

Return Value None.

Fields Calculator Script Commands 17-7


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax CalculatorWrite(<OutputFilePath>, <SoluNameArray>, <VarArray>)


oModule.CalculatorWrite("c:\test.reg",
["Solution:=", "Setup1 : LastAdaptive"],
Python Example
["Freq:=", "1GHz", "Phase:=", "0deg"]
)

VB Syntax CalculatorWrite <OutputFilePath>, <SoluNameArray>, <VarArray>


oModule.CalculatorWrite "c:\test.reg", _
VB Example Array("Solution:=", "Setup1 : LastAdaptive"),_
Array("Freq:=", "1GHz", "Phase:=", "0deg")

ChangeGeomSettings
Changes the line discretization setting.

UI Access In the Fields Calculator dialog box, click on Geom Settings...

Name Type Description


Parameters
<LineDiscr> Integer Line discretization value.

Return Value None.

Python Syntax ChangeGeomSettings(<LineDiscr>)

Fields Calculator Script Commands 17-8


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Example oModule.ChangeGeomSettings(500)

VB Syntax ChangeGeomSettings <LineDiscr>


VB Example oModule.ChangeGeomSettings 500

ClcEval
Evaluates the expression at the top of the stack using the provided solution name and variable values.

UI Access Click Eval in the Fields Calculator dialog.

Name Type Description


<SoluName> String Name of specified solution.
Parameters
<VarArray> Array Array of variable name, value pairs.
<FieldType> String Optional. Type of specified field.

Return Value None.

Python Syntax ClcEval(<SoluName>, <VarArray>, [Optional <FieldType>])


oModule.ClcEval(
"Setup1: LastAdaptive",
Python Example
["Freq:=", "10GHz",
"Phase:=", "0deg"])

Fields Calculator Script Commands 17-9


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax ClcEval <SoluName>, <VarArray>, [Optional <FieldType>]


oModule.ClcEval "Setup1: LastAdaptive", _
VB Example Array ("Freq:=", "10GHz", _
"Phase:=", "0deg")

ClcMaterial
Performs a material operation on the top stack element.

UI Access Click Matl... in the Fields Calculator dialog.

Name Type Description


Parameters <MatString> String The material property to apply.
<OpString> String Name of operation. Possible values are "mult", or "div".

Return Value None.

Python Syntax ClcMaterial(<MatString>, <OpString>)


Python Example oModule.ClcMaterial("Permeability (mu)" "mult")

VB Syntax ClcMaterial <MatString>, <OpString>


VB Example oModule.ClcMaterial "Permeability (mu)" "mult"

Fields Calculator Script Commands 17-10


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

ClearAllNamedExpr
Clears all user-defined named expressions from the list.

UI Access Click ClearAll in the Fields Calculator dialog.


Parameters None.
Return Value None.

Python Syntax ClearAllNamedExpr()


Python Example oModule.ClearAllNamedExpr()

VB Syntax ClearAllNamedExpr
VB Example oModule.ClearAllNamedExpr

CopyNamedExprToStack
Copies the named expression selected to the calculator stack.

UI Access Select a named expression and then click Copy to stack.

Name Type Description


Parameters
<ExprName> String Name of the expression to be copied to the top of the stack.

Return Value None.

Fields Calculator Script Commands 17-11


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax CopyNamedExprToStack(<ExprName>)


Python Example oModule.CopyNamedExprToStack("Mag_JxE")

VB Syntax CopyNamedExprToStack <ExprName>


VB Example oModule.CopyNamedExprToStack "Mag_JxE"

DeleteNamedExpr
Deletes the selected named expression from the list.

UI Access Select a named expression and then click Delete.

Name Type Description


Parameters
<ExprName> String Name of specified named expression.

Return Value None.

Python Syntax DeleteNamedExpr(<ExprName>)


Python Example oModule.DeleteNamedExpr("Mag_JxE")

VB Syntax DeleteNamedExpr <ExprName>


VB Example oModule.DeleteNamedExpr "Mag_JxE"

Fields Calculator Script Commands 17-12


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

EnterComplex
Enters a complex number onto the stack.

UI Access Click Number, and then click Scalar. Complex option is selected.

Name Type Description


Parameters
<ComplexNum> String String of complex value. Ex. "1 + 2j".

Return Value None.

Python Syntax EnterComplex(<ComplexNum>)


Python Example oModule.EnterComplex("1 + 2 j")

VB Syntax EnterComplex <ComplexNum>


VB Example oModule.EnterComplex "1 + 2 j"

EnterComplexVector
Enters a complex vector onto the stack.

UI Access Click Number, and then click Vector. Complex option is selected.

Name Type Description


Parameters
<ComplexVector> Array Array of strings containing X, Y and Z complex values.

Return Value None.

Fields Calculator Script Commands 17-13


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax EnterComplexVector(<ComplexVector>)


oModule.EnterComplexVector
([
"1 + 2 j",
Python Example
"1 + 2 j",
"1 + 2 j"
])

VB Syntax EnterComplexVector <ComplexVector>


oModule.EnterComplexVector _
Array("1 + 2 j",_
VB Example
"1 + 2 j",_
"1 + 2 j")

EnterLine
Enters a line defined in the 3D Modeler editor.

UI Access Click Geometry and then select Line

Parameters Name Type Description

Fields Calculator Script Commands 17-14


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<LineName> String Name of a line defined in the 3D Modeler editor.

Return Value None.

Python Syntax EnterLine(<LineName>)


Python Example oModule.EnterLine("Line1")

VB Syntax EnterLine <LineName>


VB Example oModule.EnterLine "Line1"

EnterPoint
Enters a point defined in the 3D Modeler editor.

UI Access Click Geometry and then select Point.

Name Type Description


Parameters
<PointName> String Name of a point defined in the 3D Modeler editor.

Return Value None.

Python Syntax EnterPoint(<PointName>)


Python Example oModule.EnterPoint("Point1")

Fields Calculator Script Commands 17-15


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax EnterPoint <PointName>


VB Example oModule.EnterPoint "Point1"

EnterQty
Enters a field quantity.

UI Access Click Quantity, and then select from the list.

Name Type Description


Parameters
<FieldQty> String The field quantity to be entered onto the stack.

Return Value None.

Python Syntax EnterQty(<FieldQty>)


Python Example oModule.EnterQty("E")

VB Syntax EnterQty <FieldQty>


VB Example oModule.EnterQty "E"

EnterScalar
Enters a scalar onto the stack.

UI Access Click Number and then click Scalar. Complex option not selected.

Fields Calculator Script Commands 17-16


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


Parameters
<Scalar> Double The real number to enter onto the stack.

Return Value None.

Python Syntax EnterScalar(<Scalar>)


Python Example oModule.EnterScalar(3.14159265358979)

VB Syntax EnterScalar <Scalar>


VB Example oModule.EnterScalar 3.14159265358979

EnterScalarFunc
Enters a scalar function.

UI Access Click Function and then select Scalar.

Name Type Description


Parameters
<VarName> String Name of a variable to enter as a scalar function onto the stack.

Return Value None.

Python Syntax EnterScalarFunc(<VarName>)


Python Example oModule.EnterScalarFunc("Phase")

Fields Calculator Script Commands 17-17


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax EnterScalarFunc <VarName>


VB Example oModule.EnterScalarFunc "Phase"

EnterSurf
Enters a surface defined in the 3D Modeler editor.

UI Access Click Geometry and then select Surface.

Name Type Description


Parameters
<SurfName> String Name of a surface defined in the 3D Modeler editor.

Return Value None.

Python Syntax EnterSurf(<SurfName>)


Python Example oModule.EnterSurf("Rectangle1")

VB Syntax EnterSurf <SurfName>


VB Example oModule.EnterSurf "Rectangle1"

EnterVector
Enters a vector onto the stack.

UI Access Click Number, and then click Vector. Complex option not selected.

Fields Calculator Script Commands 17-18


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


Parameters
<VectorArray> Array Array of strings containing X, Y and Z components of the vector.

Return Value None.

Python Syntax EnterVector(<VectorArray>)


Python Example oModule.EnterVector([1.0, 1.0, 1.0])

VB Syntax EnterVector <VectorArray>


VB Example oModule.EnterVector Array(1.0, 1.0, 1.0)

EnterVectorFunc
Enters a vector function.

UI Access Click Function and then select Vector.

Name Type Description


Parameters <VarNames> Array Array of strings containing names of a variable for the X, Y, and Z coordinates,
respectively, to enter as a vector function on the stack.

Return Value None.

Python Syntax EnterVectorFunc(<VarNames>)


Python Example oModuleEnterVectorFunc(["X", "Y", "Z"])

Fields Calculator Script Commands 17-19


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax EnterVectorFunc <VarNames>


VB Example oModuleEnterVectorFunc Array("X", "Y", "Z")

EnterVol
Enters a volume defined in the 3D Modeler editor.

UI Access Click Geometry and then select Volume.

Name Type Description


Parameters
<VolumeName> String Name of a volume defined in the 3D Modeler editor.

Return Value None.

Python Syntax EnterVol(<VolumeName>)


Python Example oModule.EnterVol("Box1")

VB Syntax EnterVol <VolumeName>


VB Example oModule.EnterVol "Box1"

ExportOnGrid [Fields Calculator]


Evaluates the top stack element at a set of points specified by a grid and exports the data to a file.

Fields Calculator Script Commands 17-20


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access Click Export, and then click On Grid.

Name Type Description


<OutputFile> String Name of the output file.
<Min> Array Minimum values for the coordinate components of the grid system
<Max> Array Maximum values for the coordinate components of the grid system
<Spacing> Array Spacing values for the coordinate components of the grid system
<SolnName> String Name of the simulation setup
Parameters <VarVals> Array Array of strings containing setup definitions.
<IncludePoints> Boolean Optional. Specifies whether include points in the output file.
<CSType> String Optional. Type of coordinate system. "Cartesian" (default) | "Cylindrical" |
"Spherical"
<Offsets> Array Optional. Origin for the offset coordinate system. For Cartesian, x, y, z, for
Cylindrical, R, Phi, Z, for Spherical, Rho, Theta, Phi.
<ByCount> Boolean Optional.

Return Value None.

Note:Regarding the ExportOnGrid legacy script which only has “IncludePtInOutput” argument (the last Boolean one), AEDT can still
read it and assign other new arguments as default values. Those default values are RefCSName = “global”, PtInSI = “True”, FieldInRe-
fCS = “False”

ExportOnGrid(<OutputFile>, <Min>, <Max>, <Spacing>, <SolnName>, <SolnParameters>, [<ExportOption>,


Python Syntax "IncludePointsInOutput:=", <boolean>], " RefCSName:=", <CSName>, "PtsInSI:=, <boolean>, "FieldRefCS:=",
<boolean>], "<CSType>", [ <Offsets>, <ByCount>)
oModule.ExportOnGrid("C:\offset_grid_model_unit_ref.fld",
["-1mm", "16mm", "0mm"],
Python Example ["1mm", "18mm", "1mm"],
["2mm", "2mm", "1mm"],
"4500MHz : LastAdaptive",

Fields Calculator Script Commands 17-21


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["Freq:=", "4.5GHz","Phase:=" , "0deg"],


[
"NAME:ExportOption",
"IncludePtInOutput:=" , True,
"RefCSName:=" , "offset",
"PtInSI:=" , False,
"FieldInRefCS:=" , True
],
"Cartesian", ["0mm", "0mm", "0mm"], False
)

ExportOnGrid(<OutputFile>, <Min>, <Max>, <Spacing>, <SolnName>, <SolnParameters>, [<ExportOption>,


VB Syntax "IncludePointsInOutput:=", <boolean>], " RefCSName:=", <CSName>, "PtsInSI:=, <boolean>, "FieldRefCS:=",
<boolean>], "<CSType>", [ <Offsets>, <ByCount>)
oModule.ExportOnGrid "C:/Grid.fld", _
Array( "0mm", "0deg", "-25mm"), _
Array("20mm", "90deg", "125mm"), _
VB Example
Array("10mm", "45deg", "50mm"), _
"Setup1 : LastAdaptive", _
Array("Freq:=", "10000Hz", "Phase:=", "0deg"), _

Fields Calculator Script Commands 17-22


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

true, "Cylindrical", _
Array("0mm", "0mm", "0mm")

oModule.ExportOnGrid("C:\offset_grid_model_unit_ref.fld",
Array("-1mm", "16mm", "0mm"),
Array("1mm", "18mm", "1mm"),
Array("2mm", "2mm", "1mm"),
"4500MHz : LastAdaptive",
Array("Freq:=", "4.5GHz","Phase:=" , "0deg"),
[
"NAME:ExportOption",
"IncludePtInOutput:=" , True,
"RefCSName:=" , "offset",
"PtInSI:=" , False,
"FieldInRefCS:=" , True
],
"Cartesian", Array("0mm", "0mm", "0mm"), False
)

ExportToFile [Fields Calculator]


Evaluates the top stack element at a set of points specified in an external file and exports the data to a file.

Fields Calculator Script Commands 17-23


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note:

Regarding to legacy ExportToFile script which only has “IncludePtInOutput” argument (the last Boolean one), AEDT can
still read it and assign other new arguments as default values. Those default values are RefCSName = “global”, PtInSI =
“True”, FieldInRefCS = “False”

UI Access Click Export, and then click To File.

Name Type Description


<ReportName> String Name of report to be exported.
<FileName> String Full path of the exported image file name; with extension of
.txt - Post processor format file
.csv - Comma-delimited data file
.tab - Tab-separated file
Parameters
.dat - Ansys plot data file
<solution> Solution Name
<freq> frequency
<phase> phase
<Export Options> Whether to include points in output, RefCSName, Pts in SI units <boolean>,
Field in RefCS, <boolean>.

Return Value None.

Fields Calculator Script Commands 17-24


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python ExportToFile(<ReportName>, <FileName>, <solution>, ["Freq:=", <freq>, "Phase:=", "<phase>], <ExportOptions>)


Syntax

oModule.ExportToFile("C:\\offset_file_model_unit_ref.fld", "C:\\offset_SI.pts",
"4500MHz : LastAdaptive",
[
"Freq:=" , "4.5GHz",
"Phase:=" , "0deg"
],
Python
Exampl- [
e "NAME:ExportOption",
"IncludePtInOutput:=" , True,
"RefCSName:=" , "offset",
"PtInSI:=" , False,
"FieldInRefCS:=" , True
])

VB Syn- ExportToFile <ReportName>, <FileName>


tax

oModule.ExportToFile("C:\\offset_file_model_unit_ref.fld", "C:\\offset_SI.pts",
VB "4500MHz : LastAdaptive",
Exampl-
[
e
"Freq:=" , "4.5GHz",

Fields Calculator Script Commands 17-25


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Phase:=" , "0deg"
],
[
"NAME:ExportOption",
"IncludePtInOutput:=" , True,
"RefCSName:=" , "offset",
"PtInSI:=" , False,
"FieldInRefCS:=" , True
])

GetTopEntryValue
Gets the value of the top entry of the calculator stack.

UI Access N/A

Name Type Description


Parameters <SolnName> String Name of specified solution.
<VarVals> Array Array of variable name, value pairs.

Return Value Array of strings containing top entry values.

Python Syntax GetTopEntryValue(<SolnName>, <VarVals>)

Fields Calculator Script Commands 17-26


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oModule.GetTopEntryValue(
"Setup1:LastAdaptive",
Python Example
["Freq:=", "1GHz", "Phase:=", "0deg", "x_size:=", "2mm"]
)

VB Syntax GetTopEntryValue <SolnName>, <VarVals>


oModule.GetTopEntryValue "Setup1:LastAdaptive", _
VB Example Array("Freq:=", "1GHz", "Phase:=", "0deg", _
"x_size:=", "2mm")

LoadNamedExpressions
Loads a named expression definition from a saved file.

UI Access In the Fields Calculator, click Load From... in the Library area.

Name Type Description


<FileName> String Filename and full path to the file to hold the named expression definition.
Parameters <FieldType> String For products with just one filed type, it is set to "Fields".
<NamedExpr> Array rray of strings containing the names of expression definitions to load from the
file.

Return Value None.

Python Syntax LoadNamedExpressions(<FileName>, <FieldType>, <NamedExpr>)

Fields Calculator Script Commands 17-27


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oModule.LoadNamedExpressions(
Python Example "C:\Ansoft\PersonalLib\smth.clc",
"Fields", ["smoothedtemp"])

VB Syntax LoadNamedExpressions <FileName>, <FieldType>, <NamedExpr>


oModule.LoadNamedExpressions _
VB Example "C:\Ansoft\PersonalLib\smth.clc", _
"Fields", Array("smoothedtemp")

SaveNamedExpressions
Saves a named expression definition to a file.

UI Access In the Fields Calculator, click Save To... in the Library area.

Name Type Description


<FileName> String Filename and full path to the file to hold the named expression definition.
Parameters <NamedExprs> Array Array of strings containing the names of expression definitions to load from the
file.
<Overwrite> Boolean Specifies whether to overwrite the file.

Return Value None.

Python Syntax SaveNamedExpressions(<FileName>, <NamedExprs>, <Overwrite>)

Fields Calculator Script Commands 17-28


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oModule.SaveNamedExpressions(
Python Example "C:\Ansoft\PersonalLib\smth.clc",
["smoothedtemp"], True)

VB Syntax SaveNamedExpressions <FileName>, <NamedExprs>, <Overwrite>


oModule.SaveNamedExpressions _
VB Example "C:\Ansoft\PersonalLib\smth.clc", _
Array("smoothedtemp"), true

Fields Calculator Script Commands 17-29


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

17-30
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

18 - Motion Setup Script Commands


Motion setup commands should be executed by the ModelSetup module.
Set oModule = oDesign.GetModule("ModelSetup")
oModule.CommandName <args>
Conventions Used in the Motion Setup Chapter
<AssignmentObjects>
Type: Array of strings
An array of object names.
General Motion Setup Script Commands
Following are general script commands recognized by the ModelSetup module:
l DeleteMotionSetup
l ReassignMoving

DeleteMotionSetup
Use: Deletes the motion setup.
Command: Maxwell3D or Maxwell2D>Model>Motion Setup>Unassign Band
Syntax:DeleteMotionSetup
Return Value: None
Parameters: List of strings. A list of names of motion setups to delete.
Example: oModule.DeleteMotionSetup(["MotionSetup2"])
The [ ] can contain more than one name as it is a list.

Motion Setup Script Commands A


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

ReassignMoving
Use: Specifies a new geometry assignment for moving objects.
Command: Maxwell3D or Maxwell2D>Model>Motion Setup>Add Selected Objects or
Maxwell3D or Maxwell2D>Model>Motion Setup>Remove Selected Objects
Syntax:ReassignMoving Array("Name:Moving", "Objects:=", <AssignmentObjects>)
Return Value: None
Example: oModule.ReassignMoving Array("NAME:Moving", _
"Objects:=", Array("Box4", "Box1"))

Commands to Create and Edit the Band


Following are script commands for creating and editing bands that are recognized by the
ModelSetup module:

Note:

In the following commands, all named data can be included/excluded as desired and may appear in any order.

l AssignBand
l EditMotionSetup
l GetMotionSetupNames

AssignBand
Use: Assigns the selected object as a band.
Command: Maxwell3D or Maxwell2D>Model>Motion Setup>Assign Band

Motion Setup Script Commands B


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Syntax:AssignBand <BandDataArray>
Return Value: None
Parameters:
<BandDataArray>
Array("NAME:Band",
"Move Type:=", <Translate/Rotate>,
"Coordinate System::=", <CoordinateSystemName>,
"Axis:=", <X/Y/Z>,
"Is Positive:=", <bool>,
"InitPos:=", <value>,
"NegativePos:=", <value>,
"PositivePos:=", <value>,
"TranslatePeriodic:=", <bool>,
"Consider Mechanical Transient:=", <bool>,
"velocity:=", <value>,
"objects:=", <AssignmentObjects>)
Example: Assign band as translate, do not consider mechanical transient.
oModule.AssignBand _
Array("NAME:Band", "Move Type:=", "Translate",
"Coordinate System:=", "Global", "Axis:=", "Z",
"Is Positive:=", true, "InitPos:=", "0mm", _
"NegativePos:=", "0mm", "PositivePos:=", "1mm",

Motion Setup Script Commands C


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"TranslatePeriodic:=", true,
"Consider Mechanical Transient:=", false,
"Velocity:=", "0m_per_sec",
"Objects:=", Array("band"))
Example: Assign band as translate, consider mechanical transient.
oModule.AssignBand _
Array("NAME:Band", _
"Move Type:=", "Translate",
"Coordinate System:=", "Global", "Axis:=", "Z",
"Is Positive:=", true, "InitPos:=", "0mm",
"NegativePos:=", "0mm", "PositivePos:=", "1mm",
"TranslatePeriodic:=", true,
"Consider Mechanical Transient:=", true,
"Velocity:=", "0m_per_sec", "Mass:=", "1kg",
"Damping:=", "1", "Load Force:=", "1nNewton"
"Objects:=", Array("band"))
Example: Assign band as rotate, do not consider mechanical transient.
oModule.AssignBand _
Array("NAME:Band", "Move Type:=", "Rotate",
"Coordinate System:=", "Global", "Axis:=", "Z",

Motion Setup Script Commands D


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Is Positive:=", true, "InitPos:=", "0deg",


"HasRotateLimit:=", false, "NonCylindrical:=",
false, "Consider Mechanical Transient:=", false,
"Angular Velocity:=", "0deg_per_sec", "Objects:=",
Array("band"))
Example: Assign band as rotate, consider mechanical transient.
oModule.AssignBand _
Array("NAME:Band", "Move Type:=", "Rotate",
"Coordinate System:=", "Global", "Axis:=", "Z",
"Is Positive:=", true, "InitPos:=", "0deg",
"HasRotateLimit:=", false, "NonCylindrical:=",
false, "Consider Mechanical Transient:=", true,
"Angular Velocity:=", "0deg_per_sec",
"Moment of Inertia:=", "1", "Damping:=", "0",
"Load Torque:=", "0NewtonMeter", "Objects:=",
Array("band"))
EditMotionSetup
Use: Edits the motion setup.
Command: Double-click the moving item in the project tree to edit it.
Syntax:EditMotionSetup <SetupName>, <Array>
Return Value: None

Motion Setup Script Commands E


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Parameters: <SetupName>
The name of the motion setup to be edited.
<BandDataArray>
Array("NAME:Data",
"Move Type:=", <Translate/Rotate>,
"Coordinate System::=", <CoordinateSystemName>,
"PostProcessing Coordinate System:=", <CoordinateSystemName>
"Axis:=", <X/Y/Z>,
"Is Positive:=", <bool>,
"InitPos:=", <value>,
"NegativePos:=", <value>,
"PositivePos:=", <value>,
"TranslatePeriodic:=", <bool>,
"Consider Mechanical Transient:=", <bool>,
"velocity:=", <value>,
"Mass:=", <value>,
"Damping:=", <value>,
"Load Force:=", <value>)
Example: Translational Periodic motion, no mechanical transient.
oModule.EditMotionSetup "MotionSetup1", Array("NAME:Data", "Move Type:=", "Translate",

Motion Setup Script Commands F


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Coordinate System:=", "Global",


"PostProcessing Coordinate System:=",
"Global", "Axis:=", "X", "Is Positive:=", true,
"InitPos:=", "0meter", "NegativePos:=", "0meter",
"PositivePos:=", "0.1meter",
"TranslatePeriodic:=", true,
"Consider Mechanical Transient:=", false,
"Velocity:=", "0m_per_sec")

GetMotionSetupNames
Use: Gets the motion setup parameters being used for the object. Applicable to 2D and 3D Transient solution types.
Command: None
Syntax:GetMotionSetupNames ()
Return Value: List of motion setup names
Parameters: None
Example: oModule.GetMotionSetupNames ()

Other Commands Recognized By the ModelSetup Module


The following command is also recognized by the ModelSetup module:
l GetSymmetryMultiplier
l SetSymmetryMultiplier

Motion Setup Script Commands G


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetSymmetryMultiplier
Use: Returns the symmetry multiplier of the model. Applicable to 2D and 3D Transient solution types.
Command: None
Syntax: oModule.GetSymmetryMultiplier ()
Return Value: The symmetry multiplier integer value.
Parameters: None
Example: oModule.GetSymmetryMultiplier ()
SetSymmetryMultiplier
Use: Sets the symmetry multiplier.This symmetry multiplier will be automatically applied to all input quantities including: input voltage,
inductance, resistance, load torque, mass, damping, external circuit; and all output quantities including: induced voltages, flux link-
ages in every winding, stranded loss, solid loss, core loss, torque and force.
Command: Maxwell3D or Maxwell2D>Model>Set Symmetry Multiplier
Syntax:SetSymmetryMultiplier <int>
Return Value: None
Parameters: <int>
Example: oModule.SetSymmetryMultiplier 2

Motion Setup Script Commands H


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

19 - Parameter Setup Script Commands


Parameter setup commands should be executed by the MaxwellParameterSetup module.
Set oModule = oDesign.GetModule("MaxwellParameterSetup")
oModule.CommandName <args>

Conventions Used in the Parameter Chapter


<ParameterName>
Type: <string>
Name of a parameter.
<ParameterNameArray>
Type: Array of strings
An array of the names in a group of parameters.
<AssignmentObjects>
Type: Array of strings
An array of object names.

General Parameter Setup Script Commands


Following are general script commands recognized by the MaxwellParameterSetup module:
l DeleteParameters
l DeleteAllParameters

Parameter Setup Script Commands 19-1


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

l RenameParameter
l ReassignParameter

Commands to Create and Edit Parameters


Following are script commands for creating and editing parameters that are recognized by the MaxwellParameterSetup module:
l AssignForce
l EditForce
l AssignTorque
l EditTorque
l AssignMatrix
l EditMatrix
l DeleteReduceMatrix
l RenameReduceMatrix
l AddReduceOp
l DeleteReduceOp
l EditReduceOp
l RenameReduceOp

AddReduceOp
Adds a reduce matrix group.

UI Access Right-click on the matrix and select either Join in Series... or Join in Parallel...

Parameters Name Type Description

Parameter Setup Script Commands 19-2


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<MatrixName> String Name of parent matrix


<ReduceMatrixName> String Name of reduce matrix
<ReduceOpArray> Array Array("NAME:<GroupName>",
"Type:=", one of "Join in Series" or "Join in Parallel",
"Sources:=", "<Source1>, <Source2, ...")

Return Value None

Python Syntax AddReduceOp (<MatrixName>, <ReduceMatrixName>, <ReduceOpArray>)


oModule = oDesign.GetModule("MaxwellParameterSetup")
oModule.AddReduceOp ("Matrix1", "ReduceMatrix1",
["NAME:JoinSeries1", "Type:=", "Join in Series",
Python Example
"Sources:=", "Current1,Current3"
])

VB Syntax AddReduceOp <MatrixName> <ReduceMatrixName> <ReduceOpArray>


Set oModule = oDesign.GetModule("MaxwellParameterSetup")
oModule.AddReduceOp "Matrix1", "ReduceMatrix1",
VB Example Array("NAME:JoinSeries1", "Type:=", "Join in Series",
"Sources:=", "Current1,Current3")
oModule.AddReduceOp "Matrix1", "ReduceMatrix2",

Parameter Setup Script Commands 19-3


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:JoinParallel1", "Type:=", "Join in Parallel",


"Sources:=", "Current2,Current4")

AssignForce
Creates a force.

UI Access Maxwell3D or Maxwell2D>Parameters>Assign>Force

Name Type Description


<ForceArray> Array Array containing force data:
Array("NAME:<ForceName>",
Parameters
"IsVirtual:=", <boolean>,
"ReferenceCS:=", <string>,
"Objects:=", <array of objects>)

Return Value None

Python Syntax AssignForce (<ForceArray>)


oModule = oDesign.GetModule("MaxwellParameterSetup")
oModule.AssignForce(
Python Example [ "NAME:Force1",
"Reference CS:=" , "Global",
"Is Virtual:=" , True,

Parameter Setup Script Commands 19-4


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Objects:=" , ["Core"]
])

VB Syntax AssignForce <ForceArray>


oModule.AssignForce
Array("NAME:Force1",
VB Example "Is Virtual:=", true,
"Reference CS:=", "Global",
"Objects:=", Array("Box1"))

[Beta] AssignLayoutForce
Creates a layout force.

UI Access Maxwell3D>Parameters>Assign>Force from Layout

Name Type Description


<ForceArray> Array Array containing force data:

Parameters Array("NAME:<ForceName>",
"ReferenceCS:=", <string>,
<array of nets and layers choices>)

Return Value None

Parameter Setup Script Commands 19-5


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax AssignLayoutForce (<ForceArray>)


oModule = oDesign.GetModule("MaxwellParameterSetup")
oModule.AssignLayoutForce(
[ "NAME:LayoutForce1",
"Reference CS:=" , "Global",
["NAME:NetsAndLayersChoices",
[
"NAME:LC1_1",
[
"NAME:NetLayerSetMap",
Python Example [
"NAME:net1",
"LayerSet:=" , ["Ground","Top"]
],
[
"NAME:net2",
"LayerSet:=" , ["Top"]
]
]
]

Parameter Setup Script Commands 19-6


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

]
])

VB Syntax AssignLayoutForce <ForceArray>


oModule.AssignLayoutForce
Array("NAME:LayoutForce4",
"Reference CS:=", "Global",
VB Example Array("NAME:NetsAndLayersChoices", Array("NAME:LC1_1",
Array("NAME:NetLayerSetMap",
Array("NAME:net1", "LayerSet:=", Array("Ground", "Top")),
Array("NAME:net2", "LayerSet:=", Array("Top"))))))

AssignMatrix
Use: Creates a matrix.
Command: Maxwell3D or Maxwell2D>Parameters>Assign>Matrix
Syntax:AssignMatrix <MatrixArray>
Return Value: None
Parameters:
<MatrixArray>
Array("NAME:<MatrixName>",
Array("NAME:MatrixEntry",
Array("NAME:MatrixEntry",
"Source:=", <string>,
"NumberOfTurns:=", <int>),

Parameter Setup Script Commands 19-7


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide


)
Array("NAME:MatrixGroup",
Array("NAME:MatrixGroup",
"GroupName:=", <string>,
"NumberOfBranches:=", <int>,
"Sources:=", <nameArray>),

))
Example:
oModule.AssignMatrix _
Array("NAME:Matrix1", _
Array("NAME:MatrixEntry", _
Array("NAME:MatrixEntry", _
"Source:=","Current1", _
"NumberOfTurns:=", "1"),
Array("NAME:MatrixEntry", _
"Source:=", "Current3", _
"NumberOfTurns:=", "1")), _
Array("NAME:MatrixGroup", _

Parameter Setup Script Commands 19-8


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:MatrixGroup", _
"GroupName:=", "Group1", _
"NumberOfBranches:=", "1", _
"Sources:=", "Current1,Current3")))

AssignTorque
Use: Creates a torque.
Command: Maxwell3D or Maxwell2D>Parameters>Assign>Torque
Syntax:AssignTorque <TorqueArray>
Return Value: None
Parameters:
<ForceArray>
Array("NAME:<TorqueName>",
"Is Virtual:=", <bool>,
"Coordinate System:=", <string>
"Axis:=", <string>,
"Is Positive:=", <bool>
"Objects:=", <AssignmentObjects>)
Example:
oModule.AssignTorque _
Array("NAME:Torque1", "Is Virtual:=", true, _
"Coordinate System:=", "Global", "Axis:=", "Z", _

Parameter Setup Script Commands 19-9


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Is Positive:=", true, "Objects:=", Array("Box3"))

DeleteAllParameters
Use: Deletes all parameters.
Command: Maxwell3D or Maxwell2D>Parameters>Delete All
Syntax:DeleteAllParameters
Return Value: None
Example: oModule.DeleteAllParameters

DeleteParameters
Deletes one or more specified parameters.

UI Access Delete button in Maxwell List dialog box (Maxwell3D or Maxwell2D>List)

Name Type Description


Parameters
<NameArray> string An array of parameter names

Return Value None

Python Syntax DeleteParameters ([<NameArray>])


Python Example oModule.DeleteParameters(["Force1", "Torque1"])

VB Syntax DeleteParameters <NameArray>

Parameter Setup Script Commands 19-10


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Example oModule.DeleteParameters Array("Force1", "Torque1")

DeleteReduceMatrix
Deletes a specified Reduce Matrix in the project.

UI Access Right-click on the desired reduce matrix item in Program Manager, then select Delete

Name Type Description


Parameters <MatrixName> String The name of the parent matrix
<ReduceMatrixName> String The name of the reduce matrix

Return Value None

Python Syntax DeleteReduceMatrix (<MatrixName>, <ReduceMatrixName>)


oModule.DeleteReduceMatrix ("Matrix1", "ReduceMatrix1")
Python Example

VB Syntax DeleteReduceMatrix <MatrixName>, <ReduceMatrixName>


VB Example oModule.DeleteReduceMatrix "Matrix1", "ReduceMatrix1"

DeleteReduceOp
Deletes a specified Reduce Matrix group in the project.

UI Access Right-click on the desired reduce matrix group item in Program Manager, then select Delete

Parameters Name Type Description

Parameter Setup Script Commands 19-11


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<MatrixName> String The name of the parent matrix


<ReduceMatrixName> String The name of the reduce matrix
<GroupName> String The name of the reduce matrix group

Return Value None

Python Syntax DeleteReduceOp (<MatrixName>, <ReduceMatrixName>, <GroupName>)


oModule.DeleteReduceOp ("Matrix1", "ReduceMatrix1", "JoinSeries1")
Python Example

VB Syntax DeleteReduceOp <MatrixName>, <ReduceMatrixName>, <GroupName>


VB Example oModule.DeleteReduceOp "Matrix1", "ReduceMatrix1", "JoinSeries1"

EditForce
Use: Edits a force parameter.
Command: Double-click the parameter in the project tree to edit it.
Syntax:EditForce <ParameterName>, <ForceArray>
Return Value: None

[Beta] EditLayoutForce
Creates a layout force.

Parameter Setup Script Commands 19-12


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access
Right-click the desired Layout Force Parameter in the project manager and select Properties... to open the Lay-
out Force Setup dialog for editing.

Name Type Description


<ForceArray> Array Array containing force data:

Parameters Array("NAME:<ForceName>",
"ReferenceCS:=", <string>,
<array of nets and layers choices>)

Return Value None

Python Syntax EditLayoutForce (<ForceArray>)


oModule = oDesign.GetModule("MaxwellParameterSetup")
oModule.EditLayoutForce(
[ "NAME:LayoutForce4",
"Reference CS:=" , "Global",
["NAME:NetsAndLayersChoices",
Python Example [
"NAME:LC1_1",
[
"NAME:NetLayerSetMap",
[
"NAME:net1",

Parameter Setup Script Commands 19-13


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"LayerSet:=" , ["Ground"]
],
[
"NAME:net2",
"LayerSet:=" , ["Top"]
]
]
]
]
])

VB Syntax EditLayoutForce <ForceArray>


Set oModule = oDesign.GetModule("MaxwellParameterSetup")
oModule.EditLayoutForce
Array("NAME:LayoutForce4",
VB Example "Reference CS:=", "Global",
Array("NAME:NetsAndLayersChoices", Array("NAME:LC1_1",
Array("NAME:NetLayerSetMap",
Array("NAME:net1", "LayerSet:=", Array("Ground")),
Array("NAME:net2", "LayerSet:=", Array("Top"))))))

Parameter Setup Script Commands 19-14


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

EditMatrix
Use: Edits a matrix parameter.
Command: Double-click the parameter in the project tree to edit it.
Syntax:EditMatrix <ParameterName>, <MatrixArray>
Return Value: None

EditReduceOp
Edits a reduce matrix group.

UI Access Right-click on the reduce matrix group and select Properties....

Name Type Description


<MatrixName> String Name of parent matrix
<ReduceMatrixName> String Name of reduce matrix
<GroupName> String Current name of the reduce matrix group
Parameters
<ReduceOpArray> Array Array("NAME:<NewGroupName>",
"Type:=", one of "Join in Series" or "Join in Parallel",
"Sources:=", "<Source1>, <Source2, ...")

Return Value None

Python Syntax EditReduceOp (<MatrixName>, <ReduceMatrixName>, <GroupName>, <ReduceOpArray>)


oModule = oDesign.GetModule("MaxwellParameterSetup")
Python Example oModule.EditReduceOp ("Matrix1", "ReduceMatrix1", "Group1"
["NAME:NewSeriesGroup", "Type:=", "Join in Series",

Parameter Setup Script Commands 19-15


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Sources:=", "Current1,Current3"
])

VB Syntax EditReduceOp <MatrixName>, <ReduceMatrixName>, <GroupName>, <ReduceOpArray>


Set oModule = oDesign.GetModule("MaxwellParameterSetup")
oModule.EditReduceOp "Matrix1", "ReduceMatrix1", "Group1"
VB Example
Array("NAME:NewSeriesGroup", "Type:=", "Join in Series",
"Sources:=", "Current1,Current3")

EditTorque
Use: Edits a torque parameter.
Command: Double-click the parameter in the project tree to edit it.
Syntax:EditTorque <ParameterName>, <TorqueArray>
Return Value: None

ReassignParameter
Use: Specifies a new geometry assignment for a parameter.
Command: Maxwell3D or Maxwell2D>Parameters>Reassign
Syntax:ReassignParameter Array("Name:<ParameterName>","Objects:=", <AssignmentObjects>)
Return Value: None

Parameter Setup Script Commands 19-16


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Example: oModule.ReassignParameter Array("NAME:Force1", _


"Objects:=", Array("Box2"))

RenameParameter
Use: Renames a parameter.
Command: Right-click the parameter item in the project tree, and click Rename.
Syntax:RenameParameter <OldName>, <NewName>
Return Value: None
Parameters:
<OldName>
Type: <string>
<NewName>
Type: <string>
Example: oModule.RenameParameter "Force1", "test"

RenameReduceMatrix
Renames a specified Reduce Matrix in the project.

UI Access Right-click on the desired reduce matrix item in Program Manager, then select Rename

Name Type Description


<MatrixName> String The name of the parent matrix
Parameters
<OldReduceMatrixName> String The old name of the reduce matrix
<NewReduceMatrixName> String The new name of the reduce matrix

Return Value None

Parameter Setup Script Commands 19-17


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax RenameReduceMatriz (<MatrixName>, <OldReduceMatrixName>, <NewReduceMatrixName>)


Python Example oModule.RenameReduceMatrix ("Matrix1", "ReduceMatrix1", "ReduceMatrix2")

VB Syntax RenameReduceMatrix <MatrixName>, <OldReduceMatrixName>, <NewReduceMatrixName>


VB Example oModule.RenameReduceMatrix "Matrix1", "ReduceMatrix1", "ReduceMatrix2"

RenameReduceOp
Renames a specified Reduce Matrix group in the project.

UI Access Right-click on the desired reduce matrix group item in Program Manager, then select Rename

Name Type Description


<MatrixName> String The name of the parent matrix
Parameters <ReduceMatrixName> String The name of the reduce matrix
<OldGroupName> String The old name of the reduce matrix group
<NewGroupName> String The new name of the reduce matrix group

Return Value None

Python Syntax RenameReduceOp (<MatrixName>, <ReduceMatrixName>, <OldGroupName>, <NewGroupName>)


oModule.RenameReduceOp ("Matrix1", "ReduceMatrix1", "Series1", "Series2")
Python Example

Parameter Setup Script Commands 19-18


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax RenameReduceOp <MatrixName>, <ReduceMatrixName>, <OldGroupName>, <NewGroupName>


VB Example oModule.RenameReduceOp "Matrix1", "ReduceMatrix1", "Series1", "Series2"

Parameter Setup Script Commands 19-19


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

19-20
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

20 - User Defined Document Script Commands


The product has to implement the GetModule call to create the UserDefinedDocument scripting object (e.g., Check
AltraSimDesign.cpp (function GetMgrIDispatch()). To access the UserDefinedDocuments scripting object, use:
Set oModule = oDesign.GetModule("UserDefinedDocuments")
Once you have the scripting object, you can use the following methods:
l AddDocument
l EditDocument
l RenameDocument
l DeleteDocument
l UpdateDocument
l ViewHtmlDocument
l ViewPdfDocument
l SaveHtmlDocumentAs
l SavePdfDocumentAs
l GetDocumentDefinitionNames
l DeleteAllDocuments
l UpdateAllDocuments

You can find examples of how to use these methods on each of the methods' pages. A complete example of a Python script is also
available, as is an example with a line by line explanation.

AddDocument
Creates a new document based on provided data and traces. The document names come from UserDefinedDocument folder under
syslib, userlib, and personallib. This creates a document and places it in the Project Manager under Results > Documents.

User Defined Document Scripting Interface 20-1


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access Right click on Results > Create Document. Choose a document name.

Name Type Description


Parameters <data> Array Data the defines the document.
<traces> Array trace data for the inputs in the document.

Return Value None

Python Syntax AddDocument (<data>, <traces>)


oModule.AddDocument(
[
"NAME:Design Summary",
"",
"SysLib",
Python Example
"DesignSummary",
["NAME:Inputs"]
],
["NAME:DocTraces"]
)

VB Syn- AddDocument <data>, <traces>


tax

User Defined Document Scripting Interface 20-2


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

In this example, the document names come from the UserDefinedDocument folder in the syslib, userlib, and personallib
folders. This creates a document and places it in the Documents folder under results.
oModule.AddDocument _
Array("NAME:Design Summary", _
"", "SysLib", "DesignSummary", _
Array("NAME:Inputs")), _
Array("NAME:DocTraces")
The following example is explained in Explication of a Sample UDD Script.
oModule.AddDocument Array("NAME:Test Report1", "Test Report", "SysLib", _
"Examples/TestUDDInputs", Array("NAME:Inputs", Array("NAME:DLMetrics", "Solution", _
"Data Line Metrics", -1, -1), Array("NAME:DQ0", "Trace", "DQ0", -1, -1), _
VB
Example Array("NAME:DQS", "Trace", "DQS", -1, -1), _
Array("NAME:Name", "Text", "User Name", Array("Sita Ramesh")), _
Array("NAME:Summary", "Bool", "Display Summary", Array(true)), _
Array("NAME:Version", "Number", "Script Version"))), _
Array("NAME:DocTraces", Array("NAME:DLMetrics", _
Array("User Defined", "", "DDR3 AC-Timing 4-DQ1", Array("Context:=", ""), _
Array("Index:=", Array("All"), "Trise:=", Array( "Nominal"), "Tfall:=", _
Array("Nominal"), "Pulse_Width:=", Array("Nominal"), _
"Data_Rate:=", Array( "Nominal"),"Length:=", Array("Nominal")), _
Array("Probe Component:=", Array("")), Array())), _
Array("NAME:DQ0", Array( _

User Defined Document Scripting Interface 20-3


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Standard", "DQ0", "NexximTransient", Array("NAME:Context", "SimValueContext:=", Array


( _
1, 0, 2, 0, false, false, -1, 1, 0, 1, 1, "", 0, 0, _
"DE", false, "0", "DP", false, "20000000", "DT", false, "0.001", "WE", _
false, "100ns", "WM", false, "100ns", "WN", false, "0ps", "WS", false, "0ps")), _
Array("Time:=", Array("All"), "Trise:=", Array("Nominal"), "Tfall:=", Array("Nom-
inal"), _
"Pulse_Width:=", Array("Nominal"), "Data_Rate:=", Array("Nominal"), _
"Length:=", Array("Nominal")), Array("Probe Component:=", Array("DQ0")), Array())))

DeleteAllDocuments
Deletes all documents in the object.

UI Access Right click on Documents in the Project Manager and click Delete All Documents.
Parameters None.
Return Value None.

Python Syntax DeleteAllDocuments()


Python Example oModule.DeleteAllDocuments()

VB Syntax DeleteAllDocuments

User Defined Document Scripting Interface 20-4


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Example oModule.DeleteAllDocuments

DeleteDocument
Deletes a specified document.

UI Access Right click on the created document in the Project Manager under Results > Documents and click Delete.

Name Type Description


Parameters
<name> String Name of the document to be deleted.

Return Value None.

Python Syntax DeleteDocument(<names>)


Python Example oModule.DeleteDocument("Project Design Summary")

VB Syntax DeleteDocument <names>


oModule.DeleteDocument "Project Design Summary"
VB Example

EditDocument
Edits specified documents. If the document pops up a dialog box, the user can make a change the inputs for the document. The doc-
ument is regenerated and updated. A new one is not created.

Right click on the created document in the Project Manager under Results > Documents and click Modify doc-
UI Access
ument.

User Defined Document Scripting Interface 20-5


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


<originalName> String Name of the original document
Parameters
<modifiedData> Array New data to add to or modify the document
<modifiedraces> Array Trace data for the inputs of the document

Return Value None.

Python Syntax EditDocument( <name>,<data>,<traces>)


oModule.EditDocument("Design Summary",
[
"NAME:Design Summary",
"",
"SysLib",
Python Example
"DesignSummary",
["NAME:Inputs"]
],
["NAME:DocTraces"]
)

VB Syntax EditDocument <name>, <data>, <traces>

User Defined Document Scripting Interface 20-6


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oModule.EditDocument "Design Summary", _


VB Example Array("NAME:Design Summary", "", "SysLib", _
"DesignSummary", Array("NAME:Inputs")), Array("NAME:DocTraces")

GetDocumentDefinitionNames
Document definition names are the list of names that can be used to create a document. They appear when you click on Create doc-
ument. This method returns the filenames of document definitions according to the files in the installation directories:
l syslib/UserDefinedDocuments
l userlib/UserDefinedDocuments
l personalllb/UserDefinedDocuments

UI Access NA

Name Type Description


Parameters
<separator> String Separator used to convey the directory "level"

Return Value None.

Python Syntax GetDocumentDefinitionNames(<separator>)


Python Example oModule.GetDocumentDefinitionNames("/")

VB Syntax GetDocumentDefinitionNames <separator>


VB Example oModule.GetDocumentDefinitionNames "/"

User Defined Document Scripting Interface 20-7


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetDocumentNames
Retrieves the names for all documents.

UI Access N/A
Parameters None.
Return Value Array of strings containing document names.

Python Syntax GetDocumentNames()


Python Example oModule.GetDocumentNames()

VB Syntax GetDocumentNames
VB Example oModule.GetDocumentNames

RenameDocument
Changes the name of a document.

UI Access Right click on the created document in the Project Manager under Results> Documents and click Rename.

Name Type Description


Parameters <oldName> String Current name of the document
<newName> String New name of the document

User Defined Document Scripting Interface 20-8


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value None.

Python Syntax RenameDocument(<oldName>, <newName>)


Python Example oModule.RenameDocument("Design Summary", "Project Design Summary")

VB Syntax RenameDocument <oldName>, <newName>


VB Example oModule.RenameDocument "Design Summary", "Project Design Summary"

SaveHtmlDocumentAs
Saves a pre-existing HTML file to a different name and/or location.

Right click on the created document in the Project Manager under Results > Documents and click Save As >
UI Access
HTML.

Name Type Description


Parameters <name> String Name of the document to be saved.
<saveTo> String File path to save the document to.

Return Value none

Python Syntax SaveHtmlDocumentAs(<name>, <saveTo>)


Python Example oModule.SaveHtmlDocumentAs("Design Summary 1", "DS1.html")

User Defined Document Scripting Interface 20-9


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax SaveHtmlDocumentAs <name> <saveTo>


VB Example oModule.SaveHtmlDocumentAs "Design Summary 1" "DS1.html"

SavePdfDocumentAs
Saves a pre-existing PDF file to a different name and/or location.

Right click on the created document in the Project Manager under Results > Documents and click Save As >
UI Access
PDF.

Name Type Description


Parameters <name> String Name of the document to be saved.
<saveTo> String File path to save the document at.

Return Value None.

Python Syntax SavePdfDocumentAs(<name>, <saveTo>)


Python Example oModule.SavePdfDocumentAs("Design Summary 1", "DS1.pdf")

VB Syntax SavePdfDocumentAs <name>, <saveTo>


VB Example oModule.SavePdfDocumentAs "Design Summary 1", "DS1.pdf"

UpdateAllDocuments
Refreshes the contents of all created documents. This action is made on the folder rather than the individual document.

User Defined Document Scripting Interface 20-10


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access Right click on Results > Documents in the Project Manager and click Update All Documents.
Parameters None.
Return Value None.

Python Syntax UpdateAllDocuments()


Python Example oModule.UpdateAllDocuments()

VB Syntax UpdateAllDocuments
VB Example oModule.UpdateAllDocuments

UpdateDocument
Refreshes the contents of the selected document.

Right click on the created document in the Project Manager under Results > Documents and click Update
UI Access
Document.

Name Type Description


Parameters
<name> String Name of the document to be updated

Return Value None.

User Defined Document Scripting Interface 20-11


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax UpdateDocument(<name>)


Python Example oModule.UpdateDocument("Test UDD Report")

VB Syntax UpdateDocument <name>


VB Example oModule.UpdateDocument "Test UDD Report"

ViewHtmlDocument
Displays a pre-existing document as HTML.

Right click on the created document in the Project Manager under Results > Documents and click View Xml
UI Access
Document.

Name Type Description


Parameters
<name> String Name of the document to be viewed as a HTML

Return Value None

Python Syntax ViewHtmlDocument(<name>)


Python Example oModule.ViewHtmlDocument("Design Summary 1")

VB Syntax ViewHtmlDocument <name>


VB Example oModule.ViewHtmlDocument "Design Summary 1"

User Defined Document Scripting Interface 20-12


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

ViewPdfDocument
Displays a pre-existing document as a PDF file.

Right click on the created document in the Project Manager under Results > Documents and click View PDF
UI Access
Document.

Name Type Description


Parameters
<name> String Name of the document to be viewed as a PDF

Return Value None.

Python Syntax ViewPdfDocument(<name>)


Python Example oModule.ViewPdfDocument("Design Summary 1")

VB Syntax ViewPdfDocument <name>


VB Example oModule.ViewPdfDocument "Design Summary 1"

Explication of a Sample UDD Script


This VB script defines a document. It is a portion of one of the UDD example VB scripts.

Array("NAME:Test Report", ' Name of the document


"Test Report", ' Description of the document
"SysLib", ' Location of the python script: Syslib, Userlib, PeronalLib, etc.
"TestUDDReport", ' Relative path of the script in the UserDefinedDocuments folder

' This array is the start of the input definition.

User Defined Document Scripting Interface 20-13


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:Inputs", ' Document Inputs keyword

' This array contains the Solution input.


Array("NAME:DLMetrics", ' Input name
"Solution", ' Solution Input Type
"Data Line Metrics", ' Input Description
-1, ' Solution ID
-1), ' Report ID

' This array contains the trace input.


Array("NAME:DQ0", ' Input name
"Trace", ' Trace Input Type
"DQ0", ' Input Description
-1, ' Solution ID
-1), ' Report ID

' This array contains the text input.


Array("NAME:Name", ' Input name
"Text", ' Text Input Type
"User Name", ' Input Description
Array("Sita Ramesh")), ' Default Value

' This array contains the Bool input.


Array("NAME:Summary", ' Input name
"Bool", ' Boolean Input Type
"Display Summary", ' Input Description
Array(true)), ' Default Value

' This array contains the number input.

User Defined Document Scripting Interface 20-14


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:Version", ' Input name


"Number", ' Number Input Type
"Script Version", ' Input Description
Array(1021)))), ' Default Value

' This array contains trace selection for the solution and trace inputs.
Array("NAME:DocTraces", ' Document traces keyword

' This array has input for "DLMetrics".


Array("NAME:DLMetrics", ' Input name

' This array defines a trace similar to the UDO. This trace definition is a User defined solution
Array("User Defined", "", "DDR3 AC-Timing 4-DQ1", Array("Context:=", ""), Array("Index:=", Array
("All"), "Trise:=", Array("Nominal"), "Tfall:=", Array("Nominal"), "Pulse_Width:=", Array("Nom-
inal"), "Data_Rate:=", Array("Nominal"), "Length:=", Array("Nominal")), Array("Probe Com-
ponent:=", Array("")), Array())),

' This array is for input "DQ0".


Array("NAME:DQ0",

' This array defines a trace similar to the UDO. This trace definition is a Standard solution.
Array("Standard", "DQ0", "NexximTransient", Array("NAME:Context", "SimValueContext:=", Array(1,
0, 2, 0, false, false, -1, 1, 0, 1, 1, "", 0, 0, "DE", false, "0", "DP", _
false, "20000000", "DT", false, "0.001", "WE", false, "100ns", "WM", false, _
"100ns", "WN", false, "0ps", "WS", false, "0ps")), Array("Time:=", Array("All"), "Trise:=",
Array( _
"Nominal"), "Tfall:=", Array("Nominal"), "Pulse_Width:=", Array("Nominal"), "Data_Rate:=", Array
("Nominal"), "Length:=", Array("Nominal")), Array("Probe Component:=", Array( _
"DQ0")), Array())))

Example Python Script: Defining a Document


This script creates a user-defied solution and a document.

User Defined Document Scripting Interface 20-15


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oProject = oDesktop.SetActiveProject("BJT_Inverter")
oDesign = oProject.SetActiveDesign("Nexxim1")
oModule = oDesign.GetModule("UserDefinedSolutionModule")

oModule.CreateUserDefinedSolution("UDS Distance Trace Arithmetic Result1", "SysLib", "TraceArith-


metic/Distance Sweep Trace Arithmetic",
[
"Offset 1:=", "0",
"Scale 1:=", "1",
"Offset 2:=", "0",
"Scale 2:=", "1",
"Operation:=", "Add"
],
[
[
"Standard",
"probe1",
"Transient",
[
style="font-family: monospace;">"NAME:Context",
style="font-family: monospace;">"SimValueContext:=", [1,0,2,0,False,False,-
1,1,0,1,1,"",0,0,"DE",False,"0","DP",False,"500000000","DT",False,"0.001","NUMLEVELS",False,"0","-
WE",False,"10us","WM",False,"10us","WN",False,"0ns","WS",False,"0ns"]
],
[
"Time:=", ["All"]
],
[
"Probe Component:=", ["V(Port1)"]

User Defined Document Scripting Interface 20-16


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

],
[]
],
[
"Standard",
"probe2",
"Transient",
[
"NAME:Context",
"SimValueContext:=", [1,0,2,0,False,False,-
1,1,0,1,1,"",0,0,"DE",False,"0","DP",False,"500000000","DT",False,"0.001","NUMLEVELS",False,"0",-
"WE",False,"10us","WM",False,"10us","WN",False,"0ns","WS",False,"0ns"]
],
[
"Time:=", ["All"]
],
[
"Probe Component:=", ["V(Port1)"]
],
[]
]
],
[])
oModule = oDesign.GetModule("UserDefinedDocuments")
oModule.AddDocument(
[
"NAME:Test Report",
"Test Report",
"SysLib",
"TestUDDInputs",
[
"NAME:Inputs",
[
"NAME:UDS1",

User Defined Document Scripting Interface 20-17


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Solution",
"UDS Distance Trace Arithmetic Result1",
1000000,
0
],
[
"NAME:UDS2",
"Solution",
"UDS Distance Trace Arithmetic Result2",
1000000,
2
]
]
],
[
"NAME:DocTraces",
[
"NAME:UDS1",
[
"User Defined",
"",
"UDS Distance Trace Arithmetic Result1",
[
"Context:=", ""
],
[
"Distance:=", ["All"]
],
[
"Probe Component:=", [""]
],
[]

User Defined Document Scripting Interface 20-18


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

]
],
[
"NAME:UDS2",
[
"User Defined",
"",
"UDS Distance Trace Arithmetic Result1",
[
"Context:=", ""
],
[
"Distance:=", ["All"]
],
[
"Probe Component:=", [""]
],
[]
]
]
])

User Defined Document Scripting Interface 20-19


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

20-20
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

21 - User Defined Solutions Commands


User Defined Solution commands should be executed by the "UserDefinedSolutionModule" module.

Set oDesign = oProject.SetActiveDesign("TestDesign1")


Set oModule =
oDesign.GetModule("UserDefinedSolutionModule")
The list of commands is as follows:

CreateUserDefinedSolution
DeleteUserDefinedSolutions
EditUserDefinedSolution

CreateUserDefinedSolution
Creates a new user defined solution.

UI Access Right-click on Results > Create User Defined Solution.

Name Type Description


<SoluName> String Name of user defined solution.
<LibType> String Indicates the library where the UDS plugin file is located. This parameter must
Parameters be one of the following values: "SysLib", "UserLib", "PersonalLib".
<RelativePath> String The path of the UDS plugin file relative to the "UserDefinedOutputs" sub-
directory of the library specified by <LibType>.
<PropList> Array Strings specify name-value pairs corresponding to the UDS properties spe-
cified in the plugin file.

User Defined Solutions Commands 21-1


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

For example:
Array("multiply_factor:=", "2.0", "component_name:=",
"resistor1")
<ProbeSelections> Array Name of the probe being specified. Note: this must match a probe name spe-
cified in the UDS plugin file.
<DynamicProbes> Array Array of <ProbeSelection>'s, representing the probes that are used by
dynamic-probes.

Return Value String name of created user defined solution.

CreateUserDefinedSolution(<SoluName>, <LibType>, <RelativePath>, <PropList>, <ProbeSelections>,


Python Syntax
<DynamicProbes>)
oModule.CreateUserDefinedSolution(
Python Example "ConstantTimestep1", "SysLib",
"ConstantTimestep", [], [], [])

CreateUserDefinedSolution <SoluName>, <LibType>, <RelativePath>, <PropList>, <ProbeSelections>,


VB Syntax
<DynamicProbes>
oModule.CreateUserDefinedSolution "User Defined Solution 1", _
"SysLib", "Example", _
VB Example Array("multiplication_factor:=", "1.2"), _
Array(Array("Modal Solution Data",
"Probe 1", "Setup1 : LastAdaptive", _

User Defined Solutions Commands 21-2


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array(), Array("Freq:=", Array( "All")), _


Array("Probe Component:=", Array("dB(S(1,1))")), Array()), _
Array( "Modal Solution Data", "Probe 2",
"Setup1 : LastAdaptive", Array(), _
Array("Freq:=", Array( "All")), _
Array("Probe Component:=", Array("mag(S(1,1))")), Array())), _
Array(Array("Modal Solution Data", _
"Dynamic Probe 1", "Setup1 : LastAdaptive", Array(), _
Array("Freq:=", Array( "All")), _
Array("Probe Component:=", Array("Freq")), Array()))

DeleteUserDefinedSolutions
Deletes one or more user defined solutions.

UI Access Delete button from the User Defined Solutions dialog.

Name Type Description


Parameters
<SoluNames> Array Array of strings containing names of User Defined Solutions to be deleted.

Return Value None.

Python Syntax DeleteUserDefinedSolutions(<SoluNames>)


Python Example oModule.DeleteUserDefinedSolutions(["Solution1", "Solution2"])

User Defined Solutions Commands 21-3


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax DeleteUserDefinedSolutions <SoluNames>


oModule.DeleteUserDefinedSolutions _
VB Example
Array("Solution1", "Solution2")

EditUserDefinedSolution
Modifies an existing user defined solution.

UI Access Edit button from the User Defined Solutions dialog box.

Name Type Description


<SoluName> String Name of user defined solution to be edited.
<NewSoluName> String New name for the specified user defined solution.
<LibType> String Indicates the library where the UDS plugin file is located. This parameter must
be one of the following values: "SysLib", "UserLib", "PersonalLib".
<RelativePath> String The path of the UDS plugin file relative to the "UserDefinedOutputs" sub-
directory of the library specified by <LibType>.
<PropList> Array Strings specify name-value pairs corresponding to the UDS properties spe-
Parameters cified in the plugin file.
For example:
Array("multiply_factor:=", "2.0", "component_name:=",
"resistor1")
<ProbeSelections> Array Name of the probe being specified. Note: this must match a probe name spe-
cified in the UDS plugin file.
<DynamicProbes> Array Array of <ProbeSelection>'s, representing the probes that are used by
dynamic-probes.

Return Value String name of update user defined solution.

User Defined Solutions Commands 21-4


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

EditUserDefinedSolution(<SoluName>, <NewSoluName>, <LibType>, <RelativePath>, <PropList>,


Python Syntax
<ProbeSelections>, <DynamicProbes>)
oModule.EditUserDefinedSolution("ConstantTimestep1"
Python Example "ConstantTimestep1After", "SysLib",
"ConstantTimestep", [], [], [])

EditUserDefinedSolution <SoluName>, <NewSoluName>, <LibType>, <RelativePath>, <PropList>,


VB Syntax
<ProbeSelections>, <DynamicProbes>
oModule.CreateUserDefinedSolution "User Defined Solution 1", _
"User Defined Solution 1", "SysLib", "Example", _
Array("multiplication_factor:=", "1.2"), _
Array(Array("Modal Solution Data",
"Probe 1", "Setup1 : LastAdaptive", _
Array(), Array("Freq:=", Array( "All")), _
VB Example Array("Probe Component:=", Array("dB(S(1,1))")), Array()), _
Array( "Modal Solution Data", "Probe 2",
"Setup1 : LastAdaptive", Array(), _
Array("Freq:=", Array( "All")), _
Array("Probe Component:=", Array("mag(S(1,1))")), Array())), _
Array(Array("Modal Solution Data", _
"Dynamic Probe 1", "Setup1 : LastAdaptive", Array(), _

User Defined Solutions Commands 21-5


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("Freq:=", Array( "All")), _


Array("Probe Component:=", Array("Freq")), Array()))

User Defined Solutions Commands 21-6


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

22 - Network Data Explorer Script Commands


Network Data Explorer (NDE) scripting uses three objects, each with unique script commands:
l Network Data Explorer – top-level object obtained by calling oNDE=oDesktop.GetTool("ndExplorer"). Network Data Explorer
commands are called using oNDE.
l Network Data – single set of S-parameters, corresponding to a single entry in the UI tree. Network Data commands are called
using oData.
l Post Process Settings – settings that can be applied and removed from network data without making permanent changes to
the underlying data. Post Process Settings commands are called using oPostProc.

Examples using the above objects:


oNDE = oDesktop.GetTool("ndExplorer")
oData = oNDE.Open("D:\folder\test.s2p")
success = oPostProc.AddDiffPair(2, 1, "Diff1", "Comm1", 100, 25)
The following commands are described in this section:

Warning: The following commands are preliminary. Their syntax


may change. Be prepared to make changes to legacy scripts.

AddDiffPair
Cascade (SPISim)
ClearDiffPairs
Clone
Close

Network Data Explorer Script Commands 22-1


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Combine (SPISim)
Deembed (SPISim)
DeembedBack (SPISim)
DeembedFront (SPISim)
DisableDiffPairs
EnableDiffPairs
ExportCitiFile
ExportFullWaveSpice
ExportMatlab
ExportNMFData
ExportNetworkData
ExportSpreadsheet
ExportTouchstone
ExportTouchstone2
Extract (SPISim)
GetFrequencies
GetFrequencyCount
GetName
GetPortCount
GetPortNumber

Network Data Explorer Script Commands 22-2


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetPostProcSettings
GetSolutionVariation
GetVariation
HasSameData
LoadSolution
Open
Rename (SPISim)
Renormalize (SPISim)
Reorder
Reorder (SPISim)
Reset
SetAllPortImpedances
SetAllPortImpedances
SetPortDeembedDistance
SetPortImpedance
SetPostProcSettings
Smooth
Stretch (SPISim)
Terminate

Network Data Explorer Script Commands 22-3


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

AddDiffPair
Specifies a differential pair from two terminal ports.

From the Network Data Explorer tab, select Differential Pairs in the NDE ribbon to open the Differential
UI Access
Pairs window. Then select differential pairs from the Pairs group box and click Add Pairs >>.

Name Type Description


<positiveTerminal> Integer The portNumber of the positive terminal.
<negativeTerminal> Integer The portNumber of the negative terminal.
<diffName> String The new name of the differential pin (e.g., Diff1).
<commName> String The new name of the common pin (e.g., Comm1).
Parameters <diffImpedance> Double The differential pin characteristic impedance.
<commImpedance> Double The common pin characteristic impedance.
<matched> Boolean Specify whether to use matched pair.

Note: The default value is False.

Return Value Boolean.

Python Syntax AddDiffPair()


Python success = oPostProc.AddDiffPair(2, 1, "Diff1", "Comm1", 100, 25)
Example

Network Data Explorer Script Commands 22-4


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax AddDiffPair
VB Example Set success = oPostProc.AddDiffPair 2, 1, "Diff1", "Comm1", 100, 25

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Cascade (SPISim)
Creates new network data from a group of network data objects cascaded together. The network data must have an even number of
terminal ports and must have the same number of ports.

Note: Cascade opens and interacts with SPISim to complete.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Cascade from the
UI Access
drop-down menu.

Name Type Description


Parameters <dataArray> Array These network data objects are cascaded together to create the
new network data.

Network IDispatch.

Return Value Note: Cascade returns None if the specified network data does not have compatible terminal ports
defined.

Network Data Explorer Script Commands 22-5


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax Cascade()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData2 = oNDE.Cascade([oData1, oData2, oData3])

VB Syntax Cascade
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData2 = oNDE.Cascade Array(oData1, oData2, oData3)

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

ClearDiffPairs
Clears all differential pair definitions. All other post-processing settings remain the same.

From the Network Data Explorer tab, select Differential Pairs in the NDE ribbon to open the Dif-
UI Access
ferential Pairs window. Then select differential pairs from the rightmost box and click << Remove Pairs.
Parameters None.
Return Value None.

Python Syntax ClearDiffPairs()

Network Data Explorer Script Commands 22-6


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oPostProc.ClearDiffPairs()

VB Syntax ClearDiffPairs
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
oPostProc.ClearDiffPairs

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Clone
Creates a copy of the network data object.

From the Network Data Explorer tab, select the network data object to clone. Then select Clone from
UI Access
the NDE ribbon.

Parameters None.
Return Value Network IDispatch.

Python Syntax Clone()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData1 = oData.Clone()

Network Data Explorer Script Commands 22-7


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax Clone
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData1 = oData.Clone

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Close
Closes the network data object. The object will no longer be accessible.

UI Access From the Network Data Explorer tab, click Close in the NDE ribbon, or select File > Close.

Parameters None.
Return Value None.

Python Syntax Close()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData.Close()

VB Syntax Close
VB Example Set oNDE = oDesktop.GetTool("ndExplorer")

Network Data Explorer Script Commands 22-8


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oData.Close

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Combine (SPISim)
Combines frequencies from multiple network data objects to create a new network data with all of the frequencies.

Note: Combine opens and interacts with SPISim to complete.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Combine from the
UI Access
drop-down menu.

Name Type Description


<dataArray> Array These network data objects are combined to create the new net-
work data.
Parameters
<freqTol> Double If abs(f1 – f2) < freqTol, f1 and f2 are considered the same fre-
quency.

Note: The default value is 100.

Network IDispatch.
Return Value
Note: Combine returns None if the network data does not have the same number of ports.

Network Data Explorer Script Commands 22-9


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax Combine()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData4 = oNDE.Combine([oData1, oData2, oData3], 1000)

VB Syntax Combine
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData4 = oNDE.Combine Array(oData1, oData2, oData3), 1000

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Deembed (SPISim)
Creates a new network data, dembedding the frontData and the backData from the front and back of the originalData.

Note: Deembed opens and interacts with SPISim to complete.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Deembed from the
UI Access drop-down menu to open the Deembed... window, and choose Given 3 S-params in order of: Total, Front,
Back from the Settings group box.

Name Type Description


Parameters <originalData> Object Original network data that is deembeded.
<frontData> Object Network data that is deembeded from the front of the original.

Network Data Explorer Script Commands 22-10


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<backData> Object Network data that is deembeded from the back of the original.

Network IDispatch.

Return Value Note: Deembed returns None if the specified network data does not have compatible terminal ports
defined.

Python Syntax Deembed()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData2 = oNDE.Deembed(oData1, oDataFront, oDataBack)

VB Syntax Deembed
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData2 = oNDE.Deembed oData1, oDataFront, oDataBack

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

DeembedBack (SPISim)
Creates a new network data, dembedding the backData from the back of the originalData.

Note: DeembedBack opens and interacts with SPISim to complete.

Network Data Explorer Script Commands 22-11


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Deembed from the
UI Access drop-down menu to open the Deembed... window, and choose Given 3 S-params in order of: Total, Back
from the Settings group box.

Name Type Description


Parameters <originalData> Object Original network data that is deembeded.
<backData> Object Network data that is deembeded from the back of the original.

Network IDispatch.

Return Value Note: DeembedBack returns None if the specified network data does not have compatible terminal
ports defined.

Python Syntax DeembedBack()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData2 = oNDE.DeembedBack(oData1, oDataBack)

VB Syntax DeembedBack
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData2 = oNDE.DeembedBack oData1, oDataBack

Network Data Explorer Script Commands 22-12


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

DeembedFront (SPISim)
Creates a new network data, dembedding the frontData from the front of the originalData.

Note: DeembedFront opens and interacts with SPISim to complete.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Deembed from the
UI Access drop-down menu to open the Deembed... window, and choose Given 3 S-params in order of: Total, Front
from the Settings group box.

Name Type Description


Parameters <originalData> Object Original network data that is deembeded.
<frontData> Object Network Data that is deembeded from the front of the original.

Network IDispatch.

Return Value Note: DeembedFront returns None if the specified network data does not have compatible terminal
ports defined.

Python Syntax DeembedFront()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData2 = oNDE.DeembedFront(oData1, oDataFront)

Network Data Explorer Script Commands 22-13


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax DeembedFront
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData2 = oNDE.DeembedFront oData1, oDataFront

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

DisableDiffPairs
Deactivates all differential pair definitions. This script does not remove them, so they can be reactivated.

From the Network Data Explorer tab, select Differential Pairs in the NDE ribbon to open the Dif-
ferential Pairs window. Once differential pairs have been added to the rightmost box (i.e., select dif-
UI Access
ferential pairs from the Pairs group box and click Add Pairs >>), remove check marks from the Enabled
column to deactivate the corresponding differential pairs.
Parameters None.
Return Value None.

Python Syntax DisableDiffPairs()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oPostProc.DisableDiffPairs()

Network Data Explorer Script Commands 22-14


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax DisableDiffPairs
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
oPostProc.DisableDiffPairs

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

EnableDiffPairs
Enables all differential pair definitions.

From the Network Data Explorer tab, select Differential Pairs in the NDE ribbon to open the Dif-
ferential Pairs window. Once differential pairs have been added to the rightmost box (i.e., select dif-
UI Access
ferential pairs from the Pairs group box and click Add Pairs >>), add check marks to the Enabled column
to activate the corresponding differential pairs.
Parameters None.
Return Value None.

Python Syntax EnableDiffPairs()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
success = oPostProc.EnableDiffPairs()

VB Syntax EnableDiffPairs

Network Data Explorer Script Commands 22-15


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Set oNDE = oDesktop.GetTool("ndExplorer")


VB Example
Set success = oPostProc.EnableDiffPairs

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

ExportCitiFile
Writes the S-parameters to disk in Citifile format (*.cit text file).

From the Network Data Explorer tab, select File > Save As to open a Save As explorer window. Then select
UI Access
Citifile (*.cit) from the Save as type: drop-down menu.

Name Type Description


<filePath> String The full path to the file.
<matrixType> Integer One of the following:
l 0 – S-Parameters
l 1 – Y-Parameters
l 2 – Z-Parameters
Parameters l 3 – Gamma
l 4 – Impedance

Note: The default value is 0.

<formalType> Integer One of the following:


l 0 – Magnitude/Angle (degrees)

Network Data Explorer Script Commands 22-16


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

l 1 – Real/Imaginary
l 2 – dB/Angle (degrees)

Note: The default value is 0.

<precision> Integer The number of significant figures.

Note: The default value is 10.

<frequencies> Array of A subset of the calculated frequencies. Any array values that don’t
Doubles have calculated data will be ignored. An empty array will cause all
frequencies to be written.

Note: The default value is an empty array.

Return Value Boolean True if file was successfully written; else False.

Python Syntax ExportCitiFile()

Python oNDE = oDesktop.GetTool("ndExplorer")


Example success = oData.ExportCitiFile("D:\folder\ne133.cit", 0, 1, 12, [])

VB Syntax ExportCitiFile
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set success = oData.ExportCitiFile "D:\folder\ne133.cit", 0, 1, 12, Array()

Network Data Explorer Script Commands 22-17


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

ExportMatlab
Writes the S-parameters to disk in Matlab format (*.m text file).

From the Network Data Explorer tab, select File > Save As to open a Save As explorer window. Then select
UI Access
MATLAB (*.m) from the Save as type: drop-down menu.

Name Type Description


<filePath> String The full path to the file.
<matrixType> Integer One of the following:
l 0 – S-Parameters
l 1 – Y-Parameters
l 2 – Z-Parameters
l 3 – Gamma
Parameters l 4 – Impedance

Note: The default value is 0.

<formalType> Integer One of the following:


l 0 – Magnitude/Angle (degrees)
l 1 – Real/Imaginary
l 2 – dB/Angle (degrees)

Network Data Explorer Script Commands 22-18


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note: The default value is 0.

<precision> Integer The number of significant figures.

Note: The default value is 10.

<frequencies> Array of A subset of the calculated frequencies. Any array values that don’t
Doubles have calculated data will be ignored. An empty array will cause all
frequencies to be written.

Note: The default value is an empty array.

Return Value Boolean True if file was successfully written; else False.

Python Syntax ExportMatlab()

Python oNDE = oDesktop.GetTool("ndExplorer")


Example success = oData.ExportMatlab("D:\folder\ne133.m", 0, 1, 12, [])

VB Syntax ExportMatlab
Set oNDE = oDesktop.GetTool "ndExplorer"
VB Example
Set success = oData.ExportMatlab "D:\folder\ne133.m", 0, 1, 12, Array()

Network Data Explorer Script Commands 22-19


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

ExportSpreadsheet
Writes the S-parameters to disk in spreadsheet format (*.tab text file).

From the Network Data Explorer tab, select File > Save As to open a Save As explorer window. Then select
UI Access
Data Table (spreadsheet) (*.tab) from the Save as type: drop-down menu.

Name Type Description


<filePath> String The full path to the file.
<matrixType> Integer One of the following:
l 0 – S-Parameters
l 1 – Y-Parameters
l 2 – Z-Parameters
l 3 – Gamma
Parameters l 4 – Impedance

Note: The default value is 0.

<formalType> Integer One of the following:


l 0 – Magnitude/Angle (degrees)
l 1 – Real/Imaginary
l 2 – dB/Angle (degrees)

Network Data Explorer Script Commands 22-20


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note: The default value is 0.

<precision> Integer The number of significant figures.

Note: The default value is 10.

<frequencies> Array of A subset of the calculated frequencies. Any array values that don’t
Doubles have calculated data will be ignored. An empty array will cause all
frequencies to be written.

Note: The default value is an empty array.

<renormalize> Boolean If True, will renormalize the data to the value of renormImpedance
before writing.

Note: The default value is False.

<renormImpedance> Double Data will be renormalized to this impedance before writing only if
renormalize is True.

Note: The default value is 50 ohms.

Return Value Boolean True if file was successfully written; else False.

Python Syn- ExportSpreadsheet()


tax

Python oNDE = oDesktop.GetTool("ndExplorer")


Example oData = oNDE.Open(<model path>)

Network Data Explorer Script Commands 22-21


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

success = oData.ExportSpreadsheet("D:\folder\ne133.tab", 0, 1, 12, [], True, 23)

VB Syn- ExportSpreadsheet
tax

VB Set oData=oDesktop.GetTool("ndExplorer")
Example success = oData.ExportSpreadsheet "D:\folder\ne133.tab", 0, 1, 12, Array(), True, 23

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

ExportTouchstone
Writes the S-parameters to disk in Touchstone 1.0 format (*.snp text file).

From the Network Data Explorer tab, select File > Save As to open a Save As explorer window. Then select
UI Access
Touchstone Format 1.0 (*.snp) from the Save as type: drop-down menu.

Name Type Description


<filePath> String The full path to the file.
<matrixType> Integer One of the following:

Parameters l 0 – S-Parameters
l 1 – Y-Parameters
l 2 – Z-Parameters
l 3 – Gamma

Network Data Explorer Script Commands 22-22


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

l 4 – Impedance

Note: The default value is 0.

<formalType> Integer One of the following:


l 0 – Magnitude/Angle (degrees)
l 1 – Real/Imaginary
l 2 – dB/Angle (degrees)

Note: The default value is 0.

<precision> Integer The number of significant figures.

Note: The default value is 10.

<frequencies> Array of A subset of the calculated frequencies. Any array values that don’t
Doubles have calculated data will be ignored. An empty array will cause all
frequencies to be written.

Note: The default value is an empty array.

<renormalize> Boolean If True, will renormalize the data to the value of renormImpedance
before writing.

Note: The default value is False.

<renormImpedance> Double Data will be renormalized to this impedance before writing only if
renormalize is True.

Note: The default value is 50 ohms.

Network Data Explorer Script Commands 22-23


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<freqUnits> String One of the following: "Hz", "KHz", "MHz", "GHz".

Note: The default value is "Hz".

Return Value Boolean True if file was successfully written; else False.

Python ExportTouchstone()
Syntax

Python oNDE = oDesktop.GetTool("ndExplorer")


Example success = oData.ExportTouchstone("D:\folder\ne133.s2p", 0, 1, 12, [], True, 23, "GHz")

VB Syn- ExportTouchstone
tax

Set oNDE = oDesktop.GetTool("ndExplorer")


VB
Example success = oData.ExportTouchstone "D:\folder\ne133.s2p", 0, 1, 12, Array(), True, 23,
"GHz"

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

ExportTouchstone2
Writes the S-parameters to disk in Touchstone 2 format (*.ts text file).

Network Data Explorer Script Commands 22-24


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

From the Network Data Explorer tab, select File > Save As to open a Save As explorer window. Then select
UI Access
Touchstone 2 Format (*.ts) from the Save as type: drop-down menu.

Name Type Description


<filePath> String The full path to the file.
<matrixType> Integer One of the following:
l 0 – S-Parameters
l 1 – Y-Parameters
l 2 – Z-Parameters
l 3 – Gamma
l 4 – Impedance

Note: The default value is 0.

Parameters
<formalType> Integer One of the following:
l 0 – Magnitude/Angle (degrees)
l 1 – Real/Imaginary
l 2 – dB/Angle (degrees)

Note: The default value is 0.

<precision> Integer The number of significant figures.

Note: The default value is 10.

<frequencies> Array of A subset of the calculated frequencies. Any array values that don’t
Doubles have calculated data will be ignored. An empty array will cause all
frequencies to be written.

Network Data Explorer Script Commands 22-25


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note: The default value is an empty array.

<renormalize> Boolean If True, will renormalize the data to the value of renormImpedance
before writing.

Note: The default value is False.

<renormImpedance> Double Data will be renormalized to this impedance before writing only if
renormalize is True.

Note: The default value is 50 ohms.

<freqUnits> String One of the following: "Hz", "KHz", "MHz", "GHz".

Note: The default value is "Hz".

Return Value Boolean True if file was successfully written; else False.

Python ExportTouchstone2()
Syntax

Python oNDE = oDesktop.GetTool("ndExplorer")


Example success = oData.ExportTouchstone2("D:\folder\ne133.ts", 0, 1, 12, [], True, 23, "GHz")

VB Syn- ExportTouchstone2

Network Data Explorer Script Commands 22-26


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

tax

Set oNDE = oDesktop.GetTool("ndExplorer")


VB
Example Set success = oData.ExportTouchstone2 "D:\folder\ne133.ts", 0, 1, 12, Array(), True,
23, "GHz"

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Extract (SPISim)
Creates a new smaller network data after removing data for the specified terminal port numbers.

Note: Extract opens and interacts with SPISim to complete.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Extract from the
UI Access
drop-down menu.

Name Type Description


<oData> Object Data from this object is copied to a new network data and the copy
Parameters is transformed.
<portNumbers> Array of The port numbers that will be retained (integers between 1 and n).
Integers

Return Value Network IDispatch.

Python Syntax Extract()


Python Example oNDE = oDesktop.GetTool("ndExplorer")

Network Data Explorer Script Commands 22-27


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oData2 = oNDE.Extract(oData1, [3, 2])

VB Syntax Extract
Set oNDE = oDesktop.GetTool "ndExplorer"
VB Example
Set oData2 = oNDE.Extract oData1, Array(3, 2)

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

GetFrequencies
Returns the frequency values with calculated data in the network data.

UI Access None.
Parameters None.
Return Value Array of doubles.

Python Syntax GetFrequencies()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
Freqs = oData.GetFrequencies()

Network Data Explorer Script Commands 22-28


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax GetFrequencies
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set Freqs = oData.GetFrequencies

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

GetFrequencyCount
Returns the number of frequencies with calculated data in the network data.

UI Access None.
Parameters None.
Return Value Integer number of frequencies.

Python Syntax GetFrequencyCount()


oData = oDesktop.GetTool("ndExplorer")
Python Example
numFreqs = oData.GetFrequencyCount()

VB Syntax GetFrequencyCount
Set oData = oDesktop.GetTool("ndExplorer")
VB Example
Set numFreqs = oData.GetFrequencyCount

Network Data Explorer Script Commands 22-29


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetName
Returns the name of the active design.

UI Access N/A
Parameters None.
Return Value String indicating the name of the active design.

Python Syntax GetName()


Python Example design_name = oDesign.GetName()

VB Syntax GetName
VB Example design_name = oDesign.GetName

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

GetPortCount
Returns the total number of ports.

Network Data Explorer Script Commands 22-30


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

From the Network Data Explorer tab, select Edit Ports in the NDE ribbon to open the Port prop-
UI Access
erties window.
Parameters None.
Return Value Integer number of ports.

Python Syntax GetPortCount()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
num = oData.GetPortCount()

VB Syntax GetPortCount
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
num = oData.GetPortCount

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

GetPortNumber
Returns the terminal port number for a given terminal port name.

Note: GetPortNumber can be used in other commands that require a port number, if a port name is preferable.

UI Access From the Network Data Explorer tab, ensure the Full Port Names check box is activated. Port numbers will be

Network Data Explorer Script Commands 22-31


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

represented in the object portNames.

Name Type Description


Parameters
<portName> String The designation of the port number.

Return Value Integer.

Python Syntax GetPortNumber()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
index = oPostProc.GetPortNumber("Input35")

VB Syntax GetPortNumber
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
index = oPostProc.GetPortNumber "Input35"

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

GetPostProcSettings
Returns a copy of the IDispatch to the postprocessing settings for the network data (oPostProc).

Network Data Explorer Script Commands 22-32


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note: Making changes to the PostProcSettings will not change the network data. To make changes, call
oData.SetPostProcSettings to change the network data.

UI Access None.
Parameters None.
Return Value PostProcSettings IDispatch

Python Syntax GetPostProcSettings()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oPostProc = oData.GetPostProcSettings()

VB Syntax GetPostProcSettings
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oPostProc = oData.GetPostProcSettings

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

GetVariation
Returns the variation key for the network data.

Network Data Explorer Script Commands 22-33


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access None.

Parameters None.
Return Value String variation key.

Python Syntax GetVariation()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
variation = oData.GetVariation()

VB Syntax GetVariation
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set variation = oData.GetVariation

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

HasSameData
Compares one network data object with another network data. Actual calculated values will be compared and no interpolation will be
done.

UI Access None.

Network Data Explorer Script Commands 22-34


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


<NetworkData> Object The second network data to compare against.
<matrixType> Integer One of the following:
l 0 – S-Parameters
l 1 – Y-Parameters
l 2 – Z-Parameters
l 3 – Gamma
l 4 – Impedance

Note: The default value is 0.

<comparePortNames> Boolean If True, port names must be identical.

Parameters Note: The default value is True.

<compareNoise> Boolean If True, and both network data have noise data, the comparison will
fail unless the noise values also match.

Note: The default value is 10.

<relativeTolerance> Double If the absoluteTolerance test fails, then abs(value1 - value2)/max


(abs(value1), abs(value2)) must be less than this to be considered
equal.

Note: The default value is 1e-14.

<absoluteTolerance> Double If True, then abs(value1 - value2) < absoluteTolerance.

Note: The default value is 0.

Network Data Explorer Script Commands 22-35


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value Boolean True if the compared network data have the same frequency and matrix values; otherwise, False.

Python Syntax HasSameData()

Python oNDE = oDesktop.GetTool("ndExplorer")


Example success = oData.HasSameData(oData2, 0, True, False, 1e-10, 0)

VB Syntax HasSameData
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set success = oData.HasSameData oData2, 0, True, False, 1e-10, 0

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

LoadSolution
Loads the specified design (all variations) and returns an integer ID.

After analyzing a design, from the Project Manager window, expand the Project Tree and Analysis folders.
UI Access Then right-click on the completed analysis icon and select Network Data Explorer to open the solution in the
Network Data Explorer tab.

Name Type Description


Parameters
<projectName> String Full path to the Electronics Desktop file.

Network Data Explorer Script Commands 22-36


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<designName> String Name of the design.


<solutionName> String Name of the solution.

Return Value Integer ID (identifying the solution); < 0 if the solution is not loaded.

Python Syn- LoadSolution()


tax

Python oNDE = oDesktop.GetTool("ndExplorer")


Example id = oNDE.LoadSolution("D:\folder\Tee.aedt", "HFSS_Test", "Setup1:Sweep1")

VB Syntax LoadSolution
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
id = oNDE.LoadSolution "D:\folder\Tee.aedt", "HFSS_Test", "Setup1:Sweep1"

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Open
Reads contents of file and returns the IDispatch for the new network data.

From the Network Data Explorer tab, select Open in the NDE ribbon, or select File > Open to open an explorer
UI Access
window. Then navigate to the required S-parameter file.

Parameters Name Type Description

Network Data Explorer Script Commands 22-37


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<fileName> String Full path to the file containing S-parameters.

Return Value Network IDispatch.

Python Syntax Open()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData = oNDE.Open("D:\folder\test.s2p")

VB Syntax Open
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData = oNDE.Open "D:\folder\test.s2p"

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Rename (SPISim)
Creates a new network data of the same size with the terminal ports renamed.

Note: Rename opens and interacts with SPISim to complete.

UI Access From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Rename from the

Network Data Explorer Script Commands 22-38


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

drop-down menu.

Name Type Description


<oData> Object Data from this object is copied to a new network data and the copy is
Parameters transformed.
<portNames> Array of The new names (one for each port).
Strings

Return Value Network IDispatch.

Python Syntax Rename()

Python oNDE = oDesktop.GetTool("ndExplorer")


Example oData2 = oNDE.Rename(oData1, ["input", "control", "output"])

VB Syntax Rename
Set oNDE = oDesktop.GetTool "ndExplorer"
VB Example
Set oData2 = oNDE.Rename oData1, Array("input", "control", "output")

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Renormalize (SPISim)
Creates a new network data of the same size after renormalizing the terminal ports using the specified impedance values.

Network Data Explorer Script Commands 22-39


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note: Rename opens and interacts with SPISim to complete.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Renormalize from the
UI Access
drop-down menu.

Name Type Description


<oData> Object Data from this object is copied to a new network data and the copy
Parameters is transformed.
<portImpedances> Array of The new impedance values to be applied to each port.
Doubles

Network IDispatch.
Return Value
Note: Renormalize returns None if there is not an impedance value for each port.

Python Syntax Renormalize()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData2 = oNDE.Renormalize(oData1, [3, 2])

VB Syntax Renormalize
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
oData2 = oNDE.Renormalize oData1, Array(3, 2)

Network Data Explorer Script Commands 22-40


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Reorder
Rearranges the terminal port entries but does not change the port names (i.e., switching first and third terminal port positions will give
switched values for S(1,1) and S(3,3) but S(Port1,Port1) and S(Port3,Port3) do not change).

From the Network Data Explorer tab, select Edit Ports in the NDE ribbon to open the Port properties win-
UI Access
dow. Click+drag the terminal port rows to reorder them. Make changes, as necessary, then click OK.

Name Type Description


Parameters <newOrder> Array of Must have one entry for each port; all numbers 1 to n must be
Integers present.

Return Value None.

Python Syntax Reorder()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oPostProc.Reorder([3, 2, 1])

VB Syntax Reorder
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
oPostProc.Reorder Array(3, 2, 1)

Network Data Explorer Script Commands 22-41


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Reorder (SPISim)
Creates a new network data with the same number of terminal ports and with the port names in the same order. The data is also
reordered so it corresponds to the new order (e.g., the data for S(Port1, Port1) may correspond to S(Port3, Port3).

Note: Reorder opens and interacts with SPISim to complete.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Reorder from the
UI Access
drop-down menu.

Name Type Description


<oData> Object Data from this object is copied to a new network data and the copy
Parameters is transformed.
<portNumbers> Array of The port numbers in new order (integers between 1 and n).
Integers

Network IDispatch.

Return Value Note: Reorder returns None if the array argument does not contain all the terminal port numbers, in
any order.

Python Syntax Reorder()

Network Data Explorer Script Commands 22-42


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData2 = oNDE.Reorder([3, 2, 1])

VB Syntax Reorder
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData2 = oNDE.Reorder Array(3, 2, 1)

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Reset
Resets the post-processing to what it was when the network data was created.

Note: This is not equivalent to setting post-processing to an empty state. The network data may have been read from a file
or created from solution data that already had post-processing settings.

UI Access From the Network Data Explorer tab, select Reset postprocessing in the NDE ribbon.
Parameters None.
Return Value None.

Python Syntax Reset()


Python Example oNDE = oDesktop.GetTool("ndExplorer")

Network Data Explorer Script Commands 22-43


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oPostProc.Reset()

VB Syntax Reset
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
oPostProc.Reset

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

SetAllPortImpedances
Sets all terminal port impedances in a single call. The impedances are in an array of real or complex values.

Through the UI, the terminal ports can only be edited individually. From the Network Data Explorer tab, select
UI Access
Edit Ports in the NDE ribbon to open the Port properties window. Make changes, then click OK.

Name Type Description


Parameters
<impedances> Array of Must have one entry for each port or a single complex (or real)
Doubles value which will be applied to all ports.
or String

Return Value None.

Python SetAllPortImpedances()
Syntax

Network Data Explorer Script Commands 22-44


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python oNDE = oDesktop.GetTool("ndExplorer")


Example oPostProc.SetAllPortImpedances([23, "2+3i", 50]) -or- oData.SetAllPortImpedances(50)

VB Syn- SetAllPortImpedances
tax

Set oData=oDesktop.GetTool("ndExplorer")
VB
Example oPostProc.SetAllPortImpedances Array(23, "2+3i", 50) -or- oData.SetAllPortImpedances
50

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

SetPortDeembedDistance
Sets terminal port impedance for a single port.

From the Network Data Explorer tab, select Edit Ports in the NDE ribbon to open the Port properties win-
UI Access
dow. Make changes, then click OK.

Name Type Description


<portNumber> Integer The port number of the changed terminal port (integers between 1
Parameters and n) .
<distance> String Impedance with units (e.g., “20mm”); if no units, meters are
assumed

Return Value None.

Network Data Explorer Script Commands 22-45


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax SetPortDeembedDistance()

Python oNDE = oDesktop.GetTool("ndExplorer")


Example oPostProc.SetPortDeembedDistance(2, "20mm")

VB Syntax SetPortDeembedDistance
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
oPostProc.SetPortDeembedDistance 2, "20mm"

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

SetPortImpedance
Sets port impedance for a single port.

From the Network Data Explorer tab, select Edit Ports in the NDE ribbon to open the Port properties window.
UI Access
Make changes, then click OK.

Name Type Description


<portNumber> Integer The port number of the changed terminal port (integers between 1
Parameters
and n).
<impedance> Double Double if impedance value is real; string format (e.g., 24+10i) for
or complex impedance.
String

Return Value None.

Network Data Explorer Script Commands 22-46


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax SetPortImpedance()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oPostProc.SetPortImpedance(2, "25+3i")

VB Syntax SetPortImpedance
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
oPostProc.SetPortImpedance 2, "25+3i"

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

SetPostProcSettings
Applies postprocessing settings (oPostProc) to the specified network data.

Note: Making changes to the PostProcSettings will not change the network data. To make changes, call
oData.SetPostProcSettings to change the network data.

UI Access None.

Name Type Description


Parameters
<PostProcSettings> Object The settings that will be applied to the data.

Return Value None.

Network Data Explorer Script Commands 22-47


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax SetPostProcSettings()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData.SetPostProcSettings(oPostProc)

VB Syntax SetPostProcSettings
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
oData.SetPostProcSettings oPostProc

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Smooth
Creates a new network data with values smoothed. The number of adjacent points smoothed is user-specified.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Smooth from the
UI Access
drop-down menu.

Name Type Description


Parameters
<oData> Object Data from this object is copied to a new network data and the copy
is transformed.
<order> Integer The number of adjacent points that are smoothed.

Network Data Explorer Script Commands 22-48


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note: The default value is 10.

<enforceCausality> Boolean Casual data is calculated before smoothing.

Note: The default value is False.

Return Value Network IDispatch.

Python Syntax Smooth()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData2 = oNDE.Smooth(oData1, 3, True)

VB Syntax Smooth
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData2 = oNDE.Smooth oData1, 3, True

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Stretch (SPISim)
Creates a new network data representing a matrix of transmission lines with the length of those transmission lines multiplied by a
factor of n.

Network Data Explorer Script Commands 22-49


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note: Stretch opens and interacts with SPISim to complete.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Stretch from the
UI Access
drop-down menu.

Name Type Description


<oData> Object Data from this object is copied to a new network data and the copy is
Parameters
transformed.
<factor> Double The transmission line lengths are multiplied by this number.

Network IDispatch.

Return Value Note: Stretch returns None if the network data argument does not represent a matrix of transmission
lines.

Python Syntax Stretch()


oNDE = oDesktop.GetTool("ndExplorer")
Python Example
oData2 = oNDE.Stretch(oData1, 3.1)

VB Syntax Stretch
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData2 = oNDE.Stretch oData1, 3.1

Network Data Explorer Script Commands 22-50


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Warning: The following command is preliminary. Its syntax may change. Be prepared to make changes to leg-
acy scripts.

Terminate
Creates a new network data with specified ports terminated.

From the Network Data Explorer tab, select Transforms in the NDE ribbon. Then select Terminate from the
UI Access
drop-down menu.

Name Type Description


<oData> Object Data from this object is copied to a new network data and the copy
is transformed.
Parameters
<portNumbers> Array of The port numbers that are terminated (integers between 1 and n).
Integers
<termImpedances> Array of The impedance values used to terminate the specified ports.
Complex
Numbers

Network IDispatch.

Return Value Note: Terminate returns None if the port numbers are not valid or there are no impedance value for
the port numbers.

Python Syntax Terminate()

Python oNDE = oDesktop.GetTool("ndExplorer")


Example oData2 = oNDE.Terminate(oData1, [2, 3], [23, "10+2i"])

Network Data Explorer Script Commands 22-51


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax Terminate
Set oNDE = oDesktop.GetTool("ndExplorer")
VB Example
Set oData2 = oNDE.Terminate oData1, Array(2, 3), Array(23, "10+2i")

Network Data Explorer Script Commands 22-52


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

23 - CompInstance Script Commands


CompInstance commands should be executed by the oDesign2 or oPropHost2 object.
Set oDesign2 = CompInstance.GetParentDesign
Set oPropHost2 = CompInstance.GetPropHost

Callback Scripting Using CompInstance Object


Callback scripts are scripts that can be set in the Property Dialog for individual properties by clicking the button in the Callback column
and choosing a script that is saved with the project. Callback scripts can contain any legal script commands including general Ansys
script function calls ( e.g., GetApplicationName() ). In addition, Callback scripts can also call functions on a special object named Com-
pInstance.
You can obtain an interface to a CompInstance in a schematic or layout by calling oEditor.GetCompInstanceFromRefDes(refDes). For
more information see Layout Scripting and Schematic Scripting. This interface is also available as a CompInstance object in Com-
pInstance event callbacks, such as placing a component in a layout or schematic.

Definitions
<propName> = text string
<value> = double
<valueText> = text string
<fileName> = full path file name
<choices> = string containing menu choices separated by commas
<initialChoice> = string containing initial choice for menu; must be one of the <choices>
<scriptName> = string containing name of script stored in project
<bool> is 1 for true or 0 for false

CompInstance Script Commands 23-1


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<editorName> is either "Layout" or "SchematicEditor"

The topics for this section include:


CompInstance Functions

CompInstance Functions
Following are commands that can be used to manipulate properties from a CompInstance script.
The topics for this section include:
GetComponentName
GetEditor
GetInstanceID
GetInstanceName
GetParentDesign
GetPropHost
GetPropServerName
GetComponentName
Returns the name of the component corresponding to this CompInstance.

UI Access NA

Parameters Name Type Description

CompInstance Script Commands 23-2


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

None

String
Return Value
name of component (e.g. MS_TRL) and stores it in "name"

Python Syntax GetComponentName()


Python Example name = CompInstance.GetComponentName()

VB Syntax GetComponentName()
VB Example name = CompInstance.GetComponentName()

GetInstanceID [Component Instance]


Use: Returns the instanceID of the CompInstance.
Command: None
Syntax: GetInstanceID()
Return Value: String
VB Example: id = CompInstance.GetInstanceID();
Returns id of compInstance (e.g. 7) and stores it in "id".
Note that this is not the same number as the one used in the RefDes.

Python Syntax GetInstanceID()

CompInstance Script Commands 23-3


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Example id = CompInstance.GetInstanceID()

GetInstanceName [Component Instance]


Use: Returns the instance name of the component corresponding to this CompInstance.
Command: None
Syntax: GetInstanceName()
Return Value: String
VB Example: name = CompInstance.GetInstanceName();
Returns instanceName (e.g. A7) of compInstance and stores it in "name".
Note that the Instance Name is not the same as the RefDes.

GetParentDesign
Use: Returns an interface to the compInstance's parent design.
Command: None
Syntax: GetParentDesign()
Return Value: Returns interface to design.
Example: Set oDesign2 = CompInstance.GetParentDesign();
Returns the interface to the design containing the compInstance.
This interface can be used to call Design functions. See: Design Object Script Commands.

CompInstance Script Commands 23-4


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetParentDesign()


Python Example oDesign2 = CompInstance.GetParentDesign()

GetPropHost
Use: Returns an interface to the PropHost of the CompInstance, which gives access to its properties.
Command: None
Syntax: GetPropHost()
VB Example: Set oPropHost2 = CompInstance.GetPropHost();
Returns the interface to the properties of the compInstance.
This interface can be used to call PropHost functions; for more information see Callback Scripting Using PropHost Object.

Python Syntax GetPropHost()


Python Example oPropHost2 = CompInstance.GetPropHost()

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".

CompInstance Script Commands 23-5


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetPropServerName()


Python Example name = CompInstance.GetPropServerName()

CompInstance Script Commands 23-6


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

24 - Schematic Scripting
The Schematic scripting interface is a set of commands that match the data changing methods available in the UI of the Schematic,
plus some selection and query methods. Examples of the commands available through the scripting interface are adding items, remov-
ing items, and modifying items on the Schematic. Identifying objects on the Schematic is done by a unique ID that is generated and
returned by all methods that add objects, and by the FindElements and GetSelections methods. This ID can then be passed into com-
mands to modify or remove Schematic objects.
l Since most Schematic objects can have sub-components (such as property displays or segments on a wire, etc), IDs can also
be in the format of "TopLevelID:SubComponentIndex".
l The SubComponentIndex is a one-based index into the sub components of the item thus making the second segment of com-
ponent CAP1 identified by "CAP1:2".
l A SubComponentIndex of zero will refer to the TopLevel item only.
l When an ID is mentioned later in this document, it will refer to either a simple string ID representing a top-level Schematic item
or a "TopLevelID:SubComponentIndex" pair unless otherwise stated.
l If a specified ID or SubComponentIndex does not exist, then the function will ignore that entry and proceed with other specified
IDs. Even if no valid IDs are specified, the functions will still return success.

The topics for this section include:


l Method Format
l Editor Scripting IDs
l Create Method List
l General Method List
l Property Method List
l Information Method List

Schematic Scripting 24-1


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Method Format
In the following formats, [Opt=x] appearing after a parameter indicates that the parameter is optional and the default value is x.
When calling object-creation methods as functions, parenthesis are required in order to retrieve the name of the created object. Par-
enthesis are also required in JavaScript. When using VB/VBScript to call a method as a subroutine, however, parenthesis are not
required.
All methods to create Schematic objects have the following form:
Create[type](VARIANT parameters,
// Array of type specific parameters
VARIANT attributes,
// attributes is in the format of:
Array("NAME:Attributes", _
"Page:=", int, _ // [Opt=1] Page number (one-based)
// Note: Page 1 always exists
"X:=", double, _ // X position of the object
"Y:=", double, _ // Y position of the object
"Angle:=", double, _ // Rotation angle (radians)
"Flip:=", bool) // True if mirrored
[out,retval] string id)

The algorithm used in the create methods is:


1) Create SchAdd[type]Command object with parameters passed in

Schematic Scripting 24-2


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

2) Execute the command


All methods to modify Schematic objects have the following form:
[modification](Array("NAME:Selections",
"Page:=", Page number [optional: Default=1]
"Selections:=", IDs to modify see format below),
VARIANT params
// Array of modification specific parameters)

The algorithms in these types of methods will be:


1) Go through ids and get the SelectableObjs they correspond to
2) Select the SelectableObjs found in (1)
3) Select any sub components specified
4) Create the Sch[modification]Command
5) Execute the command

ID Format
When IDs are passed to a function it can be in one of the following formats:
l Array of integers of top-level items only
l String of IDs separated by spaces or commas
l Array of strings with each string element being an ID

Point Format

Schematic Scripting 24-3


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

When a method takes an array of points, each element in the array is a string in the format of: "x y", "x,y", or "(x,y)".

Editor Scripting IDs


Objects in the schematic are identified by text IDs. These IDs are used in scripts to perform actions on objects. These IDs are returned
by all methods that add objects, and by the FindElements and GetSelections methods. The IDs are then passed into commands to
modify or remove Schematic objects.
Format of IDs for different schematic objects:
Components: CompInst@<CompName>;<compInstID>;<optional schematicID>
Geometric primitive: SchObj@<schematicID>
Global Port/ground :: GPort@<portName>;<schematicID>
Interface Port :: IPort@<portName>;<schematicID>
Page Port: PagePort@<portName>;<schematicID>
Wire : Wire@<netName>;<schematicID>;<segment index list>
Find this information in the Properties Window for the selected object as follows:
<CompName> General tab/CompName
<compInstID> General tab/ID
<schematicID> Symbol tab/SchematicID
<portName> Param Values tab/PortName
<netName> General tab/NetName
<segment index list> numbers separated by commas; Symbol tab/Segmentn - e.g. Segment0 refers to index "0"
In the Layout, the ID for a selected object is always the Name or Net property in the Footprint tab of the Properties Window

Schematic Scripting 24-4


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Format for Components


Array("CompInst@CAP_;2;4"))
The format for Components is CompInst@<CompName>;<compInstID>;<optional schematicID>. In the documented example, <Com-
pName> stands for the component name CAP_, <compInstID> stands for its ID 2, and <optional schematicID> is the schematic ID 4.
If you select the component, the Properties window gets updated and displays its details. For example, the selected object’s com-
ponent name and ID appear in the General tab of the Properties window as shown below.

The SchematicID is shown in the Symbol tab.

Schematic Scripting 24-5


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Create Method List


This section lists the scripts that are available in the Schematic scripting interface to create and change data.
Script Position Parameters
In Create Method scripts, X and Y position parameters are expressed in meters.
l If your layout grid units are metric, you may enter the X and Y positions directly into a script as parameters.
l If your layout grid is expressed in mils, you must first convert the component's positional coordinates to meters.

To convert an X or Y position to meters based on the minor grid size:


X or Y position in meters = desired_position x ( 0.00254 / minor_grid_size )
where desired_position and minor_grid_size have the same units. For example, to position an object at 500mm with a minor grid size
of 20mm:
X or Y position in meters = 500 x ( 0.00254 / 20 )
This section lists the following commands:
CreateArc (Schematic Editor)
CreateCircle (Schematic Editor)
CreateComponent (Schematic Editor)
CreateCurve (Schematic Editor)
CreateGlobalPort (Schematic Editor)
CreateGround (Schematic Editor)
CreateLine (Schematic Editor)
CreatePagePort (Schematic Editor)

Schematic Scripting 24-6


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

CreateIPort (Schematic Editor)


CreatePolygon (Schematic Editor)
CreateRectangle (Schematic Editor)
CreateText (Schematic Editor)
CreateWire (Schematic Editor)
CreateArc (Schematic Editor)
Create an arc

UI Access Draw>Primitive>Arc

Name Type Description


<ArcData> Array Array("NAME:ArcData" _
"x:=", double, _ // X position of the object
"y:=", double, _ // Y position of the object
"Radius:=", double, _ // Radius of the circle
"StartAng:=", double,_ // Start angle of the arc (radians)
Parameters "EndAng:=", double, _ // End angle of the arc (radians)
"LineWidth:=", double, // the width of the line, in meters
"Color:=", int, // the RBG value of the arc color
"Id:=", int), // [Opt=New id] Id for this item
<Attributes> Array Array("NAME:Attributes", _
"Page:=", int) _ // [Opt=1] Page number (one-based)
[out,retval] string id)

Schematic Scripting 24-7


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

String
Return Value
Unique id

Arc is created with the format SchObj@<schematicID>

The Schematic ID can be found on the Symbols tab of the Properties window when you select the arc.

Python Syntax CreateArc()


Python Example oEditor.CreateArc

Schematic Scripting 24-8


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

(["NAME:ArcData", _
"X:=", -0.004318, "Y:=", -0.00127, _
"Radius:=", 0.00297299377732279, _
"StartAng:=", 1.9195673303788, _
"EndAng:=", 3.32144615338227, _
"Id:=", 10], _
["NAME:Attributes", "Page:=", 1])

VB Syntax CreateArc()
oEditor.CreateArc
Array("NAME:ArcData", _
"X:=", -0.004318, "Y:=", -0.00127, _
"Radius:=", 0.00297299377732279, _
VB Example
"StartAng:=", 1.9195673303788, _
"EndAng:=", 3.32144615338227, _
"Id:=", 10), _
Array("NAME:Attributes", "Page:=", 1)

VB Example:
Dim oAnsoftApp

Schematic Scripting 24-9


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("Circuit1")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
Dim ArcID
ArcID = oEditor.CreateArc(Array("NAME:ArcData", "X:=", 0.10414, "Y:=", 0.08382, "Radius:=", _
0.00915810023967853, "StartAng:=", 2.15879893034246, "EndAng:=", _
5.49778714378214, "LineWidth:=", 0, "Color:=", 0, "Id:=", 48), Array("NAME:Attributes", "Page:=",
_
1))
MsgBox "Arc ID = " & ArcID
CreateCircle (Schematic Editor)
Create a circle

Schematic Scripting 24-10


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access Draw>Primitive>Circle

Name Type Description


<CircleData> Array Array("NAME:CircleData" _
"x:=", double, _ // X position of the object
"y:=", double, _ // Y position of the object
"Radius:=", double, _ // Radius of the circle
"LineWidth:=", double, // the width of the circle border, in meters
"Bordercolor:=", int, // the RBG value of the border color
Parameters
"Fill:=", int, // the fill pattern id, 0 = hollow, 1 = solid, 2 = NEDiagonal,
3 = OrthoCross, 4 = DiagCross, 5 = NWDiagonal, 6 = Horizontal, 7 = Vertical
"Color:=", int, // the RBG value of the circle fill color
"Id:=", int), // [Opt=New id] Id for this item
<Attributes> Array Array("NAME:Attributes", _
"Page:=", int) _ // [Opt=1] Page number (one-based)
[out,retval] string id)

String
Return Value
Unique id

Circle is created and the returned value has the format SchObj@<schematicID>
The schematic ID of the circle can be located in the Properties window on the Symbols tab.

Schematic Scripting 24-11


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax CreateCircle()


oEditor.CreateCircle(["NAME:CircleData", _
"X:=", -0.004572, "Y:=", -0.000508, _
Python Example "Radius:=", 0.001778, "Id:=", 12], _
["NAME:Attributes", "Page:=", 1])

VB Syntax CreateCircle()

Schematic Scripting 24-12


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oEditor.CreateCircle
Array("NAME:CircleData", _

VB Example "X:=", -0.004572, "Y:=", -0.000508, _


"Radius:=", 0.001778, "Id:=", 12), _
Array("NAME:Attributes", "Page:=", 1)

CreateComponent (Schematic Editor)


Creates a component of a given type.

UI Access N/A.

Name Type Description


<params> Array Structured array.
Array("NAME:ComponentProps",
"Name:=", <String path to component in library>,
"Id:=", <String Component ID>)
<attributes> Array Structured array.
Array("NAME:Attributes",
Parameters
"Page:=", <Integer: page number>,

Note:

For the page number, page 1 always exists.

"X:=", <Double: X position of object>,


"Y:=", <Double: Y position of the object>,

Schematic Scripting 24-13


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Angle:=", <Double: rotation angle in degrees>,


"Flip:=", <boolean: True if mirrored; else False>,
"PinNumber:=", <Integer: index of pin in symbol 0 to
n-1>

Note:

PinNumber is optional and is set to -1 by default. PinNumber affects


where the symbol is placed relative to the X and Y parameters. If
PinNumber is set to -1, the symbol is placed with its center at (X,Y). If it
is a pin index, the symbol is placed so that the pin is located at (X,Y).
The PinNumber is not recorded.

String containing unique ID in the format:


CompInst@<CompName>;<compInstID>;<optional schematicID>
Return Value For example, the return value CompInst@CAP;4;35 indicates that the component name is CAP, its ID is 4, and
its Schematic ID is 35.
You can also see these details in the Properties window when you select the created component.

Python Syntax CreateComponent(<params>, <attributes>)


oEditor.CreateComponent(
Python Example ["NAME:ComponentProps",
"Name:=", "Maxwell Circuit Elements\Passive Elements:Res",

Schematic Scripting 24-14


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Id:=", "1"
],
["NAME:Attributes",
"Page:=", 1,
"X:=", -0.01524,
"Y:=", 0.00508,
"Angle:=", 0,
"Flip:=", false
]
)

VB Syntax CreateComponent <params>, <attributes>


Set oProject = oDesktop.SetActiveProject("Project1")
Set oDesign = oProject.SetActiveDesign("Circuit1")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
VB Example
Dim CompID
CompID = oEditor.CreateComponent Array("NAME:ComponentProps", "Name:=", "Maxwell
Circuit Elements\Passive Elements:Res", "Id:=", "1"), Array("NAME:Attributes",
"Page:=", 1, "X:=", -0.01524, "Y:=", 0.00508, "Angle:=", 0, "Flip:=", false)

CreateGlobalPort (Schematic Editor)


Create a global port and enable placement on the schematic

Schematic Scripting 24-15


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access Draw>Global Port

Name Type Description


<portname> String Name for this port - leave empty to use default unique name
<id> Integer ID number for the port - leave empty to use default (recommended)
<pagenumber> Integer The (1-based) page number of the schematic page this port should be added to
- leave empty to use default (1)
Parameters
<xval> Double X position of the object
<yval> Double Y position of the object
<angle> Double Rotation of the object, in radians. Rotations of multiples of 90 degrees are valid.
Other values will be adjusted to the nearest valid angle.
<degrees> Double Rotation of the object, in degrees. Rotations of multiples of 90 degrees are
valid. Other values will be adjusted to the nearest valid angle
<flip> Boolean True if mirrored

Return Value
String
PortID, the identifier that can be used for this port in script operations involving this schematic

Global port is created and the return value has the format GPort@<portName>;<schematicID>
The Schematic ID can be found in the Properties window on the Symbols tab when you select the global port.

Schematic Scripting 24-16


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

CreateGlobalPort(["NAME:GlobalPortProps", "Name:=", <portname>, "Id:=", <id>], ["NAME:Attributes",


Python Syntax "Page:=", <pagenumber>, "X:=", <xval>, "Y:=", <yval>, "Angle:=", <angle>, [or "Degrees:=", <degrees> ,]
"Flip:=", <flip>])
oEditor.CreateGlobalPort
(["NAME:GlobalPortProps", "Name:=", "G_0", "Id:=", 1],_
Python Example
["NAME:Attributes", "Page:=", 1, "X:=", -0.02286, "Y:=",
0.00254, "Angle:=", 0, "Flip:=", false)

Schematic Scripting 24-17


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

CreateGlobalPort(Array("NAME:GlobalPortProps", "Name:=", <portname>, "Id:=", <id>), Array("NAME:At-


VB Syntax tributes", "Page:=", <pagenumber>, "X:=", <xval>, "Y:=", <yval>, "Angle:=", <angle>, [or "Degrees:=", <degrees>
,] "Flip:=", <flip>)
oEditor.CreateGlobalPort
Array("NAME:GlobalPortProps", "Name:=", "G_0", "Id:=", 1),_
VB Example
Array("NAME:Attributes","Page:=", 1, "X:=", -0.02286,
"Y:=", 0.00254, "Angle:=", 0, "Flip:=", false)

VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("Circuit1")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")

Schematic Scripting 24-18


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Dim GPort
GPort = oEditor.CreateGlobalPort(Array("NAME:GlobalPortProps", "Name:=", "G_1", "Id:=", 68),
Array("NAME:Attributes", "Page:=", _
1, "X:=", 0.11684, "Y:=", 0.0635, "Angle:=", 0, "Flip:=", false))
MsgBox "Port = " & GPort
CreateGround (Schematic Editor)
Create a ground

UI Access Draw>Ground

Name Type Description


<GroundProps> Array Array("NAME:GroundProps",_
"Id:=", int), // [Opt=New id] Id for this item
<Attributes> Array Array("NAME:Attributes", _
"Page:=", int, _ // [Opt=1] Page number (one-based)
Note: Page 1 always exists
Parameters
"X:=", double, _ // X position of the object
"Y:=", double, _ // Y position of the object
"Angle:=", double, _ // Rotation angle (radians)
"Flip:=", bool), // True if mirrored
[out,retval] string id)

String
Return Value
Unique id

Schematic Scripting 24-19


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Ground is created and the returned value has the format GPort@<portname>;<schematicID>
The Schematic ID for ground can be found on the Symbols tab of the Properties window when you select the object.

Python Syntax CreateGround()


oEditor.CreateGround
(["NAME:GroundProps", "Id:=", 8),

Python Example ["NAME:Attributes", "Page:=", 1, "X:=",


-0.04064, "Y:=", -0.00254, "Angle:=",
0, "Flip:=", false])

Schematic Scripting 24-20


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax CreateGround()
oEditor.CreateGround
Array("NAME:GroundProps", "Id:=", 8),

VB Example Array("NAME:Attributes", "Page:=", 1, "X:=",


-0.04064, "Y:=", -0.00254, "Angle:=",
0, "Flip:=", false)

VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("Circuit1")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")

Schematic Scripting 24-21


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Gnd = oEditor.CreateGround(Array("NAME:GroundProps", "Id:=", 144), Array("NAME:Attributes",


"Page:=", _
1, "X:=", 0.11684, "Y:=", 0.06604, "Angle:=", 0, "Flip:=", false))

MsgBox "GndIndex =" & Gnd


CreateLine (Schematic Editor)
Creates a line.

UI Access Draw>Primitive>Line

Name Type Description


<LineData> Array Array("NAME:LineData" _
"Points:=", Array of points, _
"LineWidth:=", double, // the width of the line, in meters
Parameters "Color:=", int, // the RBG value of the line color
"Id:=", int), // [Opt=New id] Id for this item
<Attributes> Array Array("NAME:Attributes", _
"Page:=", int) _ // [Opt=1] Page number (one-based)
[out,retval] string id)

String
Return Value
Unique id

Line is created and the returned value has the format SchObj@<schematicID>

Schematic Scripting 24-22


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

The Schematic ID can be found on the Symbol tab of the Properties window when you select the line.

Python Syntax CreateLine()


oEditor.CreateLine (["NAME:LineData",_
"Points:=", ["(-0.055652, 0.020669)", _
"(-0.036923, 0.011257)", "(-0.023144, 0.018049)"],_
Python Example
"Line-
Width:=", 0, "Color:=", 0, "Id:=", 22)], _
["NAME:Attributes", "Page:=", 1])

Schematic Scripting 24-23


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax CreateLine()
oEditor.CreateLine Array("NAME:LineData",_
"Points:=", Array("(-0.055652, 0.020669)", _

VB Example "(-0.036923, 0.011257)", "(-0.023144, 0.018049)"),_


"Line-
Width:=", 0, "Color:=", 0, "Id:=", 22), _
Array("NAME:Attributes", "Page:=", 1)

VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("Circuit1")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
LineID = oEditor.CreateLine(Array("NAME:LineData", "Points:=", Array("(0.050800, 0.106680)", _

Schematic Scripting 24-24


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"(0.124460, 0.106680)", "(0.124460, 0.106680)"), "LineWidth:=", 0, "Color:=", _


0, "Id:=", 169), Array("NAME:Attributes", "Page:=", 1))
MsgBox "LineID = " & LineID
CreatePagePort (Schematic Editor)
Create a PagePort

UI Access Draw>Page Connector

Name Type Description


<PagePortProps> Array Array("NAME:PagePortProps"),
Array("NAME:Attributes", _
"Page:=", int, _ // [Opt=1] Page number (one-based)
Note: Page 1 always exists
Parameters
"X:=", double, _ // X position of the object
"Y:=", double, _ // Y position of the object
"Angle:=", double, _ // Rotation angle (radians)
"Flip:=", bool), // True if mirrored
[out,retval] string id)

String
Return Value
Unique id

The pageport is created and it has the following format:


PagePort@<portName>;<schematicID>
The schematic ID can be found in the Properties window on the Symbols tab when you select the pageport.

Schematic Scripting 24-25


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax CreatePagePort()


oEditor.CreatePagePort
(["NAME:PagePortProps", "Name:=", "pageport_0", "Id:=", _

Python Example 12], ["NAME:Attributes", "Page:=",_


1, "X:=", -0.0381, "Y:=", -0.0127, "Angle:=", _
0, "Flip:=", false])

Schematic Scripting 24-26


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax CreatePagePort()
oEditor.CreatePagePort
Array("NAME:PagePortProps", "Name:=", "pageport_0", "Id:=", _

VB Example 12), Array("NAME:Attributes", "Page:=",_


1, "X:=", -0.0381, "Y:=", -0.0127, "Angle:=", _
0, "Flip:=", false)

VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("Circuit1")

Schematic Scripting 24-27


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Set oEditor = oDesign.SetActiveEditor("SchematicEditor")


PagePortID = oEditor.CreatePagePort(Array("NAME:PagePortProps", "Name:=", "pageport_0", "Id:=", _
177), Array("NAME:Attributes", "Page:=", 1, "X:=", 0.0889, "Y:=", 0.1651, "Angle:=", _
0, "Flip:=", false))
MsgBox "PagePort = " & PagePortID
CreateIPort (Schematic Editor)
Create an interface port

UI Access Draw>Interface Port

Name Type Description


<IPortProps> Array Array("NAME:IPortProps"),
"Name:=", string), // [Opt=default name] Name for this port
Parameters
"Id:=", int), // Port id number
<Attributes> Array Array("NAME:Attributes", _
"Page:=", int, _ // [Opt=1] Page number (one-based)

Schematic Scripting 24-28


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note:

Page 1 always exists


"X:=", double, _ // X position of the object
"Y:=", double, _ // Y position of the object
"Angle:=", double, _ // Rotation angle (radians)
"Flip:=", bool), // True if mirrored
[out,retval] string id)

String
Return Value
Unique id

Interface port is created and the returned value has the following format:
IPort@<portName>;<schematicID>
The interface port schematic ID can be found in the Properties window on the Symbols tab.

Schematic Scripting 24-29


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax CreateIPort()


oEditor.CreateIPort (["NAME:IPortProps", "Name:=", _
"Port1", "Id:=", 4], ["NAME:Attributes","Page:=", _
Python Example
1, "X:=", -0.0381, "Y:=", 0.0127, "Angle:=",_
0, "Flip:=", false])

VB Syntax CreateIPort()
oEditor.CreateIPort Array("NAME:IPortProps", "Name:=",_
"Port1", "Id:=", 4), Array("NAME:Attributes","Page:=", _
VB Example
1, "X:=", -0.0381, "Y:=", 0.0127, "Angle:=",_
0, "Flip:=", false)

VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule

Schematic Scripting 24-30


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")


Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("Circuit1")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
IPortID = oEditor.CreateIPort(Array("NAME:IPortProps", "Name:=", "Port1", "Id:=", 189), Array
("NAME:Attributes", "Page:=", _
1, "X:=", 0.0889, "Y:=", 0.1651, "Angle:=", 0, "Flip:=", false))
MsgBox "IPort ID = " & IPortID
CreatePolygon (Schematic Editor)
Create a polygon

UI Access Draw>Primitive>Polygon

Name Type Description


<PolygonData> Array Array("NAME:PolygonData" _
"Points:=", Array of points, _
"LineWidth:=", double, // the width of the Polygon border, in meters
Parameters "Bordercolor:=", int, // the RBG value of the border color
"Fill:=", int, // the fill pattern id, 0 = hollow, 1 = solid, 2 = NEDiagonal,
3 = OrthoCross, 4 = DiagCross, 5 = NWDiagonal, 6 = Horizontal, 7 = Vertical
"Color:=", int, // the RBG value of the Polygon fill color
"Id:=", int), // [Opt=New id] Id for this item

Schematic Scripting 24-31


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<Attributes> Array Array("NAME:Attributes", _


"Page:=", int) _ // [Opt=1] Page number (one-based)
[out,retval] string id)

String
Return Value
Unique id

Polygon is created and the return value has the format


SchObj@<schematicID>
The Schematic ID can be found in the Properties window on the Symbol tab when you select the polygon.

Schematic Scripting 24-32


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax CreatePolygon()


oEditor.CreatePolygon(
["NAME:PolygonData", "Points:=", [ _
"(-0.058951, 0.006308)", "(-0.046142, 0.010480)",_
Python Example
"(-0.046239, 0.001067)"), "LineWidth:=", _
0, "BorderColor:=", 0, "Fill:=", 0, "Color:=",_
0, "Id:=", 27], ["NAME:Attributes", "Page:=", 1]])

VB Syntax CreatePolygon()
oEditor.CreatePolygon
Array("NAME:PolygonData", "Points:=", Array( _
"(-0.058951, 0.006308)", "(-0.046142, 0.010480)",_
VB Example
"(-0.046239, 0.001067)"), "LineWidth:=", _
0, "BorderColor:=", 0, "Fill:=", 0, "Color:=",_
0, "Id:=", 27), Array("NAME:Attributes", "Page:=", 1)

VB Example:
Dim oAnsoftApp
Dim oDesktop

Schematic Scripting 24-33


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("Circuit1")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
polygonID = oEditor.CreatePolygon(Array("NAME:PolygonData", "Points:=", Array( _
"(0.101600, 0.058420)", "(0.101600, 0.060960)", "(0.101600, 0.058420)", _
"(0.099060, 0.060960)", "(0.101600, 0.060960)", "(0.101600, 0.058420)", _
"(0.101600, 0.060960)", "(0.101600, 0.060960)"), "LineWidth:=", 0, "BorderColor:=", _
0, "Fill:=", 0, "Color:=", 0, "Id:=", 218), Array("NAME:Attributes", "Page:=", 1))
MsgBox "Polygon ID = " & polygonID
CreateRectangle (Schematic Editor)
Create a rectangle

UI Access Draw>Primitive>Rectangle

Schematic Scripting 24-34


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


<RectData> Array Array("NAME:RectData" _
"x1:=", double, _ // X position of the upper left
"y1:=", double, _ // Y position of the upper left
"x2:=", double, _ // X position of the lower right
"y2:=", double",_ // Y position of the lower right
"LineWidth:=", double, // the width of the Rectangle border, in meters
Parameters "Bordercolor:=", int, // the RBG value of the border color
"Fill:=", int, // the fill pattern id, 0 = hollow, 1 = solid, 2 = NEDiagonal,
3 = OrthoCross, 4 = DiagCross, 5 = NWDiagonal, 6 = Horizontal, 7 = Vertical
"Color:=", int, // the RBG value of the Rectangle fill color
"Id:=", int), // [Opt=New id] Id for this item
<Attributes> Array Array("NAME:Attributes", _
"Page:=", int) _ // [Opt=1] Page number (one-based)
[out,retval] string id)

String
Return Value
Unique id

Rectangle is created and the return value has the format


SchObj@<schematicID>
The Schematic ID can be found in the Properties window on the Symbol tab when you select the rectangle.

Schematic Scripting 24-35


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax CreateRectangle()


oEditor.CreateRectangle
(["NAME:RectData", "X1:=", -0.0755449856733525, "Y1:=", _
0.0335755491881566, "X2:=", -0.0611831900668577, "Y2:=", _
Python Example
0.0254242597898758, "LineWidth:=", _
0, "BorderColor:=", 0, "Fill:=", 0, "Color:=", 0, "Id:=", 31], _
["NAME:Attributes", "Page:=", 1])

VB Syntax CreateRectangle()

Schematic Scripting 24-36


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oEditor.CreateRectangle
Array("NAME:RectData", "X1:=", -0.0755449856733525, "Y1:=", _
0.0335755491881566, "X2:=", -0.0611831900668577, "Y2:=", _
VB Example
0.0254242597898758, "LineWidth:=", _
0, "BorderColor:=", 0, "Fill:=", 0, "Color:=", 0, "Id:=", 31), _
Array("NAME:Attributes", "Page:=", 1)

VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("Circuit1")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")

Schematic Scripting 24-37


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

rectangleID = oEditor.CreateRectangle(Array("NAME:RectData", "X1:=", 0.1016, "Y1:=", 0.0635,


"X2:=", _
0.10414, "Y2:=", 0.06096, "LineWidth:=", 0, "BorderColor:=", 0, "Fill:=", 0, "Color:=", _
0, "Id:=", 9), Array("NAME:Attributes", "Page:=", 1))
MsgBox "Rectangle ID = " & rectangleID
CreateText (Schematic Editor)
Create text

UI Access Draw>Primitive>Text

Name Type Description


<TextData> Array Array("NAME:TextData" _
"x:=", double, _ // X position of the object
"y:=", double, _ // Y position of the object
"Text:=", string, _ // Text to display
"Color:=", int, // the RBG value of the text color
Parameters "Id:=", int), // Id for this item
"ShowRect:=", bool, // true or false, whether to show the highlight rectangle for
the text
"X1:=", double, // the text rectangle left X value, in meters
"Y1:=", double, // the text rectangle upper Y value, in meters
"X2:=", double, // the text rectangle right X value, in meters
"Y2:=", double, // the text rectangle lower Y value, in meters

Schematic Scripting 24-38


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"RectLineWidth:=", double, // the width of the rectangle border, in meters


"RectBordercolor:=", int, // the RBG value of the rectangle border color
"RectFill:=", int, // the rectangle fill pattern id, 0 = hollow, 1 = solid,
2 = NEDiagonal, 3 = OrthoCross, 4 = DiagCross, 5 = NWDiagonal, 6 = Hori-
zontal, 7 = Vertical
"RectColor:=", int, // the RBG value of the rectangle fill color
<Attributes> Array Array("NAME:Attributes", _
"Page:=", int) _ // [Opt=1] Page number (one-based)
[out,retval] string id)

String
Return Value
Unique id

Text is created and the return value has the format: SchObj@<SchematicID>
The Schematic ID can be found in the Properties window on the Symbols tab when you select the text.

Schematic Scripting 24-39


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax CreateText()


oEditor.CreateText(
["NAME:TextData", "X:=", -0.0764183381088826, "Y:=", _
0.040174212034384, "Size:=", 12, "Angle:=",_
0, "Text:=", "Con-
trol Circuit", "Color:=", _
0, "Id:=", 34, "ShowRect:=", false, "X1:=", _
Python Example
-0.0793287547755609, "Y1:=", _
0.0407033787010528, "X2:=", -0.0502245881087778,_
"Y2:=", 0.035411712034365, "RectLineWidth:=", _
0, "RectBorderColor:=", 0, "RectFill:=",
0, "RectColor:=", 0], ["NAME:Attributes", "Page:=", 1])

VB Syntax CreateText()
oEditor.CreateText
Array("NAME:TextData", "X:=", -0.0764183381088826, "Y:=", _
VB Example
0.040174212034384, "Size:=", 12, "Angle:=",_
0, "Text:=", "Con-
trol Circuit", "Color:=", _

Schematic Scripting 24-40


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

0, "Id:=", 34, "ShowRect:=", false, "X1:=", _


-0.0793287547755609, "Y1:=", _
0.0407033787010528, "X2:=", -0.0502245881087778,_
"Y2:=", 0.035411712034365, "RectLineWidth:=", _
0, "RectBorderColor:=", 0, "RectFill:=",
0, "RectColor:=", 0), Array("NAME:Attributes", "Page:=", 1)

VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("Circuit1")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
textobj = oEditor.CreateText(Array("NAME:TextData", "X:=", 0.10414, "Y:=", 0.06604, "Size:=", _

Schematic Scripting 24-41


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

12, "Angle:=", 0, "Text:=", "CreateDefaultTectxt" & Chr(13) & Chr(10) & "", "Color:=", _
0, "Id:=", 286, "ShowRect:=", false, "X1:=", 0.100141851851836, "Y1:=", _
0.0670983333333376, "X2:=", 0.140123333333477, "Y2:=", 0.0565149999999619, "RectLineWidth:=", _
0, "RectBorderColor:=", 0, "RectFill:=", 0, "RectColor:=", 0), Array("NAME:Attributes", "Page:=",
_
1))
MsgBox "text = " & textobj
CreateWire (Schematic Editor)
Create a wire

UI Access Draw>Wire

Name Type Description


<WireData> Array Array("NAME:WireData" _
"Name:=", string), // [Opt=default name] Name for this wire
"Id:=", int), // Wire idnum
Parameters "Points:=", Points on wire)
<Attributes> Array Array("NAME:Attributes", _
"Page:=", int, _ // [Opt=1] Page number (one-based)
Note: Page 1 always exists
[out,retval] string id)

Return Value String

Schematic Scripting 24-42


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Unique id

Wire is created and its return value has the format Wire@<netName>;<schematicID>;<segment index list>
The Schematic ID can be found in the Symbol tab of the Properties window when you select the wire. The wire net name appears in
the General tab. The parameter segment index list indicates the number of segments i.e. the segment count.

Python Syntax CreateWire()


oEditor.CreateWire(
["NAME:WireData", "Name:=", "", "Id:=", 41, "Points:=", [ _
Python Example
"(-0.033020, 0.015240)", "(-0.017780, 0.015240)",
"(-0.017780, 0.012700)"]], ["NAME:Attributes", "Page:=", 1])

Schematic Scripting 24-43


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax CreateWire()
oEditor.CreateWire
Array("NAME:WireData", "Name:=", "", "Id:=", 41, "Points:=", Array( _
VB Example
"(-0.033020, 0.015240)", "(-0.017780, 0.015240)",
"(-0.017780, 0.012700)")), Array("NAME:Attributes", "Page:=", 1)

VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("Circuit1")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")

Schematic Scripting 24-44


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

WireID = oEditor.CreateWire(Array("NAME:WireData", "Name:=", "", "Id:=", 261, "Points:=", Array(


_
"(0.101600, 0.063500)", "(0.106680, 0.063500)", "(0.106680, 0.060960)")), Array("NAME:At-
tributes", "Page:=", _
1))
MsgBox "Wire ID = " & WireID

General Method List


This section presents the general script methods that are available.
The general method script commands are listed here.
Activate (Schematic Editor)
AddPinGrounds (Schematic Editor)
AddPinIPorts (Schematic Editor)
AddPinPageConnectors (Schematic Editor)
AddPinCustomTerminations (Schematic Editor)
AlignHorizontal (Schematic Editor)
AlignVertical (Schematic Editor)
BringToFront (Schematic Editor)
Close Editor (Schematic Editor)
Copy (Schematic Editor)
CopyData [Schematic Editor]
CopySubdesign [Schematic Editor]
CreatePage (Schematic Editor)

Schematic Scripting 24-45


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Cut (Schematic Editor)


DeactivateOpen (Schematic Editor)
DeactivateShort (Schematic Editor)
Delete (Schematic Editor)
DeletePage (Schematic Editor)
ElectricRuleCheck (Schematic Editor)
ExportImage (Schematic Editor)
FindElements (Schematic Editor)
FitToBorder [Schematic Editor]
GridSetup (Schematic Editor)
FlipHorizontal (Schematic Editor)
FlipVertical (Schematic Editor)
Move (Schematic Editor)
NameNets (Schematic Editor)
PageBorders (Schematic Editor)
Pan (Schematic Editor)
Paste (Schematic Editor)
PasteData [Schematic Editor]
PasteDesign (Schematic Editor)
PushExcitations (Schematic Editor)

Schematic Scripting 24-46


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Rotate (Schematic Editor)


ShowVariableBlock (Schematic Editor)
SelectAll (Schematic Editor)
SelectPage (Schematic Editor)
SendToBack(Schematic Editor)
SetPageData [Schematic]
SortComponents (Schematic Editor)
ZoomArea (Schematic Editor)
ZoomIn (Schematic Editor)
ZoomOut (Schematic Editor)
ZoomPrevious (Schematic Editor)
ZoomToFit (Schematic Editor)
Wire (Schematic Editor)
Activate (Schematic Editor)
Enable items previously disabled

UI Access Edit>Activate

Name Type Description


Parameters
Name Type Description

Return Value Value

Schematic Scripting 24-47


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax Activate(["NAME:Selections","Selections:=", [<components>] ])


Python Example oEditor.Activate(["NAME:Selections","Selections:=", ["CompInst@STEP;1;1"]])

VB Syntax Activate Array("NAME:Selections", "Selections:=", Array("<components>"))


oEditor.Activate Array("NAME:Selections",
VB Example
"Selections:=", Array("CompInst@STEP;1;1"))

AddPinGrounds (Schematic Editor)


Adds grounds at all unconnected pins
AddPinGrounds (
Array("NAME:Selections", _ // PagePort Name
"Selections:=", _ // Net Name
Array("CompInst@CAP_;2;4"))

Schematic Scripting 24-48


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note:

The format for Components is CompInst@<CompName>;<compInstID>;<optional schematicID>. In the documented


example, <CompName> stands for the component name CAP_, <compInstID> stands for its ID 2, and <optional schem-
aticID> is the schematic ID 4. If you select the component, the Properties window gets updated and displays its details.
For example, the selected object’s component name and ID appear in the General tab of the Properties window as shown
below.

To view the SchematicID click the Symbol tab.

Schematic Scripting 24-49


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax AddPinPageConnectors ()


oEditor.AddPinPageconnectors["NAME:Selections",
Python Example "Selections:=", [ _
"CompInst@C;1;1"]]

Schematic Scripting 24-50


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AddPinIPorts (Schematic Editor)


Adds Interface Ports at unconnected pins of all selected components. Each port has a unique name.

UI Access Draw>Add at unconnected pins>Interface Ports

Name Type Description


Parameters <IntPortName,NetName> Array Array("NAME:Selections", _ // Interface Port Name
"Selections:=", _ // Net Name

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax AddPinIPorts ()


oEditor.AddPinIPorts

Python Example
["NAME:Selections", "Selections:=", ["CompInst@R;2;37"]]

VB Syntax AddPinIPorts ()
oEditor.AddPinIPorts
VB Example
Array("NAME:Selections", "Selections:=", Array("CompInst@R;2;37"))

Schematic Scripting 24-51


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AddPinPageConnectors (Schematic Editor)


Adds Page Ports at unconnected pins of all selected components

UI Access Draw>Add at unconnected pins>Grounds

Name Type Description


Parameters
Name Type Description

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax AddPinPageConnectors ()


oEditor.AddPinPageconnectors
Python Example ["NAME:Selections", "Selections:=", [ _
"CompInst@C;1;1"]]

VB Syntax AddPinPageConnectors ()
oEditor.AddPinPageconnectors
VB Example Array("NAME:Selections", "Selections:=", Array( _
"CompInst@C;1;1"))

Schematic Scripting 24-52


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AlignHorizontal (Schematic Editor)


Align items horizontally

UI Access Draw>Align Horizontal

Name Type Description


<Selections> Array Array("NAME:Selections", _
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify)
Parameters <AlignParameters> Array Array("NAME:AlignParameters", _
"Disconnect:=", bool _ // [Opt=0] Should wires disconnect
"Rubberband:=", bool) _ // [Opt=1] Should wires staircase
Note: Alignment occurs relative to the first item in ids

Return Value Value

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax AlignHorizontal()


oEditor.AlignHorizontal (["NAME:Selections", "Selections:=", [ _
Python
"CompInst@R;2;4", "CompInst@C;1;1"]], ["NAME:AlignParame-
ters", "Disconnect:=", _
Example
false, "Rubberband:=", false])

Schematic Scripting 24-53


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syn- AlignHorizontal()
tax

oEditor.AlignHorizontal Array("NAME:Selections", "Selections:=", Array( _


VB
"CompInst@R;2;4", "CompInst@C;1;1")), Array("NAME:AlignParame-
ters", "Disconnect:=", _
Example
false, "Rubberband:=", false)

AlignVertical (Schematic Editor)


Align items vertically

UI Access Draw>Align Vertical

Name Type Description


<Selections> Array Array("NAME:Selections", _
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify)
Parameters <Align Para- Array Array("NAME:AlignParameters", _
meters>
"Disconnect:=", bool _ // [Opt=0] Should wires disconnect
"Rubberband:=", bool) _ // [Opt=1] Should wires staircase
Note: Alignment occurs relative to the first item in ids

Return Value None

Schematic Scripting 24-54


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python AlignVertical()
Syntax

oEditor.AlignVertical (["NAME:Selections", "Selections:=", ["CompInst@R;2;4", _


Python
"CompInst@C;1;1"]], ["NAME:AlignParameters", "Disconnect:=", false, "Rubberband:=", _
Example
false])

VB Syn- AlignVertical()
tax

oEditor.AlignVertical Array("NAME:Selections", "Selections:=", Array("CompInst@R;2;4",


_
VB
"CompInst@C;1;1")), Array("NAME:AlignParameters", "Discon-
nect:=", false, "Rub-
Example
berband:=", _
false)

BringToFront (Schematic Editor)


Bring the selected object to the front of the view

UI Access Draw>Bring to Front

Schematic Scripting 24-55


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


<Selections> Array ["NAME: Selections", "Selections:=",[<Selected Components>]]
<Selected Components>
Parameters
CompInst@DefName; ID, schematic ID , CompInst@DefName; ID, schematic
ID
CompInst@R;1,2

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax BringToFront( )


oEditor.BringToFront(
Python Example
["NAME:Selections", "Selections:=", ["SchObj@1"]])

VB Syntax BringToFront( )
oEditor.BringToFront
VB Example
Array("NAME:Selections", "Selections:=", Array("SchObj@1"))

Schematic Scripting 24-56


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

CloseEditor (Schematic Editor)


Close an Editor

UI Access NA

Name Type Description


Parameters
None

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax CloseEditor()


Python Example oDefinitionEditor.CloseEditor()

VB Syntax CloseEditor
VB Example oDefinitionEditor.CloseEditor

Copy (Schematic Editor)


GeneralCopy
// Copy items for pasting

Schematic Scripting 24-57


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Copy(
Array("NAME:Selections", _
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify))

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax Copy( )


oEditor.Copy (["NAME:Selections", "Selections:=",
Python Example
["CompInst@R;2;37", _ "CompInst@C;1;1"]])

CopyData [Schematic Editor]


Use: Copy graphic object or component properties for pasting.
Command: Edit> Copy Data (or Right-click on graphic object or component and select Copy Data)
Syntax: CopyData Array("NAME:Selections", "Selections:=", Array(<selections>))
Return Value: None.
Parameters: <selections>
Type: Comma-separated list of strings

Schematic Scripting 24-58


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Identifiers for each selected item to be copied, in the form CompInst@<id>, where id is the compname;ID;schematicID for each ele-
ment.
Example: Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
oEditor.CopyData Array("NAME:Selections", "Selections:=", Array("CompInst@Cap;1;1"))

CopySubdesign [Schematic Editor]


Copy components that represent subdesigns, as well as their represented designs, for pasting. The designs, when pasted, will be
independent, with unique names based on the original design.

UI Access (Right-click on hierarchical component) Copy as New Design

Name Type Description


<selections> Comma- Identifiers for each selected item to be copied, in the form CompInst@<id>,
Parameters separated where id is the compname;ID;schematicID for each element.
list of
strings

Return Value None

Python Syntax CopySubdesign (["NAME:Selections", "Selections:=", [<selections>]])


oEditor.CopySubdesign ([
"NAME:Selections", "Selections:=", [
Python Example
"CompInst@Simplorer2;23;17"]])

Schematic Scripting 24-59


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax CopySubdesign Array("NAME:Selections", "Selections:=", Array(<selections>))


oEditor.CopySubdesign Array(
VB Example "NAME:Selections", "Selections:=",
Array("CompInst@Simplorer2;23;17"))

CreatePage (Schematic Editor)


Create a page at the end of the existing pages

UI Access Schematic>New Page

Name Type Description


Parameters <PageName> String Name of the page that has been created
<PageNum> Integer Page Number

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

CreatePage(string name, // Page name


Python Syntax
[out,retval] int num) // Page number
Python Example oEditor.CreatePage ("TestPage1")

Schematic Scripting 24-60


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

CreatePage( string name, // Page name


VB Syntax
[out,retval] int num) // Page number
VB Example oEditor.CreatePage "TestPage1"

Cut (Schematic Editor)


Cut Page Selection

UI Access Edit>Cut

Name Type Description


<Selections> Array Array("NAME:Selections", _
Parameters
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify))

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax Cut()


Python Example oEditor.Cut (["NAME:Selections", "Selections:=", ["CompInst@R;10;93"]])

VB Syntax Cut()

Schematic Scripting 24-61


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oEditor.Cut Array("NAME:Selections",
VB Example
"Selections:=", Array("CompInst@R;10;93"))

DeactivateOpen (Schematic Editor)


Disable items and replace with an open circuit

UI Access Edit>Deactivate (Open)

Name Type Description


<Selections> Array Array("NAME:Selections", _
Parameters
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify))

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax DeactivateOpen()


oEditor.DeactivateOpen (["NAME:Selections",
Python Example
"Selections:=", [ "CompInst@R;2;37"]])

Schematic Scripting 24-62


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax DeactivateOpen()
oEditor.DeactivateOpen Array("NAME:Selections",
VB Example
"Selections:=", Array( "CompInst@R;2;37"))

DeactivateShort (Schematic Editor)


Disable items and replace with a closed circuit

UI Access Edit>Deactivate (Short)

Name Type Description


<Selections> Array Array("NAME:Selections", _
Parameters
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify))

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax DeactivateShort ()


oEditor.DeactivateShort(["NAME:Selections", "Selections:=", [ _
Python Example
"CompInst@R;2;37"])

Schematic Scripting 24-63


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax DeactivateShort ()
oEditor.DeactivateShort Array("NAME:Selections", "Selections:=", Array( _
VB Example
"CompInst@R;2;37"))

Delete (Schematic Editor)


Delete items

UI Access Edit>Delete

Name Type Description


<Selections> Array Array("NAME:Selections", _
Parameters
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify))

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax Delete()


oEditor.Delete (["NAME:Selections", "Selections:=",
Python Example
["CompInst@R;10;93"]])

Schematic Scripting 24-64


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax Delete()
oEditor.Delete Array("NAME:Selections", "Selections:=",
VB Example
Array("CompInst@R;10;93"))

DeletePage (Schematic Editor)


To reduce the number of pages in the schematic

UI Access Schematic>Remove Page

Name Type Description


Parameters
None

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax DeletePage(<pagenum>, <pagenum>*)


Python Example num = oEditor.DeletePage([1, 4])

VB Syntax DeletePage Array(<pagenum>[, <pagenum>]*)


Dim oEditor
VB Example
Set num = oEditor.DeletePage Array(1, 4)

Schematic Scripting 24-65


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

ElectricRuleCheck (Schematic Editor)


Check Electric Rule

UI Access Schematic>Electric Rule Check

Name Type Description


<ElectricRules> Array Array(string, ...), bool)
Array
Array of strings containing names of electric rules to perform.
Valid names are:
Parameters
"PinRule": Checks for components with unconnected pins
"OutputPinRule": Checks for nets with more than one output pin
bool
True if this should check all subcircuits
False if this should just check this circuit

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Schematic Scripting 24-66


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax ElectricRuleCheck()


oEditor.ElectricRuleCheck (["PinRule",
Python Example
"OutputPinRule", "OverlapCompRule"], True)

VB Syntax ElectricRuleCheck()
oEditor.ElectricRuleCheck Array("PinRule",
VB Example
"OutputPinRule", "OverlapCompRule"), True

ExportImage (Schematic Editor)


To export a picture for a specified page of the current design to a file. The image size can also be specified. The filename extension
determines the type of image exported.

UI Access None.

Name Type Description


<filename> String The name of the file, with format-specific extension. Extensions supported are:
bmp, gif, jpg, jpeg, png, tif, tiff.
Parameters <pagenum> Integer The page number of the current schematic. Page numbers start at 1. If the num-
ber is out of range, the current schematic page will be printed.
<dx> Integer The width of the image. If dx is less than 160, 160 will be used for the width.
<dy> Integer The height of the image. If dy is less than 160, 160 will be used for the height.

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Schematic Scripting 24-67


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax ExportImage (<filename>, <pagenum>, <dx>, <dy>)


oEditor.ExportImage ("c:\mysch.png", 1, 800, 400)
Python Example

VB Syntax ExportImage (<filename>, <pagenum>, <dx>, <dy>)


VB Example oEditor.ExportImage "c:\mysch.png", 1, 800, 400

ExportNetlist
Exports a netlist solution.

UI Access None

Name Type Description


<solution> String The Circuit solution in the design. For Maxwell Circuit, the solution must
Parameters be an empty string, "".
<fileName> String File and path to the netlist file. For Maxwell Circuit, the file name must be
a SPH file.

Return Value None.

Python Syntax ExportNetlist(<setupName>,<fileName>)


Python Example oDesign.ExportNetlist("", "SolutionData.sph")

Schematic Scripting 24-68


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax ExportNetlist <solution> <fileName>


VB Example oDesign.ExportNetlist "" SolutionData.sph

FindElements (Schematic Editor)


Select elements based on properties

UI Access Edit>Find Elements

Name Type Description


<propname> String The name of the property, or "*" to search through all properties
<propvalue> String The value of the property, or a substring
<criterion> Integer 0 = Contains
1 = Does not contain
2 = Exact match
<types> Integer 2 - components only
4 - graphic objects only
Parameters 8 - wires only
16 - ports only
Add the numbers to look through more types - 30 is a common number, search-
ing through everything
<match> Boolean True = match all of the properties specified
False = match any of the properties specified
<case> Boolean True = case-sensitive
False = not case-sensitive
<sub> Boolean True = search subcircuits as well as current schematic

Schematic Scripting 24-69


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

False = only search current schematic


<only> Boolean True = search within current selections
False = search schematic(s)

Return Value Array of strings, the names of the elements selected

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

FindElements(["NAME:SearchProps", "Prop:=", [<propname>, <propvalue>, <criterion>)[, [<propname>, <prop-


Python Syntax value>, <criterion>]]*], ["NAME:Parameters", "Filter:=", <types>, "MatchAll:=", <match>, "MatchCase:=",
<case>, "SearchSubCkt:=", <sub>, "SearchSelectionOnly:=", <only>])
oEditor.FindElements(
[
"NAME:SearchProps",
"Prop:=", ["CompName","",0]

Python Example ],
[
"NAME:Parameters",
"Filter:=" , 30,
"MatchAll:=" , False,

Schematic Scripting 24-70


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"MatchCase:=" , False,
"SearchSubCkt:=" , True,
"SearchSelectionOnly:=" , False
])

FindElements(Array("NAME:SearchProps", "Prop:=", Array(<propname>, <propvalue>, <criterion>)[, Array


VB Syntax (<propname>, <propvalue>, <criterion>)]*), Array("NAME:Parameters", "Filter:=", <types>, "MatchAll:=",
<match>, "MatchCase:=", <case>, "SearchSubCkt:=", <sub>, "SearchSelectionOnly:=", <only>)
eltarray = oEditor.FindElements Array("NAME:SearchProps",
"Prop:=", Array("InstanceName", "R", 0)),
Array("NAME:Parame-
ters", "Filter:=",_2,
VB Example

"MatchAll:=", true, "MatchCase:=", false,

"SearchSubCkt:=", false, "SearchSelectionOnly:=", false)

FitToBorder [Schematic Editor]


Use: To reset the schematic view to just include the page border, if any.

UI Access View>Fit Border

Name Type Description


Parameters
None

Schematic Scripting 24-71


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value None

Python Syntax FitToBorder()


oEditor.FitToBorder()
Python Example

VB Syntax FitToBorder
VB Example oEditor.FitToBorder

GridSetup (Schematic Editor)


Changes the settings on the schematic grid

UI Access Schematic>Grid Setup

Name Type Description


<Options> Array Array("NAME:Options", _
"MajorGrid:=", string, _ // Major grid size with units
"Divisions:=", int, _ // Number of minor grid divisions
Parameters
"MajorColor:=", int, _ // RGB Color of major grid lines
"MinorColor:=", int, _ // RGB Color of minor grid lines
"ShowGrid:=", bool, _ // Should the grid be shown?
"SnapToGrid:=", bool, _ // Should objects snap to grid?

Schematic Scripting 24-72


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"BackgroundColor:=", int, _ // RGB Color of the background


"SaveAsDefault:=", bool))

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax GridSetup()


oEditor.GridSetup([
"NAME:Options", _
"MajorGrid:=", "10mm", _
"Divisions:=", 10, _
"MajorColor:=", 0x00ff0000, _ # Red
Python Example
"MinorColor:=", 0x0000ff00, _ # Green
"ShowGrid:=", true, _
"SnapToGrid:=", true, _
"BackgroundColor:=", 0x00ffffff, _ # White
"SaveAsDefault:=", false])

Schematic Scripting 24-73


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax GridSetup()
oEditor.GridSetup
Array(
"NAME:Options", _
"MajorGrid:=", "10mm", _
"Divisions:=", 10, _

VB Example "MajorColor:=", 0x00ff0000, _ // Red


"MinorColor:=", 0x0000ff00, _ // Green
"ShowGrid:=", true, _
"SnapToGrid:=", true, _
"BackgroundColor:=", 0x00ffffff, _ // White
"SaveAsDefault:=", false)

For example:
oEditor.GridSetup Array(
"NAME:Options", _
"MajorGrid:=", "10mm", _
"Divisions:=", 10, _
"MajorColor:=", 0x00ff0000, _ // Red
"MinorColor:=", 0x0000ff00, _ // Green
"ShowGrid:=", true, _

Schematic Scripting 24-74


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"SnapToGrid:=", true, _
"BackgroundColor:=", 0x00ffffff, _ // White
"SaveAsDefault:=", false)
FlipHorizontal (Schematic Editor)
Flip items about the horizontal (x) axis

UI Access NA

Name Type Description


<Selections> Array Array("NAME:Selections", _
"Page:=", page number, _ // [Opt=1] Page number
Parameters "Selections:=", IDs to modify))
<FlipParameters> Array Array("NAME: FlipParameters", _
"Disconnect:=", bool _ // [Opt=0] Should wires disconnect
"Rubberband:=", bool) _ // [Opt=1] Should wires staircase

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax FlipHorizontal(


Python Example oEditor.FlipHorizontal(

Schematic Scripting 24-75


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

["NAME:Selections", "Selections:=", [ _
"CompInst@R;2;4", "CompInst@C;1;1"]],
["NAME:FlipParame-
ters",
"Disconnect:=", true, "Rubberband:=", false])

VB Syntax FlipHorizontal(
oEditor.FlipHorizontal
Array("NAME:Selections", "Selections:=", Array( _

VB Example "CompInst@R;2;4", "CompInst@C;1;1")),


Array("NAME:FlipParame-
ters",
"Disconnect:=", true, "Rubberband:=", false)

FlipVertical (Schematic Editor)


Flip items about the vertical (y) axis

UI Access NA

Name Type Description


<Selections> Array Array("NAME:Selections", _
Parameters "Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify))
<FlipParameters> Array Array("NAME:FlipParameters", _

Schematic Scripting 24-76


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Disconnect:=", bool _ // [Opt=0] Should wires disconnect


"Rubberband:=", bool) _ // [Opt=1] Should wires staircase

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax FlipVertical(


oEditor.FlipVertical (["NAME:Selections",

Python Example
"Selections:=", ["CompInst@R;2;4", _
"CompInst@C;1;1"]], ["NAME:FlipParameters",
"Disconnect:=", true, "Rubberband:=", false])

VB Syntax FlipVertical(
oEditor.FlipVertical Array("NAME:Selections",
"Selections:=", Array("CompInst@R;2;4", _
VB Example
"CompInst@C;1;1")), Array("NAME:FlipParameters",
"Disconnect:=", true, "Rubberband:=", false)

Schematic Scripting 24-77


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Move (Schematic Editor)


Move items

UI Access NA

Name Type Description


<Selections> Array Array("NAME:Selections", _
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify))
<MoveParameters> Array Array("NAME:MoveParameters", _
Parameters
"xdelta:=", double _ // X distance to move
"ydelta:=", double _ // Y distance to move
"Disconnect:=", bool _ // [Opt=0] Should wires disconnect
"Rubberband:=", bool) _ // [Opt=1] Should wires staircase

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax Move()


Python Example oEditor.Move (["NAME:elements", "circle_0", "rect_2"],

Schematic Scripting 24-78


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

[0.0165613577023499, -0.001])

VB Syntax Move()
oEditor.Move Array("NAME:elements", "circle_0", "rect_2"),
VB Example
Array(0.0165613577023499, -0.001)

NameNets (Schematic Editor)


Change names of nets on the schematic

UI Access Schematic>Auto-Name Wires

Name Type Description


Parameters
None

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Schematic Scripting 24-79


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

NameNets(
bool display, // Show Net names or not
["NAME:NetNames", _
Python Syntax
"string:=", _ #Old name of the net (e.g. net_1)
string, _ #New name of the net (e.g. my_net)
...]) # Repeat for additional nets to change
oEditor.NameNets (True, ["NAME:NetNames",
Python Example
"Wire@net_2;41:1:=", "A[0]"])

NameNets(
bool display, // Show Net names or not
Array("NAME:NetNames", _
VB Syntax
"string:=", _ // Old name of the net (e.g. net_1)
string, _ // New name of the net (e.g. my_net)
...) // Repeat for additional nets to change
oEditor.NameNets true, Array("NAME:NetNames",
VB Example
"Wire@net_2;41:1:=", "A[0]")

Schematic Scripting 24-80


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

PageBorders (Schematic Editor)

Note:

This command has been replaced with the SetPageData command. Legacy scripts using this command will play back for
the first page of a schematic only.

Sets up visible page borders on the schematic


PageBorders(
Array("NAME:Options", _
"PageSize:=", _
Array("x:=", string, _ // Width of page border with units
"y:=", string), _ // Height of page border with units
"PageMargins:=", _
Array("x:=", string, _ // Margin Width with units
"y:=", string), _ // Margin Height with units
"ZonesHoriz:=", int, _ // Number of Horizontal zones
"ZonesVert:=", int)) // Number of Vertical zones

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Pan (Schematic Editor)


Pan Display

Schematic Scripting 24-81


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access View>Pan

Name Type Description


Parameters
None

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Pan([
Python Syntax double, _ // Move the visible area by X meters
double]) // Move the visible area by Y meters
oDefinitionEditor.Pan
Python Example
([-0.00922653869663931, 0.00686839904222147])

Pan(Array(
VB Syntax double, _ // Move the visible area by X meters
double)) // Move the visible area by Y meters
VB Example oDefinitionEditor.Pan

Schematic Scripting 24-82


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array(-0.00922653869663931, 0.00686839904222147)

Paste (Schematic Editor)


Paste copied items

UI Access Edit>Paste

Name Type Description


Parameters
None

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax Paste( VARIANT attrs)# specified attributes


oEditor.Paste (["NAME:Attributes",
Python Example "Page:=", 1, "X:=", -0.059131200000001, "Y:=",_
0.030784799999999, "Angle:=", 0, "Flip:=",false])

VB Syntax Paste(VARIANT attrs); // specified attributes


oEditor.Paste Array("NAME:Attributes",
VB Example
"Page:=", 1, "X:=", -0.059131200000001, "Y:=",_

Schematic Scripting 24-83


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

0.030784799999999, "Angle:=", 0, "Flip:=",false)

PasteData [Schematic Editor]


Use: Paste graphic object or component properties to another object or component.
Command: Edit> Paste Data (or Right-click on graphic object or component and select Paste Data)
Syntax: PasteData Array("NAME:Selections", "Selections:=", Array(<selections>), "SelectList:=", Array(<select_prop_display>,
<select_parameters>), "Exclude:=", Array(<ExcludeList>))
Return Value: None.
Parameters: Selections
Type: Comma separated component instance list where user wants to paste data
Identifiers for each selected item to be copied, in the form CompInst@<id>, where id is the compname;ID;schematicID for each ele-
ment.
SelectList
Type: Comma separated Boolean list where:
<select_prop_display> true to paste property displays
<select_parameters> true to paste parameters
<ExcludeList>
Type: Comma separated list of property names to exclude from being pasted.
Example: Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
oEditor.PasteData Array("NAME:Selections", "Selections:=", Array("CompInst@Cap;2;3"),
"SelectList:=", Array(true, true), "Exclude:=", Array("IC"))

Schematic Scripting 24-84


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

PasteDesign (Schematic Editor)


Paste a design that has already been copied to the clipboard into schematic as a subdesign.
Syntax:
PasteDesign(
pasteOption , // see below for values
Array("NAME:Attributes", _
"Page:=", int, _ // [Opt=1] Page number (one-based)
// Note: Page 1 always exists
"X:=", double, _ // X position of the object
"Y:=", double, _ // Y position of the object
"Angle:=", double, _ // Rotation angle (radians)
"Flip:=", bool) // True if mirrored
)
Return Value: Component is created and the returned value has the format CompInst@<CompName>;<compInstID>;<optional
schematicID>
For instance a return value CompInst@CAP_;4;35 indicates that the component name is CAP_, its ID is 5, and its Schem-
atic ID is 35. These details can be found in the Properties window when you select the created component. The component
name and ID can be found in the Gen-eral tab and the Schematic ID can be found in the Symbols tab.
Parameters: pasteOption should be one of the following:
0 to link to the existing design that was copied
1 to create a new copy of the design that was copied but keep the original layers of the design being copied
2 to create a new copy of the design and merge the layers of the design being copied into the design receiving the copy

Schematic Scripting 24-85


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("SimpleCircuitPaste")
oProject.CopyDesign "D"
Set oDesign = oProject.SetActiveDesign("A")
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
oEditor.PasteDesign 1, Array("NAME:Attributes", "Page:=", 1, "X:=", 0.0762, "Y:=", _
0.0635, "Angle:=", 0, "Flip:=", false)

Schematic Scripting 24-86


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

PushExcitations
Allows access to computed excitations for transient and linear frequency solutions. The script command can be accessed from three
locations.

l Layout Editor
UI Access l Schematic Editor
l Select a Nexxim solution in a 3D Layout design, right click, and choose Push Excitations.

Name Type Description


<Reference Designation> String "<refdes>"
This argument is empty when excitations are pushed from a Nexxim
solution.
<PushExcitations Para- Array This parameter changes depending on whether the excitations
meters> comes from a transient or linear frequency solution. The keyword
"transient:=" indicates to AEDT which solution generated the
excitations. If "transient:=" is present, "CalcThevenin ="
and its value are ignored.
For a linear frequency solution, use this array:
Parameters
Array("NAME:options",
"CalcThevenin =" , <true|false>,
"Sol:=", "<solution name>")
If CalcThevenin is true, Thevenin’s equivalent is calculated. Para-
meters for the linear frequency solution do not include a Freq argu-
ment, so all frequencies from the solution are used.
For a transient solution, use:
Array("NAME:options",

Schematic Scripting 24-87


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"transient:=", Array(
"start:=", <start time>,
"stop:=", <stop time>,
"maxHarmonics:=", <max harmonics>,
"winType:=", <window>,
["widthPct:=", <width percentage>,]
["kaiser:=", <Kaiser value>,]
["correctCoherentGain:=", true]),
"Sol:=", "<solution name>")
winType can have the following values:
l Rectangular
l Bartlett
l Blackman
l Hamming
l Hanning
l Kaiser
l Welch
l Weber
l Lanzcos

Return Value None

Schematic Scripting 24-88


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

PushExcitations "<refdes>", Array("NAME:options", "transient:=",


["CalcThevenin =" , <true>], Array("start:=", <start time>, "stop:=", <stop time>,
VB Syntax "maxHarmonics:=", <max harmonics>, "winType:=", <window>,
["widthPct:=", <width percentage>,] ["kaiser:=", <Kaier value>,]
["correctCoherentGain:=", true]), "Sol:=", "<solution name>")

For a transient solution:


Set oEditor = oDesign.SetActiveEditor("Layout")
oEditor.PushExcitations "U3", Array("NAME:options", _
"transient:=", Array("start:=", 0, "stop:=", 5E-005, _
"maxHarmonics:=", 100, "winType:=", "Rectangular", _
"widthPct:=", 100, "kaiser:=", 0, "correctCoherentGain:=",_
VB Example true), "Sol:=", "Transient")

Set oDesign = oProject.SetActiveEditor("Design1")


oDesign.PushExcitations "", Array("NAME:options", _
"transient:=", Array("start:=", 0, "stop:=", 1E-08, _
"maxHarmonics:=", 100, "winType:=", "Hamming", _
"widthPct:=", 100, "kaiser:=", 0, "correctCoherentGain:=",_

Schematic Scripting 24-89


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

true), "Sol:=", "Transient Setup 1")

For a linear frequency solution:


Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
oEditor.PushExcitations "S1", Array("NAME:options", _
"CalcThevenin:=", false, "Sol:=", "LinearFrequency")

Rotate (Schematic Editor)


Rotate items

UI Access Draw>Rotate

Name Type Description


<Selections> Array Array("NAME:Selections", _
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify))
<RotateParameters> Array Array("NAME:RotateParameters", _
Parameters
"Disconnect:=", bool _ // [Opt=0] Should wires disconnect
"Rubberband:=", bool _ // [Opt=1] Should wires staircase
"Angle:=", double) // [Opt=/2] Angle to rotate
Note: Rotation occurs around center of ids

Return Value None

Schematic Scripting 24-90


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note:

When you record a script, the schematic editor's Rotate command shows the rotation angle for some older scripts in radi-
ans, while newer scripts show rotation angle in degrees.

oEditor.Rotate Array("NAME:Selections", "Selections:=", _

Array("CompInst@RES_;1;1:1")), Array("NAME:RotateParameters", _

"Angle:=", 1.5707963267949, "Disconnect:=", false, "Rubberband:=", false)

If "Degrees=xxx" is not shown, the rotation must be scaled.

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax Rotate()


oEditor.Rotate (["NAME:Selections", "Selections:=",
["CompInst@R;2;4", "CompInst@C;1;1"]],
Python Example
["NAME:RotateParameters","Degrees:=", 90, "Disconnect:=", _
false, "Rubberband:=", false])

Schematic Scripting 24-91


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax Rotate()
oEditor.Rotate Array("NAME:Selections", "Selections:=",
Array("CompInst@R;2;4", "CompInst@C;1;1")),
VB Example
Array("NAME:RotateParameters","Degrees:=", 90, "Disconnect:=", _
false, "Rubberband:=", false)

SelectAll (Schematic Editor)


Select all elements on the given page.

UI Access Edit>Select All

Name Type Description


Parameters
None

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

SelectAll(int pageNum) # Page number


Python Syntax
The first page number is 1. If an invalid page number is passed in (i.e. 0, -1, etc), SelectAll will use the active
page on the currently active view. If there is no active view, the first page, page 1, is used.
Python Example oEditor.SelectAll(1)

Schematic Scripting 24-92


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

SelectAll(int pageNum) // Page number


VB Syntax The first page number is 1. If an invalid page number is passed in (i.e. 0, -1, etc), SelectAll will use the active
page on the currently active view. If there is no active view, the first page, page 1, is used.
VB Example oEditor.SelectAll 1

SelectPage (Schematic Editor)


Select a page in the UI

UI Access NA

Name Type Description


Parameters
None

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax SelectPage(int page) # Page number


Python Example oEditor.SelectPage(1)

VB Syntax SelectPage(int page) // Page number

Schematic Scripting 24-93


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Example oEditor.SelectPage 1

SetPageData [Schematic Editor]

Note:

This command replaces the PageBorders command.

To add or remove page border, title block and page property data from the specified page. Title blocks will not be shown if the page
border type is "None". Any number of title blocks may be specified, as well as any number of page properties. Some of the page prop-
erties are special and their values will be updated automatically as appropriate, such as Project, ProjectPath, Design, Number and
Date.

UI Access Schematic>Page Borders and Title Blocks...

Name Type Description


<bordertype> String One of: "None", "Outline", "ANSI", "ISO", "DIN"
<sizeX> Double Size of X axis
(with units)
<sizeY> Double Size of Y axis
(with units)
<marginX> Double Margin of X axis
Parameters (with units)
<marginY> Double Margin of Y axis
(with units)
<zonesH> Integer
<zonesV> Integer
<symbolName> String The name of the title block symbol.
<libName> String The name of the library (with path from library directory root) that contains the
title block symbol

Schematic Scripting 24-94


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<Hsnap> String One of: "Left", "Right", "Center", "None"


<Vsnap> String One of "Top", "Bottom", "Center", "None"
<rotation> String One of "0", "90", "270"
<propName> String The name of a page property followed by ":="
<propVal> String The value of a page property

Return Value None

SetPageData (<pagenum>,
["NAME:Border", "BorderType:=", <bordertype>, "Page-
Size:=", ["x:=", <sizeX>,
"y:=", <sizeY>],
"PageMargins:=", ["x:=", <marginX>,
"y:=", <marginX>],"ZonesHoriz:=", <zonesH>,
Python Syntax
"ZonesVert:=", <zonesV>],
["NAME:TitleBlocks"[, "TitleBlock:=",
[<symbolName>, <libName>, <Hsnap>, <Vsnap>,
<rotation>, -1)]*],
["NAME:PageProps"[, <propName>, <propVal>]*])

oEditor.SetPageData (1, ["NAME:Border",


"BorderType:=", "ANSI", "PageSize:=", ["x:=", "11in", "y:=", "8.5in"],

Python Example "PageMargins:=", ["x:=", "0.38in", "y:=", "0.25in"], "ZonesHoriz:=",


2, "ZonesVert:=", 2], ["NAME:TitleBlocks", "TitleBlock:=", ["TitleBlk1",
"TitleBlocks", "Right", "Bottom", "0", -1]], ["NAME:PageProps",

Schematic Scripting 24-95


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Title:=", "Design Title", "Author:=", "I. M. User", "Number:=", "1",


"Project:=", "Project8", "ProjectPath:=", "e:/projects/",
"Design:=", "TwinBuilder1", "Date:=", "9:53:11 PM Jan 27, 2016"])

SetPageData (<pagenum>,
Array("NAME:Border", "BorderType:=", <bordertype>, "Page-
Size:=", Array("x:=",
<sizeX>, "y:=", <sizeY>),
"PageMargins:=", Array("x:=", <marginX>,
"y:=", <marginX>),"ZonesHoriz:=", <zonesH>,
VB Syntax
"ZonesVert:=", <zonesV>),
Array("NAME:TitleBlocks"[, "TitleBlock:=",
Array(<symbolName>, <libName>, <Hsnap>, <Vsnap>,
<rotation>, -1)]*),
Array("NAME:PageProps"[, <propName>, <propVal>]*)

Dim oEditor
oEditor.SetPageData 1, Array("NAME:Border",

VB Example "BorderType:=", "ANSI", "PageSize:=", Array("x:=", "11in", "y:=", "8.5in"),


"PageMargins:=", Array("x:=", "0.38in", "y:=", "0.25in"), "ZonesHoriz:=",
2, "ZonesVert:=", 2), Array("NAME:TitleBlocks", "TitleBlock:=", Array("TitleBlk1",

Schematic Scripting 24-96


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"TitleBlocks", "Right", "Bottom", "0", -1)), Array("NAME:PageProps",


"Title:=", "Design Title", "Author:=", "I. M. User", "Number:=", "1",
"Project:=", "Project8", "ProjectPath:=", "e:/projects/",
"Design:=", "TwinBuilder1", "Date:=", "9:53:11 PM Jan 27, 2016")

SendToBack
Send the selected object to the back of the view

UI Access Draw>Send To Back

Name Type Description


Parameters
<Object> String Object to send to the back.

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs

Python Syntax SendToBack (["NAME:Selections", "Selections:=", [<Object>, <Object>, ...]])


oDefinitionEditor.SendToBack(["NAME:Selections",
Python Example
"Selections:=", ["SchObj@10"]])

VB Syntax SendToBack Array("NAME:Selections", "Selections:=", Array (<Object>, <Object>, ...))

Schematic Scripting 24-97


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oDefinitionEditor.SendToBack Array("NAME:Selections",
VB Example
"Selections:=", Array( "SchObj@10"))

ShowVariableBlock (Schematic Editor)


Use: Control display of Variable Text Block in Schematic Editor.
Command: Schematic Ribbon > Settings > Design Variables
Syntax: ShowVariableBlock("True") // Display Text Block
ShowVariableBlock("False") // Hide Text Block
Return Value: None.
Parameters: True // Display Text Block
False // Hide Text Block

Python Syntax ShowVariableBlock ()

oEditor ShowVariableBlock
[
Python Example
("True")
]

SortComponents (Schematic Editor)


Sorts all components, or a block of components, using the specified method

UI Access Schematic>Sort Components

Schematic Scripting 24-98


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Name Type Description


<Type> Array Array(type, _ // string specifying sort type
method)) // string specifying sort method type
Parameters // string argument specifying sort type: "All Components" or "Blocks"
// An empty string corresponds to "All Components" method
// string argument specifying sort method: "By Name", "Left to Right", or "Signal
Flow"

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax SortComponents ()


Python Example oEditor.SortComponents()

VB Syntax SortComponents ()
VB Example oEditor.SortComponents

Wire (Schematic Editor)


Use: Wire specified pairs of pins in two selected component instances.
Command: Select two component instances in the Schematic Editor, then right click on one and choose Wire.

Schematic Scripting 24-99


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Syntax:

Wire (string firstComponent, _


string firstListOfPins, _// list of pins separated by space
string secondComponent, _
string secondListOfPins ) //second list of pins separated by space
Return Value: None
VB Example: oEditor.Wire "CompInst@etch_sline_s20_z70_1;10;76", "A1 A2", "Com-
pInst@CX0805MRNPO9BB220;1;1", "B1 B2"
ZoomArea (Schematic Editor)
Zoom Area

UI Access View>Zoom Area

Name Type Description


<Size> Array Array(double, _
//Base X value of the area to zoom into double),

Parameters _ // Base Y value of the area to zoom into


Array(double, _ // X size of the area to zoom
double)) // Y Size of the area to zoom
NOTE: All values in meters

Return Value None

Schematic Scripting 24-100


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax ZoomArea()


oEditor.ZoomArea ([0.00307569800375911, 0.021101611633739],
Python Example
[-0.050433530091516, -0.0220260723256825])

Python Syntax ZoomArea()


oEditor.ZoomArea ([0.00307569800375911, 0.021101611633739],
Python Example
[-0.050433530091516, -0.0220260723256825])

ZoomIn (Schematic Editor)


Zoom into the schematic

UI Access View>Zoom In

Name Type Description


Parameters
None

Return Value None

Schematic Scripting 24-101


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax ZoomIn()


Python Example oEditor.ZoomIn()

VB Syntax ZoomIn()
VB Example oEditor.ZoomIn

ZoomOut (Schematic Editor)


Zoom out from the schematic

UI Access View>Zoom Out

Name Type Description


Parameters
None

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Schematic Scripting 24-102


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax ZoomOut()


Python Example oEditor.ZoomOut()

VB Syntax ZoomOut()
VB Example oEditor.ZoomOut

ZoomPrevious (Schematic Editor)


Restore the zoom to the previous settings

UI Access NA

Name Type Description


Parameters
None

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax ZoomPrevious()


Python Example oEditor.ZoomPrevious()

Schematic Scripting 24-103


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax ZoomPrevious()
VB Example oEditor.ZoomPrevious

ZoomToFit (Schematic Editor)


Set the Zoom to Fit

UI Access View>Fit Drawing

Name Type Description


Parameters
None

Return Value None

Note:

For more information about the component name, schematic IDs, and formats, see the section Editor Scripting IDs.

Python Syntax ZoomToFit()


Python Example oEditor.ZoomToFit()

VB Syntax ZoomToFit()
VB Example oEditor.ZoomToFit

Schematic Scripting 24-104


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Property Method List


This section presents the property script methods that are available.
ChangeProperty (Schematic Editor)
GetEvaluatedPropertyValue (Schematic Editor)
GetProperties (Schematic Editor)
GetPropertyAttribute [Schematic Editor]
GetPropertyValue (Schematic Editor)
SetPropertyValue (Schematic Editor)
ChangeProperty (Schematic Editor)
Change a property

UI Access NA

Name Type Description


Parameters
Name Type Description

Return Value Value

Python Syntax ChangeProperty()


oEditor.ChangeProperty(["NAME:AllTabs",
["NAME:ComponentTab", ["NAME:PropServers", _
Python Example
"Wire@net_1;14:1"], ["NAME:ChangedProps",
["NAME:NetName", "ExtraText:=", _

Schematic Scripting 24-105


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"net_10", "Name:=", "net_10", "SplitWires:=", false]]])

VB Syntax ChangeProperty()
oEditor.ChangeProperty Array("NAME:AllTabs",
Array("NAME:ComponentTab", Array("NAME:PropServers", _
VB Example "Wire@net_1;14:1"), Array("NAME:ChangedProps",
Array("NAME:NetName", "ExtraText:=", _
"net_10", "Name:=", "net_10", "SplitWires:=", false))))

GetEvaluatedPropertyValue (Schematic Editor)


Get value.
Command: None.
Syntax: GetEvaluatedPropertyValue<tabDescription, componentID, propName>
Return Value: Evaluated value of variable property in double format.
Parameters: tabDescription = name of property tab where property is found
componentID = id of component instance where property is found,
in the format: "CompInst@<name of component type>;<id of compInstance>"
propName = name of the variable property
VB Example:
dim info

Schematic Scripting 24-106


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

evalValue = oEditor.GetEvaluatedPropertyValue("PassedParameterTab", "CompInst@CAP_;3", "C")


Notes:
1. This function is only available with the schematic editor.
2. Calling this function on non-numeric properties (e.g. Text properties) returns 0.

GetProperties (Schematic Editor)


To get the names of properties for a specified tab and element.

UI Access NA

Name Type Description


Parameters
<tab> String One of six choices, "PassedParameterTab", "ComponentTab", "Component",
"BaseElementTab", "Quantities", "Signals"
<objectId> String Instance ID of object with the property

Return Value Array of strings, the property names

Python Syntax GetProperties(<tab>, <objectId>)


comparray = oEditor.GetAllComponents()
for i in comparray:
instval = oEditor.GetPropertyValue
Python Example
("PassedParameterTab",i,"InstanceName")
proparray = oEditor.GetProperties ("Quantities",i)
for j in proparray:

Schematic Scripting 24-107


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

direction = oEditor.GetPropertyAttribute
("Quantities",i, j, "Direction")

AddInfoMessage(str(j) + " = (direction) " +


str(direction))

VB Syntax GetProperties(<tab>, <objectId>)


comparray = oEditor.GetAllComponents
for each i in comparray
instval = oEditor.GetPropertyValue ("PassedParameterTab",i,"InstanceName")
proparray = oEditor.GetProperties ("Quantities",i)
for each j in proparray
VB Example direction = oEditor.GetPropertyAttribute
("Quantities",i, j, "Direction")

MsgBox j + " = (direction) " + direction


next
next

Schematic Scripting 24-108


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetPropertyAttribute [Schematic Editor]


To find the value of an attribute of a specified property.

UI Access NA

Name Type Description


<tab> String One of six choices, "PassedParameterTab", "ComponentTab", "Component",
"BaseElementTab", "Quantities", "Signals"
Parameters <objectId> String Instance ID of object with the property
<propName> String The name of the property
<attribute> String Currently, only the "Direction" attribute is supported. Return values will be one
of "In", "Out" or "InOut"

Return Value A string, the attribute's value.

Python Syntax GetPropertyAttribute(<tab>, <objectId>, <propName>, <attribute>)


comparray = oEditor.GetAllComponents()
for i in comparray:
instval = oEditor.GetPropertyValue
("PassedParameterTab",i,"InstanceName")
Python Example proparray = oEditor.GetProperties ("Quantities",i)
for j in proparray:
direction = oEditor.GetPropertyAttribute
("Quantities",i, j, "Direction")
AddInfoMessage(str(j)+ " = (direction) " +

Schematic Scripting 24-109


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

str(direction))

VB Syntax GetPropertyAttribute(<tab>, <objectId>, <propName>, <attribute>)


comparray = oEditor.GetAllComponents
for each i in comparray

instval = oEditor.GetPropertyValue ("PassedParameterTab",i,"InstanceName")

proparray = oEditor.GetProperties ("Quantities",i)

VB Example
for each j in proparray

direction = oEditor.GetPropertyAttribute("Quantities",i, j, "Direction")


MsgBox j + " = (direction) " + direction

next
next

GetPropertyValue (Schematic Editor)


Get a property

UI Access NA

Parameters Name Type Description

Schematic Scripting 24-110


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<tab> String Tab with the property


<item> String Name of the object
<propname> String Name of the property
<value> String Value of the property

Return Value None

Python Syntax GetPropertyValue(<tab>,<item>,<propname>,<value>)


Python Example None

VB Syntax GetPropertyValue(<tab>,<item>,<propname>,<value>)

Please refer to the examples that can be found in C:\Program Files\...[Ansys Installation]...\Examples\Twin Build-
VB Example
er\Applications\Scripting\Ex6_MathMod

SetPropertyValue (Schematic Editor)


Set a property.

UI Access NA

Name Type Description


<tab> String Tab with the property
Parameters <item> String Name of the objects
<propname> String Name of the property
<value> String The new value of the property

Return Value None

Schematic Scripting 24-111


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax SetPropertyValue(<params>)


Python Example None

VB Syntax SetPropertyValue(<params>)

Please refer to the examples that can be found in C:\Program Files\...[Ansys Installation]...\Examples\Twin Build-
VB Example
er\Applications\Scripting\Ex6_MathMod

Information Method List


This section presents the information methods that are available.
GetCompInstanceFromRefDes (Schematic Editor)
GetComponentInfo (Schematic Editor)
GetComponentPins (Schematic Editor)
GetComponentPinInfo (Schematic Editor)
GetComponentPinLocation [Schematic Editor]
GetEditorName (Schematic Editor)
GetNetConnections (Schematic Editor)
GetNumPages [Schematic Editor]
GetPortInfo (Schematic Editor)
GetSelections (Schematic Editor)

Schematic Scripting 24-112


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetSignals (Schematic Editor)


GetAllPorts
Get all ports in a design.

UI Access NA

Name Type Description


Parameters
None

Return Value Ports in the design

Python Syntax GetAllPorts()


oEditor.GetAllPorts()
Python Example

VB Syntax GetAllPorts
Set oEditor = oDesign.SetActiveEditor("SchematicEditor")
VB Example
oEditor.GetAllPorts()

GetCompInstanceFromRefDes (Schematic Editor)


Informational

UI Access NA

Parameters Name Type Description

Schematic Scripting 24-113


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Component String Name of the Component

Return Value Returns IDispatch for CompInstance

GetCompInstanceFromRefDes(string)
Python Syntax
# string is refDes for the component
GetCompInstanceFromRefDes("R1")
Python Example

GetCompInstanceFromRefDes(string)
VB Syntax
// string is refDes for the component
VB Example GetCompInstanceFromRefDes("R1")

GetComponentInfo (Schematic Editor)


Informational

UI Access NA

Name Type Description


Parameters <compID> String The Schematic component’s ID, obtained from GetSelections or through
FindElements

Array of Strings, as follows:


Return Value
"Page=number"

Schematic Scripting 24-114


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ComponentName=string"
"GateCount=number"
"LocationX=number"
"LocationY=number"
"BBoxLLx=number"
"BBoxLLy=number"
"BBoxURx=number"
"BBoxURy=number"
"Angle=number" (in degrees)
"Flip=true or false"

Python Syntax GetComponentInfo(<compID>)


For i in selectionArray:
compArray = oEditor.GetComponentInfo(i)
For Each k in compArray:
Python Example
AddInfoMessage(str(k) +
"Got with GetComponentInfo")

VB Syntax GetComponentInfo<compID>

Schematic Scripting 24-115


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

selectionArray = oEditor.GetSelections
For Each i in selectionArray
compArray = oEditor.GetComponentInfo(i)

VB Example For Each k in compArray


MsgBox k, 0, "GetComponentInfo"
Next
Next

GetComponentPins (Schematic Editor)


Informational

UI Access NA

Name Type Description


Parameters <compID> String The Schematic component’s ID, obtained from GetSelections or through
FindElements.

Return Value Array of strings, which are the names of all the component's pins

Python Syntax GetComponentPins(<compID>)


selectionArray = oEditor.GetSelections()
Python Example for i in selectionArray
pinArray = oEditor.GetComponentPins(i)

Schematic Scripting 24-116


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

for j in pinArray
AddInfoMessage("Pin: " + str(j))

VB Syntax GetComponentPins<compID>
selectionArray = oEditor.GetSelections
for Each i in selectionArray
pinArray = oEditor.GetComponentPins(i)

VB Example for each j in pinArray


MsgBox j, 0, "GetComponentPins"
Next
Next

GetComponentPinInfo (Schematic Editor)


Informational - gets details about a pin on a schematic component.

UI Access NA

Name Type Description


Parameters <compID> String The Schematic component’s ID
<pinName> String The pin name

String values, as follows:


Return Value "X=number"
"Y=number"

Schematic Scripting 24-117


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Angle=number" (in degrees)


"Flip=true or false"
"WireId=netID or empty string" (netID is the identifier of the schematic net, and can be used in other inform-
ational methods)

Python Syntax GetComponentPinInfo( <compID>, <pinName>)


info = oEditor.GetComponentPinInfo
Python Example ("1","N1")

VB Syntax GetComponentPinInfo <compID>, <pinName>


info = oEditor.GetComponentPinInfo
VB Example
("1","N1")

GetComponentPinLocation [Schematic Editor]


Informational - gets the X or Y location of a pin on a schematic component. Invoke once with TRUE for "XorY" to get the X value of the
pin's location in the schematic, and once with FALSE to get the Y value.

UI Access NA

Name Type Description


Parameters
<compID> String The Schematic component’s ID

Schematic Scripting 24-118


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<pinName> String The pin name


<XorY> Boolean TRUE gets the X value; FALSE gets the Y value.

String values, as follows:


Return Value "X=number"
"Y=number"

Python Syntax GetComponentPinLocation <compID>, <pinname>, <XorY>


varx = oEditor.GetComponentPinLocation
Python Example (compid, "N1", TRUE)

VB Syntax GetComponentPinLocation <compID>, <pinname>, <XorY>


varx = oEditor.GetComponentPinLocation
VB Example
(compid,"N1", TRUE)

GetEditorName (Schematic Editor)


Get the name of the schematic editor.

UI Access N/A
Parameters None
Return Value String containing the name of the schematic editor. “SchematicEditor”

Schematic Scripting 24-119


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetEditorName()


Python Example oEditor.GetEditorName()

VB Syntax GetEditorName( [out, retval] string) // name of the editor


dim info
VB Example
info = oEditor.GetEditorName

GetNetConnections (Schematic Editor)


Use: Informational.
Command: None.
Syntax: GetNetConnections(<netName>)
Return Value: Array of strings containing the connections for the net identified by the
netName argument. Strings in the array are in one of four formats:
"IPort portID x y pinName"
"GPort portID x y pinName"
"PagePort portID x y pinName"
"Component componentName compID x y pinName"
where IPort, GPort, PagePort, and Component are key words
that indicate what the rest of the string specifies:
IPort indicates that portID specifies the name of the interface port,
GPort indicates that portID specifies the name of the global port,

Schematic Scripting 24-120


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

PagePort indicates that portID specifies the name of the page port,
Component indicates that compID specifies the component instance identifier,
x and y are the connection point,
pinName is the name of the connected pin,
componentName is the name of the component.
Parameters: <netName>
Type: String
The name of the net. Specifying "0" as the netName will return all objects connected
to ground including all ground ports.
VB Example: netArray = oEditor.GetNetConnections("net_1")

GetNumPages [Schematic Editor]


To determine how many pages there are in the schematic.

UI Access NA

Name Type Description


Parameters
None

Return Value Integer, the number of pages in the schematic.

Python Syntax GetNumPages()


Python Example num = oEditor. GetNumPages()

Schematic Scripting 24-121


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax GetNumPages
VB Example Set num = oEditor. GetNumPages

GetPortInfo (Schematic Editor)


Informational – get details about a port on a schematic component.

UI Access NA

Name Type Description


Parameters <portID> String The Schematic port’s ID, obtained from GetSelections or through FindEle-
ments.

Array of strings, as follows:


"Name=string" // Name of the port.
"X=val" // Connection point X location.
Return Value "Y=val" // Connection point Y location.
"Angle=val" // Component angle.
"Flip=true or false" // Whether the component is flipped or not.
"WireId=string" // The identifier of the schematic net, can be used in other informational methods.

Schematic Scripting 24-122


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax GetPortInfo(<portID>)


selectionArray = oEditor.GetSelections()
for i in selectionArray:
info = oEditor.GetPortInfo(i)
Python Example
for j in info:
AddInfoMessage(str("GetPortInfo: " + j))

VB Syntax GetPortInfo<portID>
selectionArray = oEditor.GetSelections
For Each i in selectionArray
info = oEditor.GetPortInfo(i)

VB Example for each j in info


MsgBox j, mbokonly, "GetPortInfo"
Next
Next

GetSelections (Schematic Editor)


Returns an array of currently selected objects.

UI Access N/A
Parameters None.

Schematic Scripting 24-123


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value Array containing object IDs

Python Syntax GetSelections()


Python Example oEditor.GetSelections()

VB Syntax GetSelections
VB Example oEditor.GetSelections

GetSignals (Schematic Editor)


Informational

UI Access NA

Name Type Description


Parameters <wirename> String The wire’s name, as seen in the UI, obtained in script through parsing return
data from GetWireInfo.

Array of strings which contains the signal names in the wirename argument. The wirename "Net1" would return
Return Value an array with a single string "Net1". The wirename "WW[0-3],A,B" would return an array with six strings "WW[0]",
"WW[1]", "WW[2]", "WW[3]", "A", :B".

Python Syntax GetSignals(<wirename>)


Python Example selectionArray = oEditor.GetSelections()

Schematic Scripting 24-124


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

for i in selectionArray:

netArray3 = oEditor.GetWireInfo(i)
for n in netArray3:

wname = n[0:9]

if (wname == "WireName:"):
nn = len(n)
wn = n[nn-10:]
AddInfoMessage("Wirename, parsed from ID :" + str(wn))
sigs = oEditor.GetSignals(wn)
for ll in sigs:
AddInfoMessage("Element in array
from GetSignals :" + str(ll))

VB Syntax GetSignals(<wirename>)
selectionArray = oEditor.GetSelections
For Each i in selectionArray
VB Example
netArray3 = oEditor.GetWireInfo(i)

Schematic Scripting 24-125


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

for each n in netArray3

wname = Left(n, 9)

If (wname = "WireName:") Then

nn = Len(n)

wn = Right(n, nn - 10)

MsgBox wn, 0, "Wirename, parsed from ID"

sigs = oEditor.GetSignals(wn)

for each ll in sigs


MsgBox ll, 0, "Element in array from GetSignals"

Next
End If
Next
Next

GetWireConnections (Schematic Editor)


Informational.

Schematic Scripting 24-126


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UI Access NA

Name Type Description


Parameters
None

Array of strings containing the connections for the wire identified by the wireID argument.
The strings in the array are in one of four formats:
"InterfacePort=portname portID x,y"
Return Value "GlobalPort=portname portID x,y"
"PagePort=portname portID x,y"
"ComponentPin=compId pinname x,y"
where x,y is the connection point.

Python Syntax GetWireConnections(<wireID>)


selectionArray = oEditor.GetSelections()
for i in selectionArray:
AddInfoMessage("Selected element" + i)
Python Example
netArray = oEditor.GetWireConnections(i)
for m in netArray:
AddInfoMessage("GetWireConnections" + str(m))

VB Syntax GetWireConnections(<wireID>)

Schematic Scripting 24-127


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

selectionArray = oEditor.GetSelections
For Each i in selectionArray
MsgBox i, 0, "Selected element"
netArray = oEditor.GetWireConnections(i)
VB Example
for each m in netArray
MsgBox m, mbokonly, "GetWireConnections"
Next
Next

GetWireInfo (Schematic Editor)


Informational.

UI Access NA

Name Type Description


Parameters <wire id> String The Schematic wire’s ID, obtained from GetSelections
or through FindElements.

Schematic Scripting 24-128


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array of strings containing the wire info in the wireID argument.


The strings in the array are:
"Page=number"
"WireName=string"
"SegmentCount=number"
"IPortCount=number"
Return Value "GPortCount=number"
"PagePortCount=number"
"PinCount=number"
"BBoxLLx=val"
"BBoxLLy=val"
"BBoxURx=val"
"BBoxURy=val"

Python Syntax GetWireInfo(<wireID>)


selectionArray = oEditor.GetSelections()
for i in selectionArray:

Python Example AddInfoMessage("Selected element" + str(i))


netArray2 = oEditor.GetWireInfo(i)
for n in netArray2:

Schematic Scripting 24-129


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AddInfoMessage("GetWireInfo" + str(n))

VB Syntax GetWireInfo(<wireID>)
selectionArray = oEditor.GetSelections
For Each i in selectionArray
MsgBox i, 0, "Selected element"
netArray3 = oEditor.GetWireInfo(i)
VB Example
for each n in netArray3
MsgBox n, 0, "GetWireInfo"
Next
Next

GetWireSegments (Schematic Editor)


Informational.

UI Access NA

Name Type Description


Parameters <wireID> String The Schematic wire’s ID, obtained from GetSelections
or through FindElements

Schematic Scripting 24-130


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array of strings containing the wire segments in the wireID argument. The strings in the array are:
"Segment=val,val val,val number" the "val" quantities are
Return Value
segment endpoints x1,y1 x2,y2
and the "number" is a schematic segment ID

Python Syntax GetWireSegments (<wireID>)


selectionArray = oEditor.GetSelections()
for i in selectionArray:
AddInfoMessage("Selected element" + str(i))
Python Example
netArray2 = oEditor.GetWireSegments(i)
for n in netArray2:
AddInfoMessage("GetWireSegments" + str(n))

VB Syntax GetWireSegments (<wireID>)


selectionArray = oEditor.GetSelections
For Each i in selectionArray

VB Example MsgBox i, 0, "Selected element"


netArray2 = oEditor.GetWireSegments(i)
for each n in netArray2

Schematic Scripting 24-131


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

MsgBox n, 0, "GetWireSegments"
Next
Next

Schematic Scripting 24-132


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

25 - Definition Manager Script Commands


The definition manager controls the use of materials and scripts in a project. It also provides access to the managers for symbols, foot-
prints, padstacks, and components in a project.
Set oProject = oDesktop.SetActiveProject("Project1")
Set oDefinitionManager = oProject.GetDefinitionManager()
The topics for this section include:
AddDefinitionFromBlock
AddMaterial
CloneMaterial
DoesMaterialExist
EditMaterial
ExportMaterial
RemoveMaterial
RemoveUnusedDefinitions

Definition Manager Script Commands 25-1


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Related Topics:

Component Manager Script Commands

Material Manager Script Commands

Model Manager Script Commands

Network Data Explorer Manager Script Commands

Script and Library Scripts

Symbol Manager Script Commands

AddMaterial (Maxwell)
Adds a local material.

UI Access Add Material in the material editor.

Name Type Description

<MaterialParams> Array [
"NAME: <name of the material to be added>",
Parameters <MatProperty>, <MatProperty>, ...
]

<MatProperty> Array Options will depend on what is specified. Some options include "AnisoProp-
erty", "CustomProperty", and "nonlinear."

Definition Manager Script Commands 25-2


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

For simple material:


"<PropertyName>:=", <value>
For anisotropic material:
[
"NAME:<PropertyName>",
"property_type:=", "AnisoProperty",
"unit:=", <Unit>",
"component1:=", <value>,
"component2:=", <value>,
"component3:=", <value>))
]
Material properties for other property types are listed further in the topic.
<PropertyName> String Should be one of the following (depending on the material, design, and solution
types):
"permittivity", "permeability", "conductivity", "dielectric_loss_tangent",magnetic_
loss_tangent", "magnetic_coercivity", "core_loss_type", "mass_density", "stack-
ing_type", "magnetostriction", "inverse_magnetostriction", "youngs_modulus",
"poissons_ratio"

<Unit> String Possible values for magnetic properties: delta_H: "Oe" saturation_mag:
"Gauss", "uGauss", "Tesla", "uTesla"

Return Value None

Definition Manager Script Commands 25-3


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python AddMaterial (["NAME:<MaterialName>", <MatProperty>, <MatProperty>, ...])


Syntax

# Example: Magnetostrictive stress and deformation with full magnetostriction matrix


[3x3]
oDefinitionManager.AddMaterial(
[
"NAME:Material2",
"CoordinateSystemType:=", "Cartesian",
"BulkOrSurfaceType:=" , 1,
[
"NAME:PhysicsTypes",
"set:=" , ["Electromagnetic"]
],
[
"NAME:magnetostriction",
"property_type:=" , "CustomProperty",
Python
"PropertyModelType:=" , 4, # integer value of 1 (Linear), 2 (Nonlinear), 3 (Aniso-
Examp-
le
tropic), or 4 (Matrix option)
"Dir1ModelType:=" , 0,
"Dir2ModelType:=" , 0,
"IsoCoeff:=" , "0",
"IsoHMax:=" , "0A_per_meter",
"IsoHMin:=" , "0A_per_meter",
"Dir1Coeff:=" , "0",
"Dir1HMax:=" , "0A_per_meter",
"Dir1HMin:=" , "0A_per_meter",
"Dir1VecX:=" , "1",
"Dir1VecY:=" , "0",
"Dir1VecZ:=" , "0",

Definition Manager Script Commands 25-4


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Dir2Coeff:=" , "0",
"Dir2HMax:=" , "0A_per_meter",
"Dir2HMin:=" , "0A_per_meter",
"CoeffMatrixSize:=" , 3, # <int> [0, 3]. If “PropertyModelType” is “4”, size cannot be
0 (should not be empty)).
#CoeffMatrixSize = 3” means 3x3 matrix size, and matrix elements (C11, C12, .. C33) are
specified in CoeffMatrix block.
"IsCoeffMatrixSymmetric:=", True,
[
"NAME:CoeffMatrix", # if size is 3, has matrix elements C11, C12, … C33 , no ele-
ment if size is 0
"C11:=" , "5",
"C12:=" , "0",
"C13:=" , "0",
"C21:=" , "0",
"C22:=" , "4",
"C23:=" , "0",
"C31:=" , "0",
"C32:=" , "0",
"C33:=" , "3"
],
"CoeffMatrixHMax:=" , "10A_per_meter", #Value of Hmax
[
"NAME:Magnetostriction",
[
"NAME:Isotropic",
[
"NAME:OneVariation",
"DatasetMapsName:=" , "Lambda-H curves versus Stress"

]
],
[
"NAME:Direction1",

Definition Manager Script Commands 25-5


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AddMaterial Array("NAME:<MaterialName>",
VB Syntax
<MatProperty>, <MatProperty>, ...)

oDefinitionManager.AddMaterial Array(
"permittivity:=", "2.2", "0.002")

oDefinitionManager.AddMaterial Array("NAME:Material2",_
"dielectric_loss_tangent:=", "44", Array("NAME:saturation_mag",_
VB Example
"property_type:=", "AnisoProperty",_
"unit:=", "Gauss",_
"component1:=", "11", _
"component2:=", "22", _
"component3:=", "33"), _
"delta_H:=", "44Oe")

Additional Properties for Nonlinear Property Type


<MatProperty> (nonlinear material)
Array("NAME:permeability",

Definition Manager Script Commands 25-6


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"property_type:=", "nonlinear",
"BTypeForSingleCurve:=", <string>,
"Hunit:=", <string>", "Bunit:=", <string>,
"IsTemperatureDependent:=", <bool>,
Array("NAME:BHCoordinates",
Array("NAME:Coordinate", "X:=", <value>, "Y:=", <value>, ...
BTypeForSingleCurve
Type: <string>
Should be one of the following: "Intrinsic", or "Normal" ( defaults to Normal if nothing is specified). An error message
displays in the Message Window if the string does not match either "Normal" or "Intrinsic"; advising the user of this
and informing the user that this property has been set to "Normal".
Hunit
Type: <string>
Possible values: "Oe", "A_per_meter", "kA_per_meter"
Bunit
Type: <string>
Possible values: "tesla", "kTesla", "uGauss"
IsTemperatureDependent
Type: <bool>
possible values: True or False

Additional Properties for Vector Property Type


<MatProperty> (vector material)

Definition Manager Script Commands 25-7


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:<PropertyName>",
"property_type:=", "VectorProperty", "Magnitude:=", <value>", "DirComp1:=", <value>, "DirCom-
p2:=", <value>, "DirComp3:=", <value>))
<MatProperty> (choice material)
Array("NAME:<PropertyName>",
"property_type:=", "ChoiceProperty", "Choice:=", <string>")

Additional Examples
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")
Example: oDefinitionManager.AddMaterial Array("NAME:Material5",_
"CoordinateSystemType:=", _"Cartesian",_
Array("NAME:AttachedData"),_
Array("NAME:magnetic_coercivity", "property_type:=", _
"VectorProperty", "Magnitude:=", "-1A_per_meter",_
"DirComp1:=", "1", "DirComp2:=", _"2", "DirComp3:=",_

Definition Manager Script Commands 25-8


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"3"))
Example: oDefinitionManager.AddMaterial Array("NAME:Material4",_
"CoordinateSystemType:=", _"Cartesian",_
Array("NAME:AttachedData"),_
Array("NAME:stacking_type", "property_type:=", _
"ChoiceProperty", "Choice:=", "Lamination"),_
"stacking_factor:=", "0",_
Array("NAME:stacking_direction", "property_type:=",_
"ChoiceProperty", "Choice:=", ""))

Note: Litz Wire properties are valid only for 2D/3D Transient and 2D/3D Eddy Current designs.

Example (Square Litz Wire): oDefinitionManager.AddMaterial Array("NAME:LitzMaterialSquare",


...
Array("NAME:stacking_type", "property_type:=", "ChoiceProperty", "Choice:=", "Litz Wire"),
...
Array("NAME:wire_type", "property_type:=",
"ChoiceProperty", "Choice:=", "Square"), "strand_number:=", "16", "twisting_length_factor:="
,"1.1", "wire_width:=", "2mm")
Example (Round Litz Wire): oDefinitionManager.AddMaterial Array("NAME:LitzMaterialRound",_
...
Array("NAME:stacking_type", "property_type:=", "ChoiceProperty", "Choice:=", "Litz Wire"),
...

Definition Manager Script Commands 25-9


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:wire_type", "property_type:=",
"ChoiceProperty", "Choice:=", "Round"), "strand_number:=", "16", "twisting_length_factor:="
,"1.1", "wire_diameter:=" "2mm")
Example (Rectangular Litz Wire): oDefinitionManager.AddMaterial Array("NAME:LitzMa-
terialRectangular",_
...
Array("NAME:stacking_type", "property_type:=", "ChoiceProperty", "Choice:=", "Litz Wire"),
...
Array("NAME:wire_type", "property_type:=", _
"ChoiceProperty", "Choice:=", "Rectangular"), "strand_number:=", "5", "twisting_length_
factor:=" ,"1.1",
"wire_width:=", "5.5mm", "wire_thickness:=", "5.6",
Array("NAME:wire_thickness_direction", "property_type:=",
"ChoiceProperty", "Choice:=", "V(1)")
Array("NAME:wire_width_direction", "property_type:=",
"ChoiceProperty", "Choice:=", "V(2)")
)

Note: Young's Modulus and Poisson's Ratio properties are valid only for 2D and 3D Magnetostatic and Transient.

Python Example (Young's Modulus and Poisson's Ratio):


oDefinitionManager.AddMaterial("copper",
[

Definition Manager Script Commands 25-10


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide


[
"NAME:youngs_modulus",
"property_type:=" , "AnisoProperty",
"unit:=" , "",
"component1:=" , "1",
"component2:=" , "1.5",
"component3:=" , "3"
],
[
"NAME:poissons_ratio",
"property_type:=" , "AnisoProperty",
"unit:=" , "",
"component1:=" , "4",
"component2:=" , "5",
"component3:=" , "6"
],

])

VB Example (Young's Modulus and Poisson's Ratio):

Definition Manager Script Commands 25-11


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oDefinitionManager.AddMaterial "copper” ,
Array("NAME:copper",

Array("NAME:youngs_modulus",
"property_type:=", "AnisoProperty",
"unit:=", "",
"component1:=", "1",
"component2:=", "2",
"component3:=", "3"),
Array("NAME:poissons_ratio",
"property_type:=", "AnisoProperty",
"unit:=", "",
"component1:=", "4",
"component2:=", "5",
"component3:=", "6"),
…)

CloneMaterial
Clones a local material.

UI Access N/A

Name Type Description


Parameters <matName> String Name of existing material.
<newName> String Name for newly cloned material.

Return Value Boolean:

Definition Manager Script Commands 25-12


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

l 1 - Material is cloned.
l 0 - Existing material not found or a conflict with the new material name.

Python Syntax CloneMaterial (<matName>, <newName>)


Python Example oDefinitionManager.CloneMaterial("copper1", "copper3")

VB Syntax CloneMaterial <matName>, <newName>


VB Example oDefinitionManager.CloneMaterial "copper1", "copper3"

ComputeCoreLossCoefficients
Creates a current source.

UI Access N/A

Name Type Description


< string One of: Electrical Steel or Power Ferrite
CoreLossModelType
Parameters
>
<MassDensity> double Mass density of the core loss model type
<AttachedData> Array Either <CoreLossData> or <CoreLossMultiCurveData>

Array of 3 double values in SI unit:

Return Value l For Electrical Steel, returns the values for [Kh, Kc, Ke]

l For Power Ferrite, returns the values for [Cm, X, Y]

Definition Manager Script Commands 25-13


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

ComputeCoreLossCoefficients (<CoreLossModelType>, <MassDensity>,


Python Syntax
<AttachedData>)
DefinitionManager.ComputeCoreLossCoefficients("Electrical Steel", 7000,
[
"NAME:CoefficientSetupData",
"property_data:=" , "coreloss_data",
"coefficient_setup:=" , "w_per_cubic_mete",
"Frequency:=" , "60Hz",
"Thickness:=" , "0.5mm",
"Conductivity:=" , "0",
Python Example ["NAME:Coordinates",
["NAME:DimUnits", "",
""
],
[NAME:Points",0,0,3,6,4,18
]
]
])

Single Curve:
oDefinitionManager.ComputeCoreLossCoefficients "Electrical Steel", 7670.5, Array("NAME:Coef-
VB Example ficientSetupData", "property_data:=", _
"coreloss_data", "coefficient_setup:=", "w_per_cubic_meter", "Frequency:=", _
"60Hz", "Thickness:=", "0mm", "Conductivity:=", "0", Array("NAME:Coordinates", Array("NAME:DimUnits", _

Definition Manager Script Commands 25-14


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"", ""), Array("NAME:Points", 0, 0, 3, 6, 4, 12)))

Multi Curves:
oDefinitionManager.ComputeCoreLossCoefficients "Electrical Steel", 7670.5, Array
("NAME:CoreLossMultiCurveData", "property_data:=", _
"coreloss_multi_curve_data", "coreloss_unit:=", "w_per_cubic_meter", Array("NAME:AllCurves", Array
VB Example ("NAME:OneCurve", "Frequency:=", _
"50Hz", Array("NAME:Coordinates", Array("NAME:DimUnits", "", ""), Array("NAME:Points", 0, 0, _
3, 6, 4, 12))), Array("NAME:OneCurve", "Frequency:=", "75Hz", Array("NAME:Coordinates", Array
("NAME:DimUnits", _
"", ""), Array("NAME:Points", 0, 0, 3, 9, 4, 16)))))

DoesMaterialExist
Checks for the presence of a material in the library by name

UI Access None.

Name Type Description


Parameters
<MaterialName> <String> Name of the material to search for in the material database

Boolean:
Return Value l True – specified material exists.
l False – specified material does not exist.

Definition Manager Script Commands 25-15


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax DoesMaterialExist(<MaterialName>)


Python Example oDefinitionManager.DoesMaterialExist("modified_epoxy")

VB Syntax DoesMaterialExist <MaterialName>


VB Example oDefinitionManager.DoesMaterialExist "modified_epoxy"

EditMaterial (Maxwell)
Use: Modifies an existing material.

UI Access View/Edit Materials command in the material editor

Name Type Description


<OriginalName> String Name of the material before editing.
Parameters <NewName> String New name for the material
<MatProperties> Array Structured array containing material properties.Refer to AddMaterial (Maxwell)
for detailed information on material properties.

Return Value None

Pytho- EditMaterial (<OriginalName>, <NewName>,<MatProperties>)


n Syn-
tax

Pytho- Example: Nonlinear Conductivity


n
Exam-

Definition Manager Script Commands 25-16


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oDefinitionManager.EditMaterial("nonlinear_copper",
[

[
"NAME:conductivity",
"property_type:=" , "nonlinear",
[
"NAME:JECoordinates",
[
"NAME:DimUnits",
"V_per_meter",
"A_per_m2"
],
[
"NAME:Point",
0,
ple
0
],
[
"NAME:Point",
1,
2
],
[
"NAME:Point",
3,
4
]
]
]
])

Example using a Thermal Modifier for Electrical Steel Core Loss properties

Definition Manager Script Commands 25-17


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

#applicable to Electrical Steel and Power Ferrite core loss models in 3D Eddy Current and
3D Transient designs)
oDefinitionManager.EditMaterial("copper",
[
"NAME:copper",
"CoordinateSystemType:=", "Cartesian",
"BulkOrSurfaceType:=" , 1,
[
"NAME:PhysicsTypes",
"set:=" , ["Electromagnetic","Thermal","Structural"]
],
[
"NAME:AttachedData",
[
"NAME:MatAppearanceData",
"property_data:=" , "appearance_data"
]
],
[
"NAME:ModifierData",
[
"NAME:ThermalModifierData",
"modifier_data:=" , "thermal_modifier_data",
[
"NAME:all_thermal_modifiers",
[
"NAME:one_thermal_modifier",
"Property::=" , "core_loss_kh",
"Index::=" , 0,
"prop_modifier:=" , "thermal_modifier",

Definition Manager Script Commands 25-18


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"use_free_form:=" , True,
"free_form_value:=" , "if(Temp > 1000cel, 1, if(Temp -
273.15cel, 1, 1))"
],
[
"NAME:one_thermal_modifier",
"Property::=" , "core_loss_kc",
"Index::=" , 0,
"prop_modifier:=" , "thermal_modifier",
"use_free_form:=" , True,
"free_form_value:=" , "if(Temp > 1000cel, 1, if(Temp -
273.15cel, 1, 1))"
],
[
"NAME:one_thermal_modifier",
"Property::=" , "core_loss_ke",
"Index::=" , 0,
"prop_modifier:=" , "thermal_modifier",
"use_free_form:=" , True,
"free_form_value:=" , "if(Temp > 1000cel, 1, if(Temp -
273.15cel, 1, 1))"
],
[
"NAME:one_thermal_modifier",
"Property::=" , "core_loss_kdc",
"Index::=" , 0,
"prop_modifier:=" , "thermal_modifier",
"use_free_form:=" , True,
"free_form_value:=" , "if(Temp > 1000cel, 1, if(Temp -
273.15cel, 1, 1))"
],
[
"NAME:one_thermal_modifier",
"Property::=" , "core_loss_equiv_cut_depth",

Definition Manager Script Commands 25-19


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

]
]
])

VB Syntax EditMaterial <OriginalName>, <NewName>,<MatProperties>

Example: Set oProject = oDesktop.SetActiveProject("example_magnetostatic")


Set oDefinitionManager = oProject.GetDefinitionManager()
oDefinitionManager.EditMaterial "arm_steel", Array("NAME:arm_steel", "Coordin-
ateSystemType:=",
"Cartesian", Array("NAME:AttachedData"), Array("NAME:ModifierData"), Array
("NAME:permeability", "property_type:=",
"nonlinear", "BTypeForSingleCurve:=", "normal", "HUnit:=", "A_per_meter", "BUn-
it:=", "tesla", "IsTemperatureDependent:=", "True", Array("NAME:BHCoordinates",
Array("NAME:Coordinate", "X:=",
VB Example
0, "Y:=", 0), Array("NAME:Coordinate", "X:=", 4000, "Y:=", 1.413), Array
("NAME:Coordinate", "X:=",
8010, "Y:=", 1.594), Array("NAME:Coordinate", "X:=", 16010, "Y:=", 1.751), Array
("NAME:Coordinate", "X:=",
24020, "Y:=", 1.839), Array("NAME:Coordinate", "X:=", 32030, "Y:=", 1.896), Array
("NAME:Coordinate", "X:=",
40030, "Y:=", 1.936), Array("NAME:Coordinate", "X:=", 48040, "Y:=", 1.967), Array
("NAME:Coordinate", "X:=",
64050, "Y:=", 2.008), Array("NAME:Coordinate", "X:=", 80070, "Y:=", 2.042), Array

Definition Manager Script Commands 25-20


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

("NAME:Coordinate", "X:=",
96080, "Y:=", 2.073), Array("NAME:Coordinate", "X:=", 112100, "Y:=", 2.101),
Array("NAME:Coordinate", "X:=",
128110, "Y:=", 2.127), Array("NAME:Coordinate", "X:=", 144120, "Y:=", 2.151),
Array("NAME:Coordinate", "X:=",
176150, "Y:=", 2.197), Array("NAME:Coordinate", "X:=", 208180, "Y:=", 2.24),
Array("NAME:Coordinate", "X:=",
272230, "Y:=", 2.325), Array("NAME:Coordinate", "X:=", 304260, "Y:=", 2.37),
Array("NAME:Coordinate", "X:=",
336290, "Y:=", 2.42), Array("NAME:Coordinate", "X:=", 396000, "Y:=", 2.5))), "con-
ductivity:=",
"2000000", Array("NAME:magnetic_coercivity", "property_type:=", "VectorProperty",
"Magnitude:=",
"0A_per_meter", "DirComp1:=", "1", "DirComp2:=", "0", "DirComp3:=", "0"), Array
("NAME:core_loss_type", "property_type:=",
"ChoiceProperty", "Choice:=", "Hysteresis Model"), "core_loss_hci:=", "100000",
"core_loss_br:=",
"88", "core_loss_hkc:=", "333", "core_loss_equiv_cut_depth:=", "0.002meter")

VB Example (Young's Modulus and Poisson's Ratio):


oDefinitionManager.EditMaterial "copper” ,
Array("NAME:copper",

Array("NAME:youngs_modulus",
"property_type:=", "AnisoProperty",
"unit:=", "",

Definition Manager Script Commands 25-21


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"component1:=", "1",
"component2:=", "2",
"component3:=", "3"),
Array("NAME:poissons_ratio",
"property_type:=", "AnisoProperty",
"unit:=", "",
"component1:=", "4",
"component2:=", "5",
"component3:=", "6"),
…)

Additional Python Examples

Note: Young's Modulus and Poisson's Ratio properties are valid only for 2D & 3D Magnetostatic and Transient.

Python Example (Young's Modulus and Poisson's Ratio):


oDefinitionManager.EditMaterial("copper",
[

[
"NAME:youngs_modulus",
"property_type:=" , "AnisoProperty",
"unit:=" , "",
"component1:=" , "1",

Definition Manager Script Commands 25-22


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"component2:=" , "1.5",
"component3:=" , "3"
],
[
"NAME:poissons_ratio",
"property_type:=" , "AnisoProperty",
"unit:=" , "",
"component1:=" , "4",
"component2:=" , "5",
"component3:=" , "6"
],

])

Example: Magnetostrictive stress and deformation with full magnetostriction matrix [3x3]
oDefinitionManager = oProject.GetDefinitionManager()
oDefinitionManager.EditMaterial("vacuum",
[
"NAME:vacuum",
"CoordinateSystemType:=", "Cartesian",
"BulkOrSurfaceType:=" , 1,
[
"NAME:PhysicsTypes",
"set:=" , ["Electromagnetic"]
],
[

Definition Manager Script Commands 25-23


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NAME:AttachedData",
[
"NAME:MatAppearanceData",
"property_data:=" , "appearance_data",
"Red:=" , 230,
"Green:=" , 230,
"Blue:=" , 230,
"Transparency:=" , 0.949999988079071
]
],
"permittivity:=" , "1",
[
"NAME:magnetostriction",
"property_type:=" , "CustomProperty",
"PropertyModelType:=" , 4, # Value of 1 (Linear), 2 (Nonlinear), 3 (Anisotropic), or 4
(Matrix option)
"Dir1ModelType:=" , 0,
"Dir2ModelType:=" , 0,
"IsoCoeff:=" , "0",
"IsoHMax:=" , "0A_per_meter",
"IsoHMin:=" , "0A_per_meter",
"Dir1Coeff:=" , "0",
"Dir1HMax:=" , "0A_per_meter",
"Dir1HMin:=" , "0A_per_meter",
"Dir1VecX:=" , "1",
"Dir1VecY:=" , "0",
"Dir1VecZ:=" , "0",
"Dir2Coeff:=" , "0",
"Dir2HMax:=" , "0A_per_meter",
"Dir2HMin:=" , "0A_per_meter",
"CoeffMatrixSize:=" , 3, # <int> - [0, 3]. If PropertyModelType is 4, (Matrix type),
size cannot be 0

Definition Manager Script Commands 25-24


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

# CoeffMatrixSize = 3 defines a 3x3 matrix size, and matrix elements (C11, C12, ..
C33) are specified in CoeffMatrix block
"IsCoeffMatrixSymmetric:=", False, # takes a Boolean value
[
"NAME:CoeffMatrix",
"C11:=" , "1.05",
"C12:=" , "2",
"C13:=" , "3",
"C21:=" , "4",
"C22:=" , "5",
"C23:=" , "6",
"C31:=" , "7",
"C32:=" , "8",
"C33:=" , "9"
],
"CoeffMatrixHMax:=" , "12A_per_meter", #Value of Hmax
[
"NAME:Magnetostriction",
[
"NAME:Isotropic",
[
"NAME:OneVariation",
"DatasetMapsName:=" , "Lambda-H curves versus Stress"
]
],
[
"NAME:Direction1",
[
"NAME:OneVariation",
"DatasetMapsName:=" , "Lambda-H curves versus Stress"
]
],
[
"NAME:Direction2",

Definition Manager Script Commands 25-25


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

[
"NAME:OneVariation",
"DatasetMapsName:=" , "Lambda-H curves versus Stress"
]
],
"SelectedDatasetMapsName:=", "Lambda-H curves versus Stress"
]
]
])

Note: Core Loss Y Parameter for Electrical Steel is valid only for 2D & 3D Eddy Current and Transient Designs.

Python Example: Core Loss Y Parameter for Electrical Steel (Simple Property)
oDefinitionManager = oProject.GetDefinitionManager()
oDefinitionManager.EditMaterial("steel_1008",
[
"NAME:steel_1008",
"CoordinateSystemType:=", "Cartesian",
"BulkOrSurfaceType:=" , 1,
[
"NAME:PhysicsTypes",
"set:=" , ["Electromagnetic","Thermal","Structural"]
],

Definition Manager Script Commands 25-26


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

...
...
[
"NAME:core_loss_type",
"property_type:=" , "ChoiceProperty",
"Choice:=" , "Electrical Steel"
],
"core_loss_kh:=" , "105.359604403558",
"core_loss_kc:=" , "0",
"core_loss_ke:=" , "2.08295141230884",
"core_loss_kdc:=" , "0",
"mass_density:=" , "7872",
[
"NAME:stacking_type",
"property_type:=" , "ChoiceProperty",
"Choice:=" , "Litz Wire"
],
"specific_heat:=" , "481",
"youngs_modulus:=" , "200000000000",
"poissons_ratio:=" , "0.25",
"thermal_expansion_coefficient:=", "1.26e-05",

Definition Manager Script Commands 25-27


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"core_loss_equiv_cut_depth:=", "0.001meter",
[
"NAME:wire_type",
"property_type:=" , "ChoiceProperty",
"Choice:=" , "Round"
],
"strand_number:=" , "12",
"wire_diameter:=" , "3mm",
"core_loss_es_y:=" , "2.3"
])

Note: Core Loss Y Parameter for Electrical Steel is valid only for 2D & 3D Eddy Current and Transient Designs.

Python Example: Core Loss Y Parameter for Electrical Steel (Anisotropic Property)
oDefinitionManager = oProject.GetDefinitionManager()
oDefinitionManager.EditMaterial("steel_1008",
[
"NAME:steel_1008",
"CoordinateSystemType:=", "Cartesian",
"BulkOrSurfaceType:=" , 1,
[

Definition Manager Script Commands 25-28


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NAME:PhysicsTypes",
"set:=" , ["Electromagnetic","Thermal","Structural"]
],
...
...
[
"NAME:core_loss_type",
"property_type:=" , "ChoiceProperty",
"Choice:=" , "Electrical Steel"
],
"core_loss_kh:=" , "105.359604403558",
"core_loss_kc:=" , "0",
"core_loss_ke:=" , "2.08295141230884",
"core_loss_kdc:=" , "0",
"mass_density:=" , "7872",
[
"NAME:stacking_type",
"property_type:=" , "ChoiceProperty",
"Choice:=" , "Litz Wire"
],
"specific_heat:=" , "481",
"youngs_modulus:=" , "200000000000",
"poissons_ratio:=" , "0.25",
"thermal_expansion_coefficient:=", "1.26e-05",
"core_loss_equiv_cut_depth:=", "0.001meter",
[

Definition Manager Script Commands 25-29


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NAME:wire_type",
"property_type:=" , "ChoiceProperty",
"Choice:=" , "Round"
],
"strand_number:=" , "12",
"wire_diameter:=" , "3mm",
[
"NAME:core_loss_es_y",
"property_type:=" , "AnisoProperty",
"unit:=" , "",
"component1:=" , "1",
"component2:=" , "2",
"component3:=" , "3" ]
])

Additional VB Examples
Example:Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("pmsg-1_test")
Set oDefinitionManager = oProject.GetDefinitionManager()
oDefinitionManager.EditMaterial "M19-24G_3DSF0.950", Array("NAME:M19-24G_3DSF0.950", "Coordin-
ateSystemType:=",
"Cartesian", "BulkOrSurfaceType:=", 1, Array("NAME:PhysicsTypes", "set:=", Array(

Definition Manager Script Commands 25-30


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Electromagnetic")), Array("NAME:permeability", "property_type:=", "nonlinear", "BType:=",


"normal", "HUnit:=", "A_per_meter", "BUnit:=", "tesla", Array("NAME:BHCoordinates", Array
("NAME:Coordinate", "X:=",
0, "Y:=", 0), Array("NAME:Coordinate", "X:=", 22.28, "Y:=", 0.05), Array("NAME:Coordinate",
"X:=",
25.46, "Y:=", 0.1), Array("NAME:Coordinate", "X:=", 31.83, "Y:=", 0.15), Array("NAME:Coordin-
ate", "X:=",
47.74, "Y:=", 0.36), Array("NAME:Coordinate", "X:=", 63.66, "Y:=", 0.54), Array("NAME:Coordin-
ate", "X:=",
79.57, "Y:=", 0.65), Array("NAME:Coordinate", "X:=", 159.15, "Y:=", 0.99), Array("NAME:Coordin-
ate", "X:=",
318.3, "Y:=", 1.2), Array("NAME:Coordinate", "X:=", 477.46, "Y:=", 1.28), Array("NAME:Coordin-
ate", "X:=",
636.61, "Y:=", 1.33), Array("NAME:Coordinate", "X:=", 795.77, "Y:=", 1.36), Array("NAME:Coordin-
ate", "X:=",
1591.5, "Y:=", 1.44), Array("NAME:Coordinate", "X:=", 3183, "Y:=", 1.52), Array("NAME:Coordin-
ate", "X:=",
4774.6, "Y:=", 1.58), Array("NAME:Coordinate", "X:=", 6366.1, "Y:=", 1.63), Array("NAME:Coordin-
ate", "X:=",
7957.7, "Y:=", 1.67), Array("NAME:Coordinate", "X:=", 15915, "Y:=", 1.8), Array("NAME:Coordin-
ate", "X:=",
31830, "Y:=", 1.9), Array("NAME:Coordinate", "X:=", 111407, "Y:=", 2), Array("NAME:Coordinate",
"X:=",
190984, "Y:=", 2.1), Array("NAME:Coordinate", "X:=", 350138, "Y:=", 2.3), Array("NAME:Coordin-
ate", "X:=",
509292, "Y:=", 2.5), Array("NAME:Coordinate", "X:=", 2100830, "Y:=", 4.5))), "conductivity:=",

Definition Manager Script Commands 25-31


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"0", Array("NAME:core_loss_type", "property_type:=", "ChoiceProperty", "Choice:=",


"Electrical Steel"), "core_loss_kh:=", "0", "core_loss_kc:=", "4.32556", "core_loss_ke:=",
"0", "mass_density:=", "7650", Array("NAME:stacking_type", "property_type:=",
"ChoiceProperty", "Choice:=", "Lamination"), "stacking_factor:=", "0.95", Array("NAME:stacking_
direction", "property_type:=",
"ChoiceProperty", "Choice:=", "V(3)"), "core_loss_equiv_cut_depth:=",
"0.002meter")

Example:Litz Wire

Note: Litz Wire properties are valid only for 2D/3D Transient and 2D/3D Eddy Current designs.

oDefinitionManager.EditMaterial Array("NAME:LitzMaterialRound",
...
Array("NAME:wire_type", "property_type:=",
"ChoiceProperty", "Choice:=", "Round"), "strand_number:=", "16", "twisting_length_factor:="
,"1.1", "wire_diameter:=", "2mm")

Example: Thermal Modifier

Note: Example using a Thermal Modifier for Electrical Steel Core Loss properties (applicable to both Electrical Steel and
Power Ferrite core loss models in 3D Eddy Current and 3D Transient designs)

Set oProject = oDesktop.SetActiveProject("3D_eddy_temperature_dependent_coreloss")


Set oDefinitionManager = oProject.GetDefinitionManager()

Definition Manager Script Commands 25-32


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oDefinitionManager.EditMaterial "copper", Array("NAME:copper", "CoordinateSystemType:=",


"Cartesian", "BulkOrSurfaceType:=", 1, Array("NAME:PhysicsTypes", "set:=", Array(
"Electromagnetic", "Thermal", "Structural")), Array("NAME:AttachedData", Array("NAME:MatAp-
pearanceData", "property_data:=",
"appearance_data")),
Array("NAME:ModifierData", Array("NAME:ThermalModifierData", "modifier_data:=",
"thermal_modifier_data", Array("NAME:all_thermal_modifiers", Array("NAME:one_thermal_mod-
ifier", "Property::=",
"core_loss_kh", "Index::=", 0, "prop_modifier:=", "thermal_modifier", "use_free_form:=",
true, "free_form_value:=", "if(Temp > 1000cel, 1, if(Temp < -273.15cel, 1, 1))"), Array
("NAME:one_thermal_modifier", "Property::=",
"core_loss_kc", "Index::=", 0, "prop_modifier:=", "thermal_modifier", "use_free_form:=",
true, "free_form_value:=", "if(Temp > 1000cel, 1, if(Temp < -273.15cel, 1, 1))"), Array
("NAME:one_thermal_modifier", "Property::=",
"core_loss_ke", "Index::=", 0, "prop_modifier:=", "thermal_modifier", "use_free_form:=",
true, "free_form_value:=", "if(Temp > 1000cel, 1, if(Temp < -273.15cel, 1, 1))"), Array
("NAME:one_thermal_modifier", "Property::=",
"core_loss_kdc", "Index::=", 0, "prop_modifier:=", "thermal_modifier", "use_free_form:=",
true, "free_form_value:=", "if(Temp > 1000cel, 1, if(Temp < -273.15cel, 1, 1))"), Array
("NAME:one_thermal_modifier", "Property::=",
"core_loss_equiv_cut_depth", "Index::=", 0, "prop_modifier:=",
"thermal_modifier", "use_free_form:=", true, "free_form_value:=",
"if(Temp > 1000cel, 1, if(Temp < -273.15cel, 1, 1))")))), "permeability:=",

Definition Manager Script Commands 25-33


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"0.999991", "conductivity:=", "27840000", "thermal_conductivity:=", "400", Array("NAME:core_


loss_type", "property_type:=",
"ChoiceProperty", "Choice:=", "Electrical Steel"), "core_loss_kh:=", "0", "core_loss_kc:=",
"0", "core_loss_ke:=", "0", "core_loss_kdc:=", "0", "mass_density:=", "8933", "specific_
heat:=",
"385", "youngs_modulus:=", "120000000000", "poissons_ratio:=", "0.38", "thermal_expansion_coef-
ficient:=",
"1.77e-05", "core_loss_equiv_cut_depth:=", "0.001meter")

Example: B-P Curve Core Loss Model

Note: B-P Curve properties for Core Loss model are valid only for 2D/3D Transient and 2D/3D Eddy Current designs.

Set oProject = oDesktop.SetActiveProject("ThermalCoreLoss_2D_Eddy")


Set oDefinitionManager = oProject.GetDefinitionManager()
oDefinitionManager.EditMaterial "steel_1008_CL",
Array("NAME:steel_1008_CL", "CoordinateSystemType:=",
"Cartesian", "BulkOrSurfaceType:=", 1, Array("NAME:PhysicsTypes", "set:=", Array( "Elec-
tromagnetic", "Thermal", "Structural")), Array("NAME:AttachedData", Array("NAME:MatAp-
pearanceData", "property_data:=", "appearance_data", "Red:=", 161, "Green:=", 161, "Blue:=",
161)),
Array("NAME:ModifierData", Array("NAME:ThermalModifierData", "modifier_data:=", "thermal_mod-
ifier_data",
Array("NAME:all_thermal_modifiers"))), Array("NAME:permeability", "property_type:=", "non-
linear", "BTypeForSingleCurve:=", "normal", "HUnit:=", "A_per_meter", "BUnit:=", "tesla",
"IsTemperatureDependent:=", false,
Array("NAME:BHCoordinates",
Array("NAME:DimUnits", "", ""),
Array("NAME:Point", 0, 0),

Definition Manager Script Commands 25-34


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:Point", 159.2, 0.2402),


Array("NAME:Point", 318.3, 0.8654),
Array("NAME:Point", 477.5, 1.1106),
Array("NAME:Point", 636.6, 1.2458),
Array("NAME:Point", 795.8, 1.331),
Array("NAME:Point", 1591.5, 1.5),
Array("NAME:Temperatures")), "conductivity:=", "2000000", "magnetic_loss_tangent:=", "0",
Array("NAME:magnetic_coercivity",
"property_type:=", "VectorProperty",
"Magnitude:=", "0A_per_meter",
"DirComp1:=", "1", "DirComp2:=", "0", "DirComp3:=", "0"),
"thermal_conductivity:=", "45",

Array("NAME:core_loss_type",
"property_type:=", "ChoiceProperty",
"Choice:=", "B-P Curve"),
"core_loss_kdc:=", "0",
"mass_density:=", "7872",
"specific_heat:=", "481",
"youngs_modulus:=", "200000000000",
"poissons_ratio:=", "0.25",
"thermal_expansion_coefficient:=", "1.26e-05",
"core_loss_equiv_cut_depth:=", "0.001meter",
Array("NAME:core_loss_curves",
"property_type:=", "nonlinear",
"PUnit:=", "kw/m^3",
"BUnit:=", "tesla",
"Frequency:=", "60Hz",
"Thickness:=", "0.5mm",
"IsTemperatureDependent:=", true,
Array("NAME:BPCoordinates",
Array("NAME:DimUnits", "", "")),
Array("NAME:Temperatures",
Array("NAME:Temperature", "TempRef:=", "10cel",
Array("NAME:BPCoordinates",

Definition Manager Script Commands 25-35


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:DimUnits", "", ""),


Array("NAME:Point", 0, 0),
Array("NAME:Point", 1, 2),
Array("NAME:Point", 3, 4))),
Array("NAME:Temperature", "TempRef:=", "20cel",
Array("NAME:BPCoordinates",
Array("NAME:DimUnits", "", ""),
Array("NAME:Point", 0, 0),
Array("NAME:Point", 11, 21),
Array("NAME:Point", 31, 41))))))

GetProjextMaterialNames
Returns the material names belonging to an active Project.

UI Access N/A

Name Type Description


Parameters
None

Return Value String names of the materials in the active project.

Python Syntax GetProjectMaterialNames()


oProject = oDesktop.GetActiveProject()
oDefinitionManager = oProject.GetDefinitionManager()
Python Example
materials = oDefinitionManager.GetProjectMaterialNames()
AddWarningMessage(str(materials))

Definition Manager Script Commands 25-36


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

ExportMaterial
Exports a local material to a library.

UI Access Export to Library command in the material editor.

Name Type Description


<ExportData> Array ["NAME:<LibraryName>",
<MaterialName>, <MaterialName>, ...]
Parameters
<LibraryName> String Name of the exported library.
<MaterialName> String Name of the material to be exported.
<LibraryLocation> String Location to save the library. Only "PersonalLib" and "UserLib" are
allowed.

Return Value None.

Python Syntax ExportMaterial (<ExportData>, <LibraryLocation>)


oDefinitionManager.ExportMaterial (["NAME:mylib",_
Python Example
"Material1", "Material2", "Material3"], "PersonalLib")

VB Syntax ExportMaterial <ExportData>, <LibraryLocation>


oDefinitionManager.ExportMaterial Array("NAME:mylib",_
VB Example
"Material1", "Material2", "Material3"), "PersonalLib"

Definition Manager Script Commands 25-37


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

RemoveMaterial
Removes a material from a library.

UI Access Remove Material(s) command in the material editor

Name Type Description


<MaterialName> String Name of the material to be removed.
<IsProjectMaterial> Boolean If True, Maxwell assumes the material is a project material. The last
Parameters two parameters will be ignored.
If False, the material is not a project material.
<LibraryName> String Name of the user or personal library where the material resides.
<LibraryLocation> String Location of library. Valid options:"UserLib" or "PersonalLib".

Return Value None.

RemoveMaterial (<MaterialName>, <IsProjectMaterial>,


Python Syntax
<LibraryName>, <LibraryLocation>)
oDefinitionManager.RemoveMaterial ([
Python Example
"Material1", false, "mo0907","UserLib"])

RemoveMaterial <MaterialName>, <IsProjectMaterial>,


VB Syntax
<LibraryName>, <LibraryLocation>

Definition Manager Script Commands 25-38


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oDefinitionManager.RemoveMaterial
VB Example
"Material1", false, "mo0907","UserLib"

RemoveUnusedDefinitions
Removes any unused project definitions.

UI Access Tools > Project Tools > Remove Unused Definitions.

Name Type Description


Parameters
<Definitions> Array Definitions to be removed, such as materials and surface materials.

Return Value None.

Python Syntax RemoveUnusedDefinitions(<Definitions>)


oProject.RemoveUnusedDefinitions(
[
[
"NAME:Materials",
"Al-Extruded"
Python Example
],
[
"NAME:SurfaceMaterials",
"Steel-oxidised-surface"
]

Definition Manager Script Commands 25-39


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

])

VB RemoveUnusedDefinitions <Definitions>
Syntax

VB
oProject.RemoveUnusedDefinitions Array(Array("NAME:Materials", "Al-Extruded"), Array
Exampl- ("NAME:SurfaceMaterials", _
e "Steel-oxidised-surface"))

Component Manager Script Commands


The component manager provides access to components in a project. The manager object is accessed via the definition manager.
Set oDefinitionManager = oProject.GetDefinitionManager()
Set oComponentManager = oDefinitionManager.GetManager("Component")
The topics for this section include:
Add
AddDynamicNPortData
AddNPortData
AddSolverOnDemandModel
ClearSolutionCache
Edit
EditSolverOnDemandModel
EditWithComps

Definition Manager Script Commands 25-40


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Export
GetNPortData
GetSolverOnDemandData
GetSolverOnDemandModelList
Remove
RemoveSolverOnDemandMode
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>,

Definition Manager Script Commands 25-41


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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>...)

Definition Manager Script Commands 25-42


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value:<string>
// composite name of the component.
// If the name requested conflicts with the name of an existing
// component, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.

Parameters:<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 25-43


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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 dialog, checking different boxes in the "Specify products for which this com-
ponent is valid" grid control sets specific flags that correspond to the following hex/decimal settings:
Nexxim -- 100 binary, 4 decimal, 0x4
SIwaveDeNovo -- 1000 binary, 8 decimal, 0x8
Simplorer -- 10000 binary, 16 decimal, 0x10
MaxwellCircuit -- 100000 binary, 32 decimal, 0x20

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed since 00:00 hours, Jan 1, 1970 UTC from the sys-
tem clock.

<TerminalInfo>:
Array(<string>, // symbol pin

Definition Manager Script Commands 25-44


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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>:

Definition Manager Script Commands 25-45


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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,
// or "RHD" - readonly, hidden, & has description parameter

Definition Manager Script Commands 25-46


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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

Definition Manager Script Commands 25-47


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

// 2 - not used
// 3 - File Name Prop Client

<ClientDataArray>:
varies with <ClientID>

<ClientId> is 0 or 1: empty array


Array()

<ClientID> is 3:
Array("InternalFormatText:=", "<prefix><RelativePath>")

<prefix>:
<string> // "<Project>", "<PersonalLib>", "<UserLib>", or "<SysLib>"

<RelativePath>:
<string> // relative path to file from <prefix>

<TextInfo>:
Array(<string>, // name

Definition Manager Script Commands 25-48


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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

Definition Manager Script Commands 25-49


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: a number, variable or expression

<MenuPropInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
<string>, // menu choices - separated by commas
<int>) // 0 based index of current menu choice

<VPointInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>, // x value: number with length units
<string>) // y value: number with length units

<PointInfo>:

Definition Manager Script Commands 25-50


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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"

<TypeStringDependentInfo>:

<TypeString> is "Free" :

Definition Manager Script Commands 25-51


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<string>, // direction: "In", "Out", "InOut", or "DontCare"


// Following <string> is not present if direction is "DontCare"
<string> // when to calculate: "BeforeAnalogSolver",
// "BeforeStateGraph", "AfterStateGraph", or "DontCareWhen"

<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)

final array members for HFSS 3D Layout:


"CosimStackup:=", <string>,
"CosimDmbedRatio:=", <int>

Definition Manager Script Commands 25-52


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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:=", "",_

Definition Manager Script Commands 25-53


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"InfoTopic:=", "", _
"InfoHelpFile:=", "", _
"IconFile:=", "", _
"LibraryName:=", "", _
"OriginalLocation:=", "Project", _
"Author:=", "", _
"OriginalAuthor:=", "", _
"CreationDate:= ", 1147460679), _
"Refbase:=", "U", _
"NumParts:=", 1, _
"OriginalComponent:=", "", _
"Terminal:=", Array("n1", _
"n1", _
"A", _
false, _
0, _
1, _
"", _
"Electrical"), _
"Terminal:=", Array("n2", _

Definition Manager Script Commands 25-54


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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", _
"", _
"", _
"Edit", _
0, _
"ButtonPropClientData:=", Array())), _
Array("NAME:CosimDefinitions", _

Definition Manager Script Commands 25-55


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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", _

Definition Manager Script Commands 25-56


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"IsDefinition:=", true, _
"NetlistString:=", "")))

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
Python Syntax
"VariableProp:=", <VariableInfo>,
"CheckboxProp:=", <CheckBoxInfo>,
"ButtonProp:=", <ButtonInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>],
["NAME:Properties", Any combination of the following:

Definition Manager Script Commands 25-57


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"CheckboxProp:=", <CheckBoxInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>,
"VPointProp:=", <VPointInfo>,
"PointProp:=", <PointInfo>],
["Quantities",
"QuantityProp:=", <QuantityPropInfo>...],
["NAME:CosimDefinitions",
<CosimDefInfo>,
<CosimDefInfo>...]]

oComponentManager.Add(
[
"NAME:Component",
Python Example "Info:=", [
"Type:=", 0,
"NumTerminals:=", 0,
"DataSource:=", "",

Definition Manager Script Commands 25-58


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ModifiedOn:=", 1467910752,
"Manufacturer:=", "",
"Symbol:=", "Component",
"ModelNames:=", "",
"Footprint:=", "",
"Description:=" , "",
"InfoTopic:=", "",
"InfoHelpFile:=", "",
"IconFile:=", "",
"Library:=", "",
"OriginalLocation:=", "Project",
"IEEE:=", "",
"Author:=", "",
"OriginalAuthor:=", "",
"CreationDate:=", 1467910746,
"ExampleFile:=", ""],
"Refbase:=", "U",
"NumParts:=", 1,
"ModSinceLib:=", True,
"CompExtID:=", 2
])

Definition Manager Script Commands 25-59


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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>,

Definition Manager Script Commands 25-60


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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.
// 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>:

Definition Manager Script Commands 25-61


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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/AnsysEM/Designer/Examples/Projects/optiguides/optiguides.adsn", _
"numberofports:=", 2, _
"DesignName:=", "DesignerModel1", _
"SolutionName:=", "Setup1 : Adaptive_1", _
"Simulate:=", true, _
"CloseProject:=", false, _
"SaveProject:=", true, _
"RefNode:=", false, _
"InterpY:=", true, _
"InterpAlg:=", "auto", _

Definition Manager Script Commands 25-62


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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>,

Definition Manager Script Commands 25-63


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"DCBehaviorTab:=", <bool>,
"SolutionName:=", <string>,
"displayformat:=", <DisplayInfo>,
"datatype:=", <string>, // "SMatrix", "YMatrix", or "ZMatrix"
"ShowRefPin:=", <bool>,
"RefNodeCheckbox:=", <bool>, ...
<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".

Definition Manager Script Commands 25-64


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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

// Nexxim
"DCOption:=", <NexximDCOption>,
"InterpOption:=", <NexximInterpOption>,
"ExtrapOption:=", <NexximExtrapOption>,

Definition Manager Script Commands 25-65


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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

Definition Manager Script Commands 25-66


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<CircuitDCOption>:
<int> // 0 : Leave all signal lines open circuited
// 1 : Short all signal lines together
// 2 : Short all signal lines to ground
// 3 : Extrapolate from data provided (not recommended)

<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:=", "", _

Definition Manager Script Commands 25-67


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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, _
"InterpOption:=", 1, _
"ExtrapOption:=", 3, _
"DataType:=", 2, _
"DCOption:=", 3, _
"InterpOption:=", 1, _
"ExtrapOption:=", 3, _

Definition Manager Script Commands 25-68


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"DataType:=", 2)
AddSolverOnDemandModel
Use: This method looks for a local component of the name passed in, and to this component it adds an SOD model definition using the
information passed in the VARIANT. It returns the name of the SOD model added.
Parameters: BSTR component name.
Parameters: VARIANT which is the SOD model data.
Return Value: Returns the name of the model added.
ClearSolutionCache [component manager]
Use: Clear the solution cache for dynamic link component.
Command:Each of the following commands will clear the solution cache:
— Dynamic Link Item RCM > Clear Solution Cache
— Dynamic Link Component in schematic RCM > Clear Solution Cache
Syntax: ClearSolutionCache <Component Name >
Return Value: None
Parameters: <component name> is the name of the dynamic link component
VB Example:
oComponentManager.ClearSolutionCache "TeeModel1"
Edit [component manager]
Modifies an existing component
Command: Tools > Edit Configured Libraries > Components > Edit Component
Syntax: Edit <ComponentName>,
Array("NAME:<NewComponentName>",

Definition Manager Script Commands 25-69


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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>,

Definition Manager Script Commands 25-70


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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>:
<string> // composite name of the component to edit

<NewComponentName>:
<string> // new simple name for the component

Definition Manager Script Commands 25-71


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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>:

Definition Manager Script Commands 25-72


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

An integer that is the or-ing of bits for each product listed below. The default setting is 0xffffffff (4294967295) which indicates
valid for all products. In the component editing dialog, checking different boxes in the "Specify products for which this com-
ponent is valid" grid control sets specific flags that correspond to the following hex/decimal settings:
Nexxim -- 100 binary, 4 decimal, 0x4
SIwaveDeNovo -- 1000 binary, 8 decimal, 0x8
Simplorer -- 10000 binary, 16 decimal, 0x10
MaxwellCircuit -- 100000 binary, 32 decimal, 0x20

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed since 00:00 hours, Jan 1, 1970 UTC from the sys-
tem clock.

<TerminalInfo>:
Array(<string>, // symbol pin
<string> // footprint pin
<string >, // gate name
<bool>, // shared
<int>, // equivalence number
<int>, // what to do if unconnected: flag as error:0, ignore:1
<string>, // description
<Nature>)

<Nature>:

Definition Manager Script Commands 25-73


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<string> // content varies as follows

Nexxim/Circuit:
"Electrical" // the only choice

Simplorer:
// several choices
"Electrical", "Magnetic", "Fluidic", "Translational",
"Translational_V", "Rotational", "Rotational_V",
""Radiant", "Thermal", or <VHDLPackageName>

<VHDLPackageName>:
<string> // in the form <Library>.<Package>

<Library>:
<string> // name of the VHDL library

<Package>:
<string> // name of the VHDL package

Definition Manager Script Commands 25-74


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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>:

Definition Manager Script Commands 25-75


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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

Definition Manager Script Commands 25-76


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array()

<ClienID> is 3:
Array("InternalFormatText:=", "<prefix><RelativePath>")

<prefix>:
<string> // "<Project>", "<PersonalLib>", "<UserLib>", or "<SysLib>"

<RelativePath>:
<string> // relative path to file from <prefix>

<TextInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: a text string

<NumberInfo>:
Array(<string>, // name
<FlagLetters>,

Definition Manager Script Commands 25-77


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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

Definition Manager Script Commands 25-78


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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

<QuantityPropInfo>:

Definition Manager Script Commands 25-79


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array(<string>, // name
<FlagLetters>,
<string>, // description
<string>, // value
<TypeString>,
<TypeStringDependentInfo>)

<TypeString>:
<string> // "Across", "Through", or "Free"

<TypeStringDependentInfo>:

"Free" :
<string>, // direction: "In", "Out", "InOut", or "DontCare"
// Following <string> is not present if direction is "DontCare"
<string> // when to calculate: "BeforeAnalogSolver",
// "BeforeStateGraph", "AfterStateGraph", or "DontCareWhen"

"Across" or "Through"
<int>, // terminal 1
<int> // terminal 2

Definition Manager Script Commands 25-80


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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>

final array member for Netlist:

Definition Manager Script Commands 25-81


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"NetlistString:=", <string>
VB Example:
Dim name
name = oComponentManager.Edit ("Nexxim Circuit Elements\BJTs:Level01_NPN", _
Array("NAME:Level01_NPN", _
"Info:=", Array("Type:=", 4294901764,_
"NumTerminals:=", 3, _
"DataSource:=", "Ansys built-in component", _
"ModifiedOn:=", 1152722112, _
"Manufacturer:=", "", _
"Symbol:=", "nexx_bjt_npn", _
"Footprint:=", "", _
"Description:=", "BJT, GP, NPN", _
"InfoTopic:=", "NXBJT1.htm", _
"InfoHelpFile:=", "nexximcomponents.chm", _
"IconFile:=", "bjtsn.bmp", _
"Library:=", "Nexxim Circuit Elements\BJTs", _
"OriginalLocation:=", "SysLibrary ", _
"Author:=", "", _
"OriginalAuthor:=", "", _

Definition Manager Script Commands 25-82


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"CreationDate:=", 1152722102), _
"Refbase:=", "Q", _
"NumParts:=", 1, _
"Terminal:=", Array("collector", _
"collector", _
"A", _
false, _
6, _
0, _
"", _
"Electrical"), _
"Terminal:=", Array("base", _
"base", _
"A", _
false, _
7, _
0, _
"", _
"Electrical"), _
"Terminal:=", Array("emitter", _
"emitter", _

Definition Manager Script Commands 25-83


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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", _
"Emitter area multiplying factor, which affects curents, resistances, and capacitances", _ "1"),
_
"VariableProp=", Array("AREAB", _
"D", _

Definition Manager Script Commands 25-84


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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=@AREAB) *AREAC(AREAC=@" & _
"AREAC) *DTEMP(DTEMP=@DTEMP) *M(M=@M)", _

Definition Manager Script Commands 25-85


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

1, _
"ButtonPropClientData:=", Array()), _
"TextProp:=", Array( "ModelName", _
"HD", _
"", _
"Q"))))
VB Example:
Dim name2
name2 = oComponentManager.Edit "MyComponent", _
(Array("NAME:MyOtherComponent", _
"Info:=", Array("Type:=", 4294901767, _
"NumTerminals:=", 2, _
"DataSource:=", "", _
"ModifiedOn:=", 1071096503, _
"Manufacturer:=", "Ansys", _
"Symbol:=", "bendo", _
"Footprint:=", "BENDO", _
"Description:=", "",_
"InfoTopic:=", "", _
"InfoHelpFile:=", "", _

Definition Manager Script Commands 25-86


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"IconFile:=", "", _
"LibraryName:=", "", _
"OriginalLocation:=", "Project", _
"Author:=", "", _
"OriginalAuthor:=", "", _
"CreationDate:= ", 1147460679), _
"Refbase:=", "U", _
"NumParts:=", 1, _
"OriginalComponent:=", "", _
"Terminal:=", Array("n1", _
"n1", _
"A", _
false, _
0, _
0, _
"", _
"Electrical"), _
"Terminal:=", Array("n2", _
"n2", _
"A", _
false, _

Definition Manager Script Commands 25-87


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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, _

Definition Manager Script Commands 25-88


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"CosimDefName:=", "HFSS3D", _
"IsDefinition:=", true, _
"CosimStackup:=", "Layout stackup", _
"CosimDmbedRatio:=", 3), _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 1, _
"CosimDefName:=", "Circuit", _
"IsDefinition:=", true, _
"ExportAsNport:=", 0, _
"UsePjt:=", 0), _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 2, _
"CosimDefName:=", "Custom", _
"IsDefinition:=", true, _
"DefinitionCompName:=", ""), _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 3, _
"CosimDefName:=", "Netlist", _
"IsDefinition:=", true, _
"NetlistString:=", "")))

Definition Manager Script Commands 25-89


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Edit <ComponentName>,
["NAME:<NewComponentName>",
"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
Python Syntax
"VariableProp:=", <VariableInfo>,
"CheckboxProp:=", <CheckBoxInfo>,
"ButtonProp:=", <ButtonInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>],
["NAME:Properties", # any combo of the following
"CheckboxProp:=", <CheckBoxInfo>,

Definition Manager Script Commands 25-90


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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 Elements\BJTs:Level01_NPN", _
["NAME:Level01_NPN", "Info:=", ["Type:=", 4294901764,_
"NumTerminals:=", 3, "DataSource:=", "Ansoft built-in component",_
"ModifiedOn:=", 1152722112, "Manufacturer:=", "", _
Python
"Symbol:=", "nexx_bjt_npn", "Footprint:=", "", _
Example
"Description:=", "BJT, GP, NPN", "InfoTopic:=", "NXBJT1.htm", _
"InfoHelpFile:=", "nexximcomponents.chm", "IconFile:=", "bjtsn.bmp", _
"Library:=", "Nexxim Circuit Elements\BJTs",_
"OriginalLocation:=", "SysLibrary ", "Author:=", "", _

Definition Manager Script Commands 25-91


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"OriginalAuthor:=", "", "CreationDate:=", 1152722102], _


"Refbase:=", "Q", "NumParts:=", 1, "Terminal:=", ["collector", _
"collector", "A", false, 6, 0, "", "Electrical"], _
"Terminal:=", ["base", "base", "A", false, _
7, 0, "", "Electrical"], "Terminal:=", ["emitter", _
"emitter", "A", false, 8, 0, "", "Electrical"], _
["NAME:Parameters", "TextProp:=", ["LabelID", _
"HD", "Property string for netlist ID", _
"Q@ID"], "TextProp:=", ["MOD", "D", _
"Name of model data reference", "required"], _
"VariableProp:=", ["AREA", "D", _
"Emitter area multiplying factor, which affects
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", _

Definition Manager Script Commands 25-92


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"1"], "ButtonProp:=", ["NexximNetlist", "HD", "", _


"Q@ID %0 %1 %2 *MOD(@MOD) *AREA(AREA=@AREA)"& _

" *AREAB(AREAB=@AREAB) *AREAC(AREAC=@" &_


"AREAC) *DTEMP(DTEMP=@DTEMP) *M(M=@M)", _
"Q@ID %0 %1 %2 *MOD(@MOD) " & "*AREA(AREA=@AREA)
*AREAB(AREAB=@AREAB) *AREAC(AREAC=@" & _
"AREAC) *DTEMP(DTEMP=@DTEMP) *M(M=@M)", 1, _
"ButtonPropClientData:=", []],
"TextProp:=", ["ModelName", "HD", "", "Q"]]])

name2 = oComponentManager.Edit ("MyComponent",_

(["NAME:MyOtherComponent","Info:=", ["Type:=", 4294901767, _

"NumTerminals:=", 2, "DataSource:=", "", _


Python
Example
2
"ModifiedOn:=", 1071096503, "Manufacturer:=", "Ansoft", _

"Symbol:=", "bendo", "Footprint:=", "BENDO", _

Definition Manager Script Commands 25-93


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Description:=", "", "InfoTopic:=", "", _

"InfoHelpFile:=", "", "IconFile:=", "", _

"LibraryName:=", "", "OriginalLocation:=", "Project", _

"Author:=", "", "OriginalAuthor:=", "", _

"CreationDate:= ", 1147460679], "Refbase:=", "U", _

"NumParts:=", 1, "OriginalComponent:=", "", _

"Terminal:=", ["n1", "n1", "A", false, 0, 0, "", _

"Electrical"], "Terminal:=", ["n2", "n2", "A", _

false, 1, 0, "", Electrical"], ["NAME:Parameters", _

Definition Manager Script Commands 25-94


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"MenuProp:=", ["CoSimulator", "D", "", _

"Default,Custom,Netlist", 0], "ButtonProp:=", ["CosimDefinition", _

"D", "", "", "Edit", 0, "ButtonPropClientData:=", []]], _

["NAME:CosimDefinitions", ["NAME:CosimDefinition", _

"CosimulatorType:=", 0, "CosimDefName:=", "HFSS3D", _

"IsDefinition:=", true, "CosimStackup:=", "Layout stackup", _

"CosimDmbedRatio:=", 3], ["NAME:CosimDefinition", _

"CosimulatorType:=", 1, "CosimDefName:=", "", _

"IsDefinition:=", true, "ExportAsNport:=", 0, _

"UsePjt:=", 0], ["NAME:CosimDefinition", _

Definition Manager Script Commands 25-95


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"CosimulatorType:=", 2, "CosimDefName:=", "Custom", _

"IsDefinition:=", true, "DefinitionCompName:=", ""], _

["NAME:CosimDefinition", "CosimulatorType:=", 3, _

"CosimDefName:=", "Netlist", "IsDefinition:=", true, _

"NetlistString:=", ""]]])

EditSolverOnDemandModel
Use: This method looks for a local component of the name passed in, and in this component it looks for an SOD model using the name
passed in the second BSTR. It modifies the SOD model using the data in the VARIANT. It returns the name of the SOD model edited.
Return Value: Returns the name of the model edited.
Parameters: BSTR component name.
Parameters: BSTR SOD model name.
Parameters: VARIANT which is the new SOD model data (can include changed name).
EditWithComps [component manager]
Edit an existing component.

Definition Manager Script Commands 25-96


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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>:
<string> // composite name of the component being edited

Definition Manager Script Commands 25-97


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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

Definition Manager Script Commands 25-98


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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>,

Definition Manager Script Commands 25-99


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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

Definition Manager Script Commands 25-100


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

// 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

Definition Manager Script Commands 25-101


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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

Definition Manager Script Commands 25-102


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<LineInfo>:
"Line:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<PointInfo>, // must specify at least 2 points
<PointInfo>...)
<PointInfo>:
<real>, // x position
<real> // y position

<PolygonInfo>:
"Polygon:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<PointInfo>, // must specify at least 3 points
<PointInfo>...)

<TextInfo>:
"Text:=", Array(<real>, // x position
<real>, // y position

Definition Manager Script Commands 25-103


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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>,

Definition Manager Script Commands 25-104


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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 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", _

Definition Manager Script Commands 25-105


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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, _
false)), _
Array("NAME:PinDef", _
"Pin:=", Array( "n2", _
0.00254, _

Definition Manager Script Commands 25-106


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

-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, _

Definition Manager Script Commands 25-107


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Text:=", Array( 2.1684E-019, _


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>:

Definition Manager Script Commands 25-108


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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:
oComponentManager.Export Array("NAME:mylib", "Nexxim Circuit Elements\BJTs:Level01_NPN"),"Per-
sonalLib"

Python Syntax Export(["NAME:<LibraryName>", <ComponentName>, <ComponentName>...], <LibraryLocation>)


oComponentManager.Export(["NAME:mylib",
Python Example "Simplorer Circuit Elements\BJTs:Level01_NPN"],
"PersonalLib")

GetData [component manager]


Gets data that describes the definition.
Command: None
Syntax: GetData(<DefinitionName>)

Definition Manager Script Commands 25-109


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value: <DefinitionData> This is an array of data for the definition.


Parameters: <DefinitionName>:
<string> // composite name of the definition to edit
VB Example:
Dim 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. Accordingly, for each type of definition, the array data returned to GetData
should be the same array information that is supplied to the Edit or EditWithComps commands.

Python Syntax GetData(<DefinitionName>)


Python Example compData = oComponentManager.GetData("Level01_NPN")

GetNames [component manager]


Returns the names of the components (used and unused) in a design. The following script command, IsUsed, can then be used to
separate used and unused components.
Command: None
Syntax: GetNames()
Return Value: An array of strings

Definition Manager Script Commands 25-110


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Parameters: None
VB Example:
Dim componentNames
componentNames = oComponentManager.GetNames()

Python Syntax GetNames()


Python Example componentNames = oComponentManager.GetNames()

GetNPortData [component manager]


Returns NPort data for the component with the specified name.
Command: None
Return Value: Variant array, whose contents depend on the type of component. The array will be empty if the component does not
have NPort data. See the syntax for AddDynamicNPortData and AddNPortData for descriptions of the array contents for components
with those types of NPort data.
Parameters: <ComponentName>:
<string>
Example: This script displays each item in the returned array for each component in the design.

Sub DisplayVariant(x)
Dim index
index = 0

Definition Manager Script Commands 25-111


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

For Each info In x


curr = x(index)
If TypeName(curr) <> "Variant()" Then
If TypeName(curr) <> "Empty" And TypeName(curr) <> "Null" Then
str = CStr(curr)
If str = "" Then
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

Definition Manager Script Commands 25-112


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim dnpInfo
Dim index

Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")


Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject()
Set oDefinitionManager = oProject.GetDefinitionManager()

Set oComponentManager = oDefinitionManager.GetManager("Component")

Dim componentNames
componentNames = oComponentManager.GetNames()

index = 0
For Each name In componentNames

Definition Manager Script Commands 25-113


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

name = componentNames(index)
message = "NPort data for component " + name
Msgbox message
dnpInfo = oComponentManager.GetNPortData(name)

DisplayVariant dnpInfo
index = index + 1
Next

GetSolverOnDemandData
Use: This method looks for a local component of the name passed in, and in this component it looks for an SOD model of the name
passed in and returns the SOD data pertaining to that model.
Parameters: BSTR component name.
Parameters: BSTR SOD model name
Return Value: VARIANT which is the SOD data.
GetSolverOnDemandModelList
Use: This method looks for a local component of the name passed in, and returns a list of SOD model names defined in the com-
ponent.
Parameters: BSTR component name.
Return Value: VARIANT which is a list of SOD model names.

Definition Manager Script Commands 25-114


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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")

Python Syntax IsUsed(<ComponentName>)


Python Example IsUsed = oComponentManager.IsUsed("MyComponent")

Remove [component manager]


Remove a component from a library
Command: Tools > Edit Configured Libraries > Components > Remove Component
Syntax: Remove <ComponentName>,
<IsProjectComponent>,
<LibraryName>,
<LibraryLocation>
Return Value: None

Definition Manager Script Commands 25-115


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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 Syntax Remove (<ComponentName>, <IsProjectComponent>, <LibraryName>, <LibraryLocation>)


oComponentManager.Remove ("Simplorer Circuit
Python Example
Elements\BJTs:Level01_NPN", _ true, "Project")

Definition Manager Script Commands 25-116


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

RemoveSolverOnDemandModel
Use: This method looks for a local component of the name passed in, and in this component it looks for an SOD model of the name
passed in and deletes the SOD model definition from the component.
Parameters: BSTR component name.
Parameters: BSTR SOD model name
Return Value: None.
RemoveUnused [component manager]
Removes components that are not used in the design.
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()

Definition Manager Script Commands 25-117


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note:

The order of calls to RemoveUnused is significant. As a result, removing definitions in an unordered fashion may cause
other components in dependent definitions to be rendered unusable.

Also, the symbol and footprint of an unused component are not unusable until after the component itself is removed using
the Component Manager Remove script.

Python Syntax RemoveUnused()


Python Example removedDefs = oComponentManager.RemoveUnused()

Update Dynamic Link [component manager]


Use:Reads data from the linked design and updates the dynamic link component. This will update the following: properties, solutions,
ports, geometry.
Command:Each of the following commands will record a non-undoable script command:
—Dynamic Link Item RCM > Refresh Dynamic Link
—Dynamic Link Component in schematic RCM > Refresh Dynamic Link
— Click the Refresh Dynamic Link button in the Footprint tab of the Properties Window for selected Dynamic Link components
in the Layout Editor.
Syntax:UpdateDynamicLink(<component name>)
Return Value:None
Parameters:<component name> is the name of the dynamic link component

Definition Manager Script Commands 25-118


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Example:
oComponentManager.UpdateDynamicLink("TeeModel_L1")

Material Manager Script Commands


The material manager provides access to materials in a project. The manager object is accessed via the definition manager.
Set oDefinitionManager = oProject.GetDefinitionManager()
Set oMaterialManager = oDefinitionManager.GetManager("Material")
The topics for this section include:
GetData
GetNames
GetProperties
IsUsed
RemoveUnused
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:

Definition Manager Script Commands 25-119


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

materialData = oMaterialMgr.GetData("MyMaterial2")

Python Syntax GetData(<SimpleName>)


dataArray = oMaterialManager.GetData
Python Example
("mymaterial")

GetNames [material manager]


Use: Get the names of the materials in a project
Command: None
Syntax: GetNames
Return Value: Names of the materials in a project
Parameters: None
Example:
materialNames = oMaterialMgr.GetNames()

Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor

Definition Manager Script Commands 25-120


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.NewProject
oProject.InsertDesign "Nexxim Circuit", "Nexxim1", "", ""
Set oMaterialMgr = oProject.GetDefinitionManager().GetManager("Material")
oMaterialMgr.Add( Array("NAME:MyMaterial1", "CoordinateSystemType:=", "Cartesian", "per-
mittivity:=", "0.123") )
oMaterialMgr.Add( Array("NAME:MyMaterial2", "CoordinateSystemType:=", "Cartesian", "per-
mittivity:=", "0.456")
Dim materialNames
materialNames = oMaterialMgr.GetNames()

Python Syntax GetNames()


Python Example materialnames = oMaterialManager.GetNames()

GetProperties [material manager]


Get material properties. Differs from GetData in that only material properties available to the user are returned by GetProperties.

UI Access NA

Name Type Description


Parameters
<material_name> string Name of the project material

Definition Manager Script Commands 25-121


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Boolean True or False. If you use False or only a single argument, then GetProperties
returns only the properties that are different from the defaults.

Return Value Array of material data

Python Syntax GetProperties (<materialname>)


oMaterialManager.GetProperties("Gold", True)
Python Example
oMaterialManager.GetProperties("vacuum")

VB Syntax GetProperties <material_name>


VB Example materialProps = oMaterialMgr.GetProperties( "MyMaterial2" )

IsUsed [material manager]


Use: Checks if a project material is in use
Command: None
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:

Definition Manager Script Commands 25-122


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

used = oMaterialMgr.IsUsed( "MyMaterial2" )

Python Syntax IsUsed(<ComboName>)


Python Example isused = oMaterialManager.IsUsed("mylib:mymaterial")

RemoveUnused [material manager]


Use: Remove all unused materials from the project.
Command: None
Syntax: RemoveUnused
Return Value: None
Parameters: None
VB Example:
oMaterialMgr.RemoveUnused()

Python Syntax RemoveUnused()


Python Example thereWereExtras = oMaterialManager.RemoveUnused()

Model Manager Script Commands


The model manager provides access to models in a project. The manager object is accessed via the definition manager.
Set oDefinitionManager = oProject.GetDefinitionManager()
Set oModelManager = oDefinitionManager.GetManager("Model")
The model manager script commands are listed below:

Definition Manager Script Commands 25-123


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Add
ConvertToDynamic
ConvertToParametric
Edit
EditWithComps
Export
GetData
GetNames
IsUsed
Remove
RemoveUnused
Add [model manager]
Use: Add a model
Command: Tools > Edit Configured Libraries > Models > Add Model
Syntax: Add Array("NAME:<modelName>",
"ModTime:=", <ModifiedTimeInfo>,
"Library:=", "", // Library name
"LibLocation:=", "Project", // Project Location
<PinDefInfo>,
<PinDefInfo>,... // optional, to define pins

Definition Manager Script Commands 25-124


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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
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

Definition Manager Script Commands 25-125


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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

Definition Manager Script Commands 25-126


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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

Definition Manager Script Commands 25-127


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

// 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>,

Definition Manager Script Commands 25-128


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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>:

Definition Manager Script Commands 25-129


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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>:

Definition Manager Script Commands 25-130


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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 25-131


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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

VB Example:
oModelManager.Add Array("NAME:MyModel",_
"ModTime:=", 1070989137, _
"Library:=", "", _

Definition Manager Script Commands 25-132


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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",_

Definition Manager Script Commands 25-133


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

0, _
0.00254, _
false, _
0, _
true, _
"",_
false, _
false)),
Array("NAME:Graphics", _
"Rect:=", Array(0, _
0, _
12566272, _
0, _
4.33680868994202e-019, _
-0.000635, _
0.00508, _
0.002794), _
"Circle:=", Array(0, _
0, _
12566272, _

Definition Manager Script Commands 25-134


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

0.000127, _
-0.000635, _
0.000635)))
ConvertToDynamic
Use: Build a new dynamic model based on an existing parametric model.
Command: Right-click on a model under Definitions/Models in the Project Tree and choose ConvertToDynamic.
Syntax: ConvertToDynamic(defName, newname)
Return Value: <newname> // Name of the new model added
Parameters: <defName> // Model that is the base for the new conversion
VB Example:
Dim newname
newname = oModelManager.ConvertToDynamic([in] BSTR defName, [out, retval] BSTR* newName);
ConvertToParametric
Use: Build a new parametric model based on an existing dynamic model.
Command: Right-click on a model under Definitions/Models in the Project Tree and choose ConvertToParametric.
Syntax: ConvertToParametric(defName, newname)
Return Value: <newname> // Name of the new model added
Parameters: <defName> // Model that is the base for the new conversion
VB Example: Dim newname
newname = oModelManager.ConvertToParametric([in] BSTR defName, [out, retval] BSTR* newName);
Edit [deprecated]

Definition Manager Script Commands 25-135


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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.

Definition Manager Script Commands 25-136


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Parameters: <ModelName>:
<string> // composite name of the model being edited

<NewModelName>:
<string> // new simple name for the model

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.

<PinDefInfo>:
Array("NAME:PinDef",
"Pin:=", Array (<string>, // pin name
<real>, // x location
<real>, // y location
<real>, // angle in radians
<PinType>,
<real>, // line width
<real>, // line length
<bool>, // mirrored

Definition Manager Script Commands 25-137


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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>,...)

Definition Manager Script Commands 25-138


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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 25-139


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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

Definition Manager Script Commands 25-140


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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

Definition Manager Script Commands 25-141


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

< 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 25-142


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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

Definition Manager Script Commands 25-143


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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

<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:

Definition Manager Script Commands 25-144


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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, _
false)), _

Definition Manager Script Commands 25-145


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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)), _

Definition Manager Script Commands 25-146


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:PropDisplayMap", _
"W:=", Array(3, _
5, _
0, _
"Text:=", Array( 2.1684E-019, _
0.00504119, _
0, _
1, _
5, _
false, _
"Arial", _
0, _
"W=***"))))), _
rray("MY_COMP")
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>

Definition Manager Script Commands 25-147


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value: None


Parameters: <LibraryName>:
<string> // name of the library

<ModelName>:
<string> // composite name of model to export

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

VB Example:
oModelManager.Export _
Array("NAME Nexxim Circuit Elements\Distributed\Distributed:bendo:mylib", _ "myModel"), "Per-
sonalLib"

Python Syntax Export (["NAME:<LibraryName>", <ComboName>, <ComboName>...], <LibraryLocation>)


Python Example oModelManager.Export (["NAME:mylib", "model1", "model2"])

GetData [model manager]


Use: Gets data that describes the definition.

Definition Manager Script Commands 25-148


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Command: None
Syntax: GetData(<DefinitionName>)
Return Value: <DefinitionData> This is an array of data for the definition.
Parameters: <DefinitionName>:
<string> // composite name of the definition to edit
VB Example:
Dim ModelData
ModelData = oModelManager.GetData("Nexxim Circuit Elements\Hspice:nexx_bjt_npn")

Note:

GetData allows the user to access definition information, make modifications, and then use the Edit or EditWithComps
script commands to save the modified definition. Accordingly, for each type of definition, the array data returned to
GetData should be the same array information that is supplied to the Edit or EditWithComps commands.

Python Syntax GetData(<ComboName>)


dataArray = oModelManager.GetData
Python Example
("mylib:mymodel")

GetNames [model manager]


Use: Returns the names of the models (used and unused) in a design. The following script command, IsUsed, can then be used to
separate used and unused models.
Command: None

Definition Manager Script Commands 25-149


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Syntax: GetNames()
Return Value: An array of strings
Parameters: None
VB Example:
Dim modelNames
modelNames = oModelManager.GetNames()

Python Syntax GetNames()


Python Example modelnames = oModelManager.GetNames()

IsUsed [model manager]


Use: Used to determine if a model is used in the design.
Command: None
Syntax: IsUsed(<ModelName>)
Return Value: <Boolean> // true if the specified model is used in the design
Parameters: <ModelName>:
<string>
VB Example:
Dim isUsed
isUsed = oModelManager.IsUsed("MyModel")

Definition Manager Script Commands 25-150


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax IsUsed(<ComboName>)


Python Example isused = oModelManager.IsUsed ("mylib:mymodel")

Remove [model manager]


Use: Removes a model from a library
Command: Tools > Edit Configured Libraries > Models > Remove Model
Syntax: Remove <ModelName>,
<IsProjectModel>,
<LibraryName>,
<LibraryLocation>
Return Value: None
Parameters: <ModelName>:
<string> // composite name of the model to remove

<IsProjectModel>:
<bool>

<LibraryName>:
<string> // name of the library

<LibraryLocation>:

Definition Manager Script Commands 25-151


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<string> // location of the library in <LibraryName>


// One of "Project", "PersonalLib", or "UserLib"

VB Example:
oModelManager.Remove "Nexxim Circuit Elements\Distributed\Distributed:bendo", true, "Project"

Python Syntax Remove (<ModelName>, <IsLocal>, <LibraryName>, <LibraryLocation>)


oModelManager.Export([
Python Example
"NAME:mylib", "model1", "model2"])

RemoveUnused [model manager]


Use: Removes models that are not used in the design.
Command: Project->Remove Unused Definitions is similar but operates slightly different and does not record script commands.
Syntax: RemoveUnused()
Return Value: <bool> True if one or more models are removed.
Parameters: None
VB Example:
Dim removedDefs
removedDefs = oModelManager.RemoveUnused()

Definition Manager Script Commands 25-152


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note:

The order of calls to RemoveUnused is significant. As a result, removing definitions in an unordered fashion may cause
other models in dependent definitions to be rendered unusable.

Also, the model and footprint of an unused component are not unusable until after the component itself is removed using
the Component Manager Remove script.

Python Syntax RemoveUnused()


Python Example thereWereExtras = oModelManager.RemoveUnused()

Network Data Explorer Manager Script Commands


The network data Explorer (NDE) Manager provides access to certain NDE data.
Set oDefinitionManager = oProject.GetDefinitionManager()
Set oNdExplorerManager = oDefinitionManager.GetManager("NdExplorer")
For NDE scripts accessed via the ndExplorer tool, see: Network Data Explorer Script Commands.
The topics for this section include:
ExportFullWaveSpice
ExportNetworkData
ExportNMFData
ExportFullWaveSpice
Use: Export FullWaveSpice data in a format of your choice.

Definition Manager Script Commands 25-153


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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 "ConvexOptimization",
// "PassivityByPerturbation", or "IteratedFittingOfPV"
"ColumnFittingType:=", "Column", // Column FittingType can be "Column", "Entry", "Matrix"
"SSFittingType:=", "TWA", // SS Fitting Type can be "TWA", "IterativeRational"

Definition Manager Script Commands 25-154


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"RelativeErrorToleranc:=", false, // Relative error tolerance true/false


"TouchstoneFormat:=", "MA", // Touchstone Format "MA", "RI", "DB"
"TouchstoneUnits:=", "Hz", // Touchstone Units "Hz", "KHz", "MHz", "MHz"
"TouchStonePrecision:=", 8, // Touchstone precision
"ExportDirectory:=", "C:/Examples/LNA/", // Directory to export to
"ExportSpiceFileName:=", "Linckt_HBTest_2.sss", // Spice export file
"FullwaveSpiceFileName:=", "Linckt_HBTest.sss", // FWS file
"CreateNPortModel:=", true // Create a model based on the exported file true/false
)
ExportNetworkData
Exports matrix solution data to a file.

UI Access N/A

Name Type Description


<DesignVariationKey> String Design variation key. Pass empty string for the current nominal vari-
ation.
<SolnSelectionArray> Array Array of selected solutions.
[<SolnSelector>, <SolnSelector>, ...]
Parameters For example, ["Setup1:Sweep1"]. If more than one array entry,
this indicates a combined Interpolating sweep.
<SolnSelector> String Solution setup name and solution name, separated by a colon.
<FileFormat> Integer File format value.
2 : Tab delimited spreadsheet format (.tab)
3 : Touchstone (.sNp)

Definition Manager Script Commands 25-155


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

4 : CitiFile (.cit)
7 : Matlab (.m)
8 : Terminal Z0 spreadsheet
<OutFile> String Full path to the file to write out.
<FreqsArray> Array The frequencies to export. The <FreqsArray> argument contains a
vector (e.g. [1 , 2GHz, ...) to use, or ["all"]. To export all frequencies,
use ["all"]. If no frequencies are specified, all frequencies are used.
<DoRenorm> Boolean Specifies whether to renormalize the data before export.
<RenormImped> Double Real impedance value in ohms, for renormalization. Required in syn-
tax, but ignored if DoRenorm is false.
<DataType> String Optional. Type: "S", "Y", or "Z". The matrix to export.
<pass> Integer Optional. The pass to export. This is ignored if the sourceName is a
frequency sweep. Leaving out this value or specifying -1 gets all
passes.
<ComplexFormat> Integer Optional. Type: "0", "1", or "2"
The format to use for the exported data.
0 = Magnitude/Phase.
1= Real/Imaginary.
2= db/Phase.
<Precision> Integer Optional. Touchstone number of digits precision. Default if not spe-
cified is 15.
<UseExportFreqs> Boolean Specifies whether to use export frequencies.
<IncludeGammaComments> Boolean Specifies whether to include Gamma and Impedance comments.
<SupportNonStdExport> Boolean Specifies whether to support non-standard Touchstone extensions
for mixed reference impedance.

Return Value None.

Definition Manager Script Commands 25-156


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

ExportNetworkData(<DesignVariationKey>, <SolnSelectionArray>, <SolnSelector>, <FileFormat>, <OutFile>, [<Fre-


Python qsArray>], <DoRenorm>, <RenormImped>, [Optional <DataType>], [Optional <pass>], [Optional <ComplexFormat>],
Syntax [Optional <Precision>], [Optional <UseExportFreqs>], [Optional <IncludeGammaComments>], [Optional <Sup-
portNonStdExport>])
oDesign = oProject.SetActiveDesign("HFSSDesign1")
oModule = oDesign.GetModule("Solutions")
oModule.ExportNetworkData("", ["Setup1:Sweep1"], 3, "C:/Document/package_
HFSSDesign1.s4p", [0, 5000000, _
10000000, 15000000, 20000000, 25000000, 30000000, 35000000, 40000000, 45000000,
Python 50000000, 55000000, _
Exampl- 60000000, 65000000, 70000000, 75000000, 80000000, 85000000, 90000000, 95000000,
e 100000000, 105000000,_
110000000, 115000000, 120000000, 125000000, 130000000, 135000000, 140000000,
145000000, 150000000, _
155000000, 160000000, 165000000, 170000000, 175000000, 180000000, 185000000, 190000000,
195000000, _
...2485000000, 2490000000, 2495000000, 2500000000], True, 50, "S", -1, 0, 15, True,
True, True)

ExportNetworkData <DesignVariationKey>, <SolnSelectionArray>, <SolnSelector>, <FileFormat>, <OutFile>,


<FreqsArray>, <DoRenorm>, <RenormImped>, [Optional <DataType>], [Optional <pass>], [Optional <Com-
VB Syntax
plexFormat>], [Optional <Precision>], [Optional <UseExportFreqs>], [Optional <IncludeGammaComments>],
[Optional <SupportNonStdExport>]
oModule.ExportNetworkData "width=’2in’", _
VB Example Array("Setup1:Sweep1"),2, "c:\mydir\out.tab", _
Array("all"), false, 0

Definition Manager Script Commands 25-157


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oModule.ExportNetworkData "width=’2in’", _
Array("Setup1:Sweep1", "Setup1:Sweep2"), 3, _
"c:\mydir\out.s2p", Array(1.0e9, 1.5e9, 2.0e9), _
true, 50.0

ExportNMFData

Symbol Manager Script Commands


The symbol manager provides access to symbols in a project. The manager object is accessed via the definition manager.
Set oDefinitionManager = oProject.GetDefinitionManager()
Set oSymbolManager = oDefinitionManager.GetManager("Symbol")
The symbol manager script commands are listed below.
Add
BringToFront
Edit
EditWithComps
Export
GetData
GetNames
IsUsed
Remove
RemoveUnused

Definition Manager Script Commands 25-158


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Add [symbol manager]


Use: Add a symbol
Command: Tools > Edit Configured Libraries > Symbols > Add Symbol
Syntax: Add Array("NAME:<SymbolName>",
"ModTime:=", <ModifiedTimeInfo>,
"Library:=", "", // Library name
"LibLocation:=", "Project", // Project Location
<PinDefInfo>,
<PinDefInfo>,... // optional, to define pins
<GraphicsDataInfo>, // optional, to define graphics
<PropDisplayMapInfo>)) // optional, to define property displays

Return Value: <string>


// composite name of the symbol.
// If the name requested conflicts with the name of an existing
// symbol, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.

Parameters: <SymbolName>:
<string> // simple name of the symbol being added

Definition Manager Script Commands 25-159


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.

<PinDefInfo>:
Array("NAME:PinDef",
"Pin:=", Array (<string>, // pin name
<real>, // x location
<real>, // y location
<real>, // angle in radians
<PinType>,
<real>, // line width
<real>, // line length
<bool>, // mirrored
<int>, // color
<bool>, // true if visible, false if not
<string>, // hidden net name
<OptionalPinInfo>, // optional info
<PropDisplayMapInfo>)) // optional

Definition Manager Script Commands 25-160


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<PinType>:
<string> // "N" : normal pin
// "I" : input pin
// "O" : output pin

<OptionalPinInfo>:
// Specify both or neither
<bool>, // true if name is to be shown
<bool>, // true if number is to be shown

<PropDisplayMapInfo>:
Array("NAME:PropDisplayMap",
<PropDisplayInfo>,
<PropDisplayInfo>,...)

<PropDisplayInfo>:
<NameString>, Array(<DisplayTypeInfo>,
<DisplayLocationInfo>,
<int>, // optional, level number
<TextInfo>)

Definition Manager Script Commands 25-161


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<NameString>:
<string> // PropertyName:=, where PropertyName is the name of
// the property to be displayed

<DisplayTypeInfo>:
<int> // 0 : No display
// 1 : Display name only
// 2 : Display value only
// 3 : Display both name and value
// 4: Display evaluated value only
// 5: Display both name and evaluated value

<DisplayLocationInfo>:
<int> // 0 : Left
// 1 : Top
// 2 : Right
// 3 : Bottom
// 4 : Center
// 5 : Custom placement

Definition Manager Script Commands 25-162


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<GraphicsDataInfo>:
Array("NAME:Graphics",
// one or more of the following
<RectInfo>,
<CircleInfo>,
<ArcInfo>,
<LineInfo>,
<PolygonInfo>,
<TextInfo>,
<ImageInfo>)

<RectInfo>:
"Rect:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // angle, in radians
<real>, // x position of center
<real>, // y position of center
<real>, // width
< real>) // height

Definition Manager Script Commands 25-163


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<CircleInfo>:
"Circle:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>) // radius

<ArcInfo>:
"Arc:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>, // radius
<real>, // start angle, in radians
<end>) // end angle, in radians

<LineInfo>:
"Line:=", Array(<real>, // line width

Definition Manager Script Commands 25-164


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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

Definition Manager Script Commands 25-165


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<string>, // font name


<int>, // color
<string>) // text string

<Justification>:
<int> // 0 : left top
// 1 : left base
// 2 : left bottom
// 3 : center top
// 4 : center base
// 5 : center bottom
// 6 : right top
// 7 : right base
// 8 : right bottom

<ImageInfo>:
"Image:=", Array(<RectInfo>,
<ImageData>,
<bool>) // is mirrored

Definition Manager Script Commands 25-166


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<ImageData>:
<string>, // file path
<int>, // 0 : use the file path and link to it
// 1 : ignore file path and use next parameter
<string> // text data, only present if preceding int is 1

VB Example:
oSymbolManager.Add Array("NAME:MySymbol",_
"ModTime:=", 1070989137, _
"Library:=", "", _
"LibLocation:=", "Project", _
Array("NAME:PinDef", _
"Pin:=", Array ("newpin0", _
0.00254, _ 0, _
0, _
"N",_
0, _
0.00254, _
false, _
0, _
true, _
"",_

Definition Manager Script Commands 25-167


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

false, _
false)), _
Array("NAME:PinDef", _
"Pin:=", Array ("newpin1", _
-0.00254, _
0, _
3.14159265358979, _
"N",_
0, _
0.00254, _
false, _
0, _
true, _
"",_
false, _
false)),
Array("NAME:Graphics", _
"Rect:=", Array(0, _
0, _
12566272, _

Definition Manager Script Commands 25-168


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

0, _
4.33680868994202e-019, _
-0.000635, _
0.00508, _
0.002794), _
"Circle:=", Array(0, _
0, _
12566272, _
0.000127, _
0.000635, _
0.000635)))

BringToFront [symbol manager]


Use: Changes the drawing for the symbol so that the specified objects are drawn on top of other overlapping objects.
Command: Draw > Bring To Front
Syntax: BringToFront Array("NAME:Selections", "Selections:=", Array (<Object>, <Object>, ...))
Return Value: None
Parameters: <Object>
<string> // object to bring to the front
VB Example:
oDefinitionEditor.BringToFront Array("NAME:Selections", "Selections:=", Array( "SchObj@10"))

Definition Manager Script Commands 25-169


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Edit [deprecated]
Deprecated command — please use EditWithComps.
EditWithComps [symbol manager]
Use: Edit an existing symbol.
Command: None
Syntax: EditWithComps <SymbolName>,
Array("NAME:<NewSymbolName>",
"ModTime:=", <ModifiedTimeInfo>,
"Library:=", <string>, // Library name
"LibLocation:=", <string>, // Project Location
<PinDefInfo>,
<PinDefInfo>,... // optional, to define pins
<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.

Definition Manager Script Commands 25-170


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

// 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
<real>, // line length

Definition Manager Script Commands 25-171


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<bool>, // mirrored
<int>, // color
<bool>, // true if visible, false if not
<string>, // hidden net name
<OptionalPinInfo>, // optional info
<PropDisplayMapInfo>)) // optional

<PinType>:
<string> // "N" : normal pin
// "I" : input pin
// "O" : output pin

<OptionalPinInfo>:
// Specify both or neither
<bool>, // true if name is to be shown
<bool>, // true if number is to be shown

<PropDisplayMapInfo>:
Array("NAME:PropDisplayMap",
<PropDisplayInfo>,

Definition Manager Script Commands 25-172


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<PropDisplayInfo>,...)

<PropDisplayInfo>:
<NameString>, Array(<DisplayTypeInfo>,
<DisplayLocationInfo>,
<int>, // optional, level number
<TextInfo>)

<NameString>:
<string> // PropertyName:=, where PropertyName is the name of
// the property to be displayed

<DisplayTypeInfo>:
<int> // 0 : No display
// 1 : Display name only
// 2 : Display value only
// 3 : Display both name and value
// 4: Display evaluated value only
// 5: Display both name and evaluated value

<DisplayLocationInfo>:

Definition Manager Script Commands 25-173


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<int> // 0 : Left
// 1 : Top
// 2 : Right
// 3 : Bottom
// 4 : Center
// 5 : Custom placement

<GraphicsDataInfo>:
Array("NAME:Graphics",
// one or more of the following
<RectInfo>,
<CircleInfo>,
<ArcInfo>,
<LineInfo>,
<PolygonInfo>,
<TextInfo>,
<ImageInfo>)

<RectInfo>:
"Rect:=", Array(<real>, // line width

Definition Manager Script Commands 25-174


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<int>, // fill pattern


<int>, // color
<real>, // angle, in radians
<real>, // x position of center
<real>, // y position of center
<real>, // width
< real>) // height

<CircleInfo>:
"Circle:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>) // radius

<ArcInfo>:
"Arc:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<real>, // x position of center

Definition Manager Script Commands 25-175


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<real>, // y position of center


< real>, // radius
<real>, // start angle, in radians
<end>) // end angle, in radians

<LineInfo>:
"Line:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<PointInfo>, // must specify at least 2 points
<PointInfo>...)
<PointInfo>:
<real>, // x position
<real> // y position

<PolygonInfo>:
"Polygon:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<PointInfo>, // must specify at least 3 points

Definition Manager Script Commands 25-176


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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

Definition Manager Script Commands 25-177


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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

<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.

Definition Manager Script Commands 25-178


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Example:
Dim nam
oSymbolManager.EditWithComps _
("Nexxim Circuit Elements\Distributed\Distributed:bendo", _
Array("NAME:bendo new name", _
"ModTime:=", 1152722165, _
"Library:=", "Nexxim Circuit Elements\Distributed\Distributed", _
"LibLocation:=", "SysLibrary", _
Array("NAME:PinDef", _
"Pin:=", Array( "n1", _
-0.00254, _
0.00254, _
0, _
"N", _
0, _
0, _
false, _
0, _
true, _
"", _
false, _

Definition Manager Script Commands 25-179


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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), _

Definition Manager Script Commands 25-180


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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>,

Definition Manager Script Commands 25-181


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<SymbolName>...),
<LibraryLocation>
Return Value: None
Parameters: <LibraryName>:
<string> // name of the library

<SymbolName>:
<string> // composite name of symbol to export

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

VB Example:
oSymbolManager.Export _
Array("NAME Nexxim Circuit Elements\Distributed\Distributed:bendo:mylib", _ "mySymbol"), "Per-
sonalLib"
GetData [symbol manager]
Use: Gets data that describes the definition.
Command: None
Syntax: GetData(<DefinitionName>)

Definition Manager Script Commands 25-182


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value: <DefinitionData> This is an array of data for the definition.


Parameters: <DefinitionName>:
<string> // composite name of the definition to edit
VB Example:
Dim symbolData
symbolData = oSymbolManager.GetData("Nexxim Circuit Elements\Hspice:nexx_bjt_npn")

Note:

GetData allows the user to access definition information, make modifications, and then use the Edit or EditWithComps
script commands to save the modified definition. Accordingly, for each type of definition, the array data returned to
GetData should be the same array information that is supplied to the Edit or EditWithComps commands.

GetNames [symbol manager]


Use: Returns the names of the symbols (used and unused) in a design. The following script command, IsUsed, can then be used to
separate used and unused symbols.
Command: None
Syntax: GetNames()
Return Value: An array of strings
Parameters: None
VB Example:
Dim symbolNames
symbolNames = oSymbolManager.GetNames()

Definition Manager Script Commands 25-183


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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>,
<LibraryLocation>
Return Value: None
Parameters: <SymbolName>:
<string> // composite name of the symbol to remove

<IsProjectSymbol>:

Definition Manager Script Commands 25-184


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<bool>

<LibraryName>:
<string> // name of the library

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

VB Example:
oSymbolManager.Remove "Nexxim Circuit Elements\Distributed\Distributed:bendo", true, "Project"

RemoveUnused [symbol manager]


Use: Removes symbols that are not used in the design.
Command: Project->Remove Unused Definitions is similar but operates slightly different and does not record script commands.
Syntax: RemoveUnused()
Return Value: <bool> True if one or more symbols are removed.
Parameters: None
VB Example:
Dim removedDefs
removedDefs = oSymbolManager.RemoveUnused()

Definition Manager Script Commands 25-185


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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.

Add [footprint manager]


Use: Add a footprint
Command: Tools > Edit Configured Libraries > Footprints > Add Footprint
Syntax: Add Array("NAME:<FootprintName>,
"ModTime:=", <ModifiedOnInfo>,
"Library:=", "",
"LibLocation:=", "Project",
"OkayToMirror:=", <bool>,
"DefUnits:=", <UnitType>,
Array(NAME:Lyrs",
"Layer:=", <LayerArray>,
"Layer:=", <LayerArray>…,
"SLayer:=", <StackupLayerArray>,

Definition Manager Script Commands 25-186


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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.

Definition Manager Script Commands 25-187


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<UnitType>:
<string> // default length units to use if units are not specified in other
// parameters

<LayerArray>:
Array("N:=", <string>, // layer name
"ID:=", <int> ,
"T:=", <LayerTypeInfo>, // layer type
"TB:=", <TopBottomInfo>,
"Col:=", <int>, // optional - color
"Pat:=", <int>, // optional - fill pattern
"Vis:=", <bool>, // optional - are objects on layer visible
"Sel:=", <bool>, // optional - are objects on layer selectable
"L:=", <bool>) // optional
// are objects on layer locked (can't be edited)

<LayerTypeInfo>:
<string> // one of: signal, dielectric, metalized signal, assembly, silkscreen, soldermask, solderpaste, glue, or user

Definition Manager Script Commands 25-188


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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
// "edit" - manual edit
// "none"

<Dimension>:
<string> // real number, may include units

<MaterialInfo>:

Definition Manager Script Commands 25-189


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<string> // name of the layer material

<ToleranceArray>:
Array(<real>, // distance tolerance
<real>, // angle tolerance (radians)
<real>) // dimensionless tolerance

<PrimitivesInfo>:
Array("NAME:Prims",
// one or more of the following
<RectInfo>,
<CircleInfo>,
<ArcInfo>,
<LineInfo>,
<PolygonInfo>,
<TextInfo>,
<ImageInfo>)

<RectInfo>:
"Rect:=", Array(<real>, // line width

Definition Manager Script Commands 25-190


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<int>, // fill pattern


<int>, // color
<real>, // angle, in radians
<real>, // x position of center
<real>, // y position of center
<real>, // width
< real>) // height

<CircleInfo>:
"Circle:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>) // radius

<ArcInfo>:
"Arc:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<real>, // x position of center

Definition Manager Script Commands 25-191


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<real>, // y position of center


< real>, // radius
<real>, // start angle, in radians
<end>) // end angle, in radians

<LineInfo>:
"Line:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<PointInfo>, // must specify at least 2 points
<PointInfo>...)
<PointInfo>:
<real>, // x position
<real> // y position

<PolygonInfo>:
"Polygon:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<PointInfo>, // must specify at least 3 points

Definition Manager Script Commands 25-192


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<PointInfo>...)

<TextInfo>:
"Text:=", Array(<real>, // x position
<real>, // y position
<real>, // angle, in radians
<Justification>,
<bool>, // is plotter font
<string>, // font name
<int>, // color
<string>) // text string
<Justification>: <int>
// 0 : left top
// 1 : left base
// 2 : left bottom
// 3 : center top
// 4 : center base
// 5 : center bottom
// 6 : right top
// 7 : right base
// 8 : right bottom

Definition Manager Script Commands 25-193


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<ImageInfo>:
"Image:=", Array(<RectInfo>,
<ImageData>,
<bool>) // is mirrored

<ImageData>:
<string>, // file path
<int>, // 0 : use the file path and link to it
// 1 : ignore file path and use next parameter
<string> // text data, only present if preceding int is 1

<PinsInfo>:
Array("NAME:Pins",
"P:=", <PinArray>,
"P:=", <PinArray>,...)

<PinArray>:
Array("Port:=", Array("Id:=", <int>,
"Clr:=", <real>, // optional - clearance

Definition Manager Script Commands 25-194


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"N:=", <string>), // pin name


"Pos:=", Array("x:=", <Location>, // padstack (x,y) position
"y:=", <Location>),
"VRt:=", <Angle>, // optional - rotation
"HD:=", <Size>, // optional - hole diameter
<PadstackImplementationInfo>)

<Location>:
<string> specifying real number and units (may use variables)

<Angle>:
<string> specifying angle with a real number and units

<Size>:
<string> specifying size with a real number and units

<PadstackImplementationInfo>:
If another with the same implementation has already been specified:
"Ref:=", <int> // id of the other
If not:
"Ref:=", <string>, // name

Definition Manager Script Commands 25-195


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Frm:=", <int>, // id of highest layer


"To:=", <int>, // id of lowest layer
<LayerPlacementInfo>,
"Man:=", <int>, // optional, 1 if manually placed, 0 if not (default)
"Use:=", Array(<PadUseInfo>, <PadUseInfo>…) // array may be empty

<LayerPlacementInfo>:
"Lyr:=", Array("Mrg:=", <int>, // optional,
// 1 if all layers have been merged (default)
// 0 if layer are not merged
"Flp:=", <int>, // optional,
// 1 if placed bottom up
// 0 if not (default)
"Map:=", <ParentToLocalLayerInfo>)

<ParentToLocalLayerInfo>:
Array("U:=", <DirectionOfUniqueness>,
"F:=", Array(<int>, <int>, …), // forward mapping
// -1 is not mapped
"B:=", Array(<int>, <int>, …)) // backward mapping

Definition Manager Script Commands 25-196


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

// -1 is not mapped

<PadUseInfo>:
"Pad:=", Array("Lid:=", <int>, // layer id
"T:=", <string>, // type : "connected", "thermal",
// "no_pad, "not_connected",
// or "not_connected_thermal"
"Man:=", <int>) // optional, 1 if manually placed
// 0 if not (default)

<DirectionOfUniqueness>:
<string> // one of "forward", "backward", or "two ways"

<ViasInfo>:
Array("NAME:Vias", <ViaInfo>, <ViaInfo>…)

<ViaInfo>:
"V:=", Array("Id:=", <int>,
"N:=", <string>, // name
"Pos:=", Array("x:=", <Location>, // via (x,y) position
"y:=", <Location>),

Definition Manager Script Commands 25-197


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"VRt:=", <Angle>, // optional - rotation


<ImplementationInfo>

<EdgeportsInfo>:
Array("NAME:EPorts", <EdgePortArray>, <EdgePortArray>…)

<EdgePortArray>:
Array("NAME:EP",
"LP:=", Array("Id:=", <int>, // port id
"N:=", <string>), // port name
"Eo:=", Array(<edge description>, <edge description>,...))

<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

Definition Manager Script Commands 25-198


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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)

<ComponentPropertyInfo>:
Array("NAME:CProps",
"VariableProp:=", <VariableInfo>,

Definition Manager Script Commands 25-199


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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:=", "", _

Definition Manager Script Commands 25-200


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"LibLocation:=", "Project", _
"OkayToMirror:=", false, _
"DefUnits:=", "mm", _
Array("NAME:Lyrs", _
"Layer:=", Array("N:=", "Measures", _
"ID:=", 8, _
"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", _

Definition Manager Script Commands 25-201


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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, _
"Pat:=", 6), _
SLayer:=", Array("Layer:=", Array("N:=", "Cover", _
"ID:=", 12, _
"T:=", "metalizedsignal", _
"Col:=", 32639, _

Definition Manager Script Commands 25-202


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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), _

Definition Manager Script Commands 25-203


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Elev:=", "mid", _
"SubL:=", Array("Th:=", "0mm", _
"LElev:=", "78.740157480315mil", _
"R:=", "0mm", _
"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), _

Definition Manager Script Commands 25-204


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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", _
"Mat:=", "")), _
"SLayer:=", Array("Layer:=", Array("N:=", "Ground", _
"ID:=", 9, _
"T:=", "metalizedsignal", _
"Col:=", 4144959, _
"Pat:=", 6), _
"Elev:=", "mid", _

Definition Manager Script Commands 25-205


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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", _

Definition Manager Script Commands 25-206


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"h:=", "W", _
"Vds:=", Array())), _
Array("NAME:Pins",
"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"),_

Definition Manager Script Commands 25-207


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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"),_
"HD:=", "1mm", _
"Ref:=", 5)), _
Array("NAME:Nets"), _
Array("NAME:CProps",
"VariableProp:=", Array("W", _
"UD", _
"", _
"1.5mm"),_

Definition Manager Script Commands 25-208


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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>,

Definition Manager Script Commands 25-209


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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
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>:

Definition Manager Script Commands 25-210


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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>:
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)

Definition Manager Script Commands 25-211


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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
// "edit" - manual edit

Definition Manager Script Commands 25-212


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

// "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>,

Definition Manager Script Commands 25-213


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<TextInfo>,
<ImageInfo>)

<RectInfo>:
"Rect:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // angle, in radians
<real>, // x position of center
<real>, // y position of center
<real>, // width
< real>) // height

<CircleInfo>:
"Circle:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>) // radius

Definition Manager Script Commands 25-214


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<ArcInfo>:
"Arc:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>, // radius
<real>, // start angle, in radians
<end>) // end angle, in radians

<LineInfo>:
"Line:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<PointInfo>, // must specify at least 2 points
<PointInfo>...)
<PointInfo>:
<real>, // x position
<real> // y position

Definition Manager Script Commands 25-215


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<PolygonInfo>:
"Polygon:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<PointInfo>, // must specify at least 3 points
<PointInfo>...)

<TextInfo>:
"Text:=", Array(<real>, // x position
<real>, // y position
<real>, // angle, in radians
<Justification>,
<bool>, // is plotter font
<string>, // font name
<int>, // color
<string>) // text string
<Justification>: <int>
// 0 : left top
// 1 : left base
// 2 : left bottom

Definition Manager Script Commands 25-216


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

// 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

<PinsInfo>:
Array("NAME:Pins",
"P:=", <PinArray>,

Definition Manager Script Commands 25-217


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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>:
<string> specifying angle with a real number and units

<Size>:
<string> specifying size with a real number and units

Definition Manager Script Commands 25-218


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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>)

Definition Manager Script Commands 25-219


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<ParentToLocalLayerInfo>:
Array("U:=", <DirectionOfUniqueness>,
"F:=", Array(<int>, <int>, …), // forward mapping
// -1 is not mapped
"B:=", Array(<int>, <int>, …)) // backward mapping
// -1 is not mapped

<PadUseInfo>:
"Pad:=", Array("Lid:=", <int>, // layer id
"T:=", <string>, // type : "connected", "thermal",
// "no_pad, "not_connected",
// 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>…)

Definition Manager Script Commands 25-220


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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
"N:=", <string>), // port name
"Eo:=", Array(<edge description>, <edge description>,...))

<edgedescription> for primitive edges

"et:=", "pe", "pr:=", <id>, "ei:=", <edge#>

Definition Manager Script Commands 25-221


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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)

Definition Manager Script Commands 25-222


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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

<ListOfComponentNames>:

Definition Manager Script Commands 25-223


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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, _
"Library:=", "Nexxim Circuit Elements\Distributed\Distributed", _
"LibLocation:=", "SysLibrary", _
Array("NAME:PinDef", _
"Pin:=", Array( "n1", _
-0.00254, _
0.00254, _
0, _
"N", _

Definition Manager Script Commands 25-224


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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, _

Definition Manager Script Commands 25-225


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

false)), _
Array("NAME:Graphics", _
"Polygon:=", Array( 0, 0, 12566272, 0, 0.00381, 0, .00127, 0.00127, _
0.00127, 0.00127, 0, 0.00381, 0, 0.00381, _
0.002032, 0.00127, 0.00381), _
"Line:=", Array(0, 1, 12566272, -0.00254, 0.00254, 0, .00254), _
"Line:=", Array(0, 1, 12566272, 0.00254, -0.00254, .00254, 0)), _
Array("NAME:PropDisplayMap", _
"W:=", Array(3, _
5, _
0, _
"Text:=", Array( 2.1684E-019, _
0.00504119, _
0, _
1, _
5, _
false, _
"Arial", _
0, _
"W=***"))))), _

Definition Manager Script Commands 25-226


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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>:
<string> // name of the library

<FootprintName>:
<string> // composite name of footprint to export

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

VB Example:
oFootprintManager.Export Array("NAME:mylib", "Distributed Footprints:BPAD"), "PersonalLib"

Definition Manager Script Commands 25-227


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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 Elements\Distributed\Nexxim_Foot-
prints:MCPL13_Nexx")

Note:

GetData allows the user to access definition information, make modifications, and then use the Edit or EditWithComps
script commands to save the modified definition. Accordingly, for each type of definition, the array data returned to GetData
should be the same array information that is supplied to the Edit or EditWithComps commands.

GetNames [footprint manager]


Use: Returns the names of the footprints (used and unused) in a design. The following script command, IsUsed, can then be used to
separate used and unused footprints.
Command: None

Definition Manager Script Commands 25-228


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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>,

Definition Manager Script Commands 25-229


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<LibraryName>,
<LibraryLocation>
Return Value: None
Parameters: <FootprintName>:
<string> // composite name of the footprint to remove

<IsProjectFootprint>:
<bool>

<LibraryName>:
<string> // name of the library

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

VB Example:
oFootprintManager.Remove "BPAD", true, "Distributed Footprints", "Project"
oFootprintManager.Remove "BPAD", false, "MyLib", "PersonalLib"

Definition Manager Script Commands 25-230


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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()

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.

Add [padstack manager]


Use: Add a padstack
Command: Tools > Edit Configured Libraries > Padstacks > Add Padstack
Syntax: Add Array("NAME:<PadstackName>",
"ModTime:=", <ModifiedOnInfo>,

Definition Manager Script Commands 25-231


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Library:=", "", // name of the library


"LibLocation:=", "Project", // location of the named library
Array("NAME:psd",
"nam:= ", <PadstackName>,
"lib:=", "", // name of the library
"mat:=", "", // hole plating material
"plt:=", "0", // percent of hole's radius filled by plating
Array("NAME:pds",
<LayerGeometryArray>,
<LayerGeometryArray....),
"hle:=", <PadInfo>
"hRg:=", <HoleRange>,
"sbsh:=", <SolderballShape>,
"sbpl:=", <SolderballPlacement>,
"sbr:=", <string>, // solderball diameter, real with units
"sb2:=", <string>, // solderball mid diameter, real with units
"sbn:=", <string>), // name of solderball material
"ppl:=", <PadPortLayerArray>)
Return Value: simple name of the added padstack
// If the name requested conflicts with the name of an existing

Definition Manager Script Commands 25-232


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

// 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 25-233


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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

Definition Manager Script Commands 25-234


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<DimensionArray>:
Array(<string>, ...) // each string is a real with units for one of the dimensions of the shape

<DirectionString>:
<string> one of these choices
"No" // no direction
"Any" // any direction
"0" // 0 degrees
"45" // 45 degrees
"90" // 90 degrees
"135" // 135 degrees
"180" // 180 degrees
"225" // 225 degrees
"270" // 270 degrees
"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

Definition Manager Script Commands 25-235


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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:=", _


"", "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:=", _

Definition Manager Script Commands 25-236


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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:=", _
"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:=", _

Definition Manager Script Commands 25-237


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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

Definition Manager Script Commands 25-238


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:pds",
<LayerGeometryArray>,
<LayerGeometryArray....),
"hle:=", <PadInfo>
"hRg:=", <HoleRange>,
"sbsh:=", <SolderballShape>,
"sbpl:=", <SolderballPlacement>,
"sbr:=", <string>, // solderball diameter, real with units
"sb2:=", <string>, // solderball mid diameter, real with units
"sbn:=", <string>), // name of solderball material
"ppl:=", <PadPortLayerArray>)
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

Definition Manager Script Commands 25-239


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.

<LayerGeometryArray>:
Array("Name:lgm",
"lay:=", <string>, // definition layer name
"id:=", <int>, // definition layer id
"pad:=", <PadInfo>, // pad
"ant:=", <PadInfo>, // antipad
"thm:=", <PadInfo>, // themal pad
"X:=", <string>, // pad x connection, real with units
"Y:=", <string>, // pad y connection, real with units
"dir:=", <DirectionString>) // pad connection direction

<PadInfo>:
Array("shp:=", <PadShape>,
"Szs:=", <DimensionArray>,
"X:=", <string>, // x offset, real with units

Definition Manager Script Commands 25-240


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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

Definition Manager Script Commands 25-241


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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>:

Definition Manager Script Commands 25-242


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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.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:=", _

Definition Manager Script Commands 25-243


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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:=", _
"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:=",
_

Definition Manager Script Commands 25-244


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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>,

Definition Manager Script Commands 25-245


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<LayerGeometryArray....),
"hle:=", <PadInfo>
"hRg:=", <HoleRange>,
"sbsh:=", <SolderballShape>,
"sbpl:=", <SolderballPlacement>,
"sbr:=", <string>, // solderball diameter, real with units
"sb2:=", <string>, // solderball mid diameter, real with units
"sbn:=", <string>), // name of solderball material
"ppl:=", <PadPortLayerArray>,
Array(<ListOfComponentNames>) // Component names

Return Value: <string>


// 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

Definition Manager Script Commands 25-246


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<NewPadstackName>:
<string> // new simple name for the padstack

<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.

<LayerGeometryArray>:
Array("Name:lgm",
"lay:=", <string>, // definition layer name
"id:=", <int>, // definition layer id
"pad:=", <PadInfo>, // pad
"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>,

Definition Manager Script Commands 25-247


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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 25-248


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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

Definition Manager Script Commands 25-249


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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

<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.

Definition Manager Script Commands 25-250


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", "0mm", "dir:=", "Any"), Array("NAME:lgm",
"lay:=", _
"SignalB", "id:=", 2, "pad:=", Array("shp:=", "Cir", "Szs:=", Array("2mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir", "Szs:=", Array( _
"3mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0deg"), "thm:=", Array("shp:=", "No", "Szs:=", Array
(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", "0mm", "dir:=", "Any"), Array("NAME:lgm",
"lay:=", _

Definition Manager Script Commands 25-251


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Ground", "id:=", 3, "pad:=", Array("shp:=", "No", "Szs:=", Array(), "X:=", _


"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "No", "Szs:=", Array(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array("shp:=", "R90", "Szs:=", Array( _
"3mm", "0.75mm", "1mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", _
"0mm", "dir:=", "Any"), Array("NAME:lgm", "lay:=", "Bottom signal", "id:=", 5, "pad:=", Array
("shp:=", _
"Cir", "Szs:=", Array("1mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=",
_
"Cir", "Szs:=", Array("2mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0deg"), "thm:=", Array("shp:=",
_
"No", "Szs:=", Array(), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", _
"0mm", "dir:=", "Any")), "hle:=", Array("shp:=", "Cir", "Szs:=", Array("1.5mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "hRg:=", "End", "sbsh:=", "Sph", "sbpl:=", _
"abv", "sbr:=", "750um", "sb2:=", "1200um", "1200um", "sbn:=", "solder"), "ppl:=", Array( _
0, 1, 2, 3, 5), Array("")
Export [padstack manager]
Use: Export a padstack to a library
Command: Tools > Edit Configured Libraries > Padstacks > Export to Library
Syntax: Export Array("NAME:<LibraryName>",
<PadstackName>,
<PadstackName>...),

Definition Manager Script Commands 25-252


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<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"), "PersonalLib"
GetData [padstack manager]
Use: Gets data that describes the definition.
Command: None
Syntax: GetData(<DefinitionName>)
Return Value: <DefinitionData> This is an array of data for the definition.
Parameters: <DefinitionName>:
<string> // composite name of the definition to edit

Definition Manager Script Commands 25-253


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Example:
Dim padstackData
padstackData = oPadstackManager.GetData("NoPad SMT East")

Note:

GetData allows the user to access definition information, make modifications, and then use the Edit or EditWithComps
script commands to save the modified definition. Accordingly, for each type of definition, the array data returned to GetData
should be the same array information that is supplied to the Edit or EditWithComps commands.

GetNames [padstack manager]


Use: Returns the names of the padstack (used and unused) in a design. The following script command, IsUsed, can then be used to
separate used and unused padstacks.
Command: None
Syntax: GetNames()
Return Value: An array of strings
Parameters: None
VB Example:
Dim padstackNames
padstackNames = oPadstackManager.GetNames()
IsUsed [padstack manager]
Use: Used to determine if a component is used in the design.

Definition Manager Script Commands 25-254


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Command: None
Syntax: IsUsed(<PadstackName>)
Return Value: <Boolean> // true if the specified padstack is used in the design
Parameters: <PadstackName>:
<string>
VB Example:
Dim isUsed
isUsed = oPadstackManager.IsUsed("MyPadstack")
Remove [padstack manager]
Use: Removes a padstack from a library
Command: Tools > Edit Configured Libraries > Padstacks > Remove Padstacks
Syntax: Remove <PadstackName>,
<IsProjectPadstack>,
<LibraryName>,
<LibraryLocation>
Return Value: None
Parameters: <PadstackName>:
<string> // simple name of the padstack to remove

<IsProjectPadstack>:
<bool>

Definition Manager Script Commands 25-255


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<LibraryName>:
<string> // name of the library

<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"

VB Example:

oPadstackManager.Remove "Polygon SMT", true, "Padstacks", "Project"


oPadstackManager.Remove "Polygon SMT", false, "MyLib", "PersonalLib"
RemoveUnused [padstack manager]
Use: Removes padstacks that are not used in the design.
Command: Project->Remove Unused Definitions is similar but operates slightly different and does not record script commands.
Syntax: RemoveUnused()
Return Value: <bool> True if one or more padstacks are removed.
Parameters: None
VB Example:
Dim removedDefs
removedDefs = oPadstackManager.RemoveUnused()

Definition Manager Script Commands 25-256


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Note:

The order of calls to RemoveUnused is significant. As a result, removing definitions in an unordered fashion may cause
other padstacks in dependent definitions to be rendered unusable.

Script and Library Scripts


The definition manager provides access to materials in a project. The manager object is accessed via the definition manager.
Set oDefinitionManager = oProject.GetDefinitionManager()
The script and library script commands are listed below.
AddScript
EditScript
ExportScript
RemoveScript
ModifyLibraries
AddScript
Adds a script to the definition manager.

UI Access N/A

Name Type Description


<AddScriptArray> Array Structured array.
Parameters
Array("NAME:<string script name>",
"ScriptLang:=", <string "vbscript" or "javascript">

Definition Manager Script Commands 25-257


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"ScriptText:=, <string text of script>)

Return Value None.

Python Syntax AddScript(<AddScriptArray>)


oDefinitionManager.AddScript(
["NAME:MyScript",
"ScriptLang:=", "vbscript",
Python Example
"ScriptText:=", "MsgBox(\"HelloWorld\")"
]
)

VB Syntax AddScript <AddScriptArray>


oDefinitionManager.AddScript Array("NAME:MyScript", "ScriptLang:=", "vbscript",
VB Example
"ScriptText:=", "MsgBox(""HelloWorld"")")

EditScript
Edits a script in the definition manager.

UI Access N/A

Parameters Name Type Description

Definition Manager Script Commands 25-258


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<OriginalName> String Name of the script to be edited.


<EditScriptArray> Array Structured array.
Array("NAME:<string script name>",
"ScriptLang:=", <string "vbscript" or "javascript">
"ScriptText:=, <string text of script>)

Return Value None.

Python Syntax EditScript(<OriginalName>, <EditScriptArray>)


oDefinitionManager.EditScript("MyScript",
["NAME:MyNewScript",
"ScriptLang:=", "vbscript",
Python Example
"ScriptText:=", "MsgBox(\"HelloAgain\")"
]
)

VB Syntax EditScript <OriginalName> <EditScriptArray>


oDefinitionManager.EditScript "MyScript" Array("NAME:MyNewScript",
VB Example
"ScriptLang:=", "vbscript", "ScriptText:=", "MsgBox(""HelloAgain"")")

ExportScript
Use: Export to Library in the script definition manager

Definition Manager Script Commands 25-259


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Command: None
Syntax: ExportScript <ExportData>,<Library location>
Return Value: None
Parameters: <ExportData>
Array("NAME:<LibraryName>",<ScriptName>,<ScriptName>,…)
VB Example:
oProject.ExportComponent Array("NAME:mylib", "myscript"), "PersonalLib"

Python Syntax ExportScript( <ExportData>,<Library location>)


oProject.ExportComponent
Python 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>

Definition Manager Script Commands 25-260


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<LibraryName>
Type: <string>
<LibraryLocation>
Type: <string>
VB Example:
oDefinitionManager.RemoveScript "myscript", true, "Local", "Project"

Python Syntax RemoveScript (<ScriptName>,<IsProjectScript>, <LibraryName>,<LibraryLocation>)


oDefinitionManager.RemoveScript(
Python Example
"myscript", true, "Local", "Project")

ModifyLibraries
Use: Configure Libraries on the Tools menu
Command: None
Syntax: ModifyLibraries <DesignName>,Array(<ConfigLibArray>)
Return Value: None
Parameters: <DesignName>
Type: <string>
<ConfigLibArray>
Array("NAME:<LibraryType>,<ConfiguredLib>,<ConfiguredLib>,…),…
<ConfiguredLib> // blank to leave unchanged
<DefinitionType>

Definition Manager Script Commands 25-261


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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 Syntax ModifyLibraries (<DesignName>,[<ConfigLibArray>])


oDefinitionManager.ModifyLibraries(
"MyCircuit", _
["NAME:PersonalLib"], _
["NAME:UserLib"], _
Python Example
["NAME:SystemLib", _
"Symbols:=", [ "Circuit Elements", "Symbols",_
"ParamExtraElements\PE_Symbols", _
"Vendor Elements\Nonlinear"]])

Definition Manager Script Commands 25-262


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

26 - Definition Editor Script Commands


The Definition Editor controls the use of materials and scripts in a project. Symbol editor script commands 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:
Also refer to the following subtopics:
Symbol Editor Scripts

Symbol Editor Scripts


Symbol editor script commands are accessed with a definition editor.
Set oDefinitionEditor = oProject.SetActiveDefinitionEditor("SymbolEditor", "MySymbol")
The symbol editor script commands are listed below.
AddLevel (Symbol Editor)
AlignHorizontal (Symbol Editor)
AlignVertical (Symbol Editor)
" BringToFront (Symbol Editor)" on page 26-6
ChangeProperty (Symbol Editor)
CloseEditor (Symbol Editor)
CreateArc (Symbol Editor)

Definition Editor Script Commands 26-1


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

CreateCircle (Symbol Editor)


CreateImage (Symbol Editor)
CreateLine (Symbol Editor)
CreatePin (Symbol Editor)
CreatePolygon (Symbol Editor)
CreateRectangle (Symbol Editor)
CreateText (Symbol Editor)
Cut (Symbol Editor)
Delete (Symbol Editor)
DisplayPinNames (Symbol Editor)
ExportFile (Symbol Editor)
FlipHorizontal (Symbol Editor)
FlipVertical (Symbol Editor)
GetProperties (Symbol Editor)
GetPropertyValue (Symbol Editor)
GetVisibleLevels (Symbol Editor)
GridSetup (Symbol Editor)
Move (Symbol Editor)
Pan (Symbol Editor)
Paste (Symbol Editor)

Definition Editor Script Commands 26-2


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Redo (Symbol Editor)


RemoveLevels (Symbol Editor)
RemovePort (Symbol Editor)
Rotate (Symbol Editor)
Save (Symbol Editor)
SelectAll (Symbol Editor)
SendToBack (Symbol Editor)
SetActivelLevel (Symbol Editor)
SetInitialLevels (Symbol Editor)
SetPropertyValue (Symbol Editor)
SetVisibleLevels (Symbol Editor)
ToggleLevel (Symbol Editor)
Undo (Symbol Editor)
ZoomArea (Symbol Editor)
ZoomIn (Symbol Editor)
ZoomOut (Symbol Editor)
ZoomPrevious (Symbol Editor)
ZoomToFit (Symbol Editor)
AddLevel (Symbol Editor)
To add a graphics level to the symbol.
Command:Add Level in the View>Levels dialog.

Definition Editor Script Commands 26-3


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Syntax: AddLevel <level>


Return Value: Integer, the previous active level. The current active level is the newly added level.
Parameters: <level>
Type: Integer
The new level, an integer greater than 1.
Example: Dim oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor", _
"Simplorer Elements\basic Elements\Circuit\Passive Elements:R")
oldLevel = oSymbolEditor.AddLevel(4)
AlignHorizontal (Symbol Editor)
Align items horizontally
Syntax: AlignHorizontal(
Array("NAME:Selections", _
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify)),
Array("NAME:AlignParameters", _
"Disconnect:=", bool _ // [Opt=0] Should wires disconnect
"Rubberband:=", bool) _ // [Opt=1] Should wires staircase
// Note: Alignment occurs relative to the first item in ids

Definition Editor Script Commands 26-4


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax AlignHorizontal (["NAME:Selections", "Selections:=", [<selections>]], 0)


oSymbolEditor = oProject.SetActiveDefinitionEditor("Symbol-
Editor", _
"Simplorer Elements\basic Elements\Circuit\PassiveElements:R")
Python Example
oSymbolEditor.AlignHorizontal (["NAME:Selections",_
"Selections:=", ["SchObj@11"]], 0)

AlignVertical (Symbol Editor)


Align items vertically
Syntax: AlignVertical(
Array("NAME:Selections", _
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify)),
Array("NAME:AlignParameters", _
"Disconnect:=", bool _ // [Opt=0] Should wires disconnect
"Rubberband:=", bool) _ // [Opt=1] Should wires staircase
// Note: Alignment occurs relative
to the first item in ids

Python Syn- AlignVertical (["NAME:Selections", "Selections:=", [<selections>]], 0)


tax

Python oSymbolEditor = oProject.SetActiveDefinitionEditor("Symbol-


Editor", _
Example

Definition Editor Script Commands 26-5


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Simplorer Elements\basic Elements\Circuit\PassiveElements:R")


oSymbolEditor.AlignVertical (["NAME:Selections","Selections:=", ["SchObj@11"]], 0)

BringToFront (Symbol Editor)


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: <stri<Object>
<string> // object to bring to the front
Example:
oDefinitionEditor.BringToFront Array("NAME:Selections", "Selections:=", Array( "SchObj@10"))
ChangeProperty (Symbol Editor)
Use: Changes to properties are scripted using the ChangeProperty command. This command can be executed by the oEditor to
change editor properties, by the oDesign to change design level properties, and by the oProject to change project level properties.
The command can be used to create, edit, and/or remove properties. In Circuit, only Variable and Separator properties can be
deleted.
Command: None
Syntax: ChangeProperty Array("Name:AllTabs", <PropTabArray>, <PropTabArray>, ...)
Return Value: None
Parameters: <PropTabArray>
Array("Name:<PropTab>",

Definition Editor Script Commands 26-6


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<PropServersArray>,
<NewPropsArray>,
<ChangedPropsArray>,
<DeletedPropsArray>)

<PropServersArray>
Array("Name:PropServers", <PropServer>,
<PropServer>, ...)

<NewPropsArray>
Array("Name:NewProps", <PropDataArray>,
<PropDataArray>,...)

<ChangedPropsArray>
Array("Name:ChangedProps",<PropDataArray>,
<PropDataArray>, ...)

<DeletedPropsArray>
Array("Name:DeletedProps", <PropName>,
<PropName>, ...)
OR (for PropDisplay deletions only)

Definition Editor Script Commands 26-7


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("Name:DeletedProps",<PropDataArray>,
<PropDataArray>, ...)

<PropDataArray>
Array("NAME:<PropName>",
"PropType:=", <PropType>,
"NewName:=", <string>,
"Description:=", <string>,
"Callback:=", <string>,
"NewRowPosition:=", <int>,
"ReadOnly:=", <bool>,
"Hidden:=", <bool>,
<PropTypeSpecificArgs>)OR (for PropDisplays only)
Array("Name:<PropName>",<PropDisplayData>)

<PropDisplayData>
for adding, changing, deleting PropDisplays
<PropDisplayAttributes>
for changing PropDisplays only

Definition Editor Script Commands 26-8


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<PropDisplayNewAttributes>

<PropDisplayAttributes>
Layer & Location only used for PropDisplays in layout

For adding PropDisplays, this will add a single PropDisplay with attributes as shown; if an attribute is missing, a default
value will be assigned. Adding PropDisplay to schematic with attributes that are identical to one already existing there will
fail without an error message.
For deleting PropDisplays, these attributes are used to identify an existing PropDisplay to delete. If there doesn't exist a
PropDisplay that matches the given attributes, then nothing will be deleted. If multiple PropDisplays match the given attrib-
utes, then all of them will be deleted. If an attribute is missing, then all PropDisplays match that missing attribute. For
example, if Layer is missing, then PropDisplays on all layers that match the remaining given attributes will be deleted.
For changing PropDisplays, these attributes are used to identify an existing PropDisplay to change. If no PropDisplay
matching the attributes is found, no changes will be made. If multiple PropDisplays match the attributes, all of them will be
changed. If an attribute is missing, it matches all PropDisplays. For example, to change the format of PropDisplays that are
on the bottom, but have any layer, style or format to show the name only, this command should have Location set to "Bot-
tom" and all other attributes omitted.
"Format:=", <PropDisplayType>,
"Location:=", <PropDisplayLocation>,
"Layer:=", <string>,
"Style:=", <string>

<PropDisplayNewAttributes>

NewLayer & NewLocation only used for PropDisplays in layout

Definition Editor Script Commands 26-9


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

For changing PropDisplays, these attributes are used to identify which attributes to change and what the new value is. If the
attribute should not be changed, the corresponding entry should be omitted.
"NewName:=", <string>,
"NewFormat:=", <PropDisplayType>,
"NewLocation:=", <PropDisplayLocation>,
"NewLayer:=", <string>,
"NewStyle:=", <string>

<PropDisplayType>
Type: string
Identifies the format of PropDisplay.
"Name"
"Value"
"NameAndValue"
"EvaluatedValue"
"NameAndEvaluatedValue"

<PropDisplayLocation>
Type: string
Identifies where PropDisplay is located with respect to object
"Left"

Definition Editor Script Commands 26-10


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Top"
"Right"
"Bottom"
"Custom"

<PropType>
Type: string
Identifies the type of property when a new property is added. In Circuit, only separator properties and variable properties
can be added.
"SeparatorProp"
"VariableProp"
"TextProp"
"NumberProp"
"ValueProp"
"CheckboxProp"
"MenuProp"
"PointProp"
"VPointProp"
"ButtonProp"

NewName

Definition Editor Script Commands 26-11


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Specify the new name of a property if the property’s name is being edited. In Circuit, the name can only be changed for sep-
arators and variables.

Description
Specify a description of the property. In Circuit, the description can only be changed for separators and variables.

Callback
Specify the name of the script callback to be run when the property value is changed.

NewRowPosition
Used to reorder rows in the Property dialog box. In Circuit, this only applies to the Project>Project Variables panel and the
Designer>DesignProperties panel. Specify the new zero-based row index of the variable or separator.

ReadOnly
Used to mark a property as "read only" so it can not be modified. In Circuit, this flag can only be set for variables and sep-
arators.

Hidden
Used to hide a property so it can not be viewed outside of the Property dialog box. In Circuit, this flag can only be set for vari-
ables and separators.

<PropTypeSpecificArgs>

Definition Editor Script Commands 26-12


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

SeparatorProp: no arguments
TextProp: "Value:=", <string>
NumberProp: "Value:=", <double>
ValueProp: "Value:=", <value>
CheckboxProp: "Value:=", <bool>
MenuProp: "Value:=", <string>
PointProp "X:=", <double>, "Y:=", <double>
VPointProp: "X:=", <value>, "Y:=", <value>
Material Button: "Material:=", <string>
Color Button: "R:=",<int>,"G:=",<int>,"B:=",<int>
Transparency Button: "Value:=", <double>

<PropTypeSpecificArgs> for MenuProps


Syntax for NewProps array: "AllChoices:=",
<"choice1,choice2,..."> or <Array("choice1" "choice2", ... )>,
"Value:=", <string>
Syntax for ChangedProps array: "Value:=", <string>

<PropTypeSpecificArgs> for VariableProps


Syntax:
"Value:=", <value>, <OptimizationFlagsArray>,

Definition Editor Script Commands 26-13


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

<TuningFlagsArray>, <SensitivityFlagsArray>,
<StatisticsFlagsArray>

Parameters:
<OptimizationFlagsArray>
Array("NAME:Optimization",
"Included:=", <bool>,
"Min:=", <value>,
"Max:=", <value>)

<TuningFlagsArray>
Array("NAME:Tuning",
"Included:=", <bool>,
"Step:=", <value>,
"Min:=", <value>,
"Max:=", <value>)

<SensitivityFlagsArray>
Array("NAME:Sensitivity",
"Included:=", <bool>,
"Min:=", <value>,

Definition Editor Script Commands 26-14


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Max:=", <value>,
"IDisp:=", <value> )

<StatisticsFlagsArray>
Array("NAME:Statistical",
"Included:=", <bool>,
"Dist:=", <Distribution>,
"StdD:=", <value>,
"Min:=", <value>,
"Max:=", <value>,
"Tol:=", <string>)

<Distribution>
Type: string
Value should be "Gaussian" or "Uniform"

StdD
Standard deviation.

Min
Low cut-off for the distribution.

Definition Editor Script Commands 26-15


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Max
High cut-off for the distribution.

Tol
Tolerance for uniform distributions. Format is "<int>%".
Example: "20%".

VB Example:
Adding a new project level variable "$width":
oProject.ChangeProperty Array("NAME:AllTabs",_
Array("NAME:ProjectVariableTab",_
Array("NAME:PropServers", "ProjectVariables"),_
Array("NAME:NewProps",_
Array("NAME:$width",_
"PropType:=", "VariableProp",_
"Value:=", "3mm",_
"Description:=", "my new variable"))))

VB Example: Deleting the design level variable "height":

Definition Editor Script Commands 26-16


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oDesign.ChangeProperty Array("NAME:AllTabs",_
Array("NAME:LocalVariableTab",_
Array("NAME:PropServers", "DefinitionParameters"),_
Array("NAME:DeletedProps", "height"))

Changing a property’s value. If the following command were executed, then the value of the prop-
erty "XSize" of the PropServer
"Box1:CreateBox:1" on the "Geometry3DCmdTab" tab would be changed. (oEditor is the Geometry3D
editor in Circuit.)
oEditor.ChangeProperty Array("NAME:AllTabs",_
Array("NAME:Geometry3DCmdTab",_
Array("NAME:PropServers","Box1:CreateBox:1"),_
Array("NAME:ChangedProps",_
Array("NAME:XSize", "Value:=", "1.4mil"))))

VB Example: Changing a property’s value. If the following command were executed, then the values
of Callback and L on the PassedParameterTab would be changed.

oEditor.ChangeProperty Array("NAME:AllTabs", _
Array("NAME:PassedParameterTab", _
Array("NAME:PropServers", "CHOKE2"), _
Array("NAME:ChangedProps", _
Array("NAME:L", "Callback:=", "ac", "OverridingDef:=", true), _

Definition Editor Script Commands 26-17


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:L", "Value:=", "1nH"))))

VB Example: Changing the Company Name, Design Name, the background color, and the Axis scaling in
a Report.

Set oProject = oDesktop.SetActiveProject("wgcombiner")


Set oDesign = oProject.SetActiveDesign("CircuitDesign2")
Set oModule = oDesign.GetModule("ReportSetup")
oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:Header", _ Array("NAME:PropServers", "XY
Plot1:Header"), _
Array("NAME:ChangedProps", Array("NAME:Company Name", _
"Value:=", "My Company"))))
oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:Header",_ Array("NAME:PropServers", "XY
Plot1:Header"), _
Array("NAME:ChangedProps", Array("NAME:Design Name", _
"Value:=", "WG Combiner"))))
oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:General",_ Array("NAME:PropServers", "XY
Plot1:General"), _
Array("NAME:ChangedProps", Array("NAME:Back Color", _
"R:=", 128, "G:=", 255, "B:=", 255))))
oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:Axis", _ Array("NAME:PropServers", "XY
Plot1:AxisX"), _

Definition Editor Script Commands 26-18


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Array("NAME:ChangedProps", Array("NAME:Axis Scaling", _


"Value:=", "Log"))))

VB Example: Changing a property’s value. Note that the AllChoices parameter is only used when
the MenuProp is being added. Also note that either a string of choices separated by commas or an
Array("choice1", "choice2", "choice3") works for the AllChoices parameter.

Set oEditor = oDesign.SetActiveEditor("SchematicEditor")


oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:PassedParameterTab", Array
("NAME:PropServers", _
"CompInst@CAP_;2"), Array("NAME:NewProps", Array("NAME:xxxx", "PropType:=", _
"MenuProp", "AllChoices:=", Array("aa", "bb", "cc", "dd"), "Value:=", "bb"))))

CloseEditor (Symbol Editor)


Closes the specified editor.
Command: None
Syntax: CloseEditor (VARIANT ptDelta)
Return Value: None

Python Syntax CloseEditor()


Python Example oDefinitionEditor.CloseEditor()

Definition Editor Script Commands 26-19


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Copy (Symbol Editor)


Copy items for pasting.
Command:Edit>Copy
Syntax: Copy Array("NAME:Selections", "Selections:=", Array(<selections>))
Return Value: None.
Parameters: <selections>
Type: Comma-separated list of strings
Identifiers for each selected item to be copied, in the form SchObj@<id>, where id is the value of the SchematicID property
for each element.
Example: Dim oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor", _
"Simplorer Elements\basic Elements\Circuit\Passive Elements:R")
oSymbolEditor .Copy Array("NAME:Selections", "Selections:=", Array("SchObj@11", "SchObj@34"))
CreateArc (Symbol Editor)
Draws an arc in the symbol editor
Command: None
Syntax: CreateArc
Return Value: None
VB Example:
oDefinitionEditor.CreateArc Array("NAME:ArcData", _

Definition Editor Script Commands 26-20


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"X:=", -0.004318, "Y:=", -0.00127, _


"Radius:=", 0.00297299377732279, _
"StartAng:=", 1.9195673303788, _
"EndAng:=", 3.32144615338227, _
"Id:=", 10), _
Array("NAME:Attributes", "Page:=", 1)

Python Syntax CreateArc()


oDefinitionEditor.CreateArc
(["NAME:ArcData", _
"X:=", -0.004318, "Y:=", -0.00127, _
"Radius:=", 0.00297299377732279, _
Python Example
"StartAng:=", 1.9195673303788, _
"EndAng:=", 3.32144615338227, _
"Id:=", 10], _
["NAME:Attributes", "Page:=", 1])

CreateCircle (Symbol Editor)


Draws a circle in the symbol editor
Command: None

Definition Editor Script Commands 26-21


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Syntax: CreateCircle
Return Value: None
VB Example:
oDefinitionEditor.CreateCircle Array("NAME:CircleData", _
"X:=", -0.004572, "Y:=", -0.000508, _
"Radius:=", 0.001778, "Id:=", 12), _
Array("NAME:Attributes", "Page:=", 1)

Python Syntax CreateCircle()


oDefinitionEditor.CreateCircle
(["NAME:CircleData", _

Python Example "X:=", -0.004572, "Y:=", -0.000508, _


"Radius:=", 0.001778, "Id:=", 12], _
["NAME:Attributes", "Page:=", 1])

CreateImage (Symbol Editor)


Create picture from a BMP or GIF file.
Command:Draw>Image
Syntax: CreateImage(
Return Value: None.

Definition Editor Script Commands 26-22


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Parameters: Array("NAME:ImageData",
"X1:=", double, // the image rectangle left X value, in meters
"Y1:=", double, // the image rectangle upper Y value, in meters
"X2:=", double, // the image rectangle right X value, in meters
"Y2:=", double, // the image rectangle lower Y value, in meters
"File:=", string, // the name of the BMP or GIF file
"DisplayBorder:=", bool, // true or false, whether to display the image border
"LineWidth:=", double, // the width of the image border, in meters
"Color:=", int, // the RBG value of the image border color
"Id:=", int), // Id for this item
Array("NAME:Attributes",
"Page:=", int) // [Opt=1] The page number (one-based)
Example: oDefinitionEditor.CreateImage Array("NAME:ImageData", "X1:=", 0.00229684174875881,
"Y1:=", _ 0.00100608189091032, "X2:=", 0.00890589813779289, "Y2:=", -0.00432967005619977,
"File:=", "C:/Documents and Settings/user/Desktop/logo.gif", "DisplayBorder:=", false,
"LineWidth:=", 0, "Color:=", 0, "Id:=", 22), Array("NAME:Attributes", "Page:=", 1)
CreateLine (Symbol Editor)
Draws a line in the symbol editor
Command: None
Syntax: CreateLine
VB Example:
oDefinitionEditor.CreateLine Array("NAME:LineData", _Return Value: None

Definition Editor Script Commands 26-23


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Points:=", Array( "(0.001778, -0.001270)", _


"(0.004572, 0.002794)", "(0.003048, 0.003556)"), _
"Id:=", 14), Array("NAME:Attributes", "Page:=", 1)

Python Syntax CreateLine()


oDefinitionEditor.CreateLine
(["NAME:LineData", _Return Value: None

Python Example "Points:=", [ "(0.001778, -0.001270)",_


"(0.004572, 0.002794)", "(0.003048, 0.003556)"],_
"Id:=", 14], ["NAME:Attributes", "Page:=",1])

CreatePin (Symbol Editor)


Draws a pin in the symbol editor
Command: None
Syntax: CreatePin
Return Value: None
VB Example:
oDefinitionEditor.CreatePin Array("NAME:PinData", _
"Name:=", "newpin3"), Array("NAME:PinParams", _
"X:=", -0.00762, "Y:=", 0.00254, "Angle:=", 0, "Flip:=", false)

Definition Editor Script Commands 26-24


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax CreatePin()


oDefinitionEditor.CreatePin (["NAME:PinData", _
"Name:=", "newpin3"], ["NAME:PinParams",_
Python Example
"X:=", -0.00762, "Y:=", 0.00254, "Angle:=", _
0, "Flip:=", false])

CreatePolygon (Symbol Editor)


Draws a polygon in the symbol editor
Command: None
Syntax: CreatePolygon
Return Value: None
VB Example:
oDefinitionEditor.CreatePolygon Array("NAME:PolygonData", _
"Points:=", Array( "(0.004826, -0.000508)", "(0.003048, -0.003048)", _
"(0.006858, -0.003302)"), "Id:=",16), _
Array("NAME:Attributes", "Page:=", 1)

Python Syntax CreatePolygon()


oDefinitionEditor.CreatePolygon (["NAME:PolygonData", _
Python Example
"X1:=", -0.001524, "Y1:=", 0.000508, _

Definition Editor Script Commands 26-25


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"X2:=", 0.002286, "Y2:=", -0.002032, "Id:=", 18], _


["NAME:Attributes", "Page:=", 1])

CreateRectangle (Symbol Editor)


Draws a rectangle in the symbol editor
Command: None
Syntax: CreateRectangle
Return Value: None
VB Example:
oDefinitionEditor.CreateRectangle Array("NAME:RectData", _
"X1:=", -0.001524, "Y1:=", 0.000508, _
"X2:=", 0.002286, "Y2:=", -0.002032, "Id:=", 18), _
Array("NAME:Attributes", "Page:=", 1)

Python Syntax CreateRectangle()


oDefinitionEditor.CreateRectangle (["NAME:RectData", _
"X1:=", -0.001524, "Y1:=", 0.000508, _
Python Example
"X2:=", 0.002286, "Y2:=", -0.002032, "Id:=", 18], _
["NAME:Attributes", "Page:=", 1])

Definition Editor Script Commands 26-26


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

CreateText (Symbol Editor)


Draws text in the symbol editor
Command: None
Syntax: CreateText
Return Value: None
VB Example:
oDefinitionEditor.CreateText Array("NAME:TextData", _
"X:=", 0.001524, "Y:=", 0.00127, _
"Text:=","My text", "Id:=", 20), Array("NAME:Attributes", "Page:=", 1)

Python Syntax CreateText()


oDefinitionEditor.CreateText(
["NAME:TextData","X:=", 0.001524, "Y:=",
Python Example
0.00127, "Text:=","My text", "Id:=", 20],
["NAME:Attributes", "Page:=", 1])

Cut (Symbol Editor)


Cut page selection.
Command: None
Syntax: Cut(PageNumber, Selections)
Return Value: None
VB Example:

Definition Editor Script Commands 26-27


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oDefinitionEditor.CreateText Array("NAME:Selections", _
"Page:=", page number, _ // [Opt=1] Page number
"Selections:=", IDs to modify)) 1)

Python Syntax Cut(["NAME:Selections", "Selections:=",[<selections>]])


oSymbolEditor = oProject.SetActiveDefinitionEditor("Symbol-
Editor",_
"Simplorer Elements\basic Elements\Circuit\PassiveElements:R")
Python Example
oSymbolEditor.Cut (["NAME:Selections",
"Selections:=", ["SchObj@11", "SchObj@3"]])

Delete (Symbol Editor)


Delete items - remove from the symbol.
Command:Edit>Delete
Syntax: Delete Array("NAME:Selections", "Selections:=", Array(<selections>))
Return Value: None.
Parameters: <selections>
Type: Comma-separated list of strings
Identifiers for each selected item to be deleted, in the form SchObj@<id>, where id is the value of the SchematicID property for
each element.
Example: Dim oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor", _
"Simplorer Elements\basic Elements\Circuit\Passive Elements:R")

Definition Editor Script Commands 26-28


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oSymbolEditor. Delete Array("NAME:Selections", "Selections:=", Array("SchObj@11", "SchObj@34))


DisplayPinNames (Symbol Editor)
To turn on or off the display of pin names.
Command:None.
Syntax: DisplayPinNames <onoff>
Return Value: None.
Parameters: <onoff>
Type: Boolean
TRUE or FALSE to turn on or off the display of pin names.
Example: Dim oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor", "Simplorer Elements\basic
Elements\Circuit\Passive Elements:R")
oSymbolEditor.DisplayPinNames TRUE
ExportFile (Symbol Editor)
Export file of symbol.
Command:Symbol>Export File
Syntax: ExportFile <type>, <filename>
Return Value: None.
Parameters: <type>
Type: String
Type of file to export - only "EMF" is supported currently.
<filename>

Definition Editor Script Commands 26-29


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Type: String
Path, name and extension for the file to be saved.
Example: Dim oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor", _
"Simplorer Elements\basic Elements\Circuit\Passive Elements:R")
oSymbolEditor.ExportFile "EMF", "c:\sym.emf"
FlipHorizontal (Symbol Editor)
To flip the specified objects about the horizontal (x) axis.
Command:Draw>Flip Horizontal
Syntax: FlipHorizontal Array("NAME:Selections", "Selections:=", Array(<selections>)), 0
Return Value: None.
Parameters: <selections>
Type: Comma-separated list of strings
Identifiers for each selected item to be flipped, in the form SchObj@<id>, where id is the value of the SchematicID property for
each element.
Example: Dim oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor", _
"Simplorer Elements\basic Elements\Circuit\Passive Elements:R")
oSymbolEditor.FlipHorizontal Array("NAME:Selections", "Selections:=", Array("SchObj@11")), 0

Definition Editor Script Commands 26-30


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

FlipVertical (Symbol Editor)


To flip the specified objects about the horizontal (x) axis.
Command:Draw>Flip Vertical
Syntax: FlipVertical Array("NAME:Selections", "Selections:=", Array(<selections>)), 0
Return Value: None.
Parameters: <selections>
Type: Comma-separated list of strings
Identifiers for each selected item to be flipped, in the form SchObj@<id>, where id is the value of the SchematicID property for
each element.
Example: Dim oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor", _
"Simplorer Elements\basic Elements\Circuit\Passive Elements:R")
oSymbolEditor.FlipVertical Array("NAME:Selections", "Selections:=", Array("SchObj@11")), 0
GetProperties (Symbol Editor)
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")

Definition Editor Script Commands 26-31


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetPropertyValue (Symbol Editor)


Gets the value of a single property. This can be executed by the oProject, oDesign, or oEditor objects.
Command: None
Syntax: GetPropertyValue(<PropTab>, <PropServer>, <PropName>)
Return Value: String representing the property value.
VB Example: value_string = _
oEditor.GetPropertyValue("BaseElementTab",_
"rect_1", "Name")

GetVisibleLevels (Symbol Editor)


To determine the levels in the symbol.
Command:None.
Syntax: GetVisibleLevels
Return Value: An array of integers, which are the levels defined for the particular symbol.
Parameters: None.
Example: Dim oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor", _
"Simplorer Elements\basic Elements\Circuit\Passive Elements:R")
levels = oSymbolEditor.GetVisibleLevels

Definition Editor Script Commands 26-32


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GridSetup (Symbol Editor)


Changes the settings on the symbol grid.
Command:Symbol>Grid Setup
Syntax: GridSetup(
Return Value: None.
Parameters: Array("NAME:Options", _
"MajorGrid:=", string, _ // Major grid size with units
"Divisions:=", int, _ // Number of minor grid divisions
"MajorColor:=", int, _ // RGB Color of major grid lines
"MinorColor:=", int, _ // RGB Color of minor grid lines
"ShowGrid:=", bool, _ // Should the grid be shown?
"SnapToGrid:=", bool, _ // Should objects snap to grid?
"BackgroundColor:=", int, _ // RGB Color of the background
"SaveAsDefault:=", bool)) // Should these settings be the default for new schematics
Example: oEditor.GridSetup Array(
"NAME:Options",
"MajorGrid:=", "10mm",
"Divisions:=", 10,
"MajorColor:=", 0x00ff0000, // Red
"MinorColor:=", 0x0000ff00, // Green
"ShowGrid:=", true,

Definition Editor Script Commands 26-33


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"SnapToGrid:=", true,
"BackgroundColor:=", 0x00ffffff, // White
"SaveAsDefault:=", false)
Move (Symbol Editor)
To move the specified objects in X and Y.
Command:None.
Syntax: Move Array("NAME:Selections", "Selections:=", Array(<selections>)), Array("NAME:FlipParameters", "xdelta:=", <xval>,
"ydelta:=",<yval>)
Return Value: None.
Parameters: <selections>
Type: Comma-separated list of strings
Identifiers for each selected item to be moved, in the form SchObj@<id>, where id is the value of the SchematicID property for
each element.
<xval>
Type: Real number
The X delta to move.
<yval>
Type: Real number
The Y delta to move.
Example: Dim oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor",

Definition Editor Script Commands 26-34


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"Simplorer Elements\basic Elements\Circuit\Passive Elements:R")


oSymbolEditor. Move Array("NAME:Selections", "Selections:=", Array("SchObj@34")),
Array("NAME:FlipParameters", "xdelta:=", -0.00254, "ydelta:=", 0.00254)
Pan (Symbol Editor)
Pans the display.

UI Access View > Pan.

Name Type Description


Parameters
<argSelections> Array of doubles First double pans along x-axis; second double pans along y-axis.

Return Value None.

Python Syntax Pan (<argSelections>)


oDefinitionEditor.Pan([-0.00922653869663931, 0.00686839904222147])
Python Example

VB Syntax Pan <argSelections>


oDefinitionEditor.Pan
VB Example
Array(-0.00922653869663931, 0.00686839904222147)

Paste (Symbol Editor)


To paste copied objects to a specified X and Y location.
Command:Edit>Paste

Definition Editor Script Commands 26-35


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Syntax: Paste Array("NAME:Attributes", "X:=", <xval>, "Y:=",<yval>)


Return Value: None.
Parameters: <xval>
Type: Real number
The X placement value.
<yval>
Type: Real number
The Y placement value.
Example: Dim oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor", _
"Simplorer Elements\basic Elements\Circuit\Passive Elements:R")
oSymbolEditor.Paste Array("NAME:Attributes", "X:=", -0.00254, "Y:=", 0.00254)
Redo (Symbol Editor)
Redo the last operation
Command: Click Edit>Redo
Syntax: Redo
Return Value: None
Parameters: None
VB Example: oDesign.Redo

Definition Editor Script Commands 26-36


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

RemoveLevels (Symbol Editor)


Removes one or more graphics levels from a symbol.

UI Access Tools > Edit Libraries > Symbols. From Symbol editor, click View > Levels > Remove Level.

Name Type Description


Parameters
<levels> Array of integers The levels to be deleted.

Return Value None.

Python Syntax RemoveLevels (<levels>)


Python Example oSymbolEditor.RemoveLevels([3,4])

VB Syntax RemoveLevels <levels>


Dim
oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor",
VB Example _
"Simplorer Elements\basic Elements\Circuit\Passive
Elements:R")
oldLevel = oSymbolEditor.RemoveLevels(Array(3,4))

RemovePort (Symbol Editor)


Selected pins are changed to vias. Selected edge terminal ports are removed.
Syntax: RemovePort <NAME:elements", <object_name> ... // objects to be removed

Definition Editor Script Commands 26-37


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value: None.


Parameters: <object_name>
Type: <String>
VB Example: oEditor.RemovePort Array("NAME:elements", "via_195", "Port1")

Rotate (Symbol Editor)


To rotate the specified objects about their common center.
Command:Draw>Rotate
Syntax: Rotate Array("NAME:Selections", "Selections:=", Array(<selections>)), Array("NAME:FlipParameters", <angle>)
Return Value: None.
Parameters: <selections>
Type: Comma-separated list of strings
Identifiers for each selected item to be rotated, in the form SchObj@<id>, where id is the value of the SchematicID property for
each element.
<angle>
Type: A comma-separated string and real number
Either "Angle:=", <rad>, where <rad> is the angle in radians, or "Degrees:=", <deg>, where <deg> is the angle in degrees.
Example: Dim oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor",
"Simplorer Elements\basic Elements\Circuit\Passive Elements:R")

Definition Editor Script Commands 26-38


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oSymbolEditor.Rotate Array("NAME:Selections", "Selections:=", Array("SchObj@11")),


Array("NAME:FlipParameters", "Angle:=", 1.5707963267949)
Save (Symbol Editor)
Saves any changes in the current symbol to the project.
Command:Symbol>Update Project
Syntax: Save
Return Value: None.
Parameters: None.
Example: Dim oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor", _
"Simplorer Elements\basic Elements\Circuit\Passive Elements:R")
oSymbolEditor.Save
SelectAll (Symbol Editor)
Select all elements in the symbol editor.
Command: None.
Syntax: SelectAll()
Parameters: None
VB Example: Dim removedDefs
removedDefs = oDefinitionEditor.SelectAll()

Definition Editor Script Commands 26-39


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Python Syntax SelectAll()


Python Example removedDefs = oSymbolManager.SelectAll()

SendToBack (Symbol Editor)


Changes the drawing for the symbol so that the specified objects are drawn behind other overlapping objects.
Command: Draw > Send To Back
Syntax: SendToBack Array("NAME:Selections", "Selections:=", Array (<Object>, <Object>, ...))
Return Value: None
Parameters: <Object>
<string> // object to send to the back
VB Example: oDefinitionEditor.SendToBack Array("NAME:Selections", "Selections:=", Array(
"SchObj@10"))

Python Syntax SendToBack (["NAME:Selections", "Selections:=",[<Object>, <Object>, ...]])


oDefinitionEditor.SendToBack(["NAME:Selections",
Python Example
"Selections:=",["SchObj@10"]])

SetActivelLevel (Symbol Editor)


To set the active graphics level in the symbol editor.
Command:"Current" radio button for a level in the View>Levels dialog.
Syntax: SetActiveLevel <level>
Return Value: None.

Definition Editor Script Commands 26-40


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Parameters: <level>
Type: Integer
The new active level.
Example: Dim oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor", _
"Simplorer Elements\basic Elements\Circuit\Passive Elements:R")
oldLevel = oSymbolEditor. SetActiveLevel (4)
SetInitialLevels (Symbol Editor)
Sets one or more graphics levels as the default visible levels for a symbol. The levels submitted do not need to contain 1 or 0, which
are always visible.

Tools > Edit Libraries > Symbols. From Symbol editor, click View > Levels. Select the Default check box for
UI Access
desired levels.

Name Type Description


Parameters
<levels> Array of integers The levels to be selected.

Return Value None.

Python Syntax SetInitialLevels (<levels>)


Python Example oSymbolEditor.SetInitialLevels([3,4])

VB Syntax SetInitialLevels <levels>

Definition Editor Script Commands 26-41


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Dim
oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor",
VB Example _
"Simplorer Elements\basic Elements\Circuit\Passive
Elements:R")
oldLevel = oSymbolEditor.SetInitialLevels(Array(3,4))

SetPropertyValue (Symbol Editor)


Set a property.
Command: None.
Syntax: SetPropertyValue(tab, item, propname, value)
Parameters: None
VB Example: Dim removedDefs
removedDefs = oDefinitionEditor.SetPropertyValue(string tab, // Tab with the property
string item, // Name of the object
string propname, // Name of the property
string value) // The new value of the prop

SetVisibleLevels (Symbol Editor)


Makes one or more graphics levels visible in the symbol editor.

Definition Editor Script Commands 26-42


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Tools > Edit Libraries > Symbols. From Symbol editor, click View > Levels. Select the Visible check box for
UI Access
the desired levels.

Name Type Description


Parameters
<levels> Array of integers The levels to be made visible.

Return Value None.

Python Syntax SetVisibleLevels (<levels>)


Python Example oSymbolEditor.SetVisibleLevels([3,4])

VB Syntax SetVisibleLevels <levels>


Dim
oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor",
VB Example _
"Simplorer Elements\basic Elements\Circuit\Passive
Elements:R")
oldLevel = oSymbolEditor.SetVisibleLevels(Array(3,4))

ToggleLevel (Symbol Editor)


To toggle display of the graphics level in the symbol editor.
Command:"Visible" checkbox for a level in the View>Levels dialog.
Syntax: ToggleLevel <level>

Definition Editor Script Commands 26-43


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Return Value: None.


Parameters: <level>
Type: Integer
The level to turn on or off.
Example: Dim oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor", _
"Simplorer Elements\basic Elements\Circuit\Passive Elements:R")
oSymbolEditor.ToggleLevel (2)
Undo (Symbol Editor)
Undo the last operation
Command: Edit>Undo
Syntax: Undo
Return Value: None
Parameters: None
VB Example: oDesign.Undo

Python Syntax Undo()


oSymbolEditor = oProject.SetActiveDefinitionEditor("Symbol-
Editor",_
Python Example
"Simplorer Elements\basic Elements\Circuit\PassiveElements:R")

Definition Editor Script Commands 26-44


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oSymbolEditor.Undo()

ZoomArea (Symbol Editor)


To change the current graphics view area.
Command:View>Zoom Area
Syntax: ZoomArea Array(<xpt>, <ypt>), Array(<xdelta>, <ydelta>)
Return Value: None.
Parameters: <xpt>
Type: Real number
The X value of the zoom area box, in meters.
<ypt>
Type: Real number
The X value of the zoom area box, in meters.
<xdelta>
Type: Real number
The width of the zoom area box, in meters.
<ydelta>
Type: Real number
The height of the zoom area box, in meters.
Example: Dim oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor", _
"Simplorer Elements\basic Elements\Circuit\Passive Elements:R")

Definition Editor Script Commands 26-45


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oSymbolEditor.ZoomArea Array(0, 0), Array(0.004, 0.004)


ZoomIn (Symbol Editor)
To zoom in a standard amount to the current graphics view area.
Command:View>Zoom In
Syntax: ZoomIn
Return Value: None.
Parameters: None.
Example: Dim oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor",
"Simplorer Elements\basic Elements\Circuit\Passive Elements:R")
oSymbolEditor.ZoomIn
ZoomOut (Symbol Editor)
To zoom out a standard amount to the current graphics view area.
Command:View>Zoom Out
Syntax: ZoomOut
Return Value: None.
Parameters: None.
Example: Dim oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor",
"Simplorer Elements\basic Elements\Circuit\Passive Elements:R")

Definition Editor Script Commands 26-46


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oSymbolEditor.ZoomOut
ZoomPrevious (Symbol Editor)
To zoom the current graphics view area to the previous extents.
Command:View>Zoom Previous
Syntax: ZoomPrevious
Return Value: None.
Parameters: None.
Example: Dim oSymbolEditor
Set oSymbolEditor = oProject.SetActiveDefinitionEditor("SymbolEditor",
"Simplorer Elements\basic Elements\Circuit\Passive Elements:R")
oSymbolEditor.ZoomPrevious
ZoomToFit (Symbol Editor)
Set the current symbol zoom to fit the contents of the currently visible page
Command: None
Syntax: ZoomToFit()
Return Value: None

Python Syntax ZoomToFit()


oSymbolEditor = oProject.SetActiveDefinitionEditor("Symbol-
Editor",_
Python Example "Simplorer Elements\basic Elements\Circuit\PassiveElements:R")
oSymbolEditor.ZoomToFit()

Definition Editor Script Commands 26-47


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

26-48
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

27 - Core Global Script Context Commands


To run these commands:
import CoreGlobalScriptContextFunctions
CoreGlobalScriptContextFunctions.[CommandName]
The following are general script commands recognized by the CoreG-
lobalScriptContextFunctions object:
l AddErrorMessage
l AddFatalMessage
l AddInfoMessage
l AddWarningMessage
l LogDebug
l LogError

AddErrorMessage
Adds an error message to the Message Manager window. AddErrorMessageis a function of
CoreGlobalScriptContextFunctions.

UI Access N/A

Name Type Description


Parameters
<message> String Error message.

Return Value None.

Python AddErrorMessage(<message>)
Syntax

import CoreGlobalScriptContextFunctions
Python
Example CoreGlobalScriptContextFunctions.AddErrorMessage('My error
message.')

VB Syntax N/A
VB Example N/A. Script cannot be run in VBScript.

Core Global Script Context Commands 27-1


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AddFatalMessage
Adds a fatal error message to the Message Manager window. AddFatalMessageis a function of
CoreGlobalScriptContextFunctions.

UI Access N/A

Name Type Description


Parameters
<message> String Error message.

Return Value None.

Python AddFatalMessage(<message>)
Syntax

Python
import CoreGlobalScriptContextFunctions
Exampl- CoreGlobalScriptContextFunctions.AddFatalMessage('My fatal
e error message.')

VB Syntax N/A
VB Example N/A. Script cannot be run in VBScript.

AddInfoMessage
Adds an informational message to the Message Manager window. AddInfoMessageis a func-
tion of CoreGlobalScriptContextFunctions.

UI Access N/A

Name Type Description


Parameters
<message> String Informational message.

Return Value None.

Python AddInfoMessage(<message>)
Syntax

Python import CoreGlobalScriptContextFunctions


Example CoreGlobalScriptContextFunctions.AddInfoMessage('My info.')

Core Global Script Context Commands 27-2


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

VB Syntax N/A
VB Example N/A. Script cannot be run in VBScript.

AddWarningMessage
Adds a warning message to the Message Manager window. AddWarningMessageis a function
of CoreGlobalScriptContextFunctions.

UI Access N/A

Name Type Description


Parameters
<message> String Warning message.

Return Value None.

Python AddWarningMessge(<message>)
Syntax

import CoreGlobalScriptContextFunctions
Python
Example CoreGlobalScriptContextFunctions.AddWarningMessage('My warn-
ing.')

VB Syntax N/A
VB Example N/A. Script cannot be run in VBScript.

LogDebug
Adds a debug line to the log specified at Tools > Debug Logging. LogDebugis a function of
CoreGlobalScriptContextFunctions.

UI Access N/A

Name Type Description


Parameters
<message> String Debug message.

Return Value None.

Python LogDebug(<message>)
Syntax

Core Global Script Context Commands 27-3


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

import CoreGlobalScriptContextFunctions
Python
Example CoreGlobalScriptContextFunctions.LogDebug('My debug mes-
sage.')

VB Syntax N/A
VB Example N/A. Script cannot be run in VBScript.

LogError
Adds an error line to the log specified at Tools > Debug Logging. LogErroris a function of
CoreGlobalScriptContextFunctions.

UI Access N/A

Name Type Description


Parameters
<error> String Error to log.

Return Value None.

Python LogError(<error>)
Syntax

Python import CoreGlobalScriptContextFunctions


Example CoreGlobalScriptContextFunctions.LogError('My error.')

VB Syntax N/A
VB Example N/A. Script cannot be run in VBScript.

Core Global Script Context Commands 27-4


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

28 - Example Scripts
This section contains VBScript and IronPython example scripts.

VBScript Example Scripts


VBScript Examples:
l Variable Helix Script
l HFSS Data Export Script
l ExampleGetLayeredImpedanceBoundaryPropertyNamesandValues.htm

Variable Helix Script


This sample script creates a tapered helix. Tapering helices is not supported from the interface.
The script includes comment lines, which are preceded by an apostrophe ( ') and offer explan-
ations for each subsequent line or lines.

Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
Set oProject = oDesktop.GetActiveProject()
Set oDesign = oProject.GetActiveDesign()
Set oEditor = oDesign.SetActiveEditor("3D Modeler")

’ Declare the arrays and variables needed for building the polyline.

Dim points(), segments()
Dim NumPoints, R(2), P(2), PointsPerTurn, Turns, Units

Example Scripts 28-1


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

’ 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 = ""
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: ", _

Example Scripts 28-2


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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))
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)

Example Scripts 28-3


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

’ 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 _
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.

Example Scripts 28-4


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide


oEditor.SweepAlongPath _
Array("NAME:Selections", "Selections:=", _
"Circle_Helix,Line_Helix"),
Array("NAME:PathSweepParameters", "DraftAngle:=", "0deg", _
"DraftType:=", "Round", "TwistAngle:=", "0deg")

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 out-
put is done using output variables.
The frequency sweep data must be entered correctly. If it is incorrect, the script will request a
freq point that does not exist and execution will stop.
The script includes comment lines, which are preceded by an apostrophe ( ') and offer explan-
ations for each subsequent line or lines.
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
set oProject = oDesktop.GetActiveProject
set oDesign = oProject.GetActiveDesign()
Dim oFS,ofile,x,y,z,path,range,
Dim arr2,del_f,freq,cfreq,val,temp,stn,stw,i,line
'
' Input the desired file name.
'
path = inputbox("Input the file name" &chr(13) & _
"Note: If you do not specify a path the file will " & _

Example Scripts 28-5


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

"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))
arr(1) = Trim(arr(1))

Example Scripts 28-6


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

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, "")
z = val

Example Scripts 28-7


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

'
' 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

IronPython Example Scripts


IronPython Examples:
l BH Coordinates 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 28-8


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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
subsequent 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 28-9


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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 variable
"IsTemperatureDependent:=", False,
bh_coordinates,
[

Example Scripts 28-10


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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 28-11


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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 28-12


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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 28-13


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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 28-14


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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 28-15


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell 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
])

Example Scripts 28-16


Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Index

CreatePolyline 8-47
3
CreateRectangle 8-53
3D Modeler editor commands 8-1
CreateRegion 8-55
AssignMaterial 8-142
CreateRegularPolygon 8-62
Chamfer 8-145
CreateRegularPolyhedron 8-59
ChangeProperty 8-263
CreateRelativeCS 8-168
Connect 8-147
CreateSphere 8-65
Copy 8-120
CreateSpiral 8-67
CoverLines 8-148
CreateTorus 8-69
CoverSurfaces 8-149
CreateUserDefinedModel 8-72
CreateBondwire 8-10
CreateUserDefinedPart 8-40, 8-79
CreateBox 8-14
Delete 8-270
CreateCircle 8-16
DeleteEmptyGroups 8-170
CreateCone 8-19
DeleteLastOperation 8-171
CreateCutplane 8-22
DeletePolylinePoint 8-121
CreateCylinder 8-24
DetachFaces 8-172
CreateEllipse 8-26
DuplicateAlongLine 8-122
CreateEntityList 8-150
DuplicateAroundAxi 8-125
CreateEquationCurve 8-29
DuplicateMirror 8-128
CreateEquationSurface 8-33
Edit3dComponent 8-89
CreateFaceCS 8-152, 8-158
EditEntityList 8-173
CreateGroup 8-157
EditFaceCS 8-175
CreateHelix 8-36
EditObjectCS 8-181
CreateObjectFromdges 8-165
EditPolyline 8-92
CreateObjectFromFaces 8-166
EditRelativeCS 8-188
CreatePoint 8-38

Index-1
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Export 8-190 Import 8-206


ExportModelImagetoFile 8-192 ImportDXF 8-209
Fillet 8-196 ImportGDSII 8-213
FlattenGroup 8-198 Insert3DComponent 8-100
GenerateHistory 8-199 InsertNativeComponent 8-101
Get3DComponentParameters Intersect 8-217
8-97
Mirror 8-131
GetActiveCoordinateSystem 8-
204 Move 8-133

GetBodyNamesByPosition 8- MoveCSToEnd 8-218


271 MoveEntityToGroup 8-219
GetCoordinateSystems 8-205 MoveFaces 8-220
GetEdgeByPosition 8-272 OffsetFaces 8-134
GetEdgeIDsfromFace 8-274 PageSetup 8-291
GetEdgeIDsfromObject 8-275 ProjectSheet 8-223
GetFaceArea 8-275 RenamePart 8-293
GetFaceByPosition 8-277 Rotate 8-137
GetFaceCenter 8-276 Scale 8-138
GetFaceIDs 8-278 Section 8-225
GetGeometryModelerMode 8- SeparateBody 8-226
279
SetModelUnits 8-227
GetModelBoundingBox 8-280
SetWCS 8-229
GetProperties 6-26
Split 8-230
GetPropertyValue 6-28, 10-61
Subtract 8-233
GetUser Position 8-287
SweepAlongPath 8-107
GetVertexIDsFromEdge 8-287
SweepAlongVector 8-109
GetVertexIDsFromFace 8-288
SweepAroundAxis 8-112
GetVertexIDsFromObject 8-289
SweepFacesAlongNormal 8-114, 8-
GetVertexPosition 8-289 114, 8-235, 8-235
HealObject 8-200

Index-2
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Sweep- AddLevel 26-3


FacesAlongNormalWithAt-
tributes 8-116 AddMarker 10-9

ThickenSheet 8-236 AddMarkerToPlot 16-2

UncoverFaces 8-238 AddMaterial 25-2, 25-15

Ungroup 8-241 AddMessage 4-5

Unite 8-240 AddNamedExpr 17-3

UpdateComponentDefinition 8- AddNote 10-10


119 AddNPortData 25-63
WrapSheet 8-242 AddPinGrounds 24-48
3D Modeler editor object commands AddPinIPorts 24-51
GetNumObjects 8-285 AddPinPageConnectors 24-52
GetObjectIDByName 8-280 AddReduceOp 19-2
GetObjectName 8-281 AddTerminalsToWinding 11-50
GetObjectNameByFaceID 8-281 AddTraceCharacteristics 10-12
AddTraces 10-13
A
AlignHorizontal 24-53, 26-4
Aborting Scripts 1-11
AlignVertical 24-54, 26-5
Add 25-41, 25-124, 25-159, 25-186,
25-231 Analysis module commands
AddAddSolverOnDemandModel Analyze 7-6
25-69
CopySetup 13-2, 14-7
AddAssignmentToBoundary 11-3
DeleteSetups 13-3
AddCartesianLimitLine 10-4
EditSetup 13-4
AddCartesianXMarker 10-6
ExportIcepak 13-17
AddCartesianYMarker 10-7
ExportSolnData 13-18
AddDefinitionFromBlock 8-246
GetSetupCount 13-19
AddDefinitionFromLibFile 8-251
GetSetups 13-19
AddDeltaMarker 10-8
GetSweepCount 13-20
AddDiffPair 22-4
GetSweeps 13-21
AddDynamicNPortData 25-60
InsertSetup [Maxwell] 13-21

Index-3
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

PasteSetup 13-37 AssignCurrentDensity 11-55


PasteSweep 13-37 AssignCurrentDensityGroup 11-56
RenameSetup 13-38 AssignCurrentDensityTerminal 11-57
ResetAllToTimeZero 13-39 AssignCurrentDensityTerminalGroup 11-
56, 11-57
ResetSetupToTimeZero 13-39
AssignCurrentGroup 11-57
ResetToTimeZero 7-41
AssignCylindricalGapOp 12-5
RevertAllToInitial 13-39
AssignCylindricalHField 11-19
RevertAllToInitialTemperature
13-40 AssignDependent 11-20
RevertSetupToInitial 13-41 AssignFloating 11-58
RevertSetupToInitialTemperature AssignFluxTangential 11-23
13-41
AssignForce 19-4
Analysis Setup Module Script Com-
mands 13-1 AssignImpedance 11-23

Analyze AssignIndependent 11-24

Analysis module command 7-6 AssignInsulating 11-26

AnalyzeAll 7-6 AssignLayoutForce 19-5

AnalyzeDistributed 7-7 AssignLengthOp 12-12

Ansoft Application Object com- AssignMaterial 8-142


mands 3-1 AssignMatrix 19-7
GetAppDesktop 3-2 AssignModelResolutionOp 12-15
ApplyMeshOps 7-5 AssignRadiation 11-26
arithmetic operators 1-6 AssignResistiveSheet 11-27
array variables 1-4 AssignSink 11-58
AssignBand C AssignSkinDepthLayerSetting 12-17
AssignCharge 11-51 AssignSkinDepthOp 12-18
AssignCoilGroup 11-51 AssignSymmetry 11-29
AssignCoilTerminal 11-52 AssignTangentialHField 11-30
AssignCoilTerminalGroup 11-53 AssignThinLayer 11-30
AssignCurrent 11-54 AssignTorque 19-9

Index-4
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

AssignTouching 11-34 AssignCylindricalHField 11-19


AssignTrueSurfOp 12-19 AssignDependent 11-20
AssignVectorPotential 11-35 AssignFloating 11-58
AssignVoltage 11-59 AssignImpedance 11-23
AssignVoltageAPhi 11-59 AssignIndependent 11-24
AssignVoltageDrop 11-61 AssignInsulating 11-26
AssignVoltageDropGroup 11-61 AssignRadiation 11-26
AssignVoltageGroup 11-62 AssignSink 11-58
AssignVolumeChargeDensity 11- AssignSymmetry 11-29
62
AssignTangentialHField 11-30
AssignWindingGroup 11-63
AssignVoltage 11-59
AssignZeroTangentialHField 11-36
AssignVoltageDrop 11-61

B AssignVoltageDropGroup 11-61

Boundary/Excitation module com- AssignVoltageGroup 11-62


mands AssignVolumeChargeDensity 11-
AddAssignmentToBoundary 11- 62
3 AssignWindingGroup 11-63
AddTerminalsToWinding 11-50 AssignZeroTangentialHField 11-
AssignCharge 11-51 36

AssignCoilGroup 11-51 DeleteAllBoundaries 11-4

AssignCoilTerminal 11-52 DeleteAllExcitations 11-5

AssignCoilTerminalGroup 11-53 DeleteBoundaries 11-5

AssignCurrentDensity 11-55 EditCharge 11-63

AssignCurrentDensityGroup 11- EditCoilTerminal 11-64


56 EditCurrentDensity 11-65
AssignCurrentDensityTerminal EditCurrentDensityTerminal 11-65
11-57
EditCylindricalHField 11-36
AssignCur-
rentDensityTerminalGroup EditDependent 11-37
11-56, 11-57
EditExternalCircuit 11-66
AssignCurrentGroup 11-57

Index-5
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

EditFloating 11-66 ReassignBoundaries 11-3, 11-14


EditImpedance 11-38 ReassignBoundary 11-14
EditIndependent 11-39 RemoveAssignmentFromBoundary 11-
15
EditInsulating 11-39
RenameBoundary 11-16
EditRadiation 11-40
ReprioritizeBoundaries 11-17
EditSink 11-66
SetCoreLoss 11-70
EditSymmetry 11-42
SetEddyEffect 11-71
EditTangentialHField 11-43
SetMagnetizationCompute 11-72
EditVoltage 11-67
SetMinimumTimeStep 11-73
EditVoltageDrop 11-69
boundary/excitation script commands 11-2
EditVolumeChargeDensity 11-
70 BreakUDMConnection 8-262
EditWindingGroup 11-70 BringToFront 25-169, 26-6
EditZeroTangentialHField 11-48
C
GetBoundaries 11-7
CalcOp 17-4
GetBoundariesofType 11-7
CalcRead (deprecated) 17-4
GetBoundaryAssignment 11-6
CalcStack 17-6
GetCoreLossEffect 11-8
CalculatorRead 17-5
GetCoreLossEffectOnField 11-9
CalculatorWrite 17-7
GetDisplacementCurrent 11-9
Cascade 22-5
GetEddyEffect 11-9
Chamfer 8-145
GetExcitations 11-10
ChangeGeomSettings 17-8
GetExcitationsOfType 11-11
ChangeProperty 8-263, 10-16, 24-105, 26-
GetNumBoundaries 11-11 6
GetNumBoundariesofType 11- ClcEval 17-9
12
ClcMaterial 17-10
GetNumExcitations 11-13
ClearAllMarkers 10-20
GetNumExcitationsOfType 11-
13 ClearAllNamedExpr 17-11
ClearAllTraceCharacteristics 10-20

Index-6
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

ClearDiffPairs 22-6 converting data types 1-10


ClearMessages 2-35, 4-7 ConvertToDynamic 25-135
ClearSolutionCache 25-69 ConvertToParametric 25-135
Clone 22-7 Copy 8-120, 24-57, 26-20
CloneMaterial 25-12 CopyData 24-58
Close 2-36, 22-8 CopyDesign 2-37
CloseAllWindows 4-11 CopyNamedExprToStack 17-11
CloseEditor 24-57, 26-19 CopyReportDefinition 10-23
CloseProject 4-11 CopyReportsData 10-22
CloseProjectNoForce 4-12 Copyright and Trademark
Information 2
Combine 22-9
CopySetup
comparison operators 1-7
Analysis module command 13-2,
CompInstance Functions 23-2 14-7
CompInstance Script Optimetrics module command 13-
Commands 23-1 2, 14-7
Component Manager Script Com- CopySubdesign 24-59
mands 25-40
CopyTraceDefinitions 10-23
ComputeCoreLossCoefficients 25-
13 CopyTracesData 10-21
conditional statements Core Global Script Context Com-
mands 27-1
If...Then... Else 1-8
Count 4-13
Select Case 1-8
CoverLines 8-148
types of 1-8
CoverSurfaces 8-149
Con-
fig- CPython 1-70
ureFlu-
entConductivityCoupling 7-8 Create3DComponent 8-6

Connect 8-147 Create3DDesign 7-11

ConstructVariationString 7-9 CreateArc 26-20

conventions CreateBondwire 8-10

scripting help 1-1 CreateBox 8-14

Index-7
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

CreateCircle 8-16, 26-21 CreateReportFromTemplate 10-35


CreateCone 8-19 CreateReportofAllQuantities 10-36
CreateCutplane 8-22 CreateSphere 8-65
CreateCylinder 8-24 CreateSpiral 8-67
CreateEllipse 8-26 CreateText 26-27
CreateEntityList 8-150 CreateTorus 8-69
CreateEquationCurve 8-29 CreateUserDefinedModel 8-72
CreateEquationSurface 8-33 CreateUserDefinedPart 8-40, 8-79
CreateFaceCS 8-152, 8-158 CreateUserDefinedSolution 21-1
CreateFieldPlot 16-4 Cut 24-61, 26-27
CreateGroup 8-157 CutDesign 2-37
CreateHelix 8-36
D
CreateImage 26-22
DeactivateOpen 24-62
CreateLine 26-23
DeactivateShort 24-63
CreateObjectFromEdges 8-165
Deembed 22-10
CreateObjectFromFaces 8-166
DeembedBack 22-11
CreateOutputVariable 9-1
DeembedFront 22-13
CreatePage 24-60
Definition Editor Script Commands 26-1
CreatePin 26-24
Definition Manager commands
CreatePoint 8-38
AddDefinitionFromBlock 8-246
CreatePolygon 26-25
AddDefinitionFromLibFile 8-251
CreatePolyline 8-47
GetProjectMaterialNames 25-36
CreateRectangle 8-53, 26-26
Definition Manager Script Commands 25-1
CreateRegion 8-55
Delete 8-270, 24-64, 26-28
CreateRegularPolygon 8-62
DeleteAllBoundaries 11-4
CreateRegularPolyhedron 8-59
DeleteAllExcitations 11-5
CreateRelativeCS 8-168
DeleteAllParameters 19-10
CreateReport 10-25
DeleteAllReports 10-38
CreateReportFromFile 10-24

Index-8
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

DeleteBoundaries 11-5 Design object commands 10-49, 10-


50, 10-51, 10-52, 10-52, 10-65
DeleteDesign 2-38
AddCartesianLimitLine 10-4
DeleteEmptyGroups 8-170
AddCartesianXMarker 10-6
DeleteFieldPlot 16-36
AddCartesianYMarker 10-7
DeleteFieldVariation 7-12
AddDeltaMarker 10-8
DeleteFullVariation 7-13
AddMarker 10-9
DeleteLastOperation 8-171
AddMarkerToPlot 16-2
DeleteLinkedDataVariation 7-13
AddNote 10-10
DeleteMarker 10-37
AddTraceCharacteristics 10-12
DeleteMotionSetup A
AddTraces 10-13
DeleteNamedExpr 17-12
AnalyzeAll 7-6
DeleteOp 12-2
AnalyzeDistributed 7-7
DeleteOutputVariable 9-3
ApplyMeshOps 7-5
DeleteParameters 19-10
CalculatorRead 17-5
DeletePolylinePoint 8-121
ClearAllMarkers 10-20
DeleteProject 4-14
ClearAllTraceCharacteristics 10-
DeleteReduceMatrix 19-11 20
DeleteReduceOp 19-11 CloseAllWindows 4-11
DeleteReport 10-39 CopyReportDefinition 10-23
DeleteSetups 13-3 CreateOutputVariable 9-1
Analysis module command 13-3 CreateReport 10-25
Optimetrics module CreateReportFromTemplate 10-35
command 14-7
DeleteAllReports 10-38
DeleteSolutionVariation 15-1
DeleteOutputVariable 9-3
Deletetraces 10-39
DeleteReport 10-39
DeleteUserDefinedSolutions 21-3
DeleteTraces 10-39
DeleteVariation 7-14
DoesOutputVariableExist 9-3
EditOutputVariable 9-4

Index-9
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

ExportConvergence 7-24 GetVariableValue 6-30


ExportEle- GetVariationVariableValue 7-37
mentBasedHarmonicForce 7-
25 GetVersion 4-38

ExportMeshStats 7-28 ImportIntoReport 10-72

ExportPlotImageToFile 10-41 Is2D 7-39

ExportPlotImageWithViewToFile Is3D 7-39


16-40 PasteReports 10-76
ExportProfile 7-28 Redo 7-40
ExportReport 10-43 RenameDesignInstance 7-41
ExportToFile 10-46 RenameReport 10-79
Fast Transformation 7-57, 7-58 RenameTraces 10-79
GetDisplayType 10-59 RunToolkit 7-68
GetLibraryDirectory 4-26 SavePlotSettingsAsDefault 10-81
GetMatchedObjectName 8-284 SetActiveEditor 7-42
GetModelUnits 8-285 SetConductivityThreshold 7-43
GetModule 7-33 SetDesignSettings 7-43
GetName 7-34, 22-30 SetLibraryDirectory 4-66
GetObjectsByMaterial 8-282 SetMPIVendor 3-2
GetObjectsInGroup 8-283 SetProjectDirectoryVBCommand> 4-66
GetOutputVariableValue 9-6 SetPropertyValue 6-31
GetProjectDirectory 4-33 SetSolutionType 7-66
GetProperties 6-26 SetTempDirectory 4-68
GetPropertyValue 6-28, 10-61 SetupYConnection 11-74
GetRegistryInt 4-74 SetVariableValue 6-33
GetRegistryString 4-75 Show Layout 7-65, 7-65
GetSelections 8-286 ShowWindow 8-230
GetSolutionType 7-37 Solve 7-67, 7-69
GetTempDirectory 4-37 StopSimLink 7-67
GetVariables 6-30

Index-10
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

UpdateAllReports 10-82 LaunchJobMonitor 4-43


ValidateDesign 7-70 NewProject 4-44
Design Object Script Commands 7- OpenMultipleProjects 4-46
1
OpenProject 4-47
Desktop Commands For Registry
Values 4-72 PauseRecording 4-49

Desktop object commands PauseScript 4-50

AddMessage 4-5 Print 4-50

ClearMessages 4-7 QuitApplication 4-51

CloseProject 4-11 RefreshJobMonitor 4-52

CloseProjectNoForce 4-12 ResetLogging 4-53

Count 4-13 RestoreWindow 4-55

DeleteProject 4-14 ResumeRecording 4-55

EnableAutosave 4-15 RunProgram 4-56

ExportOptionsFiles 4-16 RunScript 4-57

GetActiveProject 4-16 SelectScheduler 4-60

GetAutosaveEnabled 4-17 SetActiveProject 4-62

GetBuildTimeDateString 4-18 SetActiveProjectByPath 4-63

GetCustomMenuSet 4-19 SetCustomMenuSet 4-63

GetDesigns 4-22 SetDesktopConfiguration 4-65

GetDesktopConfiguration 4-23 SetSchematicEnvironment 4-67

GetDistributedAnalysisMachines Sleep 4-69


4-23 SubmitJob 4-70
GetDis- TileWindows 4-71
trib-
utedAna- Desktop Object Script Commands 4-1
lysisMachinesForDesignType
4-24 Desktop Scripting Conventions 1-84

GetName 4-30 DetachFaces 8-172

GetProjectList 4-34 DisableDiffPairs 22-14

GetProjects 4-28, 4-32 DisplayPinNames 26-29

GetSchematicEnvironment 4-35

Index-11
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

DistributedAnalyzeSetup, Opti- EditInsulating 11-39


metrics module command 14-
8 EditLayoutForce 19-12

DoesOutputVariableExist 9-3 EditLengthOp 12-27

Draw Menu commands 8-4 EditMatrix 19-15

DuplicateAlongLine 8-122 EditModelResolutionOp 12-30

DuplicateAroundAxis 8-125 EditMotionSetup E

DuplicateMirror 8-128 EditNotes 7-14


EditObjectCS 8-181
E
Editor object commands
Edit 25-69, 25-135, 25-170, 25-209,
SetPropertyValue 6-31
25-238
Editor Scripting IDs 24-4
Edit Menu Commands 8-120
EditOutputVariable 9-4
Edit3DComponent 8-87, 8-89
EditPolyline 8-92
EditCharge 11-63
EditRadiation 11-40
EditCoilTerminal 11-64
EditReduceOp 19-15
EditCurrent 11-64
EditRelativeCS 8-188
EditCurrentDensity 11-65
EditResistiveSheet 11-40
EditCurrentDensityTerminal 11-65
EditSetup
EditCylindricalGapOp 12-22
Analysis module command 13-4
EditCylindricalHField 11-36
optimization command 14-28
EditDependent 11-37
parametric command 14-19
EditEntityList 8-173
sensitivity command 14-43
EditExternalCircuit 11-66
statistical command 14-54
EditFaceCS 8-175
EditSink 11-66
EditFloating 11-66
EditSkinOp 12-31
EditFluxTangential_ 11-37
EditSolverOnDemandModel 25-96
EditForce 19-12
EditSurfaceMeshSummaryData 16-36
EditImpedance 11-38
EditSymmetry 11-42
EditIndependent 11-39

Index-12
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

EditTangentialHField 11-43 EnterVol 17-20


EditThinLayer 11-43 Event Callback Scripting 1-87
EditTorque 19-16 Example Scripts 28-1
EditTouching 11-46 Export 8-190, 25-108, 25-147, 25-
181, 25-227, 25-252
EditTrueSurfOp 12-33
ExportCircuit 13-12
EditUserDefinedSolution 21-4
ExportCitiFile 22-16
EditVectorPotential 11-47
ExportConvergence 7-24
EditVoltage 11-67
ExportDXConfigFile, Optimetrics mod-
EditVoltageAPhi 11-68 ule command 14-9
EditVoltageDrop 11-69 ExportFile 26-29
EditVolumeChargeDensity 11-70 ExportFullWaveSpice 25-153
EditWindingGroup 11-70 ExportHarmonicTransientForce 7-26
EditWithComps 25-97, 25-136, 25- ExportIcepak, Analysis module com-
170, 25-209, 25-245 mand 13-17
EditZeroTangentialHField 11-48 ExportImageToFile 10-40
ElectricRuleCheck 24-66 ExportMarkerTable 10-47
EnableAutoSave 4-15 ExportMaterial 25-37
EnableDiffPairs 22-15 ExportMatlab 22-18
EnableHarmonicForceCalculation ExportMesh Stats 7-28
7-15
ExportNetlist 24-68
EnterComplex 17-13
ExportOptimetricsProfile, Optimetrics
EnterComplexVector 17-13 module command 14-10
EnterLine 17-14 ExportOptimetricsResults, Opti-
EnterPoint 17-15 metrics module command 14-
11
EnterQty 17-16
ExportOptionsFiles 4-16
EnterScalar 17-16
ExportParametricResults, Optimetrics
EnterScalarFunc 17-17 module command 14-12
EnterSurf 17-18 ExportPlotImageToFile 10-41
EnterVector 17-18 ExportPlotImageWithViewToFile 16-
40
EnterVectorFunc 17-19

Index-13
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

ExportProfile 7-25, 7-28 EnterComplex 17-13


ExportReport 10-43 EnterComplexVector 17-13
ExportScript 25-260 EnterLine 17-14
ExportSolnData, Analysis module EnterPoint 17-15
command 13-17
EnterQty 17-16
ExportSpreadsheet 22-20
EnterScalar 17-16
ExportSurfaceMeshSummary 16-
42 EnterScalarFunc 17-17

ExportToFile 10-44 EnterSurf 17-18

ExportTouchstone 22-22 EnterVector 17-18

ExportTouchstone2 22-24 EnterVectorFunc 17-19

Extract 22-27 EnteVol 17-20


ExportSurfaceMeshSummary 16-42
F
ModifyFieldPlot 16-43
FFTONReport 10-47
RenameFieldPlot 16-47
Field Overlay module commands,
RenamePlotFolder 16-48
GetFieldPlotNames 16-43
SetFieldPlotSettings 16-49
field overlay script commands 16-1
SetPlotFolderSettings 16-52
Field Overlays module commands
SetPlotsViewSolutionContext 16-57
AddNamedExpr 17-3
UpdateAllFieldsPlots 16-58
CalcOp 17-4
UpdateQuantityFieldsPlots 16-59
CalcStack 17-6
Fields Calculator commands
ChangeGeomSettings 17-8
AddNamedExpr 17-2, 17-3
ClcMaterial 17-10
CalcOp 17-4
ClearAllNamedExpr 17-11
CalcStack 17-6
CopyNamedExprToStack 17-11
CalculatorWrite 17-7
CreateFieldPlot 16-4
ChangeGeomSettings 17-8
DeleteFieldPlot 16-36
ClcEval 17-9
DeleteNamedExpr 17-12
ClcMaterial 17-10
EditSurfaceMeshSummaryData
16-36

Index-14
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

ClearAllNamedExpr 17-11
G
CopyNamedExprToStack 17-11
general method script commands 24-
DeleteNamedExpr 17-12 45
EnterComplex 17-13 GenerateHistory 8-199
EnterComplexVector 17-13 GenerateVariationData Parametric,
EnterLine 17-14 parametric command 14-20

EnterPoint 17-15 Get3DComponentDefinitionNames 8-


97
EnterQty 17-16
Get3DComponentInstanceNames 8-
EnterScalar 17-16 98
EnterScalarFunc 17-17 Get3DComponentMaterialNames 8-
99
EnterSurf 17-18
Get3DComponentMaterialProperties
EnterVector 17-18 8-99
EnterVectorFunc 17-19 Get3DComponentParameters 8-97
EnterVol 17-20 GetActiveCoordinateSystem 8-204
ExportOnGrid 17-20 GetActiveDesign 2-40
ExportToFile 17-23 GetActiveProject 4-16
Fields Calculator Script GetAllCategories 10-49
Commands 17-1
GetAllQuantities 10-50
Fields reporter module commands
GetAllReportNames 10-48
ExportMarkerTable 10-47
GetArrayVariables 6-26
Fillet 8-196
GetAutoSaveEnabled 4-17
FindElements 24-69
GetAvailableDisplayTypes 10-51
FitToBorder 24-71
GetAvailableReportTypes 10-52
FlattenGroup 8-198
GetAvailableSolutions 10-52
FlipHorizontal 24-75, 26-30
GetBodyNamesByPosition 8-271
FlipVertical 24-76, 26-31
GetBoundaries 11-7
For...Next loop 1-9
GetBoundariesOfType 11-7
functions
GetBoundaryAssignment 11-6
VBScript procedures 1-10

Index-15
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetBuildDateTimeString 4-18 GetEdgeIDsFromFace 8-274


GetComponentName 23-2 GetEdgeIDsFromObject 8-275
GetComponentPinLocation 24-118 GetEditorName [Schematic] 24-119
GetCoordinateSystems 8-205 GetEvaluatedPropertyValue 24-106
GetCoreLossEffect 11-8 GetExcitations 11-10
GetCoreLossEffectOnField 11-9 GetExcitationsOfType 11-11
GetData 25-109, 25-119, 25-148, GetExeDir 4-25
25-182, 25-228, 25-253
GetFaceArea 8-275
GetDataExpressions 10-53
GetFaceByPosition 8-277
GetDataUnits 10-54
GetFaceCenter 8-276
GetDefinitionManager 2-41
GetFaceIDs 8-278
GetDependentFiles 2-42
GetFieldPlotNames, Field Overlay module
GetDesign 2-42, 2-42 command 16-43
GetDesigns 4-22 GetFrequencies 22-28
GetDesignValidationInfo 7-30 GetFrequencyCount 22-29
GetDesignVariableNames 10-55 GetGeometryMode 7-31
GetDesignVariableUnits 10-56 GetGeometryModelerMode 8-279
GetDesignVariableValue 10-57 GetImagDataValues 10-59
GetDesignVariationKey 10-58 GetInstanceID 23-3
GetDisplacementCurrent 11-9 GetInstanceName 23-4
GetDisplayType 10-59 GetLibraryDirectory 4-26
GetDistributedAnalysisMachines 4- GetMatchedObjectName 8-284
23
GetModelBoundingBox 8-280
GetDis-
trib- GetModelUnits 8-285
utedAna- GetModule 7-33
lysisMachinesForDesignType
4-24 GetMotionSetupNames G
GetDocumentNames 20-8 GetName 2-44, 4-30, 7-34, 22-30
GetEddyEffect 11-9 GetNames 25-110, 25-120, 25-150, 25-
183, 25-229, 25-254
GetEdgeByPosition 8-272

Index-16
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetNetConnections 24-120 GetProperties 6-26, 24-107, 25-121,


26-31
GetNPortData 25-114
GetPropertyValue 6-28, 10-61, 26-32
GetNumBoundaries 11-11
GetPropHost 23-5, 23-5
GetNumBoundariesOfType 11-12
GetPropServerName 23-5
GetNumExcitations 11-13
GetRealDataValues 10-63
GetNumExcitationsOfType 11-13
GetRegistryInt 4-74
GetNumObjects 8-285
GetRegistryString 4-75
GetNumPages 24-121
GetReportTraceNames 10-64
GetObjectIDByName 8-280
GetSelections 7-37, 8-286
GetObjectName 8-281
GetSetupCount 13-19
GetObjectNameByFaceID 8-281
GetSetupCount, Analysis module com-
GetObjectsByMaterial 8-282 mand 13-18
GetObjectsIngroup 8-283 GetSetupNames (Optimetrics), Opti-
GetOperationNames 12-3 metrics module command 14-
13
GetOutputVariableValue 9-6
GetSetupNamesByType (Opti-
GetParentDesign 23-4 metrics), Optimetrics module
command 14-13
GetPath 2-45
GetSetups 13-19
GetPer-
QuantityPrimarySweepValues Analysis module command 13-19
10-60
GetSolutionContexts 10-65
GetPersonalLibDirectory 4-31
GetSolutionDataPerVariation 10-66
GetPortCount 22-30
GetSolutionType 7-37
GetPortNumber 22-31
GetSolverOnDemandData 25-114
GetPostProcSettings 22-32
GetSolverOnDemandModelList 25-
GetProcessID 4-32 114
GetProjectDirectory 4-33 GetSweepCount 13-20
GetProjectList 4-34 GetSweepCount, Analysis module
command 13-20
GetProjectMaterialNames 25-36
GetSweepNames 10-68
GetProjects 4-28, 4-32

Index-17
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetSweeps 13-21 hierarchy of variables in HFSS 1-74


Analysis module command 13-
20 I
GetSweepUnits 10-69 If...Then... Else statement 1-8
GetSweepValues 10-70 Import (3D Modeler command) 8-206
GetSymmetryMultiplier H ImportANF 4-39
GetSysLibDirectory 4-36 ImportAutoCAD 4-40
GetTempDirectory 4-37 ImportDXF 8-209
GetTopDesignList 2-46 ImportGDSII 4-41, 8-213
GetTopEntryValue 17-26 ImportIntoReport 10-72
GetUserLibDirectory 4-38 ImportODB 4-42
GetUserPosition 8-287 ImportSetup, Optimetrics module com-
mand 14-14
GetValidISolutionList 15-2
include files
GetVariables 6-30
scripts 1-10
GetVariableValue 6-30
indentation, IronPython 1-19
GetVariation 22-33
Information Method List 24-112
GetVariationVariableValue 7-37
InitialMeshSettings 12-35
GetVersion 4-38
InputBox function 1-11
GetVertexIDsFromEdge 8-287
Insert3DComponent 8-100
GetVertexIDsFromFace 8-288
InsertDesign 2-46
GetVertexIDsFromObject 8-289
InsertDesignWithWorkflow 2-47
GetVertexPosition 8-289
InsertNativeComponent 8-101
GetVisibleLevels 26-32
InsertSetup
GridSetup 24-72, 26-33
Analysis module command 13-21
GroupPlotCurvesByGroup-
ingStrategy 10-71 optimization command 14-35
parametric command 14-21
H
sensitivity command 14-50
HasSameData 22-34
statistical command 14-57
HealObject 8-200

Index-18
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Intersect 8-217 AssignFluxTangential_1 11-23


IronPython 1-12, 1-13 AssignResistiveSheet 11-27
indentation in 1-19 AssignThinLayer 11-30
Is2D 7-39 AssignTouching 11-34
Is3D 7-39 AssignVectorPotential 11-35
IsDataComplex 10-72 AssignVoltageAPhi_ 11-59
IsPerQuantityPrimarySweep 10-73 EditCurrent 11-64
IsUsed 25-115, 25-122, 25-150, 25- EditFluxTangential 11-37
184, 25-229, 25-255
EditResistiveSheet 11-40

L EditThinLayer 11-43

LaunchJobMonitor 4-43 EditTouching 11-46

LoadNamedExpressions 17-27 EditVectorPotential 11-47

LoadSolution 22-36 EditVoltageAPhi 11-68

logical operators 1-7 Maxwell definition manager com-


mands
looping through code
ComputeCoreLossCoefficients 25-
Do ... Loop 1-9 13
For ... Next 1-9 Maxwell Draw commands
Create3DComponent 8-6
M
Maxwell parameter setup commands
material commands
AddReduceOp 19-2
AddDefinitionFromBlock 8-246
EditReduceOp 19-15
AddDefinitionFromLibFile 8-251
Mesh Operations module commands
AddMaterial 25-2, 25-15
AssignCylindricalGapOp 12-5
CloneMaterial 25-12
AssignLengthOp 12-12
ExportMaterial 25-37
AssignModelResolutionOp 12-15
RemoveMaterial 25-38
AssignSkinDepthLayerSetting 12-
Materials Scripting Support 2-23 17
Maxwell boundary condition com- AssignSkinDepthOp 12-18
mands
AssignTrueSurfOp 12-19
AssignCurrent 11-54

Index-19
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

DeleteOp 12-2 Module Setup commands


EditCylindricalGapOp 12-22 GetSymmetryMultiplier H
EditLengthOp 12-27 SetSymmetryMultiplier H
EditModelResolutionOp 12-30 modules in HFSS scripting 1-74
EditSkinOp 12-31 Motion Setup commands
EditTrueSurfOp 12-33 AssignBand C
GetOperationNames 12-3 DeleteMotionSetup A
InitialMeshSettings 12-35 EditMotionSetup E
RenameOp 12-3 GetMotionSetupNames G
Mesh Operations Module Script ReassignMoving B
Commands 12-1
Move 8-133, 26-34
mesh operations script
commands 12-2 MoveCSToEnd 8-218

method format, create schematic MoveEnityToGroup 8-219


objects 24-2 MoveFaces 8-220
Microsoft MovePlotCurvestoGroup 10-74
VBScript user’s guide 1-12 MovePlotCurvestoNewGroup 10-75
Mirror 8-131 MsgBox function 1-11
Model Manager Script
Commands 25-123 N
Modeler Menu Commands 8-140 Named Arguments 1-84
ModifyFieldPlot 16-43 NameNets 24-79
ModifyInceptionParameters 16-46 NdExplorer
ModifyLibraries 25-261 Script Commands 22-1
module script commands Network Data Explorer Manager Com-
boundary/excitation 11-2 mands 25-153

field overlay 16-1 NewProject 4-44

general method 24-45


O
mesh operations 12-2
oAnsoftApp object 1-74
Object Oriented Property Scripting 2-1

Index-20
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

oDesign object 1-74 SolveSetup 13-2, 14-7, 14-17, 14-


18
oDesktop object 1-74
Optimetrics Module Script
oEditor object 1-74 Commands 14-1
OffsetFaces 8-134 optimization commands
oModule object 1-74 EditSetup 14-28
Open 22-37 InsertSetup 14-35
OpenAndConvertProject 4-45 Optimization Script Commands 14-28
OpenExternalEditor 8-290 Other oEditor Commands 8-243
OpenMultipleProjects 4-46 output variable commands
OpenProject 4-47 CreateOutputVariable 9-1
operators DeleteOutputVariable 9-3
arithmetic 1-6 DoesOutputVariableExist 9-3
categories in VBScript 1-5 EditOutputVariable 9-4
comparison 1-7 GetOutputVariableValue 9-6
logical 1-7 Output Variable Script Commands 9-
precedence of 1-5 1

oProject object 1-74


P
Optimetrics module commands
PageBorders 24-81
DeleteSetups 14-8
PageSetup 8-291
DistributeAnalyzeSetup 14-8
Pan 24-81, 26-35
ExportDXConfigFile 14-9
Parameter setup commands
ExportOptimetricsProfile 14-10
DeleteReduceMatrix 19-11
ExportOptimetricsResults 14-11
DeleteReduceOp 19-11
ExportParametricResults 14-12
RenameReduceMatrix 19-17
GetSetupNames 14-13
RenameReduceOp 19-18
GetSetupNamesByType 14-13
Parameter Setup commands
ImportSetup 14-14
AssignMatrix 19-7
RenameSetup 14-16
AssignTorque 19-9

Index-21
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

DeleteAllParameters 19-10 Project object commands


EditForce 19-12 AddMaterial 25-2, 25-15
EditMatrix 19-15 ChangeProperty 26-6
EditTorque 19-16 CloneMaterial 25-12
ReassignParameter 19-16 Close 2-36
RenameParameter 19-17 CopyDesign 2-37
parametric commands CutDesign 2-37
EditSetup 14-19 DeleteDesign 2-38
GenerateVariationData Para- ExportMaterial 25-37
metric 14-20
GetActiveDesign 2-40
InsertSetup 14-21
GetArrayVariables 6-26
Parametric Script Commands 14-
18 GetDependentFiles 2-42

Paste 2-49, 4-48, 4-48, 24-83, 26- GetDesign 2-42


35 GetName 2-44
Paste (Model Editor) 8-136 GetPath 2-45
Paste (Project Object) 2-49, 4-48 GetProjectMaterialNames 25-36
PasteData 24-84 GetProperties 6-26, 26-31
PasteDesign (Schematic GetPropertyValue 6-28, 10-61, 26-32
Editor) 24-84
GetTopDesignList 2-46
PasteReports 10-76
GetTopEntryValue 17-26
PasteSetup
GetVariables 6-30
Analysis module command 13-
37 GetVariableValue 6-30
Optimetrics module InsertDesign 2-46
command 14-15
LoadSolution 22-36
PasteSweep 13-37
Paste 2-49, 2-49, 4-48, 4-48, 4-48
PasteTraces 10-77
Redo 2-50
PauseRecording 4-49
RemoveMaterial 25-38
PauseScript 4-50
RemoveUnusedDefinitions 25-39
Print 4-50

Index-22
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Rename 2-50 Property Script Commands 6-1


RestoreProjectArchive 2-51, 4- Conventions uSed in thie
54 Chapter 6-13
Save 2-52 Object Script Property Function
Summary 6-3
SaveAs 2-53
PurgeHistory 8-224
SaveAsStandAloneProject 2-55
PushExcitations 24-87
SaveProjectArchive 2-56
Layout Editor 24-87
SetActiveDesign 2-58
SetPropertyValue 6-31 Q
SetVariableValue 6-33 QuitApplication 4-51
SimulateAll 2-34, 2-58
R
Undo 2-59
ReassignBoundaries 11-3, 11-14
UpdateDefinitions 2-60
ReassignBoundary 11-14
Project Object Script Commands 2-
31 ReassignMoving B
ProjectSheet 8-223 ReassignParameter 19-16
property commands Redo 26-36
ChangeProperty 26-6 design-level command 7-40
GetArrayVariables 6-26 project-level command 2-50
GetProjectMaterialNames 25-36 references, for VBScript 1-12
GetProperties 6-26, 26-31 RefreshJobMonitor 4-52
GetPropertyValue 6-28, 10-61, ReleaseData 10-78
26-32
Remove 25-115, 25-151, 25-184, 25-
GetTopEntryValue 17-26 229, 25-255
GetVariables 6-30 RemoveAssignmentFromBoundary
11-15
GetVariableValue 6-30
RemoveLevels 26-37
SetPropertyValue 6-31
RemoveMaterial 25-38
SetVariableValue 6-33
RemovePort 26-37
Property Method List 24-105
RemoveScript 25-260

Index-23
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

RemoveSolverOnDemandModel AddCartesianXMarker 10-6, 10-7


25-116
AddDeltaMarker 10-8
RemoveUnused 25-117, 25-123,
25-152, 25-185, 25-231, 25- AddMarker 10-9
256 AddMarkerToPlot 16-2
RemoveUnusedDefinitions 25-39 AddNote 10-10
Rename 2-50, 22-38 AddTraceCharacteristics 10-12
RenameBoundary 11-16 AddTraces 10-13
RenameDesignInstance 7-41 ChangeProperty 10-16
RenameFieldPlot 16-47 ClearAllMarkers 10-20
RenameOp 12-3 ClearAllTraceCharacteristics 10-20
RenameParameter 19-17 CopyReportDefinition 10-23
RenamePart 8-293 CopyReportsData 10-22
RenamePlotFolder 16-48 CopyTraceDefinitions 10-23
RenameReduceMatrix 19-17 CopyTracesData 10-21
RenameReduceOp 19-18 CreateReport 10-25
RenameReport 10-79 CreateReportFromFile 10-24
RenameSetup 13-38 CreateReportFromTemplate 10-35
Analysis module command 13- CreateReportOfAllQuantities 10-36
38
DeleteAllReports 10-38
Optimetrics module
command 14-16 DeleteReport 10-39
RenameTraces 10-79 DeleteTraces 10-39
Renormalize 22-39 ExportImageToFile 10-40
Reorder 22-41, 22-42 ExportPlotImageToFile 10-41, 16-40
Repeating a Statement Until a ExportReport 10-43
Condition Becomes True 1-9
ExportToFile 10-46, 10-71
Repeating Statements While a
Condition is True 1-9 FFTOnReport 10-47

Reporter editor commands GetAllCategories 10-49

AddCartesianLimitLine 10-4 GetAllQuantities 10-50

Index-24
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

GetAllReportNames 10-48 ResetLogging 4-53


GetAvailableDisplayTypes 10-51 ResetPlotSettings 10-80
GetAvailableReportTypes 10-52 ResetSetupToTimeZero 13-39
GetAvailableSolutionss 10-52 RestoreWindow 4-55
GetDisplayType 10-59 RestToTimeZero 7-41
GetReportTraceNames 10-64 ResumeRecording 4-55
GetSolutionContexts 10-65, 10- RevertAllToInitial 13-39
65
RevertSetupToInitial 13-41
GroupPlotCurvesByGroup-
ingStrategy 10-71 RevertSetupToInitialTemperature 13-
41
MovePlotCurvestoGroup 10-74
Rotate 8-137, 24-90, 26-38
MovePlotCurvestoNewGroup
10-75 Running Instance Manager Script
Commands 5-1
PasteReports 10-76
RunProgram 4-56
PasteTraces 10-77
RunScript 4-57
RenameReport 10-79
RunScriptWithArguments 4-59
RenameTraces 10-79
RunToolkit 7-68
ResetPlotSettings 10-80
SavePlotSettingsAsDefault 10- S
81
sample scripts
UnGroupPlotCurvesInGroup 10-
variable helix 28-13
88
Save 2-52, 26-39
UpdateAllReports 10-82
SaveAs 2-53
UpdateReports 10-82
SaveAsStandAloneProject 2-55
UpdateTraces 10-83
SaveNamedExpressions 17-28
UpdateTracesContextAndSweeps
10-86 SavePlotSettingsAsDefault 10-81
Reporter Editor Script Scale 8-138
Commands 10-1
Schematic Scripting 24-1
ReprioritizeBoundaries 11-17
Create Method List 24-6
Reset 22-43
Scope and Lifetime of Variables 1-4
ResetAllToTimeZero 13-39

Index-25
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

Script and Library Scripts 25-257 sensitivity commands


script commands EditSetup 14-43
boundary/excitation 11-2 InsertSetup 14-50
field overlay 16-1 Sensitivity Script Commands 14-43
general method script com- SeparateBody 8-226
mands 24-45
SetActiveDefinitionEditor 2-57
mesh operations 12-2
SetActiveDesign 2-58
Script Commands for Creating and
Modifying Excitations in Max- SetActiveEditor 7-42
well 11-48 SetActiveLevel 26-40
Script Commands for Creating and SetActiveProject 4-62
Modifying Boundaries in Max-
well 11-18 SetActiveProjectByPath 4-63
Script Commands for Creating and SetAllPortImpedance 22-44
Modifying Mesh
Operations 12-4 SetConductivityThreshold 7-43

scripts SetCoreLoss 11-70

CPython 1-70 SetDesignSettings 7-43

IronPython 1-12, 1-13 SetEddyEffect 11-71

overview 1-1 SetFastTrans-


formationForLayoutComponent 7-
pausing 1-79 57, 7-58
recording 1-80 SetFieldPlotSettings 16-49
running 1-78 SetInitialLevels 26-41
stopping 1-79 SetLibraryDirectory 4-66
VBScript 1-2 SetMagnetizationCompute 11-72
Section 8-225 SetMinimumTimeStep 11-73
Select Case statement 1-8 SetModelUnits 8-227
SelectAll 24-92, 26-39 SetPageData 24-94
SelectPage 24-93 SetPlotFolderSettings 16-52
SelectScheduler 4-60 SetPlotsViewSolutionContext 16-57
SendToBack 24-97, 26-40 SetPortDeembedDistance 22-45

Index-26
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

SetPortImpedance 22-46 Solutions Module Script


Commands 15-1
SetPostProcSettings 22-47
Solve 7-67
SetProjectDirectory 4-66
SolveAllSetup, Optimetrics module
SetPropertyValue 6-31, 26-42 command 14-18
SetShowLay- SolveSetup, Optimetrics module com-
outForLayoutComponent 7- mand 14-17
65, 7-65
SortComponents 24-98
SetSolutionType 7-66
Split 8-230
SetSymmetryMultiplier H
statistical commands
SetTempDirectory 4-68
EditSetup 14-54
Setting Numerical Values 1-86
InsertSetup 14-57
SetupYConnection 11-74
Statistical Script Commands 14-54
SetVariableValue 6-33
StopSimLink 7-67
SetVisibleLevels 26-42
Stretch 22-49
SetWCS 8-229
Sub Procedures 1-10
SGetAppDesktop 3-2
SubmitJob 4-70
ShowlWindow 8-230
Subtract 8-233
ShowVariableBlock 24-98
SweepAlongPath 8-107
simple and composite names 1-3
SweepAlongVector 8-109
SimulateAll 2-34, 2-58
SweepAroundAxis 8-112
Sleep 4-69
SweepFacesAlongNormal 8-114, 8-
Smooth 22-48 114, 8-235, 8-235
Solutions module commands Sweep-
ConstructVariationString 7-9 FacesAlongNormalWithAt-
tributes 8-116
DeleteFieldVariation 7-12
Symbol Editor Scripts 26-1
DeleteFullVariation 7-8, 7-13
Symbol Manager Script
DeleteLinkedDataVariation 7-13 Commands 25-158
DeleteSolutionVariation 15-1
T
GetValidISolutionLIst 15-2
Terminate 22-51

Index-27
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Maxwell Scripting Guide

ThickenSheet 8-236 User Defined Solutions Commands 21-1


ToggleLevel 26-43 Using a Do Loop 1-9

U V
UncoverFaces 8-238 ValidateDesign 7-70
Undo 26-44 Variable Naming Conventions 1-4
project-level command 2-59 variables
Ungroup 8-241 array 1-4
UnGroupPlotCurvesInGroup 10-88 assigning information 1-3
Unite 8-240 declaring 1-3
UpdateAllFieldsPlots 16-58 hierarchy in HFSS 1-74
UpdateAllReports 10-82 used in HFSS scripts 1-74
UpdateComponentDefinition 8-119 VBScript 1-2
UpdateDefinitions, project-level Microsoft user’s guide 1-12
command 2-60
operators 1-5
UpdateDynamicLink 25-118
references 1-12
UpdateQuantityFieldsPlots 16-59
VBScript Procedures 1-10
UpdateReports 10-82
UpdateTraces 10-83 W
UpdateTracesContextAndSweeps Wire (Schematic Editor) 24-99
10-86
WrapSheet 8-242
User defined documents module
commands
Z
GetDocumentNames 20-8
ZoomArea 24-100, 26-45
User defined solution module com-
ZoomIn 24-101, 26-46
mands
ZoomOut 24-102, 26-46
CreateUserDefinedSolution 21-
1 ZoomPrevious 24-103, 26-47
DeleteUserDefinedSolutions 21- ZoomToFit 24-104, 26-47
3
EditUserDefinedSolution 21-4

Index-28
Ansys Electromagnetics Suite 2024 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.

You might also like