IcepakScriptingGuide PDF
IcepakScriptingGuide PDF
Release 2019 R3
ANSYS, Inc. July 2019
Southpointe
2600 ANSYS Drive ANSYS, Inc. and
Canonsburg, PA 15317 ANSYS Europe,
[email protected] Ltd. are UL
https://www.ansys.com registered ISO
9001:2015 com-
(T) 724-746-3304 panies.
(F) 724-514-9494
Icepak Scripting Guide
2
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Table of Contents
Table of Contents Contents-1
1 - Introduction to VBScript 1-2
Simple and Composite Names 1-3
VBScript Variables 1-3
Declaring Variables 1-3
Declaring Variables in Python 1-4
Variable Naming Conventions 1-4
Scope and Lifetime of Variables 1-4
Array Variables 1-4
VBScript Operators 1-5
Operator Precedence 1-5
Arithmetic Operators 1-6
Comparison Operators 1-6
Logical Operators 1-6
Controlling Program Execution 1-7
Using If...Then...Else 1-7
Using Select Case 1-7
Looping Through Code 1-8
Using a For...Next Loop 1-8
Using a Do Loop 1-8
Repeating Statements While a Condition is True 1-8
Repeating a Statement Until a Condition Becomes True 1-8
VBScript Procedures 1-9
Function Procedures 1-9
Sub Procedures 1-9
Converting Between Data Types 1-9
Including Scripts 1-10
Aborting Scripts 1-10
Contents-1
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Contents-2
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Contents-3
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Contents-4
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
GetPrimitiveTypeInfo() 3-39
GetPrimitiveParametersDefinition2() 3-39
AreParameterValuesValid2(errorMsg, udpParams) 3-39
CreatePrimitive2(funcLib, udpParams) 3-40
Optional methods 3-40
GetPrimitiveParameters() 3-40
GetRegisteredFaceNames() 3-40
GetRegisteredEdgeNames() 3-40
GetRegisteredVertexNames() 3-40
MapParametersDefinitionVersions2(oldVersion, oldUDPParams) 3-40
GetOldPrimitiveParametersDefinition2(version ) 3-41
Example UDP 3-41
UDPFunctionLibrary 3-41
Functions list: 3-42
UDMExtension 3-45
Import 3-45
Main class: UDMExtension 3-45
IUDMExtension methods 3-45
Mandatory methods. 3-45
GetInfo() 3-45
IsAttachedToExternalEditor() 3-45
CreateInstance(funcLib) 3-46
GetUnits(instanceId) 3-46
ReleaseInstance(instanceId) 3-46
GetAttribNameForEntityId() 3-47
GetAttribNameForPartId() 3-47
Optional methods 3-47
GetInstanceSourceInfo(instanceId) 3-48
ShouldAttachDefinitionFilesToProject() 3-48
Example UDM 3-48
Contents-5
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
UDMFunctionLibrary 3-48
Functions list: 3-49
UDP/UDM Structures and constants 3-50
UDP/UDM Structures 3-50
List of structures 3-51
UDP/UDM Constants 3-57
Enum constants: 3-57
Logging and Desktop Messaging 3-59
Collecting EBU Logs 3-59
Collecting WB Logs 3-60
Example Scripts for Python UDP and UDM 3-60
4 - Application Object Script Commands 4-2
GetAppDesktop 4-2
5 - Desktop Object Script Commands 5-2
AddMessage 5-4
ClearMessages 5-5
CloseAllWindows 5-5
CloseProject 5-6
CloseProjectNoForce 5-6
Count 5-7
DeleteProject 5-8
EnableAutoSave 5-9
ExportOptionsFiles 5-10
GetActiveProject 5-11
GetAutoSaveEnabled 5-12
GetBuildDateTimeString 5-13
GetDesigns 5-14
GetDistributedAnalysisMachines 5-16
GetDistributedAnalysisMachinesForDesignType 5-17
GetExeDir 5-18
Contents-6
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
GetLibraryDirectory 5-18
GetMessages 5-19
GetName [Desktop] 5-22
GetPersonalLibDirectory 5-24
GetProcessID 5-25
GetProjects 5-26
GetProjectDirectory 5-27
GetProjectList 5-28
GetSysLibDirectory 5-29
GetTempDirectory 5-30
GetUserLibDirectory 5-31
GetVersion 5-33
ImportANF 5-34
ImportAutoCAD 5-35
ImportGDSII 5-35
5-36
LaunchJobMonitor 5-37
NewProject 5-38
OpenAndConvertProject 5-39
OpenMultipleProjects 5-39
OpenProject 5-40
Paste (Project Object) 5-41
Paste (Project Object) 5-42
PauseRecording 5-44
PauseScript 5-44
Print 5-45
QuitApplication 5-46
RefreshJobMonitor 5-47
RestoreProjectArchive 5-49
RestoreWindow 5-50
Contents-7
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
ResumeRecording 5-51
RunProgram 5-52
RunScript 5-53
RunScriptWithArguments 5-54
SelectScheduler 5-55
SetActiveProject 5-56
SetActiveProjectByPath 5-57
SetLibraryDirectory 5-59
SetProjectDirectory 5-59
SetTempDirectory 5-60
Sleep 5-61
SubmitJob 5-61
TileWindows 5-62
Desktop Commands For Registry Values 5-63
DoesRegistryValueExist 5-64
GetRegistryInt 5-64
GetRegistryString 5-64
SetRegistryFromFile 5-65
SetRegistryInt 5-65
SetRegistryString 5-66
6 - Project Object Script Commands 6-2
AnalyzeAll [project] 6-3
ClearMessages 6-3
Close 6-4
CopyDesign 6-4
CutDesign 6-4
DeleteDesign 6-5
GetActiveDesign 6-6
GetDefinitionManager 6-6
GetDependentFiles 6-7
Contents-8
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Contents-9
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
SetVariableValue 8-14
9 - Dataset Script Commands 9-2
AddDataset 9-2
DeleteDataset 9-3
EditDataset 9-4
ImportDataset 9-5
10 - Design Object Script Commands 10-2
ConstructVariationString 10-3
DeleteFieldVariation 10-4
DeleteFullVariation 10-6
DeleteLinkedDataVariation 10-7
DeleteVariation 10-9
ExportConvergence 10-9
ExportMeshStats 10-11
ExportProfile 10-12
GetDesignType 10-13
GetModule 10-14
GetName 10-15
GetNominalVariation 10-16
GetSelections 10-16
GetSolutionType 10-18
GetSolveInsideThreshold 10-18
GetSourceContexts 10-18
GetVariationVariableValue 10-19
GeometryCheckAndAutofix 10-19
PasteDesign (Design Object) 10-21
Redo [Design] 10-22
RenameDesignInstance 10-23
ResetToTimeZero 10-23
SARSetup 10-24
Contents-10
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
SetActiveEditor 10-25
SetBackgroundMaterial 10-26
SetLengthSettings 10-26
SetSolutionType 10-27
SetSolveInsideThreshold 10-28
SetSourceContexts 10-28
Solve 10-29
RunToolkit 10-30
Undo [Design] 10-34
ValidateDesign 10-34
11 - 3D Modeler Editor Script Commands 11-2
Draw Menu Commands 11-3
Create3D Component 11-4
CreateBondwire 11-6
CreateCutplane 11-7
CreateEquationCurve 11-7
CreateEquationSurface 11-10
CreateHelix 11-13
CreatePoint 11-14
CreateUserDefinedPart 11-14
CreateRegion 11-15
CreateRegularPolyhedron 11-19
CreateSpiral 11-20
CreateUserDefinedModel 11-21
CreateUserDefinedPart 11-23
Edit3DComponent 11-25
EditPolyline 11-26
Get3DComponentParameters 11-27
Get3DComponentDefinitionNames 11-27
Get3DComponentInstanceNames 11-28
Contents-11
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Get3DComponentMaterialNames 11-28
Get3DComponentMaterialProperties 11-29
Insert3DComponent 11-29
InsertPolylineSegment 11-30
SweepAlongPath 11-31
SweepAlongVector 11-32
SweepAroundAxis 11-33
SweepFacesAlongNormal 11-33
SweepFacesAlongNormalWithAttributes 11-35
UpdateComponentDefinition 11-36
Edit Menu Commands 11-37
Copy 11-37
DeletePolylinePoint 11-37
DuplicateAlongLine 11-38
DuplicateAroundAxis 11-39
DuplicateMirror 11-41
Mirror 11-43
Move 11-44
OffsetFaces 11-44
Paste (Model Editor) 11-45
Rotate 11-45
Scale 11-46
Modeler Menu Commands 11-46
AssignMaterial 11-48
Chamfer 11-48
Connect 11-50
CoverLines 11-50
CoverSurfaces 11-50
CreateEntityList 11-50
CreateFaceCS 11-51
Contents-12
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
CreateGroup 11-52
CreateObjectCS 11-54
CreateObjectFromEdges 11-57
CreateObjectFromFaces 11-58
CreateRelativeCS 11-59
DeleteEmptyGroups 11-60
DeleteLastOperation 11-61
DetachFaces 11-61
EditEntityList 11-62
EditFaceCS 11-63
EditObjectCS 11-63
EditRelativeCS 11-66
Export 11-67
ExportModelImageToFile 11-67
Fillet 11-69
FlattenGroup 11-71
GenerateHistory 11-71
HealObject 11-71
GetActiveCoordinateSystem 11-75
GetCoordinateSystems 11-75
Import 11-76
ImportDXF 11-78
ImportGDSII [Modeler Import] 11-81
Intersect 11-83
MoveCStoEnd 11-83
MoveEntityToGroup 11-84
MoveFaces 11-85
ProjectSheet 11-87
PurgeHistory 11-88
ReplaceWith3DComponent 11-88
Contents-13
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Section 11-91
SeparateBody 11-91
SetModelUnits 11-92
SetWCS 11-92
ShowWindow 11-93
Split 11-93
Subtract 11-94
SweepFacesAlongNormal 11-95
ThickenSheet 11-96
UncoverFaces 11-97
Unite 11-99
Unroup 11-99
WrapSheet 11-100
Other oEditor Commands 11-101
BreakUDMConnection 11-102
Delete 11-103
FitAll 11-103
GetBodyNamesByPosition 11-103
GetEdgeByPosition 11-104
GetEdgeIDsFromFace 11-105
GetEdgeIDsFromObject 11-105
GetFaceArea 11-106
GetFaceCenter 11-106
GetFaceByPosition 11-107
GetFaceIDs 11-108
GetMatchedObjectName 11-108
GetModelBoundingBox 11-109
GetModelUnits 11-109
GetNumObjects 11-110
GetObjectIDByName 11-110
Contents-14
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
GetObjectName 11-111
GetObjectNameByFaceID 11-111
GetObjectsByMaterial 11-112
GetObjectsInGroup 11-112
GetPropertyValue 11-113
GetSelections [Model Editor] 11-115
GetUserPosition 11-116
GetVertexIDsFromEdge 11-117
GetVertexIDsFromFace 11-117
GetVertexIDsFromObject 11-117
GetVertexPosition 11-118
OpenExternalEditor 11-118
PageSetup 11-119
RenamePart 11-119
12 - Output Variable Script Commands 12-1
CreateOutputVariable 12-1
DeleteOutputVariable 12-4
DoesOutputVariableExist 12-5
EditOutputVariable 12-6
GetOutputVariableValue 12-8
SimValueContext 12-17
13 - Reporter Editor Script Commands 13-2
AddCartesianLimitLine 13-5
AddCartesianXMarker 13-6
AddCartesianYMarker 13-6
AddDeltaMarker 13-7
AddMarker 13-8
AddNote 13-8
AddTraceCharacteristics 13-9
AddTraces 13-11
Contents-15
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
ClearAllMarkers 13-15
ClearAllTraceCharacteristics 13-17
CopyTracesData 13-18
CopyReportData 13-18
CopyReportDefinitions 13-19
CopyTraceDefinitions 13-20
CreateReport 13-20
CreateReport [Designer] 13-26
CreateReportFromTemplate 13-30
CreateReportOfAllQuantities 13-31
DeleteMarker 13-32
DeleteAllReports 13-33
DeleteReports 13-34
DeleteTraces 13-34
ExportImageToFile [Reporter] 13-35
ExportPlotImageToFile [Reporter] 13-36
ExportReport 13-38
ExportToFile 13-39
ExportToFile [Reporter] 13-40
ExportMarkerTable 13-40
FFTOnReport 13-41
GetAllCategories 13-43
GetAllReportNames 13-44
GetAllQuantities 13-46
GetAvailableDisplayTypes 13-46
GetAvailableReportTypes 13-47
GetAvailableSolutions 13-48
GetDataExpressions 13-48
GetDataUnits 13-49
GetDesignVariableNames 13-49
Contents-16
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
GetDesignVariableUnits 13-50
GetDesignVariableValue 13-50
GetDesignVariationKey 13-51
GetDisplayType 13-52
GetImagDataValues 13-52
GetPerQuantityPrimarySweepValues 13-53
GetPropertyValue 13-54
GetRealDataValues 13-56
GetReportTraceNames 13-57
GetSolutionContexts 13-58
GetSolutionDataPerVariation 13-59
GetSweepNames 13-61
GetSweepUnits 13-61
GetSweepValues 13-62
GroupPlotCurvesByGroupingStrategy 13-62
ImportIntoReport 13-64
IsDataComplex 13-64
IsPerQuantityPrimarySweep 13-65
MovePlotCurvesToGroup 13-65
MovePlotCurvesToNewGroup 13-66
PasteReports 13-67
PasteTraces 13-67
Release Data 13-68
RenameReport 13-68
RenameTrace 13-69
ResetPlotSettings 13-69
SavePlotSettingsAsDefault 13-70
UpdateTraces 13-71
UpdateTracesContextandSweeps 13-78
UpdateAllReports 13-80
Contents-17
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
UpdateReports 13-80
UnGroupPlotCurvesInGroup 13-81
14 - Boundary and Excitation Module Script Commands 14-1
General Commands Recognized by the Boundary/Excitations Module 14-2
AddAssignmentToBoundary 14-2
AutoIdentifyNets 14-4
AutoIdentifyPorts 14-4
AutoIdentifyTerminals 14-5
ChangeImpedanceMult 14-5
ConvertNportCircuitElementsToPorts 14-6
CreateNportCircuitElements 14-6
DeleteAllBoundaries 14-8
DeleteAllExcitations 14-8
DeleteBoundaries 14-9
GetBoundaryAssignment 14-10
GetBoundaries 14-10
GetBoundariesOfType 14-10
GetDefaultBaseName 14-11
GetExcitations 14-11
GetExcitationsOfType 14-11
GetNumBoundaries GetNumBoundaries 14-12
GetNumBoundariesOfType 14-12
GetNumExcitations 14-12
GetNumExcitationsOfType 14-13
GetPortExcitationCounts 14-13
ReassignBoundary 14-13
RemoveAssignmentFromBoundary 14-15
RenameBoundary 14-16
ReprioritizeBoundaries 14-17
SetDefaultBaseName 14-17
Contents-18
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Contents-19
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
EditFiniteCond 14-54
EditHalfSpace 14-55
EditHybridRegion 14-56
EditImpedance 14-56
EditIncidentWave 14-56
EditLayeredImpedance 14-58
EditMaster 14-58
EditPerfectE 14-58
EditPerfectH 14-58
EditLumpedPort 14-59
EditLumpedRLC 14-60
EditMagneticBias 14-60
EditRadiation 14-60
EditSlave 14-62
EditSymmetry 14-62
EditTerminal 14-62
EditVoltage 14-63
EditWavePort 14-63
LumpedPortToCircuitPort 14-63
SetHybridRegionCoupledGroup 14-63
SetTerminalReferenceImpedances 14-66
SwapCircuitPortAssignment 14-66
UnassignIERegions 14-67
Script Commands for Creating and Modifying PMLs 14-68
CreatePML 14-68
ModifyPMLGroup 14-70
PMLGroupCreated 14-71
PMLGroupModified 14-71
RecalculatePMLMaterials 14-71
15 - Analysis Setup Module Script Commands 15-1
Contents-20
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
CopySetup 15-1
CopySweep 15-2
DeleteDrivenSweep 15-2
DeleteSetups 15-2
DeleteSweep [HFSS-IE] 15-3
EditFrequencySweep 15-3
EditSetup 15-4
EditSweep [HFSS-IE] 15-6
EditCircuitSettings 15-7
ExportCircuit 15-8
GetSetupCount 15-11
GetSetups 15-11
InsertFrequencySweep 15-12
InsertSetup 15-20
InsertSetup [HFSS-IE] 15-36
InsertSetup [Transient] 15-37
InsertSweep [HFSS-IE] 15-43
PasteSetup 15-46
PasteSweep 15-47
RenameDrivenSweep 15-47
RenameSetup 15-47
RenameSweep [HFSS-IE] 15-48
RevertAllToInitial 15-49
RevertSetupToInitial 15-49
SetMPIVendor 15-49
16 - Optimetrics Module Script Commands 16-1
General Commands Recognized by the Optimetrics Module 16-4
CopySetup 16-4
DeleteSetups [Optimetrics] 16-5
DistributedAnalyzeSetup 16-5
Contents-21
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
ExportDXConfigFile 16-6
ExportOptimetricsProfile 16-7
ExportOptimetricsResult 16-7
ExportParametricResults 16-8
GetSetupNames [Optimetrics] 16-9
GetSetupNamesByType [Optimetrics] 16-9
ImportSetup 16-10
PasteSetup [Optimetrics] 16-11
RenameSetup [Optimetrics] 16-12
SolveAllSetup 16-12
SolveSetup [Optimetrics] 16-13
Parametric Script Commands 16-13
EditSetup [Parametric] 16-13
GenerateVariationData (Parametric) 16-14
InsertSetup [Parametric] 16-14
Optimization Script Commands 16-18
EditSetup [Optimization] 16-18
InsertSetup [Optimization] 16-22
Sensitivity Script Commands 16-30
EditSetup [Sensitivity] 16-30
InsertSetup [Sensitivity] 16-35
Statistical Script Commands 16-38
EditSetup [Statistical] 16-38
InsertSetup [Statistical] 16-41
17 - Solutions Module Script Commands 17-1
DeleteSolutionVariation 17-1
18 - Field Overlays Module Script Commands 18-1
AddMarkerToPlot 18-1
CreateFieldPlot 18-2
DeleteFieldPlot 18-15
Contents-22
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
GetFieldPlotNames 18-15
ModifyFieldPlot 18-17
RenameFieldPlot 18-18
RenamePlotFolder 18-18
SetFieldPlotSettings 18-19
SetPlotFolderSettings 18-20
UpdateAllFieldsPlots 18-24
UpdateQuantityFieldsPlots 18-24
19 - Fields Calculator Script Commands 19-1
AddNamedExpression 19-2
AddNamedExpr 19-2
CalcOp 19-3
CalcRead(deprecated) 19-3
CalculatorRead 19-3
CalcStack 19-4
CalculatorWrite 19-5
ChangeGeomSettings 19-5
ClcEval 19-6
ClcMaterial 19-6
ClearAllNamedExpr 19-7
CopyNamedExprToStack 19-7
DeleteNamedExpr 19-7
EnterComplex 19-8
EnterComplexVector 19-8
EnterLine 19-9
EnterPoint 19-9
EnterQty 19-9
EnterScalar 19-10
EnterScalarFunc 19-10
EnterSurf 19-11
Contents-23
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
EnterVector 19-11
EnterVectorFunc 19-12
EnterVol 19-12
ExportOnGrid 19-12
ExportToFile [Fields Calculator] 19-14
GetTopEntryValue 19-15
LoadNamedExpressions 19-15
SaveNamedExpressions 19-16
20 - User Defined Solutions Commands 20-1
CreateUserDefinedSolution 20-1
DeleteUserDefinedSolutions 20-3
EditUserDefinedSolution 20-4
21 - NdExplorer Script Commands 21-1
NdExplorer Manager Script Commands 21-1
ExportFullWaveSpice [NdExplorer] 21-1
ExportNetworkData [NdExplorer] 21-2
ExportNMFData [NdExplorer] 21-3
22 - CompInstance Script Commands 22-1
Callback Scripting Using CompInstance Object 22-1
CompInstance Functions 22-1
GetComponentName 22-2
GetEditor [Component Instance] 22-2
GetInstanceID [Component Instance] 22-3
GetInstanceName [Component Instance] 22-3
GetParentDesign 22-4
GetPropServerName 22-4
23 - Definition Manager Script Commands 23-1
Component Manager Script Commands 23-1
Add [component manager] 23-2
AddDynamicNPortData [component manager] 23-15
Contents-24
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Contents-25
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Contents-26
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Contents-27
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Contents-28
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Contents-29
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Contents-30
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
1 - Introduction to VBScript
ANSYS Electronics Desktop uses the Microsoft® Visual Basic® Scripting Edition (VBScript) script-
ing language to record macros. VBScript is based on the Microsoft Visual Basic programming lan-
guage.
Using scripts is a fast, effective way to accomplish tasks you want to repeat. When you execute a
script, the commands in the script are performed.
You can write a script using any text editor or you can record a script from within the ANSYS Elec-
tronics Desktop interface. After recording the script from within ANSYS Electronics Desktop, you
can then modify it if necessary using a text editor.
Although ANSYS Electronics Desktop records scripts in VBScript format, it can also execute
scripts in JavaScriptTM format. If you are running a script from a command prompt, the script can
be written in any language that provides the Microsoft COM methods. The ANSYS Electronics
Desktop scripting documentation refers to VBScript format only.
This chapter provides an overview of key VBScript components.
A Sample HFSS Script
A Sample Circuit Script
A Sample Q3D Script
Simple and Composite Names
VBScript Variables
VBScript Operators
Controlling Program Execution
Looping Through Code
VBScript Procedures
Converting Between Data Types
Including Scripts
Aborting Scripts
Interacting with a Script
Recommended VBScript References
For more details about VBScript, please see the Recommended VBScript References section at
the end of this chapter.
l Composite names are used by definition manager script commands to uniquely identify
script definitions.
l Materials and scripts do not have composite names, so project definitions for these items
must possess a unique simple name.
l The format of a composite name is LibraryName:SimpleDefinitionName. For example, the
composite name for the component "CAP_ in" the system library Nexxim Circuit Ele-
ments\Capacitors is "Nexxim Circuit Elements\Capacitors:CAP_in."
l The format of a composite name in a project is OriginLibraryName:SimpleDefinitionName.
For example, the composite name for the project component "CAP_" that was originally
from the system library Nexxim Circuit Elements\Capacitors is "Nexxim Circuit Ele-
ments\Capacitors:CAP_".
l Not all definitions in a project have a library of origin. Newly added definitions do not have a
library of origin, and project definitions whose names are changed do not have a library of ori-
gin (even if they did before the name change). As a result, the composite name for items
without a library of origin is the item’s simple name itself. For example, the composite name
for the project component "CAP_" that came from a system library and was renamed to
"MyCAP_" is "MyCAP_".
To construct a composite name, select Tools > Edit Configured Libraries > Components to
open the Edit Libraries dialog. The subnames used to construct a composite name can be found
in the Name and Origin columns that correspond to a particular component. The Origin column
contains the library portion of the composite name, while the Name column contains the simple por-
tion of the composite name.
VBScript Variables
A VBScript variable is a placeholder representing information that may change during the time your
script is running. Variables are useful because they let you assign a short and easy to remember
name to each piece of data you plan to use. Use a variable name in a script to view or modify its
value.
Declaring Variables
To declare variables explicitly in a script, use the Dim, Public, or Private statements. For example:
Dim box_xsize
After declaring a variable, you can assign information to it. For example:
box_xsize = "3mm"
You can declare multiple variables by separating each variable name with a comma. For example:
Dim Top, Bottom, Left, Right
You can also declare a variable implicitly by simply using its name in your script. Doing so is not gen-
erally a good practice because you could misspell the variable name in one or more places, causing
unexpected results when your script is run. For that reason, the Option Explicit statement is avail-
able to require explicit declaration of all variables. The Option Explicit statement should be the
first statement in your script.
Primitives(1) = "Cone1"
Primitives(2) = "Cylinder1"
Similarly, the data can be retrieved from any element using an index into a particular array element.
For example:
one_prim = Primitives(1)
You can also use the Array function to assign an array of elements to a variable. For example:
Dim Primitives
Primitives = Array ("Box1", "cone1", "Cylinder1")
Note:
When using the Array function, do not use parentheses on the variable when it is
declared. For example, use Dim myarray, not Dim myarray().
If you do not know the size of the array at declaration or the size changes during the time your script
is running, you can use dynamic arrays. They are declared without size or number of dimensions
inside the parentheses. For example:
Dim FirstArray()
ReDim SecondArray()
To use a dynamic array, you must subsequently use ReDim to determine the number of dimen-
sions and the size of each dimension. You can also use the Preserve keyword to preserve the con-
tents of the array as the resizing takes place.
ReDim FirstArray(25)
ReDim Preserve FirstArray(30)
VBScript Operators
VBScript provides operators, which are grouped into these categories: arithmetic operators, com-
parison operators, and logical operators.
Please see the online VBScript User’s Guide for more details.
Operator Precedence
When several operations occur in an expression, each part is evaluated and resolved in a pre-
determined order, called operator precedence. You can use parentheses to override the order of
precedence and force some parts of an expression to be evaluated before others. Operations
within parentheses are always performed before those outside the parentheses. Within par-
entheses, however, standard operator precedence is maintained.
When expressions contain operators from more than one category, arithmetic operators are eval-
uated first, comparison operators are evaluated next, and logical operators are evaluated last.
Comparison operators all have equal precedence, that is, they are evaluated in the left-to-right
order in which they appear. Arithmetic and logical operators are evaluated in the following order of
precedence.
Arithmetic Operators
Following is a list of VBScript’s arithmetic operators.
Symbol Description
^ Exponentiation
- Unary negation
* Multiplication
/ Division
\ Integer division
Mod Modulus arithmetic
+ Addition
- Subtraction
& String concatenation
Comparison Operators
Following is a list of VBScript’s comparison operators.
Symbol Description
= Equality
<> Inequality
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
Is Object equivalence
Logical Operators
Following is a list of VBScript’s logical operators:
Symbol Description
l If...Then...Else
l Select Case
Using If...Then...Else
Following is an example that demonstrates the If...Then...Else conditional statement:
If obj = "Box1" Then
<statements to execute>
ElseIf obj = "Cylinder1" Then
<statements to execute>
Else
<statements to execute>
End If
Using Select Case
Following is an example that demonstrates the Select Case conditional statement:
Select Case primitive_name
Case "Box1"
<statements to execute>
Case "Cylinder1"
<statements to execute>
Case Else
<statements to execute>
End Select
When using conditional statements that test for zero voltage/current, it is important to note that a
real voltage or current should not be trusted to be exactly zero, even when it should be. Typically,
the voltage or current is often on the order of 'epsilon' (1e-16) or smaller; hence, it is nonzero in
value.
Using a For...Next Loop
The For...Next type of loop allows you to run a group of statements repeatedly. It uses a counter to
run statements a specified number of times. Following is an example that demonstrates the
For...Next loop:
For variable = start To end
<statements to execute>
Next
You can exit early from a For...Next loop with the Exit For statement.
Using a Do Loop
You can use Do...Loop statements to run a block of statements until (or while) a condition is true.
Repeating Statements While a Condition is True
Use the While keyword to check a condition in a Do...Loop statement. The syntax is as follows:
Do While condition
<statements to execute>
Loop
Repeating a Statement Until a Condition Becomes True
Following is the syntax:
Do Until condition
<statements to execute>
Loop
You can exit early from a loop by using the Exit For statement.
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
Including Scripts
You can include one script within another using the following command:
#include "<scriptfilename>"
Where scriptfilename is the full path name to a file that contains script text, or is the name of a script
in the project library or script library (listed in the project window under the Definitions/Scripts dir-
ectory).
The command works for VBScript, JScript, and for the following:
l Scripts in the project library that are run by right-clicking the script icon in the project window
and choosing Run Script
l Scripts in files that are external are run by choosing Tools>Run Script
l Scripts that are specified as callbacks in the Property dialog box
l Scripts that are run to draw parameterized footprints in layout
An include command can be placed anywhere in a script, but for readability it is recommended that
commands be placed at the beginning of a file. The same script can be included multiple times
without error, and circular inclusions will be ignored.
Aborting Scripts
You can abort a script that is running in the desktop simply by pressing the ESC key. Terminating a
script in this manner works for each of the following:
l Scripts in the project library that are run by right-clicking the script icon in the project window
and choosing Run Script.
l Scripts in files that are external can be run by choosing Tools>Run Script.
l Scripts that are specified as callbacks in the Property dialog box.
l Scripts that are run to draw parameterized footprints in layout.
The MsgBox function shows a message and returns a number based on the button the user
presses. For example:
MsgBox ("message text")
oProject
The oProject object corresponds to one project open in the product. It is used to manipulate the pro-
ject and its data. Its data includes variables, material definitions and one or more designs. One
example of accessing this object is:
Set oProject = oDesktop.GetActiveProject()
See the following chapters for details about the script commands recognized by the oProject
object:
oDesign
The oDesign object corresponds to an instance of a design in the project. This object is used to
manipulate the design and its data. Its data includes variables, modules, and editors.
One example of accessing this object is:
Set oDesign = oProject.GetActiveDesign()
See the following chapters for details about the script commands recognized by the oDesign
object:
oEditor
The oEditor object corresponds to an editor, such as the 3D Modeler, layout or schematic editors.
This object is used to add and modify data in the editor.
One example of accessing this object is:
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
A layout example of accessing this object is:
Set oEditor = oDesign.SetActiveEditor("Layout")
The Ansoft.ElectronicsDesktop product scripting supports the following editors:
Editor
Reporter There is no Reporter editor object in the script. Instead, Reporter editor commands
Editor are executed by the ANSYS Electronics Desktop design object oDesign.
See the chapter 3D Modeler Editor Script Commands, for details about the script commands recog-
nized by the oEditor object and the chapter Reporter Editor Script Commands for details about
Reporter editor commands.
oModule
The oModule object corresponds to a module in the design. Modules are used to handle a set of
related functionality.
One example of accessing this object is:
Set oModule = oDesign.GetModule("BoundarySetup")
The software scripting supports the following modules:
Solution Data.
Examples of HFSS, Layout Editor, and Q3D Extractor scripts are described as follows.
Example: HFSS Script
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
Set oProject = oDesktop.SetActiveProject("Project1")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
Set oModule = oDesign.GetModule("BoundarySetup")
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project1")
oProject.InsertDesign "HFSS3D", "HFSS3D1", _
"C:\testinstall\HFSS\syslib\PCB - SingleSided.asty", ""
Set oDesign = oProject.SetActiveDesign("HFSS3D1")
Set oEditor = oDesign.SetActiveEditor("Layout")
Recording a Script
After you begin to record a script, each subsequent interface action you take is recorded and saved
to a text file or project folder you have specified — i.e., each interface command is made up of one
or more associated script commands, and each action is recorded and saved to a single script. The
recorded script is saved in the format you select, either IronPython Script format (.py, the
default) or VBScript format (.vbs).
To Record a Script to a File:
1. Click Tools>Record Script to File or select the Automation tab and click the Record
Script icon:
2. Use the file browser to locate and double-click the folder where you wish to save the script,
such as C:\Program Files\AnsysEM\<platform>\Scripts.
3. Type the name of the script in the File name text box and select the script type as
IronPython (*.py, the default) or or VBScript format (.vbs).
4. Then click Save.
4. Perform the steps you want to record.
5. When you have finished recording the script, click Tools >Stop Script Recording.
The recorded script is then saved to filename.py or filename.vbs in the folder specified folder.
2. Type the name of the script in the text box and select the script type as IronPython (*.py, the
default) or or VBScript format (.vbs), then click OK.
The recorded script is then saved to filename.py or scriptname.vbs in the Scripts library and
can be accessed by expanding the definitions/Scripts folder in the Project tree.
1. Click Tools>Record Script or select the Automation tab and click the Record Script
icon:
2. Use the file browser to locate the folder in which you want to save the script, such as
C:\ANSYS\product name\Scripts, and then double-click the folder’s name.
3. Type the name of the script in the File name text box, or click its name, specify the file type:
The script is saved in the folder you selected by the file name filename.pyor file-
name.vbs or filename.js.
1. On the Tools menu, click Record Script to Project or select the Automation tab and click
the Record Script icon and select Record Script to Project from the drop-down menu:
2. Enter a name for the script, and click OK to close the dialog and begin recording.
3. Perform the steps that you want to record.
4. When you have finished recording the script, click Stop Script Recording on the Tools
menu.
The script you recorded is saved to the current project’s scripts library. Refer to
Managing Library Contents for information on working with libraries.
Note:
Project scripts are stored in the project scripts library. Refer to Managing Library
Contents for information on working with libraries.
Running a Script
1. Click Tools>Run Script or click the Automation tab and click the Run Script icon:
2. Use the file browser to locate the folder in which you saved the script, and then double-click
the folder’s name.
3. Type the name of the script in the File name text box, or click its name, specify the file type:
If you run the script from DOS prompt as a .vbs file (that is, you do not launch ANSYS Electronics
Desktop, but just launch vbs directly, or use wscript.exe or cscript.exe), the arguments will be in the
WSH.arguments collection, not the AnsoftScriptHost.arguments collection. To handle this, use the
following script:
on error resume next
dim args
Set args = AnsoftScript.arguments
if(IsEmpty(args)) then
Set args = WSH.arguments
End if
on error goto 0
'At this point, args has the arguments no matter if you are running
'under windows script host or Ansoft script host
msgbox "Count is " & args.Count
for i = 0 to args.Count - 1
msgbox args(i)
next
l Click Tools>Pause Script or select the Automation tab and click the Pause Script icon.
Stopping a Script
l On the Tools menu, click Stop Script.
ANSYS Electronics Desktop stops executing the script that has been paused.
l Syntax Conventions
l Script Command Conventions
l Named Arguments
Syntax Conventions
The following data types will be used throughout this scripting guide:
1. When running from command line using -runscriptandexit or -runscript, give -scriptargs
parameters and specify arguments.
All arguments following the -scriptargs flag are enclosed in double quotes. For example
C:\AnsysEM\AnsysEMn\Win64\hfss.exe -RunScriptAndExit _
C:\scripts\test.vbs -scriptsargs "arg1 arg2 arg3"
2. When running from Tools>Run script, there is an edit field at the bottom of the file selection
dialog that you can use to enter script arguments.
You can access the script arguments using the AnsoftScriptHost.arguments collection from
vbscript. This is a standard COM collection.
If you run the script from DOS prompt as a .vbs file (that is, you do not open ANSYS Electronics
Desktop, but launch vbs directly, or use wscript.exe or cscript.exe), the arguments are in the
WSH.arguments collection, not the AnsoftScriptHost.arguments collection. To handle this,
write this script:
on error resume next
dim args
Set args = AnsoftScript.arguments
if(IsEmpty(args)) then
Set args = WSH.arguments
End if
on error goto 0
'At this point, args has the arguments no matter if you are running
'under windows script host or Ansoft script host
msgbox "Count is " & args.Count
for i = 0 to args.Count - 1
msgbox args(i)
next
Named Arguments
Many ANSYS Electronics Desktop script commands use named arguments. The names can
appear in three ways:
1. Named data, name precedes data.
For example: ...,"SolveInside:=", true, ...
2. Named Array, name precedes array.
For example: ...,"Attributes:=", Array(...),...
3. Named Array, name inside array.
For example: ..., Array("NAME:Attributes",...),...
In the first and second examples, the name is formatted as "<Name>:=". This signals ANSYS Elec-
tronics Desktop that this is a name for the next argument in the script command. In the third
example, the name is formatted as "NAME:<name>" and is the first element of the Array.
The names are used both to identify what the data means to you and to inform ANSYS Electronics
Desktop which data is being given. The names must be included or the script will not play back cor-
rectly. However, if you are writing a script, you do not need to pass in every piece of data that the
command can take. For example, if you are modifying a boundary, the script will be recorded to
include every piece of data needed for the boundary, whether or not it was modified. If you are writ-
ing a script by hand, you can just add the data that changed and omit anything that you do not want
to change. ANSYS Electronics Desktop will use the names to determine which data you provided.
For example, when editing an impedance boundary, ANSYS Electronics Desktop records the ‘edit
impedance boundary’ command as follows:
oModule.EditImpedance "Imped1", Array("NAME:Imped1", _
"Resistance:=", "100", "Reactance:=", "50", _
"InfGroundPlane:=", false)
If you only want to change the resistance, then you can leave out the other data arguments when
you are manually writing a script:
oModule.EditImpedance "Imped1", Array("NAME:Imped1", _
"Resistance:=", "100")
Another example corresponding to ANSYS Electronics Desktop layout is described below:
When editing a port excitation, ANSYS Electronics Desktop records the ‘edit port’ command as fol-
lows:
oModule.Edit "Port1", Array("NAME:Port1",Array("NAME:Properties",
"PortSolver:=", "true", "Phase:=", "0deg", "Magnitude:=", "2mA",
"Impedance:=", "50Ohm", "Theta:=", "0deg", "Phi:=", "0deg", "PostPro-
cess:=", "false", "Renormalize:=", "50Ohm + 0i Ohm", "Deembed:=",
"0mm", "RefToGround:=", "false"), "Type:=", "EdgePort",
is made active. The current active layer is indicated by a combo box display in the toolbar. The list
for the combo box contains all layers that may be set active.
The active text style is related to the active layer. If there is no active layer, there is no active text
style. Objects on the active layer have priority during snapping.
Scripts and Locked Layers
The locked attribute of a layer is defined to mean that you may not edit, delete, or add objects on
the layer, either directly or with scripts (i.e., scripts run on layout or footprint definitions). This
includes not being able to change properties of objects on the layer. Note, however, that parameter
changes can alter objects on locked layers.
The locked attribute of a layer is configurable using script commands and is user-editable via the
Edit Layers Dialog in the Layout Editor.
Event Callback Scripting
Event Callback scripting allows you to define custom JavaScript and VBScript routines that will run
automatically after a triggering event is detected, events such as placing a component or running a
simulation. When you define an Event Callback script, you specify one or more scripts that will be
run after a particular event is detected. For more information see Event Callbacks in the help.
A callback script can only access functions and other scripts defined by its callback definition. For
example, a Simplorer callback script can call PropHost.GetValue — and all other PropHost func-
tions — but only from scripts defined in the Property Dialog callback. As a result, "PropHost" is a
Simplorer script item that is only visible in "Property" callback scripts. For more information, see
Callback Scripting Using PropHost Object and Callback Scripting Using CompInstance Object.
The following table lists allowable callback events, items that are visible from the associated call-
back script, and the set of accessible functions that can be called.
Scripts Vis-
Callback ible from the Functions Callable
Event Event Call- from the Visible Script
back Script
Place Com- CompInstance CompInstance.GetParentDesign() — Returns a oDesign item
ponent that can be used to call Design functions.
This is the PersonalLib subdirectory in the project directory. The project directory can be
specified in the General Options dialog box (click Tools>Options>General Options to
open this dialog box) under the Project Options tab.
This is the userlib subdirectory in the library directory. The library directory can be specified
in the General Options dialog box (click Tools>Options>General Options to open this
dialog box) under the Project Options tab.
This is the syslib subdirectory in the library directory. The library directory can be specified in
the General Options dialog box (click Tools>Options>General Options to open this dia-
log box) under the Project Options tab.
Editing Properties
Any data that is shown in the dockable Properties dialog box or in the modal Properties pop-up
window is called a property. For example, project and local variables are properties. The XSize of a
box in the Geometry editor is also a property. See the chapter, Property Script Commands, for an
explanation of how to manipulate properties in a script.
The document assumes that you know how desktop scripting works using VBScript or Javascript.
Introduction to IronPython
IronPython Mini-cookbook
Translating Script commands from VBScript to IronPython
Scripting Using Iron Python: Putting it all Together
Standalone IronPython and Desktop IronPython
IronPython Samples
Creating User Defined Primitives and User Defined Models in Python Scripts
Introduction to IronPython
IronPython is an implementation of the Python programming language targeting the .NET runtime.
What this means in practical terms is that IronPython uses the Python programming language syn-
tax and standard python libraries and can additionally use .NET classes and objects to give one the
best of both worlds. This usage of .NET classes is fairly seamless in that a class defined in a .NET
assembly can be used as a base class of a python class.
Scope
Functioning as a tutorial on Python or IronPython is way out of the scope of this document. There
are several excellent resources online that do a very good job in that regard. This document only
attempts to provide a limited introduction to IronPython as used to script ANSYS EM products.
This document is also not a tutorial on the scripting of ANSYS EM products. It complements the
existing scripting guide (available from a product's Help menu) and provides a pythonic inter-
pretation of that information. The reader might have to refer to either the scripting guide or recor-
ded samples of VBScript to follow some of the sections.
Python compatibility
The version of IronPython in use is 2.7 and built on the .NET framework version 4.0: this version tar-
gets Python 2.7 language compatibility. While most python files will execute under IronPython
with no changes, python libraries that make use of extensions written in the C programming lan-
guage (NumPy or SciPy for instance), are not expected to work under IronPython. In such cases, it
might be possible to locate .NET implementation of such libraries or explore the use of IronClad.
(http://code.google.com/p/ironclad/).
Advantages of IronPython
The advantages that IronPython use provides are significant:
l Python has a large eco-system with plenty of supporting libraries, Visual IDEs and debug-
gers. It is actively developed and enhanced.
l IronPython, in addition, has access to the entire .NET eco system. This allows us, for
instance, to create a modern GUI using the System.Windows.Forms assembly from
IronPython code and call any other .NET assembly for that matter.
l The use of IronPython's technologies enables the ability to interactively script Desktop (fea-
ture in development). This allows better discovery of the scripting APIs as well as directly pro-
gramming to the scripting API in python, a language more tractable and platform
independent compared with VBScript.
l The Python syntax of dictionaries is somewhat easier to read and write when supplying argu-
ments to the scripting methods.
Related Topics
IronPython Mini-cookbook
Translating Script commands from VBScript to IronPython
Scripting Using Iron Python: Putting it all Together
IronPython Samples
IronPython Mini-cookbook
While a tutorial on Python syntax is beyond the scope of this document, it will present simple coun-
terparts the VBScript constructs that users tend to regularly use.
Comments
Assigning/Creating variables
Create Lists/Arrays
Create Dictionaries/Maps
Boolean Values
Converting Numbers to Strings and Vice Versa
String Formatting/Concatenation
Looping over Lists
Looping over a Range
A Note About Indentation
Additional Sections:
Obtaining More Information
Discovering Methods
Help on a Method
Comments
VBScript IronPython
' Comments start with a single quote # Comments start with a sharp or hash
' like this line # symbol, like these lines
Assigning/Creating Variables
VBScript IronPython
' Declare with a Dim # No Set syntax. Simply create and assign
Dim oDesktop oDesktop = oApp.GetAppDesktop()
Create Lists/Arrays
VBScript IronPython
' Declare as array of String with 11 # Declare an empty array
' indices from 0 through 10 myEmptyArray = []
Dim myArray(0 to 10) as String
myArray(0) = "Hello" # declare an array and initialize it with 5 ints
myArray(1) = "bye" myInitedArray = [ 1, 2, 3, 4, 5]
' Declare n array with no size # Python lists can have items of any type
Dim array2() as String # and there is no pre-declaration
# declare an array and init with mixed types
' Re-Dimension the array once size is mixed = ["hello", 1 ,2 ["nested"]]
' known
ReDim array2(0 to 2) as String # append to an array
array2(0) = "this" mixed.append( 3.5 )
array2(1) = "also"
Create Dictionaries/Maps
VBScript IronPython
' No direct equivalent is available as # an IronPython dictionary is a collection of
' far as the author knows # name value pairs. Just like arrays, there is
# no restriction on the keys or the values.
# For purposes of ANSYS EM scripting however,
# all keys must be strings
Boolean Values
VBScript IronPython
' Boolean literals are in lower case # The first letter is capitalized
true True
false False
VBScript IronPython
' Use CInt, CDbl, CBool, CLng # use the integer() or float() or double()
' to convert the string representation # functions to cast a string CONTAINING the
' to the number representation. Use # string representation of whatever you are
' IsNumber to check before conversion # casting to.
Dim nStr = "100" strInt = "3"
Dim n = CInt(nStr) intVal = int(strVal)
floatVal = float(strVal)
' Use CStr to convert a number to
' its string representation # invoke the str() function with the int/float
Dim v, vStr # values as needed. You can alternately use
v = 100 # the string formatting method listed below
vStr = CStr(v) strVal = str(42)
strVal = str(42.345)
String formatting/concatenation
VBScript IronPython
' string concatenation uses the & # if you have two strings, you can always
' operator # concatenate then using the '+' operator
Dim allStr, str1 str1 = "hello"
str1 = " how are you" str2 = "world"
allStr = "Hello " & " There" & str1 str12 = str1 + " " + str2
' there seems to be no direct string # if you have different types though, string
' formatting function in VBScript # and int say, you must use the string
' using string concatenation or using # formatting commands. When formatting
' Replace are the two builtin options # multiple arguments, they must be entered
Dim fmt = "{1} climbs stalk {2}" # as a tuple ( item1, item2, )
Dim str = Replace(fmt, "{1}", "jack") num = 10
str = Replace(str, "{2"}, 10) str3 = "%s climbs stalk %d" % ("jack", num)
str4 = "%d stalks" % num
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
VBScript IronPython
' Loop over a range, specify start, end # prints out values from 0 through 9
' and step for i in range(0, 10):
For i = 0 To 10 Step 1 print i
Print i
Next
Related Topics
A Note About Indentation
Obtaining More Information
Discovering Methods
Help on a Method
Introduction to IronPython
Translating Script commands from VBScript to IronPython
Scripting Using Iron Python: Putting it all Together
IronPython Samples
Related Topics
Obtaining More Information
Discovering Methods
Help on a Method
Introduction to IronPython
Translating Script commands from VBScript to IronPython
Scripting Using Iron Python: Putting it all Together
IronPython Samples
Related Topics
Discovering Methods
Help on a Method
Introduction to IronPython
Translating Script commands from VBScript to IronPython
Scripting Using Iron Python: Putting it all Together
IronPython Samples
Discovering Methods
For instance, if you want to list all methods available in the string module, you would type in "import
string" to import the module first and then type in "dir(string)". You will get a list of all the methods
available (as well as some __somename__ internal names that can be ignored)
Related Topics
Obtaining More Information
Help on a Method
Introduction to IronPython
Translating Script commands from VBScript to IronPython
Scripting Using Iron Python: Putting it all Together
IronPython Samples
Help on a Method
Once you know a function name, you can get more help on it using the builtin help method. For
instance, executing help(string.split) in the IronPython Command Window displays the fol-
lowing:
Related Topics
Script Method Argument
VBscript Method Call Types
VBScript Sub-Routines
Converting VBScript Function calls to IronPython Syntax
Introduction to IronPython
IronPython Mini-cookbook
Scripting Using Iron Python: Putting it all Together
IronPython Samples
Primitive Types
Primitive types are the standard bool, int, float, double and string
Named Array
Named arrays are a special construct used very commonly and can be found in practically every
recorded script sample.
It starts with Array( "NAME:someName" and is followed by a collection of comma separated val-
ues which can be:
l A primitive value
l An array of primitive values
l Another named array
l A key, of the form "keyName:=" followed by
o A primitive value
o A function (described next)
Named Function
Named functions are arrays which start with Array( and do not have a leading "NAME:name" item.
They are always introduced by a key and can contain comma separated values of the following
type:
l A primitive value
l A key (of the form "keyName:=") followed by
o A primitive value
o Another function (nested function)
Related Topics
Translating Script commands from VBScript to IronPython
Note that the significant item here is that the method name is always followed by an argument list
enclosed in parentheses if there are arguments. If the argument list is empty as shown above for
the NewProject call, the parentheses can be omitted.
VBScript Sub-Routines
VBScript Sub-Routines are those that do not have any return value. VBScript allows these to be
written without any parentheses even if they have a non-empty argument list.
oModule.CreateReport "XY Plot1", "Standard", "XY Plot", "optimtee :
optimtee", _
Array("Domain:=", "Sweep"), Array("Freq:=", Array("All"), "off-
set:=",_
Array("0uin")), Array("X Component:=", "Freq", "Y Component:=",
_
Array("dB20(S(1,1))", "dB20(S(1,2))", "dB20(S(1,3))", _
"dB20(S(2,1))", "dB20(S(2,2))", "dB20(S(2,3))", "dB20(S(3,1))",
"dB20(S(3,2))", "dB20(S(3,3))")), Array()
Sample Script 3: VBScript Sub-Routine sample
Related Topics
Translating Script commands from VBScript to IronPython
l If you see a VBScript snippet that looks like a VBScript Sub-Routine, remember to add par-
entheses.
l If you see a VBScript function that has no arguments and no parenthesis, remember to add
them around an empty argument list.
The parentheses change is the only one to keep in mind when converting VBScript function calls
syntax to IronPython.
Return Values
Primitive Method Arguments
Named Array Argument
Named Array Values with All Key Value Pairs
Named Arrays with Nested Named Arrays
Function Blocks
Return Values
VBscript return values are sometimes assigned via the Set declaration. IronPython return values
are simple assignment (see the cookbook chapter)
Related Topics
Converting VBScript Function calls to IronPython Syntax
"NAME: ConeParameters",
"XCenter:=" , "0mm",
"YCenter:=" , "0mm",
"ZCenter:=" , "0mm",
"WhichAxis:=" , "Z",
"Height:=" , "2mm",
"BottomRadius:=" , "1.56204993518133mm",
"TopRadius" , "0mm"
],
[
"NAME:Attributes",
"Name:=" , "Cone1",
"Flags:=" , "",
"Color:=" , "(132 132 193)",
"Transparency:=" , 0,
"PartCoordinateSystem:=" , "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"vacuum\"",
"SolveInside:=" , True
])
Sample Script 5: Create a cone in IronPython
Note that the formatting (which helps readability immensely) is not really needed. All that had to be
done was
Related Topics
Converting VBScript Function calls to IronPython Syntax
"UDMId" : "",
"MaterialValue" : "\"vacuum\"",
"SolveInside" : True
}
Sample Script 6: CreateCone in IronPython using dictionary syntax
Related Topics
Converting VBScript Function calls to IronPython Syntax
"key1" : 1,
"key2" : 2,
"name2" : {"R" : 255}
}
Sample Script 9: Named array with nested named array in all dictionary syntax
{ "NAME" : "name",
"key1" : 1,
"key2" : 2,
"name2" : {
"NAME" : "name2",
"R" : 255
}
}
Sample Script 10: Nested named array with optional "NAME:" field
Related Topics
Converting VBScript Function calls to IronPython Syntax
Function Blocks
Function blocks in VBScript argument syntax are represented as arrays without the "NAME:.."
field. However, functions are always introduced by a key in a parent structure. Function blocks can
therefore never exist as a top-level argument. They are only found as the value pairs inside a
named array or inside another function block.
Note:
Function blocks and their items cannot be converted to dictionaries even though they
might be composed entirely of key value pairs.
The reason for this is the need to main the user-entered order. Every item in a function block is
expect to be transmitted to the script method in exactly the same order as typed out and this is
impossible to achieve when a dictionary is used (as the keys get reordered according to the dic-
tionary's internal tree/key sorting scheme).
Note:
When you see a function block, simply replace the Array( ) delimiters with the python
array delimiters [ ]
Related Topics
Converting VBScript Function calls to IronPython Syntax
Related Topics
Introduction to IronPython
IronPython Mini-cookbook
Translating Script commands from VBScript to IronPython
Appendix: IronPython Samples
l Tools > Run Script menu item, select "IronPython" from the file type drop-down list.
l Launch the product with a script argument.
l Register an IronPython script as an external tool using the Tools > External Tools menu
item.
When desktop executes a script, it does so in an execution environment setup with predefined vari-
ables and functions. These predefined variables and functions are how the script communicates
with the desktop and they come in three flavors.
Script Argument for IronPython
Script Objects for IronPython
Methods for IronPython
Methods for Manipulating Registry Values
Related Topics
IronPython Script Execution Environment
The use of these objects is done as per the individual product scripting guides with some syntax
adjustments made for the parameters to account for the IronPython differences.
Related Topics
IronPython Script Execution Environment
are passed as a single string with individual arguments separated by spaces. Each argu-
ment can optionally be enclosed by quotes to allow spaces within the argument.
l SetScriptingLanguageToJavascript(), SetScriptingLanguageToVBScript() allows
the script to change the syntax of the language being used in the Run*Command commands
listed below. Once set, the language choice remains for the rest of the script execution or till
it is changed. The default is VBScript.
l RunScriptCommand(CommandString) runs the supplied script text. The language of the
text is controlled by a previous call to SetScriptingLanguageToJavascript() or SetScript-
ingLanguageToVBScript()
l RunDesktopCOmmand(CommandString) runs the supplied script text. The text is expec-
ted to generally be a single line and be a method call on a oDesktop object. The oDesktop
object is initialized based on the supplied optional ProjectName Pparameter. If the Pro-
jectName parameter is not supplied, the active project is used.
l RunProjectCommand(CommandString,ProjectName=None, ProjectName=None)
runs the supplied script text. The oDesign object is initialized based on the supplied optional
parameters. If the ProjectName is not supplied, the active project is used to resolve the pro-
ject. If the DesignName is not supplied, the project’s active design or first design will be used
to resolve the oDesign object within the project.
l RunModuleCommand(CommandString,ModuleName, DesignName=None, Pro-
jectName=None) runs the supplied script text. The text is expected to be a single line and
be a method call on a oModule object. The design targeted is resolved using the supplied
optional DesignName and ProjectName parameters and the oModule object is initialized
using the supplied Module name on that resolved design.
l RunEditorCommand(CommandString, EditorName,DesignName=None, Pro-
jectName=None) runs the supplied script text. The text is expected to be a single line and
be a method call on a oEditor object. The design targeted is resolved using the supplied
optional DesignName and ProjectName parameters and the oEditor object is initialized
using the supplied Editor name on that resolved design.
l RunDefinitionManagerCommand(CommandString, ProjectName=None) runs the
supplies script text. The text is expected to be a single line and be a method call on a oDefin-
itionManager object. The oDefinitionManager object is created for the project specifie4d by
the optional ProjectName parameter.
Related Topics
IronPython Script Execution Environment
Example:
value = oDesktop.GetRegistryString("Desktop/ActiveDSOConfigurations/HFSS")
l SetRegistryString (KeyPath", "string") - sets the registry key to the specified string
value.
Example:
oDesktop.SetRegistryString("Desktop/ActiveDSOConfigurations/HFSS", "Local")
Example:
num = oDesktop.GetRegistryInt("Desktop/Set-
tings/ProjectOptions/HFSS/UpdateReportsDynamicallyOnEdits")
Example:
oDesktop.SetRegistryInt("Desktop/Set-
tings/ProjectOptions/HFSS/UpdateReportsDynamicallyOnEdits", 0)
Example:
bExist =oDesktop.DoesRegistryValueExist("Desktop/ActiveDSOConfigurations/HFSS")
Example:
oDesktop.SetRegistryFromFile("c:\\temp/test.acf")
Example for how to set the DSO & HPC analysis setup with Python script
1. In a PC start HFSS go to the DSO and HPC options dialog, create a setup name it as "test"
2. Export the setup to a file c:\tem\test.acf.
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).
self._label = Label()
self._label.Text = text
self._label.Dock = DockStyle.Fill
_button = Button()
_button.Text = "Close"
_button.Dock = DockStyle.Bottom
_button.Click += self._buttonPressed
self.Controls.Add(self._label)
self.Controls.Add(_button)
def _buttonPressed(self,sender,args):
self.Close()
#----------------------------------------------------
# Main script code
#----------------------------------------------------
#display the ScriptArgument variable as the text label
# in the form.
gui = ShowPropertiesForm("Sample Form", ScriptArgument)
While creating cross platform user interfaces from scripts is one of the main motivations driving the
adoption of IronPython, any .NET assembly can be used with the caveat that Linux use requires
Mono compatibility of any used assemblies.
While this hybrid approach is useful when you have existing VBScript commands that you want to
reuse or when you want to quickly parameterize a recorded sample, the one significant limitation of
this approach is the inability to capture return values from VBScript or JavaScript calls that do
return something. Full two way communication with the product requires the use of pure
IronPython to directly invoke the script objects as described below.
Related Topics
IronPython Script Execution Environment
Note:
The typical VBScript calls to obtain the registered COM scripting interface via CreateOb-
ject calls and then obtain the oDesktop object from it using the GetAppDesktop() is not
needed (or even supported on all platforms). Since all scripting occurs in the context of a
running workbench, the available Desktop object is always provided and expected to be
used directly.
Scripting using the IronPython scripting API is very much like scripting with VBScript except that
The samples section lists a collection of pure IronPython snippets: these, along with the various
script snippets listed in this document should serve as a guide and reference.
Related Topics
IronPython Script Execution Environment
Standalone IronPython and Desktop IronPython
IronPython Samples
Change property
The following snippets show how a change property command (in this case, to change the color of
a cone) looks in VBScript and its two possible IronPython variants.
oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:Geo-
metry3DAttributeTab",_
Array("NAME:PropServers", "Cone1"), _
Array("NAME:ChangedProps", _
Array("NAME:Color", "R:=", 255, "G:=", 255, "B:=", 0))))
Sample Script 13: ChangeProperty command to change color of a cone in VBScript
oEditor.ChangeProperty(
["NAME:AllTabs",
["NAME:Geometry3DAttributeTab",
["NAME:PropServers", "Cone1"],
["NAME:ChangedProps",
["NAME:Color", "R:=", 0, "G:=", 0, "B:=", 64]
]
]
])
Sample Script 14: ChangeProperty command to change color of cone using Python
arrays
Any time there are named arrays composed purely of key-value pairs, they can always be rep-
resented using a Python dictionary, irrespective of the nesting of said named array.
oEditor.ChangeProperty(
["NAME:AllTabs",
["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
{
"NAME" : "Attributes",
"Name" : "Cone1",
"Flags" : "",
"Color" : "(132 132 193)",
"Transparency" : 0,
"PartCoordinateSystem": "Global",
"UDMId" : "",
"MaterialValue" : "\"vacuum\"",
"SolveInside" : True
}
)
Sample Script 16: IronPython script to create a cone
Create geometry and then create a grid from it using copy/paste/move
The following script demonstrates slightly more advanced use of scripting and the use of return val-
ues from script methods. It creates a 5x5 grid of cones and also demonstrates the adding of inform-
ation messages to the application's message window.
oProject = oDesktop.GetActiveProject()
oDesign = oProject.InsertDesign("HFSS","Hersheys Kis-
ses","DrivenModal","")
oEditor = oDesign.SetActiveEditor("3D Modeler")
"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
}
)
# copy first
oEditor.Copy(
{
"NAME" : "Selections",
"Selections" : firstConeName
}
)
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
l No need to create and build project; all you need to do is create a Python script
l Python script is platform independent
l Scripts can inherit functionality from existing scripts
l Garbage collector - no need to free memory
l Easy debugging
Changes compared to C
Though methods, constants and structures are kept as close to the C implementation as possible,
some changes had to be made to make code Python-compatible.
Structures
For a complete list of structures and examples please see UDP/UDM Structures.
Constants
Enumeration/Enum constants have almost the same names as in C but the enum must be qualified
by the type. Additionally, redundant "UDP", "UDM" or type prefixes have been removed. This
allows for better human-readability.
# Example of specifying the LengthUnit enum by qualifying it
# with the type of the enum: UnitType
unitType = UnitType.LengthUnit
For a complete list of enum constants please see UDP/UDM Constants.
Methods
Methods are described in IUDPExtension methods, IUDMExtension methods, UDPFunc-
tionLibrary and UDMFunctionLibrary listed further in this document.
The main differences in functions parameters (from C implementation):
Output Parameters
The rule for the output parameters is as follows:
l If the function has one output parameter variable and no return value, the variable will
become function's return value.The same will happen if the return value is a 'success/failure'
boolean ('None' will be returned on failure and parameter variable - on success).
l If the function has one output parameter and a return value, the function will return a Python
tuple where function return value will be the first one in the tuple.
l If there is more than one out variable, the function will return a Python tuple with all output
parameters in the specified order. If function has a return value, it must always be the first in
the tuple.
# one output parameter; return value is ignored
udmDefinition = udmFunctionLibrary.GetDefinition()
C Python
bool getDefinition(UDMDefinition* udmDefinition = udmFunctionLibrary.GetDefinition()
udmDefinition,
void* callbackData );
(Note: callbackData is omitted in py interface)
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:
C Python
bool getAllFaces( long partId, faceIds = udmFunc-
tionLibrary.GetAllFaces(partId)
long* numFaces,
long** faceIds,
void* callbackData);
(ignore numFaces as redundant: folded
into faceIds,
where numFaces and faceIds are output parameters return value is omitted: folded into the
and numFaces is the size of faceId. faceIds is None check
callbackData is omitted)
long unite( long numObjects, lret = udpFunctionLibrary.Unite
(objectIds)
long* objectIds,
void* callbackData);
C Python
parameters and nSize is the size of partIds. callbackData is omitted)
Added Parameters
There is a special case in UDPFunctionLibrary: two functions - DuplicateAlongLine and Duplic-
ateAroundAxis - have new integer listSize parameter added to their signatures.
This parameter defines the size of the output List. This is done for compliance with C++ geometry
library as the size of the List must be predefined and this size is different from the existing para-
meter’s values.
Example:
(ret, cloneIDs) = funcLib.DuplicateAlongLine(partID, transVec,
numCubes, cloneIdsSize)
(ret, cloneIDs) = funcLib.DuplicateAroundAxis(partID, axis, angle,
nClones, cloneIdsSize)
Here cloneIdsSize is a new integer parameter.
Comparison with C function:
C Python
long duplicateAlongLine( (lret, cloneIds) = udmFunctionLibrary.DuplicateAlongLine(partId,
long partId, transVec, nClones, cloneIdsSize)
UDPVector transVector,
int nClones,
long* nClones, (callbackData is omitted
void* callbackData); cloneIdsSize is a new parameter)
long duplicateAroundAxis( (lret, cloneIds) = udmFunctionLibrary.DuplicateAroundAxis(partId,
axis, angle, nClones, cloneIdsSize)
long partId,
UDPCoordinateSystemAxis
axis,
double angle, (callbackData is omitted
int nClones, cloneIdsSize is a new parameter)
long* nClones,
void* callbackData);
Developing a UDM/UDP
Creation
To create a User Defined Primitive in Python you write a Python script that implements UDPEx-
tension class. To create a User Defined Model in Python you write a Python script that implements
UDMExtension class (see links for full description).
Location
The scripts are located the same way the C based UDM/UDP are. They are expected to be under
the UserDefinedParts or UserDefinedModels sub-directories of one of the library folders (SysLib,
UserLib or PersonalLib). They will then appear under the appropriate menu items: Draw>User
Defined Primitives for UDP or Draw>User Defined Model for UDM.
The sub-directories structure created in one of the specified directory will be displayed in the
UDP/UDM menu.
Keep in mind that there is no difference between the menu display for C and Python imple-
mentations of UDM or UDP - only the file names without extensions are displayed
Organize
"Lib" sub-directory is a special directory. The contents of this directory is not shown in the menu. In
the "Lib" directory you can create Python scripts with base classes and utilities to be used in
UDP/UDM Python scripts. All the Lib directories upstream of a script (till the UserDefinedModels or
UserDefinedPrimitives) are included in the Python search path and this allows for easy import of
helper modules in such directories.
To use UDM data structures, constants, and/or classes in your Lib sub-directory scripts you have to
add import statement to the scripts:
For UDM:extension:
from UDM import *
For UDP:extension:
from UDP import *
Edit/Reload
Python is a scripting language, so if you have errors in your script, you will see them at the time you
try to run the script. The errors will be displayed in the Message Manager Window. If you need
more information, you might be able to get it from log files. See Logging section for more details.
You can always change your script, call Update Menu command from Draw>User Defined
Model> menu or Draw>User Defined Primitives> menu and run the script again. If you delete
script you might want to restart the application instead of calling Update Menu.
UDPExtension
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 *
IUDPExtension methods
All methods are same as the methods in the C UDP implementation. The changes to the methods
signatures are just to conform to the Python style.
Mandatory methods.
These methods must be implemented in the UDP Python script as methods of UDPExtension
class.
GetLengthParameterUnits()
l returns string.
GetPrimitiveTypeInfo()
l returns UDPPrimitiveTypeInfo.
GetPrimitiveParametersDefinition2()
AreParameterValuesValid2(errorMsg, udpParams)
CreatePrimitive2(funcLib, udpParams)
Optional methods
These methods, which have default implementations, can be implemented as methods of UDPEx-
tension class as needed. Default methods will return NULL or FALSE depending on the return
type.
GetPrimitiveParameters()
GetRegisteredFaceNames()
GetRegisteredEdgeNames()
GetRegisteredVertexNames()
ProjectParametersOnToValidPlane2(currentUDPParams, projectedUDPParams)
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
...
...
For the full example, see Example Scripts for Python UDP and UDM.
UDPFunctionLibrary
UDPFunctionLibrary implements IUDPFunctionLib interface: The IUDPFunctionLib object is
passed as a parameter to Python script in functions CreatePrimitive2. You can call any of the func-
tions from the functions list (shown below).
udpFunctionLib.AddMessage(MessageSeverity.WarningMessage ,"New warn-
ing");
Considering that out variables are returned as members of the return tuple, sample code that calls
DetachFaces in Python script can look like this:
intVal = 10
inList = [..., ...]
(lret, outList) = udpFunctionLibrary.DetachFaces(intVal, inList)
As you can see outList output parameter is defined in the call to DetachFaces function. Unlike in C,
there is no need to define it before the function call.
Functions list:
UDMExtension
Import
You do not have to add import statements for the predefined classes and structures - it is done for
you and all data types described in this document can be used in your Python script.
However you have to add import statements to your helper scripts in your Lib sun-directory.
from UDM import *
IUDMExtension methods
All methods are the same as the methods in the C UDM implementation. The changes to the meth-
ods signatures are just to conform to the Python style.
Mandatory methods.
These methods must be implemented in the UDM Python script as methods of UDMExtension
class.
GetInfo()
IsAttachedToExternalEditor()
CreateInstance(funcLib)
l funcLib is UDMFunctionLibrary
l returns UDMParameters.
GetUnits(instanceId)
l instanceId is a long
l returns string containing units for the instance.
l funcLib is UDMFunctionLibrary
l udmInParams is a list of UDMParameters that comes from desktop
l updatedParams: UDM script can change the UDM parameters it receives. Updated para-
meters need to be sent back to desktop. If the UDM script is not going to change any of the
parameters that it received, it needs to copy udmInParams to updatedParams.
l refreshModifiedPartsOnly is a boolean
Supporting this flag is optional. For UDMs where the refresh performance is not an issue, it
is recommended to ignore this flag and update all parts every time.
This flag can be used to optimize performance of Refresh method when the model created
by UDM is large. If the UDM consists of multiple parts, and new parameters change only a
few parts amongst them, UDM script can only modify parts that are changed by the new
parameters.
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):
Replaces the old UDMDialogForDefinitionAndOptions method, which is still supported, but users
are urged to use UDMDialogForDefinitionOptionsAndParams. If both methods are present, applic-
ation will use UDMDialogForDefinitionOptionsAndParams.
l UDM can pop up dialog for UDM definition, options, parameters in this method. Definition,
options, and parameters are set/modified by user and returned to application. Dll can also
just give default definition, options and parameters.
l Returns two booleans and a string
l First boolean returns whether the method was successful or not.
l Second boolean returns whether the application should popup a dialog. If it is True, applic-
ation will populate a dialog with definition, options, parameters that are returned.
l String returned contains length units for parameters.
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()
Example UDM
class UDMExtension(IUDMExtension):
def IsAttachedToExternalEditor(self):
return False
def GetInfo(self)
udmInfo = UDMInfo(
name = "SampleUDM",
purpose = "udm example",
company="ANSYS",
date="12.21.12",
version = "1.0")
return udmInfo
...
...
UDMFunctionLibrary
UDMFunctionLibrary implements IUDMFunctionLib interface. The IUDMFunctionLib object is
passed as a parameter to Python script in the following functions
l CreateInstance
l Refresh
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)
if bret:
udpPosition.X = udpPositionLow.X
As you can see udpPositionLow and udpPositionHigh output parameters are defined in the call to
GetBoundingBox function. There is no need to define them before the function call.
Functions list:
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)
l UDP/UDM Structures
l UDP/UDM Constants
UDP/UDM Structures
Differences compared to C API
l UDMDefinition
l UDMOptions
l UDMParameters
Instead of containing arrays of data, the structures contain single fields where each field cor-
responds to an item in a different array from the original C API. The structure objects thus con-
structed are added to the Python list. Alternately the Python list can be initialized using the structure
objects.
Example (creating UDMParameter list):
udmParamList = [UDMParameter("cubeSizeName", UnitType.LengthUnit,
UDPParam(ParamDataType.Double, cubeSize),
ParamPropType.Value,
ParamPropFlag.MustBeReal),
UDMParameter("cubeDistanceName", UnitType.LengthUnit,
UDPParam(ParamDataType.Double, cubeDistance),
ParamPropType.Value,
ParamPropFlag.MustBeReal),
UDMParameter("numCubesName", UnitType.LengthUnit,
UDPParam(ParamDataType.Int, numCubes),
ParamPropType.Number,
ParamPropFlag.MustBeInt)]
l UDPParam
l UDPParamData
Data field in UDPParam is now an object - the same for all types of data used - as Python can work
with any type of data.
UDPParamData is obsolete, thus not implemented. Be sure to set proper data type to UDPPara-
m.DataType when setting UDPParam.Data.
Example:
nCubesParam = UDPParam(ParamDataType.Int, numCubes)
nCubes = nCubesParam.Data
distanceParam = UDPParam()
distanceParam.setDouble(10.5)
doubleDistance = distanceParam.Data * 2
l UDP3x3Matrix
The structure is not implemented. Use size 9 Python List of doubles instead.
Example:
rotationMatrix =[0,0,1, 1,0,0, 0,0,1]
udpFunctionLib.Transform(partId, rotationMatrix, translationVector)
List of structures
You can use constructors to create a structure. You can also modify fields - directly or by provided
methods.
Example:
pos1 = UDPPosition(1,2,3)
pos2 = UDPPosition(x=1,y=10,z=0)
pos2.Z = pos1.Z
udpParam = UDPParam(ParamDataType.Double,1)
value = udpParam.Data
methods:
setInt(int val)
setBool(bool val)
int covered)
UDPEqua- UDPEqua- string FunctionXt
tionBasedCurveDefinition tionBasedCurveDefinition(
string FunctionYt
string functionXt,
string FunctionZt
string functionYt,
double TStart
string functionZt,
double TEnd
double tStart,
int NumOfPointsOnCurve
double tEnd,
int numOfPointsOnCurve)
UDPEqua- UDPEqua- string FunctionXuv
tionBasedSurfaceDefinition tionBasedSurfaceDefinition(
string FunctionYuv
string functionXuv,
string FunctionZuv
string functionYuv,
double UStart
string functionZuv,
double UEnd
double uStart,
double VStart
double uEnd,
double VEnd
double vStart,
double vEnd)
UDPHelixDefinition UDPHelixDefinition( int ProfileID
int profileID, UDPPosition PtOnAxis
UDPPosition ptOnAxis, UDPPosition AxisDir
UDPPosition axisDir, double NoOfTurns
UDP/UDM Constants
Full names of enum constants must be used in scripts.
Example:
unitType = UnitType.LengthUnit
dataType = ParamDataType.Int
Enum constants:
1. Create a directory that serves as a folder for the logs. Make sure that this directory is empty:
clean it out if it already has files. For this example, the name of the directory is c:\ans-
dir\ansdebug.
2. Start a new shell to set the environment. (You can set it permanently, but this is not recom-
mended.)
3. Set the following env variables in this shell:
l Set ANSOFT_DEBUG_MODE to 2. Set it to a higher number such as 4 or 5 if the
developer requests it.
l Set ANSOFT_DEBUG_LOG to a file in the previously created ansdebug directory: for
example, set ANSOFT_DEBUG_LOG=c:\ansdir\ansdebug\ansdebug.log.
l Set ANSOFT_DEBUG_LOG_SEPARATE to 1.
4. From the above shell, start the ANSYS Electromagnetics product and exercise the problem
scenario.
5. Zip all the log files in the c:\ansdir\ansdebug directory, and send them to the developer or sup-
port person requesting them.
Collecting WB Logs
1. Under WB, execute the Tools/Options menu option, and under the Journals And Logs sec-
tion, ensure the Write Workbench Log Files is checked.
Note the location of the log files. (On Windows this is typically %TEMP%\WorkbenchLogs.)
Navigate to that directory and remove all files.
2. Set up the EBU env vars if you need to collect those as well, following the instructions above.
This opens a Properties dialog box in which you can set parameters.
l GetAppDesktop
The following deprecated commands are no longer supported and produce an error if used.
l GetDesiredRamMBLimit (deprecated)
l GetHPCLicenseType (deprecated)
l GetMaximumRamMBLimit (deprecated)
l GetMPISpawnCmd(deprecated)
l GetMPIVendor (deprecated)
l GetNumberOfProcessors (deprecated)
l GetUseHPCForMP (deprecated)
l SetDesiredRamMBLimit (deprecated)
l SetHPCLicenseType (deprecated)
l SetMaximumRamMBLimit (deprecated)
l SetMPISpawnCmd (deprecated)
l SetMPIVendor (deprecated)
l SetNumberOfProcessors (deprecated)
l SetUseHPCForMP (deprecated)
GetAppDesktop
GetAppDesktop is a function of oAnsoftApp. This function does not take an input and it returns an
object. The object is assigned to the variable oDesktop.
UI Access NA
VB Syntax GetAppDesktop()
VB Set oDesktop = oAnsoftApp.GetAppDesktop()
Example
GetProjectList
GetSysLibDirectory
GetTempDirectory
GetUserLibDirectory
GetVersion
ImportANF
ImportAutoCAD
ImportGDSII
ImportODB
LaunchJobMonitor
NewProject
OpenAndConvertProject
OpenMultipleProjects
OpenProject
Paste
PauseRecording
PauseScript
Print
QuitApplication
RefreshJobMonitor
RestoreProjectArchive
RestoreWindow
ResumeRecording
RunProgram
RunScript
RunScriptWithArguments
SelectScheduler
SetActiveProject
SetActiveProjectByPath
SetLibraryDirectory
SetProjectDirectory
SetTempDirectory
Sleep
SubmitJob
Tile Windows
Also see:
Desktop Commands For Registry Values
AddMessage
Add a message with severity and context to message window.
UI Access NA
ClearMessages
Clears the Message Window
UI Access NA
Python oDesktop.ClearMessages()
Example
VB Syntax ClearMessages
VB Example oDesktop.ClearMessages
CloseAllWindows
Closes all MDI child windows on the desktop.
Python oDesktop.CloseAllWindows()
Example
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
CloseProjectNoForce
Use: Close a named project currently open in the Desktop, unless a simulation is running. Changes
to the project will not be saved. Save the project using the Project command Save or Save As
before closing to save changes. To determine if the project has been closed, use GetPro-
jectList and see if the named project is present.
UI Access File>Close
VB Example:
------------------------------------
Example Script
------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.CloseProjectNoForce "Project9"
Count
Use: Gets the total number of queried projects or designs obtained by GetProjects() and
GetDesigns() commands. See the example query.
Syntax:
Return Value: Returns an integer value.
Parameters: None
Example: set projects = oDesktop.GetProjects()
numprojects = projects.
Example:
---------------------------------------------------------
Example Script: iterate through using integer index
---------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Dim projects
set projects = oDesktop.GetProjects()
for i = 0 to projects.Count - 1
msgbox projects(i).GetName()
dim designs
set designs = projects(i).GetDesigns()
for j = 0 to designs.Count - 1
msgbox designs(j).GetName()
next
next
DeleteProject
Use: Deletes a project from disk.
UI Access Edit>Delete
VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2019.1.0
' 14:24:22 Aug 21, 2018
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.DeleteProject "Project8"
EnableAutoSave
Enable or disable autosave feature.
UI Access NA
Python oDesktop.EnableAutoSave(True)
Example
VB Syntax EnableAutoSave(<Enable>)
VB Example oDesktop.EnableAutoSave(true)
--------------------------------------------------------------------
In this example message box returns 1 since autosave is enabled.
--------------------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject()
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
oDesktop.EnableAutoSave(true)
msgbox(oDesktop.GetAutoSaveEnabled())
ExportOptionsFiles
Copies the options config files to the DestinationDirectory.
Python ExportOptionsFiles( <
DestinationDirectory>)
Syntax
Python oDesktop.ExportOptionsFiles("D:/test/export/")
Example
GetActiveProject
Obtain the object for the project that is currently active in the Desktop.
Note:
UI Access NA
Return Value Object, the project that is currently active in the desktop
VB Syntax GetActiveProject
VB Set oProject = oDesktop.GetActiveProject
Example
VB Example:
------------------------------------
Example Script
------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject()
GetAutoSaveEnabled
Checks to see if the autosave feature is enabled.
UI Access NA
Boolean
Return Value
True if autosave is enabled
VB Syntax GetAutoSaveEnabled
VB Enabled = oDesktop.GetAutoSaveEnabled()
Example
VB Example:
------------------------------------
Example Script
------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject()
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
msgbox(oDesktop.GetAutoSaveEnabled())
GetBuildDateTimeString
Returns a string representing the build date and time of the product;
UI Access NA
String
Return Value The build date and time. Format: year-month-day hour:minute:second, e.g.,
2019-01-18 21:59:33
Python oDesktop.GetBuildDateTimeString()
Example
VB Syntax GetBuildDateTimeString
VB Example dnt = oDesktop.GetBuildDateTimeString
VB Example:
------------------------------------------------------
message box displays dat
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
msgbox(oDesktop.GetBuildDateTimeString())
GetDesigns
Returns the designs in a given project.
For querying designs within a queried project obtained by the GetProjects() command. Once you
have the designs you can iterate through them using standard VBScript methods. See the example
query.
UI Access NA
Return Value A collection containing objects for all designs in the project
tax
VB Syntax GetDesigns
For each dsn in oProject.GetDesigns
VB Example MsgBox dsn.GetName()
next
Example:
--------------------------------------------------------------------
Object in design(0) is edited. designs(0) is one of several designs
in this project. design(0) implies first design; design(1) implies
second design and so on.
--------------------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project9")
set projects = oDesktop.GetProjects()
set designs = projects(0).GetDesigns()
Set oEditor = designs(0).SetActiveEditor("3D Modeler")
oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:Geo-
metry3DCmdTab", Array("NAME:PropServers", _
GetDistributedAnalysisMachines
Gets a list of machines used for distributed analysis. You can iterate through the list using standard
VBScript methods.
UI Access NA
Return Value Returns a collection of names of machines used for distributed analysis
Python GetDistributedAnalysisMachines()
Syntax
VB Syn- GetDistributedAnalysisMachines()
tax
VB Example:
------------------------------------
Example Script
------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
for each machine in oDesktop.GetDistributedAnalysisMachines()
msgbox machine
next
GetDistributedAnalysisMachinesForDesignType
To obtain a list of the machines set up for analysis of the specified design type.
UI Access NA
machineNames =oDesktop.
Python GetDistributedAnalysisMachinesForDesignType
Example
("HFSS")
GetDistributedAnalysisMachinesForDesignType
("HFSS")
GetExeDir
Returns the path where the executable is located.
UI Access NA
String
Return Value path where executable is located, such as 'C:/Program Files/An-
sysEM/AnsysEM19.5/Win64/'
Python oDesktop.GetExeDir()
Example
VB Syntax GetExeDir()
VB Example msgbox(oDesktop.GetExeDir())
GetLibraryDirectory
Get the path to the SysLib directory.
UI Access NA
String
Return Value
The path to the SysLib directory.
Python GetLibraryDirectory()
Syntax
Python AddInfoMessage(str(oDesktop.GetLibraryDirectory()))
Example
VB Syntax GetLibraryDirectory
VB Example MsgBox oDesktop.GetLibraryDirectory
VB Example:
------------------------------------------------------
message box returns the path in this example
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
libdir = oDesktop.GetLibraryDirectory
msgbox(oDesktop.GetLibraryDirectory())
Python GetLibraryDirectory()
Syntax
Python AddInfoMessage(str(oDesktop.GetLibraryDirectory()))
Example
GetMessages
Get the messages from a specified project and design.
UI Access NA
Messages = oDesktop.GetMessages
Python
Example ("MyProject","HFSS1,1)
VB Example:
------------------------------------------------------
For severity =1, the message box returns the first
warning message for Project9, HFSSDesign1
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Dim oseverity
Dim var
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
var = oDesktop.GetMessages(Project9,HFSSDesign1,1)
msgbox var(0)
VB Example:
----------------------------------------------------------
For severity =2, the message box returns the
first error message for Project9, HFSSDesign1
----------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Dim oseverity
Dim var
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
VB Example:
------------------------------------------------------
using for loop display all the messages for
Project9, HFSSDesign1
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Dim var
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
for each var in oDesktop.GetMessages("Project9","HFSSDesign1",1)
msgbox var
next
GetName [Desktop]
Use: Gets names of queried projects or designs obtained by GetProjects() and GetDesigns() com-
mands. See the example query.
Syntax: GetName()
Return Value: Returns a name of type string.
Parameters: None
Example:
set projects = oDesktop.GetProjects()
project_name = projects(0).GetName()
Example:
--------------------------------------------------------------
In this example, message box returns project name. projects(0) is
the first of the several projects. Similarly projects(1) displays
name of second project
----------------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
set projects = oDesktop.GetProjects()
project_name = projects(0).GetName()
msgbox(project_name)
Example:
------------------------------------------------------
message box returns the names of the projects
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
for each prj in oDesktop.GetProjects()
msgbox prj.GetName()
next
GetPersonalLibDirectory
Get the path to the PersonalLib directory.
UI Access NA
String
Return Value
The path to the PersonalLib directory
Python GetPersonalLibDirectory()
Syntax
Python AddInfoMessage(str(oDesktop.GetPersonalLibDirectory()))
Example
VB Syntax GetPersonalLibDirectory
VB MsgBox oDesktop.GetPersonalLibDirectory
Example
VB Example:
------------------------------------------------------
message box returns the PersonalLib directory path
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
sys = oDesktop.GetPersonalLibDirectory()
msgbox(oDesktop.GetPersonalLibDirectory())
GetProcessID
Returns the process ID of ansysedt.exe.
UI Access NA
String
Return Value
returns the process ID of ansysedt.exe, such as 12716
Python oDesktop.GetProcessID()
Example
VB Syntax GetProcessID()
VB Example msgbox(oDesktop.GetProcessID())
GetProjects
Return a list of all the projects that are currently open in the Desktop. Once you have the projects
you can iterate through them using standard VBScript methods. See the example query.
UI Access NA
Return Value Returns a collection containing objects for all open projects in the Desktop
VB Syntax GetProjects
For each pjt in oDesktop.GetProjects
MsgBox pjt.GetName()
VB Example
Next
VB Example:
---------------------------------------------------
Example Script
----------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
GetProjectDirectory
Gets the path to the Project directory.
UI Access NA
String
Return Value
The path to the Project directory.
Python GetProjectDirectory()
Syntax
Python AddInfoMessage(str(oDesktop.GetProjectDirectory()))
Example
VB Syntax GetProjectDirectory
VB Example MsgBox oDesktop.GetProjectDirectory
VB Example:
------------------------------------------------------
message box returns the project directory path
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
projdir = oDesktop.GetProjectDirectory()
msgbox(oDesktop.GetProjectDirectory())
GetProjectList
Returns a list of all projects that are open in the Desktop.
UI Access NA
Return Value An array of strings, the names of all open projects in the Desktop.
VB Syntax GetProjectList
VB list_of_projects = oDesktop.GetProjectList
Example
VB Example:
------------------------------------------------------
message box returns list of project names
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Dim lpj
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
for each lpj in oDesktop.GetProjectList()
msgbox lpj
next
GetSysLibDirectory
Get the path to the SysLib directory.
UI Access NA
String
Return Value
The path to the SysLib directory.
Python GetSysLibDirectory()
Syntax
Python AddInfoMessage(str(oDesktop.GetSysLibDirectory))
Example
VB Syntax GetSysLibDirectory
VB Example MsgBox oDesktop.GetSysLibDirectory
VB Example:
------------------------------------------------------
message box returns system library directory path
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
sys = oDesktop.GetSysLibDirectory()
msgbox(oDesktop.GetSysLibDirectory())
Python GetSysLibDirectory()
Syntax
Python AddInfoMessage(str(oDesktop.GetSysLibDirectory))
Example
GetTempDirectory
Gets the path to the Temp directory.
UI Access NA
String
Return Value
The path to the Temp directory.
Python GetTempDirectory()
Syntax
Python AddInfoMessage(str(oDesktop.GetTempDirectory))
Example
VB Syntax GetTempDirectory
VB Example MsgBox oDesktop.GetTempDirectory
VB Example:
tempdir = oDesktop.GetTempDirectory
VB Example:
------------------------------------------------------
message box returns temp directory path
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
tempdir = oDesktop.GetTempDirectory()
msgbox(oDesktop.GetTempDirectory())
GetUserLibDirectory
Gets the path to the UserLib directory.
UI Access NA
String
Return Value
The path to the UserLib directory.
Python GetUserLibDirectory()
Syntax
Python AddInfoMesage(str(oDesktop.GetUserLibDirectory()))
Example
VB Syntax GetUserLibDirectory
VB Example MsgBox oDesktop.GetUserLibDirectory
VB Example:
------------------------------------------------------
message box returns userlib directory path
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
userlib = oDesktop.GetUserLibDirectory()
msgbox(oDesktop.GetUserLibDirectory())
GetVersion
Use: Returns a string representing the version.
UI Access NA
String
Return Value
The version string of the product.
Python AddInfoMessage(str(oDesktop.GetVersion()))
Example
VB Syntax GetVersion()
VB Example Msgbox oDesktop.GetVersion
VB Example:
------------------------------------------------------
message box displays version number
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
msgbox(oDesktop.GetVersion())
ImportANF
Use:Import an ANF file into a new project.
Command:File > Import > ANF
Syntax:ImportANF<"ANF_filename">
Return Value:None
Parameters:<"ANF_filename">
Type: text
Example:
oDesktop.RestoreWindow()
Set oTool = oDesktop.GetTool("ImportExport")
oTool.ImportANF("C:/AnsTranslator/results/package 4.anf")
Example:
------------------------------------------------------
Example shows how to import an ANF file.
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Dim oTool
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oTool = oDesktop.GetTool("ImportExport")
oTool.ImportANF("C:\Program Files\An-
sysEM\AnsysEM18.0\Win64\Examples\Package\package_board.anf")
ImportAutoCAD
Use:Import an AutoCAD file into a new project.
Command:File >Import > AutoCAD
Syntax:ImportAutoCAD <"AutoCADfilename">, <"Controlfilename">
Return Value:None
Parameters:<"AutoCADfilename">
Type: text
Description: name of the AutoCAD file to import
<"OutputEDBfilename">
Type: text
Description: name of the EDB file to create during the import.
<"Controlfilename">
Type: text
Description: name of the xml control file to use to guide the import.
This string can be empty ("") if no control file is to be used.
VB Example:
Set oTool = oDesktop.GetTool("ImportExport")
oTool.ImportDXF"a4lines.dxf", "a4lines.aedb.edb" "a4lines.xml"
ImportGDSII
Use:Import a GDSII file into a new project.
Command:File > Import > GDSII
Syntax:ImportGDSII
<"GDSIIfilename">
<"OutputEDBfilename">,
<"Controlfilename">,
<"PropertyMappingfilename">
Return Value:None
Parameters:<"GDSIIfilename">
Type: text
Description: name of the GDSII file to import
<"OutputEDBfilename">
Type: text
Description: name of the EDB file to create during the import.
<"Controlfilename">
Type: text
Description: name of the xml control file to use to guide the import.
This string can be empty ("") if no control file is to be used.
<"PropertyMappingfilename">
Type: text
Description: name of the property mapping file to use to guide the import.
This string can be empty ("") if no control file is to be used.
VB Example:
Set oTool = oDesktop.GetTool("ImportExport")
oTool.ImportGDSII "test.gds", "test.aedb.edb", "test.xml",
"test.txt"
ImportGDSII ([
<"GDSIIfilename">
Python Syn- <"OutputEDBfilename">,
tax
<"Controlfilename">,
<"PropertyMappingfilename">
])
oTool.ImportGDSII
([
Python
Example "test.gds", "test.aedb.edb",
"test.xml", "test.txt"
])
ImportODB
LaunchJobMonitor
Use: For use in starting job monitoring. This brings up the Monitor Job dialog box.
Python LaunchJobMonitor()
Syntax
Python oDesktop.LaunchJobMonitor("C:\\projects\\basic.aedt")
Example
VB Syn- LaunchJobMonitor()
tax
VB oDesktop.LaunchJobMonitor("C:\\projects\\basic.aedt")
Example
NewProject
Creates a new project. The new project becomes the active project.
UI Access File>New
VB Syntax NewProject
VB Example Set oProject = oDesktop.NewProject
VB Example:
------------------------------------------------------
Example creates a new project.
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.NewProject
OpenAndConvertProject
Use:Opens a legacy project and converts or copies to .aedt format.
Command:Click File>Open, and choose a legacy project.
Return Value:An object reference to the newly-opened project which has the .aedt extension.
Syntax:OpenAndConvertProject(filePath, legacyChoice)
Parameters:filePath: full path of the legacy project to open
legacyChoice: integer with one of the following values:
0: show conversion dialog box, (same as File>Open of a legacy file)
1: convert, will convert the project/results to project/results with the .aedt extension in the
same directory, the original project will no longer be available
2: copy, will copy the project/results to a new project/results with the .aedt extension in
the same directory, the originals will still be available.
Warning: If project file / results with the same name and .aedt extension already exist in
the same directory, they will be overwritten.
VB Example:
' convert original to OptimTee.aedt
set oProject = oDesktop.OpenAndConvertProject("C:/leg-
acy/OptimTee.hfss", 1)
' create OptimTee.aedt, leave original
set oProject = oDesktop.OpenAndConvertProject("C:/leg-
acy/OptimTee.aedt", 2)
OpenMultipleProjects
Use: Opens all files of a specified type in a specified directory.
Command: Click File>Multiple Open
Syntax: OpenMultipleProjects <Directory> <FileType>
OpenProject
Use: Opens a specified project.
Command: Click File>Open
Syntax: OpenProject <FileName>
Return Value: An object reference to the newly-opened project.
Parameters: <FileName>: Full path of the project to open.
Type: <string>
VB Example:
oDesktop.OpenProject "D:/Projects/Project1.aedt"
VB Example:
------------------------------------------------------
Example opens a specified project.
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.OpenProject "E:/helical_antenna.aedt"
Python OpenProject(<Filename>)
Syntax
Python oDesktop.OpenProject("C:/Projects/MyProject.aedt")
Example
UI Access Edit>Paste
Python oProject.Paste()
Example
VB Syntax Paste
VB Example oProject.Paste
Example:
------------------------------------------------------
Example Script
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject()
oProject.CopyDesign "Differential"
oProject.Paste
UI Access Edit>Paste
Python oProject.Paste()
Example
VB Syntax Paste
VB Example oProject.Paste
VB Example:
------------------------------------------------------
Example Script
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject()
oProject.CopyDesign "Differential"
oProject.Paste
PauseRecording
Temporarily stop script recording.
UI Access NA
Python oDesktop.PauseRecording()
Example
VB Syntax PauseRecording
VB Example oDesktop.PauseRecording
PauseScript
Pause the execution of the script and pop up a message to the user. The script execution will not
resume until the user chooses
Tools>Resume Script
VB Example:
------------------------------------------------------
Example pauses a script. Resume script to run it.
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.PauseScript "Script is paused. Click OK to continue"
Set oProject = oDesktop.NewProject
oDesktop.OpenProject "E:/helical_antenna.aedt"
Print
Use: Prints the contents of the active view window.
UI Access File>Print
Python oDesktop.Print()
Example
VB Syntax Print
VB Example oDesktop.Print
VB Example:
------------------------------------------------------
Example prints the contents of the active window.
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.Print
QuitApplication
Exits the desktop.
UI Access File>Exit
Python oDesktop.QuitApplication()
Example
VB Syntax QuitApplication
VB Example oDesktop.QuitApplication
VB Example:
oDesktop.QuitApplication
------------------------------------------------------
Example : quit an application.
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.QuitApplication
RefreshJobMonitor
For use in monitoring a job.
A string specifing the job state. The result could be one of the following strings:
"Monitor Not Visible"
"Queued"
"Running"
Return Value "Shutting Down"
"Unknown"
"Completed"
"Not Monitoring"
"Starting Monitoring"
Python oDesktop.RefreshJobMonitor()
Example
VB Syntax RefreshJobMonitor()
VB Example oDesktop.RefreshJobMonitor()
VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2016.0.0
' 13:12:25 Oct 12, 2015
' ----------------------------------------------
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run """C:\\Program Files\\An-
sysEM\\AnsysEM18.0\\Win64\\ansysedt.exe"" -ng -monitor -batchsolve
c:\\Projects\\basic.aedt"
'WshShell.Run "notepad"
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.LaunchJobMonitor "c:\\projects\\basic.aedt"
do
a = oDesktop.RefreshJobMonitor()
msg = "state is " + a
oDesktop.AddMessage "", "", 1, a
if a = "Monitor Not Visible" then
exit do
end if
loop
oDesktop.AddMessage "", "", 1, "Done monitoring"
RestoreProjectArchive
Restores a specified project archive to the specified file path.
Command: File>Restore Archive...
Syntax: RestoreProjectArchive <ArchiveFilePath>, <ProjectFilePath>, <OverwriteExistingFiles>,
<OpenProjectAfterRestore>;
Return Value: None
Parameters: <ArchiveFilePath>
Type: string
Archive file path.
<ProjectFilePath>,
Type: string
<OverwriteExitingFiles>,
Type: Boolean
Whether to overwriting any existing files during extraction.
<OpenProjectAfterRestore>,
Type Boolean
Whether to open the project in the desktop.
VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2016.0.0
' 9:41:46 Feb 22, 2016
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.RestoreProjectArchive "C:\User-
s\kmchrist\Documents\OptimTee.aedtz", _
"C:\Documents\OptimTee.aedt", false, true
RestoreWindow
Restores a minimized Desktop window.
UI Access NA
Python oDesktop.RestoreWindow()
Example
VB Syntax RestoreWindow
VB Example oDesktop.RestoreWindow
oDesktop.RestoreWindow
------------------------------------------------------
Example : restores minimized Desktop window.
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
ResumeRecording
Resume recording a script.
UI Access NA
Python oDesktop.ResumeRecording()
Example
VB Syntax ResumeRecording
VB Example oDesktop.ResumeRecording
RunProgram
Runs an external program.
UI Access NA
oDesktop.RunProgram("winword.exe", _
Python
"C:\Program Files\Microsoft Office\Office10",_
Example
"", None)
RunScript
Launches another script from within the script currently being executed.
Long
Return Value
the return code for the script method.
tax
Python oDesktop.RunScript("C:/Project/test1.vbs")
Example
RunScriptWithArguments
Similar to RunScript, launch another script from within the currently executing script, but with argu-
ments.
UI Access NA
Long
Return Value
the return code for the script method.
Python oDesktop.RunScriptWithArguments
Example ("C:/Project/test2.py", "foo")
SelectScheduler
Select the scheduler used for batch job submission. It tries non-graphical selection of the sched-
uler, attempting to get version information from the scheduler in order to check for successful selec-
tion, and if unable to get the information, it then displays the Select Scheduler dialog, waiting for
the user to complete the settings.
The selected scheduler (if selection was successful, this string should match the
Return Value
input option string, although it could differ in upper/lowercase).
SetActiveProject
Specify the name of the project that should become active in the desktop. Return that project.
UI Access NA
Example
Example:
------------------------------------------------------
Example sets an existing project as active.
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Dim lpj
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject ("Project9")
msgbox "Active Project Set to " + oDesktop.GetActiveProject
().GetName()
SetActiveProjectByPath
Specify the name of the project that should become active in the desktop. Return that project. If a
user has two projects open with the same name, the result of SetActiveProject is ambiguous
(the first one listed in selected). This command permits unambiguous specification of the active pro-
ject.
UI Access NA
oProject = oDesktop.SetActiveProjectByPath
Python
Example ("c:\Projects\MyProject.aedt")
VB Syntax SetActiveProjectByPath(ProjectName)
Set oProject = oDesktop.SetActiveProjectByPath
VB
Example
("c:\Projects\MyProject.aedt")
Example:
------------------------------------------------------
Example sets an existing project as active by path.
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProjectByPath("E:/helical_
antenna.aedt")
msgbox "Active Project Set to " + oDesktop.GetActiveProject
().GetName()
SetLibraryDirectory
Sets the library directory path. The specified directory must already exist and contain a syslib
folder.
UI Access NA
Python oDesktop.SetLibraryDirectory("c:\libraries")
Example
SetProjectDirectory
UI Access NA
Python oDesktop.SetProjectDirectory("c:\projects")
Example
VB oDesktop.SetProjectDirectory "c:\projects"
Example
SetTempDirectory
Sets the temp directory path. The directory will be automatically created if it does not already exist.
UI Access NA
Python oDesktop.SetTempDirectory("c:\tmp")
Example
Example:
------------------------------------------------------
Example sets Temp directory path.
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Sleep
Suspends execution of HFSS for the specified number of milliseconds, up to 60,000 milliseconds
(1 minute).
UI Access NA
Python oDesktop.Sleep(1000)
Example
SubmitJob
To submit a batch job to a scheduler. When submitting the same project file multiple times, you
should have the script wait for each job (or jobs for multi-step) to finish, which can be done via the
monitoring functions LaunchJobMonitor() and RefreshJobMonitor(), checking the result of
RefreshJobMonitor() in a loop until it returns completed ("Monitor Not Visible") status.
jobIDs = oDesktop.SubmitJob("C:\\hpc-settings\\Submit_
Job_Settings.areg", "C:\\projects\\basic.aedt"))
Python
moreIDs = oDesktop.SubmitJob("C:\\hpc-settings\\Submit_
Example
Job_Settings.areg", "C:\\projects\\basic.aedt",
"Design1", "Setup1")
jobIDs = oDesktop.SubmitJob("C:\\hpc-settings\\Submit_
Job_Settings.areg", "C:\\projects\\basic.aedt"))
VB
moreIDs = oDesktop.SubmitJob("C:\\hpc-settings\\Submit_
Example
Job_Settings.areg", "C:\\projects\\basic.aedt",
"Design1", "Setup1")
TileWindows
Use: Arrange all open windows in a tiled format.
Command: From main menu, Window>Tile Horizontally or Window>Tile Vertically.
Syntax: TileWindows(<TilingFlag>)TileWindows(<)
Return Value: None
Parameters: <TilingFlag>
Type: <int>
Tile vertically when <TilingFlag> is 0 and horizontally when <TilingFlag> is 1
VB Example:
oDesktop.CloseAllWindows()
VB Example:
------------------------------------
Example Script
------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.TileWindows(0)
Python oDesktop.TileWindows(0)
Example
1. In a PC start HFSS go to the DSO and HPC options dialog, create a setup name it as "test"
2. Export the setup to a file c:\tem\test.acf.
3. Copy the exported file to a target PC f:\temp\test.acf.
4. Run the following script.
DoesRegistryValueExist
GetRegistryInt
GetRegistryString
SetRegistryFromFile
SetRegistryInt
SetRegistryString
DoesRegistryValueExist
Use: Determine if a registry value exists.
Command: None
Syntax: DoesRegistryValueExist <KeyName>
Return Value: Boolean. True if key exists. False otherwise.
Parameters: <KeyName> - registry key name with the full path.
VB Example:
bExist = oDesktop.DoesRegistryValueExist("Desktop/Act-
iveDSOConfigurations/HFSS")
GetRegistryInt
Use: Obtain RegistryKey integer value.
Command: None
Syntax: GetRegistryIn(<KeyName>)
Return Value: Integer for success, if the integer value is found. Return as Bad-Argument-Value, if
Registry key does not exist or it is not an integer value.
Parameters: <KeyName>
Registry key name with the full path.
VB Example:
num = oDesktop.GetRegistryInt("Desktop/Set-
tings/ProjectOptions/HFSS/UpdateReportsDynamicallyOnEdits")
GetRegistryString
Use: Obtain RegistryKey string value.
Command: None.
Syntax: GetRegistryString <KeyName> <PVal>
Return Value: String for success. Bad argument if they key is not defined or has an integer value.
Parameters: <KeyName>
Registry key name with the full path.
VB Example:
activeDSO = oDesktop.GetRegistryString("Desktop/ActiveDSOConfigurations/HFSS")
SetRegistryFromFile
Configures a registry by specifying an Analysis Configuration file which must have been exported
from the HPC and Analysis panel.
Command: None.
Syntax: SetRegistryFromFile "<filePath>"
Return Value: Success if Analysis configuration is imported. Bad argument value if the file is not
found or does not contain valid analysis configuration data.
Parameters: <filePath>
Full path to an Analysis Configuration file.
VB Example:
oDesktop.SetRegistryFromFile "c:/temp/test.acf"
SetRegistryInt
Sets a registry key with an integer value.
Command: None
Syntax: SetRegistryInt "<KeyName>", <int>
Return Value: Success if the key is defined as an integer. Bad argument value if a key is not
defined, or if the value is a text string.
Parameters: <KeyName>
Registry key name with full path.
<int>
New integer value.
VB Example:
oDesktop.SetRegistryInt "Desktop/Set-
tings/ProjectOptions/HFSS/UpdateReportsDynamicallyOnEdits", 0
SetRegistryString
Sets a string value for a specified registry key.
Command: None.
Syntax: SetRegistryString "<KeyPath>" "<val>"
Return Value: Success, if the key is defined as a text string. Bad argument value if the key is not
defined or requires an integer value.
Parameters: <KeyName>
Registry key name with full path.
<val>
New string value.
VB Example:
oDesktop.SetRegistryString "Desktop/ActiveDSOConfigurations/HFSS",
"Local"
AnalyzeAll [project]
Runs the project-level script command from the script, which simulates all solution setups and Opti-
metrics setups for all design instances in the project. The UI waits until simulation is finished before
continuing with the script.
Python oProject.AnalyzeAll()
Example
VB Syntax AnalyzeAll
VB Example oProject.AnalyzeAll
ClearMessages
Clears the Message Window
UI Access NA
Python oproject.ClearMessages()
Example
VB Syntax ClearMessages
VB Example oproject.ClearMessages
Close
Closes the active project. Unsaved changes will be lost.
Command: None
Syntax: Close
Return Value: None
Parameters: None
VB Example:
oProject.Close
CopyDesign
Copies a design
UI Access Edit>Copy
CutDesign
Cuts a design from the active project. The design is stored in memory and can be pasted in any
Twin Builder project
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
Python oProject.CutDesign("SimplorerDesign1")
Example
DeleteDesign
Deletes a specified design in the project.
UI Access Edit>Delete
GetActiveDesign
Returns the design in the active project
Note:
UI Access NA
VB Syntax GetActiveDesign
VB Set oDesign = oProject.GetActiveDesign()
Example
GetDefinitionManager
Obtain the DefinitionManager object.
UI Access NA
Python GetDefinitionManager()
Syntax
VB Syn- GetDefinitionManager
tax
GetDependentFiles
Provides a list of the external files referenced in the project, including characteristic (for example,
MDX) and coupled project files; does not include those in <libdir>/Data directories.
UI Access NA
VB Syntax GetDependentFiles
VB Example files = oProject.GetDependentFiles
VB Example:
files = oProject.GetDependentFiles
for i = 0 to UBound(files)
msgbox files(i)
next
GetName [Project]
Obtain the project name
UI Access NA
Return Value String, the project name not including the path or extension.
VB Syntax GetName
VB Example MsgBox oProject.GetName ()
GetPath
Returns the location of the project on disk.
UI Access NA
String
Return Value
The path to the project, which does not include the project name.
Python AddInfoMessage(str(oProject.GetPath()))
Example
VB Syntax GetPath
VB Example MsgBox oProject.GetPath ()
GetTopDesignList
Returns a list of the names of the top-level designs.
UI Access NA
Return Value An array of strings that are the names of the top-level designs.
name_list = oProject.GetTopDesignList()
Python for i in nameL
Example
AddInfoMessage(str(i))
VB Syntax GetTopDesignList
name_list = oProject.GetTopDesignList()
for each i in
VB
Example MsgBox i
Next
InsertDesign
Use: Inserts a new design in the project. In HFSS scripts, the last argument will always be empty.
Command: Project>Insert HFSS Design
Syntax: InsertDesign "HFSS", <DesignName>, <SolutionType>, ""
Return Value: Object
Parameters: <DesignName>
Type: <string>
<SolutionType>
Type: <string>
Solution type of the new design. Can be "DrivenModal",
"DrivenTerminal", or "Eigenmode".
VB Example:
Set oDesign = oProject.InsertDesign("HFSS", "HFSSDesign3",_
"DrivenModal", "")
For Insert HFSS Layout Design and Insert Circuit Netlist, the command details are as fol-
lows.
Use: Inserts a new design in the project. In Circuit scripts, the last argument will always be empty.
Command: Project>Insert Circuit Design
Syntax: InsertDesign <DesignType>, <DesignName>, <TechnologyFile>:<SubCircuitID>,""
Return Value: None.
Parameters:
<DesignType>
Type: <string>
Possible Values:
"Circuit", "Nexxim Circuit", "System" , "Nexxim Netlist", "HFSS3D"
<DesignName>
Type: <string>
Name of the new design
<TechnologyFile>:<SubCircuitID>
Type: <string>
The path to the Circuit technology file to be used in this design. Use a pair of empty double quotes
("") for none. <SubCircuitID> is optional and must be preceded by a colon if included along with the
Technology File name. No colon is necessary when the subcircuit ID is omitted.
Solution type of the new design where available types depend upon the DesignType
chosen.
InsertDesignWithWorkflow
Inserts a design with a named workflow and returns an IDispatch string.
NA, although Circuit Design has a Show workflow dialog on new design
UI Access
check box in Options.
VB Example
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2019.2.0
' 17:50:12 Mar 04, 2019
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop,
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project28")
oProject.InsertDesignWithWorkflow "Circuit Design", "Serial Design", _
"PCIe3 Stressed", "LongChannel", "SysLib", _
UI Access Edit>Paste
Python oProject.Paste()
Example
VB Syntax Paste
VB Example oProject.Paste
VB Example:
------------------------------------------------------
Example Script
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
UI Access Edit>Redo
Python oProject.Redo()
Example
VB Syntax Redo
VB Example oProject.Redo
Rename
Renames the project and saves it. Similar to SaveAs, except SaveAs requires a path.
UI Access Edit>Rename
RestoreProjectArchive
Restores a specified project archive to the specified file path.
Command: File>Restore Archive...
Syntax: RestoreProjectArchive <ArchiveFilePath>, <ProjectFilePath>, <OverwriteExistingFiles>,
<OpenProjectAfterRestore>;
Return Value: None
Parameters: <ArchiveFilePath>
Type: string
Archive file path.
<ProjectFilePath>,
Type: string
<OverwriteExitingFiles>,
Type: Boolean
Whether to overwriting any existing files during extraction.
<OpenProjectAfterRestore>,
Type Boolean
Whether to open the project in the desktop.
VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2016.0.0
' 9:41:46 Feb 22, 2016
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.RestoreProjectArchive "C:\User-
s\kmchrist\Documents\OptimTee.aedtz", _
"C:\Documents\OptimTee.aedt", false, true
Save
Saves the active project.
UI Access File>Save
Python oProject.Save()
Example
VB Syntax Save
VB Example oProject.Save
SaveAs
Saves the project under a new name. Similar to Rename except SaveAs requires a path.
UI Access File>Save As
For Schematic and Layout editor related projects SaveAs functions as follows.
Use: Saves the project under a new name.
Command: File > Save As
Syntax: SaveAs <FileName> <OverWrite> <DefaultAction> <OverrideActions>
Return Value: None
Parameters:
<FileName>
Type: <string>
New name for the file
<OverWrite>
Type: <bool>
Set to true if an existing project by that name should be overwritten
<DefaultAction>
Type: <string>
Set to one of the following action strings: ef_overwrite , ef_copy_no_overwrite, ef_
make_path_absolute or empty string
<OverrideActions>
Type: Array("Name: OverrideActions", <Files>, <Files>, ...)
<Files>
Type: Array("Name: <Action>", <FileName>, <FileName>, ...)
<DAction>
Type: <string>
Set to one of the following action strings: ef_overwrite , ef_copy_no_overwrite, ef_
make_path_absolute or empty string
VB Example:
oProject.SaveAs
"F:\Designer Projects\TA33097\HighSpeedChannel.aedt", true, "ef_over-
write", Array("NAME:OverrideActions",
Array("NAME:ef_copy_no_overwrite", Array("NAME:Files","$PROJECTDIR/-
circuit_models.inc")),
Array("NAME:ef_make_path_absolute", Array
("NAME:Files","$PROJECTDIR\SL_6s.sp")))
Note:
The DefaultAction is applied to all files that are NOT explicitly listed in the OverrideActions
array. Those in the OverrideActions array are separate arrays for actions that are dif-
ferent from the default action; those actions are applied to the files listed in the same
array:
• If OverrideActions are not specified, then DefaultAction is applied to ALL files in project
directory.
SaveProjectArchive
Saves the active project as an archive to the specified file path.
UI Access File>Archive
on <AdditionalFiles>,<ArchiveNotes>)
Syn-
tax
Pyth- oProject.SaveProjectArchive("C:\\User-
on s\\Documents\\Ansoft\\Project27.aedtz", True, False, [], "")
Exa-
mpl-
e
VB
oProject.SaveProjectArchive "C:\Documents\OptimTee.aedtz",
Examp- true, _
le false, Array(), "My notes"
VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2016.0.0
' 9:41:46 Feb 22, 2016
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("OptimTee")
oProject.Save
oProject.SaveProjectArchive "C:\\Documents\OptimTee.aedtz", true, _
false, Array(), "My notes"
SetActiveDefinitionEditor
Obtain a particular definition editor.
UI Access NA
oSymbolEditor=oProject.SetActiveDefinitionEditor("Sym-
Python bolEditor",
Exampl- "Simplorer Elements\Basic Elements\Circuit\Passive Ele-
e
ments:R")
SetActiveDesign
Sets a new design to be the active design. Specify the name of the design that should become act-
ive and return that design.
UI Access NA
SimulateAll
Runs the SimulateAll project-level script command from the script, which will simulate all solution
setups and Optimetrics setups for all design instances in the project. Script processing only con-
tinues when all analyses are finished.
UI Access NA
Python oProject.SimulateAll()
Example
VB Syntax SimulateAll
VB Example oProject.SimulateAll
Undo [Project]
Cancels the last project-level command.
UI Access Edit>Undo
Python oProject.Undo()
Example
VB Syntax Undo
VB Example oProject.Undo
UpdateDefinitions
Updates all definitions. Warning messages are sent to the message window when definitions can't
be found, informational messages when definitions are updated.
Python oProject.UpdateDefinitions()
Example
VB Syntax UpdateDefinitions
VB Example oProject.UpdateDefinitions
AddMaterial
CloneMaterial
DoesMaterialExist
EditMaterials
ExportMaterial
RemoveMaterial
AddMaterial
Adds a local material.
Command: Add Material command in the material editor .
Syntax: AddMaterial Array("NAME:<MaterialName>",
<MatProperty>, <MatProperty>, ...)
Return Value: None
Parameters: <MatProperty> (simple material)
"<PropertyName>:=", <value>
<PropertyName>
Type: <string>
Should be one of the following: "permittivity",
"permeability", "conductivity"
"dielectric_loss_tangent",
"magnetic_loss_tangent", "saturation_mag",
"lande_g_factor", "delta_H"
property_type
Type: <string>
Should be "AnisoProperty".
unit
Type: <string>
Possible values:
delta_H: "Oe"
saturation_mag: "Gauss", "uGauss", "Tesla", "uTesla"
other properties: "" (empty string)
VB Example:
Set oDefinitionManager = oProject.GetDefinitionManager()
oDefinitionManager.AddMaterial Array("NAME:Material2",_
"dielectric_loss_tangent:=", "44",
Array("NAME:saturation_mag",_
"property_type:=", "AnisoProperty",_
"unit:=", "Gauss",_
"component1:=", "11", _
"component2:=", "22", _
"component3:=", "33"), _
"delta_H:=", "44Oe")
Python oDefinitionManager.AddMaterial(
Example ["permittivity:=", "2.2", "0.002"])
EditMaterial
Modifies an existing material.
"BulkOrSurfaceType:=" , 1,
[
"NAME:PhysicsTypes",
"set:=" , ["Electromagnetic","Thermal","Structur
],
"permittivity:=" , "9.3",
"dielectric_loss_tangent:=", "0.008",
"thermal_conductivity:=", "26",
"mass_density:=" , "3720",
"specific_heat:=" , "790",
"youngs_modulus:=" , "267000000000",
"poissons_ratio:=" , "0.26",
"thermal_expansion_coeffcient:=", "7.2e-006"
])
"specific_heat:=", "790",
"youngs_modulus:=", "267000000000",
"poissons_ratio:=", "0.26",
"thermal_expansion_coeffcient:=", "7.2e-006"
))
ExportMaterial
Exports a local material to a library.
Return None
Value
oDefinitionManager.ExportMaterial (["NAME:mo0907b",_
Python
Example "Material1", "Material2", "Material3"], "UserLib")
VB
oDefinitionManager.ExportMaterial Array("NAME:mo0907b",_
Example "Material1", "Material2", "Material3"), "UserLib"
RemoveMaterial
Use: Removes a material from a library.
Command: Remove Material(s) command in the material editor .
Python oDefinitionManager.RemoveMaterial ([
Example "Material1", false, "mo0907","UserLib"])
Refers to a single item that can be modified in the dockable Properties dialog box or in
the modal Properties pop-up window.
l <PropServer>
Refers to the item whose properties are being modified. This is usually a compound
name giving all the information needed by the editor, design, or project to locate the item
being edited.
l <PropTab>
Corresponds to one tab in the Property dialog box – the tab under which properties are
being edited.
l <PropName>
Project
Project Variables:
<PropServer>
"ProjectVariables"
<PropTab>
"ProjectVariableTab"
<PropTab>
"LocalVariableTab"
Passed Parameters
<PropServer>
"Instance:<name of circuit instance>"
<PropTab>
"PassedParameter Tab"
Definition Parameters
<PropServer>
"DefinitionParameters"
<PropTab>
"DefinitionParameters"
Modules and Editors
<PropServer>
Format is: <ModuleName>:<ItemName>, where <ItemName> is the
boundary name, solution setup name, etc., depending on which module
is being edited.
<PropTab>
Boundary module: "HfssTab"
Mesh Operations module: "MeshSetupTab"
Analysis module: "HfssTab"
Optimetrics module: "OptimetricsTab"
Solutions module: Does not support properties.
Field Overlays module: "FieldsPostProcessorTab"
Radiation module: "RadFieldSetupTab"
Circuit module: "CCircuitTab"
System module: "SystemTab"
HFSS 3D Layout module: "HFSS 3D LayoutTab"
Nexxim module: "NexximTab"
Layout elements: "BaseElementTab"
Schematic elements: "ComponentTab"
Optimetrics module: "OptimetricsTab"
3D Model Editor
Object in the module:
<PropServer>
Name of the object. For example: "Box1".
<PropTab>
"Geometry3DAttributeTab"
Operation on an object:
<PropServer>
Format is <ObjName>:<OperationName>:<int>
Concatenation of object name, operation name, and the index of the operation.
For example: "Box2:CreateBox:2" refers to the second
"CreateBox" command in Box2’s history.
<PropTab>
"Geometry3DCmdTab"
Reporter
Operations on Report properties:
Format is <ReportSetup>
For example, to set the Company Name in the plot header to "My Company":
Set oModule = oDesign.GetModule("ReportSetup")
oModule.ChangeProperty Array("NAME:AllTabs",_ Array
("NAME:Header",_ Array("NAME:PropServers",_
"XY Plot1:Header"), Array("NAME:ChangedProps",_ Array("NAME:Com-
pany Name", "Value:=", "My Company"))))
<PropTab>
Boundary module: "MaxwellTab"
Mesh Operations module: "MeshSetupTab"
Analysis module: "MaxwellTab"
Optimetrics module: "OptimetricsTab"
Solutions module: Does not support properties.
Field Overlays module: "FieldsPostProcessorTab"
Radiation module: "RadFieldSetupTab"
Note:
For scripted property changes in the various modules and editors, refer to the chapters
on the System, HFSS 3D Layout, and Nexxim tools, as well as the Layout and Schematic
editors.
GetArrayVariables
Use: Returns a list of array variables. To get a list of indexed Project variables, execute this com-
mand using oProject. To get a list of indexed local variables, use oDesign.
Syntax: GetArrayVariables()
Return Value: Variant array of strings – the names of the array variables.
VB Example:
Dim var_array
project_var_array = oProject.GetArrayVariables()
local_var_array = oDesign.GetArrayVariables()
GetProperties
Gets a list of all the properties belonging to a specific PropServer and PropTab. This can be
executed by the oProject, oDesign, or oEditor variables.
UI Access NA
selectionArray = oEditor.GetSelections()
for k in selectionArray:
Python
Example props = oEditor.GetProperties("PassedParameterTab",k)
...
selectionArray = oEditor.GetSelections
for each k in selectionArray
VB
props = oEditor.GetProperties("PassedParameterTab",k)
Example
...
next
VB Example:
Dim all_props
all_props = oDesign.GetProperties("HfssTab",_
"BoundarySetup:WavePort1")
GetPropertyValue
Gets the value of a single property belonging to a specific serverName and PropTab. This function
is available with the Project, Design or Editor objects, including definition editors.
Use the script recording feature and edit a property, and then view the resulting script to
see the format for that property.
UI Access NA
Values")
DefinitionParameterTab (Para-
meter Defaults")
LocalVariableTab ("Variables" or
"Local Variables")
ProjectVariableTab ("Project vari-
ables")
ConstantsTab ("Constants")
BaseElementTab ("Symbol" or
"Footprint")
ComponentTab ("General")
CustomTab ("Intrinsic Variables")
Quantities ("Quantities")
Signals ("Signals")
<propServer> String An object identifier, generally returned from
another script method, such as Comp-
Inst@R;2;3
<propName> String Name of the property.
selectionArray = oEditor.GetSelections()
for k in selectionArray:
Python
Exampl- val = oEditor.GetPropertyValue("PassedParameterTab", k,
e "R")
...
VB selectionArray = oEd-
Examp- itor.GetSelections
le
val = oEditor.GetPropertyValue("PassedParameterTab", k,
"R")
...
next
oModule = oDesign.GetModule("ReportSetup")
Python
Example oModule.GetPropertyValue("Trace", "S Parameter Plot
1:dB(S(1,1))","Y Axis")
VB Example:
value_string = _
oEditor.GetPropertyValue("Geometry3DCmdTab",_
"Box1:CreateBox:1", "XSize")
VB Example:value_string = _
oEditor.GetPropertyValue("BaseElementTab",_
"rect_1", "Name")
GetVariables
Returns a list of all defined variables. To get a list of Project variables, execute this command using
oProject. To get a list of local variables, use oDesign.
UI Access NA
project_var_array = oProject.GetVariables()
Python
Example local_var_array = oDesign.GetVariables()
VB Syntax GetVariables ()
VB project_var_array = oProject.GetVariables()
Example local_var_array = oDesign.GetVariables()
GetVariableValue
Gets the value of a single variable. To get the value of Project variables, execute this command
using oProject. To get the value of local variables, use oDesign.
UI Access NA
String
Return Value
A string representing the value of the variable.
Python oProject.GetVariableValue("var_name")
Example
VB Syntax GetVariableValue( <
VarName> )
VB Example oProject.GetVariableValue("var_name")
SetPropertyValue
Sets the value of a single propertybelonging to a specific PropServer and PropTab. This function is
available with the Project, Design or Editor objects, including definition editors.This is not sup-
ported for properties of the following types: ButtonProp, PointProp, V3DPointProp, and
VPointProp. Only the ChangeProperty command can be used to modify these properties.
Use the script recording feature and edit a property, and then view the resulting script
entry or use GetPropertyValue for the desired property to see the expected format.
UI Access NA
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
selectionArray=oEditor.GetSelections()
for k in selectionArray:
...#filter for resistors
Python
Example oEditor.SetPropertyValue("PassedParameterTab",
k, "R", "2200")
...
selectionArray=oEditor.GetSelections
for each k in selectionArray
...'filter for resistors
VB
oEditor.SetPropertyValue("PassedParameterTab",
Example
k, "R", "2200")
...
next
VB Example: oEditor.SetPropertyValue _
"Geometry3DCmdTab","Box1:CreateBox:1",_
"XSize", "3mm"
VB Example: oEditor.SetPropertyValue _
"BaseElementTab","rect_1",_
"LineWidth", "3mm"
SetVariableValue
Sets the value of a variable. To set the value of a Project variable, execute this command using
oProject. To set the value of a local variable, use oDesign.
UI Access NA
AddDataSet
DeleteDataSet
EditDataSet
ImportDataSet
AddDataset
Adds a dataset.
oProject.AddDataset(
Python
[
Example
"NAME:$ds1",
[
"NAME:Coordinates",
[
"NAME:Coordinate",
"X:=", 2,
"Y:=", 4
],
[
"NAME:Coordinate",
"X:=", 6,
"Y:=", 8
]
]
])
DeleteDataset
Deletes the specified dataset.
Python oProject.DeleteDataset("$ds1")
Example
EditDataset
Modifies a dataset. When a dataset is modified, its name as well as its data can be changed.
Array("NAME:Coor
"X:=", 1, "Y:=",
"X:=", 3, "Y:=", 4)))
ImportDataset
Imports a dataset from a named file.
VB Example:
Set oProject = oDesktop.SetActiveProject("OptimTee")
oProject.ImportDataset "F:/work/BSR_1_dk.tab"
1 18.5
2 18.5
3 18.5
4 18.5
5 18.5
6 18.5
...
In the case of Q3D Extractor, the ImportDataset command details are as follows.
Imports a dataset.
Command: Project>Datasets>Import
Syntax: ImportDataset <DatasetFileFullPath>
Return Value: None
Parameters: <DatasetFileFullPath>
Type: <string>
The full path to the file containing the dataset values.
VB Example: oProject.ImportDataset ("e:\tmp\dsdata.txt")
ApplyMeshOps
Analyze
AnalyzeDistributed
ConstructVariationString
DeleteVariation
DeleteFieldVariation
DeleteFullVariation
DeleteLinkedDataVariation
EditDesignSettings
ExportConvergence
ExportMeshStats
ExportProfile
GenerateMesh
GetDesignType
GetModule
GetName
GetNominalVariation
GetSelections
GetSolutionType
GetSolveInsideThreshold
GetSourceContexts
GetVariationVariableValue
PasteDesign
Redo
RenameDesignInstance
ResetToTimeZero
SetActiveEditor
SetDesignSettings
SetSolveInsideThreshold
SetSourceContexts
Solve
RunToolkit
Undo
ConstructVariationString
Lists and orders the variables and values associated with a design variation.
Command: None
Syntax: ConstructVariationString(<ArrayOfVariableNames>, <ArrayOfVari-
ableValuesIncludingUnits>)
Return Value: Returns variation string with the variables ordered to correspond to the order of vari-
ables in design variations. The values for the variables are inserted into the variation string.
Parameters: <ArrayOfVariableNames>
Type: string
<ArrayOfVariableValuesIncludingUnits>
Type: string
VB Example:
varstring = oDesign.ConstructVariationString(Array("x_size", "y_
size"), Array("2mm", "1mm"))
Python oDesign.ConstructVariationString(Array("x_size",
Example "y_size"), Array("2mm", "1mm"))
DeleteFieldVariation
Delete Field variations, field and mesh, or just field.
Command: [Solver]>Results>Clean Up Solutions
Syntax: DeleteFieldVariation [All | Array(<parameters>)], boolean, boolean, [boolean]
Return Value: None
Parameters: All
Deletes all Field and mesh variations
Array(<parameters>)
Deletes specified variation
boolean
VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2015.0.0
' 9:42:08 Oct 22, 2014
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
oDesign.DeleteFieldVariation "All", true, false
VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2015.0.0
' 9:51:41 Oct 22, 2014
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
oDesign.DeleteFieldVariation Array("offset=" & Chr(39) &
"0.0947046688081817in" & Chr(39) & ""), _
true, false
DeleteFullVariation
Use: Use to selectively make deletions or delete all solution data.
Command: [solver]>Results>Clean Up Solutions...
Syntax: DeleteFullVariation Array(<parameters>), boolean
Parameters: All | <DataSpecifierArray>
If, All, all data of existing variations is deleted.
Array(<DesignVariationKey>, )
<DesignVariationKey>
Type: <string>
Design variation string.
<Boolean>
Type: boolean
Whether to also delete linked data.
Example:
Set oDesign = oProject.SetActiveDesign("HFSSModel1")
oDesign.DeleteFullVariation Array(""), false
Example:
Set oDesign = oProject.SetActiveDesign("MaxwellModel1")
oDesign.DeleteFullVariation Array(""), false
Example:
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("ogive")
Set oDesign = oProject.SetActiveDesign("IEDesign1")
oDesign.DeleteFullVariation Array(""), true
Example:
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Tee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
oDesign.DeleteFullVariation Array("offset=" &Chr(39) & "0.2in" _
& Chr(39) & "", "offset=" & Chr(39) & "0in" & Chr(39) & ""), false
DeleteLinkedDataVariation
Deletes cached linked data, either all, or specified variations.
Command: [product_name]>Results>Clean Up Solutions
Syntax: DeleteLinkedDataVariation [All | <DesignVariationKey>, <DesignVariationKey>, …]
Return Value: None
Parameters: All
Deletes All Linked data.
<DesignVariationKey>
Type: <string>
Design variation string.
VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2015.0.0
' 13:37:16 Oct 22, 2014
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
oDesign.DeleteLinkedDataVariation "All"
VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2015.0.0
' 13:56:43 Oct 22, 2014
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
oDesign.DeleteLinkedDataVariation Array("offset=" & Chr(39) &
"0.0947046688081817in" & Chr(39) & "", _
"offset=" & Chr(39) & "0.2in" & Chr(39) & "", "offset=" & Chr(39) &
"0.3in" & Chr(39) & "", _
"offset=" & Chr(39) & "0.4in" & Chr(39) & "", "offset=" & Chr(39) &
"0.5in" & Chr(39) & "", _
"offset=" & Chr(39) & "0.6in" & Chr(39) & "", "offset=" & Chr(39) &
"0.7in" & Chr(39) & "", _
"offset=" & Chr(39) & "0.8in" & Chr(39) & "", "offset=" & Chr(39) &
"0.9in" & Chr(39) & "", _
"offset=" & Chr(39) & "0in" & Chr(39) & "", "offset=" & Chr(39) &
"1in" & Chr(39) & "")
DeleteVariation
Use:Obsolete. Use DeleteFullVariation, DeleteFieldVariation, DeleteLinkedDataVariation.
ExportConvergence
Use: Exports convergence data (max mag delta S, E, freq) to file for the given variation.
Command: None
Syntax: ExportConvergence <SetupName>, <VariationString>, <FilePath> <overwriteIfExists>
Return Value: None
Parameters: <SetupName>
Type: <string>
Example: "Setup1 "
<VariationString>
Type: <string>
Example: "radius = 3mm"
The empty variation string ("") is interpreted to mean the current nominal variation.
<FilePath>
Type: <string>
Example: "c:\convergence.conv"
overwriteIfExists <Boolean>
If "overwriteIfExists" is TRUE, then the playback of the script overwrites an existing file. If
FALSE, it does not. The default is "TRUE".
Type: <string>
Example: overwriteIfExists=TRUE
VB Example:
oDesign.ExportConvergence "Setup1", "x_size = 2mm", "c:\-
convergence.conv"
<VariationString>
Type: <string>
Example: "radius = 3mm"
The empty variation string ("") is interpreted to mean the current
nominal variation.
<SolnType>
Type: "CG", "DC RL" and "AC RL".
<FilePath>
Type: <string>
Example: "c:\convergence.conv"
overwriteIfExists <Boolean>
Type: <string>
Example: overwriteIfExists=TRUE
If "overwriteIfExists" is TRUE, then the playback of the script
overwrites an existing file. If FALSE, it does not. The default is
"TRUE".
VB Example: oDesign.ExportConvergence "Setup1", "x_size = 2mm", "AC
RL", "c:\convergence.conv"
ExportMeshStats
Use: Exports the mesh statistics to a file.
Command: None.
Parameters: <SetupName>
Type: <string>
Example: "Setup1 "
<VariationString>
Type: <string>
Python N/A
Syntax
ExportProfile
Use: Exports a solution profile to file.
Syntax: ExportProfile <SetupName>, <VariationString>, <FilePath>, <overwriteIfExists>
Return Value: None
Parameters: <SetupName>
Type: <string>
Example: "Setup1"
<VariationString>
Type: <string>
Example: "radius = 3mm"
The empty variation string ("") is interpreted to mean the current nominal variation.
<FilePath>
Type: <string>
Example: "c:\profile.prof"
overwriteIfExists <Boolean>
If "overwriteIfExists" is TRUE, then the playback of the script overwrites an existing file. If
FALSE, it does not. The default is "TRUE".
Type: <string>
Example: overwriteIfExists=TRUE
VB Example:
oDesign.ExportProfile "Setup1", "", "c:\profile.prof"
GetDesignType
Use: Returns the design type of the active design.
UI Access NA
Parameters NA
String indicating the design type of the active design ("Circuit Design", "Circuit
Netlist", "HFSS 3D Layout Design", "HFSS", "HFSS-IE", "Icepak", "Maxwell
Return Value
2D", "Maxwell 3D", "Q2D Extractor", "Q3D Extractor", "RMxprt", "Twin
Builder")
VB Syntax GetDesignType()
GetModule
Use: Returns the IDispatch for the specified module.
UI Access NA
VB Example:
Set oModule = oDesign.GetModule "BoundarySetup"
For Q3D Extractor the GetModule command details are as follows.
Use: Returns the IDispatch for the specified module.
Command: none
Syntax: GetModule <ModuleName>
Return Value: Module object.
Parameters: Type: <string>
Name of the module. One of the following:
- Boundary module: "BoundarySetup"
- Mesh Operations module: "MeshSetup"
- Reduce Matrix module: "ReduceMatrix"
- Analysis module: "AnalysisSetup"
- Optimetrics module: "Optimetrics"
- Solutions module: "Solutions"
- Field Overlays module: "FieldsReporter"
- Reporter module: "ReportSetup"
VB Example: Set oModule = oDesign.GetModule "MeshSetup"
Example:
oModule = oDesign.GetModule("ReportSetup")
oModule.GetPropertyValue("Trace", "S Parameter Plot 1:dB(S(1,1))","Y
Axis")
GetName
Returns the name of the Design.
UI Access NA
String, the hierarchical name of the design, with the following format:
Return Value <id0>;<name0>[/<id1>;<name1>]*, where the id and name for a
design at any level of hierarchy can be seen as the values of the ID and Rep-
resentation properties on the General tab when the design is selected in the pro-
ject window. The first set of id and name identifies the top level design, the next
set identifies the design at the next level of hierarchy, and the remaining sets
identify further levels of hierarchy. Note that two instances of the same design
will have different ID values, so that the hierarchical name is specific to the
actual design instance responding to the script method.
VB Syntax GetName
VB Example dname = oDesign.GetName
GetNominalVariation
Use: Gets the nominal variation string
Command: None
Syntax: GetNominalVariation()
Return Value: Returns a string representing the nominal variation
Parameters: None
VB Example:
var = oDesign.GetNominalVariation()
Python oDesign.GetNominalVariation([])
Example
GetSelections
Use:Informational.
Command:None
Syntax:GetSelections
Return Value:array of names. When called after a copy/paste operation, it returns a list of the pas-
ted objects.
Parameters:None
VB Example:Set oProject = oDesktop.SetActiveProject("Project6")
Set oDesign = oProject.SetActiveDesign("Q3DDesign1")
Set oEditor = oDesign.SetActiveEditor("Modeler")
Dim A
A = Array()
A = oEditor.GetSelections
Dim B
B = Join(A,",")
'Debug.Write "The Selections are " &B
MsgBox(B)
Dim C
C = Array("NAME:Selections", "Selections:=", B)
oEditor.Delete C
oEditor.GetSelections(
[
Dim B
B = Join(A,",")
'Debug.Write "The Selections are " &B
Python
Example MsgBox(B)
Dim C
C = Array("NAME:Selections", "Selections:=",
B)
oEditor.Delete C
])
GetSolutionType
Use: Returns the solution type for the design.
Command: none
Syntax: GetSolutionType
Return Value: <SolutionType>
Type: <string>
Possible values are: "DrivenModal", "DrivenTerminal", "Eigenmode", "Transient" or
"Transient Network".
VB Example:
oDesign.GetSolutionType
oProject = oDesktop.GetActiveProject()
Python
oDesign = oProject.GetActiveDesign()
Example
oDesign.GetSolutionType()
GetSolveInsideThreshold
Use: Returns the solve inside threshold. This command command does not apply to HFSS-IE.
Command: none
Syntax: GetSolveInsideThreshold
Return Value: Double representing the solve inside threshold.
VB Example:
oDesign.GetSolveInsideThreshold
GetSourceContexts
Use: Obtain sources currently enabled as context in the Edit Sources dialog Source Context tab.
Command: None
Syntax: GetSource Contexts
Python oModule.GetSourceContexts([])
Example
GetVariationVariableValue
Use: Finds the value of a variable for a specific variation string.
Command: None
Syntax: GetVariationVariableValue(<VariationString>, <VariableName>)
Return Value: Returns a double precision value in SI units, interpreted to mean the value of the vari-
able contained in the variation string.
Parameters: <VariationString>
Type: string
<VariableName>
Type: string
VB Example:
Example: varval = _
oDesign.GetVariationVariableValue("x_size = 2mm y_size = 1mm",_ "y_
size")
GeometryCheckAndAutofix
Use: Runs Geometry Check and optionally applies autofixes.
Command: HFSS 3D Layout > Geometry Check
Syntax: GeometryCheckAndAutofix <ChecksArray>,
minimum_area_meters_squared,
<FixesArray>
Return Value: None
Parameters: <ChecksArray> - Array("NAME:checks", <check 1>, <check
2>, …, <check n>)
Specify the checks that should be included. Specifying fewer checks
may speed up execution but may also result in less problems reported
in the message manager (or the logfile) and consequently less prob-
lems that can be fixed by autofixes.
The following are valid checks that can be specified:
— "Self-Intersecting Polygons"
— "Disjoint Nets (Floating Nodes)"
— "DC-Short Errors"
— "Identical/Overlapping Vias"
— "Misaligments"
There may be no checks, all 5 of the checks, or anything in between.
The order that checks are specified in is not relevant.
minimum_area_meters_squared
Specify a decimal value for the minimum area (e.g. .000015) option-
ally in scientific notation (e.g. 2E-006). Cutouts smaller than this
minimum area may be ignored during validation check.
l 1 to create a new copy of the design that was copied but keep the original layers of the
design being copied
l 2 to create a new copy of the design and merge the layers of the design being copied into the
design receiving the copy
VB Example:
' ----------------------------------------------
Redo [Design]
Reapplies the last design-level command.
UI Access Edit>Redo
Python oDesign.Redo()
Example
VB Syntax Redo
VB Example oDesign.Redo
RenameDesignInstance
Renames a design instance.
Right-click a design instance in the project tree, and then click Rename on the
UI Access
shortcut menu.
VB oDesign.RenameDesignInstance "HFSSDesign1",
Example "HFSSDesign2"
ResetToTimeZero
To reset a simulation to time zero.
Command: CleanStop
Syntax: ResetToTimeZero( "<name of setup>" )
Return Value: None
Parameters: <Name of Setup>
VB Example:
# ----------------------------------------------
# Script Recorded by ANSYS Electronics Desktop Version 2015.0.0
# 16:11:48 Nov 14, 2014
# ----------------------------------------------
import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oProject = oDesktop.SetActiveProject("TermPorts")
oDesign = oProject.SetActiveDesign("TermPorts2Active")
oDesign.AnalyzeAll()
oModule = oDesign.GetModule("AnalysisSetup")
oModule.ResetToTimeZero("Setup1")
Python oModule.ResetToTimeZero(["Setup1"])
Example
SARSetup
Sets up for the specific absorption rate (SAR) computation.This command command does not
apply to HFSS-IE.
Command: HFSS>Fields>SAR Setting
Syntax: SARSetup <TissueMass>, <MaterialDensity>, <Tissue object List ID>, <voxel size>,
<Average SAR method>
Return Value: None
Parameters: <TissueMass>
Type: <double>
Double between 1 and 10 in grams.
<MaterialDensity>
Type: <double>
Positive double in gram/cm3.
Type: <integer>
The ID of an object list which will be treated as tissues for SAR calculation.
<voxel size>
Type: <double>
The size of a voxel in millimeters.
SetActiveEditor
Sets the active editor.
Command: None
Syntax: SetActiveEditor(<EditorName>)
Return Value: Editor object
Parameters: <EditorName>
Type: <string>
The only choice is "3D Modeler"
VB Example:
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
SetBackgroundMaterial
Use:Sets the background material of the design.
Command:Right click on the design in the project tree and choose "Set Background Material".
Syntax:SetBackgroundMaterial <MatName>
Return Value:None
Parameters:<MatName>
Type: <string>
The name of the background material
VB Example:oDesign.SetBackgroundMaterial "vacuum"
Note:
For a 2D project, you can run this command only if the following conditions are met:
SetLengthSettings
Use:Sets the distributed and lumped length of the design.
Syntax:SetLengthSettings
Return Value:None
Parameters: <DistributedUnits>
Type:<String>
Value: Length units
Length Units used for post processing in the design.
<LumpedLength>
Type:<String>
Value: Length (double) with units.
Length of design used in post processing.
<RiseTime>
Type: <String>
SetSolutionType
Sets the solution type for the design. This command does not apply to HFSS-IE.
Command: HFSS>Solution Type
Syntax: SetSolutionType <SolutionType>, <AutoOpenMode>,<Model_Exterior_as_IE>
Return Value: None
Parameters: <SolutionType>
Type: <string>
Possible values are: "DrivenModal", "DrivenTerminal", "Transient", "Transient Network",
or "Eigenmode"
<AutoOpenMode>
Type: <Boolean>
Only applies for Driven Solution Type. Possible values are: True, False
<Model_Exterior_as_IE>
Type: <Boolean>
Only Applies for Driven Solution Type. Possible values are: True, False.
VB Example:
oDesign.SetSolutionType "DrivenModal", true, true
Python oDesign.SetSolutionType
Example (["Open"])
SetSolveInsideThreshold
Set the solve inside threshold to the supplied double. This command command does not apply to
HFSS-IE.
Command: None
Syntax: SetSolveInsideThreshold(<threshold>)
Return Value: None
Parameters: <threshold>
Type: <double>
Siemens/m
VB Example:
oDesign.SetSolveInsideThreshold(100000)
SetSourceContexts
For Near or Far Field projects for Driven Modal or Driven Terminal Network Analysis Solutions,
specify the port name and all modes/terminals of that port to be enabled as Source Context.
Command: Fields>Edit Sources
Syntax: SetSourceContexts Array("<sourceID>",...)
Return Value: None.
Parameters: <sourceID>
Type: <string>
VB Example:
SetoModule = oDesign.GetModule("Solutions")
oModule.SetSourceContexts Array("Box1_T1", "Box1_T2", "Box1_T3",
"Current1", "IncPWave1")
oModule.SetSourceContexts Array([
Python "Box1_T1",
Example "Box1_T2", "Box1_T3", "Current1", "IncPWave1"
])
Solve
Performs a blocking simulation. The next script command will not be executed until the simulation is
complete.
Command: [product]>Analyze
Syntax: Solve <SetupNameArray>
Return Value: Type: <int>
-1: simulation error
0: normal completion
Parameters: <SetupNameArray>: Array(<SetupName>, <SetupName>, ...)
<SetupName>
Type: <string>
Name of the solution setup to solve.
VB Example:
return_status = oDesign.Solve Array("Setup1", "Setup2")
Performs a blocking simulation. The next script command will not be executed until the simulation is
complete.
Command: Q3D Extractor or 2D Extractor>Analyze. Or right-click the Analysis option in the
project tree and choose "Analyze".
Syntax: Solve <SetupNameArray>
Return Value: Type: <int>
-1: command execution error
1: simulation error
0: normal completion
Parameters: <SetupNameArray>: Array(<SetupName>, <SetupName>, ...)
<SetupName>
Type: <string>
Name of the solution setup to solve.
VB Example: return_status = oDesign.Solve Array("Setup1", "Setup2")
oDesign.Solve Array([
Python
"Setup1", "Setup2"
Example
])
RunToolkit
Use: Run a Python toolkit script, applying it to the Active Project. The script itself may have pre-
requisites, such as sweeps defined, or specific model characteristics, such as port definitions.
Command: [product]>Toolkit><IronPythonScript>
Syntax: RunToolkit "<LibName>", "<IronPythonScriptName>", Array()
Return Value: User Defined Solutions and user Defined Outputs.
Parameters: <LibName>
Type: <string>
Name of the library in which the script is located.
<IronPythonScriptName>
Type: <string>
Name of the IronPython script.
Array(<array>
Type: <Array>
Additional parameters or files required by the script.
VB Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 16.0.0
' 10:12:18 AM May 14, 2013
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("test_HAC")
Set oDesign = oProject.SetActiveDesign("RCS1")
oDesign.RunToolkit "SysLib", "HearingAidCompliance", Array()
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertFrequencySweep "Setup1", Array("NAME:Sweep", "IsEn-
abled:=", true, "SetupType:=", _
"LinearStep", "StartValue:=", "1GHz", "StopValue:=", "10GHz", "StepS-
ize:=", _
"0.1GHz", "Type:=", "Interpolating", "SaveFields:=", false,
"SaveRadFields:=", _
false, "InterpTolerance:=", 0.5, "InterpMaxSolns:=", 250, "Inter-
pMinSolns:=", _
0, "InterpMinSubranges:=", 1, "ExtrapToDC:=", false, "InterpUseS:=",
true, "InterpUsePortImped:=", _
false, "InterpUsePropConst:=", true, "UseDerivativeConvergence:=",
false, "InterpDerivTolerance:=", _
0.2, "UseFullBasis:=", true, "EnforcePassivity:=", true, "Passiv-
ityErrorTolerance:=", _
0.0001)
Full scripting for cable modeling is not supported and no arguments are allowed in the script. The
RunToolkit command will not automatically create a cable bundle, but will simply open the Cable
Modeling dialog box. You will have to manually input your parameters.
Currently, the script to launch the cable modeling dialog boxes is:
oDesign.RunToolkit "SysLib", "CableModeling/AutomotiveCableBundle",
Array()
oDesign.RunToolkit "SysLib", "CableModeling/Oil-GasCableBundle",
Array()
oModule = oDesign.GetModule("AnalysisSetup")
Python oModule.InsertSetup "Matrix", Array("NAME:Setup1",
Examp- "AdaptiveFreq:=", "1GHz", "SaveFields:=", _
le
true, "Enabled:=", true, Array("NAME:Cap",
"MaxPass:=", 10, "MinPass:=", 1, "MinConvPass:=", _
Undo [Design]
Cancels the last design-level command.
UI Access Edit>Undo
Python oDesign.Undo()
Example
VB Syntax Undo
VB Example oDesign.Undo
ValidateDesign
Use: Returns the validation information to a named file.
Command: Validate
oProject = oDesktop.GetActiveProject()
Python
oDesign = oProject.GetActiveDesign()
Exampl-
e oDesign.ValidateDesign(r"C:/Users/agao/Desktop/f1.tmp",
True)
l NonModel
l Wireframe
Array("NAME:Selections",
"Selections:=", <string>)
Selections
Comma-separated list of parts on which to perform the operation.
Example: "Selections:=", "Rect1, Rect2"
The topics for this section include:
Draw Menu Commands
Edit Menu Commands
Modeler Menu Commands
Other oEditor Commands
CreateTorus
CreateUserDefinedModel
CreateUserDefinedPart
Edit3DComponent
EditNativeComponentDefinition
EditPolyline
Get3DComponentParameters
Get3DComponentDefinitionNames
Get3DComponentInstanceNames
Get3DComponentMaterialNames
Get3DComponentMaterialProperties
Insert3DComponent
InsertPolylineSegment
SweepAlongPath
SweepAlongVector
SweepAroundAxis
SweepFacesAlongNormal
SweepFacesAlongNormalWithAttributes
UpdateComponentDefinition
Create3D Component
Use: Create a 3D component
Command: None
Syntax: Create3DComponent <Geometry Data>, <Design Data>, <File Name>, <Image File>
Return Value: None
Parameters: < Geometry Data>
Geometry data
< Design Data>
Design data
< File Name>
File name of 3D component
"ComponentName:=", "Connector",
"Owner:=", "", "Email:=", "", "Company:=", "",
"Version:=", "1.0", "Date:=", "11:41:01 AM Aug 28, 2014",
"Notes:=", "", "HasLabel:=", false,
"IncludedParts:=", Array( "Box1", "Cylinder1", "Cone1"),
"IncludedCS:=", Array("RelativeCS1"),
Python "ReferenceCS:=", "Global",
Exampl- "IncludedParameters:=", Array("htcone", "lr", "htcyl",
e "zs",
"radcyl", "xs", "$rp", "$con"),
"ParameterDescription:=", Array()),
Array("NAME:DesignData", "Boundaries:=",
Array( "PerfE1", "FiniteCond1"),
"Excitations:=", Array("1"),
"MeshOperations:=", Array()),
"C:/tmp/Connector.a3dcomp",
Array("NAME:ImageFile", "ImageFile:=", "" ])
CreateBondwire
Use: Creates a bondwire primitive.
Command: Draw>Bondwire
Syntax: CreateBondwire <ParametersArray>, <AttributesArray>
Return Value: The name of the newly created object.
Parameters: <ParametersArray>
Array("NAME:BondwireParameters",
"WireType:=", <string>,
"WireDiameter:=", <value>,
"NumSides:=", <value>,
"XPadPos:=", <value>,
"YPadPos:=", <value>,
"ZPadPos:=", <value>,
"XDir:=", <value>,
"YDir:=", <value>,
"ZDir:=", <value>,
"Distance:=", <value>,
"h1:=", <value>,
"h2:=", <value>,
"alpha:=", <value>,
"beta:=", <value>,
"WhichAxis:=", <string>)
WireType
Should be one of: "JEDEC_4Points", "JEDEC_5Points"
Example: "WireType:=", "JEDEC_4Points"
WhichAxis
Axis normal to the plane where the wire is drawn. Possible values are: "X", "Y", "Z"
Example: "WhichAxis:=", "Z" means the bond wire will be drawn on the XY plane.
CreateCutplane
Use: Creates a cutplane. Only the name and color attributes from <AttributesArray> are sup-
ported.
Command: Draw>Plane
Syntax: CreateCutplane <CutplaneParametersArray>,
<AttributesArray>
Return Value: The name of the newly created object.
Parameters: <CutplaneParametersArray>
Array("NAME:PlaneParameters",
"PlaneBaseX:=", <value>,
"PlaneBaseY:=", <value>,
"PlaneBaseZ:=", <value>,
"PlaneNormalX:=", <value>,
"PlaneNormalY:=", <value>),
"PlaneNormalZ:=", <value>)
CreateEquationCurve
Use: Create an equation-based curve.
Command: Draw>Equation Based Curve
Syntax: CreateEquationCurve Array <Parameters> Array<Attributes>
Return Value: None
Parameters:
Array("NAME:EquationBasedCurveParameters",
"XtFunction:=", "<value>",
"YtFunction:=", "<value>",
"ZtFunction:=", "<value>",
"tStart:=", "<value>",
"tEnd:=", "<value>",
"NumOfPointsOnCurve:=", "<value>",
"Version:=", <ID>),
Array("NAME:Attributes",
"Name:=", "<textn>",
"Flags:=", "",
"Color:=", "(<int> <int> <int>)",
"Transparency:=", <value>,
"PartCoordinateSystem:=", "<id>",
"UDMId:=", "",
"MaterialValue:=", "" & Chr(34)
& "vacuum"
& Chr(34) & "",
"SolveInside:=", <boolean>)
oEditor.CreateEquationCurve(
[
"NAME:EquationBasedCurveParameters",
"XtFunction:=" , "sin(_t)",
"YtFunction:=" , "_t",
"ZtFunction:=" , "_t",
"tStart:=" , "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,
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False
])
CreateEquationSurface
Use: Create an equation based surface. For descriptions of the parameters, see the online help for
the Draw>Equation Based Surface command. The parameters here correspond to the fields in
the dialog.
oEditor.CreateEquationSurface(
[
"NAME:EquationBasedSurfaceParameters",
"XuvFunction:=" , "_u",
"Version:=" , 1
],
[
"NAME:Attributes",
"Name:=" , "EquationSurface1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False
])
CreateHelix
Use: Creates a helix by sweeping the specified 2D objects.
Command: Draw>Helix
Syntax: CreateHelix <SelectionsArray>, <HelixParametersArray>
Return Value: The name of the newly created object.
Parameters: <SelectionsArray>
Array("NAME:Selections",
"Selections:=", <string>)
Selections
Comma-separated list of parts to sweep.
Example: "Selections:=", "Rect1, Rect2"
<HelixParametersArray>
Array("NAME:HelixParameters",
"XCenter:=", <value>,
"YCenter:=", <value>,
"ZCenter:=", <value>,
"XStartDir:=", <value>,
"YStartDir:=", <value>,
"ZStartDir:=", <value>,
"Thread:=", <value>,
"NumThread:=", <value>,
"RightHand:=", <bool>)
CreatePoint
Use: Creates a point. Only the name and color attributes from <AttributesArray> are supported.
Command: Draw>Point
Syntax: CreatePoint <PointParametersArray>, <AttributesArray>
Return Value: The name of the newly created object.
Parameters: <PointParametersArray>
Array("NAME:PointParameters",
"PointX:=", <value>,
"PointY:=", <value>,
"PointZ:=", <value>)
CreateUserDefinedPart
Use: Create User defined part.
Command: Draw>UserDefinedPrimitive
Syntax: CreateUserDefinedPart <UserDefinedParametersArray>, <AttributesArray>
Return Value: None
Parameters: <UserDefinedParametersArray>
Array("NAME:UserDefinedPrimitiveParameters",
"CoordinateSystemID:=", <value>,
"DllName:=", <string>,
"Library:=", <string>,
Array("NAME:ParamVector",
oEditor.CreateUserDefinedPart [
(
Array("NAME:UserDefinedPrimitiveParameters",
"CoordinateSystemID:=", -1,
"DllName:=", "Examples/RectangularSpiral",
"NoOfParameters:=", 6, "Library:=", "syslib",
Array("NAME:ParamVector",
Array("NAME:Attributes", "Name:=",
"RectangularSpiral1",
"Flags:=", "",
"Color:=", "(132 132 193)",
"Transparency:=", 0,
"PartCoordinateSystem:=", "Global",
"MaterialName:=", "copper",
"SolveInside:=", _
False)
)]
CreateRegion
Use: Defines a region containing the design.
Command: Draw>Create Region
Syntax: CreateRegion <RegionParameters> <RegionAttributes>
Return Value: The name of the newly created object.
Parameters: <RegionParameters>
Array("NAME:RegionParameters", _
"+XPaddingType:=", <Offset_Type>,
"+XPadding:=", "<X_value>", _
"-XPaddingType:=", <Offset_Type>,
"-XPadding:=", "<-X_value>", _
"+YPaddingType:=", <Offset_Type>,
"+YPadding:=", "<Y_value>",
"-YPaddingType:=", <Offset_Type>,
"-YPadding:=", "<-Y_value>", _
"+ZPaddingType:=", <Offset_Type>,
"+ZPadding:=", "<Z_value>", _
"-ZPaddingType:=", <Offset_Type>,
"-ZPadding:=", "<-Z_value>")
<Offset_Type>
Type: String
Can be one of:
"Percentage Offset",
"Absolute Offset",
"Absolute Position",
<RegionAttributes>
Array("NAME:Attributes",
"Name:=", "Region", _
"Flags:=", "Wireframe<# or >", _
"Color:=", "(<red_int> <green_int> <blue_int>)", _
"Transparency:=", <real>, _
"PartCoordinateSystem:=", "<ID>", _
"MaterialName:=", "<MaterialName>", _
"SolveInside:=", <Boolean>)
VB Example:
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateRegion Array("NAME:RegionParameters",
"+XPaddingType:=", "Absolute Offset", _
"+XPadding:=", "1um", _
"-XPaddingType:=", "Absolute Offset", _
"-XPadding:=", "1um", _
"+YPaddingType:=", "Absolute Offset", _
"+YPadding:=", "1um",
"-YPaddingType:=", "Absolute Offset", _
"-YPadding:=", "1um", _
"+ZPaddingType:=", "Absolute Offset", _
"+ZPadding:=", "1um", _
"-ZPaddingType:=", "Absolute Offset", _
"-ZPadding:=", "1um"),
Array("NAME:Attributes", "Name:=", _
"Region", "Flags:=", "Wireframe#", _
"Color:=", "(255 0 0)", _
"Transparency:=", 0, _
"PartCoordinateSystem:=", "Global", _
"MaterialValue:=", "" & Chr(34) & "vacuum" & Chr(34) & "", _
"SolveInside:=", true)
"CoordinateSystemID:=", <ID_number>_
"+XPadding:=", "<X_value>", _
"-XPadding:=", "<-X_value>", _
"+YPadding:=", "<Y_value>",
"-YPadding:=", "<-Y_value>", _
"+ZPadding:=", "<Z_value>", _
"-ZPadding:=", "<-Z_value>")
<RegionAttributes>
Array("NAME:Attributes",
"Name:=", "Region", _
"Flags:=", "Wireframe<# or >", _
"Color:=", "(<red_int> <green_int> <blue_int>)", _
"Transparency:=", <real>, _
"PartCoordinateSystem:=", "<ID>", _
"MaterialName:=", "<MaterialName>", _
"SolveInside:=", <Boolean>)
Set oEditor = oDesign.SetActiveEditor("3D Modeler") oEd-
itor.CreateRegion Array("NAME:RegionParameters", _ "Coordin-
ateSystemID:=", -1, _ "+XPadding:=", "0", "-XPadding:=", "0", _
"+YPadding:=", "0", "-YPadding:=", "0", _ "+ZPadding:=", "0", "-ZPad-
ding:=", "0"), _ Array("NAME:Attributes", "Name:=", "Region", _
"Flags:=", "Wireframe#", _ "Color:=", "(255 0 0)", _ "Trans-
parency:=", 0.400000005960464, _ "PartCoordinateSystem:=", "Global",
_ "MaterialName:=", "vacuum", _ "SolveInside:=", true)
oEditor.CreateRegion (
[
Python
Array("NAME:RegionParameters",
Example "+XPaddingType:=", "Absolute Offset", _
"+XPadding:=", "1um", _
"-XPaddingType:=", "Absolute Offset", _
"-XPadding:=", "1um", _
"+YPaddingType:=", "Absolute Offset", _
"+YPadding:=", "1um",
"-YPaddingType:=", "Absolute Offset", _
"-YPadding:=", "1um", _
"+ZPaddingType:=", "Absolute Offset", _
"+ZPadding:=", "1um", _
"-ZPaddingType:=", "Absolute Offset", _
"-ZPadding:=", "1um"),
Array("NAME:Attributes", "Name:=", _
"Region", "Flags:=", "Wireframe#", _
"Color:=", "(255 0 0)", _
"Transparency:=", 0, _
"PartCoordinateSystem:=", "Global", _
"MaterialValue:=", "" & Chr(34) & "vacuum"
& Chr(34) & "", _
"SolveInside:=", True)
)]
CreateRegularPolyhedron
Use: Creates a regular polyhedron primitive.
Command: Draw>Regular Polyhedron
Syntax: CreateRegularPolyhedron <PolyhedronParametersArray>,
<AttributesArray>
Return Value: The name of the newly created object.
Parameters: <PolyhedronParametersArray>
Array("NAME:PolyhedronParameters",
"XCenter:=", <value>,
"YCenter:=", <value>,
"ZCenter:=", <value>,
"XStart:=", <value>,
"YStart:=", <value>,
"ZStart:=", <value>,
"Height:=", <value>,
"NumSides:=", <value>,
"WhichAxis:=", <string>)
NumSides:
Specify a number greater than 2.
WhichAxis
Axis of the polyhedron. Possible values are: "X", "Y", "Z"
Example: "WhichAxis:=", "Z"
CreateSpiral
Use: Creates a spiral by sweeping the specified 2D objects.
Command: Draw>Spiral
Syntax: CreateSpiral <SelectionsArray>, <SpiralParametersArray>
Return Value: The name of the newly created object.
Parameters: <SelectionsArray>
Array("NAME:Selections",
"Selections:=", <string>)
Selections
Comma separated list of parts to sweep.
Example: "Selections:=", "Rect1, Rect2"
<SpiralParametersArray>
Array("NAME:SpiralParameters",
"XCenter:=", <value>,
"YCenter:=", <value>,
"ZCenter:=", <value>,
"XStartDir:=", <value>,
"YStartDir:=", <value>,
"ZStartDir:=", <value>,
"NumThread:=", <value>,
"RightHand:=", <bool>,
"RadiusIncrement:=", <value>)
CreateUserDefinedModel
Command: Creates a SpaceClaimLink. Spaceclaim file path has to be included as "Geo-
metryFilePath" definition. Another definition named "IsSpaceClaimLinkUDM" needs to be there
with value equal to 1.
Syntax: UserDefinedModel <UserDefinedModelParameters>
Return Value: None
Parameters: <UserDefinedModelParameters>
Array("NAME:UserDefinedModelParameters
"DllName:=", "<modelName>", "Version:=", "2.0",
"ConnectionID:=", "", "Library:=", "<installLib>",
Array("NAME:Definition", Array("NAME:UDMParam",
"Name:=", "GeometryFilePath", "Value:=", "" & Chr(34) &
"<SpaceClaimFilePath>" & Chr(34) & "" & "",
"DataType:=", "String", "PropType2:=", 0,
"PropFlag2:=", 1),
Array("NAME:UDMParam", "Name:=", "IsSpaceClaimLinkUDM",
"Value:=", "1", "DataType:=", "Int", "PropType2:=", 5,
"PropFlag2:=", 8))
VB Example:
oEditor.CreateUserDefinedModel Array("NAME:User-
DefinedModelParameters",
"DllName:=", "SCIntegUDM", "Version:=", "2.0",
"ConnectionID:=", "", "Library:=", "installLib",
Array("NAME:Definition", Array("NAME:UDMParam",
"Name:=", "GeometryFilePath", "Value:=", "" & Chr(34) &
"G:\box.scdoc" & Chr(34) & "" & "",
"DataType:=", "String", "PropType2:=", 0, "PropFlag2:=", 1), Array
("NAME:UDMParam", "Name:=", "IsSpaceClaimLinkUDM",
"Value:=", "1", "DataType:=", "Int", "PropType2:=", 5,
"PropFlag2:=", 8)),
Array("NAME:Options", Array("NAME:UDMParam",
"Name:=", "Solid Bodies", "Value:=", "1",
"DataType:=", "Int", "PropType2:=", 5, "PropFlag2:=", 0), Array
oEditor.CreateUserDefinedModel [(
{Array("NAME:UserDefinedModelParameters",
Array("NAME:UDMParam",
"Name:=", "Surface Bodies", "Value:=", "1", "DataType:=",
"Int", "PropType2:=",
5, "PropFlag2:=", 0),
Array("NAME:UDMParam", "Name:=", "Line Bodies",
"Value:=", "1", "DataType:=", "Int", "PropType2:=", 5,
"PropFlag2:=",
8),
Array("NAME:UDMParam", "Name:=", "Parameters", "Value:=",
"1",
"DataType:=", "Int", "PropType2:=", 5, "PropFlag2:=", 0),
Array("NAME:UDMParam",
"Name:=", "Parameter Key",
"Value:=", "" & Chr(34) & "" & Chr(34) & "", "DataType:=",
"String", "PropType2:=", 0, "PropFlag2:=", 0),
Array("NAME:UDMParam", "Name:=", "Named Selections",
"Value:=", "1",
"DataType:=", "Int", "PropType2:=", 5, "PropFlag2:=", 8),
Array("NAME:UDMParam", "Name:=", "Rendering Attributes",
"Value:=", "1", "DataType:=", "Int", "PropType2:=", 5,
"PropFlag2:=", 0),
Array("NAME:UDMParam", "Name:=", "Material Assignment",
"Value:=", "1", "DataType:=", "Int", "PropType2:=", 5,
"PropFlag2:=", 0),
Array("NAME:UDMParam", "Name:=", "Explode Multi-Body Parts",
"Value:=",
"1", "DataType:=", "Int", "PropType2:=", 5,
"PropFlag2:=", 8),
Array("NAME:UDMParam", "Name:=", "Smart CAD Update",
"Value:=", "1",
"DataType:=", "Int", "PropType2:=", 5, "PropFlag2:=", 8)),
Array("NAME:GeometryParams"),
Array("NAME:MaterialParams"), Array("NAME:DesignParams")
])
CreateUserDefinedPart
Use: Create User defined part.
Command: Draw>UserDefinedPrimitive
Syntax: CreateUserDefinedPart <UserDefinedParametersArray>, <AttributesArray>
oEditor.CreateUserDefinedPart [
(
Array("NAME:UserDefinedPrimitiveParameters",
"CoordinateSystemID:=", -1,
"DllName:=", "Examples/RectangularSpiral",
"NoOfParameters:=", 6, "Library:=", "syslib",
Array("NAME:ParamVector",
Array("NAME:Attributes", "Name:=",
"RectangularSpiral1",
"Flags:=", "",
"Color:=", "(132 132 193)",
"Transparency:=", 0,
"PartCoordinateSystem:=", "Global",
"MaterialName:=", "copper",
"SolveInside:=", _
False)
)]
Edit3DComponent
Use:Edit 3D Component
Command:None
Syntax:Edit3DComponent <Component Name>
Return Value:None
Parameters:<Component Name>
Name of the 3D component
<Data>
Data of the 3D component
VB Example:
oEditor.Edit3DComponent "Connector1",
Array("NAME:EditComponentParametersData",
"NewComponentName:=", " Connector2",
"GeometryParameters:=", "",
"MaterialParameters:=", "",
"DesignParameters:=", "",
Array("NAME:Component Meshing", "MeshAssembly:=", false), Array("NAME:Ex-
citations", "Suppressed:=", Array()))
oEditor.Edit3DComponent
([
"Connector1",
Array("NAME:EditComponentParametersData",
Pytho- "NewComponentName:=", " Connector2",
n "GeometryParameters:=", "",
Exam- "MaterialParameters:=", "",
ple "DesignParameters:=", "",
Array("NAME:Component Meshing", "MeshAssembly:=", false),
Array("NAME:Excitations",
"Suppressed:=", Array()))
])
EditPolyline
Modifies a polyline primitive. Specify the name of the polyline to modify and the new set of data for
the polyline.
Command: Draw>Line Segment>Insert Segment Before>Straight
Draw>Line Segment>Insert Segment Before>Spline
Draw>Line Segment>Insert Segment Before>3 Point Arc
Draw>Line Segment>Insert Segment Before>Center Point Arc
Draw>Line Segment>Insert Segment After>Straight
Draw>Line Segment>Insert Segment After>Spline
Draw>Line Segment>Insert Segment After>3 Point Arc
Draw>Line Segment>Insert Segment After>Center Point Arc
Edit>Delete Start Point
Edit>Delete End Point.
Syntax: EditPolyline <SelectionsArray>,
<PolylineParametersArray>,
Return Value: The name of the newly created object
Parameters: <SelectionsArray>
Array("NAME:Selections",
"Selections:=", "string")
Selections
Get3DComponentParameters
Use:Get parameters of 3D components
Command:none
Syntax:Get3DComponentParameters <Component Name>
Return Value:An array of component parameters.
Parameters:<Component Name>
Name of the 3D component
VB Example:
Dim paras
paras = oEditor.Get3DComponentParameters("Connector")
Python oEditor.Get3DComponentParameters("Connector")
Example
Get3DComponentDefinitionNames
Use:Get names of 3D component definitions
Command:None
Syntax:Get3DComponentDefinitionNames
Return Value:An array of component definition names.
Parameters:
VB Example:
Dim defNames
defNames = oEditor.Get3DComponentDefinitionNames()
Python oEditor.Get3DComponentDefinitionNames("")
Example
Get3DComponentInstanceNames
Use:Get instance names of 3D component definitions.
Command:None
Syntax:An array of 3D component instance names.
Return Value:An array of 3D component instance names.
Parameters:<Definition Name>
Name of the 3D component definition
VB Example:
Dim instNames
instNames = oEditor.Get3DComponentInstanceNames("Connector")
Python Get3DComponentInstanceNames(<"Connector">)
Syntax
Python oEditor.Get3DComponentInstanceNames("Connector")
Example
Get3DComponentMaterialNames
Use:Get material names of 3D component.
Command:None.
Syntax:Get3DComponentMaterialNames <Component Instance Name>
Return Value:An array of material names.
Parameters:<Component Instance Name>
Name of the component
VB Example:
Dim materialNames
materialNames = oEditor.Get3DComponentMaterialNames("Connector1")
Python Get3DComponentMaterialNames(<"Connector1">)
Syntax
Python oEditor.Get3DComponentMaterialNames("Connector1")
Example
Get3DComponentMaterialProperties
Use:Get material properties of 3D component material.
Command:None
Syntax:Get3DComponentMaterialProperties <Complete Material Name>
Return Value:An array of material properties.
Parameters:<Complete Material Name>
Name of the material with a complete format
VB Example:
Dim materialProperties
materialProperties = oEditor.Get3DComponentMaterialProperties("Con-
nector1:Material01")
Python Get3DComponentMaterialProperties(<"Connector1:Material01">)
Syntax
Python oEditor.Get3DComponentMaterialProperties("Con-
Exampl- nector1:Material01")
e
Insert3DComponent
Insert a 3D Component
Command: none
Syntax: Insert3DComponent <Data>
Return Value: None
Parameters: <Data>
Data of the 3D component
VB Example:
oEditor.Insert3DComponent Array("NAME:InsertComponentData",
"Parameters:=", "",
"TargetCS:=", "Global",
"ComponentFile:=", "C:\tmp\Connector.a3dcomp")
oEditor.Insert3DComponent [
(
Array("NAME:InsertComponentData",
Python
Example "Parameters:=", "",
"TargetCS:=", "Global",
"ComponentFile:=", "C:\tmp\Connector.a3dcomp")
])
InsertPolylineSegment
Use: Inserts a polyline segment either before or after an existing segment of a polyline primitive.
Command: Draw>Line Segment>Insert Segment Before>Straight
Draw>Line Segment>Insert Segment Before>Spline
Draw>Line Segment>Insert Segment Before>3 Point Arc
Draw>Line Segment>Insert Segment Before>Center Point Arc
Draw>Line Segment>Insert Segment After>Straight
Draw>Line Segment>Insert Segment After>Spline
Draw>Line Segment>Insert Segment After>3 Point Arc
Draw>Line Segment>Insert Segment After>Center Point Arc
Syntax: InsertPolylineSegment <InsertPolylineSegmentArray>
Return Value: None
Parameters: <InsertPolylineSegmentArray>
Array("Name:Insert Polyline Segment",
"Selections:=", <string>,
"Segment Index:=", <value>,
"At Start:=", <bool>,
"SegmentType:=", <string>
<PolylinePointsArray>)
<PolylinePointsArray>
Array("Name:Polyline Points", <OnePointArray>,
<OnePointArray>, ...)
<OnePointArray>
Array("Name:PLPoint",
"X:=", <value>,
"Y:=", <value>,
"Z:=", <value>)
Selections
Name of the polyline to modify. The name should be formatted as
"<PolylineName>:CreatePolyline:1".
Example: "Selections:=", "Polyline1:CreatePolyline:1"
SegmentType
Can be "Line", "Arc", "Spline", or "AngularArc"
SweepAlongPath
Use: Sweeps the specified 1D or 2D parts along a path. The last 1D object specified is the path for
the sweep.
Command: Draw>Sweep>Along Path
Syntax: SweepAlongPath <SelectionsArray>,
<PathSweepParametersArray>
Return Value: None
Parameters: <PathSweepParametersArray>
Array("NAME:PathSweepParameters",
"DraftAngle:=", <value>,
"DraftType:=", <string>,
"TwistAngle:=", <value>)
DraftType
Possible values are "Extended", "Round", "Natural"
VB Example: oEditor.SweepAlongPath _
Array("NAME:Selections", "Selections:=",
"Polygon1,Polyline1"),_
Array("NAME:PathSweepParameters", _
"DraftAngle:=", "0deg",_
"DraftType:=", "Round",_
"TwistAngle:=", "30deg")
SweepAlongPath ([
Python Syn-
tax
<SelectionsArray>, <PathSweepParametersArray>
])
oEditor.SweepAlongPath (
[
Array("NAME:Selections", "Selections:=",
"Polygon1,Polyline1"),_
Python
Array("NAME:PathSweepParameters", _
Example
"DraftAngle:=", "0deg",_
"DraftType:=", "Round",_
"TwistAngle:=", "30deg")
])
SweepAlongVector
Use: Sweeps the specified 1D or 2D parts along a vector.
Command: Draw>Sweep>Along Vector
Syntax: SweepAlongVector <SelectionsArray>,
<VecSweepParametersArray>
Return Value: None
Parameters: <VecSweepParametersArray>
Array("NAME:VectorSweepParameters",
"DraftAngle:=", <value>,
"DraftType:=", <string>,
"SweepVectorX:=", <value>, _
"SweepVectorY:=", <value>,
"SweepVectorZ:=", <value)
DraftType
Possible values are "Extended", "Round", "Natural"
SweepAroundAxis
Use: Sweeps the specified 1D or 2D parts around an axis.
Command: Draw>Sweep>Around Axis
Syntax: SweepAroundAxis <SelectionsArray>,
<AxisSweepParametersArray>
Return Value: None
Parameters: <AxisSweepParametersArray>
Array("NAME:AxisSweepParameters",
"DraftAngle:=", <value>,
"DraftType:=", <string>,
"SweepAxis:=", <string>,
"SweepAngle:=", <value>)
DraftType
Possible values are "Extended", "Round", "Natural"
SweepAxis
Possible values are "X", "Y", "Z"
SweepFacesAlongNormal
Use: Sweep a face along normal.
oEditor.SweepFacesAlongNormal (
[
Python Array("NAME:Selections",
Example "Selections:=", "Rectangle1",
"NewPartsModelFlag:=", "Model"),
Array("NAME:Parameters",
Array("NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=",
SweepFacesAlongNormalWithAttributes
Use: Sweep selected faces along normal to create new object, user can specify the attributes of
the new object
Command: Recorded during PML creation
Syntax: SweepFacesAlongNormalWidthAttributes <SelectionsArray>, <ParametersArray>,
<AttributeArray>
Return Value: None
Parameters: <ParametersArray>
Array("NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=", Array(12),
"LengthOfSweep:=", "0.1mm"))
VB Example:
oEditor.SweepFacesAlongNormalWithAttributes Array("NAME:Selections",
"Selections:=","Box1",
"NewPartsModelFlag:=", "Model"),
Array("NAME:Parameters",
Array("NAME:SweepFaceAlongNormalToParameters", "FacesToDetach:=", Array(7),
"LengthOfSweep:=", "0.424865556413828mm")),
Array("NAME:Attributes", "Name:=", "PML_Box1_1", "Flags:=", "",
"Color:=", "(132 132 193)",
"Transparency:=", 0.899999976158142,
"PartCoordinateSystem:=", "FaceCS1",
"UDMId:=", "",
"MaterialValue:=", "" & Chr(34) & "vacuum" & Chr(34) & "",
"SolveInside:=", true)
tax
oEditor.SweepFacesAlongNormalWithAttributes ([
Array("NAME:Selections","Selections:=","Box1",
"NewPartsModelFlag:=", "Model"),
Array("NAME:Parameters",
Array("NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=", Array(7),
Pytho- "LengthOfSweep:=", "0.424865556413828mm")),
n
Exam-
ple Array("NAME:Attributes", "Name:=", "PML_Box1_1", "Flags:=",
"",
"Color:=", "(132 132 193)",
"Transparency:=", 0.899999976158142,
"PartCoordinateSystem:=", "FaceCS1",
"UDMId:=", "",
"MaterialValue:=", "" & Chr(34) & "vacuum" & Chr(34) &
"",
"SolveInside:=", True)
])
UpdateComponentDefinition
Use:Update component definition
Command:None
Syntax:UpdateComponentDefinition <Data>
Return Value:none
Parameters:<Data> Component data
VB Example:
oEditor.UpdateComponentDefinition
Array("NAME:UpdateDefinitionData",
"DefinitionNames:=", " Connector, Magic_Tee",
"Passwords:=", Array("", ""))
Python oEditor.UpdateComponentDefinition
Example
([
Array("NAME:UpdateDefinitionData",
"DefinitionNames:=", " Connector, Magic_Tee",
"Passwords:=",
Array("", ""))
])
Copy
Use: Copies specified parts
Command: Edit>Copy
Syntax: Copy <SelectionsArray>
Return Value: None
DeletePolylinePoint
Use: Deletes either a start or end point from an existing polyline segment.
Command: Edit>Delete Start Point
Edit>Delete End Point
Syntax: DeletePolylinePoint <DeletePointArray>
Return Value: None
Parameters: <DeletePointArray>
Array("Name:Delete Point",
"Selections:=", <string>,
"Segment Index:=", <value>,
"At Start:=", <bool>)
Selections
Name of the polyline to modify. The name should be formatted as
"<PolylineName>:CreatePolyline:1".
Example: "Selections:=", "Polyline1:CreatePolyline:1"
DuplicateAlongLine
Duplicates specified parts along line.
Command: Click Edit>Duplicate>Along Line
Syntax: DuplicateAlongLine <SelectionsArray>,
<DupLineParametersArray> <DupBoundariesArray>
Return Value: List with names of newly created objects.
Parameters: <DupLineParametersArray>
Array("NAME:DuplicateToAlongLineParameters",
"XComponent:=", <value>,
"YComponent:=", <value>,
"ZComponent:=", <value>,
"NumClones:=", <value>)
NumClones
Specify a number greater than 1.
<DupBoundariesArray>
Array("NAME:Options", "DuplicateBoundaries:=", <bool>)
VB Example:
oEditor.DuplicateAlongLine Array("NAME:Selections", _
"Selections:=", "Box1", _
"NewPartsModelFlag:=", "Model"), _
Array("NAME:DuplicateToAlongLineParameters", _
DuplicateAroundAxis
Duplicates specified parts around an axis.
Command: Edit>Duplicate>Around Axis
Syntax: DuplicateAroundAxis <SelectionsArray>,
<DupAxisParametersArray> <DupBoundariesArray>
Return Value: None
Parameters: <DupAxisParametersArray>
Array("NAME:DuplicateAroundAxisParameters",
"WhichAxis:=", <string>,
"AngleStr:=", <value>,
"NumClones:=",<value>)
WhichAxis
Axis to duplicate around. Possible values are: "X", "Y", "Z"
Example: "WhichAxis:=", "Z"
NumClones:
Specify a number greater than 1.
<DupBoundariesArray>
Array("NAME:Options", "DuplicateBoundaries:=", <bool>)
VB Example:
oEditor.DuplicateAroundAxis Array("NAME:Selections", _
"Selections:=", "Box1", _
"NewPartsModelFlag:=", "Model"), _
Array("NAME:DuplicateAroundAxisParameters", _
"CreateNewObjects:=", false, _
"WhichAxis:=", "Z", _
(For Maxwell 2D XY Designs, "Whichaxis:=" should be set to "Z".)
(For Maxwell 2D RZ Designs, "Whichaxis:=" should be set to "Y".)
"AngleStr:=", "90deg", _
"NumClones:=", "2"), _
Array("NAME:Options", "DuplicateBoundaries:=", false)
Python oEditor.DuplicateAroundAxis
Example ([
Array("NAME:Selections",_
"Selections:=", "Box1", _
"NewPartsModelFlag:=", "Model"), _
Array("NAME:DuplicateAroundAxisParameters", _
"CreateNewObjects:=", false, _
"WhichAxis:=", "Z", _
"AngleStr:=", "90deg", _
"NumClones:=", "2"), _
DuplicateMirror
Duplicate specified parts according to a mirror plane.
Command: Edit>Duplicate>Mirror
Syntax: DuplicateMirror <SelectionsArray>,
<DupMirrorParametersArray>
Return Value: None
Parameters: <DupMirrorParametersArray>
Array("NAME:DuplicateToMirrorParameters",
"DuplicateMirrorBaseX:=", <value>,
"DuplicateMirrorBaseY:=", <value>,
"DuplicateMirrorBaseZ:=", <value>,
"DuplicateMirrorNormalX:=", <value>,
"DuplicateMirrorNormalY:=", <value>,
"DuplicateMirrorNormalZ:=", <value>)
(For Maxwell 2D XY Designs, Z parameters should be set to "0".)
(For Maxwell 2D RZ Designs, Y parameters should be set to "0".)
<DupBoundariesArray>
Array("NAME:Options", "DuplicateBoundaries:=", <bool>)
VB Example:
oEditor.DuplicateMirror Array("NAME:Selections", _
"Selections:=", "Box1", _
"NewPartsModelFlag:=", "Model"), _
Array("NAME:DuplicateToMirrorParameters", _
"DuplicateMirrorBaseX:=", "0mm", _
"DuplicateMirrorBaseY:=", "0mm", _
"DuplicateMirrorBaseZ:=", "0mm", _
"DuplicateMirrorNormalX:=", "0mm", _
"DuplicateMirrorNormalY:=", "-1mm", _
"DuplicateMirrorNormalZ:=", "0mm"), _
Array("NAME:Options", "DuplicateBoundaries:=", false)
])
Mirror
Use: Mirrors specified parts.
Command: Edit>Arrange>Mirror
Syntax: Mirror <SelectionsArray>, <MirrorParametersArray>
Return Value: None
Parameters: <MirrorParametersArray>
Array("NAME:MirrorParameters",
"MirrorBaseX:=", <value>,
"MirrorBaseY:=", <value>,
"MirrorBaseZ:=", <value>,
"MirrorNormalX:=", <value>,
"MirrorNormalY:=", <value>,
"MirrorNormalZ:=", <value>)
VB Example:
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.Mirror Array("NAME:Selections", "Selections:=", "Box1", _
"NewPartsModelFlag:=", "Model"), _
Array("NAME:MirrorParameters", _
"MirrorBaseX:=", "-0.8mm", _
"MirrorBaseY:=", "-1mm", _
"MirrorBaseZ:=", "0mm", _
"MirrorNormalX:=", "0.948683298050514mm", _
"MirrorNormalY:=", "-0.316227766016838mm", _
"MirrorNormalZ:=", "0mm")
Python oEditor.Mirror
Example ([
Array("NAME:Selections", "Selections:=","Box1", _
"NewPartsModelFlag:=", "Model"), _
Array("NAME:MirrorParameters", _
"MirrorBaseX:=", "-0.8mm", _
"MirrorBaseY:=", "-1mm", _
"MirrorBaseZ:=", "0mm", _
"MirrorNormalX:=", "0.948683298050514mm", _
"MirrorNormalY:=", "-0.316227766016838mm", _
"MirrorNormalZ:=", "0mm")
])
Move
Use: Moves specified parts.
Command: Click Edit>Arrange>Move
Syntax: Move <SelectionsArray>, <MoveParametersArray>
Return Value: None
Parameters: <MoveParametersArray>
Array("NAME:TranslateParameters",
"TranslateVectorX:=", <value>,
"TranslateVectorY:=", <value>,
"TranslateVectorZ:=", <value>)
(For Maxwell 2D XY Designs, "TranslateVectorZ:=" should be set to "0".)
(For Maxwell 2D RZ Designs, "TranslateVectorY:=" should be set to "0".)
OffsetFaces
Use: Offsets faces of specified parts.
Command: Edit>Arrange>Offset
Syntax: OffsetFaces <SelectionsArray>, <OffsetParametersArray>
Return Value: None
Parameters: <OffsetParametersArray>
Array("NAME:OffsetParameters",
"OffsetDistance:=", <value>)
Rotate
Use: Rotates specified parts.
Command: Edit>Arrange>Rotate
Syntax: Rotate <SelectionsArray>, <RotateParametersArray>
Return Value: None
Parameters: <RotateParametersArray>
Array("NAME:RotateParameters",
"RotateAxis:=", <string>
"RotateAngle:=", <value>)
RotateAxis
Possible values are: "X", "Y", "Z"
(For Maxwell 2D XY Designs, "RotateAxis:=" should be set to "Z".)
(For Maxwell 2D RZ Designs, "Whichaxis:=" should be set to "Y".)
Python Rotate()
Syntax
Scale
Use: Scales specified parts.
Command: Edit>Scale
Syntax: Scale <SelectionsArray>, <ScaleParametersArray>
Return Value: None
Parameters: <ScaleParametersArray>
Array("NAME:ScaleParameters",
"ScaleX:=", <value>,
"ScaleY:=", <value>,
"ScaleZ:=", <value>)
(For Maxwell 2D XY Designs, "ScaleZ:=" should be set to "0".)
(For Maxwell 2D RZ Designs, "ScaleY:=" should be set to "0".)
EditEntityList
EditFaceCS
EditObjectCS
EditRelativeCS
Export
Fillet
FlattenGroup
Generate History
GetActiveCoordinateSystem
GetCoordinateSystems
Import
ImportDXF
ImportGDSII [Modeler]
Intersect
MoveCStoEnd
MoveEntityToGroup
MoveFaces
ProjectSheet
PurgeHistory
ReplaceWith3DComponent
Section
SeparateBody
SetModelUnits
SetWCS
ShowWindow
Split
Subtract
SweepFacesAlongNormal
ThickenSheet
UncoverFaces
Unite
Ungroup
Wrap Sheet
AssignMaterial
Use: Assigns a material to the specified objects. Only the MaterialName and SolveInside para-
meters of <AttributesArray> are supported.
Command: Modeler>Assign Material
Syntax: AssignMaterial <SelectionsArray>, <AttributesArray>
Return Value: None
VB Example:
oEditor.AssignMaterial _
Array("NAME:Selections", "Selections:=", "Polygon1"),
Array("NAME:Attributes", _
"MaterialName:=", "tungsten",_
"SolveInside:=", false)
oEditor.AssignMaterial
([
Array("NAME:Selections", "Selections:=", "Polygon1"),
Python
Example Array("NAME:Attributes", _
"MaterialName:=", "tungsten",_
"SolveInside:=", false)
])
Chamfer
Use: Creates a chamfer.
Command: Modeler>Chamfer
VB Example:
oEditor.Chamfer Array("Name:Selections", _
"Selections:=", "Box1"), Array("NAME:Parameters", _ Array("NAME:Cham-
ferParameters", _
"CoordinateSystemID:=", -1, _
"Edges:=", Array(13), "LeftRange:=", "1mm"))
oEditor.Chamfer
([
Pyt-
hon
Array("Name:Selections", "Selections:=", "Box1"),
Exa- Array("NAME:Parameters",
mpl-
e Array("NAME:ChamferParameters", "CoordinateSystemID:=", -1,
"Edges:=", Array(13), "LeftRange:=", "1mm"))
])
Connect
Use: Connects specified 1D parts to form a sheet.
Command: Modeler>Surface>Connect
Syntax: Connect <SelectionsArray>
Return Value: None
CoverLines
Use: Covers the specified 1D objects to form a sheet.
Command: Modeler>Surface>Cover Lines
Syntax: CoverLines <SelectionsArray>
Return Value: None
CoverSurfaces
Use: Covers the specified objects to form a solid object.
Command: Modeler>Surface>Cover Faces
Syntax: CoverSurfaces <SelectionsArray>
Return Value: None
CreateEntityList
Use: Creates a list of entities. The list can contain objects or faces, but not both. Only the Name
attribute from <AttributesArray> is supported.
Command: Modeler>List>Create>Object List
Modeler>List>Create>Face List
Syntax: CreateEntityList <EntityListParametersArray>,
<AttributesArray>
Return Value: None
Parameters: <EntityListParametersArray>
Array("NAME:GeometryEntityListParameters",
"EntityType:=", <string>,
"EntityList:=", <array>
EntityType
Possible values are "Object", "Face"
EntityList
Array of integers – the IDs of the objects or faces to put in the list. To get the IDs, use
GetObjectIDByName
CreateFaceCS
Use: Creates a face coordinate system. Only the Name attribute of the <AttributesArray> para-
meter is supported.
Command: Modeler>Coordinate System>Create>Face CS
Syntax: CreateFaceCS <FaceCSParametersArray>, <AttributesArray>
Return Value: None
Parameters: <FaceCSParametersArray>
Array("NAME:FaceCSParameters",
"FaceID:=", <int>,
"PartID:=", <int>,
Array("NAME:OriginPosn",
"IsAttachedToEntity:=", <bool>,
"EntityID:=", <value>,
"PositionType:=", <string>,
"UParam:=", <value>,
"VParam:=", <value>,
"XPosition:=", <value>,
"YPosition:=", <value>,
"ZPosition:=", <value>)
Array("NAME:AxisPosn",
"IsAttachedToEntity:=", <bool>
"EntityID:=", <value>
"PositionType:=", <string>,
"UParam:=", <value>,
"VParam:=", <value>,
"XPosition:=", <value>,
"YPosition:=", <value>,
"ZPosition:=", <value>)
"WhichAxis:=", <string>)
FaceID
ID of the face on which to create the coordinate system.
PartID
ID of the object on which the face ID lies.
IsAttachedToEntity
Specifies whether the point is anchored (to a vertex, edge, or face).
If IsAttachedToEntity is true, provide the UParam and VParam
parameters. Otherwise, provide the XPosition, YPosition, and
ZPosition parameters.
EntityID
ID of the vertex, edge, or face to which the point is anchored.
PositionType
Place where the point is anchored.
Possible values are: "FaceCenter", "EdgeCenter", "OnVertex", "OnEdge", "OnFace"
UParam, VParam
Numbers between 0 and 1 representing the relative position of the point on the edge or
face.
Example: UParam = .5, VParam = .5 would be the center of a face.
XPosition, YPosition, ZPosition
Fixed position of the point.
WhichAxis
Possible values are "X", "Y", "Z"
CreateGroup
Use: Creates a group from specified objects in the history tree.
Command: Modeler>Group>Create
Syntax: CreateGroup Array(["NAME:GroupParameter", "ParentGroupID:=",
"Model", "Parts:=", "[objID],[objID], [objID]...", "Sub-
modelInstances:=", "", "Groups:=", "")
Return Value: None
Parameters: "Parts:=", "[objID],[objID], [objID]...",
The object ID for the models to become part of the history tree group.
SubmodelInstances:=,"[submodelID]"
The object ID for any submodel instances.
Groups:=, " "
The name of a subgroup to be included in the history tree group
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project44")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateGroup Array("NAME:GroupParameter", "ParentGroupID:=",
"Model", _
"Parts:=", "Box1,Box2,Box3", "SubmodelInstances:=", "", "Groups:=",
"")
oEditor.CreateGroup
Pytho- ([
n
Examp- Array("NAME:GroupParameter", "ParentGroupID:=", "Model", _
le
"Parts:=", "Box1,Box2,Box3", "SubmodelInstances:=", "",
"Groups:=", "")
])
CreateObjectCS
Creates an Object coordinate system.
Command: Modeler>Coordinate System>Create>Object><Offset | Rotated | Both>
Syntax: CreateObjectCS <ParameterArrays>
Return Value: None
Parameters: Array("NAME:ObjectCSParameters",
"PartID:=", <ID>,
"ReverseXAxis:=", <Boolean>,
"ReverseYAxis:=", <Boolean>,
Array("NAME:Origin",
"IsAttachedToEntity:=", <Boolean>,
"EntityID:=", <ID>,
"PositionType:=", "<OnPositionID>,
String, one of OnVertex, FaceCenter, OnEdge, AbsolutePosition
"UParam:=", <integer>,
"VParam:=", <Integer>,
"XPosition:=", "<Integer>",
"YPosition:=", "<Integer>",
"ZPosition:=", "<Integer>"),
Array("NAME:xAxis",
"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", <Int>,
"FaceID:=", <Int>,
"xDirection:=", "<int>",
"yDirection:=", "<Int>",
"zDirection:=", "<Int>",
"UParam:=", <int>,
"VParam:=", <Int>),
Array("NAME:yAxis",
"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", <Int>,
"FaceID:=", <int>,
"xDirection:=", "<int>",
"yDirection:=", "<int>",
"zDirection:=", "<int>",
"UParam:=", <int>,
"VParam:=", <int>)),
Array("NAME:Attributes",
"Name:=", "<ObjectCSName>")
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("coax_bend")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateObjectCS Array("NAME:ObjectCSParameters",
"PartID:=", 24,
"ReverseXAxis:=", false,
"ReverseYAxis:=", false,
Array("NAME:Origin",
"IsAttachedToEntity:=",
true, "EntityID:=", 30,
"PositionType:=", "OnVertex",
"UParam:=", 0,
"VParam:=", 0,
"XPosition:=", "0",
"YPosition:=", "0",
"ZPosition:=", "0"),
Array("NAME:xAxis",
"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", -1,
"FaceID:=", -1,
"xDirection:=", "1",
"yDirection:=", "0",
"zDirection:=", "0",
"UParam:=", 0,
"VParam:=", 0),
Array("NAME:yAxis",
"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", -1,
"FaceID:=", -1,
"xDirection:=", "0",
"yDirection:=", "1",
"zDirection:=", "0",
"UParam:=", 0, "VParam:=", 0)),
Array("NAME:Attributes",
"Name:=", "ObjectCS1")
oEditor.CreateObjectCS
([
Array("NAME:ObjectCSParameters",
"PartID:=", 24,
"ReverseXAxis:=", false,
"ReverseYAxis:=", false,
Array("NAME:Origin",
"IsAttachedToEntity:=",
Python true, "EntityID:=", 30,
Example "PositionType:=", "OnVertex",
"UParam:=", 0,
"VParam:=", 0,
"XPosition:=", "0",
"YPosition:=", "0",
"ZPosition:=", "0"),
Array("NAME:xAxis",
"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", -1,
"FaceID:=", -1,
"xDirection:=", "1",
"yDirection:=", "0",
"zDirection:=", "0",
"UParam:=", 0,
"VParam:=", 0),
Array("NAME:yAxis",
"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", -1,
"FaceID:=", -1,
"xDirection:=", "0",
"yDirection:=", "1",
"zDirection:=", "0",
"UParam:=", 0, "VParam:=", 0)),
Array("NAME:Attributes",
"Name:=", "ObjectCS1")
])
CreateObjectFromEdges
Use: Creates a polyline from the specified object edge.
Command: Modeler>Create Object From Edge
Syntax: CreateObjectFromEdges <SelectionsArray>,
<ObjFromEdgeParametersArray>
Return Value: None
Parameters: <SelectionsArray>
Array("NAME:Selections",
"Selections:=" <ObjName>)
<ObjFromEdgeParametersArray>
Array("NAME:Parameters",
<EdgeParametersArray>)
<EdgeParametersArray>
Array("Name:BodyFromEdgeToParameters",
"CoordinateSystemID:=", <int>,
"Edges:=", <EdgeIDarray>)
VB Example:
oEditor.CreateEdgeFromEdges _
Array("NAME:Selections", "Selections:=", "Box1"),_
Array("NAME:Parameters", _
Array("NAME:BodyFromEdgeToParameters", _
"CoordinateSystemID:=", -1, _
"Edges:=", Array(13)))
CreateObjectFromEdges ([
Python <SelectionsArray>,
Syntax
<ObjFromEdgeParametersArray>
])
oEditor.CreateEdgeFromEdges ([
Array("NAME:Selections", "Selections:=", "Box1"),_
Array("NAME:Parameters", _
Python
Array("NAME:BodyFromEdgeToParameters", _
Example
"CoordinateSystemID:=", -1, _
"Edges:=", Array(13)))
])
CreateObjectFromFaces
Use: Creates 2D objects from the specified faces.
Command: Modeler>Surface>Create Object From Face
Syntax: CreateObjectFromFaces <SelectionsArray>,
<ObjFromFaceParametersArray>
Return Value: None
Parameters: <ObjFromFaceParametersArray>
Array("NAME:Parameters",
<FacesOfOneObjToDetach>, <FacesOfOneObjToDetach>,
...)
<FacesOfOneObjToDetach>
Array("Name:BodyFromFaceToParameters",
"FacesToDetach:=", <array>)
FacesToDetach
Array of integers – the IDs of the faces to use to create objects.
VB Example:
oEditor.CreateObjectFromFaces _
Array("NAME:Selections", "Selections:=", "Box1"),_
Array("NAME:Parameters", _
Array("NAME:BodyFromFaceToParameters", _
"FacesToDetach:=", Array(185)))
CreateObjectFromFaces ([
Python <SelectionsArray>,
Syntax
<ObjFromFaceParametersArray>
])
oEditor.CreateObjectFromFaces ([
Array("NAME:Selections", "Selections:=", "Box1"),_
Python Array("NAME:Parameters", _
Example Array("NAME:BodyFromFaceToParameters", _
"FacesToDetach:=", Array(185)))
])
CreateRelativeCS
Use: Creates a relative coordinate system. Only the Name attribute of the <AttributesArray> para-
meter is supported.
Command: Modeler>Coordinate System>Create>Relative CS->Offset
Modeler>Coordinate System>Create>Relative CS->Rotated
Modeler>Coordinate System>Create>Relative CS->Both
Syntax: CreateRelativeCS <RelativeCSParametersArray>,
<AttributesArray>
Return Value: None
Parameters: <RelativeCSParametersArray>
Array("NAME:RelativeCSParameters",
"OriginX:=", <value>,
"OriginY:=", <value>,
"OriginZ:=", <value>,
"XAxisXvec:=", <value>,
"XAxisYvec:=", <value>,
"XAxisZvec:=", <value>,
"YAxisXvec:=", <value>,
"YAxisYvec:=", <value>,
"YAxisZvec:=", <value>)
DeleteEmptyGroups
Use: Removes a specified history tree group.
Command: Modeler>Group>Delete Empty
Syntax: DeleteEmptyGroups Array("Groups:=", Array("<GroupID>"))
Return Value: None
Parameters: <GroupID>,
The ID for the history tree groups to delete.
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
oEditor.DeleteEmptyGroups
Python ([
Example Array("Groups:=", Array("Group1")
)])
DeleteLastOperation
Use: Deletes the last operation for specified objects.
Command: Modeler>Delete Last Operation
Syntax: DeleteLastOperation <SelectionsArray>
Return Value: None
DetachFaces
Detaches the specified faces.
Command: Modeler>Surface>Detach Faces
Syntax: DetachFaces <SelectionsArray>,
<DetachFacesParametersArray>
Return Value: None
Parameters: <DetachFacesParametersArray>
Array("NAME:Parameters",
<FacesOfOneObjToDetach>,
<FacesOfOneObjToDetach>, ...)
<FacesOfOneObjToDetach>
Array("Name:DetachFacesToParameters",
"FacesToDetach:=", <array>)
FacesToDetach
An array of integers – the face IDs of the faces to detach.
VB Example:
oEditor.DetachFaces _
Array("NAME:Selections", "Selections:=",_
"Box5,Box4"),_
Array("NAME:Parameters", _
Array("NAME:DetachFacesToParameters", _
"FacesToDetach:=", Array(123, 122)),
Array("NAME:DetachFacesToParameters", _
"FacesToDetach:=", Array(94)))
DetachFaces ([
Python Syn- <SelectionsArray>,
tax
<DetachFacesParametersArray>
])
oEditor.DetachFaces
([
Array("NAME:Selections", "Selections:=",_
"Box5,Box4"),_
Python Array("NAME:Parameters", _
Example Array("NAME:DetachFacesToParameters", _
"FacesToDetach:=", Array(123, 122)),
Array("NAME:DetachFacesToParameters", _
"FacesToDetach:=", Array(94)))
])
EditEntityList
Modifies an entity list.
Command: Modeler>List>Reassign
EditFaceCS
Recreates an existing face coordinate system. The name of the coordinate system to modify
should be specified in the <AttributesArray> parameter.
Command: Modeler->Coordinate System->Edit
Syntax: EditFaceCS <FaceCSParametersArray>, <AttributesArray>
Return Value: None
EditObjectCS
Use: Edit an existing Object CS.
Command: Click Modeler>Coordinate System>Edit
Syntax: EditObjectCS <Array>
Return Value: None
Parameters: Array("NAME:ObjectCSParameters",
"PartID:=", <ID>,
"ReverseXAxis:=", <Boolean>,
"ReverseYAxis:=", <Boolean>,
Array("NAME:Origin",
"IsAttachedToEntity:=", <Boolean>,
"EntityID:=", <ID>,
"PositionType:=", "<OnPositionID>,
String, one of: OnVertex, FaceCenter, OnEdge, AbsolutePosition
"UParam:=", <integer>,
"VParam:=", <Integer>,
"XPosition:=", "<Integer>",
"YPosition:=", "<Integer>",
"ZPosition:=", "<Integer>"),
Array("NAME:xAxis",
"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", <Int>,
"FaceID:=", <Int>,
"xDirection:=", "<int>",
"yDirection:=", "<Int>",
"zDirection:=", "<Int>",
"UParam:=", <int>,
"VParam:=", <Int>),
Array("NAME:yAxis",
"DirectionType:=", "AbsoluteDirection",
"EdgeID:=", <Int>,
"FaceID:=", <int>,
"xDirection:=", "<int>",
"yDirection:=", "<int>",
"zDirection:=", "<int>",
"UParam:=", <int>,
"VParam:=", <int>)),
Array("NAME:Attributes",
"Name:=", "<ObjectCSName>")
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project53")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
oEditor.EditObjectCS
Python
([
Example Array("NAME:ObjectCSParameters",
"PartID:=", 6,
"ReverseXAxis:=", false,
"ReverseYAxis:=", false,
Array("NAME:Origin", "IsAttachedToEntity:=", false,
"EntityID:=", -1,
"PositionType:=", "AbsolutePosition",
"UParam:=", 0, "VParam:=", 0,
"XPosition:=", "0mm", "YPosition:=", "0mm",
"ZPosition:=", "0mm"),
Array("NAME:xAxisPos", "IsAttachedToEntity:=", true,
"EntityID:=", 13,
"PositionType:=", "OnEdge",
"UParam:=", 0.75, "VParam:=", 0,
"XPosition:=", "0", "YPosition:=", "0", "ZPosition:=",
"0"), Array("NAME:yAxisPos", "IsAttachedToEntity:=", true,
"EntityID:=", 7,
"PositionType:=", "FaceCenter",
"UParam:=", 0, "VParam:=", 0,
"XPosition:=", "0", "YPosition:=", "0", "ZPosition:=",
"0")), Array("NAME:Attributes", "Name:=", "ObjectCS1")
])
EditRelativeCS
Modifies a relative coordinate system. Use <AttributesArray> to indicate the name of the coordin-
ate system to modify.
Command: Modeler>Coordinate System>Edit
Syntax: EditRelativeCS <RelativeCSParametersArray>,
<AttributesArray>
Return Value: None
Parameters: <ParametersArray>
Array("NAME:RelativeCSParameters",
"OriginX:=", <value>,
"OriginY:=", <value>,
"OriginZ:=", <value>,
"XAxisXvec:=", <value>,
"XAxisYvec:=", <value>,
"XAxisZvec:=", <value>,
"YAxisXvec:=", <value>,
"YAxisYvec:=", <value>,
"YAxisZvec:=", <value>)
Export
Exports the model to a file.
Command: Modeler>Export
Syntax: Export <ExportParametersArray>
Return Value: None
Parameters: <ExportParametersArray>
Array("NAME:ExportParameters",
"File Name:=", <string>,
"Major Version:=", <int>,
"Minor Version:=", <int>)
Major Version
Can be –1 or any ACIS major version supported by HFSS software.
Minor Version
Can be –1 or any ACIS minor version supported by HFSS software.
ExportModelImageToFile
Use: Export an image of the model to a file. For high resolution images, you can set environment
variables to specify pixel width and height.
Command: Modeler>Export...
Syntax: ExportModelImageToFile "<path>/<imageName>.<formatsuffix>" 0,0, Array
(<SaveImageParams>)
Return Value: None
Parameters: <path>
<imagename>
Extension Contents
.bmp Bitmap files.
.gif Graphics Interchange Format files.
.jpeg Joint Photographics Experts Group files.
.tiff Tagged Image File Format files.
.wrl Virtual Reality Modeling Language (VRML) files.
<width>,<height>,
For the default, use 0, 0. For higher resolution, set desired <width> and <height>, for
example for 8k export as: 7680, 4320.
Array("NAME:SaveImageParams",
"ShowAxis:=","<Boolean>",
"ShowGrid:=", "<Boolean>",
"ShowRuler:=", "<Boolean>"
"ShowRegions:=" "<Default>",
"Selections:=" ,"")
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 15.0.0
' 2:28:32 PM Jul 30, 2012
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("dra_diel")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
oEditor.ExportModelImageToFile
("C:/Users/MyName/Documents/highresexample_image.jpg",
7680, 4320,
[
Python
"NAME:SaveImageParams",
Example
"ShowAxis:=" , "True",
using High
"ShowGrid:=" , "True",
Resolution
"ShowRuler:=" , "True",
settings.
"ShowRegion:=" ,
"Default",
"Selections:=" , ""
])
Fillet
Creates a fillet.
Command: Modeler>Fillet
Syntax: Fillet(<ObjectName> <FilletParameters>)
Return Value: None
Parameters: <ObjectName>
Array("NAME:Selections", _
"Selections:=", <string>),
<FilletParameters>
Array("NAME:Parameters", _
Array("NAME:FilletParameters", _
"CoordinateSystemID:=", <value>,
"Edges:=", <ArrayOfEdgeIDs>,
"Radius:=", <value>,
"Setback:=", <value>))
VB Example:
oEditor.Fillet Array("Name:Selections", "Selections:=", _
"Box1"), Array("NAME:Parameters", Array("NAME:FilletParameters", _
"CoordinateSystemID:=", -1, "Edges:=", Array(13), "Radius:=", _
"1mm", "Setback:=", "0mm"))
oEditor.Fillet
([
Array("Name:Selections", "Selections:=",
_
Python "Box1"), Array("NAME:Parameters", Array("NAME:Fil-
Exampl- letParameters",
e _
"CoordinateSystemID:=", -1, "Edges:=", Array(13),
"Radius:=", _
"1mm", "Setback:=", "0mm"))
])
FlattenGroup
Use: Flattens a specified history tree group.
Command: Modeler>Group>Flatten
Syntax: FlattenGroup Array("Groups:=", Array("<GroupID>"))
Return Value: None
Parameters: <GroupID>,
The ID for the history tree groups to flatten.
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project44")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.Ungroup Array("Groups:=", Array("Group1"))
GenerateHistory
Generates the history for specified 1D objects.
Command: Modeler>Generate History
Syntax: GenerateHistory <SelectionsArray>
Return Value: None
HealObject
Use:To heal an imported object.
Command: Click Modeler>Model Healing>Heal
Syntax:HealObject <parameters>
Return Value:None
Parameters:Array("NAME:Selections",
"Selections:=", "<objectID>",
"NewPartsModelFlag:=", ["Model" | "NonModel"]),
Array("NAME:ObjectHealingParameters",
"Version:=", 1,
"AutoHeal:=", <boolean>,
"TolerantStitch:=", <boolean>,
"SimplifyGeom:=", <boolean>,
"TightenGaps:=", <boolean>,
"StopAfterFirstStitchError:=", <boolean>,
"MaxStitchTol:=", <smallvalue>,
"ExplodeAndStitch:=", <boolean>,
"GeomSimplificationTol:=", <value>,
"MaximumGeneratedRadiusForSimplification:=", <value>,
"SimplifyType:=", 2,
"TightenGapsWidth:=", <value>,
"RemoveSliverFaces:=", <boolean>,
"RemoveSmallEdges:=", <boolean>,
"RemoveSmallFaces:=", <boolean>,
"SliverFaceTol:=", <value>,
"SmallEdgeTol:=", <value>,
"SmallFaceAreaTol:=", <value>,
"BoundingBoxScaleFactor:=", <value>,
"RemoveHoles:=", <boolean>,
"RemoveChamfers:=", <boolean>,
"RemoveBlends:=", <boolean>,
"HoleRadiusTol:=", <value>,
"ChamferWidthTol:=", <value>,
"BlendRadiusTol:=", <value>,
"AllowableSurfaceAreaChange:=", <value>,
"AllowableVolumeChange:=", <value>)
VB Example:
oEditor.HealObject Array("NAME:Selections",
"Selections:=", "Box1",
"NewPartsModelFlag:=", "Model"),
Array("NAME:ObjectHealingParameters",
"Version:=", 1,
"AutoHeal:=", false,
"TolerantStitch:=", true,
"SimplifyGeom:=", true,
"TightenGaps:=", true,
"StopAfterFirstStitchError:=", false,
"MaxStitchTol:=", 0.001,
"ExplodeAndStitch:=", true,
"GeomSimplificationTol:=", -1,
"MaximumGeneratedRadiusForSimplification:=", -1,
"SimplifyType:=", 2,
"TightenGapsWidth:=", 1E-006,
"RemoveSliverFaces:=", true,
"RemoveSmallEdges:=", true,
"RemoveSmallFaces:=", true,
"SliverFaceTol:=", 0,
"SmallEdgeTol:=", 0.1,
"SmallFaceAreaTol:=", 0.1,
"BoundingBoxScaleFactor:=", 1250,
"RemoveHoles:=", true,
"RemoveChamfers:=", true,
"RemoveBlends:=", true,
"HoleRadiusTol:=", 0.1,
"ChamferWidthTol:=", 0.1,
"BlendRadiusTol:=", 0.1,
"AllowableSurfaceAreaChange:=", 5,
"AllowableVolumeChange:=", 5)
oEditor.HealObject
([
Array("NAME:Selections",
"Selections:=", "Box1",
"NewPartsModelFlag:=", "Model"),
Array("NAME:ObjectHealingParameters",
"Version:=", 1,
"AutoHeal:=", false,
"TolerantStitch:=", true,
"SimplifyGeom:=", true,
Python
"TightenGaps:=", true,
Example
"StopAfterFirstStitchError:=", false,
"MaxStitchTol:=", 0.001,
"ExplodeAndStitch:=", true,
"GeomSimplificationTol:=", -1,
"MaximumGeneratedRadiusForSimplification:=", -1,
"SimplifyType:=", 2,
"TightenGapsWidth:=", 1E-006,
"RemoveSliverFaces:=", true,
"RemoveSmallEdges:=", true,
"RemoveSmallFaces:=", true,
"SliverFaceTol:=", 0,
"SmallEdgeTol:=", 0.1,
"SmallFaceAreaTol:=", 0.1,
"BoundingBoxScaleFactor:=", 1250,
"RemoveHoles:=", true,
"RemoveChamfers:=", true,
"RemoveBlends:=", true,
"HoleRadiusTol:=", 0.1,
"ChamferWidthTol:=", 0.1,
"BlendRadiusTol:=", 0.1,
"AllowableSurfaceAreaChange:=", 5,
"AllowableVolumeChange:=", 5)
])
GetActiveCoordinateSystem
Get active coordinate system.
Command: None.
Syntax: GetActiveCoordinateSystem
Return Value: Active coordinate name.
Parameters: None.
VB Example:
Dim csName
csName = oEditor.GetActiveCoordinateSystem
Python oEditor.GetActiveCoordinateSystem([])
Example
GetCoordinateSystems
Get coordinate system names.
Command: None
Syntax: GetCoordinateSystems
Return Value: An array of coordinate system names
Parameters: None
VB Example:
Dim csNames
csNames = oEditor.GetCoordinateSystems ()
Import
Imports a 3D model file.
Command: Modeler>Import
Syntax: Import <ImportParametersArray>
Return Value: None
Parameters: <ImportParametersArray>
Array("NAME:NativeBodyParameters",
"CoordinateSystemID:=", <ID>,
"HealOption:=", <integer>,
"HealSTL":=, <integer>,
"CheckModel:=", <boolean>,
"Options:=", "",
"FileType:=", "UnRecognized",
"MaxStitchTol:=", <value>,
"SourceFile:=", "string")
Array("NAME:NativeBodyParameters",
"AutoHeal:=", <bool>,
"Options:=", <string>,
VB Example: oDesign.Import("SourceFile:=", <string>)
"SourceFile:=", _
"D:\ANSYS Electronics Desktop Projects\TeeModelforSpaceClaim.stl")
ImportDXF
Imports an AutoCAD model file and a tech file. The tech file is an ASCII file that lists the units, the
layer name followed by tab delimited color, elevations and thickness.
Command: Modeler>Import
)))
oEditor.Import Array("NAME:NativeBodyParameters",
"CoordinateSystemID:=", -1,
"HealOption:=", <integer>,
"CheckModel:=", <boolean>,
"Options:=", "",
"FileType:=", "UnRecognized",
"MaxStitchTol:=", <real>,
"SourceFile:=", "<path>" & ".sm3")
VB Example:
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.ImportDXF Array("NAME:options", "FileName:=", _
"C:/mymodel.dxf", ...
Array("NAME:TechFileLayers", ...
"layer:=", Array("name:=", "BOTTOMLAYER",
"color:=", "purple",
"elev:=", 0,
"thick:=", 200),
)))
oEditor.Import Array("NAME:NativeBodyParameters",
"CoordinateSystemID:=", -1,
"HealOption:=", 0,
"CheckModel:=", true,
"Options:=", "",
"FileType:=", "UnRecognized",
"MaxStitchTol:=", 0.001,
"SourceFile:=", "C:design." & ".sm3")
oEditor.ImportDXF ([
Array("NAME:options", "FileName:=",
_
"C:/mymodel.dxf", ...
Array("NAME:TechFileLayers", ...
Python "layer:=", Array("name:=", "BOTTOMLAYER",
Example
"color:=", "purple",
"elev:=", 0,
"thick:=", 200),
)))
])
"IsLayerNew:=", <booleanInteger>,
"DestLayer:=", "<string>",
"layer_type:=", "<string>",
"IsPresentInLayout:=", <boolean>),
"OrderMap:=", Array("entry:=",
Array("order:=", <integer>,
"layer:=", "<string>"),
"entry:=", Array("order:=",
<integer>, "layer:=", "Signal25"),
"entry:=", Array("order:=", <integer+1>,
"layer:=", "Signal30"),
...),
Array("NAME:Structs",
Array("NAME:GDSIIStruct", "ImportStruct:=", <boolean>,
"CreateNewCell:=", <boolean>,
"StructName:=", "string>",
Array("NAME:Elements")),
Array("NAME:GDSIIStruct", "ImportStruct:=",<boolean>,
"CreateNewCell:=", <boolean>,
"StructName:=", "<string>",
Array("NAME:Elements"))))
oEditor.Import Array("NAME:NativeBodyParameters",
"CoordinateSystemID:=", <ID>,
"HealOption:=", <integer>,
"CheckModel:=", <boolean>,
"Options:=", "",
"FileType:=", "UnRecognized",
"MaxStitchTol:=", <value>,
"SourceFile:=", "string")
VB Example:
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.ImportGDSII Array("NAME:options", ...
Intersect
Use: Intersects specified objects.
Command: Modeler>Boolean>Instersect
Syntax: Intersect <SelectionsArray>, <IntersectParametersArray>
Return Value: None
Parameters: <IntersectParametersArray>
Array("NAME:IntersectParameters",
"KeepOriginals:=", <bool>)
MoveCStoEnd
Moves the named ObjectCS to the end of the History tree.
Command: Modeler>Coordinate System>Move CS to End
Syntax: MoveCSToEnd Array("NAME:Selections",
"Selections:=", "<ObjectCSName>")
Return Value: None
Parameters: <ObjectCSName>
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
MoveEntityToGroup
Use: Moves a specified entity to an existing history tree group.
Command: None.
Syntax: MoveEntityToGroup Array("Groups:=", Array("<entityID>")),
Array("ParentGroup:=", "<target_GroupID>")
Return Value: None
Parameters: <entityID>,
The ID for the models or groups to become part of the parent history tree group.
<target_GroupID>"
The parent history tree ID.
Groups:=, " "
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
MoveFaces
Use: Moves the specified faces along normal or along a vector.
Command: Modeler>Surface>Move Faces>Along Normal
Modeler>Surface>Move Faces>Along Vector
Syntax: MoveFaces <SelectionsArray>, <MoveFacesParametersArray>
Return Value: None
Parameters: <MoveFacesParametersArray>
Array("NAME:Parameters",
<FacesOfOneObjToMove>, <FacesOfOneObjToMove>, ...)
<FacesOfOneObjToMove>
Array("Name:MoveFacesParameters",
"MoveAlongNormalFlag:=", <bool>,
"OffsetDistance:=", <value>,
"MoveVectorX:=", <value>,
"MoveVectorY:=", <value>,
"MoveVectorZ:=", <value>,
"FacesToMove:=", <array>)
MoveAlongNormalFlag
Specifies whether to move along the face normal or along a vector.
If false, provide the MoveVectorX, MoveVectorY, and MoveVectorZ parameters.
FacesToMove
Array of integers – the IDs of the faces to move
VB Example:
oEditor.MoveFaces _
Array("NAME:Selections", "Selections:=", _
"Box2,Box1"), _
Array("NAME:Parameters", _
Array("NAME:MoveFacesParameters", _
"MoveAlongNormalFlag:=", true, _
"OffsetDistance:=", "1mm", _
"FacesToMove:=", Array(218)),
Array("NAME:MoveFacesParameters", _
"MoveAlongNormalFlag:=", false,_
"OffsetDistance:=", "1mm", _
"MoveVectorX:=", "1mm", _
"MoveVectorY:=", "0mm", _
"MoveVectorZ:=", "0mm", _
"FacesToMove:=", Array(185)))
oEditor.MoveFaces
([
Array("NAME:Selections", "Selections:=", _
Python "Box2,Box1"), _
Example Array("NAME:Parameters", _
Array("NAME:MoveFacesParameters", _
"MoveAlongNormalFlag:=", true, _
"OffsetDistance:=", "1mm", _
"FacesToMove:=", Array(218)),
Array("NAME:MoveFacesParameters", _
"MoveAlongNormalFlag:=", false,_
"OffsetDistance:=", "1mm", _
"MoveVectorX:=", "1mm", _
"MoveVectorY:=", "0mm", _
"MoveVectorZ:=", "0mm", _
"FacesToMove:=", Array(185)))
])
ProjectSheet
Use: Project HFSS sheet object, typically for modeling thin conformal deposits. Typically followed
by Thicken Sheet.
Command: Click Modeler>Surface>Project Sheet
Syntax: ProjectSheet (Array("NAME:Selections",Selections:="...,...,""), Array("NAME:Pro-
jectSheetParameters")
Return Value: None
Parameters: None
VB Example:
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.ProjectSheet Array("NAME:Selections", "Selections:=",
"Box1,Box2,Polyline1"),
array("NAME:ProjectSheetParameters")
])
PurgeHistory
Use:Purges the construction history of the selected object. For complex objects this simplifies the
object and can improve modeler speed.
Command:Click Modeler>Purge History
Syntax:PurgeHistory <PurgeHistoryArray>
Return Value:None
Parameters:<PurgeHistoryArray>
Array("Name:Selections",
"Selections:=", <string>,
"NewPartsModelFlag:=", ["Model" | "NonModel"])
Selections
Name of the object to purge.
NewPartsModelFlag
Flag to indicate model properties, Model or NonModel.
VB Example:
oEditor.PurgeHistory Array("NAME:Selections", _
"Selections:=", "Polygon1", "NewPartsModelFlag:=", "Model")
oEditor.PurgeHistory
([
Python Array("NAME:Selections", _
Example
"Selections:=", "Polygon1", "NewPartsModelFlag:=",
"Model")
])
ReplaceWith3DComponent
Use: Replace selection with a 3D component
Section
Use: Creates a 2D cross-section of the selection in the specified plane.
Command: Modeler>Surface>Section
Syntax: Section <SelectionsArray>, <SectionParametersArray>
Return Value: None
Parameters: <SectionParametersArray>
Array("NAME:SectionToParameters",
"SectionPlane:=", <string>)
Section Plane
Possible values are "XY", "YZ", "ZX"
SeparateBody
Use: Separates bodies of specified multi-lump objects.
Command: Modeler>Boolean>Separate Bodies
Syntax: SeparateBody <SelectionsArray>
Return Value: None
Parameters: <SelectionsArray>
Selections:=",<objectNames>"
"NewPartsModelFlag:=", ["Model" | "NonModel"]
Indicates the type of model properties in the geometry - Model or Non Model.
VB Example:
oEditor.SeparateBody
([
Python Array("NAME:Selections",
Example "Selections:=", "Rectangle1,Circle1",
"NewPartsModelFlag:=", "Model")
])
SetModelUnits
Use: Sets the model units.
Command: Modeler>Units
Syntax: SetModelUnits <ModelUnitsParametersArray>
Return Value: None
Parameters: <ModelUnitsParametersArray>
Array("NAME:Units Parameter",
"Units:=", <string>,
"Rescale:=", <bool>)
Units
Possible values are: "cm", "ft", "in", "meter", "mil", "mm", "nm", "uin", "um"
SetWCS
Use: Sets the working coordinate system.
Command: Modeler>Coordinate System>Set Working CS
Syntax: SetWCS <WCSParametersArray>
Return Value: None
Parameters: <WCSParametersArray>
Array("NAME:SetWCS Parameter",
"Working Coordinate System:=", <string>)
Working Coordinate System
Name of the coordinate system to set as the WCS.
ShowWindow
Opens the selected 3D model editor window.
Syntax: ShowWindow
Return Value: None
Parameters: None
VB Example:
Set oDesign = oProject.GetActiveDesign
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.ShowWindow
Python oEditor.ShowWindow()
Example
Split
Use: Splits specified objects along a plane.
Command: Modeler->Boolean->Split
Syntax: Split <SelectionsArray>, <SplitParametersArray>
Return Value: None
Parameters: <SplitParametersArray>
Array("NAME:SplitToParameters",
"SplitPlane:=", <string>,
"WhichSide:=", <string>)
SplitPlane
Subtract
Use: Subtracts specified objects.
Command: Modeler->Boolean->Subtract
Syntax: Subtract <SubtractSelectionsArray>,
<SubtractParametersArray>
Return Value: None
Parameters: <SubtractSelectionsArray>
Array("NAME:Selections",
"Blank Parts:=", <string>,
"Tool Parts:=", <string>)
Blank Parts
Comma-separated list of parts to use as the blank in the subtract operation.
Example: "Blank Parts:=", "Box1, Box2"
Tool Parts
Comma-separated list of parts to use as the tool in the subtract operation.
Example: "Blank Parts:=", "Box3, Box4"
<SubtractParametersArray>
Array("NAME:SubtractParameters",
"KeepOriginals:=", <bool>)
VB Example:
oEditor.Subtract _
Array("NAME:Selections", _
"Blank Parts:=", "Polygon1",_
"Tool Parts:=", "Box1"),_
Array("NAME:SubtractParameters", _
"KeepOriginals:=", false)
Subtract ([
Python Syn- <SubtractSelectionsArray>,
tax
<SubtractParametersArray>
])
oEditor.Subtract
([
Array("NAME:Selections", _
SweepFacesAlongNormal
Use: Sweep a face along normal.
Command: Modeler>Sweep Faces Along Normal
Syntax: SweepFacesAlongNormal <selection> <parameters>
Return Value: None
Parameters: Array("NAME:Selections",
"Selections:=", "<faceID>",
"NewPartsModelFlag:=", ["Model" | "NonModel"]),
Array("NAME:Parameters",
Array("NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=", Array( <faceID>),
"LengthOfSweep:=", "<value><units>")
)
VB Example:
oEditor.SweepFacesAlongNormal
Array("NAME:Selections",
"Selections:=", "Rectangle1",
"NewPartsModelFlag:=", "Model"),
Array("NAME:Parameters",
Array("NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=",
Array( 57),
"LengthOfSweep:=", "0.5mm")
)
oEditor.SweepFacesAlongNormal (
[
Array("NAME:Selections",
"Selections:=", "Rectangle1",
"NewPartsModelFlag:=", "Model"),
Python
Array("NAME:Parameters",
Example
Array("NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=",
ThickenSheet
Use: Thicken a sheet object to convert it to a 3D object.
Command: Modeler>Surface>Thicken Sheet
Syntax: Thicken Sheet <SelectionParameters> <SheetThickenParameters>
Return Value: None
Parameters: Array("NAME:Selections",
"Selections:=", "<objectID>",
"NewPartsModelFlag:=", ["Model" | "NonModel"]),
Array("NAME:SheetThickenParameters",
"Thickness:=", "<value><units>",
"BothSides:=", <boolean>)
VB Example:
oEditor.ThickenSheet Array("NAME:Selections",
"Selections:=", "Rectangle1",
"NewPartsModelFlag:=", "Model"),
Array("NAME:SheetThickenParameters",
"Thickness:=", "1.01mm",
"BothSides:=", false)
oEditor.ThickenSheet
{[
Array("NAME:Selections",
"Selections:=", "Rectangle1",
Python
"NewPartsModelFlag:=", "Model"),
Example
Array("NAME:SheetThickenParameters",
"Thickness:=", "1.01mm",
"BothSides:=", false)
])
UncoverFaces
Use: Uncovers specified faces.
Command: Modeler>Surface>Uncover Faces
Syntax: UncoverFaces <SelectionsArray>, <UncoverParametersArray>
Return Value: None
Parameters: <UncoverParametersArray>
Array("NAME:Parameters",
<FacesOfOneObjToUncover>,
<FacesOfOneObjToUncover>,...)
<FacesOfOneObjToUncover>
Array("Name:UncoverFacesParameters",
"FacesToUncover:=", <array>)
FacesToUncover
An array of integers – the face IDs of the faces to uncover.
VB Example:
oEditor.UncoverFaces _
Array("NAME:Selections", "Selections:=", _
"Box3,Box2"),_
Array("NAME:Parameters", _
Array("NAME:UncoverFacesParameters", _
"FacesToUncover:=", Array(69)),
Array("NAME:UncoverFacesParameters", _
"FacesToUncover:=", Array(36)))
oEditor.UncoverFaces
([
Array("NAME:Selections", "Selections:=", _
Python
"Box3,Box2"),_
Example
Array("NAME:Parameters", _
Array("NAME:UncoverFacesParameters", _
"FacesToUncover:=", Array(69)),
Array("NAME:UncoverFacesParameters", _
"FacesToUncover:=", Array(36)))
])
Unite
Use: Unites the specified objects.
Command: Modeler>Boolean>Unite
Syntax: Unite <SelectionsArray>, <UniteParametersArray>
Return Value: None
Parameters: <UniteParametersArray>
Array("NAME:UniteParameters",
"KeepOriginals:=", <bool>)
Unroup
Use: Ungroups a specified history tree group.
Command: Modeler>Group>Ungroup
Syntax: DeleteEmptyGroups Array("Groups:=", Array("<GroupID>"))
Return Value: None
Parameters: <GroupID>,
The ID for the history tree group to ungroup.
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
WrapSheet
Use: Wraps a sheet object to another object.
Command: Wrap Sheet
Syntax: WrapSheet Array("NAME:Selections", "Selections:=", "<SheetID>,<ObjectID>"), Array
("NAME:WrapSheetParameters", "Imprinted:=", <Boolean>)
Return Value: None
Parameters: <SheetID>
ID of sheet object.
<ObjectID>
ID of 3D object.
<Boolean>
true or false.
VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2015.0.0
' 13:58:45 Nov 13, 2014
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
GetObjectIDByName
GetObjectName
GetObjectNameByFaceID
GetObjectsByMaterial
GetObjectsInGroup
GetMatchedObjectName
GetModelUnits
GetNumObjects
GetSelections
GetVertexIDsFromEdge
GetVertexIDsFromFace
GetVertexIDsFromObject
GetVertexPosition
GetUserPosition
OpenExternalEditor
PageSetup
RenamePart
BreakUDMConnection
Use:Break a current UDM connection to SpaceClaim.
Command:Break Connection.
Syntax:BreakUDMConnection <Array>
Return Value:
Parameters:<Array>
Array("NAME:Selections", "Selections:=", "")
VB Example:
oEditor.BreakUDMConnection Array("NAME:Selections", "Selections:=",
"")
Delete
Use: Deletes specified objects, coordinate systems, points, planes, etc.
Command: None
Syntax: Delete <SelectionsArray>
Return Value: None
FitAll
Fits the design to the modeling area.
Python oEditor.FitAll()
Example
VB Syn- FitAll()
tax
GetBodyNamesByPosition
Gets the IDs of objects that contact the given point.
Command: None.
Syntax: GetBodyNamesByPosition(<positionParameters>).
Return Value: Retuurns a list of IDs.
Parameters: <PositionParameters>
Array("NAME:Parameters", _
"Xposition:=", <value>,
"YPosition:=", <value>,
"ZPosition:=", <value>)
VB Example:
oEditor.GetBodyNamesByPosition(Array("NAME:Parameters", _
"XPosition:=", "a", _
"YPosition:=", "0mm", _
"ZPosition:=", "0mm"))
Python oEditor.GetBodyNamesByPosition(["0.6mm","0.6mm","1mm"])
Exampl- ["Region"]
e
GetEdgeByPosition
Gets the edge ID corresponding to position input.
Syntax: GetEdgeByPosition(<PositionParameters>)
Return Value: Returns an integer edge ID.
Parameters: <PositionParameters>
Array("NAME:EdgeParameters", _
"BodyName:=", <string>,
"Xposition:=", <value>,
"YPosition:=", <value>,
"ZPosition:=", <value>)
For 2D XY Designs, ZPosition should be set to "0".
For 2D RZ Designs, YPosition should be set to "0".
VB Example:
oEditor.GetEdgeByPosition(Array("NAME:EdgeParameters", _
"BodyName:=", "Box1", "XPosition:=", "3.4mm", _
Pyt- oEditor.GetEdgeByPosition
ho-
n (["NAME:EdgeParameters", "BodyName:=", "Box1", "XPosition:=",
Ex- "3.4mm", "YPosition:=", "2.8mm", "ZPosition:=", "0.4mm"
am-
ple
])
GetEdgeIDsFromFace
Get the edge IDs for a given face ID.
Command: None
Syntax: GetEdgeIDsFromFace <Face ID>
Return Value: An array of edge IDs
Parameters: <FaceID>
ID of the face
VB Example:
Dim oEdgeIDs
oEdgeIDs = Array()
oEdgeIDs = oEditor.GetEdgeIDsFromFace(10)
Python oEditor.GetEdgeIDsFromFace("10")
Example
GetEdgeIDsFromObject
Get the edge IDs of given an object name
Command: None
Syntax: GetEdgeIDsFromObject <Object Name>
Python oEditor.GetEdgeIDsFromObject("Box1")
Example
GetFaceArea
Get area of given face ID.
Command: None.
Syntax: GetFaceArea <face ID>
Return Value: Double value for face area.
Parameters: <FaceID>
Face ID
VB Example:
Dim oArea
oArea = oEditor.GetFaceArea(10)
Python oEditor.GetFaceArea("10")
Example
GetFaceCenter
Given a planar face ID, return the center position.
Command: none
Python oEditor.GetFaceCenter(oFaceID)
Example
GetFaceByPosition
Gets the face id corresponding to position input.
Syntax: GetFaceByPosition(<FaceByPositionParametersArray>)
Return Value: Returns an integer face id
Parameters: (<FaceByPositionParametersArray>)
Array("NAME:FaceParameters",
"BodyName:=", <string>,
"XPosition:=", <value>,
"YPosition:=", <value>,
"ZPosition:=", <value>)
For 2D XY Designs, ZPosition should be set to "0".
For 2D RZ Designs, YPosition should be set to "0".
BodyName
Name of the body on which the point lies.
The point should be on exactly one face, not at a vertex or edge where two or more faces
join. And the coordinates must be on the face.
VB Example:
Dim faceid
faceid = oEditor.GetFaceByPosition(Array("NAME:FaceParameters", _
"BodyName:=" "Box1", "XPosition:=", "3.4mm", "YPosition:=, _
top_face_id = oEditor.GetFaceByPosition(["NAME:FacePara-
meters",
"BodyName:=", "Box",
Python
Example "XPosition:=", "0mm",
"YPosition:=", "0mm",
"ZPosition:=", "100mm"])
GetFaceIDs
Get the face IDs of given an object name
Command: None.
Syntax: GetFaceIDs <Object Name>
Return Value: An array of face IDs
Parameters: <ObjectName>
Name of the object
VB Example:
Dim oFaceIDs
oFaceIDs = Array()
oFaceIDs = oEditor.GetFaceIDs("Box1")
Python oEditor.GetFaceIDs("Box1")
Example
GetMatchedObjectName
Use: Gets all object names containing the input text string.
Syntax: GetMatchedObjectName(<ObjectNameWildcardText>)
Return Value: Array of object names containing wildcard text.
Parameters: <ObjectNameWildcardText>
Type: <string>
Text to be used for object name matching.
VB Example:
objectnames = oEditor.GetMatchedObjectName("Box*")
Python oEditor.GetMatchedObjectName("Box*")
Example
GetModelBoundingBox
Gets the bounding box of the current model.
Syntax: GetModelBoundingBox()
Return Value: Returns the Xmin, Ymin, Zmin, Xmax, Ymax, Zmax values that define the bounding
box.
Parameters: None
VB Example:
Dim oBoundingBox
oBoundingBox = oEditor.GetModelBoundingBox()
Python oEditor.GetModelBoundingBox([])
Example
GetModelUnits
Use: Get the model units.
Command: None.
Syntax: GetModelUnits
Return Value: A string contains current model units.
Parameters: None.
VB Example:
Dim oUnit
oUnit = oEditor.GetModelUnits()
Python oEditor.GetModelUnits([])
Example
GetNumObjects
Use: Gets the number of objects in a design.
Syntax: GetNumObjects
Return Value: Returns the number of objects.
Type: <int>
Parameters: None
VB Example:
totalobjects = oEditor.GetNumObjects
Python oEditor.GetNumObjects([])
Example
GetObjectIDByName
Use: Get Object IDs to provide for CreateEntityList.
Syntax: GetObjectIDByName("<objectName>")
Return Value: <Object ID>
Parameters: <objectName>
Type: <string>
VB Example:
oObjectID = oEditor.GetObjectIDByName("Box2")
Python oEditor.GetObjectIDByName("Box2")
Example
GetObjectName
Use: Gets an object name corresponding to the 0 base index of the creation order.
Syntax: GetObjectName(<Index>)
Return Value: Returns the object name of the corresponding object.
Parameters: <Index>
Type: <string>
The 0 base index of the creation order
VB Example:
objectname = oEditor.GetObjectName(3)
Python oEditor.GetObjectName("3")
Example
GetObjectNameByFaceID
Use: Gets an object name corresponding to the input face id.
Syntax: GetObjectNameByFaceID(<FaceID>)
Return Value: Returns the name of the corresponding object.
Parameters: <FaceID>
Type: <string>
VB Example:
objectname = oEditor.GetObjectNameByFaceID(Face10)
Python oEditor.GetObjectNameByFaceID("Face10")
Example
GetObjectsByMaterial
Use:Get objects by material name.
Command:None.
Syntax:GetObjectsByMaterial <Material Name>
Return Value:An array of object names.
Parameters:<Material Name>
Type: <string>
Material name/
VB Example:
Dim objNames
objNames = oEditor.GetObjectsByMaterial("vacuum")
Python oEditor.GetObjectsByMaterial("vacuum")
Example
GetObjectsInGroup
Use: Returns the objects for the specified group.
Syntax: GetObjectsInGroup(<GroupName>)
Return Value: The objects in the group.
Parameters: <groupName>
Type: <string>
One of <materialName>, <assignmentName>, "Non Model", "Solids", "Unclassified",
"Sheets", "Lines"
VB Example:
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
Dim oObject
Dim oObjects
Python oEditor.GetObjectsInGroup("Sheets")
Example
GetPropertyValue
Gets the value of a single property belonging to a specific serverName and PropTab. This function
is available with the Project, Design or Editor objects, including definition editors.
Use the script recording feature and edit a property, and then view the resulting script to
see the format for that property.
UI Access NA
selectionArray = oEditor.GetSelections()
for k in selectionArray:
Python
Exampl- val = oEditor.GetPropertyValue("PassedParameterTab", k,
e "R")
...
selectionArray = oEd-
itor.GetSelections
VB
Examp-
val = oEditor.GetPropertyValue("PassedParameterTab", k,
le
"R")
...
next
VB Example:
value_string = _
oEditor.GetPropertyValue("Geometry3DCmdTab",_
"Box1:CreateBox:1", "XSize")
VB Example:value_string = _
oEditor.GetPropertyValue("BaseElementTab",_
"rect_1", "Name")
Dim A
A = Array()
A = oEditor.GetSelections
Dim B
B = Join(A,",")
'Debug.Write "The Selections are " &B
MsgBox(B)
Dim C
C = Array("NAME:Selections", "Selections:=", B)
oEditor.Delete C
GetUserPosition
Use: Returns the coordinates of an interactive position input in the 3D model window.
Syntax: GetUserPosition(<PositionInputPrompt>)
Return Value: Array of coordinates
Parameters: <PositionInputPrompt>
Type: <string>
VB Example:
Dim position
Dim coord
position = oEditor.GetUserPosition("Enter a point")
For Each coord in position
Msgbox(coord)
Next
Python oEditor.GetUserPosition("Enter
Example a point")
GetVertexIDsFromEdge
Use: Get the vertex IDs of given a edge ID.
Command: None.
Syntax: GetVertexIDsFromEdge <Edge ID>
Return Value: An array of edge IDs.
Parameters: <EdgeID>
ID of the edge.
VB Example:
Dim oVertexIDs
oVertexIDs = Array()
oVertexIDs = oEditor.GetVertexIDsFromEdge(10)
GetVertexIDsFromFace
Use: Get the vertex IDs of given a face ID.
Command: None.
Syntax: GetVertexIDsFromFace <Face ID>
Return Value: An array of vertex IDs
Parameters: <FaceID>
ID of the face
VB Example:
Dim oVertexIDs
oVertexIDs = Array()
oVertexIDs = oEditor.GetVertexIDsFromFace(10)
GetVertexIDsFromObject
Use: Get the vertex IDs of given an object name
Command: None.
Syntax: GetVertexIDsFromObject <Object Name>
Return Value: An array of edge IDs
Parameters: <ObjectName>
GetVertexPosition
Use: Returns a vector of vertex coordinates.
Syntax: GetVertexPosition(<VertexID>)
Return Value: Vector of coordinates
Parameters: <VertexID>
Type: <vector>
VB Example:
position = oEditor.GetVertexPosition(VertexIDs(0))
OpenExternalEditor
Use:Launch a SpaceClaim session.
Command:Launch SpaceClaim.
Syntax:OpenExternalEditor <Array>
Return Value:
Parameters:<Array>
Array("NAME:Selections", "Selections:=", "")
VB Example:
oEditor.OpenExternalEditor Array("NAME:Selections", "Selections:=",
"")
PageSetup
Use: Specifies the page settings for printing.
Command: File>Page Setup
Syntax: PageSetup <PageSetupParametersArray>
Return Value: None
Parameters: <PageSetupParametersArray>
Array("NAME:PageSetupData",
"margins:=",
Array("left:=", <value>,
"right:=", <value>,
"top:=", <value>,
"bottom:=", <value>))
RenamePart
Use: Renames an object.
Command: None
Syntax: RenamePart <RenameParametersArray>
Return Value: None
Parameters: <RenameParametersArray>
Array("NAME:Rename Data",
"Old Name:=", <string>,
"New Name:=", <string>)
CreateOutputVariable
Different forms of this command are documented for HFSS, Q3D Extractor and Schematic and
Layout Editors.
<ContextArray>
Type: <variant>
Context for which the output variable expression is being evaluated.
VB Example:
Set oModule = oDesign.GetModule("OutputVariable")
oModule.CreateOutputVariable "test","mag(S(WavePort1,WavePort1))", _
"Setup1 : LastAdaptive", "Modal Solution Data", _
Array("Domain:=", "Sweep")
For Layout Editor the CreateOutputVariable syntax and other details are as follows:
<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. For more inform-
ation see SimValueContext.
For Q3D Extractor or a 2D Extractor the command and example are as follows:
Command: Q3D Extractor or 2D Extractor>Results>Output Variables
VB Example: Set oModule = oDesign.GetModule("OutputVariable") oMod-
ule.CreateOutputVariable "char_Z", _ "sqrt(ACL(via:via_source,vi-
a:via_source)/C(via,GroundPlane))", _ "Setup1 : LastAdaptive",
"Matrix", Array("Context:=", "Original")
DeleteOutputVariable
Deletes an existing output variable. The variable can only be deleted if it is not in use by any traces.
VB
Set oModule = oDesign.GetModule("OutputVariable")
Example oModule.DeleteOutputVariable "testNew"
DoesOutputVariableExist
Verify that a named output variable exists.
UI Access NA
Boolean
Return Value
True if the variable exists. False otherwise.
Python
oProject = oDesktop.GetActiveProject()
Example oDesign = oProject.GetActiveDesign()
oModule = oDesign.GetModule("OutputVariable")
oModule.DoesOutputVariableExist("MyTestVar")
VB Syntax DoesOutputVariableExist(<outputVariableName>)
Set oProject = oDesktop.GetActiveProject()
Set oDesign = oProject.GetActiveDesign()
VB
Example Set oModule = oDesign.GetModule("OutputVariable")
Set oModule.DoesOutputVariableExist("MyTestVar")
EditOutputVariable
Changes the name or expression of an existing output variable.
UI Access NA
Python
oModule = oDesign.GetModule("OutputVariable")
Example oModule.EditOutputVariable ("test",
VB Example:
Set oModule = oDesign.GetModule("OutputVariable")
oModule.EditOutputVariable "test", "dB(S(WavePort1,WavePort1)) ", _
"testNew", "Setup1 : LastAdaptive", "Modal Solution Data", _ Array
("Domain:=", "Sweep")
GetOutputVariableValue
Gets the double value of an output variable. Only those expressions that return a double value are
supported. The expression is evaluated only for a single point.
Different forms of this command are documented for HFSS, Q3D Extractor as well Schematic and
Layout Editors.
UI Access NA
Dim oEditor
Dim oModule
Dim var1
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project1")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("OutputVariable")
var1 = oModule.GetOutputVariableValue("p", "freq='1GHz'", _
"Setup1 : LastAdaptive", "Modal Solution Data", Array())
msgbox (var1)
VB Example:
' -----------------------------------------------------------
' Sample script to get output variable values in 2.0 products
' -----------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim projects
Dim oProject
Dim oDesign
Dim oModule
Dim val
' -----------------------------------------------------------
' Get all of the VBS objects needed to talk to the product
' -----------------------------------------------------------
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
Set projects = oDesktop.GetProjects()
' -----------------------------------------------------------
' Now, look at the original output variable in a different design
' variation
' -----------------------------------------------------------
val = oModule.GetOutputVariableValue ( "fieldOV", _
"Distance='0' _
"Setup1 : LastAdaptive", "Fields", _
Freq='1GHz' xsize='0.4mm' ysize='4.1mm'", _
Array("Context:=", "Polyline1", "PointCount:=", 1 ) )
' -----------------------------------------------------------
' Look at the same variable at a position 1mm along the line
' -----------------------------------------------------------
val = oModule.GetOutputVariableValue ( "fieldOV", _
"Distance='1mm'
"Setup1 : LastAdaptive", _
Freq='1GHz'", _
"Fields", _
Array("Context:=", "Polyline1", "PointCount:=", 3 ) _
)
MsgBox( "2 val " & FormatNumber(val) )
For HFSS Layout and Schematic Editor the command details are as follows:
Syntax: GetOutputVariableValue(<OutputVarName>, <VariationKey>, <SolutionName>,
<ReportType>, <ContextArray>)
Return Value: Double value of the output variable .
Parameters: <OutputVarName>
Type: <string>
Name of the output variable.
<VariationKey>
Type: <string>
Example: " ’F=’20GHz’ x_size=’1.0in’ "
<SolutionName>
Type: <string>
Name of the solution as listed in the output variable UI.
For example: "Setup1 : Last Adaptive"
<ReportType>
Type: <string>
Possible values are:
<ContextArray>
Type: Array
Context for the output variable. For more information see SimValueContext.
VB Example:
' ----------------------------------------------
' Script used by Ansys Designer Version 4.1.0
----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("MyTransientProject")
Set oDesign = oProject.SetActiveDesign("Nexxim1")
Set oModule = oDesign.GetModule("OutputVariable")
val1=oModule.GetOutputVariableValue("vout", "MyTransientSetup",
"time='3.9462ns'", "Standard", _
VB Example:
' ----------------------------------------------
' Script used by Ansys Designer Version 4.1.0
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("MyLNAExample")
Set oDesign = oProject.SetActiveDesign("Nexxim1")
Set oModule = oDesign.GetModule("OutputVariable")
val1=oModule.GetOutputVariableValue("magS", _
"LinearFrequency", "F='1GHz'", "Standard", _
Array("NAME:Context", "SimValueContext:=", _
Array(3, 0, 2, 0, false, false, -1, 1, 0, 1, 1, "", 0, 0)))
MsgBox val1
Val=oModule.GetOutputVariableValue("OutVarTest",_ Freq=’500MHz’
"Setup1 : LastAdaptive", "Matrix", _
Array ("Context:= ",Original" ))
SimValueContext
SimValueContext holds context information for a trace, and describes how data for a trace should
be extracted from the simulation. SimValueContext contains a list of 14 required initial values:
SimValueContext (
Domain ID, Calculation Type, Number of Cycles, Rise Time,
Step, Impulse, Context ID, Window Width,
Window Type, TDR Kaiser Parameter, Hold Time, DeviceName,
TDR Step Time, DR Maximum Time )
For example, the following indicates a trace in the Time Domain, Standard Calculation with the
number of cycles being 2:
"SimValueContext:=", Array(1, 0, 2, 0, false, false, -1, 1, 0, 1, 1,
"", 0, 0)
Additional, context-specific values may follow the required values, as described in subsection 15
below.
1. Domain ID
No Domain 0
Time Domain 1
Spectrum Domain 2
Sweep Domain 3
Device Domain 4
SinglePt Domain 5
LoadPull Domain 6
Transient Domain 7
Budget Domain 8
NetworkFunction Domain 9
Oscillator Domain 55802
Noise Domain 55803
Transfer Function Domain 55807
Time Frequency Domain 55808
2. Calculation Type
Standard Calculation 0
Device2_DCIV 1
Device3_DCIV_Output 2
Device3_DCIV_Input 3
Device3_DCIV_Transfer 4
Device3_DCIV_Reverse 5
Device2_ACLoad 6
Device3_ACLoad_Output 7
Device3_ACLoad_Input 8
Device3_ACLoad_Transfer 9
Device3_ACLoad_Reverse 10
Constellation 11
EyeDiagram 12
FreeX ( Statistic Report ) 13
Context-specific values are entered in the format "key, true/false, keyvalue", where:
— "key" is the name of the key being set.
— "true/false" indicates whether the key is a string value.
— "keyvalue" is the value of the key.
— The order of the context keys is not significant.
— Context keys have software defaults that will be used if not provided in the script.
VB Example:
"SimValueContext:=", Array(1, 0, 2, 0, false, false, -1, 1, 0, 1, 1,
"", 0, 0,
"DE", false, "0",
"DP", false, "20000000",
"DT", false, "0.001",
"WE", false, "10ns",
"WM", false, "10ns",
"WN", false, "0ns",
"WS", false, "0ns"))
Window Type ID
Rectangular 0
Bartlett 1
Blackman 2
Hamming 3
Hanning 4
Kaiser 5
Welch 6
Weber 7
Lanzcos 8
c. Eyeprobe index context for UI domain, Time domain, Eye Measuremant domain in Veri-
fEye and QuickEye analysis:
d. Eyesource index context for Initial Response domain and Peak Distortion domain in
VerifEye and QuickEye analysis:
All Report and Trace properties can be edited using the ChangeProperty commands. This
includes Title properties, General properties, and Background properties such as border color,
fonts, X and Y axis scaling, and number display.
Note:
When you execute Tools>Record Script, operations performed in the Reporter are
automatically recorded.
CopyTracesData
CopyReportData
CopyReportDefinitions
CopyTraceDefinitions
CreateReport
CreateReportFromFile
CreateReportFromTemplate
CreateReportOfAllQuantities
DeleteMarker
DeleteAllReports
DeleteReports
DeleteTraces
EditQuickEyeAnalysis
EditVerifEyeAnalysis
FFTOnReport
ExportImageToFile
ExportPlotImageToFile
ExportToFile
ExportMarkerTable
GetAllCategories
GetAllQuantities
GetAllReportNames
GetAvailableDisplayTypes
GetAvailableReportTypes
GetAvailableSolutions
GetDataExpressions
GetDataUnits
GetDesignVariableNames
GetDesignVariableUnits
GetDesignVariableValue
GetDesignVariationKey
GetImagDataValues
GetPerQuantityPrimarySweepValues
GetRealDataValues
GetSolutionContexts
GetSolutionDataPerVariation
GetSweepNames
GetSweepUnits
GetSweepValues
GroupPlotCurvesByGroupingStrategy
ImportIntoReport
IsDataComplex
IsPerQuantityPrimarySweep
MovePlotCurvesToGroup
MovePlotCurvesToNew
PasteReport
PasteTraces
ReleaseData
RenameReport
RenameTrace
ResetPlotSettings
SavePlotSettingsAsDefault
UpdateAllFieldsPlots
UpdateAllReports
UpdateQuantityFieldsPlots
UpdateReports
UpdateTrace
UpdateTracesContextandSweeps
UnGroupPlotCurvesInGroup
AddCartesianLimitLine
Adds a limit line to a report on the X axis.
VB
Example Array("NAME:CartesianLimitLine",
Array("NAME:XValues", 0, 2, 5, 7, 10,
15), "XUnits:="
AddCartesianXMarker
Adds a marker to a report on the X axis.
AddCartesianYMarker
Adds a marker to a report on the Y axis.
Command: Report2D>Marker>Add Y Marker
Syntax: AddCartesianYMarker <ReportName>, <MarkerID>, <Ycoord>
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.
<MarkerID>
Type: <string>
ID of the marker, for example: "Y1".
<YCoord>
Type: <real>
Y location for the marker.
VB Example:
oModule.AddCartesianYMarker "XY Plot1", "Y1", 0
AddDeltaMarker
Add markers to calculate differences between two trace points on a plot.
AddMarker
Adds a marker to a trace on a report.
AddNote
Adds a note at a specified location to a given report.
Return None
Value
oModule = oDesign.GetModule("ReportSetup")
oModule.AddNote ("XY Plot1", ["NAME:NoteDataSource",
Python ["NAME:Note-
DataSource", "SourceName:=", "Note1",
Exampl-
e "HaveDefaultPos:=", true, "DefaultXPos:=",
1996, "DefaultYPos:=", _ 3177, "String:=", "This is a
note"]]
AddTraceCharacteristics
Adds a trace characteristics field to the legend on a report.
Command: Report2D>Trace Characteristics>All... for Add Trace Characteristics dialog.
<Range>
Either "Full" for the full sweep range, or "Specified", and "<start>", and "<end>" values
and units.
VB Example:
Set oModule = oDesign.GetModule("ReportSetup")
oModule.AddTraceCharacteristics "Rept2DRectFreq2", "min", Array(),
Array("Full")
VB Example:
Set oModule = oDesign.GetModule("ReportSetup")
oModule.AddTraceCharacteristics "Rept2DRectFreq", "distortion",
Array("0"), Array( "Specified", "19.5GHz", "20.4GHz")
oModule.AddTraceCharacteristics "Rept2DRectFreq2", "deadtime", Array
("0.1"), Array( "Full")
Pyth-
oModule.AddTraceCharacteristics("Differential S-parameters",
on "pk2pk", [], ["Full"])
Exa- oModule.AddTraceCharacteristics("Differential S-parameters",
mple
"prms", ["0", "0"], ["Full"])
AddTraces
Creates a new trace and adds it to the specified report.
<ValueArray>
Array("All") or Array("Value1", "Value2",
..."Valuen")
examples of <VariableName>
"Freq", "Theta", "Distance"
<ReportDataArray> Array of This array contains the report quant-
Strings ity and X, Y, and (Z) axis definitions.
Array("X Component:=", <Vari-
ableName>, "Y Component:=",
<VariableName> | <ReportQuant-
ityArray>)
<ReportQuantityArray>
ex. Array("dB(S(Port1, Port1))")
<SolutionName>
Type: <string>
Name of the solution as listed in the Modify Report dialog box.
For example: "Setup1 : Last Adaptive"
<ContextArray>
Type: Array of strings
Context for which the expression is being evaluated. This can be an empty string if there
is no context.
Array("Domain:=", <DomainType>)
<DomainType>
ex. "Sweep" or "Time"
Array("Context:=", <SimValueContext>)
Context for the trace. For more information see SimValueContext.
<FamiliesArray>
Type: Array of strings
Contains sweep definitions for the report.
<ValueArray>
Array("All") or Array("Value1", "Value2", ..."Valuen")
examples of <VariableName>
"Freq", "Theta", "Distance"
<ReportDataArray>
Type: Array of strings
This array contains the report quantity and X, Y, and (Z) axis definitions.
Array("X Component:=", <VariableName>, "Y Component:=", <VariableName> |
<ReportQuantityArray>)
<ReportQuantityArray>
ex. Array("dB(S(Port1, Port1))")
VB Example:
oModule.AddTraces "XY Plot1", "Setup1 : Sweep1", _
Array("Domain:=", "Time", "HoldTime:=", 1, "RiseTime:=", 0, _
"StepTime:=", 6.24999373748E-012, "Step:=", false, _
"WindowWidth:=", 1, _
"WindowType:=", 0, "KaiserParameter:=", 1, _
"MaximumTime:=", 6.2437437437444E-009), _
Array("Time:=", Array("All"), "OverridingValues:=", _
Array("0s","6.24999373748188e-012s", ... )), _
Array("X Component:=", "Time", _
"Y Component:=", Array("TDRZ(WavePort1)")), _
Array()
ClearAllMarkers
Clears all markers from a report.
UI Access Report2d>Markers>ClearAllMarkers
For Q3D Extractor the ClearAllMarkers command has the following details.
Clears all markers.
Command: Q3DExtractor>Fields>Fields>Marker>Clear All
Syntax: ClearAllMarkers
Return Value: none
Parameters: none
VB Example: Dim oAnsoftApp
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Solenoid")
ClearAllTraceCharacteristics
Clears all trace characteristics from the legend in a report.
CopyTracesData
Copy trace data for a paste operation.
Command: Select a trace in the Project tree, right-click and select Copy Data
Syntax: CopyTracesData <ReportName> <TracesArray>)
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.
<TracesArray>
Type: Array of Strings
Trace definitions from which to copy corresponding data.
VB Example:
oModule.CopyTracesData "Transmission", Array("mag(S(Port1,Port2))")
An example related to Q3D Extractor is as follows:
VB Example: oModule.CopyTracesData "C11", Array("C (Box1,Box1))")
Python
oModule.CopyTracesData ("Transmission",
Example ["mag(S(Port1,Port2))"])
CopyReportData
Copy all data corresponding to the specified reports.
UI Access Select a report in the Project tree, right-click and select Copy Data
strings
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
CopyTraceDefinitions
Copy trace definitions for a paste operation.
UI Access Select a trace in the Project tree, right-click and select Copy Definition
Python
oModule.CopyTraceDefinitions ("Transmission",
Example ["mag(S(Port1,Port2))"])
VB
oModule.CopyTraceDefinitions "Transmission",
Example Array("mag(S(Port1,Port2))")
CreateReport
Creates a new report with a single trace and adds it to the Results branch in the project tree.
Command: [product]>Results>Create <type> Report
Syntax: CreateReport <ReportName> <ReportType> <DisplayType> <SolutionName> <Con-
textArray> <FamiliesArray> <ReportDataArray>
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.
<ReportType>
Type: <string>
Possible values are:
"Modal S Parameters" - Only for Driven Modal solution-type problems with ports.
"Terminal S Parameters" - Only for Driven Terminal solution-type problems with ports.
"Eigenmode Parameters" - Only for Eigenmode solution-type problems.
"Fields"
"Far Fields" - Only for problems with radiation or PML boundaries.
"Near Fields" - Only for problems with radiation or PML boundaries.
"Emission Test"
<DisplayType>
Type: <string>
If ReportType is "Modal S Parameters", "Terminal S Parameters", or "Eigenmode Para-
meters", then set to one of the following:
"Rectangular Plot", "Polar Plot", "Radiation Pattern",
"Smith Chart", "Data Table", "3D Rectangular Plot", or "3D Polar
Plot".
If <ReportType> is "Far Fields" or "Near Fields", then set to one of the following:
"Rectangular Plot", "Radiation Pattern", "Rectangular Contour
Plot" "Data Table",
"3D Rectangular Plot", or "3D Polar Plot"
Array("Context:=", <GeometryType>)
<GeometryType>
ex. "Infinite Spheren", "Spheren", "Polylinen"
<FamiliesArray>
Type: Array of strings
Contains sweep definitions for the report.
Array("<VariableName>:= ", <ValueArray>)
<ValueArray>
Array("All") or Array("Value1", "Value2", ..."Valuen")
examples of <VariableName>
"Freq", "Theta", "Distance"
<ReportDataArray>
Type: Array of strings
This array contains the report quantity and X, Y, and (Z) axis definitions.
Array("X Component:=", <VariableName>, "Y Component:=", <VariableName> |
<ReportQuantityArray>)
<ReportQuantityArray>
VB Example:
oModule.CreateReport "ReptSmithFreq",_
"Modal Solution Data", "Smith Plot", "Setup1 : Sweep1", _
Array("Domain:=", "Sweep"), _
Array("Freq:=", Array("All")),_
Array("Polar Component:=", _
Array("ln(Y(LumpPort1,LumpPort1))")), _
Array()
Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2016.0.0
' 15:14:58 Sep 08, 2015
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("dra_diel")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("ReportSetup")
oModule.CreateReport "Rectangular Contour Plot 2", "Far Fields", _
"Rectangular Contour Plot", "Setup1 : LastAdaptive", Array("Con-
text:=", _
"Infinite Sphere1"), Array("_u:=", Array("All"), "_v:=", Array
("All"), "Freq:=", Array( _
"5GHz")), Array("X Component:=", "_u", "Y Component:=", "_v", "Z Com-
ponent:=", Array( _
"rETotal")), Array()
Nominal Example:
oModule.CreateReport( "XY Plot 2", "Standard",_
"Rectangular Plot", "TR", ["NAME:Context",_
"SimValueContext:=", [] 1, 0, 2, 0, false,_
false, -1, 1, 0, 1, 1, "", 0, 0]], ["Time:=",_
["All"], "aaa:=", ["Nominal"]]_
["X Component:=", "Time", "Y Component:=",_
["E1.I"]][])
Optimetrics Example:
oModule.CreateReport ("XY Plot 3", "Standard",_
"Rectangular Plot", "TR", ["NAME:Context",_
"OptiSetup:=", "ParametricSetup1", "SimValueContext:=",_
[1, 0, 2, 0, false, false, 0, 1, _
0, 1, 1, "", 0, 0]], ["Time:=", ["All"],_
"aaa:=", ["Nominal"]], ["X Component:=",_
"Time", "Y Component:=", ["E1.I"]], [])
Spectral Example:
oModule.CreateReport ("XY Plot 4", "Standard",_
"Rectangular Plot", "TR", ["NAME:Context",_
"SimValueContext:=", [ 2, 0, 2, 0, false, false, _
-1, 1, 0, 1, 1, "", 0, 0, "CG", false, "0", "KP", _
false, "0", "MH", false, "100", "TE", false, "40ms", _
"TH", false, "40", "TS", false, "0ns", "UF", false, _
"0", "WT", false, "0", "WW", false, "100"]],_
["Spectrum:=", ["All"], "aaa:=",_
["Nominal"]], ["X Component:=","Spectrum", _
"Y Component:=", ["mag(E1.I)"]], [])
CreateReport [Designer]
Use:Creates a new report with a single trace and adds it to the Results branch in the project tree.
Command:Product Menu>Results>Create <type> Report
Syntax:CreateReport <ReportName> <ReportType> <DisplayType> <SolutionName> <Con-
textArray> <FamilesArray> <ReportDataArray>
Return Value:None
Parameters:<ReportName>
Type: <string>
Name of Report.
<ReportType>
Type: <string>
Possible values are:
"Standard" - For most plot types.
"Load Pull" - For load pull plots.
"Constellation" - For constellation plots.
"Data table" - For data tables.
"Eye Diagram" - For eye diagrams.
"Statistical" - For statistical plots.
<DisplayType>
Type: <string>
Possible values are:
"Rectangular Plot", "Polar Plot", "Radiation Pattern", "Smith Chart", "Data Table", "3D
Rectangular Plot", "3D Polar Plot", or "Rectangular Stacked Plot".
<SolutionName>
Type: <string>
Name of the solution as listed in the Modify Report dialog box.
For example: "Setup1 : Last Adaptive"
<ContextArray>
Type: Array of strings
Context for which the expression is being evaluated. This can be an empty string if there
is no context.
Array("Domain:=", <DomainType>)
<DomainType>
ex. "Sweep" or "Time"
Array("Context:=", <SimValueContext>)
Context for the trace. For more information see SimValueContext.
<FamiliesArray>
Type: Array of strings
Contains sweep definitions for the report.
Array("<VariableName>:= ", <ValueArray>)
<ValueArray>
Array("All") or Array("Value1", "Value2", ..."Valuen")
examples of <VariableName>
"Freq", "Theta", "Distance"
<ReportDataArray>
Type: Array of strings
This array contains the report quantity and X, Y, and (Z) axis definitions.
Array("X Component:=", <VariableName>, "Y Component:=", <VariableName> |
<ReportQuantityArray>)
<ReportQuantityArray>
ex. Array("dB(S(Port1, Port1))")
VB Example:
oModule.CreateReport "XY Stacked Plot 1", "Standard", "Rectangular
Stacked Plot", _
"LinearFrequency", Array("NAME:Context", "SimValueContext:=", Array
(3, 0, 2, 0, _
false, false, -1, 1, 0, 1, 1, "", 0, 0)), Array("F:=", Array
("All")), Array("X Component:=", _
"F", "Y Component:=", Array("dB(S(Port1,Port1))", "dB(S
(Port1,Port2))", _
"dB(S(Port2,Port1))", "dB(S(Port2,Port2))")), Array()
VB Example:
oModule.CreateReport "Data Table 1", "Standard", "Data Table", "Lin-
earFrequency",_
Array("NAME:Context", "SimValueContext:=", Array( _
3, 0, 2, 0, false, false, -1, 1, 0, 1, 1, "", 0, 0)), Array("F:=",
Array("All")), Array("X Component:=", _
"F", "Y Component:=", Array("dB(S(Port1,Port1))")), Array()
VB Example:
oModule.CreateReport "3D Rectangular Plot 1", "Standard", "3D Rect-
angular Plot", _
"LinearFrequency", Array("NAME:Context", "SimValueContext:=", Array
(3, 0, 2, 0, _
false, false, -1, 1, 0, 1, 1, "", 0, 0)), Array("F:=", Array
("All")), Array("X Component:=", _
"F", "Y Component:=", "F", "Z Component:=", Array("dB(S
(Port1,Port1))")), Array()
VB Example:
oModule.CreateReport "3D Rectangular Plot 2", "Standard", "3D Rect-
angular Plot", _
"LinearFrequency", Array("NAME:Context", "SimValueContext:=", Array
(3, 0, 2, 0, _
Python CreateReport(<data_block>)
Syntax
oModule = oDesign.GetModule("ReportSetup")
oModule.CreateReport("QuickEye Voltage Plot 1", "Eye Dia-
gram", "Rectangular Plot", "QuickEyeAnalysis",
[
"NAME:Context",
"SimValueContext:=" , [1,0,2,0,False,False,
-1,1,0,1,1,"",0,0,"DE",False,"0","DP",False,
"20000000","DT",False,"0.001","NUMLEVELS",False,"1","PCI-
D",
False,"3","PID",False,"0",
"WE",False,"49.99995us","WM",False,"49.99995us","WN",Fal-
se,
"0ps","WS",False,"0ps"]
Python ],
Example
[
"Time:=" , ["All"]
],
[
"Component:=" , ["aeyeprobe3"]
],
[
"Unit Interval:=" , "1e-009s",
"Offset:=" , "0",
"Auto Delay:=" , True,
"Manual Delay:=" , "0ps",
"AutoCompCrossAmplitude:=", True,
"CrossingAmplitude:=" , "0mV",
"AutoCompEyeMeasurementPoint:=", True,
"EyeMeasurementPoint:=" , "5e-010s"
])
CreateReportFromTemplate
Create a report from a saved template.
[product]>Results>Report Templates>
UI Access
PersonalLib><TemplateName>
oProject = oDesktop.SetActiveProject("3PhaseRectifier")
oDesign = oProject.SetActiveDesign("3PhaseRectifier")
VB CreateReportFromTemplate "<TemplatePath>"
Syntax
& "ReportTemplates\TestTemplate.rpt"
CreateReportOfAllQuantities
Create a report including all quantities in a category. Cannot create a report with expressions.
UI Access NA
VB
"Modal Solution Data", "Smith Chart", "Setup1 : LastAd-
Exampl- aptive",
e [],"S Parameter",["Freq:=", ["All"], "offset:=",
["All"],"a:=",
["Nominal"],"b:=", ["Nominal"]],[],[])
DeleteMarker
Use:Deletes the specified marker.
Command:[product]>Fields>Fields>Marker>Delete Marker
Syntax:DeleteMarker <MarkerName>
Return Value:None
Parameters:<MarkerName>
Type: <string>
Name of the marker.
VB Example:Dim oAnsoftApp
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Solenoid")
Set oDesign = oProject.SetActiveDesign("Solenoid")
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.DeleteMarker "m1"
DeleteAllReports
Deletes all existing reports.
Right-click the report to delete in the project tree, and then click Delete All
UI Access
Reports on the shortcut menu.
Python oModule.DeleteAllReports()
Example
VB Syntax DeleteAllReports
VB Example oModule.DeleteAllReports
DeleteReports
Deletes an existing report or reports.
Right-click the report to delete in the project tree, and then click Delete on the
UI Access
shortcut menu
VB Syntax DeleteReports(<ReportNameArray>)
VB oModule.DeleteReports Array("Rept2DRectFreq")
Example
DeleteTraces
Deletes an existing traces or traces.
Right-click the Trace to delete in the project tree, and then click Delete on the
UI Access
shortcut menu
VB Syntax DeleteTraces(<TraceSelectionArray>)
oModule.DeleteTraces Array("XY Plot 1:=",
VB
Array("dB(S(LumpPort1,Lump-
Port1))"),
Example
"XY Plot 2:=", Array("Mag_E"))
ExportImageToFile [Reporter]
Export an image in a specified format.
Command: None.
Syntax: ExportImageToFile(<ReportName>,<exportFileName>, <width>, <height>)
Parameters: <ReportName>
Type: <string>
Name of the image file.
<ExportFileName>
Type: <String>
Full path of the exported image file name; with extension of jpg, gif, tiff, tif, bmp, or wrl.
<width>
Type: <int>
Image width in pixels; if width or height is less or equal to zero, use the report window
width, or 500 pixels if report window is closed.
<height>
Type: <int>
Image height in pixels; if width or height is less or equal to zero, use the report window
height, or 500 pixels report window is closed.
For the default, use 0, 0. For higher resolution, set the desired <width> and <height>, for
example for 8k export as 7680, 4320:
VB Example:
Set oProject = oDesktop.SetActiveProject("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
Set oModule = oDesign.GetModule("ReportSetup")
oModule.ExportImageToFile "Rectangular Contour Plot 1", "D:/-
work/2015/UV-Export/pp1.gif", 0, 0
ExportPlotImageToFile [Reporter]
Use: Create field plot exports of existing field plots from a given view points, and with the model
being auto-sized automatically for each view.
Command: None.
Syntax: ExportPlotImageToFile(<FileName>, "", <plotItemName>, <setViewTopDownDir-
ectionByRelativeCS>)
Return Value: An image file.
Parameters: <FileName>
Type: <string>
Full path plus file name.
""
Type: <EmptyString>
<PlotItemName>
Type: <string>
Example:
’This example demonstrates the creation of E-field plots ’of three
different orientations:
’Mag_E1 created in-plane with the XY-plane of the Global ’coordinate
system
’Mag_E2 created in-plane with the XY-plane of the RelativeCS1
coordinate system
’Mag_E3 created in-plane with the XY-plane of the RelativeCS2
coordinate system
Dim oAnsoftApp, oDesktop, oProject, oDesign, oEditor, oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject()
Set oDesign = oProject.GetActiveDesign()
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.
Python oDesign.ExportReport(
Example "Plot1", "c:\report1.dat")
ExportToFile
Note:
The ExportToFile script command has replaced the script command ExportReport.
ExportReport remains in order to retain backward compatibility for existing scripts, but it
is strongly recommended that you now use ExportToFile.
From a data table or plot, generates text format, comma delimited, tab delimited, or .dat type output
files.
Command: Right-click on report name in the Project tree and select Export Data.
Syntax: ExportToFile <ReportName>, <FileName>
Return Value: None
Parameters: <ReportName>
Type: string
<Filename>
Type: string
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.
Python
oModule.ExportToFile(
Example "Plot1", "c:\report1.dat")
ExportMarkerTable
The documented command is applicable for Q3D Extractor.
Use:Exports the marker table to a .csv or .tab file.
Command:[product]>Fields>Fields>Marker>ExportMarkerTable
Syntax:ExportMarkerTable <pathandfilename>
Return Value:none
Parameters:<pathandfilename>
Example:Dim oAnsoftApp
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Solenoid")
Set oDesign = oProject.SetActiveDesign("Solenoid")
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.ExportMarkerTable("C:/work/FieldMarkerTable.csv")
FFTOnReport
Use: Perform an FFT on a selected report.
Command: [product]>Results>Perform FFT on Report
Syntax: FFTOnReport "<plotName>", <FFTWindowType>, "<function>"
Return Value: Creates a plot named FFT "PlotName"
Parameters: <PlotName>
Type: string
<FFTWindowType>
Type: string
Rectangular, Tri, Van Hann, Hamming, Blackman,Lanczos, Weber, Welch.
<function>
Type: string
<none>, ang_deg, ang_rad, arg, cang_deg, cang_rad, dB, dB1 normalize, dB20nor-
malize, dBc, im, mag, normalize, re.
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 3:39:35 PM Mar 16, 2011
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
Set oModule = oDesign.GetModule("Solutions")
oModule.FFTOnReport "XY Plot 1", "Rectangular", "dB"
Type: string
<none>, ang_deg, ang_rad, arg, cang_deg, cang_rad, dB, dB1 normalize, dB20nor-
malize, dBc, im, mag, normalize, re.
Example: Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
Set oModule = oDesign.GetModule("Solutions")
oModule.FFTOnReport "XY Plot 1", "Rectangular", "dB"
GetAllCategories
Get all available category names (not including variable and output-variables) in a solution for a
report type and display type, returned as an array of text strings.
UI Access NA
GetAllCategories(reportTypeArg,displayTypeArg, solutionNameArg,
VB Syntax
simValueCtxtArg, categoryName_array)
categories= oModule.GetAllCategories
VB
("Far Fields", "Rectangular Plot", "Setup1 :
Example
LastAdaptive", "Infini
GetAllReportNames
Gets the names of existing reports in a design
UI Access NA
Python GetAllReportNames()
Syntax
oReportModule = oDesign.GetModule("ReportSetup")
names = oReportModule.GetAllReportNames()
Python
Example for name in names:
AddInfoMessage(str(name))
VB Syntax GetAllReportNames()
VB Dim names
names = oReportModule.GetAllReportNames
For index = 0 to UBound(names)
Example MsgBox(names(index))
Next
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject
Set oDesign = oProject.GetActiveDesign
Set oReportModule = oDesign.GetModule("ReportSetup")
Dim names
names = oReportModule.GetAllReportNames
For index = 0 to UBound(names)
MsgBox(names(index))
Next
Set oFieldReportModule = oDesign.GetModule("FieldsReporter")
Set collection = oFieldReportModule.GetFieldPlotNames
For index = 0 to collection.Count-1
MsgBox(collection.Item(index))
Next
GetAllQuantities
Gets all available quantity names in category, returned as an array of text strings.
UI Access NA
GetAvailableDisplayTypes
All supported display types in report type as an array of text strings.
UI Access NA
Python GetAvailableDisplayTypes(reportTypeArg,displayType_array)
Syntax
VB Syn- GetAvailableDisplayTypes(reportTypeArg,displayType_array)
tax
GetAvailableReportTypes
Get all available report types in the current Design as an array of text string.
UI Access NA
VB reportTypes = oModule.GetAvailableReportTypes()
Example
GetAvailableSolutions
Get all available solutions in report type as an array of text strings.
UI Access NA
Python GetAvailableSolutions(reportTypeArg,solution_array)
Syntax
VB Syn- GetAvailableSolutions(reportTypeArg,solution_array)
tax
GetDataExpressions
Returns data expressions.
UI Access NA
Parameters NA
Return Value Array of text strings
VB Syntax GetDataExpressions()
VB dim expressions
Example expressions = oModule.GetDataExpressions()
GetDataUnits
Returns text string containing units.
UI Access NA
Python oModule.GetDataUnits(expressions)
Example
VB Syntax GetDataUnits(<expressionString>)
VB Example oModule.GetDataUnits(expressions)
GetDesignVariableNames
Returns array of strings containing design variable names.
UI Access NA
Parameters NA
Return Value Array of strings
VB Syntax GetDesignVariableNames()
VB dim names
Example names = oModule.GetDesignVariableNames()
GetDesignVariableUnits
Returns array of strings containing design variable units.
UI Access NA
Python GetDesignVariableUnits(<varName>)
Syntax
VB Syn- GetDesignVariableUnits(<varName>)
tax
VB dim units
Example units = oModule.GetDesignVariableUnits("Variable Name")
GetDesignVariableValue
Returns a design variable's value.
UI Access NA
ableNames()
<siValue> Boolean True to return SI-value; False to return
by GetDesignVariableUnits()
VB dim value
Example value = oModule.GetDesignVariableValue("varName", True)
GetDesignVariationKey
Returns a design's Variation Key.
UI Access NA
Parameters NA
Return Value String containing Variation Key
VB Syntax GetDesignVariationKey()
dim key
VB Example
key = oModule.GetDesignVariationKey()
GetDisplayType
Get the display type of a report.
UI Access NA
Type: <string>
Python GetDisplayType("Standard")
Example
GetImagDataValues
Returns array of imaginary data values.
UI Access NA
Python GetImagDataValues(<expressionString>,<siValue>)
Syntax
VB Syn- GetImagDataValues(<expressionString>,<siValue>)
tax
VB
dim imaginaryvalues
Exampl- imaginaryvalues = oModule.GetImagDataValues("expres-
e sion",True)
GetPerQuantityPrimarySweepValues
Returns per quantity primary sweep values.
UI Access NA
VB GetPerQuantitySweepValues(<expressionString>, <siValue>)
Syn-
tax
VB
dim sweepvalues
Exam- sweepvalues = oModule.GetPerQuantitySweepValues
ple ("0.111,0.201,0.345,0.231", True)
GetPropertyValue
Gets the value of a single property belonging to a specific serverName and PropTab. This function
is available with the Project, Design or Editor objects, including definition editors.
Use the script recording feature and edit a property, and then view the resulting script to
see the format for that property.
UI Access NA
selectionArray = oEditor.GetSelections()
for k in selectionArray:
Python
Exampl- val = oEditor.GetPropertyValue("PassedParameterTab", k,
e "R")
...
selectionArray = oEd-
itor.GetSelections
VB
Examp-
val = oEditor.GetPropertyValue("PassedParameterTab", k,
le
"R")
...
next
oModule = oDesign.GetModule("ReportSetup")
Python
Example oModule.GetPropertyValue("Trace", "S Parameter Plot
1:dB(S(1,1))","Y Axis")
VB Example:
value_string = _
oEditor.GetPropertyValue("Geometry3DCmdTab",_
"Box1:CreateBox:1", "XSize")
VB Example:value_string = _
oEditor.GetPropertyValue("BaseElementTab",_
"rect_1", "Name")
GetRealDataValues
Returns array of real data values.
UI Access NA
Python GetRealDataValues(<expressionString>,<siValue>)
Syntax
VB Syn- GetRealDataValues(<expressionString>,<siValue>)
tax
VB dim realvalues
Example realvalues = oModule.GetRealDataValues("expression",True)
GetReportTraceNames
Use: Gets the names of existing trace names in a plot.
Syntax: GetReportTraceNames("<plot name>")
Return Value: Array of trace names for a named plot.
Parameters: <PlotName>
Type: <string>
Name of plot.
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject
Set oDesign = oProject.GetActiveDesign
Set oReportModule = oDesign.GetModule("ReportSetup")
Dim names
names = oReportModule.GetReportTraceNames("Sparameter Plot 1")
MsgBox(names(index))
Python GetReportTraceNames()
Syntax
oReportModule = oDesign.GetModule("ReportSetup")
names = oReportModule.GetReportTraceNames("SParameter Plot
Python
Exampl-
1")
e for name in names:
AddInfoMessage(str(name))
GetSolutionContexts
Get all available solution context names in a solution as an array of text strings.
UI Access NA
GetSolutionDataPerVariation
Obtains solution data for a given report type and solution. You must have already run a simulation.
UI Access N/A
l GetSweepNames()
l GetSweepUnits()
l GetSweepValues()
l IsPerQuantityPrimarySweep()
l GetDataExpressions() – should be the same as <expressionArg>
l GetPerQuantityPrimarySweepValues()
l IsDataComplex()
Return Value
l GetDataUnits()
l GetRealDataValues()
l GetImagDataValues()
l ReleaseData()
l GetDesignVariableNames()
l GetDesignVariableUnits()
l GetDesignVariableValue()
l GetDesignVariationKey()
Note:
l This command is not recordable from the UI, but its parameters are similar to
CreateReport, so you may record a CreateReport script to get the parameter val-
ues.
l Boolean SI Value parameter defaults to True. When the pass in value is True,
return data values will be in Standard International values; when False, return data
values will be in the current units.
GetSolutionDataPerVariation(reportTypeArg, solutionNameArg,
VB Syntax
simValueCtxtArg, pointSetArg, expressionArg)
dim domain (2)
domain(0) = "Domain:="
domain(1) = "Sweep"
dim all (1)
all(0) = "All"
VB Example dim freq (3)
freq(0) = "Freq:="
freq(1) = all
freq(2) = "offset:="
freq(3) = all
dim pointSetArg (2)
pointSetArg(0) = domain
pointSetArg(1) = freq
dim expressionArg (2)
expressionArg(0) = "S(Port1,Port1)"
expressionArg(1) = "dB(S(Port1,Port3))"
dim solutionData = oMod-
ule.GetSolutionDataPerVariation("Modal Solution
Data", "Setup1 : Sweep", pointSetArg, expressionArg)
GetSweepNames
Returns array of text strings containing primary sweep name(s).
UI Access NA
Parameters NA
Return Value Array of text strings
VB Syntax GetSweepNames()
dim sweepnames
VB Example
sweepnames = oModule.GetSweepNames()
GetSweepUnits
Returns text string containing units.
UI Access NA
VB Syntax GetSweepUnits(<sweepName>)
VB dim sweepunits
Example sweepunits = oModule.GetSweepUnits("Sweep 1")
GetSweepValues
Returns sweep values.
UI Access NA
VB dim sweepvalues
Example sweepvalues = oModule.GetSweepValues("Sweep 1", True)
GroupPlotCurvesByGroupingStrategy
Groups curves in a Stacked Plot automatically based on a curve grouping strategy.
ImportIntoReport
Imports .tab, .csv, and .dat format files into a report.
UI Access Right-click on report name in the Project tree and select Export Data.
IsDataComplex
Returns whether an expression is complex.
UI Access NA
Python oModule.IsDataComplex('.001,.234,.455,.434')
Example
VB Syntax IsDataComplex(<expressionString>)
VB oModule.IsDataComplex('.001,.234,.455,.434')
Example
IsPerQuantityPrimarySweep
Returns whether data expressions have different primary sweep values.
UI Access NA
Parameters NA
Return Value Boolean (True if data expressions have different primary sweep values)
Python oModule.IsPerQuantityPrimarySweep()
Example
VB Syntax IsPerQuantityPrimarySweep()
VB Example oModule.IsPerQuantityPrimarySweep()
MovePlotCurvesToGroup
In a Stacked Plot move curve(s) from its stack(s) to an existing stack. Here term ‘group’ is syn-
onymous to ‘stack’ in the context of cartesian stacked plot.
Command: Move Plot Curves to Group
Syntax: MovePlotCurvesToGroup("<reportName>",["<curve1-name>", "<curve2-name>",...],
"<stack-name>")
Return Value: None
Parameters: <ReportName>
Type: <string>
Report name.
<curveN_name>
Type: <string>
Trace name.
<"stack-name">
Type: <string>
Stack name.
MovePlotCurvesToNewGroup
In a Stacked Plot move curve(s) from its stack(s) to anew stack. Here term ‘group’ is synonymous
to ‘stack’ in the context of Cartesian stacked plot.
Command: Move Plot Curves to New Group
Syntax: MovePlotCurvestoNewGroup("<reportName>",["<curve1-name>", "<curve2-name>",...],
"<stack-name>")
Return Value: None
Parameters: <ReportName>
Type: <string>
Report name.
<curveN_name>
Type: <string>
Trace name.
<"stack-name">
Type: <string>
Stack name.
PasteReports
Paste copied reports to results in the current project.
UI Access Edit>Paste
Python oModule.PasteReports()
Example
VB Syntax PasteReports
VB Example oModule.PasteReports
PasteTraces
To paste copied traces to a named plot.
UI Access Paste
tax
Release Data
Releases all cached data. After this function is called, all subsequent function calls to the object will
fail.
UI Access NA
Parameters NA
Return Value NA
Python oModule.ReleaseData()
Example
VB Syntax ReleaseData()
VB Example oModule.ReleaseData()
RenameReport
Renames an existing report.
UI Access Select a report on the Project tree, right-click and select Rename
RenameTrace
To rename a trace in a plot
UI Access NA
Python
oModule.RenameTrace ("XY Plot1",
Example "dB(S(WavePort1,WavePort1))1",_ "Port1dbS")
VB
oModule.RenameTrace "XY Plot1",
Example "dB(S(WavePort1,WavePort1))1",_ "Port1dbS"
ResetPlotSettings
Resets plot settings to defaults.
SavePlotSettingsAsDefault
Saves report plot settings as default.
VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2017.1.0
' 13:53:30 Feb 10, 2017
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
Set oModule = oDesign.GetModule("ReportSetup")
oModule.SavePlotSettingsAsDefault "XY Plot 1"
UpdateTraces
Update the traces in a report for which traces are not automatically updated by the Report Traces
dialog, Update Report, Real Time selection.
<DomainType>)
<DomainType>
ex. "Sweep" or "Time"
<Context> Array Array("Context:=", <Geo-
metryType>)
<GeometryType>
ex. "Infinite Spheren", "Spheren",
"Polylinen"
<FamiliesArray> Array of Contains sweep defin-
strings itions for the report.
Array("<Vari-
ableName>:= ", <ValueAr-
ray>)
<ValueArray> Array Array("All") or Array
("Value1", "Value2",
..."Valuen")
examples of <Vari-
ableName>
"Freq", "Theta",
"Distance"
<ReportDataArray> Array of This array contains the
Strings report quantity and X, Y,
and (Z) axis definitions.
Array("X Component:=",
<VariableName>, "Y
Component:=", <Vari-
ableName> |
<ReportQuantityArray>)
<ReportQuant- Array ex. Array("dB(S(Port1, Port1))")
ityArray>
Array() Empty Denotes the end of the
Array UpdateTraces Command
Return None
Value
[
"NAME:Context",
"SimValueContext:=", [2,0,2,0,False,False,_
-
1,1,0,1,1,"",0,0,"CG",False,"0","KP",False,"0","MH",False,_
"100","TE",False,"100s","TH",False,"40",
"TS",False,"0ns","UF",False,_
"0","WT",False,"0","WW",False,"100"]
Exampl-
],
e
[
"Spectrum:=", ["All"]
],
[
"X Component:=", "Spectrum",
"Y Component:=", ["mag(NEG1.VAL)"]
], [])
Update the traces in a report for which traces are not automatically updated by the Report Traces
dialog, Update Report, Real Time selection.
Command: Report dialog, Apply Traces button
Syntax: UpdateTraces "<plotName>" Array("<TraceDef>") Array()
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.
<SolutionName>
Type: <string>
Name of the solution as listed in the Modify Report dialog box.
For example: "Setup1 : Last Adaptive"
<ContextArray>
Type: Array of strings
Context for which the expression is being evaluated. This can be an empty string if there
is no context.
Array("Domain:=", <DomainType>)
<DomainType>
ex. "Sweep" or "Time"
Array("Context:=", <SimValueContext>)
Context for the trace. For more information see SimValueContext.
<FamiliesArray>
Type: Array of strings
Contains sweep definitions for the report.
Array("<VariableName>:= ", <ValueArray>)
<ValueArray>
Array("All") or Array("Value1", "Value2", ..."Valuen")
examples of <VariableName>
"Freq", "Theta", "Distance"
<ReportDataArray>
Type: Array of strings
This array contains the report quantity and X, Y, and (Z) axis definitions.
Array("X Component:=", <VariableName>, "Y Component:=", <VariableName> |
<ReportQuantityArray>)
<ReportQuantityArray>
ex. Array("dB(S(Port1, Port1))")
Array()
Type: Empty array.
Denotes the end of the UpdateTraces command.
VB Example:
Set oModule = oDesign.GetModule("ReportSetup")
oModule.UpdateTraces "XY Plot1", _ Array("dB(S
(WavePort1,WavePort1))"), _
"Setup1 : Sweep1", _
Array("Domain:=", "Sweep"), _
Array("Freq:=", Array("All")), _
Array("X Component:=", "Freq", _
"Y Component:=", Array("dB(S(WavePort1,WavePort1))")), _
Array()
VB Example:
oModule.UpdateTraces "XY Plot 1", Array("dB(S
(WavePort1,WavePort1))"), _
"Setup1 : Sweep1", _
Array("Domain:=", "Time", "HoldTime:=", 1, _
"RiseTime:=", 0, "StepTime:=", 0, "Step:=", false, _
"WindowWidth:=", 1, _
"WindowType:=", 0, "KaiserParameter:=", 1, _
"MaximumTime:=", 0), _
Array("Time:=", Array("All")), _
Array("X Component:=", "Time", _
"Y Component:=", Array("dB(S(WavePort1,WavePort1))")), _
Array()
Array("Context:=", <GeometryType>)
<GeometryType>
ex. "Spheren", "Polylinen"
<FamiliesArray>
Type: Array of strings
Contains sweep definitions for the report.
Array("<VariableName>:= ", <ValueArray>)
<ValueArray>
Array("All") or Array("Value1", "Value2", ..."Valuen")
examples of <VariableName>
"Freq"
<ReportDataArray>
Type: Array of strings
This array contains the report quantity and X, Y, and (Z) axis definitions.
Array("X Component:=", <VariableName>, "Y Component:=", <VariableName> |
<ReportQuantityArray>)
<ReportQuantityArray>
ex. Array("ACR(trace:src1, trace:src1)")
Array()
Type: Empty array.
Denotes the end of the UpdateTraces command.
VB Example: Set oModule = oDesign.GetModule("ReportSetup")
oModule.UpdateTraces "XY Plot1", _ Array("ACR(trace:src1,
trace:src1)"), _ "Setup1 : Sweep1", _
Array("Context:=", "Original"), _
Array("Freq:=", Array("All")), _
Array("X Component:=", "Freq", _
"Y Component:=", Array("ACR(trace:src1, trace:src1)"), _
Array()
UpdateTracesContextandSweeps
Use this command to edit sweeps and context of multiple traces without affecting their component
expressions.
Python UpdateTracesContextandSweeps()
Syntax
oModule.UpdateTracesContextAndSweeps_
("Active S Parameter Quick Report",_
["dB(ActiveS(Port1:1))", "dB(ActiveS(Port2:1))"],_
"Setup1 : Sweep1", [], _
["Freq:=", _
Python
Example ["9GHz", "9.05GHz", "9.1GHz",
"9.15GHz", "9.2GHz", _
"9.25GHz", "9.3GHz", "9.35GHz", _
"9.4GHz", "9.45GHz", "9.5GHz",
"9.55GHz", _
VB Syntax UpdateTracesContextandSweeps
oModule.UpdateTracesContextAndSweeps_
"Active S Parameter Quick Report",_
Array( _
"dB(ActiveS(Port1:1))", "dB(ActiveS(Port2:1))"),_
"Setup1 : Sweep1", Array(), _
Array("Freq:=", _
Array( _
"9GHz", "9.05GHz", "9.1GHz",
VB
Example "9.15GHz", "9.2GHz", _
"9.25GHz", "9.3GHz", "9.35GHz", _
"9.4GHz", "9.45GHz", "9.5GHz",
"9.55GHz", _
"9.6GHz", "9.65GHz", "9.7GHz",_
"9.75GHz", "9.8GHz", "9.85GHz",
"9.9GHz", "9.95GHz", "10GHz"),_
"off-
set:=", Array("All"))
oModule.UpdateTracesContextAndSweeps _
"C Matrix Quick Report", _
Array( _
"C(trace, trace)", "C(gnd, gnd)"), _
"Setup1 : Sweep1", Array ("Context:=", "Original")
Array("Freq:=", _
Array("All"))
UpdateAllReports
Updates all reports in the Results branch in the project tree.
Python
oModule = oDesign.GetModule("ReportSetup")
Example oModule.UpdateAllReports()
VB Syntax UpdateAllReports ()
VB
Set oModule = oDesign.GetModule("ReportSetup")
Example oModule.UpdateAllReports
UpdateReports
Updates the specified reports in the Results branch in the project tree.
Update Report
UI Access NA
Python UpdateReports(["<plotname>"])
Syntax
UnGroupPlotCurvesInGroup
From a Stacked Plot ungroup curves in a stack, that is, curves in that stack are ungrouped and are
shown in their own stacks.
Command: UnGroup Plot Curves in ...
Syntax: oModule.UngroupPlotCurvesInGroup("<report-name>", "<stack-name>")
Return Value: None
Parameters: <ReportName>
Type: <string>
Report name.
<"stack-name">
Type: <string>
Stack name.
Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2018.0.0
' 15:35:40 Nov 15, 2017
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("CoaxBend14_1")
Set oDesign = oProject.SetActiveDesign("Transient")
Set oModule = oDesign.GetModule("ReportSetup")
oModule.GroupPlotCurvesByGroupingStrategy "Transient Plot 1", "Single"
"Faces:=", <AssignmentFaces>)
Return Value: None
VB Example:
oModule.AddAssignmentTOBoundary Array("NAME:PerfE1",_
"Objects:=", Array("Box2", "Box3"),_
"Faces:=", Array(12, 11))
oModule.AddAssignmentToBoundary([ "NAME:SBR1", "Objects:=" , ["Fusel-
age"] ])
For Q3D Extractor, the command details are as follows:
Use: Specifies a new geometry assignment for a boundary.
Command: Q3D Extractor>Nets>Reassign>Net
Syntax: AddAssignmentToBoundary Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Return Value: None
VB Example: oModule.AddAssignmentToBoundary Array("NAME:Net1",_
"Objects:=", Array("Box2", "Box3"),_
"Objects:=", Array("Box3", "Box4"))
oModule.AddAssignmentToBoundary ((
[
Python
"NAME:PerfE1",
Example
"Faces:=" , [12]
])
AutoIdentifyNets
Use: Automatically identifies nets.
Command: Q3D Extractor>Nets>Auto Identify Nets
Syntax: AutoIdentifyNets
Return Value: None
Command: oModule.AutoIdentifyNets
AutoIdentifyPorts
Use: Automatically assign ports and terminals in a terminal design.
Command: HFSS>Excitations>Assign>Wave Port|Lumped Port
Syntax: AutoIdentifyPorts <FaceIDArray> <IsWavePort>, <ReferenceConductorsArray>
<BaseNameforCreatedPorts> <UseConductorNamesAsBaseNameforTerminals>
Return Value: None.
Parameters: <FaceIDArray>
Array("NAME:Faces", <FaceID>, <FaceID>, ...)
<IsWavePort>
Type: Boolean
true = waveport, false = lumped port
<ReferenceConductorsArray>
Array("NAME:ReferenceConductors", <ConductorName>, <ConductorName>, ...)
<BaseNameforCreatedPorts>
Type: <string>
<empty string> = default name for the wave or lumped port, <string> = base name to
use for created ports
<UseConductorNamesAsBaseNameforTerminals>
Type: Boolean
true = use conductor names, false = use port object name as base name
VB Example:
Set oModule = oDesign.GetModule("BoundarySetup"
oModule.AutoIdentifyPorts Array("NAME:Faces", 52), true, _ Array
("NAME:ReferenceConductors", "Conductor1") true
AutoIdentifyTerminals
Use: Automatically identify the terminals within the given ports.
Command: HFSS>Excitations>Assign>Auto Assign Terminals
Syntax: AutoIdentifyTerminals <ReferenceConductorsArray>, <PortNames> <UseCon-
ductorNamesAsBaseNameforTerminals>
Return Value: None
Parameters: <ReferenceConductors>
Array("NAME:ReferenceConductors", <ConductorName>, <ConductorName>, ...)
<portNames>
List of names.
<UseConductorNamesAsBaseNameforTerminals>
Type: Boolean
true = use conductor names, false = use port object name as base name
VB Example:
Set oModule = oDesign.GetModule("BoundarySetup"
oModule.AutoIdentifyTerminals Array("NAME:ReferenceConductors", "Con-
ductor1"), "WavePort1" true
ChangeImpedanceMult
Use: Modifies the port impedance multiplier.
Command: HFSS>Excitations>Edit Impedance Mult
Syntax: ChangeImpedanceMult <MultVal>
Return Value: None
Parameters: <MultVal>
Type: <value>
New value for the impedance multiplier.
VB Example:
oModule.ChangeImpedanceMult 0.5
ConvertNportCircuitElementsToPorts
Use: Converts one or more HFSS Circuit Element to one or more ports.
Command: Right-click on element and select Convert to HFSS Ports
Syntax: ConvertNportCircuitElementToHFSSPorts Array("<name> ")
Return Value: None
VB Example:
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.ConvertNportCircuitElementToPorts Array("Nport1")
oModule.ConvertNportCircuitElementToPorts Array("Nport2")
oModule = oDesign.GetModule("BoundarySetup")
Python
oModule.ConvertNportCircuitElementToPorts(["Nport1"])
Example
oModule.ConvertNportCircuitElementToPorts(["Nport2"])
CreateNportCircuitElements
Use: Creates an HFSS Circuit Element from one or more ports..
Command: Right-click Circuit Elements>Create Single Port Model... or
Circuit Elements>Create Multi-Terminal Model...
Syntax: CreateNportCircuitElement("NAME:<Nportn>", "Definition:=" , "Model", [ "NAME:Assign-
ments", ["NAME: <ID>", Assign:=" , <ID>,] [...] ]
Return Value: None
VB Example:
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.CreateNportCircuitElement Array("NAME:Nport1", "Defin-
ition:=", "Model", Array("NAME:Assignments", Array("NAME:Model",
"Assign:=", "1")))
oModule.CreateNportCircuitElement(
[
"NAME:Nport1",
"Definition:=" , "Model",
[
"NAME:Assignments",
[
"NAME:Model",
"Assign:=" , "1"
]
]
Python
])
Example
oModule.CreateNportCircuitElement(
[
"NAME:Nport2",
"Definition:=" , "Model2",
[
"NAME:Assignments",
[
"NAME:P01__NET179__T1",
"Assign:=" , "2"
],
[
"NAME:P02__NET178__T1",
"Assign:=" , "3"
],
[
"NAME:P03__NET178__T1",
"Assign:=" , "4"
],
[
"NAME:P04__NET179__T1",
"Assign:=" , "5"
]
]
])
DeleteAllBoundaries
Use: Deletes all boundaries.
Command: [product]>Boundaries>Delete All
Syntax: DeleteAllBoundaries
Return Value: None
VB Example: oModule.DeleteAllBoundaries
For Q3D Extractor or 2D Extractor, the DeleteAllBoundaries command has the following
details.
Use: Delete all the boundaries
Command: Q3D Extractor>Boundary>Delete All or 2D Extractor>Boundary>Delete All
Syntax: DeleteAllBoundaries
Return Value: None
VB Example: oModule.DeleteAllBoundaries
DeleteAllExcitations
Use: Deletes all excitations.
Command: [product]>Excitations>Delete All
Syntax: DeleteAllExcitations
Return Value: None
VB Example:
oModule.DeleteAllExcitations
For Q3D Extractor or 2D Extractor, the DeleteAllExcitations command has the following
details.
Use: Deletes all excitations.
Command: Q3D Extractor>Nets>Delete All or 2D Extractor>Conductor>Delete All
Syntax: DeleteAllExcitations
Return Value: None
VB Example: oModule.DeleteAllExcitations
DeleteBoundaries
Use: Deletes the specified boundaries and excitations.
Command: Delete command in the List dialog box. Click [product]>List to open the List dialog
box.
Syntax: DeleteBoundaries <NameArray>
Return Value: None
Parameters: <NameArray>
Type: Array of strings
An array of boundary names.
VB Example:
oModule.DeleteBoundaries Array("PerfE1", "WavePort1")
For Q3D Extractor, the DeleteBoundaries command has the following details.
Use: Deletes the specified boundaries and excitations.
Command: Delete command in the List dialog box. Click Q3D Extractor or 2D Extractor>List
to open the List dialog box. Or, use the 2D Extractor>Conductor>Delete command.
Syntax: DeleteBoundaries <NameArray>
Parameters: <NameArray>
Type: Array of strings
GetBoundaryAssignment
Use: Gets a list of face IDs associated with the given boundary or excitation assignment.
Syntax: GetBoundaryAssignment(<BoundaryName>)
Return Value: Returns integer array of face IDs.
Parameters: <BoundaryName>
Type: <string>
Previously defined boundary or excitation name.
VB Example:
list = oModule.GetBoundaryAssignment("Rad1")
GetBoundaries
Use: Gets boundary names for a project.
Syntax: GetBoundaries()
Return Value: Array of boundary names.
Parameters: None
VB Example:
bndinfo_array = oModule.GetBoundaries()
GetBoundariesOfType
Use: Gets boundary names of the given type.
Syntax: GetBoundariesOfType(<BoundaryType>)
Return Value: Array of boundary names of the given type.
Parameters: <BoundaryType>
Type:<string>
Name of legal boundary type.
For example: "Radiation".
VB Example:
bndname_array = oModule.GetBoundariesOfType("Perfect E")
GetDefaultBaseName
Use: Gets the default base name for boundaries for a project.
Syntax: GetDefaultBaseName <BoundaryType>
Return Value: String of boundary default base name.
Parameters: <BoundaryType>
Type:<string>
Name of legal boundary type.
For example: "Radiation".
VB Example:
bnddefault_BaseName = oModule.GetDefaultBaseName "Radiation"
GetExcitations
Gets excitation port and terminal names for a model.
Syntax: GetExcitations()
Return Value: Pairs of strings. The first is the name of the excitation (e.g. "port1:1") and the second
is its type ("Wave Port")
Parameters: None
VB Example:
excite_name_array = oModule.GetExcitations()
GetExcitationsOfType
Gets excitation names of the given type.
Syntax: GetExcitationsOfType(<ExcitationType>)
GetNumBoundaries GetNumBoundaries
Gets the number of boundaries in a design.
Syntax: GetNumBoundaries()
Return Value: Integer count
Parameters: None
VB Example:
numbound = oModule.GetNumBoundaries()
GetNumBoundariesOfType
Gets the number of boundaries of the given type.
Syntax: GetNumBoundariesOfType(<BoundaryType>)
Return Value: Integer count
Parameters: <BoundaryType>
Type: <string>
VB Example:
numbound = oModule.GetNumBoundariesOfType("Perfect E")
GetNumExcitations
Gets the number of excitations in a design, including all defined modes and terminals of ports.
Syntax: GetNumExcitations()
Return Value: Integer count
Parameters: None
VB Example:
numexcite = oModule.GetNumExcitations()
GetNumExcitationsOfType
Gets the number of excitations of the given type, including all defined modes and terminals of ports.
Syntax: GetNumExcitationsOfType(<ExcitationType>)
Return Value: Integer count
Parameters: <ExcitationType>
Type: <string>
VB Example:
numexcite = oModule.GetNumExcitationsOfType("Voltage")
GetPortExcitationCounts
Gets all port names and corresponding number of modes/terminals for each port excitation.
Syntax: GetPortExcitationCounts()
Return Value: Array of port names (Type: <string>) and corresponding mode/terminal counts
(Type: <integer>).
Parameters: None
VB Example:
portinfo = oModule.GetPortExcitationCounts()
ReassignBoundary
Use: Specifies a new geometry assignment for a boundary.
Command: Click Boundaries>Reassign or Excitations>Reassign
Syntax: ReassignBoundary Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Return Value: None
VB Example:
oModule.ReassignBoundary Array("NAME:PerfE1",_
oModule.ReassignBoundary ((
Python [
Example "NAME:PerfE1",
"Faces:=" , [12]
])
RemoveAssignmentFromBoundary
Use: Removes a geometry assignment from a boundary.
Command: Click Boundaries>Reassign or Excitations>Reassign
Syntax: RemoveAssignmentFromBoundary Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Return Value: None
VB Example:
oModule.RemoveAssignmentFromBoundary Array("NAME:PerfE1",_
"Objects:=", Array("Box2", "Box3"),_
"Faces:=", Array(12, 11))
oModule.RemoveAssignmentFromBoundary([ "NAME:SBR1", "Objects:=" ,
["Fuselage"] ])
For Q3D Extractor, the command details are as follows:
Use: Removes a geometry assignment from a boundary.
Command: Q3D Extractor>Nets>Reassign>Net
Syntax: RemoveAssignmentFromBoundary Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
Return Value: None
VB Example: oModule.RemoveAssignmentFromBoundary Array("NAME:Net1",_
"Objects:=", Array("Box2", "Box3"),_
"Objects:=", Array("Box3", "Box4"))
"Faces:=", <AssignmentFaces>)
Return Value: None
VB Example: oModule.RemoveAssignmentFromBoundary Array("NAME:Rect-
angle2",
"Objects:=", Array("Rectangle3"))
RenameBoundary
Use: Renames a boundary or excitation.
Command: Right-click a boundary in the project tree, and then click Rename on the shortcut
menu.
Syntax: RenameBoundary <OldName>, <NewName>
Return Value: None
Parameters: <OldName>
Type: <string>
<NewName>
Type: <string>
VB Example:
oModule.RenameBoundary "PerfE1" "PerfE"
For Q3D Extractor, the RenameBoundary command details are as follows:
Use: Renames an excitation.
Command: Right-click a net/terminal in the project tree, and then click Rename on the shortcut
menu.
Syntax: RenameBoundary <OldName>, <NewName>
Return Value: None
Parameters: <OldName>
Type: <string>
<NewName>
Type: <string>
VB Example: oModule.RenameBoundary "Net1" "Net2"
VB Example: oModule.RenameBoundary "Rectangle4" "VCC"
ReprioritizeBoundaries
Use: Specifies the order in which the boundaries and excitations are recognized by the solver. The
first boundary in the list has the highest priority. Note: this command is only valid if all defined bound-
aries and excitations appear in the list. All ports must be listed before any other boundary type.
Command: HFSS>Boundaries>Reprioritize
Syntax: ReprioritizeBoundaries <NewOrderArray>
Return Value: None
Parameters: <NewOrderArray>
Array("NAME:NewOrder", <BoundName>, <BoundName>, ...)
VB Example:
oModule.ReprioritizeBoundaries Array("NAME:NewOrder", _
"Imped1", "PerfE1", "PerfH1")
SetDefaultBaseName
Use: Sets the default base name for boundaries for a project.
Syntax: SetDefaultBaseName <BoundaryType>, <DefaultName>
Return Value: String of boundary default base name.
Parameters: <BoundaryType>
Type:<string>
Name of legal boundary type.
For example: "Radiation".
<NewName>
Type: <string>
VB Example:
bnddefault_BaseName = oModule.SetDefaultBaseName "Radiation",_
"RadBnd"
CircuitPortToLumpedPort
EditCircuitPort [HFSS]
EditCurrent
EditDiffPairs
EditFiniteCond
EditHalfSpace
EditHybridRegion
EditImpedance
EditIncidentWave
EditLayeredImpedance
EditMaster
EditPerfectE
EditPerfectH
EditLumpedPort
EditLumpedRLC
EditMagneticBias
EditNPortCircuitElement
EditRadiation
EditSlave
EditSymmetry
EditTerminal
EditVoltage
EditWavePort
LumpedPortToCircuitPort
SetHybridRegionCoupledGroup
SetTerminalReferenceImpedances
SwapCircuitPortAssignment
UnassignIERegions
AssignCircuitPort
Use: Assigns a circuit port for a driven terminal or driven modal design in HFSS.
VB Example:
oModule.AssignCircuitPort Array("NAME:1",
"Edges:=", Array(50, 56), _
"Impedance:=", "50ohm", _
"DoDeembed:=", true, _
"RenormalizeAllTerminals:=", true,_
"TerminalIDList:=", Array())
oModule.AssignCircuitPort(
[
"NAME:1",
])
AssignCurrent
Use: Creates a current source.
Command: [product]>Excitations>Assign>Current
Syntax: AssignCurrent <CurrentArray>
Return Value: None
Parameters: <CurrentArray>
Array("NAME:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Current:=", <value>,
<DirectionArray>,
"Faces:=", <AssignmentFaces>)
<DirectionArray>
Array("NAME:Direction",
"Start:=", <LineEndPoint>,
"End:=", <LineEndPoint>)
Example:
oModule.AssignCurrent Array("NAME:Current1",_
"Current:=", "1000mA",_
Array("NAME:Direction",_
"Start:=", Array(-0.4, 0.4, -1.6),_
"End:=", Array(-0.4, 0.4, 0)), _
"Faces:=", Array(12))
AssignDielectricCavity
Use: Assign a Hybrid Region as a Dielectric Cavity.
Command: HFSS>Hybrid>Assign Hybrid>Dielectric Cavity
Syntax: AssignDielectricCavity Array(<name><"geometryName">)
Return Value: None
Parameters: <GeometryName>
Type: String
Name of the FEBI Hybrid Region.
<GeometryName>
Type: String
Name of the geometry assigned as Dielectric Cavity Region.
<"geometryName">
VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2017.0.0
' 14:50:08 Aug 12, 2016
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project17")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oModule.AssignDielectricCavity Array("NAME:Cavity1", "Objects:=",
Array("Cylinder1"))
AssignFEBI
Assign a Hybrid Region as a FEBI.
Command: HFSS>Hybrid>Assign Hybrid>FEBI
Syntax: AssignFEBI Array(<name><"geometryName">)
Return Value: None
Parameters: <name>
Type: String
Name of the FEBI Hybrid Region.
<name>
Type: String
Name of the geometry assigned as FEBI Hybrid Region.
<"geometryName">
VB Example:
' Script Recorded by ANSYS Electronics Desktop Version 2017.0.0
' 14:53:22 Aug 12, 2016
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project17")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignFEBI Array("NAME:FE-BI1", "Objects:=", Array("Regu-
larPolyhedron1"))
AssignFiniteCond
Use: Assign a single finite conductivity boundary on selected edges.
Command: 2D Extractor>Boundary>Assign>Finite Conductivity
Syntax: AssignFiniteCond Array("NAME:<Name>", "Edges:=", Array(<edge ids>), <Fin-
iteCondParameters>)
Return Value: none
Parameters: <Name>
Type:<String>
Name of the boundary
<edge ids>
Type:<integer list>
List of edge ids, separated by comma.
<FiniteCondParameters>
Parameters:
"Roughness:=", "<Roughness>", "UseCoating:=", <UseCoating>, "Lay-
erThickness:=", "<Thickness>", "UseMaterial:=", <UseMaterial>,
"Material:=", "<MaterialName>"
<Roughness>
Type: <String>
Value: double with units of length
<UseCoating>
Type: <Boolean>
Value: true or false
<Thickness>
Type: String
Value: double with units of length
<UseMaterial>
Type:<Boolean>
Value: true or false
<MaterialName>
Type: String
Value: specify material name for coating.
<Radius>
Type: String
Value: double with units of length.
<Ratio>
Type: String
Value: double.
AssignFloquet
Create a Floquet port.
Command: HFSS>Excitations>Assign>Floquet
Syntax: AssignFloquetPort <FloquetPortArray>
Return Value: None.
Parameters: <FloquetPortArray>
Array("NAME:<BoundName>",
"Faces:=", <FaceIDArray>,
<ModesArray>,
"NumModes:=", <Int>,
"RenormalizeAllTerminals:=", <Boolean>,
"DoDeembed:=", <Boolean>,
Array("NAME:Modes", Array("NAME:Mode1",
"ModeNum:=", <Int>,
"UseIntLine:=", <Boolean>),
Array("NAME:Mode2", "ModeNum:=", <Int>,
"UseIntLine:=", <Boolean>)),
"ShowReporterFilter:=", <Boolean>,
"UseScanAngles:=", <Boolean>,
"Phi:=", "<numdeg>",
"Theta:=", "<numdeg>",
Array("NAME:LatticeAVector",
"Start:=", Array("<num><units>", "num><units>", "<num><units>"),
"End:=", Array("<num><units>", "num><units>", "<num><units>")),
Array("NAME:LatticeBVector",
"Start:=", Array("<num><units>", "num><units>", "<num><units>"),
"End:=", Array("<num><units>", "num><units>", "<num><units>")),
Array("NAME:ModesCalculator",
"Frequency:=", "<Value>GHz",
"FrequencyChanged:=", <Boolean>,
"PhiStart:=", "<num>deg",
"PhiStop:=", "<num>deg",
"PhiStep:=", "<num>deg",
"ThetaStart:=", "<num>deg",
"ThetaStop:=", "<num>deg",
"ThetaStep:=", "<num>deg"),
Array("NAME:ModesList",
Array("NAME:Mode",
"ModeNumber:=", <ModeID>,
"IndexM:=", <Index>,
"IndexN:=", <Index>,
"KC2:=", <value>,
"PropagationState:=", "Propagating",
"Attenuation:=", 0,
"PolarizationState:=", "TE",
"AffectsRefinement:=", <Boolean>),
Array("NAME:Mode",
"ModeNumber:=", <ModeID>,
"IndexM:=", <Index>,
"IndexN:=", <Index>,
"KC2:=", <value>,
"PropagationState:=", "<Propagating>",
"Attenuation:=", <value>,
"PolarizationState:=", "<TE or TM>",
"AffectsRefinement:=", <Boolean>)))
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 13.0.0
' 1:54:11 PM Jun 15, 2010
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project44")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignFloquetPort Array("NAME:FloquetPort1",
"Faces:=", Array(7),
"NumModes:=", 2,
"RenormalizeAllTerminals:=", true,
"DoDeembed:=", false,
AssignHalfSpace
Use: Assign a Half Space boundary, dividing the background material at a specified Z axis point.
You also assign a material, typically to the lower half.
Command: Assign Half Space
AssignIERegion
Assign an IE Region to a conductor contained within a FEBI Radiation boundary.
Command: Assign IE Region
Syntax: AssignIERegion <"geometryName">
Return Value: None
Parameters: <GeometryName>
Type: String
Name of the geometry assigned as an IE Region.
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 2:26:27 PM Mar 07, 2011
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project58")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignIERegion "Box1"
AssignImpedance
Use: Creates an impedance boundary for an HFSS design.
Command: [product]>Boundaries>Assign>Impedance
Syntax: AssignImpedance <ImpedanceArray>
Return Value: None
Parameters: <ImpedanceArray>
Array("NAME:<BoundName>",
"Resistance:=", <value>,
"Reactance:=", <value>,
"InfGroundPlane:=", <bool>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
VB Example:
oModule.AssignImpedance Array("NAME:Imped1",_
"Resistance:=", "50",_
"Reactance:=", "50",_
"InfGroundPlane:=", false,_
"Faces:=", Array(12))
AssignIncidentWave
Use: Creates an incident wave excitation.
Command: HFSS>Excitations>Assign>IncidentWave
Syntax: AssignIncidentWave <IncidentWaveArray>
Return Value: None
Parameters: <IncidentWaveArray>
Array("NAME:<BoundName>",
"IsCartesian:=",<bool>
"EoX:=", <value>,
"EoY:=", <value>,
"EoZ:=", <value>,
"kX:=", <value>,
"kY:=", <value>,
"kZ:=", <value>
"PhiStart:=",<value>,
"PhiStop:=", <value>,
"PhiPoints:=", <int>,
"ThetaStart:=", <value>,
"ThetaStop:=", <value>,
"ThetaPoints:=", <int>,
"EoPhi:=", <value>,
"EoTheta:=", <value>)
IsCartesian
If true, provide the EoX, EoY, EoZ, kX, kY, kZ parameters.
AssignLayeredImp
Use: Creates a layered impedance boundary.
Command: HFSS>Boundaries>Assign>Layered Impedance
Syntax: AssignLayeredImp <LayeredImpArray>
Return Value: None
Parameters: <LayeredImpArray>
Array("NAME:<BoundName>",
"Frequency:=", <value>,
"Roughness:=", <value>,
"IsInternal:=", <bool>,
"IsTwoSided:=", <bool>,
"IsShellElement:=", <bool>,
<LayersArray>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
<LayersArray>
Array("NAME:Layers",
<OneLayerArray>, <OneLayerArray>, ...)
<OneLayerArray>
Array("NAME:<LayerName>",
"LayerType:=", <LayerType>,
"Thickness:=",<value>,
"Material:=", <string>)
<LayerName>
Type: <string>
Specifies the layer number, such as "Layer1" or "Layer2"
<LayerType>
Type: <string>
Should be specified for the last layer only.
Possible values: "Infinite", "PerfectE", or "PerfectH"
Thickness
Thickness of the layer. Should be specified for all layers except the last layer.
Material
Material assigned on the layer. For the last layer, do not specify a material if the Lay-
erType is "PerfectE" or "PerfectH".
InfGroundPlane <boolean>
For HFSS designs, you can specify whether one layer is an infinite ground plane.
VB Example:
' ----------------------------------------------
AssignLinkedRegion
Use: Assign a Hybrid Region as a Linked Region.
Command: HFSS>Hybrid>Assign Hybrid>Linked Region
Syntax: AssignLinkedRegion Array(<name><"geometryName">, Type:=, "IE", IsLinkedRegion:="
true))
Return Value: None
Parameters: <name>
Type: String
VB Example:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2017.0.0
' 14:54:00 Aug 12, 2016
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project17")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignLinkedRegion Array("NAME:Linked1", "Objects:=", Array(
_
"RegularPolyhedron1"), "Type:=", "IE", "IsLinkedRegion:=", true)
AssignLumpedPort
Creates a lumped port.
Command: HFSS>Excitations>Assign>Lumped Port
Syntax: AssignLumpedPort <LumpedPortArray>
AssignLumpedRLC
Use: Creates a lumped RLC boundary.
Command: HFSS>Boundaries>Assign>Lumped RLC
Syntax: AssignLumpedRLC <LumpedRLCArray>
Return Value: None
Parameters: <LumpedRLCArray>
Array("NAME:<BoundName>",
"UseResist:=",<bool>,
"Resistance:=", <value>,
"UseInduct:=", <bool>,
"Inductance:=", <value>,
"UseCap:=", <bool>,
"Capacitance:=", <value>,
<CurrentLineArray>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
<CurrentLineArray>
Array("NAME:CurrentLine", _
"Start:=", <LineEndPoint>,
"End:=", <LineEndPoint>)
VB Example:
oModule.AssignLumpedRLC Array("NAME:LumpRLC1",_
"UseResist:=", true,_
"Resistance:=", "10Ohm",_
"UseInduct:=", true,_
"Inductance:=", "10nH",_
"UseCap:=", true,_
"Capacitance:=","10pF",_
Array("NAME:CurrentLine", _
"Start:=", Array(-0.4, -1.2, -1.6),_
"End:=", Array(-0.4, -1.2, 0)),
"Faces:=", Array(12))
AssignMagneticBias
Use: Creates a magnetic bias source.
Command: HFSS>Excitations>Assign>Magnetic Bias
AssignMaster
Use:Creates a master boundary.
Command:HFSS>Boundaries>Assign>Master
Syntax:AssignMaster <MasterArray>
Return Value:None
Parameters:<MasterArray>
Array("NAME:<BoundName>",
<CoordSysArray>,
"ReverseV:=", <bool>,
"Faces:=", <AssignmentFaces>)
<CoordSysArray>
Array("NAME:CoordSysVector",
"Origin:=", <CoordSysPoint>,
"UPos:=", <LineEndPoint>)
VB Example:
oModule.AssignMaster Array("NAME:Master1",_
Array("NAME:CoordSysVector",_
"Origin:=", Array(-1.4, -1.4, -0.8),_
"UPos:=", Array(-1.4, -1.4, 0)),_
"ReverseV:=", false,_
"Faces:=", Array(12))
AssignPerfectE
Use: Creates a perfect E boundary.
Command: HFSS>Boundaries>Assign>Perfect E
Syntax: AssignPerfectE <PerfectEArray>
Return Value: None
Parameters: <PerfectEArray>
Array("NAME:<BoundName>",
"InfGroundPlane:=", <bool>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
VB Example:
oModule.AssignPerfectE Array("NAME:PerfE1",_
"InfGroundPlane:=", false,_
"Faces:=", Array(12))
AssignPerfectH
Creates a perfect H boundary.
Command:HFSS>Boundaries>Assign>PerfectH
Syntax: AssignPerfectH <PerfectHArray>
Return Value: None
Parameters: <PerfectHArray>
Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
VB Example:
oModule.AssignPerfectH Array("NAME:PerfH1",_
"Faces:=", Array(12))
AssignRadiation
Creates a radiation boundary.
Command: HFSS>Boundaries>Assign>Radiation
Syntax: AssignRadiation <RadiationArray>
Return Value: None
Parameters: <RadiationArray>
Array("NAME:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>
"IsIncidentField:=", <boolean>, _
"IsEnforcedHField:=", <boolean>, _
"IsEnforcedEField:=", <boolean>, _
"IsFssReference:=", <boolean>, _
"IsForPML:=", <boolean>, _
"UseAdaptiveIE:=", <boolean>, _
"IncludeInPostproc:=", <boolean>))
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 2:27:20 PM Sep 13, 2011
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project59")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignRadiation Array("NAME:Rad1", _
"Objects:=", Array("Box1"), _
"IsIncidentField:=", false, _
"IsEnforcedField:=", false, _
"IsFssReference:=", false, _
"IsForPML:=", false, _
"UseAdaptiveIE:=", true, _
"IncludeInPostproc:=", true)
AssignScreeningImpedance
Creates a screening impedance boundary.
Command: HFSS>Boundaries>Assign>Screening Impedance
Syntax: AssignScreeningImpedance <ScreeningArray>
Return Value: None.
Parameters: <ScreeningArray>
Array("NAME:<name>",
"Objects:=", Array( "<name>"),
"IsAnisotropic:=", <Boolean>,
If true, you need to specify the coordinate system
"CoordSystem:=", <integer or name>,
"HasExternalLink:=", <Boolean>,
true or false. If False, specify XResistence and XReactance values. Also see the first
example.
"XResistance:=", "<value>",
"XReactance:=", "<value>"
If true, then specify the external link array with the project and solution to use. Also see
the second example.
Array("NAME:XLink",
"Project:=", "<projectName>.aedt",
"Design:=", "<DesignName>",
"Soln:=", "Setup1 : LastAdaptive",
Array("NAME:Params", "<variable>:=", "<value>"),
"ForceSourceToSolve:=", <Boolean>,
"PreservePartnerSoln:=", <Boolean>,
"PathRelativeTo:=", "TargetProject"),
Array("NAME:YLink",
"Project:=", "<projectName>.aedt",
"Design:=", "HFSSDesign1",
"Soln:=", "Setup1 : LastAdaptive",
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 13.0.0
' 4:17:23 PM Oct 29, 2010
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project53")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignScreeningImpedance Array("NAME:Screening1", "Object-
s:=", Array( "Rectangle1"),
"IsAnisotropic:=", true,
"CoordSystem:=", 1,
"HasExternalLink:=", true,
Array("NAME:XLink",
"Project:=", "mydesign.aedt",
"Design:=", "HFSSDesign1",
"Soln:=", "Setup1 : LastAdaptive",
Array("NAME:Params", "bend_angle:=", "50deg"),
"ForceSourceToSolve:=", false,
"PreservePartnerSoln:=", false,
"PathRelativeTo:=", "TargetProject"),
Array("NAME:YLink", "Project:=", "mydesign.aedt",
"Design:=", "HFSSDesign1",
"Soln:=", "Setup1 : LastAdaptive",
Array("NAME:Params", "bend_angle:=", "50deg"),
"ForceSourceToSolve:=", true,
"PreservePartnerSoln:=", true,
"PathRelativeTo:=", "TargetProject"))
AssignSymmetry
Use: Creates a symmetry boundary.
Command: HFSS>Boundaries>Assign>Symmetry
Syntax: AssignSymmetry <SymmetryArray>
Return Value: None
Parameters: <SymmetryArray>
Array("NAME:<BoundName>",
"IsPerfectE:=", <bool>
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
VB Example:
oModule.AssignSymmetry Array("NAME:Sym1",_
"IsPerfectE:=", true,_
"Faces:=", Array(12))
AssignTerminal
Use: Assigning terminals to a port.
Command: HFSS>Excitations>Assign>Terminal
Syntax: AssignTerminal <TerminalArray>
Return Value: None
Parameters: <TerminalArray>
Array("NAME: <TerminalName>, "Edges:", <EdgeIDArray>, "ParentBndID":= ,
"<PortName>", "TeminalResistance:=", <value>)
<TerminalName>
Type: String
<EdgeIDArray>
Type: Array of strings
<PortName>
Type: String
Name of Port.
<value>
Type: string
Value and units for the resistance.
VB Example:
oModule.AssignTerminal Array("NAME:Rectangle1_T1", _
"Edges:=", Array(36), "ParentBndID:=", _
"WavePort1", "TerminalResistance:=", "50ohm")
AssignVoltage
Use: Creates a voltage source.
Command: HFSS>Excitations>Assign>Voltage
Syntax: AssignVoltage <VoltageArray>
Return Value: None
Parameters: <VoltageArray>
Array("NAME:<BoundName>",
"Voltage:=", <value>,
<DirectionArray>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
<DirectionArray>
Array("NAME:Direction",_
"Start:=",<LineEndPoint>,
"End:=", <LineEndPoint>)
VB Example:
oModule.AssignVoltage Array("NAME:Voltage1",_
"Voltage:=", "1000mV",_
Array("NAME:Direction",_
"Start:=", Array(-0.4, -1.2, 0),_
"End:=", Array(-1.4, -1.2, 0)),_
"Faces:=", Array(7))
AssignWavePort
Use: Creates a wave port.
Command: HFSS>Excitations>Assign>Wave Port
Syntax: AssignWavePort <WavePortArray>
Return Value: None
Parameters: <WavePortArray>
Array("NAME:<BoundName>",
"Faces:=", <FaceIDArray>,
"NumModes:=", <int>,
"PolarizeEField:=",<bool>,
"DoDeembed:=", <bool>,
"DeembedDist:=", <value>,
"DoRenorm:=", <bool>,
"RenormValue:=",<value>,
<ModesArray>,
"TerminalIDList:=", <TerminalsArray>
)
NumModes
Number of modes for modal problems.
<ModesArray>
Specify for modal problems.
Array("NAME:Modes",
<OneModeArray>, <OneModeArray>, ...)
<OneModeArray>
Array("NAME:<ModeName>",
"ModeNum:=", <int>,
"UseIntLine:=", <bool>,
<IntLineArray>)
<ModeName>
Type: <string>
Name of the mode. Format is "Mode<int>". For example "Mode1".
<IntLineArray>
Array("NAME:IntLine",
"Start:=", <LineEndPoint>,
"End:=", <LineEndPoint>,
"CharImp:=", <string>)
CharImp
Characteristic impedance of the mode. Possible values are "Zpi", "Zpv", or "Zvi"
VB Example: Modal problem:
oModule.AssignWavePort Array("NAME:WavePort1",_
"NumModes:=", 2,_
"PolarizeEField:=",false,_
"DoDeembed:=", true,_
"DeembedDist:=", "10mil",_
"DoRenorm:=", true,_
"RenormValue:=","50Ohm",
Array("NAME:Modes",_
Array("NAME:Mode1",_
"ModeNum:=", 1,_
"UseIntLine:=", true,_
Array("NAME:IntLine",_
"Start:=", Array(-0.4, -1.2, 0),_
"End:=", Array(-1.4, 0.4, 0)),_
"CharImp:=", "Zpi"), _
Array("NAME:Mode2",_
"ModeNum:=", 2,_
"UseIntLine:=", false)),_
"Faces:=", Array(7))
VB Example: Terminal problem:
oModule.AssignWavePort Array("NAME:WavePort1",_
"Faces:=", Array(11)
"NumModes:=", 2,_
"PolarizeEField:=", false,_
"DoDeembed:=", false,
"TeminalIDList:=", Array()
)
CircuitPortToLumpedPort
Use: Converts a circuit port to a lumped port for a driven terminal or driven modal design in HFSS.
Command: Convert to Lumped Port
Syntax: CIrcuitPortToLumpedPort ("<PortName>")
Return Value: None
Parameters: <PortName>
VB Example:
oModule.CircuitPortToLumpedPort("1")
Python CircuitPortToLumpedPort("1")
Example
EditCircuitPort [HFSS]
Use: Edits a circuit port for a driven terminal or driven modal design in HFSS.
Command: Properties
Syntax: EditCircuitPort <parameters>
Return Value: None
Parameters: <CircuitPortArray>
Array("NAME:<PortName>",
"Impedance:=", "valueohm",
DoDeembed:=", <boolean>
"RenormalizeAllTerminals:=", <boolean>
"TerminalIDLit:=", Array()
)
VB Example:
oModule.EditCircuitPort Array("NAME:1",
"Impedance:=", "50ohm", _
"DoDeembed:=", true, _
"RenormalizeAllTerminals:=", true,_
"TerminalIDList:=", Array())
Python oModule.EditCircuitPort(
Example
[
"NAME:1",
"Impedance:=" , "50ohm",
"DoDeembed:=" , False,
"RenormalizeAllTerminals:=", True,
"TerminalIDList:=" , []
])
EditCurrent
Use: Modifies a current source.
Command: Double-click the excitation in the project tree to modify its settings.
Syntax: EditCurrent <BoundName> <CurrentArray>
Return Value: None
EditDiffPairs
Use:Edits the properties of differential pairs defined from terminal excitations on wave ports.
Command:HFSS>Excitations>Differential Pairs
Syntax:EditDiffPairs <DifferentialPairsArray>
Return Value:None
Parameters:<DifferentialPairsArray>
Array("NAME:EditDiffPairs",
<OneDiffPairArray>, <OneDiffPairArray>,...)
<OneDiffPairArray>
Array("NAME:Pair1",_
"PosBoundary:=", <string>,
"NegBoundary:=", <string>,
"CommonName:=", <string>,
"CommonRefZ:=", <value>,
"DiffName:=", <string>,
"DiffRefZ:=", <value>,
"IsActive:=", <boolean>)
PosBoundary
Name of the terminal to use as the positive terminal.
NegBoundary
Name of the terminal to use as the negative terminal.
CommonName
Name for the common mode.
CommonRefZ
Reference impedance for the common mode.
DiffName
Name for the differential mode.
DiffRefZ
Reference impedance for the differential mode.
VB Example:
oModule.EditDiffPairs Array("NAME:EditDiffPairs", Array
("NAME:Pair1", "PosBoundary:=", _
"Rectangle1_T1", "NegBoundary:=", "Rectangle2_T1", _
"CommonName:=", "Comm1", "CommonRefZ:=", "25ohm", _
"DiffName:=", "Diff1", "DiffRefZ:=", "100ohm", "IsActive:=", true))
EditFiniteCond
Use: Edit parameters of single finite conductivity boundary.
Command: Double-click finite conductivity boundary in project tree.
Syntax: EditFiniteCond <BoundaryName>, Array("NAME:<Name>", <FiniteCondParameters>)
EditHalfSpace
Use: Edit a Half Space boundary name, Z location, and or materials.
EditHybridRegion
Use:Edit a Hybrid Region boundary name.
Command: Edit Properties
Syntax:EditHybridRegion Array("<Name>", "NAME:<newName>",)
Return Value: None
Parameters: "NAME:<stringN>"
VB Example:
oModule.EditHybridRegion "SBR11", Array("NAME:SBR2")
EditImpedance
Use: Modifies an impedance boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditImpedance <BoundName> <ImpedanceArray>
Return Value: None
EditIncidentWave
Modifies an incident wave excitation.
Command: Double-click the excitation in the project tree to modify its settings.
Syntax: EditIncidentWave <BoundName> <IncidentWaveArray>
"MinFreq:=", "100MHz",
"MaxFreq:=", "1GHz",
"Delay:=", "0.2s",
"NumFreqsExtracted:=", 401,
"SweepMinFreq:=", "100MHz",
"SweepMaxFreq:=", "1GHz",
"IsPropagating:=", true,
"IsEvanescent:=", false, "IsEllipticallyPolarized:=", false)
EditLayeredImpedance
Use: Modifies a layered impedance boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditLayeredImp <BoundName> <LayeredImpArray>
Return Value: None
EditMaster
Use: Modifies a master boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: Edit <BoundName> <MasterArray>
Return Value: None
EditPerfectE
Use: Modifies a perfect E boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditPerfectE <BoundName>, <PerfectEArray>
Return Value: None
EditPerfectH
Use: Modifies a perfect H boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditPerfectH <BoundName> <PerfectHArray>
Return Value: None
EditLumpedPort
Modifies a lumped port.
Command: Double-click the excitation in the project tree to modify its settings.
Syntax: EditLumpedPort <BoundName> <LumpedPortArray>
Parameters: <LumpedPortArray>
Array("NAME:<BoundName>",
"Faces:=", <FaceIDArray>,
"RenormalizeAllTerminals:=", <boolean>
"DoDeembed:="’ <boolean"
<ModesArray>,
"TerminalIDList:=", <TerminalsArray>,
"FullResistance:=", <value>,
"FullReactance:=", <value>,
)
Return Value: None
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 2:18:20 PM May 20, 2011
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("calib_modal_test")
EditLumpedRLC
Use: Modifies a lumped RLC boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditLumpedRLC <BoundName> <LumpedRLCArray>
Return Value: None
EditMagneticBias
Use: Modifies a magnetic bias excitation.
Command: Double-click the excitation in the project tree to modify its settings.
Syntax: EditMagneticBias <BoundName> <MagneticBiasArray>
Return Value: None
Parameters:
EditRadiation
Modifies a radiation boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditRadiation <BoundName> <RadiationArray>
Return Value: None
Parameters: <RadiationArray>
Array("NAME:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>
"IsIncidentField:=", <boolean>, _
"IsEnforcedHField:=", <boolean>, _
"IsEnforcedEField:=", <boolean>, _
"IsFssReference:=", <boolean>, _
"IsForPML:=", <boolean>, _
"UseAdaptiveIE:=", <boolean>, _
"IncludeInPostproc:=", <boolean>))
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 2:34:08 PM Sep 13, 2011
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project59")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.EditRadiation "Rad1", _
Array("NAME:Rad1", _
"IsIncidentField:=", true, _
"IsEnforcedField:=", false, _
"IsFssReference:=", false, _
"IsForPML:=", false, _
"UseAdaptiveIE:=", false, _
"IncludeInPostproc:=", true)
EditSlave
Use: Modifies a slave boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditSlave <BoundName> <SlaveArray>
Return Value: None
EditSymmetry
Use: Modifies a symmetry boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditSymmetry <BoundName> <SymmetryArray>
Return Value: None
EditTerminal
Use: Modifies properties of a terminal
Command: Edit Properties for a selected terminal
Syntax: EditTerminal <TerminalArray>)
Return Value: None
Parameters: <TerminalArray>
Array("NAME: <TerminalName>", "ParentBndID:=", "<PortName>", "Ter-
minalResistance:=," <value>")
<TerminalName>
Type:String
<PortName>
Type: String
<value>
Type: <string>
Value and units of resistance.
VB Example:
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.EditTerminal "Rectangle2_T1", Array("NAME:Rectangle2_T1", _
"ParentBndID:=", "WavePort1", "TerminalResistance:=", "75ohm")
EditVoltage
Use: Modifies a voltage source.
Command: Double-click the excitation in the project tree to modify its settings.
Syntax: EditVoltage <BoundName> <VoltageArray>
Return Value: None
EditWavePort
Use: Modifies a wave port.
Command: Double-click the excitation in the project tree to modify its settings.
Syntax: EditWavePort <BoundName> <WavePortArray>
Return Value: None
VB Example:
LumpedPortToCircuitPort
Use: Converts a lumped port to a circuit port for a driven terminal or driven modal design in HFSS.
Command: Convert to Circuit Port
Syntax: LumpedPortToCircuitPort ("<PortName>")
Return Value: None
Parameters: <PortName>
VB Example:
oModule.LumpedPortToCircuitPort("1")
Python LumpedPortToCircuitPort("1")
Example
SetHybridRegionCoupledGroup
Use: To set coupling for hybrid regions.
Command: HFSS>HybridRegions>Set Coupling
Syntax: SetHybridRegionCoupledGroup <value>
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project35")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.SetHybridRegionCoupledGroup "TwoWayCoupled"
Setting Hybrid Region Groupings
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2017.0.0
' 14:38:14 Nov 08, 2016
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project35")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
SetTerminalReferenceImpedances
Use: To set the reference impedance for all terminals within a specified port.
Command: HFSS>Excitations>Set Terminal Reference Impedances or HFSS-IE>Ex-
citations>Set Terminal Reference Impedances
Syntax: SetTerminalReferenceImpedances <value>, <PortName>
Return Value: None
Parameters: <value>
Type: <string>
The value and units for the the impedance
<PortName>
Type: <string>
The name of the port.
VB Example:
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.SetTerminalReferenceImpedances "75ohm", "WavePort1"
SwapCircuitPortAssignment
Use: Swaps the terminal and reference assignments on a circuit port.
Command: Swap Direction
Syntax: SwapCircuitPortAssignment ("<PortName>")
Return Value: None
Parameters: <PortName>
VB Example:
oModule.SwapCircuitPortAssignment("1")
Python SwapCircuitPortAssignment("1")
Example
UnassignIERegions
Use: Unassign one or more IE Regions assigned to conducting objects.
Command: Unassign IE Regions
Syntax: UnassignIERegion Array (<"geometryName">)
Return Value: None
Parameters: <GeometryName>
Type: String
Name of one or more geometries assigned as an IE Region.
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 14.0.0
' 2:51:43 PM Mar 07, 2011
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project58")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.UnassignIERegions Array("Box1")
BaseObj
Name of the base object touching the PML cover object.
Orientation
String representing the orientation of the PML.
Possible values are: "XAxis", "YAxis", and "ZAxis"
UseFreq
If true, provide the MinFreq parameter.
If false, provide the MinBeta parameter.
VB Example:
oModule.CreatePML Array("UserDrawnGroup:=", false,_
"PMLFaces:=", Array(120), "CreateJoiningObjs:=",_ true,_
UseFreq
If true, provide the MinFreq argument.
If false, provide the MinBeta argument.
VB Example:
oModule.ModifyPMLGroup Array("NAME:PMLGroup1",
"RadDist:=", "1.166666667mm",
"UseFreq:=", false, "MinBeta:=", 2)
PMLGroupCreated
Use: Command added by HFSS after a PML has been created. It is not responsible for creating
the PML objects and materials. It just contains the information needed by the PML Setup wizard
for future modification of the PML. This script command is not intended to be modified by you.
Removing this command from the script will prevent future modification of the PML through the
user interface after the script is played back.
Command: HFSS>Boundaries>Assign>PML Setup Wizard
Syntax: PMLGroupCreated <args>
Return Value: None
PMLGroupModified
Use: Command added by HFSS after a PML’s parameters are modified. This updates the PML
Setup wizard’s data. This script command is not intended to be modified by you. Removing this
command from the script will prevent future modification of the PML through the user interface after
the script is played back.
Command: Modify existing PML in the PML Setup wizard.
Syntax: PMLGroupModified <args>
Return Value: None
RecalculatePMLMaterials
Use: Scripting equivalent to clicking Recalculate Materials in the PML Setup wizard. This will
update the PML materials to match the current state of the PML Setup wizard data.
Command: None
Syntax: RecalculatePMLMaterials
Return Value: None
VB Example:
oModule.RecalculatePMLMaterials
CopySetup
DeleteSetups
EditSetup
ExportCircuit
GetSetupCount
GetSetups
InsertFrequencySweep
InsertSetup
InsertSetup [Transient]
PasteSetup
PasteSweep
RenameDrivenSweep
RenameSetup
RevertAllToInitial
RevertSetupToInitial
CopySetup
Copy the specified Optimetrics setup.
UI Access NA
CopySweep
The documented command is applicable for Q3D Extractor.
Use: Copy a sweep.
Syntax: CopySweep <SetupName>, <SweepName>
Return Value: None
Parameters: <SetupName>
Type: <String>
Name of solve setup to which the sweep belongs.
<SweepName>
Type:<String>
Name of sweep copied.
oModule.CopySweep "Setup6", "Sweep1"
DeleteDrivenSweep
Use: Deletes a frequency sweep. For HFSS-IE use DeleteSweep.
Command: Right-click a frequency sweep in the project tree, and then click Rename on the short-
cut menu.
Syntax: DeleteDrivenSweep <SetupName>, <SweepName>
Return Value: None
DeleteSetups
Use: Deletes one or more solution setups, which are specified by an array of solution setup names.
Command: Right-click a solution setup in the project tree, and then click Delete on the shortcut
menu, or delete selected solution setups in the List dialog box.
Syntax: DeleteSetups <SetupArray>
Return Value: None
Parameters: <SetupArray>
Array(<name1>, <name2>, ...)
VB Example:
oModule.DeleteSetups Array("Setup1", "Setup2")
DeleteSweep [HFSS-IE]
Use: Deletes a frequency sweep.
Command: Right-click a frequency sweep in the project tree, and then click Rename on the short-
cut menu.
Syntax: DeleteSweep <SetupName>, <SweepName>
Return Value: None
For Q3D Extractor, the command details are as follows:
Use: Deletes a sweep.
Syntax: DeleteSweep <SetupName>, <SweepName>
Return Value: None
Parameters: <SetupName>
Type: <String>
Name of solve setup.
<SweepName>
Type: <String>
Name of sweep to be deleted.
oModule.DeleteSweep "Setup6", "Sweep1"
EditFrequencySweep
Use: Modifies an existing frequency sweep. For HFSS-IE use EditSweep [HFSS-IE]
Command: Double-click a frequency sweep in the project tree to modify its settings.
Syntax: EditFrequencySweep <SetupName>, <SweepName>, <AttributesArray>
<SweepName>
Type: <string>
Name of the sweep to be edited.
<Attributes Array>
Array("NAME:<SweepName>",
"IsEnabled:=", <boolean>,
"SetupType:=", <SetupType>,
<FrequencyInformation>,
"Type:=", <SweepType>,
<SaveFieldsList>
<DCExtrapInfo>)
See the InsertFrequencySweep command for details.
Example:
oModule.EditFrequencySweep "Setup1", "Sweep3", _
Array("NAME:Sweep3", "IsEnabled:=", true, _
"SetupType:=", "SinglePoints", _
"ValueList:=", Array("1GHz", "2GHz", "3GHz"), _
"Type:=", "Discrete", _
"SaveFieldsList:=", Array(false, false, false), _
"ExtrapToDC:=", false)
EditSetup
Use: Modifies an existing solution setup.
Command: Double-click a solution setup in the project tree to modify its settings.
<AttributesArray>
Array("NAME:<NewSetupName>", <NamedParameters>)
See the InsertSetup command for details and examples.
For Q3D Extractor, the EditSetup command has the following details.
Use: Edit an existing solution setup.
Command: Double-click a setup in the project tree to edit it.
Syntax: EditSetup <SetupName>, Array("NAME:<NewSetupName>, "Enabled:=",
<Enabled>,"AdaptiveFreq:=",<AdaptFreq>,<SolverParam>)
Return Value: None
Parameters: <SetupName>
Type: <string>
Name of the solve setup being edited.
<NewSetupName>
Type: <string>
New name of the solve setup being edited
<SaveFields>
Type: <string>
Flag to indicate whether the fields are saved for last adaptive
solution. (True or False).
<Enabled>
Type: <bool>
Flag to indicate whether the setup is enabled.
<AdaptFreq>
Type: <String>
Frequency with units.
<SolverParam>
See InsertSetup for details.
oModule.EditSetup "Setup1", Array("NAME:Setup1", "AdaptiveFreq:=",
"1GHz", "EnableDistribProbTypeOption:=", _ false, "SaveFields:=",
"true", "Enabled:=", true, Array("NAME:Cap", "MaxPass:=", 10,
"MinPass:=", 1, "MinConvPass:=", _ 2, "PerError:=", 1, "Per-
Refine:=", 30, "AutoIncreaseSolutionOrder:=", false, "Solu-
tionOrder:=", _ "Normal"), Array("NAME:DC", "Residual:=", 1E-005,
"SolveResOnly:=", _ false, Array("NAME:Cond", "MaxPass:=", 10,
"MinPass:=", 1, "MinConvPass:=", 1, "PerError:=", _ 1, "Per-
Refine:=", 30), Array("NAME:Mult", "MaxPass:=", 1, "MinPass:=", 1,
"MinConvPass:=", _ 1, "PerError:=", 1, "PerRefine:=", 30)), Array
("NAME:AC", "MaxPass:=", 10, "MinPass:=", _ 1, "MinConvPass:=", 2,
"PerError:=", 1, "PerRefine:=", 30))
EditSweep [HFSS-IE]
Use: Modifies an existing sweep in HFSS-IE.
Command: Double-click a frequency sweep in the project tree to modify its settings.
Syntax: EditSweep <SetupName>, <SweepName>, <AttributesArray>
Return Value: None
Parameters: <SetupName>
Type: <string>
Name of the solution setup containing the sweep to be edited.
<SweepName>
Type: <string>
Name of the sweep to be edited.
<Attributes Array>
Array("NAME:<SweepName>",
"IsEnabled:=", <boolean>,
"SetupType:=", <SetupType>,
<FrequencyInformation>,
"Type:=", <SweepType>,
<SaveFieldsList>
<DCExtrapInfo>)
<additionalRanges>
Array( "SetupType:=", "<SetupType>",
"StartValue:=", "<ValueUnits>",
"StopValue:=", "<ValueUnits", "Count:=", <value>, ...)
EditCircuitSettings
Use:Exports equivalent circuit data.
Command:Right-click the Analysis folder, and then choose Edit Circuit Settings.
Syntax:EditCircuitSettings <ExportSettings>
Return Value:None
Parameters:<ExportSettings>
See ExportCircuit for details.
VB Example:oModule.EditCircuitSettings Array("NAME:CircuitData",
"MatrixName:=", "Original", "NumberOfCells:=", _ "1", "User-
HasChangedSettings:=", true, "IncludeCap:=", true, "IncludeCond:=",
_ true, Array("NAME:CouplingLimits", "CouplingLimitType:=", "By Frac-
tion", "CapFraction:=", _ 0.01, "IndFraction:=", 0.01, "ResFrac-
tion:=", 0.01, "CondFraction:=", 0.01), "IncludeDCR:=", _ false,
"IncudeDCL:=", false, "IncludeACR:=", false, "IncludeACL:=", false,
"ADDResistance:=", _ true)
VB Example:oModule.EditCircuitSettings Array("NAME:CircuitData",
"MatrixName:=", "Original", "NumberOfCells:=", _ "1", "User-
HasChangedSettings:=", true, "IncludeCap:=", true, "IncludeCond:=",
_ true, Array("NAME:CouplingLimits", "CouplingLimitType:=", "By Frac-
tion", "CapFraction:=", _ 0.01, "IndFraction:=", 0.01, "ResFrac-
tion:=", 0.01, "CondFraction:=", 0.01), "IncludeR:=", _ false,
"IncludeL:=", false, "ExportDistributed:=", true, "LumpedLength:=",
_ "7meter", "RiseTime:=", "1s")
ExportCircuit
Use:Export equivalent circuit data.
Command:Right-click a setup in the project tree or the Analysis folder and choose Export
Circuit.
Syntax:ExportCircuit <Solution>, <Variation>, <FileName>, <ExportSettings>, <ModelName>,
<Freq>
Return Value:none
Parameters:<Solution>
<SetupName>:<SolutionName>
<SetupName>
Type: <string>
Name of the setup where circuit is being exported
<SolutionName>
Type: <String>
Name of the solution.
<Variation>
Type: <string>
The variation where circuit is being exported
<FileName>
Type: <string>
The name of the file where circuit is being exported
<ModelName>
Type: <String>
<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:
<CouplingLimitsArray>
Array("NAME:CouplingLimits", "CouplingLimitType:=", _ <Coup-
lingLimitType>, <CouplingLimitsParameters>, 0.01, "CondFraction:=",
0.01)
<CouplingLimitType> = "None"
A rgument not needed
<CouplingLimitType> = "ByFraction"
<CouplingLimitsParameters>
"CapFraction:=", <Fraction>, "IndFraction:=", <Fraction>,
"ResFraction:=", <Fraction>,"CondFraction:=",<Fraction>,
Parameters:
<Fraction>
Type: <double>
Fraction of the self term
<CouplingLimitType> = "ByValue"
<CouplingLimitsParameters>
GetSetupCount
Gets the number of analysis setups in a design.
Syntax: GetSetups()
Return Value: Number of setups.
Parameters: None
VB Example:
setupcount = oModule.GetSetupCount()
GetSetups
Gets the names of analysis setups in a design.
Syntax: GetSetups()
Return Value: Array of analysis setup names.
Parameters: None
VB Example:
setupnames = oModule.GetSetups()
InsertFrequencySweep
Adds a frequency sweep to a Driven solution-type setup.
Command: HFSS>Analysis Setup>Add Sweep
Syntax: InsertFrequencySweep <SetupName>, <AttributesArray> [<additionalRanges>]
Return Value: None
Parameters: <SetupName>
Type: <string>
Name of the solution setup into which the sweep will be inserted.
<Attributes Array>
Array("NAME:Sweep",
"IsEnabled:=", <boolean>
"RangeType:=", <"LinearStep" | "LinearCount" | "LogScale">,
<LinearStepArray>
"RangeStart:=", "<real>GHz",
"RangeEnd:=", "<real>GHz",
"RangeStep:=", "<real>GHz",
<LinearCountArray>
"RangeStart:=", "<real>GHz",
"RangeEnd:=", "<real>GHz",
"RangeCount:=", <int>,
<LogScaleArray>
RangeStart:=", "<real>GHz",
"RangeEnd:=", "<real>GHz",
"RangeCount:=", <int>,
"RangeSamples:=", <int>,
<SweepTypeArray>
"Type:=", <"Interpolating" |"Fast" | "Discrete">,
<InterpolatingParametersArray>
"SaveFields:=", <boolean>,
"SaveRadFields:=", <boolean>,
"InterpTolerance:=", <real>,
"InterpMaxSolns:=", <int>,
"InterpMinSolns:=", <int>,
"InterpMinSubranges:=", <int>,
"ExtrapToDC:=", <boolean>,
"InterpUseS:=", <boolean>,
"InterpUsePortImped:=", <boolean>,
"InterpUsePropConst:=", <boolean>,
"UseDerivativeConvergence:=", true,
"InterpDerivTolerance:=", <real>,
"UseFullBasis:=", <boolean>,
"EnforcePassivity:=", <boolean>,
"PassivityErrorTolerance:=", <real>)
"EnforceCausality:=", <boolean>
<FastParametersArray>
"SaveFields:=", <boolean>,
"SaveRadFields:=", <boolean>,
"GenerateFieldsForAllFreqs:=", <boolean>,
"ExtrapToDC:=", <boolean>)
<DiscreteParametersArray>
"SaveFields:=", <boolean>,
"SaveRadFields:=", <boolean>,
"ExtrapToDC:=", <boolean>)
oModule.InsertFrequencySweep "Setup1",
Array("NAME:Sweep2", "IsEnabled:=", false,
"RangeType:=", "LinearStep",
"RangeStart:=", "1GHz",
"RangeEnd:=", "10GHz",
"RangeStep:=", "0.1GHz",
"Type:=", "Fast",
"SaveFields:=", true,
"SaveRadFields:=", false,
"GenerateFieldsForAllFreqs:=", false,
"ExtrapToDC:=", false)
"StartValue:=", "0.005GHz", _
"StopValue:=", "2.5GHz", _
"StepSize:=", "0.005GHz", _
"Type:=", "Discrete", "SaveFields:=", false, _
"ExtrapToDC:=", false)
Type: <String>
Name of the solve setup in which the sweep is added.
<SweepDataArray>
Array("NAME:<SweepName>", "IsEnabled:=", <EnableFlag>,
"SetupType:=", _
<SetupType>", <SetupTypeParameters>, "Type:=", <SweepType>,
"SaveFields:=", <SaveFields>, <InterpSweepParameters>)
Array("NAME:<SweepName>", "IsEnabled:=", <EnableFlag>,
"SetupType:=", _
<SetupType>", <SetupTypeParameters>, "Type:=", <SweepType>,
"SaveFieldsList:=", <SaveFieldsListParameters>, <Inter-
pSweepParameter>)
VB Example: Array("NAME:Sweep1", "IsEnabled:=", true,
"SetupType:=", _ "LinearStep", "StartValue:=", "1GHz",
"StopValue:=", "10GHz", "StepSize:=", _ "1GHz", "Type:=", "Dis-
crete", "SaveFields:=", true)
VB Example: Array("NAME:Sweep1", "IsEnabled:=", true,
"SetupType:=", _ "LinearCount", "StartValue:=", "1GHz",
"StopValue:=", "100GHz", "Count:=", 100, "Type:=", _ "Discrete",
"SaveFields:=", true)
VB Example: Array("NAME:Sweep1", "IsEnabled:=", true, "SetupType:=",
_ "LinearCount", "StartValue:=", "1GHz", "StopValue:=", "100GHz",
"Count:=", 100, "Type:=", _ "Discrete", "SaveFields:=", true)
VB Example: Array("NAME:Sweep1", "IsEnabled:=", true, "SetupType:=",
_ "SinglePoints", "ValueList:=", Array("1GHz", "2GHz", "5GHz"),
"Type:=", _ "Discrete", "SaveFieldsList:=", Array(false, false,
false)
VB Example: Array("NAME:Sweep2", "IsEnabled:=", true, "SetupType:=",
_ "LinearStep", "StartValue:=", "1GHz", "StopValue:=", "10GHz",
"StepSize:=", _ "1GHz", "Type:=", "Interpolating", "SaveFields:=",
false, "InterpTolerance:=", _ 0.01, "InterpMaxSolns:=", 9, "Inter-
pMinSolns:=", 4)
Parameters:
<SweepName>
Type: <String>
Sweep name
<EnableFlag>
Type:<bool>
Flag to tell whether sweep is enabled.
<SetupType>
Type:String>
Values: "LinearStep", "LinearCount", "LogScale", "SinglePoints"
<SetupTypeParameters>
Base on the value of setup type, setup type parameters varies.
<LinearStepParameters>
StartValue:=", <StartValue>, "StopValue:=", <StopValue>, "StepSize:=", <StepSize>
<StartValue>
Type:<String>
Start frequency.
<StopValue>
Type: <String>
Stop Frequency
<StepSize>
Type:<String>
Step frequency.
<LinearCountParameters>
StartValue:=", <StartValue>, "StopValue:=", <StopValue>, "Count:=", <Count>
<StartValue>
Type:<String>
Start frequency.
<StopValue>
Type: <String>
Stop Frequency
<Count>
Type:<integer>
Number of frequency points in the given range.
<LogScaleParameters>
Note:
InsertSetup
Use: Adds a new solution setup.
Command: [product]>Analysis Setup>Add Solution Setup
Syntax: InsertSetup <SetupType>, <AttributesArray>
Return Value: None
Parameters: <SetupType>
Type: <string>
"HfssDriven" or "HfssDrivenAuto" or "HfssEigen". Must match the HFSS solution type.
<AttributesArray>
Array("NAME:<SetupName>", <Named Parameters>)
<Named Parameters>
The named parameters will vary according to the solution type and the selections made.
The parameters correspond to fields in the Setup dialog. For example, here is default
dialog for an HFSS driven setup with one excitation assigned.
Some of the attributes Array correspond to these fields on the General tab of the Setup.
Array("NAME:Setup1", "AdaptMultipleFreqs:=", false, _
"Frequency:=", "5GHz", _
"MaxDeltaS:=", 0.02, _
"PortsOnly:=", false, _
"UseMatrixConv:=", false, _
"MaximumPasses:=", 6,_
Others correspond to fields on the Options tab.
The script parameters corresponding to these Options tab fields are as follows:
"MinimumPasses:=", 1, _
"MinimumConvergedPasses:=", 1, _
"PercentRefinement:=", 30, _
"IsEnabled:=", true, _
"BasisOrder:=", 1, _
"DoLambdaRefine:=", true, _
"DoMaterialLambda:=", true, _
"SetLambdaTarget:=", false, _
"Target:=", 0.3333,
Still other parameters correspond to fields on the Advanced tab.
"PortAccuracy:=", 2,_
SaveRadFieldsOnly:=", false, _
"SaveAnyFields:=", true,
Still others parameters correspond to the Hybrid tab.
"IESolverType:=", "Auto",_
"LambdaTargetForIESolver:=", 0.15, _
"UseDefaultLambdaTgtForIESolver:=", true
The choices made for solver, solution type, Ports Only, Single Frequency, Multi-Fre-
quencies, Broadband, Mesh Linking, and whether Expression Cash, or Derivatives, and
HPC are used will all affect the parameters array for a particular setup.
To see the required parameters for a specific Setup and their format, use the record
script function, and view the resulting script in a text editor. For descriptions of the para-
meters, see the Online help for the setup. See the examples below.
VB Example: An HFSS Driven project solution with Auto Solution.
"BasisOrder:=", 1,
"UseIterativeSolver:=", false,
"DoLambdaRefine:=", false,
"DoMaterialLambda:=", true,
"SetLambdaTarget:=", false,
"Target:=", 0.3333,
"UseMaxTetIncrease:=", false,
"MaxTetIncrease:=", 1000000,
"EnableSolverDomains:=", false,
"ThermalFeedback:=", false,
"UsingConstantDelta:=", 0,
"ConstantDelta:=", "0s",
"NumberSolveSteps:=", 1)
"DoLambdaRefine:=", true,
"DoMaterialLambda:=", false,
"SetLambdaTarget:=", false,
"Target:=", 0.3333,
"UseMaxTetIncrease:=", false,
"MaxTetIncrease:=", 1000000,
"PortAccuracy:=", 2,
"UseABCOnPort:=", true,
"SetPortMinMaxTri:=", false,
"EnableSolverDomains:=", false,
"ThermalFeedback:=", false,
"UsingConstantDelta:=", 0,
"ConstantDelta:=", "0s",
"NumberSolveSteps:=", 1)
VB Example: An Eigenmode solution type:
Set oProject = oDesktop.SetActiveProject("cavity")
Set oDesign = oProject.SetActiveDesign("HFSSModel1")
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup "HfssEigen",
Array("NAME:Setup2",
"MinimumFrequency:=", "1.77347GHz",
"NumModes:=", 1,
"MaxDeltaFreq:=", 10,
"ConvergeOnRealFreq:=", true,
"MaximumPasses:=", 3,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"IsEnabled:=", true,
"BasisOrder:=", 1,
"UseIterativeSolver:=", false,
"DoLambdaRefine:=", true,
"DoMaterialLambda:=", true,
"SetLambdaTarget:=", false,
"Target:=", 0.2,
"UseMaxTetIncrease:=", false,
"MaxTetIncrease:=", 1000000,
"UsingConstantDelta:=", 0,
"ConstantDelta:=", "0s",
"NumberSolveSteps:=", 1)
VB Example:
A Driven solution type with ports and matrix convergence:
Set oDesign = oProject.SetActiveDesign("packagehfss")
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup "HfssDriven",
Array("NAME:Setup2",
"Frequency:=", "1GHz",
"PortsOnly:=", false,
"MaxDeltaS:=", 0.02,
"UseMatrixConv:=", true,
Array("NAME:ConvergenceMatrix",
"AllDiagEntries:=", true,
"MagMinThreshold:=", 0.01,
"Entry:=", Array("Port1:=", "abc", "ModeNum1:=", 1)),
"MaximumPasses:=", 6,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"IsEnabled:=", true,
"BasisOrder:=", 1,
"UseIterativeSolver:=", false,
"DoLambdaRefine:=", true,
"DoMaterialLambda:=", true,
"SetLambdaTarget:=", false,
"Target:=", 0.3333,
"UseMaxTetIncrease:=", false,
"MaxTetIncrease:=", 1000000,
"PortAccuracy:=", 2,
"UseABCOnPort:=", true,
"SetPortMinMaxTri:=", false,
"EnableSolverDomains:=", false,
"ThermalFeedback:=", false,
"UsingConstantDelta:=", 0,
"ConstantDelta:=", "0s",
"NumberSolveSteps:=", 1)
VB Example:
An HFSS setup with an Hybrid Boundary type SBR.
oModule.EditSetup("SBRsetup1",
[
"NAME:SBRsetup1",
"AdaptBroadband:=" , False,
"Frequency:=" , "1GHz",
"MaxDeltaE:=" , 0.1,
"MaximumPasses:=" , 10,
"MinimumPasses:=" , 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=" , 30,
"IsEnabled:=" , True,
"BasisOrder:=" , 1,
"DoLambdaRefine:=" , True,
"DoMaterialLambda:=" , True,
"SetLambdaTarget:=" , False,
"Target:=" , 0.3333,
"UseMaxTetIncrease:=" , False,
"UseDomains:=" , True,
"UseIterativeSolver:=" , False,
"IterativeResidual:=" , 1E-
006,
"DDMSolverResidual:=" , 0.0001,
"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,
"IESolverType:=" , "Auto",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True
"SkipIERegionsSolveDuringAdaptivePasses:=", True
"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"InfiniteSphereSetup:=" , "Infinite Sphere1",
"SkipSBRSolveDuringAdaptivePasses:=", True,
"PTDUTDSimulationSettings:=", "PTD Correction + UTD Rays",
"PTDEdgeDensity:=" , 20
])
VB Example:
A Driven solution type with Multi-Frequencies specified.
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2017.0.0
' 14:10:43 Aug 26, 2016
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project20")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup "HfssDriven", Array("NAME:Setup2", "AdaptMul-
tipleFreqs:=", true, Array("NAME:MultipleAdaptiveFreqsSetup",
"1.1GHz:=", Array( _
0.02), "10GHz:=", Array(0.02), "11GHz:=", Array(0.02), "12.5GHz:=",
Array(0.02), "15GHz:=", Array( _
0.02), "20GHz:=", Array(0.02)), "MaximumPasses:=", 6, "Min-
imumPasses:=", 1, "MinimumConvergedPasses:=", _
1, "PercentRefinement:=", 30, "IsEnabled:=", true, "BasisOrder:=",
1, "DoLambdaRefine:=", _
true, "DoMaterialLambda:=", true, "SetLambdaTarget:=", false, "Tar-
get:=", _
0.3333, "UseMaxTetIncrease:=", false, "PortAccuracy:=", 2,
"UseABCOnPort:=", _
false, "SetPortMinMaxTri:=", false, "UseDomains:=", false, "UseIter-
ativeSolver:=", _
false, "SaveRadFieldsOnly:=", false, "SaveAnyFields:=", true,
"IESolverType:=", _
"Auto", "LambdaTargetForIESolver:=", 0.15, "UseDe-
faultLambdaTgtForIESolver:=", _
true, "RayDensityPerWavelength:=", 4, "MaxNumberOfBounces:=", 5)
VB Example:
An Driven Solution type with Broadband specified.
' ----------------------------------------------
oModule.InsertSetup("HfssDrivenAuto",
[
"NAME:Setup1",
"IsEnabled:=" , True,
"AutoSolverSetting:=" , "Balanced",
[
"NAME:Sweeps",
Python
[
Example
"NAME:Sweep",
"RangeType:=" , "LinearStep",
"RangeStart:=" , "1GHz",
"RangeEnd:=" , "10GHz",
"RangeStep:=" , "1GHz"
]
],
"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,
"Type:=" , "Discrete"
])
oModule.InsertSetup("HfssDriven",
[ "NAME:Setup2",
"AdaptMultipleFreqs:=" , False,
"Frequency:=" , "5GHz",
"MaxDeltaS:=" , 0.02,
"PortsOnly:=" , False,
"UseMatrixConv:=" , False,
"MaximumPasses:=" , 6, "MinimumPasses:=" , 1, "Min-
imumConvergedPasses:=", 1,
"PercentRefinement:=" , 30,
"IsEnabled:=" , True,
"BasisOrder:=" , 1,
"DoLambdaRefine:=" , True, "DoMaterialLambda:=" , True,
"SetLambdaTarget:=" , False, "Target:=" , 0.3333,
"UseMaxTetIncrease:=" , False,
"PortAccuracy:=" , 2, "UseABCOnPort:=" , False,
Python "SetPortMinMaxTri:=" , False,
Example "UseDomains:=" , True,
"UseIterativeSolver:=" , False, "IterativeResidual:=" ,
1E-06,
"DDMSolverResidual:=" , 0.0001,
"SaveRadFieldsOnly:=" , False, "SaveAnyFields:=" ,
True,
"IESolverType:=" , "Auto",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True,
"SkipIERegionSolveDuringAdaptivePasses:=", True
"RayDensityPerWavelength:=", 4,
"MaxNumberOfBounces:=" , 5,
"InfiniteSphereSetup:=" , "Infinite Sphere1",
"SkipSBRSolveDuringAdaptivePasses:=", True,
"PTDUTDSimulationSettings:=", "PTD Correction + UTD
Rays",
"PTDEdgeDensity:=" , 20 ])
<AdaptParam>)),
Array("NAME:AC", "Residual:=", 1E-005, Array("NAME:Cond",
<AdaptParam>), Array("NAME:Mult", <AdaptParam>))
Parameters:
<ACFreq>
Type: <string>
Frequency of the AC solution.
<Residual>
Type: <double>
Solver residual.
<SolveResOnly>
Type: <bool>
Solve resistance only for a DC solution.
<AdaptParam>
"MaxPass:=", <MaxPass>, "PerError:=", <PerError>,
"PerRefine:=", <PerRefine>
Parameters:
<MaxPass>
Type: <int>
Maximum pass for a solution
<PerError>
Type: <double>
Percentage error as stopping criteria.
<PerRefine>
Type: <double>
Mesh refinement at each pass in percentage.
VB Example:
oModule.InsertSetup "Matrix", Array("NAME:Setup1", "AdaptiveFreq:=",
"1GHz", "EnableDistribProbTypeOption:=", _ false, "SaveFields:=",
"true", "Enabled:=", true, Array("NAME:Cap", "MaxPass:=", 10,
"MinPass:=", 1, "MinConvPass:=", _ 1, "PerError:=", 1, "Per-
Refine:=", 30, "AutoIncreaseSolutionOrder:=", false, "Solu-
tionOrder:=", _ "Normal"), Array("NAME:DC", "Residual:=", 1E-005,
"SolveResOnly:=", _ false, Array("NAME:Cond", "MaxPass:=", 10,
"MinPass:=", 1, "MinConvPass:=", 1, "PerError:=", _ 1, "Per-
Refine:=", 30), Array("NAME:Mult", "MaxPass:=", 1, "MinPass:=", 1,
"MinConvPass:=", _ 1, "PerError:=", 1, "PerRefine:=", 30)), Array
("NAME:AC", "MaxPass:=", 10, "MinPass:=", _ 1, "MinConvPass:=", 1,
"PerError:=", 1, "PerRefine:=", 30))
InsertSetup [HFSS-IE]
Adds a new HFSS-IE solution setup.
Command: HFSS>Analysis Setup>Add Solution Setup
Syntax: InsertSetup <SetupType>, <AttributesArray> [<AdditionalSetups>]
Return Value: None
Parameters: <SetupType>
Type: <string>
"HFIESetup". Must match the HFSS solution type.
<AttributesArray>
Array("NAME:<SetupName>", <Named Parameters>)
<Named Parameters>
The named parameters will vary according to the solution type. To see the required para-
meters for a specific set of parameters and their format, use the record script function,
and view the resulting script in a text edtor. See the HFSS-IE example below.
<additionalRanges>
Array( "SetupType:=", "<SetupType>",
"StartValue:=", "<ValueUnits>",
"StopValue:=", "<ValueUnits", "Count:=", <value>, ...)
VB Example:
oModule.InsertSetup "HFIESetup", Array("NAME:Setup3",
"MaximumPasses:=", 6,
"MinimumPasses:=", 1,
"MinimumConvergedPasses:=", 1,
"PercentRefinement:=", 30,
"Enabled:=", true,
"AdaptiveFreq:=", "1GHz",
"DoLambdaRefine:=", true,
"UseDefaultLambdaTarget:=", true,
"Target:=", 0.25,
"DoMaterialLambda:=", true,
"MaxDeltaS:=", 0.02,
"MaxDeltaE:=", 0.1,
"UsePOSolver:=", true)
InsertSetup [Transient]
Add a new solution setup to a Transient design
Command: HFSS>Analysis Setup>Add Solution Setup
<Named Parameters>
The parameters correspond to fields in the Setup dialog. For example, here is default
dialog for an HFSS Transient driven Composite Excitation setup with one excitation
assigned. To see the required parameters for a specific set of parameters and their
format, use the record script function, and view the resulting script in a text editor.
The first part of a vbs script corresponds to the fields and selections on the General tab:
Set oModule = oDesign.GetModule("AnalysisSetup")
The vbs script for this setup includes parameters for this information.
Array("NAME:Transient", "TimeProfile:=", "Broadband Pulse", "HfssFre-
quency:=", "5GHz",
"MinFreq:=", "100MHz", "MaxFreq:=", "1GHz",
"NumFreqsExtracted:=", 401,
"SweepMinFreq:=", "100MHz", "SweepMaxFreq:=", "1GHz",
To see the parameters for a specific Setup and their format, use the record script func-
tion, and view the resulting script in a text editor. For descriptions of the parameters, see
the Online help for the setup. See the examples below.
VB Example: Transient Solution Type
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup "HfssTransient",
Array("NAME:Setup1",
"Frequency:=", "1GHz",
"MaxDeltaE:=", 0.1,
"MaximumPasses:=", 20,
"IsEnabled:=", true,
"BasisOrder:=", -1,
"NoAdditionalRefinementOnImport:=", true,
Array("NAME:Transient",
"UseAutoTermination:=", 1,
"SteadyStateCriteria:=", 0.001,
"UseMinimumDuration:=", 0,
"TerminateOnMaximum:=", 1,
"UseMaxTime:=", 1,
"MaxTime:=", "20000ps"))
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("transient")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup "HfssTransient", Array("NAME:Setup1", "Fre-
quency:=", "5GHz", "MaxDeltaS:=", _
0.02, "MaximumPasses:=", 20, "UseImplicitSolver:=", true, "IsEn-
abled:=", true, "BasisOrder:=", _
-1, Array("NAME:Transient", "TimeProfile:=", "Broadband Pulse",
"HfssFrequency:=", _
"5GHz", "MinFreq:=", "100MHz", "MaxFreq:=", "1GHz", "NumFre-
qsExtracted:=", 401, "SweepMinFreq:=", _
"100MHz", "SweepMaxFreq:=", "1GHz", "ListsForFields:=", Array("Facel-
ist1"), "UseSaveCount:=", _
1, "SaveCount:=", 256, "UseSaveStart:=", 1, "SaveStart:=", "0s",
"UseSaveDelta:=", _
1, "SaveDelta:=", "10ps", "SaveRadFields:=", 0, "SaveFDRadFields:=",
0, "UseAutoTermination:=", _
1, "SteadyStateCriteria:=", 0.01, "UseMinimumDuration:=", 0, "Ter-
minateOnMaximum:=", _
1, "UseMaxTime:=", 1, "MaxTime:=", "20ns"))
oModule.InsertSetup("HfssTransient",
Python
Example [ "NAME:Setup2", "Frequency:=" , "5GHz",
InsertSweep [HFSS-IE]
Adds a frequency sweep to a Driven solution-type setup in HFSS-IE.
Command: HFSS-IE>Analysis Setup>Add Sweep
Syntax: InsertSweep <SetupName>, <AttributesArray>
Return Value: None
Parameters: <SetupName>
Type: <string>
Name of the solution setup into which the sweep will be inserted.
<Attributes Array>
Array("NAME:<SweepName>",
"IsEnabled:=", true,
"SetupType:=", <SetupType>,
"Type:=", <SweepType>,
<FrequencyInformation>,
<SaveFieldsList>
<DCExtrapInfo>)
<SweepType>
Type: <string>
Ex. "Discrete", "Fast", or "Interpolating".
<SetupType>
Type: <string>
Ex. "LinearSetup", "LinearCount", or "SinglePoints".
<FrequencyInformation>
This will vary based on the sweep and solution type. See the examples below.
<DCExtrapInfo>
Information about whether and how to perform DC extrapolation. This parameter is not
used for Discrete sweeps. See the examples below.
<additionalRanges>
Array( "SetupType:=", "<SetupType>",
"StartValue:=", "<ValueUnits>",
"StopValue:=", "<ValueUnits", "Count:=", <value>, ...)
"IsEnabled:=", true,
"SetupType:=", "LinearStep", _
"StartValue:=", "0.005GHz", _
"StopValue:=", "2.5GHz", _
"StepSize:=", "0.005GHz", _
"Type:=", "Discrete", "SaveFields:=", false, _
"ExtrapToDC:=", false)
PasteSetup
Use: Paste a solve setup.
Syntax: PasteSetup
Return Value: None
VB Example: oModule.PasteSetup
PasteSweep
Use: Paste a sweep.
Syntax: PasteSweep <SetupName>
Return Value: None
Parameters: <SetupName>
Type: <String>
Name of solve setup where the copied sweep is pasted.
VB Example: oModule.PasteSweep "Setup6"
RenameDrivenSweep
Use: Renames an existing frequency sweep in HFSS. For HFSS-IE use RenameSweep.
Command: Right-click a frequency sweep in the project tree, and then click Rename on the short-
cut menu.
Syntax: RenameDrivenSweep <SetupName>, <OldSweepName>,
<NewSweepName>
Return Value: None
VB Example:
oModule.RenameDrivenSweep "Setup1", "Sweep1", _
"MySweep"
RenameSetup
Use: Renames an existing solution setup.
Command: Right-click a solution setup in the project tree, and then click Rename on the shortcut
menu.
Syntax: RenameSetup <OldName>, <NewName>
Return Value: None
Parameters: <OldName>
Type: <string>
<NewName>
Type: <string>
New name for the solution setup.
VB Example: oModule.RenameSetup "Setup1", "Setup2"
RenameSweep [HFSS-IE]
Use: Renames an existing frequency sweep in HFSS-IE.
Command: Right-click a frequency sweep in the project tree, and then click Rename on the short-
cut menu.
Syntax: RenameSweep <SetupName>, <OldSweepName>,
<NewSweepName>
Return Value: None
VB Example:
oModule.RenameSweep "Setup1", "Sweep1", _
"MySweep"
Type: <string>
New name for the sweep.
VB Example: oModule.RenameSweep "Setup6", "Sweep3", "NewSweep"
RevertAllToInitial
Use: Marks the current mesh for all solution setups as invalid. This will force the next simulation to
begin with the initial mesh.
Command: [product]>Analysis Setup>Revert to Initial Mesh
Syntax: RevertAllToInitial
Return Value: None
For Q3D Extractor and 2D Extractor, the command details are as follows:
Use: Marks the current mesh for all solution setups as invalid. This will force the next simulation to
begin with the initial mesh.
Command: Q3D Extractor or 2D Extractor>Analysis Setup>Revert to Initial Mesh
Syntax: RevertAllToInitial
Return Value: None
VB Example: oModule.RevertAllToInitial
RevertSetupToInitial
Use: Marks the current mesh for a solution setup as invalid. This will force the next simulation to
begin with the initial mesh.
Command: Right-click a setup in the project tree, and then click Revert to Initial Mesh on the
shortcut menu.
Syntax: RevertSetupToInitial <SetupName>
Return Value: None
Parameters: <SetupName>
The name of the solution setup you want to revert to.
VB Example: oModule.RevertSetupToInitial "Setup1"
SetMPIVendor
The documented command is applicable for Q3D Extractor.
Type: <double>
Inequality value.
<OptiGoalSpec>
"Solution:=", <Soln>, "Calculation:=", <Calc>,
"Context:=, <Geometry>
Array("NAME:Ranges",
"Range:", Array("Var:=",
<VarName>, "Type:=", <RangeType>, "Start:=",
<StartV>, "Stop:=", <StopV>), ...
"Range:", Array("Var:=", <VarName>, "Type:=",
<RangeType>, "Start:=", <StartV>, "Stop:=",
<StopV>))
<Soln>
Type: <string>
Name of the solution.
<Calc>
Type: <string>
An expression that is composed of a basic solution quantity and an
output variable.
<ContextName>
Type: <string>
Name of context needed in the evaluation of <Calc>.
<Geometry>
Type: <string>
Name of geometry needed in the evaluation of <Calc>.
<RangeType>
Type: <string>
if "r", start and stop values specify a range for the variable.
if "s", start values specify the single value for the variable.
UI Access NA
DeleteSetups [Optimetrics]
Deletes the specified Optimetrics setups.
Right-click the setup in the project tree, and then click Delete on the shortcut
UI Access
menu
DistributedAnalyzeSetup
Distributes all variable value instances within a parametric sweep to different machines already spe-
cified from within the user interface
Right-click the parametric setup name in the project tree and select Distribute
UI Access
Analysis.
Python oModule.DistributedAnalyzeSetup("ParametricSetup1")
Example
VB oModule.DistributedAnalyzeSetup "ParametricSetup1"
Example
ExportDXConfigFile
Create an xml file with the setup information for Design Xplorer
Right click on the Design Xplorer setup in the project tree and choose Export
UI Access
External Connector Addin Configuration…
oModule.ExportDXConfigFile ("DesignXplorerSetup1",
Python
Example "c:/exportdir/DXSetup1.xml")
VB
oModule.ExportDXConfigFile ("DesignXplorerSetup1",
Example "c:/exportdir/DXSetup1.xml")
ExportOptimetricsProfile
Export Optimetrics profile data
Right click on the Optimetrics setup in the project tree and choose View Ana-
UI Access lysis Result… On the Post Analysis Display dialog, click the Profile tab and
click on the Export button.
oModule.ExportOptimetricsProfile
Python
Example ("StatisticalSetup1", "
VB oModule.ExportOptimetricsProfile
Example "StatisticalSetup1", "c:/exportdir/test.csv"
ExportOptimetricsResult
Export an existing Optimization, Sensitivity, Statistical or DesignXplorer result. (Does not export
Parametric results.)
Right click on the desired Optimetrics setup in the project tree and choose View
UI Access Analysis Result… On the Post Analysis Display dialog, click the Result tab,
then select Table view, and click on the Export button
Python oModule.ExportOptimetricsResult (
Example "StatisticalSetup1", "c:/exportdir/test.csv",false)
ExportParametricResults
Export existing Parametric results.
Right click on the desired Parametric setup in the project tree and choose View
UI Access Analysis Result… On the Post Analysis Display dialog, click the Result tab,
then select Table view, and click on the Export button.
Python oModule.ExportParametricResults (
Example "ParametricSetup1", "c:/exportdir/test.csv", False)
VB oModule.ExportParametricResults
Example "ParametricSetup1", "c:/exportdir/test.csv",false
GetSetupNames [Optimetrics]
Gets a list of Optimetrics setup names
UI Access NA
oModule = oDesign.GetModule("Optimetrics")
Python
Example setupNames = oModule.GetSetupNames()
VB Syntax GetSetupNames()
VB
Set oModule = oDesign.GetModule("Optimetrics")
Example setupNames = oModule.GetSetupNames()
GetSetupNamesByType [Optimetrics]
Gets a list of Optimetrics setup names by type.
UI Access NA
ImportSetup
Import an Optimetric setup from a file.
UI Access NA
oModule.ImportSetup ("OptiStatistical",
Python ["NAME:StatisticalSetup1",
Example
"c:/importdir/mySetupInfoFile"])
"c:/importdir/mySetupInfoFile")
PasteSetup [Optimetrics]
Pastes the specified Optimetrics setup.
UI Access NA
RenameSetup [Optimetrics]
Renames the specified Optimetrics setup.
Right-click the setup in the project tree, and then click Rename on the
UI Access
shortcut menu.
SolveAllSetup
Solves all Optimetrics setups
Python oModule.SolveAllSetup()
Example
VB Syntax SolveAllSetup
VB Example oModule.SolveAllSetup
SolveSetup [Optimetrics]
Solves the specified Optimetrics setup.
Right-click the setup in the project tree, and then click Analyze on the shortcut
UI Access
menu.
Right-click the setup in the project tree, and then click Properties on the short-
UI Access
cut menu.
GenerateVariationData (Parametric)
Generate variation data before parametric solve for CAD integrated project
Command: Right click on the parametric setup in the project tree and choose "Generate Variation
Data"
Syntax: GenerateVariationData <SetupName>
Return Value: None
Parameters: <SetupName>
Name of the setup.
VB Example:
oModule.GenerateVariationData "ParametricSetup1"
InsertSetup [Parametric]
Inserts a new parametric setup.
Right-click the Optimetrics folder in the project tree, and then click Add> Para-
UI Access
metric on the shortcut menu.
<OptiGoalSpec>))
<SetupName> String Name of the parametric setup.
<SimSetups> Array of An array of Twin Builder solution setup
Strings names.
<SweepDefs> Array Array("NAME:Sweeps",
Array("NAME:SweepDefinition", "Variable:=",
oModule.InsertSetup(
"OptiParametric",
["NAME:ParametricSetup1", _
Python
"SaveFields:=", true, _
Example
["NAME:StartingPoint"], _
"Sim. Setups:=", ["Setup1"],_
["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", _
["NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "returnloss", _
"Context:=", "",_
["NAME:Ranges", _
"Range:=", ["Var:=", "Freq", "Type:=","s", _
"Start:=", "8GHz", "Stop:=", "8GHz"]], _
["NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect", _
"Context:=", "", _
["NAME:Ranges", _
"Range:=", ["Var:=", "Freq", "Type:=","s", _
"Start:=", "8GHz", "Stop:=", "8GHz"]]]]]])
oModule.InsertSetup
"OptiParametric",
Array("NAME:ParametricSetup1", _
"SaveFields:=", true, _
Array("NAME:StartingPoint"), _
"Sim. Setups:=", Array("Setup1"),_
Array("NAME:Sweeps", _
Array("NAME:SweepDefinition", _
"Variable:=", "$width", _
"Data:=", "LIN 12mm 17mm 2.5mm", _
"OffsetF1:=", false, _
"Synchronize:=", 0),
Array("NAME:SweepDefinition", _
"Variable:=", "$length", _
VB
"Data:=", "LIN 8mm 12mm 2mm", _
Example
"OffsetF1:=", false, _
"Synchronize:=", 0)),
Array("NAME:Sweep Operations"), _
Array("NAME:Goals", _
Array("NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "returnloss", _
"Context:=", "",_
Array("NAME:Ranges", _
"Range:=", Array("Var:=", "Freq", "Type:=","s", _
"Start:=", "8GHz", "Stop:=", "8GHz"))), _
Array("NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect", _
"Context:=", "", _
Array("NAME:Ranges", _
"Range:=", Array("Var:=", "Freq", "Type:=","s", _
"Start:=", "8GHz", "Stop:=", "8GHz")))))
Right-click the setup in the project tree, and then click Properties on the shortcut
UI Access
menu
oModule.EditSetup("OptimizationSetup1",
[
"NAME:OptimizationSetup1",
"UseFastCalculationUpdateAlgo:=", False,
"FastCalcOptCtrledByUser:=", False,
Python "IsEnabled:=", True,
Example
"SaveSolutions:=", False,
[
"NAME:StartingPoint"
],
"Optimizer:=", "Quasi Newton",
[
"NAME:AnalysisStopOptions",
"StopForNumIteration:=" , True,
"StopForElapsTime:=", False,
"StopForSlowImprovement:=", False,
"StopForGrdTolerance:=", False,
"MaxNumIteration:=",1000,
"MaxSolTimeInSec:=",3600,
"RelGradientTolerance:=", 0,
"MinNumIteration:=", 10
],
"CostFuncNormType:=", "L2",
"PriorPSetup:=", "",
"PreSolvePSetup:=", True,
[
"NAME:Variables"
],
[
"NAME:LCS"
],
[
"NAME:Goals",
[
"NAME:Goal",
"ReportType:=", "Standard",
"Solution:=", "TR",
[
"NAME:SimValueContext",
"SimValueContext:=", [1,0,2,0,False,False,-1,1,0,1,1,"",0,0
]
],
"Calculation:=", "acosh(Time)",
"Name:=", "Time",
[
"NAME:Ranges",
"Range:=", ["Var:=", "Time","Type:=", "a"]
],
"Condition:=", "==",
[
"NAME:GoalValue",
"GoalValueType:=", "Independent",
"Format:=", "Real/Imag",
"bG:=", ["v:=", "[1;]"]
],
"Weight:=", "[1;]"
]
],
"Acceptable_Cost:=" , 0,
"Noise:=", 0.0001,
"UpdateDesign:=", False,
"UpdateIteration:=", 5,
"KeepReportAxis:=", True,
"UpdateDesignWhenDone:=", True
])
oModule.EditSetup "OptimizationSetup1",
Array("NAME:OptimizationSetup1", "UseFastCal-
culationUpdateAlgo:=", _
false, "FastCalcOptCtrledByUser:=", false,
"IsEnabled:=", true, "SaveSolutions:=", _
false, Array("NAME:StartingPoint"), "Optimizer:=",
"Quasi Newton", Array("NAME:AnalysisStopOptions",
"StopForNumIteration:=", _
true, "StopForElapsTime:=", false,
"StopForSlowImprovement:=", false, "StopForGrdTolerance:=",
_
false, "MaxNumIteration:=", 1000, "MaxSolTimeInSec:=",
3600, "RelGradientTolerance:=", _
0, "MinNumIteration:=", 10), "CostFuncNormType:=",
"L2", "PriorPSetup:=", "", "PreSolvePSetup:=", _
VB true, Array("NAME:Variables"), Array("NAME:LCS"),
Exam-
ple Array("NAME:Goals", Array("NAME:Goal", "ReportType:=", _
"Standard", "Solution:=", "TR", Array("NAME:SimValueCon-
text",
"SimValueContext:=", Array( _
1, 0, 2, 0, false, false, -1, 1, 0, 1, 1, "", 0, 0)),
"Calculation:=", "Time", "Name:=", _
"Time", Array("NAME:Ranges", "Range:=",
Array("Var:=", "Time", "Type:=", "a")), "Condition:=", _
"==", Array("NAME:GoalValue", "GoalValueType:=",
"Independent", "Format:=", _
"Real/Imag", "bG:=", Array("v:=", "[1;]")),
"Weight:=", "[1;]")), "Acceptable_Cost:=", _
0, "Noise:=", 0.0001, "UpdateDesign:=", false,
"UpdateIteration:=", 5, "KeepReportAxis:=", _
true, "UpdateDesignWhenDone:=", true)
InsertSetup [Optimization]
Use: Inserts a new optimization setup.
Right-click the Optimetrics folder in the project tree, and then click Add>Op-
UI Access
timization on the shortcut menu.
"MaxStep:=", <MaxStepV>))
<MinStepV> VarValue The minimum step of the variable.
<MaxStepV> VarValue The maximum step of the variable.
<AcceptableCost> Double The acceptable cost value for the optim-
izer to stop.
<Noise> Double The noise of the design.
<UpdateDesign> Boolean Specifies whether or not to apply the
optimal variation to the design after the
optimization is done.
<OptimizationGoalSpec> Array "Condition:=", <Optim-
izationCond>,
Array("NAME:GoalValue",
"GoalValeType:=",
<GoalValueType>,
"Format:=",
<GoalValueFormat>, "bG:=",
Array("v:=", <GoalValue>)),
"Weight:=", <Weight>)
<OptimizationCond> String Either "<=", "==", or ">="
<GoalValueType> String Either "Independent" or "Depend-
ent"
<GoalValueFormat> String Either "Real/Imag" or "Mag/Ang".
<GoalValue> String Value in string. Value can be a real num-
ber, complex number, or expression.
Return None
Value
Command: Right-click the Optimetrics folder in the project tree, and then click Add>Op-
timization on the shortcut menu.
Syntax: InsertSetup "OptiOptimization", <OptimizationParams>
Return Value: None
Parameters: <OptimizationParams>
Array("NAME:<SetupName>", "SaveFields:=",
<SaveField>, <StartingPoint>, "Optimizer:=",
<Optimizer>,
"MaxIterations:=", <MaxIter>, "PriorPSetup:=",
<PriorSetup>, "PreSolvePSetup:=", <Preceed>,
<OptimizationVars>, <Constraint>,
Array("NAME:Goals", Array("NAME:Goal",
<OptiGoalSpec>, <OptimizationGoalSpec>), ...
Array("NAME:Goal", <OptiGoalSpec>,
<OptimizationGoalSpec>)),
"Acceptable_Cost:=", <AcceptableCost>, "Noise:=",
<Noise>, "UpdateDesignWhenDone:=", <UpdateDesign"
<OptimizationVars>
Array("NAME:Variables", "VarName:=", Array("i:=",
<IncludeVar>, "Min:=", <MinV>, "Max:=", <MaxV>,
"MinStep:=", <MinStepV>, "MaxStep:=", <MaxStepV>),
………………. "VarName:=", Array("i:=", <IncludeVar>, "Min:=",
<MinV>, "Max:=", <MaxV>,
"MinStep:=", <MinStepV>, "MaxStep:=", <MaxStepV>))
<MinStepV>
Type : <VarValue>
The minimum step of the variable.
<MaxStepV>
Type: <VarValue>
The maximum step of the variable.
<AcceptableCost>
Type: <double>
The acceptable cost value for the optimizer to stop.
<Noise>
Type: <double>
The noise of the design.
<UpdateDesign>
Type: <bool>
Specifies whether or not to apply the optimal variation to the design after the optimization
is done.
<OptimizationGoalSpec>
"Condition:=", <OptimizationCond>,
Array("NAME:GoalValue", "GoalValueType:=",
<GoalValueType>,
"Format:=", <GoalValueFormat>, "bG:=",
Array("v:=", <GoalValue>)), "Weight:=", <Weight>)
<OptimizationCond>
Type: <string>
Either "<=", "==", or ">="
<GoalValueType>
Type: <string>
Either "Independent" or "Dependent"
<GoalValueFormat>
Type:<string>
Either "Real/Imag" or "Mag/Ang".
<GoalValue>
Type: <string>
Value in string. Value can be a real number, complex number, or expression.
VB Example:
oModule.InsertSetup "OptiOptimization",_
Array("NAME:OptimizationSetup1", _
"SaveFields:=", false, _
Array("NAME:StartingPoint", "$length:=", "8mm", _
"$width:=", "14.5mm"), _
"Optimizer:=", "Quasi Newton", _
"MaxIterations:=", 100, _
"PriorPSetup:=", "ParametricSetup1", _
"PreSolvePSetup:=", true, _
Array("NAME:Variables", _
"$length:=", Array("i:=", true, "Min:=", "6mm", _
"Max:=", "18mm", _
"MinStep:=", "0.001mm", "MaxStep:=", _
"1.2mm"), _
"$width:=", Array("i:=", true, "Min:=", _
"6.5mm", "Max:=", "19.5mm", _
"MinStep:=", "0.001mm", "MaxStep:=", _
"1.3mm")), _
Array("NAME:LCS"), _
Array("NAME:Goals", _
Array("NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "reflect", _
"Context:=", "", _
Array("NAME:Ranges", _
"Range:=", Array("Var:=", "Freq", _
"Type:=", "s", _
"Start:=", "8GHz", "Stop:=", "8GHz")), _
"Condition:=", "<=", _
Array("NAME:GoalValue", _
"GoalValueType:=", "Independent", _
"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)
oModule.InsertSetup(
"OptiOptimization",_
["NAME:OptimizationSetup1", _
"SaveFields:=", false, _
["NAME:StartingPoint", "$length:=", "8mm",_
"$width:=", "14.5mm"], _
"Optimizer:=", "Quasi Newton", _
"MaxIterations:=", 100, _
Python
"PriorPSetup:=", "ParametricSetup1", _
Example
"PreSolvePSetup:=", true, _
["NAME:Variables", _
"$length:=", ["i:=", true, "Min:=", "6mm",_
"Max:=", "18mm", _
"MinStep:=", "0.001mm", "MaxStep:=", _
"1.2mm"], _
"$width:=", ["i:=", true, "Min:=", _
"6.5mm", "Max:=", "19.5mm", _
VB
oModule.InsertSetup
Example "OptiOptimization",_
Array("NAME:OptimizationSetup1", _
"SaveFields:=", false, _
Array("NAME:StartingPoint", "$length:=", "8mm",_
"$width:=", "14.5mm"), _
"Optimizer:=", "Quasi Newton", _
"MaxIterations:=", 100, _
"PriorPSetup:=", "ParametricSetup1", _
"PreSolvePSetup:=", true, _
Array("NAME:Variables", _
"$length:=", Array("i:=", true, "Min:=", "6mm",_
"Max:=", "18mm", _
"MinStep:=", "0.001mm", "MaxStep:=", _
"1.2mm"), _
"$width:=", Array("i:=", true, "Min:=", _
"6.5mm", "Max:=", "19.5mm", _
"MinStep:=", "0.001mm", "MaxStep:=", _
"1.3mm")), _
Array("NAME:LCS"), _
Array("NAME:Goals", _
Array("NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "reflect", _
"Context:=", "", _
Array("NAME:Ranges", _
"Range:=", Array("Var:=", "Freq", _
"Type:=", "s", _
"Start:=", "8GHz", "Stop:=", "8GHz")), _
"Condition:=", "<=", _
Array("NAME:GoalValue", _
"GoalValueType:=", "Independent", _
"Format:=", "Real/Imag", _
"bG:=", Array("v:=", "[0.0001]")), _
"Weight:=", "[1]")),
"Acceptable_Cost:=", 0.0002, _
"Noise:=", 0.0001, _
"UpdateDesign:=", true, _
"UpdateIteration:=", 5, _
"KeepReportAxis:=", true, _
"UpdateDesignWhenDone:=", true)
Right-click the setup in the project tree, and then click Properties on the shortcut
UI Access
menu
oModule.EditSetup("OptimizationSetup1",
[
Python
Exampl- "NAME:OptimizationSetup1",
e
"UseFastCalculationUpdateAlgo:=", False,
"FastCalcOptCtrledByUser:=", False,
"IsEnabled:=", True,
"SaveSolutions:=", False,
[
"NAME:StartingPoint"
],
"Optimizer:=", "Quasi Newton",
[
"NAME:AnalysisStopOptions",
"StopForNumIteration:=", True,
"StopForElapsTime:=", False,
"StopForSlowImprovement:=", False,
"StopForGrdTolerance:=" , False,
"MaxNumIteration:=", 1001,
"MaxSolTimeInSec:=", 3600,
"RelGradientTolerance:=", 0,
"MinNumIteration:=", 10
],
"CostFuncNormType:=", "L2",
"PriorPSetup:=", "",
"PreSolvePSetup:=", True,
[
"NAME:Variables"
],
[
"NAME:LCS"
],
[
"NAME:Goals",
[
"NAME:Goal",
"ReportType:=", "Standard",
"Solution:=", "TR3",
[
"NAME:SimValueContext",
"SimValueContext:=", [1,0,2,0,False,False,-
1,1,0,1,1,"",0,0]
],
"Calculation:=", "mag(DIFF1.VAL)",
"Name:=", "DIFF1.VAL",
[
"NAME:Ranges",
"Range:=", [
"Var:=", "Time","Type:=", "a"]
],
"Condition:=", "==",
[
"NAME:GoalValue",
"GoalValueType:=", "Independent",
"Format:=", "Real/Imag",
"bG:=", ["v:=", "[1;]"]
],
"Weight:=", "[1;]"
]
],
"Acceptable_Cost:=", 0,
"Noise:=", 0.0001,
"UpdateDesign:=", False,
"UpdateIteration:=", 5,
"KeepReportAxis:=", True,
"UpdateDesignWhenDone:=", True
])
"PreSolvePSetup:=", True,
Array(
"NAME:Variables"
),
Array(
"NAME:LCS"
),
Array(
"NAME:Goals",
Array(
"NAME:Goal",
"ReportType:=", "Standard",
"Solution:=", "TR3",
Array(
"NAME:SimValueContext",
"SimValueContext:=",
Array(1,0,2,0,False,False,-1,1,0,1,1,"",0,0)
),
"Calculation:=", "mag(DIFF1.VAL)",
"Name:=", "DIFF1.VAL",
Array(
"NAME:Ranges",
"Range:=", Array("Var:=", "Time","Type:=", "a")
),
"Condition:=", "==",
Array(
"NAME:GoalValue",
"GoalValueType:=", "Independent",
"Format:=", "Real/Imag",
InsertSetup [Sensitivity]
Inserts a new sensitivity setup.
oModule.InsertSetup(
"OptiSensitivity", _
["NAME:SensitivitySetup1",_
"SaveFields:=", true,_
["NAME:StartingPoint"], _
"MaxIterations:=", 20,_
"PriorPSetup:=", "",_
"PreSolvePSetup:=", true, _
Python
["NAME:Variables"], _
Example
["NAME:LCS"],_
"NAME:Goals",_
["NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "returnloss",_
"Context:=", "",_
["NAME:Ranges",_
"Range:=", ["Var:=", "Freq", "_
Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz"]]],_
["NAME:Goal",_
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect",_
"Context:=", "",_
["NAME:Ranges",_
"Range:=", ["Var:=","Freq",_
"Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz"]]]],_
"Master Goal:=", 1,_
"MasterError:=", 0.001])
"Context:=", "",_
Array("NAME:Ranges",_
"Range:=", Array("Var:=", "Freq", "_
Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz"))),_
Array("NAME:Goal",_
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect",_
"Context:=", "",_
Array("NAME:Ranges",_
"Range:=", Array("Var:=","Freq",_
"Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz")))),_
"Master Goal:=", 1,_
"MasterError:=", 0.001)
Right-click the setup in the project tree, and clickProperties on the shortcut
UI Access
menu.
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 13.0.0
' 3:04:05 PM May 18, 2010
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("optiguides")
Set oDesign = oProject.SetActiveDesign("HFSSModel1")
Set oModule = oDesign.GetModule("Optimetrics")
oModule.EditSetup "StatisticalSetup1", Array("NAME:S-
tatisticalSetup1",
Array("NAME:ProdOptiSetupData",
"SaveFields:=", true, "CopyMesh:=", false),
Array("NAME:StartingPoint", "$length:=", "7.824547736mm",
"$width:=", "14.8570192mm"),
"MaxIterations:=", 50,
"PriorPSetup:=", "",
Array("NAME:Variables",
"$length:=", Array("i:=", true,
"int:=", false,
"Dist:=", "Uniform",
"Tol:=", "10%", "StdD:=", "0.2mm", "Min:=", "-3",
"Max:=", "3", "Shape:=", "1", "Scale:=", "0.04mm",
"Location:=", "0.4mm",
"Dataset:=", "", "LatinHypercube:=", "true", "VarMin:=", "0.2mm",
"VarMax:=", "0.6mm", "Prob:=", "0.01",
"Mean:=", "0.4mm"),
"$width:=", Array("i:=", true,
"int:=", false,
"Dist:=", "Gaussian",
"Tol:=", "10%",
"StdD:=", "0.2mm",
"Min:=", "-3", "Max:=", "3",
"Shape:=", "1",
"Scale:=", "0.04mm",
"Location:=", "0.4mm",
"Dataset:=", "",
"LatinHypercube:=", "true",
"VarMin:=", "0.2mm", "VarMax:=", "0.6mm",
"Prob:=", "0.02",
"Mean:=", "0.4mm")),
Array("NAME:Goals", Array("NAME:Goal",
"ReportType:=", "Modal Solution Data",
"Solution:=", "Setup1 : PortOnly",
Array("NAME:SimValueContext", "Domain:=", "Sweep"),
"Calculation:=", "returnloss",
"Name:=", "returnloss",
Array("NAME:Ranges",
"Range:=", Array("Var:=", "Freq",
"Type:=", "s",
"Start:=", "8.2GHz", "Stop:=", "0"))),
Array("NAME:Goal",
"ReportType:=", "Modal Solution Data",
"Solution:=", "Setup1 : PortOnly",
Array("NAME:SimValueContext",
"Domain:=", "Sweep"),
"Calculation:=", "reflect",
"Name:=", "reflect",
Array("NAME:Ranges",
"Range:=", Array("Var:=", "Freq",
"Type:=", "s",
"Start:=", "8.2GHz", "Stop:=", "0")))))
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.
tribution is Uniform
<StdD> VarValue The standard deviation for the variable when
distribution is Gaussian.
<MinCutoff> Double The minimum cut-off for the variable when dis-
tribution is Gaussian.
<MaxCutoff> Double The maximum cut-off for the variable when dis-
tribution is Gaussian.
oModule.InsertSetup(
"OptiStatistical", _
["NAME:StatisticalSetup1", _
"SaveFields:=", true, _
["NAME:StartingPoint"],_
"MaxIterations:=", 50,_
"PriorPSetup:=", "", _
["NAME:Variables"], _
["NAME:Goals", _
["NAME:Goal", _
Python
Example "Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "returnloss", _
"Context:=", "", _
["NAME:Ranges", _
"Range:=", ["Var:=", "Freq", _
"Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz"]]],_
["NAME:Goal",_
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect",_
"Context:=", "", _
["NAME:Ranges",_
"Range:=", ["Var:=", "Freq", "Type:=",_
"s", "Start:=", "8GHz", "Stop:=", "8GHz"]]]])
Example:
' ----------------------------------------------
' Script Recorded by Ansoft HFSS Version 13.0.0
' 3:29:39 PM May 18, 2010
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
oDesign.ChangeProperty Array("NAME:AllTabs",
Array("NAME:LocalVariableTab",
Array("NAME:PropServers", "LocalVariables"),
Array("NAME:ChangedProps",
Array("NAME:offset",
Array("NAME:Statistical", "Included:=", true)))))
Set oModule = oDesign.GetModule("Optimetrics")
oModule.InsertSetup "OptiStatistical", Array("NAME:S-
tatisticalSetup1",
Array("NAME:ProdOptiSetupData",
"SaveFields:=", false, "CopyMesh:=", false),
Array("NAME:StartingPoint", "offset:=", "0in"),
"MaxIterations:=", 50, "PriorPSetup:=", "",
Array("NAME:Variables",
Array("NAME:Goals", Array("NAME:Goal",
"ReportType:=", "Modal Solution Data",
"Solution:=", "Setup1 : LastAdaptive", Array("NAME:SimValueCon-
text"),
"Calculation:=", "Power11",
"Name:=", "Power11",
Array("NAME:Ranges",
"Range:=", Array("Var:=", "Freq", "Type:=", "d",
"DiscreteValues:=", "10GHz")))))
For Q3D Extractor and Circuit the command details are as follows:
Inserts a new statistical setup.
Command: Right-click Optimetrics in the project tree, and then click Add>Statistical on the
shortcut menu.
Syntax: InsertSetup "OptiStatistical", <StatisticalParams>
Return Value: None
Parameters: <StatisticalParams>
Array("NAME:<SetupName>", "SaveFields:=",
<SaveField>, <StartingPoint>, "MaxIterations:=",
<MaxIter>, "PriorPSetup:=", <PriorSetup>,
"PreSolvePSetup:=", <Preceed>, <StatisticalVars>,
Array("NAME:Goals", Array("NAME:Goal",
<OptiGoalSpec>), …, Array("NAME:Goal",
<OptiGoalSpec>))),
<StatisticalVars>
Array("NAME:Variables",
"VarName:=", Array("i:=", <IncludeVar>, "Dist:=",
<DistType>, "Tol:=", <Tolerance>,
"StdD:=", <StdD>, "Min:=", <MinCutoff>, "Max:=",
<MaxCutoff>, ...
"VarName:=", Array("i:=", <IncludeVar>, "Dist:=",
<DistType>, "Tol:=", <Tolerance>, "StdD:=",
<StdD>, "Min:=", <MinCutoff>, "Max:=",
<MaxCutoff>))
Parameters:
<DistType>
Type : <string>
Distrbution can be "Gaussian" or "Uniform".
<Tolerance>
Type: <VarValue>
The tolerance for the variable when distribution is Uniform.
<StdD>
Type: <VarValue>
The standard deviation for the variable when distribution is
Gaussian.
<MinCutoff>
Type: <double>
The minimum cut-off for the variable when distribution is Gaus-
sian.
<MaxCutoff>
Type: <double>
The maximum cut-off for the variable when distribution is Gaus-
sian.
Example: oModule.InsertSetup "OptiStatistical", _
Array("NAME:StatisticalSetup1", _
"SaveFields:=", true, _
Array("NAME:StartingPoint"),_
"MaxIterations:=", 50,_
"PriorPSetup:=", "", _
Array("NAME:Variables"), _
Array("NAME:Goals", _
Array("NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "returnloss", _
"Context:=", "", _
Array("NAME:Ranges", _
"Range:=", Array("Var:=", "Freq", _
"Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz"))),_
Array("NAME:Goal",_
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect",_
"Context:=", "", _
Array("NAME:Ranges",_
"Range:=", Array("Var:=", "Freq", "Type:=", _
"s", "Start:=", "8GHz", "Stop:=", "8GHz"))))
DeleteSolutionVariation
Deletes all solution data for specific solutions and design variations. This is obsolete and is sup-
ported only for backward compatibility. You should use DeleteFullVariation.
Command: [product]>Results>Clean Up Solutions
Syntax: DeleteSolutionVariation
Array(<DataSpecifierArray>, ...)
Return Value: None
Parameters: <DataSpecifierArray>
Array(<DesignVariationKey>, <SetupName>, <SolnName>)
<DesignVariationKey>
Type: <string>
Design variation string.
<SetupName>
Type: <string>
Name of the solution setup.
<SolnName>
Type: <string>
Name of the solutions within the solution setup.
VB Example:
oModule.DeleteSolutionVariation Array( _
Array("width=’2in’", "Setup1", "Adaptive_1") _
Array("width=’2in’", "Setup1", "Sweep1") )
<SetupName>
Type: <string>
Name of the solve setup.
<SolnName>
Type: <string>
Name of the solutions within the solve setup.
VB Example: oModule.DeleteSolutionVariation Array(Array("width-
='2in'", "Setup1", "Adaptive_1") _
Array("width='2in'", "Setup1", "LastAdaptive") )
CreateFieldPlot
DeleteFieldPlot
GetFieldPlotName
ModifyFieldPlot
RenameFieldPlot
RenamePlotFolder
SetFieldPlotSettings
SetPlotFolderSettings
UpdateAllFieldsPlots
UpdateQuantityFieldsPlots
AddMarkerToPlot
Use: Adds a marker to a trace on a named field plot.
Command: None.
Syntax: AddMarkerToPlot , <location>, <fieldPlotName>
Return Value: None
Parameters: <Location>
Type: <Coord>
X.Y, and Z coordinates for the marker.
<FieldPlotName>
Type: <string>
Name of the field plot.
VB Example:
CreateFieldPlot
Use: Creates a field/mesh plot "Field" or a visual ray trace ("VRT") plot.
Command: HFSS>Fields>Plot Fields>Mag_E
Command: Maxwell3D or Maxwell2D>Fields>Fields>E>Mag_E
Syntax: CreateFieldPlot <PlotParameterArray> ["Field" | "VRT"]
Return Value: None
Parameters: <PlotParameterArray> "Field"
Array("NAME:<PlotName>",
"SolutionName:=", <string>,
"QuantityName:=", <string>,
"PlotFolder:=", <string>,
"UserSpecifyName:=", <int>,
"UserSpecifyFolder:=", <int>,
"IntrinsicVar:=", <string>,
"PlotGeomInfo:=", <PlotGeomArray>,
"FilterBoxes:=", <FilterBoxArray>,
<PlotOnPointsSettings>,
<PlotOnLineSettings>,
<PlotOnSurfaceSettings>,
<PlotOnVolumeSettings>)
SolutionName
Name of the solution setup and solution formatted as:
"<SolveSetupName> : <WhichSolution>",
where <WhichSolution> can be "Adaptive_<n>",
"LastAdaptive", or "PortOnly".
For example: "Setup1 : Adaptive_2"
HFSS requires a space on either side of the ‘:’ character. If it is missing, the plot will not
be created.
QuantityName
Type of plot to create. Possible values are:
Mesh plots: "Mesh"
Field plots: "Mag_E", "Mag_H", "Mag_Jvol", "Mag_Jsurf",
"ComplexMag_E", "ComplexMag_H", "ComplexMag_Jvol",
"ComplexMag_Jsurf", "Vector_E", "Vector_H",
"Vector_Jvol", "Vector_Jsurf", "Vector_RealPoynting",
"Local_SAR", "Average_SAR"
PlotFolder
Name of the folder to which the plot should be added. Possible values
are: "E Field", "H Field", "Jvol", "Jsurf", "SAR
Field", and "MeshPlots".
UserSpecifyName
0 if default name for plot is used, 1 otherwise.
Not needed. <PlotName> will be respected regardless of whether this
flag is set.
UserSpecifyFolder
0 if default folder for plot is used, 1 otherwise.
IntrinsicVar
Formatted string that specifies the frequency and phase at which to make the plot.
For example: "Freq='1GHz' Phase='30deg'"
<PlotGeomArray>
Array(<NumGeomTypes>, <GeomTypeData>,
<GeomTypeData>, ...)
For example: Array(4, "Volume", "ObjList", 1, "Box1",
"Surface", "FacesList", 1, "12", "Line", 1,
"Polyline1", "Point", 2, "Point1", "Point2")
<NumGeomTypes>
Type: <int>
Number of different geometry types (volume, surface, line, point)
plotted on at the same time.
<GeomTypeData>
<GeomType>, <ListType>, <NumIDs>, <ID>, <ID>, ...)
<GeomType>
Type: <string>
Possible values are "Volume", "Surface", "Line", "Point".
<ListType>
Type: <string>
Possible values are "ObjList", or "FacesList".
These are used for the GeomType of "Line" or "Point".
<NumIDs>
Type: <int>
Number of IDs or object names that will follow.
<ID>
Type: <int> or <string>
ID of a face or name of an object, line, or point on which to plot.
<FilterBoxArray>
Array of names of objects to use to restrict the plot range.
Array(<NumFilters>, <ObjName>, <ObjName>, ...)
Example: Array(1, "Box1")
Example: Array(0) no filtering
<PlotOnPointSettings>
Array("NAME:PlotOnPointSettings",
"PlotMarker:=", <bool>,
"PlotArrow:=", <bool>)
<PlotOnLineSettings>
Array("NAME:PlotOnLineSettings",
Array("NAME:LineSettingsID",
"Width:=", <int>,
"Style:=", <string>),
"IsoValType:=", <string>,
"ArrowUniform:=", <bool>,
"NumofArrow:=", <int>)
Style
IsoValType
Possible values are "Tone", "Fringe", "Gourard"
<PlotOnSurfaceSettings>
Array("NAME:PlotOnSurfaceSettings",
"Filled:=", <bool>,
"IsoValType:=", <string>,
"SmoothShade:=", <bool>,
"AddGrid:=", <bool>,
"MapTransparency:=", <bool>,
"Transparency:=", <doubl.e>,
"ArrowUniform:=", <bool>
"ArrowSpacing:=", <double>
"GridColor:=", Array(<int>, <int>, <int>)
IsoValType
Possible values are: "Tone", "Line", "Fringe", "Gourard"
GridColor
Array containing the R, G, B components of the color. Components
should be in the range 0 to 255.
<PlotOnVolumeSettings>
Array("NAME:PlotOnVolumeSettings",
"PlotIsoSurface:=", <bool>,
"CloudDensity:=", <double>,
"PointSize:=", <int>,
"ArrowUniform:=", <bool>,
"ArrowSpacing:=", <double>)
Example Field Plot:
oModule.CreateFieldPlot Array("NAME:Mag_E1", _
"SolutionName:=", "Setup1 : LastAdaptive", _
"QuantityName:=", "Mag_E", _
"PlotFolder:=", "E Field1", _
"UserSpecifyName:=", 0, _
"UserSpecifyFolder:=", 0, _
"IntrinsicVar:=", "Freq='1GHz' Phase='0deg'",_
"PlotGeomInfo:=", Array( 1, "Surface",_
"FacesList", 1, "7"),_
"FilterBoxes:=", Array(0),
Array("NAME:PlotOnSurfaceSettings", _
"Filled:=", false, _
"IsoValType:=", "Fringe", _
"SmoothShade:=", true, _
"AddGrid:=", false, _
"MapTransparency:=", true, _
"Transparency:=", 0, _
"ArrowUniform:=", true, _
"ArrowSpacing:=", 0.100000001490116, _
"GridColor:=", Array(255, 255, 255)))
"UserSpecifyFolder:=", <int>,
"IntrinsicVar:=", <string>,
"MaxFrequency:=", "<Number><FreqUnits>", _
"LaunchFrom:=", ["Launch from custom", |
"LaunchFromPointID:=",] _
18007, "RayDensity:=", <int>, _
"NumberBounces:=", <int>, _
"Multi-Bounce Ray Density Control:=", <Boolean>, _
"MBRD Max sub divisions:=", <int>, _
"ShootFilterType:=", ["All Rays" | _
"Rays by index", "start index:=", <int>, "stop index:=", <int>,
"index step:=", <int> |_
"Rays in box", "FilterBoxID:=", <objID> | _
"Single ray", "Ray elevation:=", "<real>deg", "Ray azimuth:=",
"<real>deg"
"),
"VRT"
Example VRT Plot:
' ----------------------------------------------
' Script Recorded by ANSYS Electronics Desktop Version 2017.2.0
' 14:03:00 Jun 21, 2017
' ----------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("abrams_1p5")
Set oDesign = oProject.SetActiveDesign("UseSbr")
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.CreateFieldPlot Array("NAME:VRT_Plot1", _
"SolutionName:=", "Setup1 : LastAdaptive", _
"QuantityName:=", "QuantityName_SBR", _
"PlotFolder:=", "Visual Ray Trace SBR", "UserSpecifyName:=", 0,
"UserSpecifyFolder:=", 0, _
"IntrinsicVar:=", "", "MaxFrequency:=", "1GHz", "LaunchFrom:=",
"Launch from custom", _
"LaunchFromPointID:=", 18007, "RayDensity:=", 2, "NumberBounces:=",
5, _
"Multi-Bounce Ray Density Control:=", false, "MBRD Max sub divi-
sions:=", 2, "ShootFilterType:=", "All Rays"), "VRT"
"ArrowUniform:=", true, _
"ArrowSpacing:=", 0.100000001490116, _
"GridColor:=", Array(255, 255, 255))), "Field"
For Q3D Extractor and 2D Extractor, the command details are as follows:
PlotFolder
Name of the folder to which the plot should be added. Possible
values are: "Q", "ABS_Q", "JDC Vol", "Phi", "JDC Surf", and "JAC".
UserSpecifyName
0 if default name for plot is used, 1 otherwise.
This parameter is not essential. <PlotName> is respected regard-
less of whether this flag is set.
UserSpecifyFolder
0 if the default folder for plot is used, 1 otherwise.
This parameter is not essential. The specified PlotFolder is
respected regardless of whether this flag is set.
IntrinsicVar
Formatted string that specifies the frequency and phase at which
to create the plot.
For example: "Freq='1GHz' Phase='30deg'"
<PlotGeomArray>
Array(<NumGeomTypes>, <GeomTypeData>,
<GeomTypeData>, ...)
For example: Array(4, "Volume", "ObjList", 1, "Box1",
"Surface", "FacesList", 1, "12", "Line", 1,
"Polyline1", "Point", 2, "Point1", "Point2")
<NumGeomTypes>
Type: <int>
Number of different geometry types (volume, surface, line, point)
plotted at the same time.
<GeomTypeData>
<GeomType>, <ListType>, <NumIDs>, <ID>, <ID>, ...)
<GeomType>
Type: <string>
Possible values are "Volume", "Surface", "Line", "Point".
<ListType>
Type: <string>
Possible values are "ObjList" or "FacesList".
These are used for GeomType values "Line" or "Point".
<NumIDs>
Type: <int>
Number of IDs or object names that will follow.
<ID>
Type: <int> or <string>
ID of a face or name of an object, line, or point on which to plot.
<FilterBoxArray>
Array of object names used to restrict the plot range.
DeleteFieldPlot
Use: Deletes one or more plots.
Command: HFSS>Fields>Delete Plot
Command: Maxwell3D or Maxwell2D>Fields>Delete Plot
Command: Q3D Extractor or 2D Extractor>Fields>Delete Plot
Syntax: DeleteFieldPlot <NameArray>
Return Value: None
Parameters: <NameArray>
Array of strings – the names of the plots to delete.
VB Example:
oModule.DeleteFieldPlot Array("Mag_E1", "Vector_E1")
GetFieldPlotNames
Gets the names of field overlay plots defined in a design.
Syntax: GetFieldPlotNames()
Return Value: Array of field plot names.
Parameters: None
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject
Set oDesign = oProject.GetActiveDesign
Set oReportModule = oDesign.GetModule("ReportSetup")
Dim names
names = oReportModule.GetAllReportNames
For index = 0 to UBound(names)
MsgBox(names(index))
Next
Set oFieldReportModule = oDesign.GetModule("FieldsReporter")
Set collection = oFieldReportModule.GetFieldPlotNames
For index = 0 to collection.Count-1
MsgBox(collection.Item(index))
Next
ModifyFieldPlot
Use: Modifies a plot definition.
Command: HFSS>Fields>Modify Plot
Command: Maxwell3D or Maxwell2D>Fields>Modify Plot
Command: Q3D Extractor or 2D Extractor>Fields>Modify Plot
Syntax: ModifyFieldPlot <OriginalName> <PlotParameterArray>
Return Value: None
VB Example:
oModule.ModifyFieldPlot "Vector_E1",_
Array("NAME:Vector_E2", _
"SolutionName:=", "Setup1 : LastAdaptive", _
"QuantityName:=", "Vector_E", _
"PlotFolder:=", "E Field1", _
"UserSpecifyName:=", 0, _
"UserSpecifyFolder:=", 0, _
"IntrinsicVar:=","Freq='1GHz' Phase='30deg'", _
"PlotGeomInfo:=", Array(1,_
"Surface","FacesList", 1, "7"), _
"FilterBoxes:=", Array(0), _
Array("NAME:PlotOnSurfaceSettings", _
"Filled:=", false, _
"IsoValType:=", "Fringe", _
"SmoothShade:=", true, _
"AddGrid:=", false, _
"MapTransparency:=", true, _
"Transparency:=", 0, _
"ArrowUniform:=", true, _
"ArrowSpacing:=", 0.100000001490116, _
"GridColor:=", Array(255, 255, 255)))
RenameFieldPlot
Use: Renames a plot.
Command: Right-click the plot you want to rename in the project tree, and then click Rename on
the shortcut menu.
Syntax: RenameFieldPlot <OldName> <NewName>
Return Value: None
Parameters: <OldName>
Type: <string>
Original name of the plot.
<NewName>
Type: <string>
New name of the plot.
VB Example:
oModule.RenameFieldPlot "Vector_E1", "Vector_E2"
RenamePlotFolder
Use: Renames a plot folder.
Command: Right-click a plot folder in the project tree, and then click Rename on the shortcut
menu.
Syntax: RenamePlotFolder <OldName> <NewName>
Return Value: None
Parameters: <OldName>
Type: <string>
Original name of the folder.
<NewName>
Type: <string>
New name of the folder.
VB Example:
oModule.RenamePlotFolder "E Field", "Surface Plots"
SetFieldPlotSettings
Sets plot attributes.
Command: HFSS>Fields>Modify Plot Attributes, under the Plots tab.
Command: Maxwell3D or Maxwell2D>Fields>Modify Plot Attributes, under the Plots tab.
Command: Q3D Extractor or 2D Extractor>Fields>Modify Plot Attributes, under the Plots
tab.
Syntax: SetFieldPlotSettings <PlotName> <PlotItemAttributes>
Return Value: None
Parameters: <PlotName>
Type: <string>
Name of the plot to modify.
<PlotItemAttributes>
Array("NAME:FieldsPlotItemSettings",
<PlotOnPointsSettings>,
<PlotOnLineSettings>,
<PlotOnSurfaceSettings>,
<PlotOnVolumeSettings>)
See description of CreateFieldPlot command for details.
VB Example:
oModule.SetFieldPlotSettings "Mag_E2", _
Array("NAME:FieldsPlotItemSettings", _
Array("NAME:PlotOnLineSettings", _
Array("NAME:LineSettingsID", _
"Width:=", 4,
"Style:=", "Cylinder"), _
"IsoValType:=", "Tone", _
"ArrowUniform:=", true, _
"NumofArrow:=", 100), _
Array("NAME:PlotOnSurfaceSettings", _
"Filled:=", false, _
"IsoValType:=", "Tone", _
"SmoothShade:=", true, _
"AddGrid:=", false, _
"MapTransparency:=", true, _
"Transparency:=", 0, _
"ArrowUniform:=", true, _
"ArrowSpacing:=", 0.100000001490116, _
"GridColor:=", Array(255, 255, 255)))
SetPlotFolderSettings
Sets the attributes of all plots in the specified folder.
Command: HFSS>Fields>Modify Plot Attributes
Command: Maxwell3D or Maxwell2D>Fields>Modify Plot Attributes
Command: Q3D Extractor or 2D Extractor>Fields>Modify Plot Attributes
Syntax: SetPlotFolderSettings <PlotFolderName> <PlotFolderAttributes>
Return Value: None
Parameters: <PlotFolderName>
Type: <string>
Name of the folder with the attributes to modify.
<PlotFolderAttributes>
Array("NAME:FieldsPlotSettings",
<ColorMapSettings>
Array("NAME:ColorMapSettings",
"ColorMapType:=", <string>,
"SpectrumType:=", <string>,
"UniformColor:=", Array(<int>, <int>, <int>),
"RampColor:=", Array(<int>, <int>, <int>)
ColorMapType
Possible values are "Uniform", "Ramp", "Spectrum"
SpectrumType
Possible values are "Rainbow", "Temperature", "Magenta", "Gray"
UniformColor, RampColor
Array containing the R, G, B components of the color. Components should be in the
range 0 to 255.
<Scale3DSettings>
Array("NAME:Scale3DSettings",
"m_nLevels:=", <int>,
"m_autoScale:=", <bool>,
"minvalue:=", <double>,
"maxvalue:=", <double>,
"log:=", <bool>,
"IntrinsicMin:=", <double>,
"IntrinsicMax:=", <double>)
<Marker3DSettings>
Array("NAME:Marker3DSettings",
"MarkerType:=", <int>,
"MarkerMapSize:=", <bool>,
"MarkerMapColor:=", <bool>,
"MarkerSize:=", <double>)
MarkerType
9: Sphere
10: Box
11: Tetrahedron
12: Octahedron
default: Sphere
<Arrow3DSettings>
Array("NAME:Arrow3DSettings",
"ArrowType:=", <int>,
"ArrowMapSize:=", <bool>,
"ArrowMapColor:=", <bool>,
"ShowArrowTail:=", <bool>,
"ArrowSize:=", <double>)
ArrowType
0: Line
1: Cylinder
2: Umbrella
default: Line
VB Example:
oModule. SetPlotFolderSettings "E Field1", _
Array("NAME:FieldsPlotSettings", _
"Real time mode:=", true, _
Array("NAME:ColorMapSettings", _
"ColorMapType:=", "Spectrum", _
"SpectrumType:=", "Rainbow", _
"UniformColor:=", Array(127, 255, 255), _
"RampColor:=", Array(255, 127, 127)), _
Array("NAME:Scale3DSettings", _
"m_nLevels:=", 27, _
"m_autoScale:=", true, _
"minvalue:=", 9.34379863739014, _
"maxvalue:=", 13683.755859375, _
"log:=", false, _
"IntrinsicMin:=", 9.34379863739014, _
"IntrinsicMax:=", 13683.755859375), _
Array("NAME:Marker3DSettings", _
"MarkerType:=", 0, _
"MarkerMapSize:=", true, _
"MarkerMapColor:=", false, _
"MarkerSize:=", 0.25), _
Array("NAME:Arrow3DSettings", _
"ArrowType:=", 1, _
"ArrowMapSize:=", true, _
"ArrowMapColor:=", true, _
"ShowArrowTail:=", true, _
"ArrowSize:=", 0.25))
UpdateAllFieldsPlots
Updates the All Fields Plots.
Command: None.
Syntax: UpdateAllFieldsPlots ()
Return Value: None
Parameters: None
VB Example:
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.UpdateAllFieldsPlots()
UpdateQuantityFieldsPlots
Use: Updates the Quantity Fields Plots.
Command: None.
Syntax: UpdateQuantityFieldsPlots (<quantity_folder_name>)
Return Value: None
Parameters: <quantity_folder_name>
Type: <string>
Folder containing the plotted quantities
VB Example:
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.UpdateQuantityFieldsPlots("fldplt")
ExportOnGrid
ExportToFile
GetTopEntryValue
LoadNamedExpressions
SaveNamedExpressions
AddNamedExpression
Creates a named expression using the expression at the top of the stack.
Command: Click Add.
Syntax: AddNamedExpression <Name>
Return Value: None
Parameters: <ExpressionName> and <FieldType>.
Type: <string>
Name for the new named expression.
<FieldType>
Type: <string>
VB Example:
oModule.AddNamedExpression "Mag_JxE", "Fields"
AddNamedExpr
Creates a named expression using the expression at the top of the stack.
Command: Click Add.
Syntax: AddNamedExpr <Name>
Return Value: None
Parameters: <ExpressionName>
Type: <string>
Name for the new named expression.
<FieldType>
Type: <string>
VB Example:
CalcOp
Use: Performs a calculator operation.
Command: Operation commands like Mag, +, etc.
Syntax: CalcOp <OperationString>
Return Value: None
Parameters: <OperationString>
Type: String
The text on the corresponding calculator button.
Examples: Mag, +
CalcRead(deprecated)
Use:Reads a file that is written out by the CalcWrite command, and puts the result into a calculator
numeric.
Syntax:CalcRead <FileName> <SolutionName> <VariablesArray>
Return Value:None
Parameters:<FileName>
Type: <string>
<SolutionName>
Type: <string>
<VariablesArray>
Array of variable name and value pairs.
oModule.CalcRead _
"c:\example.reg" "Setup1: LastAdaptive",_
Array ("Freq:=", "10GHz", "Phase:=", "0deg")
CalculatorRead
Use: Gets a register file and applies it to the calculator stack.
Command: Click Read
Syntax: CalculatorRead <InputFilePath>, <SolutionName>, <FieldType>, <VariablesArray>
<SolutionName>
Type: <string>
Example: "Setup1 : LastAdaptive"
<FieldType>
Type: <string>
<VariablesArray>
Array of variable names, value pairs.
VB Example:
oModule.CalculatorRead "c:\test.reg", _
"Setup1 : LastAdaptive", "Fields", _
Array("Freq:=", "1GHz", "Phase:=", "0deg")
For Q3D Extractor, the command example is as follows:
VB Example: oModule.CalculatorRead "C:\Ansoft\smoothedtemper.fld",
"Setup1 : LastAdaptive", "Fields", Array("$conductivity:=",
"50000000")
CalcStack
Use: Performs an operation on the stack.
Command: Stack operation buttons such as Push and Pop.
Syntax: CalcStack <OperationString>
Return Value: None
Parameters: <Operation String>
Type: <string>
The text on the corresponding calculator button.
VB Example:
oModule.CalcStack "push"
CalculatorWrite
Use: Writes contents of top register to file.
Command: Click Write
Syntax: CalculatorWrite <OutputFilePath>, <SolutionNameArray>, <VariablesArray>
Return Value: None
Parameters: <OutputFilePath>
Path to and including name of output register file.
<SolutionNameArray>
Array("Solution:=", <string>)
<VariablesArray>
Array of variable names, value pairs.
VB Example:
oModule.CalculatorWrite "c:\test.reg", _
Array("Solution:=", "Setup1 : LastAdaptive"), _
Array("Freq:=", "1GHz", "Phase:=", "0deg")
ChangeGeomSettings
Use: Changes the line discretization setting.
Command: Geom Settings
Syntax: ChangeGeomSettings <int>
Return Value: None
Parameters: The line discretization setting.
ClcEval
Use: Evaluates the expression at the top of the stack using the provided solution name and variable
values.
Command: Click Eval.
Syntax: ClcEval <SolutionName> <VariablesArray>
Return Value: None
Parameters: <SolutionName>
Type: <string>
<VariablesArray>
Array of variable name, value pairs.
VB Example:
oModule.ClcEval "Setup1: LastAdaptive", _
Array ("Freq:=", "10GHz",_
"Phase:=", "0deg")
ClcMaterial
Use: Performs a material operation on the top stack element.
Command: Click Matl.
Syntax: ClcMaterial <MaterialString>, <OperationString>
Return Value: None
Parameters: <Material String>
Type: <string>
The material property to apply.
<OperationString>
Type: <string>
Possible values are "mult", or "div".
VB Example:
oModule.ClcMaterial "Permeability (mu)" "mult"
ClearAllNamedExpr
Use: Clears all user-defined named expressions from the list.
Command: Click ClearAll.
Syntax: ClearAllNamedExpr
Return Value: None
Parameters: None
CopyNamedExprToStack
Use: Copies the named expression selected to the calculator stack.
Command: Select a named expression and then click Copy to stack.
Syntax: CopyNamedExprToStack <Name>
Return Value: None
Parameters: <Name>
Type: <string>
The name of the expression to be copied to the top of the stack.
VB Example:
oModule.CopyNamedExprToStack "Mag_JxE"
DeleteNamedExpr
Use: Deletes the selected named expression from the list.
Command: Select a named expression and then click Delete.
Syntax: DeleteNamedExpr <Name>
Return Value: None
Parameters: <Name>
Type: <string>
The name of the named expression to be deleted.
VB Example:
oModule.DeleteNamedExpr "Mag_JxE"
EnterComplex
Use: Enters a complex number onto the stack.
Command: Click Number, and then click Scalar. Complex option is selected.
Syntax: EnterComplex "<Real> + <Imaginary> j"
Return Value: None
Parameters: <Real>
Type: <double>
Real component of the scalar.
<Imaginary>
Type: <double>
Imaginary component of the scalar.
VB Example:
oModule.EnterComplex "1 + 2 j"
EnterComplexVector
Use: Enters a complex vector onto the stack.
Command: Click Number, and then click Vector. Complex option is selected.
Syntax: EnterComplexVector Array ("<X Re> + <X Im> j",
"<Y Re> + <Y Im> j", "<Z Re> + <Z Im> j")
Return Value: None
Parameters: <X Re>, <YRe>, <ZRe>
Type: <double>
Real components of the X, Y, and Z values respectively.
VB Example:
oModule.EnterComplexVector Array("1 + 2 j",_
"1 + 2 j",_
"1 + 2 j")
EnterLine
Use: Enters a line defined in the 3D Modeler editor.
Command: Click Geometry and then select Line.
Syntax: EnterLine <LineName>
Return Value: None
Parameters: <LineName>
Type: <string>
Name of a line defined in the 3D Modeler editor.
VB Example:
oModule.EnterLine "Line1"
EnterPoint
Use: Enters a point defined in the 3D Modeler editor.
Command: Click Geometry and then select Point.
Syntax: EnterPoint <PointName>
Return Value: None
Parameters: <PointName>
Type: <string>
Name of a point defined in the 3D Modeler editor.
VB Example:
oModule.EnterPoint "Point1"
EnterQty
Use: Enters a field quantity.
EnterScalar
Use: Enters a scalar onto the stack.
Command: Click Number and then click Scalar. Complex option not selected.
Syntax: EnterScalar <Scalar>
Return Value: None
Parameters: <Scalar>
Type: <double>
The real number to enter onto the stack.
EnterScalarFunc
Use: Enters a scalar function.
Command: Click Function and then select Scalar.
Syntax: EnterScalarFunc <VarName>
Return Value: None
Parameters: <VarName>
Type: <string>
Name of a variable to enter as a scalar function onto the stack.
VB Example:
oModule.EnterScalarFunc "Phase"
EnterSurf
Use: Enters a surface defined in the 3D Modeler editor.
Command: Click Geometry and then select Surface.
Syntax: EnterSurf <SurfaceName>
Return Value: None
Parameters: <SurfaceName>
Type: <string>
Name of a surface defined in the 3D Modeler editor.
VB Example:
oModule.EnterSurf "Rectangle1"
EnterVector
Use: Enters a vector onto the stack.
Command: Click Number, and then click Vector. Complex option not selected.
Syntax: EnterVector Array (<X>, <Y>, <Z>)
Return Value: None
Parameters: <X>
Type: <double>
X component of the vector.
<Y>
Type: <double>
Y component of the vector.
<Z>
Type: <double>
Z component of the vector.
VB Example:
oModule.EnterVector Array (1.0, 1.0, 1.0)
EnterVectorFunc
Use: Enters a vector function.
Command: Click Function and then select Vector.
Syntax: EnterVectorFunc Array(<XVarName>, <YVarName>,
<ZVarName>)
Return Value: None
Parameters: <XVarName>, <YVarName>, <ZVarName>
Type: <string>
Name of a variable for the X, Y, and Z coordinates, respectively, to enter as a vector func-
tion on the stack.
VB Example:
oModuleEnterVectorFunc Array("X", "Y", "Z")
EnterVol
Use: Enters a volume defined in the 3D Modeler editor.
Command: Click Geometry and then select Volume.
Syntax: EnterVol <VolumeName>
Return Value: None
Parameters: <VolumeName>
Type: <string>
Name of a volume defined in the 3D Modeler editor.
VB Example:
oModule.EnterVol "Box1"
ExportOnGrid
Use: Evaluates the top stack element at a set of points specified by a grid and exports the data to a
file.
Command: Click Export, and then click On Grid.
<PtsFile>
Type: <string>
Name of the file containing the points at which to evaluate the top stack element. The file
should contain tab- or space-separated x,y,z values of data points.
GetTopEntryValue
Use: Gets the value of the top entry of the calculator stack.
Syntax: GetTopEntryValue(<SolutionName>, <VariablesArray>)
Return Value: Returns an array of variants, which is either a scalar (one double) or a vector (3
doubles) based on the quantity on top of the stack.
Parameters: <SolutionName>
Type: <string>
Example: "Setup1: LastAdaptive"
<VariablesArray>
Array of variable name, value pairs.
VB Example:
dim topvalue
topvalue = _
oModule.GetTopEntryValue("Setup1:LastAdaptive", _
Array("Freq:=", "1GHz", "Phase:=", "0deg", _
"x_size:=", "2mm"))
If cdbl(topvalue(0)) <- 180.0 then ...
LoadNamedExpressions
Use:Loads a named expression definition from a saved file.
Command:In the Fields Calculator, click Load From... in the Library area.
Syntax:LoadNamedExpressions <FileName>, <FieldType>, <NamedExpressions>
Return Value:None
Parameters:<FileName>
Type:<String>
Filename and full path to the file to hold the named expression definition.
<FieldType>
Type:<String>
For products with just one filed type, it is set to "Fields".
<NamedExpressions>
Type: Array<string, string,...>
Array of strings containing the names of expression definitions to load from the file.
VB Example:
oModule.LoadNamedExpressions "C:\Ansoft\PersonalLib\smth.clc",
"Fields", Array("smoothedtemp")
SaveNamedExpressions
Use:Saves a named expression definition to a file.
Command:In the Fields Calculator, click Save To... in the Library area.
Syntax:SaveNamedExpressions <FileName>, <NamedExpressions>, <BooleanFlag>
Return Value:None
Parameters:<FileName>
Type:<String>
Filename and full path to the file to hold the named expression definition.
<NamedExpressions>
Type: Array<string, string,...>
Array of strings containing the names of expression definitions to load from the file.
<BooleanFlag>
Type:<Boolean>
True: Overwrite the file.
False: Append to the file.
VB Example:
oModule.SaveNamedExpressions "C:\Ansoft\PersonalLib\smth.clc", Array
("smoothedtemp"), true
CreateUserDefinedSolution
DeleteUserDefinedSolutions
EditUserDefinedSolution
CreateUserDefinedSolution
Creates a new user defined solution.
Command: Create User Defined Solution popup menu is available in the Result folder context
menu when applicable.
Syntax: CreateUserDefinedSolution <SolutionName>, <PluginFileLocation>, <Plu-
ginFileRelativePathName>, <PropertyValuesArray>, <ProbeSelectionArray>, <Dynam-
icProbesArray>
Return Value: The name of the user defined solution that was created. Note: if the requested user
defined solution name is not available because it is already in use, the user defined solution will be
created with a different name which will be returned.
Parameters: <SolutionName>
Type: String
Requested name of new user defined solution.
<PluginFileLocation>
Type: String
Indicates the library where the UDS plugin file is located. This parameter must be one of
the following values: "SysLib", "UserLib", "PersonalLib".
<PluginFileRelativePathName>
Type: String
The path of the UDS plugin file relative to the "UserDefinedOutputs" subdirectory of the
library specified by <PluginFileLocation>.
<PropertyValuesArray>
Type: Array of strings
Strings specify name-value pairs corresponding to the UDS properties specified in the
plugin file.
For example:
Array("multiply_factor:=", "2.0", "component_name:=", "resistor1")
<ProbeSelectionArray>
Type: Array of <ProbeSelection>'s (see below)
The probe specification array specifies how UDS probes are defined and mapped to
traces in the design.
<ProbeSelection>
Type: Array of strings representing how a single probe is defined by a trace. The array
contains the following items:
<ReportType>
Type: String
See the CreateReport command for more information.
<ProbeName>
Type: String
Name of the probe being specified. Note: this must match a probe name specified in the
UDS plugin file.
<SolutionName>
Type: String
See the CreateReport command for more information.
<SimulatedValueContexArray>
Type: Array of strings
See the CreateReport command for more information.
<PointSetDefinitionArray>
Type: Array of values with optional overriding values and optional variable values.
See the CreateReport command for more information.
<TraceExpressionArray>
Type: Array of strings and values.
This is similar to the TracesExpressionsArray used in the CreateReport command, but
there will only be a single component expression named "Probe Component." See the
CreateReport command for more information.
<ExtendedTraceInformationArray>
Type: Array of strings and values
See the CreateReport command for more information.
<DynamicProbesArray>
Type: Array of <ProbeSelection>'s, representing the probes that are used by dynamic-
probes.
VB Example:
oModule.CreateUserDefinedSolution "User Defined Solution 1", _
"SysLib", "Example",
Array("multiplication_factor:=", "1.2"),
Array(Array("Modal Solution Data",
"Probe 1", "Setup1 : LastAdaptive",
Array(),
Array("Freq:=", Array( "All")),
Array("Probe Component:=", Array("dB(S(1,1))")), Array()),
Array( "Modal Solution Data", "Probe 2",
"Setup1 : LastAdaptive", Array(),
Array("Freq:=", Array( "All")),
Array("Probe Component:=", Array("mag(S(1,1))")), Array())), Array
(Array( "Modal Solution Data",
"Dynamic Probe 1", "Setup1 : LastAdaptive", Array(),
Array("Freq:=", Array( "All")),
Array("Probe Component:=", Array("Freq")), Array()))
DeleteUserDefinedSolutions
Deletes one or more user defined solutions.
Command: 'Delete' button from the "User Defined Solutions" dialog.
Syntax: DeleteUserDefinedSolutions <UserDefinedSolutionNames>
Return Value: None
Parameters:
<UserDefinedSolutionNames>
Type: Array of strings
Name of User Defined Solutions to be deleted.
VB Example: Example:
oModule.DeleteUserDefinedSolutions Array("Solution1", "Solution2")
EditUserDefinedSolution
Updates an existing user defined solution
Command: Command: 'Edit' button in the User Defined Solutions dialog
Syntax: Syntax: EditUserDefinedSolution <ExistingSolutionName>, <NewSolutionName>, <Plu-
ginFileLocation>, <PluginFileRelativePathName>, <PropertyValuesArray>, <ProbeSelec-
tionArray>, <DynamicProbesArray>
Return Value: Return Value: the name of the user defined solution after being updated. Note: if the
requested user defined solution name is not available because it is already in use, the user defined
solution will be created with a different name which will be returned.
Parameters:
<ExistingSolutionName>
Type: String
Name of the existing user defined solution
<NewSolutionName>
Type: String
Requested name for the updated user defined solution.
<PluginFileLocation>
See CreateUserDefinedSolution for more information.
<PluginFileRelativePathName>
See CreateUserDefinedSolution for more information.
<PropertyValuesArray>
See CreateUserDefinedSolution for more information.
<ProbeSelectionArray>
ExportFullWaveSpice [NdExplorer]
Use: Export FullWaveSpice data in a format of your choice.
Command: File > Export MacroModel > Broadband (SYZ, FWS….)
Syntax: ExportFullWaveSpice
"DesignName", // Design name. Can be left blank, if loading solution from a file.
true/false, // true - solution loaded from file, false- loaded from design
"Name", // If loading from design this is the solution name, else this is the
// full path of the file from which the solution is loaded
"variation", // Pick a particular variation. Leave blank if no variation.
Array("NAME:Frequencies"), // Optional; if none defined all frequencies are used
Array("NAME:SpiceData", // Spice export options object
"SpiceType:=", "SSS", // SpiceType can be "PSpice", "HSpice", "Spectre", "SSS",
// "Simplorer", "TouchStone1.0", "TouchStone2.0"
"EnforcePassivity:=", false, // Enforce Passivity true/false
ExportNetworkData [NdExplorer]
Use: Export the solution in a format of your choice (Citifile, Spreadsheet, Matlab, Touchstone, Neut-
ral)
Command: File > Export SYZ Data
Syntax: ExportNetworkData
"DesignName", // Design name. Can be left blank, if loading solution from a file.
true/false, // true - solution loaded from file, false- loaded from design
"Name", // If loading from design this is the solution name, else this is the
// full path of the file from which the solution is loaded
"ExportFile", // full path of file to export to
"variation", // Pick a particular variation. Leave blank if no variation
Array("NAME:Frequencies"), // optional, if none defined all frequencies are used
ExportNMFData [NdExplorer]
Use: Export the solution in NMF format.
Command: File > Export SYZ Data
Syntax: ExportNMFData
"DesignName", // Design name. Can be left blank, if loading solution from a file.
true/false, // true - solution loaded from file, false- loaded from design
"Name", // If loading from design this is the solution name, else this is the
// full path of the file from which the solution is loaded
"ExportFile", // full path of file to export to
Array("NAME:Frequencies"), // optional, if none defined all frequencies are used
Array("NAME:NMFOptions", // Export NMF options object
"DataTypes:=", Array("S"), // DataTypes can be "S", "Y","Z", "G", and "Z0",
// for S , Y, Z matrix, Gamma and Z0 (zero)
"DisplayFormat:=", "MA", // DisplayFormat "MA", "RI", "DB"
Definitions
<propName> = text string
<value> = double
<valueText> = text string
<fileName> = full path file name
<choices> = string containing menu choices separated by commas
<initialChoice> = string containing initial choice for menu; must be one of the <choices>
<scriptName> = string containing name of script stored in project
<bool> is 1 for true or 0 for false
<editorName> is either "Layout" or "SchematicEditor"
CompInstance Functions
Following are commands that can be used to manipulate properties from a CompInstance script.
GetComponentName
Returns the name of the component corresponding to this CompInstance.
UI Access NA
String
Return Value
name of component (e.g. MS_TRL) and stores it in "name"
VB Syntax GetComponentName()
VB Example name = CompInstance.GetComponentName()
VB Example:
Set oLayout2 = CompInstance.GetEditor("Layout");
Returns the interface to the layout containing a selected component.
This interface can be used to call Layout Scripting functions.
Python id = CompInstance.GetInstanceID()
Example
GetParentDesign
Use: Returns an interface to the compInstance's parent design.
Command: None
Syntax: GetParentDesign()
Return Value: Returns interface to design.
Example: Set oDesign2 = CompInstance.GetParentDesign();
Returns the interface to the design containing the compInstance.
This interface can be used to call Design functions; for more information see Nexxim
Scripting or HFSS 3D Layout Scripting.
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".
GetNPortData
IsUsed
Remove
RemoveUnused
UpdateDynamicLink
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>),
"VPointProp:=", <VPointInfo>,
"PointProp:=", <PointInfo>),
Array("Quantities",
"QuantityProp:=", <QuantityPropInfo>...),
Array("NAME:CosimDefinitions",
<CosimDefInfo>,
<CosimDefInfo>...)
Return Value:<string>
// composite name of the component.
// If the name requested conflicts with the name of an existing
// component, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.
Parameters:<ComponentName>:
<string> // simple name of the component
<ComponentInfo>:
Array("Type:=", <TypeInfo>,
"NumTerminals:=", <int>,
"DataSource:=", <string>,
"ModifiedOn:=", <ModifiedOnInfo>,
"Manufacturer:=", "<string>,
"Symbol:=", <string>,
"Footprint:=", <string>,
"Description:=", <string>,
"InfoTopic:=", <string>,
"InfoHelpFile:=", <string>,
"IconFile:=", <string>,
"LibraryName:=", "",
"OriginalLocation:=", "Project", // Project Location
"Author:=", <string>,
"OriginalAuthor:=", <string>,
"CreationDate:= ", <int>)
<TypeInfo>:
An integer that is the or-ing of bits for each product listed below. The default setting is
0xffffffff (4294967295) which indicates valid for all products. In the component editing dia-
log, checking different boxes in the "Specify products for which this component is valid"
grid control sets specific flags that correspond to the following hex/decimal settings:
Nexxim -- 100 binary, 4 decimal, 0x4
SIwaveDeNovo -- 1000 binary, 8 decimal, 0x8
Simplorer -- 10000 binary, 16 decimal, 0x10
MaxwellCircuit -- 100000 binary, 32 decimal, 0x20
<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed since 00:00
hours, Jan 1, 1970 UTC from the system clock.
<TerminalInfo>:
Array(<string>, // symbol pin
<string> // footprint pin
<string >, // gate name
<bool>, // shared
<int>, // equivalence number
<int>, // what to do if unconnected: flag as error:0, ignore:1
<string> // description
<Nature>)
<Nature>:
<string> // content varies as follows
Nexxim/Circuit:
"Electrical" // the only choice
Simplorer:
// several choices
"Electrical", "Magnetic", "Fluidic", "Translational",
"Translational_V", "Rotational", "Rotational_V",
""Radiant", "Thermal", or <VHDLPackageName>
<VHDLPackageName>:
<string> // in the form <Library>.<Package>
<Library>:
<string> // name of the VHDL library
<Package>:
<string> // name of the VHDL package
<VariableInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: number, variable, or expression
<FlagLetters>:
<string> // "D" - has description parameter,
// "RD" - readonly & has description parameter,
<CheckBoxInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<bool>) // value: true or false
<ButtonInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
<string>, // button title
<string>, // extra text
<ClientID>,
"ButtonPropClientData:= ", <ClientDataArray>)
<ClientID>:
<int> // specifies Button Prop Client
// 0 - unknown, ButtonPropClientData
// array will be empty
// 1 - Netlist Prop Client
// 2 - not used
// 3 - File Name Prop Client
<ClientDataArray>:
varies with <ClientID>
<ClientID> is 3:
Array("InternalFormatText:=", "<prefix><RelativePath>")
<prefix>:
<string> // "<Project>", "<PersonalLib>", "<UserLib>", or "<SysLib>"
<RelativePath>:
<string> // relative path to file from <prefix>
<TextInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: a text string
<NumberInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<real>, // value: a number
<string>) // units
<SeparatorInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: a text string
<ValueInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: a number, variable or expression
<MenuPropInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
<string>, // menu choices - separated by commas
<int>) // 0 based index of current menu choice
<VPointInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>, // x value: number with length units
<string>) // y value: number with length units
<PointInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<real>, // x value
<real>) // y value
<QuantityPropInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
<string>, // value
<TypeString>,
<TypeStringDependentInfo>)
<TypeString>:
<string> // "Across", "Through", or "Free"
<TypeStringDependentInfo>:
<TypeString> is "Free" :
<string>, // direction: "In", "Out", "InOut", or "DontCare"
// Following <string> is not present if direction is "DontCare"
<string> // when to calculate: "BeforeAnalogSolver",
// "BeforeStateGraph", "AfterStateGraph", or "DontCareWhen"
<CosimDefInfo>:
Array("NAME:CosimDefinition",
"CosimulatorType:=", <int>,
"CosimDefName:=", <string> // "HFSS 3D Layout", "Circuit",
// "Custom", or "Netlist"
"IsDefinition:=", <bool>,
final array member(s) vary with CosimDefName)
VB Example:
Dim name
oComponentManager.Add (Array("NAME:MyComponent", _
"Info:=", Array("Type:=", 4294901767, _
"NumTerminals:=", 2, _
"DataSource:=", "", _
"ModifiedOn:=", 1071096503, _
"Manufacturer:=", "Ansys", _
"Symbol:=", "bendo", _
"Footprint:=", "BENDO", _
"Description:=", "",_
"InfoTopic:=", "", _
"InfoHelpFile:=", "", _
"IconFile:=", "", _
"LibraryName:=", "", _
"OriginalLocation:=", "Project", _
"Author:=", "", _
"OriginalAuthor:=", "", _
"CreationDate:= ", 1147460679), _
"Refbase:=", "U", _
"NumParts:=", 1, _
"OriginalComponent:=", "", _
"Terminal:=", Array("n1", _
"n1", _
"A", _
false, _
0, _
1, _
"", _
"Electrical"), _
"Terminal:=", Array("n2", _
"n2", _
"A", _
false, _
1, _
0, _
"", _
"Electrical"), _
Array("NAME:Parameters", _
"MenuProp:=", Array("CoSimulator", _
"D", _
"", _
"Default,HFSS 3D Layout,Circuit,Custom,Netlist", _
0), _
"ButtonProp:=", Array("CosimDefinition", _
"D", _
"", _
"", _
"Edit", _
0, _
"ButtonPropClientData:=", Array())), _
Array("NAME:CosimDefinitions", _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 0, _
"CosimDefName:=", "HFSS 3D Layout", _
"IsDefinition:=", true, _
"CosimStackup:=", "Layout stackup", _
"CosimDmbedRatio:=", 3), _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 1, _
"CosimDefName:=", "Circuit", _
"IsDefinition:=", true, _
"ExportAsNport:=", 0, _
"UsePjt:=", 0), _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 2, _
"CosimDefName:=", "Custom", _
"IsDefinition:=", true, _
"DefinitionCompName:=", ""), _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 3, _
"CosimDefName:=", "Netlist", _
"IsDefinition:=", true, _
"NetlistString:=", "")))
Add [("NAME:<ComponentName>",
"Info:=", <ComponentInfo>,
"RefBase:=", <string>, // reference designator
"NumParts:=", <int>, // parts per component
"OriginalComponent:=", <string>
"Terminal:=", <TerminalInfo>,
"Terminal:=", <TerminalInfo>, ...
The remaining parameters are optional.
["NAME:Parameters", // any combo of the following
"VariableProp:=", <VariableInfo>,
"CheckboxProp:=", <CheckBoxInfo>,
"ButtonProp:=", <ButtonInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
<CosimDefInfo>...]]
oComponentManager.Add(
[
"NAME:Component",
"Info:=", [
"Type:=", 0,
"NumTerminals:=", 0,
"DataSource:=", "",
"ModifiedOn:=", 1467910752,
"Manufacturer:=", "",
"Symbol:=", "Component",
"ModelNames:=", "",
"Footprint:=", "",
"Description:=" , "",
<DataType>:
<string> // "DesignerData" or "Q3DData"
<InterpolationAlgorithm>:
<string> // "auto", "lin", "shadH", or "shadNH"
<NewToOldMapPairs>:
Array of name/value pairs such as "V1", "V2" that will have the new variable name first
and the old variable name second.
<OldToNewMapPairs>:
Array of name/value pairs such as "V1", "V2" that will have the old variable name first
and the new variable name second.
VB Example:
oComponentManager.AddDynamicNPortData
Array("NAME:ComponentData", _
"ComponentDataType:=", "DesignerData", _
"name:=", "DesignerData", _
"filename:=", _
"C:/Program Files/An-
sysEM/Designer/Examples/Projects/optiguides/optiguides.adsn", _
"numberofports:=", 2, _
"DesignName:=", "DesignerModel1", _
"SolutionName:=", "Setup1 : Adaptive_1", _
"Simulate:=", true, _
"CloseProject:=", false, _
"SaveProject:=", true, _
"RefNode:=", false, _
"InterpY:=", true, _
"InterpAlg:=", "auto", _
"NewToOldMap:=", Array("nport_height:=", "$height", _
"nport_length:=", "$length", _
"nport_width:=", "$width"), _
"OldToNewMap:=", Array("$height:=", "nport_height", _
"$length:=", "nport_length", _
"$width:=", "nport_width"), _
"PinNames:=", Array( "WavePort1:1", "WavePort2:1"))
<ProductOptionsInfo>)
Return Value: <string>
// composite name of the component.
// If the name requested conflicts with the name of an existing
// component, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.
Parameters: <ComponentDataName>:
<string> // simple name of the component
<LocationType>:
<string> // one of "UsePath", "PersonalLib", "UserLib", "SysLib",
// or "Project".
<dcInfo>:
<string> // one of "DCOpen", "DCShort", "DCShShort",
// "DCNone", or "DCEmpty".
<DisplayInfo>:
<string> // one of "MagnitudePhase", "RealImaginary",
// or "DbPhase".
<ProductOptionsInfo>:
// The remaining parameters differ by product
// Nexxim
"DCOption:=", <NexximDCOption>,
"InterpOption:=", <NexximInterpOption>,
"ExtrapOption:=", <NexximExtrapOption>,
"DataType:=", 2
<NexximDCOption>:
<int> // 0 : Zero Padding
// 1 : Same as last point
// 2 : Linear extrapolation from last 2 points
// 3 : Constant magnitude, linear phase extrapolation
// 4 : Leave all signal lines open circuited
// 5 : Short all signal lines together
// 6 : Short all signal lines to ground
<NexximInterpOption>:
<int> // 0 : Step
// 1 : Linear
<NexximExtrapOption>:
<int> // 0 : Zero padding
// 1 : Same as last point
// 2 : Linear extrapolation from last 2 points
// 3 : Constant magnitude, linear phase extrapolation
<CircuitDCOption>:
<int> // 0 : Leave all signal lines open circuited
// 1 : Short all signal lines together
// 2 : Short all signal lines to ground
<CircuitInterpOption>:
<int> // 0 : Linear
// 1 : Cubic spline
// 2 : Rational polynomial
<CircuitExtrapOption>:
<int> // 0 : Same as interpolation
// 1 : Zero padding
// 2 : Same as last point
VB Example:
oComponentManager.AddNPortData Array("NAME:ComponentData", _
"ComponentDataType:=", "NPortData", _
"name:=", "NportData", _
"filename:=", "", _
"numberofports:=", 2, _
"filelocation:=", "UsePath", _
"domain:=", "frequency", _
"datamode:=", "Import", _
"devicename:=", "", _
"ImpedenceTab:=", true, _
"NoiseDataTab:=", true, _
"DCBehaviorTab:=", true, _
"SolutionName:=", "", _
"displayformat:=", "MagnitudePhase", _
"datatype:=", "SMatrix", _
"ShowRefPin:=", true, _
"RefNodeCheckbox:=", false, _
"DCOption:=", 3, _
"InterpOption:=", 1, _
"ExtrapOption:=", 3, _
"DataType:=", 2, _
"DCOption:=", 3, _
"InterpOption:=", 1, _
"ExtrapOption:=", 3, _
"DataType:=", 2)
Parameters: <ComponentName>:
<NewComponentName>:
<string> // new simple name for the component
<ComponentInfo>:
Array("Type:=", <TypeInfo>,
"NumTerminals:=", <int>,
"DataSource:=", <string>,
"ModifiedOn:=", <ModifiedOnInfo>,
"Manufacturer:=", "<string>,
"Symbol:=", <string>,
"Footprint:=", <string>,
"Description:=", <string>,
"InfoTopic:=", <string>,
"InfoHelpFile:=", <string>,
"IconFile:=", <string>,
"LibraryName:=", <string>,
"OriginalLocation:=", <string>, // Project Location
"Author:=", <string>,
"OriginalAuthor:=", <string>,
"CreationDate:= ", <int>)
<TypeInfo>:
An integer that is the or-ing of bits for each product listed below. The default setting is
0xffffffff (4294967295) which indicates valid for all products. In the component editing dia-
log, checking different boxes in the "Specify products for which this component is valid"
grid control sets specific flags that correspond to the following hex/decimal settings:
Nexxim -- 100 binary, 4 decimal, 0x4
SIwaveDeNovo -- 1000 binary, 8 decimal, 0x8
Simplorer -- 10000 binary, 16 decimal, 0x10
<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed since 00:00
hours, Jan 1, 1970 UTC from the system clock.
<TerminalInfo>:
Array(<string>, // symbol pin
<string> // footprint pin
<string >, // gate name
<bool>, // shared
<int>, // equivalence number
<int>, // what to do if unconnected: flag as error:0, ignore:1
<string>, // description
<Nature>)
<Nature>:
<string> // content varies as follows
Nexxim/Circuit:
"Electrical" // the only choice
Simplorer:
// several choices
"Electrical", "Magnetic", "Fluidic", "Translational",
"Translational_V", "Rotational", "Rotational_V",
""Radiant", "Thermal", or <VHDLPackageName>
<VHDLPackageName>:
<string> // in the form <Library>.<Package>
<Library>:
<string> // name of the VHDL library
<Package>:
<string> // name of the VHDL package
<VariableInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: number, variable, or expression
<FlagLetters>:
<string> // "D" - has description parameter,
// "RD" - readonly & has description parameter,
// or "RHD" - readonly, hidden, & has description parameter
<CheckBoxInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<bool>) // value: true or false
<ButtonInfo>:
Array(<string>, // name
<FlagLetters>,
<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>
<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>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<real>, // value: a number
<string>) // units
<SeparatorInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: a text string
<ValueInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: a number, variable or expression
<MenuPropInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
<string>, // menu choices - separated by commas
<int>) // 0 based index of current menu choice
<VPointInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>, // x value: number with length units
<string>) // y value: number with length units
<PointInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<real>, // x value
<real>) // y value
<QuantityPropInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
<string>, // value
<TypeString>,
<TypeStringDependentInfo>)
<TypeString>:
<string> // "Across", "Through", or "Free"
<TypeStringDependentInfo>:
"Free" :
<string>, // direction: "In", "Out", "InOut", or "DontCare"
// Following <string> is not present if direction is "DontCare"
<string> // when to calculate: "BeforeAnalogSolver",
// "BeforeStateGraph", "AfterStateGraph", or "DontCareWhen"
"Across" or "Through"
<int>, // terminal 1
<int> // terminal 2
<CosimDefInfo>:
Array("NAME:CosimDefinition",
"CosimulatorType:=", <int>,
"CosimDefName:=", <string> // "HFSS3D", "Circuit",
// "Custom", or "Netlist"
"IsDefinition:=", <bool>,
final array member(s) vary with CosimDefName)
0, _
"", _
"Electrical"), _
"Terminal:=", Array("base", _
"base", _
"A", _
false, _
7, _
0, _
"", _
"Electrical"), _
"Terminal:=", Array("emitter", _
"emitter", _
"A", _
false, _
8, _
0, _
"", _
"Electrical"), _
Array("NAME:Parameters", _
"TextProp:=", Array("LabelID", _
"HD", _
"Property string for netlist ID", _
"Q@ID"), _
"TextProp:=", Array("MOD", _
"D", _
"Name of model data reference", _
"required"), _
"VariableProp:=", Array("AREA", _
"D", _
"Q"))))
VB Example:
Dim name2
name2 = oComponentManager.Edit "MyComponent", _
(Array("NAME:MyOtherComponent", _
"Info:=", Array("Type:=", 4294901767, _
"NumTerminals:=", 2, _
"DataSource:=", "", _
"ModifiedOn:=", 1071096503, _
"Manufacturer:=", "Ansys", _
"Symbol:=", "bendo", _
"Footprint:=", "BENDO", _
"Description:=", "",_
"InfoTopic:=", "", _
"InfoHelpFile:=", "", _
"IconFile:=", "", _
"LibraryName:=", "", _
"OriginalLocation:=", "Project", _
"Author:=", "", _
"OriginalAuthor:=", "", _
"CreationDate:= ", 1147460679), _
"Refbase:=", "U", _
"NumParts:=", 1, _
"OriginalComponent:=", "", _
"Terminal:=", Array("n1", _
"n1", _
"A", _
false, _
0, _
0, _
"", _
"Electrical"), _
"Terminal:=", Array("n2", _
"n2", _
"A", _
false, _
1, _
0, _
"", _
Electrical"), _
Array("NAME:Parameters", _
"MenuProp:=", Array("CoSimulator", _
"D", _
"", _
"Default,HFSS3D,Circuit,Custom,Netlist", _
0), _
"ButtonProp:=", Array("CosimDefinition", _
"D", _
"", _
"", _
"Edit", _
0, _
"ButtonPropClientData:=", Array())), _
Array("NAME:CosimDefinitions", _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 0, _
"CosimDefName:=", "HFSS3D", _
"IsDefinition:=", true, _
"CosimStackup:=", "Layout stackup", _
"CosimDmbedRatio:=", 3), _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 1, _
"CosimDefName:=", "Circuit", _
"IsDefinition:=", true, _
"ExportAsNport:=", 0, _
"UsePjt:=", 0), _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 2, _
"CosimDefName:=", "Custom", _
"IsDefinition:=", true, _
"DefinitionCompName:=", ""), _
Array("NAME:CosimDefinition", _
"CosimulatorType:=", 3, _
"CosimDefName:=", "Netlist", _
"IsDefinition:=", true, _
"NetlistString:=", "")))
Edit <ComponentName>,
["NAME:<NewComponentName>",
"Info:=", <ComponentInfo>,
"RefBase:=", <string>, // reference designator
"NumParts:=", <int>, // parts per component
Pytho- "OriginalComponent:=", <string>
n Syn-
tax "Terminal:=", <TerminalInfo>,
"Terminal:=", <TerminalInfo>, ...
#The remaining parameters are optional
["NAME:Parameters", // any combo of the following
"VariableProp:=", <VariableInfo>,
"CheckboxProp:=", <CheckBoxInfo>,
"ButtonProp:=", <ButtonInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>],
["NAME:Properties", # any combo of the following
"CheckboxProp:=", <CheckBoxInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>),
"VPointProp:=", <VPointInfo>,
"PointProp:=", <PointInfo>),
["Quantities",
"QuantityProp:=", <QuantityPropInfo>...],
["NAME:CosimDefinitions",
<CosimDefInfo>,
<CosimDefInfo>...])
name = oComponentManager.Edit ("Simplorer Circuit Ele-
ments\BJTs:Level01_NPN", _
["NAME:Level01_NPN", "Info:=", ["Type:=", 4294901764,_
"NumTerminals:=", 3, "DataSource:=", "Ansoft built-in com-
Pytho- ponent",_
n
"ModifiedOn:=", 1152722112, "Manufacturer:=", "", _
Exam-
ple "Symbol:=", "nexx_bjt_npn", "Footprint:=", "", _
"Description:=", "BJT, GP, NPN", "InfoTopic:=",
"NXBJT1.htm", _
"InfoHelpFile:=", "nexximcomponents.chm", "IconFile:=", "bjt-
sn.bmp", _
name2 = oComponentManager.Edit
("MyComponent",_
["NAME:CosimDefinitions", ["NAME:CosimDefinition", _
["NAME:CosimDefinition", "CosimulatorType:=", 3, _
"NetlistString:=", ""]]])
Parameters: <ComponentName>:
<NewComponentName>:
<string> // new simple name for the component
<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.
<PinDefInfo>:
Array("NAME:PinDef",
"Pin:=", Array (<string>, // pin name
<real>, // x location
<real>, // y location
<real>, // angle in radians
<PinType>,
<real>, // line width
<real>, // line length
<bool>, // mirrored
<int>, // color
<bool>, // true if visible, false if not
<string>, // hidden net name
<OptionalPinInfo>, // optional info
<PropDisplayMapInfo>)) // optional
<PinType>:
<string> // "N" : normal pin
// "I" : input pin
// "O" : output pin
<OptionalPinInfo>:
// Specify both or neither
<bool>, // true if name is to be shown
<bool>, // true if number is to be shown
<PropDisplayMapInfo>:
Array("NAME:PropDisplayMap",
<PropDisplayInfo>,
<PropDisplayInfo>,...)
<PropDisplayInfo>:
<NameString>, Array(<DisplayTypeInfo>,
<DisplayLocationInfo>,
<int>, // optional, level number
<TextInfo>)
<NameString>:
<string> // PropertyName:=, where PropertyName is the name of
// the property to be displayed
<DisplayTypeInfo>:
<int> // 0 : No display
// 1 : Display name only
// 2 : Display value only
// 3 : Display both name and value
// 4: Display evaluated value only
// 5: Display both name and evaluated value
<DisplayLocationInfo>:
<int> // 0 : Left
// 1 : Top
// 2 : Right
// 3 : Bottom
// 4 : Center
// 5 : Custom placement
<GraphicsDataInfo>:
Array("NAME:Graphics",
// one or more of the following
<RectInfo>,
<CircleInfo>,
<ArcInfo>,
<LineInfo>,
<PolygonInfo>,
<TextInfo>,
<ImageInfo>)
<RectInfo>:
"Rect:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // angle, in radians
<real>, // x position of center
<real>, // y position of center
<real>, // width
< real>) // height
<CircleInfo>:
"Circle:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>) // radius
<ArcInfo>:
"Arc:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>, // radius
<real>, // start angle, in radians
<end>) // end angle, in radians
<LineInfo>:
"Line:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<PointInfo>, // must specify at least 2 points
<PointInfo>...)
<PointInfo>:
<real>, // x position
<real> // y position
<PolygonInfo>:
"Polygon:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<PointInfo>, // must specify at least 3 points
<PointInfo>...)
<TextInfo>:
"Text:=", Array(<real>, // x position
<real>, // y position
<real>, // angle, in radians
<Justification>,
<bool>, // is plotter font
<string>, // font name
<int>, // color
<string>) // text string
<Justification>:
<int> // 0 : left top
// 1 : left base
// 2 : left bottom
// 3 : center top
// 4 : center base
// 5 : center bottom
// 6 : right top
// 7 : right base
// 8 : right bottom
<ImageInfo>:
"Image:=", Array(<RectInfo>,
<ImageData>,
<bool>) // is mirrored
<ImageData>:
<string>, // file path
<ListOfComponentNames>:
<string>,<string> ...
// The list may be empty. When not empty, each string that is listed is a component
// that references the component to be edited. Prior to editing, a clone of the component
is
// made, and the components that are listed are modified so that they now refer to
// the clone.
VB Example:
Dim nam
oModelManager.EditWithComps_
("Nexxim Circuit Elements\Distributed\Distributed:bendo", _
Array("NAME:bendo new name", _
"ModTime:=", 1152722165, _
"Library:=", "Nexxim Circuit Elements\Distributed\Distributed", _
"LibLocation:=", "SysLibrary", _
Array("NAME:PinDef", _
"Pin:=", Array( "n1", _
-0.00254, _
0.00254, _
0, _
"N", _
0, _
0, _
false, _
0, _
true, _
"", _
false, _
false)), _
Array("NAME:PinDef", _
"Pin:=", Array( "n2", _
0.00254, _
-0.00254, _
1.5708, _
"N", _
0, _
0, _
false, _
0, _
true, _
"", _
false, _
false)), _
Array("NAME:Graphics", _
"Polygon:=", Array( 0, 0, 12566272, 0, 0.00381, 0, .00127, 0.00127,
_
0.00127, 0.00127, 0, 0.00381, 0, 0.00381, _
0.002032, 0.00127, 0.00381), _
"Line:=", Array(0, 1, 12566272, -0.00254, 0.00254, 0, .00254), _
"Line:=", Array(0, 1, 12566272, 0.00254, -0.00254, .00254, 0)), _
Array("NAME:PropDisplayMap", _
"W:=", Array(3, _
5, _
0, _
"Text:=", Array( 2.1684E-019, _
0.00504119, _
0, _
1, _
5, _
false, _
"Arial", _
0, _
"W=***"))))), _
Array("MY_COMP")
<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:
Note:
GetData allows the user to access definition information, make modifications, and then
use the Edit or EditWithComps script commands to save the modified definition. Accord-
ingly, for each type of definition, the array data returned to GetData should be the same
array information that is supplied to the Edit or EditWithComps commands.
Python GetData(<DefinitionName>)
Syntax
Sub DisplayVariant(x)
Dim index
index = 0
curr = x(index)
If TypeName(curr) <> "Variant()" Then
If TypeName(curr) <> "Empty" And TypeName(curr) <> "Null"
Then
str = CStr(curr)
If str = "" Then
str = ChrW(34) & ChrW(34)
End If
Msgbox str
Else
str = "Empty/Null item."
Msgbox str
End If
Else
DisplayVariant curr
End If
index = index + 1
Next
End Sub
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim dnpInfo
Dim index
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject()
Set oDefinitionManager = oProject.GetDefinitionManager()
Dim componentNames
componentNames = oComponentManager.GetNames()
index = 0
For Each name In componentNames
name = componentNames(index)
message = "NPort data for component " + name
Msgbox message
dnpInfo = oComponentManager.GetNPortData(name)
DisplayVariant dnpInfo
index = index + 1
Next
Python IsUsed(<ComponentName>)
Syntax
<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"
Syntax <LibraryLocation>)
Note:
Also, the symbol and footprint of an unused component are not unusable until after the
component itself is removed using the Component Manager Remove script.
Python RemoveUnused()
Syntax
GetSolverOnDemandData
Use: This method looks for a local component of the name passed in, and in this component it looks
for an SOD model of the name passed in and returns the SOD data pertaining to that model.
Parameters: BSTR component name.
Parameters: BSTR SOD model name
Return Value: VARIANT which is the SOD data.
GetSolverOnDemandModelList
Use: This method looks for a local component of the name passed in, and returns a list of SOD
model names defined in the component.
Parameters: BSTR component name.
Return Value: VARIANT which is a list of SOD model names.
RemoveSolverOnDemandModel
Use: This method looks for a local component of the name passed in, and in this component it looks
for an SOD model of the name passed in and deletes the SOD model definition from the com-
ponent.
Parameters: BSTR component name.
Parameters: BSTR SOD model name
Return Value: None.
EditWithComps
Export
GetData
GetNames
IsUsed
Remove
RemoveUnused
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
<real>, // angle in radians
<PinType>,
<real>, // line width
<real>, // line length
<bool>, // mirrored
<int>, // color
<bool>, // true if visible, false if not
<string>, // hidden net name
<OptionalPinInfo>, // optional info
<PropDisplayMapInfo>)) // optional
<PinType>:
<string> // "N" : normal pin
// "I" : input pin
// "O" : output pin
<OptionalPinInfo>:
// Specify both or neither
<bool>, // true if name is to be shown
<bool>, // true if number is to be shown
<PropDisplayMapInfo>:
Array("NAME:PropDisplayMap",
<PropDisplayInfo>,
<PropDisplayInfo>,...)
<PropDisplayInfo>:
<NameString>, Array(<DisplayTypeInfo>,
<DisplayLocationInfo>,
<int>, // optional, level number
<TextInfo>)
<NameString>:
<string> // PropertyName:=, where PropertyName is the name of
// the property to be displayed
<DisplayTypeInfo>:
<int> // 0 : No display
// 1 : Display name only
// 2 : Display value only
// 3 : Display both name and value
// 4: Display evaluated value only
// 5: Display both name and evaluated value
<DisplayLocationInfo>:
<int> // 0 : Left
// 1 : Top
// 2 : Right
// 3 : Bottom
// 4 : Center
// 5 : Custom placement
<GraphicsDataInfo>:
Array("NAME:Graphics",
// one or more of the following
<RectInfo>,
<CircleInfo>,
<ArcInfo>,
<LineInfo>,
<PolygonInfo>,
<TextInfo>,
<ImageInfo>)
<RectInfo>:
"Rect:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // angle, in radians
<real>, // x position of center
<real>, // y position of center
<real>, // width
< real>) // height
<CircleInfo>:
"Circle:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>) // radius
<ArcInfo>:
"Arc:=", Array(<real>, // line width
<LineInfo>:
"Line:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<PointInfo>, // must specify at least 2 points
<PointInfo>...)
<PointInfo>:
<real>, // x position
<real> // y position
<PolygonInfo>:
"Polygon:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<PointInfo>, // must specify at least 3 points
<PointInfo>...)
<TextInfo>:
"Text:=", Array(<real>, // x position
<real>, // y position
<real>, // angle, in radians
<Justification>,
<Justification>:
<int> // 0 : left top
// 1 : left base
// 2 : left bottom
// 3 : center top
// 4 : center base
// 5 : center bottom
// 6 : right top
// 7 : right base
// 8 : right bottom
<ImageInfo>:
"Image:=", Array(<RectInfo>,
<ImageData>,
<bool>) // is mirrored
<ImageData>:
<string>, // file path
<int>, // 0 : use the file path and link to it
// 1 : ignore file path and use next parameter
<string> // text data, only present if preceding int is 1
VB Example:
oModelManager.Add Array("NAME:MyModel",_
"ModTime:=", 1070989137, _
"Library:=", "", _
"LibLocation:=", "Project", _
Array("NAME:PinDef", _
"Pin:=", Array ("newpin0", _
0.00254, _
0, _
0, _
"N",_
0, _
0.00254, _
false, _
0, _
true, _
"",_
false, _
false)), _
Array("NAME:PinDef", _
"Pin:=", Array ("newpin1", _
-0.00254, _
0, _
3.14159265358979, _
"N",_
0, _
0.00254, _
false, _
0, _
true, _
"",_
false, _
false)),
Array("NAME:Graphics", _
"Rect:=", Array(0, _
0, _
12566272, _
0, _
4.33680868994202e-019, _
-0.000635, _
0.00508, _
0.002794), _
"Circle:=", Array(0, _
0, _
12566272, _
0.000127, _
-0.000635, _
0.000635)))
ConvertToDynamic
Use: Build a new dynamic model based on an existing parametric model.
Command: Right-click on a model under Definitions/Models in the Project Tree and choose Con-
vertToDynamic.
Syntax: ConvertToDynamic(defName, newname)
Return Value: <newname> // Name of the new model added
Parameters: <defName> // Model that is the base for the new con-
version
VB Example:
Dim newname
newname = oModelManager.ConvertToDynamic([in] BSTR defName, [out,
retval] BSTR* newName);
ConvertToParametric
Use: Build a new parametric model based on an existing dynamic model.
Command: Right-click on a model under Definitions/Models in the Project Tree and choose Con-
vertToParametric.
Syntax: ConvertToParametric(defName, newname)
Edit [deprecated]
Deprecated command — please use EditWithComps.
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
<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
<PropDisplayMapInfo>:
Array("NAME:PropDisplayMap",
<PropDisplayInfo>,
<PropDisplayInfo>,...)
<PropDisplayInfo>:
<NameString>, Array(<DisplayTypeInfo>,
<DisplayLocationInfo>,
<int>, // optional, level number
<TextInfo>)
<NameString>:
<string> // PropertyName:=, where PropertyName is the name of
// the property to be displayed
<DisplayTypeInfo>:
<int> // 0 : No display
// 1 : Display name only
// 2 : Display value only
// 3 : Display both name and value
// 4: Display evaluated value only
// 5: Display both name and evaluated value
<DisplayLocationInfo>:
<int> // 0 : Left
// 1 : Top
// 2 : Right
// 3 : Bottom
// 4 : Center
// 5 : Custom placement
<GraphicsDataInfo>:
Array("NAME:Graphics",
// one or more of the following
<RectInfo>,
<CircleInfo>,
<ArcInfo>,
<LineInfo>,
<PolygonInfo>,
<TextInfo>,
<ImageInfo>)
<RectInfo>:
"Rect:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // angle, in radians
<real>, // x position of center
<real>, // y position of center
<real>, // width
< real>) // height
<CircleInfo>:
"Circle:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // x position of center
<ArcInfo>:
"Arc:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>, // radius
<real>, // start angle, in radians
<end>) // end angle, in radians
<LineInfo>:
"Line:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<PointInfo>, // must specify at least 2 points
<PointInfo>...)
<PointInfo>:
<real>, // x position
<real> // y position
<PolygonInfo>:
"Polygon:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<PointInfo>, // must specify at least 3 points
<PointInfo>...)
<TextInfo>:
"Text:=", Array(<real>, // x position
<real>, // y position
<real>, // angle, in radians
<Justification>,
<bool>, // is plotter font
<string>, // font name
<int>, // color
<string>) // text string
<Justification>:
<int> // 0 : left top
// 1 : left base
// 2 : left bottom
// 3 : center top
// 4 : center base
// 5 : center bottom
// 6 : right top
// 7 : right base
// 8 : right bottom
<ImageInfo>:
"Image:=", Array(<RectInfo>,
<ImageData>,
<bool>) // is mirrored
<ImageData>:
<string>, // file path
<int>, // 0 : use the file path and link to it
// 1 : ignore file path and use next parameter
<ListOfComponentNames>:
<string>,<string> ...
// The list may be empty. When not empty, each string that is listed is a component
// that references the model to be edited. Prior to editing, a clone of the model is
// made, and the components that are listed are modified so that they now refer to
// the clone.
VB Example:
Dim nam
oModelManager.EditWithComps_
("Nexxim Circuit Elements\Distributed\Distributed:bendo", _
Array("NAME:bendo new name", _
"ModTime:=", 1152722165, _
"Library:=", "Nexxim Circuit Elements\Distributed\Distributed", _
"LibLocation:=", "SysLibrary", _
Array("NAME:PinDef", _
"Pin:=", Array( "n1", _
-0.00254, _
0.00254, _
0, _
"N", _
0, _
0, _
false, _
0, _
true, _
"", _
false, _
false)), _
Array("NAME:PinDef", _
"Pin:=", Array( "n2", _
0.00254, _
-0.00254, _
1.5708, _
"N", _
0, _
0, _
false, _
0, _
true, _
"", _
false, _
false)), _
Array("NAME:Graphics", _
"Polygon:=", Array( 0, 0, 12566272, 0, 0.00381, 0, .00127, 0.00127,
_
0.00127, 0.00127, 0, 0.00381, 0, 0.00381, _
0.002032, 0.00127, 0.00381), _
"Line:=", Array(0, 1, 12566272, -0.00254, 0.00254, 0, .00254), _
"Line:=", Array(0, 1, 12566272, 0.00254, -0.00254, .00254, 0)), _
Array("NAME:PropDisplayMap", _
"W:=", Array(3, _
5, _
0, _
"Text:=", Array( 2.1684E-019, _
0.00504119, _
0, _
1, _
5, _
false, _
"Arial", _
0, _
"W=***"))))), _
rray("MY_COMP")
<ModelName>:
<string> // composite name of model to export
<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"
VB Example:
oModelManager.Export _
Array("NAME Nexxim Circuit Ele-
ments\Distributed\Distributed:bendo:mylib", _ "myModel"), "Per-
sonalLib"
Note:
GetData allows the user to access definition information, make modifications, and then
use the Edit or EditWithComps script commands to save the modified definition. Accord-
ingly, for each type of definition, the array data returned to GetData should be the same
array information that is supplied to the Edit or EditWithComps commands.
Python IsUsed(<ComboName>)
Syntax
<LibraryName>,
<LibraryLocation>
Return Value: None
Parameters: <ModelName>:
<string> // composite name of the model to remove
<IsProjectModel>:
<bool>
<LibraryName>:
<string> // name of the library
<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"
VB Example:
oModelManager.Remove "Nexxim Circuit Ele-
ments\Distributed\Distributed:bendo", true, "Project"
Python
oModelManager.Export([
Example "NAME:mylib", "model1", "model2"])
VB Example:
Dim removedDefs
removedDefs = oModelManager.RemoveUnused()
Note:
Also, the model and footprint of an unused component are not unusable until after the
component itself is removed using the Component Manager Remove script.
Python RemoveUnused()
Syntax
Remove
RemoveUnused
Parameters: <SymbolName>:
<string> // simple name of the symbol being added
<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.
<PinDefInfo>:
Array("NAME:PinDef",
"Pin:=", Array (<string>, // pin name
<real>, // x location
<real>, // y location
<real>, // angle in radians
<PinType>,
<real>, // line width
<real>, // line length
<bool>, // mirrored
<int>, // color
<bool>, // true if visible, false if not
<string>, // hidden net name
<OptionalPinInfo>, // optional info
<PropDisplayMapInfo>)) // optional
<PinType>:
<string> // "N" : normal pin
// "I" : input pin
// "O" : output pin
<OptionalPinInfo>:
// Specify both or neither
<bool>, // true if name is to be shown
<bool>, // true if number is to be shown
<PropDisplayMapInfo>:
Array("NAME:PropDisplayMap",
<PropDisplayInfo>,
<PropDisplayInfo>,...)
<PropDisplayInfo>:
<NameString>, Array(<DisplayTypeInfo>,
<DisplayLocationInfo>,
<int>, // optional, level number
<TextInfo>)
<NameString>:
<string> // PropertyName:=, where PropertyName is the name of
// the property to be displayed
<DisplayTypeInfo>:
<int> // 0 : No display
// 1 : Display name only
// 2 : Display value only
// 3 : Display both name and value
// 4: Display evaluated value only
// 5: Display both name and evaluated value
<DisplayLocationInfo>:
<int> // 0 : Left
// 1 : Top
// 2 : Right
// 3 : Bottom
// 4 : Center
// 5 : Custom placement
<GraphicsDataInfo>:
Array("NAME:Graphics",
// one or more of the following
<RectInfo>,
<CircleInfo>,
<ArcInfo>,
<LineInfo>,
<PolygonInfo>,
<TextInfo>,
<ImageInfo>)
<RectInfo>:
"Rect:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // angle, in radians
<real>, // x position of center
<real>, // y position of center
<real>, // width
< real>) // height
<CircleInfo>:
"Circle:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>) // radius
<ArcInfo>:
"Arc:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>, // radius
<LineInfo>:
"Line:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<PointInfo>, // must specify at least 2 points
<PointInfo>...)
<PointInfo>:
<real>, // x position
<real> // y position
<PolygonInfo>:
"Polygon:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<PointInfo>, // must specify at least 3 points
<PointInfo>...)
<TextInfo>:
"Text:=", Array(<real>, // x position
<real>, // y position
<real>, // angle, in radians
<Justification>,
<bool>, // is plotter font
<string>, // font name
<int>, // color
<string>) // text string
<Justification>:
<int> // 0 : left top
// 1 : left base
// 2 : left bottom
// 3 : center top
// 4 : center base
// 5 : center bottom
// 6 : right top
// 7 : right base
// 8 : right bottom
<ImageInfo>:
"Image:=", Array(<RectInfo>,
<ImageData>,
<bool>) // is mirrored
<ImageData>:
<string>, // file path
<int>, // 0 : use the file path and link to it
// 1 : ignore file path and use next parameter
<string> // text data, only present if preceding int is 1
VB Example:
oSymbolManager.Add Array("NAME:MySymbol",_
"ModTime:=", 1070989137, _
"Library:=", "", _
"LibLocation:=", "Project", _
Array("NAME:PinDef", _
"Pin:=", Array ("newpin0", _
0.00254, _ 0, _
0, _
"N",_
0, _
0.00254, _
false, _
0, _
true, _
"",_
false, _
false)), _
Array("NAME:PinDef", _
"Pin:=", Array ("newpin1", _
-0.00254, _
0, _
3.14159265358979, _
"N",_
0, _
0.00254, _
false, _
0, _
true, _
"",_
false, _
false)),
Array("NAME:Graphics", _
"Rect:=", Array(0, _
0, _
12566272, _
0, _
4.33680868994202e-019, _
-0.000635, _
0.00508, _
0.002794), _
"Circle:=", Array(0, _
0, _
12566272, _
0.000127, _
0.000635, _
0.000635)))
Edit [deprecated]
Deprecated command — please use EditWithComps.
<PinDefInfo>,
<PinDefInfo>,... // optional, to define pins
<GraphicsDataInfo>, // optional, to define graphics
<PropDisplayMapInfo>), // optional, to define property displays
Array(<ListOfComponentNames>) // Component names
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
<PinType>:
<string> // "N" : normal pin
// "I" : input pin
// "O" : output pin
<OptionalPinInfo>:
// Specify both or neither
<bool>, // true if name is to be shown
<bool>, // true if number is to be shown
<PropDisplayMapInfo>:
Array("NAME:PropDisplayMap",
<PropDisplayInfo>,
<PropDisplayInfo>,...)
<PropDisplayInfo>:
<NameString>, Array(<DisplayTypeInfo>,
<DisplayLocationInfo>,
<int>, // optional, level number
<TextInfo>)
<NameString>:
<DisplayTypeInfo>:
<int> // 0 : No display
// 1 : Display name only
// 2 : Display value only
// 3 : Display both name and value
// 4: Display evaluated value only
// 5: Display both name and evaluated value
<DisplayLocationInfo>:
<int> // 0 : Left
// 1 : Top
// 2 : Right
// 3 : Bottom
// 4 : Center
// 5 : Custom placement
<GraphicsDataInfo>:
Array("NAME:Graphics",
// one or more of the following
<RectInfo>,
<CircleInfo>,
<ArcInfo>,
<LineInfo>,
<PolygonInfo>,
<TextInfo>,
<ImageInfo>)
<RectInfo>:
"Rect:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // angle, in radians
<real>, // x position of center
<real>, // y position of center
<real>, // width
< real>) // height
<CircleInfo>:
"Circle:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>) // radius
<ArcInfo>:
"Arc:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>, // radius
<real>, // start angle, in radians
<end>) // end angle, in radians
<LineInfo>:
"Line:=", Array(<real>, // line width
<PolygonInfo>:
"Polygon:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<PointInfo>, // must specify at least 3 points
<PointInfo>...)
<TextInfo>:
"Text:=", Array(<real>, // x position
<real>, // y position
<real>, // angle, in radians
<Justification>,
<bool>, // is plotter font
<string>, // font name
<int>, // color
<string>) // text string
<Justification>:
<int> // 0 : left top
// 1 : left base
// 2 : left bottom
// 3 : center top
// 4 : center base
// 5 : center bottom
// 6 : right top
// 7 : right base
// 8 : right bottom
<ImageInfo>:
"Image:=", Array(<RectInfo>,
<ImageData>,
<bool>) // is mirrored
<ImageData>:
<string>, // file path
<int>, // 0 : use the file path and link to it
// 1 : ignore file path and use next parameter
<string> // text data, only present if preceding int is 1
<ListOfComponentNames>:
<string>,<string> ...
// The list may be empty. When not empty, each string that is listed is a component
// that references the symbol to be edited. Prior to editing, a clone of the symbol is
// made, and the components that are listed are modified so that they now refer to
// the clone.
VB Example:
Dim nam
oSymbolManager.EditWithComps _
("Nexxim Circuit Elements\Distributed\Distributed:bendo", _
Array("NAME:bendo new name", _
"ModTime:=", 1152722165, _
Array("NAME:Graphics", _
"Polygon:=", Array( 0, 0, 12566272, 0, 0.00381, 0, .00127, 0.00127,
_
0.00127, 0.00127, 0, 0.00381, 0, 0.00381, _
0.002032, 0.00127, 0.00381), _
"Line:=", Array(0, 1, 12566272, -0.00254, 0.00254, 0, .00254), _
"Line:=", Array(0, 1, 12566272, 0.00254, -0.00254, .00254, 0)), _
Array("NAME:PropDisplayMap", _
"W:=", Array(3, _
5, _
0, _
"Text:=", Array( 2.1684E-019, _
0.00504119, _
0, _
1, _
5, _
false, _
"Arial", _
0, _
"W=***"))))), _
Array("MY_COMP")
Parameters: <LibraryName>:
<string> // name of the library
<SymbolName>:
<string> // composite name of symbol to export
<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"
VB Example:
oSymbolManager.Export _
Array("NAME Nexxim Circuit Ele-
ments\Distributed\Distributed:bendo:mylib", _ "mySymbol"), "Per-
sonalLib"
Note:
GetData allows the user to access definition information, make modifications, and then
use the Edit or EditWithComps script commands to save the modified definition. Accord-
ingly, for each type of definition, the array data returned to GetData should be the same
array information that is supplied to the Edit or EditWithComps commands.
<LibraryLocation>
Return Value: None
Parameters: <SymbolName>:
<string> // composite name of the symbol to remove
<IsProjectSymbol>:
<bool>
<LibraryName>:
<string> // name of the library
<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"
VB Example:
oSymbolManager.Remove "Nexxim Circuit Ele-
ments\Distributed\Distributed:bendo", true, "Project"
Note:
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.
"OkayToMirror:=", <bool>,
"DefUnits:=", <UnitType>,
Array(NAME:Lyrs",
"Layer:=", <LayerArray>,
"Layer:=", <LayerArray>…,
"SLayer:=", <StackupLayerArray>,
"SLayer:=", <StackupLayerArray>...),
"ActLyr:=", <string>, // name of active layer
"Tol:=", <ToleranceArray> // optional
<PrimitivesInfo>, // optional
<PinsInfo>, // optional
<ViasInfo>, // optional
<EdgeportsInfo>, // optional
<ComponentPropertyInfo>,
<ScriptInfo>) // optional, specified for scripted footprints
Parameters: <FootprintName>:
<string> // simple name of footprint to create
<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.
<UnitType>:
<string> // default length units to use if units are not specified in other
// parameters
<LayerArray>:
Array("N:=", <string>, // layer name
"ID:=", <int> ,
"T:=", <LayerTypeInfo>, // layer type
"TB:=", <TopBottomInfo>,
"Col:=", <int>, // optional - color
"Pat:=", <int>, // optional - fill pattern
"Vis:=", <bool>, // optional - are objects on layer visible
"Sel:=", <bool>, // optional - are objects on layer selectable
"L:=", <bool>) // optional
// are objects on layer locked (can't be edited)
<LayerTypeInfo>:
<string> // one of: signal, dielectric, metalized signal, assembly, silkscreen, soldermask,
solderpaste, glue, or user
<TopBottomInfo>:
<string> // one of: top, neither, bottom, or template
<StackupLayerArray>:
Array(<LayerArray>,
"Elev:=", <ElevationInfo>,
"SubL:=", Array("Th:=", <Dimension>,
"LElev:=", <Dimension>,
"R:=", <Dimension>,
"M:=", <MaterialInfo>))
<ElevationInfo>:
<string> // "top" - snap to top
<Dimension>:
<string> // real number, may include units
<MaterialInfo>:
<string> // name of the layer material
<ToleranceArray>:
Array(<real>, // distance tolerance
<real>, // angle tolerance (radians)
<real>) // dimensionless tolerance
<PrimitivesInfo>:
Array("NAME:Prims",
// one or more of the following
<RectInfo>,
<CircleInfo>,
<ArcInfo>,
<LineInfo>,
<PolygonInfo>,
<TextInfo>,
<ImageInfo>)
<RectInfo>:
"Rect:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // angle, in radians
<real>, // x position of center
<real>, // y position of center
<real>, // width
< real>) // height
<CircleInfo>:
"Circle:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>) // radius
<ArcInfo>:
"Arc:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>, // radius
<real>, // start angle, in radians
<end>) // end angle, in radians
<LineInfo>:
"Line:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<PointInfo>, // must specify at least 2 points
<PointInfo>...)
<PointInfo>:
<real>, // x position
<real> // y position
<PolygonInfo>:
"Polygon:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<PointInfo>, // must specify at least 3 points
<PointInfo>...)
<TextInfo>:
"Text:=", Array(<real>, // x position
<real>, // y position
<real>, // angle, in radians
<Justification>,
<bool>, // is plotter font
<string>, // font name
<int>, // color
<string>) // text string
<Justification>: <int>
// 0 : left top
// 1 : left base
// 2 : left bottom
// 3 : center top
// 4 : center base
// 5 : center bottom
// 6 : right top
// 7 : right base
// 8 : right bottom
<ImageInfo>:
"Image:=", Array(<RectInfo>,
<ImageData>,
<bool>) // is mirrored
<ImageData>:
<string>, // file path
<int>, // 0 : use the file path and link to it
// 1 : ignore file path and use next parameter
<string> // text data, only present if preceding int is 1
<PinsInfo>:
Array("NAME:Pins",
"P:=", <PinArray>,
"P:=", <PinArray>,...)
<PinArray>:
Array("Port:=", Array("Id:=", <int>,
"Clr:=", <real>, // optional - clearance
"N:=", <string>), // pin name
"Pos:=", Array("x:=", <Location>, // padstack (x,y) position
"y:=", <Location>),
"VRt:=", <Angle>, // optional - rotation
"HD:=", <Size>, // optional - hole diameter
<PadstackImplementationInfo>)
<Location>:
<string> specifying real number and units (may use variables)
<Angle>:
<string> specifying angle with a real number and units
<Size>:
<string> specifying size with a real number and units
<PadstackImplementationInfo>:
If another with the same implementation has already been specified:
"Ref:=", <int> // id of the other
If not:
"Ref:=", <string>, // name
"Frm:=", <int>, // id of highest layer
"To:=", <int>, // id of lowest layer
<LayerPlacementInfo>,
"Man:=", <int>, // optional, 1 if manually placed, 0 if not (default)
"Use:=", Array(<PadUseInfo>, <PadUseInfo>…) // array may be empty
<LayerPlacementInfo>:
"Lyr:=", Array("Mrg:=", <int>, // optional,
// 1 if all layers have been merged (default)
// 0 if layer are not merged
"Flp:=", <int>, // optional,
// 1 if placed bottom up
// 0 if not (default)
"Map:=", <ParentToLocalLayerInfo>)
<ParentToLocalLayerInfo>:
Array("U:=", <DirectionOfUniqueness>,
"F:=", Array(<int>, <int>, …), // forward mapping
// -1 is not mapped
"B:=", Array(<int>, <int>, …)) // backward mapping
// -1 is not mapped
<PadUseInfo>:
"Pad:=", Array("Lid:=", <int>, // layer id
"T:=", <string>, // type : "connected", "thermal",
// "no_pad, "not_connected",
// or "not_connected_thermal"
"Man:=", <int>) // optional, 1 if manually placed
// 0 if not (default)
<DirectionOfUniqueness>:
<string> // one of "forward", "backward", or "two ways"
<ViasInfo>:
Array("NAME:Vias", <ViaInfo>, <ViaInfo>…)
<ViaInfo>:
"V:=", Array("Id:=", <int>,
"N:=", <string>, // name
"Pos:=", Array("x:=", <Location>, // via (x,y) position
"y:=", <Location>),
"VRt:=", <Angle>, // optional - rotation
<ImplementationInfo>
<EdgeportsInfo>:
Array("NAME:EPorts", <EdgePortArray>, <EdgePortArray>…)
<EdgePortArray>:
Array("NAME:EP",
"LP:=", Array("Id:=", <int>, // port id
"N:=", <string>), // port name
"Eo:=", Array(<edge description>, <edge description>,...))
<start Y Location>:
doubles that are the X, Y location of the start point of the edge arc <end X location>
<end Y Location>:
doubles that are the X, Y location of the end point of the edge arc
<arc height>: double giving the height of the edge arc (0 for a straight edge)
<radians>: double giving the arc size in radians (0 for a straight edge)
<ComponentPropertyInfo>:
Array("NAME:CProps",
"VariableProp:=", <VariableInfo>,
"VariableProp:=", <VariableInfo>,
…)
<VariableInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: number, variable, or expression
<ScriptInfo>:
Array("NAME:script",
"language:=", <string>, // one of "javascript" or "vbscript"
"UsesScript:=", true,
"script:=", <string>) // contents of script
VB Example:
oFootprintManager.Add (Array("NAME:BCL", _
"ModTime:=", 1023388445, _
"Library:=", "", _
"LibLocation:=", "Project", _
"OkayToMirror:=", false, _
"DefUnits:=", "mm", _
Array("NAME:Lyrs", _
"Layer:=", Array("N:=", "Measures", _
"ID:=", 8, _
"T:=", "measures", _
"Col:=", 4144959, _
"Pat:=", 1), _
"Layer:=", Array("N:=", "Rats", _
"ID:=", 1, _
"T:=", "rat", _
"Col:=", 16711680, _
"Pat:=", 1), _
"Layer:=", Array("N:=", "Errors", _
"ID:=", 2, _
"T:=", "error", _
"Col:=", 255, _
"Pat:=", 1, _
"L:=", true), _
"Layer:=", Array("N:=", "Symbols", _
"ID:=", 3, _
"T:=", "symbol", _
"Col:=", 8323199, _
"Pat:=", 4), _
"Layer:=", Array("N:=", "Assembly", _
"ID:=", 4, _
"T:=", "assembly", _
"TB:=", "top", _
"Col:=", 16711680, _
Pat:=", 3), _
"Layer:=", Array("N:=", "Silkscreen", _
"ID:=", 5, _
"T:=", "silkscreen", _
TB:=", "top", _
"Col:=", 8454143, _
"Pat:=", 6), _
SLayer:=", Array("Layer:=", Array("N:=", "Cover", _
"ID:=", 12, _
"T:=", "metalizedsignal", _
"Col:=", 32639, _
Pat:=", 7), _
"Elev:=", "mid", _
"SubL:=", Array("Th:=", "0mm", _
"LElev:=", "118.110236220472mil", _
"R:=", "0mm", _
"Mat:=", "")), _
"SLayer:=", Array("Layer:=", Array("N:=", "Dielec3", _
"ID:=", 11, _
"T:=", "dielectric", _
"Col:=", 8323199, _
"Pat:=", 6), _
"Elev:=", "none", _
"SubL:=", Array("Th:=", "1mm", _
"LElev:=", "78.740157480315mil", _
"R:=", "0mm", _
"Mat:=", "")), _
"SLayer:=", Array("Layer:=", Array("N:=", "Trace2", _
"ID:=", 10, _
"T:=", "signal", _
"Col:=", 8355584, _
"Pat:=", 5), _
"Elev:=", "mid", _
"SubL:=", Array("Th:=", "0mm", _
"LElev:=", "78.740157480315mil", _
"R:=", "0mm", _
"Mat:=", "")), _
"SLayer:=", Array("Layer:=", Array("N:=", "Dielec2", _
"ID:=", 6, _
"T:=", "dielectric", _
"Col:=", 8323072, _
"Pat:=", 4), _
"Elev:=", "none", _
"SubL:=", Array("Th:=", "1mm", _
"LElev:=", "39.3700787401575mil", _
"R:=", "0mm", _
"Mat:=", "")), _
"SLayer:=", Array("Layer:=", Array("N:=", "Trace1", _
"ID:=", 0, _
"T:=", "signal", _
"Col:=", 32512, _
"Pat:=", 3), _
"Elev:=", "mid", _
"SubL:=", Array("Th:=", "0mm", _
"LElev:=", "39.3700787401575mil", _
"R:=", "0mm", _
"Mat:=", "")), _
"SLayer:=", Array("Layer:=", Array("N:=", "Dielec1", _
"ID:=", 7, _
"T:=", "dielectric", _
"Col:=", 127, _
"Pat:=", 7), _
"Elev:=", "none", _
"SubL:=", Array("Th:=", "1mm", _
"LElev:=", "0mil", _
"R:=", "0mil", _
"Mat:=", "")), _
"SLayer:=", Array("Layer:=", Array("N:=", "Ground", _
"ID:=", 9, _
"T:=", "metalizedsignal", _
"Col:=", 4144959, _
"Pat:=", 6), _
"Elev:=", "mid", _
"SubL:=", Array("Th:=", "0mil", _
"LElev:=", "0mil", _
"R:=", "0mil", _
"Mat:=", ""))), _
"ActLyr:=", "Trace2", _
Array("NAME:Prims",
"rect:=", Array("Id:=", 10003, _
"Lyr:=", 10, _
"N:=", "rect101", _
"x:=", "0mm", _
"y:=", "0mm", _
"w:=", "P", _
"h:=", "W", _
"Vds:=", Array()), _
"rect:=", Array("Id:=", 10103, _
"Lyr:=", 0, _
"N:=", "rect103", _
"x:=", "0mm", _
"y:=", "0mm", _
"w:=", "P", _
"h:=", "W", _
"Vds:=", Array())), _
Array("NAME:Pins",
"HD:=", "1mm", _
"Ref:=", 5)), _
Array("NAME:Nets"), _
Array("NAME:CProps",
"VariableProp:=", Array("W", _
"UD", _
"", _
"1.5mm"),_
"VariableProp:=", Array("P", _
"UD", _
"", _
10mm"))))
Parameters: <FootprintName>:
<string> // composite name of the footprint being edited
<NewFootprintName>:
<string> // new simple name for the footprint
<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.
<UnitType>:
<string> // default length units to use if units are not specified in other
// parameters
<LayerArray>:
<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
<Dimension>:
<string> // real number, may include units
<MaterialInfo>:
<string> // name of the layer material
<ToleranceArray>:
Array(<real>, // distance tolerance
<real>, // angle tolerance (radians)
<real>) // dimensionless tolerance
<PrimitivesInfo>:
Array("NAME:Prims",
// one or more of the following
<RectInfo>,
<CircleInfo>,
<ArcInfo>,
<LineInfo>,
<PolygonInfo>,
<TextInfo>,
<ImageInfo>)
<RectInfo>:
"Rect:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // angle, in radians
<CircleInfo>:
"Circle:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>) // radius
<ArcInfo>:
"Arc:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<real>, // x position of center
<real>, // y position of center
< real>, // radius
<real>, // start angle, in radians
<end>) // end angle, in radians
<LineInfo>:
"Line:=", Array(<real>, // line width
<int>, // line pattern
<int>, // color
<PointInfo>, // must specify at least 2 points
<PointInfo>...)
<PointInfo>:
<real>, // x position
<real> // y position
<PolygonInfo>:
"Polygon:=", Array(<real>, // line width
<int>, // fill pattern
<int>, // color
<PointInfo>, // must specify at least 3 points
<PointInfo>...)
<TextInfo>:
"Text:=", Array(<real>, // x position
<real>, // y position
<real>, // angle, in radians
<Justification>,
<bool>, // is plotter font
<string>, // font name
<int>, // color
<string>) // text string
<Justification>: <int>
// 0 : left top
// 1 : left base
// 2 : left bottom
// 3 : center top
// 4 : center base
// 5 : center bottom
// 6 : right top
// 7 : right base
// 8 : right bottom
<ImageInfo>:
"Image:=", Array(<RectInfo>,
<ImageData>,
<bool>) // is mirrored
<ImageData>:
<string>, // file path
<int>, // 0 : use the file path and link to it
// 1 : ignore file path and use next parameter
<string> // text data, only present if preceding int is 1
<PinsInfo>:
Array("NAME:Pins",
"P:=", <PinArray>,
"P:=", <PinArray>,...)
<PinArray>:
Array("Port:=", Array("Id:=", <int>,
"Clr:=", <real>, // optional - clearance
"N:=", <string>), // pin name
"Pos:=", Array("x:=", <Location>, // padstack (x,y) position
"y:=", <Location>),
"VRt:=", <Angle>, // optional - rotation
"HD:=", <Size>, // optional - hole diameter
<PadstackImplementationInfo>)
<Location>:
<string> specifying real number and units (may use variables)
<Angle>:
<Size>:
<string> specifying size with a real number and units
<PadstackImplementationInfo>:
If another with the same implementation has already been specified:
"Ref:=", <int> // id of the other
If not:
"Ref:=", <string>, // name
"Frm:=", <int>, // id of highest layer
"To:=", <int>, // id of lowest layer
<LayerPlacementInfo>,
"Man:=", <int>, // optional, 1 if manually placed, 0 if not (default)
"Use:=", Array(<PadUseInfo>, <PadUseInfo>…) // array may be empty
<LayerPlacementInfo>:
"Lyr:=", Array("Mrg:=", <int>, // optional,
// 1 if all layers have been merged (default)
// 0 if layer are not merged
"Flp:=", <int>, // optional,
// 1 if placed bottom up
// 0 if not (default)
"Map:=", <ParentToLocalLayerInfo>)
<ParentToLocalLayerInfo>:
Array("U:=", <DirectionOfUniqueness>,
"F:=", Array(<int>, <int>, …), // forward mapping
// -1 is not mapped
"B:=", Array(<int>, <int>, …)) // backward mapping
// -1 is not mapped
<PadUseInfo>:
"Pad:=", Array("Lid:=", <int>, // layer id
"T:=", <string>, // type : "connected", "thermal",
// "no_pad, "not_connected",
// or "not_connected_thermal"
"Man:=", <int>) // optional, 1 if manually placed
// 0 if not (default)
<DirectionOfUniqueness>:
<string> // one of "forward", "backward", or "two ways"
<ViasInfo>:
Array("NAME:Vias", <ViaInfo>, <ViaInfo>…)
<ViaInfo>:
"V:=", Array("Id:=", <int>,
"N:=", <string>, // name
"Pos:=", Array("x:=", <Location>, // via (x,y) position
"y:=", <Location>),
"VRt:=", <Angle>, // optional - rotation
<ImplementationInfo>
<EdgeportsInfo>:
Array("NAME:EPorts", <EdgePortArray>, <EdgePortArray>…)
<EdgePortArray>
Array("NAME:EP",
"LP:=", Array("Id:=", <int>, // port id
<arc height>: double giving the height of the edge arc (0 for a straight edge)
<radians>: double giving the arc size in radians (0 for a straight edge)
<ComponentPropertyInfo>:
Array("NAME:CProps",
"VariableProp:=", <VariableInfo>,
"VariableProp:=", <VariableInfo>,
…)
<VariableInfo>:
Array(<string>, // name
<FlagLetters>,
<string>, // description
"CB:=", <string>, // optional - script for call back
<string>) // value: number, variable, or expression
<ScriptInfo>:
Array("NAME:script",
"language:=", <string>, // one of "javascript" or "vbscript"
"UsesScript:=", true,
"script:=", <string>) // contents of script
<ListOfComponentNames>:
<string>,<string> ...
// The list may be empty. When not empty, each string that is listed is a component
// that references the footprint to be edited. Prior to editing, a clone of the footprint is
// made, and the components that are listed are modified so that they now refer to
// the clone.
VB Example:
Dim nam
oFootprintManager.EditWithComps _
("Nexxim Circuit Elements\Distributed\Distributed:bendo", _
Array("NAME:bendo new name", _
"ModTime:=", 1152722165, _
Array("NAME:Graphics", _
"Polygon:=", Array( 0, 0, 12566272, 0, 0.00381, 0, .00127, 0.00127,
_
0.00127, 0.00127, 0, 0.00381, 0, 0.00381, _
0.002032, 0.00127, 0.00381), _
"Line:=", Array(0, 1, 12566272, -0.00254, 0.00254, 0, .00254), _
"Line:=", Array(0, 1, 12566272, 0.00254, -0.00254, .00254, 0)), _
Array("NAME:PropDisplayMap", _
"W:=", Array(3, _
5, _
0, _
"Text:=", Array( 2.1684E-019, _
0.00504119, _
0, _
1, _
5, _
false, _
"Arial", _
0, _
"W=***"))))), _
Array("MY_COMP")
<FootprintName>:
<string> // composite name of footprint to export
<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"
VB Example:
oFootprintManager.Export Array("NAME:mylib", "Distributed Foot-
prints:BPAD"), "PersonalLib"
Note:
GetData allows the user to access definition information, make modifications, and then
use the Edit or EditWithComps script commands to save the modified definition. Accord-
ingly, for each type of definition, the array data returned to GetData should be the same
array information that is supplied to the Edit or EditWithComps commands.
<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"
Note:
Also, the symbol and footprint of an unused component are not unusable until after the
component itself is removed using the Component ManagerRemove script.
Syntax: AddPortsToAllNets
Return Value: None
Parameters: None.
VB Example:
oEditor. AddPortsToAllNets
AddPortsToNet [padstack manager]
Use: Add ports to all the pins on the designated nets.
Command: In Layout r-click>Port>Create Ports on Net
Layout tab under Nets r-click>Create Ports
Syntax: AddPortsToNet Array("NAME:Nets", "net-name", …)
Return Value: None
Parameters: net-name the name of a net; all pins on this particular
net receive ports.
VB Example:
oEditor.AddPortsToNet Array("NAME:Nets", "CB1", "CB5")
"hle:=", <PadInfo>
"hRg:=", <HoleRange>,
"sbsh:=", <SolderballShape>,
"sbpl:=", <SolderballPlacement>,
"sbr:=", <string>, // solderball diameter, real with units
"sb2:=", <string>, // solderball mid diameter, real with units
"sbn:=", <string>), // name of solderball material
"ppl:=", <PadPortLayerArray>)
Return Value: simple name of the added padstack
// If the name requested conflicts with the name of an existing
// padstack, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.
Parameters: <PadstackName>:
<string> // simple name of padstack to create
<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.
<LayerGeometryArray>:
Array("Name:lgm",
"lay:=", <string>, // definition layer name
"id:=", <int>, // definition layer id
"pad:=", <PadInfo>, // pad
"ant:=", <PadInfo>, // antipad
"thm:=", <PadInfo>, // themal pad
"X:=", <string>, // pad x connection, real with units
"Y:=", <string>, // pad y connection, real with units
"dir:=", <DirectionString>) // pad connection direction
<PadInfo>:
Array("shp:=", <PadShape>,
"Szs:=", <DimensionArray>,
"X:=", <string>, // x offset, real with units
"Y:=", <string>, // y offset, real with units
"R:=", <string>) // rotation, real with units
<PadShape>:
<string> one of these choices
"No" // no pad
"Cir" // Circle
"Sq" // Square
"Rct" // Rectangle
"Ov" // Oval
"Blt" // Bullet
"Ply" // Polygons
"R45" // Round 45 thermal
"R90" // Round 90 thermal
"S45" // Square 45 thermal
"S90" // Square 90 thermal
<DimensionArray>:
Array(<string>, ...) // each string is a real with units for one of the dimensions of the
shape
<DirectionString>:
<string> one of these choices
"No" // no direction
"Any" // any direction
"0" // 0 degrees
"45" // 45 degrees
"90" // 90 degrees
"135" // 135 degrees
"180" // 180 degrees
"225" // 225 degrees
"270" // 270 degrees
"315" // 315 degrees
<HoleRange>:
<string> one of these choices
"Thr" // through all layout layers
"Beg" // from upper pad layer to lowest layout layer
"End" // from upper layout layer to lowest pad layer
"UTL" // from upper pad layer to lowest pad layer
<SolderballShape>:
<string> one of these choices
"None" // no solderball
"Cyl" // cylinder solderball
"Sph" // spheroid solderball
<SolderballPlacement>:
<string> one of these choices
"abv" // above padstack
"blw" // below padstack
<PadPortLayerArray>:
Array( <int>, <int>,....) where each int is a layer id
VB Example:
"sbsh:=", <SolderballShape>,
"sbpl:=", <SolderballPlacement>,
"sbr:=", <string>, // solderball diameter, real with units
"sb2:=", <string>, // solderball mid diameter, real with units
"sbn:=", <string>), // name of solderball material
"ppl:=", <PadPortLayerArray>)
Return Value: <string> // composite name of the padstack
// If the name requested conflicts with the name of an existing
// padstack, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.
Parameters: <PadstackName>:
<string> // composite name of padstack to edit
<NewPadstackName>:
<string> // new simple name for padstack
<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.
<LayerGeometryArray>:
Array("Name:lgm",
"lay:=", <string>, // definition layer name
"id:=", <int>, // definition layer id
"pad:=", <PadInfo>, // pad
"ant:=", <PadInfo>, // antipad
"thm:=", <PadInfo>, // themal pad
"X:=", <string>, // pad x connection, real with units
"Y:=", <string>, // pad y connection, real with units
<PadInfo>:
Array("shp:=", <PadShape>,
"Szs:=", <DimensionArray>,
"X:=", <string>, // x offset, real with units
"Y:=", <string>, // y offset, real with units
"R:=", <string>) // rotation, real with units
<PadShape>:
<string> one of these choices
"No" // no pad
"Cir" // Circle
"Sq" // Square
"Rct" // Rectangle
"Ov" // Oval
"Blt" // Bullet
"Ply" // Polygons
"R45" // Round 45 thermal
"R90" // Round 90 thermal
"S45" // Square 45 thermal
"S90" // Square 90 thermal
<DimensionArray>:
Array(<string>, ...) // each string is a real with units for one of the
// dimensions of the shape
<DirectionString>:
<string> one of these choices
"No" // no direction
<HoleRange>:
<string> one of these choices
"Thr" // through all layout layers
"Beg" // from upper pad layer to lowest layout layer
"End" // from upper layout layer to lowest pad layer
"UTL" // from upper pad layer to lowest pad layer
<SolderballShape>:
<string> one of these choices
"None" // no solderball
"Cyl" // cylinder solderball
"Sph" // spheroid solderball
<SolderballPlacement>:
<string> one of these choices
"abv" // above padstack
"blw" // below padstack
<PadPortLayerArray>:
Array( <int>, <int>,....) where each int is a layer id
VB Example:
"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
Parameters: <PadstackName>:
<string> // composite name of the padstack being edited
<NewPadstackName>:
<string> // new simple name for the padstack
<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.
<LayerGeometryArray>:
Array("Name:lgm",
"lay:=", <string>, // definition layer name
"id:=", <int>, // definition layer id
<PadInfo>:
Array("shp:=", <PadShape>,
"Szs:=", <DimensionArray>,
"X:=", <string>, // x offset, real with units
"Y:=", <string>, // y offset, real with units
"R:=", <string>) // rotation, real with units
<PadShape>:
<string> one of these choices
"No" // no pad
"Cir" // Circle
"Sq" // Square
"Rct" // Rectangle
"Ov" // Oval
"Blt" // Bullet
"Ply" // Polygons
"R45" // Round 45 thermal
"R90" // Round 90 thermal
"S45" // Square 45 thermal
"S90" // Square 90 thermal
<DimensionArray>:
Array(<string>, ...) // each string is a real with units for one of the
<DirectionString>:
<string> one of these choices
"No" // no direction
"Any" // any direction
"0" // 0 degrees
"45" // 45 degrees
"90" // 90 degrees
"135" // 135 degrees
"180" // 180 degrees
"225" // 225 degrees
"270" // 270 degrees
"315" // 315 degrees
<HoleRange>:
<string> one of these choices
"Thr" // through all layout layers
"Beg" // from upper pad layer to lowest layout layer
"End" // from upper layout layer to lowest pad layer
"UTL" // from upper pad layer to lowest pad layer
<SolderballShape>:
<string> one of these choices
"None" // no solderball
"Cyl" // cylinder solderball
"Sph" // spheroid solderball
<SolderballPlacement>:
<string> one of these choices
"abv" // above padstack
<PadPortLayerArray>:
Array( <int>, <int>,....) where each int is a layer id
<ListOfComponentNames>:
<string>,<string> ...
// The list may be empty. When not empty, each string that is listed is a component
// that references the padstack to be edited. Prior to editing, a clone of the padstack is
// made, and the components that are listed are modified so that they now refer to
// the clone.
VB Example:
oPadstackManager.EditWithComps "Circle - through1", Array
("NAME:Circle - through1", "ModTime:=", _
1235765635, "Library:=", "", "LibLocation:=", "Project", Array
("NAME:psd", "nam:=", _
"Circle - through1", "lib:=", "", "mat:=", "", "plt:=", "0", Array
("NAME:pds", Array("NAME:lgm", "lay:=", _
"Top Signal", "id:=", 0, "pad:=", Array("shp:=", "Cir", "Szs:=",
Array("2.5mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir",
"Szs:=", Array( _
"3.5mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array
("shp:=", "No", "Szs:=", Array(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", "0mm",
"dir:=", "Any"), Array("NAME:lgm", "lay:=", _
"SignalA", "id:=", 1, "pad:=", Array("shp:=", "Cir", "Szs:=", Array
("2mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir",
"Szs:=", Array( _
"3mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array
("shp:=", "No", "Szs:=", Array(), "X:=", _
<PadstackName>:
<string> // simple name of padstack to export
<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"
VB Example:
oPadstackManager.Export Array("NAME:mylib", "myPadstack"), "Per-
sonalLib"
Note:
GetData allows the user to access definition information, make modifications, and then
use the Edit or EditWithComps script commands to save the modified definition. Accord-
ingly, for each type of definition, the array data returned to GetData should be the same
array information that is supplied to the Edit or EditWithComps commands.
<LibraryName>,
<LibraryLocation>
Return Value: None
Parameters: <PadstackName>:
<string> // simple name of the padstack to remove
<IsProjectPadstack>:
<bool>
<LibraryName>:
<string> // name of the library
<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"
VB Example:
Note:
GetData
GetNames
GetProperties
IsUsed
Remove
RemoveUnused
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.NewProject
oProject.InsertDesign "Nexxim Circuit", "Nexxim1", "", ""
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.NewProject
oProject.InsertDesign "Nexxim Circuit", "Nexxim1", "", ""
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.NewProject
oProject.InsertDesign "Nexxim Circuit", "Nexxim1", "", ""
Set oMaterialMgr = oProject.GetDefinitionManager().GetManager("Mater-
ial")
oMaterialMgr.Add( Array("NAME:MyMaterial1", "Coordin-
ateSystemType:=", "Cartesian", "permittivity:=", "0.123") )
oMaterialMgr.Add( Array("NAME:MyMaterial2", "Coordin-
ateSystemType:=", "Cartesian", "permittivity:=", "0.456")
Dim materialNames
materialNames = oMaterialMgr.GetNames()
Python oMaterialManager.GetProperties("Gold")
Example
Python IsUsed(<ComboName>)
Syntax
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.NewProject
oProject.InsertDesign "Nexxim Circuit", "Nexxim1", "", ""
Dim message
Dim createdMat
Python RemoveUnused()
Syntax
Syntax: ExportNMFData
"DesignName", // Design name. Can be left blank, if loading solution from a file.
true/false, // true - solution loaded from file, false- loaded from design
"Name", // If loading from design this is the solution name, else this is the
// full path of the file from which the solution is loaded
"ExportFile", // full path of file to export to
Array("NAME:Frequencies"), // optional, if none defined all frequencies are used
Array("NAME:NMFOptions", // Export NMF options object
"DataTypes:=", Array("S"), // DataTypes can be "S", "Y","Z", "G", and "Z0",
// for S , Y, Z matrix, Gamma and Z0 (zero)
"DisplayFormat:=", "MA", // DisplayFormat "MA", "RI", "DB"
"FileType:=", "", // Export File Type
// 2 - Spreadsheet(*.tab)
// 3 - Touchstone(*.sNp)
// 4 - Citifile(*.cit)
// 6 - Neutral format(*.nmf)
// 7 - Matlab format(*.m)
"Renormalize:=", false, // Renormalize true/false
"RefImpedance:=",50, // Reference Impedance
"Precision:=", 8, // Number of digits Precision
"Variables:=", ARRAY("FF", "cap", "Rs") // Array of variables
"Variations:=", ARRAY("", "", "") // Array of variations to export solutions for
Array("NAME:ConstantVars") // Array of variables that are constant, can be empty
Array("NAME: DependentVars") // Array of variables that are dependent, can be empty
"MatrixSize:=", 2, // Matrix size, optional (used in nmf file header)
"CreateNPortModel:=", true // Create a model based on the exported file true/false
)
AddScript
Use: Add Script in the script definition manager
Command: None
Syntax: AddScript Array(<AddScriptArray>)
Return Value: None
Parameters: <AddScriptArray>
Array("NAME<ScriptName>", <string>,
<ScriptLanguage>,<string> ("vbscript" or "javascript")
<ScriptText>, <string> // text of script
VB Example: oDefinitionManager.AddScript Array("NAME:MyScript", _
"ScriptLang:=", "vbscript", _
"ScriptText:=", "MsgBox(" & Chr(34) & "Hello World" & Chr(34) & ")")
oDefinitionManager.AddScript (["NAME:MyScript", _
Python
"ScriptLang:=", "vbscript", _
Examp-
le "ScriptText:=", "MsgBox(" & Chr(34) & "Hello World" & Chr
(34) &")"])
EditScript
Use: Edit Script in the script definition manager
Command: None
Syntax: EditScript <OriginalName>,Array("NAME:<NewName>", < ScriptText >)
oDefinitionManager.EditScript ("myscript",
["NAME:myscript", "ScriptLang:=", _
Python
Example "vbscript", "ScriptText:=", _
"MsgBox(" & Chr(34) & "Hello Again"
& Chr(34) & ")"])
ExportScript
Use: Export to Library in the script definition manager
Command: None
Syntax: ExportScript <ExportData>,<Library location>
Return Value: None
Parameters: <ExportData>
Array("NAME:<LibraryName>",<ScriptName>,<ScriptName>,…)
VB Example:
Python oProject.ExportComponent
Example (["NAME:mylib", "myscript"], "PersonalLib")
RemoveScript
Use: Remove Script in the script definition manager
Command: None
Syntax: RemoveScript <ScriptName>,<IsProjectScript>, <LibraryName>,<LibraryLocation>
Return Value: None
Parameters: <ScriptName>
Type: <string>
<IsProjectScript>
Type: <bool>
<LibraryName>
Type: <string>
<LibraryLocation>
Type: <string>
VB Example:
oDefinitionManager.RemoveScript "myscript", true, "Local", "Project"
Python
oDefinitionManager.RemoveScript(
Example "myscript", true, "Local", "Project")
ModifyLibraries
Use: Configure Libraries on the Tools menu
Command: None
Syntax: ModifyLibraries <DesignName>,Array(<ConfigLibArray>)
oDefinitionManager.ModifyLibraries(
"MyCircuit", _
["NAME:PersonalLib"], _
["NAME:UserLib"], _
Python
Example ["NAME:SystemLib", _
"Symbols:=", [ "Circuit Elements", "Symbols",_
"ParamExtraElements\PE_Symbols", _
"Vendor Elements\Nonlinear"]])
"Color:=", <ColorNumber>,
"Pattern:=", <FillPattern>,
"Visible:=", <Visibility>,
"Selectable:=", <Selectability>,
"Locked:=", <Locked>)
Return Value:None.
Parameters:<LayerName>
Type: <String>
<Type >
Type: <String> (Same choices as in the layer dialog.)
<TB >
Type: <String> Choices are "Top"|"Neither"|"Bottom"|"Template"|"Invalid"
<ColorNumber>
Type: integer representing rbg in hex
<FillPattern>
Type: integer
<Visibility>
true | false
<Selectability>
true | false
<Locked>
true | false
VB Example:oDefinitionEditor.AddLayer Array("NAME:layer", "Name:=",
"junk footprint", _
"Type:=", "soldermask", "Top Bottom:=", "neither", "Color:=",
4144959, _
"Pattern:=", 1, "Visible:=", true, "Selectable:=", true, "Locked:=",
false)
<SublayerArray>
Type: Array(("NAME:Sublayer", "Thickness:=", <Thickness>, "LowerElevation:=",
<Elevation>, "Roughness:=" , <Roughness>, "Material:=", <MaterialName)
<Thickness>
Type: <String> containing number and units (e.g. "0mil")
<Elevation>
Type: <String> containing number and units (e.g. "0mil")
<Roughness>
Type: <String> containing number and units (e.g. "0mil")
<Material>
Type: <String>
oEditor.AddStackupLayer Array("NAME:stackup layer", "Name:=",
"MyLayer2", _
"Type:=", "Signal", "Top Bottom:=", "neither", "Color:=", 127, "Pat-
tern:=", 7, _
"Visible:=", true, "Selectable:=", true, "Locked:=", false, "Elev-
ationEditMode:=", "none",_
Array("NAME:Sublayer", "Thickness:=", "25mil", "LowerElevation:=",
"0mil", _
"Roughness:=", "0mil", "Material:=", "Al2_O3_ceramic"), "UseR:=",
true, _
"RMdl:=", "Huray", "NR:=", "2mil", "HRatio:=", 2.8)
…) // etc
Return Value: None.
"SnapTargetIntersection_on:=", true, _
"SnapTargetGrid_on:=", false, _
"SnapSourceVertex_on:=", false, _
"SnapSourceEdgeCenter_on:=", false, _
"SnapSourceObjCenter_on:=", true, _
"SnapSourceEdge_on:=", true, _
"SnapSourceElecConnection_on:=", true, _
"ConstrainToGrid:=", false _
"defaultholesize:=", "5mil", _
"show connection points:=", true, _
"display vertex labels:=", true, _
"NetColor:=", 8421440, _
"rectangle description:=", 1, "snaptoport:=", false, _
"sym footprint scaling:=", _
0.385, "primary selection color:=", 32768, _
"secondary selection color:=", _
22784, "preview selection:=", true, "anglesnap:=", _
"59deg", "AllowDragOnFirstClick:=", true, _
"useFixedDrawingResolution:=", true, _
"DrawingResolution:=", "0.002mm", "Tol:=", _
Array(3E-009, 1.5E-008, 1E-012))
Note:
An error will be returned if this script command is not used at the top-level hierarchy.
height
Default Hole Default size for 25 mil "defaultholesize" 2
Size actual holes in a PC
board
Align Snaps components on "snaptoport" 1
Microwave on entry.
Components
Symbol Foot- Used to size symbol Based on data extent and "sym footprint scaling" 6
print Scaling footprints placed in current length units.
layout.
Primary and Colors used to indic- Primary color is red, sec- "primary selectioncolor" 3
Secondary ate the first item ondary color is a darker red
Selection selected and other "secondary selection color" 3
Colors items currently selec-
ted.
Preview Highlight the object off "preview selection" 1
Selection that would be selec-
ted with a left mouse
button click in the
current location.
Snapping Choose snapping Snap distance is 20 pixels. "PixelSnapTolerance"7
options sources and targets Snapping sources are ver- "SnapTargetVertex_on"1
and the maximum tex, edge center, object cen- "SnapTargetEdgeCenter_
distance (in pixels) ter, & elec. conn. Snapping on"1
for snapping to targets are vertex, edge cen- "SnapTargetObjCenter_on"1
occur. Constrain ter, object center, elec. "SnapTargetEdge_on"1
edits to grid if conn, & grid. Edits are con- "SnapTargetElecConnection_
desired. strained to grid. on"1
"SnapTargetIntersection_on"1
"SnapTargetGrid_on"1
"SnapSourceVertex_on"1
Note: "SnapSourceEdgeCenter_
on"1
Off-grid "SnapSourceObjCenter_on"1
objects are "SnapSourceEdge_on"1
ignored if Con- "SnapSourceElecConnection_
on"1
strainToGrid is "ConstrainToGrid"1
asserted.
4 = An Array containing (lower left x, lower left y, upper right x, upper right y)
7 = Integer
Array("NAME:Contents",
"edge:=", Array(<edge description>), "edge:=, Array(<edge description>), ...
"external:=", <flag>)
Return Value: Text containing the name of the created edge port. (Returns an empty name if the
edge port is not created.)
Parameters: <edge description> for primitive edges
"et:=", "pe", "prim:=", <"prim">, "edge:=", <edge#>
<arc height>: double giving the height of the edge arc (0 for a straight edge)
<radians>: double giving the arc size in radians (0 for a straight edge)
<flag>
true if the port is an external port
false if the port is an internal port
VB Example:
oDefinitionEditor.CreateEdgePort Array("NAME:Contents", "edge:=",
Array("et:=",
"pe", "prim:=", "rect_6", "edge:=", 1), "edge:=", Array("et:=",
"pe", "prim:=",
"rect_6", "edge:=", 2), "external:=", true)
"MeasurementGeometry:=",
Array("LayerName:=", <layer_name>, // layer
"lw:=", <value>, // line width
"sx:=", <value>, // start X coordinate
"sy:=", <value>, // start Y coordinate
"ex:=", <value>, // end X coordinate
"ey:=", <value>, // end Y coordinate
<text_style>)
<text_style> :
"name:=", <quoted string>, // its name
"isPlot:=", <bool>,
"font:=", <font_name>,
"size:=", double, // size in current units
"angle:=", <value>,
"weight:=", <text_weight>,
"just:=", <text_justification>,
"mirror:=", <bool>,
"scales:=", <bool>))
VB Example:
oEditor.CreateMeasure
Array("NAME:Contents",
"MeasurementGeometry:=",
Array("Layer:=", 0,
"Name:=", "Measurement_2",
"LayerName:=", "Measures",
"lw:=", "0mm",
"sx:=", "-32mm",
"sy:=", "-13mm",
"ex:=", "32mm",
"ey:=", "-11mm",
"name:=", "<DefaultAnnotation>",
"isPlot:=", false,
"font:=", "Arial",
"size:=", 10,
"angle:=", "0deg",
"weight:=", 3,
"just:=", 4,
"mirror:=", false,
"scales:=", false))
The following are also in the array if the layer is a stackup layer:
Index: integer [the stackup order index]
…) // etc
VB Example:
oEditor.Intersect Array("NAME:primitives", "circle_0", "rect_2")
Note As with other Layout scripting interface commands that modifiy the layout, this command is
not intended for use within scripts that define footprints. The command behavior from within such a
script is undefined and may be unexpected. Use the LayoutHost scripting interface commands
within scripts that define footprints.
oProject.SetActiveDefinitionEditor("SymbolEditor", "tqtrx_cap")
…) // etc
VB Example:
oEditor.Intersect Subtract ("NAME:primitives", "circle_0", "rect_2")
…) // etc
VB Example:
oEditor.Unite Array("NAME:primitives", "circle_0", "rect_2")
AddRuleSet
Use: Adds a rule set to the design
Command: Right-click Design Verification in the Project Tree and choose Add Rule Set
Syntax: AddRuleSet Array("NAME:<RuleSetName>",
"ScriptNames:=", <ScriptInfo>,
"ScriptActiveFlags:=", <ScriptFlags>)
Return Value: None
Parameters: <RuleSetName>:
<string> // name of the rule set to create
<ScriptInfo>:
Array(<string>, <string>,...) // names of scripts to be in the rule set
<ScriptFlags>:
AddRun
Use: Adds a run to a rule set already in the design
Command: Right-click on a rule set item under Design Verification in the Project Tree and
choose Add Run
Syntax: AddRun <RuleSetName>,
Array("NAME:<RunName>",
"TargetType:=", <TargetTypeInfo>, // optional
"TargetObjects:=", <TargetObjectsInfo>, // optional
"IgnoredObjects:=", <IgnoredObjectsInfo>, // optional
"ArcTolerance:=", <ToleranceString>) // optional
Return Value: None
Parameters: <RuleSetName>:
<string> // name of an existing rule set
<RunName>:
<string> // name of the run to create
<TargetTypeInfo>:
<int> // 0 for entire layout (default if not specified)
// 1 for specified portion of layout
<TargetObjectsInfo>:
objects on which to perform the check
DeleteRuleSet
Use: Deletes a rule set from the design
Command: Right-click on a rule set item under Design Verification in the Project Tree and
choose Delete
Syntax: DeleteRuleSet <RuleSetName>
Return Value: None
Parameters: <RuleSetName>:
DeleteRun
Use: Deletes a run from an existing a rule set
Command: Right-click on a run item under Design Verification in the Project Tree and choose
Delete
Syntax: DeleteRun <RuleSetName>, <RunName>
Return Value: None
Parameters: <RuleSetName>:
<string> // name of an existing rule set
<RunName>:
<string> // name of the run to delete
VB Example: oModule.DeleteRun "Rule Set 10", "All
EditRuleSet
Use: Edits a existing rule set
Command: Right-click on a rule set item under Design Verification in the Project Tree and
choose Properties.
Syntax: EditRuleSet <ExistingRuleSetName>,
Array("NAME:<RuleSetName>",
"ScriptNames:=", <ScriptInfo>,
"ScriptActiveFlags:=", <ScriptFlags>)
Return Value: None
Parameters: <ExistingRuleSetName>:
<string> // name of the rule set to change
<RuleSetName>:
<string> // name of the rule set after change
<ScriptInfo>:
Array(<string>, <string>,...) // names of scripts to be in the rule set
<ScriptFlags>:
sequence of "t" and "f" characters
t indicates a script that is active (used in when the rule set is run)
f indicates a script is not currently active (used when the rule set is run)
applied to the scripts as ordered in <ScriptInfo>
<string>
VB Example: oModule.EditRuleSet "Rule Set 9", _
Array("NAME:Rule Set 10", _
"ScriptNames:=", Array("And", _
"Find Shorts"), _
"ScriptActiveFlags:=", "tt")
EditRun
Use: Edits an existing run.
Command: Right-click on a run item under Design Verification in the Project Tree and choose
Properties.
Syntax: EditRun <RuleSetName>,
<ExistingRunName>,
Array("NAME:<RunName>",
"TargetType:=", <TargetTypeInfo>, // optional
"TargetObjects:=", <TargetObjectsInfo>, // optional
"IgnoredObjects:=", <IgnoredObjectsInfo>, // optional
"ArcTolerance:=", <ToleranceString>) // optional
Return Value: None
Parameters: <RuleSetName>:
<string> // name of an existing rule set
<ExistingRunName>:
<string> // name of the run to change
<RunName>:
<string> // name of the run after the changes
<TargetTypeInfo>:
<int> // 0 for entire layout (default if not specified)
// 1 for specified portion of layout
<TargetObjectsInfo>:
objects on which to perform the check
may specify if TargetTypeInfo is 1 (specified portion of layout)
"<ObjectName>, <ObjectName>, ..."
<ObjectName):
<string> // name of a layout object
<IgnoredObjectsInfo>:
objects which to ignore when performing the check
may specify if TargetTypeInfo is 0 (entire layout)
"<ObjectName>, <ObjectName>, ..."
<ToleranceString>:
<string> // real number and units
// if not specified, the current layout arc tolerance is used
VB Example:
oModule.EditRun "Rule Set 10", _
"All", _
Array("NAME:New All", _
"TargetType:=", 0)
oModule.EditRun "Rule Set 10", _
"New All", _
Array("NAME:Selected Objs2", _
"TargetType:=", 1, _
"TargetObjects:=", "line_975,line_1015")
oModule.EditRun "Rule Set 10", _
"Selected Objs2", _
Array("NAME:Objects to Ignore2", _
"TargetType:=", 0, _
"IgnoredObjects:=", "via_209,line_736")
RenameRuleSet
Use: Renames a existing rule set
Command: Right-click on a rule set item under Design Verification in the Project Tree and
choose Rename
Syntax: RenameRuleSet <ExistingRuleSetName>, <NewRuleSetName>
Return Value: None
Parameters: <ExistingRuleSetName>:
<string> // name of the rule set to change
<NewRuleSetName>:
<string> // new name for the rule set
VB Example: oModule.RenameRuleSet "Rule Set 12", "Rule Set 30"
RenameRun
Use: Renames an existing run.
Command: Right-click on a run item under Design Verification in the Project Tree and choose
Rename
Syntax: RenameRun <RuleSetName>, <ExistingRunName>, <NewRunName>
Return Value: None
Parameters: <RuleSetName>:
<string> // name of an existing rule set
<ExistingRunName>:
<string> // name of the run to change
<NewRunName>:
<string> // new name for the run
VB Example: oModule.RenameRun "Rule Set 30", "New All", "Sel
Objects"
RunAllDV
Use: Executes all runs in the Design Verification Project Tree item.
Command: Right-click on Design Verification in the Project Tree and choose Run All
Syntax: RunAllDV
Return Value: None
Parameters: None
VB Example: oModule.RunAllDV
RunAllRuleSetDV
Use: Executes all runs in an existing rule set
Command: Right-click on a rule set item under Design Verification in the Project Tree and
choose Run All
Syntax: RunAllRuleSetDV <RuleSetName>
Return Value: None
Parameters: <RuleSetName>:
<string> // name of an existing rule set
VB Example: oModule.RunAllRuleSetDV "Rule Set 30"
RunDV
Use: Executes the specified run in an existing rule set
Command: Right-click on a run item under Design Verification in the Project Tree and choose
Run
Syntax: RunDV <RuleSetName>, <RunName>
Return Value: None
Parameters: <RuleSetName>:
<string> // name of an existing rule set
<RunName>:
<string> // name of the run to execute
VB Example: oModule.RunDV "Rule Set 30", "Run 2"
26 - Example Scripts
This section contains VBScript and IronPython example scripts.
"Note: If you do not specify a path the file will " & _
"be placed in the script directory", _
"File","C:\hfss_export.txt",50,50)
'
' If the user clicks Cancel the path will be blank, in which
case the script should just exit.
If path <>"" then
'
' Create the file, open it for data entry, and output the
column labels.
'
Set oFS = CreateObject("Scripting.FileSystemObject")
Set ofile = oFS.CreateTextFile (path)
line = "Freq" & chr(9) & "RE(S11)" & chr(9) & "IMG(S11)"
ofile.WriteLine line
'
' Input the needed freq, solution, and sweep data and clean it
up.
'
msgbox("For the following input make sure it matches " & _
"the frequencies defined in your sweep")
range = inputbox("Input the range of frequencies in GHz " & _
"and number of points",_
"Frequency","8,12,10",50,50)
'
' The following 2 lines define the 2 output variables.
'
oDesign.CreateOutputVariable "re_S", "re(S(port1,port1))"
oDesign.CreateOutputVariable "im_S", "im(S(port1,port1))"
arr = split (range, ",")
arr(0) = Trim(arr(0))
arr(1) = Trim(arr(1))
arr(2) = Trim(arr(2))
if cint(arr(2)) <> 1 then
del_f = (arr(1)-arr(0))/(arr(2)-1)
else
del_f = 0
end if
temp = InputBox("Input the Setup and Sweep number to use:"_
& chr(13) & "(e.g. input 1,2 for Setup1 and Sweep2)", _
"Solution Data","1,1",50,50)
arr2 = split(temp,",")
stn = arr2(0)
swn = arr2(1)
stn = Trim(stn)
swn = Trim(swn)
'
' Loop through the freq points.
'
for i=1 to arr(2) step 1
freq = arr(0) + (cint(i)-1)*del_f
x=freq
cfreq="Freq='" & freq & "Ghz'"
'
' Get the values of the output variables for the desired freq.
'
val = oDesign.GetOutputVariableValue("re_S","Setup" & _
stn & " :Sweep" & swn,cfreq, "")
y = val
val = oDesign.GetOutputVariableValue("im_S","Setup" & _
stn & " : Sweep" & swn,cfreq, "")
z = val
'
' Create the line of text to send to the file and write it to
the file.
'
line = x & chr(9) & y & chr(9) &z
ofile.WriteLine line
Next
'
' Delete the 2 output variables before finishing.
'
oDesign.DeleteOutputVariable "re_S"
oDesign.DeleteOutputVariable "im_S"
'
' Close the file.
'
ofile.close
End if
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
’ Declare the arrays and variables needed for building the polyline.
’
Dim points(), segments()
Dim NumPoints, R(2), P(2), PointsPerTurn, Turns, Units
’
’ Establish the constant Pi.
Pi = 4*Atn(1)
’ Retrieve the variable helix parameters from the user.
’ Start with the input for unit selection.
’
Units = InputBox("Select the units:"&Chr(13)& _
"(cm,mm,um,in,mil)", "Variable Helix","mil",50,50)
’
’ Check to make sure it is a valid unit.
’
Select Case Units
Case "m"
Units = ""
Case "cm"
Case "mm"
Case "um"
Case "in"
Case "mil"
Case Else
MsgBox("Invalid Units - defaults to m")
Units = ""
End Select
’
’ Obtain the other user-defined parameters.
’
Turns = InputBox("Select the number of turns (must be
integer):","Variable Helix", 2,50,50)
PointsPerTurn = InputBox("Select the points per turn:", _
"Variable Helix",16,50,50)
R(0) = InputBox("Select the initial Radius: ", _
"Variable Helix",10,50,50)
R(1) = InputBox("Select the final Radius: ", _
"Variable Helix",10,50,50)
P(0) = InputBox("Select the initial Pitch: ", _
"Variable Helix", 4,50,50)
P(1) = InputBox("Select the final Pitch: ", _
"Variable Helix", 4,50,50)
NumPoints = Turns*PointsPerTurn
’
’ Initialize the points and segments arrays.
’
Redim points(NumPoints+1)
Redim segments(NumPoints)
points(0) = "NAME:PolylinePoints"
segments(0) = "NAME:PolylineSegments"
’
’ Build the Point and Segment Arrays needed in the HFSS polyline call.
’
For n = 1 To (NumPoints+1)
Angle = (n-1)*2*Pi/PointsPerTurn
Radius = R(0) + ((n-1)/NumPoints)*(R(1)-R(0))
To recreate this tab file, paste the text below the script into a text editor and save as Posco_BH_
curve.tab.
The script itself includes comment lines, which are preceded by # and offer explanations for the sub-
sequent line(s).
Script Contents
# specify path to the file with BH coordinates
path_to_file = r"D:\Posco_BH_curve.tab"
# specify name of the material
material_name = "Posco 35PN250"
oProject = oDesktop.GetActiveProject()
oDefinitionManager = oProject.GetDefinitionManager()
""" create list with B and H points to pass to AddMaterial command
bh_coordinates list is a three dimensional array: 1D: name, 2D:
Coordinate list, 3D: BH point"""
bh_coordinates = ["NAME:BHCoordinates", ["NAME:DimUnits", "", ""]]
bh_coordinates.append(["NAME:Coordinate", [
"NAME:CoordPoint",
float(h),
float(b)
]
])
# create a new magnetic material with BH curve
oDefinitionManager.AddMaterial(
[
"NAME:" + material_name,
"CoordinateSystemType:=", "Cartesian",
"BulkOrSurfaceType:=" , 1,
[
"NAME:PhysicsTypes",
"set:=" , ["Electromagnetic"]
],
[
"NAME:permeability",
"property_type:=" , "nonlinear",
"BTypeForSingleCurve:=" , "normal",
"HUnit:=" , "A_per_meter", # unit can be specified
as variable
"BUnit:=" , "tesla", # unit can be specified as vari-
able
"IsTemperatureDependent:=", False,
bh_coordinates,
[
"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
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
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
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,
[
"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",
"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
])
The next asks for start, stop and step values for in an interpolating frequency sweep.
The following figure shows the waveguide array generated by the defaults.
After running the simulation, the plots defined by the script shows the following results.
import clr
clr.AddReferenceByPartialName("Microsoft.VisualBasic")
from Microsoft.VisualBasic.Constants import
vbOKOnly,vbOKCancel,vbAbortRetryIgnore,vbYesNoCancel,vbYesNo,vbRetry-
Cancel
from Microsoft.VisualBasic.Constants import
vbOK,vbCancel,vbAbort,vbRetry,vbIgnore,vbYes,vbNo
from Microsoft.VisualBasic.Interaction import InputBox, MsgBox
oProject = oDesktop.GetActiveProject()
oDesign = oProject.GetActiveDesign()
oEditor = oDesign.SetActiveEditor("3D Modeler")
#Ask for the start, stop, and step of the interpolating frequency
sweep
#-------------------------------------------------------------------
---
inputText = InputBox("Please enter the start, stop, and step of the
interpolating " +
# Make variables and set them equal to the values from the user
input
# ------------------------------------------------------------------
-
oDesign.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:LocalVariableTab",
[
"NAME:PropServers",
"LocalVariables"
],
[
"NAME:NewProps",
[
"NAME:a", "PropType:=", "VariableProp", "UserDef:=", True,
"Value:=", a_str
],
[
"NAME:b", "PropType:=", "VariableProp", "UserDef:=", True,
"Value:=", b_str
],
[
"NAME:NumX", "PropType:=", "VariableProp", "UserDef:=", True,
"Value:=", numX
],
[
"NAME:NumY", "PropType:=", "VariableProp", "UserDef:=", True,
"Value:=", numY
],
[
"NAME:WaveguideLength", "PropType:=", "VariableProp", "User-
Def:=", True,
"Value:=", WaveguideLength_str
],
[
"NAME:Frequency", "PropType:=", "VariableProp", "UserDef:=",
True,
"Value:=", Frequency
],
[
"NAME:Lambda", "PropType:=", "VariableProp", "UserDef:=", True,
"Value:=", "c0/" + Frequency
],
[
"NAME:RadBoundDist", "PropType:=", "VariableProp", "UserDef:=",
True,
"Value:=", "Lambda/4"
]
]
]
])
#Create the radiation box
#------------------------
oEditor.CreateBox(
[
"NAME:BoxParameters",
"XPosition:=" , "-a/2-RadBoundDist",
"YPosition:=" , "-b/2-RadBoundDist",
"ZPosition:=" , "0mm",
"XSize:=" , "NumX*a+(NumX-1)*Lambda/2+2*RadBoundDist",
"YSize:=" , "NumY*b+(NumY-1)*Lambda/2+2*RadBoundDist",
"ZSize:=" , "RadBoundDist"
],
[
"NAME:Attributes",
"Name:=" , "RadiationBox",
"Flags:=" , "",
"Color:=" , "(132 132 193)",
"Transparency:=" , 0.8,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"vacuum\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , True,
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])
"NAME:Mode1",
"ModeNum:=" , 1,
"UseIntLine:=" , True,
[
"NAME:IntLine",
"Start:=" , ["0mm", "-" +str(b_over2) + "mm", "-" + Wave-
guideLength_str],
"End:=" , ["0mm", str(b_over2) + "mm", "-" + WaveguideLength_
str]
],
"AlignmentGroup:=" , 0,
"CharImp:=" , "Zpi"
]
],
"ShowReporterFilter:=" , False,
"ReporterFilter:=" , [True],
"UseAnalyticAlignment:=", False
])
[
"NAME:Radiation",
"Faces:=" , faceIDs,
"IsFssReference:=" , False,
"IsForPML:=" , False
])
ElementNum += 1
"UseMaxTetIncrease:=" , False,
"PortAccuracy:=" , 2,
"UseABCOnPort:=" , False,
"SetPortMinMaxTri:=" , False,
"UseDomains:=" , False,
"UseIterativeSolver:=" , False,
"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,
"IESolverType:=" , "Auto",
"LambdaTargetForIESolver:=", 0.15,
"UseDefaultLambdaTgtForIESolver:=", True
])
oModule.InsertFrequencySweep("Setup1",
[
"NAME:InterpolatingSweep",
"IsEnabled:=" , True,
"RangeType:=" , "LinearStep",
"RangeStart:=" , StartFrequency,
"RangeEnd:=" , StopFrequency,
"RangeStep:=" , StepFrequency,
"Type:=" , "Interpolating",
"SaveFields:=" , False,
"InterpTolerance:=" , 0.5,
"InterpMaxSolns:=" , 50,
"InterpMinSolns:=" , 0,
"InterpMinSubranges:=" , 1,
"ExtrapToDC:=" , False,
"InterpUseS:=" , True,
"InterpUsePortImped:=" , False,
"InterpUsePropConst:=" , True,
"UseDerivativeConvergence:=", False,
"InterpDerivTolerance:=", 0.2,
"UseFullBasis:=" , True,
"EnforcePassivity:=" , True,
"PassivityErrorTolerance:=", 0.0001
])
#Create an infinite sphere with fine theta resolution and phi cuts
at 0 and 90 degrees
#-------------------------------------------------------------------
------------------
oModule = oDesign.GetModule("RadField")
oModule.InsertFarFieldSphereSetup(
[
"NAME:Infinite Sphere1",
"UseCustomRadiationSurface:=", False,
"ThetaStart:=" , "-90deg",
"ThetaStop:=" , "90deg",
"ThetaStep:=" , "1deg",
"PhiStart:=" , "0deg",
"PhiStop:=" , "90deg",
"PhiStep:=" , "90deg",
"UseLocalCS:=" , True,
"CoordSystem:=" , "RelativeCS1"
])
"Theta:=" , ["All"],
"Phi:=" , ["0deg"],
"Freq:=" , ["All"],
"a:=" , ["Nominal"],
"b:=" , ["Nominal"],
"NumX:=" , ["Nominal"],
"NumY:=" , ["Nominal"],
"WaveguideLength:=" , ["Nominal"],
"Frequency:=" , ["Nominal"]
],
[
"X Component:=" , "Theta",
"Y Component:=" , ["im(rEPhi)","re(rEPhi)","im(rETheta)","re
(rETheta)"]
], [])
#For phi = 90
#------------
oModule.CreateReport("Etheta/Ephi Re/Im Components for Phi=90", "Far
Fields",
"Rectangular Plot", "Setup1 : LastAdaptive",
[
"Context:=" , "Infinite Sphere1"
],
[
"Theta:=" , ["All"],
"Phi:=" , ["90deg"],
"Freq:=" , ["All"],
"a:=" , ["Nominal"],
"b:=" , ["Nominal"],
"NumX:=" , ["Nominal"],
"NumY:=" , ["Nominal"],
"WaveguideLength:=" , ["Nominal"],
"Frequency:=" , ["Nominal"]
],
[
"X Component:=" , "Theta",
"Y Component:=" , ["im(rEPhi)","re(rEPhi)","im(rETheta)","re
(rETheta)"]
], [])
Index
CreateRelativeCS 11-59
.
CreateSpiral 11-20
.vbs file format 2-7
CreateUserDefinedModel 11-21
3 CreateUserDefinedPart 11-14, 11-
23
3D Modeler editor commands 11-2
Delete 11-103
AssignMaterial 11-48
DeleteEmptyGroups 11-60
Chamfer 11-48
DeleteLastOperation 11-61
Connect 11-50
DeletePolylinePoint 11-37
Copy 11-37
DetachFaces 11-61
CoverLines 11-50
DuplicateAlongLine 11-38
CoverSurfaces 11-50
DuplicateAroundAxi 11-39
Create3DComponent 11-4
DuplicateMirror 11-41
CreateBondwire 11-6
EditEntityList 11-62
CreateCutplane 11-7
EditFaceCS 11-63
CreateEntityList 11-50
EditObjectCS 11-63
CreateEquationCurve 11-7
EditPolyline 11-26
CreateEquationSurface 11-10
EditRelativeCS 11-66
CreateFaceCS 11-51, 11-54
Export 11-67
CreateGroup 11-52
ExportModelImagetoFile 11-67
CreateHelix 11-13
Fillet 11-69
CreateObjectFromdges 11-57
FlattenGroup 11-71
CreateObjectFromFaces 11-58
GenerateHistory 11-71
CreatePoint 11-14
GetActiveCoordinateSystem 11-75
CreateRegion 11-15
GetBodyNamesByPosition 11-103
CreateRegularPolyhedron 11-19
Index-1
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Index-2
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Index-3
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Index-4
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
EditTerminal 14-62
C
EditVoltage 14-63
CalcOp 19-3
EditWavePort 14-63
CalcRead (deprecated) 19-3
GetBoundaries 14-10
CalcStack 19-4
GetBoundariesofType 14-10
CalculatorRead 19-3
GetBoundaryAssignment 14-10
CalculatorWrite 19-5
GetDefaultBaseName 14-11
Chamfer 11-48
GetExcitations 14-11
ChangeGeomSettings 19-5
GetExcitationsOfType 14-11
ChangeImpedanceMult 14-5
GetNumBoundaries 14-12
ChangeLayers 24-5
GetNumBoundariesofType 14-12
ChangeOptions 24-8
GetNumExcitations 14-12
CircuitPortToLumpedPort 14-51
GetNumExcitationsOfType 14-13
ClcEval 19-6
GetPortExcitationsCounts 14-13
ClcMaterial 19-6
LumpedPortToCircuitPort 14-63
ClearAllMarkers 13-15
ReassignBoundaries 14-2, 14-6,
14-13, 14-15 ClearAllNamedExpr 19-7
Index-5
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Index-6
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
D DeleteProject 5-8
Index-7
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Index-8
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Index-9
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Index-10
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Index-11
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Index-12
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Index-13
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Index-14
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Index-15
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Index-16
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Index-17
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Index-18
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Index-19
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Index-20
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Index-21
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Index-22
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
Index-23
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
Icepak Scripting Guide
DeleteUserDefinedSolution 20-3
T
EditUserDefinedSolution 20-4
ThickenSheet 11-96
Using a Do Loop 1-8
TileWindows 5-62
ToggleViaPin 24-28 V
ValidateDesign 10-34
U
Variable Naming Conventions 1-4
UnassignIERegions 14-67
variables
UncoverFaces 11-97
array 1-4
Undo
assigning information 1-3
design-level command 10-34
declaring 1-3
project-level command 6-23
hierarchy in HFSS 2-2
Ungroup 11-99
used in HFSS scripts 2-2
UnGroupPlotCurvesInGroup 13-81
VBScript 2-2
Unite 11-99, 24-29
.vbs file format 2-7
UpdateAllFieldsPlots 18-24
Microsoft user’s guide 1-11
UpdateAllReports 13-80
operators 1-5
UpdateComponentDefinition 11-36
overview 1-2
UpdateDefinitions, project-level com-
mand 6-24 references 1-11
UpdateQuantityFieldsPlots 18-24
W
UpdateReports 13-80
WrapSheet 11-100
UpdateTraces 13-71
UpdateTracesContextandSweeps Z
13-78
ZoomToFit 24-29
User Defined Solutions
Commands 20-1
UserDefinedSolutions module com-
mands
CreateUserDefinedSolution 20-1
Index-24
ANSYS Electromagnetics Suite 2019 R3 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.