HFSSScripting Guide
HFSSScripting Guide
Release 2020 R2
ANSYS, Inc. July 2020
Southpointe
2600 ANSYS Drive ANSYS, Inc. and
Canonsburg, PA 15317 ANSYS Europe,
[email protected] Ltd. are UL
https://www.ansys.com registered ISO
9001:2015 com-
(T) 724-746-3304 panies.
(F) 724-514-9494
HFSS Scripting Guide
2
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Table of Contents
Table of Contents Contents-1
1 - Introduction to Scripting 1-1
Introduction to VBScript 1-1
Simple and Composite Names 1-2
VBScript Variables 1-2
Declaring Variables 1-2
Declaring Variables in Python 1-3
Variable Naming Conventions 1-3
Scope and Lifetime of Variables 1-3
Array Variables 1-3
VBScript Operators 1-4
Operator Precedence 1-5
Arithmetic Operators 1-5
String Concatenation Operator 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
Contents-1
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Contents-2
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Contents-3
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Methods 1-47
Output Parameters 1-48
Comparison with C function: 1-48
'List Size' Parameters 1-49
Comparison with C function: 1-50
Added Parameters 1-50
Developing a UDM/UDP 1-51
Creation 1-51
Location 1-51
Organize 1-52
Edit/Reload 1-52
UDPExtension 1-52
Import 1-52
Main class: UDPExtension 1-52
IUDPExtension methods 1-53
Mandatory methods. 1-53
GetLengthParameterUnits() 1-53
GetPrimitiveTypeInfo() 1-53
GetPrimitiveParametersDefinition2() 1-53
AreParameterValuesValid2(errorMsg, udpParams) 1-53
CreatePrimitive2(funcLib, udpParams) 1-53
Optional methods 1-53
GetPrimitiveParameters() 1-53
GetRegisteredFaceNames() 1-54
GetRegisteredEdgeNames() 1-54
GetRegisteredVertexNames() 1-54
MapParametersDefinitionVersions2(oldVersion, oldUDPParams) 1-54
GetOldPrimitiveParametersDefinition2(version ) 1-54
Example UDP 1-54
UDPFunctionLibrary 1-55
Contents-4
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Contents-5
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Contents-6
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
GetActiveProject 3-12
GetAutoSaveEnabled 3-13
GetBuildDateTimeString 3-14
GetDefaultUnit 3-15
GetDesigns 3-16
GetDistributedAnalysisMachines 3-17
GetDistributedAnalysisMachinesForDesignType 3-18
GetExeDir 3-19
GetGDIObjectCount 3-20
GetLibraryDirectory 3-20
GetLocalizationHelper 3-21
GetMessages 3-22
GetName [Desktop] 3-25
GetPersonalLibDirectory 3-26
GetProcessID 3-27
GetProjects 3-28
GetProjectDirectory 3-29
GetProjectList 3-30
GetScriptingToolsHelper 3-32
GetSysLibDirectory 3-32
GetTempDirectory 3-33
GetUserLibDirectory 3-34
GetVersion 3-36
ImportANF 3-37
ImportAutoCAD 3-38
ImportGDSII 3-38
ImportODB 3-40
LaunchJobMonitor 3-40
NewProject 3-41
OpenAndConvertProject 3-42
Contents-7
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
OpenMultipleProjects 3-43
OpenProject 3-43
OpenProjectWithConversion 3-44
Paste (Project Object) 3-44
Paste (Project Object) 3-46
PauseRecording 3-47
PauseScript 3-48
Print 3-49
QuitApplication 3-50
RefreshJobMonitor 3-51
RestoreProjectArchive 3-53
RestoreWindow 3-54
ResumeRecording 3-55
RunACTWizardScript 3-55
RunProgram 3-56
RunScript 3-56
RunScriptWithArguments 3-58
SelectScheduler 3-59
SetActiveProject 3-60
SetActiveProjectByPath 3-61
SetLibraryDirectory 3-62
SetProjectDirectory 3-63
SetTempDirectory 3-64
ShowDockingWindow 3-65
Sleep 3-65
SubmitJob 3-66
TileWindows 3-67
Desktop Commands For Registry Values 3-68
DoesRegistryValueExist 3-68
GetRegistryInt 3-69
Contents-8
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
GetRegistryString 3-69
SetRegistryFromFile 3-69
SetRegistryInt 3-70
SetRegistryString 3-70
4 - Running Instances Manager Script Commands 4-1
GetAllRunningInstances 4-1
GetRunningInstanceByProcessID 4-1
GetRunningInstanceByProject 4-2
5 - Project Object Script Commands 5-1
AnalyzeAll [project] 5-2
ClearMessages 5-2
Close 5-3
CopyDesign 5-3
CutDesign 5-4
DeleteDesign 5-4
DeleteToolObject 5-5
GetActiveDesign 5-5
GetChildNames [Project] 5-6
GetChildObject [Project] 5-7
GetChildTypes [Project] 5-8
GetConfigurableData (Project) 5-8
GetDefinitionManager 5-8
GetDependentFiles 5-9
GetDesign 5-10
GetEDBHandle 5-10
GetLegacyName 5-11
GetName [Project] 5-11
GetPath 5-11
GetTopDesignList 5-12
GetPropNames [Project] 5-13
Contents-9
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Contents-10
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Contents-11
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
ExportConvergence 8-17
ExportMatrixData 8-18
ExportNetworkData 8-21
ExportNMFData 8-25
ExportMeshStats 8-29
ExportProfile 8-30
Generate Mesh 8-30
GetChildNames [Design] 8-31
GetChildObject [Design] 8-31
GetChildTypes [Design] 8-32
GetConfigurableData 8-33
GetData 8-33
GetDesignType 8-33
GetDesignValidationInfo 8-34
GetEditSourcesCount 8-35
GetExcitationsModule 8-36
GetManagedFilesPath 8-37
GetModule 8-38
GetName 8-40
GetNominalVariation 8-40
GetNoteText 8-41
GetPostProcessingVariables 8-41
GetPropNames [Design] 8-42
GetPropValue [Design] 8-42
GetSelections 8-43
GetSolutionType 8-44
GetSolveInsideThreshold 8-45
GetSourceContexts 8-45
GetVariationVariableValue 8-46
GeometryCheckAndAutofix 8-46
Contents-12
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Contents-13
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
CreateBox 10-5
CreateCircle 10-7
CreateCone 10-9
CreateCutplane 10-10
CreateCylinder 10-11
CreateEllipse 10-12
CreateEquationCurve 10-14
CreateEquationSurface 10-16
CreateHelix 10-20
CreatePoint 10-20
CreateUserDefinedPart 10-22
CreatePolyline 10-23
CreateRectangle 10-27
CreateRegion 10-29
CreateRegularPolyhedron 10-33
CreateRegularPolygon 10-33
CreateSphere 10-35
CreateSpiral 10-36
CreateTorus 10-37
CreateUserDefinedModel 10-39
CreateUserDefinedPart 10-41
Edit3DComponent 10-43
EditNativeComponentDefinition 10-44
EditPolyline 10-47
Get3DComponentParameters 10-47
Get3DComponentDefinitionNames 10-48
Get3DComponentInstanceNames 10-48
Get3DComponentMaterialNames 10-49
Get3DComponentMaterialProperties 10-49
Insert3DComponent 10-50
Contents-14
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
InsertNativeComponent 10-51
InsertPolylineSegment 10-53
SweepAlongPath 10-54
SweepAlongVector 10-56
SweepAroundAxis 10-57
SweepFacesAlongNormal 10-59
SweepFacesAlongNormalWithAttributes 10-60
UpdateComponentDefinition 10-62
Edit Menu Commands 10-62
Copy 10-63
DeletePolylinePoint 10-63
DuplicateAlongLine 10-63
DuplicateAroundAxis 10-65
DuplicateMirror 10-67
Mirror 10-69
Move 10-70
OffsetFaces 10-70
Paste (Model Editor) 10-71
Rotate 10-71
Scale 10-72
Modeler Menu Commands 10-72
AssignMaterial 10-74
Chamfer 10-75
Connect 10-76
CoverLines 10-76
CoverSurfaces 10-76
CreateEntityList 10-76
CreateFaceCS 10-80
CreateGroup 10-82
CreateObjectCS 10-83
Contents-15
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
CreateObjectFromEdges 10-86
CreateObjectFromFaces 10-88
CreateRelativeCS 10-89
DeleteEmptyGroups 10-90
DeleteLastOperation 10-91
DetachFaces 10-91
EditEntityList 10-92
EditFaceCS 10-93
EditObjectCS 10-93
EditRelativeCS 10-96
Export 10-97
ExportModelImageToFile 10-97
Fillet 10-100
FlattenGroup 10-101
GenerateHistory 10-102
HealObject 10-102
GetActiveCoordinateSystem 10-105
GetCoordinateSystems 10-106
Import 10-106
ImportDXF 10-109
ImportGDSII [Modeler Import] 10-111
Intersect 10-113
MoveCStoEnd 10-113
MoveEntityToGroup 10-114
MoveFaces 10-115
ProjectSheet 10-117
PurgeHistory 10-118
ReplaceWith3DComponent 10-119
Section 10-121
SeparateBody 10-122
Contents-16
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
SetModelUnits 10-122
SetWCS 10-123
ShowWindow 10-123
Split 10-124
Subtract 10-124
SweepFacesAlongNormal 10-125
ThickenSheet 10-127
UncoverFaces 10-128
Unite 10-129
Ungroup 10-130
WrapSheet 10-131
Other oEditor Commands 10-132
AddViewOrientation 10-133
BreakUDMConnection 10-136
ChangeProperty 10-137
Delete 10-139
FitAll 10-139
GetBodyNamesByPosition 10-140
GetChildNames [Modeler] 10-141
GetChildObject [Modeler] 10-142
GetChildTypes [Modeler] 10-144
GetEdgeByPosition 10-144
GetEdgeIDsFromFace 10-145
GetEdgeIDsFromObject 10-146
GetEntityListIDByName 10-146
GetFaceArea 10-147
GetFaceCenter 10-148
GetFaceByPosition 10-148
GetFaceIDs 10-149
GetGeometryModelerMode 10-150
Contents-17
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
GetMatchedObjectName 10-150
GetModelBoundingBox 10-151
GetModelUnits 10-151
GetPropNames [Modeler] 10-152
GetPropValue [Modeler] 10-152
GetNumObjects 10-153
GetObjectIDByName 10-154
GetObjectName 10-154
GetObjectNameByFaceID 10-155
GetObjectsByMaterial 10-155
GetObjectsInGroup 10-156
GetPropertyValue 10-156
GetSelections [Model Editor] 10-159
GetUserPosition 10-159
GetVertexIDsFromEdge 10-160
GetVertexIDsFromFace 10-161
GetVertexIDsFromObject 10-161
GetVertexPosition 10-161
OpenExternalEditor 10-162
PageSetup 10-162
RenamePart 10-163
SetPropValue [Modeler] 10-164
11 - Output Variable Script Commands 11-1
CreateOutputVariable 11-1
DeleteOutputVariable 11-4
DoesOutputVariableExist 11-5
EditOutputVariable 11-6
GetOutputVariableValue 11-8
SimValueContext 11-16
12 - Reporter Editor Script Commands 12-1
Contents-18
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
AddCartesianLimitLine 12-4
AddCartesianXMarker 12-5
AddCartesianYMarker 12-5
AddDeltaMarker 12-6
AddMarker 12-7
AddNote 12-7
AddTraceCharacteristics 12-9
AddTraces 12-11
ChangeProperty [ReportSetup] 12-15
ClearAllMarkers 12-16
ClearAllTraceCharacteristics 12-18
CopyTracesData 12-19
CopyReportData 12-19
CopyReportDefinitions 12-20
CopyTraceDefinitions 12-21
CreateReport 12-21
CreateReport [Designer] 12-26
CreateReportFromFile 12-31
CreateReportFromTemplate 12-31
CreateReportOfAllQuantities 12-33
DeleteMarker 12-34
DeleteAllReports 12-35
DeleteReports 12-35
DeleteTraces 12-36
ExportImageToFile [Reporter] 12-37
ExportPlotImageToFile [Reporter] 12-38
ExportReport 12-39
ExportToFile 12-40
ExportToFile [Reporter] 12-41
ExportMarkerTable 12-42
Contents-19
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
FFTOnReport 12-42
GetAllCategories 12-44
GetAllReportNames 12-45
GetAllQuantities 12-47
GetAvailableDisplayTypes 12-48
GetAvailableReportTypes 12-48
GetAvailableSolutions 12-49
GetChildNames [Report Setup] 12-49
GetChildObject [Report Setup] 12-50
GetChildTypes [ReportSetup] 12-51
GetDataExpressions 12-51
GetDataUnits 12-52
GetDesignVariableNames 12-52
GetDesignVariableUnits 12-53
GetDesignVariableValue 12-53
GetDesignVariationKey 12-54
GetDisplayType 12-54
GetImagDataValues 12-55
GetPerQuantityPrimarySweepValues 12-56
GetPropertyValue 12-57
GetPropNames [Reporter] 12-59
GetPropValue [Report Setup] 12-59
GetRealDataValues 12-60
GetReportTraceNames 12-61
GetSolutionContexts 12-62
GetSolutionDataPerVariation 12-62
GetSweepNames 12-64
GetSweepUnits 12-65
GetSweepValues 12-66
GroupPlotCurvesByGroupingStrategy 12-66
Contents-20
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
ImportIntoReport 12-67
IsDataComplex 12-68
IsPerQuantityPrimarySweep 12-68
MovePlotCurvesToGroup 12-69
MovePlotCurvesToNewGroup 12-70
PasteReports 12-70
PasteTraces 12-71
Release Data 12-71
RenameReport 12-72
RenameTrace 12-72
ResetPlotSettings 12-73
SavePlotSettingsAsDefault 12-74
SetPropValue [Report Setup] 12-75
UpdateTraces 12-75
UpdateTracesContextandSweeps 12-82
UpdateAllReports 12-84
UpdateReports 12-84
UnGroupPlotCurvesInGroup 12-85
13 - Boundary and Excitation Module Script Commands 13-1
General Commands Recognized by the Boundary/Excitations Module 13-2
AddAssignmentToBoundary 13-3
AutoIdentifyNets 13-4
AutoIdentifyPorts 13-4
AutoIdentifyTerminals 13-5
ChangeImpedanceMult 13-5
ConvertNportCircuitElementsToPorts 13-6
CreateNportCircuitElements 13-6
DeleteAllBoundaries 13-8
DeleteAllExcitations 13-8
DeleteBoundaries 13-8
Contents-21
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
GetBoundaryAssignment 13-9
GetBoundaries 13-9
GetBoundariesOfType 13-9
GetDefaultBaseName 13-10
GetExcitations 13-10
GetExcitationsOfType 13-10
GetNumBoundaries GetNumBoundaries 13-11
GetNumBoundariesOfType 13-11
GetNumExcitations 13-11
GetNumExcitationsOfType 13-12
GetPortExcitationCounts 13-12
ReassignBoundary 13-12
RemoveAssignmentFromBoundary 13-14
RenameBoundary 13-14
ReprioritizeBoundaries 13-15
SetDefaultBaseName 13-15
Script Commands for Creating and Modifying Boundaries 13-16
AssignCircuitPort 13-17
AssignCurrent 13-19
AssignDielectricCavity 13-19
AssignFEBI 13-20
AssignFiniteCond 13-21
AssignFloquet 13-23
AssignHalfSpace 13-26
Assign Hybrid Region 13-27
AssignIERegion 13-28
AssignImpedance 13-28
AssignIncidentWave 13-29
AssignLayeredImp 13-30
AssignLinkedRegion 13-32
Contents-22
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
AssignLumpedPort 13-33
AssignLumpedRLC 13-35
AssignMagneticBias 13-37
AssignMaster 13-38
AssignPerfectE 13-39
AssignPerfectH 13-39
AssignRadiation 13-40
AssignScreeningImpedance 13-41
AssignSlave 13-44
AssignSymmetry 13-45
AssignTerminal 13-46
AssignVoltage 13-47
AssignWavePort 13-48
CircuitPortToLumpedPort 13-50
EditCircuitPort [HFSS] 13-51
EditCurrent 13-52
EditDiffPairs 13-52
EditFiniteCond 13-53
EditHalfSpace 13-54
EditHybridRegion 13-55
EditImpedance 13-55
EditIncidentWave 13-55
EditLayeredImpedance 13-57
EditMaster 13-57
EditPerfectE 13-57
EditPerfectH 13-57
EditLumpedPort 13-57
EditLumpedRLC 13-58
EditMagneticBias 13-59
EditRadiation 13-59
Contents-23
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
EditSlave 13-60
EditSymmetry 13-60
EditTerminal 13-60
EditVoltage 13-61
EditVoltageDrop 13-61
EditWavePort 13-61
LumpedPortToCircuitPort 13-62
SetHybridRegionCoupledGroup 13-62
SetTerminalReferenceImpedances 13-64
SetSBRSources 13-64
VBS Example Modal and Terminal Solution Type: 13-65
SetSBRWedgeSettings 13-66
VBS Example 13-67
SwapCircuitPortAssignment 13-68
UnassignIERegions 13-68
Script Commands for Creating and Modifying Boundaries in HFSS-IE 13-69
AssignAperture [HFSS-IE] 13-69
AssignFiniteCond [HFSS-IE] 13-70
AssignHalfSpace [HFSS-IE] 13-71
AssignImpedance [HFSS-IE] 13-72
AssignInfiniteGroundPlane [HFSS-IE] 13-72
AssignLumpedPort [HFSS-IE] 13-73
Script Commands for Creating and Modifying PMLs 13-73
CreatePML 13-74
ModifyPMLGroup 13-75
PMLGroupCreated 13-76
PMLGroupModified 13-76
RecalculatePMLMaterials 13-77
14 - Mesh Operations Module Script Commands 14-1
General Commands Recognized by the Mesh Operations Module 14-1
Contents-24
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
DeleteOp 14-2
GetOperationNames 14-2
RenameOp 14-2
Script Commands for Creating and Modifying Mesh Operations 14-3
AssignApplyCurvilinearElementsOp 14-3
AssignLengthOp 14-4
AssignModelResolutionOp 14-5
AssignCurvatureExtractionOp (Beta) 14-6
AssignSkinDepthLayerSetting 14-7
AssignSkinDepthOp 14-7
AssignTrueSurfOp 14-8
EditApplyCurvilinearElementsOp 14-9
EditLengthOp 14-10
EditModelResolutionOp 14-10
EditSBRCurvatureExtractionOp (Beta) 14-11
EditSkinDepthOp 14-12
EditTrueSurfOp 14-12
InitialMeshSettings 14-13
15 - Analysis Setup Module Script Commands 15-1
ClearLinkedData (Module) 15-2
CopySetup 15-2
CopySweep 15-3
DeleteDrivenSweep 15-3
DeleteSetups 15-4
DeleteSweep [HFSS-IE] 15-4
EditCircuitSettings 15-4
EditFrequencySweep 15-5
EditSetup 15-6
EditSweep [HFSS-IE] 15-8
ExportCircuit 15-9
Contents-25
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
GetSetupCount 15-12
GetSetups 15-13
GetSetupNames 15-13
GetSweepCount 15-13
GetSweeps 15-14
InsertFrequencySweep 15-14
InsertSetup 15-22
InsertSetup [HFSS-IE] 15-39
InsertSetup [Transient] 15-40
InsertSweep [HFSS-IE] 15-46
PasteSetup 15-50
PasteSweep 15-50
RenameDrivenSweep 15-50
RenameSetup 15-50
RenameSweep [HFSS-IE] 15-51
RevertAllToInitial 15-52
RevertSetupToInitial 15-52
SetMPIVendor 15-53
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-6
ExportDXConfigFile 16-6
ExportOptimetricsProfile 16-7
ExportOptimetricsResult 16-8
ExportParametricResults 16-8
GetChildNames [Optimetrics] 16-9
GetChildObject [Optimetrics] 16-10
GetChildTypes [Optimetrics] 16-10
Contents-26
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Contents-27
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
ExportForHSpice 17-7
ExportNetworkData 17-9
ExportNMFData [HFSS] 17-13
GetAdaptiveFreq 17-14
GetAvailableVariations 17-14
GetExcitationScaling 17-15
GetISolutionVersionID 17-15
GetSolveRangeInfo 17-16
GetValidISolutionList 17-16
HasFields 17-17
HasMatrixData 17-17
HasMesh 17-18
ImportSolution 17-18
ImportTable 17-19
IsFieldAvailableAt 17-21
ListMatchingVariations 17-21
ListValuesOfVariable 17-22
ListVariations 17-22
18 - Field Overlays Module Script Commands 18-1
AddAntennaOverlay 18-1
AddMarkerToPlot 18-3
CreateFieldPlot 18-3
DeleteFieldPlot 18-17
EditAntennaOverlay 18-17
GetFieldPlotNames 18-19
HideAntennaParametersOverlay 18-20
ModifyFieldPlot 18-21
RenameFieldPlot 18-22
RenamePlotFolder 18-23
SetFieldPlotSettings 18-23
Contents-28
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
SetPlotFolderSettings 18-24
ShowAntennaParameterOverlay 18-28
UpdateAllFieldsPlots 18-29
UpdateQuantityFieldsPlots 18-29
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
EnterVector 19-11
EnterVectorFunc 19-12
EnterVol 19-12
ExportOnGrid 19-12
Contents-29
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Contents-30
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Script Commands for Exporting Antenna Parameters and Max Field Parameters 20-24
ExportRadiationParametersToFile 20-24
21 - User Defined Solutions Commands 21-1
CreateUserDefinedSolution 21-1
DeleteUserDefinedSolutions 21-3
EditUserDefinedSolution 21-4
22 - Network Data Explorer Script Commands 22-1
Network Data Explorer Manager Script Commands 22-1
ExportFullWaveSpice [Network Data Explorer] 22-1
ExportNetworkData [Network Data Explorer] 22-2
ExportNMFData [Network Data Explorer] 22-3
23 - Definition Manager Script Commands 23-1
AddMaterial 23-1
CloneMaterial 23-3
DoesMaterialExist 23-4
EditMaterial 23-5
ExportMaterial 23-7
RemoveMaterial 23-7
RemoveUnusedDefinitions 23-8
Component Manager Script Commands 23-9
Add [component manager] 23-10
AddDynamicNPortData [component manager] 23-23
AddNPortData [component manager] 23-25
AddSolverOnDemandModel 23-29
ClearSolutionCache [component manager] 23-29
Edit [component manager] 23-29
EditSolverOnDemandModel 23-48
EditWithComps [component manager] 23-48
Export [component manager] 23-56
GetData [component manager] 23-57
Contents-31
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Contents-32
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Contents-33
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
EditScript 23-160
ExportScript 23-161
RemoveScript 23-161
ModifyLibraries 23-162
24 - Example Scripts 24-1
VBScript Example Scripts 24-1
Data Export Script 24-1
Variable Helix Script 24-4
IronPython Example Scripts 24-8
BH Coordinates Python Script 24-8
Script Contents 24-9
Posco_BH_Curve.tab Contents 24-11
Equation Based Curve Python Script 24-13
HFSS Waveguide Array Python Script 24-16
Index Index-1
Contents-34
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
1 - Introduction to Scripting
Using scripts is a fast, effective way to accomplish tasks you want to repeat. When you execute a
script, the commands in the script are performed in the order in which they appear.
ANSYS Electronics Desktop can record scripts in VBScript or IronPython, and can run external
scripts written in VBScript, IronPython, or JavaScript. Additionally, it contains an IronPython com-
mand shell for executing scripts.
When running ANSYS Electronics Desktop from the command line, scripts can be written in any
language that provides Microsoft COM methods.
The following topics contain more information about the VBScript and IronPython scripting lan-
guages, as well general advice for scripting using Electronics Desktop:
Introduction to VBScript
Introduction to IronPython
ANSYS Electronics Desktop Scripting
Introduction to VBScript
ANSYS Electronics Desktop can use Microsoft® Visual Basic® Scripting (VBScript) to record mac-
ros. VBScript is based on the Microsoft Visual Basic programming language.
This chapter provides an overview of key VBScript components.
Simple and Composite Names
VBScript Variables
VBScript Operators
Controlling Program Execution
Looping Through Code
VBScript Procedures
Converting Between Data Types
Including Scripts
Aborting Scripts
Interacting with a Script
Recommended VBScript References
Sample HFSS Script
Sample Circuit Script
Sample Q3D Script
For more details about VBScript, please see the Recommended VBScript References section at
the end of this chapter.
Simple and Composite Names
Components, symbols, footprints, models, and padstacks possess either "simple" names or "com-
posite" names. Composite names are used to distinguish items from libraries that may possess the
same simple name. A composite name is created by combining an item’s library name with its
simple name. Composite names for definitions are unique, but simple names are not.
l Composite names are used by definition manager script commands to uniquely identify
script definitions.
l Materials and scripts do not have composite names, so project definitions for these items
must possess a unique simple name.
l The format of a composite name is LibraryName:SimpleDefinitionName. For example, the
composite name for the component "CAP_ in" the system library Nexxim Circuit Ele-
ments\Capacitors is "Nexxim Circuit Elements\Capacitors:CAP_in."
l The format of a composite name in a project is OriginLibraryName:SimpleDefinitionName.
For example, the composite name for the project component "CAP_" that was originally
from the system library Nexxim Circuit Elements\Capacitors is "Nexxim Circuit Ele-
ments\Capacitors:CAP_".
l Not all definitions in a project have a library of origin. Newly added definitions do not have a
library of origin, and project definitions whose names are changed do not have a library of ori-
gin (even if they did before the name change). As a result, the composite name for items
without a library of origin is the item’s simple name itself. For example, the composite name
for the project component "CAP_" that came from a system library and was renamed to
"MyCAP_" is "MyCAP_".
To construct a composite name, select Tools > Edit Configured Libraries > Components to
open the Edit Libraries dialog box. The subnames used to construct a composite name can be
found in the Name and Origin columns that correspond to a particular component. The Origin
column contains the library portion of the composite name, while the Name column contains the
simple portion of the composite name.
VBScript Variables
A VBScript variable is a placeholder representing information that may change during the time your
script is running. Variables are useful because they let you assign a short and easy to remember
name to each piece of data you plan to use. Use a variable name in a script to view or modify its
value.
Declaring Variables
To declare variables explicitly in a script, use the Dim, Public, or Private statements. For example:
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.
Declaring Variables in Python
Python does not require you to declare variables before you assign a value to them.
You can directly assign information to it. For example:
box_xsize = "3mm"
Variable Naming Conventions
You should use names that are short but intuitive and easy to remember. Use the following con-
ventions for naming variables in VBScript:
All arrays in VBScript are zero-based, so the array above actually contains 3 elements. You assign
data to each of the array’s elements using an index into the array. Data can be assigned to the ele-
ments of an array as follows:
Primitives(0) = "Box1"
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 an expression contains operators from more than one category, they are evaluated in the fol-
lowing order:
1. Arithmetic Operators
2. String Concatenation Operator (&)
3. Comparison Operators
4. Logical Operators
Arithmetic operators within a single expression are evaluated in the following order of pre-
cedence:
1. Exponentiation (^)
2. Multiplication and Division (*,/): These two operators are of equal precedence and are eval-
uated in the left-to-right order in which they appear within the expression.
3. Integer Division (\)
4. Modulus Arithmetic (Mod)
5. Addition and Subtraction (+,-): These two operators are of equal precedence and are eval-
uated in the order in which they appear within the expression.
If the same arithmetic operator appears multiple times within a single expression, they are eval-
uated in the left-to-right order in which they appear.
Comparison operators all have equal precedence and are evaluated in the left-to-right order in
which they appear within the expression.
Logical operators all have equal precedence and are evaluated in the left-to-right order in which
they appear within the expression.
Arithmetic Operators
Following is a list of VBScript’s arithmetic operators:
Symbol Description
^ Exponentiation
- Unary negation
* Multiplication
/ Division
\ Integer division
Mod Modulus arithmetic
+ Addition
- Subtraction
Note:
For the order of precedence for these operators, see Operator Precedence.
Symbol Description
= Equality
<> Inequality
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
Is Object equivalence
Note:
All comparison operators have the same precedence. When multiple comparisons exist
in a single expression, evaluate them in the left-to-right order in which they appear.
Logical Operators
Following is a list of VBScript’s logical operators:
Symbol Description
Not Logical negation
And Logical conjunction
Or Logical disjunction
Xor Logical exclusion
Eqv Logical equivalence
Imp Logical implication
Note:
All logical operators have the same precedence. When multiple logical operators exist in
a single expression, evaluate them in the left-to-right order in which they appear.
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
Looping Through Code
Looping allows you to run a group of statements repeatedly. There are two types of loops:
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
Converting Between Data Types
To convert data from one subtype to another, use the following VBScript functions:
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")
Recommended VBScript References
Microsoft Corporation. VBScript User’s Guide.
Available http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/htm-
l/vbstutor.asp.
Childs, M., Lomax, P., and Petrusha, R. VBScript in a Nutshell: A Desktop Quick Reference.
May 2002. O’Reilly & Associates. ISBN: 1-56592-720-6.
Sample HFSS Script
Following is an example of an ANSYS Electronics Desktop script. It includes comment lines, which
are preceded by either an apostrophe ( ’) or the word REM, that offer explanations for each pre-
ceding line or lines. VBScript keywords appear in bold font.
’ ----------------------------------------------
’ Script Recorded by Ansoft HFSS Version 10.0
’ 11:03 AM May 3, 2005
’ ----------------------------------------------
Dim oDesign
Dim oEditor
Dim oModule
REM Dim is used to declare variables. Dim means dimension. In VBScript you can use Dim,
REMPublic, or Private to declare variables. As VBScript has no built-in data types (like
REMinteger, string, etc.), all variables are treated as variants, which can store any type of
REMinformation. In this example, the three variables will be used as objects. When
REMrecording scripts in HFSS, variants that will be used as objects always begin with o.
oDesktop.NewProject
’ In VBScript, a Sub procedure is a procedure that is called by name, can receive arguments,
’ and can perform a specific task with a group of statements. Here the Sub procedure
’ NewProject of the object oDesktop is called. This Sub does not take an input.
’ character ( _ ) here indicates that the statement continues to the next line. The
’ underscore character must be placed outside of string constants, or else VBScript will
’ recognize the character as part of the string constant rather than an indication that the
’ string continues on the next line. Following is an example of proper use of the underscore
’ character:
’ Msgbox("Please include units when creating variables " & _
’ "that require dimensions."
’ Following is an example of improper use of the underscore character:
’ Msgbox("Please include units when creating variables _
’ that require dimensions."
For additional ANSYS Electronics Desktop script examples, see Example Scripts.
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.
This document describes IronPython briefly and then goes on to describe the desktop provided
IronPython scripting console and scripting with IronPython. You can open an IronPython Com-
mand Window by clicking Tools> Open Command Window.
The document assumes that you know how desktop scripting works using VBScript or Javascript.
Introduction to IronPython
IronPython Mini-cookbook
Translating Script commands from VBScript to IronPython
Scripting Using Iron Python: Putting it all Together
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
myDict = {
"a" : 1,
"b" : "hello there",
"c" : [ 1, 2, "abc"]
}
Boolean Values
VBScript IronPython
' Boolean literals are in lower case # The first letter is capitalized
true True
false False
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"
' 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
A note about indentation
Python is one of the languages where whitespace (spaces, tabs etc) are syntactically significant.
You must understand the basics of indentation before scripting in python.
Any statement that introduces a block of code should be written such that every line of the block
has the same indent (leading spaces or tabs) and the indent should be at least one more than the
indent of the introducing statement.
Sample Script 1 – Describing Python Indentation:
return (a * b) + 100
else:
return (a * b) + 1000
Related Topics
Obtaining More Information
Discovering Methods
Help on a Method
Introduction to IronPython
Translating Script commands from VBScript to IronPython
Scripting Using Iron Python: Putting it all Together
IronPython Samples
Obtaining more Information on Python
Reading a book and searching online are two of the standard options. There are several very good
python tutorials online and the command window is also a great way to quickly execute code and
learn by doing.
Much of the official python documentation is embedded into each python distribution and the com-
mand window can also be used to get more help. You can open the IronPython Command Window
by clicking Tools> Open Command Window. You can also aces the command window execut-
able, Ipy.exe, from the IronPython directory under the ANSYS EM product installation directory.
You can use this window to interactively enter python commands (any of the pure python samples
in this document)
Related Topics
Discovering Methods
Help on a Method
Introduction to IronPython
Translating Script commands from VBScript to IronPython
Scripting Using Iron Python: Putting it all Together
IronPython Samples
Discovering Methods
For instance, if you want to list all methods available in the string module, you would type in "import
string" to import the module first and then type in "dir(string)". You will get a list of all the methods
available (as well as some __somename__ internal names that can be ignored)
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
Obtaining More Information
Discovering Methods
Introduction to IronPython
Translating Script commands from VBScript to IronPython
Scripting Using Iron Python: Putting it all Together
IronPython Samples
Translating Script commands from VBScript to IronPython
This chapter briefly describes Desktop scripting methods and arguments via VBScript samples.
The distinctions made here are significant and come in use later when translating scripts written in
VBScript to IronPython.
Related Topics
Script Method Argument
VBscript Method Call Types
VBScript Sub-Routines
Converting VBScript Function calls to IronPython Syntax
Introduction to IronPython
IronPython Mini-cookbook
Scripting Using Iron Python: Putting it all Together
IronPython Samples
Script Method Argument
Script method calls in VBscript are described later in this document, they generally take the form:
objectName .methodName ( arg1, arg2, ..)
The function call syntax is a standard followed by several programming languages, however, the
argument types in VBScript objects, when used for product scripting, are restricted to the following
Primitive types
Named Array
Named Function
Primitive Types
Primitive types are the standard bool, int, float, double and string
Named Array
Named arrays are a special construct used very commonly and can be found in practically every
recorded script sample.
l A primitive value
l An array of primitive values
l Another named array
l A key, of the form "keyName:=" followed by
o A primitive value
o A function (described next)
Named Function
Named functions are arrays which start with Array( and do not have a leading "NAME:name" item.
They are always introduced by a key and can contain comma separated values of the following
type:
l A primitive value
l A key (of the form "keyName:=") followed by
o A primitive value
o Another function (nested function)
Related Topics
Translating Script commands from VBScript to IronPython
VBscript Method Call Types
VBScript method calls fall into two categories and the distinction between the two results in syntax
differences. These syntax differences are significant when converting VBScript to IronPython.
VBScript Functions
In VBScript terminology functions return values. The syntax for this is the one shared with prac-
tically all programming languages.
Set oDesktop = oAnsoftApp.GetAppDesktop()
Set oProject = oDesktop.NewProject
Sample Script 2: VBScript function call sample
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.
Related Topics
Translating Script commands from VBScript to IronPython
Converting VBScript Function calls to IronPython Syntax
When converting functions, the important point to remember is that IronPython function names,
when used for scripting, are always followed by parentheses. So:
l If you see a VBScript snippet that looks like a VBScript Sub-Routine, remember to add par-
entheses.
l If you see a VBScript function that has no arguments and no parenthesis, remember to add
them around an empty argument list.
The parentheses change is the only one to keep in mind when converting VBScript function calls
syntax to IronPython.
Related Topics
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
Primitive Method Arguments
Replace each VBScript primitive with an equivalent IronPython primitive. Boolean values in
IronPython have their first letter capitalized.
True instead of true, and False instead of false
Converting VBScript Function calls to IronPython Syntax
Named Array Argument
The recommended approach here is to simply replace a VBScript array with a python array. The
mapping is quite simple:
l Change Array( to a left bracket: [ and close with a right bracket: ], instead of a right par-
enthesis ).
l Remove the line continuation symbols: _
l Capitalize the first letter of Boolean values.
l If individual elements of an array are presented on separate lines, the indentation level of
related items must be consistent. Also, array contents must be indented more than their con-
taining brackets.
For instance, method and named VBScript arrays in the snippet above are translated to the fol-
lowing:
oEditor.CreateCone(
[
"NAME: ConeParameters",
"XCenter:=" , "0mm",
"YCenter:=" , "0mm",
"ZCenter:=" , "0mm",
"WhichAxis:=" , "Z",
"Height:=" , "2mm",
"BottomRadius:=" , "1.56204993518133mm",
"TopRadius" , "0mm"
],
[
"NAME:Attributes",
"Name:=" , "Cone1",
"Flags:=" , "",
"Color:=" , "(132 132 193)",
"Transparency:=" , 0,
"PartCoordinateSystem:=" , "Global",
"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
Named Array Values with All Key Value Pairs
While it is generally not allowed to replace the arrays and nested arrays with python dictionaries, in
the case where the named array consists entirely of key value pairs (like the following sample), one
can use a dictionary and avoid typing the trailing ":=" symbols after the keys. This further aids read-
ability of the script.
If the array consists of all key value pairs:
"UDMId" : "",
"MaterialValue" : "\"vacuum\"",
"SolveInside" : True
}
Sample Script 6: CreateCone in IronPython using dictionary syntax
Related Topics
Converting VBScript Function calls to IronPython Syntax
Named Arrays with Nested Named Arrays
[ "NAME:name",
"key1:=" , 1,
"key2:=" , 2,
["NAME:name2", "R:=", 255]
]
Sample Script 7: Named array with nested named array in array syntax
The above named array with a nested named array (after conversion to IronPython as named
array) can be converted to a dictionary as well. The dictionary can take any of the following forms
{ "NAME" : "name",
"key1" : 1,
"key2" : 2,
"name2" : ["NAME:name2", "R:=", 255]
}
Sample Script 8: Named array with nested named array as mixed dictionary + array
{ "NAME" : "name",
"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
Scripting Using Iron Python: Putting it all Together
If you have existing VBScript/Javascript scripts use existing scripts them as much as possible by
either embedding the test into the IronPython script or invoking them via the Run methods
described later in this chapter.
Translating a script in VBScript to IronPython
Read the chapter on translation and study the samples in that chapter as well as those in the
appendix. For python syntax and the differences, the mini-cookbook chapter will also be useful.
Writing an IronPython script from scratch
Read through the scripting guide available from the product's help menu and translate the
VBScript methods described to IronPython using the information provided in the chapter on trans-
lation. Studying the samples in the document will also prove helpful.
For python syntax and the differences, the mini-cookbook chapter will also be useful.
IronPython Script Execution Environment
Methods for Manipulating Registry Values
Scripting using Embedded VBScript or JavaScript
Scripting with IronPython
Standalone IronPython and Desktop IronPython
Related Topics
Introduction to IronPython
IronPython Mini-cookbook
Translating Script commands from VBScript to IronPython
Appendix: IronPython Samples
IronPython Script Execution Environment
Scripts written in IronPython are executed by desktop in four different ways:
l Tools> Run Script menu item, select "IronPython" from the file type drop-down list.
l Launch the product with a script argument.
o HFSS -runscript someScript.py to keep HFSS GUI open after completing script exe-
cution.
o HFSS -features=beta -ng -runscriptandexit someScript.py to run HFSS in a non-
graphical mode and exit after script completion. Note that this is a beta feature sup-
ported for the HFSS and 3D Layout design types.
l Register an IronPython script as an external tool using the Tools> External Tools menu
item.
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 four flavors addressed in the following subtopics:
Script Argument for IronPython
Script Objects for IronPython
Methods for IronPython
Methods for Manipulating Registry Values
Script Argument for IronPython
When scripts are launched using the Tools > Run Script menu item, the dialog that pops up
allows the user to specify arguments.
Related Topics
IronPython Script Execution Environment
Script Objects for IronPython
The Desktop script objects are available to every IronPython script being run. The names used fol-
low the same convention as with VBScript.
The use of these objects is done as per the individual product scripting guides with some syntax
adjustments made for the parameters to account for the IronPython differences.
Related Topics
IronPython Script Execution Environment
Methods for IronPython
A collection of methods is made available to all python scripts to enable the use of existing scripts
written in VBScript or Javascript. Additional utility methods to add messages to the desktop mes-
sage window are also present.
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
The ANSYS Registry is stored as an XML file format, file is located (by default) at C:\User-
s\<UserName>\Documents\Ansoft\<AnsysProductNameversion>\config\<PC_NAME>_user-
.XML. Most of the ANSYS product configuration information is stored in this XML file. So those six
methods allow a user to change the product configuration in VB-script or Python script.
Example:
value = oDesktop.GetRegistryString("Desktop/Act-
iveDSOConfigurations/HFSS")
l SetRegistryString (KeyPath", "string") - sets the registry key to the specified string
value.
Example:
oDesktop.SetRegistryString("Desktop/Act-
iveDSOConfigurations/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/Act-
iveDSOConfigurations/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.
3. Copy the exported file to a target PC f:\temp\test.acf.
4. Run the following script.
#import the setup
oDesktop.SetRegistryFromFile("f:\\temp\\test.acf")
# Set Active Setup to "test"
oDesktop.SetRegistryString("Desktop/Act-
iveDSOConfigurations/HFSS", "test")
Scripting using Embedded VBScript or JavaScript
Since script recording is still done in VBScript and users are expected to have a significant col-
lection of VBScript or JavaScript assets, it is useful to continue to use existing script files and snip-
pets even when scripting in IronPython. The various Run<*>Command methods have been
designed for this purpose.
For instance: one can create a parameterized cone in HFSS by executing the following IronPython
script from the Tools>Run Script menu.
# assign the VBScript snippet obtained from a script recording from
HFSS to
# coneScript and replace the BottomRadius recorded value with botRa-
dius
coneScript = """Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject()
oProject.InsertDesign "HFSS", "HFSSPyTestDesign", "DrivenModal", ""
Set oDesign = oProject.SetActiveDesign("HFSSPyTestDesign")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateCone Array("NAME:ConeParameters", _
"XCenter:=", "0mm", "YCenter:=", "0mm", "ZCenter:=", "0mm",_
"WhichAxis:=", "Z", "Height:=", "2mm", _
"BottomRadius:=", "3mm", _
"TopRadius:=", "0mm"), Array("NAME:Attributes", "Name:=", _
"Cone1", "Flags:=", "", "Color:=", "(132 132 193)", "Trans-
parency:=", 0, _
"PartCoordinateSystem:=", "Global", "UDMId:=", "", "Mater-
ialValue:=", _
"" & Chr(34) & "vacuum" & Chr(34) & "", "SolveInside:=", _
true)
"""
SetScriptingLanguageToVBScript()
RunScriptCommand(coneScript)
Sample Script 11: Hybrid VBScript + IronPython scripting: parameterized Cone Creation
Even though recorded VBScript is used for scripting, the incremental functionality that is provided
using IronPython is the ability to write a GUI using IronPython/.NET, collect information from the
user and then modify or generate the VBScript commands to actually script the ANSYS EM
desktop. This GUI functionality is cross platform and a significant positive. The following example
demonstrates a contrived use of a .NET window form to display the argument supplied to the
IronPython script (via the ScriptArgument variable).
_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
Scripting with IronPython
While this section talks about directly interacting with the script objects, note that you can execute
VBScript or Javascript at any point using any of the available Run*Command functions. using your
existing script assets in this fashion and mixing with IronPython code for new functionality as
needed is a viable and option.
Access to the application scripting objects is provided via the predefined oDesktop object (as listed
in Script Objects). Interacting with the script objects is very natural, method calls are made just like
in VBScript except that the argument syntax is somewhat simplified to follow natural Python syn-
tax. All primitive types (string, integer, double) map to the natural primitive types in python. The only
differences from the VBScript syntax are seen when specifying array type arguments. The dif-
ferences are described in earlier chapters.
Note:
The typical VBScript calls to obtain the registered COM scripting interface via CreateOb-
ject calls and then obtain the oDesktop object from it using the GetAppDesktop() is not
needed (or even supported on all platforms). Since all scripting occurs in the context of a
running workbench, the available Desktop object is always provided and expected to be
used directly.
Scripting using the IronPython scripting API is very much like scripting with VBScript except that
The samples section lists a collection of pure IronPython snippets: these, along with the various
script snippets listed in this document should serve as a guide and reference.
Related Topics
IronPython Script Execution Environment
Standalone IronPython and Desktop IronPython
Standalone IronPython
In general, it is easier to run a script directly from Electronics Desktop. Standalone IronPython does
not implement all the functionality available when a script is run from Electronics Desktop. It only
implements full support for COM functions.
Running Standalone IronPython
Standalone IronPython uses COM to get the handle to the AnsysEDT app. To run standalone
IronPython, you’ll need to call the IronPython interpreter ipy64.exe.
It is located in:
\\<AnsysEDTInstallationPath>\common\IronPython\ipy64.exe
For example, to run myScript.py, type the following in the command line:
"C:\Program Files\An-
sysEM\AnsysEM20.2\Win64\common\IronPython\ipy64.exe"
"<filePath>\myScript.py"
You can set the interpreter to be the default program when double-clicking the .py script. You can
use any recorded script as the basis for a standalone script and simply add an installation-internal
path to the python module search path (as shown below) and end the script with a new shutdown
call.
Using a Recorded Script
A python script recorded in AnsysEDT already has the required lines to be run as a standalone,
except for the first two lines (path settings) and the final Shutdown() call. See the example script
below.
Creating an External Script
When creating a script outside of Electronics Desktop, the following lines should be included at the
beginning of your script:
l import sys
l sys.path.append("<InstallationPath>")
# Adds the Electronics Desktop installation path to the list of directories Python searches for
modules and files.
l sys.path.append("<InstallationPath>/PythonFiles/DesktopPlugin")
l import ScriptEnv
# This imports ScriptEnv.py from the installation path specified above. ScriptEnv.py per-
forms an operating system check and defines functions used in Electronics Desktop scripts.
See the annotations in the ScriptEnv.py file for more information.
l ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
or ScriptEnv.InitializeNew(NonGraphical=True)
# Initialize and InitializeNew are functions within ScriptEnv.py. The first option
launches Electronics Desktop. The second allows you to run a script without launching
Electronics Desktop. See the annotations in the ScriptEnv.py file for more information.
# This stops ScriptEnv.py. If you are running multiple scripts, include this only at the end of
the last script.
Example Script
import sys
sys.path.append(r"C:\Program Files\AnsysEM\AnsysEM20.2\Win64")
sys.path.append(r"C:\Program Files\An-
sysEM\AnsysEM20.2\Win64\PythonFiles\DesktopPlugin")
import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
oProject = oDesktop.NewProject()
oProject.InsertDesign("HFSS", "HFSSDesign1", "DrivenModal", "")
oDesign = oProject.SetActiveDesign("HFSSDesign1")
oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateRectangle(
[
"NAME:RectangleParameters",
"IsCovered:= ", True,
"XStart:= ", "-0.2mm",
"YStart:= ", "-3mm",
"ZStart:= ", "0mm",
"Width:= ", "0.8mm",
"Height:= ", "1.2mm",
"WhichAxis:= ", "Z"
],
[
"NAME:Attributes",
"Name:= ", "Rectangle1",
"Flags:= ", "",
"Color:= ", "(132 132 193)",
"Transparency:= ", 0,
"PartCoordinateSystem:=", "Global",
"UDMId:= ", "",
"MaterialValue:= ", "\"vacuum\"",
"SolveInside:= ", True
])
oDesign.SetDesignSettings(['NAME:Design Settings Data', 'Allow Mater-
ial Override:=', True, 'Calculate Lossy Dielectrics:=', True])
oEditor.SetModelUnits(['NAME:Units Parameter', 'Units:=', 'mil',
'Rescale:=' , False ])
ScriptEnv.Shutdown()
IronPython Samples
Change property
The following snippets show how a change property command (in this case, to change the color of
a cone) looks in VBScript and its two possible IronPython variants.
oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:Geo-
metry3DAttributeTab",_
Array("NAME:PropServers", "Cone1"), _
Array("NAME:ChangedProps", _
Array("NAME:Color", "R:=", 255, "G:=", 255, "B:=", 0))))
Sample Script 13: ChangeProperty command to change color of a cone in VBScript
oEditor.ChangeProperty(
["NAME:AllTabs",
["NAME:Geometry3DAttributeTab",
["NAME:PropServers", "Cone1"],
["NAME:ChangedProps",
["NAME:Color", "R:=", 0, "G:=", 0, "B:=", 64]
]
]
])
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
Most scripting tasks using IronPython are expected to be formatted as the following example. One
starts with the predefined oDesktop object and drills down to the design, editors, modules etc and
issues any required commands on the object while formatting the script command arguments in nat-
ural python syntax.
oProject = oDesktop.GetActiveProject()
oDesign = oProject.InsertDesign("HFSS","Random","DrivenModal","")
oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateCone(
{
"NAME" : "ConeParameters",
"XCenter" : "0mm",
"YCenter" : "0mm",
"ZCenter" : "0mm",
"WhichAxis" : "Z",
"Height" : "2mm",
"BottomRadius" : "1.56204993518133mm",
"TopRadius" : "0mm"
},
{
"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")
"Name" : firstConeName,
"Flags" : "",
"Color" : "(132 132 193)",
"Transparency" : 0,
"PartCoordinateSystem": "Global",
"UDMId" : "",
"MaterialValue" : "\"vacuum\"",
"SolveInside" : True
}
)
# copy first
oEditor.Copy(
{
"NAME" : "Selections",
"Selections" : firstConeName
}
)
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
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)
C Python
where udmDefinition is an output
parameter
l If function has input 'List' parameter and input 'list size' parameter, 'list size' parameter will be
omitted.
l If function has output 'List' parameter and output 'list size' parameter, 'list size' parameter will
be omitted.
l If function has output 'List' parameter and input 'list size' parameter, 'list size' parameter
won't be omitted as it's needed for memory allocation in the corresponding C++ function
from the UDP/UDM function library.
Example:
# input list, input list size
lret = udpFunctionLibrary.Unite(objectIds)
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);
Added Parameters
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 *
You must write a class derived from IUDPExtension with a mandatory name UDPExtension:
class UDPExtension(IUDPExtension):
The class should implement IUDPextension methods described below.
IUDPExtension methods
All methods are same as the methods in the C UDP implementation. The changes to the methods
signatures are just to conform to the Python style.
Mandatory methods.
These methods must be implemented in the UDP Python script as methods of UDPExtension
class.
GetLengthParameterUnits()
l returns string.
GetPrimitiveTypeInfo()
l returns UDPPrimitiveTypeInfo.
GetPrimitiveParametersDefinition2()
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
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 *
Main class: UDMExtension
You must write a class derived from IUDMExtension with a mandatory name UDMExtension:
class UDMExtension(IUDMExtension):
The class should implement IUDMExtension methods described below.
IUDMExtension methods
All methods are the same as the methods in the C UDM implementation. The changes to the meth-
ods signatures are just to conform to the Python style.
Mandatory methods.
These methods must be implemented in the UDM Python script as methods of UDMExtension
class.
GetInfo()
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 instanceId is a long
l returns string containing source information of UDM instance. It is used to create initial name
for UDM instance.
ShouldAttachDefinitionFilesToProject()
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)
UDP/UDM Structures and constants
The following sections describe:
l UDP/UDM Structures
l UDP/UDM Constants
UDP/UDM Structures
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)
setString(string val)
setDouble(double val)
setPosition(UDPPosition 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
UDP/UDM Constants
The instructions below are for Windows, but they work similarly for Linux. On Linux, determine your
shell (execute echo $SHELL) and, based on that, use setenv or export to set the environment vari-
ables.
1. Create a directory that serves as a folder for the logs. Make sure that this directory is empty:
clean it out if it already has files. For this example, the name of the directory is c:\ans-
dir\ansdebug.
2. Start a new shell to set the environment. (You can set it permanently, but this is not recom-
mended.)
3. Set the following env variables in this shell:
l Set ANSOFT_DEBUG_MODE to 2. Set it to a higher number such as 4 or 5 if the
developer requests it.
l Set ANSOFT_DEBUG_LOG to a file in the previously created ansdebug directory: for
example, set ANSOFT_DEBUG_LOG=c:\ansdir\ansdebug\ansdebug.log.
l Set ANSOFT_DEBUG_LOG_SEPARATE to 1.
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.
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:
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:
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 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")
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. Click Save.
5. Perform the steps you want to record.
6. 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, then click OK.
3. When you have finished, click Tools > Stop Script Recording.
The recorded script is then saved to scriptname.vbs in the Scripts library and can be
accessed by expanding the definitions/Scripts folder in the Project Manager.
l You can edit scripts stored in a project by right-clicking the desired script in the Definitions >
Scripts folder in the Project Manager window; then selecting Edit Script from the context
menu. The script will open in theScript Editor.
l You can execute a project script, by right-clicking the desired script in the Definitions >
Scripts folder in the Project Manager window; then selecting Run Script from the context
menu.
l You can also access project scripts by selecting the Automation tab and using the menu
under the Run script icon:
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:
4. Click Open.
To supply script arguments when running from Tools> Run Script, use the Edit field at the bot-
tom of the file selection dialog box. You can access the script arguments using the
AnsoftScriptHost.arguments collection from VBScript. This is a standard COM collection.
To run a script from a command line (as described in the ANSYS Electronics Desktop Help in the
Running ANSYS Electronics Desktop from a Command Line section), use:
-runscriptandexit or -runscript arguments to the ANSYS Electronics Desktop command
line syntax.
You can give -scriptargs parameter to the script and specify the arguments described in the
ANSYS Electronics Desktop help.
If you run the script from DOS prompt as a .vbs file (that is, you do not launch ANSYS Electronics
Desktop, but just launch vbs directly, or use wscript.exe or cscript.exe), the arguments will be in the
WSH.arguments collection, not the AnsoftScriptHost.arguments collection. To handle this, use the
following script:
on error resume next
dim args
Set args = AnsoftScript.arguments
if(IsEmpty(args)) then
Set args = WSH.arguments
End if
on error goto 0
'At this point, args has the arguments no matter if you are running
'under windows script host or Ansoft script host
msgbox "Count is " & args.Count
for i = 0 to args.Count - 1
msgbox args(i)
next
Pausing and Resuming a Script
To pause a script during its execution:
l Click Tools> Pause Script or select the Automation tab and click the Pause Script icon.
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
l Setting Numerical Values
l ANSYS Electronics Desktop Layout Scripts and the Active Layer
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 selec-
tion 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
Named Arguments
Many ANSYS Electronics Desktop script commands use named arguments. The names can
appear in three ways:
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",
"Voltage:=", 3.5)
"Voltage:=", "3.5V" )
"Voltage:=", "$var1" )
vb_var = "3.5V"
"Voltage:=", vb_var)
The active layer is not used during script adding operations. Script adding operations are respons-
ible for ensuring that the specified layer exists and meets the particular requirements (such as layer
type) for the operation. If there is a problem with using the specified layer, the operation is not done.
The active layer is always visible and selectable. These attributes are reset, if needed, when a layer
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 window or in the pop-up Properties dialog box
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 explan-
ation of how to manipulate properties in a script.
1-94
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
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
GetProcessID
GetProjects
GetProjectDirectory
GetProjectList
GetScriptingToolsHelper
GetSysLibDirectory
GetTempDirectory
GetUserLibDirectory
GetVersion
ImportANF
ImportAutoCAD
ImportGDSII
ImportODB
LaunchJobMonitor
NewProject
OpenAndConvertProject
OpenMultipleProjects
OpenProject
OpenProjectWithConversion
Paste
PauseRecording
PauseScript
Print
QuitApplication
RefreshJobMonitor
RestoreProjectArchive
RestoreWindow
ResumeRecording
RunACTWizardScript
RunProgram
RunScript
RunScriptWithArguments
SelectScheduler
SetActiveProject
SetActiveProjectByPath
SetLibraryDirectory
SetProjectDirectory
SetTempDirectory
ShowDockingWindow
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 messages, optionally specifying severity and design.
In Message Manager, right-click the project name and click Clear messages
UI Access
for Project#
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 oDesktop.CloseProjectNoForce "MyProject"
Example
VB Example:
------------------------------------
Example Script
------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.CloseProjectNoForce "Project9"
Count
Use: Gets the total number of queried projects or designs obtained by GetProjects() and
GetDesigns() commands. See the example query.
Syntax:
Return Value: Returns an integer value.
Parameters: None
Example: set projects = oDesktop.GetProjects()
numprojects = projects.
Example:
---------------------------------------------------------
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:
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"
DownloadJobResults
This command is for downloading results from ANSYS Cloud. Before using this script command,
the command SelectScheduler() must be used first to select “ansys cloud” scheduler. This makes
sure that current scheduler is ANSYS Cloud, and user is logged in. Then, either a valid .q file or .q.-
completed file must be in the project folder, or, a valid job ID and a “batchinfo” folder containing the
corresponding .jobid file are required in the project folder. When the download requirements are
met, the command downloads results from ANSYS Cloud using the specified filters to the given
folder.
resultPath string A string giving the folder path for the down-
load to save to.
Filters (optional) string A string containing filters to download. The
delimiter of file types is “;”. If no filter specified,
the default filter “*” will be applied, which
requests all files for download.
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())
GetDefaultUnit
Returns the default unit for a physical quantity.
UI Access You can view the default settings in Options > General > Default Units
<unit>
Return Value
For example, for Length in the Default Units options, the return value is mm
Python GetDefaultUnit()
Syntax
oDesktop.GetDefaultUnit("length")
oDesktop.GetDefaultUnit("angularspeed")
Python oDesktop.GetDefaultUnit("magneticreluctance")
Example oDesktop.GetDefaultUnit("massflowrate")
oDesktop.GetDefaultUnit("pressurecoefficient")
oDesktop.GetDefaultUnit("flux")
VB Syntax GetDefaultUnit
VB Example oDesktop.GetDefaultUnit("length")
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
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", _
"Box1:CreateBox:1"), Array("NAME:ChangedProps", Array("NAME:ZSize",
"Value:=", "1mm"))))
GetDistributedAnalysisMachines
Gets a list of machines used for distributed analysis. You can iterate through the list using standard
VBScript methods.
UI Access NA
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")
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/AnsysEM20.2/Win64/'
Python oDesktop.GetExeDir()
Example
VB Syntax GetExeDir()
VB Example msgbox(oDesktop.GetExeDir())
GetGDIObjectCount
Note:
This command is for internal ANSYS use only.
Python oDesktop.GetGDIObjectCount()
Example
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:
------------------------------------------------------
Python GetLibraryDirectory()
Syntax
Python AddInfoMessage(str(oDesktop.GetLibraryDirectory()))
Example
GetLocalizationHelper
Note:
This command is for internal ANSYS use only.
UI Access NA
Object
Return Value
Localization helper object, such as "IDispatch(ILocalizationHelper)"
Python oDesktop.GetLocalizationHelper()
Example
VB Syntax GetLocalizationHelper
VB Example oDesktop.GetLocalizationHelper()
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")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
var = oDesktop.GetMessages(Project9,HFSSDesign1,1)
msgbox var(0)
VB Example:
------------------------------------------------------
using for loop display all the messages for
Project9, HFSSDesign1
------------------------------------------------------
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Dim oProjects
Dim omachine
Dim var
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
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
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
for each prj in oDesktop.GetProjects()
msgbox prj.GetName()
for each design in prj.GetDesigns()
msgbox design.GetName()
next
next
GetProjectDirectory
Gets the path to the Project directory.
UI Access NA
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
GetScriptingToolsHelper
Note:
This command is for internal ANSYS use only.
UI Access NA
Object
Return Value
ScriptingTools helper object
Python oDesktop.GetScriptingToolsHelper()
Example
VB Syntax GetScriptingToolsHelper
VB Example oDesktop.GetScriptingToolsHelper()
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
Use:Import an ODB++ file into a new project.
Command:File > Import > ODB++
Syntax:ImportODB++ <"ODB++filename">, <"OutputEDBfilename>, <"Controlfilename">
Return Value:None
Parameters:<"ODB++filename">
Type: text
Description: name of the ODB++ file to import
<"OutputEDBfilename">
Type: text
Description: name of the EDB file to create during the import.
<"Controlfilename">
Type: text
Description: name of the xml control file to use to guide the import.
This string can be empty ("") if no control file is to be used.
VB Example:
Set oTool = oDesktop.GetTool("ImportExport")
oTool.ImportODB "test.tgz", "test.aedb.edb", "test.xml"
LaunchJobMonitor
Use: For use in starting job monitoring. This brings up the Monitor Job dialog box.
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
Opens a legacy project and converts or copies it to .aedt format.
Return Value An object reference to the newly opened project which has the .aedt extension
Warning: If project file / results with the same name and .aedt extension already exist in the same
directory, they will be overwritten.
oProject = oDesktop.OpenAndConvertProject("c:\\-
files\\optimtee.hfss", 1)
Pytho-
n Note: optimtee.hfss is gone after this code executes
Examp- oProject = oDesktop.OpenAndConvertProject("c:\\-
le
files\\optimtee.hfss", 2)
Note: optimtee.hfss remains after this code executes
VB OpenAndConvertProject(filePath, legacyChoice)
Syntax
VB
Set oProject = oDesktop.OpenAndConvertProject("c:\-
Exam- files\optimtee.hfss", 1)
ple
Note: optimtee.hfss is gone after this code executes
OpenMultipleProjects
Use: Opens all files of a specified type in a specified directory.
Command: Click File>Multiple Open
Syntax: OpenMultipleProjects <Directory> <FileType>
Return Value: None
Parameters: <Directory>
Type: <string>
<FileType>
Type: <string>
VB Example:
oDesktop.OpenMultipleProjects "D:/Projects", "*.aedt"
OpenProject
Opens a specified project.
Python OpenProject(<Filename>)
Syntax
Python oDesktop.OpenProject("C:/Projects/MyProject.aedt")
Example
VB oDesktop.OpenProject "D:/Projects/Project1.aedt"
Example
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
VB Dim oModule
Example Dim oProjects
Dim omachine
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.OpenProject "E:/helical_antenna.aedt"
OpenProjectWithConversion
Note:
This command is for internal ANSYS use only.
Python oDesktop.OpenProjectWithConversion()
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:
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:
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
RunACTWizardScript
Note:
This command is for internal ANSYS use only.
Python oDesktop.RunACTWizardScript()
Example
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.
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 window, waiting for
the user to complete the settings.
Return Value The selected scheduler (if selection was successful, this string should match the
SetActiveProject
Specify the name of the project that should become active in the desktop. Return that project.
UI Access NA
Example:
------------------------------------------------------
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
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")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
oDesktop.SetTempDirectory("C:\temp")
msgbox "Temp Directory Set to " + oDesktop.GetTempDirectory()
ShowDockingWindow
Shows or hides a docking window.
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.
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"
3-72
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
GetAllRunningInstances
Returns a list of running instances of ANSYS Electronics Desktop.
UI Access NA
Parameters None.
Return Value Array containing list of ANSYS Electronics Desktop instances.
Python GetAllRunningInstances()
Syntax
VB Syn- GetAllRunningInstances
tax
GetRunningInstanceByProcessID
Returns the instance of ANSYS Electronics Desktop that is running a specified process.
UI Access NA
Python GetRunningInstanceByProcessID(<processID>)
Syntax
VB GetRunningInstanceByProcessID <processID>
Syntax
GetRunningInstanceByProject
Returns the instance of ANSYS Electronics Desktop that contains a specified open project.
UI Access NA
Python GetRunningInstanceByProject(<projectNameOrPath>)
Syntax
VB GetRunningInstanceByProject <projectNameOrPath>
Syntax
Redo
Rename
Save
SaveAs
SetActiveDefinitionEditor
SetActiveDesign
SetPropValue [Project]
SimulateAll
Undo
UpdateDefinitions
ValidateDesign
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
tax
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
DeleteToolObject
Note:
This command is for internal ANSYS use only.
GetActiveDesign
Returns the design in the active project
Note:
UI Access NA
VB Syntax GetActiveDesign
VB Set oDesign = oProject.GetActiveDesign()
Example
GetChildNames [Project]
Use: Gets child names of the project object.
Syntax: GetChildNames(type)
Return Value: Returns names of children for the queried object.
Parameters: type - optional parameter, default to "Design"; should use values returned by
GetChildTypes().
oProject=oDesktop.GetActiveProject()
VB Syntax GetChildNames(type)
set oProject=oDesktop.GetActiveProject()
VB Example
arrDesignNames = oProject.GetChildNames()
arrVarbleNames = oProject.GetChildNames("Variable")
GetChildObject [Project]
Returns the Child Object of the project.
Note:
UI Access NA
oProject = oDeskop.GetActiveProject()
oDesign = oProject.GetChildObject(“TeeModel”)
Python
Example oVariable = oProject.GetChildObject("VariableName")
oReport = oProject.GetChildObject("TeeModel/Results/S
Parameter Plot 1")
VB GetChildObject()
Syn-
tax
VB
set oDesign = oProject.GetChildObject(“TeeModel”)
Exam- set oVariable = oProject.GetChildObject("VariableName")
ple
set oReport = oProject.GetChildObject("TeeModel/Results/S
Parameter Plot 1")
GetChildTypes [Project]
Use: Gets child types of the project object..
Syntax: GetChildTypes()
Return Value: Returns type of children for the queried object.
oProject=oDesktop.GetActiveProject()
oprj.GetName()
Python
Example
'Project1'
oprj.GetChildTypes()
['Design', 'Variable']
GetConfigurableData (Project)
Note:
This command is for internal ANSYS use only.
Python oProjectGetConfigurableData()
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
GetDesign
Returns the interface to a specific design in a given project.
UI Access NA
Python oProject.GetDesign("HFSSDesign1")
Example
VB Syntax GetDesign(<designName>)
VB Example oProject.GetDesign("HFSSDesign1")
GetEDBHandle
Returns the EDB handle for the project.
UI Access NA
Parameters NA
Return Value Numeric string indicating the EDB handle for the project
Python oProject.GetEDBHandle()
Example
VB Syntax GetEDBHandle()
VB Example oProject.GetEDBHandle()
GetLegacyName
Note:
This command is for internal ANSYS use only.
Python oProject.GetLegacyName()
Example
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
VB name_list = oProject.GetTopDesignList()
Example
for each i in
MsgBox i
Next
GetPropNames [Project]
Use: Always return empty; since the project object doesn't associated with any property.
Syntax: GetPropNames()
Return Value: Empty array.
Parameters: Implicit or specific name of Project object.
Python
Example
GetPropValue [Project]
Returns the property value for the active project object, or specified property values.
UI Access NA
VB Syntax GetPropValue(propPath)
VB Example varVal = oProject.GetPropValue("TeeModel/offset")
InsertDesign
Use: Inserts a new design in the project. In HFSS scripts, the last argument will always be empty.
Command: Project>Insert HFSS Design
Syntax: InsertDesign "HFSS", <DesignName>, <SolutionType>, ""
Return Value: Object
Parameters: <DesignName>
Type: <string>
Name of the new design.
<SolutionType>
Type: <string>
Solution type of the new design. Can be "DrivenModal",
"DrivenTerminal", or "Eigenmode".
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.
Parameters: <DesignType>
Type: <string>
Type of design to insert. Can be "Maxwell 2D", "Maxwell 3D", or "RMxprt"
<DesignName>
Type: <string>
Name of the new design.
<SolutionType>
Type: <string>
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.
InsertToolObject
Note:
This command is for internal ANSYS use only.
oProject.InsertToolObject()
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:
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. "True" must begin
with a capital letter.
<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:
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
SetPropValue [Project]
Sets the property value for the active project object.
Return Value True if the property is found and the new value is valid. Otherwise return False.
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
5-30
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
For a detailed summary of how these new Property script commands are used in a range of con-
texts, including Variable objects, see Object Script Property Function Summary. Additional
examples for these commands are listed under Project Objects, Design Objects, 3D Modeler, Opti-
metrics, Radiation Module and Reporter.
Older property commands should be executed by the oProject object.
Set oProject = oDesktop.SetActiveProject("Project1")
oProject.CommandName <args>
Some of the topics covered in this chapter are as follows:
Conventions Used in this Chapter
ChangeProperty
GetProperties
GetPropertyValue
GetArrayVariables
GetVariables
SetPropertyValue
SetVariableValue
Additional Property Scripting Example
Example Use of Record Script and Edit Properties
l An Object path consisted of one or multiple Object-ID-Nodes separated by "/" . In the HFSS-
Optimtee example, the Optimization Max value of variable "offset" is represented by the path
"TeeModel/offset/Optimization/max" or "TeeModel/Variable[offset]/Optimization[max]"
l Object-ID-Node; may exist in the following forms:
l A simple object name or property name.
l Type[Name] for object; Tab[name] for property.
l Name[attr1="v1", attr2 = "v2", ...]. When more than one child object have the same
name, use attributes to specify the difference.
l ArrayName[index]. For example, the Optimetric setup may has multiple calculations,
"Calculation[0]" can be used to identify the first calculation.
l name beginning with '@' character denoted as a property name, when an object has
a child and property with the same name.
Property Object:
Property Object is the base class defined for all script object that support property Get & Set.
l GetName()
l Returns the name of the object.
l GetChildTypes()
l An object may have different type of children. For example, a design may have vari-
ables, modules, and editors.
l Returns array of text strings; may be empty if the children are NOT divided to dif-
ferent types.
l GetChildNames([type)
l type – Children type name; default returns all children names for all types.
l return – An array of immediate children names, belong to the type if specified.
l GetChildObject(objPath)
l objPath – A child object path. The path may include multiple generations, such as
(designObject/moduleObj/SetupObject).
l return – A child property object if the object found.
l GetPropNames(bIncludeReadOnly);
l bIncludeReadOnly – optional, default to true; True will include read-only properties,
False will exclude read-only properties.
l Return – An array of the object’s property names.
l GetPropValue(propertyPath)
l propertyPath – The path of the property. A property name or child object’s path
appended with a property name, like “TeeModel/Offset/SIValue”
l return -- The property value if the property is found, otherwise cause script error..
l SetPropValue([propertyPath, data)
l propertyPath – The path of the property. A property name or child object’s path appen-
ded with a property name, like “TeeModel/Offset/Value”
l data – new data, data type is depended on property type.
l return – True if property data is updated successfully; False if the new data is invalid.
Project Object
Project Object inherited all functions defined in the Property Object. But it doesn't have property,
GetPropValue() & SetPropValue() function can be used to set its child object's property.
oDesign = oProject("TeeModel")
oVariable = oProject.GetChildObject("VariableName")
l SetPropValue(propertyPath, newValue)
Design Object
Design Object inherited all functions defined in the Property Object. But it doesn't have property,
GetPropValue() & SetPropValue() function can be used to set its child object's property..
l GetChildObject()
oVariable = oDesign.GetChildObject("VariableName")
oReport = oDesign.GetChildObject("Results/S Parameter Plot 1")
oRptModule = oDesign.GetChildObject("ReportSetup")
l GetPropNames(bIncludeReadOnly) always return empty array since the design has no
property.
l GetPropValue()
oDesign GetPropValue("offset/SIValue") //get the offset variable SI value in the
DesignoDesign GetPropValue("offset/SIValue") //get the offset variable SI value in the
Design
oDesign.GetPropValue("Results/S Parameter Plot 1/Display Type") // Get the report display
type
l SetPropValue()
oDesign.SetPropValue("offset", "2mm") //Set the offset variable value to "2mm" in the
Design
oDesign.SetPropValue("Results/S Parameter Plot 1/Display Type", "Data Table) // Set the
report display type to data table.
Variable Object
Is a Property Object that has no child. It also provides quick function call to get/set it properties by
adding functions with property name appended to Get_ & Set_ prefix. To find what functions it
provided enter dir(oVar) the command window. It can accessed by the project or design object’s
GetChildObject(VariableName) function.
oProjVar = oProject.GetChildObject(“$VarName”)
oVar = oProject.GetChildObject(“DesignName/VarName”)
oVar = oDesign.GetChildObject(“variableName”)
oProject..GetChildNames(“Variable”) will return all project variable names.
oDesign.GetChildNames(Variable”) will return all Design Variable names.
l GetChildTypes() there are six type of children, they are ['OptiParametric', 'OptiOptimization',
'OptiSensitivity', 'OptiStatistical', 'OptiDesignExplorer', 'OptiDXDOE']. But the return array
only included those that have setup defined, so it may be an empty array if no optimetrics
setup is defined. The GetChildNames(type) function also recognized the type name without
the prefix “Opti”.
l GetChildNames(type)
GetChildNames() will return all setup for all types.
GetChildNames(“OptiOptimization”) & GetChildNames(“Optimization”) will return all Optim-
ization setup.
l GetChildObject()
oParamSetup = oOptModule.GetChildObject('ParametricSetup1') get the
oOptSetup = oOptModule.GetChildObject('OptimizationSetup1')
l GetPropNames(bIncludeReadOnly) always return empty array since the it has no property.
l GetPropValue(propPath) may be used to get its child’s property value
oOptModule.GetPropValue("OptimizationSetup1\Optimizer") get the optimizer name for
OptimizationSetup1
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>
<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.
Example: <PropServer> for the boundary "PerfE1" is
"BoundarySetup:PerfE1"
<PropTab>
Boundary module: "HfssTab"
Mesh Operations module: "MeshSetupTab"
Analysis module: "HfssTab"
Optimetrics module: "OptimetricsTab"
Solutions module: Does not support properties.
Field Overlays module: "FieldsPostProcessorTab"
Radiation module: "RadFieldSetupTab"
Circuit module: "CCircuitTab"
System module: "SystemTab"
HFSS 3D Layout module: "HFSS 3D LayoutTab"
Nexxim module: "NexximTab"
Layout elements: "BaseElementTab"
Schematic elements: "ComponentTab"
Optimetrics module: "OptimetricsTab"
3D Model Editor
Object in the module:
<PropServer>
Name of the object. For example: "Box1".
<PropTab>
"Geometry3DAttributeTab"
Operation on an object:
<PropServer>
Format is <ObjName>:<OperationName>:<int>
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
Signals ("Signals")
<propServer> String An object identifier, generally returned from
another script method, such as Comp-
Inst@R;2;3
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")
all_props = oDesign.GetProperties("Q3DTab",_
"BoundarySetup:Source1")
GetPropertyValue
Gets the value of a single property belonging to a specific serverName and PropTab. This function
is available with the Project, Design or Editor objects, including definition editors.
Use the script recording feature and edit a property, and then view the resulting script to
see the format for that property.
UI Access NA
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")
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
PassedParameterTab ("Parameter
Values")
DefinitionParameterTab (Para-
meter Defaults")
LocalVariableTab ("Variables" or
"Local Variables")
ProjectVariableTab ("Project vari-
ables")
ConstantsTab ("Constants")
BaseElementTab ("Symbol" or
"Footprint")
ComponentTab ("General")
Component("Component")
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.
<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
VB Example:
Dim all_props
Dim prop
all_props = oEditor.GetProperties("Geometry3DCmdTab",_
"Box1:CreateBox:1")
For Each prop In all_props
val = oEditor.GetPropertyValue("Geometry3DCmdTab",_
"Box1:CreateBox:1", prop)
new_val = InputBox("New Value of " + prop + ":",_
"Current Value of '" + prop + "' is " + val, val)
If new_val <> val Then
oEditor.SetPropertyValue "Geometry3DCmdTab",_
"Box1:CreateBox:1", prop, new_val
val = _
oEditor.SetPropertyValue("Geometry3DCmdTab",_
"Box1:CreateBox:1", prop)
MsgBox("Now the value of '" + prop + "' is " + val)
End If
Next
The following is a sample script that creates a HFSS 3D Layout design, draws a rectangle in the lay-
out editor and uses the GetPropertyValue, SetPropertyValue and GetProperties functions. The
script gets all properties of the rectangle. It then loops through the properties and for each one,
shows the user the current value and asks if the value should be changed. Note that the last call to
GetPropertyValue in the script will fail if you change the name of the rectangle from the script.
VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
'
oDesktop.RestoreWindow
oDesktop.NewProject
Set oProject = oDesktop.GetActiveProject
'
' CREATE A RECTANGLE IN HFSS_3D_LAYOUT
'
oProject.InsertDesign "HFSS 3D Layout", "HFSS 3D Layout1", _
"C:\testinstall\Designer\syslib\PCB - SingleSided.asty", ""
Set oDesign = oProject.SetActiveDesign("HFSS 3D Layout1")
Set oEditor = oDesign.SetActiveEditor("Layout")
oEditor.CreateRectangle Array("NAME:Contents", _
"rectGeometry:=", Array("Name:=", _
"rect_1", "LayerName:=", "Top", "lw:=", _
"0mm", "Ax:=", "-22mm", "Ay:=", "20mm", "Bx:=", _
"29mm", "By:=", "-4mm", "ang:=", "0deg"))
'
'
6-26
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
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")
7-6
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
AddDesignVariablesForDynamicLink
ApplyMeshOps
Analyze
AnalyzeDistributed
AssignDCThickness
ConstructVariationString
DeleteLinkedDataVariation
DeleteVariation
DeleteFieldVariation
DeleteFullVariation
DeleteLinkedDataVariation
EditDesignSettings
EditNotes
ExportConvergence
ExportMatrixData
ExportMeshStats
ExportProfile
ExportNetworkData
ExportNMFData
GenerateMesh
GetChildNames [Design]
GetChildObject [Design]
GetChildTypes [Design]
GetConfigurableData
GetData
GetDesignType
GetDesignValidationInfo
GetEdit SourcesCount
GetExcitations
GetManagedFilesPath
GetModule
GetName
GetNominalVariation
GetNoteText
GetPostProcessingVariables
GetSelections
GetSolutionType
GetSolveInsideThreshold
GetSourceContexts
GetVariationVariableValue
GeometryCheckAndAutofix
PasteDesign
Redo
RenameDesignInstance
ResetToTimeZero
SARSetup
SetActiveEditor
SetDesignSettings
SetLengthSettings
SetObjectDeformation
SetObjectTemperature
SetPhaseCenterPerPort
SetPropValue [Design]
SetSinglePhaseCenter
SetSolutionType
SetSolveInsideThreshold
SetSourceContexts
Solve
RunToolkit
Undo
ValidateLink
AddDesignVariablesForDynamicLink
Creates design variables based on any in a Circuit, HFSS, 3D Layout, Q3D, or 2D extractor project
that is connected to a Circuit or 3D Layout design through a dynamic link.
l In the Schematic Editor or Layout Editor, right click the new instance
of the linked design and click Add Design Variables for Dynamic Link.
UI Access l In the Project Manager, right click on [Project Name] > [Design Name] >
[Dynamic Link Design] and click Add Design Variables for Dynamic
Link.
ApplyMeshOps
Use: If any mesh operations were defined and not yet performed in the current variation for the spe-
cified solution setups, they will be applied to the current mesh. If necessary, an initial mesh will be
computed first. No further analysis will be performed.
Note:
Analyze
Solves a single solution setup and all of its frequency sweeps.
UI Access
Right-click a solution setup in the project tree, and then click Analyze on the
shortcut menu.
Integer
Return Value 0: successful completion
-1: simulation error
Python oDesign.Analyze("TR1")
Example
AnalyzeDistributed
Use: Perform a distributed analysis.
Command: None
Syntax: AnalyzeDistributed <SetupName>
Return Value: <AnalysisStatus>
Type: <int>
-1: completed with error
0: completed successfully
Parameters: <SetupName>
VB Example: For frequency sweeps:
oDesign.AnalyzeDistributed "Setup1"
AssignDCThickness
Assign DC Thickness to more accurately compute DC resistance of a thin conducting object for
which Solve Inside is not selected.
Command: HFSS>Boundaries>Assign DC Thickness
Syntax: AssignDCThickness Array(<ObjectName>) Array (<ThicknessValue>) <string>
Return Value: None
Parameters: <ObjectName>
Type: <string>
Array of object names. Any objects not specified in the arguments are unchanged after
the command is processed.
<ThicknessValue>
Type: <real> or <string>, either "Infinite" or "Effective".
Array of DC thickness values (including units) corresponding to each object name. You
can also specify an infinite thickness or have it calculated automatically.
<string>
Type: <string>
"EnableAuto" is equivalent to checking the checkbox in the second tab of the DC thick-
ness dialog. "DisableAuto" is equivalent to clearing that checkbox. Omitting the string
means leaves the checkbox unchanged.
Example:
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignDCThickness Array("Box2"), Array("1mm")
The following example includes the use of "Automatic" and "Infinite" settings.
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("hfss_uhf_probe")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignDCThickness Array("Arm_1", "Arm_2"), _
Array("" & Chr(34) & "<Effective>" & Chr(34) & "", _
"" & Chr(34) & "<Infinite>" & Chr(34) & "")
ClearLinkedData (Design)
Clear the linked data of all the solution setups. Similar to the ClearLinkedData command for the
module level.
Right-click menu of the Analysis item
Python oDesign.ClearLinkedData()
Example
VB Syntax ClearLinkedData()
VB Example oDesign.ClearLinkedData
ConstructVariationString
Lists and orders the variables and values associated with a design variation.
UI Access None.
Returns variation string with the variables ordered to correspond to the order of
Return variables in design variations. The values for the variables are inserted into the vari-
Value ation string. For an example of how ConstructionVariationString can be used, see
the Python example.
VB ConstructVariationString(<ArrayOfVariableNames>, <ArrayOfVari-
Syn- ableValuesIncludingUnits>)
tax
VB oDesign.ConstructVariationString(Array("x_size","y_size"),
Exam- Array("2mm", "1mm"))
ple
DeleteFieldVariation
Delete field variations, fields and meshes, or fields and meshes for all variations
Fields
oProject = oDesktop.GetActiveProject()
Pyt-
oDesign = oProject.GetActiveDesign()
hon
Exa- Design.DeleteFieldVariation(["mm=\'2mm\' y_
mp- 1=\'0.838297677541429mm\' y_7=\'3.07582323679311mm\'"],
le False, False)
Pyt- oDesign.DeleteFieldVariation(["mm=\'2mm\' y_
hon 1=\'0.559511093478194mm\' y_7=\'1.86857203894162mm\'"], True,
Exa- False)
mp-
le
VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("OptimTee")
Set oDesign = oProject.SetActiveDesign("TeeModel")
oDesign.DeleteFieldVariation "All", true, false
VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
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")
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 the linked data of specified variations.
Pytho- DeleteLinkedDataVariation(<DesignVariationKeys>)
n Syn-
tax
VB DeleteLinkedDataVariation(<DesignVariationKeys>)
Syn-
tax
VB oDesign.DeleteLinkedDataVariation(Array("current=\'0.9mA\'",
Exam- "current=\'1.0mA\'"))
ple
DeleteVariation
Use:Obsolete. Use DeleteFullVariation, DeleteFieldVariation, DeleteLinkedDataVariation.
EditDesignSettings
Use: To set the design settings.
Command: [product]>Design Settings
Syntax: EditDesignSettings <OverrideArray>
Return Value: None
Parameters: <OverrideArray>
Array("NAME:Design Settings Data",
"Use Advanced DC Extrapolation:= <Boolean>,
"Port Validation Settings=: ["Standard" | "Extended"]
"Calculate Lossy Dielectrics:=", <Boolean>)
"Use Power S:=", <Boolean>,
"Export After Simulation:=", <boolean>, "Export Dir:=", "<path>",
"Allow Material Override:=", <boolean>,
"Calculate Lossy Dielectrics:=", <boolean>,
"EnabledObjects:=", Array(),
"Model validation Settings:=", Array("NAME:Validation Options",
"EntityCheckLevel:=", "[strict | none | warningOnly | basic ]",
"IgnoreUnclassifiedObjects:=", <boolean>,
"SkipIntersectionChecks:=", <boolean>),
"Design Validation Settings:=", "Perform full validations" )
HFSS Example
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project4")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
oDesign.EditDesignSettings Array("NAME:Design Settings Data", "Use
Advanced DC Extrapolation:=", _
false, "Use Power S:=", false, "Export After Simulation:=", false,
"Allow Material Override:=", _
true, "Calculate Lossy Dielectrics:=", true, "Perform Minimal val-
idation:=", _
false, "EnabledObjects:=", Array(), "Port Validation Settings:=",
"Standard"), Array("NAME:Model Validation Settings", "EntityCheck-
Level:=", _
"Strict", "IgnoreUnclassifiedObjects:=", true, "SkipIn-
tersectionChecks:=", _
false)
Parameters: <MaterialsOverrideArray>
Array("NAME:Design Settings Data",
"Allow Material Override:=", <boolean>,
"Calculate Lossy Dielectrics:=", <boolean>,
"Perform Minimal validation:=", <boolean>,
"PECThreshold:=", <real>, "CondThreshold:=", <int>),
Array("NAME:Model Validation Settings", "EntityCheckLevel:=", [strict | none | warningOnly | basic
]", "IgnoreUnclassifiedObjects:=", <boolean>,
"SkipIntersectionChecks:=", <boolean>)
HFSS-IE 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("Project38")
Set oDesign = oProject.SetActiveDesign("IEDesign1")
oDesign.EditDesignSettings Array("NAME:Design Settings Data", "Allow
Material Override:=", _
true, "Calculate Lossy Dielectrics:=", true, "Perform Minimal val-
idation:=", _
false, "PECThreshold:=", 1E+030, "CondThreshold:=", 10000), _
Array("NAME:Model Validation Settings", "EntityCheckLevel:=", _
"Strict", "IgnoreUnclassifiedObjects:=", false, "SkipIn-
tersectionChecks:=", _
true)
Python oDesign.EditDesignSettings(
Example [
EditNotes
Edits design notes.
Command: Click [design_type]>Edit Notes, or right-click a design instance in the project tree and
select Edit Notes.
Return Value: None
Parameters: <DesignNotes>
Type: string
VB Example: oDesign.EditNotes "Design for testing"
Python
Example oDesign.EditNotes("Design for testing")
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"
Parameters: <SetupName>
Type: <string>
Example: "Setup1 "
<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"
ExportMatrixData
Use:Exports matrix in Matlab or spreadsheet format.
Command:In the Matrix tab of the Solution dialog box, click Export>RLGC.
<IndUnit>
Type: <string>
Unit used for the inductance value
<CapUnit>
Type: <string>
Unit used for the capacitance value
<CondUnit>
Type: <string>
Unit used for the conductance value
<Frequency>
Type: <double>
Frequency in hertz.
<MatrixType>
Type: <String>
Value: "Maxwell", "Spice", "Couple" , (one or all of these).
Matrix type to export.
<PassNumber>
Type: <integer>
Pass number.
<ACPlusDCResistance>
Type: <bool>
Default Value: false
Add DC and AC resistance and export the matrix.
VB Example:oDesign.ExportMatrixData "C:/temp/3DScripts/rlgc_
lvl.lvl", "C, DC RL, AC RL", "", _ "Setup1:LastAdaptive", "Ori-
ginal", "ohm", "nH", "pF", "mSie", 100000000, _ "Max-
well,Spice,Couple", 0
oDesign.ExportMatrixData
Pytho- (["C:/temp/3DScripts/rlgc_lvl.lvl", "C, DC RL, AC RL", "", _
n "Setup1:LastAdaptive",
Exam- "Original", "ohm", "nH", "pF", "mSie", 100000000, _ "Max-
ple well,Spice,Couple",
0])
ExportNetworkData
Exports matrix solution data to a file. Available only for Driven solution types with ports.
Command: None
Syntax: ExportNetworkData
<DesignVariationKey>, <SolnSelectionArray>, <FileFormat>,
<OutFile>,<FreqsArray>, <useExportFreqs>, <DoRenorm>, <RenormImped>
<dataType> <pass> <complexFormat> <Touch-
stoneNumberofDigitsPrecision> <IncludeGammaAndImpedanceComments>
<SupportNon-standardTouchstoneExtensions>
Return Value: None
Parameters: <SolnSelectionArray>
Array(<SolnSelector>, <SolnSelector>, ...)
If more than one array entry, this indicates a combined Interpolating sweep.
<SolnSelector>
Type: <string>
Gives solution setup name and solution name, separated by a colon.
<FileFormat>
Type: <int>
Possible values are:
2 : Tab delimited spreadsheet format (.tab)
3 : Touchstone (.sNp)
4 : CitiFile (.cit)
7 : Matlab (.m)
8 : Terminal Z0 spreadsheet
<OutFile>
Type: <string>
Full path to the file to write out.
<FreqsArray>
Type: Array of doubles or "All".
The frequencies to export. The <FreqsArray> argument contains a vector (e.g. "1GHz",
"2GHz", ...) to use, or "all". To export all frequencies, use Array("all").
<useExportFreqs>
Type: <bool>
Optional, currently always ignored.
<DoRenorm>
Type: <bool>
Specifies whether to renormalize the data before export.
<RenormImped>
Type: <double>
Real impedance value in ohms, for renormalization. Required in syntax,
but ignored if DoRenorm is false.
<DataType>
Type: "S", "Y", or "Z"
The matrix to export.
<Pass>
Type: string, from 1 to N.
The pass to export. This is ignored if the sourceName is a frequency sweep. Leaving out
this value or specifying -1 gets all passes.
<ComplexFormat>
Type: "0", "1", or "2"
The format to use for the exported data.
0 = Magnitude/Phase.
1= Real/Imaginary.
2= db/Phase.
<TouchstoneNumberofDigitsPrecision>
Type: <int>
Default if not specified is 15.
<IncludeGammaAndImpedanceComments>
Type: <bool>
Specifies whether to include Gamma and Impedance comments.
<SupportNon-standardTouchstoneExtensions>
Type: <bool>
Specifies whether to support non-standard Touchstone extensions for mixed reference
impedances.
ExportNetworkData( [
Pyth- "",
on
Syn-
# Empty string.
tax 1,
#The number 1.
"Name",
# This is the full path of the file from which the solution is loaded.
"ExportFile",
# full path of file to export to
"variation",
# Pick a particular variation. Leave blank if no variation
["NAME:Frequencies"],
# optional, if none defined all frequencies are used
["NAME:Options",
# Export options object
"DataTypes:=", ["S"],
# DataTypes can be "S", "Y","Z", "G", and "Z0", for S , Y, Z matrix, Gamma and Z0 (zero)
"DisplayFormat:=", "MA",
# DisplayFormat "MA", "RI", "DB"
"FileType:=", "",
# Export File Type:
2 - Spreadsheet(*.tab)
3 - Touchstone(*.sNp)
4 - Citifile(*.cit)
6 - Neutral format(*.nmf)
7 - Matlab format(*.m)
"Renormalize:=", False,
# Renormalize True/False
"RefImpedance:=",50,
# Reference Impedance
"Precision:=", 8,
# Number of digits Precision
"CreateNPortModel:=", True
# Create a model based on the exported file True/False
])
import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
Pyth- oProject = oDesktop.SetActiveProject("package")
on
Exa- oDesign = oProject.SetActiveDesign("HFSSDesign1")
mple
oModule = oDesign.GetModule("Solutions")
oModule.ExportNetworkData("", ["Setup1:Sweep1"], 3, "C://Docu-
ments/package_HFSSDesign1.s4p", _
Array ('all'), True, 50, "S", -1, 0, 15, True, True, True)
ExportNMFData
Use:Exports s-parameters in neutral file format.
Command:In the matrix tab of the Solution dialog box, click Export->S-Parameter. Then select
the Neutral Model file format.
Syntax: ExportNetworkData <SolutionName> <FileName> <ReduceMatrix><Reference Imped-
ance> <FrequencyArray> <DesignVariation> <Format> <Length> <PassNumber>
Return Value:None
Parameters:SolutionName>
Type: <String>
Format: <SetupName>:<SolutionName>
Solution that is exported.
<FileName>
Type:<String>
The name of the file. The file extension will determine the
file format.
<ReduceMatrix>
Type: <string>
Either "Original" or one of the reduce matrix setup name
<Reference Impedance>
Type: <Double>
Reference impedance
<FrequencyArray>
ExportNMFData(
"",
# Empty string.
1,
Python Syn-
tax
#The number 1.
"Name",
# This is the full path of the file from which the solution is loaded
"ExportFile",
# full path of file to export to
["NAME:Frequencies"],
#optional, if none defined all frequencies are used
["NAME:NMFOptions",
#Export NMF options object
"DataTypes:=", ["S"],
#DataTypes can be "S", "Y","Z", "G", and "Z0", for S , Y, Z matrix, Gamma and Z0
(zero)
"DisplayFormat:=", "MA",
#DisplayFormat "MA", "RI", "DB"
"FileType:=", "",
# Export File Type
2 - Spreadsheet(*.tab)
3 - Touchstone(*.sNp)
4 - Citifile(*.cit)
6 - Neutral format(*.nmf)
7 - Matlab format(*.m)
"Renormalize:=", false,
#Renormalize true/false
"RefImpedance:=",50,
# Reference Impedance
"Precision:=", 8,
# Number of digits Precision
"Variables:=", ["FF", "cap", "Rs"]
# Array of variables
"Variations:=", ["", "", ""]
# Array of variations to export solutions for
["NAME:ConstantVars"]
#Array of variables that are constant, can be empty
["NAME: DependentVars"]
#Array of variables that are dependent, can be empty
"MatrixSize:=", 2,
#Matrix size, optional (used in nmf file header)
"CreateNPortModel:=", true
#Create a model based on the exported file true/false
])
oTool = oDesktop.GetTool("NdExplorer")
oTool.ExportNetworkData("", True,
"C:/.../100OHM.S2P", "$SYSLIB/Test.s2p", "",
[
"NAME:Frequencies",
500000000,
1000000000,
10000000000,
25000000000,
50000000000,
75000000000,
Python
Example 100000000000
],
[
"NAME:TSOptions",
"DataTypes:=" , ["S"],
"DisplayFormat:=" , "DB",
"FileType:=" , 3,
"Renormalize:=" , True,
"RefImpedance:=" , 50,
"Precision:=" , 6,
"UseMultipleCores:=" , False,
"NumberOfCores:=" , 1,
"Comments:=" , True,
"Noise:=" , False
])
ExportMeshStats
Use: Exports the mesh statistics to a file.
Command: None.
Parameters: <SetupName>
Type: <string>
Example: "Setup1 "
<VariationString>
Type: <string>
Example: "radius = 3mm"
The empty variation string ("") is interpreted to mean the current nominal variation.
<FilePath>
Type: <string>
Example: "c:\convergence.conv"
overwriteIfExists <Boolean>
If "overwriteIfExists" is TRUE, then the playback of the script overwrites an existing file. If
FALSE, it does not. The default is "TRUE".
Type: <string>
Example: overwriteIfExists=TRUE
VB Example:
oDesign.ExportMeshStats ("Setup1", "offset=" & Chr(39) & "0.09in" &
Chr(39) & "","C:\mydir\meshstats.ms" "tat")
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"
Generate Mesh
Use: If any mesh operations were defined and not yet performed in the current variation for the spe-
cified solution setups, they will be applied to the current mesh. If necessary, an initial mesh will be
computed first. No further analysis will be performed.
Command: HFSS > Analysis Setup > Generate Mesh.
GetChildNames [Design]
Use: Gets child names of the Design object..
Syntax: GetChildNames(childType)
Return Value: Returns names of children for the Design object.
Parameters: childType-- optional parameter, default will return Module and Editor names; or use
value returned by GetChildTypes().
oDesign = oProject.GetActiveDesign()
arrModuleAndEditorNames = oDesign.GetChildNames()
Python
arrEditorNames = oDesign.GetChildNames("Editor")
Example
arrModuleNames = oDesign.GetChildNames("Editor")
arrVariableNames = oDesign.GetChildNames("Variable")
VB Syntax GetChildNames(childType)
VB Example
GetChildObject [Design]
Returns the Child Object of the Design object.
UI Access NA
oDesign = oProject.GetActiveDesign()
oOptimModule = oDesign.GetChildObject(“Optimetrcis”)
oEditor = oDesign.GetChildObject(“3D Model”)
Python
Example oBox = oDesign.GetChildObject(“3D Model/Box1”)
oRpt = oDesign.GetChildObject("Results/S Parameter Plot
1")
oVariable= oDesign.GetChildObject("Offset")
VB Syntax GetChildObject(objectPath)
set oDesign = oProject.GetActiveDesign()
set oOptimModule = oDesign.GetChildObject(“Opti-
metrcis”)
set oEditor = oDesign.GetChildObject(“3D Model”)
VB Example
set oBox = oDesign.GetChildObject(“3D Model/Box1”)
set oRpt = oDesign.GetChildObject("Results/S Parameter
Plot 1")
set oVariable= oDesign.GetChildObject("Offset")
GetChildTypes [Design]
Use: Gets child types of design object.
Syntax: GetChildTypes()
Python GetChildTypes ()
Syntax
oProject=oDesktop.GetActiveProject()
oDesign = oProject.GetChildObject("'HFSSDesign1'")
Python
oDesign .getChildTypes()
Example
['Module', 'Editor', 'Variable']
GetConfigurableData
Note:
This command is for internal ANSYS use only.
Python oDesign.GetConfigurableData()
Example
GetData
Note:
This command is for internal ANSYS use only.
Python oDesign.GetData()
Example
GetDesignType
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()
GetDesignValidationInfo
Use: Returns the validation information. For example, for a non-graphical job so the cluster man-
ager can reject any job in a queue that does not have proper validation. For example, ansysedt.exe
-features=SF6694_Non_Graphical_Command_execution -ng -runscriptandexit "D:/MyPro-
jects/Validate.py" "E/MyProjects/Tee.aedt".
Command: none
Syntax: GetDesignValidationInfo(<ValidationResultfilePath>)
Return Value: 0 if Validation is not done or 1 if a validation result has been found. Writes the result
to a user specified location.
Type: <string>
Format is as follows:
<ValidationInfo>
<DesignValid>false</DesignValid>
<IgnoreUnclassifiedObjects>false</IgnoreUnclassifiedObjects>
<SkipIntersectionChecks>false</SkipIntersectionChecks>
<EntityCheckLevel>Strict</EntityCheckLevel>
Pytho- GetDesignValidationInfo(<filePath>)
n Syn-
tax
GetEditSourcesCount
Returns the number of sources that are listed in the Edit Sources panel.
Command: None
Syntax: GetEditSources
Return Value: <int>
Parameters: None
VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.GetActiveProject
Set oDesign = oProject.GetActiveDesign
Set oModule = oDesign.GetModule("Solutions")
Dim count
count = oModule.GetEditSourcesCount
MsgBox(count)
Python oModule.GetEditSourcesCount
Example
GetExcitationsModule
Query source scalings (mag, phase etc.) from the Edit Source panel.
Command: None
Syntax: GetExcitationScaling( <port name>, <port index>)
Return Value: Scaling for excitation.
Parameters: <port name>
Port ID
<port index>
Port Index if present.
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("Project15")
Set oDesign = oProject.SetActiveDesign("HfssDesign1")
Set oModule = oDesign.GetExcitations("Solutions")
' ----------------------------------------------
' sample code to display results
' ----------------------------------------------
buffer = ""
for i = 0 to uBound(data)
buffer = buffer & data(i)
if i < uBound(data) then buffer = buffer + ", "
next
MsgBox( buffer )
GetManagedFilesPath
Get the path to the project's results folder.
UI Access NA
The path where the project results are located, such as C:/Users/[user-
Return Value
name]/Ansoft/Project31.aedtresults/mf_0/
Python oDesign.GetManagedFilesPath()
Example
VB Syntax oDesign.GetManagedFilesPath
VB Example oDesign.GetManagedFilesPath
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:
<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-
Return Value 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
GetNoteText
Return the text of the note added to a design in the project tree.
UI Access NA
oProject = oDesktop.GetActiveProject()
Python oDesign = oProject.GetActiveDesign()
Example
oDesign.GetNoteText()
GetPostProcessingVariables
Return the list of post processing variables.
UI Access NA
oProject = oDesktop.GetActiveProject()
Python oDesign = oProject.GetActiveDesign()
Example
oDesign.GetPostProcessingVariables()
GetPropNames [Design]
Use: Always return empty array since the design has no property.
Syntax: GetPropNames()
Return Value: Returns empty array.
Parameters: Implicit or specific name of Design object.
Python GetPropNames(bIncludeReadOnly)
Example
GetPropValue [Design]
Returns the property value for the active design object, or specified property values.
UI Access NA
oProject = oDeskop.GetActiveProject()
Python oDesign = oProject.GetChildObject(“TeeModel”)
Example
oDesign.GetPropValue(“offset”) // Get value of offset
variable as text string
VB Syntax GetPropValue(propPath)
set oProject = oDeskop.GetActiveProject()
set oDesign = oProject.GetChildObject(“TeeModel”)
valStr = oDesign.GetPropValue(“offset”) // Get value of
offset variable as text string
val = oDesign.GetPropValue(“offset/SIValue”) // Get SI-
VB Example value of offset variable as number.
disp = oDesign.GetPropValue("Results/S Parameter Plot
1/Display Type") // Get the report display type as text
string
arr = oDesign.GetPropValue("Results/S Parameter Plot
1/Display Type/Choices'") // Get the report display
type choice as array of text string
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 (The solution type may be viewed in the project tree at the design level.)
Syntax: GetSolutionType
Return Value: <SolutionType>
Type: <string>
oProject = oDesktop.GetActiveProject()
Python
oDesign = oProject.GetActiveDesign()
Example
oDesign.GetSolutionType()
VB Syntax GetSolutionType
VB 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
Return Value: Array of enabled source names
Parameters: None
VB Example:
SetoModule = oDesign.GetModule("Solutions")
oModule.GetSourceContexts
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.
"minimum_area_meters_squared:=", 2E-006, _
Array("NAME:fixes", "Self-Intersecting Polygons", _
"Disjoint Nets", "Identical/Overlapping Vias", _
"Traces-Inside-Traces Errors", _
"Misalignments (Planes/Traces/Vias)")
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:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
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:
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.
<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:
SetDesignSettings
Use: To set the design settings.
Command: HFSS>Design Settings
Syntax: SetDesignSettings <OverrideArray>
Return Value: None
Parameters: <OverrideArray>
Array("NAME:Design Settings Data",
"Use Advanced DC Extrapolation:= <Boolean>,
"Port Validation Settings=: ["Standard" | "Extended"]
"Calculate Lossy Dielectrics:=", <Boolean>)
"Use Power S:=", <Boolean>,
"Export After Simulation:=", <boolean>, "Export Dir:=", "<path>",
"Allow Material Override:=", <boolean>,
"Calculate Lossy Dielectrics:=", <boolean>,
"EnabledObjects:=", Array(),
"Maximum Number of Frequencies for Broadband Adapt:=", <int>
],
[
"Model validation Settings:=", Array("NAME:Validation Options",
"EntityCheckLevel:=", "[strict | none | warningOnly | basic ]",
"IgnoreUnclassifiedObjects:=", <boolean>,
"SkipIntersectionChecks:=", <boolean>),
"Design Validation Settings:=", "Perform full validations" )
HFSS 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("Project38")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
oDesign.SetDesignSettings Array("NAME:Design Settings Data", "Use
Advanced DC Extrapolation:=", _
false, "Use Power S:=", false, "Export After Simulation:=", false,
"Allow Material Override:=", _
false, "Calculate Lossy Dielectrics:=", false, "Perform Minimal val-
idation:=", _
false, "EnabledObjects:=", Array(), "Port Validation Settings:=",
"Extended"), Array("NAME:Model Validation Settings", "EntityCheck-
Level:=", _
"WarningOnly", "IgnoreUnclassifiedObjects:=", false, "SkipIn-
tersectionChecks:=", _
true)
oDesign.SetDesignSettings(
[
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>
Value: Time with units.
Rise time used in post processing steps.
SetObjectDeformation
Sets the deformation of objects when calling ANSYS Electronics Desktop from ANSYS Work-
bench
Pyth- SetObjectDeformation()
on
Syn-
tax
system1.SendAnsoftCommand(PyCom-
Pyth- mand="""oDesktop.SetActiveProject(\"MaxwellProject\")
on
.SetActiveDesign(\"Maxwell3DDesign1\")
Exam-
ple .SetObjectDeformation([ \"EnabledObjects:=\" , [\"Cylin-
der1\"]])""")
VB Syntax SetObjectDeformation
VB Example oDesign.SetObjectDeformation
SetObjectTemperature
Sets the temperature of objects.
Return None
Value
Pytho- oDesign.SetObjectTemperature()
n Syn-
tax
oDesign.SetObjectTemperature(
[
"NAME:TemperatureSettings",
Pytho-
n "IncludeTemperatureDependence:=", True,
Exam-
ple EnableFeedback:=" , False,
Temperatures:=" , ["Regu-
larPolyhedron1","22cel","Polygon1","22cel"
])
VB oDesign.SetObjectTemperature
Syn-
tax
oDesign.SetObjectTemperature Array("NAME:Tem-
VB peratureSettings", "IncludeTemperatureDependence:=", _
Exa-
true, "EnableFeedback:=", true, "Temperatures:=", Array
mpl-
e
("RegularPolyhedron1", _
"22cel", "Polygon1", "22cel"))
SetPhaseCenterPerPort
Use: Sets phase center per port for an HFSS Modal antenna in preparation for link to a target
SBR+ design.
Command: Set Far-Field Phase Center...
SetPropValue [Design]
Sets the property value for the active property object.
Return Value True if the property is found and the new value is valid. Otherwise return False.
oDesign = oProject.GetChildObject(“TeeModel”)
Python oDesign.SetPropValue(“offset”, "12mm")
Example
oDesign.SetPropValue("Results/S Parameter Plot 1/Dis-
play Type", "Rectangular Plot")
VB Syntax SetPropValue(propPath)
set oDesign = oProject.GetChildObject(“TeeModel”)
oDesign.SetPropValue(“offset”, "0.1in")
VB Example
oDesign.SetPropValue("Results/S Parameter Plot 1/Dis-
play Type", "Rectangular Plot")
SetSinglePhaseCenter
Use: Sets a single phase center for an HFSS Modal antenna in preparation for link to a target
SBR+ design.
Command: Set Far-Field Phase Center...
Syntax: SetSinglePhaseCenter <"CSName">
Return Value: None.
Parameters: <CSName>
Type: <string>
Name of the coordinate system to set as the phase center.
VB Example:
Set oDesign = oProject.SetSinglePhaseCenter ("RelativeCS1")
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
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:
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")
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")
oModule.InsertSetup "Matrix", Array("NAME:Setup1",
"AdaptiveFreq:=", "1GHz", "SaveFields:=", _
true, "Enabled:=", true, Array("NAME:Cap",
"MaxPass:=", 10, "MinPass:=", 1, "MinConvPass:=", _
1, "PerError:=", 1, "PerRefine:=", 30,
"AutoIncreaseSolutionOrder:=", true, "SolutionOrder:=", _
"Normal"), Array("NAME:DC", "Residual:=",
Python 1E-005, "SolveResOnly:=", false, Array("NAME:Cond",
Examp- "MaxPass:=", _
le
10, "MinPass:=", 1, "MinConvPass:=", 1,
"PerError:=", 1, "PerRefine:=", 30), Array("NAME:Mult",
"MaxPass:=",
_
1, "MinPass:=", 1, "MinConvPass:=", 1,
"PerError:=", 1, "PerRefine:=", 30)), Array("NAME:AC",
"MaxPass:=",
_
10, "MinPass:=", 1, "MinConvPass:=", 1,
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: Validation Check, which validates the active design in the project.
Syntax: ValidateDesign(r"filePath", <Whether to clear the file, True or False>)
Return Value: 0 means the validation failed. 1 means passed.
Type: <string>
oProject = oDesktop.GetActiveProject()
Python
oDesign = oProject.GetActiveDesign()
Exampl-
e oDesign.ValidateDesign(r"C:/Users/agao/Desktop/f1.tmp",
True)
ValidateLink
Note:
This command is for internal ANSYS use only.
Python oDesign.ValidateLink()
Example
Assign Array
Use:Create an array based on a unit cell model.
Command:HFSS>Model>Create Array
Syntax:AssignArray <arrayParameters>
Return Value:None
Parameters:Array(NAME:<string>",
"Type:=", "Regular",
"Name:=", "<string>",
"UseAirObjects:=", <boolean>,
"RowMasterBnd:=", "Master<n>",
"ColumnMasterBnd:=", "Master<n>",
"RowDimension:=", <value>,
"ColumnDimension:=", <value>,
"PostProcessRow:=", <value>,
"PostProcessCol:=", <value>,
"Active:=", "All" | [<arraycoords>] |"None" )
Example:
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("terminalArray")
Set oDesign = oProject.SetActiveDesign("HFSSDesign")
Set oModule = oDesign.GetModule("ModelSetup")
oModule.AssignArray Array("NAME:A",
"Type:=", "Regular",
"Name:=", "A",
"UseAirObjects:=", true,
"RowMasterBnd:=", "Master1",
"ColumnMasterBnd:=", "Master2",
"RowDimension:=", 2,
"ColumnDimension:=", 2,
"PostProcessRow:=", 1,
"PostProcessCol:=", 1,
"Active:=", "All")
DeleteArray
Use: Delete an existing array based on a unit cell model.
Command: Delete
Syntax: DeleteArray
Return Value: None
Parameters: None
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("forcreatearraycube")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("ModelSetup")
oModule.DeleteArray
EditArray
To edit properties of an existing array.
Command: Properties
Syntax: EditArray <arrayParameters>
Return Value: None
Parameters: Array(NAME:<string>",
"NAME:A",
"Name:=", "<string>",
"UseAirObjects:=", <boolean>,
"RowMasterBnd:=", "Master<n>",
"ColumnMasterBnd:=", "Master<n>",
"RowDimension:=", <value>,
"ColumnDimension:=", <value>,
"PostProcessRow:=", <value>,
"PostProcessCol:=", <value>,
"Active:=", "All" | [<arraycoords>] |"None" )
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("PatchHexLattice")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
Set oModule = oDesign.GetModule("ModelSetup")
oModule.EditArray Array("NAME:A", "Name:=", "A", "UseAirObjects:=",
true, _
"RowMasterBnd:=", "PhasedArray1_1_Master1", "ColumnMasterBnd:=",
"PhasedArray1_1_Master2", _
"RowDimension:=", 4, "ColumnDimension:=", 3, _
"Visible:=", true, "RenderType:=", 0, "Padding:=", 0,
Array("NAME:Cells", _
"PhasedArray1_1:=", Array("[1,1], [1,2], [1,3], [3,2]")), _
Array("NAME:Rotation"), "Active:=", "[1,1], [1,2], [1,3], [3,2]", _
Array("NAME:PostProcessingCells", "PhasedArray1_1:=", Array("3",
"2")), _
"Colors:=", Array("PhasedArray1_1", "(128 128 255)"))
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
InsertNativeComponent
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>
"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.
CreateBox
Use: Creates a box primitive.
Command: Draw>Box
Syntax: CreateBox <BoxParametersArray>, <AttributesArray>
Return Value: The name of the newly created object.
Parameters: <BoxParametersArray>
Array("NAME:BoxParameters",
"XPosition:=", <value>,
"YPosition:=", <value>,
"ZPosition:=", <value>,
"XSize:=",<value>,
"YSize:=",<value>,
"ZSize:=",<value>)
VB Example:
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateBox Array("NAME:BoxParameters", _
"CoordinateSystemID:=", -1, "XPosition:=", _
"1mm", "YPosition:=", "1mm", "ZPosition:=", "0mm", _
"XSize:=", "1mm", "YSize:=", "1mm", "ZSize:=", "1mm"),_ Array
("NAME:Attributes", "Name:=", "Box1", "Flags:=", "", _
"Color:=", "(132 132 193)", "Transparency:=", 0, _
"PartCoordinateSystem:=", "Global", "MaterialName:=", _
"vacuum", "SolveInside:=", true)_
oEditor.DuplicateAlongLine Array("NAME:Selections",
"Selections:=", "Box1"), _
Array("NAME:DuplicateToAlongLineParameters",_
"CoordinateSystemID:=", -1, "CreateNewObjects:=", true, _
"XComponent:=", "1mm", "YComponent:=", "1mm", "ZComponent:=", _
"0mm", "NumClones:=", "2"), _
Array("NAME:Options", "DuplicateBoundaries:=", true)
tax
oEditor.CreateBox(
[
"NAME:BoxParameters",
"XPosition:=" , "0.4mm",
"YPosition:=" , "-1.4mm",
"ZPosition:=" , "0mm",
"XSize:=" , "0.4mm",
"YSize:=" , "0.4mm",
"ZSize:=" , "0.4mm"
],
[
Python "NAME:Attributes",
Example "Name:=" , "Box2",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"vacuum\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , True,
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False
])
CreateCircle
Use: Creates a circle primitive.
Command: Draw>Circle
Syntax: CreateCircle <CircleParametersArray>, <AttributesArray>
Return Value: The name of the newly created object.
Parameters: <CircleParametersArray>
Array("NAME:CircleParameters",
"XCenter:=", <value>,
"YCenter:=", <value>,
"ZCenter:=", <value>,
"Radius:=", <value>,
"WhichAxis:=", <string>
"NumSegments:=", "<integer>")
WhichAxis
Axis of normal vector to the circle. Possible values are: "X", "Y", "Z"
Example: "WhichAxis:=", "Z" means the circle will be drawn in the
XY plane.
oEditor.CreateCircle(
[
"NAME:CircleParameters",
"IsCovered:=" , True,
"XCenter:=" , "0mm",
"YCenter:=" , "0mm",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False
])
CreateCone
Use: Creates a cone primitive.
Command: Draw>Cone
Syntax: CreateCone <ConeParametersArray>, <AttributesArray>
Return Value: The name of the newly created object.
Parameters: <ConeParametersArray>
Array("NAME:ConeParameters",
"XCenter:=", <value>,
"YCenter:=", <value>,
"ZCenter:=", <value>,
"WhichAxis:=", <string>,
"Height:=", <value>,
"BottomRadius:=", <value>,
"TopRadius:=", <value>)
WhichAxis
Axis of the cone. Possible values are: "X", "Y", "Z"
Example: "WhichAxis:=", "Z"
oEditor.CreateCone(
[
"NAME:ConeParameters",
"XCenter:=" , "0mm",
"YCenter:=" , "0mm",
"ZCenter:=" , "0mm",
"WhichAxis:=" , "Z",
"Height:=" , "1mm",
"BottomRadius:=" , "0.282842712474619mm",
"TopRadius:=" , "0.565685424949238mm"
],
[
Python
"NAME:Attributes",
Example
"Name:=" , "Cone1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False
])
CreateCutplane
Use: Creates a cutplane. Only the name and color attributes from <AttributesArray> are sup-
ported.
Command: Draw>Plane
CreateCylinder
Use: Creates a cylinder primitive.
Command: Draw>Cylinder
Syntax: CreateCylinder <CylinderParametersArray>,
<AttributesArray>
Return Value: The name of the newly created object.
Parameters: <CylinderParametersArray>
Array("NAME:CylinderParameters",
"XCenter:=", <value>,
"YCenter:=", <value>,
"ZCenter:=", <value>,
"Radius:=", <value>,
"Height:=", <value>,
"WhichAxis:=", <string>
"NumSides:=", "<integer>")
WhichAxis
Axis of the cylinder. Possible values are: "X", "Y", "Z"
Example: "WhichAxis:=", "Z"
oEditor.CreateCylinder(
[
"NAME:CylinderParameters",
"XCenter:=" , "0mm",
"YCenter:=" , "-0.2mm",
"ZCenter:=" , "0mm",
"Radius:=" , "0.14142135623731mm",
"Height:=" , "0.3mm",
"WhichAxis:=" , "Z",
"NumSides:=" , "0"
],
[
Python
"NAME:Attributes",
Example
"Name:=" , "Cylinder1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False
])
CreateEllipse
Use: Creates an ellipse primitive.
Command: Draw>Ellipse
oEditor.CreateEllipse(
[
"NAME:EllipseParameters",
"IsCovered:=" , True,
"XCenter:=" , "0mm",
"YCenter:=" , "0mm",
"Name:=" , "Ellipse1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False
])
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",
"tEnd:=" , "6",
"NumOfPointsOnCurve:=" , "10",
Python "Version:=" , 1,
Example [
"NAME:PolylineXSection",
"XSectionType:=" , "None",
"XSectionOrient:=" , "Auto",
"XSectionWidth:=" , "0",
"XSectionTopWidth:=" , "0",
"XSectionHeight:=" , "0",
"XSectionNumSegments:=" , "0",
"XSectionBendType:=" , "Corner"]
],
[
"NAME:Attributes",
"Name:=" , "EquationCurve1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"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.
"UDMId:=", "",
"MaterialValue:=", ""
& Chr(34)
& "vacuum"
& Chr(34)
& "", "SolveInside:=", true)
VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project74")
Set oDesign = oProject.SetActiveDesign("HFSS1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateEquationSurface Array("NAME:Equa-
tionBasedSurfaceParameters", "XuvFunction:=", _
"_u", "YuvFunction:=", "_v", "ZuvFunction:=", "sin(_u)+cos(_v)",
"uStart:=", "1", "uEnd:=", _
"10", "vStart:=", "1", "vEnd:=", "10", "Version:=", 1), Array
("NAME:Attributes", "Name:=", _
"EquationSurface1", "Flags:=", "", "Color:=", "(143 175 143)",
"Transparency:=", _
0, "PartCoordinateSystem:=", "Global", "UDMId:=", "", "Mater-
ialValue:=", _
"" & Chr(34) & "vacuum" & Chr(34) & "", "SurfaceMaterialValue:=", ""
& Chr(34) & "" & Chr(34) & "", "SolveInside:=", _
oEditor.CreateEquationSurface(
[
"NAME:EquationBasedSurfaceParameters",
"XuvFunction:=" , "_u",
"YuvFunction:=" , "_v",
"ZuvFunction:=" , "sin(_u)+cos(_v)",
"uStart:=" , "1",
"uEnd:=" , "10",
"vStart:=" , "1",
"vEnd:=" , "10",
"Version:=" , 1
],
Python
[
Example
"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
Creates a point. Only the name and color attributes from <AttributesArray> are supported.
"PointY:=", <value>,
"PointZ:=", <value>)
AttributesArray Array Array("NAME:At-
tributes",
"Name:=", <value>,
"Color:=", <R G B>)
Return None
Value
oEditor.CreatePoint(
[
"NAME:PointParameters",
"PointX:=" , "0.2mm",
"PointY:=" , "-0.2mm",
Python "PointZ:=" , "0mm"
Example ],
[
"NAME:Attributes",
"Name:=" , "Point1",
"Color:=" , "(143 175 143)"
])
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",
Array("NAME:Pair", "Name:=", <string>, "Value:=", <value>)…)
oEditor.CreateUserDefinedPart [
(
Array("NAME:UserDefinedPrimitiveParameters",
"CoordinateSystemID:=", -1,
"DllName:=", "Examples/RectangularSpiral",
"NoOfParameters:=", 6, "Library:=", "syslib",
Array("NAME:ParamVector",
Array("NAME:Attributes", "Name:=",
"RectangularSpiral1",
"Flags:=", "",
CreatePolyline
Creates a polyline primitive.
Command: Draw>Polyline
Syntax: CreatePolyline <PolylineParametersArray>,
<AttributesArray>
Return Value: The name of the newly created object.
Parameters: <PolylineParametersArray>
Array("NAME:PolylineParameters",
"IsPolylineCovered:=", <bool>,
"IsPolylineClosed:=", <bool>,
<PolylinePointsArray>,
<PolylineSegmentsArray>)
<PolylinePointsArray>
Array("NAME:PolylinePoints", <OnePointArray>,
<OnePointArray>, ...)
<OnePointArray>
Array("NAME:PLPoint",
"X:=", <value>,
"Y:=", <value>,
"Z:=", <value>))
<PolylineSegmentsArray>
Array("NAME:PolylineSegments",
<OneSegmentArray>, <OneSegmentArray>, ...)
<OneSegmentArray>
Array("NAME:PLSegment",
"SegmentType:=", <string>,
"StartIndex:=", <value>,
"NoOfPoints:=", <value>)
SegmentType
Can be "Line", "Arc", "Spline", or "AngularArc"
Example:
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 oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreatePolyline Array("NAME:PolylineParameters",
"IsPolylineCovered:=", true,
"IsPolylineClosed:=", false,
Array("NAME:PolylinePoints",
oEditor.CreatePolyline(
Python
[
Example
"NAME:PolylineParameters",
"IsPolylineCovered:=" , True,
"IsPolylineClosed:=" , False,
[
"NAME:PolylinePoints",
[
"NAME:PLPoint",
"X:=" , "0.4mm",
"Y:=" , "-0.6mm",
"Z:=" , "0mm"
],
[
"NAME:PLPoint",
"X:=" , "0mm",
"Y:=" , "-0.4mm",
"Z:=" , "0mm"
]
],
[
"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:=" , "Polyline1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False
])
CreateRectangle
Use: Creates a rectangle primitive.
Command: Draw>Rectangle
Syntax: CreateRectangle <RectangleParametersArray>,
<AttributesArray>
Return Value: The name of the newly created object.
Parameters: <RectangleParametersArray>
Array("NAME:RectangleParameters",
"XStart:=", <value>,
"YStart:=", <value>,
"ZStart:=", <value>,
"Width:=", <value>,
"Height:=", <value>,
"WhichAxis:=", <string>)
WhichAxis
Axis of normal vector to the rectangle. Possible values are: "X", "Y", "Z"
Example: "WhichAxis:=", "Z" means the rectangle will be drawn in
the XY plane.
oEditor.CreateRectangle(
[
"NAME:RectangleParameters",
"IsCovered:=" , True,
"XStart:=" , "-0.2mm",
"YStart:=" , "-0.4mm",
"ZStart:=" , "0mm",
"Width:=" , "0.6mm",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", 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)
oEditor.CreateRegion(
[
("NAME:RegionParameters",
"+XPaddingType:=", "Absolute Offset",
"+XPadding:=", "1um",
"-XPaddingType:=", "Absolute Offset",
"-XPadding:=", "1um",
"+YPaddingType:=", "Absolute Offset",
"+YPadding:=", "1um",
"-YPaddingType:=", "Absolute Offset",
"-YPadding:=", "1um",
Python
Example "+ZPaddingType:=", "Absolute Offset",
"+ZPadding:=", "1um",
"-ZPaddingType:=", "Absolute Offset",
"-ZPadding:=", "1um"),
("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"
CreateRegularPolygon
Use: Creates a regular polygon primitive.
Command: Draw>RegularPolygon
NumSides
Specify a number greater than 2.
WhichAxis
Axis of normal vector to the polygon. Possible values are: "X", "Y", "Z"
Example: "WhichAxis:=", "Z" means the polygon will be drawn in the XY plane.
oEditor.CreateRegularPolygon(
[
"NAME:RegularPolygonParameters",
"YStart:=" , "0.8mm",
"ZStart:=" , "0mm",
"NumSides:=" , "12",
"WhichAxis:=" , "Z"
],
[
"NAME:Attributes",
"Name:=" , "Polygon1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False
])
CreateSphere
Use: Creates a sphere primitive.
Command: Draw>Sphere
Syntax: CreateSphere <SphereParametersArray>, <AttributesArray>
Return Value: The name of the newly created object.
Parameters: <SphereParametersArray>
Array("NAME:SphereParameters",
"XCenter:=", <value>,
"YCenter:=", <value>,
"ZCenter:=", <value>,
"Radius:=", <value>)
oEditor.CreateSphere(
[
"NAME:SphereParameters",
"XCenter:=" , "-0.1mm",
"YCenter:=" , "-0.4mm",
"ZCenter:=" , "0mm",
"Radius:=" , "0.223606797749979mm"
],
[
"NAME:Attributes",
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>)
CreateTorus
Use: Creates a torus primitive.
Command: Draw>Torus
Syntax: CreateTorus <TorusParametersArray>, <AttributesArray>
Return Value: The name of the newly created object.
Parameters: <TorusParametersArray>
Array("NAME:TorusParameters",
"XCenter:=", <value>,
"YCenter:=", <value>,
"ZCenter:=", <value>,
"MajorRadius:=", <value>,
"MinorRadius:=", <value>,
"WhichAxis:=", <string>)
WhichAxis
oEditor.CreateTorus(
[
"NAME:TorusParameters",
"XCenter:=" , "0mm",
"YCenter:=" , "-0.4mm",
"ZCenter:=" , "0mm",
"MajorRadius:=" , "0.182514076993644mm",
"MinorRadius:=" , "0.0410927207563347mm",
"WhichAxis:=" , "Z"
],
[
Python "NAME:Attributes",
Example "Name:=" , "Torus1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"copper\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , False,
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False
])
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
("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
oEditor.CreateUserDefinedModel [(
{Array("NAME:UserDefinedModelParameters",
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",
Array("NAME:Pair", "Name:=", <string>, "Value:=", <value>)…)
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",
("NAME:EditComponentParametersData",
"NewComponentName:=",
Python
Example " Connector2",
"GeometryParameters:=", "",
"MaterialParameters:=", "",
"DesignParameters:=", "",
("NAME:Component Meshing",
"MeshAssembly:=", false),
("NAME:Excitations",
"Suppressed:=", Array()))
])
EditNativeComponentDefinition
Edit Link from HFSS Modal antenna design to SBR+ design as a component.
Command: Edit Definition
Syntax: EditNativeComponentDefinition <LinkParameters>
Return Value: None
Parameters: <LinkParametersData>
Data of the 3D component
VB Example:
oEditor.EditNativeComponentDefinition Array("NAME:EditNat-
iveComponentData",
"TargetCS:=", "Global",
"UniqueDefinitionIdentifier:=", "cf3021fd-fca4-4428-a045-fed-
c60b9d040",
"OriginFilePath:=", "",
"IsLocal:=", false,
"ChecksumString:=", "",
"ChecksumHistory:=", Array(),
"VersionHistory:=", Array(),
Array("NAME:NativeComponentDefinitionProvider", "Type:=", "Linked
Antenna", _
"Unit:=", "mm", "Project:=", "HornElliptical_ATK1.aedt",
"Product:=", "HFSS", "Design:=", "HornElliptical_ATK",
"Soln:=", "ATK_Solution : FF_Sweep",
Array("NAME:Params", "Horn_length:=", "2.36in", _
"Horn_radius:=", "1.65in", "Ratio:=", "0.6",
"WG_Wall_Thickness:=", "0.024in", "WG_length:=", "1.18in", "WG_radi-
us:=", "0.59in"),
"ForceSourceToSolve:=", false, "PreservePartnerSoln:=", false,
"PathRelativeTo:=", "TargetProject", "FieldType:=", "farfield"),
oEditor.EditNativeComponentDefinitionData(
[
"NAME:EditNativeComponentData",
"TargetCS:=" , "Global",
"UniqueDefinitionIdentifier:=", "c05a4b88-aaef-4e97-
a746-ecf27ab5adf1",
"OriginFilePath:=" , "",
"IsLocal:=" , False,
"ChecksumString:=" , "",
Python "ChecksumHistory:=" , [],
Example
"VersionHistory:=" , [],
[
"NAME:NativeComponentDefinitionProvider",
"Type:=" , "Linked Antenna",
"Unit:=" , "mm",
"Project:=" , "This Project*",
"Product:=" , "HFSS",
"Design:=" , "Source1",
"Soln:=" , "fc : LastAdaptive",
[
"NAME:Params",
"imp:=" , "60ohm"
],
"ForceSourceToSolve:=" , False,
"PreservePartnerSoln:=" , False,
"PathRelativeTo:=" , "TargetProject",
"FieldType:=" , "farfield",
[
"NAME:SourceBlockageStructure",
"ModelObject:=" , ["bowtie"],
"NonModelObject:=" , ["Cylinder1","Perfect Con-
ductor"]
]
],
"SubmodelDefinitionName:=", "Antenna2",
[
"NAME:ComponentPriorityLists"
],
[
"NAME:BasicComponentInfo",
"ComponentName:=" , "Antenna2",
"Company:=" , "",
"Company URL:=" , "",
"Model Number:=" , "",
"Help URL:=" , "",
"Version:=" , "1.0",
"Notes:=" , "",
"IconType:=" , "Linked Antenna"
]
])
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
Name of the polyline to modify. The name should be formatted as
"<PolylineName>:CreatePolyline:1".
Example: "Selections:=", "Polyline1:CreatePolyline:1"
Get3DComponentParameters
Use:Get parameters of 3D components
Command:none
Syntax:Get3DComponentParameters <Component Name>
Return Value:An array of component parameters.
Parameters:<Component Name>
Name of the 3D component
VB Example:
Dim paras
paras = oEditor.Get3DComponentParameters("Connector")
Python 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")
])
InsertNativeComponent
Link from HFSS Modal antenna design to SBR+ design as a component.
Command: Create Antenna>Link to Source Design...
Syntax: InsertNativeComponentData <LinkParameters>
Return Value: None
Parameters: <LinkParametersData>
Data of the 3D component
VB Example:
oEditor.InsertNativeComponent Array("NAME:In-
sertNativeComponentData", "TargetCS:=", "Radar_CS",
"UniqueDefinitionIdentifier:=", "cc9025bd-6de1-4291-8740-
0e38f796e83d",
"OriginFilePath:=", "", "IsLocal:=", false,
"ChecksumString:=", "", "ChecksumHistory:=", Array(), "Ver-
sionHistory:=", Array(),
Array("NAME:NativeComponentDefinitionProvider", "Type:=", "Linked
Antenna", "Unit:=", "meter", "Project:=", "Dipole_twoplates.aedt",
"Product:=", "HFSS", "Design:=", "SBR_Dipole_PEC3", "Soln:=",
"Setup1 : LastAdaptive",
Array("NAME:Params", "gap:=", "0.1mm", "lambda2Ghz:=", "0.074948-
meter"),
"ForceSourceToSolve:=", false,
"PreservePartnerSoln:=", false,
"PathRelativeTo:=", "TargetProject",
"FieldType:=", "nearfield",
Array("NAME:SourceBlockageStructure", "NonModelObject:=", Array()),
"UseGlobalCurrentSrcOption:=", _false,
"Current Source Conformance:=", "Enable", "Thin Sources:=", true,
"Power Fraction:=", "0.95"),
"SubmodelDefinitionName:=", "Antenna2", Array("NAME:Com-
ponentPriorityLists"),
oEditor.InsertNativeComponent(
[
"NAME:InsertNativeComponentData", "TargetCS:=" ,
"Radar_CS",
"UniqueDefinitionIdentifier:=", "e7557a6b-d552-46e9-
b085-ffd1a6a38a31",
"OriginFilePath:=" , "",
"IsLocal:=" , False, "ChecksumString:=" , "",
"ChecksumHistory:=" , [],
"VersionHistory:=" , [],
[ "NAME:NativeComponentDefinitionProvider",
"Type:=" , "Linked Antenna",
Python
"Unit:=" , "meter",
Example
"Project:=" , "Dipole_twoplates.aedt",
"Product:=" , "HFSS",
"Design:=" , "SBR_Dipole_PEC3",
"Soln:=" , "Setup1 : LastAdaptive", [ "NAME:Params",
"gap:=" , "0.1mm", "lambda2Ghz:=" , "0.074948meter" ],
"ForceSourceToSolve:=" , False,
"PreservePartnerSoln:=" , False,
"PathRelativeTo:=" , "TargetProject",
"FieldType:=" , "nearfield", [ "NAME:SourceB-
lockageStructure", "NonModelObject:=" , [] ],
"UseGlobalCurrentSrcOption:=", False,
"Current Source Conformance:=", "Enable",
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
Sweeps the specified 1D or 2D parts along a path. The last 1D object specified is the path for the
sweep.
Return None
Value
oEditor.SweepAlongPath(
[
"NAME:Selections",
"Selections:=" , "Rectangle1,Polyline1",
"NewPartsModelFlag:=" , "Model"
],
Python
[
Example
"NAME:PathSweepParameters",
"DraftAngle:=" , "0deg",
"DraftType:=" , "Round",
"CheckFaceFaceIntersection:=", False,
"TwistAngle:=" , "0deg"
])
VB Array("NAME:PathSweepParameters", _
Example "DraftAngle:=", "0deg",_
"DraftType:=", "Round",_
"CheckFaceFaceIntersection:=", False,_
"TwistAngle:=", "30deg")
SweepAlongVector
Sweeps the specified 1D or 2D parts along a vector.
Return None
Value
oEditor.SweepAlongVector(
[
"NAME:Selections",
"Selections:=" , "Rectangle1",
"CheckFaceFaceIntersection:=", False,
"SweepVectorX:=" , "0mm"
"SweepVectorY:=" , "0mm"
"SweepVectorX:=" , "12mm"
])
SweepAroundAxis
Sweeps the specified 1D or 2D parts around an axis.
"SweepAngle:=", <value>
"NumOfSegments:=", <value>)
Possible values for DraftType are "Exten-
ded", "Round", and "Natural"
Possible values for SweepAxis are "X", "Y",
and "Z"
Return None
Value
oEditor.SweepAroundAxis(
[
"NAME:Selections",
"Selections:=" , "Rectangle1",
"NewPartsModelFlag:=" , "Model"
],
[
Python
"NAME:AxisSweepParameters",
Example
"DraftAngle:=" , "0deg",
"DraftType:=" , "Round",
"CheckFaceFaceIntersection:=", False,
"SweepAxis:=" , "X"
"SweepAngle:=" , "360deg"
"NumOfSegments:=" , "12"
])
VB oEditor.SweepAroundAxis
Example Array("NAME:Selections",_
"Selections:=", "Rectangle1",_
"NewPartsModelFlag:=" , "Model")
Array("NAME:AxisSweepParameters", _
"DraftAngle:=", "0deg",_
"DraftType:=", "Round",_
"CheckFaceFaceIntersection:=", False,_
"SweepAxis:=" , "X",_
"SweepAngle:=" , "360deg",_
"NumOfSegments:=" , "12")
SweepFacesAlongNormal
Sweep a face along normal.
Return None
Value
oEditor.SweepFacesAlongNormal(
Python
[
Example
"NAME:Selections",
"Selections:=" , "Rectangle1",
"NewPartsModelFlag:=" , "Model"
],
[
"NAME:Parameters",
[
"NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=" , [183],
"LengthOfSweep:=" , "0.1mm"
]
])
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)
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("", ""))
oEditor.UpdateComponentDefinition
([
Array("NAME:UpdateDefinitionData",
Python "DefinitionNames:=", " Connector, Magic_Tee",
Example "Passwords:=",
Array("", ""))
])
Scale
Copy
Use: Copies specified parts
Command: Edit>Copy
Syntax: Copy <SelectionsArray>
Return Value: None
DeletePolylinePoint
Use: Deletes either a start or end point from an existing polyline segment.
Command: Edit>Delete Start Point
Edit>Delete End Point
Syntax: DeletePolylinePoint <DeletePointArray>
Return Value: None
Parameters: <DeletePointArray>
Array("Name:Delete Point",
"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.
ZComponent <value>
NumClones <value> Specify a number greater than
1.
Options <Array>
<DupBoundaries> <Array>
DuplicateBoundaries <bool> True or False
DuplicateAroundAxis
Duplicates specified parts around an axis.
[
"NAME:Selections",
"Selections:=" , "Rectangle1",
"NewPartsModelFlag:=" , "Model"
],
[
"NAME:DuplicateAroundAxisParameters",
"CreateNewObjects:=" , False,
"WhichAxis:=" , "Z",
Example "AngleStr:=" , "90deg",
"NumClones:=" , "2"
],
[
"NAME:Options",
"DuplicateAssignments:=", False
],
[
"CreateGroupsForNewObjects:=", False
])
VB Array("NAME:DuplicateAroundAxisParameters", _
Example "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)
DuplicateMirror
Duplicate specified parts according to a mirror plane.
oEditor.DuplicateMirror(
[
"NAME:Selections",
"DuplicateMirrorBaseX:=", "0mm",
"DuplicateMirrorBaseY:=", "0.7mm",
"DuplicateMirrorBaseZ:=", "0mm",
"DuplicateMirrorNormalX:=", "1mm",
"DuplicateMirrorNormalY:=", "0mm",
"DuplicateMirrorNormalZ:=", "0mm"
],
[
"NAME:Options",
"DuplicateAssignments:=", False
],
[
"CreateGroupsForNewObjects:=", False
])
oEditor.DuplicateMirror Array("NAME:Selections", _
"Selections:=", "Box1", _
"NewPartsModelFlag:=", "Model"), _
Array("NAME:DuplicateToMirrorParameters", _
"DuplicateMirrorBaseX:=", "0mm", _
"DuplicateMirrorBaseY:=", "0mm", _
VB
Exampl- "DuplicateMirrorBaseZ:=", "0mm", _
e
"DuplicateMirrorNormalX:=", "0mm", _
"DuplicateMirrorNormalY:=", "-1mm", _
"DuplicateMirrorNormalZ:=", "0mm"), _
Array("NAME:Options", "DuplicateBoundaries:=", false)
(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>)
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")
oEditor.Mirror(
[
("NAME:Selections",
"Selections:=","Box1",
"NewPartsModelFlag:=", "Model"),
Python ("NAME:MirrorParameters",
Example "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>
Python oEditor.Rotate (
Example
[
"NAME:Selections",
"Selections:=",
["CompInst@R;2;4", "CompInst@C;1;1"
]
],
["NAME:RotateParameters",
"Degrees:=", 90,
"Disconnect:=", false,
"Rubberband:=", false
])
Scale
Use: Scales specified parts.
Command: Edit>Scale
Syntax: Scale <SelectionsArray>, <ScaleParametersArray>
Return Value: None
Parameters: <ScaleParametersArray>
Array("NAME:ScaleParameters",
"ScaleX:=", <value>,
"ScaleY:=", <value>,
"ScaleZ:=", <value>)
(For Maxwell 2D XY Designs, "ScaleZ:=" should be set to "0".)
(For Maxwell 2D RZ Designs, "ScaleY:=" should be set to "0".)
CreateFaceCS
CreateGroup
CreateObjectCS
CreateObjectFromEdges
CreateObjectFromFaces
CreateRelativeCS
DeleteEmptyGroups
DeleteLastOperation
DetachFaces
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
Python
([
Example
Array("NAME:Selections", "Selections:=", "Polygon1"),
Array("NAME:Attributes", _
"MaterialName:=", "tungsten",_
"SolveInside:=", false)
])
Chamfer
Use: Creates a chamfer.
Command: Modeler>Chamfer
Syntax: Chamfer (<ObjectName> <ChamferParameters>)
Return Value: None
Parameters: <ObjectName>
Array("NAME:Selections", _
"Selections:=", <string>),
<ChamferParameters>
Array("NAME:Parameters", _
Array("NAME:ChamferParameters", _
"CoordinateSystemID:=", <value>,
"Edges:=", <ArrayOfEdgeIDs>,
"LeftRange:=", <value>))
VB Example:
oEditor.Chamfer Array("Name:Selections", _
"Selections:=", "Box1"), Array("NAME:Parameters", _ Array("NAME:Cham-
ferParameters", _
"CoordinateSystemID:=", -1, _
"Edges:=", Array(13), "LeftRange:=", "1mm"))
tax
oEditor.Chamfer
([
Pyt-
hon
Array("Name:Selections", "Selections:=", "Box1"),
Exa- Array("NAME:Parameters",
mpl-
e Array("NAME:ChamferParameters", "CoordinateSystemID:=", -1,
"Edges:=", Array(13), "LeftRange:=", "1mm"))
])
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>
VBS Example: This example first creates a box and cylinder, and then
displays Entity lists.
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.NewProject
oProject.InsertDesign "HFSS", "HFSSDesign1", "DrivenTerminal", ""
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateBox Array("NAME:BoxParameters", "XPosition:=", "-
1.1mm", "YPosition:=", _
"-0.8mm", "ZPosition:=", "0mm", "XSize:=", "0.3mm", "YSize:=",
"0.5mm", "ZSize:=", _
"0.4mm"), Array("NAME:Attributes", "Name:=", "Box1", "Flags:=", "",
"Color:=", _
"(143 175 143)", "Transparency:=", 0, "PartCoordinateSystem:=",
"Global", "UDMId:=", _
"", "MaterialValue:=", "" & Chr(34) & "vacuum" & Chr(34) & "", "Sur-
faceMaterialValue:=", _
"" & Chr(34) & "" & Chr(34) & "", "SolveInside:=", true, "IsMa-
terialEditable:=", _
true, "UseMaterialAppearance:=", false, "IsLightweight:=", false)
oEditor.CreateCylinder Array("NAME:CylinderParameters", "XCenter:=",
"0.4mm", "YCenter:=", _
"0.7mm", "ZCenter:=", "0mm", "Radius:=", "0.282842712474619mm",
"Height:=", _
"0.6mm", "WhichAxis:=", "Z", "NumSides:=", "0"), Array("NAME:At-
tributes", "Name:=", _
"Cylinder1", "Flags:=", "", "Color:=", "(143 175 143)", "Trans-
parency:=", 0, "PartCoordinateSystem:=", _
"Global", "UDMId:=", "", "MaterialValue:=", "" & Chr(34) & "vacuum"
& Chr(34) & "", "SurfaceMaterialValue:=", _
"" & Chr(34) & "" & Chr(34) & "", "SolveInside:=", true, "IsMa-
terialEditable:=", _
true, "UseMaterialAppearance:=", false, "IsLightweight:=", false)
Dim oObjectList
oObjectList = oEditor.CreateEntityList(Array("NAME:Geo-
metryEntityListParameters", "EntityType:=", _
"Object", "EntityList:=", "Box1, Cylinder1"), Array("NAME:At-
tributes", "Name:=", _
"Objectlist1"))
MsgBox(oObjectList)
Dim oObjectID
oObjectID = oEditor.GetEntityListIDByName(oObjectList)
MsgBox(oObjectID)
Dim oFaceList
oFaceList = oEditor.CreateEntityList(Array("NAME:Geo-
metryEntityListParameters", "EntityType:=", _
"Face", "EntityList:=", Array(12, 35)), Array("NAME:Attributes",
"Name:=", _
"Facelist1"))
MsgBox(oFaceList)
Dim oFaceID
oFaceID = oEditor.GetEntityListIDByName(oFaceList)
MsgBox(oFaceID)
oProject = oDesktop.GetActiveProject()
oDesign = oProject.GetActiveDesign()
oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateBox(
[
"NAME:BoxParameters",
"XPosition:=" , "-0.5mm",
"YPosition:=" , "-0.8mm",
"ZPosition:=" , "0mm",
"XSize:=" , "1.6mm",
"YSize:=" , "2mm",
"ZSize:=" , "2.3mm"
Python ],
Example [
"NAME:Attributes",
"Name:=" , "Box1",
"Flags:=" , "",
"Color:=" , "(143 175 143)",
"Transparency:=" , 0,
"PartCoordinateSystem:=", "Global",
"UDMId:=" , "",
"MaterialValue:=" , "\"vacuum\"",
"SurfaceMaterialValue:=", "\"\"",
"SolveInside:=" , True,
"IsMaterialEditable:=" , True,
"UseMaterialAppearance:=", False,
"IsLightweight:=" , False
])
list_name = oEditor.CreateEntityList(
[
"NAME:GeometryEntityListParameters",
"EntityType:=" , "Face",
"EntityList:=" , [int(id) for id in oEd-
itor.GetFaceIDs("Box1")]
],
[
"NAME:Attributes",
"Name:=" , "Facelist1"
])
print(list_name)
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
Creates a group from specified objects in the history tree.
Return None.
Value
oEditor.CreateGroup(
Pytho- ["NAME:GroupParameter", "ParentGroupID:=", "Model",
n
Examp- "Parts:=", "Box1,Box2,Box3", "SubmodelInstances:=", "",
le "Groups:=", ""]
)
VB CreateGroup <group>
Syn-
tax
VB Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
Exam-
ple oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project44")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateGroup Array("NAME:GroupParameter", "Par-
entGroupID:=", "Model", _
"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
Python 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",
Example "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
Creates a polyline from the specified object edge.
<BodyFromEdgeToParameters> Array of
Integers
<Edges> Identifying numbers
for selected edges
<CreateGroupsForNewObjects> Boolean True to create groups
for new objects. False
to not create groups
for new objects.
Return None
Value
CreateObjectFromEdges ([
Python Syn- <SelectionsArray>,
tax
<ObjFromEdgeParametersArray>
])
oEditor.CreateObjectFromEdges(
[
"NAME:Selections",
"Selections:=" , "Rectangle1",
"NewPartsModelFlag:=" , "Model"
],
[
Python "NAME:Parameters",
Example [
"NAME:BodyFromEdgeToParameters",
"Edges:=" , [72]
]
],
[
"CreateGroupsForNewObjects:=", False
])
oEditor.CreateEdgeFromEdges _
Array("NAME:Selections", "Selections:=", "Box1"),_
VB Array("NAME:Parameters", _
Example Array("NAME:BodyFromEdgeToParameters", _
"CoordinateSystemID:=", -1, _
"Edges:=", Array(13)))
CreateObjectFromFaces
Creates 2D objects from the specified faces.
Return None
Value
CreateObjectFromFaces ([
Python Syn- <SelectionsArray>,
tax
<ObjFromFaceParametersArray>
])
Python oEditor.CreateObjectFromFaces (
Example [
"NAME:Selections",
"Selections:=" , "Rectangle1",
"NewPartsModelFlag:=" , "Model"
],
[
"NAME:Parameters",
[
"NAME:BodyFromFaceToParameters",
"FacesToDetach:=" , [78]
]
],
[
"CreateGroupsForNewObjects:=", False
])
oEditor.CreateObjectFromFaces _
Array("NAME:Selections", "Selections:=", "Box1"),_
VB
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
"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. You can also specify an orientation, either a default ori-
entation name, or a custom orientation that you have defined in the desktop.
Command: Modeler>Export...
Syntax: ExportModelImageToFile "<path>/<imageName>.<formatsuffix>" 0,0, Array
(<SaveImageParams>)
Return Value: None
Parameters: <path>
<imagename>
<formatsuffix>, You can export the following graphics formats:
Extension Contents
.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>",
Whether to show the Axis in the image.
"ShowGrid:=", "<Boolean>",
Whether to show the Grid in the image.
"ShowRuler:=", "<Boolean>"
Whether to show the Ruler in the image.
"ShowRegions:=", "<Default>",
Whether to show regions in the image.
"Selections:=" ,""
Selected object names.
"Orientation:=", "<OrientationName>")
The name of the Orientation to use. One of top, bottom, right, left, front, back trimetric,
dimetric, isometric, or a custom orientation that you added to the Orientation List using
View>Modify Attributes>Add Orientation... command in the ANSYS Electronics
Desktop.
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("dra_diel")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.ExportModelImageToFile _
"C:/MyPath/Downloads/dra_example.jpg", 0, 0,
Array("NAME:SaveImageParams", "ShowAxis:=", _
"Default", "ShowGrid:=", "Default", "ShowRuler:=", "Default" , "Ori-
entation:=", "Trimetric")
oEditor.ExportModelImageToFile
Python ("C:/Users/MyName/Documents/highresexample_image.jpg",
Example 7680, 4320,
using High [
Resolution "NAME:SaveImageParams",
settings. "ShowAxis:=" , "True",
"ShowGrid:=" , "True",
"ShowRuler:=" , "True",
"ShowRegion:=" ,
"Default",
"Selections:=" , ""
"Orientation:=" , "Trimetric"
])
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"))
Python oEditor.Fillet
Exampl-
([
Array("Name:Selections", "Selections:=",
_
"Box1"), Array("NAME:Parameters", Array("NAME:Fil-
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")
"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"),
Python Array("NAME:ObjectHealingParameters",
Example "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)
])
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")
])
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
Syntax: ImportDXF <ImportParametersArray>
Return Value: None
Parameters: <ImportParametersArray>
Array("NAME:options",
"FileName:=", <path>,
"Scale:=", <real>,
"UnionOverlapping:=", <boolean>,
"AutoDetectClosed:=", <boolean>,
"SelfStitch:=", <boolean>,
"DefeatureGeometry:=", <boolean>,
"DefeatureDistance:=", <real>,
"RoundCoordinates:=", <boolean>,
"RoundNumDigits:=", <integer>,
"WritePolyWithWidthAsFilledPoly:=", <boolean>,
"ImportMethod:=", <integer>,
"2DSheetBodies:=", <boolean>,
Array("NAME:LayerInfo",
Array("NAME:<layerName>",
"source:=", "<integer>",
"display_source:=", "<integer>",
"import:=", <boolean>,
"dest:=", "<integer>",
"dest_selected:=", <boolean>,
"layer_type:=", "<string>",
"paint:=", <boolean>),
Array("NAME:TechFileLayers", "layer:=",
Array("name:=", "ground",
"color:=", "purple",
"elev:=", 0,
"thick:=", 0.0001),
)))
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),
)))
])
"FlattenHierarchy:=", <boolean>,
"ImportMethod:=", <integer>,
Array("NAME:LayerMap",
Array("NAME:LayerMapInfo",
"LayerNum:=", <integer>,
"Import:=", <booleaninteger>,
"IsVIA:=", <booleaninteger>,
"IsLayerNew:=", <booleanInteger>,
"DestLayer:=", "<string>",
"layer_type:=", "<string>",
"IsPresentInLayout:=", <boolean>),
"OrderMap:=", Array("entry:=",
Array("order:=", <integer>,
"layer:=", "<string>"),
"entry:=", Array("order:=",
<integer>, "layer:=", "Signal25"),
"entry:=", Array("order:=", <integer+1>,
"layer:=", "Signal30"),
...),
Array("NAME:Structs",
Array("NAME:GDSIIStruct", "ImportStruct:=", <boolean>,
"CreateNewCell:=", <boolean>,
"StructName:=", "string>",
Array("NAME:Elements")),
Array("NAME:GDSIIStruct", "ImportStruct:=",<boolean>,
"CreateNewCell:=", <boolean>,
"StructName:=", "<string>",
Array("NAME:Elements"))))
oEditor.Import Array("NAME:NativeBodyParameters",
"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.
VB MoveCStoEnd <objectCSname>
Syntax
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
VB
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Exam-
ple Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("coax_bend")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.MoveCSToEnd Array("NAME:Selections", "Selections:=",
"ObjectCS1")
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.
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.MoveEntityToGroup Array("Groups:=", Array("Box_Group1")), _
Array("ParentGroup:=", "Box_Group")
MoveFaces
Moves the specified faces along normal or along a vector.
"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 is an array of integers
(the IDs of the faces to move)
Return None
Value
oEditor.MoveFaces(
[
"NAME:Selections",
"Selections:=" , "Rectangle1",
"NewPartsModelFlag:=" , "Model"
],
[
"NAME:Parameters",
Python [
Example "NAME:MoveFacesParameters",
"MoveAlongNormalFlag:=" , True,
"OffsetDistance:=" , "1mm",
"MoveVectorX:=" , "0mm",
"MoveVectorY:=" , "0mm",
"MoveVectorZ:=" , "0mm",
"FacesToMove:=" , [183]
]
])
ProjectSheet
Project HFSS sheet object, typically for modeling thin conformal deposits. Typically followed by
Thicken Sheet.
Return None.
Value
Syntax
oEditor.ProjectSheet(
Python ['NAME:Selections','Selections:=','Box1,Box2,Polyline1'],
Example ['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
Command: Replace with 3D Component
Syntax: ReplaceWith3DComponent <Geometry Data>, <Design Data>, <File Name>, <Image
File>
Return Value: None
Parameters: < Geometry Data>
Geometry data
< Design Data>
Design data
< File Name>
File name of 3D component
< Image File>
File name of 3D component image
VB Example:
oEditor.ReplaceWith3DComponent Array("NAME:CreateData", "Com-
ponentName:=", _
"ConnectorOnly_wBCs", "Company:=", "", "Company URL:=", "", "Model
Number:=", "", "Help URL:=", _
"", "Version:=", "1.0", "Notes:=", "", "IconType:=", "", "Own-
er:=", _
"Notes:=" , "",
"IconType:=" , "",
"Owner:=" , "Emily",
"Email:=" , "[email protected]",
"Date:=" , "3:46:31 PM Dec 26, 2018",
"HasLabel:=" , False,
"IncludedParts:=" , ["out-
er","teflon","inner","teflon_1"],
"HiddenParts:=" , [],
"IncludedCS:=" , [],
"ReferenceCS:=" , "Global",
"IncludedParameters:=" , ["bend_angle"],
"ParameterDescription:=", [ "bend_angle:=" , ""]
],
[
"NAME:DesignData",
"Excitations:=" , ["1","2"]
],
[
"NAME:ImageFile",
"ImageFile:=" , ""
])
Section
Use: Creates a 2D cross-section of the selection in the specified plane.
Command: Modeler>Surface>Section
Syntax: Section <SelectionsArray>, <SectionParametersArray>
Return Value: None
Parameters: <SectionParametersArray>
Array("NAME:SectionToParameters",
"SectionPlane:=", <string>)
Section Plane
Possible values are "XY", "YZ", "ZX"
SeparateBody
Use: Separates bodies of specified multi-lump objects.
Command: Modeler>Boolean>Separate Bodies
Syntax: SeparateBody <SelectionsArray>
Return Value: None
Parameters: <SelectionsArray>
Selections:=",<objectNames>"
"NewPartsModelFlag:=", ["Model" | "NonModel"]
Indicates the type of model properties in the geometry - Model or Non Model.
VB Example:
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.SeparateBody Array("NAME:Selections",
"Selections:=", "Rectangle1,Circle1",
"NewPartsModelFlag:=", "Model")
oEditor.SeparateBody
([
Python Array("NAME:Selections",
Example "Selections:=", "Rectangle1,Circle1",
"NewPartsModelFlag:=", "Model")
])
SetModelUnits
Use: Sets the model units.
Command: Modeler>Units
Syntax: SetModelUnits <ModelUnitsParametersArray>
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
Possible values are "XY", "YZ", "ZX"
Possible values for 2D XY Designs are "YZ", "ZX".
Possible values for 2D RZ Designs are "XY", "YZ".
WhichSide
Side to keep. Possible values are "Both", "PositiveOnly", "NegativeOnly"
Subtract
Use: Subtracts specified objects.
Command: Modeler->Boolean->Subtract
Syntax: Subtract <SubtractSelectionsArray>,
<SubtractParametersArray>
Return Value: None
Parameters: <SubtractSelectionsArray>
Array("NAME:Selections",
"Blank Parts:=", <string>,
"Tool Parts:=", <string>)
Blank Parts
Comma-separated list of parts to use as the blank in the subtract operation.
Example: "Blank Parts:=", "Box1, Box2"
Tool Parts
Comma-separated list of parts to use as the tool in the subtract operation.
Example: "Blank Parts:=", "Box3, Box4"
<SubtractParametersArray>
Array("NAME:SubtractParameters",
"KeepOriginals:=", <bool>)
VB Example:
oEditor.Subtract _
Array("NAME:Selections", _
"Blank Parts:=", "Polygon1",_
"Tool Parts:=", "Box1"),_
Array("NAME:SubtractParameters", _
"KeepOriginals:=", false)
oEditor.Subtract(
[
("NAME:Selections",
"Blank Parts:=", "Polygon1",
Python
"Tool Parts:=", "Box1"),
Example
("NAME:SubtractParameters",
"KeepOriginals:=", false)
])
SweepFacesAlongNormal
Sweep a face along normal.
Return None
Value
oEditor.SweepFacesAlongNormal(
[
"NAME:Selections",
"Selections:=" , "Rectangle1",
"NewPartsModelFlag:=" , "Model"
],
Python [
Example "NAME:Parameters",
[
"NAME:SweepFaceAlongNormalToParameters",
"FacesToDetach:=" , [183],
"LengthOfSweep:=" , "0.1mm"
]
])
ThickenSheet
Thicken a sheet object to convert it to a 3D object.
oEditor.ThickenSheet(
[
Python "NAME:Selections",
Example
"Selections:=" , "Box1_ObjectFromFace1",
"NewPartsModelFlag:=" , "Model"
],
[
"NAME:SheetThickenParameters",
"Thickness:=" , "0.01mm",
"BothSides:=" , True
])
UncoverFaces
Uncovers specified faces.
Command: Modeler>Surface>Uncover Faces
Syntax: UncoverFaces <SelectionsArray>, <UncoverParametersArray>
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.
oEditor.UncoverFaces(
[
"NAME:Selections",
"Selections:=" , "Box1_ObjectFromFace1",
"NewPartsModelFlag:=" , "Model"
],
Python
Example
[
"NAME:Parameters",
[
"NAME:UncoverFacesParameters",
"FacesToUncover:=" , [39]
]
])
VB Array("NAME:Parameters", _
Example 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>)
Ungroup
Ungroups a specified history tree group.
Python Ungroup()
Syntax
oEditor.Ungroup(
Python [
Example
"Groups:=" , ["armature_Group","Group1"]
])
VB Syn- Ungroup
tax
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
VB
Dim oEditor
Example
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
WrapSheet
Wraps a sheet object to another object.
UI Access None.
Return None.
Value
oEditor.WrapSheet(
Dim oAnsoftApp
Dim oDesktop
VB Dim oProject
Examp-
le Dim oDesign
Dim oEditor
Dim oModule
GetObjectIDByName
GetObjectName
GetObjectNameByFaceID
GetObjectsByMaterial
GetObjectsInGroup
GetMatchedObjectName
GetModelUnits
GetNumObjects
GetPropNames [Modeler]
GetSelections
GetVertexIDsFromEdge
GetVertexIDsFromFace
GetVertexIDsFromObject
GetVertexPosition
GetUserPosition
OpenExternalEditor
PageSetup
RenamePart
SetPropValue [Modeler]
AddViewOrientation
Creates a new orientation using a script. The command you to use predefined view names or cre-
ate a user defined View Orientation that supports the Orientation parameter for the
ExportModelImageToFile script command. Parameters can be in either Vector or Input angle
format, as shown in the Update View Orientation dialog accessed by the View>Modify Attrib-
utes>Orientation List... command.
Py- [
th- "NAME:VectorComponents",
on
Ex- [
a-
m- "NAME:Direction",
pl-
e -0.726043283939362,
-0.214442044496536,
-0.653357207775116
],
[
"NAME:Up",
-0.620335400104523,
-0.205735266208649,
0.75687313079834
]
]
BreakUDMConnection
Break a current UDM connection to SpaceClaim.
Return Value
oEditor.BreakUDMConnection(
[
Python
"NAME:Selections",
Example
"Selections:=" , "SpaceClaim1"
])
VB oEditor.BreakUDMConnection Array("NAME:Selections",
Example "Selections:=", "")
ChangeProperty
Change the properties used to create an object in the history tree
Command: Select a command in the History Tree and select Properties.
Syntax: ChangeProperty <array>
Return Value: None
Parameters: Varies, depending on the properties associated with the
select object command.
Example:
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 oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:Geo-
metry3DCmdTab",
Array("NAME:PropServers", "Polyline2:CreatePolyline:1"), Array
("NAME:ChangedProps",
Array("NAME:Type", "Value:=", "Isosceles Trapezoid"), Array
("NAME:Width/Diameter", "Value:=", "0.1mm"),
Array("NAME:Top Width", "Value:=", "0.05mm"),
Array("NAME:Height", "Value:=", "0.02mm"))))
oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:Geo-
metry3DCmdTab", Array("NAME:PropServers",
"Polyline2:CreatePolyline:1"),
Array("NAME:ChangedProps",
Array("NAME:Bend Type", "Value:=", "Corner"))))
ChangeProperty([<NAME:AllTabs>, [<NAME:Geometry3DCmdTab>,
Python Syn-
tax
[<NAME:PropServers>, <ObjectName:CommandName>],
[<NAME:ChangedProps>, [<NAME:BendType>, <Value>]]]])
oEditor.ChangeProperty(
[
"NAME:AllTabs",
Python [
Example
"NAME:Geometry3DCmdTab",
[
"NAME:PropServers",
"Polyline2:CreatePolyline:1"
],
[
"NAME:ChangedProps",
[
"NAME:Bend Type",
"Value:=", "Corner"
]
]
]
])
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 object names that contact the given point.
UI Access NA
Python GetBodyNamesByPosition ()
Syntax
oProject = oDesktop.GetActiveProject()
oDesign = oProject.GetActiveDesign()
oEditor = oDesign.SetActiveEditor("3D Modeler")
list_of_bodies = oEditor.GetBodyNamesByPosition(
[
Python "NAME:Parameters",
Example
"XPosition:=","0mm",
"YPosition:=","15mm",
"ZPosition:=","0mm"
])
print(list_of_bodies)
VB Syn- GetBodyNamesByPosition(<positionParameters>)
tax
oEditor.GetBodyNamesByPosition(Array("NAME:Parameters", _
VB "XPosition:=", "a", _
Example "YPosition:=", "0mm", _
"ZPosition:=", "0mm"))
GetChildNames [Modeler]
Use: Gets child names of queried model objects.
Syntax: GetChildNames()
Return Value: Returns names of children for the queried object History tree.
Parameters: Implicit or specific name of Project object or object category.
oProject = oDeskTop.GetActiveProject()
oDesign = oProject.GetActiveDesign()
oModel = oDesign.GetChildObject(“3D Modeler”)
oModel.GetChildTypes()
Returns an array containing the different types of child objects.
['ModelParts', 'AllParts', 'NonModelParts', 'Coordin-
ateSystems', 'Points', 'Planes', 'SubmodelDefinitions',
'Groups', 'Lists']
oModel.GetChildNames('ModelParts')
Returns Model Parts
Python
Example ['WG_Interior', 'WG', 'MT_Interior', 'MT', 'Box2',
'Cylinder1', 'RegularPolyhedron1', 'Polyline1',
'Polyline2', 'RegularPolyhedron1_Detach1', 'Polyline2_
Detach1', 'Polyline2_ObjectFromEdge1']
oModel.GetChildNames('NonModelParts')
Returns NonModel parts, if any.
oModel.GetChildNames("AllParts")
Returns all parts.
['WG_Interior', 'WG', 'MT_Interior', 'MT', 'Box2',
'Cylinder1', 'RegularPolyhedron1', 'Polyline1',
'Polyline2', 'RegularPolyhedron1_Detach1', 'Polyline2_
Detach1', 'Polyline2_ObjectFromEdge1']
oModel.GetChildNames(“CoordinateSystems”)
Returns Coordinate Systems
oModel.GetChildNames(“Points”)
Returns all the points
[‘Point1’]
oModel.GetChildNames(‘Planes’)
Returns all the planes in the model
['Global:XY', 'Global:YZ', 'Global:XZ', 'EndCS:XY',
'EndCS:YZ', 'EndCS:XZ', 'aEndCS:XY', 'aEndCS:YZ',
'aEndCS:XZ', 'bEndCS:XY', 'bEndCS:YZ', 'bEndCS:XZ',
'cEndCS:XY', 'cEndCS:YZ', 'cEndCS:XZ', 'FaceCS1:XY',
'FaceCS1:YZ', 'FaceCS1:XZ', 'Plane1', 'ObjectCS1:XY',
'ObjectCS1:YZ', 'ObjectCS1:XZ']
oModel.GetChildNames(‘SubModelDefinitions”)
Returns all the subModel definitions in the model
['Straight', 'MagicTee']
oModel.GetChildNames(“Groups”)
Returns all the groups in the model
['Group1', 'Group2', 'Group3']
oModel.GetChildNames(“Lists”)
Returns all the Lists
['AllObjects', 'Objectlist1', 'Facelist1']
GetChildObject [Modeler]
Returns the ChildObject in the active model, or specified object values.
Note:
UI Access NA
oDesign = oProject.GetActiveDesign()
oModel = oDesign.GetChildObject(“3D Modeler”)
oModel.GetChildTypes()
Returns:
['ModelParts', 'AllParts', 'NonModelParts', 'Coordin-
ateSystems', 'Points', 'Planes', 'SubmodelDefinitions',
'Groups', 'Lists']
oModel.GetChildNames(“ModelParts”)
Returns:
['WG_Interior', 'WG', 'MT_Interior', 'MT', 'Box2',
Python 'Cylinder1', 'RegularPolyhedron1', 'Polyline1',
Example 'Polyline2', 'RegularPolyhedron1_Detach1', 'Polyline2_
Detach1', 'Polyline2_ObjectFromEdge1']
oWGi = oModel.GetChildObject(“WG_Interior”)
Returns object of WG_Interior to variable WGi
oWGi.GetPropNames()
Returns property names from ChildObject assigned to WGi
['Name', 'Material', 'Material/SIValue', 'Mater-
ial/EvaluatedValue', 'Solve Inside', 'Orientation',
'Orientation/Choices', 'Model', 'Display Wireframe',
'Material Appearance', 'Color', 'Color/Red', 'Col-
or/Green', 'Color/Blue', 'Transparent']
VB Syntax GetChildObject
VB Set oDesign = oProject.GetActiveDesign()
GetChildTypes [Modeler]
Use: Gets child types of queried designs or editors obtained by GetActiveProjects() and GetAct-
iveDesigns() commands.
Syntax: GetChildTypes()
Return Value: Returns type of children for the queried object.
oprj=oDesktopGetActiveProject()
oprj.GetName()
'Project1'
oprj.GetChildNames()
['HFSSDesign1']
oprj.GetChildTypes()
odes=GetActiveDesign()
odes=Get.ChildNames()
['Optimetrics', 'Radfield', 'Results', '3D Modeler']
odes.getChildTypes()
['Module', 'Editor', 'Variable']
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", _
"YPosition:=", "2.8mm", "ZPosition:=", "0.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>
Return Value: An array of edge IDs
Parameters: <ObjectName>
Name of the object
VB Example: Example:
Dim oEdgeIDs
oEdgeIDs = Array()
oEdgeIDs = oEditor.GetEdgeIDsFromObject("Box1")
Python oEditor.GetEdgeIDsFromObject("Box1")
Example
GetEntityListIDByName
Where oObjectList is the name of the entity list (can be object or face), GetEntityListIDByName
(oObjectList) returns a list of IDs in that list
Command: None
Syntax: GetEntityListIDByName( <ObjectList>
Return Value: A list of IDs.
Parameters: <ObjectList>
Names of the objects
VB Example: Example:
Dim oObjectList
oObjectList = oEditor.CreateEntityList(Array("NAME:Geo-
metryEntityListParameters", "EntityType:=", _
"Object", "EntityList:=", "Box1, Cylinder1"), Array("NAME:At-
tributes", "Name:=", _
"Objectlist1"))
MsgBox(oObjectList)
Dim oObjectID
oObjectID = oEditor.GetEntityListIDByName(oObjectList)
MsgBox(oObjectID)
Dim oFaceList
oFaceList = oEditor.CreateEntityList(Array("NAME:Geo-
metryEntityListParameters", "EntityType:=", _
"Face", "EntityList:=", Array(12, 35)), Array("NAME:Attributes",
"Name:=", _
"Facelist1"))
MsgBox(oFaceList)
Dim oFaceID
oFaceID = oEditor.GetEntityListIDByName(oFaceList)
MsgBox(oFaceID)
Python oEditor.GetEntityListIDByName(oObjectList)
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
Syntax: GetFaceCenter <FaceID>
Return Value: An array containing planar face center position
Parameters: <PlanarFaceID>
VB Example:
Dim oFaceCenter
oFaceCenter = oEditor.GetFaceCenter(oFaceID)
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>)
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
GetGeometryModelerMode
Returns the modeler mode (3D or XY) for the current design. This lets you know whether the cur-
rent model is 2D or 3D.
UI Access NA
Parameters None.
Return Value String containing the modeling mode.
Python oEditor.GetGeometryModelerMode()
Example
VB Syntax GetGeometryModelerMode()
oEditor.GetGeometryModelerMode()
VB 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
GetPropNames [Modeler]
Returns the property names for the active model object, or specified property values.
UI Access NA
Returns the property names of the current 3D Model object. If you specify
Return Value
"False" returns all property names that can be changed.
oRh1 = oModel.GetChildObject("Box1")
oRh1.GetPropNames()
Returns:
Python
Example ['Name', 'Material', 'Material/SIValue', 'Mater-
ial/EvaluatedValue', 'Solve Inside', 'Orientation',
'Orientation/Choices', 'Model', 'Group', 'Display Wire-
frame', 'Material Appearance', 'Color', 'Color/Red',
'Color/Green', 'Color/Blue', 'Transparent']
VB Syntax GetPropNames()
Rh1 = oDesign.GetChildObject(“Box1”)
GetPropName("Rh1")
Returns
VB Example
['Name', 'Material', 'Material/SIValue', 'Mater-
ial/EvaluatedValue', 'Solve Inside', 'Orientation',
'Orientation/Choices', 'Model', 'Group', 'Display Wire-
frame', 'Material Appearance', 'Color', 'Color/Red',
'Color/Green', 'Color/Blue', 'Transparent']
GetPropValue [Modeler]
Returns the property value for the active model object, or specified property values.
UI Access NA
oRh1 = oModel.GetChildObject("Box1")
oRh1.GetPropNames()
Returns:
['Name', 'Material', 'Material/SIValue', 'Mater-
ial/EvaluatedValue', 'Solve Inside', 'Orientation',
Python
'Orientation/Choices', 'Model', 'Group', 'Display Wire-
Example
frame', 'Material Appearance', 'Color', 'Color/Red',
'Color/Green', 'Color/Blue', 'Transparent']
oBox2.GetPropValue("Orientation")
Returns the specified Property Value:
'Global'
VB Syntax GetPropValue()
Rh1 = oDesign.GetChildObject(“Box1”)
VB Example
GetPropValue("Orientation")
GetNumObjects
Gets the number of objects in a design.
UI Access NA
Python oEditor.GetNumObjects()
Example
VB Syntax GetNumObjects()
VB Example totalobjects = oEditor.GetNumObjects()
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
Gets an object name corresponding to the input face id.
UI Access NA
Python oEditor.GetObjectNameByFaceID(88)
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
Set oObjects = oEditor.GetObjectsInGroup( "Sheets" )
For Each oObject in oObjects
MsgBox oObject
Next
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
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")
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>
Name of the object
VB Example:
Dim oVertexIDs
oVertexIDs = Array()
oVertexIDs = oEditor.GetVertexIDsFromObject("Box1")
GetVertexPosition
Use: Returns a vector of vertex coordinates.
Syntax: GetVertexPosition(<VertexID>)
Return Value: Vector of coordinates
Parameters: <VertexID>
Type: <vector>
VB Example:
position = oEditor.GetVertexPosition(VertexIDs(0))
OpenExternalEditor
Launch a SpaceClaim session.
Return Value
oEditor.OpenExternalEditor(
[
Python
"NAME:Selections",
Example
"Selections:=" , "SpaceClaim1"
])
VB oEditor.OpenExternalEditor Array("NAME:Selections",
Example "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
Renames an object.
Return None.
Value
oEditor.RenamePart(
[
'NAME:Rename Data',
Python
'Old Name:=', 'partname',
Example
'New Name:=', 'newpartname',
]
)
VB Syn- oEditor.RenamePart()
tax
Dim oEditor
VB
Set oEditor = oDesign.SetActiveEditor("3D Modeler")
Example
oEditor.RenamePart Array("NAME:Rename Data",
SetPropValue [Modeler]
Sets the property value for the active model property.
Return Value True if the property is found and the new value is valid. Otherwise return False.
oRh1 = oModel.GetChildObject("Box1")
oRh1.GetPropNames()
Returns:
['Name', 'Material', 'Material/SIValue', 'Mater-
ial/EvaluatedValue', 'Solve Inside', 'Orientation',
'Orientation/Choices', 'Model', 'Group', 'Display Wire-
frame', 'Material Appearance', 'Color', 'Color/Red',
'Color/Green', 'Color/Blue', 'Transparent']
oPt1.GetPropNames(False)
Python
Example Returns all Prop names that can be set.
['Name', 'Color', 'Color/R', 'Color/G', 'Color/B', 'Pos-
ition', 'Position/X', 'Position/Y', 'Position/Z']
oBox1.GetPropValue("Color/R")
Returns the specified Property Value:
143
oBox1.SetPropValue(“Color/r”,111)
VB Syntax GetPropValue()
VB Example SetPropValue(“Color/r”,111)
10-166
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
CreateOutputVariable
Different forms of this command are documented for HFSS, Q3D Extractor and Schematic and
Layout Editors.
Python
oModule = oDesign.GetModule("OutputVariable")
Exampl- oModule.CreateOutputVariable ("test", "normalize(R1_0.V)",
e _
Type: <string>
The name of the report type as seen in the output variable UI.
<ContextArray>
Type: <variant>
Context for which the output variable expression is being evaluated.
VB Example:
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.
Python
oModule = oDesign.GetModule("OutputVariable")
Example oModule.DeleteOutputVariable ("testNew")
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.
oProject = oDesktop.GetActiveProject()
oDesign = oProject.GetActiveDesign()
Python
Example 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
oModule = oDesign.GetModule("OutputVariable")
Python
oModule.EditOutputVariable ("test",
Example
"normalize(R1_0.V)", "testNew", "TR", "Standard", [])
VB Example:
Set oModule = oDesign.GetModule("OutputVariable")
oModule.EditOutputVariable "test", "dB(S(WavePort1,WavePort1)) ", _
"testNew", "Setup1 : LastAdaptive", "Modal Solution Data", _ Array
("Domain:=", "Sweep")
<SolutionName>
Type: <string>
Name of the solution as seen in the output variable UI.
For example: "Setup1 : Last Adaptive"
<SolutionType>
Type: <string>
The name of the report type as seen in the output variable UI.
<ContextArray>
Type: <variant>
Context for which the output variable expression is being evaluated.
VB Example: oModule.EditOutputVariable "char_Z", _ "sqrt(ACL
(via:via_source,via:via_source)/C(via,via))", "char_Z", _ "Setup1 :
LastAdaptive", "Matrix", Array("Context:=", "Original")
GetOutputVariableValue
Gets the double value of an output variable. Only those expressions that return a double value are
supported. The expression is evaluated only for a single point.
Different forms of this command are documented for HFSS, Q3D Extractor as well Schematic and
Layout Editors.
UI Access NA
no context.
Type: <string>
Name of the solution as listed in the output variable UI.
For example: "Setup1 : Last Adaptive"
<ReportTypeName>
Type: <string>
The name of the report type as seen in the output variable UI. Possible HFSS values
are:
"Modal Solution Data" - Only for Driven Modal solution-type problems with ports.
"Terminal S Parameters" - Only for Driven Terminal solution-type problems with ports.
"Eigenmode Parameters" - Only for Eigenmode solution-type problems.
"Fields"
"Far Fields" - Only for problems with radiation or PML boundaries.
"Near Fields" - Only for problems with radiation or PML boundaries.
"Emission Test"
<ContextArray>
Type: Array
Context for which the output variable expression is being evaluated. This can be empty if
there is no context (for example, for S- parameters). The Reporter uses interpolation to
evaluate the values at the given special sweeps. If a requested special-sweep value is
outside the range the Reporter does not do extrapolation. Rather it issues an error mes-
sage indicating values outside the available range for a primary sweep.
Example:
Array("Context:=","Infinite Sphere1")
or Array("Context:=","Polyline1")
or Array()
VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
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
' -----------------------------------------------------------
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()
Set oProject = projects(0)
Set oDesign = oProject.GetDesign ("HfssDesign1")
' -----------------------------------------------------------
' 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:
"Standard" - For most plot types.
"Load Pull" - For load pull plots.
<ContextArray>
Type: Array
Context for the output variable. For more information see SimValueContext.
VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("MyTransientProject")
Set oDesign = oProject.SetActiveDesign("Nexxim1")
Set oModule = oDesign.GetModule("OutputVariable")
val1=oModule.GetOutputVariableValue("vout", "MyTransientSetup",
"time='3.9462ns'", "Standard", _
Array("NAME:Context", "SimValueContext:=", Array(1, 0, 2, 0, false,
false, -1, 1, 0, 1, 1, "", 0, 0)))
MsgBox val1
VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("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
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
Transient Time Domain 55809
Periodic AC Domain 55818
UI Domain 55819
Eye Measurement Domain 55823
Initial Response Domain 55824
Peak Distortion Domain 55825
2. Calculation Type
Standard Calculation 0
Device2_DCIV 1
Device3_DCIV_Output 2
Device3_DCIV_Input 3
Device3_DCIV_Transfer 4
Device3_DCIV_Reverse 5
Device2_ACLoad 6
Device3_ACLoad_Output 7
Device3_ACLoad_Input 8
Device3_ACLoad_Transfer 9
Device3_ACLoad_Reverse 10
Constellation 11
EyeDiagram 12
FreeX ( Statistic Report ) 13
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.
CopyTraceDefinitions
CreateReport
CreateReportFromFile
CreateReportFromTemplate
CreateReportOfAllQuantities
DeleteMarker
DeleteAllReports
DeleteReports
DeleteTraces
FFTOnReport
ExportImageToFile
ExportPlotImageToFile
ExportToFile
ExportMarkerTable
GetAllCategories
GetAllQuantities
GetAllReportNames
GetAvailableDisplayTypes
GetAvailableReportTypes
GetAvailableSolutions
GetChildObject [Reporter]
GetChildNames [Reporter]
GetChildTypes [Reporter]
GetDataExpressions
GetDataUnits
GetDesignVariableNames
GetDesignVariableUnits
GetDesignVariableValue
GetDesignVariationKey
GetDisplayType
GetImagDataValues
GetPerQuantityPrimarySweepValues
GetPropertyValue
GetPropNames [Reporter]
GetRealDataValues
GetSolutionContexts
GetSolutionDataPerVariation
GetSweepNames
GetSweepUnits
GetSweepValues
GroupPlotCurvesByGroupingStrategy
ImportIntoReport
IsDataComplex
IsPerQuantityPrimarySweep
MovePlotCurvesToGroup
MovePlotCurvesToNew
PasteReport
PasteTraces
ReleaseData
RenameReport
RenameTrace
ResetPlotSettings
SavePlotSettingsAsDefault
SetPropValue [Reporter]
UpdateAllFieldsPlots
UpdateAllReports
UpdateQuantityFieldsPlots
UpdateReports
UpdateTrace
UpdateTracesContextandSweeps
UnGroupPlotCurvesInGroup
AddCartesianLimitLine
Adds a limit line to a report on the X axis.
15), "XUnits:="
0.05, 0.3, 0.65, 0.825, 0.95,
1), "YUnits:=", "mV", "
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.
VB
oModule.AddDeltaMarker "XY Plot 1",
Example "m3", "dB(S(LumpPort1 LumpPort1)):
AddMarker
Adds a marker to a trace on a report.
AddNote
Adds a note at a specified location to a given report.
ray>)
<NoteDataName> String
<NoteArray> Array Array
("NAME:<NoteDataSourceName>",
"SourceName:=", <SourceName>,
"HaveDefaultPos:=", <boolean>,
"DefaultXPos:=", <XPos>,
"DefaultYPos:=", <YPos>,
"String:=", <Note>))
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.
Syntax: AddTraceCharacteristics <ReportName>, <TraceCharID>, Array("<sub-quantity for spe-
cific trace characteristic>"), Array(<Range>)
Return Value: None
Parameters: <ReportName>
Type: <string>
Name of Report.
<TraceCharID>
Type: <string>
ID for the trace characteristic. These are listed in the Add Trace Characteristics dialog
and the online help.
<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))")
("0s", _
"6.24999373748188e-012s", ... )), Array("X Component:=",
"Time",_
"Y Component:=", Array("TDRZ(WavePort1)")), Array()
<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.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()
ChangeProperty [ReportSetup]
Change the properties for a Report.
Command: Select a Report and change properties.
Syntax: ChangeProperty <array>
Return Value: None
Parameters: Varies, depending on the properties associated with the select object command.
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("bp_filter")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("ReportSetup")
oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:Cartesian",
Array("NAME:PropServers", _
"XY Plot 1:CartesianDisplayTypeProperty"), Array
("NAME:ChangedProps", Array("NAME:Show X Scrollbar", "Value:=", _
true))))
oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:General",
Array("NAME:PropServers", _
"XY Plot 1:General"), Array("NAME:ChangedProps", Array("NAME:Use
Scientific Notation", "Value:=", _
true))))
oModule = oDesign.GetModule("ReportSetup")
oModule.ChangeProperty(
[
"NAME:AllTabs",
[
"NAME:General",
[
"NAME:PropServers",
"XY Plot 1:General"
Python
],
Example
[
"NAME:ChangedProps",
[
"NAME:Use Scientific Notation",
"Value:=" , True
]
]
]
])
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"
Type: <string>
Name of the solution as listed in the Modify Report dialog box.
For example: "Setup1 : Last Adaptive"
<ContextArray>
Type: Array of strings
Context for which the expression is being evaluated. This can be an empty string if there
is no context.
Array("Domain:=", <DomainType>)
<DomainType>
ex. "Sweep" or "Time"
Array("Context:=", <GeometryType>)
<GeometryType>
ex. "Infinite Spheren", "Spheren", "Polylinen"
<FamiliesArray>
Type: Array of strings
Contains sweep definitions for the report.
Array("<VariableName>:= ", <ValueArray>)
<ValueArray>
Array("All") or Array("Value1", "Value2", ..."Valuen")
examples of <VariableName>
"Freq", "Theta", "Distance"
<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 "Rept2DRectFreq",_
"Modal Solution Data", "XY Plot", _
"Setup1 : Sweep1",_
Array("Domain:=", "Sweep"), _
Array("Freq:=", Array("All")), _
Array("X Component:=", "Freq",
"Y Component:=", _ Array("dB(S(LumpPort1,LumpPort1))")), _
Array()
VB Example:
Set oModule = oDesign.GetModule("ReportSetup")
oModule.CreateReport "3D Cartesian Plot1", "Far Fields",_
"3D Cartesian Plot", "Setup1 : LastAdaptive", _
Array("Context:=", "Infinite Sphere1", "Domain:=", "Sweep"), Array
("Theta:=", Array("All"), "Phi:=", Array("All"), _
"Freq:=", Array("10GHz")), _
Array("X Component:=", "Theta", _
"Y Component:=", "Phi", _
"Z Component:=", Array("rETotal")), _
Array()
VB Example:
oModule.CreateReport "ReptSmithFreq",_
"Modal Solution Data", "Smith Plot", "Setup1 : Sweep1", _
Array("Domain:=", "Sweep"), _
Array("Freq:=", Array("All")),_
Array("Polar Component:=", _
Array("ln(Y(LumpPort1,LumpPort1))")), _
Array()
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("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()
"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
<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:
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, _
false, false, -1, 1, 0, 1, 1, "", 0, 0)), Array("F:=", Array
("All")), Array("X Component:=", _
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"
])
CreateReportFromFile
Creates a new report from an .rdat file.
Command: [product]>Results>CreateReportFromFile
Syntax: CreateReportFromFile "<FilePathName>"
Return Value: None
Parameters: <FilePathName>
Type: <string>
Path to .rdat file.
VB Example:
Set oModule = oDesign.GetModule("ReportSetup")
oModule.CreateReportFromFile "C:/Users/MyDir/Documents/Return_
Loss.rdat"
oModule = oDesign.GetModule("ReportSetup")
Python
Example oModule.CreateReportFromFile("C:/User-
s/MyDir/Documents/Return_Loss.rdat")
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>
Name of fields to plot.
<SetViewTopDownDirectionByRelativeCS>
Type: <string>
Name of relative coordinate system to use for the field plot.
Example:
’This example demonstrates the creation of E-field plots ’of three
different orientations:
’Mag_E1 created in-plane with the XY-plane of the Global ’coordinate
system
’Mag_E2 created in-plane with the XY-plane of the RelativeCS1
coordinate system
’Mag_E3 created in-plane with the XY-plane of the RelativeCS2
coordinate system
Dim oAnsoftApp, oDesktop, oProject, oDesign, oEditor, oModule
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.
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
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
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()
Dim names
names = oReportModule.GetAllReportNames
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
quantities= oModule.GetAllQuantities
VB
("Far Fields", "Rectangular Plot", "Setup1 :
Example
LastAdaptive", "Infinite Sphere1", "Gain")
GetAvailableDisplayTypes
All supported display types in report type as an array of text strings.
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
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
UI Access NA
UI Access NA
Pyt- GetChildObject(objectPath)
hon
Syn-
tax
VB GetChildObject(objectPath)
Syn-
tax
GetChildTypes [ReportSetup]
Use: Gets child types of queried Report module object.
Syntax: GetChildTypes()
Return Value: Always empty array.
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
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
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
for k in selectionArray:
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")
GetPropNames [Reporter]
Use: Report setup module does not have its own property, this function always returns empty
array.
Syntax: GetPropNames(bIncludeReadOnly)
Return Value: Returns empty set.
Parameters: bIncludeReadOnly—optional, default to True.
oOptModule.GetPropNames()
Python
oOptModule.GetPropNames(True)
Example
oOptModule.GetPropNames(False)
UI Access NA
VB Syntax GetPropValue(propPath)
GetPropValue("Display Type"0)
VB Example
'Rectangular Plot'
GetRealDataValues
Returns array of real data values.
UI Access NA
Python GetRealDataValues(<expressionString>,<siValue>)
Syntax
VB Syn- GetRealDataValues(<expressionString>,<siValue>)
tax
VB dim realvalues
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
Python
oReportModule = oDesign.GetModule("ReportSetup")
Exampl- names = oReportModule.GetReportTraceNames("SParameter Plot
e 1")
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
meter.
<solutionNameArg> String Solution name as input para-
meter.
<simValueCtxtArg> Structured Array Same as ContextArray values cre-
ated in the relevant CreateReport
script.
<familiesArg> Array of Strings Same as FamiliesArray values
created in the relevant CreateRe-
port script.
<expressionArg> String or Array of Text string or array of text strings;
Strings valid expression, may validate it
as the data-table Y-component.
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 For the returned ISolutionDataResultComInterface object, some of its functions
have an optional boolean parameter: SIValue. SIValue 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, familiesArg, expressionArg)
set solutionData = oMod-
ule.GetSolutionDataPerVariation(
"Modal Solution Data",
"Setup1 : Sweep",
VB Example Array("Domain:=", "Sweep"),
Array("Freq:=", Array("All"), "offset:=", Array
("All")),
Array("S(Port1,Port1)", "dB(S(Port1,Port3))")
)
GetSweepNames
Returns array of text strings containing primary sweep name(s).
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.
Command: Group Curves By...
Syntax: GroupPlotCurvesByGroupingStrategy "<reportName>", "<curve_grouping_strategy>")
Return Value: None
Parameters: <ReportName>
Type: <string>
Report name.
<curve_grouping_strategy>
Type: <string>
Single, By Trace, By Units
VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("CoaxBend14_1")
Set oDesign = oProject.SetActiveDesign("Transient")
Set oModule = oDesign.GetModule("ReportSetup")
oModule.GroupPlotCurvesByGroupingStrategy "Transient Plot 1", "By Units"
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
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.
Command: Right-click on plot Edit>Reset Plot Settings
Syntax: ResetPlotSettings("PlotName")
Return Value: None
Parameters: <PlotName>
Type: <string>
Name of plot.
VB Example:
Set oModule = oDesign.GetModule("ReportSetup")
oModule.ResetPlotSettings "Differential S-parameters"
SavePlotSettingsAsDefault
Saves report plot settings as default.
VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Return Value True if the property is found and the new value is valid. Otherwise return False.
UpdateTraces
Update the traces in a report for which traces are not automatically updated by the Report Traces
dialog, Update Report, Real Time selection.
Return None
Value
Array()
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
<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:=", <DomainType>)
<DomainType>
ex. "Original" or "RM1"
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", [], _
Python
["Freq:=", _
Example
["9GHz", "9.05GHz", "9.1GHz",
"9.15GHz", "9.2GHz", _
"9.25GHz", "9.3GHz", "9.35GHz", _
"9.4GHz", "9.45GHz", "9.5GHz",
"9.55GHz", _
"9.6GHz", "9.65GHz", "9.7GHz",_
"9.75GHz", "9.8GHz", "9.85GHz",
"9.9GHz", "9.95GHz", "10GHz"],_
"off-
set:=",["All"]])
VB Syntax UpdateTracesContextandSweeps
oModule.UpdateTracesContextAndSweeps_
"Active S Parameter Quick Report",_
Array( _
"dB(ActiveS(Port1:1))", "dB(ActiveS(Port2:1))"),_
"Setup1 : Sweep1", Array(), _
Array("Freq:=", _
Array( _
"9GHz", "9.05GHz", "9.1GHz",
VB
Example "9.15GHz", "9.2GHz", _
"9.25GHz", "9.3GHz", "9.35GHz", _
"9.4GHz", "9.45GHz", "9.5GHz",
"9.55GHz", _
"9.6GHz", "9.65GHz", "9.7GHz",_
"9.75GHz", "9.8GHz", "9.85GHz",
"9.9GHz", "9.95GHz", "10GHz"),_
"off-
set:=", Array("All"))
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:
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"
GetDefaultBaseName
GetExcitations
GetExcitationsOfType
GetNumBoundaries
GetNumBoundariesOfType
GetNumExcitations
GetNumExcitationsOfType
GetPortExcitationsCount
ReassignBoundary
RemoveAssignmentFromBoundary
RenameBoundary
ReprioritizeBoundaries
SetDefaultBaseName
AddAssignmentToBoundary
Use: Adds a new geometry assignment to a boundary.
Command: Click Boundaries>Reassign or Excitations>Reassign
Syntax: AddAssignmentToBoundary Array("Name:<BoundName>",
"Objects:=", <AssignmentObjects>,
"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"] ])
Python oModule.AddAssignmentToBoundary ((
Example [
"NAME:PerfE1",
"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:
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 Array("NAME:Nport2", "Defin-
ition:=", "Model2", Array("NAME:Assignments", Array("NAME:P01__
NET179__T1", "Assign:=", _
oModule.CreateNportCircuitElement(
[
"NAME:Nport1",
"Definition:=" , "Model",
[
"NAME:Assignments",
[
"NAME:Model",
"Assign:=" , "1"
]
]
])
Python
oModule.CreateNportCircuitElement(
Example
[
"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
DeleteAllExcitations
Use: Deletes all excitations.
Command: [product]>Excitations>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.
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>)
Return Value: Array of excitation names of the given type.
Parameters: <ExcitationType>
Type: <string>
Name of legal excitation type.
For example: "Plane Incident Wave.
VB Example:
excite_name_array = _
oModule.GetExcitationsOfType("Wave Port")
GetNumBoundaries GetNumBoundaries
Gets the number of boundaries in a design.
Syntax: GetNumBoundaries()
Return Value: Integer count
Parameters: None
VB Example:
numbound = oModule.GetNumBoundaries()
GetNumBoundariesOfType
Gets the number of boundaries of the given type.
Syntax: GetNumBoundariesOfType(<BoundaryType>)
Return Value: Integer count
Parameters: <BoundaryType>
Type: <string>
VB Example:
numbound = oModule.GetNumBoundariesOfType("Perfect E")
GetNumExcitations
Gets the number of excitations in a design, including all defined modes and terminals of ports.
Syntax: GetNumExcitations()
Return Value: Integer count
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",_
"Objects:=", Array("Box2", "Box3"),_
oModule.ReassignBoundary ((
[
Python
"NAME:PerfE1",
Example
"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"] ])
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"
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: [product]>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"
EditCurrent
EditDiffPairs
EditFiniteCond
EditHalfSpace
EditHybridRegion
EditImpedance
EditIncidentWave
EditLayeredImpedance
EditMaster
EditPerfectE
EditPerfectH
EditLumpedPort
EditLumpedRLC
EditMagneticBias
EditNPortCircuitElement
EditRadiation
EditSlave
EditSymmetry
EditTerminal
EditVoltage
EditWavePort
LumpedPortToCircuitPort
SetHybridRegionCoupledGroup
SetSBRSources
SetSBRWedgeSettings
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:
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:
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",
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 oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignFloquetPort Array("NAME:FloquetPort1",
"Faces:=", Array(7),
"NumModes:=", 2,
"RenormalizeAllTerminals:=", true,
"DoDeembed:=", false,
Array("NAME:Modes", Array("NAME:Mode1", "ModeNum:=", 1,
"UseIntLine:=", false),
Array("NAME:Mode2", "ModeNum:=", 2, "UseIntLine:=", false)),
"ShowReporterFilter:=", false,
"UseScanAngles:=", true, "Phi:=", "0deg", "Theta:=", "0deg",
Array("NAME:LatticeAVector", "Start:=", Array("0mm", "0mm",
"0.8mm"), "End:=", Array( "0mm", "0.6mm", "0.8mm")),
Array("NAME:LatticeBVector", "Start:=", Array("0mm", "0mm",
"0.8mm"), "End:=", Array("0.8mm", "0mm", "0.8mm")),
Array("NAME:ModesCalculator", "Frequency:=", "1GHz",
"FrequencyChanged:=", false,
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
Syntax: AssignHalfSpace Array("NAME:HalfSpacen", "ZLocation:=", "<intUnits>", "Material:=",
"<string>")
Return Value: None
Parameters: "NAME:<stringN>"
String
ZLocation
Z value and Units
Materials
<string> defining the material.
VB Example:
oModule.AssignHalfSpace Array("NAME:HalfSpace1", "ZLocation:=",
"2mm", "Material:=", "water_sea")
AssignImpedance
Use: Creates an impedance boundary for an HFSS design.
Command: [product]>Boundaries>Assign>Impedance
Syntax: AssignImpedance <ImpedanceArray>
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.
If false, provide the PhiStart, PhiStop, PhiPoints, ThetaStart, ThetStop, ThetaPoints,
EoPhi, EoTheta parameters.
VB Example:
oModule.AssignIncidentWave Array("NAME:IncWave1",_
"IsCartesian:=", true,_
"EoX:=", "1", "EoY:=", "0", "EoZ:=", "0",_
"kX:=", "0", "kY:=", "0", "kZ:=", "1")
VB Example:
oModule.AssignIncidentWave Array("NAME:IncWave2",_
"IsCartesian:=", false,_
"PhiStart:=","0deg",_
"PhiStop:=", "90deg",_
"PhiPoints:=", 2,_
"ThetaStart:=", "0deg",_
"ThetaStop:=", "180deg",_
"ThetaPoints:=", 3, _
"EoPhi:=", "1", "EoTheta:=", "0")
AssignLayeredImp
Use: Creates a layered impedance boundary.
<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:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("tune_coax_fed_patch")
Set oDesign = oProject.SetActiveDesign("HFSSDesign2")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignLayeredImp Array("NAME:Layered1",
"Objects:=", Array("Rectangle1"),
"Frequency:=", "0GHz",
"Roughness:=", "0um",
"IsTwoSided:=", true,
"IsShellElement:=", true,
Array("NAME:Layers", Array("NAME:Layer1",
"Thickness:=", "1um", "Material:=", "vacuum")),
"InfGroundPlane:=", false)
AssignLinkedRegion
Use: Assign a Hybrid Region as a Linked Region.
Command: HFSS>Hybrid>Assign Hybrid>Linked Region
VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("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>
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("calib_modal_test")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignLumpedPort "lp2", Array("NAME:lp2",
"RenormalizeAllTerminals:=", true,
"DoDeembed:=", true,
Array("NAME:Modes", Array("NAME:Mode1",
"ModeNum:=", 1,
"UseIntLine:=", true,
Array("NAME:IntLine",
"Start:=", Array( "120mm", "50mm", "40mm"),
"End:=", Array("120mm", "50mm", "120mm")),
"CharImp:=", "Zpi")),
"ShowReporterFilter:=", false,
"ReporterFilter:=", Array(true), "FullResistance:=", "50ohm",
"FullReactance:=", "0ohm")
AssignLumpedRLC
Use: Creates a lumped RLC boundary.
Command: HFSS>Boundaries>Assign>Lumped RLC
Syntax: AssignLumpedRLC <LumpedRLCArray>
Return Value: None
Parameters: <LumpedRLCArray>
Array("NAME:<BoundName>",
"RLC Type:=" , <"Parallel" | "Serial" >,
"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",_
"RLC Type:=" ," Parallel" ,
"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))
oModule.AssignLumpedRLC(
Python
[
Example
"NAME:LumpRLC1",
"Objects:=" , ["Box1"],
[
"NAME:CurrentLine",
"Start:=" , ["0.15mm","-0.2mm","0mm"],
"End:=" , ["0.15mm","0.6mm","0mm"]
],
"RLC Type:=" , "Parallel",
"UseResist:=" , True,
"Resistance:=" , "100ohm",
"UseInduct:=" , True,
"Inductance:=" , "10nH",
"UseCap:=" , True,
"Capacitance:=" , "10pF"
])
AssignMagneticBias
Use: Creates a magnetic bias source.
Command: HFSS>Excitations>Assign>Magnetic Bias
Syntax: AssignMagneticBias <MagneticBiasArray>
Return Value: None
Parameters: <MagneticBiasArray>
Array("NAME:<BoundName>",
"IsUniformBias:=", <bool>,
"Bias:=", <value>,
"XAngle:=", <value>,
"YAngle:=", <value>,
"ZAngle:=", <value>,
"Project:=",<string>,
"Objects:=", <AssignmentObjects>)
IsUniformBias
If true, supply the Bias, XAngle, YAngle, and ZAngle parameters.
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:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
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",
Array("NAME:Params", "<variable>:=", "<value>"),
"ForceSourceToSolve:=", <Boolean>
"PreservePartnerSoln:=", <Boolean>,
"PathRelativeTo:=", "TargetProject"))
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project53")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project53")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignScreeningImpedance Array("NAME:Screening1", "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"))
AssignSlave
Use: Creates a slave boundary.
Command: HFSS>Boundaries>Assign>Slave
Syntax: AssignSlave <SlaveArray>
Return Value: None
Parameters: <SlaveArray>
Array("NAME:<BoundName>",
<CoordSysArray>,
"ReverseV:=", <bool>,
"Master:=", <string>,
"UseScanAngles:=", <bool>,
"Phi:=", <value>,
"Theta:=", <value>,
"Phase:=", <value>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
<UseScanAngles>
If UseScanAngles is True, then Phi and Theta should be specified.
If it is False, then Phase should be specified.
VB Example:
oModule.AssignSlave Array("NAME:Slave1",_
Array("NAME:CoordSysVector", _
"Origin:=", Array(-1, 0, 0.2),_
"UPos:=", Array(-1, 0, 0)),_
"ReverseV:=", false,_
"Master:=", "Master1",_
"UseScanAngles:=", true,_
"Phi:=", "10deg",_
"Theta:=", "0deg",_
"Faces:=", Array(12))
VB Example:
oModule.AssignSlave Array("NAME:Slave2",_
Array("NAME:CoordSysVector",_
"Origin:=", Array(-1, 0, 0.2),_
"UPos:=", Array(-2, 0, 0.2)),_
"ReverseV:=", false,_
"Master:=", "Master1",_
"UseScanAngles:=",false,_
"Phase:=", "10deg",_
"Faces:=", Array(11))
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.
Number of terminals for terminal problems.
<ModesArray>
Specify for modal problems.
Array("NAME:Modes",
<OneModeArray>, <OneModeArray>, ...)
<OneModeArray>
Array("NAME:<ModeName>",
"ModeNum:=", <int>,
"UseIntLine:=", <bool>,
<IntLineArray>)
<ModeName>
Type: <string>
Name of the mode. Format is "Mode<int>". For example "Mode1".
<IntLineArray>
Array("NAME:IntLine",
"Start:=", <LineEndPoint>,
"End:=", <LineEndPoint>,
"CharImp:=", <string>)
CharImp
Characteristic impedance of the mode. Possible values are "Zpi", "Zpv", or "Zvi"
VB Example: Modal problem:
oModule.AssignWavePort Array("NAME:WavePort1",_
"NumModes:=", 2,_
"PolarizeEField:=",false,_
"DoDeembed:=", true,_
"DeembedDist:=", "10mil",_
"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())
oModule.EditCircuitPort(
[
"NAME:1",
Python
"Impedance:=" , "50ohm",
Example
"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
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>)
Return Value: none
Parameters: <BoundaryName>
Type: <String>
Name of the boundary to edit.
<Name>
Type:<String>
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Cube_RCS_00a")
Set oDesign = oProject.SetActiveDesign("PEC_d1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.EditIncidentWave "IncPWave1",
Array("NAME:IncPWave1", "IsCartesian:=", false,
"PhiStart:=", "$phi_inc",
"PhiStop:=", "$phi_inc",
"PhiPoints:=", 1,
"ThetaStart:=", "$theta_inc",
"ThetaStop:=", "$theta_inc",
"ThetaPoints:=", 1, "EoPhi:=", "$phi_pol",
"EoTheta:=", "$theta_pol",
"OriginX:=", "0mm",
"OriginY:=", "0mm",
"OriginZ:=", "0mm",
"TransientActive:=", 1,
"TimeProfile:=", "Broadband Pulse",
"HfssFrequency:=", "1GHz",
"MinFreq:=", "100MHz",
"MaxFreq:=", "1GHz",
"Delay:=", "0.2s",
"NumFreqsExtracted:=", 401,
"SweepMinFreq:=", "100MHz",
"SweepMaxFreq:=", "1GHz",
"IsPropagating:=", true,
<ModesArray>,
"TerminalIDList:=", <TerminalsArray>,
"FullResistance:=", <value>,
"FullReactance:=", <value>,
)
Return Value: None
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("calib_modal_test")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.EditLumpedPort "lp2", Array("NAME:lp2", "RenormalizeAllTerminals:=", true,
"DoDeembed:=", _
true, Array("NAME:Modes", Array("NAME:Mode1", "ModeNum:=", 1, "UseIntLine:=", true, Array
("NAME:IntLine", "Start:=", Array( _
"120mm", "50mm", "40mm"), "End:=", Array("120mm", "50mm", "120mm")), "CharImp:=", _
"Zpi")), "ShowReporterFilter:=", false, "ReporterFilter:=", Array(true), "FullResistance:=", _
"50ohm", "FullReactance:=", "0ohm")
EditLumpedRLC
Use: Modifies a lumped RLC boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditLumpedRLC <BoundName> <LumpedRLCArray>
Return Value: None
EditMagneticBias
Use: Modifies a magnetic bias excitation.
Command: Double-click the excitation in the project tree to modify its settings.
Syntax: EditMagneticBias <BoundName> <MagneticBiasArray>
Return Value: None
Parameters:
EditRadiation
Modifies a radiation boundary.
Command: Double-click the boundary in the project tree to modify its settings.
Syntax: EditRadiation <BoundName> <RadiationArray>
Return Value: None
Parameters: <RadiationArray>
Array("NAME:<BoundName>",
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>
"IsIncidentField:=", <boolean>, _
"IsEnforcedHField:=", <boolean>, _
"IsEnforcedEField:=", <boolean>, _
"IsFssReference:=", <boolean>, _
"IsForPML:=", <boolean>, _
"UseAdaptiveIE:=", <boolean>, _
"IncludeInPostproc:=", <boolean>))
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
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
EditVoltageDrop
Use: Edits a voltage drop excitation.
Command: Double-click the excitation in the project tree to edit it.
Syntax:EditVoltageDrop <BoundName> <VoltageDropArray>
Return Value: None
EditWavePort
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>
Return Value: None
Parameters: <value>
Type: <string>
"OneWayCoupled" or "TwoWayCoupled" for all regions or "Advanced", Array("One
Way:= <hybridregionname>, Array(Two Way:=", Array("<hybridregionname>" , )))
VB Example:
Setting All Hybrid Regions to One Way Coupled
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project35")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.SetHybridRegionCoupledGroup "Advanced", Array("One Way:=",
Array("Two Way:=", Array( _
"Hybrid1", "Hybrid2")))
SetTerminalReferenceImpedances
Use: To set the reference impedance for all terminals within a specified port.
Command: HFSS>Excitations>Set Terminal Reference Impedances or HFSS-IE>Ex-
citations>Set Terminal Reference Impedances
Syntax: SetTerminalReferenceImpedances <value>, <PortName>
Return Value: None
Parameters: <value>
Type: <string>
The value and units for the the impedance
<PortName>
Type: <string>
The name of the port.
VB Example:
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.SetTerminalReferenceImpedances "75ohm", "WavePort1"
SetSBRSources
Designs containing SBR+ regions will always be set to All One-Way and the Set Coupling menu is
replaced by the Set SBR+ Source Regions command. Non-SBR+ regions will serve as sources,
and interact with each other through the SBR+ regions. All source regions interact as one-way
links to SBR+ and coupling between the source regions are handled by SBR+ using reciprocity the-
ory. If Global Setting is selected, Current Source Conformance, Thin Sources, and Power Fraction
are not recorded.
Command: SetSBR+ Source Regions
Syntax: SetSBRSources (<parameters>)
oModule.SetSBRSources(
[
["NAME:Two Way",
"Regions:=", ["FE-BI3", "Hybrid2"],
"Use Global:= True
],
[
Name: Two Way",
"Regions:=", ["FE-BI1", "FE-BI2"],
"Far Field Source CS:=", "Global"
],
[
Python
"NAME:Hybrid3",
Example
"Use Global:= False,
"Use Current Source Conformance:=", "Auto",
"Thin Sources:=", False
],
[
"NAME:Hybrid4",
"Use Global:= False,
"Use Current Source Conformance:=", "Enable",
"Thin Sources:=", True,
"Power Fraction:=", 0.42
[,
])
SetSBRWedgeSettings
For designs with an SBR+ Region, set SBR wedge settings.
Command: Set SBR WedgeSettings
Syntax: SetSBRWedgeSettings Array("Name:SBRWedgeSettings", <parameters>)
Parameters:"MaxWedgeAngle:=" <"ndeg">
"IncludeSheetEdges:=" <bool>
"ApplySourceDistFilter:="<bool>
"SourceX:=" <x coord>, "SourceY:=" <Y coord>, and "SourceZ:=" <Z
coord>,
"CS:=" "<CS Name>,
"DistFromSource:=", "n<units>",
"ApplyBoxFilter:=", <bool>
If false, no additional parameters. If True:
"Box:=" <BoxID>
Return Value: None
VBS Example
oModule.SetSBRWedgeSettings Array("NAME:SBRWedgeSettings",
"MaxWedgeAngle:=", _
"135deg", "IncludeSheetEdges:=", true, "ApplySourceDistFilter:=",
true, "SourceX:=", _
0, "SourceY:=", 0, "SourceZ:=", 0, "CS:=", "Global",
"DistFromSource:=", _
"1000mm", "ApplyBoxFilter:=", false)
oModule.SetSBRWedgeSettings(
[
"NAME:SBRWedgeSettings",
"MaxWedgeAngle:=" , "135deg",
Python
Example
"IncludeSheetEdges:=" , True,
"ApplySourceDistFilter:=", True,
"SourceX:=" , 0,
"SourceY:=" , 0,
"SourceZ:=" , 0,
"CS:=" , "Global",
"DistFromSource:=" , "1000mm",
"ApplyBoxFilter:=" , True
"Box:=" , "Box1"
])
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:
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")
AssignFiniteCond [HFSS-IE]
Use: Creates a finite conductivity boundary.
Command: HFSS-IE>Boundaries>Assign>Finite Conductivity
Syntax: AssignFiniteCond <FiniteCondArray>
Return Value: None
Parameters: <FiniteCondArray>
Array("NAME:<BoundName>",
"Objects:=", <AssignmentObjects>,
"UseMaterial:=",<bool>,
"Material:=", <string>,
"Conductivity:=", <value>,
"Permeability:=", <value>,
"InfGroundPlane:=", <bool>,
"Faces:=", <AssignmentFaces>)
UseMaterial
If True, provide Material parameter.
If False, provide Conductivity and Permeability parameters.
VB Example:
oModule.AssignFiniteCond Array("NAME:FiniteCond1",_
"Objects:=", Array("Rectangle2"), _
"UseMaterial:=", false, _
"Conductivity:=", "58000000", _
"Permeability:=", "1", _
"Roughness:=", "0um", _
"UseThickness:=", false)
AssignHalfSpace [HFSS-IE]
Use: Creates a Half Space boundary for an HFSS-IE design.
Command: HFSS-IE>Boundaries>Assign>Half Space
Syntax: AssignHalfSpace Array("NAME:HalfSpacen", "ZLocation:=, <Value><Units>", "Mater-
ial:=", <string>")
Return Value: None
Parameters: Zlocation
Z Coordinate and units for the definition of the half space boundary.
Material
String identifying the material for the lower half of the space.
VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project2")
Set oDesign = oProject.SetActiveDesign("IEDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignHalfSpace Array("NAME:HalfSpace1", "ZLocation:=",
"0mm", "Material:=", "water_sea")
AssignImpedance [HFSS-IE]
Use: Creates an impedance boundary for an HFSS-IE design.
Command: HFSS-IE>Boundaries>Assign>Impedance
Syntax: AssignImpedance <ImpedanceArray>
Return Value: None
Parameters: <ImpedanceArray>
Array("NAME:<BoundName>",
"Resistance:=", <value>,
"Reactance:=", <value>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>)
VB Example:
oModule.AssignImpedance Array("NAME:Imped1",_
"Resistance:=", "50",_
"Reactance:=", "50",_
"Faces:=", Array(12))
AssignInfiniteGroundPlane [HFSS-IE]
Use:Creates an infinite ground plane in HFIE.
Command:HFSS-IE>Boundaries>Assign>Infinite Ground Plane
Syntax:AssignInfGndPlane <Array>
Return Value:None
Parameters:<Array>
"NAME:"<InfGndPlaneName>
"ZLocation:=", <value>
"Roughness:=", <value>
"Material:=", "<name>"
VB Example:
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AssignInfGndPlane Array("NAME:InfGndPlane1", _
"ZLocation:=", "0mm", _
"Roughness:=", "0mm", _
"Material:=", "Copper")
AssignLumpedPort [HFSS-IE]
Use: Creates a lumped port.
Command: HFSS>Excitations>Assign>Lumped Port
Syntax: AutoIdentifyPorts <LumpedPortArray>
Return Value: None
Parameters: Array
VB Example:
Set oDesign = oProject.SetActiveDesign("HFSSIEDesign1")
Set oModule = oDesign.GetModule("BoundarySetup")
oModule.AutoIdentifyPorts Array("NAME:Faces", 12), _
Array("NAME:ReferenceConductors", "Box1"), _
"LumpPort1", true
CreatePML
Use: Command to create a new PML group from the script. This is equivalent to creating a new
PML group in the user interface.
Command: None
Syntax: For manually created PMLs:
CreatePML Array("UserDrawnGroup:=", true,
"PMLObj:=", <string>,
"BaseObj:=", <string>,
"Thickness:=", <value>,
"Orientation:=", <string>,
"RadDist:=", <value>,
"UseFreq:=", <bool>,
"MinFreq:=", <value>,
"MinBeta:=", <double>)
"RadIncidentField:=", <bool>
"RadFssReference:=", <bool>
Parameters: PMLObj
Name of the object to use as the PML cover.
BaseObj
Name of the base object touching the PML cover object.
Orientation
String representing the orientation of the PML.
Possible values are: "XAxis", "YAxis", and "ZAxis"
UseFreq
If true, provide the MinFreq parameter.
If false, provide the MinBeta parameter.
VB Example:
oModule.CreatePML Array("UserDrawnGroup:=", false,_
"PMLFaces:=", Array(120), "CreateJoiningObjs:=",_ true,_
"Thickness:=", "0.33mm", "RadDist:=", "1.6mm",_
"UseFreq:=", true, "MinFreq:=", "1GHz")
VB Example:
oModule.CreatePML Array("UserDrawnGroup:=", true,_
"PMLObj:=", "Box1", "BaseObj:=", "Box2", _
"Thickness:=", "0.3mm", "Orientation:=", "ZAxis", _
"RadDist:=", "1.6mm", "UseFreq:=", false, _
"MinBeta:=", "2")
ModifyPMLGroup
Use: Command to modify a PML group. Note: This is the scripting equivalent to clicking Update in
the PML Setup wizard. This does not actually modify the materials. It only modifies the data stored
by the PML Setup wizard.
Command: None
Syntax: ModifyPMLGroup Array("NAME:<GroupName>",
"RadDist:=", <value>,
"UseFreq:=", <bool>,
"MinFreq:=", <value>,
"MinBeta:=", <double>)
Return Value: None
Parameters: <GroupName>
Name of the PML group to modify.
UseFreq
If true, provide the MinFreq argument.
If false, provide the MinBeta argument.
VB Example:
oModule.ModifyPMLGroup Array("NAME:PMLGroup1",
"RadDist:=", "1.166666667mm",
"UseFreq:=", false, "MinBeta:=", 2)
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
13-78
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
DeleteOp
Deletes the specified mesh operations.
Command: Delete command in the List dialog box. Click HFSS or Q3D Extractor or 2D
Extractor or Maxwell 3D or Maxwell 2D>List to access the List dialog box.
Syntax: DeleteOp <NameArray>
Return Value: None
Parameters: <NameArray>
Type: Array of strings.
An array of mesh operation names.
VB Example:
oModule.DeleteOp Array("Length1", "SkinDepth1",_
"Length2")
GetOperationNames
Use: Gets the names of mesh operations defined in a design.
Syntax: GetOperationNames(<OperationType>)
Return Value: Array of mesh operation names.
Parameters: <OperationType>
Type: <string>
For example: "Skin Depth Based"
VB Example:
Set opnames = oModule.GetOperationNames("Length Based")
For Each name in opnames
Msgbox name
Next
RenameOp
Use: Renames a mesh operation.
Command: Right-click the mesh operation in the project tree, and then click Rename on the short-
cut menu.
Syntax: RenameOp <OldName>, <NewName>
<NewName>
Type: <string>
New name for the mesh operation.
VB Example:
oModule.RenameOp "SkinDepth1", "NewName"
AssignLengthOp
Assigns length-based operations to the selection.
Command: HFSS or Maxwell 3D or Maxwell 2D > Mesh > Assign Mesh Operation > On
Selection or HFSS or Maxwell 3D or Maxwell 2D > Mesh > Assign Mesh Operation >
Inside Selection > Length Based.
Syntax: AssignLengthOp <LengthOpParams>
Return Value: None
Parameters: <LengthOpParams>
Array("NAME:<OpName>",
"RefineInside:=", <bool>,
"Objects:=", <AssignmentObjects>,
"Faces:=", <AssignmentFaces>,
"RestrictElem:=", <bool>
"NumMaxElem:=", <integer>
"RestrictLength:=", <bool>
"MaxLength:=", <value>)
RefineInside
If true, Objects should be specified. Implies apply restrictions to tetrahedra inside the
object.
If false, Faces and/or Objects can be specified. Implies apply restrictions to triangles on
the surface of the face or object.
RestrictElem
If true, NumMaxElem should be specified.
RestrictLength
If true, MaxLength should be specified.
VB Example: Assigning length-based operations to the inside tet-
rahedra of an object:
oModule.AssignLengthOp Array("NAME:Length1", _
"RefineInside:=", true, _
"Objects:=", Array("Box1"), _
"RestrictElem:=", true, _
"NumMaxElem:=", 1000, _
"RestrictLength:=", true, _
"MaxLength:=", "1mm")
AssignModelResolutionOp
Use: Assigns a model resolution name, value and unit for mesh operations, or specify to
UseAutoFeaturelength. If UseAutoFeature length is true, the Defeature length is not used.
Command: HFSS or Q3D Extractor or 2D Extractor or Maxwell 3D > Mesh > Assign Mesh
Operation > Model Resolution
Syntax: AssignModelResolutionOp Array(<ModelResParams>)
Return Value: None
Parameters: Array("NAME:<string>",
"Objects:=", Array( "<modelname>"), _
"UseAutoLength:=", <Boolean>, _
"DefeatureLength:=", "<value><units>")
VB Example:
Set oDesign = oProject.SetActiveDesign("wg_combiner")
Set oModule = oDesign.GetModule("MeshSetup")
oModule.AssignModelResolutionOp Array("NAME:ModelResolution1",
"Objects:=", Array( "waveguide"), _
"UseAutoLength:=", true, _
"DefeatureLength:=", "71.5891053163818mil")
AssignCurvatureExtractionOp (Beta)
Assigns a curvature extraction operation to the selection for a faceted SBR+ object or face.
Command: HFSS > Mesh > Assign Mesh Operation > SBR+ Curvature Extraction for
Faceted Surfaces...
Syntax: AssignCurvatureExtractionOp <CurvilinearElementsOpParams>
Return Value: None
Parameters: <CurvilinearnElementsOpParams>
Array("NAME:<OpName>",
"Faces:=", <AssignmentFaces>, | "Objects:=", Array("objectID")
"Apply:=", <bool>)
VB Example:
oModule.AssignCurvatureExtractionOp Array("NAME:SBRCurvExtr1",
"Objects:=", Array( "RegularPolyhedron1"), "Dis-
ableForFacetedSurfaces:=", true)
oModule.AssignCurvatureExtractionOp("SBRCurvExtr1",
Python [
Example "NAME:SBRCurvExtr1",
"DisableForFacetedSurfaces:=", True
])
AssignSkinDepthLayerSetting
Use: Assigns a skin-depth layer settings to the selected edges.
Command: Click Mesh > Assign Mesh Operation > On Selection > Skin Depth Based
Syntax: AssignSkinDepthLayerSetting Array("NAME:<LayerSettingName>", "Enabled:=", <Set-
tingEnabled>, "Edges:=", Array(<EdgeIDArray>), "SkinDepth:=", "<SkinDepthValue>", "NumLay-
ers:=", "<LayerNumber>")
Return Value: None
Parameters: <LayerSettingName>
The name of the skin depth layer setting.
<SettingEnabled>
Boolean: "Enabled:=", true
<EdgeIDArray>
Array of edge IDs. "Edges:=", Array(10, 12, 13)
<SkinDepthValue>
Skin depth value with unit. "SkinDepth:=", "1mm"
<LayerNumber>
Integer, the number of layers. "NumLayers:=", "2"
Example: oModule.AssignSkinDepthLayerSetting Array("NAME:Sk-
inDepthLayer1",
"Enabled:=", true
"Edges:=", Array(10, 12, 13),
"SkinDepth:=", "1mm",
"NumLayers:=", 2)
AssignSkinDepthOp
Assigns a skin-depth based operations to the selection.
Command: HFSS or 2D Extractor or Maxwell 3D or Maxwell 2D > Mesh > Assign
Mesh Operation > On Selection > Skin Depth Based
Syntax: AssignSkinDepthOp <SkinDepthOpParams>
Return Value: None
Parameters: <SkinDepthOpParams>
Array("NAME:<OpName>",
"Faces:=", <AssignmentFaces>,
"RestrictElem:=", <bool>,
"NumMaxElem:=", <int>,
"SkinDepth:=", <value>,
"SurfTriMaxLength:=", <value>,
"NumLayers:=", <int>)
RestrictElem
If true, NumMaxElem should be specified.
VB Example:
oModule.AssignSkinDepthOp Array("NAME:SkinDepth1", _
"Faces:=", Array(7), _
"RestrictElem:=", true, _
"NumMaxElem:=", 1000, _
"SkinDepth:=", "1mm", _
"SurfTriMaxLength:=", "1mm", _
"NumLayers:=", 2)
AssignTrueSurfOp
Assigns a true surface-based mesh operation on the selection.
Command: HFSS or Q3D Extractor or 2D Extractor or Maxwell 3D or Maxwell 2D > Mesh
> Assign Mesh Operation > Surface Approximation
Syntax: AssignTrueSurfOp <TrueSurfOpParams>
Return Value: None
Parameters: <TrueSurfOpParams>
Array("NAME:<OpName>",
"Faces:=", <AssignmentFaces>,
"SurfDevChoice:=", <RadioOption>,
"SurfDev:=", <value>,
"NormalDevChoice:=", <RadioOption>,
"NormalDev:=", <value>,
"AspectRatioChoice:=", <RadioOption>,
"AspectRatio:=", <double>)
<RadioOption>
Type: <int>
0: Ignore
1: Use defaults
2: Specify the value
VB Example:
oModule.AssignTrueSurfOp Array("NAME:TrueSurf1",
"Faces:=", Array(9), _
"SurfDevChoice:=", 2, _
"SurfDev:=", "0.04123105626mm", _
"NormalDevChoice:=", 2, _
"NormalDev:=", "15deg", _
"AspectRatioChoice:=", 1)
EditApplyCurvilinearElementsOp
Edits a curvilinear elements mesh operation to the selection.
Command: Edit>Properties.
Syntax: EditApplyCurvilinarElementsOp <CurvilinearElementsOpParams>
Return Value: None
Parameters: <CurvilinearnElementsOpParams>
Array("NAME:<OpName>",
"Faces:=", <AssignmentFaces>, | "Objects:=", Array("objectID")
"Apply:=", <bool>,
RestrictElem
If true, NumMaxElem should be specified.
VB Example:
oModule.EditApplyCurvlinearElementsOp Array("NAME:ApplyCurvilinear1", "Objects:=", Array(
"Sphere1"), "Apply:=", true)
EditLengthOp
Use: Edits an existing length-based operation. This cannot be used to modify assignments.
Instead, the mesh operation should be deleted and a new one created.
Command: Double-click the operation in the project tree to modify its settings.
Syntax: EditLengthOp <OpName>, <LengthOpParams>
Return Value: None
VB Example:
oModule.EditLengthOpK "Length1", Array("NAME:Length1", _
"RefineInside:=", false, _
"RestrictElem:=", false, _
"RestrictLength:=", true, _
"MaxLength:=", "2mm")
EditModelResolutionOp
Use: Assigns a model resolution name, value and unit for mesh operations. If UseAutoLength is
true, the Defeature length is not used.
Command: Double-click the operation in the project tree to modify its settings.
Syntax: EditModelResolutionOp Array(<ModelResParams>)
Return Value:
Parameters: Array("NAME:<string>",
EditSBRCurvatureExtractionOp (Beta)
Edits a curvature extraction operation to the selection for an SBR+ object or face.
Command: Edit Propeties
Syntax: EditSBRCurvatureExtractionOp <CurvilinearElementsOpParams>
Return Value: None
Parameters: <CurvilinearnElementsOpParams>
Array("NAME:<OpName>",
"Faces:=", <AssignmentFaces>, | "Objects:=", Array("objectID")
"Apply:=", <bool>)
VB Example:
oModule.EditSBRApplyCurvlinearElementsOp Array("NAME:ApplyCurvilinear1", "Objects:=",
Array( "Sphere1"), "Apply:=", true)
EditSkinDepthOp
Use: Modifies an existing skin-depth based mesh operation. Assignments cannot be changed
using this command. To change the assignment, you must delete operation and create it using a
new assignment.
Command: Double-click the operation in the project tree to modify its settings.
Syntax: EditSkinDepthOp <OpName>, <SkinDepthOpParams>
Return Value: None
VB Example:
oModule.EditSkinDepthOp "SkinDepth1",
Array("NAME:SkinD",_
"RestrictElem:=", false, _
"SkinDepth:=", "2mm", _
"SurfTriMaxLength:=", "1mm", _
"NumLayers:=", 2)
EditTrueSurfOp
Use: Modifies an existing true surface approximation-based mesh operation. Assignments cannot
be changed using this command. To change the assignment, delete this operation and create it
using a new assignment.
Command: Double-click the operation in the project tree to modify its settings.
Syntax: EditTrueSurfOp <OpName>, <TrueSurfOpParams>
Return Value: None
VB Example:
oModule.EditTrueSurfOp "TrueSurf2",
Array("NAME:trusurf", _
"SurfDevChoice:=", 2, _
"SurfDev:=","0.03mm", _
"NormalDevChoice:=", 1, _
"AspectRatioChoice:=", 2, _
"AspectRatio:=", 10)
InitialMeshSettings
Use: Assigns a true surface-based mesh operation to the selection.
Command: Maxwell3D or Maxwell2D > Mesh > Initial Mesh Settings
Syntax: InitialMeshSettings <InitialMeshSettingsParams>
Return Value: None
Parameters: <InitialMeshSettingsParams>
Array("NAME:<MeshSettings>",
"CurvedSurfaceApproxChoice:=", "UseSlider" or "Manual Settings">
"UseLegacyFaceterForTauVolumeMesh:=", false, _
"UseFlexMeshingForTAUvolumeMesh:=", true)
VBS Example:Using Slider
oModule.InitialMeshSettings Array("NAME:MeshSettings", Array("NAME:G-
lobalSurfApproximation", _
"CurvedSurfaceApproxChoice:=", "UseSlider", "Slider-
MeshSettings:=", 5), _
Array("NAME:GlobalCurvilinear", "Apply:=", false), _
Array("NAME:GlobalModelRes", "UseAutoLength:=", true), "MeshMeth-
od:=", "Auto", _
"UseLegacyFaceterForTauVolumeMesh:=", false, _
"UseFlexMeshingForTAUvolumeMesh:=", true)
oModule.InitialMeshSettings(
[
"NAME:MeshSettings", [ "NAME:G-
lobalSurfApproximation", _
"CurvedSurfaceApproxChoice:=", "UseSlider", "Slider-
MeshSettings:=" , 5 ], _
Python [ "NAME:GlobalCurvilinear", "Apply:=" , False ], _
Example
[ "NAME:GlobalModelRes", "UseAutoLength:=" , True ],
_
"MeshMethod:=" , "Auto", _
"UseLegacyFaceterForTauVolumeMesh:=", False, _
"UseFlexMeshingForTAUvolumeMesh:=", False _
])
RevertAllToInitial
RevertSetupToInitial
ClearLinkedData (Module)
Clear the linked data of all the solution setups. Similar to the ClearLinkedData command for the
design level.
Right-click menu of individual setups under the Analysis item.
Project Manager > Design name > Analysis > right-click Setup name >
UI Access
Clear Linked Data
oProject = oDesktop.GetActiveProject()
VB Syntax ClearLinkedData(<SetupNameArray>)
VB oModule.ClearLinkedData(Array("setup1"))
Example
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 Manager, and then click Rename on the
shortcut menu.
Syntax: DeleteDrivenSweep <SetupName>, <SweepName>
Return Value: None
DeleteSetups
Use: Deletes one or more solution setups, which are specified by an array of solution setup names.
Command: Right-click a solution setup in the project tree and then click Delete on the shortcut
menu, or delete selected solution setups in the List dialog box.
Syntax: DeleteSetups <SetupArray>
Return Value: None
Parameters: <SetupArray>
Array(<name1>, <name2>, ...)
VB Example:
oModule.DeleteSetups Array("Setup1", "Setup2")
DeleteSweep [HFSS-IE]
Use: Deletes a frequency sweep.
Command: Right-click a frequency sweep in the Project Manager, and then click Rename on the
shortcut 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"
EditCircuitSettings
Use: Exports equivalent circuit data.
Command: Right-click the Analysis folder, and then choose Edit Circuit Settings.
Syntax: EditCircuitSettings <ExportSettings>
Return Value: None
Parameters: <ExportSettings>
See ExportCircuit for details.
VB Example: oModule.EditCircuitSettings Array("NAME:CircuitData",
"MatrixName:=", "Original", _
"NumberOfCells:=", "1", "UserHasChangedSettings:=", true,
"IncludeCap:=", true, "IncludeCond:=", _
true, Array("NAME:CouplingLimits", "CouplingLimitType:=", "By Frac-
tion", "CapFraction:=", 0.01, _
"IndFraction:=", 0.01, "ResFraction:=", 0.01, "CondFraction:=",
0.01), "IncludeDCR:=", false, _
"IncudeDCL:=", false, "IncludeACR:=", false, "IncludeACL:=", false,
"ADDResistance:=", true)
EditFrequencySweep
Use: Modifies an existing frequency sweep. For HFSS-IE use EditSweep [HFSS-IE]
Command: Double-click a frequency sweep in the Project Manager to modify its settings.
Syntax: EditFrequencySweep <SetupName>, <SweepName>, <AttributesArray>
Return Value: None
Parameters: <SetupName>
Type: <string>
Name of the solution setup containing the sweep to be edited.
<SweepName>
Type: <string>
Name of the sweep to be edited.
<Attributes Array>
Array("NAME:<SweepName>",
"IsEnabled:=", <boolean>,
"SetupType:=", <SetupType>,
<FrequencyInformation>,
"Type:=", <SweepType>,
<SaveFieldsList>
<DCExtrapInfo>)
See the InsertFrequencySweep command for details.
Example:
oModule.EditFrequencySweep "Setup1", "Sweep3", _
Array("NAME:Sweep3", "IsEnabled:=", true, _
"SetupType:=", "SinglePoints", _
"ValueList:=", Array("1GHz", "2GHz", "3GHz"), _
"Type:=", "Discrete", _
"SaveFieldsList:=", Array(false, false, false), _
"ExtrapToDC:=", false)
EditSetup
Use: Modifies an existing solution setup.
Command: Double-click a solution setup in the project tree to modify its settings.
Syntax: EditSetup <SetupName>, <AttributesArray>
Return Value: None
Parameters: <SetupName>
Type: <string>
Name of the solution setup being edited.
<AttributesArray>
Array("NAME:<NewSetupName>", <NamedParameters>)
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 Manager 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,
EditSweep [HFSS-IE]
Use: Modifies an existing sweep in HFSS-IE.
Command: Double-click a frequency sweep in the Project Manager 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>, ...)
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>
Model name or name of the sub circuit (Optional). If not specified
then <FileName> is considered as model name.
<Freq>
Type: <double>
Sweep frequecny in hz.
<ExportSettings>
Array("NAME:CircuitData", "MatrixName:=", _
<ReduceMatrix>, "NumberOfCells:=", <NumCell>, "User-
HasChangedSettings:=", <UserChangedSettings>, "IncludeCap:=",
<IncludeCap>, "IncludeCond:=", <IncludeCond>, Array("NAME:Coup-
lingLimits", <CouplingLimitsArray>, "IncludeDCR:=", <IncludeDCR>,
"IncludeDCL:=", <IncludeDCL>, "IncludeACR:=", <IncludeACR>,
"IncludeACL:=", <IncludeACL>, "ADDResistance:=", <AddResistance>)
Parameters:
<ReduceMatrix>
Type: <string>
One of the reduced matrix setup or "Original"
<NumCell>
Type: <string>
Number of cells in export. Can be a variable.
<UserChangedSettings>
Type: <bool>
Whether user changed settings or use default settings.
<IncludeCap>
Type: <bool>
Flag indicates whether to export Capacitance matrix.
<IncludeCond>
Type: <bool>
Note:
<CouplingLimitsArray>
Array("NAME:CouplingLimits", "CouplingLimitType:=", <Coup-
lingLimitType>, _
<CouplingLimitsParameters>, 0.01, "CondFraction:=", 0.01)
<CouplingLimitType> = "None"
Argument not needed
<CouplingLimitType> = "ByFraction"
<CouplingLimitsParameters>
"CapFraction:=", <Fraction>, "IndFraction:=", <Fraction>,
"ResFraction:=", <Fraction>,"CondFraction:=",<Fraction>,
Parameters:
<Fraction>
Type: <double>
Fraction of the self term
<CouplingLimitType> = "ByValue"
<CouplingLimitsParameters>
"CapLimit:=", <Limit>, "IndLimit:=", <Limit>, "ResLimit:=",
<Limit>,
"CondLimit:=", <Limit>,
Parameters:
<Limit>
Type: <string>
Value of the limit.
VB Example:
oModule.ExportCircuit
"Setup1 : LastAdaptive", "", "C:/Project/Q3D/FourNets.cir", Array
("NAME:CircuitData", _
"MatrixName:=", "Original", "NumberOfCells:=", "1", "User-
HasChangedSettings:=", true, _
"IncludeCap:=", true, "IncludeCond:=", true, Array("NAME:Coup-
lingLimits", "CouplingLimitType:=", _
"By Fraction", "CapFraction:=", 0.01, "IndFraction:=", 0.01,
"ResFraction:=", 0.01, _
"CondFraction:=", 0.01), "IncludeDCR:=", false, IncudeDCL:=", false,
"IncludeACR:=", false, _
"IncludeACL:=", false, "ADDResistance:=", true), "", 2000000000000
GetSetupCount
Gets the number of analysis setups in a design.
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()
GetSetupNames
Use: Gets the names of far field and near field radiation setups in a design.
Syntax: GetSetupNames(<RadiationType>)
Return Value: Array of setup names.
Parameters: <RadiationType>
Type: <string>
For example: "Sphere"
VB Example:
Set setupnames = oModule.GetSetupNames("Infinite Sphere")
For Each setup in setupnames
Msgbox setup
Next
GetSweepCount
Gets the number of sweeps in a given analysis setup.
Syntax: GetSweepCount(<SetupName>)
Return Value: Number of sweeos for the named setup.
Parameters: <SetupName>
Type: <string>
Name of the setup.
VB Example:
sweepcount = oModule.GetSweepCount("Setup1")
GetSweeps
Gets the names of all sweeps in a given analysis setup.
Syntax: GetSweeps(<SetupName>)
Return Value: Array of sweep names.
Parameters: <SetupName>
Type: <string>
Name of the setup.
VB Example:
sweepnames = oModule.GetSweeps("Setup1")
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>)
"RangeStart:=", "1GHz",
"RangeEnd:=", "10GHz",
"RangeStep:=", "0.1GHz",
"Type:=", "Discrete",
"SaveFields:=", false,
"SaveRadFields:=", false,
"ExtrapToDC:=", false)
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)
Syntax: InsertSweep
Return Value: None
Parameters: oModule.InsertSweep <SetupName>, <SweepDataArray>
<SetupName>
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", "StepS-
ize:=", _
"1GHz", "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:=", _
"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", "StepS-
ize:=", _
"1GHz", "Type:=", "Interpolating", "SaveFields:=", false, "Inter-
pTolerance:=", _
0.01, "InterpMaxSolns:=", 9, "InterpMinSolns:=", 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>
"StartValue:=", <StartValue>,"StopValue:=",<StopValue>, "SamplesPerDecade:=", <Samples>
<StartValue>
Type: <String>
Start frequency.
<StopValue>
Type: <String>
Stop Frequency
<Samples>
Type: <integer>
Number of samples per decade.
<SinglePointsParameters>
"ValueList:=", Array(<FrequencyPoint>,<FrequencyPoint> ..),
<FrequencyPoint>
Type: <String>
Single frequency point.
<SweepType>
Type: <String>
Note:
Type: <Integer>
Maximum basis points for interpolating sweep.
<MinSolutions>
Type: <Integer>
Minimum basis points for interpolating sweep.
<InterpMinSubRanges>
Type: <Integer>
Minimum number of subranges in the interpolator.
VB Example:
oModule.InsertSweep "Setup4", Array("NAME:Sweep2", "IsEnabled:=",
true, "SetupType:=", _
"LinearStep", "StartValue:=", "1GHz", "StopValue:=", "10GHz", "StepS-
ize:=", _
"1GHz", "Type:=", "Interpolating", "SaveFields:=", false, "Inter-
pTolerance:=", _
0.01, "InterpMaxSolns:=", 9, "InterpMinSolns:=", 4, Inter-
pMinSubranges:=", 2
VB Example: oModule.InsertSweep "Setup4", Array("NAME:Sweep1", "IsEn-
abled:=", true, "SetupType:=", _
"LinearStep", "StartValue:=", "1GHz", "StopValue:=", "10GHz", "StepS-
ize:=", _
"1GHz", "Type:=", "Discrete", "SaveFields:=", true)
VB Example: oModule.InsertSweep "Setup4", Array("NAME:Sweep2", "IsEn-
abled:=", true, "SetupType:=", _
"LinearStep", "StartValue:=", "1GHz", "StopValue:=", "10GHz", "StepS-
ize:=", _
"1GHz", "Type:=", "Interpolating", "SaveFields:=", false, "Inter-
pTolerance:=", _
0.01, "InterpMaxSolns:=", 9, "InterpMinSolns:=", 4)
InsertSetup
Use: Adds a new solution setup.
Command: [product]>Analysis Setup>Add Solution Setup
Syntax: InsertSetup <SetupType>, <AttributesArray>
Return Value: None
Parameters: <SetupType>
Type: <string>
"HfssDriven" or "HfssDrivenAuto" or "HfssEigen". Must match the HFSS solution type.
<AttributesArray>
Array("NAME:<SetupName>", <Named Parameters>)
<Named Parameters>
The named parameters will vary according to the solution type and the selections made.
The parameters correspond to fields in the Setup dialog box. 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,
"ListsForFields:=", ["Facelist1", "Facelist2"],
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.
"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)
"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.
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
VB Example:
An Driven Solution type with Broadband specified.
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
oModule.InsertSetup("HfssDrivenAuto",
[
"NAME:Setup1",
"IsEnabled:=" , True,
"AutoSolverSetting:=" , "Balanced",
[
"NAME:Sweeps",
[
"NAME:Sweep",
Python
"RangeType:=" , "LinearStep",
Example
"RangeStart:=" , "1GHz",
"RangeEnd:=" , "10GHz",
"RangeStep:=" , "1GHz"
]
],
"SaveRadFieldsOnly:=" , False,
"SaveAnyFields:=" , True,
"Type:=" , "Discrete"
])
Python oModule.InsertSetup("HfssDriven",
Example
[ "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,
"SetPortMinMaxTri:=" , False,
"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 ])
Type: <string>
Flag to indicate whether the fields are saved for last adaptive
solution. (True or False).
<Enabled>
Type: <bool>
Flag to indicate whether the setup is enabled.
<AdaptFreq>
Type: <String>
Frequency with units.
<SolverParam>
Array("NAME:Cap", "Residual:=", <Residual>, <AdaptParam>),
Array("NAME:DC", "Residual:=", <Residual>, "SolveResOnly:=",
<SolveResOnly>, Array("NAME:Cond", <AdaptParam>), Array("NAME:Mult",
<AdaptParam>)),
Array("NAME:AC", "Residual:=", 1E-005, Array("NAME:Cond",
<AdaptParam>), Array("NAME:Mult", <AdaptParam>))
Parameters:
<ACFreq>
Type: <string>
Frequency of the AC solution.
<Residual>
Type: <double>
Solver residual.
<SolveResOnly>
Type: <bool>
Solve resistance only for a DC solution.
<AdaptParam>
"MaxPass:=", <MaxPass>, "PerError:=", <PerError>,
"PerRefine:=", <PerRefine>
Parameters:
<MaxPass>
Type: <int>
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", "Max-
imumPasses:=", 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
Syntax: InsertSetup <SetupType>, <AttributesArray>
Return Value: None
Parameters: <SetupType>
Type: <string>
"HfssTransient". Must match the HFSS solution type.
<AttributesArray>
Array("NAME:<SetupName>", <Named Parameters>)
<Named Parameters>
The parameters correspond to fields in the Setup dialog. For example, here is default
dialog for an HFSS Transient driven Composite Excitation setup with one excitation
assigned. To see the required parameters for a specific set of parameters and their
format, use the record script function, and view the resulting script in a text editor.
The first part of a vbs script corresponds to the fields and selections on the General tab:
Set oModule = oDesign.GetModule("AnalysisSetup")
oModule.InsertSetup "HfssTransient", Array("NAME:Setup1", "Fre-
quency:=", "5GHz", "MaxDeltaE:=", 0.1, _"MaximumPasses:=", 6, "UseIm-
plicitSolver:=", true, "IsEnabled:=", true,
The next parameters correspond to fields and selections on the Saved Fields tab:
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 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",
[
"NAME:Setup2",
"Frequency:=" , "5GHz",
Python "MaxDeltaS:=" , 0.02,
Example "MaximumPasses:=" , 20,
"UseImplicitSolver:=" , True,
"IsEnabled:=" , True,
"BasisOrder:=" , -1,
[
"NAME:Transient",
"TimeProfile:=" , "Broadband Pulse",
"HfssFrequency:=" , "5GHz",
"MinFreq:=" , "100MHz",
"MaxFreq:=" , "1GHz",
"NumFreqsExtracted:=" , 401,
"SweepMinFreq:=" , "100MHz",
"SweepMaxFreq:=" , "1GHz",
"ListsForFields:=" , ["Facelist1"],
"UseSaveCount:=" , 1,
"SaveCount:=" , 256,
"UseSaveStart:=" , 1,
"SaveStart:=" , "0s",
"UseSaveDelta:=" , 1,
"SaveDelta:=" , "10ps",
"SaveRadFields:=" , 0,
"SaveFDRadFields:=" , 0,
"UseAutoTermination:=" , 1,
"SteadyStateCriteria:=" , 0.01,
"UseMinimumDuration:=" , 0,
"TerminateOnMaximum:=" , 0
]
])
InsertSweep [HFSS-IE]
Adds a frequency sweep to a Driven solution-type setup in HFSS-IE.
Command:HFSS-IE>Analysis Setup>Add Sweep
Syntax: InsertSweep <SetupName>, <AttributesArray>
Return Value: None
Parameters: <SetupName>
Type: <string>
Name of the solution setup into which the sweep will be inserted.
<Attributes Array>
Array("NAME:<SweepName>",
"IsEnabled:=", true,
"SetupType:=", <SetupType>,
"Type:=", <SweepType>,
<FrequencyInformation>,
<SaveFieldsList>
<DCExtrapInfo>)
<SweepType>
Type: <string>
Ex. "Discrete", "Fast", or "Interpolating".
<SetupType>
Type: <string>
Ex. "LinearSetup", "LinearCount", or "SinglePoints".
<FrequencyInformation>
This will vary based on the sweep and solution type. See the examples below.
<DCExtrapInfo>
Information about whether and how to perform DC extrapolation. This parameter is not
used for Discrete sweeps. See the examples below.
<additionalRanges>
Array( "SetupType:=", "<SetupType>",
"StartValue:=", "<ValueUnits>",
"StopValue:=", "<ValueUnits", "Count:=", <value>, ...)
VB Example:Discrete Sweep
"StepSize:=", "0.1GHz", _
"Type:=", "Discrete", _
"SaveFields:=", false, "ExtrapToDC:=", false)
VB Example:Fast Sweep
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 Manager and then click Rename on the
shortcut 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 Manager and then click Rename on the short-
cut menu.
Syntax: RenameSetup <OldName>, <NewName>
Return Value: None
Parameters: <OldName>
Type: <string>
Name of the solution setup being renamed.
<NewName>
Type: <string>
New name for the solution setup.
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 Manager and then click Rename on the
shortcut menu.
Syntax: RenameSweep <SetupName>, <OldSweepName>,
<NewSweepName>
Return Value: None
VB Example:
oModule.RenameSweep "Setup1", "Sweep1", "MySweep"
RevertAllToInitial
Use: Marks the current mesh for all solution setups as invalid. This will force the next simulation to
begin with the initial mesh.
Command: [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.
SetMPIVendor
The documented command is applicable for Q3D Extractor.
Use: Specify vendor name.
Syntax: SetMPIVendor <vendorname>, <product name>
Return Value: None
Parameters: <vendorname>
Type: <String>
Name of MPI vendor. Possible values are "Intel", "Plat-
formComputing"
<product name>
Type: <String>
Valid value is "Q3D Extractor". It is optional input, if not spe-
cified the default value is "Q3D Extractor"
oAnsoftApp.SetMPIVendor "Intel", "Q3D Extractor"
15-54
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Type: <double>
Inequality value.
<OptiGoalSpec>
"Solution:=", <Soln>, "Calculation:=", <Calc>,
"Context:=, <Geometry>
Array("NAME:Ranges",
"Range:", Array("Var:=",
<VarName>, "Type:=", <RangeType>, "Start:=",
<StartV>, "Stop:=", <StopV>), ...
"Range:", Array("Var:=", <VarName>, "Type:=",
<RangeType>, "Start:=", <StartV>, "Stop:=",
<StopV>))
<Soln>
Type: <string>
Name of the solution.
<Calc>
Type: <string>
An expression that is composed of a basic solution quantity and an
output variable.
<ContextName>
Type: <string>
Name of context needed in the evaluation of <Calc>.
<Geometry>
Type: <string>
Name of geometry needed in the evaluation of <Calc>.
<RangeType>
Type: <string>
if "r", start and stop values specify a range for the variable.
if "s", start values specify the single value for the variable.
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…
"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
GetChildNames [Optimetrics]
If used without a specific optimization setup name, gets a list of all setups for all types. If a with a
specific setup name, returns names for that optimization setup.
UI Access NA
oOptimModule = oDesign.GetChildObject(“Optimetrics”)
Python
arrAllSetup = oOptimModule.GetChildNames()
Example
arrParmSetup = oOptimModule.GetChildNames(“'OptiPara-
metric'”)
arrOptimizeSetup = oOptimModule.GetChildNames(“'Optim-
ization'”)
GetChildObject [Optimetrics]
Gets a Setup Object of the Optimetrics module
UI Access NA
A script object for the setup See discussion of Optimetrics Setup Objects in
Return Value Object Script Property Function Summary.
oParamSetup = oOptModule.GetChildObject('Para-
Python metricSetup1')
Example oOptSetup = oOptModule.GetChildObject('Optim-
izationSetup1')
GetChildTypes [Optimetrics]
Use: Gets child types of queried Optimetrics module.
Syntax: GetChildTypes()
Return Value: Array of text string, it can be an empty array if there is no setup is defined. There are
six types of setup, they are ['OptiParametric', 'OptiOptimization', 'OptiSensitivity', 'OptiStatistical',
'OptiDesignExplorer', 'OptiDXDOE'].
GetPropNames [Optimetrics]
Use: Always returns the empty set for Optimetrics objects since they do not have properties.
Syntax: GetPropNames(bIncludeReadOnly)
Return Value: Returns empty set.
Parameters: bIncludeReadOnly—optional, default to True.
oOptModule.GetPropNames()
Python
oOptModule.GetPropNames(True)
Example
oOptModule.GetPropNames(False)
GetPropValue [Optimetrics]
Returns the property value for a setup property.
UI Access NA
oOptModule.GetPropValue("OptimizationSetup1\Optimizer")
//get the optimizer name for OptimizationSetup1
Python
Example oOptModule.GetPropValue("Optim-
izationSetup1\Optimizer\Choices") //Get the menu prop-
erty’s menu items. In this case all Optimizer names.
VB Syn- GetPropValue()
tax
VB GetPropValue(“Optimetrics/OptimizationSetup1/Enabled”)
Example
Returns True if Enabled, or False if disabled.
GetSetupNames [Optimetrics]
Gets a list of Optimetrics setup names
UI Access NA
oModule = oDesign.GetModule("Optimetrics")
Python
Example setupNames = oModule.GetSetupNames()
VB Syn- GetSetupNames()
tax
GetSetupNamesByType [Optimetrics]
Gets a list of Optimetrics setup names by type.
UI Access NA
AddInfoMessage(str(name))
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.
SetPropValue [Optimetrics]
Sets the property value for the active Optimetrics setup.
Return Value True if the property is found and the new value is valid. Otherwise return False.
oOptModule.SetPropValue("ParametricSetup1\Enabled",
Python False) //disable ParametricSetup1
Example oOptModule.SetPropValue("Optim-
izationSetup1/Optimizer","Quasi Newton")
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.
ExportParametricSetupTable
Exports the parametric setup table as a CSV file.
Pyth- oModule.ExportParametricSetupTable('ParametricSetup1',
on 'E:/Files/ParametricSetup1_Table.csv')
Exa-
mple
VB obj.ExportParametricSetupTable "ParametricSetup1",
Exa- "E:/Files/ParametricSetup1_Table.csv"
mple
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.
Parameters
<VarName>, "Data:=", <SweepData>,
"Synchronize:=", <SyncNum>), ...
Array("NAME:SweepDefinition", "Variable:=",
tax
oModule.InsertSetup(
"OptiParametric",
["NAME:ParametricSetup1", _
"SaveFields:=", true, _
["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", _
Python
Example "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"]]]]]])
"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",
Python
[
Example
"NAME:OptimizationSetup1",
"UseFastCalculationUpdateAlgo:=", False,
"FastCalcOptCtrledByUser:=", False,
"IsEnabled:=", True,
"SaveSolutions:=", False,
[
"NAME:StartingPoint"
],
"Optimizer:=", "Quasi Newton",
[
"NAME:AnalysisStopOptions",
"StopForNumIteration:=" , True,
"StopForElapsTime:=", False,
"StopForSlowImprovement:=", False,
"StopForGrdTolerance:=", False,
"MaxNumIteration:=",1000,
"MaxSolTimeInSec:=",3600,
"RelGradientTolerance:=", 0,
"MinNumIteration:=", 10
],
"CostFuncNormType:=", "L2",
"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:=",
_
VB false, "MaxNumIteration:=", 1000, "MaxSolTimeInSec:=",
Exam-
ple 3600, "RelGradientTolerance:=", _
0, "MinNumIteration:=", 10), "CostFuncNormType:=",
"L2", "PriorPSetup:=", "", "PreSolvePSetup:=", _
true, Array("NAME:Variables"), Array("NAME:LCS"),
Array("NAME:Goals", Array("NAME:Goal", "ReportType:=", _
"Standard", "Solution:=", "TR", Array("NAME: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:=",
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.
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>
<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",_
Python
Example "$width:=", "14.5mm"], _
"Optimizer:=", "Quasi Newton", _
"MaxIterations:=", 100, _
"PriorPSetup:=", "ParametricSetup1", _
"PreSolvePSetup:=", true, _
["NAME:Variables", _
"$length:=", ["i:=", true, "Min:=", "6mm",_
"Max:=", "18mm", _
"MinStep:=", "0.001mm", "MaxStep:=", _
"1.2mm"], _
"$width:=", ["i:=", true, "Min:=", _
"6.5mm", "Max:=", "19.5mm", _
"MinStep:=", "0.001mm", "MaxStep:=", _
"1.3mm"]], _
["NAME:LCS"], _
["NAME:Goals", _
["NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive", _
"Calculation:=", "reflect", _
"Context:=", "", _
["NAME:Ranges", _
"Range:=", ["Var:=", "Freq", _
"Type:=", "s", _
"Start:=", "8GHz", "Stop:=", "8GHz"]], _
"Condition:=", "<=", _
["NAME:GoalValue", _
"GoalValueType:=", "Independent", _
"Format:=", "Real/Imag", _
"bG:=", ["v:=", "[0.0001]"]], _
"Weight:=", "[1]"]],
"Acceptable_Cost:=", 0.0002, _
"Noise:=", 0.0001, _
"UpdateDesign:=", true, _
"UpdateIteration:=", 5, _
"KeepReportAxis:=", true, _
"UpdateDesignWhenDone:=", true)
"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",
[
"NAME:OptimizationSetup1",
"UseFastCalculationUpdateAlgo:=", False,
"FastCalcOptCtrledByUser:=", False,
"IsEnabled:=", True,
"SaveSolutions:=", False,
[
"NAME:StartingPoint"
],
"Optimizer:=", "Quasi Newton",
[
"NAME:AnalysisStopOptions",
Python
Exampl- "StopForNumIteration:=", True,
e
"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
])
"MaxNumIteration:=", 1001,
"MaxSolTimeInSec:=", 3600,
"RelGradientTolerance:=", 0,
"MinNumIteration:=" , 10
),
"CostFuncNormType:=", "L2",
"PriorPSetup:=", "",
"PreSolvePSetup:=", True,
Array(
"NAME:Variables"
),
Array(
"NAME:LCS"
),
Array(
"NAME:Goals",
Array(
"NAME:Goal",
"ReportType:=", "Standard",
"Solution:=", "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",
InsertSetup [Sensitivity]
Inserts a new sensitivity setup.
itivityVars>,
<Constraint>,
Array("NAME:Goals", Array("NAME:Goal",
<OptiGoalSpec>), ..., Array("NAME:Goal",
<OptiGoalSpec>)), "Master Goal:=". <Master-
GoalID>,
"MasterError:=", <MasterError>)
<SensitivityVars> Array Array("NAME:Variables",
"VarName:=", Array("i:=", <IncludeVar>,
"Min:=", <MinV>, "Max:=", <MaxV>,
"IDisp:=", <InitialDisp>),...
"VarName:=", Array("i:=", <IncludeVar>,
"Min:=", <MinV>, "Max:=", <MaxV>,
"IDisp:=", <InitialDisp>))
<InitialDisp> VarValue Index of the master goal. Index starts from
zero.
<MasterError> Double Error associated with the master goal.
oModule.InsertSetup(
"OptiSensitivity", _
["NAME:SensitivitySetup1",_
"SaveFields:=", true,_
["NAME:StartingPoint"], _
Python
Example "MaxIterations:=", 20,_
"PriorPSetup:=", "",_
"PreSolvePSetup:=", true, _
["NAME:Variables"], _
["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])
"PreSolvePSetup:=", true, _
Array("NAME:Variables"), _
Array("NAME:LCS"),_
Array("NAME:Goals",_
Array("NAME:Goal", _
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "returnloss",_
"Context:=", "",_
Array("NAME:Ranges",_
"Range:=", Array("Var:=", "Freq", "_
Type:=", "s",_
"Start:=", "8GHz", "Stop:=", "8GHz"))),_
Array("NAME:Goal",_
"Solution:=", "Setup1 : LastAdaptive",_
"Calculation:=", "reflect",_
"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:
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.
form".
<Tolerance> VarValue The tolerance for the variable when dis-
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", _
Python
["NAME:Goal", _
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"]]]])
Array("NAME:Ranges",_
"Range:=", Array("Var:=", "Freq", "Type:=",_
"s", "Start:=", "8GHz", "Stop:=", "8GHz"))))
Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
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",
"offset:=", Array("i:=", true,
"int:=", false,
"Dist:=", "Gaussian",
"Tol:=", "10%",
"StdD:=", ".5in",
"Min:=", "-3",
"Max:=", "3",
"Shape:=", "1",
"Scale:=", "0in",
"Location:=", "0in",
"Dataset:=", "",
"LatinHypercube:=", "true",
"VarMin:=", "-1in",
"VarMax:=", "1in",
"Prob:=", "0.01",
"Mean:=", "0in")),
Array("NAME:Goals", Array("NAME:Goal",
"ReportType:=", "Modal Solution Data",
"Solution:=", "Setup1 : LastAdaptive", Array("NAME:SimValueCon-
text"),
"Calculation:=", "Power11",
"Name:=", "Power11",
Array("NAME:Ranges",
"Range:=", Array("Var:=", "Freq", "Type:=", "d",
"DiscreteValues:=", "10GHz")))))
For Q3D Extractor and Circuit the command details are as follows:
Inserts a new statistical setup.
Command: Right-click Optimetrics in the project tree, and then click Add>Statistical on the
shortcut menu.
Syntax: InsertSetup "OptiStatistical", <StatisticalParams>
Return Value: None
Parameters: <StatisticalParams>
Array("NAME:<SetupName>", "SaveFields:=",
<SaveField>, <StartingPoint>, "MaxIterations:=",
<MaxIter>, "PriorPSetup:=", <PriorSetup>,
"PreSolvePSetup:=", <Preceed>, <StatisticalVars>,
Array("NAME:Goals", Array("NAME:Goal",
<OptiGoalSpec>), …, Array("NAME:Goal",
<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"))))
16-52
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
DeleteImportData
Deletes imported solution or table data in HFSS. Not in HFSS-IE
<ImportSpec>
Type: <string>
Format of string is "importname:solnnameORtablename".
VB Example:
oModule.DeleteImportData _
Array("Import1:Adaptive_1", "Import2:DataTable")
EditSources
For HFSS, the command details are as follows. Note that the syntax has changed for AEDT
18.2.
Indicates which source excitations should be used for fields post processing.
Command: HFSS or HFSS-IE>Fields>Edit Sources
Syntax: EditSources([["Name:=", "<portName>" , <keyword>, <value>, ...]...]
Return Value: None
Parameters:
Each inner block describes the values to be assigned to an individual excitation. The valid
keywords are:
Name - Required. This identifies the excitation and uses the same syntax as the edit source
dialog. As opposed to the old command, names can be specified in any order. Unspecified
excitations will not be affected, so users can edit one or more excitations without needing to
edit them all.
Magnitude - a unit quantity ("1W", "2mV", …)
Phase - a unit quantity ("1W", "2mV", …)
For Driven Terminal designs, a terminal may be terminated
Terminated - boolean ("true", "false"). If terminated, Magnitude and Phase are super-
seded with:
Resistance - a unit quantity ("50ohm", …)
ExciteModes - boolean. If true use modal excitations, otherwise use terminals. Terminal
excitations are specified by their name, magnitude, and phase
For Eigen problems:
The special excitation "Modes" specifies the modal excitations. These are then set with the
keywords
For all unit quantities, expressions ( "3 * my_var", "pwl( freq, ds1 )") are permitted as well.
For Q3D Extractor, the documented command details are as follows:
Indicates which source excitations should be used for fields post processing.
Command: Q3D Extractor or 2D Extractor>Fields>Edit Sources
Syntax: EditSources <FieldType>, <SourceArray>,
<MultiplicityArray>, <MagnitudeArray>,
<PhaseArray>, <TerminatedArray>, <ImpedanceArray>
Return Value: None
Parameters: <SourceSettings>
"Value Type:=", <UnitType>, <SourceArray>, <ValueArray>
Parameters:
<UnitType>
Type: <string>
In Q3D Extractor, possible types for DC and AC are "A" and "V".
The only type for Cap is "V".
In 2D Extractor, the CG solution uses only "V" and the RL solu-
tion uses only "A".
<SourceArray>
Array("NAME:SourceNames", <SourceName>, <SourceName>, …)
Parameters:
<SourceName>
Type: <string>
Net name for capacitance. Source name for AC and DC
<ValueArray>
Array("NAME:Source Values", <SourceValue>, <SourceValue>, …)
Parameters:
<SourceValue>
Type: <double>
The value associated with a source in
<SourceArray>.
oModule.EditSources Array("NAME:AC", "Value Type:=", "A", Array
("NAME:Source Names", _ "TheVia:Source1"), Array("NAME:Source Val-
ues", 1)),
Array("NAME:Cap", "Value Type:=", "N", _ Array("NAME:Source Names",
"GroundPlane", "TheVia"), Array("NAME:Source Values", 0, 1)), _
Array("NAME:DC", "Value Type:=", "V", Array("NAME:Source Names",
"TheVia:Source1"),
Array("NAME:Source Values", 1))
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, DeleteFieldVariation,
and DeleteLinked Variation.
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") )
DeleteVariation [HFSS]
Obsolete. Replaced by DeleteFullVariation, DeleteFieldVariation, and DeleteLinked Variation.
ExportEigenmodes
Exports a tab delimited table of Eigenmodes in HFSS. Not in HFSS-IE.
Command: None
Syntax: ExportEigenmodes
<setupName> <solutionName> <DesignVariationKey>
<filename>
Return Value: None
Parameters:
<SolutionName>
Type: <string>
Name of the solutions within the solution setup.
<DesignVariationKey>
Type: <string>
Design variation string.
VB Example:
Set oModule = oDesign.GetModule("Solutions")
oModule.ExportEigenmodes "Setup1 : LastAdaptive", "", _
"C:\mydir\myeigenmode" & _
".eig"
ExportForHSpice
Exports matrix solution data to a file in a format suitable for HSpice analysis. Available only for
Driven Terminal solution types with ports. Output in an appropriate format will be generated for
each of the non-empty file names provided.
Command: None
Syntax: ExportForHSpice
<DesignVariationKey>, <SolnSelectionArray>, <SpiceType>,
<BandWidth>, <FWSFile>, <LumpedElementFile>,
<PoleZeroSpiceFile>, <PoleZeroMatlabFile>,
<PartialFractionFile>,
<BandWidth>
Type: <int>
Possible value is:
0: Low (narrow) band width
<FWSFile>
Type: <string>
<LumpedElementFile>
Type: <string>
<PoleZeroSpiceFile>
Type: <string>
<PoleZeroMatlabFile>
Type: <string>
<PartialFractionFile>
Type: <string>
<FittingErrorInPercent>
Type: <float>
<MaximumOrder>
Type: <int>
Maximum number of poles in rational function expansion.
<UseCommonGround>
Type:<init>
0/1
<EnforcePassivity>
Type: : <int>
0/1
VB Example:
oModule.ExportForHSpice "width=’2in’", _
Array("Setup1:Sweep1"), 1, 0, _
"c:\mydir\Sweep1.fws", "", "", "", "", _
.005, 20, 200
ExportNetworkData
Exports matrix solution data to a file. Available only for Driven solution types with ports.
Command: None
Syntax: ExportNetworkData
<DesignVariationKey>, <SolnSelectionArray>, <FileFormat>,
<OutFile>,<FreqsArray>, <useExportFreqs>, <DoRenorm>, <RenormImped>
<dataType> <pass> <complexFormat> <Touch-
stoneNumberofDigitsPrecision> <IncludeGammaAndImpedanceComments>
<SupportNon-standardTouchstoneExtensions>
Return Value: None
Parameters: <SolnSelectionArray>
Array(<SolnSelector>, <SolnSelector>, ...)
If more than one array entry, this indicates a combined Interpolating sweep.
<SolnSelector>
Type: <string>
Gives solution setup name and solution name, separated by a colon.
<FileFormat>
Type: <int>
Possible values are:
2 : Tab delimited spreadsheet format (.tab)
3 : Touchstone (.sNp)
4 : CitiFile (.cit)
7 : Matlab (.m)
8 : Terminal Z0 spreadsheet
<OutFile>
Type: <string>
Full path to the file to write out.
<FreqsArray>
Type: Array of doubles or "All".
The frequencies to export. The <FreqsArray> argument contains a vector (e.g. "1GHz",
"2GHz", ...) to use, or "all". To export all frequencies, use Array("all").
<useExportFreqs>
Type: <bool>
Optional, currently always ignored.
<DoRenorm>
Type: <bool>
Specifies whether to renormalize the data before export.
<RenormImped>
Type: <double>
Real impedance value in ohms, for renormalization. Required in syntax,
Array("Setup1:Sweep1", "Setup1:Sweep2"), 3, _
"c:\mydir\out.s2p", Array(1.0e9, 1.5e9, 2.0e9), _
true, 50.0
VB Example: Touchstone Outputs with Precision, Gamma and Impedance
Comments, and support for mixed reference impedances.
oModule.ExportNetworkData "offset=" & Chr(39) & "0in" & Chr(39) &
"", Array("Setup1:Sweep1"), 3, "C:/MyDocuments/Tee_TeeModel.s3p",
Array("All"), true, 50, "S", -1, 0, 15, true, true, false
ExportNetworkData( [
"",
# Empty string.
1,
#The number 1.
"Name",
# This is the full path of the file from which the solution is loaded.
"ExportFile",
# full path of file to export to
"variation",
Pyth-
on # Pick a particular variation. Leave blank if no variation
Syn-
["NAME:Frequencies"],
tax
# optional, if none defined all frequencies are used
["NAME:Options",
# Export options object
"DataTypes:=", ["S"],
# DataTypes can be "S", "Y","Z", "G", and "Z0", for S , Y, Z matrix, Gamma and Z0 (zero)
"DisplayFormat:=", "MA",
# DisplayFormat "MA", "RI", "DB"
"FileType:=", "",
# Export File Type:
2 - Spreadsheet(*.tab)
3 - Touchstone(*.sNp)
4 - Citifile(*.cit)
6 - Neutral format(*.nmf)
7 - Matlab format(*.m)
"Renormalize:=", False,
# Renormalize True/False
"RefImpedance:=",50,
# Reference Impedance
"Precision:=", 8,
# Number of digits Precision
"CreateNPortModel:=", True
# Create a model based on the exported file True/False
])
import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oDesktop.RestoreWindow()
Pyth- oProject = oDesktop.SetActiveProject("package")
on
Exa- oDesign = oProject.SetActiveDesign("HFSSDesign1")
mple
oModule = oDesign.GetModule("Solutions")
oModule.ExportNetworkData("", ["Setup1:Sweep1"], 3, "C://Docu-
ments/package_HFSSDesign1.s4p", _
Array ('all'), True, 50, "S", -1, 0, 15, True, True, True)
ExportNMFData [HFSS]
Exports matrix solution data to a file in neutral model format. Available only for Driven solution
types with ports. Variables can be held constant by setting their values in the variation field. For
example: "length='50mm' width='30mm'". All other independent variables will be treated as NMF
parameters.
Command: None
Syntax: ExportNMFData
<SolnSelectionArray>, <OutFile>, <FreqsArray>,
<DesignVariationKey>, <DoRenorm>, <RenormImped>
GetAdaptiveFreq
To obtain an adaptive frequency for a specified setup.
Syntax: GetAdaptiveFreq(<SetupName>)
Return Value: Returns a frequency value.
Type: <double>
Example: "15500000000.0"
Parameters: <SetupName>
Type: <string>
VB Example:
set oModule = oDesign.GetModule("Solutions")
adaptfreq = oModule.GetAdaptiveFreq("Setup1")
GetAvailableVariations
The documented command is applicable for Q3D Extractor.
Returns the available variation for a solution.
Command: None
Syntax: GetAvailableVariations("<SetupName>:<SolnName>)
Return Value: An array of string object.
Parameters: <SetupName>
Type: <string>
The solve setup name.
<>
Type: <string>
The solution name ("Adaptive_1", … "Adaptive_N", "LastAdaptive").
GetExcitationScaling
Use: Get source scaling parameters.
Syntax: GetExcitationScaling("<port name>", <mode/terminal/eigenmode index>)
Return Value: Returns a vector of strings representing source scaling parameters
Parameters: <portName>
Type: <string>
<mode/terminal/eigenmode index>
Type: <Int>
VB Example:
First terminal scaling from port "1":
data = oModule.GetExcitationScaling("1")
or data = oModule.GetExcitationScaling("1", 1)
GetISolutionVersionID
Use: To obtain the solution ID to help track solution validity.
Syntax: GetISolutionVersionID(BSTR fullSolutionName)
Return Value: Returns a solution ID.
Parameters: None
VB Example:
versionID = oModule.GetISolutionVersionID(BSTR fullSolutionName)
GetSolveRangeInfo
Use: To determine the frequency range of a particular simulation setup. For fast sweeps and inter-
polating sweeps this command returns the start and stop frequencies. For discrete sweeps, it
returns a list of frequencies. For an adaptive solution, it returns the adaptive frequency.
Syntax: GetSolveRangeInfo(<SolutionName>)
Return Value: An array of frequencies.
Parameters: <SolutionName>
Type: <string>
VB Example:
set oModule = oDesign.GetModule("Solutions")
freqrange = oModule.GetSolveRangeInfo("Setup1:Sweep1")
GetValidISolutionList
Use: Gets all available solution names that exist in a design.
Syntax: GetValidISolutionList(<IncludeImportedSolutions>)
Return Value: Array of names
Parameters: <IncludeImportedSolutions>
Type: <Boolean>
If no parameter is given the default is False.
VB Example:
solution = oModule.GetValidISolutionList(True)
HasFields
Use: To determine if fields exist for a particular solution.
Syntax: HasFields(<SolutionName>, <DesignVariation>)
Return Value: Returns 1 or 0 ( 1= true, 0 = false)
Type: Boolean
Parameters: <SolutionName>
Type: <string>
Example: "Setup1:LastAdaptive"
<DesignVariation>
Type: <string>
Example: "x_size = 2mm"
VB Example:
set oModule = oDesign.GetModule("Solutions")
fieldsExist = oModule.HasFields("Setup1:Sweep1", _
"x_size=2mm")
HasMatrixData
Use: To determine if matrix data exists for a particular solution.
Syntax: HasMatrixData(<SolutionName>, <DesignVariation>, <matrixType> )
Return Value: Returns 1 or 0 ( 1= true, 0 = false)
Type: Boolean
Parameters: <SolutionName>
Type: <string>
Example: "Setup1:LastAdpative"
<DesignVariation>
Type: <string>
Example: "radius = 4in"
Type: <string>
Example: "C, CD RL"
<matrixType>
Type: <string>
Example: "C, DCR, DCL, ACR, ACL"
VB Example:
set oModule = oDesign.GetModule("Solutions")
matrixExistACRL = oModule.HasMatrixData("Setup1:LastAdaptive",_
"thick = -7mm", "ACR, ACL")
MsgBox matrixExistACRL
HasMesh
To determine if a current mesh exists for a particular simulation setup, not including the initial mesh.
Syntax:HasMesh(<SetupName>, <DesignVariation>, <matTypeArg>)
Return Value: Returns 1 or 0 ( 1= true, 0 = false)
Type: Boolean
Parameters: <SetupName>
Type: <string>
<DesignVariation>
Type: <string>
<matTypeArg>
Type: <string>; should be one of the strings: "Cap", "DC", "AC".
VB Example:
set oModule = oDesign.GetModule("Solutions")
meshexist = oModule.HasMesh("Setup1","padrad=\'0.6mm\' viarad-
d=\'0.2mm\'", "Cap")
ImportSolution
Use: Imports a matrix solution in HFSS, which can then be used in creating reports or in the display
of matrix data. The imported solution need not have the same characteristics as the current design.
Imported terminal data that meets the required criteria can be used for full-wave Spice export. Not
used in HFSS-IE.
Command: HFSS>Results>Import Solutions
Syntax: ImportSolution <FileName>, <ImportName>, <SolnArray>
Return Value: None
Parameters: <FileName>
Type: <string>
Location of the source data. The type of the data file will be determined strictly by its file
extension. Supported types are Touchstone (.sNp or .yNp or .zNp or .tou), and Ansoft
Designer (.flp).
<ImportName>
Type: <string>
Identifying name to use for the import, analogous to solution setup name.
<SolnArray>
Type: Array of strings
The names of the solutions selected for import from the file. The only import format sup-
porting multiple solutions in one file is HFSS8.x format.
VB Example:
oModule.ImportSolution "c:\mydir\in.s2p", _
"MeasuredData", Array("Sweep1")
ImportTable
Use: Imports a data table for use in plotting reports in HFSS. Not used in HFSS-IE. The table can
have multiple independent real-valued columns of data, and multiple dependent real- or complex-
valued columns of data. The data supported imports are either tab delimited format (.tab) or
comma delimited format (.csv). The first row may contain column names. Complex data columns
are inferred from the column data format. In tab delimited format, "(double, double)" denotes a com-
plex number. In comma delimited format, "(double, double)" denotes a complex number.
Command: HFSS>Results>Import Solutions
Syntax: ImportTable
<FileName>, <ImportName>, <TableName>,
<ComplexIsRealImag>, <IsMatrixData>,
<ColNames>, <ColIndependentFlags>
Return Value: None
Parameters: <FileName>
Type: <string>
<ImportName>
Type: <string>
Identifying name to use for the import, analogous to solution setup name.
<TableName>
Type: <string>
Identifying name for the table, analogous to solution name.
<ComplexIsRealImag>
Type: <bool>
Whether to use real/imag to interpret data for any complex column.
If false, then use mag/phase(degrees).
<IsMatrixData>
Type: <bool>
Controls whether the table data can be used in matrix data reports or in field data
reports.
<ColNames>
Array("ColName1", ...)
Non-empty array used only if you want to override the column names obtained from the
table data file, in which case all column names are required.
<ColIndependentFlags>
Array(<bool>, ...)
Indicates which columns are independent. If this is the empty array, the default is that
only the first column is independent. If this is the non- empty array, a flag must be present
for every column.
VB Example:
oModule.ImportTable "c:\mydir\mytable.tab", _
IsFieldAvailableAt
Use: To determine if a field solution exists for a particular frequency in a simulation.
Syntax: IsFieldAvailableAt(<SolutionName>, <DesignVariation>, <Freq>)
Return Value: Returns 1 or 0 ( 1= true, 0 = false)
Type: Boolean
Parameters: <SolutionName>
Type: <string>
<DesignVariation>
Type: <string>
Example: "y_start = 3mm"
<Freq>
Type: <double>
VB Example:
set oModule = oDesign.GetModule("Solutions")
fieldsExist = oModule.IsFieldAvailableAt _
("Setup1:Sweep1", " ", "9000000000.0")
ListMatchingVariations
Use: Gets a list of solved variations that include the specified variable values.
Command: None
Syntax: ListMatchingVariations
(<FullSolutionName>, <ArrayOfMatchingVariableNames>, <ArrayOfMatch-
ingVariableValueStringsIncludingUits>)
Return Value: An array of strings corresponding to solved variations. The match variables may be
a partial set of design variables and the match values are one per variable in the same order as the
variables.
Parameters: <FullSolutionName>
Type: String
<ArrayOfMatchingVariableNames>
Type: String
<ArrayOfMatchingVariableValueStringsIncludingUnits>
Type: String
VB Example:
list = oModule.ListMatchingVariations("Setup1 : LastAdaptive",_
Array("x_size", "y_size"), Array("2mm", "1mm"))
ListValuesOfVariable
Use: Gets the values of a specified variable corresponding to the solved variations.
Command: None
Syntax: ListValuesOfVariable(<FullSolutionName>, <VariableName>)
Return Value: An array of double precision values in SI units interpreted as the specified variable
corresponding to the solved variations.
Parameters: <FullSolutionVariableName>
Type: String
<VariableName>
Type: String
VB Example:
list = oModule.ListValuesOfVariable("Setup1 : _LastAdaptive", "x_
size")
ListVariations
Use: Get a list of solved variations.
Command: None
Syntax: ListVariations(<FullSolutionName>)
Return Value: An array of strings corresponding to solved variations.
Parameters: <FullSolutionName>
Type: String
VB Example:
list = oModule.ListVariations("Setup1 : LastAdaptive")
AddAntennaOverlay
To save a table of antenna parameters for use an overlay on far field plots.
Command: Antenna Parameter Overlay
Syntax: AddAntennaOverlay Array("NAME:<OverlayName>",
Setup :="<SetupName>", Solution :="<SolutionName>", ["<array>"],> <"Intrinsic Variation[s]">,
"<AntennaParameters>",)
Return Value: None
Parameters: <OverlayName>
Text string with the overlay name
<SetupName>
Text string for the Far Field Radiation setup name, for example "Infinite Sphere1"
<SolutionName>
Text string for the Solution Setup and Pass, for example, "Setup1 : LastAdaptive"
<array>
Text string if an array has been defined.
<Intrinsic Variation[s]>
Text string for variation definition, in the form"IntrinsicVariation:=", "<vari-
able>=<value>",
<Use Nominal Design>
Boolean, in the format "UseNominalDesign:=", [true | false],
<AntennaParameters>,
A list of each antenna parameter to display, in the form "Calculations:=" <antenna para-
meter>,
Antenna parameters can be MaxU, Peak Directivity, Peak Gain, Peak Realized Gain,
Radiated Power, Accepted Power, Incident Power, Radiation Efficiency, Front to Back
Ratio, and Decay Factor.
VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("tune_coax_fed_patch")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("RadField")
oModule.AddAntennaOverlay Array("NAME:Antenna Parameter Overlay1",
"Setup:=", "Infinite Sphere1", "Solution:=", "Setup1 :
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:
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.AddMarkerToPlot(["0.290455877780914in", "-
0.616900205612183in", "1.77635683940025e-015in"], "Mag_E1")
oModule.AddMarkerToPlot(["-0.317279517650604in",
"1.22481322288513in", "0in"], "Mag_E1")
oModule.AddMarkerToPlot(["0.290455877780914in", "-
0.616900205612183in", "1.77635683940025e-015in"], "Mag_H1")
oModule.AddMarkerToPlot(["-0.317279517650604in",
"1.22481322288513in", "0in"], "Mag_H1")
CreateFieldPlot
Use: Creates a field/mesh plot "Field" or a visual ray trace ("VRT") plot.
Command: HFSS>Fields>Plot Fields><field_quantity>
Command: Maxwell3D or Maxwell2D>Fields>Fields><field_quantity>
SolutionName
Name of the solution setup and solution formatted as:
"<SolveSetupName> : <WhichSolution>",
where <WhichSolution> can be "Adaptive_<n>",
"LastAdaptive", or "PortOnly".
For example: "Setup1 : Adaptive_2"
HFSS and Maxwell require a space on either side of the ‘:’ character. If it is missing, the
plot will not be created.
QuantityName
Type of plot to create. Possible values include :
Mesh plots: "Mesh"
Field plots (HFSS) include: "Mag_E", "Mag_H", "Mag_Jvol", "Mag_Jsurf",
PlotFolder
Name of the folder to which the plot should be added. Possible values
include: "E Field", "H Field", "Jvol", "Jsurf", "SAR
Field", and "MeshPlots".
UserSpecifyName
0 if default name for plot is used, 1 otherwise.
Not needed. <PlotName> will be respected regardless of whether this
flag is set.
UserSpecifyFolder
0 if default folder for plot is used, 1 otherwise.
Not needed. The specified PlotFolder will be respected regardless of
whether this flag is set.
IntrinsicVar
Formatted string that specifies the frequency and phase at which to make the plot.
For example: "Freq='1GHz' Phase='30deg'"
<PlotGeomArray>
Array(<NumGeomTypes>, <GeomTypeData>,
<GeomTypeData>, ...)
For example: Array(4, "Volume", "ObjList", 1, "Box1",
"Surface", "FacesList", 1, "12", "Line", 1,
"Polyline1", "Point", 2, "Point1", "Point2")
<NumGeomTypes>
Type: <int>
Number of different geometry types (volume, surface, line, point)
plotted on at the same time.
<GeomTypeData>
<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
Possible values are "Cylinder", "Solid", "Dashdash",
"Dotdot", "Dotdash"
IsoValType
Possible values are "Tone", "Fringe", "Gourard"
<PlotOnSurfaceSettings>
Array("NAME:PlotOnSurfaceSettings",
"Filled:=", <bool>,
"IsoValType:=", <string>,
"SmoothShade:=", <bool>,
"AddGrid:=", <bool>,
"MapTransparency:=", <bool>,
"Transparency:=", <doubl.e>,
"ArrowUniform:=", <bool>
"ArrowSpacing:=", <double>
"GridColor:=", Array(<int>, <int>, <int>)
IsoValType
Possible values are: "Tone", "Line", "Fringe", "Gourard"
GridColor
Array containing the R, G, B components of the color. Components
should be in the range 0 to 255.
<PlotOnVolumeSettings>
Array("NAME:PlotOnVolumeSettings",
"PlotIsoSurface:=", <bool>,
"CloudDensity:=", <double>,
"PointSize:=", <int>,
"ArrowUniform:=", <bool>,
"ArrowSpacing:=", <double>)
Example Field Plot:
oModule.CreateFieldPlot Array("NAME:Mag_E1", _
"SolutionName:=", "Setup1 : LastAdaptive", _
"QuantityName:=", "Mag_E", _
"PlotFolder:=", "E Field1", _
"UserSpecifyName:=", 0, _
"UserSpecifyFolder:=", 0, _
Example VRT Plot:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
"MapTransparency:=", true, _
"Transparency:=", 0, _
"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
IsoValType
Possible values are: "Tone", "Line", "Fringe", "Gourard".
GridColor
Array containing the R, G, B components of the color. Components
should be in the range 0 to 255.
<PlotOnVolumeSettings>
Array("NAME:PlotOnVolumeSettings",
"PlotIsoSurface:=", <bool>,
"CloudDensity:=", <double>,
"PointSize:=", <int>,
"ArrowUniform:=", <bool>,
"ArrowSpacing:=", <double>)
DeleteFieldPlot
Use: Deletes one or more plots.
Command: HFSS>Fields>Delete Plot
Command: Maxwell3D or Maxwell2D>Fields>Delete Plot
Command: Q3D Extractor or 2D Extractor>Fields>Delete Plot
Syntax: DeleteFieldPlot <NameArray>
Return Value: None
Parameters: <NameArray>
Array of strings – the names of the plots to delete.
VB Example:
oModule.DeleteFieldPlot Array("Mag_E1", "Vector_E1")
EditAntennaOverlay
Use:Edit the properties in an existing antenna parameters overlay.
Command:None
Command:Antenna Parameter Overlay
Syntax:EditAntennaOverlay Array("NAME:<OverlayName>",
Setup :="<SetupName>", Solution :="<SolutionName>", ["<array>"],> <"Intrinsic Variation[s]">,
"<AntennaParameters>",)
Return Value:None
Parameters:<OverlayName>
Text string with the overlay name
<SetupName>
Text string for the Far Field Radiation setup name, for example "Infinite Sphere1"
<SolutionName>
Text string for the Solution Setup and Pass, for example, "Setup1 : LastAdaptive"
<array>
Text string if an array has been defined.
<Intrinsic Variation[s]>
Text string for variation definition, in the form "IntrinsicVariation:=", "<vari-
able>=<value>",
<Use Nominal Design>
Boolean, in the format "UseNominalDesign:=", [true | false],
<AntennaParameters>,
A list of each antenna parameter to display, in the form "Calculations:=" <antenna para-
meter>,
Antenna parameters can be MaxU, Peak Directivity, Peak Gain, Peak Realized Gain,
Radiated Power, Accepted Power, Incident Power, Radiation Efficiency, Front to Back
Ratio, and Decay Factor.
VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("tune_coax_fed_patch")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("RadField")
oModule.EditAntennaOverlay "Antenna Parameter Overlay2", Array
("NAME:Antenna Parameter Overlay2",
"Setup:=", "Infinite Sphere1", "Solution:=", "Setup1 : LastAd-
aptive", "IntrinsicVariation:=", "Freq=1.8GHz ", "UseNom-
inalDesign:=", false, "DesignVariation:=", "feed_pos=" & Chr(39) &
"10.8mm" & Chr(39) & "", "Calculations:=", "Max U,Peak Dir-
ectivity,Peak Gain,Peak Realized Gain,Accepted Power,Radiation Effi-
ciency,Front To Back Ratio")
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
HideAntennaParametersOverlay
Use:To hide a currently visible antenna parameters overlay.
Command:HFSS or HFSS-IE>Fields>Plot Fields>Radiation Field
Syntax:HideAntennaParameterOverlay
Return Value:None
Parameters:<name>
The name of the antenna parameters overlay.
VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("tune_coax_fed_patch")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("FieldsReporter")
oModule.HideAntennaParameterOverlay "Antenna Parameter Overlay3"
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
<PlotFolderAttributes>
Array("NAME:FieldsPlotSettings",
"Real time mode:=", <bool>,
<ColorMapSettings>,
<Scale3DSettings>,
<Marker3DSettings>,
<Arrow3DSettings>)
<ColorMapSettings>
Array("NAME:ColorMapSettings",
"ColorMapType:=", <string>,
"SpectrumType:=", <string>,
"UniformColor:=", Array(<int>, <int>, <int>),
"RampColor:=", Array(<int>, <int>, <int>)
ColorMapType
Possible values are "Uniform", "Ramp", "Spectrum"
SpectrumType
Possible values are "Rainbow", "Temperature", "Magenta", "Gray"
UniformColor, RampColor
<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))
ShowAntennaParameterOverlay
Use: To display an existing antenna parameters overlay as a table on a far field plot.
Command: HFSS or HFSS-IE>Fields>Plot>Radiation FIelds
Syntax: ShowAntennaParamedterOverlay <name>
Return Value: None
Parameters: <name>
The name of the antenna parameters overlay.
VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("tune_coax_fed_patch")
Set oDesign = oProject.SetActiveDesign("HFSSDesign1")
Set oModule = oDesign.GetModule("RadField")
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")
18-30
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
ExportOnGrid
ExportToFile
GetTopEntryValue
LoadNamedExpressions
SaveNamedExpressions
AddNamedExpression
Creates a named expression using the expression at the top of the stack.
Command: Click Add.
Syntax: AddNamedExpression <Name>
Return Value: None
Parameters: <ExpressionName> and <FieldType>.
Type: <string>
Name for the new named expression.
<FieldType>
Type: <string>
VB Example:
oModule.AddNamedExpression "Mag_JxE", "Fields"
AddNamedExpr
Creates a named expression using the expression at the top of the stack.
Command: Click Add.
Syntax: AddNamedExpr <Name>
Return Value: None
Parameters: <ExpressionName>
Type: <string>
Name for the new named expression.
<FieldType>
Type: <string>
VB Example:
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
19-18
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
GetSetupNames
RenameSetup
SetPropValue [Radiation]
DeleteFarFieldSetup
Deletes an existing far-field setup.
Command: Delete command in the List dialog box. Click HFSS>List to access the List dialog
box.
Syntax: DeleteFarFieldSetup <NameArray>
Return Value: None
Parameters: <NameArray>
Type: Array of strings.
An array of radiation setup names.
VB Example:
oModule.DeleteFarFieldSetup Array("Infinite Sphere1")
DeleteNearFieldSetup
Deletes an existing near-field line radiation setup.
VB Syntax DeleteNearFieldSetup(NameArray)
oModule.DeleteNearFieldSetup Array("Line1",
VB Example
"Sphere1", "Box2", "Rectangle1")
EditRadiatedPowerCalculationMethod
Use: Select the method used to calculate radiated power.
Syntax: EditRadiatedPowerCalculationMethod(<PowerCalculationMethod>)
Return Value: None
Parameters: <PowerCalculationMethod>
Type: <string>
One of: "Auto", "Raidation Surface Integral", or "Far Field Integral">
VB Example:
oModule = oDesign.GetModule("RadField")
oModule.EditRadiatedPowerCalculationMethod("Auto")
oModule.EditRadiatedPowerCalculationMethod("Radiation Surface Integ-
ral")
oModule.EditRadiatedPowerCalculationMethod("Far Field Integral")
oModule = oDesign.GetModule("RadField")
Python
Example oModule.EditRadiatedPowerCalculationMethod("Radiation
Surface Integral")
GetChildNames [Radiation]
Use: Gets setupup names .
Syntax: GetChildNames()
Return Value: All setup names.
Parameters: Optional, this parameter is ignored.
GetChildObject [Radiation]
Gets a Setup Object of the Radiation module.
GetChildTypes [Radiation]
Use: Gets child types of queried Radiation module object.
Syntax: GetChildTypes()
Return Value: Returns empty array.
oRad = oDesign.GetChildObject(“RadField”)
Python
oRadModule.GetChildTypes()
Example
GetPropNames [Radiation]
Use: Radiation module does not have its own property, this function always returns empty array.
Syntax: GetPropNames(bIncludeReadOnly)
Return Value: Returns empty set.
Parameters: bIncludeReadOnly—optional, default to True.
oRadModule.GetPropNames()
Python
oRadModule.GetPropNames(True)
Example
oRadModule.GetPropNames(False)
GetPropValue [Radiation]
Get the property value for a setup object.
UI Access NA
GetSetupNames
Use: Gets the names of far field and near field radiation setups in a design.
Syntax: GetSetupNames(<RadiationType>)
Return Value: Array of setup names.
Parameters: <RadiationType>
Type: <string>
For example: "Sphere"
VB Example:
Set setupnames = oModule.GetSetupNames("Infinite Sphere")
For Each setup in setupnames
Msgbox setup
Next
RenameSetup [Radiation]
Use: Renames an existing radiation setup.
Command: Right-click a radiation 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>
VB Example:
oModule.RenameSetup "Sphere1", "MyNearSphere"
SetPropValue [Radiation]
Sets the property value for the active Radiation property object.
Return Value True if the property is found and the new value is valid. Otherwise return False.
EditNearFieldSphereSetup
InsertBoxSetup
InsertFarFieldSphereSetup
InsertNearFieldLineSetup
InsertNearFieldRectangleSetup
InsertNearFieldSphereSetup
EditBoxSetup
Edits a near-field box radiation setup.
"Height:=", <string>,
"HeightSamples:=", <int>)
For UseCustomRadiationSurface para-
meter, provide value if True. If False, radi-
ation boundary/PML boundaries will be
used as radiation surfaces.
Return None.
Value
oModule = oDesign.GetModule("RadField")
arr = oModule.EditBoxSetup(['NAME:MyBox', 'UseCus-
Python tomRadiationSurface:=', False, 'Length:=', '20mm',
Example 'Width:=', '20mm', 'LengthSamples:=', 21,
'WidthSamples:=', 21, 'CoordSystem:=', 'Global',
'Height:=', '20mm', 'HeightSamples:=', 21])
VB Syntax EditBoxSetup(boxParams)
oModule.EditBoxSetup Array("NAME:MyBox", _
"UseCustomRadiationSurface:=", false, _
"Length:=", "20mm", _
"Width:=", "20mm", _
VB Example "LengthSamples:=", 21 _
"WidthSamples:=", 21 _
"CoordSystem:=", "Global" _
"Height:=", "20mm" _
"HeightSamples:=", 21, _
EditInfiniteSphereSetup
Modifies an existing far-field infinite sphere setup, or right click on Infinite Sphere under Radiation
in the Project tree and select Properties...
Double-click a radiation setup in the project tree to modify its settings, or right click
UI Access
on Infinite Sphere under Radiation in the Project tree and select Properties...
"PhiStop:=" <int><unit>
"PhiStep:=" <int><unit>
"UseLocalCS:=" Boolean Whether to use local
CS
Return None
Value
oModule = oDesign.GetModule("RadField")
oModule.EditInfiniteSphereSetup("Infinite Sphere1",
[
"NAME:Infinite Sphere1",
"UseCustomRadiationSurface:=", False,
"ThetaStart:=" , "0deg",
Python
"ThetaStop:=" , "180deg",
Example
"ThetaStep:=" , "3deg",
"PhiStart:=" , "-180deg",
"PhiStop:=" , "180deg",
"PhiStep:=" , "3deg",
"UseLocalCS:=" , False
])
EditNearFieldLineSetup
Edits a near-field line radiation setup.
UI Access Project Manager > Radiation > Line. Double-click and edit a line.
Return None.
Value
VB Syntax EditNearFIeldLineSetup(lineParams)
oModule.EditNearFieldLineSetup Array("NAME:MyLine",
VB Example
_
"UseCustomRadiationSurface:=", false, _
"Line:=", "Polyline1", _
"NumPts:=", "100")
EditNearFieldRectangleSetup
Edits a near-field rectangle radiation setup.
UI Access Project Manager > Radiation > Rectangle. Double-click and edit a rectangle.
Return None.
Value
oModule = oDesign.GetModule("RadField")
arr = oModule.EditNearFieldRectangleSetup(['NAME:MyRect-
Python angle', 'UseCustomRadiationSurface:=', False,
Example 'Length:=', '20mm', 'Width:=', '20mm',
'LengthSamples:=', 41, 'WidthSamples:=', 41, 'CoordSys-
tem:=', 'RelativeCS1'])
VB Syntax EditNearFIeldRectangleSetup(rectParams)
oModule.EditNearFieldRectangleSetup Array
("NAME:MyRectangle", _
"UseCustomRadiationSurface:=", false, _
"Length:=", "20mm", _
VB Example
"Width:=", "20mm", _
"LengthSamples:=", 41 _
"WidthSamples:=", 41 _
"CoordSystem:=", "RelativeCS1")
EditNearFieldSphereSetup
Edits a near-field sphere radiation setup.
UI Access Project Manager > Radiation > Sphere. Double-click and edit a sphere.
Return None.
Value
VB Syntax EditNearFIeldSphereSetup(sphereParams)
oModule.EditNearFieldSphereSetup _
Array("NAME:MySphere", _
"UseCustomRadiationSurface:=", true, _
"CustomRadiationSurface:=", "FaceList1", _
"ThetaStart:=", "0deg", "ThetaStop:=", "180deg",
VB Example
_
"ThetaStep:=", "10deg", "PhiStart:=", "0deg", _
"PhiStop:=", "360deg", "PhiStep:=", "10deg", _
"UseLocalCS:=", true, _
"CoordSystem:=", "FaceCS1")
InsertBoxSetup
Inserts a near-field box radiation setup.
UI Access HFSS > Radiation > Insert Near Field Setup > Box.
"Height:=", <string>,
"HeightSamples:=", <int>)
For UseCustomRadiationSurface para-
meter, provide value if True. If False, radi-
ation boundary/PML boundaries will be
used as radiation surfaces.
Return None.
Value
VB Syntax InsertBoxSetup(boxParams)
oModule.InsertBoxSetup Array("NAME:MyBox", _
VB Example
"UseCustomRadiationSurface:=", false, _
"Length:=", "20mm", _
"Width:=", "20mm", _
"LengthSamples:=", 21 _
"WidthSamples:=", 21 _
"CoordSystem:=", "Global" _
"Height:=", "20mm" _
"HeightSamples:=", 21, _
InsertFarFieldSphereSetup
Use: Creates/inserts a far-field infinite sphere radiation setup.
Command: HFSS>Radiation>Insert Far Field Setup>Infinite Sphere
Syntax: InsertFarFieldSphereSetup <InfSphereParams>
Return Value: None
Parameters: <InfSphereParams>
Array("NAME:<SetupName>",
"UseCustomRadiationSurface:=", <bool>,
"CustomRadiationSurface:=", <FaceListName>,
"ThetaStart:=", <value>,
"ThetaStop:=", <value>,
"ThetaStep:=", <value>,
"PhiStart:=", <value>,
"PhiStop:=", <value>,
"PhiStep:=", <value>,
"UseLocalCS:=", <bool>,
"CoordSystem:=", <CSName>)
UseCustomRadiationSurface
If true, provide CustomRadiationSurface parameter.
If false, radiation boundary/PML boundaries will be used as radiation surfaces.
UseLocalCS
InsertNearFieldLineSetup
Inserts a near-field line radiation setup.
UI Access HFSS > Radiation > Insert Near Field Setup > Line.
Return None.
Value
VB Syntax InsertNearFIeldLineSetup(lineParams)
oModule.InsertNearFieldLineSetup Array
("NAME:MyLine", _
InsertNearFieldRectangleSetup
Inserts a near-field rectangle radiation setup.
UI Access HFSS > Radiation > Insert Near Field Setup > Rectangle.
Return None.
Value
oModule = oDesign.GetModule("RadField")
arr = oModule.InsertNearFieldRectangleSetup
Python (['NAME:MyRectangle', 'UseCustomRadiationSurface:=',
Example False, 'Length:=', '20mm', 'Width:=', '20mm',
'LengthSamples:=', 41, 'WidthSamples:=', 41, 'CoordSys-
tem:=', 'RelativeCS1'])
VB Syntax InsertNearFIeldRectangleSetup(rectParams)
oModule.InsertNearFieldRectangleSetup Array
("NAME:MyRectangle", _
"UseCustomRadiationSurface:=", false, _
"Length:=", "20mm", _
VB Example
"Width:=", "20mm", _
"LengthSamples:=", 41 _
"WidthSamples:=", 41 _
"CoordSystem:=", "RelativeCS1")
InsertNearFieldSphereSetup
Inserts a near-field sphere radiation setup.
UI Access HFSS > Radiation > Insert Near Field Setup > Sphere.
"Cus-
tomRadiationSurface:=",
<FaceListName>,
"Radius:=", <value>,
"ThetaStart:=", <value>,
"ThetaStop:=", <value>,
"ThetaStep:=", <value>,
"PhiStart:=", <value>,
"PhiStop:=", <value>,
"PhiStep:=", <value>,
"UseLocalCS:=", <bool>,
"CoordSystem:=",
<CSName>)
For CustomRadiationSurface parameter,
provide value if True. If False, radiation
boundary/PML boundaries will be used as
radiation surfaces.
For UseLocalCS parameter, provide value
if True. If False, global coordinate system
will be used.
Return None.
Value
oModule = oDesign.GetModule("RadField")
arr = oModule.InsertNearFieldSphereSetup
(['NAME:MySphere', 'UseCustomRadiationSurface:=', True,
Python 'CustomRadiationSurface:=', 'FaceList1', 'Thet-
Example aStart:=', '0deg', 'ThetaStop:=', '180deg', 'Thet-
aStep:=', '10deg', 'PhiStart:=', '0deg', 'PhiStop:=',
'360deg', 'PhiStep:=', '10deg', 'UseLocalCS:=', True,
'CoordSystem:=', 'FaceCS1'])
VB Syntax InsertNearFIeldSphereSetup(sphereParams)
oModule.InsertNearFieldSphereSetup _
Array("NAME:MySphere", _
"UseCustomRadiationSurface:=", true, _
"CustomRadiationSurface:=", "FaceList1", _
"ThetaStart:=", "0deg", "ThetaStop:=", "180deg",
VB Example
_
"ThetaStep:=", "10deg", "PhiStart:=", "0deg", _
"PhiStop:=", "360deg", "PhiStep:=", "10deg", _
"UseLocalCS:=", true, _
"CoordSystem:=", "FaceCS1")
<ArrayOption>
Type: <string>
Can be one of three strings: "NoArray", or "RegularArray",
"CustomArray".
If "RegularArray" is specified, then <RegularArrayParams> must
be specified. If "CustomArray" is specified, <CustomArrayParams>
must be specified. You can also supply both the custom and regular
array specifications and switch between them by setting this flag to the
option you want to use.
<RegularArrayParams>
Array("NAME:RegularArray",
"NumUCells:=", <value>,
"NumVCells:=", <value>,
"CellUDist:=", <value>,
"CellVDist:=", <value>,
"UDirnX:=", <value>,
"UDirnY:=", <value>,
"UDirnZ:=", <value>,
"VDirnX:=", <value>,
"VDirnY:=", <value>,
"VDirnZ:=", <value>,
"FirstCellPosX:=", <value>,
"FirstCellPosY:=", <value>,
"FirstCellPosZ:=", <value>,
"UseScanAngle:=", <bool>,
"ScanAnglePhi:=", <value>,
"ScanAngleTheta:=", <value>,
"UDirnPhaseShift:=", <value>,
"VDirnPhaseShift:=", <value>)
UseScanAngle
If true, the values of the ScanAnglePhi and ScanAngleTheta
parameters will be used and need to be specified.
If false, the values of the UDirnPhaseShift and VDirnPhaseShift
parameters will be used and must be specified.
<CustomArrayParams>
Array("NAME:CustomArray",
"NumCells:=", <int>,
<CellsParamsArray
<CellsParamsArray>
Array("NAME:Cell",
<CellParams>, <CellParams>, ...)
<CellParams>
Array("Name:<CellName>",
"XCoord:=", <double>,
"YCoord:=", <double>,
"ZCoord:=", <double>,
"Amplitude:=", <double>,
"Phase:=", <double>)
The <double> values above should be in SI units.
<CellName>
Type: <string>
Format is: "Cell_n"
Replace n with the index number of the cell, for example: "Cell_1"
VB Example: Using the "NoArray" option:
oModule.EditAntennaArraySetup _
Array("NAME:ArraySetupInfo", "UseOption:=", "NoArray")
VB Example: Using the "RegularArray" option:
oModule.EditAntennaArraySetup _
Array("NAME:ArraySetupInfo",_
"UseOption:=", "RegularArray", _
Array("NAME:RegularArray", _
"NumUCells:=", "10", "NumVCells:=", "10",_
"CellUDist:=", "10mm", "CellVDist:=", "10mm", _
"UDirnX:=", "1", "UDirnY:=", "0", "UDirnZ:=", _
"0", _
"VDirnX:=", "0", "VDirnY:=", "1", "VDirnZ:=",_
"0", _
"FirstCellPosX:=", "0mm", _
"FirstCellPosY:=", "0mm", _
"FirstCellPosZ:=", "0mm",
"UseScanAngle:=", true, _
"ScanAnglePhi:=","45deg", _
"ScanAngleTheta:=", "45deg"))
VB Example: Using the "CustomArray" option:
oModule.EditAntennaArraySetup _
Array("NAME:ArraySetupInfo",
"UseOption:=", "CustomArray",_
Array("NAME:CustomArray", _
"NumCells:=", 3,_
Array("NAME:Cell", _
Array("NAME:Cell_1", _
"XCoord:=", 0, "YCoord:=", 0, "ZCoord:=",0,_
"Amplitude:=", 1, "Phase:=", 0), _
Array("NAME:Cell_2", _
"XCoord:=",0.06729,"YCoord:=","ZCoord:=",0,_
"Amplitude:=", 1, "Phase:=", 0), _
Array("NAME:Cell_3", _
"XCoord:=",0.13458,"YCoord:=",0,"ZCoord:=",0,_
"Amplitude:=", 1, "Phase:=", 0))))
<FilePath>
Type: String.
Specifies the file to export to, for example: "C:\projects\exportantparams.txt".
IntrinsicVariationKey
Specifies the frequency at which to extract the parameters. Example: "Freq='10GHz'"
DesignVariationKey
Specifies the design variations at which to extract the parameters. Example: "width-
h=5mm"
VB Example:
oModule.ExportRadiationParametersToFile _
Array("ExportFileName:=", _
"C:\projects\exportantparams.txt",_
"SetupName:=", "Infinite Sphere1", _
"IntrinsicVariationKey:=", "Freq='10GHz'", _
"DesignVariationKey:=", "",
"SolutionName:=", "LastAdaptive")
20-26
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
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>
The Network Data Explorer manager script commands are listed below.
ExportFullWaveSpice [Network Data Explorer]
ExportNetworkData [Network Data Explorer]
ExportNMFData [Network Data Explorer]
AddMaterial
CloneMaterial
DoesMaterialExist
EditMaterial
ExportMaterial
RemoveMaterial
RemoveUnusedDefinitions
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"])
CloneMaterial
Clones a local material.
Command: None
Syntax: CloneMaterial(<name>, <newName>)
Return Value: True if Material is cloned successfully. False if the existing material is not found or if
there is a name conflict with the new material name.
Parameters: name
Type: <string>
Existing material name.
<newName>
Type: <string>
The new material name for newly cloned material.
VB Example:
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
oDesktop.RestoreWindow
Set oProject = oDesktop.SetActiveProject("Project1")
Set oDefinitionManager = oProject.GetDefinitionManager()
oDefinitionManager.CloneMaterial("copper1", "copper3")
DoesMaterialExist
Checks for the presence of a material in the library by name
UI Access None.
database
Return Boolean
Value
Python DoesMaterialExist(<MaterialName>)
Syntax
oProject = oDesktop.GetActiveProject()
Python
oDefinitionManager = oProject.GetDefinitionManager()
Example
oDefinitionManager.DoesMaterialExist("modified_epoxy")
VB Syn- DoesMaterialExist(<MaterialName>)
tax
EditMaterial
Modifies an existing material.
"CoordinateSystemType:=", "Cartesian",
"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"
])
"mass_density:=", "3720",
"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"])
RemoveUnusedDefinitions
Removes any unused project definitions.
oProject.RemoveUnusedDefinitions(
[
[
"NAME:Materials",
"Al-Extruded"
Python
],
Example
[
"NAME:SurfaceMaterials",
"Steel-oxidised-surface"
]
])
VB RemoveUnusedDefinitions
Syn-
tax
VB oProject.RemoveUnusedDefinitions Array(Array("NAME:Materials",
Exa- "Al-Extruded"), Array("NAME:SurfaceMaterials", _
mpl-
e "Steel-oxidised-surface"))
EditSolverOnDemandModel
EditWithComps
Export
GetNPortData
GetSolverOnDemandData
GetSolverOnDemandModelList
Remove
RemoveSolverOnDemandMode
UpdateDynamicLink
Add [component manager]
Use:Add a component
Command: Tools > Edit Configured Libraries > Components > Add Component
Syntax:Add Array("NAME:<ComponentName>",
"Info:=", <ComponentInfo>,
"RefBase:=", <string>, // reference designator
"NumParts:=", <int>, // parts per component
"OriginalComponent:=", <string>
"Terminal:=", <TerminalInfo>,
"Terminal:=", <TerminalInfo>, ...
// The remaining parameters are optional
Array("NAME:Parameters", // any combo of the following
"VariableProp:=", <VariableInfo>,
"CheckboxProp:=", <CheckBoxInfo>,
"ButtonProp:=", <ButtonInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>),
Array("NAME:Properties", // any combo of the following
"CheckboxProp:=", <CheckBoxInfo>,
"TextProp:=", <TextInfo>,
"NumberProp:=", <NumberInfo>,
"SeparatorProp:=", <SeparatorInfo>,
"ValueProp:=", <ValueInfo>,
"MenuProp:=", <MenuInfo>),
"VPointProp:=", <VPointInfo>,
"PointProp:=", <PointInfo>),
Array("Quantities",
"QuantityProp:=", <QuantityPropInfo>...),
Array("NAME:CosimDefinitions",
<CosimDefInfo>,
<CosimDefInfo>...)
Return Value:<string>
// composite name of the component.
// If the name requested conflicts with the name of an existing
// component, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.
Parameters:<ComponentName>:
<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,
// 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>:
<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
<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>,
["Quantities",
"QuantityProp:=", <QuantityPropInfo>...],
["NAME:CosimDefinitions",
<CosimDefInfo>,
<CosimDefInfo>...]]
oComponentManager.Add(
[
"NAME:Component",
"Info:=", [
"Type:=", 0,
"NumTerminals:=", 0,
"DataSource:=", "",
"ModifiedOn:=", 1467910752,
"Manufacturer:=", "",
"Symbol:=", "Component",
"ModelNames:=", "",
"Footprint:=", "",
Python
Example
"Description:=" , "",
"InfoTopic:=", "",
"InfoHelpFile:=", "",
"IconFile:=", "",
"Library:=", "",
"OriginalLocation:=", "Project",
"IEEE:=", "",
"Author:=", "",
"OriginalAuthor:=", "",
"CreationDate:=", 1467910746,
"ExampleFile:=", ""],
"Refbase:=", "U",
"NumParts:=", 1,
"ModSinceLib:=", True,
"CompExtID:=", 2
])
<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"))
AddNPortData [component manager]
Use: Adds a component using the specified data
Command: Project Menu > Add Model > Add Nport Model
Syntax: AddNPortData Array("NAME:<ComponentDataName>",
"ComponentDataType:=", "NportData",
"name:=", <string>, // Name of the item
"filename:=", <string>, // Path to the file to find the data
"numberofports:=", <int>,
"filelocation:=", <LocationType>,
"domain:=", <string>, // "time" or "frequency"
"datamode:=", <string> // "EnterData", "Import", or "Link"
"devicename:=", <string>,
"ImpedanceTab:=", <bool>,
"NoiseDataTab:=", <bool>,
"DCBehaviorTab:=", <bool>,
"SolutionName:=", <string>,
"displayformat:=", <DisplayInfo>,
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
"InterpOption:=", -1,
"ExtrapOption:=",-1,
"DataType:=", 0
// Nexxim
"DCOption:=", <NexximDCOption>,
"InterpOption:=", <NexximInterpOption>,
"ExtrapOption:=", <NexximExtrapOption>,
"DataType:=", 2
<NexximDCOption>:
<int> // 0 : Zero Padding
// 1 : Same as last point
// 2 : Linear extrapolation from last 2 points
// 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>:
<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)
AddSolverOnDemandModel
Use: This method looks for a local component of the name passed in, and to this component it adds
an SOD model definition using the information passed in the VARIANT. It returns the name of the
SOD model added.
Parameters: BSTR component name.
Parameters: VARIANT which is the SOD model data.
Return Value: Returns the name of the model added.
ClearSolutionCache [component manager]
Use: Clear the solution cache for dynamic link component.
Command:Each of the following commands will clear the solution cache:
— Dynamic Link Item RCM > Clear Solution Cache
— Dynamic Link Component in schematic RCM > Clear Solution Cache
Syntax: ClearSolutionCache <Component Name >
Return Value: None
Parameters: <component name> is the name of the dynamic link com-
ponent
VB Example:
oComponentManager.ClearSolutionCache "TeeModel1"
Edit [component manager]
Modifies an existing component
Command: Tools > Edit Configured Libraries > Components > Edit Component
<CosimDefInfo>,
<CosimDefInfo>...)
Return Value: <string>
// composite name of the component.
// If the name requested conflicts with the name of an existing
// component, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.
Parameters: <ComponentName>:
<string> // composite name of the component to edit
<NewComponentName>:
<string> // new simple name for the component
<ComponentInfo>:
Array("Type:=", <TypeInfo>,
"NumTerminals:=", <int>,
"DataSource:=", <string>,
"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>,
<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,
// 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)
"CreationDate:=", 1152722102), _
"Refbase:=", "Q", _
"NumParts:=", 1, _
"Terminal:=", Array("collector", _
"collector", _
"A", _
false, _
6, _
0, _
"", _
"Electrical"), _
"Terminal:=", Array("base", _
"base", _
"A", _
false, _
7, _
0, _
"", _
"Electrical"), _
"Terminal:=", Array("emitter", _
"emitter", _
"A", _
false, _
8, _
0, _
"", _
"Electrical"), _
Array("NAME:Parameters", _
"TextProp:=", Array("LabelID", _
"HD", _
"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>,
Pytho-
n Syn- ["NAME:<NewComponentName>",
tax
"Info:=", <ComponentInfo>,
ments\BJTs:Level01_NPN", _
["NAME:Level01_NPN", "Info:=", ["Type:=", 4294901764,_
"NumTerminals:=", 3, "DataSource:=", "Ansoft built-in com-
ponent",_
"ModifiedOn:=", 1152722112, "Manufacturer:=", "", _
"Symbol:=", "nexx_bjt_npn", "Footprint:=", "", _
"Description:=", "BJT, GP, NPN", "InfoTopic:=",
"NXBJT1.htm", _
"InfoHelpFile:=", "nexximcomponents.chm", "IconFile:=", "bjt-
sn.bmp", _
"Library:=", "Nexxim Circuit Elements\BJTs",_
"OriginalLocation:=", "SysLibrary ", "Author:=", "", _
"OriginalAuthor:=", "", "CreationDate:=", 1152722102], _
"Refbase:=", "Q", "NumParts:=", 1, "Terminal:=", ["col-
lector", _
name2 = oComponentManager.Edit
("MyComponent",_
["NAME:CosimDefinitions", ["NAME:CosimDefinition", _
["NAME:CosimDefinition", "CosimulatorType:=", 3, _
"NetlistString:=", ""]]])
EditSolverOnDemandModel
Use: This method looks for a local component of the name passed in, and in this component it looks
for an SOD model using the name passed in the second BSTR. It modifies the SOD model using
the data in the VARIANT. It returns the name of the SOD model edited.
Return Value: Returns the name of the model edited.
Parameters: BSTR component name.
Parameters: BSTR SOD model name.
Parameters: VARIANT which is the new SOD model data (can include
changed name).
EditWithComps [component manager]
Edit an existing component.
Command: None
Syntax: EditWithComps <ComponentName>,
Array("NAME:<NewComponentName>",
"ModTime:=", <ModifiedTimeInfo>,
"Library:=", <string>, // Library name
"LibLocation:=", <string>, // Project Location
<PinDefInfo>,
<PinDefInfo>,... // optional, to define pins
<GraphicsDataInfo>, // optional, to define graphics
<PropDisplayMapInfo>), // optional, to define property displays
Array(<ListOfComponentNames>) // Component names
Parameters: <ComponentName>:
<string> // composite name of the component being edited
<NewComponentName>:
<string> // new simple name for the component
<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.
<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>,
<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
<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>:
<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 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:
oComponentManager.Export Array("NAME:mylib", "Nexxim Circuit Ele-
ments\BJTs:Level01_NPN"),"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.
Python GetData(<DefinitionName>)
Syntax
Sub DisplayVariant(x)
Dim index
index = 0
End If
index = index + 1
Next
End Sub
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim dnpInfo
Dim index
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
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.
IsUsed [component manager]
Used to determine if a component is used in the design.
Command: None
Syntax: IsUsed(<ComponentName>)
Return Value: <Boolean> // true if the specified component is used in the design
Parameters: <ComponentName>:
<string>
VB Example:
Dim isUsed
isUsed = oComponentManager.IsUsed("MyComponent")
Python 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"
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.
RemoveUnused [component manager]
Removes components that are not used in the design.
Command: Project->Remove Unused Definitions is similar but operates slightly different and
does not record script commands.
Syntax: RemoveUnused()
Return Value: <bool> True if one or more components are removed.
Parameters: None
VB Example:
Dim removedDefs
removedDefs = oComponentManager.RemoveUnused()
Note:
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
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")
UI Access NA
Python IsUsed(<ComboName>)
Syntax
Python RemoveUnused()
Syntax
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
<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
<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:
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)
Return Value: <newname> // Name of the new model added
Parameters: <defName> // Model that is the base for the new con-
version
VB Example: Dim newname
newname = oModelManager.ConvertToParametric([in] BSTR defName, [out, retval]
BSTR* newName);
Edit [deprecated]
Deprecated command — please use EditWithComps.
EditWithComps [model manager]
Use: Edit an existing model.
Command: None
Syntax: EditWithComps <ModelName>,
Array("NAME:<NewModelName>",
"ModTime:=", <ModifiedTimeInfo>,
"Library:=", <string>, // Library name
"LibLocation:=", <string>, // Project Location
<PinDefInfo>,
<PinDefInfo>,... // optional, to define pins
<GraphicsDataInfo>, // optional, to define graphics
<PropDisplayMapInfo>), // optional, to define property displays
Array(<ListOfComponentNames>) // Component names
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
<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
<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
<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
<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), _
<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
<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"])
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
Add
BringToFront
Edit
EditWithComps
Export
GetData
GetNames
IsUsed
Remove
RemoveUnused
Add [symbol manager]
Use: Add a symbol
Command: Tools > Edit Configured Libraries > Symbols > Add Symbol
Syntax: Add Array("NAME:<SymbolName>",
"ModTime:=", <ModifiedTimeInfo>,
"Library:=", "", // Library name
"LibLocation:=", "Project", // Project Location
<PinDefInfo>,
<PinDefInfo>,... // optional, to define pins
<GraphicsDataInfo>, // optional, to define graphics
<PropDisplayMapInfo>)) // optional, to define property displays
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
<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
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.
Parameters: <SymbolName>:
<string> // composite name of the symbol being edited
<NewSymbolName>:
<string> // new simple name for the symbol
<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.
<PinDefInfo>:
Array("NAME:PinDef",
"Pin:=", Array (<string>, // pin name
<real>, // x location
<real>, // y location
<real>, // angle in radians
<PinType>,
<real>, // line width
<real>, // line length
<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
<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
<ListOfComponentNames>:
<string>,<string> ...
// The list may be empty. When not empty, each string that is listed is a component
// that references the symbol to be edited. Prior to editing, a clone of the symbol is
// made, and the components that are listed are modified so that they now refer to
// the clone.
VB Example:
Dim nam
oSymbolManager.EditWithComps _
("Nexxim Circuit Elements\Distributed\Distributed:bendo", _
Array("NAME:bendo new name", _
"ModTime:=", 1152722165, _
"Library:=", "Nexxim Circuit Elements\Distributed\Distributed", _
"LibLocation:=", "SysLibrary", _
Array("NAME:PinDef", _
"Pin:=", Array( "n1", _
-0.00254, _
0.00254, _
0, _
"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")
<SymbolName>:
<string> // composite name of symbol to export
<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"
VB Example:
oSymbolManager.Export _
Array("NAME Nexxim Circuit Ele-
ments\Distributed\Distributed:bendo:mylib", _ "mySymbol"), "Per-
sonalLib"
GetData [symbol manager]
Use: Gets data that describes the definition.
Command: None
Syntax: GetData(<DefinitionName>)
Return Value: <DefinitionData> This is an array of data for the definition.
Parameters: <DefinitionName>:
<string> // composite name of the definition to edit
VB Example:
Dim symbolData
symbolData = oSymbolManager.GetData("Nexxim Circuit Ele-
ments\Hspice:nexx_bjt_npn")
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.
<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"
removedDefs = oSymbolManager.RemoveUnused()
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.
"LibLocation:=", "Project",
"OkayToMirror:=", <bool>,
"DefUnits:=", <UnitType>,
Array(NAME:Lyrs",
"Layer:=", <LayerArray>,
"Layer:=", <LayerArray>…,
"SLayer:=", <StackupLayerArray>,
"SLayer:=", <StackupLayerArray>...),
"ActLyr:=", <string>, // name of active layer
"Tol:=", <ToleranceArray> // optional
<PrimitivesInfo>, // optional
<PinsInfo>, // optional
<ViasInfo>, // optional
<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>:
<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
<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
<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>:
<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>,
<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",
"P:=", Array("Port:=", Array("Id:=", 3, "N:=", "n1"), _
"Pos:=", Array("x:=", "-P/2", "y:=", "0mm"), _
"VRt:=", "180deg", _
"Ref:=", "NoPad SMT East", _
"Frm:=", 12, _
"To:=", 9, _
"Lyr:=", Array("Map:=", Array("U:=", "forward",_
"F:=", Array(-1, -1, -1, -1,_
-1, -1, -1, -1,_
-1, -1, 0, -1, -1), _
"B:=", Array(10))), _
"Use:=", Array()), _
"P:=", Array("Port:=", Array("Id:=", 4, "N:=", "n4"),_
"Pos:=", Array("x:=","P/2", "y:=", "0mm"),_
"HD:=", "1mm", _
"Ref:=", 3), _
"P:=", Array("Port:=", Array("Id:=",5, "N:=", "n2"),_
"Pos:=", Array("x:=", "-P/2", "y:=", "0mm"),_
"VRt:=", "180deg",_
"Ref:=", "NoPad SMT East",_
"Frm:=", 12, _
"To:=", 9, _
"Lyr:=", Array("Map:=", Array("U:=", "forward",_
"F:=", Array(0, -1, -1, -1, -1,_
-1, -1, -1, -1, _
-1, -1, -1, -1), _
"B:=", Array(0))), _
"Use:=", Array()), _
"P:=", Array("Port:=", Array("Id:=", 6, "N:=", "n3"), _
"SLayer:=", <StackupLayerArray>...),
"ActLyr:=", <string>, // name of active layer
"Tol:=", <ToleranceArray> // optional
<PrimitivesInfo>, // optional
<PinsInfo>, // optional
<ViasInfo>, // optional
<EdgeportsInfo>, // optional
<ComponentPropertyInfo>,
<ScriptInfo>, // optional, specified for scripted footprints
Array(<ListofComponentNames>) // Component names
Return Value: <string>
// composite name of the footprint.
// If the name requested conflicts with the name of an existing
// footprint, the requested name is altered to be unique.
// The name returned reflects any change made to be unique.
Parameters: <FootprintName>:
<string> // composite name of the footprint being edited
<NewFootprintName>:
<string> // new simple name for the footprint
<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.
<UnitType>:
<string> // default length units to use if units are not specified in other
// parameters
<LayerArray>:
Array("N:=", <string>, // layer name
"ID:=", <int> ,
"T:=", <LayerTypeInfo>, // layer type
"TB:=", <TopBottomInfo>,
"Col:=", <int>, // optional - color
"Pat:=", <int>, // optional - fill pattern
"Vis:=", <bool>, // optional - are objects on layer visible
"Sel:=", <bool>, // optional - are objects on layer selectable
"L:=", <bool>) // optional
// are objects on layer locked (can't be edited)
<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
<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
<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
<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",
<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, _
"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")
Export [footprint manager]
Use: Export a footprint to a library
Command: Tools > Edit Configured Libraries > Footprints > Export to Library
Syntax: Export Array("NAME:<LibraryName>",
<FootprintName>,
<FootprintName>...),
<LibraryLocation>
Return Value: None
Parameters: <LibraryName>:
<string> // name of the library
<FootprintName>:
<string> // composite name of footprint to export
<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"
VB Example:
oFootprintManager.Export Array("NAME:mylib", "Distributed Foot-
prints:BPAD"), "PersonalLib"
GetData [footprint manager]
FootprintGetData
Use: Gets data that describes the definition.
Command: None
Syntax: GetData(<DefinitionName>)
Return Value: <DefinitionData> This is an array of data for the definition.
Parameters: <DefinitionName>:
<string> // composite name of the definition to edit
VB Example:
Dim footprintData
footprintData = oFootprintManager.GetData("Nexxim Circuit Ele-
ments\Distributed\Nexxim_Footprints:MCPL13_Nexx")
Note:
GetData allows the user to access definition information, make modifications, and then
use the Edit or EditWithComps script commands to save the modified definition. Accord-
ingly, for each type of definition, the array data returned to GetData should be the same
array information that is supplied to the Edit or EditWithComps commands.
<LibraryName>,
<LibraryLocation>
Return Value: None
Parameters: <FootprintName>:
<string> // composite name of the footprint to remove
<IsProjectFootprint>:
<bool>
<LibraryName>:
<string> // name of the library
<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"
VB Example:
oFootprintManager.Remove "BPAD", true, "Distributed Footprints",
"Project"
oFootprintManager.Remove "BPAD", false, "MyLib", "PersonalLib"
RemoveUnused [footprint manager]
Use: Removes footprints that are not used in the design.
Command: Project->Remove Unused Definitions is similar but operates slightly different and
does not record script commands.
Syntax: RemoveUnused()
Return Value: <bool> True if one or more footprints are removed.
Parameters: None
VB Example:
Dim removedDefs
removedDefs = oFootprintManager.RemoveUnused()
Note:
Also, the symbol and footprint of an unused component are not unusable until after the
component itself is removed using the Component ManagerRemove script.
Array("NAME:psd",
"nam:= ", <PadstackName>,
"lib:=", "", // name of the library
"mat:=", "", // hole plating material
"plt:=", "0", // percent of hole's radius filled by plating
Array("NAME:pds",
<LayerGeometryArray>,
<LayerGeometryArray....),
"hle:=", <PadInfo>
"hRg:=", <HoleRange>,
"sbsh:=", <SolderballShape>,
"sbpl:=", <SolderballPlacement>,
"sbr:=", <string>, // solderball diameter, real with units
"sb2:=", <string>, // solderball mid diameter, real with units
"sbn:=", <string>), // name of solderball material
"ppl:=", <PadPortLayerArray>)
Return Value: simple name of the added padstack
// If the name requested conflicts with the name of an existing
// 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",
<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
<PadPortLayerArray>:
Array( <int>, <int>,....) where each int is a layer id
VB Example:
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",
<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>:
<PadPortLayerArray>:
Array( <int>, <int>,....) where each int is a layer id
VB Example:
oPadstackManager.Edit "Circle - through1", Array("NAME:Circle -
through1", "ModTime:=", _
1235765635, "Library:=", "", "LibLocation:=", "Project", Array
("NAME:psd", "nam:=", _
"Circle - through1", "lib:=", "", "mat:=", "", "plt:=", "0", Array
("NAME:pds", Array("NAME:lgm", "lay:=", _
"Top Signal", "id:=", 0, "pad:=", Array("shp:=", "Cir", "Szs:=",
Array("2.5mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir",
"Szs:=", Array( _
"3.5mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array
("shp:=", "No", "Szs:=", Array(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", "0mm",
"dir:=", "Any"), Array("NAME:lgm", "lay:=", _
"SignalA", "id:=", 1, "pad:=", Array("shp:=", "Cir", "Szs:=", Array
("2mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir",
"Szs:=", Array( _
"3mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0"), "thm:=", Array
("shp:=", "No", "Szs:=", Array(), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0"), "X:=", "0mm", "Y:=", "0mm",
"dir:=", "Any"), Array("NAME:lgm", "lay:=", _
"SignalB", "id:=", 2, "pad:=", Array("shp:=", "Cir", "Szs:=", Array
("2mm"), "X:=", _
"0mm", "Y:=", "0mm", "R:=", "0deg"), "ant:=", Array("shp:=", "Cir",
"Szs:=", Array( _
"3mm"), "X:=", "0mm", "Y:=", "0mm", "R:=", "0deg"), "thm:=", Array
("shp:=", "No", "Szs:=", Array(), "X:=", _
Parameters: <PadstackName>:
<string> // composite name of the padstack being edited
<NewPadstackName>:
<string> // new simple name for the padstack
<ModifiedOnInfo>:
An integer that corresponds to the number of seconds that have elapsed
since 00:00 hours, Jan 1, 1970 UTC from the system clock.
<LayerGeometryArray>:
Array("Name:lgm",
"lay:=", <string>, // definition layer name
"id:=", <int>, // definition layer id
"pad:=", <PadInfo>, // pad
"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
<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
<SolderballPlacement>:
<string> one of these choices
"abv" // above padstack
"blw" // below padstack
<PadPortLayerArray>:
Array( <int>, <int>,....) where each int is a layer id
<ListOfComponentNames>:
<string>,<string> ...
// The list may be empty. When not empty, each string that is listed is a component
// that references the padstack to be edited. Prior to editing, a clone of the padstack is
// made, and the components that are listed are modified so that they now refer to
// the clone.
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:=", _
<PadstackName>:
<string> // simple name of padstack to export
<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"
VB Example:
oPadstackManager.Export Array("NAME:mylib", "myPadstack"), "Per-
sonalLib"
GetData [padstack manager]
Use: Gets data that describes the definition.
Command: None
Syntax: GetData(<DefinitionName>)
Return Value: <DefinitionData> This is an array of data for the definition.
Parameters: <DefinitionName>:
<string> // composite name of the definition to edit
VB Example:
Dim padstackData
padstackData = oPadstackManager.GetData("NoPad SMT East")
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.
Command: Tools > Edit Configured Libraries > Padstacks > Remove Padstacks
Syntax: Remove <PadstackName>,
<IsProjectPadstack>,
<LibraryName>,
<LibraryLocation>
Return Value: None
Parameters: <PadstackName>:
<string> // simple name of the padstack to remove
<IsProjectPadstack>:
<bool>
<LibraryName>:
<string> // name of the library
<LibraryLocation>:
<string> // location of the library in <LibraryName>
// One of "Project", "PersonalLib", or "UserLib"
VB Example:
Dim removedDefs
removedDefs = oPadstackManager.RemoveUnused()
Note:
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 >)
Return Value: None
Parameters: <OriginalName>
Type: <String>
Name of the script before editing.
<NewName>
Type: <String>
New name for the script.
<ScriptText>
Type: <string> // text of script
VB Example:
oDefinitionManager.EditScript "myscript",
Array("NAME:myscript", "ScriptLang:=", _
"vbscript", "ScriptText:=", _
"MsgBox(" & Chr(34) & "Hello Again" & Chr(34) & ")")
oDefinitionManager.EditScript ("myscript",
Python
["NAME:myscript", "ScriptLang:=", _
Example
"vbscript", "ScriptText:=", _
ExportScript
Use: Export to Library in the script definition manager
Command: None
Syntax: ExportScript <ExportData>,<Library location>
Return Value: None
Parameters: <ExportData>
Array("NAME:<LibraryName>",<ScriptName>,<ScriptName>,…)
VB Example:
oProject.ExportComponent Array("NAME:mylib", "myscript"), "Per-
sonalLib"
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:
Python
oDefinitionManager.RemoveScript(
Example "myscript", true, "Local", "Project")
ModifyLibraries
Use: Configure Libraries on the Tools menu
Command: None
Syntax: ModifyLibraries <DesignName>,Array(<ConfigLibArray>)
Return Value: None
Parameters: <DesignName>
Type: <string>
<ConfigLibArray>
Array("NAME:<LibraryType>,<ConfiguredLib>,<ConfiguredLib>,…),…
<ConfiguredLib> // blank to leave unchanged
<DefinitionType>
Array("<libraryname >","<libraryname>",…)
VB Example:
oDefinitionManager.ModifyLibraries "MyCircuit", _
Array("NAME:PersonalLib"), _
Array("NAME:UserLib"), _
Array("NAME:SystemLib", _
"Symbols:=", Array( "Circuit Elements", "Symbols", _
"ParamExtraElements\PE_Symbols", _
"Vendor Elements\Nonlinear"))
Python oDefinitionManager.ModifyLibraries(
"MyCircuit", _
["NAME:PersonalLib"], _
["NAME:UserLib"], _
Example ["NAME:SystemLib", _
"Symbols:=", [ "Circuit Elements", "Symbols",_
"ParamExtraElements\PE_Symbols", _
"Vendor Elements\Nonlinear"]])
23-164
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
24 - 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
Variable Helix Script
This sample script creates a tapered helix. Tapering helices is not supported from the interface.
The script includes comment lines, which are preceded by an apostrophe ( ') and offer explanations
for each subsequent line or lines.
Dim oAnsoftApp
Dim oDesktop
Dim oProject
Dim oDesign
Dim oEditor
Dim oModule
Set oAnsoftApp = CreateObject("Ansoft.ElectronicsDesktop")
Set oDesktop = oAnsoftApp.GetAppDesktop()
’ 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
Equation Based Curve Python Script
This sample Python script creates an equation based curve that produces a helix.
from math import pi, sin, cos
oProject = oDesktop.GetActiveProject()
oDesign = oProject.GetActiveDesign()
oEditor = oDesign.SetActiveEditor("3D Modeler")
Start_t = 0
End_t = pi*2
Npoint = 128
Nsection = Npoint-1
d_t = (End_t-Start_t)/Nsection
for n in range(1,Nsection):
P1 = Start_t+d_t*(n-1)
P2 = P1+d_t
X_t1 = cos(P1*6)
Y_t1 = sin(P1*6)
Z_t1 = P1
X_t2 = cos(P2*6)
Y_t2 = sin(P2*6)
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
])
HFSS Waveguide Array Python Script
This sample Python script creates an HFSS Waveguide array. The script includes comment lines,
which are preceded by an apostrophe ( ’ ), that offer explanations for each subsequent line or lines.
The script includes examples of creating a 3D model, boundaries and excitation, solution setup and
sweep, as well as reports.
You must insert an HFSS project before running the script. Running the script causes a series of
input dialogs to appear that lets you set parameters.
The first dialog asks for input for a and be dimensions and the waveguide length.
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)"]
], [])
3 CreatePoint 10-20
Index-1
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-2
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-3
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-4
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-5
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-6
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-7
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
DeleteOp 14-2
D
DeleteOutputVariable 11-4
dataset commands
DeletePolylinePoint 10-63
AddDataset 7-1
DeleteProject 3-8
DeleteDataset 7-2
DeleteReport 12-35
EditDataset 7-3
DeleteSetups
ImportDataset 7-4
Analysis module command 15-3
Dataset Script Commands 7-1
Optimetrics module command 16-5
Definition Manager Script Com-
mands 23-1 DeleteSolutionVariation 17-5
Index-8
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-9
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-10
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
NewProject 3-41 E
OpenMultipleProjects 3-43
Edit 23-29, 23-76, 23-76, 23-96, 23-
OpenProject 3-43 96, 23-124, 23-145
Index-11
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-12
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-13
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-14
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-15
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-16
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-17
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-18
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-19
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
GetSetupNamesByType 16-12
O
ImportSetup 16-13
oAnsoftApp object 1-76
RenameSetup 16-14
oDesign object 1-76
SolveSetup 15-2, 16-4, 16-16, 16-16
oDesktop object 1-76
Optimetrics Module Script Commands 16-1
oEditor object 1-76
optimization commands
OffsetFaces 10-70
EditSetup 16-22
oModule object 1-76
InsertSetup 16-26
OpenAndConvertProject 3-42
Optimization Script Commands 16-22
OpenExternalEditor 10-162
Other oEditor Commands 10-132
OpenMultipleProjects 3-43
output variable commands
OpenProject 3-43
CreateOutputVariable 11-1
operators
DeleteOutputVariable 11-4
arithmetic 1-5
DoesOutputVariableExist 11-5
categories in VBScript 1-4
EditOutputVariable 11-6
comparison 1-6
GetOutputVariableValue 11-8
concatenation 1-6
Output Variable Script Commands 11-1
logical 1-6
precedence of 1-4 P
oProject object 1-76 Padstack Manager Script Commands 23-
140
Optimetrics module commands
PageSetup 10-162
DeleteSetups 16-5
parametric commands
DistributeAnalyzeSetup 16-6
EditSetup 16-17
ExportDXConfigFile 16-6
GenerateVariationData Parametric 16-
ExportOptimetricsProfile 16-7
18
ExportOptimetricsResults 16-8
InsertSetup 16-18
ExportParametricResults 16-8
Parametric Script Commands 16-17
GetChildNames 16-9, 16-10
Paste 3-44, 3-46, 5-18, 8-48
GetSetupNames 16-12
Paste (Model Editor) 10-71
Index-20
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-21
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-22
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-23
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-24
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-25
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
Index-26
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
ListValuesOfVariable 17-22
T
ListVariations 17-22, 17-22
ThickenSheet 10-127
ModuleHasMatrixData 17-17
TileWindows 3-67
ModuleHasMesh 17-18
Solutions Module Script U
Commands 17-1
UnassignIERegions 13-68
Solve 8-61
UncoverFaces 10-128
SolveAllSetup, Optimetrics module
command 16-16 underscore ( _ ) character 1-11
Index-27
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.
HFSS Scripting Guide
DeleteUserDefinedSolution 21-3
EditUserDefinedSolution 21-4
Using a Do Loop 1-8
V
ValidateDesign 8-67
Variable Naming Conventions 1-3
variables
array 1-3
assigning information 1-2
declaring 1-2
hierarchy in HFSS 1-76
used as objects 1-11
used in HFSS scripts 1-76
VBScript 1-1
Microsoft user’s guide 1-11
operators 1-4
references 1-11
Sub procedures 1-11
VBScript Procedures 1-9
W
WrapSheet 10-131
Index-28
ANSYS Electromagnetics Suite 2020 R2 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential
information of ANSYS, Inc. and its subsidiaries and affiliates.