scriptingmaxwell_onlinehelp

326
Introduction to Scripting in Maxwell September 2010 ANSYS, Inc. 275 Technology Drive Canonsburg, PA 15317 Tel: (+1) 7247463304 Fax: (+1) 7245149494 General Information: [email protected] Technical Support: [email protected]

Upload: scibdreader

Post on 24-Nov-2014

1.062 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

September 2010ANSYS, Inc.275 Technology DriveCanonsburg, PA 15317Tel: (+1) 724‐746‐3304Fax: (+1) 724‐514‐9494General Information: [email protected] Support: [email protected]

Page 2: scriptingMaxwell_onlinehelp

The information contained in this document is subject to change without notice. ANSYS, Inc. makes no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. ANSYS, Inc. shall not be liable for errors contained herein or for incidental or consequential damages in connection with the furnishing, performance, or use of this material.

© 2010 SAS IP, Inc. All rights reserved.

Ansoft, Simplorer, Optimetrics, Maxwell, and RMxprt are registered trademarks or trademarks of SAS IP, Inc. All other trademarks are the property of their respective owners.

Printing HistoryNew editions of this manual incorporate all material updated since the previous edition. The man‐ual printing date, which indicates the manual’s current edition, changes when a new edition is printed. Minor corrections and updates that are incorporated at reprint do not cause the date to change.

Update packages may be issued between editions and contain additional and/or replacement pages to be merged into the manual by the user. Pages that are rearranged due to changes on a previous page are not considered to be revised.

Edition Date Software Version

1 October 2005 112 February 2006 11 SP 13 February 2008 124 January 2010 135 September 2010 14

ii

Page 3: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Getting Help

Ansoft Technical SupportTo contact Ansoft technical support staff in your geographical area, please log on to the Ansoft corporate website, http://www.ansoft.com, click the Contact button, and then click Support. Your Ansoft sales engi-neer may also be contacted in order to obtain this information.E-mail can work well for technical support. All Ansoft software files are ASCII text and can be sent conveniently by e-mail. When reporting diffi-culties, it is extremely helpful to include very specific information about what steps were taken or what stages the simulation reached. This allows more rapid and effective debugging.

iii

Page 4: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

iv

Page 5: scriptingMaxwell_onlinehelp

Table of Contents

1. Introduction to VBScriptSample Maxwell Script . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3VBScript Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5

Declaring Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5

Variable Naming Conventions . . . . . . . . . . . . . . . . . . . . . . 1-6

Scope and Lifetime of Variables . . . . . . . . . . . . . . . . . . . . 1-6

Array Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6

VBScript Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8Operator Precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8

Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8

Comparison Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9

Logical Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9

Controlling Program Execution . . . . . . . . . . . . . . . . . . . . . 1-10Using If...Then...Else . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-10

Using Select Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-10

Looping Through Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-11Using a For...Next Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-11

Using a Do Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-11

Repeating Statements While a Condition is True . . . . . . . 1-11

Repeating a Statement Until a Condition Becomes True . 1-11

VBScript Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-12

Contents-1

Page 6: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Function Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-12

Sub Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-12

Converting Between Data Types . . . . . . . . . . . . . . . . . . . . 1-12Interacting with a Script . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-13Recommended VBScript References . . . . . . . . . . . . . . . . 1-13

2. Maxwell and VBScriptOverview of Maxwell Script Variables . . . . . . . . . . . . . . . . 2-2Recording a Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5Stopping Script Recording . . . . . . . . . . . . . . . . . . . . . . . . . 2-5Running a Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6Pausing and Resuming a Script . . . . . . . . . . . . . . . . . . . . 2-7Stopping a Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7Maxwell Scripting Conventions . . . . . . . . . . . . . . . . . . . . . 2-7

Syntax Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7

Script Command Conventions . . . . . . . . . . . . . . . . . . . . . 2-8

Named Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9

Setting Numerical Values . . . . . . . . . . . . . . . . . . . . . . . . . 2-10

Executing a Script from Within a Script . . . . . . . . . . . . . . . 2-11Editing Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11

3. Ansoft Application Object Script CommandsGeneral Application Script Commands . . . . . . . . . . . . . . . 3-2

GetAppDesktop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2

SetDesiredRamMBLimit . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2

SetMaximumRamMBLimit . . . . . . . . . . . . . . . . . . . . . . . . 3-2

SetNumberOfProcessors . . . . . . . . . . . . . . . . . . . . . . . . . 3-3

GetDesiredRamMBLimit . . . . . . . . . . . . . . . . . . . . . . . . . 3-3

GetMaximumRamMBLimit . . . . . . . . . . . . . . . . . . . . . . . . 3-4

GetNumberOfProcessors . . . . . . . . . . . . . . . . . . . . . . . . . 3-4

4. Desktop Object Script CommandsGeneral Desktop Script Commands . . . . . . . . . . . . . . . . . 3-2

CloseAllWindows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2

CloseProject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3

Contents-2

Page 7: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

CloseProjectNoForce . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3

EnableAutoSave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3

GetActiveProject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3

GetLibraryDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4

GetProjectDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4

GetProjectList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4

GetTempDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4

GetVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4

NewProject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5

OpenMultipleProjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5

OpenProject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5

PauseScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6

Print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6

QuitApplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6

RestoreWindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6

RunProgram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7

RunScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7

SetActiveProject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8

SetActiveProjectByPath . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8

SetLibraryDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8

SetProjectDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9

SetTempDirectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9

Sleep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9

Commands for Querying Objects . . . . . . . . . . . . . . . . . . . 3-10Count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10

GetDesigns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11

GetDistributedAnalysisMachines . . . . . . . . . . . . . . . . . . . 3-11

GetName (Desktop) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11

GetProjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11

5. Project Object Script CommandsGeneral Project Object Script Commands . . . . . . . . . . . . 4-2

GetName (Project) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2

GetPath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2

Contents-3

Page 8: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

GetActiveDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3

SetActiveDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3

GetTopDesignList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3

GetDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3

Close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4

Save . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4

SaveAs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4

InsertDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4

CopyDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5

Paste (Project) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6

CutDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6

DeleteDesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6

Undo (Project) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6

Redo (Project) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7

AnalyzeAll (Project menu) . . . . . . . . . . . . . . . . . . . . . . . . 4-7

6. Material Script CommandsMaterial Level Script Commands . . . . . . . . . . . . . . . . . . . 5-2

AddMaterial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2

DoesMaterialExist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3

EditMaterial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4

ExportMaterial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5

RemoveMaterial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5

7. Property Script CommandsConventions Used in the Property Script Chapter . . . . . . 6-2

General Property Scripting Commands . . . . . . . . . . . . . . 6-4ChangeProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4

Callback Scripting Using PropHost Object . . . . . . . . . . . . 6-10

PropHost Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-13AddMenuProp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-13

AddMenuProp2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-14

AddProp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-14

AddProp2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-14

Contents-4

Page 9: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

ExecuteScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-15

GetCallback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-15

GetChangedProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-15

GetDescription . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-15

GetEditor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-16

GetFileName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-16

GetHidden . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-16

GetPropServers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-16

GetPropTabType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-17

GetReadOnly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-17

GetTabTypeName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-17

GetText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-17

GetValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-18

PropertyExists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-18

RemoveProp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-18

SetCallback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-18

SetDescription . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-19

SetHidden . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-19

SetReadOnly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-19

SetText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-19

SetValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-19

Additional Property Scripting Commands . . . . . . . . . . . . . 6-21GetPropertyValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-21

SetPropertyValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-21

GetProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-22

GetVariableValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-22

SetVariableValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-23

GetVariables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-23

Additional Property Scripting Example . . . . . . . . . . . . . . . 6-24

Example: Using Record Script and Edit Properties . . . . . 6-25

8. Dataset Script CommandsGeneral Dataset Script Commands . . . . . . . . . . . . . . . . . 7-2

AddDataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2

Contents-5

Page 10: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

EditDataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2

DeleteDataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3

9. Design Object Script CommandsConventions Used in the Design Object Chapter . . . . . . . 8-2

General Design Object Script Commands . . . . . . . . . . . . 8-3GetName (Design) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3

GetModule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4

SetDesignSettings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4

DeleteVariation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-6

SetSolutionType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-7

SetActiveEditor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-7

Solve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-8

Undo (Design) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-8

Redo (Design) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-8

RenameDesignInstance . . . . . . . . . . . . . . . . . . . . . . . . . . 8-8

ApplyMeshOps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-9

EditNotes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-9

AnalyzeAll (Maxwell menu) . . . . . . . . . . . . . . . . . . . . . . . 8-10

AnalyzeAllNominal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-10

Analyze . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-10

AnalyzeDistributed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-10

SetConductivityThreshold . . . . . . . . . . . . . . . . . . . . . . . . 8-11

ExportConvergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-11

GetVariationVariableValue . . . . . . . . . . . . . . . . . . . . . . . . 8-12

ExportMeshStats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-12

ExportProfile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-13

GetNominalVariation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-14

Is2D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-14

Is3D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-14

GetOutputVariableValue, AddOutputVariable, EditOutputVari-able, DeleteOutputVariable . . . . . . . . . . . . . . . . . . . . . . . 8-14

ChangeProperty, GetPropertyValue, SetPropertyValue, Get-Properties, GetVariableValue, SetVariableValue, GetVariables

Contents-6

Page 11: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

8-15

CreateReport, RemoveReport, GetReportNames . . . . . . 8-15

AddDataset, EditDataset, DeleteDataset . . . . . . . . . . . . . 8-15

10. Output Variable Script CommandsGeneral Output Variable Script Commands . . . . . . . . . . . 9-2

CreateOutputVariable . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2

EditOutputVariable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3

DeleteOutputVariable . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-4

DoesOutputVariableExist . . . . . . . . . . . . . . . . . . . . . . . . . 9-4

GetOutputVariables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-4

GetOutputVariableValue . . . . . . . . . . . . . . . . . . . . . . . . . 9-4

11. 3D Modeler Editor Script CommandsConventions Used in the 3D Modeler Chapter . . . . . . . . 10-2

Draw Menu Commands . . . . . . . . . . . . . . . . . . . . . . . . . . 10-3CreateBondwire . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-3

CreateBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-4

CreateCircle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-5

CreateCone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-6

CreateCutplane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-6

CreateCylinder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-7

CreateEllipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-7

CreateHelix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-8

CreatePoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-8

CreateUserDefinedPart . . . . . . . . . . . . . . . . . . . . . . . . . 10-9

CreatePolyline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-9

CreateRectangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-10

CreateRegularPolyhedron . . . . . . . . . . . . . . . . . . . . . . . 10-11

CreateRegularPolygon . . . . . . . . . . . . . . . . . . . . . . . . . . 10-12

CreateSphere . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-12

CreateSpiral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-13

CreateTorus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-13

EditPolyline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-14

Contents-7

Page 12: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

InsertPolylineSegment . . . . . . . . . . . . . . . . . . . . . . . . . . 10-14

PurgeHistory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-15

DeletePolylinePoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-16

SweepAlongPath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-16

SweepAlongVector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-17

SweepAroundAxis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-17

Edit Menu Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-19Copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-19

DuplicateAlongLine . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-19

DuplicateAroundAxis . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-20

DuplicateMirror . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-20

Mirror . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-21

Move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-21

OffsetFaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-21

Paste (Modeler) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-22

Rotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-22

Scale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-22

Modeler Menu Commands . . . . . . . . . . . . . . . . . . . . . . . 10-24AssignMaterial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-25

Chamfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-25

Connect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-25

CoverLines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-26

CoverSurfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-26

CreateEntityList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-26

CreateFaceCS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-27

CreateObjectFromEdges . . . . . . . . . . . . . . . . . . . . . . . . 10-28

CreateObjectFromFaces . . . . . . . . . . . . . . . . . . . . . . . . 10-29

CreateRelativeCS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-30

DeleteLastOperation . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-30

DetachFaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-30

EditEntityList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-31

EditFaceCS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-31

EditRelativeCS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-32

Contents-8

Page 13: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Export . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-32

Fillet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-33

GenerateHistory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-33

Import . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-33

ImportDXF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-34

Intersect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-37

MoveFaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-37

Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-38

SeparateBody . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-39

SetModelUnits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-39

SetWCS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-39

ShowWindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-39

Split . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-40

Subtract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-40

UncoverFaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-41

Unite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-42

Other oEditor Commands . . . . . . . . . . . . . . . . . . . . . . . . 10-43Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-43

GetModelBoundingBox . . . . . . . . . . . . . . . . . . . . . . . . . 10-43

GetEdgeByPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-43

GetFaceByPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-44

GetUserPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-45

GetObjectName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-45

GetObjectIDByName . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-45

GetObjectNameByFaceID . . . . . . . . . . . . . . . . . . . . . . . 10-46

GetMatchedObjectName . . . . . . . . . . . . . . . . . . . . . . . . 10-46

GetNumObjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-46

GetSelections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-46

PageSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-47

RenamePart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-47

GetModelBoundingBox . . . . . . . . . . . . . . . . . . . . . . . . . 10-48

12. Reporter Editor Script CommandsGeneral Reporter Editor Script Commands . . . . . . . . . . 11-2

Contents-9

Page 14: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

AddCartesianXMarker . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2

AddDeltaMarker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-3

AddMarker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-4

AddNote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-4

AddTraces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-5

ClearAllMarkers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-6

CopyTracesData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-7

CopyReportData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-7

CopyReportDefinitions . . . . . . . . . . . . . . . . . . . . . . . . . . 11-7

CopyTraceDefinitions . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-8

CreateReport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-8

CreateReportFromTemplate . . . . . . . . . . . . . . . . . . . . . 11-10

DeleteTraces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-11

ExportToFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-11

GetAllReportNames . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-12

GetDisplayType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-12

ImportIntoReport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-13

PasteReports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-13

PasteTraces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-13

DeleteAllReports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-14

DeleteReports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-14

RenameReport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-14

RenameTrace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-14

UpdateTraces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-15

UpdateTracesContextAndSweeps . . . . . . . . . . . . . . . . . 11-16

13. Boundary and Excitation Module Script Com-mands

Conventions Used in this Chapter . . . . . . . . . . . . . . . . . 12-2

General Commands Recognized by the Boundary/Excitation Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-3

DeleteBoundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-3

DeleteAllBoundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-3

DeleteAllExcitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-4

Contents-10

Page 15: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

GetBoundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-4

GetBoundariesOfType . . . . . . . . . . . . . . . . . . . . . . . . . . 12-4

GetBoundaryAssignment . . . . . . . . . . . . . . . . . . . . . . . . 12-4

GetNumBoundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-5

GetNumBoundariesOfType . . . . . . . . . . . . . . . . . . . . . . 12-5

GetExcitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-5

GetExcitationsOfType . . . . . . . . . . . . . . . . . . . . . . . . . . 12-5

GetNumExcitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-6

GetNumExcitationsOfType . . . . . . . . . . . . . . . . . . . . . . . 12-6

RenameBoundary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-6

ReassignBoundary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-7

ReprioritizeBoundaries . . . . . . . . . . . . . . . . . . . . . . . . . . 12-7

Script Commands for Creating and Modifying Boundaries 12-8AssignZeroTangentialHField . . . . . . . . . . . . . . . . . . . . . 12-8

EditZeroTangentialHField . . . . . . . . . . . . . . . . . . . . . . . 12-9

AssignSymmetry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-9

EditSymmetry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-9

AssignInsulating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-9

EditInsulating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-10

AssignMaster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-10

EditMaster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-10

AssignSlave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-10

EditSlave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-11

AssignRadiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-11

EditRadiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-11

AssignImpedance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-12

EditImpedance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-12

AssignTangentialHField . . . . . . . . . . . . . . . . . . . . . . . . . 12-12

EditTangentialHField . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-13

AssignCylindricalHField . . . . . . . . . . . . . . . . . . . . . . . . . 12-13

EditCylindricalHField . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-14

Script Commands for Creating and Modifying Excitations 12-15AssignVoltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-15

Contents-11

Page 16: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

AssignVoltageGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-16

EditVoltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-16

AssignVoltageDrop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-16

AssignVoltageDropGroup . . . . . . . . . . . . . . . . . . . . . . . 12-17

EditVoltageDrop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-17

AssignCurrentDensity . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-17

AssignCurrentDensityGroup . . . . . . . . . . . . . . . . . . . . . 12-18

EditCurrentDensity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-18

AssignCurrentDensityTerminal . . . . . . . . . . . . . . . . . . . 12-18

AssignCurrentDensityTerminalGroup . . . . . . . . . . . . . . 12-19

EditCurrentDensityTerminal . . . . . . . . . . . . . . . . . . . . . . 12-19

AssignCurrent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-19

AssignCurrentGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-19

EditCurrent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-19

AssignFloating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-20

EditFloating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-20

AssignCharge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-20

EditCharge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-21

AssignVolumeChargeDensity . . . . . . . . . . . . . . . . . . . . 12-21

EditVolumeChargeDensity . . . . . . . . . . . . . . . . . . . . . . . 12-21

AssignCoilTerminal . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-21

AssignCoilTerminalGroup . . . . . . . . . . . . . . . . . . . . . . . 12-22

EditCoilTerminal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-22

AssignSink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-22

EditSink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-23

Other BoundarySetup Module Script Commands . . . . . . 12-24AssignWindingGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-24

EditWindingGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-25

AddTerminalsToWinding . . . . . . . . . . . . . . . . . . . . . . . . 12-25

EditExternalCircuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-25

SetCoreLoss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-26

SetEddyEffect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-26

SetMinimumTimeStep . . . . . . . . . . . . . . . . . . . . . . . . . . 12-27

Contents-12

Page 17: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

14. Mesh Operations Module Script CommandsConventions Used in the Mesh Operations Chapter . . . 13-2

General Commands Recognized by the Mesh Operations Mod-ule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-3

DeleteOp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-3

GetOperationNames . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-3

RenameOp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-3

Script Commands for Creating and Modifying Mesh Operations 13-5

AssignLengthOp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-5

AssignSkinDepthOp . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-6

AssignTrueSurfOp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-7

AssignModelResolutionOp . . . . . . . . . . . . . . . . . . . . . . . 13-7

EditLengthOp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-8

EditSkinDepthOp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-8

EditTrueSurfOp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-8

EditModelResolutionOp . . . . . . . . . . . . . . . . . . . . . . . . . 13-9

15. Analysis Module Script CommandsAnalysis Setup Script Commands . . . . . . . . . . . . . . . . . . 14-2

InsertSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-2

EditSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-8

RenameSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-9

DeleteSetups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-9

ExportCircuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-9

ExportSolnData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-11

RevertSetupToInitial . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-11

RevertAllToInitial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-12

ResetSetupToTimeZero . . . . . . . . . . . . . . . . . . . . . . . . . 14-12

ResetAllToTimeZero . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-12

GetSetups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-12

GetSetupNames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-13

Analyze (Project Menu) . . . . . . . . . . . . . . . . . . . . . . . . . 14-13

CopySetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-13

Contents-13

Page 18: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

PasteSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-14

16. Optimetrics Module Script CommandsConventions Used in the Optimetrics Module Chapter . 15-2

General Commands Recognized by the Optimetrics Module 15-5

DeleteSetups (Optimetrics) . . . . . . . . . . . . . . . . . . . . . . 15-5

DistributedAnalyzeSetup . . . . . . . . . . . . . . . . . . . . . . . . 15-5

GetSetupNames (Optimetrics) . . . . . . . . . . . . . . . . . . . . 15-5

GetSetupNamesByType (Optimetrics) . . . . . . . . . . . . . 15-6

RenameSetup (Optimetrics) . . . . . . . . . . . . . . . . . . . . . . 15-6

SolveSetup (Optimetrics) . . . . . . . . . . . . . . . . . . . . . . . . 15-6

Parametric Script Commands . . . . . . . . . . . . . . . . . . . . . 15-7InsertSetup (Parametric) . . . . . . . . . . . . . . . . . . . . . . . . 15-7

EditSetup (Parametric) . . . . . . . . . . . . . . . . . . . . . . . . . . 15-9

Optimization Script Commands . . . . . . . . . . . . . . . . . . . . 15-10InsertSetup (Optimization) . . . . . . . . . . . . . . . . . . . . . . . 15-10

EditSetup (Optimization) . . . . . . . . . . . . . . . . . . . . . . . . 15-12

Sensitivity Script Commands . . . . . . . . . . . . . . . . . . . . . 15-13InsertSetup (Sensitivity) . . . . . . . . . . . . . . . . . . . . . . . . . 15-13

EditSetup (Sensitivity) . . . . . . . . . . . . . . . . . . . . . . . . . . 15-14

Statistical Script Commands . . . . . . . . . . . . . . . . . . . . . . 15-15InsertSetup (Statistical) . . . . . . . . . . . . . . . . . . . . . . . . . 15-15

EditSetup (Statistical) . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-17

17. Solutions Module Script CommandsDeleteSolutionVariation . . . . . . . . . . . . . . . . . . . . . . . . . 16-2

18. Field Overlays Module Script CommandsGeneral Parameter Setup Script Commands . . . . . . . . . 17-2

CreateFieldPlot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-2

DeleteFieldPlot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-6

GetFieldPlotNames . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-6

ModifyFieldPlot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-6

RenameFieldPlot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-7

Contents-14

Page 19: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

RenamePlotFolder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-7

SetFieldPlotSettings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-8

SetPlotFolderSettings . . . . . . . . . . . . . . . . . . . . . . . . . . 17-8

19. Fields Calculator Script CommandsField Calculator Script Commands . . . . . . . . . . . . . . . . . 18-2

AddNamedExpression . . . . . . . . . . . . . . . . . . . . . . . . . . 18-2

AddNamedExpr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-3

CalcOp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-3

CalcRead(deprecated) . . . . . . . . . . . . . . . . . . . . . . . . . . 18-3

CalcStack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-4

CalculatorRead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-4

CalculatorWrite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-5

CalcWrite(deprecated) . . . . . . . . . . . . . . . . . . . . . . . . . . 18-5

ChangeGeomSettings . . . . . . . . . . . . . . . . . . . . . . . . . . 18-6

ClcEval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-6

ClcMaterial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-6

ClearAllNamedExpr . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-6

CopyNamedExprToStack . . . . . . . . . . . . . . . . . . . . . . . . 18-7

DeleteNamedExpr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-7

EnterComplex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-7

EnterComplexVector . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-8

EnterLine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-8

EnterPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-8

EnterQty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-9

EnterScalar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-9

EnterScalarFunc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-9

EnterSurf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-10

EnterVector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-10

EnterVectorFunc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-10

EnterVol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-11

ExportOnGrid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-11

ExportToFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-12

GetTopEntryValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-12

Contents-15

Page 20: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

LoadNamedExpressions . . . . . . . . . . . . . . . . . . . . . . . . 18-13

SaveNamedExpressions . . . . . . . . . . . . . . . . . . . . . . . . 18-13

20. Motion Setup Script CommandsConventions Used in the Motion Setup Chapter . . . . . . 18-2

General Motion Setup Script Commands . . . . . . . . . . . . 18-3DeleteMotionSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-3

ReassignMoving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-3

Commands to Create and Edit the Band . . . . . . . . . . . . 18-3AssignBand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-3

EditMotionSetup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-5

Other Commands Recognized By the ModelSetup Module 18-5

SetSymmetryMultiplier . . . . . . . . . . . . . . . . . . . . . . . . . . 18-5

21. Parameter Setup Script CommandsConventions Used in the Parameter Chapter . . . . . . . . . 18-2

General Parameter Setup Script Commands . . . . . . . . . 18-3DeleteParameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-3

DeleteAllParameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-3

RenameParameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-3

ReassignParameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-4

Commands to Create and Edit Parameters . . . . . . . . . . 18-5AssignForce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-5

EditForce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-5

AssignTorque . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-6

EditTorque . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-6

AssignMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-6

EditMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-7

22. Example ScriptsVariable Helix Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-2Maxwell Data Export Script . . . . . . . . . . . . . . . . . . . . . . . 20-6

Contents-16

Page 21: scriptingMaxwell_onlinehelp

1 Introduction to VBScript

Maxwell uses the Microsoft® Visual Basic® Scripting Edition (VBScript) scripting language to record macros. VBScript is based on the Microsoft Visual Basic programming language. Using scripts is a fast, effective way to accomplish tasks you want to repeat.You can write a script using any text editor, or you can record a script from within the Maxwell interface. After recording the script from within Max-well, you can then modify it using a text editor. Although Maxwell records scripts in VBScript format, it can also execute scripts in JavaScriptTM format. If you are running a script from a command prompt, the script can be written in any language that provides the Microsoft COM methods. The Maxwell scripting documentation refers to VBScript format only.

This chapter provides an overview of key VBScript components. For more details about VBScript, please see the Recommended VBScript References section at the end of this chapter.Related Topics:Sample Maxwell Script

VBScript Variables

VBScript Operators

Controlling Program Execution

Looping Through Code

VBScript Procedures

Converting Between Data Types

Interacting with a Script

Introduction to VBScript 1-1

Page 22: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Recommended VBScript References

1-2 Introduction to VBScript

Page 23: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Sample Maxwell ScriptFollowing is an example of a Maxwell script. It includes comment lines, which are preceded by either an apostrophe ( ’) or the word REM, that offer explanations for each preceding line or lines. VBScript keywords appear in bold font.

Dim oAnsoftApp

Dim oDesktop

Dim oProject

Dim oDesign

Dim oEditor

Dim oModule

REM Dim is used to declare variables and means dimension. In VBScript you can use Dim,REM Public, or Private to declare variables. As VBScript has no built-in data types (likeREM integer, string, etc.), all variables are treated as variants, which can store any type ofREM information. In this example, the three variables will be used as objects. When REM recording scripts in Maxwell, variants that will be used as objects always begin with o.

Set oAnsoftApp = CreateObject("AnsoftMaxwell.MaxwellScriptInterface")

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

Set oDesktop = oAnsoftApp.GetAppDesktop()

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

oDesktop.NewProject

’ In VBScript, a Sub procedure is a procedure that is called by name, can receive arguments, ’ and can perform a specific task with a group of statements. Here the Sub procedure ’ NewProject of the object oDesktop is called. This Sub does not take an input.

Set oProject = oDesktop.GetActiveProject

oProject.InsertDesign "Maxwell", "Maxwell Model1", "", ""

’ In a Sub or Function procedure call, you can group the input parameters inside ’ parentheses or without parentheses. Here the four strings are the input parameters of ’ the Sub procedure InsertDesign of the object oProject.

Introduction to VBScript 1-3

Page 24: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Set oDesign = oProject.SetActiveDesign("Maxwell Model1")

Set oEditor = oDesign.SetActiveEditor("3D Modeler")

oEditor.CreateBox Array("NAME:BoxParameters", "XPosition:=", _

"0mm", "YPosition:=", "0mm", "ZPosition:=", "0mm", _

"XSize:=", "1.6mm", "YSize:=", "1.2mm", "ZSize:=", _

"0.8mm"), Array("NAME:Attributes", "Name:=", "Box1", "Flags:=",_

"", "Color:=", "(132 132 193)", "Transparency:=", _

0.400000005960464, "PartCoordinateSystem:=", _

"Global", "MaterialName:=", "vacuum", "SolveInside:=", true)

’ oEditor.CreateBox is a Sub procedure that takes two array variables as input. The ’ first array is for the box’s geometric parameters, and the second array is for the box’s’ attributes. You can modify the italicized entries to create a different box. In VBScript,’ Array is a function that returns a variant containing an array. The underscore’ character ( _ ) here indicates that the statement continues to the next line. The’ underscore character must be placed outside of string constants, or else VBScript ’ recognizes the character as part of the string constant rather than an indication that the’ string continues on the next line. Following is an example of proper use of the underscore’ character: ’ Msgbox(“Please include units when creating variables "& _ ’ "that require dimensions." ’ Following is an example of improper use of the underscore character:’ Msgbox("Please include units when creating variables _ ’ that require dimensions."

For additional Maxwell script examples, see Example Scripts.

1-4 Introduction to VBScript

Page 25: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

VBScript VariablesA VBScript variable is a placeholder representing information that may change while 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• Variable Naming conventions• Scope and Lifetime of Variables• Array Variables

Declaring VariablesTo 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 exam-ple:

Dim Top, Bottom, Left, Right

You can also declare a variable implicitly by simply using its name in your script. Doing so is not generally a good practice because you could misspell the variable name in one or more places, causing unexpected results when your script is run. For that reason, the Option Explicit state-ment is available to require explicit declaration of all variables. The Option Explicit statement should be the first statement in your script.

Introduction to VBScript 1-5

Page 26: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Variable Naming ConventionsYou should use names that are short but intuitive and easy to remember. Use the following con-ventions for naming variables in VBScript:• Begin with an alphabetic character. • Cannot contain an embedded period. • Must not exceed 255 characters. • Must be unique in the scope in which it is declared. • Do not use VBScript keywords.

Scope and Lifetime of VariablesVariables at the script level are available to all procedures within the script. At the procedure level, variables are available only within the procedure. It has local scope and is a procedure-level variable. The lifetime of a variable depends on how long it exists. The script-level variables exist from declaration until the end of the script. A procedure-level variable exists only as long as you are in the procedure and is destroyed when the procedure exits.

Array VariablesCreate an array variable when you want to assign more than one related value to a single vari-able. An array variable contains a series of values. For example:

Dim Primitives(2)

All arrays in VBScript are zero-based, so the array above actually contains 3 elements. You assign data to each of the array’s elements using an index into the array. Data can be assigned to the elements of an array as follows:

Primitives(0) = "Box1"

Primitives(1) = "Cone1"

Primitives(2) = "Cylinder1"

Similarly, the data can be retrieved from any element using an index into a particular array ele-ment. For example:

one_prim = Primitives(1)

You can also use the Array function to assign an array of elements to a variable. For example:

Dim Primitives

Primitives = Array ("Box1", "cone1", "Cylinder1")

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

1-6 Introduction to VBScript

Page 27: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

If you do not know the size of the array at declaration or the size changes during the time your script is running, you can use dynamic arrays. They are declared without size or number of dimensions inside the parentheses. For example:

Dim FirstArray()

ReDim SecondArray()

To use a dynamic array, you must subsequently use ReDim to determine the number of dimen-sions and the size of each dimension. You can also use the Preserve keyword to preserve the contents of the array as the resizing takes place.

ReDim FirstArray(25)

ReDim Preserve FirstArray(30)

Introduction to VBScript 1-7

Page 28: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

VBScript OperatorsVBScript provides operators, which are grouped into three categories: arithmetic operators, comparison operators, and logical operators.Please see the online VBScript User’s Guide for more details.Related Topics:Operator Precedence

Operator PrecedenceWhen 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 paren-theses, however, standard operator precedence is maintained.When expressions contain operators from more than one category, arithmetic operators are evaluated first, comparison operators are evaluated next, and logical operators are evaluated last. Comparison operators all have equal precedence, that is, they are evaluated in the left-to-right order in which they appear. Arithmetic and logical operators are evaluated in the following order of precedence:

Arithmetic OperatorsFollowing is a list of VBScript’s arithmetic operators.

Symbol Description

^ Exponentiation

- Unary negation

* Multiplication

/ Division

\ Integer division

Mod Modulus arithmetic

+ Addition

- Subtraction

& String concatenation

1-8 Introduction to VBScript

Page 29: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Comparison OperatorsFollowing is a list of VBScript’s comparison operators:

Logical OperatorsFollowing is a list of VBScript’s logical operators:

Symbol Description

= Equality

<> Inequality

< Less than

> Greater than

<= Less than or equal to

>= Greater than or equal to

Is Object equivalence

Symbol Description

Not Logical negation

And Logical conjunction

Or Logical disjunction

Xor Logical exclusion

Eqv Logical equivalence

Imp Logical implication

Introduction to VBScript 1-9

Page 30: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Controlling Program ExecutionYou can use conditional statements to control the flow of a script. There are two types of condi-tional statements in VBScript:• If...Then...Else• Select Case

Using If...Then...ElseFollowing 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 CaseFollowing 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

1-10 Introduction to VBScript

Page 31: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

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

Using a For...Next LoopThe 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 demon-strates the For...Next loop:

For variable = start To end

<statements to execute>

Next

Using a Do LoopYou can use Do...Loop statements to run a block of statements until (or while) a condition is true.

Repeating Statements While a Condition is TrueUse 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 TrueFollowing is the syntax:

Do Until condition

<statements to execute>

Loop

You can exit early from a loop by using the Exit For statement.

Introduction to VBScript 1-11

Page 32: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

VBScript ProceduresIn 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 ProceduresA 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 ProceduresA 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 TypesTo convert data from one subtype to another, use the following VBScript functions:

CStr Syntax: CStr(variablename). Converts variablename to a string. For example, it can be used to convert the number 2.5 to the string "2.5".

CBool Syntax: CBool(variablename).

Converts variablename to a boolean. If variablename is 0 or "0", CBool returns False. Otherwise it returns True.

CDbl Syntax: CDbl(variablename).

Converts variablename to a double precision number. For example, it can be used to convert the string "2.5" to the number 2.5.

CInt Syntax: CInt(variablename).

Converts variablename to an integer.

1-12 Introduction to VBScript

Page 33: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Interacting with a ScriptVBScript provides two functions that enable you to interact with a script while it is running:the InputBox function and the MsgBox function.The InputBox function displays a dialog box with an input field. The value that is typed into the input field is returned. For example:

Dim users_string

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

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

The last two arguments to the function are optional.The MsgBox function shows a message and returns a number based on the button the user presses. For example:

MsgBox ("message text")

Recommended VBScript ReferencesMicrosoft Corporation. VBScript User’s Guide.

Available http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vbstutor.asp.Childs, M., Lomax, P., and Petrusha, R. VBScript in a Nutshell: A Desktop Quick Reference. May 2002. O’Reilly & Associates. ISBN: 1-56592-720-6.

Introduction to VBScript 1-13

Page 34: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

1-14 Introduction to VBScript

Page 35: scriptingMaxwell_onlinehelp

2 Maxwell and VBScript

This chapter provides an overview of Maxwell scripting using VBScript. Infor-mation is included on the following topics:

Maxwell script variables.

Recording, running, pausing, resuming, and stopping a script from run-ning or recording.

Modifying a script for easier playback.

Maxwell scripting conventions, including script command syntax used in this guide, named arguments, and setting numerical values.

Executing a script from within a script.

Modifying properties.

Maxwell and VBScript 2-1

Page 36: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Overview of Maxwell Script VariablesWhen you record a script, the beginning of the script looks like the following:

Dim oAnsoftApp

Dim oDesktop

Dim oProject

Dim oDesign

Dim oEditor

Dim oModule

Set oAnsoftApp = CreateObject("AnsoftMaxwell.MaxwellScriptInterface")

Set oDesktop = oAnsoftApp.GetAppDesktop()

Set oProject = oDesktop.SetActiveProject("")

Set oDesign = oProject.SetActiveDesign("")

Set oModule = oDesign.GetModule("Solutions")

The lines above define the variables used by Maxwell in the script and assign values to the vari-ables. The variables are used in the following hierarchy:

Class hierarchy of variables.

oAnsoftApp

oDesktop

oProject

oModule

oDesign

oEditor

2-2 Maxwell and VBScript

Page 37: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

oAnsoftAppThe oAnsoftApp object provides a handle for VBScript to access Maxwell.

oDesktopThe oDesktop object is used to perform desktop-level operations, including project manage-ment.

See Chapter 4, Desktop Object Script Commands, for details about script commands recognized by the oDesktop object.

oProjectThe oProject object corresponds to one project open in the product. It is used to manipulate the project and its data. Its data includes variables, material definitions and one or more designs.

See the following chapters for details about the script commands recognized by the oProject object:

• Chapter 5, Project Object Script Commands

• Chapter 6, Material Script Commands

• Chapter 7, Property Script Commands

• Chapter 8, Dataset Script Commands

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

See the following chapters for details about the script commands recognized by the oDesign object:

• Chapter 9, Design Object Script Commands

• Chapter 10, Output Variable Script Commands

• Chapter 12, Reporter Editor Script Commands

Maxwell and VBScript 2-3

Page 38: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

oEditorThe oEditor object corresponds to an editor, such as the 3D Modeler. This object is used to add and modify data in the editor.

The Maxwell product scripting supports the following editors:

See Chapter 11, 3D Modeler Editor Script Commands, for details about the script commands rec-ognized by the oEditor object and Chapter 12, Reporter Editor Script Commands for details about Reporter editor commands.

oModuleThe oModule object corresponds to a module in the design. Modules are used to handle a set of related functionality.

The Maxwell product scripting supports the following modules:

Editor Name in Script

3D Modeler Editor "3D Modeler"

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

Module Name in Script Chapter

Boundary ModuleCorresponds to the Boundary and Excitation commands.

"BoundarySetup" Chapter 13, Boundary and Excitation Module Script Commands

Mesh Operations Module

Corresponds to the Mesh Operations folder in the project tree.

"MeshSetup" Chapter 14, Mesh Operations Module Script Commands

Analysis ModuleCorresponds to the Analysis folder in the project tree.

"AnalysisSetup" Chapter 15, Analysis Module Script Commands

Optimetrics ModuleCorresponds to the Optimetrics folder in the project tree.

"Optimetrics" Chapter 16, Optimetrics Script Commands

2-4 Maxwell and VBScript

Page 39: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Recording a ScriptScript commands can be found on the Tools menu in the Maxwell interface.

Once you start to record a script, your subsequent actions are added to the script. Each inter-face command has one or more associated script commands that are recorded to the script. The script is recorded to a text file in .vbs (VBScript) file format.

To record a script:

1 Click Tools>Record Script.The Save As dialog box appears.

2 Use the file browser to locate the folder in which you want to save the script, such as C:\Ansoft\Maxwell12\Scripts, and then double-click the folder’s name.

3 Type the name of the script in the File name text box, and then click Save.The script is saved in the folder you selected by the file name filename.vbs.

4 Perform the steps that you want to record. 5 When you have finished recording the script, click Stop Script Recording on the Tools menu.

Stopping Script RecordingScript commands can be found on the Tools menu in the Maxwell interface.

To stop recording a script:

• On the Tools menu, click Stop Script Recording.Maxwell stops recording to the script.

Solutions Module Corresponds to the operations in the Solution Data dialog box, which is accessed by clicking Maxwell>Results>Solution Data.

"Solutions" Chapter 17, Solutions Module Script Commands

Field Overlays Module Corresponds to the Field Overlays folder in the project tree.

"FieldsReporter" Chapter 18, Field Overlays Module Script Commands

Model ModuleCorresponds to the Model folder in the project tree.

"ModelSetup" Chapter 19, Motion Setup Script Commands

Parameter ModuleCorresponds to the Parameters folder in the project tree.

"MaxwellParameterSetup"

Chapter 20, Parameter Setup Script Commands

Maxwell and VBScript 2-5

Page 40: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Running a ScriptScript commands can be found on the Tools menu in the Maxwell interface.

To run a script:

1 Click Tools>Run Script.The Open dialog box appears.

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

3 Type the name of the script in the File name text box, or click its name, and then click Open.Maxwell executes the script.

To supply script arguments when running from Tools>Run Script, use the edit field at the bot-tom of the file selection dialog. You can access the script arguments using the Ansoft-ScriptHost.arguments collection from vbscript. This is a standard COM collection.

To run a script from a command line (as described in the Online Help):

1 Type one of the following command line options at the command line:

-runscriptandexit or -runscript

2 Press Enter.

You can also pass the -scriptargs parameter to the script and specify arguments.

Note If you run the script from DOS prompt as a .vbs file (that is, you do not launch Maxwell or ePhysics, but simply 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, write the following:

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

2-6 Maxwell and VBScript

Page 41: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Pausing and Resuming a ScriptScript commands can be found on the Tools menu in the Maxwell interface.

To pause a script during its execution:

• Click Tools>Pause Script.

To resume a script after pausing it:

• Click Tools>Resume Script.

Stopping a ScriptScript commands can be found on the Tools menu in the Maxwell interface.

To stop a script.

• Click Tools>Stop Script.Maxwell stops executing the script that has been paused.

Maxwell Scripting ConventionsThis scripting guide uses the following conventions:

• Syntax conventions• Script command conventions• Named arguments• Setting numerical values

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

<string> A quoted string.

<bool> A boolean value. Should be set to either true or false (no quotes). Example: "SolveInside:=", true

Maxwell and VBScript 2-7

Page 42: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Script Command ConventionsThe majority of this guide lists individual script commands. The following conventions are used to describe them:

Script Command NameUse: Describes the function of the script command.Command: Lists the interface command that corresponds to the script command. Menu

commands are separated by carats.Syntax: Demonstrates the correct syntax for the command. Carat

brackets < > enclose information or arguments that you must enter.

Return Value: Describes the return value, if any.Parameters: Describes the arguments or information in the syntax

description, if an explanation is needed.

Example: Provides a working example of the script command, if needed.

Passing Arguments to ScriptsThere are two ways to pass arguments to scripts:

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

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.The user can access the script arguments using the AnsoftScriptHost.arguments col-lection from vbscript. This is a standard COM collection.

<double> A double precision value.Example: 1.2

<int> An integer. Example: 1

<value> Can be a number, a VBScript variable, or a quoted string containing a valid Maxwell expression. Examples:

-"XSize:=", 1

-"XSize:=", "3mm"

-"XSize:=", VBScript_Var

-"XSize:=", "Maxwell_Var + 10mm"

2-8 Maxwell and VBScript

Page 43: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

There is an issue if the user runs the script from a DOS prompt as a .vbs file (that is, you don’t open Maxwell, but launch the vbs script 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, you can write this:

on error resume next

dim args

Set args = AnsoftScript.arguments

if(IsEmpty(args)) then

Set args = WSH.arguments

End if

on error goto 0

'At this point, args has the arguments no matter if you are running

'under windows script host or Ansoft script host

msgbox "Count is " & args.Count

for i = 0 to args.Count - 1

msgbox args(i)

next

Named ArgumentsMany Maxwell script commands use named arguments. The names can appear in three ways:

1. Named data, name precedes data. For example: ...,"SolveInside:=", true, ...

2. Named Array, name precedes array. For example: ...,"Attributes:=", Array(...),..

3. Named Array, name inside array. For example: ..., Array("NAME:Attributes",..),..

In the first and second examples, the name is formatted as “<Name>:=”. This signals Maxwell 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 Maxwell which data is being given. The names must be included or the script will not play back correctly. How-ever, if you are writing a script, you do not need to pass in every piece of data that the com-mand can take. For example, if you are modifying a boundary, the script will be recorded to include every piece of data needed for the boundary, whether or not it was modified. If you are writing a script by hand, you can just add the data that changed and omit anything that you do not want to change. Maxwell will use the names to determine which data you provided.

Maxwell and VBScript 2-9

Page 44: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

For example, when editing an impedance boundary, Maxwell 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")

Setting Numerical ValuesFor script arguments that expect a number, the following options are possible:

• Pass in the number directly. For example:

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

3.5)

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

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

"3.5V" )

• Pass in an Maxwell defined variable name. For example:

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

"$var1" )

• Pass in a VBScript variable. For example:

vb_var = "3.5V"

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

vb_var)

2-10 Maxwell and VBScript

Page 45: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Executing a Script from Within a ScriptMaxwell provides a script command that enables you to launch another script from within the script that is being executed:

oDesktop.RunScript <ScriptName>

If the full path to the script is not specified, Maxwell searches for the specified script in the fol-lowing locations, in this order:

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

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

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

• Maxwell installation directory.

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

Maxwell and VBScript 2-11

Page 46: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

2-12 Maxwell and VBScript

Page 47: scriptingMaxwell_onlinehelp

3 Ansoft Application Object Script Commands

The Application object commands permit you to set parameters for RAM and processor use. Application object commands should be executed by the oAnsoftApp object.

oAnsoftApp.<CommandName> <args>

Ansoft Application Object Script Commands 3-1

Page 48: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

General Application Script CommandsFollowing are general script commands recognized by the oAnsoftApp object:• GetAppDesktop• SetDesiredRamMBLimit• SetMaximumRamMBLimit• SetNumberOfProcessors• GetDesiredRamMBLimit• GetMaximumRamMBLimit• GetNumberOfProcessors

GetAppDesktopUse: 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.

Syntax: GetAppDesktop()

Return Value: Object.Parameters: None

Example: Set oDesktop = oAnsoftApp.GetAppDesktop()

SetDesiredRamMBLimitUse: Sets the Desired RAM Limit (MB) value.Syntax: SetDesiredRamMBLimit <DesiredRAMLimit>, <ProductName>

Return Value: NoneParameters: <DesiredRAMLimit>

Type: <int>

<ProductName>

Type: <String> Values may be: Maxwell 3D, Maxwell 2D. If no ProductName is supplied, the setting is applied to both 2D and 3D.

Example: oAnsoftApp.SetDesiredRamMBLimit 2000, "Maxwell 3D"

SetMaximumRamMBLimitUse: Sets the Maximum RAM Limit (MB) value.Syntax: SetMaximumRamMBLimit <MaximumRAMLimit>, <ProductName>

Note This function is not supported for RMxprt.

3-2 Ansoft Application Object Script Commands

Page 49: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Return Value: NoneParameters: <MaximumRAMLimit>

Type: <int><ProductName>

Type: <String> Values may be: Maxwell 3D, Maxwell 2D. If no ProductName is supplied, the setting is applied to both 2D and 3D.

Example: oAnsoftApp.SetMaximumRamMBLimit 2000, "Maxwell 2D"

SetNumberOfProcessorsUse: Sets the Number of Processors value.Syntax: SetNumberOfProcessors <NumProcessors>, <ProductName>

Return Value: NoneParameters: <NumProcessors>

Type: <int><ProductName>

Type: <String> Values may be: Maxwell 3D, Maxwell 2D. If no ProductName is supplied, the setting is applied to both 2D and 3D.

Example: oAnsoftApp.SetNumberOfProcessors 2, "Maxwell 3D"

GetDesiredRamMBLimitUse: Gets the Desired RAM Limit (MB) value.Syntax: GetDesiredRamMBLimit(<ProductName>)

Return Value: Returns the Desired RAM Limit in megabytes (MB).Type: <int>

Parameters: <ProductName>

Type: <String> Values may be: Maxwell 3D, Maxwell 2D.

Note This function is not supported for RMxprt.

Note This function is not supported for RMxprt.

Note This function is not supported for RMxprt.

Ansoft Application Object Script Commands 3-3

Page 50: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Example: desired_ram = oAnsoftApp.GetDesiredRamMBLimit("Maxwell 2D")

GetMaximumRamMBLimitUse: Gets the Maximum RAM Limit (MB) value.Syntax: GetMaximumRamMBLimit(<ProductName>)

Return Value: Returns the Maximum RAM Limit in megabytes (MB).Type: <int>

Parameters: <ProductName>

Type: <String> Values may be: Maxwell 3D, Maxwell 2D.

Example: max_ram = oAnsoftApp.GetMaximumRamMBLimit("Maxwell 3D")

GetNumberOfProcessorsUse: Gets the Number of Processors value.Syntax: GetNumberOfProcessors(<ProductName>)

Return Value: Returns the Number of Processors.Type: <int>

Parameters: <ProductName>

Type: <String> Values may be: Maxwell 3D, Maxwell 2D.

Example: numprocessors = oAnsoftApp.GetNumberOfProcessors("Maxwell 2D")

Note This function is not supported for RMxprt.

Note This function is not supported for RMxprt.

3-4 Ansoft Application Object Script Commands

Page 51: scriptingMaxwell_onlinehelp

4 Desktop Object Script Commands

Desktop commands should be executed by the oDesktop object. Some com-mands permit you to query objects when you do not know the names.

Set oAnsoftApp =

CreateObject ("AnsoftMaxwell.MaxwellScriptInterface")

Set oDesktop = oAnsoftApp.GetAppDesktop()

oDesktop.CommandName <args>

Desktop Object Script Commands 4-1

Page 52: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

General Desktop Script CommandsFollowing are general script commands recognized by the oDesktop object:• CloseAllWindows• CloseProject• CloseProjectNoForce• EnableAutoSave• GetActiveProject• GetLibraryDirectory• GetProjectDirectory• GetProjectList• GetTempDirectory• GetVersion• NewProject• OpenMultipleProjects• OpenProject• PauseScript• Print• QuitApplication• RestoreWindow• RunProgram• RunScript• SetActiveProject• SetActiveProjectByPath• SetLibraryDirectory• SetProjectDirectory• SetTempDirectory• Sleep

CloseAllWindowsUse: Closes all MDI child windows on the desktop. Command: From the main menu, click Window>Close All.Syntax: CloseAllWindows()

Return Value: None

Parameters: NoneExample: Desktop.CloseAllWindows()

4-2 Desktop Object Script Commands

Page 53: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

CloseProjectUse: Closes a specified project. Changes to the project are not saved. Save the

project using the Project command Save or SaveAs.Command: File>CloseSyntax: CloseProject <ProjectName>

Return Value: NoneParameters: <ProjectName>

Type: <string>

Example: oDesktop.CloseProject "Project1"

CloseProjectNoForceUse: Closes a specified project unless there are simulations ongoing. Changes to

the project will not be saved. Save the project using the Project command Save or SaveAs before closing to save changes.

Command: File>CloseSyntax: CloseProjectNoForce <ProjectName>

Return Value: NoneParameters: <ProjectName>

Type: <string>Example: oDesktop.CloseProjectNoForce "Project1"

EnableAutoSaveUse: Enables or disables the autosave feature. Command: NoneSyntax: EnableAutoSave(bool bEnable)

Return Value: None

Parameters: NoneExample: oDesktop.EnableAutoSave(true), enables autosave

GetActiveProjectUse: Returns the project that is active in the desktop.Command: NoneSyntax: GetActiveProject

Return Value: The project that is active in the desktop.Parameters: NoneExample: Set oProject = oDesktop.GetActiveProject ()

Desktop Object Script Commands 4-3

Page 54: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

GetLibraryDirectoryUse: Gets the library directory path.Syntax: GetLibraryDirectory

Return Value: Returns a directory path.Type: <string>

Parameters: None

Example: libdir = oDesktop.GetLibraryDirectory

GetProjectDirectoryUse: Gets the project directory path.Syntax: GetProjectDirectory

Return Value: Returns a directory path.Type: <string>

Parameters: None

Example: projdir = oDesktop.GetProjectDirectory

GetProjectListUse: Returns a list of all projects that are open in the desktop.Command: None

Syntax: GetProjectList

Return Value: An array of strings, which are the names of all open projects in the desktop.Parameters: NoneExample: list_of_projects = oDesktop.GetProjectList()

GetTempDirectoryUse: Gets the temp directory path.Syntax: GetTempDirectory

Return Value: Returns a directory path.Type: <string>

Parameters: None

Example: tempdir = oDesktop.GetTempDirectory

GetVersionUse: Returns a string representing the version.

4-4 Desktop Object Script Commands

Page 55: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Command: NoneSyntax: GetVersion()

Return Value: string

Parameters: NoneExample: msgbox(oDesktop.GetVersion()), displays "12.0"

NewProjectUse: Creates a new project. The new project becomes the active project.Command: File>NewSyntax: NewProject

Return Value: The project that is added.Parameters: NoneExample: Set oProject = oDesktop.NewProject

OpenMultipleProjectsUse: Opens all files of a specified type in a specified directory. Command: File>Multiple OpenSyntax: OpenMultipleProjects <Directory> <FileType>

Return Value: NoneParameters: <Directory>

Type: <string>

<FileType>

Type: <string>

Example: oDesktop.OpenMultipleProjects "D:/Projects", "*.mxwl"

OpenProjectUse: Opens a specified project.Command: File>OpenSyntax: OpenProject <FileName>

Return Value: The opened project.Parameters: <FileName>: Full path and name of the project to open.

Type: <string>

Example: oDesktop.OpenProject "D:/Projects/Project1.mxwl"

Desktop Object Script Commands 4-5

Page 56: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

PauseScriptUse: Pauses the script’s execution and displays a message in a pop-up dialog box

to the user. The script execution does not resume until the user clicks Tools>Resume Script.

Command: Tools>Pause ScriptSyntax: PauseScript <Message>

Return Value: NoneParameters: <Message>

Type: <string>

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

PrintUse: Prints the contents of the active view window. Command: File>PrintSyntax: Print

Return Value: NoneParameters: NoneExample: oDesktop.Print

QuitApplicationUse: Exits the desktop. Command: File>ExitSyntax: QuitApplication

Return Value: NoneParameters: NoneExample: oDesktop.QuitApplication

RestoreWindowUse: Restores a minimized Maxwell window.Command: NoneSyntax: RestoreWindow

Return Value: NoneParameters: NoneExample: oDesktop.RestoreWindow

4-6 Desktop Object Script Commands

Page 57: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

RunProgramUse: Runs an external program.Command: NoneSyntax: RunProgram <ProgName>, <ProgPath>, <WorkPath>, <ArgArray>

Return Value: NoneParameters: <ProgName>

Type: <string>

Name of the program to run.

<ProgPath>

Type: <string>

Location of the program. To use the system path, pass in an empty string.

<WorkPath>

Type: <string>

Working directory in which program will start.

<ArgArray>

Type: Array of strings

Arguments to pass to the program. If there are no argu-ments, pass in None.

Example: oDesktop.RunProgram "winword.exe", _

"C:\Program Files\Microsoft Office\Office10",_

"", None

RunScriptUse: Launches another script from within the script currently being executed.Command: Tools>Run ScriptSyntax: RunScript <ScriptPath>

Return Value: None Parameters: <ScriptPath>

Type: <string>Name or full path of the script to execute. If the full path to the script is not specified, Maxwell searches for the specified script in the follow-ing locations, in this order:• Personal library directory.

This is the PersonalLib subdirectory in the project directory. The project directory can be specified in the General Options dialog

Desktop Object Script Commands 4-7

Page 58: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

box (invoked by clicking Tools>Options>General Options) under the Project Options tab.

• User library directory.This is the userlib subdirectory in the library directory. It can be specified in the General Options dialog box.

• System library directory.This is the syslib subdirectory in the library directory. It can be specified in the General Options dialog box.

• Maxwell installation directory.Example: oDesktop.RunScript "C:/Project/test1.vbs"

SetActiveProjectUse: Returns a specified project as the active project in the desktop.Command: NoneSyntax: SetActiveProject <ProjectName>

Return Value: The specified project becomes active in the desktop.Parameters: <ProjectName>

Type: <string>

Example: Set oProject = oDesktop.SetActiveProject ("Project1")

SetActiveProjectByPathUse: If a user has two projects open with the same name, the result of

SetActiveProject is ambiguous (the first one listed in selected). The SetActiveProjectByPath command allows you to unambiguously specify the active project.

Syntax: SetActiveProjectByPath()

Return Value: The specified project becomes active in the desktop.Parameters: <fullPathProjectName>

Example: Set oProject = oDesktop.SetActiveProjectByPath("C:\working\rotation.mxwl")

SetLibraryDirectoryUse: Sets the library directory path. The specified directory must already exist

and contain a syslib folder.Syntax: SetLibraryDirectory <DirectoryPath>

Return Value: None

4-8 Desktop Object Script Commands

Page 59: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Parameters: <DirectoryPath>

Type: <string>Example: oDesktop.SetLibraryDirectory "c:\libraries"

SetProjectDirectoryUse: Sets the project directory path. The directory will be automatically created

if it does not already exist.Syntax: SetProjectDirectory <DirectoryPath>

Return Value: NoneParameters: <DirectoryPath>

Type: <string>Example: oDesktop.SetProjectDirectory "c:\projects"

SetTempDirectoryUse: Sets the temp directory path. The directory will be automatically created if

it does not already exist.Syntax: SetTempDirectory <DirectoryPath>

Return Value: NoneParameters: <DirectoryPath>

Type: <string>Example: oDesktop.SetTempDirectory "c:\temp"

SleepUse: Suspends execution of Maxwell for the specified number of milliseconds, up

to 60,000 milliseconds (1 minute). Command: noneSyntax: Sleep <TimeInMilliseconds>

Return Value: NoneParameters: <TimeInMilliseconds>

Type: <int>Example: oDesktop.Sleep 1000

Desktop Object Script Commands 4-9

Page 60: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Commands for Querying ObjectsThe following commands can be used to query objects:• GetProjects• GetDesigns• GetName• Count• GetDistributedAnalysisMachines.

CountUse: Gets the total number of queried projects or designs obtained by

GetProjects() and GetDesigns() commands. See the example query.Syntax: Count

Return Value: Returns an integer value.Parameters: None

Example: set projects = oDesktop.GetProjects()

numprojects = projects.Count

Example:

’ iterate through projects and designs using for each

for each prj in oDesktop.GetProjects()

msgbox prj.GetName()

for each design in prj.GetDesigns()

msgbox design.GetName()

next

next

’ iterate through using integer index

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

msgbox designs(j).GetName()

next

next

4-10 Desktop Object Script Commands

Page 61: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

’ lookup by name

GetDesignsUse: 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.

Syntax: GetDesigns()

Return Value: Returns a COM collection of designs in the given project.Parameters: None

Example: set projects = oDesktop.GetProjects()

set designs = projects(0).GetDesigns()

GetDistributedAnalysisMachines Use: Gets a list of machines used for distributed analysis. You can iterate through

the list using standard VBScript methods.Syntax: GetDistributedAnalysisMachines()Return Value: Returns a COM collection of machines used for distributed analysis. Parameters: None

Example: For each machine in oDesktop.GetDistributedAnalysisMachines()

msgbox machine

next

GetName (Desktop)Use: Gets names of queried projects or designs obtained by GetProjects() and

GetDesigns() commands. 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()

GetProjectsUse: For querying projects. Once you have the projects you can iterate through

them using standard VBScript methods. See the example query.Syntax: GetProjects()

Desktop Object Script Commands 4-11

Page 62: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Return Value: Returns a COM collection of opened projects.Parameters: None

Example: set projects = oDesktop.GetProjects()

4-12 Desktop Object Script Commands

Page 63: scriptingMaxwell_onlinehelp

5 Project Object Script Commands

Project commands should be executed by the oProject object. The follow-ing is an example of accessing the object:

Set oProject = oDesktop.GetActiveProject()

Note For design names, use the name as it appears in the project tree.

Project Object Script Commands 5-1

Page 64: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

General Project Object Script CommandsFollowing are general script commands recognized by the oProject object:• GetName• GetPath• GetActiveDesign• SetActiveDesign• GetTopDesignList• GetDesign• Close• Save• SaveAs• InsertDesign• CopyDesign• Paste• CutDesign• DeleteDesign• Undo• Redo• AnalyzeAll

GetName (Project)Use: Returns the project name.Command: NoneSyntax: GetName

Return Value: The active project’s name.Parameters: NoneExample: name = oProject.GetName ()

GetPathUse: Returns the location of the project on disk.Command: NoneSyntax: GetPath

Return Value: The path to the project, which does not include the project name.Parameters: NoneExample: path = oProject.GetPath ()

5-2 Project Object Script Commands

Page 65: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

GetActiveDesignUse: Returns the design in the active project.Command: NoneSyntax: GetActiveDesign

Return Value: The active design.Parameters: NoneExample: Set oDesign = oProject.GetActiveDesign ()

SetActiveDesignUse: Sets a new design to be the active design.Command: NoneSyntax: SetActiveDesign <DesignName>

Return Value: The named design becomes active.Parameters: <DesignName>

Type: <string>

Name of the design to set as the active design.Example: Set oDesign = oProject.SetActiveDesign ("MaxwellDesign2")

GetTopDesignListUse: Returns a list of the names of the top-level designs.Command: NoneSyntax: GetTopDesignList

Return Value: An array of strings that are the names of the top-level designs.Parameters: NoneExample: name_list = oProject.GetTopDesignList ()

GetDesignUse: Returns the specified design.Command: NoneSyntax: GetDesign <DesignName>

Return Value: The specified design.Parameters: <DesignName>

Type: <string>

Name of the design to return.

Example: Set oDesign = oProject.GetDesign ("Maxwell3DDesign1")

Project Object Script Commands 5-3

Page 66: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

CloseUse: Closes the active project. Unsaved changes will be lost. Command: NoneSyntax: Close

Return Value: NoneParameters: None

Example: oProject.Close

SaveUse: Saves the active project.Command: File>SaveSyntax: Save

Return Value: NoneParameters: None

Example: oProject.Save

SaveAsUse: Saves the project under a new name.Command: File>Save AsSyntax: SaveAs <FileName> <OverWrite>

Return Value: NoneParameters: <FileName>

Type: <string>

New name for the file.

<OverWrite>

Type: <bool>

Set to true if an existing project by that name should be overwritten.

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

InsertDesignUse: Inserts a new design in the project. In Maxwell scripts, the last argument

will always be empty.Command: Project>Insert Maxwell Design

5-4 Project Object Script Commands

Page 67: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

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

Return Value: NoneParameters: <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.

Example: oProject.InsertDesign "Maxwell 2D","Maxwell2DDesign2",_

"Magnetostatic", ""

CopyDesignUse: Copies a design.Command: Edit>Copy

DesignType Available SolutionType

Maxwell 3D "Magnetostatic", "EddyCurrent", "Transient", "Electrostatic", "DCConduction",

"ElectroDCConduction", "ElectricTransient"

Maxwell 2D "Magnetostatic", "EddyCurrent", "Transient", "Electrostatic", "ACConduction", "DCConduction"

RMxprt "Three-Phase Induction Motor", "Single-Phase Induction Motor",

"Three-Phase Synchronous Machine", "Brushless Permanent-Magnet DC Motor",

"Adjust-Speed Synchronous Machine", "Permanent-Magnet DC Motor", "Switched Reluctance Motor",

"Line-Start Permanent-Magnet Synchronous Motor", "Universal Motor",

"DC Machine", "Claw-Pole Alternator",

"Three-Phase Non-Salient Synchronous Machine"

Project Object Script Commands 5-5

Page 68: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Syntax: CopyDesign <DesignName>

Return Value: NoneExample: oProject.CopyDesign "MaxwellModel1"

Paste (Project)Use: Pastes a design in the active project.Command: Edit>PasteSyntax: Paste

Return Value: NoneParameters: NoneExample: oProject.Paste

CutDesignUse: Cuts a design from the active project. The design is stored in memory and

can be pasted in any Maxwell project.Command: Edit>CutSyntax: CutDesign <DesignName>

Return Value: NoneExample: oProject.CutDesign "MaxwellDesign1"

DeleteDesignUse: Deletes a specified design from the project.

Command: Edit>DeleteSyntax: DeleteDesign <DesignName>

Return Value: NoneExample: oProject.DeleteDesign "MaxwellDesign2"

Undo (Project)Use: Cancels the last project-level command.Command: Edit>UndoSyntax: Undo

Return Value: NoneParameters: None

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.

5-6 Project Object Script Commands

Page 69: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Example: oProject.Undo

Redo (Project)Use: Reapplies the last project-level command.Command: Edit>RedoSyntax: Redo

Return Value: NoneParameters: None

Example: oProject.Redo

AnalyzeAll (Project menu)Use: Runs the project-level script command from the script, which simulates all

Maxwell solution setups and Optimetrics setups for all design instances in the project.

Command: Project>Analyze AllSyntax: AnalyzeAll

Return Value: NoneParameters: NoneExample: oProject.AnalyzeAll

Project Object Script Commands 5-7

Page 70: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

5-8 Project Object Script Commands

Page 71: scriptingMaxwell_onlinehelp

6 Material Script Commands

Material commands should be executed by the oProject object.

Set oProject = oDesktop.SetActiveProject("Project1")

oProject.CommandName <args>

Material Script Commands 6-1

Page 72: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Material Level Script CommandsFollowing are general script commands recognized by the oProject object:• AddMaterial• DoesMaterialExist• EditMaterial• ExportMaterial• RemoveMaterial

AddMaterialUse: Adds a local material.Command: Add Material command in the material editor.Syntax: AddMaterial Array("NAME:<MaterialName>",

<MatProperty>, <MatProperty>, ...)

Return Value: NoneParameters: <MatProperty> (simple material)

"<PropertyName>:=", <value>

<MatProperty> (anisotropic material)

Array("NAME:<PropertyName>”,

"property_type:=", "AnisoProperty",

"unit:=", <string>", "component1:=", <value>,

"component2:=", <value>, "component3:=", <value>)

<PropertyName>

Type: <string>

Should be one of the following: "permittivity", "permeability", "conductivity"

"dielectric_loss_tangent",

"magnetic_loss_tangent", "magnetic_coercivity", "core_loss_type", "mass_density", "stacking_type"

property_type

Type: <string>

Should be one of the following: "AnisoProperty", "NonlinearProperty"unit

Type: <string>

Possible values: delta_H: "Oe" saturation_mag: "Gauss", "uGauss", "Tesla", "uTesla"

6-2 Material Script Commands

Page 73: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

other properties: "" (empty string)<MatProperty> (vector material)

Array("NAME:<PropertyName>",

"property_type:=", "VectorProperty", " Magnitude:=", <value>", “DirComp1:=", <value>, "DirComp2:=", <value>, "DirComp3:=", <value>))

<MatProperty> (choice material)

Array("NAME:<PropertyName>",

"property_type:=", "ChoiceProperty", "Choice:=", <string>")

Example: oProject.AddMaterial Array("NAME:Material2",_

"dielectric_loss_tangent:=", "44",_

Array("NAME:saturation_mag",_

"property_type:=", "AnisoProperty",_

"unit:=", "Gauss",_ "component1:=", "11", _

"component2:=", "22", _ "component3:=", "33"), _

"delta_H:=", "44Oe")

Example: oDefinitionManager.AddMaterial Array("NAME:Material5",_

"CoordinateSystemType:=", _"Cartesian",_

Array("NAME:AttachedData"),_

Array("NAME:magnetic_coercivity", "property_type:=", _

"VectorProperty", "Magnitude:=", "-1A_per_meter",_

"DirComp1:=", "1", "DirComp2:=", _"2", "DirComp3:=",_

"3"))

Example: oDefinitionManager.AddMaterial Array("NAME:Material4",_

"CoordinateSystemType:=", _"Cartesian",_

Array("NAME:AttachedData"),_

Array("NAME:stacking_type", "property_type:=", _

"ChoiceProperty", "Choice:=", "Lamination"),_

"stacking_factor:=", "0",_

Array("NAME:stacking_direction", "property_type:=",_

"ChoiceProperty", "Choice:=", ""))

DoesMaterialExistUse: Checks for the presence of a material in the library by nameCommand: None

Material Script Commands 6-3

Page 74: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Syntax: DoesMaterialExist(<MaterialName>)

Return Value: BooleanParameters: <MaterialName>

Type: <string>Name of the material to search for in the material database

Example:

Set oProject = oDesktop.SetActiveProject("cir_th")

Set oDesign = oProject.SetActiveDesign("Design1")

Set oDefinitionManager = oProject.GetDefinitionMan-ager()

if(oProject.DoesMaterialExist("modified_epoxy")) then

MsgBox("It Exists")

else

MsgBox("It Doesn't Exist...Creating")

oProject.AddMaterial Array("NAME:Material2",_

"dielectric_loss_tangent:=", "44",_

Array("NAME:saturation_mag",_

"property_type:=", "AnisoProperty",_

"unit:=", "Gauss",_ "component1:=", "11", _

"component2:=", "22", _ "component3:=", "33"), _

"delta_H:=", "44Oe")

end if

EditMaterialUse: Modifies an existing material.Command: View/Edit Materials command in the material editor.Syntax: EditMaterial <OriginalName>, Array("NAME:<NewName>",

<MatProperty>, <MatProperty>, ...)

Return Value: NoneParameters: <OriginalName>

Type: <string>

Name of the material before editing.

<NewName>

Type: <string>

New name for the material.

6-4 Material Script Commands

Page 75: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

ExportMaterialUse: Exports a local material to a library.Command: Export to Library command in the material editor.Syntax: ExportMaterial <ExportData>, <Library location>

Return Value: NoneParameters: <ExportData>

Array("NAME:<LibraryName>",

<MaterialName>, <MaterialName>, ...)

Example: oProject.ExportMaterial Array("NAME:mo0907b",_

"Material1", "Material2", "Material3"), "UserLib"

RemoveMaterialUse: Removes a material from a library.Command: Remove Material(s) command in the material editor.Syntax: RemoveMaterial <MaterialName>, <IsProjectMaterial>,

<LibraryName>, <LibraryLocation>

Return Value: NoneParameters: <MaterialName>

Type: <string>

Name of the material to be removed.

<IsProjectMaterial>

Type: <bool>

If true, Maxwell assumes the material is a project material, and the last two parameters are ignored.

<LibraryName>

Type: <string>

The name of the user or personal library where the material resides.

<LibraryLocation>

Type: <string>

Should be “UserLib” or “PersonalLib”.

Example: oProject.RemoveMaterial "Material1", false, "mo0907",_

"UserLib"

oProject.RemoveMaterial "Material1", true, "Local",_

"Project"

Material Script Commands 6-5

Page 76: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

6-6 Material Script Commands

Page 77: scriptingMaxwell_onlinehelp

7 Property Script Commands

Property commands should be executed by the oProject object.

Set oProject = oDesktop.SetActiveProject("Project1")

oProject.CommandName <args>

Property Script Commands 7-1

Page 78: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Conventions Used in the Property Script Chapter• <Property>

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

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

• <PropTab>

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

• <PropName>

Name of a single property.<PropServer> and <PropTab> NamesProjectProject Variables:

<PropServer>

"ProjectVariables"

<PropTab>

"ProjectVariableTab"

Maxwell DesignLocal Variables:

<PropServer>

"LocalVariables"

<PropTab>

"LocalVariableTab"

Maxwell Modules<PropServer>

Format is: <ModuleName>:<ItemName>, where <ItemName> is the solution setup name, etc., depending on which mod-ule is being edited.

Example: <PropServer> for the boundary “PerfE1” is “BoundarySetup:PerfE1”

<PropTab>

7-2 Property Script Commands

Page 79: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

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"

3D Model EditorObject in the module:<PropServer>

Name of the object. For example: "Box1".

<PropTab>

"Geometry3DAttributeTab"

Operation on an object:<PropServer>

Format is <ObjName>:<OpperationName>:<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 Com-pany”:

Set oModule = oDesign.GetModule("ReportSetup")

oModule.ChangeProperty Array("NAME:AllTabs",_ Array("NAME:Header",_ Array("NAME:PropServers",_

"XY Plot1:Header"), Array("NAME:ChangedProps",_ Array("NAME:Company Name", "Value:=", "My Company"))))

Property Script Commands 7-3

Page 80: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

General Property Scripting CommandsFollowing are general commands that can be used to manipulate properties from a script.• ChangeProperty

ChangePropertyUse: Changes to properties are scripted using the ChangeProperty command.

This command can be executed by the oEditor to change editor properties, by the oDesign to change design level properties, and by the oProject to change project level properties. The command can be used to create, edit, and/or remove properties. In Maxwell, only Variable and Separator properties can be deleted.

Command: NoneSyntax: ChangeProperty Array("Name:AllTabs", <PropTabArray>,

<PropTabArray>, ...)

Return Value: NoneParameters: <PropTabArray>

Array("Name:<PropTab>",

<PropServersArray>,

<NewPropsArray>,

<ChangedPropsArray>,

<DeletedPropsArray>)

<PropServersArray>

Array("Name:PropServers", <PropServer>,

<PropServer>, ...)

<NewPropsArray>

Array("Name:NewProps", <PropDataArray>,

<PropDataArray>,...)

<ChangedPropsArray>

Array("Name:ChangedProps",<PropDataArray>,

<PropDataArray>, ...)

<DeletedPropsArray>

Array("Name:DeletedProps", <PropName>,

<PropName>, ...)

<PropDataArray>

Array("NAME:<PropName>",

"PropType:=", <PropType>, "NewName:=", <string>,

7-4 Property Script Commands

Page 81: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"Description:=", <string>,

"NewRowPosition:=", <int>,

"ReadOnly:=", <bool>,

"Hidden:=", <bool>, <PropTypeSpecificArgs>)

<PropType>

Type: stringIdentifies the type of property when a new property is added. In Maxwell, only separator properties and vari-able properties can be added.

"SeparatorProp"

“VariableProp"

"TextProp"

"NumberProp"

"ValueProp"

"CheckboxProp"

"MenuProp"

"PointProp"

"VPointProp"

"V3DPointProp"

"ButtonProp"

NewName

Specify the new name of a property if the property’s name is being edited. In Maxwell, the name can only be changed for separators and variables.

Description

Specify a description of the property. In Maxwell, the description can only be changed for separators and variables.

NewRowPosition

Used to reorder rows in the Property dialog box. In Max-well, this only applies to the Project>Project Variables panel and the Maxwell3D>Design Properties, Maxwell2D>Design Properties, or RMxprt>Design Properties panel. Specify the new zero-based row index of the variable or separator.

ReadOnly

Used to mark a property as "read only" so it can not be modified. In Maxwell, this flag can only be set for variables and separators.

Property Script Commands 7-5

Page 82: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Hidden

Used to hide a property so it can not be viewed outside of the Property dialog box. In Maxwell, this flag can only be set for variables and separators.

<PropTypeSpecificArgs>

SeparatorProp: no argumentsTextProp: "Value:=", <string>

NumberProp: "Value:=", <double>

ValueProp: "Value:=", <value>

CheckboxProp: "Value:=", <bool>

MenuProp: "Value:=", <string>

PointProp"X:=", <double>, "Y:=", <double>

VPointProp: "X:=", <value>, "Y:=", <value>

V3DPointProp: "X:=",<value>, "Y:=",<value>,

"Z:=",<value>

Material Button: "Material:=", <string>

Color Button: "R:=",<int>,"G:=",<int>,"B:=",<int>

Transparency Button:"Value:=", <double>

<PropTypeSpecificArgs> for VariablePropsSyntax:

"Value:=", <value>, <OptimizationFlagsArray>,

<TuningFlagsArray>, <SensitivityFlagsArray>,

<StatisticsFlagsArray>

Parameters:

<OptimizationFlagsArray>

Array("NAME:Optimization",

"Included:=", <bool>, "Min:=", <value>,

"Max:=", <value>)

<Tuning flagsArray>

Array("NAME:Tuning",

"Included:=", <bool>, "Step:=", <value>,

"Min:=", <value>, "Max:=", <value>)

<SensitivityFlagsArray>

Array("NAME:Sensitivity",

"Included:=", <bool>,

7-6 Property Script Commands

Page 83: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"Min:=", <value>,

"Max:=", <value>,

"IDisp:=", <value> )

<StatisticsFlagsArray>

Array("NAME:Statistical",

"Included:=", <bool>,

"Dist:=", <Distribution>,

"StdD:=", <value>,

"Min:=", <value>,

"Max:=", <value>,

"Tol:=", <string>)

<Distribution>

Type: string

Value should be "Gaussian" or "Uniform"

StdD

Standard deviation.

Min

Low cut-off for the distribution.

Max

High cut-off for the distribution.

Tol

Tolerance for uniform distributions. Format is "<int>%". Example: "20%".

Example:Adding a new project level variable "$width":oProject.ChangeProperty Array("NAME:AllTabs",_

Array("NAME:ProjectVariableTab",_

Array("NAME:PropServers", "ProjectVariables"),_

Array("NAME:NewProps",_

Array("NAME:$width",_

"PropType:=", "VariableProp",_

"Value:=", "3mm",_

"Description:=", "my new variable"))))

Example: Changing the Company Name, Design Name, the background color, and the Axis scaling in a Report.

Property Script Commands 7-7

Page 84: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Set oProject = oDesktop.SetActiveProject("wgcombiner")

Set oDesign = oProject.SetActiveDesign("HFSSDesign2")

Set oModule = oDesign.GetModule("ReportSetup")

oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:Header", _

Array("NAME:PropServers", "XY Plot1:Header"), _

Array("NAME:ChangedProps", Array("NAME:Company Name", _

"Value:=", "My Company"))))

oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:Header",_

Array("NAME:PropServers", "XY Plot1:Header"), _ Array("NAME:ChangedProps", Array("NAME:Design Name", _ "Value:=", "WG Combiner"))))

oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:General",_ Array("NAME:PropServers", "XY Plot1:General"), _ Array("NAME:ChangedProps", Array("NAME:Back Color", _ "R:=", 128, "G:=", 255, "B:=", 255))))

oModule.ChangeProperty Array("NAME:AllTabs", Array("NAME:Axis", _ Array("NAME:PropServers", "XY Plot1:AxisX"), _ Array("NAME:ChangedProps", Array("NAME:Axis Scaling", _ "Value:=", "Log"))))

Example:Deleting the design level variable "height":oDesign.ChangeProperty Array("NAME:AllTabs",_

Array("NAME:LocalVariableTab",_

Array("NAME:PropServers", "DefinitionParameters"),_

Array("NAME:DeletedProps", "height"))

Example:Changing a property’s value. If the following command were executed, then the value of the property “XSize” of the PropServer “Box1:CreateBox:1” on the “Geometry3DCmdTab” tab would be changed. (oEditor is the Geometry3D editor in Maxwell.)oEditor.ChangeProperty Array("NAME:AllTabs",_

Array("NAME:Geometry3DCmdTab",_

7-8 Property Script Commands

Page 85: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Array("NAME:PropServers","Box1:CreateBox:1"),_

Array("NAME:ChangedProps",_

Array("NAME:XSize", "Value:=", "1.4mil"))))

Property Script Commands 7-9

Page 86: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Callback Scripting Using PropHost ObjectCallback scripts are scripts that can be set in the Property Dialog for individual properties by clicking the button in the Callback column and choosing a script that is saved with the project. Callback scripts can contain any legal script commands including general Ansoft script function calls (e.g. GetApplication(), …). In addition, they can call functions on a special object named PropHost. The PropHost represents the PropServer (owner of properties) that contains the Prop-erty that is calling the Callback script. Therefore, the Callback script can use the PropHost's functions to query or set other properties in the same PropServer.

Definitions

<propName> = text string<value> = double<valueText> = text string<fileName> = full path file name<choices> = string containing menu choices separated by commas<initialChoice> = string containing initial choice for menu; must be one of the <choices><scriptName> = string containing name of script stored in project<bool> is 1 for true or 0 for false

<propType> <propTypeName> Property Description0 TextProp Text

1 MenuProp Menu

2 CheckboxProp Checkbox

3 VariableProp Variable

4 VPointProp VPoint

5 V3DPointProp V3DPoint

6 NumberProp Number

7 ColorProp Color

8 PointProp Point

9 ValueProp Value

10 ButtonProp Button

7-10 Property Script Commands

Page 87: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

11 SeparatorProp Separator

12 NetlistProp Netlist

13 FileNameProp FileName

<tabType> Description Objects with this tab type0 DefaultTab

1 PassedParameterTab Instances of designs, components, geometric objects

2 DefinitionParameterTab Definitions of designs, components

3 LocalVariableTab Definitions of designs, components

4 ProjectVariableTab Projects

5 ConstantsTab Projects

6 BaseElementTab Geometric objects

7 ComponentTab Designs, components

8 PropertyTab9 CircuitTab10 SystemTab11 PlanarEMTab12 HfssTab HFSS objects

13 OptimetricsTab Optimetrics data

14 AltraSimTab15 Report3DTab Report3d

16 FieldsPostProcessorTab Fieldspostprocessor

17 MeshSetupTab Manual meshing setup

18 RadFieldSetupTab Radiation field geometry setup

19 Geometry3DAttributeTab Geometry3D

20 Geometry3DCmdTab Geometry3D

21 Geometry3DPolylineTab Geometry3D

<propType> <propTypeName> Property Description

Property Script Commands 7-11

Page 88: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

22 Geometry3DCSTab Geometry3D

23 Geometry3DPlaneTab Geometry3D

24 Geometry3DPointTab Geometry3D

25 Geometry3DListTab Geometry3D

26 StandardPropTab27 PropDisplayPropTab28 CustomPropTab

<tabType> Description Objects with this tab type

7-12 Property Script Commands

Page 89: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

PropHost FunctionsFollowing are commands that can be used to manipulate properties from a script.• AddMenuProp• AddMenuProp2• AddProp• AddProp2• ExecuteScript• GetCallback• GetChangedProperty• GetDescription• GetEditor• GetFileName• GetHidden• GetPropServers• GetPropTabType• GetReadOnly• GetTabTypeName• GetText• GetValue• PropertyExists• RemoveProp• SetCallabck• SetDescription• SetHidden

• SetReadOnly• SetText• SetValue

AddMenuPropUse: Creates a new Menu property in tabType with name specified; choices are

set to the values in choices; initial selection is initialChoice.Command: NoneSyntax: AddMenuProp(<tabType>, <propName>, <choices>,

<initialChoice>)

Return Value: None.

Property Script Commands 7-13

Page 90: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Example: PropHost.AddProp(2, "ResChoices", "inline,upfront,parallel,series", "parallel"); creates a new MenuProp in the DefinitionParameters tab named ResChoices with choices inline, upfront, parallel, and series. The initial choice shown in the Menu is "parallel"

AddMenuProp2Use: Creates a new Menu property in tabTypeName with name specified; choices

are set to the values in choices; initial selection is initialChoice.Command: NoneSyntax: AddMenuProp2(<tabTypeName>, <propName>, <choices>,

<initialChoice>)

Return Value: None.Example: PropHost.AddMenuProp2("DefinitionParameterTab",

"ResChoices", "inline,upfront,parallel,series", "parallel"); creates a new MenuProp in the DefinitionParameters tab named ResChoices with choices inline, upfront, parallel, and series. The initial choice shown in the Menu is "parallel".

AddPropUse: Creates a new propType property in tabType with name and value specified.Command: NoneSyntax: AddProp(<tabType>, <propType>, <propName>, <valueText>)

Return Value: None.Example: PropHost.AddProp(2, 3, "W1", "10mm"); creates a new

VariableProp in the DefinitionParameters tab named W1 with value 10mm.

AddProp2Use: Creates a new propTypeName property in tabTypeName with name and

value specified.Command: NoneSyntax: AddProp2(<tabTypeName>, <propTypeName>, <propName>,

<valueText>)

Return Value: None.

7-14 Property Script Commands

Page 91: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Example: PropHost.AddProp2(("DefinitionParameterTab", "VariableProp", "W1", "10mm"); creates a new VariableProp in the DefinitionParameters tab named W1 with value 10mm.

ExecuteScriptUse: Finds the named script in the Definitions/Scripts folder and runs that script;

the script being run can also use the PropHost object.Command: NoneSyntax: ExecuteScript(<scriptName>)

Return Value: None.Example: PropHost.ExecuteScript("PropChangeScript"); runs the

script named PropChangeScript

GetCallbackUse: Finds named property and returns name of Callback script.Command: NoneSyntax: GetCallback(<propName>)

Return Value: StringExample: a = PropHost.GetCallback( "W1"); returns

"SynchronizeResistors"

GetChangedPropertyUse: If the script was called by a Callback associated with a property, this

function returns the name of that property.Command: NoneSyntax: GetChangedProperty()

Return Value: StringExample: pn = PropHost.GetChangedProperty(); returns "C" if the

script was a Callback associated with the property named "C" and the script was called in response to the property "C" changing value.

GetDescriptionUse: Finds named property and returns description string.Command: NoneSyntax: GetDescription(<propName>)

Return Value: String

Property Script Commands 7-15

Page 92: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Example: a = PropHost.GetDescription( "W1"); returns "this is the width of the gate"

GetEditorUse: Returns an interface to the editor requested IF the PropServer behind the

PropHost is contained within that type of editor.Command: NoneSyntax: GetEditor(<editorName>)

Return Value: StringExample: Set oLayout2 = PropHost.GetEditor("Layout"); returns the

interface to the layout containing a selected component. This interface can be used to call Layout Scripting functions.

GetFileNameUse: Finds the named buttonProp and if it is a FileName buttonProp, it returns

the file's full path name; otherwise it returns an empty string .Command: NoneSyntax: GetFileName(<propName>)

Return Value: Full path file name or empty string.Example: a = PropHost.GetFileName("SubstrateFile"); returns the

full path filename associated with the ButtonProp named SubstrateFile.

GetHiddenUse: Finds named property and returns its Hidden flag.Command: NoneSyntax: GetHidden(<propName>)

Return Value: Returns 1 if property is hidden and 0 if it is not.Example: a = PropHost.GetHidden( "W1"); returns 1

GetPropServersUse: Returns array of objects that have properties showing on tabTypeName.Command: NoneSyntax: GetPropServers(<tabTypeName>)

Return Value: Returns string.

7-16 Property Script Commands

Page 93: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Example: objects = PropHost.GetPropServers("PassedParameterTab"); returns array containing PropServers that have properties shown on PassedParameterTab; this would include only components and designs; individual properties can be accessed using standard notation, e.g. objects(0) might contain "CompInst@CAP_;1".

GetPropTabTypeUse: Finds named property and returns the id of the tab it is in.Command: NoneSyntax: GetPropTabType(<propName>)

Return Value: Returns string.Example: a = PropHost.GetPropTabType( "W1"); returns 2 for

property W1 since it is on the DefinitionParams tab

GetReadOnlyUse: Finds named property and returns its ReadOnly flag.Command: NoneSyntax: GetReadOnly(<propName>)

Return Value: Returns 1 if property is read-only and 0 if it is not.Example: a = PropHost.GetReadOnly( "W1"); returns 1

GetTabTypeNameUse: Finds named property and returns the name of the tab it is on.Command: NoneSyntax: GetTabTypeName(<propName>)

Return Value: Returns string.Example: a = PropHost.GetTabTypeName( "W1"); returns

"DefinitionParameterTab" for property W1 since it is on the DefinitionParams tab.

GetTextUse: Finds property in any tab and returns its value as a text string.Command: NoneSyntax: GetText(<propName>)

Return Value: Returns string.Example: a = PropHost.GetText("C"); a contains "13pF"

Property Script Commands 7-17

Page 94: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

GetValueUse: Finds property in any tab and returns its value as a double.Command: NoneSyntax: GetValue(<propName>)

Return Value: Returns double.Example: a = PropHost.GetValue("C") ;

PropertyExistsUse: Finds named property and returns its property type.Command: NoneSyntax: PropertyExists(<propName>)

Return Value: Returns 1 if property exists in any tab, 0 if it does not.Example: a = PropHost.PropertyExists( "W1"); returns 1 since this

property is present on DefinitionParams tab

RemovePropUse: Removes the named property from whichever tab it is found.Command: NoneSyntax: RemoveProp(<propName>)

Return Value: None.Example: PropHost.RemoveProp("W1"); removes the property named W1

from whatever tab it is in

SetCallbackUse: Finds named property and sets its Callback script.Command: NoneSyntax: SetCallback(<propName>, <scriptName>)

Return Value: None.Example: PropHost.SetCallback( "W1", "SynchronizeResistors"); sets

the Callback script for property W1 to SynchronizeResistors

Note Values are returned in SI units. Compound SI units are, in general, not supported. Temperature values are returned in Celcius

7-18 Property Script Commands

Page 95: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

SetDescriptionUse: Finds named property and sets its description text.Command: NoneSyntax: SetDescription(<propName>, <valueText>)

Return Value: None.Example: PropHost.SetDescription( "W1", "this is the width of the

gate"); sets the description for property W1 to "this is the width of the gate"

SetHiddenUse: Finds named property and sets its Hidden flag.Command: NoneSyntax: SetHidden(<propName>, <bool>)

Return Value: None.Example: PropHost.SetHidden( "W1", 1); makes property W1 invisible

in Property Window

SetReadOnlyUse: Finds named property and sets its ReadOnly flag.Command: NoneSyntax: SetReadOnly(<propName>, <bool>)

Return Value: None.Example: PropHost.SetReadOnly( "W1", 1); makes property W1 read-

only

SetTextUse: Finds property in any tab and sets its value to a text string.Command: NoneSyntax: SetText(<propName>, <valueText>)

Return Value: None.Example: PropHost.SetText("C", "22nF"); sets C to 22nF

SetValueUse: Finds property in any tab and sets its value to a double.Command: None

Property Script Commands 7-19

Page 96: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Syntax: SetValue(<propName>, <value>)

Return Value: None.Example: PropHost.SetValue("C", 2e-9); sets C to 2e-9

7-20 Property Script Commands

Page 97: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Additional Property Scripting CommandsFollowing are other commands that can be used to manipulate properties from a script.• GetPropertyValue• SetPropertyValue• GetProperties• GetVariableValue• SetVariableValue• GetVariables

GetPropertyValueUse: Gets the value of a single property. This can be executed by the oProject,

oDesign, or oEditor variables.

Command: NoneSyntax: GetPropertyValue(<PropTab>, <PropServer>, <PropName>)

Return Value: String representing the property value.Example: value_string = _

oEditor.GetPropertyValue("Geometry3DCmdTab",_

"Box1:CreateBox:1", "XSize")

SetPropertyValueUse: Sets the value of one property. This is not supported for properties of the

following types: ButtonProp, PointProp, V3DPointProp, and VPointProp. Only the ChangeProperty command can be used to modify these properties. This can be executed by the oProject, oDesign, or oEditor variables.

Command: NoneSyntax: SetPropertyValue <PropTab>, <PropServer>, <PropName>,

<PropValue>

Note To view the expected format for the tab name and property name string arguments, use the script recording feature and edit a property using the interface, and then view the resulting script entry.

Note To view the expected format for the tab name and property name string arguments, use the script recording feature and edit a property using the interface, and then view the resulting script entry or use GetPropertyValue.

Property Script Commands 7-21

Page 98: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Return Value: NoneParameters: <PropValue>

Type: String

Contains the value to set the property. The formatting is different depending on what type of property is being edited. Use GetPropertyValue for the desired property to see the expected format.

Example: oEditor.SetPropertyValue _

"Geometry3DCmdTab","Box1:CreateBox:1",_

"XSize", "3mm"

GetPropertiesUse: Gets a list of all the properties belonging to a specific PropServer and

PropTab. It can be executed by the oProject, oDesign, or oEditor variables.

Command: NoneSyntax: GetProperties( <PropTab>, <PropServer>)

Return Value: Variant array of strings – the properties belonging to the prop server.Example: Dim all_props

all_props = oDesign.GetProperties("MaxwellTab",_

"BoundarySetup:Source1")

GetVariableValueUse: Gets the value of a single variable. To get the value of project variables, use

oProject. To get the value of local variables, use oDesign.Command: NoneSyntax: GetVariableValue(<VarName>)

Return Value: A string representing the value of the variable. Parameters: <VarName>

Type: string

Name of the variable to access.

Example: project_var_value_string = oProject.GetVariableValue("var_name")

Example: local_var_value_string = oDesign.GetVariableValue("var_name")

7-22 Property Script Commands

Page 99: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

SetVariableValueUse: Sets the value of a variable. To set the value of a project variable, use

oProject. To set the value of a local variable, use oDesign.Syntax: SetVariableValue <VarName>, <VarValue>

Return Value: NoneParameters: <VarValue>

Type: <value>

New value for the variable.

Example: oProject.SetVariableValue "$Var1", "3mm"

var_value = "2Ohm"

oDesign.SetVariableValue "Var2", var_value

GetVariablesUse: 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.

Syntax: GetVariables()

Return Value: Variant array of strings – the names of the variables.Example: Dim var_array

project_var_array = oProject.GetVariables()

local_var_array = oDesign.GetVariables()

Property Script Commands 7-23

Page 100: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Additional Property Scripting ExampleFollowing is a sample script that uses the GetPropertyValue, SetPropertyValue, and GetProperties functions. The script gets all the properties of the first CreateBox command of "Box1". It then loops through the properties and for each one, shows the current value and asks if the value should be changed.

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

7-24 Property Script Commands

Page 101: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Example: Using Record Script and Edit PropertiesA simple way to see how to format the string arguments for a design object or property of inter-est is to use the script recording command in Maxwell, and then to edit the property. Open the script file and look at the o.Editor.ChangeProperty entry to view the string arguments.

Example: Dim oAnsoftApp

Dim oDesktop

Dim oProject

Dim oDesign

Dim oEditor

Dim oModule

Set oAnsoftApp = CreateObject("AnsoftHfss.HfssScriptInt-erface")

Set oDesktop = oAnsoftApp.GetAppDesktop()

oDesktop.RestoreWindow

Set oProject = oDesktop.SetActiveProject("wg_combiner")

Set oDesign = oProject.SetActiveDesign("HFSSModel1")

Set oEditor = oDesign.SetActiveEditor("3D Modeler")

oEditor.ChangeProperty Array("NAME:AllTabs", Array("NAME:Geometry3DAttributeTab", Array("NAME:PropS-ervers", _

"Polyline1"), Array("NAME:ChangedProps", Array("NAME:Display Wireframe",

"Value:=", true), Array("NAME:Display Wireframe", "Value:=", _

false), Array("NAME:Transparent", "Value:=", 0.2))))

Property Script Commands 7-25

Page 102: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

7-26 Property Script Commands

Page 103: scriptingMaxwell_onlinehelp

8 Dataset Script Commands

Dataset commands should be executed by the oProject object.

Set oProject = oDesktop.SetActiveProject("Project1")

oProject.CommandName <args>

Dataset Script Commands 8-1

Page 104: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

General Dataset Script CommandsFollowing are general script commands recognized by the oProject object:• AddDataset• EditDataset• DeleteDataset

AddDatasetUse: Adds a dataset.Command: Project>Datasets>AddSyntax: AddDataset <DatasetDataArray>

Return Value: NoneParameters: <DatasetDataArray>

Array("NAME:<DatasetName>",

Array("NAME:Coordinates", <CoordinateArray>,

<CoordinateArray>, ...)

<DatasetName>

Type: <string>Name of the dataset.

<CoordinateArray>

Array("NAME:Coordinate",

"X:=", <double>, "Y:=", <double>)

Example: oProject.AddDataset Array("NAME:ds1",_

Array("NAME:Coordinates",_

Array("NAME:Coordinate", "X:=", 1, "Y:=", 2,_

Array("NAME:Coordinate", "X:=", 3, "Y:=", 4),_

Array("NAME:Coordinate", "X:=", 5, "Y:=", 7),_

Array("NAME:Coordinate", "X:=", 6, "Y:=", 20)))

EditDatasetUse: Modifies a dataset. When a dataset is modified, its name and data can be

changed. Command: Project>Datasets>EditSyntax: EditDataset <OriginalName> <DatasetDataArray>

Return Value: None

8-2 Dataset Script Commands

Page 105: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Parameters: <OriginalName>

Type: <string>

Name of the dataset before editing.

Example: oProject.EditDataset "ds1" Array("NAME:ds2",_

Array("NAME:Coordinates",_

Array("NAME:Coordinate", "X:=", 1, "Y:=", 2),_

Array("NAME:Coordinate", "X:=", 3, "Y:=", 4)))

DeleteDatasetUse: Deletes the specified dataset.Command: Project>Datasets>RemoveSyntax: DeleteDataset <DatasetName>

Return Value: NoneParameters: <DatasetName>

Type: <string>

Name of the dataset you want to delete.

Dataset Script Commands 8-3

Page 106: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

8-4 Dataset Script Commands

Page 107: scriptingMaxwell_onlinehelp

9 Design Object Script Commands

Design object commands should be executed by the oDesign object.

Set oDesign = oProject.SetActiveDesign("Mawell3DDesign1")

oDesign.CommandName <args>

Design Object Script Commands 9-1

Page 108: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Conventions Used in the Design Object Chapter<ModuleName>

Name used to access one of the following Maxwell modules:• Boundary module: "BoundarySetup"

• Mesh Operations module: "MeshSetup"• Analysis module: "AnalysisSetup"• Optimetrics module: "Optimetrics"• Solutions module: "Solutions"• Field Overlays module: "FieldsReporter"

9-2 Design Object Script Commands

Page 109: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

General Design Object Script CommandsFollowing are general script commands recognized by the oDesign object:• GetName• GetModule• SetDesignSettings• DeleteVariation• SetSolutionType• SetActiveEditor• Solve• Undo• Redo• RenameDesignInstance• ApplyMeshOps• EditNotes• AnalyzeAll (Maxwell menu)• AnalyzeAllNominal• Analyze• AnalyzeDistributed• SetConductivityThreshold• ExportConvergence• GetVariationVariableValue• ExportMeshStats• ExportProfile• GetNominalVariation• Is2D• Is3D• GetOutputVariableValue, AddOutputVariable, EditOutputVariable, DeleteOutputVariable• ChangeProperty, GetPropertyValue, SetPropertyValue, GetProperties, GetVariableValue,

SetVariableValue, GetVariables• CreateReport, RemoveReport, GetReportNames• AddDataset, EditDataset, DeleteDataset

GetName (Design)Use: Returns the name of the design.Command: NoneSyntax: GetName

Return Value: The name of the design.Type: <string>

Design Object Script Commands 9-3

Page 110: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Parameters: None

Example: name_string = oDesign.GetName

GetModuleUse: Returns the IDispatch for the specified module.Command: NoneSyntax: GetModule <ModuleName>

Return Value: Module object.Parameters: <ModuleName>

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"

Example: Set oModule = oDesign.GetModule "BoundarySetup"

SetDesignSettingsUse: Sets design settings for the active design. Settings vary with solution type.Command: Click Maxwell3d>Design Settings, Maxwell2D>Design Setings, or right-

click a design instance in the project tree and select Design Settings.Syntax: SetDesignSettings <DesignSettingsArray>

Return Value: None.Parameters: <DesignSettingsArray>

For 3D Transient solution type:

Array(“NAME:Design Settings Data”,

"Allow Material Override:=", <bool>,

"PreservTranSolnAfterDatasetEdit:=", <bool>,

"ComputeTransientInductance:=", <bool>

"PerfectConductorThreshold:=", <real>,

"InsulatorThreshold:=", <real>,

"EnableTranTranLinkWithSimplorer:=", <bool>,

9-4 Design Object Script Commands

Page 111: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"Multiplier:=", <int>)

For 3D Magnetostatic solution type:

Array(“NAME:Design Settings Data”,

"Allow Material Override:=", <bool>,

"ComputeIncrementalMatrix:=", <bool>,

"PerfectConductorThreshold:=", <real>,

"InsulatorThreshold:=", <real>)

For 3DEddy Current solution type:

Array(“NAME:Design Settings Data”,

"Allow Material Override:=", <bool>,

"PerfectConductorThreshold:=", <real>,

"InsulatorThreshold:=", <real>)

For 3D Electrostatic solution type:

Array(“NAME:Design Settings Data”,

"Allow Material Override:=", <bool>,

"PreservTranSolnAfterDatasetEdit:=", <bool>,

"PerfectConductorThreshold:=", <real>,

"InsulatorThreshold:=", <real>,

"EnableTranTranLinkWithSimplorer:=", <bool>,

"Multiplier:=", <int>)

For 3D DC Conduction solution type:

Array(“NAME:Design Settings Data”,

"Allow Material Override:=", <bool>,

"PerfectConductorThreshold:=", <real>,

"InsulatorThreshold:=", <real>)

For 3D Electric Transient solution type:

Array(“NAME:Design Settings Data”,

"Allow Material Override:=", <bool>,

"PreservTranSolnAfterDatasetEdit:=", <bool>,

"PerfectConductorThreshold:=", <real>,

"InsulatorThreshold:=", <real>)

For 2D Transient solution type:

Array(“NAME:Design Settings Data”,

"PreserveTranSolnAfterDatasetEdit:=", <bool>,

"ComputeTransientInductance:=", <bool>,

Design Object Script Commands 9-5

Page 112: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"PerfectConductorThreshold:=", <real>,

"InsulatorThreshold:=", <real>,

"EnableTranTranLinkWithSimplorer:=", <bool>,

"BackgroundMaterialName:=", <string>

"Multiplier:=", <int>)

For 2D Magnetostatic solution type:

Array(“NAME:Design Settings Data”,

"PerfectConductorThreshold:=", <real>,

"InsulatorThreshold:=", <real>,

"ComputeIncrementalMatrix:=", <bool>,

"BackgroundMaterialName:=", <string>)

For 2D Eddy Current, Electrostatic, DC Conduction, and AC Conduction solution types:

Array(“NAME:Design Settings Data”,

"PerfectConductorThreshold:=", <real>,

"InsulatorThreshold:=", <real>,

"BackgroundMaterialName:=", <string>)

DeleteVariationUse: Delete the matrix, field, and/or mesh solution data for specific variations,

across all solutions. Command: Maxwell3D or Maxwell2D>Results>Clean Up SolutionsSyntax: DeleteVariation <VariationArray>, <FullVariations>,

<MeshAndFieldsOnly>, <FieldsOnly>

Return Value: NoneParameters: <VariationArray>

Array(<DesignVariationKey>, <DesignVariationKey>,...)

Parameters:

<DesignVariationKey>

Type: <string>

Design variation string

<FullVariations>

Type: <bool>

Whether to delete meshes, fields, matrix data, profile, and convergence data.

<MeshAndFieldsOnly>

9-6 Design Object Script Commands

Page 113: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Type: <bool>

Whether to delete only meshes and fields.

<FieldsOnly>

Type: <bool>

Whether to delete fields only.

Example: oDesign.DeleteVariation Array("width='2in'",_ "width='2.5in'"), TRUE, FALSE, FALSE

See also DeleteSolutionVariation.

SetSolutionTypeUse: Sets the solution type for the design.Command: Click Maxwell3D>Solution Type, Maxwell2D>Solution Type, or right-click

a design instance in the project tree and select Solution Type.Syntax: SetSolutionType <SolutionType>, <GeomMode>

Return Value: NoneParameters: <SolutionType>

Type: <string>

Possible values for 3D designs are: "Magnetostatic", "EddyCurrent", "Transient", "Electrostatic", "DCCon-duction", "ElectroDCConduction", "ElectricTransient"

Possible values for 2D designs are: "Magnetostatic", "EddyCurrent", "Transient", "Electrostatic", "DCCon-duction", "ACConduction"

<GeomMode>

Type: <string>

Possible values for 2D geometry mode: "XY", "about Z"

Example: oDesign.SetSolutionType "ElectroDCConduction" oDesign.SetSolutionType "Electrostatic", "XY" oDesign.SetSolutionType "EddyCurrent", "about Z"

SetActiveEditorUse: Sets the active editor.Command: NoneSyntax: SetActiveEditor(<EditorName>)

Return Value: Editor objectParameters: <EditorName>

Type: <string>

Predefined editor name.

Design Object Script Commands 9-7

Page 114: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Example: Set oEditor = oDesign.SetActiveEditor("3D Modeler")

SolveUse: Performs a blocking simulation. The next script command will not be

executed until the simulation is complete.Command: Maxwell3D or Maxwell2D>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.

Example: return_status = oDesign.Solve Array(“Setup1”, “Setup2”)

Undo (Design)Use: Cancels the last design-level command.Command: Edit>UndoSyntax: Undo

Return Value: NoneExample: oDesign.Undo

Redo (Design)Use: Reapplies the last design-level command.Command: Edit>RedoSyntax: Redo

Return Value: NoneExample: oDesign.Redo

RenameDesignInstanceUse: Renames a design instance.

9-8 Design Object Script Commands

Page 115: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Command: Right-click a design instance in the project tree, and then click Rename on the shortcut menu.

Syntax: RenameDesignInstance <OldName>, <NewName>

Return Value: NoneParameters: <OldName>

Type: <string>

Old design name.

<NewName>

Type: <string>

New design name.

Example: oDesign.RenameDesignInstance "Maxwell2DDesign1",_ "MaxwellDesign2"

ApplyMeshOpsUse: If there are any mesh seed operations that were defined and not yet

simulated in the current variation for the specified solve setups, this command applies them to modify the current mesh. If necessary, the command computes an initial mesh first. No further simulating is done.

Command: Click Maxwell3D or Maxwell2D>Analysis Setup>Apply Mesh Operations, or right-click the Analysis folder in the project tree and select Apply Mesh Operations.

Syntax: ApplyMeshOps <SetupNameArray>

Return Value: Type: <int>-1: completed with error 0: completed successfully

Parameters: <SetupNameArray >

Array(<SetupName1>, < SetupName 2>,...)

<SetupName>

Type: <string>

Name of the solution setup on which to apply the mesh.

Example: oDesign.ApplyMeshOps Array("Setup1","Setup2")

EditNotesUse: Edits design notes.Command: Click Maxwell>Edit Notes, or right-click a design instance in the project

tree and select Edit Notes.Syntax: EditNotes <DesignNotes>

Return Value: None

Design Object Script Commands 9-9

Page 116: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Parameters: <DesignNotes>

Type: <string>

Design notes.

Example: oDesign. EditNotes "Design for testing"

AnalyzeAll (Maxwell menu)Use: Analyzes the nominal problems and all the Optimetrics problems for all the

setups under the selected design.Command: Click Maxwell>Analyze All, or right-click a design instance in the project

tree and select Analyze All.Syntax: AnalyzeAll

Return Value: NoneParameters: None

Example: oDesign.AnalyzeAll

AnalyzeAllNominalUse: Analyzes the nominal problems for all the setups under the design.Command: Right-click the Analysis folder in the project tree, and select Analyze.Syntax: AnalyzeAllNominal

Return Value: NoneParameters: None

Example: oDesign.AnalyzeAllNominal

AnalyzeUse: Analyzes the nominal problem for the designated setup under the design.Command: Right-click the solve setup, and select Analyze.Syntax: Analyze <SetupName>

Return Value: NoneParameters: <SetupName>

Type: <string>

Name of the solution setup to solve.

Example: oDesign.Analyze "Setup1"

AnalyzeDistributedUse: Performs a distributed analysis.

9-10 Design Object Script Commands

Page 117: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Command: Right-click Analysis setup (or Parametrics setup), and select Distribute Analysis.

Syntax: AnalyzeDistributed <SetupName>

Return Value: <AnalysisStatus>Type: <int>-1: completed with error 0: completed successfully

Parameters: <SetupName>

Example: For frequency sweeps:

oDesign.AnalyzeDistributed "Setup1"

SetConductivityThreshold Use: Sets the thresholds for a perfect conductor and an insulator/conductor.Command: Maxwell>Set Material Thresholds or right click on design instance in

project tree and choose "Set Material Thresholds"Syntax: SetConductivityThreshold <PerfectConductorThreshold>

<Insulator/ConductorThreshold>

Return Value: NoneParameters: <PerfectConductorThreshold>

Type: <double>

Perfect conductor threshold

<Insulator/ConductorThreshold>

Type: <double>

Insulator/conductor threshold

Example: oDesign.SetConductivityThreshold 1E+030, 1.00

ExportConvergenceUse: Exports convergence data to file for the given variation.Command: NoneSyntax: ExportConvergence <SetupName>, <VariationString>,

<FilePath>

Return Value: NoneParameters: <SetupName>

Type: <string>Example: "Setup1"

<VariationString>

Design Object Script Commands 9-11

Page 118: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

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>

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

Example: oDesign.ExportConvergence "Setup1", "x_size = 2mm", "c:\convergence.conv"

GetVariationVariableValueUse: Finds the value of a variable for a specific variation string.Command: NoneSyntax: GetVariationVariableValue(<VariationString>,

<VariableName>)

Return Value: Returns a double precision value in SI units, interpreted to mean the value of the variable contained in the variation string.

Parameters: <VariationString>

Type: string<VariableName>

Type: stringExample: Example: varval =

oDesign.GetVariationVariableValue("x_size = 2mm y_size = 1mm", "y_size")

ExportMeshStatsUse: Exports the mesh statistics to a file.Command: None.Parameters: <SetupName>

Type: <string>

9-12 Design Object Script Commands

Page 119: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

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>

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

Example: oDesign.ExportMeshStats "Setup1", "offset=" & Chr(39) & "0.09in" & Chr(39) & "","C:\mydir\meshstats.ms" "tat"

ExportProfileUse: Exports a solution profile to file.Syntax: ExportProfile <SetupName>, <VariationString>, <FilePath>

Return Value: NoneParameters: <SetupName>

Type: <string>Example: "Setup1"

<VariationString>

Type: <string>Example: "radius = 3mm"The empty variation string ("") is interpreted to mean the current nomi-nal variation.

<FilePath>

Type: <string>Example: "c:\profile.prof"

overwriteIfExists <Boolean>

Type: <string>

Example: overwriteIfExists=TRUE

Design Object Script Commands 9-13

Page 120: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

If "overwriteIfExists" is TRUE, then the playback of the script overwrites an existing file. If FALSE, it does not. The default is "TRUE".

Example: oDesign.ExportProfile "Setup1", "", "c:\profile.prof"

GetNominalVariationUse: Gets the nominal variation stringCommand: NoneSyntax: GetNominalVariation()

Return Value: Returns a string representing the nominal variationParameters: None

Example: var = oDesign.GetNominalVariation()

Is2DUse: Determines if the current design is 2D.Command: NoneSyntax: Is2D

Return Value: BooleanTrue if the design is 2D.

Parameters: None

Example: oDesign.Is2D

Is3DUse: Determines if the current design is 3D.Command: NoneSyntax: Is3D

Return Value: BooleanTrue if the design is 3D.

Parameters: None

Example: oDesign.Is3D

GetOutputVariableValue, AddOutputVariable, EditOutputVariable, DeleteOutputVariable

Output Variable commands. See Output Variable Script Commands.

9-14 Design Object Script Commands

Page 121: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

ChangeProperty, GetPropertyValue, SetPropertyValue, GetProperties, GetVariableValue, SetVariableValue, GetVariables

Commands for manipulating properties. See Property Script Commands.

CreateReport, RemoveReport, GetReportNamesCommands for manipulating reports. See Reporter Editor Script Commands.

AddDataset, EditDataset, DeleteDataset Commands for manipulating datasets. See Dataset Script Commmands.

Design Object Script Commands 9-15

Page 122: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

9-16 Design Object Script Commands

Page 123: scriptingMaxwell_onlinehelp

10 Output Variable Script Commands

The Output variable commands should be executed by the "OutputVariable" module. First obtain the output variable module from oDesign and use it for outputvariable commands.

Set oModule = oDesign.GetModule("OutputVariable")

oModule.CommandName <args>

The old output variable commands are still supported but they are depre-cated and produce a warning in the message window. The old Output vari-able commands were executed by the oModule object.

Set oDesign = Project.SetActiveDesign("MaxwellModel1")

oDesign.CommandName <args>

Output Variable Script Commands 10-1

Page 124: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

General Output Variable Script CommandsFollowing are script commands recognized by the oDesign object:• CreateOutputVariable• EditOutputVariable• DeleteOutputVariable• DoesOutputVariableExist• GetOutputVariables• GetOutputVariableValue

CreateOutputVariableUse: Adds a new output variable to the output variable list. Output variables are

associated with a name and an expression. The name of an output variable is not permitted to collide with design variables, Sim values, or other output variable names. It cannot have spaces or any arithmetic or other operators. The definitions cannot be cyclic. For example, A = 2*B, B=3*A is not allowed.

Command: Maxwell3D>Results>Output Variables, Maxwell2D>Results>Output Variables, or RMxprt>Results>Output Variables.

Syntax: CreateOutputVariable <OutputVarName>, <Expression>, <SolutionName>, <ReportTypeName>, <simValueContext>

Return Value: NoneParameters: <OutputVarName>

Type: <string>Name of the output variable.

<Expression>

Type: <value>Value to assign to the variable.

<SolutionName>

Type: <string>Name of the solution as listed in the output variable UI. For example: "Setup1 : Last Adaptive"

<ReportTypeName>

Type: <string>The name of the report type as seen in the output variable UI.

<simValueContext>

Type: <variant>Context for which the output variable expression is being evaluated

10-2 Output Variable Script Commands

Page 125: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Example: Set oModule = oDesign.GetModule("OutputVariable")

oModule.CreateOutputVariable "magforce", "mag(Force1.Force_x)", _

"Setup1 : LastAdaptive", "Magnetostatic", Array()

EditOutputVariableUse: Change the name or expression of an existing output variable.Syntax: EditOutputVariable <OrigVarName>, <NewExpression>,

<NewVarName>, <SolutionName>, <ReportTypeName>, <SimValueContext>

Provide empty quotes “” as the NewVarName or NewExpression if it should not be changed.

Return Value: NoneParameters: <OrigVarName>

Type: <string>Original name of the variable.

<NewExpression>

Type: <value>New value to assign to the variable.

<NewVarName>

Type: <string>New name of the variable if any, or else pass an empty string.

<SolutionName>

Type: <string>Name of the solution as seen in the output variable UI. For example: "Setup1 : Last Adaptive"

<ReportTypeName>

Type: <string>The name of the report type as seen in the output variable UI.

<SimValueContext>

Type: <variant>Context for which the output variable expression is being evaluated.

Example: Set oModule = oDesign.GetModule("OutputVariable")

oModule.EditOutputVariable "magforce", "mag(Force1.Force_z)", _

"magforce", "Setup1 : LastAdaptive", "Magnetostatic",

Output Variable Script Commands 10-3

Page 126: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Array()

DeleteOutputVariableUse: Delete an existing output variable. The variable can only be deleted if it is

not being used by any traces. Command: Delete button on the Output Variables dialog.Syntax: DeleteOutputVariable <VarName>

Return Value: NoneParameters: <VarName>

Type: <string>Name of the output variable.

Example: Set oModule = oDesign.GetModule("OutputVariable")

oModule.DeleteOutputVariable "magforce"

DoesOutputVariableExistUse: Determines whether a specified output variable exists.Syntax: DoesOutputVariableExist <OutputVarName>

Return Value: BooleanParameters: <OutputVarName>

Type: <string>

Name of the output variable.

Example: OutputVarmagforceExists = oDesign.DoesOutputVariableExist(magforce)

GetOutputVariablesUse: Gets a list of output variables.Syntax: GetOutputVariables

Return Value: An array of output variable names.Parameters: None

Example: Set oModule = oDesign.GetModule("OutputVariable")

ov = oDesign.GetOutputVariables

GetOutputVariableValueUse: 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.

10-4 Output Variable Script Commands

Page 127: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Syntax: GetOutputVariableValue(<OutputVarName>, <IntrinsicVariation>, <SolutionName>, <ReportTypeName>, <SimValueContext>)

Return Value: Double value of the output variable.Parameters: <OutputVarName>

Type: <string>Original name of the variable

<Variation>

Type: <string>A set of variable, value pairs to use when evaluating the output expres-sion. If no variables are present, a null string must be used.The Eddy-Current solution type requires at least the specification of frequency as shown here while the transient solver will require Time as a minimum entry.For example: "" (Null String)"freq=‘60’" (Eddy current example)

<SolutionName>

Type: <string>Name of the solution as listed in the output variable dialog box as shown in SimValueContext.For example: "Setup1 : Last Adaptive"

<ReportTypeName >

Type: <string>The name of the report type as seen in the output variable dialog box as shown in SimValueContext.

<SimValueContext>

Type: <string>Context for which the output variable expression is being evaluated. This section is related to the Parameters or Geometry fields in the UI that specify a context for extracting data quantities. This can be an empty string if there is no context.The Context section of the Output Variables dialog box contains the information that is required when getting the value of the Output Vari-able. Note these values when using the dialog box to create the Output

Note If the Output Variable is based upon a field quantity, then the ReportTypeName must be set to "Fields".

Output Variable Script Commands 10-5

Page 128: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Variable.

10-6 Output Variable Script Commands

Page 129: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Hint Variation variables can be identified by doing a Data Table report and viewing the variable specifications in the table header. For example:

Also, as shown below, the Trace and Families tabs on the Report dialog box can be used as illustrated to identify variation variables.

Output Variable Script Commands 10-7

Page 130: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Example: Dim Val

Val= oModule.GetOutputVariableValue("tempmag",_

"freq='60' coilcurrent='1000' gapsize='-0.001'",_

"Setup1 : LastAdaptive", "EddyCurrent", "")

Val= oModule.GetOutputVariableValue("tempmag",_

"coilcurrent='1000' gapsize='-0.001'",_

"Setup1 : LastAdaptive", "Magnetostatic", "")

Val= oModule.GetOutputVariableValue("BFieldMag",_

"", "Setup1 : LastAdaptive", "Fields", "")

Val= oModule.GetOutputVariableValue("MagBatPoint1",_

"freq='60' coilcurrent='1000' gapsize='-0.001' Phase=’0deg’", "Setup1 : LastAdaptive", "Fields", Array("Context:=", "Point1"))

10-8 Output Variable Script Commands

Page 131: scriptingMaxwell_onlinehelp

11 3D Modeler Editor Script Commands

Modeler commands should be executed by the 3D Modeler editor.

Set oEditor = oDesign.SetActiveEditor("3D Modeler")

oEditor.CommandName <args>

3D Modeler Editor Script Commands 11-1

Page 132: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Conventions Used in the 3D Modeler Chapter<Attributes Array>

Array("NAME:Attributes",

"Name:=", <string>,

"Flags:=", <string>,"Color:=", <string>,

"Transparency:=", <value>,

"PartCoordinateSystem:=", <string>,

"MaterialName:=", <string>,

"Solveinside:=", <bool>)

Flags

Format is a string containing any of the following flags separated by the # character:

• Model

• NonModel

• Wireframe

Example: "Flags:=", "NonModel#Wireframe"

Color

Format is a string containing an R,G,B triple format-ted as "(R G B)".

Example: "Color:=", "(255 255 255)"

Transparency

Specify a number between 0 and 1.

PartCoordinateSystem

Orientation of the primitive. Specify the name of one of the defined coordinate systems.

<SelectionsArray>

Array("NAME:Selections",

"Selections:=", <string>)

Selections

Comma-separated list of parts on which to perform the operation.

Example: "Selections:=", "Rect1, Rect2"

11-2 3D Modeler Editor Script Commands

Page 133: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Draw Menu CommandsFollowing are the commands used for drawing:• CreateBondwire• CreateBox• CreateCircle• CreateCone• CreateCutplane• CreateCylinder• CreateEllipse• CreateHelix• CreatePoint• CreateUserDefinedPart• CreatePolyline• CreateRectangle• CreateRegularPolyhedron• CreateRegularPolygon• CreateSphere• CreateSpiral• CreateTorus• DeletePolylinePoint• EditPolyline• InsertPolylineSegment• PurgeHistory• SweepAlongPath• SweepAlongVector• SweepAroundAxis

CreateBondwireUse: Creates a bondwire primitive.Command: Draw>BondwireSyntax: CreateBondwire <ParametersArray>, <AttributesArray>

Return Value: NoneParameters: <ParametersArray>

Array("NAME:BondwireParameters",

"WireType:=", <string>,

3D Modeler Editor Script Commands 11-3

Page 134: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"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. Pos-sible values are: "X", "Y", "Z"

Example: "WhichAxis:=", "Z" means the bond wire will be drawn on the XY plane.

CreateBoxUse: Creates a box primitive.Command: Draw>BoxSyntax: CreateBox <BoxParametersArray>, <AttributesArray>

Return Value: NoneParameters: <BoxParametersArray>

Array("NAME:BoxParameters",

"XPosition:=", <value>,

"YPosition:=", <value>,

"ZPosition:=", <value>,

"XSize:=",<value>,

"YSize:=",<value>,

"ZSize:=",<value>)

11-4 3D Modeler Editor Script Commands

Page 135: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

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", "ZCompo-nent:=", _ "0mm", "NumClones:=", "2"), _

Array("NAME:Options", "DuplicateBoundaries:=", true)

CreateCircleUse: Creates a circle primitive.Command: Draw>CircleSyntax: CreateCircle <CircleParametersArray>, <AttributesArray>

Return Value: NoneParameters: <CircleParametersArray>

Array("NAME:CircleParameters",

"XCenter:=", <value>,

"YCenter:=", <value>,

"ZCenter:=", <value>,

"Radius:=", <value>,

"WhichAxis:=", <string>)

WhichAxis

Axis of the normal vector to the circle. Possible val-ues are: "X", "Y", "Z"Example: "WhichAxis:=", "Z" means the circle will be drawn in the XY plane.

3D Modeler Editor Script Commands 11-5

Page 136: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

CreateConeUse: Creates a cone primitive.Command: Draw>ConeSyntax: CreateCone <ConeParametersArray>, <AttributesArray>

Return Value: NoneParameters: <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"

CreateCutplaneUse: Creates a cutplane. Only the name and color attributes from

<AttributesArray> are supported.Command: Draw>PlaneSyntax: CreateCutplane <CutplaneParametersArray>,

<AttributesArray>

Return Value: NoneParameters: <CutplaneParametersArray>

Array("NAME:PlaneParameters",

"PlaneBaseX:=", <value>,

"PlaneBaseY:=", <value>,

"PlaneBaseZ:=", <value>,

"PlaneNormalX:=", <value>,

"PlaneNormalY:=", <value>),

"PlaneNormalZ:=", <value>)

11-6 3D Modeler Editor Script Commands

Page 137: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

CreateCylinderUse: Creates a cylinder primitive.Command: Draw>CylinderSyntax: CreateCylinder <CylinderParametersArray>,

<AttributesArray>

Return Value: NoneParameters: <CylinderParametersArray>

Array("NAME:CylinderParameters",

"XCenter:=", <value>,

"YCenter:=", <value>,

"ZCenter:=", <value>,

"Radius:=", <value>,

"Height:=", <value>,

"WhichAxis:=", <string>)

WhichAxis

Axis of the cylinder. Possible values are:"X", "Y", "Z"Example: "WhichAxis:=", "Z"

CreateEllipseUse: Creates an ellipse primitive.Command: Draw>EllipseSyntax: CreateEllipse <EllipseParametersArray>, <AttributesArray>

Return Value: NoneParameters: <EllipseParametersArray>

Array("NAME:EllipseParameters",

"XCenter:=", <value>,

"YCenter:=", <value>,

"ZCenter:=", <value>,

"MajRadius:=", <value>,

"Ratio:=", <value>,

"WhichAxis:=", <string>)

WhichAxis

Axis of the normal vector to the ellipse. Possible val-ues are: "X", "Y", "Z"Example: "WhichAxis:=", "Z" means the ellipse is drawn in the XY plane.

3D Modeler Editor Script Commands 11-7

Page 138: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

CreateHelixUse: Creates a helix by sweeping the specified 2D objects.Command: Draw>HelixSyntax: CreateHelix <SelectionsArray>, <HelixParametersArray>

Return Value: NoneParameters: <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>)

CreatePointUse: Creates a point. Only the name and color attributes from

<AttributesArray> are supported.Command: Draw>PointSyntax: CreatePoint <PointParametersArray>, <AttributesArray>

Return Value: NoneParameters: <PointParametersArray>

Array(“NAME:PointParameters”,

"PointX:=", <value>,

"PointY:=", <value>,

"PointZ:=", <value>)

11-8 3D Modeler Editor Script Commands

Page 139: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

CreateUserDefinedPartUse: Creates a user-defined part.Command: Draw>User Defined PrimitiveSyntax: CreateUserDefinedPart <UserDefinedParametersArray>,

<AttributesArray>

Return Value: NoneParameters:

<UserDefinedParametersArray>

Array("NAME:UserDefinedPrimitiveParameters",

“CoordinateSystemID:=", <value>,

"DllName:=", <string>,

"Library:=", <string>,

Array("NAME:ParamVector", Array("NAME:Pair", "Name:=",

<string>, "Value:=", <value>)…)

Example:oEditor.CreateUserDefinedPartArray("NAME:UserDefinedPrimitiveParameters",_"CoordinateSystemID:=", -1, "DllName:=",_"Examples/RectangularSpiral", "NoOfParameters:=", 6,_"Library:=", "syslib", Array("NAME:ParamVector",_Array("NAME:Pair", "Name:=", "Xpos", "Value:=", "0mm"),_Array("NAME:Pair", "Name:=", "Ypos", "Value:=", "0mm"),_Array("NAME:Pair", "Name:=", "TurnSep", "Value:=", "5mm"),_ Array("NAME:Pair", "Name:=", "Turns", "Value:=", "2"),_Array("NAME:Pair", "Name:=", "Width", "Value:=", "2mm"),_Array("NAME:Pair", "Name:=", "Height", "Value:=", "2mm"))),_ Array("NAME:Attributes", "Name:=", "RectangularSpiral1",_"Flags:=", "", "Color:=", "(132 132 193)", "Transparency:=", _ 0, "PartCoordinateSystem:=", "Global", "MaterialName:=",_"copper", "SolveInside:=", false)

CreatePolylineUse: Creates a polyline primitive.Command: Draw>PolylineSyntax: CreatePolyline <PolylineParametersArray>,

3D Modeler Editor Script Commands 11-9

Page 140: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

<AttributesArray>

Return Value: NoneParameters: <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"

CreateRectangleUse: Creates a rectangle primitive.Command: Draw>RectangleSyntax: CreateRectangle <RectangleParametersArray>,

<AttributesArray>

Return Value: NoneParameters: <RectangleParametersArray>

Array("NAME:RectangleParameters",

11-10 3D Modeler Editor Script Commands

Page 141: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"XStart:=", <value>,

"YStart:=", <value>,

"ZStart:=", <value>,

"Width:=", <value>,

"Height:=", <value>,

"WhichAxis:=", <string>)

WhichAxis

Axis of the normal vector to the rectangle. Possible values for 3D Designs are: "X", "Y", "Z".For 2D XY Designs "Whichaxis:=" should be set to "Z".

For 2D RZ Designs "Whichaxis:=" should be set to "Y".

Example: "WhichAxis:=", "Z" means the rectangle will be drawn in the XY plane.

CreateRegularPolyhedronUse: Creates a regular polyhedron primitive.Command: Draw>Regular PolyhedronSyntax: CreateRegularPolyhedron <PolyhedronParametersArray>,

<AttributesArray>

Return Value: NoneParameters: <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 for 3D Designs are: "X", "Y", "Z"

3D Modeler Editor Script Commands 11-11

Page 142: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

For 2D XY Designs "Whichaxis:=" should be set to "Z".

For 2D RZ Designs "Whichaxis:=" should be set to "Y".

Example: "WhichAxis:=", "Z"

CreateRegularPolygonUse: Creates a regular polygon primitive.Command: Draw>Regular PolygonSyntax: CreateRegularPolygon <PolygonParametersArray>,

<AttributesArray>

Return Value: NoneParameters: <PolygonParametersArray>

Array("NAME:RegularPolygonParameters",

"XCenter:=",<value>,

"YCenter:=",<value>,

"ZCenter:=",<value>,

"XStart:=", <value>,

"YStart:=", <value>,

"ZStart:=", <value>,

"NumSides:=", "12",

"WhichAxis:=", <string>)

NumSides

Specify a number greater than 2.

WhichAxis

Axis of normal vector to the polygon. Possible values for 3D Designs are: "X", "Y", "Z"For 2D XY Designs "Whichaxis:=" should be set to "Z".

For 2D RZ Designs "Whichaxis:=" should be set to "Y".

Example: "WhichAxis:=", "Z" means the polygon will be drawn in the XY plane.

CreateSphereUse: Creates a sphere primitive.Command: Draw>SphereSyntax: CreateSphere <SphereParametersArray>, <AttributesArray>

Return Value: NoneParameters: <SphereParametersArray>

11-12 3D Modeler Editor Script Commands

Page 143: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Array("NAME:SphereParameters",

"XCenter:=", <value>,

"YCenter:=", <value>,

"ZCenter:=", <value>,

"Radius:=", <value>)

CreateSpiralUse: Creates a spiral by sweeping the specified 2D objects.Command: Draw>SpiralSyntax: CreateSpiral <SelectionsArray>, <SpiralParametersArray>

Return Value: NoneParameters: <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>)

CreateTorusUse: Creates a torus primitive.Command: Draw>TorusSyntax: CreateTorus <TorusParametersArray>, <AttributesArray>

Return Value: NoneParameters: <TorusParametersArray>

Array("NAME:TorusParameters",

"XCenter:=", <value>, "YCenter:=", <value>,

"ZCenter:=", <value>,

3D Modeler Editor Script Commands 11-13

Page 144: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"MajorRadius:=", <value>,

"MinorRadius:=", <value>,

"WhichAxis:=", <string>)

WhichAxis

Axis of the torus. Possible values are: "X", "Y", "Z"Example: "WhichAxis:=", "Z"

EditPolylineUse: 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>SplineDraw>Line Segment>Insert Segment Before>3 Point ArcDraw>Line Segment>Insert Segment Before>Center Point ArcDraw>Line Segment>Insert Segment After>StraightDraw>Line Segment>Insert Segment After>SplineDraw>Line Segment>Insert Segment After>3 Point ArcDraw>Line Segment>Insert Segment After>Center Point Arc

Syntax: EditPolyline <SelectionsArray>,

<PolylineParametersArray>,

Return Value: NoneParameters: <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"

InsertPolylineSegmentUse: 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>SplineDraw>Line Segment>Insert Segment Before>3 Point ArcDraw>Line Segment>Insert Segment Before>Center Point ArcDraw>Line Segment>Insert Segment After>Straight

11-14 3D Modeler Editor Script Commands

Page 145: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Draw>Line Segment>Insert Segment After>SplineDraw>Line Segment>Insert Segment After>3 Point ArcDraw>Line Segment>Insert Segment After>Center Point Arc

Syntax: InsertPolylineSegment <InsertPolylineSegmentArray>

Return Value: NoneParameters: <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"

PurgeHistoryUse: Purges the construction history of the selected object. For complex objects

this simplifies the object and can improve modeler speed.Command: Modeler>Purge HistorySyntax: PurgeHistory <PurgeHistoryArray>

3D Modeler Editor Script Commands 11-15

Page 146: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Return Value: NoneParameters: <PurgeHistoryArray>

Array(“Name:Selections”,

“Selections:=”, <string>,

“NewPartsModelFlag:=”, <string>)

Selections

Name of the object to purge.NewPartsModelFlag

Flag to indicate model properties, Model or NonModel.Example: oEditor.PurgeHistory Array("NAME:Selections",

"Selections:=", "Polygon1", "NewPartsModelFlag:=", "Model")

DeletePolylinePointUse: Deletes either a start or end point from an existing polyline segment.Command: Edit>Delete Start Point

Edit>Delete End PointSyntax: DeletePolylinePoint <DeletePointArray>

Return Value: NoneParameters: <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”

SweepAlongPathUse: Sweeps the specified 1D or 2D parts along a path. The last 1D object

specified identifies the path for the sweep.Command: Draw>Sweep>Along PathSyntax: SweepAlongPath <SelectionsArray>,

<PathSweepParametersArray>

Return Value: None

11-16 3D Modeler Editor Script Commands

Page 147: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Parameters: <PathSweepParametersArray>

Array("NAME:PathSweepParameters",

"DraftAngle:=", <value>,

"DraftType:=", <string>,

"TwistAngle:=", <value>)

DraftType

Possible values are "Extended", "Round", "Natural"

Example: oEditor.SweepAlongPath _

Array("NAME:Selections", "Selections:=",_

"Polygon1,Polyline1"),_

Array("NAME:PathSweepParameters", _

"DraftAngle:=", "0deg",_

"DraftType:=", "Round",_

"TwistAngle:=", "30deg")

SweepAlongVectorUse: Sweeps the specified 1D or 2D parts along a vector.Command: Draw>Sweep>Along VectorSyntax: SweepAlongVector <SelectionsArray>,

<VecSweepParametersArray>

Return Value: NoneParameters: <VecSweepParametersArray>

Array("NAME:VectorSweepParameters",

"DraftAngle:=", <value>,

"DraftType:=", <string>,

"SweepVectorX:=", <value>, _

"SweepVectorY:=", <value>,

"SweepVectorZ:=", <value)

DraftType

Possible values are "Extended", "Round", "Natural"

SweepAroundAxisUse: Sweeps the specified 1D or 2D parts around an axis.Command: Draw>Sweep>Around AxisSyntax: SweepAroundAxis <SelectionsArray>,

3D Modeler Editor Script Commands 11-17

Page 148: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

<AxisSweepParametersArray>

Return Value: NoneParameters: <AxisSweepParametersArray>

Array("NAME:AxisSweepParameters",

"DraftAngle:=", <value>,

"DraftType:=", <string>,

"SweepAxis:=", <string>,

"SweepAngle:=", <value>)

DraftType

Possible values are "Extended", "Round", "Natural"

SweepAxis

Possible values are "X", "Y", "Z"

11-18 3D Modeler Editor Script Commands

Page 149: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Edit Menu CommandsFollowing are the commands used for editing:• Copy • DuplicateAlongLine • DuplicateAroundAxis• DuplicateMirror • Mirror • Move• OffsetFaces• Paste • Rotate• Scale

CopyUse: Copies specified parts.Command: Edit>CopySyntax: Copy <SelectionsArray>

Return Value: None

DuplicateAlongLineUse: Duplicates specified parts along a line.Command: Edit>Duplicate>Along LineSyntax: DuplicateAlongLine <SelectionsArray>,

<DupLineParametersArray>

Return Value: NoneParameters: <DupLineParametersArray>

Array("NAME:DuplicateToAlongLineParameters",

"XComponent:=", <value>,

"YComponent:=", <value>,

"ZComponent:=", <value>,

"NumClones:=", <value>)

NumClones

Specify a number greater than 1.

3D Modeler Editor Script Commands 11-19

Page 150: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

DuplicateAroundAxisUse: Duplicates specified parts around an axis.Command: Edit>Duplicate>Around AxisSyntax: DuplicateAroundAxis <SelectionsArray>,

<DupAxisParametersArray>

Return Value: NoneParameters: <DupAxisParametersArray>

Array("NAME:DuplicateAroundAxisParameters",

"WhichAxis:=", <string>,

"AngleStr:=", <value>,

"NumClones:=",<value>)

WhichAxis

Axis to duplicate around. Possible values for 3D Designs are: "X", "Y", "Z".

For 2D XY Designs, "Whichaxis:=" should be set to "Z".

For 2D RZ Designs, "Whichaxis:=" should be set to "Y".

Example: "WhichAxis:=", "Z"

NumClones:

Specify a number greater than 1.

DuplicateMirrorUse: Duplicates specified parts according to a mirror plane.Command: Edit>Duplicate>MirrorSyntax: DuplicateMirror <SelectionsArray>,

<DupMirrorParametersArray>

Return Value: NoneParameters: <DupMirrorParametersArray>

Array("NAME:DuplicateToMirrorParameters",

"DuplicateMirrorBaseX:=", <value>,

"DuplicateMirrorBaseY:=", <value>,

"DuplicateMirrorBaseZ:=", <value>,

"DuplicateMirrorNormalX:=", <value>,

"DuplicateMirrorNormalY:=", <value>,

"DuplicateMirrorNormalZ:=", <value>)

11-20 3D Modeler Editor Script Commands

Page 151: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

For 2D XY Designs, Z parameters should be set to "0".

For 2D RZ Designs, Y parameters should be set to "0".

MirrorUse: Mirrors specified parts.Command: Edit>Arrange>MirrorSyntax: Mirror <SelectionsArray>, <MirrorParametersArray>

Return Value: NoneParameters: <MirrorParametersArray>

Array("NAME:MirrorParameters",

"MirrorBaseX:=", <value>,

"MirrorBaseY:=", <value>,

"MirrorBaseZ:=", <value>,

"MirrorNormalX:=", <value>,

"MirrorNormalY:=", <value>,

"MirrorNormalZ:=", <value>)

MoveUse: Moves specified parts.Command: Edit>Arrange>MoveSyntax: Move <SelectionsArray>, <MoveParametersArray>

Return Value: NoneParameters: <MoveParametersArray>

Array("NAME:TranslateParameters",

"TranslateVectorX:=", <value>,

"TranslateVectorY:=", <value>,

"TranslateVectorZ:=", <value>)

For 2D XY Designs, "TranslateVectorZ:=" should be set to "0".

For 2D RZ Designs, "TranslateVectorY:=" should be set to "0".

OffsetFacesUse: Offsets the faces of specified parts.Command: Edit>Arrange>Offset

3D Modeler Editor Script Commands 11-21

Page 152: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Syntax: OffsetFaces <SelectionsArray>, <OffsetParametersArray>

Return Value: NoneParameters: <OffsetParametersArray>

Array("NAME:OffsetParameters",

"OffsetDistance:=", <value>)

Paste (Modeler)Use: Pastes copied data.Command: Edit>PasteSyntax: Paste

Return Value: None

RotateUse: Rotates specified parts.Command: Edit>Arrange>RotateSyntax: Rotate <SelectionsArray>, <RotateParametersArray>

Return Value: NoneParameters: <RotateParametersArray>

Array("NAME:RotateParameters",

"RotateAxis:=", <string>

"RotateAngle:=", <value>)

RotateAxis

Possible values for 3D Designs are: "X", "Y", "Z".

For 2D XY Designs, "RotateAxis:=" should be set to "Z".

For 2D RZ Designs, "RotateAxis:=" should be set to "Y".

ScaleUse: Scales specified parts.Command: Edit>ScaleSyntax: Scale <SelectionsArray>, <ScaleParametersArray>

Return Value: NoneParameters: <ScaleParametersArray>

Array("NAME:ScaleParameters",

"ScaleX:=", <value>,

"ScaleY:=", <value>,

11-22 3D Modeler Editor Script Commands

Page 153: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"ScaleZ:=", <value>)

For 2D XY Designs, "ScaleZ:=" should be set to "0".

For 2D RZ Designs, "ScaleY:=" should be set to "0".

3D Modeler Editor Script Commands 11-23

Page 154: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Modeler Menu CommandsFollowing are the Modeler commands:• AssignMaterial• Chamfer• Connect• CoverLines• CoverSurfaces• CreateEntityList• CreateFaceCS• CreateObjectFromEdges• CreateObjectFromFaces• CreateRelativeCS• DeleteLastOperation• DetachFaces• EditEntityList• EditFaceCS• EditRelativeCS• Export• Fillet• GenerateHistory• Import• ImportDXF• Intersect• MoveFaces• Section• SeparateBody• SetModelUnits• SetWCS• ShowWindow• Split• Subtract• UncoverFaces• Unite

11-24 3D Modeler Editor Script Commands

Page 155: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

AssignMaterialUse: Assigns a material to the specified objects. Only the MaterialName and

SolveInside parameters of <AttributesArray> are supported.Command: Modeler>Assign MaterialSyntax: AssignMaterial <SelectionsArray>, <AttributesArray>

Return Value: NoneExample: oEditor.AssignMaterial _

Array("NAME:Selections", "Selections:=", "Polygon1"),_

Array("NAME:Attributes", _

"MaterialName:=", "tungsten",_

"SolveInside:=", false)

ChamferUse: Creates a chamfer.Command: Modeler>Chamfer (Only available for 3D Projects and 3D Objects)Syntax: Chamfer (<ObjectName> <ChamferParameters>)

Return Value: NoneParameters: <ObjectName>

Array("NAME:Selections", _

"Selections:=", <string>),

<ChamferParameters>

Array("NAME:Parameters", _

Array("NAME:ChamferParameters", _

"CoordinateSystemID:=", <value>,

"Edges:=", <ArrayOfEdgeIDs>,

"LeftRange:=", <value>))

Example: oEditor.Chamfer Array("Name:Selections", _

"Selections:=", "Box1"), Array("NAME:Parameters", _ Array("NAME:ChamferParameters", _

"CoordinateSystemID:=", -1, _

"Edges:=", Array(13), "LeftRange:=", "1mm"))

ConnectUse: Connects specified 1D parts to form a sheet.Command: Modeler>Surface>Connect

3D Modeler Editor Script Commands 11-25

Page 156: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Syntax: Connect <SelectionsArray>

Return Value: None

CoverLinesUse: Covers the specified 1D objects to form a sheet.Command: Modeler>Surface>Cover LinesSyntax: CoverLines <SelectionsArray>

Return Value: None

CoverSurfacesUse: Covers the specified objects to form a solid object.Command: Modeler>Surface>Cover FacesSyntax: CoverSurfaces <SelectionsArray>

Return Value: None

CreateEntityListUse: 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 ListSyntax: CreateEntityList <EntityListParametersArray>,

<AttributesArray>

Return Value: NoneParameters: <EntityListParametersArray>

Array("NAME:GeometryEntityListParameters",

"EntityType:=", <string>,

"EntityList:=", <array>

EntityType

Possible values are "Object", "Face"

EntityList

Array of integers – the IDs of the objects or faces to put in the list.

11-26 3D Modeler Editor Script Commands

Page 157: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

CreateFaceCSUse: Creates a face coordinate system. Only the Name attribute of the

<AttributesArray> parameter is supported.Command: Modeler>Coordinate System>Create>Face CSSyntax: CreateFaceCS <FaceCSParametersArray>, <AttributesArray>

Return Value: NoneParameters: <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 sys-tem.

PartID

ID of the object on which the face ID lies.

IsAttachedToEntity

Specifies whether the point is anchored (to a vertex, edge, or face).

3D Modeler Editor Script Commands 11-27

Page 158: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

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 posi-tion 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.

For 2D XY Designs, ZPosition should be set to "0".

For 2D RZ Designs, YPosition should be set to "0".

WhichAxis

Possible values are "X", "Y", "Z".

For 2D XY Designs, WhichAxis must be set to "Z".

For 2D RZ Designs, WhichAxis must be set to "Y".

CreateObjectFromEdgesUse: Creates a polyline from the specified object edge.Command: Modeler>Create Object From EdgeSyntax: CreateObjectFromEdges <SelectionsArray>,

<ObjFromEdgeParametersArray>

Return Value: NoneParameters: <SelectionsArray>

Array("NAME:Selections",

"Selections:=" <ObjName>)

<ObjFromEdgeParametersArray>

Array("NAME:Parameters",

11-28 3D Modeler Editor Script Commands

Page 159: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

<EdgeParametersArray>)

<EdgeParametersArray>

Array("Name:BodyFromEdgeToParameters",

"CoordinateSystemID:=", <int>,

"Edges:=", <EdgeIDarray>)

Example: oEditor.CreateEdgeFromEdges _

Array("NAME:Selections", "Selections:=", "Box1"),_

Array("NAME:Parameters", _

Array("NAME:BodyFromEdgeToParameters", _

"CoordinateSystemID:=", -1, _

"Edges:=", Array(13)))

CreateObjectFromFacesUse: Creates 2D objects from the specified faces.Command: Modeler>Surface>Create Object From FaceSyntax: CreateObjectFromFaces <SelectionsArray>,

<ObjFromFaceParametersArray>

Return Value: NoneParameters: <ObjFromFaceParametersArray>

Array("NAME:Parameters",

<FacesOfOneObjToDetach>, <FacesOfOneObjToDetach>,

...)

<FacesOfOneObjToDetach>

Array("Name:BodyFromFaceToParameters",

"FacesToDetach:=", <array>)

FacesToDetach

Array of integers – the IDs of the faces to use to cre-ate objects.

Example: oEditor.CreateObjectFromFaces _

Array("NAME:Selections", "Selections:=", "Box1"),_

Array("NAME:Parameters", _

Array("NAME:BodyFromFaceToParameters", _

"FacesToDetach:=", Array(185)))

3D Modeler Editor Script Commands 11-29

Page 160: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

CreateRelativeCSUse: Creates a relative coordinate system. Only the Name attribute of the

<AttributesArray> parameter is supported.Command: Modeler>Coordinate System>Create>Relative CS>Offset

Modeler>Coordinate System>Create>Relative CS>RotatedModeler>Coordinate System>Create>Relative CS>Both

Syntax: CreateRelativeCS <RelativeCSParametersArray>,

<AttributesArray>

Return Value: NoneParameters: <RelativeCSParametersArray>

Array("NAME:RelativeCSParameters",

"OriginX:=", <value>,

"OriginY:=", <value>,

"OriginZ:=", <value>,

"XAxisXvec:=", <value>,

"XAxisYvec:=", <value>,

"XAxisZvec:=", <value>,

"YAxisXvec:=", <value>,

"YAxisYvec:=", <value>,

"YAxisZvec:=", <value>)

For 2D XY Designs, OriginZ, XAxisZvec, and YAxisZvec should be set to "0".

For 2D RZ Designs, OriginY, XAxisYvec, and YAxisYvec should be set to "0".

DeleteLastOperationUse: Deletes the last operation for specified objects.Command: Modeler>Delete Last OperationSyntax: DeleteLastOperation <SelectionsArray>

Return Value: None

DetachFacesUse: Detaches the specified faces.Command: Modeler>Surface>Detach FacesSyntax: DetachFaces <SelectionsArray>,

<DetachFacesParametersArray>

11-30 3D Modeler Editor Script Commands

Page 161: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Return Value: NoneParameters: <DetachFacesParametersArray>

Array("NAME:Parameters",

<FacesOfOneObjToDetach>,

<FacesOfOneObjToDetach>, ...)

<FacesOfOneObjToDetach>

Array("Name:DetachFacesToParameters",

"FacesToDetach:=", <array>)

FacesToDetach

An array of integers – the IDs of the faces to detach.

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

EditEntityListUse: Modifies an entity list.Command: Modeler>List>ReassignSyntax: EditEntityList <SelectionsArray>,

<EntityListParametersArray>

Return Value: None

EditFaceCSUse: Recreates an existing face coordinate system. The name of the coordinate

system to modify should be specified in the <AttributesArray> parameter.

Command: Modeler>Coordinate System>EditSyntax: EditFaceCS <FaceCSParametersArray>, <AttributesArray>

Return Value: None

3D Modeler Editor Script Commands 11-31

Page 162: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

EditRelativeCSUse: Modifies a relative coordinate system. Use <AttributesArray> to

indicate the name of the coordinate system to modify.Command: Modeler>Coordinate System>EditSyntax: EditRelativeCS <RelativeCSParametersArray>,

<AttributesArray>

Return Value: NoneParameters: <ParametersArray>

Array("NAME:RelativeCSParameters",

"OriginX:=", <value>,

"OriginY:=", <value>,

"OriginZ:=", <value>,

"XAxisXvec:=", <value>,

"XAxisYvec:=", <value>,

"XAxisZvec:=", <value>,

"YAxisXvec:=", <value>,

"YAxisYvec:=", <value>,

"YAxisZvec:=", <value>)

For 2D XY Designs, OriginZ, XAxisZvec, and YAxisZvec should be set to "0".

For 2D RZ Designs, OriginY, XAxisYvec, and YAxisYvec should be set to "0".

ExportUse: Exports the model to a file.Command: Modeler>ExportSyntax: Export <ExportParametersArray>

Return Value: NoneParameters: <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 Maxwell.

11-32 3D Modeler Editor Script Commands

Page 163: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Minor Version

Can be –1 or any ACIS minor version supported by Max-well software.

FilletUse: Creates a fillet.Command: Modeler>Fillet (Only Available for 3D Projects and 3D Objects)Syntax: Fillet(<ObjectName> <FilletParameters>)

Return Value: NoneParameters: <ObjectName>

Array("NAME:Selections", _

"Selections:=", <string>),

<FilletParameters>

Array("NAME:Parameters", _

Array("NAME:FilletParameters", _

"CoordinateSystemID:=", <value>,

"Edges:=", <ArrayOfEdgeIDs>,

"Radius:=", <value>,

"Setback:=", <value>))

Example: oEditor.Fillet Array("Name:Selections", "Selections:=", _"Box1"), Array("NAME:Parameters", Array("NAME:FilletParameters", _ "CoordinateSystemID:=", -1, "Edges:=", Array(13), "Radius:=", _ "1mm", "Setback:=", "0mm"))

GenerateHistoryUse: Generates the history for specified 1D objects.Command: Modeler>Generate HistorySyntax: GenerateHistory <SelectionsArray>

Return Value: None

ImportUse: Imports a 3D model file.Command: Modeler>ImportSyntax: Import <ImportParametersArray>

3D Modeler Editor Script Commands 11-33

Page 164: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Return Value: NoneParameters: <ImportParametersArray>

Array("NAME:NativeBodyParameters",

"AutoHeal:=", <bool>,

"Options:=", <string>,

"SourceFile:=", <string>)

ImportDXFUse: Import a DXF file into a design.Command: ImportDXFSyntax: ImportDXF Array("NAME:options",

"FileName:=", <"filename">,

"Scale:=", <scale>,

"AutoDetectClosed:=", <detect closed>,

"SelfStitch:=", <stitch>,

"DefeatureGeometry:=", <defeature>,

"DefeatureDistance:=", <defeature distance>,

"RoundCoordinates:=", <round>,

"RoundNumDigits:=", <round digits>,

"WritePolyWithWidthAsFilledPoly:=", <filled poly>,

"ImportMethod:=", <import method>

"2DSheetBodies:=", <2D sheet>

Array("NAME:LayerInfo",

Array("NAME:<layer>",

"source:=", <"layer">,

"display_source:=", "<display>",

"import:=", <import>,

"dest:=", "<destination layer>",

"dest_selected:=", <destination selected>,

"layer_type:=", <"layer type">), …))

Return Value: NoneParameters: <"filename">

Type: textDescription: name of the DXF file to import

<scale>

11-34 3D Modeler Editor Script Commands

Page 165: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Type: doubleDescription: scale factor to be applied to incoming coordinate values; converts the incoming units to meters.

<detect closed>

Type: boolean (true or false)Description: if true, polylines are checked to see whether or not they are closed. If a polyline is closed, Designer creates a polygon in the design.

<stitch>

Type: boolean (true or false)Description: if true, multiple straight line segments are joined to form polylines. If the resulting polyline is closed, a polygon is created in Designer.

<defeature>

Type: boolean (true or false)Description: if true, certain small features in the imported geometry are removed to reduce complexity. The features that are removed include: multiple points placed within the specified distance; thin or narrow regions ("thins" and "spikes"); and extraneous points along straight line segments.

<defeature distance>

Type: doubleDescription: defeaturing distance/

<round>

Type: boolean (true or false)Description: if true, all imported data is rounded to the specify number of decimal points.

<round digits>

Type: integerDescription: number of rounding decimal points

<filled poly>

Type: boolean (true or false)Description: if true, import wide polylines as polygons. There is more flexibility to change the shape of a polygon.

<import method>

Type: integerDescription: 0 for Script, 1 for Acis.

3D Modeler Editor Script Commands 11-35

Page 166: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

<2D sheet>

Type: boolean (true or false)Description: if true, import geometry as 2D sheet bodies.

<layer>

Type: textDescription: import layer name (as found in the DXF file).

<import>

Type: boolean (true or false)Description: if true, the layer is import (note: there's no need to list all layers, just supply the layers to be imported).

<destination layer>

Type: textDescription: destination layer name

<destination selected>

Type: boolean (true or false)Description: if true, the destination layer must be an existing layer (else a new layer will be created).

<"layer type">

Type: textDescription: the layer type, "undefined", "signal", "dielectric", "metal-izedsignal", "ground", "etching", "resistance", "capacitance", "cover", "rat", "error", "symbol", "measures", "voids", "assembly", "silkscreen", "soldermask", "solderpaste", "glue", "wirebond", "jumper", "user", "generic".

Example:

oEditor.ImportDXF Array("NAME:options",

"FileName:=", "C:/Designs/dxfiles/spiral_export.dxf",

"Scale:=", 0.001,

"AutoDetectClosed:=", true,

"SelfStitch:=", true,

"DefeatureGeometry:=", true,

"DefeatureDistance:=", 1E-008,

"RoundCoordinates:=", true,

"RoundNumDigits:=", 4,

"WritePolyWithWidthAsFilledPoly:=", true,

"ImportMethod:=", 1,

11-36 3D Modeler Editor Script Commands

Page 167: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"2DSheetBodies:=", true,

Array("NAME:LayerInfo",

Array("NAME:0",

"source:=", "0",

"display_source:=", "0",

"import:=", true,

"dest:=", "0",

"dest_selected:=", false,

"layer_type:=", "signal"),

Array("NAME:spiral_export",

"source:=", "spiral_export",

"display_source:=", "spiral_export",

"import:=", true,

"dest:=", "spiral_export",

"dest_selected:=", false,

"layer_type:=", "signal")))

IntersectUse: Intersects specified objects.Command: Modeler>Boolean>InstersectSyntax: Intersect <SelectionsArray>, <IntersectParametersArray>

Return Value: NoneParameters: <IntersectParametersArray>

Array("NAME:IntersectParameters",

"KeepOriginals:=", <bool>)

MoveFaces Use: Moves the specified faces along the normal or along a vector.Command: Modeler>Surface>Move Faces>Along Normal

Modeler>Surface>Move Faces>Along Vector(Command available for 3D Projects only)

Syntax: MoveFaces <SelectionsArray>, <MoveFacesParametersArray>

Return Value: NoneParameters: <MoveFacesParametersArray>

Array("NAME:Parameters",

3D Modeler Editor Script Commands 11-37

Page 168: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

<FacesOfOneObjToMove>, <FacesOfOneObjToMove>, ...)

<FacesOfOneObjToMove>

Array("Name:MoveFacesParameters",

"MoveAlongNormalFlag:=", <bool>,

"OffsetDistance:=", <value>,

"MoveVectorX:=", <value>, "MoveVectorY:=", <value>,

"MoveVectorZ:=", <value>, "FacesToMove:=", <array>)

MoveAlongNormalFlag

Specifies whether to move along the face normal or along a vector.

If false, provide the MoveVectorX, MoveVectorY, and MoveVectorZ parameters.

FacesToMove

Array of integers – the IDs of the faces to move

Example: oEditor.MoveFaces _

Array("NAME:Selections", "Selections:=", _

"Box2,Box1"), _

Array("NAME:Parameters", _

Array("NAME:MoveFacesParameters", _

"MoveAlongNormalFlag:=", true, _

"OffsetDistance:=", "1mm", _

"FacesToMove:=", Array(218)),_

Array("NAME:MoveFacesParameters", _

"MoveAlongNormalFlag:=", false,_

"OffsetDistance:=", "1mm", _

"MoveVectorX:=", "1mm", _"MoveVectorY:=", "0mm", _

"MoveVectorZ:=", "0mm", _"FacesToMove:=",_

Array(185)))

SectionUse: Creates a 2D cross-section of the selection in the specified plane.Command: Modeler>Surface>SectionSyntax: Section <SelectionsArray>, <SectionParametersArray>

Return Value: NoneParameters: <SectionParametersArray>

Array("NAME:SectionToParameters",

"SectionPlane:=", <string>)

11-38 3D Modeler Editor Script Commands

Page 169: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Section Plane

Possible values are "XY", "YZ", "ZX".

SeparateBodyUse: Separates bodies of specified multi-lump objects.Command: Modeler>Boolean>Separate BodiesSyntax: SeparateBody <SelectionsArray>

Return Value: None

SetModelUnitsUse: Sets the model units.Command: Modeler>UnitsSyntax: SetModelUnits <ModelUnitsParametersArray>

Return Value: NoneParameters: <ModelUnitsParametersArray>

Array("NAME:Units Parameter",

"Units:=", <string>,

"Rescale:=", <bool>)

Units

Possible values are: "cm", "ft", "in", "meter", "mil", "mm", "nm", "uin", "um".

SetWCSUse: Sets the working coordinate system.Command: Modeler>Coordinate System>Set Working CSSyntax: SetWCS <WCSParametersArray>

Return Value: NoneParameters: <WCSParametersArray>

Array("NAME:SetWCS Parameter",

"Working Coordinate System:=", <string>)

Working Coordinate System

Name of the coordinate system to set as the WCS.

ShowWindowUse: Opens the selected 3D model editor window.

3D Modeler Editor Script Commands 11-39

Page 170: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Syntax: ShowWindow

Return Value: NoneParameters: NoneExample: Set oDesign = oProject.GetActiveDesign

Set oModeler = oDesign.SetActiveEditor("3D Modeler")

oEditor.ShowWindow

SplitUse: Splits specified objects along a plane.Command: Modeler>Boolean>SplitSyntax: Split <SelectionsArray>, <SplitParametersArray>

Return Value: NoneParameters: <SplitParametersArray>

Array("NAME:SplitToParameters",

"SplitPlane:=", <string>,

"WhichSide:=", <string>)

SplitPlane

Possible values for 3D Designs 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", "Nega-tiveOnly"

SubtractUse: Subtracts specified objects.Command: Modeler>Boolean>SubtractSyntax: Subtract <SubtractSelectionsArray>,

<SubtractParametersArray>

Return Value: NoneParameters: <SubtractSelectionsArray>

Array(“NAME:Selections”,

"Blank Parts:=", <string>,

11-40 3D Modeler Editor Script Commands

Page 171: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

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

Example: oEditor.Subtract _

Array("NAME:Selections", _

"Blank Parts:=", "Polygon1",_

"Tool Parts:=", "Box1"),_

Array("NAME:SubtractParameters", _

"KeepOriginals:=", false)

UncoverFacesUse: Uncovers specified faces.Command: Modeler>Surface>Uncover FacesSyntax: UncoverFaces <SelectionsArray>, <UncoverParametersArray>

Return Value: NoneParameters: <UncoverParametersArray>

Array("NAME:Parameters",

<FacesOfOneObjToUncover>,

<FacesOfOneObjToUncover>,...)

<FacesOfOneObjToUncover>

Array("Name:UncoverFacesParameters",

"FacesToUncover:=", <array>)

FacesToUncover

An array of integers – the IDs of the faces to uncover.

Example: oEditor.UncoverFaces _

Array("NAME:Selections", "Selections:=", _

3D Modeler Editor Script Commands 11-41

Page 172: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"Box3,Box2"),_

Array("NAME:Parameters", _

Array("NAME:UncoverFacesParameters", _

"FacesToUncover:=", Array(69)), _

Array("NAME:UncoverFacesParameters", _

"FacesToUncover:=", Array(36)))

UniteUse: Unites the specified objects.Command: Modeler>Boolean>UniteSyntax: Unite <SelectionsArray>, <UniteParametersArray>

Return Value: NoneParameters: <UniteParametersArray>

Array("NAME:UniteParameters",

"KeepOriginals:=", <bool>)

11-42 3D Modeler Editor Script Commands

Page 173: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Other oEditor CommandsThe following are some other oEditor commands:• Delete• GetEdgeByPosition• GetFaceByPosition• GetUserPosition• GetObjectName• GetObjectNameByFaceID• GetObjectIDByName• GetMatchedObjectName• GetNumObjects• GetSelections• PageSetup• RenamePart• GetModelBoundingBox

DeleteUse: Deletes specified objects, coordinate systems, points, planes, etc.Command: NoneSyntax: Delete <SelectionsArray>

Return Value: None

GetModelBoundingBoxUse: Gets the bounding box of the current model.Command: NoneSyntax: GetModelBoundingBox()

Return Value: Returns the Xmin, Ymin, Zmin, Xmax, Ymax, Zmax values that define the bounding box.

Parameters: None

Example: Dim oBoundingBox

oBoundingBox = oEditor.GetModelBoundingBox()

GetEdgeByPositionUse: Gets the edge id corresponding to position input.Syntax: GetEdgeByPosition(<PositionParameters>)

3D Modeler Editor Script Commands 11-43

Page 174: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

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"

Example: edgeid = oEditor.GetEdgeByPosition(Array("NAME:EdgeParameters", _

"BodyName:=", "Box1", "XPosition:=", "3.4mm", _

"YPosition:=", "2.8mm", "ZPosition:=", "0.4mm"))

GetFaceByPositionUse: Gets the ID of a face by position.Command: NoneSyntax: GetFaceByPosition <FaceByPositionParametersArray>

Return Value: An integer containing the face ID.Parameters: <FaceByPositionParametersArray>

Array("NAME:Parameters",

"BodyName:=", <string>,

"XPosition:=", <value>,

"YPosition:=", <value>,

"ZPosition:=", <value>)

For 2D XY Designs, ZPosition should be set to "0"For 2D RZ Designs, YPosition should be set to "0"

BodyName

Name of the body on which the point lies.

Example: Dim FaceID

FaceID = oEditor.GetFaceByPosition_

(Array("NAME:Parameters",_

"BodyName:=", "Box1",_

11-44 3D Modeler Editor Script Commands

Page 175: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"XPosition:=", "0mm",_

"YPosition:=", "0mm",_

"ZPosition:=", "0mm"))

GetUserPositionUse: Returns the coordinates of an interactive position input in the 3D model

window.Syntax: GetUserPosition(<PositionInputPrompt>)

Return Value: Array of coordinatesParameters: <PositionInputPrompt>

Type: <string>Example: Dim position

Dim coord

position = oEditor.GetUserPosition("Enter a point")

For Each coord in position

Msgbox(coord)

Next

GetObjectNameUse: Gets an object name corresponding to the 0 base index of the creation

order.Syntax: GetObjectName(<Index>)

Return Value: Returns the object name of corresponding object.Parameters: <Index>

Type: <string>The 0 base index of the creation order.

Example: objectname = oEditor.GetObjectName(3)

GetObjectIDByNameUse: Gets an object name corresponding to the input face ID.Syntax: GetObjectIDByName(<ObjectName>)

Return Value: Returns the ID of the corresponding object Name.Parameters: <ObjectName>

Type: <string>Example: oObjectID = oEditor.GetObjectIDByName("Box2")

3D Modeler Editor Script Commands 11-45

Page 176: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

GetObjectNameByFaceIDUse: Gets an object name corresponding to the input face ID.Syntax: GetObjectName(<FaceID>)

Return Value: Returns the name of the corresponding object.Parameters: <FaceID>

Type: <string>Example: objectname = oEditor.GetObjectNameByFaceID(Face10)

GetMatchedObjectNameUse: 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.

Example: objectnames = oEditor.GetMatchedObjectName("Box*")

GetNumObjectsUse: Gets the number of objects in a design.Syntax: GetNumObjects

Return Value: Returns the number of objects.Type: <int>

Parameters: None

Example: totalobjects = oEditor.GetNumObjects

GetSelectionsUse: Informational.Command: None.Syntax: GetSelections

Return Value: Returns an array of IDs.Parameters: None

Example: Set oProject = oDesktop.SetActiveProject("Project6")

Set oDesign = oProject.SetActiveDesign("MaxwellDesign1")

Set oEditor = oDesign.SetActiveEditor("3D Modeler")

11-46 3D Modeler Editor Script Commands

Page 177: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

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

PageSetupUse: Specifies the page settings for printing.Command: File>Page SetupSyntax: PageSetup <PageSetupParametersArray>

Return Value: NoneParameters: <PageSetupParametersArray>

Array("NAME:PageSetupData",

"margins:=",

Array("left:=", <value>,

"right:=", <value>,

"top:=", <value>,

"bottom:=", <value>))

RenamePartUse: Renames an object.Command: NoneSyntax: RenamePart <RenameParametersArray>

Return Value: NoneParameters: <RenameParametersArray>

Array("NAME:Rename Data",

"Old Name:=", <string>,

"New Name:=", <string>)

3D Modeler Editor Script Commands 11-47

Page 178: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

GetModelBoundingBox Use: Gets the bounding box of the current model.Syntax: GetModelBoundingBox()Return Value: Returns the X, Y, and Z position values and the dX, dY, and dZ size values

that define the bounding box.Parameters: None

Example: Dim oBoundingBox

oBoundingBox = oEditor.GetModelBoundingBox()

11-48 3D Modeler Editor Script Commands

Page 179: scriptingMaxwell_onlinehelp

12 Reporter Editor Script Commands

Reporter commands should be executed by the oDesign module. Following is an example of how to access this object:

Set oDesign = Project.SetActiveDesign("Maxwell3DDesign1")

Set oModule=oDesign.GetModule("ReportSetup")

All Report properties can be edited using the ChangeProperty commands. This includes Title properties, General properties, and Background proper-ties such as border color, fonts, X and Y axis scaling, units, and number dis-play.

Note Maxwell supports Reporter scripting. When you click Tools>Record Script, Maxwell operations performed in the Reporter are automatically recorded.

Reporter Editor Script Commands 12-1

Page 180: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

General Reporter Editor Script CommandsFollowing are reporter script commands recognized by the oDesign module:• AddCartesianXMarker• AddDeltaMarker• AddMarker• AddNote• AddTraces• ClearAllMarkers• CopyReportData• CopyReportDefinition• CopyTraceData• CopyTraceDefinition• CreateReport• CreateReportFromTemplate• DeleteAllReports• DeleteReports• DeleteTraces• ExportToFile• GetAllReportNames• GetDisplayType• ImportIntoReport• PasteReports• PasteTraces• RenameReport• RenameTrace• UpdateTraces• UpdateTracesContextAndSweeps

AddCartesianXMarkerUse: Adds a marker to a report on the X axis.Command: Report2D>Marker>Add X MarkerSyntax: AddCartesianXMarker <ReportName>, <MarkerID>, <Xcoord>

Return Value: NoneParameters: <ReportName>

Type: <string>Name of Report.

12-2 Reporter Editor Script Commands

Page 181: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

<MarkerID>

Type: <string>ID of the marker, for example: “M1”.

<XCoord>

Type: <real>X location for the marker.

Example:

oModule.AddCartesianXMarker "XY Plot1", "MX1", 0

AddDeltaMarkerUse: Add markers to calculate differences between two trace points on a plot.Command: Report2D>Marker>Add Delta MarkerSyntax: AddDeltaMarker <ReportName>, <MarkerID_1>, <TraceID_1>,

<Xcoord_1>, <MarkerID_2>, <TraceID_2> <Xcoord_2>

Return Value: NoneParameters: <ReportName>

Type: <string>Name of Report.

<MarkerID>

Type: <string>ID for the markers.

<TraceID>

Type: <string>Typically given by expression plus solution name plus coordinate system type.

<XCoord>

Type: <real>X location for the marker.

Example:

oModule.AddDeltaMarker "XY Plot 1",

"m3", "dB(S(LumpPort1 LumpPort1)) : Setup1 : Sweep1 : Cartesian", _ "3.22GHz", _

"m4", "dB(S(LumpPort1 LumpPort1)) : Setup1 : Sweep1 : Cartesian",_ "3.93GHz"

Reporter Editor Script Commands 12-3

Page 182: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

AddMarkerUse: Adds a marker to a trace on a report.Command: Report2D>Marker>Add MarkerSyntax: AddMarker <ReportName>, <MarkerID>, <TraceID>, <Xcoord>,

Return Value: NoneParameters: <ReportName>

Type: <string>Name of Report.

<MarkerID>

Type: <string>ID for the marker.

<TraceID>

Type: <string>Typically given by expression plus solution name plus coordinate system type.

<XCoord>

Type: <real>X location for the marker.

Example:

Set oModule = oDesign.GetModule("ReportSetup")

oModule.AddMarker "XY Plot1", "m1", _

"mag(S(Port1 Port1)) : Setup1 : LastAdaptive : Carte-sian", "0.3in"

AddNoteUse: Adds a note at a specified location to a given report.Command: Right-click on the plot and select Add NoteSyntax: AddNote <ReportName> <NoteDataArray>)

Return Value: NoneParameters: <ReportName>

Type: <string>Name of report.

<NoteDataArray>

Type: ArrayArray(“NAME:<NoteDataName>”, <NoteArray>)

12-4 Reporter Editor Script Commands

Page 183: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

<NoteDataName>

Type: String<NoteArray>

Array(“NAME:<NoteDataSourceName>”, “SourceName:=”, <SourceName>, "HaveDefaultPos:=", <boolean>,

"DefaultXPos:=", <XPos>, "DefaultYPos:=", <YPos>,“String:=”, <Note>))

Example:

Set oModule = oDesign.GetModule("ReportSetup")

oModule.AddNote "XY Plot1", Array("NAME:NoteDataSource", Array("NAME:NoteDataSource", "SourceName:=", "Note1",

"HaveDefaultPos:=", true, "DefaultXPos:=", 1996, "DefaultYPos:=", _ 3177, "String:=", "This is a note"))

AddTracesUse: Creates a new trace and adds it to the specified report.Command: Modify Report>Add TraceSyntax: AddTraces <ReportName>, <SolutionName>,

<SimulatedValueContextArray>, <PointSetDefinitionArray>, <TracesExpressionsArray>, <ExtendedTraceInformationArray>

Return Value: NoneParameters: <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"

<SimulatedValueContextArray>

Type: Array of stringsContext for which the expression is being evaluated. This can be an empty string if there is no context.Array(“Domain:=”, <DomainType>)

<DomainType>

Reporter Editor Script Commands 12-5

Page 184: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

ex. “Sweep” or “Time”Array(“Context:=”, <GeometryType>)

<GeometryType> ex. “Infinite Spheren”, “Spheren”, “Polylinen”

<FamiliesArray>

Type: Array of stringsContains 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 stringsThis array contains the report quantity and X, Y, and (Z) axis definitions.Array(“X Component:=”, <VariableName>, “Y Component:=”, <Variable-Name> | <ReportQuantityArray>)

<ReportQuantityArray>ex. Array(“dB(S(Port1, Port1))”)

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

ClearAllMarkersUse: Clears all markers from a report.Command: Report2d>Markers>ClearAllMarkersSyntax: ClearAllMarkers <ReportName>

12-6 Reporter Editor Script Commands

Page 185: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Return Value: NoneParameters: <ReportName>

Type: <string>Name of Report.

Example: oModule.ClearAllMarkers "XY Plot 1"

CopyTracesDataUse: Copy trace data for a paste operation.Command: Select a trace in the Project tree, right-click and select Copy DataSyntax: CopyTracesData <ReportName> <TracesArray>)

Return Value: NoneParameters: <ReportName>

Type: <string>Name of Report.

<TracesArray>

Type: Array of StringsTrace definitions from which to copy corresponding data.

Example:

oModule.CopyTracesData "XY Plot 1", Array("magforce")

CopyReportData Use: Copy all data corresponding to the specified reports.Command: Select a report in the Project tree, right-click and select Copy DataSyntax: CopyReportData <ReportsArray>

Return Value: NoneParameters: <ReportsArray>

Type: Array of stringsNames of reports from which to copy data.

Example:

oModule.CopyReportData Array("XY Plot 1")

CopyReportDefinitions Use: Copy the definition of a report for paste operations.Command: Select a report in the Project tree, right-click and select Copy DefinitionSyntax: CopyReportDefinitions <ReportsArray>

Reporter Editor Script Commands 12-7

Page 186: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Return Value: NoneParameters: <ReportsArray>

Type: Array of stringsNames of reports from which to copy the definitions.

Example:

oModule.CopyReportDefinitions Array("XY Plot 1")

CopyTraceDefinitionsUse: Copy trace definitions for a paste operation.Command: Select a trace in the Project tree, right-click and select Copy DefinitionSyntax: CopyTraceDefinitions <ReportName> <TracesArray>

Return Value: NoneParameters: <ReportName>

Type: <string>Name of Report.

<TracesArray>

Type: Array of strings.Trace definitions to copy.

Example:

oModule.CopyTraceDefinitions "XY Plot 1", Array("mag-force")

CreateReportUse: Creates a new report with a single trace and adds it to the Results branch in

the project tree. To add more traces, use the AddTraces command. To edit the display properties, use the ChangeProperty Script command.

Command: Maxwell2D or Maxwell3D>Results>Create<type> ReportSyntax: CreateReport <ReportName> <ReportType> <DisplayType>

<SolutionName> <ContextArray> <FamiliesArray><ReportDataArray>

Return Value: NoneParameters: <ReportName>

Type: <string>Name of Report.

ReportType

Possible values are:

12-8 Reporter Editor Script Commands

Page 187: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

“Matrix”.“DC R/L Fields”.“AC R/L Fields”.“C Fields”.

DisplayType

“Rectangular Plot”, “Data Table”, or “3D Rectangular Plot”.

<TraceArray>

Array("NAME:Traces",

<OneTraceArray>, <OneTraceArray>,...)

<OneTraceArray>

Array("NAME:<TraceName>,

"SolutionName:=","string",

"Context:=",”string”,

<DisplayTypeDependentData>)

<SolutionName>

Name of the solution as listed in the Traces dialog box. For example: “Setup1 : Last Adaptive”

<Context>

Context for which the output variable expression is being evaluated. This can be an empty string if there is no context.

Example: “Line1” or “”

Field reports usually require a polyline (e.g. "Line1") unless they are integrations. Q3D Extractor matrix data requires a Reduce Matrix operation(e.g. "Original").

<DisplayTypeDependentData>

This data varies according to the display type. See the examples below.

<FamiliesArray>

Type: Array of strings

Contains sweep definitions for the report.

Array(“<VariableName>:= “, <ValueArray>)

<ValueArray>

Array(“All”) or Array(“Value1”, “Value2”, ...”Valuen”)

examples of <VariableName>

Reporter Editor Script Commands 12-9

Page 188: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

“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))”)

Example: oDesign.CreateReport Array("NAME:Rept2DRectTime",_

"ReportType:=","Matrix",_

"DisplayType:=","Rectangular Plot", _

Array("NAME:Traces", _

Array("NAME:Trace1", _

“SolutionName:=", _

"Setup1 : Adaptive_2”, _

“Context:=",”Original”, _

"XComponent:=", "Pass", _

"YComponent:=", “C(Box1, Box1)",_

"YAxis:=", 1)))

CreateReportFromTemplateUse: Create a report from a report template file.

Command: Select results folder in project tree, right-click, Report Templates, select appropriate template file name.

Syntax: CreateReportFromTemplate <ReportTemplateFileName>

Return Value: NoneParameters:

<ReportTemplateFileName>

Type: stringThe report template file name.

Example:

oModule.CreateReportFromTemplate _

"C:\Program Files\Ansoft\HFSS11\userlib\ReportTem-plates\ThreePortSParams.rpt"

12-10 Reporter Editor Script Commands

Page 189: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

DeleteTracesUse: Deletes an existing traces or traces.Command: Right-click the report to delete in the project tree, and then click Delete on

the shortcut menu.Syntax: DeleteTraces(<TraceSelectionArray>)

Return Value: NoneParameters: <TraceSelectionArray>

Type: Array of stringsArray(“<ReportName>:=”, <TracesArray>, <TracesArray>,... )

<ReportName>

Type: <string>Name of Report.

<TracesArray>

Type: Array of stringsThis array contains the traces to delete within a report.Array(<Trace>, <Trace>, ...)

<Trace>

Type: string

Example:

Delete 3 traces from one report:

oModule.DeleteTraces Array("XY Plot 3:=", Array("Matrix1.MagFlux(Current1)", "Matrix1.MagFlux-Nom(Current1)", "Force1.Force_mag"))

Delete 2 traces from 2 different reports:

oModule.DeleteTraces Array("XY Plot 1:=", Array("mag-force"), "XY Plot 3:=", Array("Matrix1.Mag-Flux(Current1)"))

ExportToFile Use: From a data table or plot, generates text format, comma delimited, tab

delimited, or .dat type output files.Syntax: ExportToFile <ReportName>, <FileName>

Return Value: None

Reporter Editor Script Commands 12-11

Page 190: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Parameters: <ReportName>

Type: string<FileName>

Type: string

Example: oDesign.ExportToFile “Plot1”, “c:\report1.dat”

GetAllReportNamesUse: Gets the names of existing reports in a design.Syntax: GetAllReportNames()

Return Value: Array of report names.Parameters: None

Example: Set reportnames = oDesign.GetAllReportNames()

For Each name in reportnames

Msgbox name

Next

GetDisplayTypeUse: Get Display type of a report.Command: NoneSyntax: GetDisplayType <ReportName>

Return Value: String for display typeParameters:

<ReportName>

Type: stringThe name of report to find the display type for.

Example: Dim displayType

displayType = oModule.GetDisplayType("XY Plot 1")

.txt Post processor format file

.csv Comma-delimited data file

.tab Tab-separated file

.dat Ansoft plot data file

12-12 Reporter Editor Script Commands

Page 191: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

ImportIntoReportUse: Imports .tab, .csv, and .dat format files into a report.Command: Right-click on report name in the Project tree and select Export Data.Syntax: ImportIntoReport <ReportName>, <FileName>

Return Value: NoneParameters: <ReportName>

Type: string<FileName>

Type: stringPath and file name.

Example:

oDesign.ImportIntoReport “Plot1”, “c:\report1.dat”

PasteReportsUse: Paste Reports from clipboard.Command: Command: Select results folder in project tree, right-click, paste.

Syntax: PasteReports

Return Value: None

Parameters: None

Example: oModule.PasteReports

PasteTracesUse: Paste traces from clipboard in a report.Command: Select report in project tree, right click, paste.Syntax: PasteTraces <ReportName>

Return Value: NoneParameters:

<ReportName>

Type: string

.csv Comma-delimited data file

.tab Tab-separated file

.dat Ansoft plot data file

Reporter Editor Script Commands 12-13

Page 192: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

The name of report, where traces are to be pasted.Example: oModule.PasteTraces "Mag_Force"

DeleteAllReportsUse: Deletes all existing reports.Command: Right-click the report to delete in the project tree, and then click Delete

All Reports on the shortcut menu.Syntax: DeleteAllReports

Return Value: NoneExample: oModule.DeleteAllReports

DeleteReportsUse: Deletes an existing report or reports.Command: Right-click the report to delete in the project tree, and then click Delete on

the shortcut menu.Syntax: DeleteReports(<ReportNameArray>)

Return Value: NoneParameters: <ReportNameArray>

Type: Array of stringsExample: oModule.DeleteReports Array(“Rept2DRectFreq”)

RenameReportUse: Renames an existing report.Command: Select a report on the Project tree, right-click and select RenameSyntax: RenameReport <OldReportName>, <NewReportName>

Return Value: NoneParameters: <OldReportName>

Type: string<NewReportName>

Type: stringExample:

oModule.RenameReport "XY Plot1", "MagneticForce"

RenameTraceUse: Edit the name of an existing trace.

12-14 Reporter Editor Script Commands

Page 193: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Command: 'Right click, Rename" on trace item in project tree.Syntax: RenameTrace <ReportName>, <OldTraceName>, <NewTraceName>

Return Value: NoneParameters:

<ReportName>

Type: stringName of report, which contains the trace whose name, is to be edited.

<OldTraceName>

Type: stringOld name of trace.

<NewTraceName>

Type: stringNew name of trace.

Example:

oModule.RenameTrace "XY Plot 1", "Flux", "RotorFlux"

UpdateTracesUse: Edits traces of an existing report.Command: ’Apply Trace’ button in the Create Report dialogSyntax: UpdateTraces <ReportName>, <TraceNames>, <SolutionName>,

<SimulatedValueContextArray>, <PointSetDefinitionArray>, <TracesExpressionArray>, <ExtendedTraceInformationArray>

Return Value: NoneParameters: <ReportName>

Type: stringThe name of report, which contains traces to be edited.

<TraceNames>

Type: Array of stringsThe names of traces to be edited.

<SolutionName>

see CreateReport section<SimulatedValueContextArray>

see CreateReport section<PointSetDefinitionArray>

see CreateReport section

Reporter Editor Script Commands 12-15

Page 194: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

<TracesExpressionsArray>

see CreateReport section<ExtendedTraceInformationArray>

see CreateReport sectionExample:

oModule.UpdateTraces "XY Plot 1", Array("dB(S(Port1,Port1))"), "Setup1 : Sweep1", Array("Domain:=", _

"Sweep"), Array("Freq:=", Array("All"), "offset:=", Array("Nominal")), Array("X Component:=", _

"Freq", "Y Component:=", Array("dB(S(Port2,Port1))")), Array()

UpdateTracesContextAndSweepsUse: Edits context and sweeps of traces of an existing report.Command: 'Apply Trace' button in the Create Report dialog after selecting multiple

traces in project tree.Syntax: UpdateTracesContextAndSweeps <ReportName>, <TraceNames>,

<SolutionName>, <SimulatedValueContextArray>, <PointSetDefinitionArray>

Return Value: NoneParameters: see UpdateTraces section

Example:

oModule.UpdateTracesContextAndSweeps "S Parameters", Array("S21", "S11"), _

"Setup1 : Sweep1", Array("Domain:=", "Sweep"), Array("Freq:=", Array("8GHz", _

"8.05GHz", "8.1GHz", "8.15GHz", "8.2GHz", "8.25GHz", "8.3GHz", "8.35GHz", _

"8.4GHz", "8.45GHz", "8.5GHz", "8.55GHz", "8.6GHz", "8.65GHz", "8.7GHz", _

"8.75GHz", "8.8GHz", "8.85GHz", "8.9GHz", "8.95GHz", "9GHz"), "offset:=", Array( _

"Nominal"))

12-16 Reporter Editor Script Commands

Page 195: scriptingMaxwell_onlinehelp

13 Boundary and Excitation Module Script Commands

Boundary and excitation commands should be executed by the Boundary-Setup module.

Set oModule = oDesign.GetModule("BoundarySetup")

oModule.CommandName <args>

Boundary and Excitation Module Script Commands 13-1

Page 196: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Conventions Used in this Chapter<BoundName>

Type: string.

Name of a boundary.

<BoundNameArray>

Type: Array of strings

An array of the names in a boundary/excitation group.

<AssignmentObjects>

Type: Array of strings.

An array of object names.

<AssignmentFaces>

Type: Array of integers.

An array of face IDs. The ID of a face can be deter-mined through the user interface using the Modeler>Mea-sure>Area command. The face ID is given in the Measure Information dialog box.

<LineEndPoint>

Array(<double>, <double>, <double>)

<CoordSysArray>

Array("NAME:CoordSysVector",

"Origin:=", <CoordSysPoint>,

"UPos:=", <LineEndPoint>)

13-2 Boundary and Excitation Module Script

Page 197: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

General Commands Recognized by the Boundary/Excitation ModuleFollowing are general script commands recognized by the BoundarySetup module:• DeleteBoundaries• DeleteAllBoundaries• DeleteAllExcitations• GetBoundaries• GetBoundariesOfType• GetBoundaryAssignment• GetNumBoundaries• GetNumBoundariesOfType• GetExcitations• GetExcitationsOfType• GetNumExcitations• GetNumExcitationsOfType• RenameBoundary• ReassignBoundary• ReprioritizeBoundaries

DeleteBoundariesUse: Deletes the specified boundaries and excitations.Command: Delete command in the Design List dialog box. (Click Maxwell3D or

Maxwell2D>List to open the Design List dialog box.)Syntax: DeleteBoundaries <NameArray>

Return Value: NoneParameters: <NameArray>

Type: Array of strings

An array of boundary names.

Example: oModule.DeleteBoundaries Array("Net1", "Source1")

DeleteAllBoundariesUse: Deletes all boundaries.Command: Maxwell3D or Maxwell2D>Boundaries>Delete AllSyntax: DeleteAllBoundaries

Return Value: NoneExample: oModule.DeleteAllBoundaries

Boundary and Excitation Module Script Commands 13-3

Page 198: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

DeleteAllExcitationsUse: Deletes all excitations.Command: Maxwell3D or Maxwell2D>Excitations>Delete AllSyntax: DeleteAllExcitations

Return Value: NoneExample: oModule.DeleteAllExcitations

GetBoundariesUse: Gets boundary names for a project.Command: NoneSyntax: GetBoundaries()

Return Value: Array of boundary names.Parameters: None

Example: bndinfo_array = oModule.GetBoundaries()

GetBoundariesOfTypeUse: Gets boundary names of the given type.Command: NoneSyntax: GetBoundariesOfType(<BoundaryType>)

Return Value: Array of boundary names of the given type.Parameters: <BoundaryType>

Type:<string>

Name of legal boundary type.

For example: "Radiation"

Example: bndname_array = oModule.GetBoundariesOfType("Perfect E")

GetBoundaryAssignmentUse: Gets a list of face IDs associated with the given boundary or excitation

assignment.Command: NoneSyntax: GetBoundaryAssignment(<BoundaryName>)

Return Value: Returns integer array of face IDs.Parameters: <BoundaryName>

Type:<string>

13-4 Boundary and Excitation Module Script

Page 199: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Previously defined boundary or excitation name.

Example: list = oModule.GetBoundaryAssignment("Rad1")

GetNumBoundariesUse: Gets the number of boundaries in a design.Command: NoneSyntax: GetNumBoundaries()

Return Value: Integer countParameters: None

Example: numbound = oModule.GetNumBoundaries()

GetNumBoundariesOfTypeUse: Gets the number of boundaries of the given type.Command: NoneSyntax: GetNumBoundariesOfType(<BoundaryType>)

Return Value: Integer countParameters: <BoundaryType>

Type:<string>

Example: numbound = oModule.GetNumBoundariesOfType("Perfect E")

GetExcitationsUse: Gets excitation port and terminal names for a model.Command: NoneSyntax: 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

Example: excite_name_array = oModule.GetExcitations()

GetExcitationsOfTypeUse: Gets excitation names of the given type.Command: NoneSyntax: GetExcitationsOfType(<ExcitationType>)

Return Value: Array of excitation names of the given type.Parameters: <ExcitationType>

Boundary and Excitation Module Script Commands 13-5

Page 200: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Type:<string>

Name of legal excitation type.

For example: "Plane Incident Wave".

Example: excite_name_array = oModule.GetExcitationsOfType("Wave Port")

GetNumExcitationsUse: Gets the number of excitations in a design, including all defined modes and

terminals of ports.Command: NoneSyntax: GetNumExcitations()

Return Value: Integer countParameters: None

Example: numexcite = oModule.GetNumExcitations()

GetNumExcitationsOfTypeUse: Gets the number of excitations of the given type, including all defined

modes and terminals of ports.Command: NoneSyntax: GetNumExcitationsOfType(<ExcitationType>)

Return Value: Integer countParameters: <ExcitationType>

Type:<string>

Example: numexcite = oModule.GetNumExcitationsOfType("Voltage")

RenameBoundaryUse: Renames a boundary or excitation.Command: Right-click a boundary/excitation in the project tree, and then click

Rename from the shortcut menu.Syntax: RenameBoundary <OldName>, <NewName>

Return Value: NoneParameters: <OldName>

Type: <string>

<NewName>

Type: <string>

Example: oModule.RenameBoundary "Bound1" "Bound2"

13-6 Boundary and Excitation Module Script

Page 201: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

ReassignBoundaryUse: Specifies a new geometry assignment for a boundary.Command: Select Maxwell3D or Maxwell2D>Excitations>Reassign or select

Maxwell3D or Maxwell2D>Boundaries>ReassignSyntax: ReassignBoundary Array("Name:<BoundName>",

"Objects:=", <AssignmentObjects>,

"Faces:=", <AssignmentFaces>)

Return Value: NoneExample: oModule.ReassignBoundary Array("NAME:Net1",_

"Objects:=", Array("Box2", "Box3"),_

"Objects:=", Array("Box3", "Box4"))

ReprioritizeBoundaries Use: Specifies the order that the boundaries are sent to the solver. The first

boundary in the list has the highest priority.

Command: Maxwell3D or Maxwell2D>Boundaries>ReprioritizeSyntax: ReprioritizeBoundaries <NewOrderArray>

Return Value: NoneParameters: <NewOrderArray>

Array("NAME:NewOrder", <BoundName>, <BoundName>, ...)

Example: oModule.ReprioritizeBoundaries Array("NAME:NewOrder",_ "Symmetry1", "Insulating1")

Note This command is only valid if all boundaries appear in the list.

Boundary and Excitation Module Script Commands 13-7

Page 202: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Script Commands for Creating and Modifying BoundariesFollowing are script commands for creating and editing boundaries that are recognized by the BoundarySetup module:

• AssignZeroTangentialHField• EditZeroTangentialHField• AssignInsulating• EditInsulating• AssignSymmetry• EditSymmetry• AssignMaster• EditMaster• AssignSlave• EditSlave• AssignRadiation• EditRadiation• AssignImpedance• EditImpedance• AssignTangentialHField• EditTangentialHField• AssignCylindricalHField• EditCylindricalHField

AssignZeroTangentialHFieldUse: Creates a zero tangential H-Field boundary.Command: Maxwell>Boundaries>Assign>Zero Tangential H FieldSyntax: AssignZeroTangentialHField <ZeroTangentialHFieldArray>

Return Value: NoneParameters: <ZeroTangentialHFieldArray>

Array("NAME:<BoundName>",

"Objects:=", <AssignmentObjects>,

"Faces:=", <AssignmentFaces>)

Example: oModule.AssignZeroTangentialHField Array("NAME:ZeroTangentialHField1", "Faces:=", Array(7))

Note In the following commands, all named data can be included/excluded as desired and may appear in any order.

13-8 Boundary and Excitation Module Script

Page 203: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

EditZeroTangentialHFieldUse: Edits a zero tangential H-Field boundary.Command: Double-click the boundary in the project tree to edit it.Syntax: EditZeroTangentialHField <BoundName>, <PerfectEArray>

Return Value: None

AssignSymmetryUse: Creates a symmetry boundary.Command: Maxwell3D or Maxwell2D>Boundaries>Assign>SymmetrySyntax: AssignSymmetry <SymmetryArray>

Return Value: NoneParameters: <SymmetryArray>

Array( "NAME:<BoundName>",

"IsOdd:=",<bool>,//true for odd, false for even

"Objects:=", <AssignmentObjects>,

"Faces:=", <AssignmentFaces>)

Example: oModule.AssignSymmetry Array("NAME:Symmetry1", _ "IsOdd:=", true, "Faces:=", Array(35))

EditSymmetryUse: Edits a symmetry boundary.Command: Double-click the boundary in the project tree to edit it.Syntax: EditSymmetry <BoundName> < SymmetryArray >

Return Value: None

AssignInsulatingUse: Creates an insulating boundary.Command: Maxwell3D>Boundaries>Assign>InsulatingSyntax: AssignInsulating <InsulatingArray>

Return Value: NoneParameters: <InsulatingArray>

Array("Name:<BoundName>",

"Objects:=", <AssignmentObjects>,

"Faces:=", <AssignmentFaces>)

Boundary and Excitation Module Script Commands 13-9

Page 204: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Example: oModule.AssignInsulating Array("NAME:Insulating2", _ "Faces:=", Array(7))

EditInsulatingUse: Edits an insulating boundary.Command: Double-click the boundary in the project tree to edit it.Return Value: EditInsulating <BoundName> <InsulatingArray>Return Value: None

AssignMasterUse: Creates a master boundary.Command: Maxwell3D or Maxwell2D>Boundaries>Assign>MasterSyntax: AssignMaster <MasterArray>

Return Value: NoneParameters: <MasterArray>

Array("NAME:<BoundName>",

<CoordSysArray>,

"ReverseV:=", <bool>,

"Faces:=", <AssignmentFaces>)

Example: oModule.AssignMaster Array("NAME:Master1", _ Array("NAME:CoordSysVector", "Origin:=", _ Array("1.6mm", "1.2mm", "0mm"), "UPos:=", _ Array("1.6mm", "1.2mm", "1mm")), "ReverseV:=", true, _ "Faces:=", Array(68))

EditMasterUse: Edits a master boundary.Command: Double-click the boundary in the project tree to edit it.Syntax: Edit <BoundName> <MasterArray>

Return Value: None

AssignSlaveUse: Creates a slave boundary.Command: Maxwell3D or Maxwell2D>Boundaries>Assign>SlaveSyntax: AssignSlave <SlaveArray>

Return Value: None

13-10 Boundary and Excitation Module Script

Page 205: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Parameters: <SlaveArray>

Array("NAME:<BoundName>",

<CoordSysArray>,

"ReverseV:=", <bool>,

"Master:=", <string>,

"RelationIsSame:=", <bool>,//true for Hs = Hm

"Objects:=", <AssignmentObjects>,

"Faces:=", <AssignmentFaces>)

Example: oModule.AssignSlave Array("NAME:Slave1", _ Array("NAME:CoordSysVector", "Origin:=", _ Array( "1.6mm", "1.2mm", "0mm"), "UPos:=", _ Array("1.6mm", "1.2mm", "1mm")), "ReverseV:=", _ false, "Master:=", "Master1", "RelationIsSame:=", _ false, "Faces:=", Array(67))

EditSlaveUse: Edits a slave boundary.Command: Double-click the boundary in the project tree to edit it.Syntax: EditSlave <BoundName> <SlaveArray>

Return Value: None

AssignRadiationUse: Creates a radiation boundary.Command: Maxwell3D>Boundaries>Assign>RadiationSyntax: AssignRadiation <RadiationArray>

Return Value: NoneParameters: <RadiationArray>

Array("NAME:<BoundName>",

"Objects:=", <AssignmentObjects>,

"Faces:=", <AssignmentFaces>)

Example: oModule.AssignRadiation Array("NAME:Radiation1", _ "Faces:=", Array(12, 11))

EditRadiationUse: Edits a radiation boundary.Command: Double-click the boundary in the project tree to edit it.

Boundary and Excitation Module Script Commands 13-11

Page 206: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Syntax: EditRadiation <BoundName> <RadiationArray>

Return Value: None

AssignImpedanceUse: Creates an impedance boundary.Command: Maxwell3D or Maxwell2D>Boundaries>Assign>ImpedanceSyntax: AssignImpedance <ImpedanceArray>

Return Value: NoneParameters: <ImpedanceArray>

Array("NAME:<BoundName>",

"Conductivity:=",<value>,

"Resistance:=", <value>,

"Permeability:=", <value>,

"Objects:=", <AssignmentObjects>,

"Faces:=", <AssignmentFaces>)

Example: oModule.AssignImpedance Array("NAME:Impedance1", _ "Conductivity:=", "1", "Permeability:=", "2", _ "Faces:=", Array(7, 12))

EditImpedanceUse: Edits an impedance boundary.Command: Double-click the boundary in the project tree to edit it.Syntax: EditImpedance <BoundName> <ImpedanceArray>

Return Value: None

AssignTangentialHFieldUse: Creates an H-Field boundary on a planar face.Command: Maxwell3D>Boundaries>Assign>Tangential H FieldSyntax: AssignTangentialHField <TangentialHFieldArray>

Return Value: NoneParameters: <TangentialHFieldArray>

Array("NAME:<BoundName>",

"ComponentXReal:=", <value>,

"ComponentXImg:=", <value>,

"ComponentYReal:=", <value>,

13-12 Boundary and Excitation Module Script

Page 207: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"ComponentYImg:=", <value>,

<CoordSysArray>

"ReverseV:=", <bool>,

"Objects:=", <AssignmentObjects>,

"Faces:=", <AssignmentObjects>)

Example: oModule.AssignTangentialHField Array("NAME:TangentialHField2", "ComponentXReal:=", _ "1", "ComponentXImg:=", "2", "ComponentYReal:=", "3", _ "ComponentYImg:=", "4", Array("NAME:CoordSysVector", _ "Origin:=", Array( "-0.4mm", "-1.4mm", "1mm"), "UPos:=", _ Array("-0.4mm", "-0.8mm", "1mm")), "ReverseV:=", true, _ "Faces:=", Array(7))

EditTangentialHFieldUse: Edits a tangential H-Field boundary.Command: Double-click the boundary in the project tree to edit it.Syntax: EditTangentialHField <BoundName> <TangentialHFieldArray>

Return Value: None

AssignCylindricalHFieldUse: Creates an H-Field boundary on a cylindrical face.Command: Maxwell>Boundaries>Assign>Tangential H FieldSyntax: AssignCylindricalHField <CylindricalHFieldArray>

Return Value: NoneParameters: <CylindricalHFieldArray>

Array("NAME:<BoundName>",

"ComponentPhiReal:=", <value>,

"ComponentPhiImg:=", <value>,

"ComponentZReal:=", <value>,

"ComponentZImg:=", <value>,

"ReverseZ:=", <bool>,

"Origin:=", <LineEndPoint>)

"Objects:=", <AssignmentObjects>,

"Faces:=", <AssignmentObjects>)

Example: oModule.AssignCylindricalHField Array("NAME:TangentialHField4", "ComponentPhiReal:=", _

Boundary and Excitation Module Script Commands 13-13

Page 208: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"1", "ComponentPhiImg:=", "2", "ComponentZReal:=", "3", _ "ComponentZImg:=", "4", "ReverseZ:=", false, _ "ReferencePosDefined:=", true, "Origin:=", _ Array("1.36568542494924mm", "0.6mm", "0mm"), _ "Faces:=", Array(75))

EditCylindricalHFieldUse: Edits a cylindrical H-Field boundary.Command: Double-click the boundary in the project tree to edit it.Syntax: EditCylindricalHField <BoundName>

<CylindricalHFieldArray>

Return Value: None

13-14 Boundary and Excitation Module Script

Page 209: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Script Commands for Creating and Modifying ExcitationsFollowing are script commands for creating and editing excitations that are recognized by the BoundarySetup module:

• AssignVoltage• AssignVoltageGroup• EditVoltage• AssignVoltageDrop• AssignVoltageDropGroup• EditVoltageDrop• AssignCurrentDensity• AssignCurrentDensityGroup• EditCurrentDensity• AssignCurrentDensityTerminal• AssignCurrentDensityTerminalGroup• EditCurrentDensityTerminal• AssignCurrent• AssignCurrentGroup• EditCurrent• AssignFloating• EditFloating• AssignCharge• EditCharge• AssignVolumeChargeDensity• EditVolumeChargeDensity• AssignCoilTerminal• AssignCoilTerminalGroup• EditCoilTerminal• AssignSink• EditSink

AssignVoltageUse: Creates a voltage excitation.Command: Maxwell>Excitations>Assign>VoltageSyntax: AssignVoltage <SourceArray>

Return Value: None

Note In the following commands, all named data can be included/excluded as desired and may appear in any order.

Boundary and Excitation Module Script Commands 13-15

Page 210: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Parameters: <SourceArray>

Array(“NAME:<SourceName>”,

“Faces:=”, <AssignmentFaces>)

Example: oModule.AssignVoltage Array("NAME:Source1",_

"Faces:=", Array(12))

AssignVoltageGroupUse: Creates a group of voltage excitations. The size of the bound name array

must be identical to the size of assignment. This command is not supported for the Electric solution types.

Command: Maxwell>Excitations>Assign>VoltageSyntax: AssignVoltageGroup <BoundNameArray> <VoltageArray>

Return Value: NoneExample: oModule.AssignVoltageGroup Array("VoltageSrc2_1", _

"VoltageSrc2_2"), Array("NAME:VoltageSrc2_1", _ "Voltage:=", "0V", "Faces:=", Array(12, 11))

EditVoltageUse: Edits a voltage excitation.Command: Double-click the excitation in the project tree to edit it.Syntax: EditVoltage <BoundName> <VoltageArray>

Return Value: None

AssignVoltageDropUse: Creates a voltage drop excitation.Command: Maxwell>Excitations>Assign>Voltage DropSyntax: AssignVoltageDrop <VoltageDropArray>

Return Value: NoneParameters: <VoltageDropArray>

Array("NAME:<BoundName>",

"Voltage Drop:=", <value>,

"Point out of terminal:=", <bool>,

"Objects:=", <AssignmentObjects>,

"Faces:=", <AssignmentFaces>)

13-16 Boundary and Excitation Module Script

Page 211: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Example: oModule.AssignVoltageDrop Array("NAME:VoltageDrop1", _ "Voltage Drop:=", "1kV", "Point out of terminal:=", _ true, "Faces:=", Array(7))

AssignVoltageDropGroupUse: Creates a group of voltage drop excitations.Command: Maxwell>Excitations>Assign>Voltage DropSyntax: AssignVoltageDropGroup <BoundNameArray>

<VoltageDropArray>

Return Value: None

EditVoltageDropUse: Edits a voltage drop excitation.Command: Double-click the excitation in the project tree to edit it.Syntax: EditVoltageDrop <BoundName> <VoltageDropArray>

Return Value: None

AssignCurrentDensityUse: Creates a current density excitation.Command: Maxwell>Excitations>Assign>Current DensitySyntax: AssignCurrentDensity <CurrentDensityArray>

Return Value: NoneParameters: <CurrentDensityArray>

Array("NAME:<BoundName>",

"CurrentDensityX:=", <value>,

"Phase:=", <value>,//for eddy current solution type

"CurrentDensityY:=", <value>,

"CurrentDensityZ:=", <bool>,

"CoordinateSystem Name:=", <string>,

"CoordinateSystem Type:=", <string>,

"Objects:=", <AssignmentObjects>)

Example: oModule.AssignCurrentDensity Array("NAME:CurrentDensity1", "CurrentDensityX:=", _ "1", "CurrentDensityY:=", "2", "CurrentDensityZ:=", _ "3", "CoordinateSystem Name:=", "Global", _

Boundary and Excitation Module Script Commands 13-17

Page 212: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"CoordinateSystem Type:=", "Cartesian", "Objects:=", _ Array("Box1"))

Example: oModule.AssignCurrentDensity Array("NAME:CurrentDensity1", "Phase:=", "12", _ "CurrentDensityX:=", "1", "CurrentDensityY:=", _ "2", "CurrentDensityZ:=", "3", _ "CoordinateSystem Name:=", "Global", "CoordinateSystem Type:=", "Cartesian", "Objects:=", _ Array("Box1"))

AssignCurrentDensityGroupUse: Creates a group of current density excitations.Command: Maxwell>Excitations>Assign>Current DensitySyntax: AssignCurrentDensityGroup <BoundNameArray>

<CurrentDensityArray>

Return Value: None

EditCurrentDensityUse: Edits a current density excitation.Command: Double-click the excitation in the project tree to edit it.Syntax: EditCurrentDensity <BoundName> <CurrentDensityArray>

Return Value: None

AssignCurrentDensityTerminalUse: Creates a current density terminal excitation.Command: Maxwell>Excitations>Assign>Current Density TerminalSyntax: AssignCurrentDensityTerminal

<CurrentDensityTerminalArray>

Return Value: NoneParameters: <CurrentDensityTerminalArray>

Array("Name:<BoundName>",

"Objects:=", <AssignmentObjects>,

"Faces:=", <AssignmentFaces>)

Example: oModule.AssignCurrentDensityTerminal Array("NAME:CurrentDensityTeminal1", "Faces:=", Array(7))

13-18 Boundary and Excitation Module Script

Page 213: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

AssignCurrentDensityTerminalGroupUse: Creates a group of current density terminal excitations.Command: Maxwell>Excitations>Assign>Current Density TerminalSyntax: AssignCurrentDensityTerminalGroup <BoundNameArray>

<CurrentDensityTerminalArray>

Return Value: None

EditCurrentDensityTerminalUse: Edits a current density terminal excitation.Note: Double-click the excitation in the project tree to edit it.Syntax: EditCurrentDensityTerminal <BoundName>

<CurrentDensityTerminalArray>

Return Value: None

AssignCurrentUse: Creates a current excitation.Command: Maxwell>Excitations>Assign>CurrentSyntax: AssignCurrent <SourceArray>

Return Value: NoneParameters: <SourceArray>

Array("NAME:<SourceName>",

"Faces:=", <AssignmentFaces>)

Example: oModule.AssignCurrent Array("NAME:Source1",_

"Faces:=", Array(12))

AssignCurrentGroupUse: Creates a group of current excitations.Command: Maxwell>Excitations>Assign>CurrentSyntax: AssignCurrentGroup <BoundNameArray> <CurrentArray>

Return Value: None

EditCurrentUse: Edits a current excitation.Command: Double-click the excitation in the project tree to edit it.Syntax: EditCurrent <BoundName> <CurrentArray>

Boundary and Excitation Module Script Commands 13-19

Page 214: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Return Value: None

AssignFloatingUse: Creates a floating excitation.Command: Maxwell>Boundaries>Assign>FloatingSyntax: AssignFloating <FloatingArray>

Return Value: NoneParameters: <FloatingArray>

Array("NAME:<BoundName>",

"Value:=", <value>,

"Objects:=", <AssignmentObjects>,

"Faces:=", <AssignmentFaces>)

Example: oModule.AssignFloating Array("NAME:Floating1", _ "Value:=", "1", "Faces:=", Array(11))

EditFloatingUse: Edits a floating excitation.Command: Double-click the excitation in the project tree to edit it.Syntax: EditFloating <BoundName> <FloatingArray>

Return Value: None

AssignChargeUse: Creates a charge excitation.Command: Maxwell>Excitations>Assign>ChargeSyntax: AssignCharge <ChargeArray>

Return Value: NoneParameters: <ChargeArray>

Array("NAME:<BoundName>",

"Value:=", <value>,

"Objects:=", <AssignmentObjects>,

"Faces:=", <AssignmentFaces>)

Example: oModule.AssignCharge Array("NAME:Charge1", "Value:=", _ "1", "Faces:=", Array(11))

13-20 Boundary and Excitation Module Script

Page 215: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

EditChargeUse: Edits a charge excitation.Command: Double-click the excitation in the project tree to edit it.Syntax: EditCharge <BoundName> <ChargeArray>

Return Value: None

AssignVolumeChargeDensityUse: Creates a volume charge density excitation.Command: Maxwell>Excitations>Assign>Volume Charge DensitySyntax: AssignVolumeChargeDensity <VolumeChargeDensityArray>

Return Value: NoneParameters: <VolumeChargeDensityArray>

Array("NAME:<BoundName>",

"Value:=", <value>,

"CoordinateSystem :=", <string>,

"Objects:=", <AssignmentObjects>)

Example: oModule.AssignVolumeChargeDensity Array("NAME:VolumeChargeDenstiy1", "Value:=", "1", _ "CoordinateSystem:=", "", "Objects:=", Array("Box1"))

Example: oModule.AssignVolumeChargeDensity Array("NAME:x", _ "Value:=", "y", "CoordinateSystem:=", "Global", _ "Objects:=", Array("Box2"))

EditVolumeChargeDensityUse: Edits a volume charge density excitation.Command: Double-click the excitation in the project tree to edit it.Syntax: EditVolumeChargeDensity <BoundName>

<VolumeChargeDensityArray>

Return Value: None

AssignCoilTerminalUse: Assigns 2D terminalsCommand: Maxwell>Excitations>Assign>Coil TerminalSyntax: AssignCoilTerminal <TerminalArray>

Parameters: <TerminalArray>

Array("NAME:AssignTerminals",

Boundary and Excitation Module Script Commands 13-21

Page 216: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Array("Name:SourceList", Array("Name:<SourceName>",

"Excitation:=", <NetObject>, "Objects:=", <Assignment 2D>)),

Array("Name:SinkList", Array("Name:<SinkName>",

"Excitation:=", <NetObject>, "Objects:=", <Assignment 2D>)),

"Name:DeleteList", <Name Array>)

Return Value: NoneExample: OModule.Assign2DTerminals Array("NAME:AssignTerminals",

Array("NAME:SourceList", Array("NAME:Source2", "Net:=",_ "Box2", "Objects:=", Array("Rectangle1"))), _ Array("NAME:SinkList", Array("NAME:Sink1", "Net:=", _ "Box1", "Objects:=", Array("Rectangle2"))), _ "DeleteList:=", "")

oModule.AssignPerfectH Array("NAME:PerfH1", "Faces:=", _ Array(12))

AssignCoilTerminalGroupUse: Creates a group of coil terminal excitations.Command: Maxwell>Excitations>Assign>Coil TerminalSyntax: AssignCoilTerminal <BoundNameArray> <CoilTerminalArray>

Return Value: None

EditCoilTerminalUse: Edits a coil terminal excitation.Command: Double-click the excitation in the project tree to edit it.Syntax: EditCoilTerminal <BoundName> <CoilTerminalArray>

Return Value: None

AssignSinkUse: Creates a sink.Command: Maxwell>Excitations>Assign>SinkSyntax: AssignSink <SinkArray>

Return Value: NoneParameters: <SinkArray>

Array("NAME:<SinkName>",

"Faces:=", <AssignmentFaces>)

13-22 Boundary and Excitation Module Script

Page 217: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Example: oModule.AssignSink Array("NAME:Sink1",_ "Faces:=", Array(12))

EditSinkUse: Edits a sink excitation.Command: Double-click the excitation in the project tree to edit it.Syntax: EditSink <BoundName> <SinkArray>

Return Value: None

Boundary and Excitation Module Script Commands 13-23

Page 218: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Other BoundarySetup Module Script CommandsFollowing are additional script commands that are recognized by the BoundarySetup module:

• AssignWindingGroup• EditWindingGroup• AddTerminalsToWinding• EditExternalCircuit• SetCoreLoss• SetEddyEffect• SetMinimumTimeStep

AssignWindingGroupUse: Creates a winding group.Command: Maxwell>Excitations>Add WindingSyntax: AssignWindingGroup <WindingGroupArray >

Return Value: NoneParameters:

<WindingGroupArray>

Array("NAME:<BoundName>",

"Type:=",<WindingType>,

"IsSolid:=", <bool>, //true for solid, false for stranded

"Current:=", <value>,

"Resistance:=", <value>,

"Inductance:=", <value>,

"Voltage:=", <value>,

)

Example:oModule.AssignWindingGroup Array("NAME:Winding1", _ "Type:=", "Voltage", "IsSolid:=", _false, _ "Current:=", "4A", "Resistance:=", "5Ohm", _ "Inductance:=", "6mH", "Voltage:=", "7V")

Example: oModule.AssignWindingGroup Array("NAME:Winding2", _ "Type:=", "Current", "IsSolid:=", false, "Current:=", _

Note In the following commands, all named data can be included/excluded as desired and may appear in any order.

13-24 Boundary and Excitation Module Script

Page 219: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"1A", "Resistance:=", "0Ohm", "Inductance:=", "0mH", _ "Voltage:=", "0V")

Example: oModule.AssignWindingGroup Array("NAME:Winding3", _ "Type:=", "External", "IsSolid:=", true, "Current:=", _ "1A", "Resistance:=", "0Ohm", "Inductance:=", "0mH", _ "Voltage:=", "0V")

EditWindingGroupUse: Edits a winding group.Command: Double-click the winding group item in the project tree to edit it.Syntax: EditWindingGroup <BoundName> <WindingGroupArray>

Return Value: None

AddTerminalsToWindingUse: Adds existing terminal(s) to the selected winding.Command: Right-click a winding item in the project tree, and then select Add

Terminals.Syntax: AddTerminalsToWinding <AddTerminalsToWindingArray>

Return Value: NoneParameters: < AddTerminalsToWindingArray >

Array(" NAME:AddTerminalsToWinding", <BoundListArray>)

<BoundListArray> Array("NAME:BoundaryList",<CoilTermi-nalArray>)

Example:oModule.AddTerminalstoWinding Array("NAME:AddTerminalsToWinding", _ Array("NAME:BoundaryList", Array("NAME:CoilTerminal1", _ "Point out of terminal:=", false, "Conductor number:=", _ "1", "Winding:=", "Winding1", "Faces:=", Array(12)), _ Array("NAME:CoilTerminal2", "Point out of terminal:=", _ false, "Conductor number:=", "1", "Winding:=", _"Winding1", "Faces:=", Array(7))))

EditExternalCircuitUse: Edits the external circuit for the winding. The SourceNameArray and

SourceTypeArray parameters must be of the same size and be a one-to-one match.

Command: Maxwell>Excitations>External Circuit>Edit External Circuit

Boundary and Excitation Module Script Commands 13-25

Page 220: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Syntax: EditExternalCircuit <fileName> <SourceNameArray> <SourceTypeArray>

Return Value: NoneParameters: <SourceNameArray> Array(<string>)

<SourceTypeArray> Array(<srcTypeEnum>)<srcTypeEnum> 1- Time dependent 2-Position dependent 3- Speed dependent

Example: oModule.EditExternalCircuit "C:\TestProjects\Tdslink\extnlckt00.ckt", Array("VC1", _"VSA1_0", "VSA1_1", "VSA1_2"), Array(1, 2, 1, 3)

SetCoreLossUse: Turns on the core loss effect. Please list all the objects that need to turn on

the core loss effect. If an object is not in the list, then it is treated as core loss effect "off". This setting only takes effect if the object has the corresponding core loss definition in the material library.

Command: Maxwell>Excitation>Set Core LossSyntax: SetCoreLoss <ObjectNameArray>

Return Value: NoneParameters: < ObjectNameArray >

Array("<objectName>"), <bool>, //true to apply core loss effect on field, false means do not apply core loss effect. Default is false.

<objectName> string

Example: oModule.SetCoreLoss Array("Box1", "Box2"), true

SetEddyEffectUse: Sets the eddy effect for an excitation.Command: Maxwell>Excitations>Set Eddy EffectsSyntax: SetEddyEffect <EddyEffectSettingArray>

Return Value: NoneParameters:

<EddyEffectSettingArray>

Array("NAME:Eddy Effect Setting", <EddyEffectVectorAr-ray>)

<EddyEffectVectorArray>

Array("NAME:EddyEffectVector", Array<EddyEffectDataAr-ray>)

13-26 Boundary and Excitation Module Script

Page 221: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

<EddyEffectDataArray>

Array(("NAME:Data",

"Object Name:=", <string>,

"Eddy Effect:=", <bool>,

"DisplacementCurrent:=", <bool>)

Example:oModule.SetEddyEffect Array("NAME:Eddy Effect Setting", _Array("NAME:EddyEffectVector", Array("NAME:Data", _"Object Name:=", "Box1", "Eddy Effect:=", true, _"Displacement Current:=", true), Array("NAME:Data", _"Object Name:=", "Box1_1", "Eddy Effect:=", true, _"Displacement Current:=", false)))

Example: oModule.SetEddyEffect Array("NAME:Eddy Effect Setting", _Array("NAME:EddyEffectVector", Array("NAME:Data", _"Object Name:=", "Box1", "Eddy Effect:=", true), _Array("NAME:Data", "Object Name:=", "Box1_1", _"Eddy Effect:=", false)))

SetMinimumTimeStepUse: Sets the minimum time step for an external circuit excitation.Command: Maxwell>Excitations>External Circuit>Set Minimum Time StepSyntax: SetMinimumTimeStep <value>

Return Value: NoneParameters: None

Example: oModule.SetMinimumTimeStep "1ps"

Boundary and Excitation Module Script Commands 13-27

Page 222: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

13-28 Boundary and Excitation Module Script

Page 223: scriptingMaxwell_onlinehelp

14 Mesh Operations Module Script Commands

Mesh setup and operations commands should be executed by the Mesh-Setup module.

Set oModule = oDesign.GetModule("MeshSetup")

oModule.CommandName <args>

Mesh Operations Module Script Commands 14-1

Page 224: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Conventions Used in the Mesh Operations Chapter<OpName>

Type: <string>

Name of a mesh operation.

<AssignmentObjects>

Type: Array of strings

An array of object names.

<AssignmentFaces>

Type: Array of integers.

An array of face IDs. The ID of a face can be deter-mined through the user interface using the Modeler>Mea-sure>Area command. The face ID is given in the Measure Information dialog box.

14-2 Mesh Operations Module Script Commands

Page 225: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

General Commands Recognized by the Mesh Operations ModuleFollowing are general script commands recognized by the MeshSetup module:• DeleteOp • GetOperationNames • RenameOp

DeleteOpUse: Deletes the specified mesh operations.Command: Delete command in the List dialog box. Click Maxwell3D or Maxwell2D>List

to access the List dialog box.Syntax: DeleteOp <NameArray>

Return Value: NoneParameters: <NameArray>

Type: Array of strings.

An array of mesh operation names.

Example: oModule.DeleteOp Array("Length1", "SkinDepth1",_

"Length2")

GetOperationNamesUse: Use: Gets the names of mesh operations defined in a design.Syntax: Syntax: GetOperationNames(<OperationType>)

Return Value: Return Value: Array of mesh operation names.Parameters: <OperationType>

Type: <string>

Example: Set opnames = oModule.GetOperationNames(“Length Based”)

For Each name in opnames

Msgbox name

Next

RenameOpUse: Renames a mesh operation.Command: Right-click the mesh operation in the project tree, and then click Rename

on the shortcut menu.Syntax: RenameOp <OldName>, <NewName>

Return Value: None

Mesh Operations Module Script Commands 14-3

Page 226: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Parameters: <OldName>

Type: <string>

Old name of the mesh operation.

<NewName>

Type: <string>

New name of the mesh operation.

Example: oModule.RenameOp "SkinDepth1", "NewName"

14-4 Mesh Operations Module Script Commands

Page 227: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Script Commands for Creating and Modifying Mesh OperationsFollowing are script commands for creating and modifying mesh operations that are recognized by the MeshSetup module:

• AssignLengthOp• AssignSkinDepthOp• AssignTrueSurfOp• AssignModelResolutionOp• EditLengthOp• EditSkinDepthOp• EditTrueSurfOp• EditModelResolutionOp

AssignLengthOpUse: Assigns length-based operations to the selection.Command: Maxwell3D or Maxwell2D>Mesh Operations>Assign>On Selection>Length

Based or Maxwell3D or Maxwell2D>Mesh Operations>Assign>Inside Selection>Length Based

Syntax: AssignLengthOp <LengthOpParams>

Return Value: NoneParameters: <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.

Note In the following commands, all named data can be included/excluded as desired and may appear in any order.

Mesh Operations Module Script Commands 14-5

Page 228: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

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.

Example: Assigning length-based operations to the inside tetrahedra of an object:oModule.AssignLengthOp Array("NAME:Length1", _

"RefineInside:=", true, _

"Objects:=", Array("Box1"), _

"RestrictElem:=", true, _

"NumMaxElem:=", 1000, _

"RestrictLength:=", true, _

"MaxLength:=", "1mm")

AssignSkinDepthOpUse: Assigns a skin-depth based operation to the selection.Command: Maxwell3D or Maxwell2D>Mesh Operations>Assign>On Selection>Skin

Depth BasedSyntax: AssignSkinDepthOp <SkinDepthOpParams>

Return Value: NoneParameters: <SkinDepthOpParams>

Array("NAME:<OpName>",

"Faces:=", <AssignmentFaces>,

"RestrictElem:=", <bool>,

"NumMaxElem:=", <int>,

"SkinDepth:=", <value>,

"SurfTriMaxLength:=", <value>,

"NumLayers:=", <int>)

RestrictElem

If true, NumMaxElem should be specified.

Example: oModule.AssignSkinDepthOp Array("NAME:SkinDepth1", _

"Faces:=", Array(7), _

"RestrictElem:=", true, _

"NumMaxElem:=", 1000, _

"SkinDepth:=", "1mm", _

14-6 Mesh Operations Module Script Commands

Page 229: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"SurfTriMaxLength:=", "1mm", _

"NumLayers:=", 2)

AssignTrueSurfOpUse: Assigns a true surface-based mesh operation to the selection.Command: Maxwell3D or Maxwell2D>Mesh Operations>Assign>Surface

ApproximationSyntax: AssignTrueSurfOp <TrueSurfOpParams>

Return Value: NoneParameters: <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

Example: oModule.AssignTrueSurfOp Array("NAME:TrueSurf1", _

"Faces:=", Array(9), _

"SurfDevChoice:=", 2, _

"SurfDev:=", "0.04123105626mm", _

"NormalDevChoice:=", 2, _

"NormalDev:=", "15deg", _

"AspectRatioChoice:=", 1)

AssignModelResolutionOpUse: Assigns a model resolution name, value and unit for mesh operations.Command: Maxwell3D>Mesh Operations>Assign>Model Resolution

Mesh Operations Module Script Commands 14-7

Page 230: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Example: oModule.AssignModelResolutionOp Array("NAME:ModelResolution1", "Objects:=", Array( _ "Rectangle2"), "DefeatureLength:=", "0.3mm")

EditLengthOpUse: 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: NoneExample: oModule.EditLengthOp "Length1", Array("NAME:Length1", _

"RefineInside:=", false, _

"RestrictElem:=", false, _

"RestrictLength:=", true, _

"MaxLength:=", "2mm")

EditSkinDepthOpUse: Modifies an existing skin-depth based mesh operation. Assignments cannot

be changed using this command. To change the assignment, you must delete the 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: NoneExample: oModule.EditSkinDepthOp "SkinDepth1",

Array("NAME:SkinD",_

"RestrictElem:=", false, _

"SkinDepth:=", "2mm", _

"SurfTriMaxLength:=", "1mm", _

"NumLayers:=", 2)

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

14-8 Mesh Operations Module Script Commands

Page 231: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Return Value: NoneExample: oModule.EditTrueSurfOp "TrueSurf2", _

Array("NAME:trusurf", _

"SurfDevChoice:=", 2, _

"SurfDev:=","0.03mm", _

"NormalDevChoice:=", 1, _

"AspectRatioChoice:=", 2, _

"AspectRatio:=", 10)

EditModelResolutionOpUse: Assigns a model resolution name, value and unit for mesh operations.Command: Double-click the operation in the Project tree to modify its settings.Example: oModule.EditModelResolutionOp

Array("NAME:ModelResolution1", "Objects:=", Array( _ "Rectangle2"), "DefeatureLength:=", "0.3mm")

Mesh Operations Module Script Commands 14-9

Page 232: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

14-10 Mesh Operations Module Script Commands

Page 233: scriptingMaxwell_onlinehelp

15 Analysis Module Script Commands

Maxwell analysis setup commands should be executed by the Analysis mod-ule, referred to in Maxwell scripts as the AnalysisSetup module.

Set oModule = oDesign.GetModule("AnalysisSetup")

oModule.CommandName <args>

Analysis Module Script Commands 15-1

Page 234: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Analysis Setup Script CommandsFollowing are script commands recognized by the AnalysisSetup module:• InsertSetup• EditSetup• RenameSetup• DeleteSetups• ExportCircuit• ExportSolnData• RevertSetupToInitial• RevertAllToInitial• ResetSetupToTimeZero• ResetAllToTimeZero• GetSetups• GetSetupNames• Analyze• CopySetup• PasteSetup

InsertSetupUse: Adds a new solution setup. Command: Maxwell3D or Maxwell2D>Analysis Setup>Add Solution SetupSyntax: InsertSetup <SetupType>, <AttributesArray>

Return Value: NoneParameters:

<SetupType>

Type: <string>

Possible values for 3D designs are: "Magnetostatic", "EddyCurrent", "Transient", "Electrostatic", "DCCon-duction", "ElectroDCConduction", and "ElectricTransient".

Possible values for 2D designs are: "Magnetostatic", "EddyCurrent", "Transient", "Electrostatic", "ACConduction", "DCConduction".

<AttributesArray>Array("NAME:<SetupName>", <NamedParameters>)

<NamedParameters>The named parameters vary according to the setup type. Please see the specific examples below for each solution type.

15-2 Analysis Module Script Commands

Page 235: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Example:3D Magnetostatic solve setup:

oModule.InsertSetup "Magnetostatic", Array("NAME:Setup1", _

"MaximumPasses:=", 10, _"MinimumPasses:=", 2, _"MinimumConvergedPasses:=", 1, _"PercentRefinement:=", 30, _"SolveFieldOnly:=", false, _"PercentError:=", 1, _"SolveMatrixAtLast:=", true, _"UseOutputVariable:=", false, _"PreAdaptMesh:=", false, _"NonLinearResidual:=", 0.001, _"MuNonLinearBH:=", true, _"ComputeHc:=", false, _"HcNonLinearBH:=", true)

Example:3D EddyCurrent solve setup:

oModule.InsertSetup "EddyCurrent", Array("NAME:Setup1", _"MaximumPasses:=", 10, _"MinimumPasses:=", 2, _"MinimumConvergedPasses:=", 1, _"PercentRefinement:=", 30, _"SolveFieldOnly:=", false, _"PercentError:=", 1, _"SolveMatrixAtLast:=", true, _"UseOutputVariable:=", false, _"PreAdaptMesh:=", false, _"Frequency:=", "60Hz", _"HasSweepSetup:=", false)

Example:3D Transient solve setup:

oModule.InsertSetup "Transient", Array("NAME:Setup1", _"NonlinearSolverResidual:=", 0.005, _"StopTime:=", "0.01s", _"TimeStep:=", "0.002s", _"OutputError:=", false, _

Analysis Module Script Commands 15-3

Page 236: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"UseControlProgram:=", false, _"ControlProgramName:=", " ", _"ControlProgramArg:=", " ", _"CallCtrlProgAfterLastStep:=", false, _"HasSweepSetup:=", false, _"OutputVarCalTimeStep:=", "0.002s", _"OutputVarCalNumOfSolveSteps:=", 1, _"OutputVarCalTimeMethod:=", 0, _"NumberOfOutputVars:=", 0, _"TransientHcNonLinearBH:=", true, _"TransientComputeHc:=", false, _"PreAdaptMesh:=", false, _"TransientComputePowerLoss:=", false, _"TransientComputeForceDensity:=", false)

Example:3D Electrostatic solve setup:

oModule.InsertSetup "Electrostatic", Array("NAME:Setup1", _"MaximumPasses:=", 10, _"MinimumPasses:=", 2, _"MinimumConvergedPasses:=", 1, _"PercentRefinement:=", 30, _"SolveFieldOnly:=", false, _"PercentError:=", 1, _"SolveMatrixAtLast:=", true, _"UseOutputVariable:=", false, _"PreAdaptMesh:=", false)

Example:3D DCConduction solve setup:

oModule.InsertSetup "DCConduction", Array("NAME:Setup2", _"MaximumPasses:=", 10, _"MinimumPasses:=", 2, _"MinimumConvergedPasses:=", 1, _"PercentRefinement:=", 30, _"SolveFieldOnly:=", false, _"PercentError:=", 1, _"SolveMatrixAtLast:=", true, _"UseOutputVariable:=", false, _"PreAdaptMesh:=", false)

15-4 Analysis Module Script Commands

Page 237: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Example:3D ElectroDCConduction solve setup:

oModule.InsertSetup "ElectroDCConduction", Array("NAME:Setup3", _"MaximumPasses:=", 10, _"MinimumPasses:=", 2, _"MinimumConvergedPasses:=", 1, _"PercentRefinement:=", 30, _"SolveFieldOnly:=", false, _"PercentError:=", 1, _"SolveMatrixAtLast:=", true, _"UseOutputVariable:=", false, _"PreAdaptMesh:=", false)

Example:3D ElectricTransient solve setup:

oModule.InsertSetup "ElectricTransient", Array("NAME:Setup1", _"Tolerance:=", 0.005, _Array("NAME:Data", _"SaveField:=", true, _"Stop:=", "100s", _"InitialStep:=", "0.01s", _"MaxStep:=", "5s"), _"Initial Voltage:=", "0V", _"NumberOfOutputVars:=", 0)

Example:2D Magnetostatic solve setup:

oModule.InsertSetup "Magnetostatic", Array("NAME:Setup1", _"MaximumPasses:=", 10, _"MinimumPasses:=", 2, _"MinimumConvergedPasses:=", 1, _"PercentRefinement:=", 30, _"SolveFieldOnly:=", false, _"PercentError:=", 1, _"SolveMatrixAtLast:=", true, _"UseOutputVariable:=", false, _"PreAdaptMesh:=", false, _"NonLinearResidual:=", 0.0001, _"MuNonLinearBH:=", true, _

Analysis Module Script Commands 15-5

Page 238: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"ComputeHc:=", false, _"HcNonLinearBH:=", true)

Example:2D EddyCurrent solve setup:

oModule.InsertSetup "EddyCurrent", Array("NAME:Setup1", _"MaximumPasses:=", 10, _"MinimumPasses:=", 2, _"MinimumConvergedPasses:=", 1, _"PercentRefinement:=", 30, _"SolveFieldOnly:=", false, _"PercentError:=", 1, _"SolveMatrixAtLast:=", true, _"UseOutputVariable:=", false, _"PreAdaptMesh:=", false, _"Frequency:=", "60Hz", _"NonLinearResidual:=", 0.0001, _"HasSweepSetup:=", false)

Example: 2D Transient solve setup:

oModule.InsertSetup "Transient", Array("NAME:Setup1", _"NonlinearSolverResidual:=", 0.0001, _"StopTime:=", "0.01s", _"TimeStep:=", "0.002s", _"OutputError:=", false, _"UseControlProgram:=", false, _"ControlProgramName:=", " ", _"ControlProgramArg:=", " ", _"CallCtrlProgAfterLastStep:=", false, _"HasSweepSetup:=", false, _"OutputVarCalTimeStep:=", "0.002s", _"OutputVarCalNumOfSolveSteps:=", 1, _"OutputVarCalTimeMethod:=", 0, _"NumberOfOutputVars:=", 0, _"TransientHcNonLinearBH:=", true, _"TransientComputeHc:=", false, _"PreAdaptMesh:=", false, _"UseAdaptiveTimeStep:=", false, _"InitialTimeStep:=", "0.002s", _"MinTimeStep:=", "0.001s", _

15-6 Analysis Module Script Commands

Page 239: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"MaxTimeStep:=", "0.003s", _"TimeStepErrTolerance:=", 0.0001)

Example: 2D Electrostatic solve setup:

oModule.InsertSetup "Electrostatic", Array("NAME:Setup1", _"MaximumPasses:=", 10, _"MinimumPasses:=", 2, _"MinimumConvergedPasses:=", 1, _"PercentRefinement:=", 30, _"SolveFieldOnly:=", false, _"PercentError:=", 1, _"SolveMatrixAtLast:=", true, _"UseOutputVariable:=", false, _"PreAdaptMesh:=", false)

Example: 2D ACConduction solve setup:

oModule.InsertSetup "ACConduction", Array("NAME:Setup1", _"MaximumPasses:=", 10, _"MinimumPasses:=", 2, _"MinimumConvergedPasses:=", 1, _"PercentRefinement:=", 30, _"SolveFieldOnly:=", false, _"PercentError:=", 1, _"SolveMatrixAtLast:=", true, _"UseOutputVariable:=", false, _"PreAdaptMesh:=", false, _"Frequency:=", "60Hz", _"HasSweepSetup:=", false)

Example: 2D DCConduction solve setup:

oModule.InsertSetup "DCConduction", Array("NAME:Setup1", _"MaximumPasses:=", 10, _"MinimumPasses:=", 2, _"MinimumConvergedPasses:=", 1, _"PercentRefinement:=", 30, _"SolveFieldOnly:=", false, _"PercentError:=", 1, _"SolveMatrixAtLast:=", true, _"UseOutputVariable:=", false, _

Analysis Module Script Commands 15-7

Page 240: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"PreAdaptMesh:=", false)

EditSetupUse: 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: NoneParameters:

<SetupName>

Type: <string>

Name of the solution setup being edited.

<AttributesArray>

Array("NAME:<NewSetupName>", <NamedParameters>)

NamedParameters depend upon the solution type of the design. See InsertSetup for additional details.

Example: 3D ElectricTransient edit setup:

oModule.EditSetup "Setup1", Array("NAME:Setup1", _"Tolerance:=", 0.005, _Array("NAME:Data", _"SaveField:=", true, _"Stop:=", "100s", _"InitialStep:=", "0.01s", _"MaxStep:=", "0.5s"), _"Initial Voltage:=", "0V", _"NumberOfOutputVars:=", 0)

Example: 2D DCConduction edit setup:

oModule.EditSetup "Setup1", Array("NAME:Setup1", _"MaximumPasses:=", 20, _"MinimumPasses:=", 2, _"MinimumConvergedPasses:=", 1, _"PercentRefinement:=", 30, _"SolveFieldOnly:=", false, _"PercentError:=", 1, _"SolveMatrixAtLast:=", true, _"UseOutputVariable:=", false, _"PreAdaptMesh:=", false)

15-8 Analysis Module Script Commands

Page 241: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

RenameSetupUse: Renames an existing solution setup.Command: Right-click a solution setup in the project tree, and then click Rename on

the shortcut menu.Syntax: RenameSetup <OldName>, <NewName>

Return Value: NoneParameters: <OldName>

Type: <string>

Name of the solution setup being renamed.

<NewName>

Type: <string>

New name for the solution setup.

Example: oModule.RenameSetup "Setup1", "Setup2"

DeleteSetupsUse: 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: NoneParameters: <SetupArray>

Array(<name1>, <name2>, ...)

Example: oModule.DeleteSetups Array("Setup1", "Setup2")

ExportCircuitUse: Exports matrix solution to an outside circuit.Command: Right-click a matrix setup under Parameters in the project tree, and select

View Solution. From the dialog box, click the Export Circuit button.Syntax: ExportCircuit <SetupName>, <Variation>, <ExportFileName>,

Array("NAME:CircuitData", "Matrix:=", <MatrixName>, "Post Processed:=", <IsPostProcessed>, "Scale:=", <ScalingFactor>, Array("NAME:Pins", "<SourceName>:=", Array("res:=", <Resistance> ))), <ModelName>

Return Value: NoneParameters: <SetupName>

Type: string

Analysis Module Script Commands 15-9

Page 242: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Setup name

<Variation>

Type: string

Variation values

<ExportFileName>

Type: string

Export file name

<MatrixName>

Type: string

Matrix setup name

<IsPostProcessed>

Type: bool

Is post processed (true/false)

<ScalingFactor>

Type: string (value)

Scaling factor

<SourceName>

Type: string (without quotation mark)

Source name

<Resistance>

Type: value

Resistance value

<ModelName>

Type: string

Model name or name of the sub circuit(optional). If not specified then "ExportFileName" is used as the model name.

Example: oModule. ExportCircuit "Setup1", "", _"C:/Maxwell/Projects/Export/Matrix1.sml", _Array("NAME:CircuitData", _"Matrix:=", "Matrix1", _"Post Processed:=", false, _"Scale:=", "1", _Array("NAME:Pins", _"Current1:=", Array("res:=", "0mOhm")))

15-10 Analysis Module Script Commands

Page 243: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

ExportSolnDataUse: Exports solution data to a file.Command: Right-click a parameter setup under Parameters in the project tree, and

select View Solution. From the dialog box, select an appropriate solution type, and click the Export Solution button.

Syntax: ExportSolnData <SetupName>, <SolutionName>, <IsPostProcessed>, <Variation>, <ExportFileName>,

Return Value: None

Parameters: <SetupName>

Type: string

Setup name.

<SolutionName>

Type: string

Solution setup name.

<IsPostProcessed>

Type: bool

Is post processed (true/false).

<Variation>

Type: string

Variation values.

<ExportFileName>

Type: string

Export file name.

Example: oModule.ExportSolnData "Setup1", "Matrix1", false, "", _

"C:/Maxwell/Projects/Export/OutputSolution.txt"

RevertSetupToInitialUse: Marks the current mesh for a solution setup as invalid, forcing the next

simulation to start from 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: NoneParameters: <SetupName>

The name of the solution setup you want to revert to.

Example: oModule.RevertSetupToInitial "Setup1"

Analysis Module Script Commands 15-11

Page 244: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

RevertAllToInitialUse: Marks the current mesh for all solution setups as invalid, forcing the next

simulation to start from the initial mesh.Command: Maxwell3D or Maxwell2D>Analysis Setup>Revert to Initial MeshSyntax: RevertAllToInitial

Return Value: NoneExample: oModule.RevertAllToInitial

ResetSetupToTimeZero Use: Forces the next solve to start from time 0 for a given setup. Applies only to

the Transient solution type.Command: Right-click a setup in the project tree, and select Revert to Time Zero.Syntax: ResetSetupToTimeZero <SetupName>

Return Value: NoneParameters: <SetupName>

Type: string

Setup name

Example: oModule.ResetSetupToTimeZero "Setup1"

ResetAllToTimeZero Forces the next solve to start from time 0 for all setups. Applies only to the Transient solution type.

Command: Right-click Analysis in the project tree, and select Revert to Time Zero.

Syntax: ResetAllToTimeZero

Return Value: NoneParameters: None

Example: oModule.ResetAllToTimeZero

GetSetupsUse: Gets the names of analysis setups in a design.Syntax: GetSetups()

Return Value: Array of analysis setup names.Parameters: None

Example: setupnames = oModule.GetSetups()

15-12 Analysis Module Script Commands

Page 245: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

GetSetupNamesUse: Get the names of setups.Command: NoneSyntax: GetSetupNames()

Return Value: An array of strings. The setup names.Parameters: None.

Example: Set setups = oModule.GetSetupNames()

numsetups = setups.Count

for i=0 to numsetups-1

setup = setups.Item(i)

MsgBox "Setup Name = " & setup

Next

Analyze (Project Menu)Use: Solves a single solution setup and all of its frequency sweeps.Command: Right-click a solution setup in the project tree, and then click Analyze on

the shortcut menu. Syntax: SolveSetup

Parameters: <SetupName>

Type: <String>

Name of the solve setup.

<SweepName>

Type: <String>

Sweep name

Return Value: NoneExample: oDesign.Analyze "Setup2"

Example: oDesign.Analyze "Setup2:Sweep1"

CopySetupUse: Copy a solve setup.Syntax: CopySetup <SetupName>

Return Value: NoneParameters: <SetupName>

Type: <String>

Analysis Module Script Commands 15-13

Page 246: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Name of solve setup to be copied.

Example: oModule.CopySetup "Setup6"

PasteSetupUse: Paste a solve setup.Syntax: PasteSetup

Return Value: NoneExample: oModule.PasteSetup

15-14 Analysis Module Script Commands

Page 247: scriptingMaxwell_onlinehelp

16 Optimetrics Module Script Commands

Optimetrics script commands should be executed by the Optimetrics mod-ule.

Set oModule = oDesign.GetModule("Optimetrics")

oModule.CommandName <args>

Optimetrics Module Script Commands 16-1

Page 248: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Conventions Used in the Optimetrics Module Chapter

<VarName>

Type: <string>

Name of a variable.

<VarValue>

Type: <string>

Value with a unit (i.e., <value>, but cannot be an expression).

<StartV>

Type: <VarValue>

The starting value of a variable.

<StopV>

Type: <VarValue>

The stopping value of a variable.

<MinV>

Type: <VarValue>

The minimum value of a variable.

<MaxV>

Type: <VarValue>

The maximum value of a variable.

<IncludeVar>

Type: <bool>

Specifies whether or not the variable is included in the analysis.

<StartingPoint>

Array("NAME:StartingPoint", "<VarName>:=",

<VarValue>, .... "<VarName>:=", <VarValue>)

<SaveField>

Type: <bool>

Specifies whether to remove the non-nominal field solu-tion.

<MaxIter>

Type: <int>

Maximum iteration allowed in an analysis.

<PriorSetup>

16-2 Optimetrics Module Script Commands

Page 249: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Type: <string>

The name of the embedded parametric setup.

<Precede>

Type: <bool>

If true, the embedded parametric setup will be solved before the analysis begins.

If false, the embedded parametric setup will be solved during each analysis iteration.

<Constraint>

Array("NAME:LCS",

"lc:=", Array("<VarName>:=",

<Coeff>, …"<VarName>:=", <Coeff>, "rel:=", <Cond>, "rhs:=", <Rhs>), ...

"lc:=", Array("<VarName>:=", <Coeff>, ..."

<VarName>:=", <Coeff>, "rel:=", <Cond>, "rhs:=",

<Rhs>))

Parameters:

<Coeff>

Type: <double>

Coefficient for a variable in the linear con-straint.

<Cond>

Type: <string>

Inequality condition.

<Rhs>

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

Parameters:

Optimetrics Module Script Commands 16-3

Page 250: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

<Soln>

Type: <string>

Name of the Maxwell solution.

<Calc>

Type: <string>

An expression composed of a basic solution quantity and an output variable.

<ContextName>

Type: <string>

Name of context 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.

16-4 Optimetrics Module Script Commands

Page 251: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

General Commands Recognized by the Optimetrics ModuleFollowing are general script commands recognized by the Optimetrics module:• DeleteSetups (Optimetrics)• RenameSetup (Optimetrics)• SolveSetup (Optimetrics)• GetSetupNames (Optimetrics)• GetSetupNamesByType (Optimetrics)• DistributedAnalyzeSetup

DeleteSetups (Optimetrics)Use: Deletes the specified Optimetrics setups.Command: Right-click the setup in the project tree, and then click Delete on the

shortcut menu.Syntax: DeleteSetups <NameArray>

Return Value: NoneParameters: <NameArray>

Type: Array of strings.

An array of setup names.

Example: oModule.DeleteSetups Array("OptimizationSetup1")

DistributedAnalyzeSetupUse: Distributes all variable value instances within a parametric sweep to

different machines already specified from within the user interface.Command: Right-click the parametric setup name in the project tree, and select

Distribute Analysis.Syntax: DistributedAnalyzeSetup <ParametricSetupName>

Return Value: None

Parameters: <ParametricSetupName>Type: <string>

Example: oModule.DistributedAnalyzeSetup "ParametricSetup1"

GetSetupNames (Optimetrics)Use: Gets a list of Optimetrics setup names.Syntax: GetSetupNames()

Return Value: Array of Optimetrics setup names

Optimetrics Module Script Commands 16-5

Page 252: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Parameters: None

Example: For each name in oModule.GetSetupNames()

Msgbox nameNext

GetSetupNamesByType (Optimetrics)Use: Gets a list of Optimetrics setup names by type.Syntax: GetSetupNamesByType(<Optimetrics type>)

Return Value: Array of Optimetrics setup names of the given type.Parameters: <Optimetrics type>

Type: String Examples: parametric, optimization, statistical, sensitivity

Example: For each name in oModule.GetSetupNamesByType("optimization")

Msgbox nameNext

RenameSetup (Optimetrics)Use: Renames the specified Optimetrics setup.Command: Right-click the setup in the project tree, and then click Rename on the

shortcut menu.Syntax: RenameSetup <OldName> <NewName>

Return Value: NoneParameters: <OldName>

Type: <string>

<NewName>

Type: <string>

Example: oModule.RenameSetup "OptimizationSetup1" "MyOptimization"

SolveSetup (Optimetrics)Use: Solves the specified Optimetrics setup.Command: Right-click the setup in the project tree, and then click Analyze on the

shortcut menu.Syntax: SolveSetup <SetupName>

Return Value: NoneParameters: oModule.SolveSetup "OptimizationSetup1"

16-6 Optimetrics Module Script Commands

Page 253: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Parametric Script CommandsFollowing are parametric analysis script commands:• InsertSetup (Parametric)• EditSetup (Parametric)

InsertSetup (Parametric)Use: Inserts a new parametric setup.Command: Right-click the Optimetrics folder in the project tree, and then click Add>

Parametric on the shortcut menu.(Maxwell3D or Maxwell2D>Optimetrics Analysis>Add Parametric)

Syntax: InsertSetup "OptiParametric", <ParametricParams>

Return Value: NoneParameters:

<Parametric Params>

Array("NAME:<SetupName>", "SaveFields:=",

<SaveField>, <StartingPoint>, "Sim. Setups:=",

<SimSetups>, <SweepDefs>, <SweepOps>,

Array("NAME:Goals", Array("NAME:Goal",

<OptiGoalSpec>), ... Array("NAME:Goal",

<OptiGoalSpec>))

<SetupName>

Type: <string>

Name of the parametric setup.

<SimSetups>

Type: Array of strings.

An array of Maxwell solution setup names.

<SweepDefs>

Array("NAME:Sweeps",

Array("NAME:SweepDefinition", "Variable:=",

<VarName>, "Data:=", <SweepData>,

"Synchronize:=", <SyncNum>), ...

Array("NAME:SweepDefinition", "Variable:=",

<VarName>, "Data:=", <SweepData>,

"Synchronize:=", <SyncNum>))

Parameters:

Optimetrics Module Script Commands 16-7

Page 254: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

<SweepData>

"<SweepType>, <StartV>, <StopV>, <StepV>"

Parameters:

<SweepType>

Type: <string>

The type of sweep data.

<SyncNum>

Type: <int>

SweepData with the same value are synchronized.

<SweepOps>

Array("NAME:Sweep Operations", <OpType>:=,

Array(<VarValue>, …, <VarValue>), ...

<OpType>:=, Array(<VarValue>, …, <VarValue>))

Parameters:

<OpType>

Type: <string>

The sweep operation type.

Example:oModule.InsertSetup "OptiParametric", _Array("NAME:ParametricSetup1", "SaveFields:=", true, _Array("NAME:StartingPoint"), "Sim. Setups:=", _Array("Setup1"),Array("NAME:Sweeps", _Array("NAME:SweepDefinition", _"Variable:=", "$width", _"Data:=", "LIN 12mm 17mm 2.5mm", _"OffsetF1:=", false, "Synchronize:=", 0), _Array("NAME:SweepDefinition", "Variable:=", _"$length", "Data:=", _"LIN 8mm 12mm 2mm", "OffsetF1:=", false, _"Synchronize:=", 0)), _Array("NAME:Sweep Operations"), Array("NAME:Goals", _Array("NAME:Goal", "Solution:=", _"Setup1 : LastAdaptive", _"Calculation:=", "returnloss", _"Context:=", "", _Array("NAME:Ranges", "Range:=", _Array("Var:=", "Freq", "Type:=", "s", _"Start:=", "8GHz", "Stop:=", "8GHz"))), _Array("NAME:Goal", "Solution:=", _"Setup1 : LastAdaptive","Calculation:=", "reflect", _

16-8 Optimetrics Module Script Commands

Page 255: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"Context:=", "", Array("NAME:Ranges", "Range:=", _Array("Var:=", "Freq", "Type:=", "s", _"Start:=", "8GHz", "Stop:=", "8GHz")))))

EditSetup (Parametric)Use: Modifies an existing parametric setup.Command: Right-click the setup in the project tree, and then click Properties on the

shortcut menu.Syntax: EditSetup <SetupName>, <ParametricParams>

Return Value: None

Optimetrics Module Script Commands 16-9

Page 256: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Optimization Script CommandsFollowing are optimization analysis script commands:• InsertSetup (Optimization)• EditSetup (Optimization)

InsertSetup (Optimization)Use: Inserts a new optimization setup.Command: Right-click the Optimetrics folder in the project tree, and then click

Add>Optimization on the shortcut menu. (Maxwell3D or Maxwell2D>Optimetrics Analysis>Add Optimization)

Syntax: InsertSetup "OptiOptimization", <OptimizationParams>

Return Value: NoneParameters:

<OptimizationParams>

Array("NAME:<SetupName>", "SaveFields:=",

<SaveField>, <StartingPoint>, "Optimizer:=",

<Optimizer>,

"MaxIterations:=", <MaxIter>, "PriorPSetup:=",

<PriorSetup>, "PreSolvePSetup:=", <Preceed>,

<OptimizationVars>, <Constraint>,

Array("NAME:Goals", Array("NAME:Goal",

<OptiGoalSpec>, <OptimizationGoalSpec>), ...

Array("NAME:Goal", <OptiGoalSpec>,

<OptimizationGoalSpec>)),

"Acceptable_Cost:=", <AcceptableCost>, "Noise:=",

<Noise>, "UpdateDesignWhenDone:=", <UpdateDesign>

<OptimizationVars>

Array("NAME:Variables", "VarName:=", Array("i:=",

<IncludeVar>, "Min:=", <MinV>, "Max:=", <MaxV>,

"MinStep:=", <MinStepV>, "MaxStep:=", <MaxStepV>),

………………. "VarName:=", Array("i:=", <IncludeVar>, "Min:=", <MinV>, "Max:=", <MaxV>,

"MinStep:=", <MinStepV>, "MaxStep:=", <MaxStepV>))

Parameters:

<MinStepV>

Type : <VarValue>

16-10 Optimetrics Module Script Commands

Page 257: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

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", "GoalValeType:=",

<GoalValueType>,

"Format:=", <GoalValueFormat>, "bG:=",

Array("v:=", <GoalValue>)), "Weight:=", <Weight>)

Parameters:

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

Example:oModule.InsertSetup _

Optimetrics Module Script Commands 16-11

Page 258: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

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

EditSetup (Optimization)Use: Modifies an existing optimization setup.Command: Right-click the setup in the project tree, and then click Properties on the

shortcut menu.Syntax: EditSetup <SetupName>, <OptimizationParams>

Return Value: None

16-12 Optimetrics Module Script Commands

Page 259: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Sensitivity Script CommandsFollowing are sensitivity analysis script commands:• InsertSetup (Sensitivity)• EditSetup (Sensitivity)

InsertSetup (Sensitivity)Use: Inserts a new sensitivity setup.Command: Right-click Optimetrics in the project tree, and then click Add>Sensitivity

on the shortcut menu.(Maxwell3D or Maxwell2D>Optimetrics Analysis>Add Sensitivity)

Syntax: InsertSetup "OptiSensitivity", <SensitivityParams>

Return Value: None

Parameters:<SensitivityParams>

Array("NAME:<SetupName>", "SaveFields:=", <Save-Field>, <StartingPoint>, "MaxIterations:=",

<MaxIter>, "PriorPSetup:=", <PriorSetup>,

"PreSolvePSetup:=", <Preceed>, <SensitivityVars>, <Constraint>,

Array("NAME:Goals", Array("NAME:Goal", <OptiGoal-Spec>), ..., Array("NAME:Goal", <OptiGoalSpec>)), "Mas-ter Goal:=". <MasterGoalID>, "MasterError:=", <MasterError>)

<SensitivityVars>

Array("NAME:Variables",

"VarName:=", Array("i:=", <IncludeVar>,

"Min:=", <MinV>, "Max:=", <MaxV>,

"IDisp:=", <InitialDisp>),...

"VarName:=", Array("i:=", <IncludeVar>,

"Min:=", <MinV>, "Max:=", <MaxV>,

"IDisp:=", <InitialDisp>))

Parameters:

<InitialDisp>

Type : <VarValue>

The initial displacement of the variable.

<MasterGoalID>

Optimetrics Module Script Commands 16-13

Page 260: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Type: <int>

Index of the master goal. Index starts from zero.

<MasterError>

Type: <double>

Error associated with the master goal.

Example:oModule.InsertSetup "OptiSensitivity", _Array("NAME:SensitivitySetup1","SaveFields:=", true, _Array("NAME:StartingPoint"), "MaxIterations:=", 20, _"PriorPSetup:=", "","PreSolvePSetup:=", true, _Array("NAME:Variables"), Array("NAME:LCS"), _Array("NAME:Goals", Array("NAME:Goal", _"Solution:=", "Setup1 : LastAdaptive", "Calculation:=", _"returnloss", "Context:=", "", _Array("NAME:Ranges","Range:=", _Array("Var:=", "Freq", "Type:=", "s", _"Start:=", "8GHz", "Stop:=", "8GHz"))), _Array("NAME:Goal","Solution:=", "Setup1 : _LastAdaptive", "Calculation:=", "reflect", _"Context:=", "", Array("NAME:Ranges", "Range:=", _Array("Var:=", "Freq", "Type:=", "s", _"Start:=", "8GHz", "Stop:=", "8GHz")))), _"Master Goal:=", 1,"MasterError:=", 0.001)

EditSetup (Sensitivity)Use: Modifies an existing sensitivity setup.Command: Right-click the setup in the project tree, and then click Properties on the

shortcut menu.Syntax: EditSetup <SetupName>, <SensitivityParams>

Return Value: None

16-14 Optimetrics Module Script Commands

Page 261: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Statistical Script CommandsFollowing are statistical analysis script commands:• InsertSetup (Statistical)• EditSetup (Statistical)

InsertSetup (Statistical)Use: Inserts a new statistical setup.Command: Right-click Optimetrics in the project tree, and then click Add>Statistical

on the shortcut menu.(Maxwell>Optimetrics Analysis>Add Statistical)Syntax: InsertSetup "OptiStatistical", <StatisticalParams>

Return Value: NoneParameters:

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

Optimetrics Module Script Commands 16-15

Page 262: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Type: <VarValue>

The tolerance for the variable when distribution is Uniform.

<StdD>

Type: <VarValue>

The standard deviation for the variable when distri-bution is Gaussian.

<MinCutoff>

Type: <double>

The minimum cut-off for the variable when distribu-tion is Gaussian.

<MaxCutoff>

Type: <double>

The maximum cut-off for the variable when distribu-tion is Gaussian.

Example: oModule.InsertSetup "OptiStatistical", _

Array("NAME:StatisticalSetup1", _

"SaveFields:=", true, _

Array("NAME:StartingPoint"),_

"MaxIterations:=", 50,_

"PriorPSetup:=", "", _

Array("NAME:Variables"), _

Array("NAME:Goals", _

Array("NAME:Goal", _

"Solution:=", "Setup1 : LastAdaptive", _

"Calculation:=", "returnloss", _

"Context:=", "", _

Array("NAME:Ranges", _

"Range:=", Array("Var:=", "Freq", _

"Type:=", "s",_

"Start:=", "8GHz", "Stop:=", "8GHz"))),_

Array("NAME:Goal",_

"Solution:=", "Setup1 : LastAdaptive",_

"Calculation:=", "reflect",_

"Context:=", "", _

Array("NAME:Ranges",_

16-16 Optimetrics Module Script Commands

Page 263: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"Range:=", Array("Var:=", "Freq", "Type:=", _

"s", "Start:=", "8GHz", "Stop:=", "8GHz"))))

EditSetup (Statistical)Use: Modifies an existing statistical setup.Command: Right-click the setup in the project tree, and click Properties on the

shortcut menu.Syntax: EditSetup <SetupName>, <StatisticalParams>

Return Value: None

Optimetrics Module Script Commands 16-17

Page 264: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

16-18 Optimetrics Module Script Commands

Page 265: scriptingMaxwell_onlinehelp

17 Solutions Module Script Commands

Solutions commands should be executed by the Solutions module.

Set oModule = oDesign.GetModule("Solutions")

oModule.CommandName <args>

Solutions Module Script Commands 17-1

Page 266: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

DeleteSolutionVariationUse: Deletes solution data for specific solutions and design variations. See also

DeleteVariation.Command: Maxwell3D or Maxwell2D>Results>Browse SolutionsSyntax: DeleteSolutionVariation Array(<DataSpecifierArray>, …)

Return Value: NoneParameters:

<DataSpecifierArray>

Array(<DesignVariationKey>, <SetupName>, <SolnName>)

<DesignVariationKey>

Type: <string>

Design variation string.

<SetupName>

Type: <string>

Name of the solve setup.

<SolnName>

Type: <string>

Name of the solutions within the solve setup.

Example:oModule.DeleteSolutionVariation _Array(Array("width='2in'", "Setup1", "Adaptive_1") _Array("width='2in'", "Setup1", "Sweep1"))

17-2 Solutions Module Script Commands

Page 267: scriptingMaxwell_onlinehelp

18 Field Overlays Module Script Commands

Field overlay commands should be executed by the Field Overlays module, which is called FieldsReporter in Maxwell scripts.

Set oModule = oDesign.GetModule("FieldsReporter")

oModule.CommandName <args>

Field Overlays Module Script Commands 18-1

Page 268: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

General Parameter Setup Script CommandsFollowing are script commands recognized by the FieldOverlays module:• CreateFieldPlot• DeleteFieldPlot• GetFieldPlotNames• ModifyFieldPlot• RenameFieldPlot• RenamePlotFolder• SetFieldPlotSettings• SetPlotFolderSettings

CreateFieldPlotUse: Creates a field/mesh plot.Command: Maxwell3D or Maxwell2D>Fields>Fields>E>Mag_ESyntax: CreateFieldPlot <PlotParameterArray>

Return Value: NoneParameters: <PlotParameterArray>

Array(“NAME:<PlotName>”,

"“SolutionName:=", <string>,

"QuantityName:=", <string>,

"PlotFolder:=", <string>,

"UserSpecifyName:=", <int>,

"UserSpecifyFolder:=", <int>,

"IntrinsicVar:=", <string>,

"PlotGeomInfo:=", <PlotGeomArray>,

"FilterBoxes:=", <FilterBoxArray>,

<PlotOnPointSettings>, <PlotOnLineSettings>,

<PlotOnSurfaceSettings>, <PlotOnVolumeSettings>)

SolutionName

Name of the solution setup and solution formatted as:

"“<SolveSetupName> : <WhichSolution>",

where <WhichSolution> can be "Adaptive_<n>",

"LastAdaptive", or "PortOnly".

For example: "Setup1 : Adaptive_2"

Maxwell requires a space on both sides of the ‘:’ char-acter. Otherwise, the plot will not be created.

18-2 Field Overlays Module Script Commands

Page 269: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

QuantityName

Type of plot to create. Possible values are:

Mesh plots: “Mesh”Field Plots:

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 regardless of whether this flag is set.

UserSpecifyFolder

0 if the default folder for plot is used, 1 otherwise.

This parameter is not essential. The specified Plot-Folder is respected regardless of whether this flag is set.

IntrinsicVar

Formatted string that specifies the frequency and phase at which to create the plot.

For example: "Freq='1GHz' Phase='30deg'"

<PlotGeomArray>

Array(<NumGeomTypes>, <GeomTypeData>,

<GeomTypeData>, ...)

For example: Array(4, "Volume", "ObjList", 1, "Box1",

"Surface", "FacesList", 1, "12", "Line", 1,

"Polyline1", "Point", 2, "Point1", "Point2")

<NumGeomTypes>

Type: <int>

Number of different geometry types (volume, surface, line, point) plotted at the same time.

Field type Plot quantity names

AC R/L Fields "SurfaceJac", "Mag_SurfaceJac"

DC R/L PEC Fields "SurfaceJdc", "Mag_SurfaceJdc"

DC R/L Fields "VolumeJdc", "Mag_VolumeJdc", "Phidc"

C Fields "SmoothQ", "ABS_Q"

Field Overlays Module Script Commands 18-3

Page 270: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

<GeomTypeData>

<GeomType>, <ListType>, <NumIDs>, <ID>, <ID>, ...)

<GeomType>

Type: <string>

Possible values are "Volume", "Surface", "Line", “Point”.

<ListType>

Type: <string>

Possible values are "ObjList" or "FacesList".

These are used for GeomType values "Line" or "Point".

<NumIDs>

Type: <int>

Number of IDs or object names that will follow.

<ID>

Type: <int> or <string>

ID of a face or name of an object, line, or point on which to plot.<FilterBoxArray>

Array of object names used to restrict the plot range.

Array(<NumFilters>, <ObjName>, <ObjName>, ...)

Example: Array(1, "Box1")

Example: Array(0) no filtering

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

18-4 Field Overlays Module Script Commands

Page 271: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"Dotdot", "Dotdash".

IsoValType

Possible values are "Tone", "Fringe", "Gourard">

Array("NAME:PlotOnSurfaceSettings",

"Filled:=", <bool>,

"IsoValType:=", <string>,

"SmoothShade:=", <bool>,

"AddGrid:=", <bool>,

"MapTransparency:=", <bool>,

"Transparency:=", <double>,

"ArrowUniform:=", <bool>

"ArrowSpacing:=", <double>

"GridColor:=", Array(<int>, <int>, <int>)

IsoValType

Possible values are: "Tone", "Line", "Fringe", "Gourard".

GridColor

Array containing the R, G, B components of the color. Components should be in the range 0 to 255.

<PlotOnVolumeSettings>

Array("NAME:PlotOnVolumeSettings",

"PlotIsoSurface:=", <bool>,

"CloudDensity:=", <double>,

"PointSize:=", <int>,

"ArrowUniform:=", <bool>,

"ArrowSpacing:=”, <double>)

Example:oModule.CreateFieldPlot Array("NAME:Mag_E1", _

"SolutionName:=", "Setup1 : LastAdaptive", _

"QuantityName:=", "Mag_E", _

"PlotFolder:=", "E Field1", _

"UserSpecifyName:=", 0, _

"UserSpecifyFolder:=", 0, _

"IntrinsicVar:=", "Freq='1GHz' Phase='0deg'",_

"PlotGeomInfo:=", Array( 1, "Surface",_

"FacesList", 1, "7"),_

Field Overlays Module Script Commands 18-5

Page 272: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

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

DeleteFieldPlotUse: Deletes one or more plots.Command: Maxwell3D or Maxwell2D>Fields>Delete PlotSyntax: DeleteFieldPlot <NameArray>

Return Value: NoneParameters: <NameArray>

Array of strings specifying the plots to delete.

Example: oModule.DeleteFieldPlot Array("Mag_E1", "Vector_E1")

GetFieldPlotNamesUse: Gets the names of field overlay plots defined in a design.Syntax: GetFieldPlotNames()

Return Value: Array of field plot names.Parameters: None

Example: Set plotnames = oModule.GetFieldPlotNames()

For Each name in plotnames

Msgbox name

Next

ModifyFieldPlotUse: Modifies a plot definition. Command: Maxwell3D or Maxwell2D>Fields>Modify PlotSyntax: ModifyFieldPlot <OriginalName> <PlotParameterArray>

Return Value: None

18-6 Field Overlays Module Script Commands

Page 273: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

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

RenameFieldPlotUse: 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: NoneParameters: <OldName>

Type: <string>

Original name of the plot.

<NewName>

Type: <string>

New name of the plot.

Example: oModule.RenameFieldPlot "Vector_E1", "Vector_E2"

RenamePlotFolderUse: 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: NoneParameters: <OldName>

Type: <string>

Field Overlays Module Script Commands 18-7

Page 274: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Original name of the folder.

<NewName>

Type: <string>

New name of the folder.

Example: oModule.RenamePlotFolder "E Field", "Surface Plots"

SetFieldPlotSettingsUse: Sets plot attributes.Command: Maxwell3D or Maxwell2D>Fields>Modify Plot Attributes, on the Plots tab.Syntax: SetFieldPlotSettings <PlotName> <PlotItemAttributes>

Return Value: NoneParameters:

<PlotName>

Type: <string>

Name of the plot to modify.

<PlotItemAttributes>

Array("NAME:FieldsPlotItemSettings",

<PlotOnPointsSettings>,

<PlotOnLineSettings>,

<PlotOnSurfaceSettings>,

<PlotOnVolumeSettings>)

See description of CreateFieldPlot command for details.

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

SetPlotFolderSettingsUse: Sets the attributes of all plots in the specified folder.

18-8 Field Overlays Module Script Commands

Page 275: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Command: Maxwell3D or Maxwell2D>Fields>Modify Plot AttributesSyntax: SetPlotFolderSettings <PlotFolderName>

<PlotFolderAttributes>

Return Value: NoneParameters:

<PlotFolderName>

Type: <string>Name of the folder with the attributes to modify.

<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

Array containing the R, G, B components of the color. Components should be in the range 0 to 255.

<Scale3DSettings>

Array("NAME:Scale3DSettings",

"m_nLevels:=", <int>,

"m_autoScale:=", <bool>,

"minvalue:=", <double>,

"maxvalue:=", <double>,

"log:=", <bool>,

Field Overlays Module Script Commands 18-9

Page 276: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"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

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

18-10 Field Overlays Module Script Commands

Page 277: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Array("NAME:Scale3DSettings", _

"m_nLevels:=", 27, _

"m_autoScale:=", true, _

"minvalue:=", 9.34379863739014, _

"maxvalue:=", 13683.755859375, _

"log:=", false, _

"IntrinsicMin:=", 9.34379863739014, _

"IntrinsicMax:=", 13683.755859375), _

Array("NAME:Marker3DSettings", _

“MarkerType:=", 0, _

"MarkerMapSize:=", true, _

"MarkerMapColor:=", false, _

"MarkerSize:=", 0.25), _

Array("NAME:Arrow3DSettings", _

"ArrowType:=", 1, _

"ArrowMapSize:=", true, _

"ArrowMapColor:=", true, _

"ShowArrowTail:=", true, _

"ArrowSize:=", 0.25))

Field Overlays Module Script Commands 18-11

Page 278: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

18-12 Field Overlays Module Script Commands

Page 279: scriptingMaxwell_onlinehelp

19 Fields Calculator Script Commands

Fields Calculator commands should be executed by the Field Overlays mod-ule, which is called FieldsReporter in Maxwell scripts.

Set oModule = oDesign.GetModule("FieldsReporter")

oModule.CommandName <args>The command associated with each of the following scripting commands is a button clicked in the Fields Calculator.

Fields Calculator Script Commands 19-1

Page 280: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Field Calculator Script CommandsFollowing are general script commands recognized by the FieldOverlays module:• AddNamedExpression• AddNamedExpr• CalcOp• CalcRead(deprecated)• CalcStack• CalculatorRead• CalculatorWrite• CalcWrite(deprecated)• ChangeGeomSettings• ClcEval• ClcMaterial• ClearAllNamedExpr• CopyNamedExprToStack• DeleteNamedExpr• EnterComplex• EnterComplexVector• EnterLine• EnterPoint• EnterQty• EnterScalar• EnterScalarFunc• EnterSurf• EnterVector• EnterVectorFunc• EnterVol• ExportOnGrid• ExportToFile• GetTopEntryValue• LoadNamedExpressions• SaveNamedExpressions

AddNamedExpressionUse: Creates a named expression using the expression at the top of the stack.

19-2 Fields Calculator Script Commands

Page 281: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Command: Click Add.Syntax: AddNamedExpression <Name>

Return Value: NoneParameters: <ExpressionName> and <FieldType>.

Type: <string>Name for the new named expression.

<FieldType>Type: <string>

Example: oModule.AddNamedExpression "Mag_JxE", "Fields"

AddNamedExprUse: Creates a named expression using the expression at the top of the stack.Command: Click Add.Syntax: AddNamedExpr <Name>

Return Value: NoneParameters: <Name>

Type: <string>

Name for the new named expression.

Example: oModule.AddNamedExpr "Mag_JxE"

CalcOpUse: Performs a calculator operation.Command: Operation commands like Mag, +, etc.Syntax: CalcOp <OperationString>

Return Value: NoneParameters: <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

Fields Calculator Script Commands 19-3

Page 282: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Parameters: <FileName>

Type: <string>

<SolutionName>Type: <string>

<VariablesArray>Array of variable name and value pairs.

Example: oModule.CalcRead _"c:\example.reg" "Setup1: LastAdaptive",_Array ("Freq:=", "10GHz", "Phase:=", "0deg")

CalcStackUse: Performs an operation on the stack.Command: Stack operation buttons such as Push and Pop.Syntax: CalcStack <OperationString>

Return Value: NoneParameters: <OperationString>

Type: <string>

The text on the corresponding calculator button.

Example: oModule.CalcStack "push"

CalculatorReadUse: Gets a register file and applies it to the calculator stack.Command: Click ReadSyntax: CalculatorRead <InputFilePath>, <SolutionName>,

<FieldType>, <VariablesArray>

Return Value: NoneParameters: <InputFilePath>

Path to and including name of input register file.<SolutionName>

Type: <string>Example: "Setup1 : LastAdaptive"

<FieldType>

Type: <string><VariablesArray>

Array of variable names, value pairs.

19-4 Fields Calculator Script Commands

Page 283: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Example: oModule.CalculatorRead "C:\Ansoft\smoothedtemper.fld", "Setup1 : LastAdaptive", "Fields", Array("$conductivity:=", "50000000")

CalculatorWriteUse: Writes contents of top register to file.Command: Click WriteSyntax: CalculatorWrite <OutputFilePath>, <SolutionNameArray>,

<VariablesArray>

Return Value: NoneParameters: <OutputFilePath>

Path to and including name of output register file.<SolutionNameArray>

Array("Solution:=", <string>)

<VariablesArray>

Array of variable names, value pairs.Example: oModule.CalculatorWrite "C:\Ansoft\smoothedTemp.fld",

Array("Solution:=", "Setup1 : LastAdaptive"), Array("$conductivity:=", "50000000")

CalcWrite(deprecated)Use: Evaluates the top stack element for all tetrahedrons, and writes the data to

a file.Syntax: CalcWrite <FileName> <SolutionName> <VariablesArray>

Return Value: NoneParameters: <FileName>

Type: <string>

Name of the output file.

<SolutionName>Type: <string>

<VariablesArray>Array of variable name and value pairs.

Example: oModule.CalcWrite _"c:\example.reg" "Setup1: LastAdaptive", _Array ("Freq:=", "10GHz", "Phase:=", "0deg")

Fields Calculator Script Commands 19-5

Page 284: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

ChangeGeomSettingsUse: Changes the line discretization setting.Command: Geom SettingsSyntax: ChangeGeomSettings <int>

Return Value: NoneParameters: The line discretization setting.

ClcEvalUse: 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: NoneParameters: <SolutionName>

Type: <string>

<VariablesArray>

Array of variable name, and value pairs.

Example: oModule.ClcEval "Setup1: LastAdaptive",_Array ("Freq:=","10GHz", "Phase:=", "0deg")

ClcMaterialUse: Performs a material operation on the top stack element.Command: Click Matl.Syntax: ClcMaterial <MaterialString>, <OperationString>

Return Value: NoneParameters: <Material String>

Type: <string>

The material property to apply.

<OperationString>

Type: <string>

Possible values are "mult" or "div".

Example: oModule.ClcMaterial "Permeability (mu)" "mult"

ClearAllNamedExprUse: Clears all user-defined named expressions from the list.

19-6 Fields Calculator Script Commands

Page 285: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Command: Click ClearAll.Syntax: ClearAllNamedExpr

Return Value: NoneParameters: None

CopyNamedExprToStackUse: 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: NoneParameters: <Name>

Type: <string>

The name of the expression to be copied to the top of the stack.

Example: oModule.CopyNamedExprToStack "Mag_JxE"

DeleteNamedExprUse: Deletes the selected named expression from the list.Command: Select a named expression, and then click Delete.Syntax: DeleteNamedExpr <Name>

Return Value: NoneParameters: <Name>

Type: <string>

The name of the named expression to be deleted.

Example: oModule.DeleteNamedExpr "Mag_JxE"

EnterComplexUse: Enters a complex number onto the stack.Command: Click Number, and then click Scalar. Syntax: EnterComplex "<Real> + <Imaginary> j"

Return Value: NoneParameters: <Real>

Type: <double>

Real component of the scalar.

<Imaginary>

Fields Calculator Script Commands 19-7

Page 286: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Type: <double>

Imaginary component of the scalar.

Example: oModule.EnterComplex "1 + 2 j"

EnterComplexVectorUse: Enters a complex vector onto the stack. Command: Click Number, and then click Vector. Syntax: EnterComplexVector Array ("<X Re> + <X Im> j", "<Y Re> +

<Y Im> j", "<Z Re> + <Z Im> j")

Return Value: NoneParameters: <X Re>, <Y Re>, <Z Re>

Type: <double>

Real components of the X, Y, and Z values respectively.

<X Im>, <YIm>, <ZIm>

Type: <double>

Imaginary components of the X, Y, and Z values,respec-tively.

Example: oModule.EnterComplexVector Array("1 + 2 j", _"1 + 2 j","1 + 2 j")

EnterLineUse: Enters a line that was defined in the "3D Modeler" editor.Command: Click Geometry, and then select Line.Syntax: EnterLine <LineName>

Return Value: NoneParameters: <LineName>

Type: <string>

Name of a line defined in the 3D Modeler editor.

Example: oModule.EnterLine "Line1"

EnterPointUse: Enters a point defined in the "3D Modeler" editor.Command: Click Geometry, and then select Point.Syntax: EnterPoint <PointName>

Return Value: NoneParameters: <PointName>

19-8 Fields Calculator Script Commands

Page 287: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Type: <string>

Name of a point defined in the 3D Modeler editor.

Example: oModule.EnterPoint "Point1"

EnterQtyUse: Enters a field quantity.Command: Click Quantity, and then select a field quantity from the list.Syntax: EnterQty <FieldQuantityString>

Return Value: NoneParameters: <Field Quantity String>

Type: <string>

The name of the field quantity to be entered onto the stack.

Example: oModule.EnterQty "E"

EnterScalarUse: Enters a scalar onto the stack.Command: Click Number, and then click Scalar. Syntax: EnterScalar <Scalar>

Return Value: NoneParameters: <Scalar>

Type: <double>

The real number to enter onto the stack.

EnterScalarFuncUse: Enters a scalar function.Command: Click Function, and then select Scalar.Syntax: EnterScalarFunc <VarName>

Return Value: NoneParameters: <VarName>

Type: <string>

Name of a variable to enter as a scalar function onto the stack.

Example: oModule.EnterScalarFunc "Phase"

Fields Calculator Script Commands 19-9

Page 288: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

EnterSurfUse: Enters a surface defined in the "3D Modeler" editor.Command: Click Geometry, and then select Surface.Syntax: EnterSurf <SurfaceName>

Return Value: NoneParameters: <SurfaceName>

Type: <string>

Name of a surface defined in the 3D Modeler editor.

Example: oModule.EnterSurf "Rectangle1"

EnterVectorUse: Enters a vector onto the stack.Command: Click Number, and then click Vector. Syntax: EnterVector Array (<X>, <Y>, <Z>)

Return Value: NoneParameters: <X>

Type: <double>

X component of the vector.

<Y>

Type: <double>

Y component of the vector.

<Z>

Type: <double>

Z component of the vector.

Example: oModule.EnterVector Array (1.0, 1.0, 1.0)

EnterVectorFuncUse: Enters a vector function.Command: Click Function, and then click Vector.Syntax: EnterVectorFunc Array(<XVarName>, <YVarName>,

<ZVarName>)

Return Value: NoneParameters: <XVarName>, <YVarName>, <ZVarName>

Type: <string>

Name of a variable for the X, Y, and Z coordinates,

19-10 Fields Calculator Script Commands

Page 289: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

respectively, to enter as a vector function on the stack.

Example: oModule.EnterVectorFunc Array("X", "Y", "Z")

EnterVolUse: Enters a volume defined in the "3D Modeler" editor.Command: Click Geometry, and then click Volume.Syntax: EnterVol <VolumeName>

Return Value: NoneParameters: <VolumeName>

Type: <string>

Name of a volume defined in the "3D Modeler" editor.

Example: oModule.EnterVol "Box1"

ExportOnGridUse: Evaluates the top stack element at a set of points specified by a grid, and

exports the data to a file.

Command: Click Export, and then click On Grid.Syntax: ExportOnGrid <OutputFile> <MinArray> <MaxArray>

<SpacingsArray>

Return Value: NoneParameters: <OutputFile>

Type: <string>

Name of the output file.

<MinArray>, <MaxArray>, <SpacingsArray>

Type: Array<double, double, double>

Min, Max, and Spacing for the X, Y, and Z components of the grid.

For 2D XY Designs, the Z component should be set to "0".

For 2D RZ Designs, the Y component should be set to "0".

Example: oModule.ExportOnGrid _

"C:\Maxwell12OutputFiles\GridExport.reg",_

Note Design variables must be defined prior to execution of this command.

Fields Calculator Script Commands 19-11

Page 290: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Array("1", "1", "1"),_

Array("4", "4", "4"),_

Array("2", "2", "2")

ExportToFileUse: Evaluates the top stack element at a set of points specified in an external

file, and exports the data to a file.Command: Click Export, and then click To File.Syntax: ExportToFile <OutputFile> <PtsFile>

Return Value: NoneParameters: <OutputFile>

Type: <string>

Name of the output file.

<PtsFile>

Type: <string>

Name of the file containing the points at which to evaluate the top stack element. The file should contain tab- or space-separated x,y,z values of data points.

GetTopEntryValueUse: Evaluates the value at the top entry of the calculator stack.Command: None (only through scripts)Syntax: GetTopEntryValue (<SolutionName>, <VariablesArray>)

<ValueArray>

Return Value: An array of variants, which is either a scalar (one double) or a vector (three doubles) based on the quantity on top of the stack.

Parameters: <SolutionName>

Type: <string>

Example: "Setup1:LastAdaptive"

<VariablesArray>

Array of variable name/value pairs.

<ValueArray>

Array of values.

Example:dim topvaluetopvalue = _oModule.GetTopEntryValue("Setup1: LastAdaptive", _

19-12 Fields Calculator Script Commands

Page 291: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Array("Freq:=", "1GHz", "Phase:=", "0deg", _"x_size:=", "2mm"))If cdbl(topvalue(0)) <- 180.0 then ...

LoadNamedExpressionsUse: 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: NoneParameters: <FileName>

Type:<String>Filename and full path to the file to hold the named expression defini-tion.

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

Parameters:

Example: oModule.LoadNamedExpressions "C:\Ansoft\PersonalLib\Maxw.clc", "Fields", Array("SmoothedBField")

SaveNamedExpressionsUse: 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: NoneParameters: <FileName>

Type:<String>Filename and full path to the file to hold the named expression defini-tion.

<NamedExpressions>

Type: Array<string, string,...>

Fields Calculator Script Commands 19-13

Page 292: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

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.

<BooleanFlag>

Type:<Boolean>True: Overwrite the file.False: Append to the file.

Example: oModule.SaveNamedExpressions "C:\Ansoft\PersonalLib\Maxw.clc", Array("SmoothedBField"), true

19-14 Fields Calculator Script Commands

Page 293: scriptingMaxwell_onlinehelp

20 Motion Setup Script Commands

Motion setup commands should be executed by the ModelSetup module.

Set oModule = oDesign.GetModule("ModelSetup")oModule.CommandName <args>

Motion Setup Script Commands 20-1

Page 294: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Conventions Used in the Motion Setup Chapter<AssignmentObjects>

Type: Array of strings

An array of object names.

20-2 Motion Setup Script Commands

Page 295: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

General Motion Setup Script CommandsFollowing are general script commands recognized by the ModelSetup module:• DeleteMotionSetup• ReassignMoving

DeleteMotionSetupUse: Deletes the motion setup.Command: Maxwell3D or Maxwell2D>Model>Motion Setup>Unassign BandSyntax: DeleteMotionSetup

Return Value: NoneParameters: None

Example: oModule.DeleteMotionSetup

ReassignMoving Use: Specifies a new geometry assignment for moving objects. Command: Maxwell3D or Maxwell2D>Model>Motion Setup>Add Selected Objects or

Maxwell3D or Maxwell2D>Model>Motion Setup>Remove Selected ObjectsSyntax: ReassignMoving Array("Name:Moving", "Objects:=",

<AssignmentObjects>)

Return Value: NoneExample: oModule.ReassignMoving Array("NAME:Moving", _

"Objects:=", Array("Box4", "Box1"))

Commands to Create and Edit the BandFollowing are script commands for creating and editing bands that are recognized by the ModelSetup module:

• AssignBand• EditMotionSetup

AssignBandUse: Assigns the selected object as a band.Command: Maxwell3D or Maxwell2D>Model>Motion Setup>Assign Band

Note In the following commands, all named data can be included/excluded as desired and may appear in any order.

Motion Setup Script Commands 20-3

Page 296: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Syntax: AssignBand <BandDataArray>

Return Value: NoneParameters:

<BandDataArray>

Array("NAME:Band",

"Move Type:=", <Translate/Rotate>,

"Coordinate System::=", <CoordinateSystemName>,

"Axis:=", <X/Y/Z>,

"Is Positive:=", <bool>,

"InitPos:=", <value>,

"NegativePos:=", <value>,

"PositivePos:=", <value>,

"Consider Mechanical Transient:=", <bool>,

"velocity:=", <value>,

"objects:=", <AssignmentObjects>)

Example: Assign band as translate, do not consider mechanical transient.

oModule.AssignBand _

Array("NAME:Band", "Move Type:=", "Translate", _

"Coordinate System:=", "Global", "Axis:=", "Z", _

"Is Positive:=", true, "InitPos:=", "0mm", _

"NegativePos:=", "0mm", "PositivePos:=", "1mm", _

"Consider Mechanical Transient:=", false, _

"Velocity:=", "0m_per_sec", _

"Objects:=", Array("band"))

Example: Assign band as translate, consider mechanical transient.

oModule.AssignBand _

Array("NAME:Band", _

"Move Type:=", "Translate", _

"Coordinate System:=", "Global", "Axis:=", "Z", _

"Is Positive:=", true, "InitPos:=", "0mm", _

"NegativePos:=", "0mm", "PositivePos:=", "1mm", _

"Consider Mechanical Transient:=", true, _

"Velocity:=", "0m_per_sec", "Mass:=", "1kg", _

"Damping:=", "1", "Load Force:=", "1nNewton" _

"Objects:=", Array("band"))

20-4 Motion Setup Script Commands

Page 297: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Example: Assign band as rotate, do not consider mechanical transient.

oModule.AssignBand _

Array("NAME:Band", "Move Type:=", "Rotate", _

"Coordinate System:=", "Global", "Axis:=", "Z", _

"Is Positive:=", true, "InitPos:=", "0deg", _

"HasRotateLimit:=", false, "NonCylindrical:=", _

false, "Consider Mechanical Transient:=", false, _

"Angular Velocity:=", "0deg_per_sec", "Objects:=", _

Array("band"))

Example: Assign band as rotate, consider mechanical transient.

oModule.AssignBand _

Array("NAME:Band", "Move Type:=", "Rotate", _

"Coordinate System:=", "Global", "Axis:=", "Z", _

"Is Positive:=", true, "InitPos:=", "0deg", _

"HasRotateLimit:=", false, "NonCylindrical:=", _

false, "Consider Mechanical Transient:=", true, _

"Angular Velocity:=", "0deg_per_sec", _

"Moment of Inertia:=", "1", "Damping:=", "0", _

"Load Torque:=", "0NewtonMeter", "Objects:=", _

Array("band"))

EditMotionSetupUse: Edits the motion setup.

Command: Double-click the moving item in the project tree to edit it.Syntax: EditMotionSetup <BandDataArray>

Return Value: None

Other Commands Recognized By the ModelSetup ModuleThe following command is also recognized by the ModelSetup module:• SetSymmetryMultiplier

SetSymmetryMultiplierUse: Sets the symmetry multiplier.This symmetry multiplier will be automatically

applied to all input quantities including: input voltage, inductance,

Motion Setup Script Commands 20-5

Page 298: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

resistance, load torque, mass, damping, external circuit; and all output quantities including: induced voltages, flux linkages in every winding, stranded loss, solid loss, core loss, torque and force.

Command: Maxwell3D or Maxwell2D>Model>Set Symmetry MultiplierSyntax: SetSymmetryMultiplier <int>

Return Value: NoneParameters: <int>

Example: oModule.SetSymmetryMultiplier 2

20-6 Motion Setup Script Commands

Page 299: scriptingMaxwell_onlinehelp

21 Parameter Setup Script Commands

Parameter setup commands should be executed by the MaxwellParame-terSetup module.

Set oModule = oDesign.GetModule("MaxwellParameterSetup")

oModule.CommandName <args>

Parameter Setup Script Commands 21-1

Page 300: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Conventions Used in the Parameter Chapter<ParameterName>

Type: <string>

Name of a parameter.

<ParameterNameArray>

Type: Array of strings

An array of the names in a group of parameters.

<AssignmentObjects>

Type: Array of strings

An array of object names.

21-2 Parameter Setup Script Commands

Page 301: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

General Parameter Setup Script CommandsFollowing are general script commands recognized by the MaxwellParameterSetup module:• DeleteParameters• DeleteAllParameters• RenameParameter• ReassignParameter

DeleteParametersUse: Deletes one or more specified parameters.Command: Delete button in Maxwell List dialog box (Maxwell3D or Maxwell2D>List)Syntax: DeleteParameters <NameArray>

Return Value: NoneParameters:

<NameArray>

Type: Array of strings

An array of parameter names.

Example: oModule.DeleteParameters Array("Force1", "Torque1")

DeleteAllParameters Use: Deletes all parameters.Command: Maxwell3D or Maxwell2D>Parameters>Delete AllSyntax: DeleteAllParameters

Return Value: NoneExample: oModule.DeleteAllParameters

RenameParameterUse: Renames a parameter.Command: Right-click the parameter item in the project tree, and click Rename.Syntax: RenameParameter <OldName>, <NewName>

Return Value: NoneParameters:

<OldName>

Type: <string>

<NewName>

Type: <string>

Parameter Setup Script Commands 21-3

Page 302: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Example: oModule.RenameParameter "Force1", "test"

ReassignParameter Use: Specifies a new geometry assignment for a parameter. Command: Maxwell3D or Maxwell2D>Parameters>ReassignSyntax: ReassignParameter

Array("Name:<ParameterName>","Objects:=", <AssignmentObjects>)

Return Value: NoneExample: oModule.ReassignParameter Array("NAME:Force1", _

"Objects:=", Array("Box2"))

21-4 Parameter Setup Script Commands

Page 303: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Commands to Create and Edit ParametersFollowing are script commands for creating and editing parameters that are recognized by the MaxwellParameterSetup module:

• AssignForce• EditForce• AssignTorque• EditTorque• AssignMatrix• EditMatrix

AssignForceUse: Creates a force.Command: Maxwell3D or Maxwell2D>Parameters>Assign>ForceSyntax: AssignForce <ForceArray>

Return Value: NoneParameters:

<ForceArray>

Array("NAME:<ForceName>",

"Is Virtual:=", <bool>,

"Reference CS:=", <string>

"Objects:=", <AssignmentObjects>)

Example:

oModule.AssignForce _

Array("NAME:Force1", "Is Virtual:=", true, _

"Reference CS:=", "Global", "Objects:=", Array("Box1"))

EditForceUse: Edits a force parameter.Command: Double-click the parameter in the project tree to edit it.Syntax: EditForce <ParameterName>, <ForceArray>

Return Value: None

Note In the following commands, all named data can be included/excluded as desired and may appear in any order.

Parameter Setup Script Commands 21-5

Page 304: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

AssignTorqueUse: Creates a torque.Command: Maxwell3D or Maxwell2D>Parameters>Assign>TorqueSyntax: AssignTorque <TorqueArray>

Return Value: NoneParameters:

<ForceArray>

Array("NAME:<TorqueName>",

"Is Virtual:=", <bool>,

"Coordinate System:=", <string>

"Axis:=", <string>,

"Is Positive:=", <bool>

"Objects:=", <AssignmentObjects>)

Example:

oModule.AssignTorque _

Array("NAME:Torque1", "Is Virtual:=", true, _

"Coordinate System:=", "Global", "Axis:=", "Z", _

"Is Positive:=", true, "Objects:=", Array("Box3"))

EditTorqueUse: Edits a torque parameter.Command: Double-click the parameter in the project tree to edit it.Syntax: EditTorque <ParameterName>, <TorqueArray>

Return Value: None

AssignMatrixUse: Creates a matrix.Command: Maxwell3D or Maxwell2D>Parameters>Assign>MatrixSyntax: AssignMatrix <MatrixArray>

Return Value: NoneParameters:

<MatrixArray>

Array("NAME:<MatrixName>",

Array("NAME:MatrixEntry",

Array("NAME:MatrixEntry",

21-6 Parameter Setup Script Commands

Page 305: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

"Source:=", <string>,

"NumberOfTurns:=", <int>),

)

Array("NAME:MatrixGroup",

Array("NAME:MatrixGroup",

"GroupName:=", <string>,

"NumberOfBranches:=", <int>,

"Sources:=", <nameArray>),

))

Example:

oModule.AssignMatrix _

Array("NAME:Matrix1", _

Array("NAME:MatrixEntry", _

Array("NAME:MatrixEntry", _

"Source:=","Current1", _

"NumberOfTurns:=", "1"),

Array("NAME:MatrixEntry", _

"Source:=", "Current3", _

"NumberOfTurns:=", "1")), _

Array("NAME:MatrixGroup", _

Array("NAME:MatrixGroup", _

"GroupName:=", "Group1", _

"NumberOfBranches:=", "1", _

"Sources:=", "Current1,Current3")))

EditMatrixUse: Edits a matrix parameter.Command: Double-click the parameter in the project tree to edit it.Syntax: EditMatrix <ParameterName>, <MatrixArray>

Return Value: None

Parameter Setup Script Commands 21-7

Page 306: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

21-8 Parameter Setup Script Commands

Page 307: scriptingMaxwell_onlinehelp

22 Example Scripts

Following are sample Maxwell scripts:

• Variable Helix Script• Maxwell Data Export Script

Example Scripts 22-1

Page 308: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Variable Helix ScriptThe following is a sample Maxwell script that creates a tapered helix. Tapering helices are not supported from the Maxwell interface. The script includes comment lines, preceded by an apos-trophe ( ’ ), that explain each subsequent line or lines.

Dim oAnsoftApp

Dim oDesktop

Dim oProject

Dim oDesign

Dim oEditor

Dim oModule

Set oAnsoftApp = CreateObject("AnsoftMaxwell.MaxwellScriptInter_

face")

Set oDesktop = oAnsoftApp.GetAppDesktop()

Set oProject = oDesktop.GetActiveProject()

Set oDesign = oProject.GetActiveDesign()

Set oEditor = oDesign.SetActiveEditor("3D Modeler")

’ Declare the arrays and variables needed for building the polyline.’

Dim points(), segments()

Dim NumPoints, R(2), P(2), PointsPerTurn, Turns, Units

’ ’ Establish the constant Pi.

Pi = 4*Atn(1)

’ Retrieve the variable helix parameters from the user.’ Start with the input for unit selection.’

Units = InputBox("Select the units:"&Chr(13)& _

"(cm,mm,um,in,mil)", "Variable Helix","mil",50,50)

’ ’ Check to make sure it is a valid unit.’

Select Case Units

Case "m"

Units = ""

Case "cm"

22-2 Example Scripts

Page 309: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

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 Maxwell polyline call.’

For n = 1 To (NumPoints+1)

Example Scripts 22-3

Page 310: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Angle = (n-1)*2*Pi/PointsPerTurn

Radius = R(0) + ((n-1)/NumPoints)*(R(1)-R(0))

Pitch = P(0) + ((n-1)/NumPoints)*(P(1)-P(0))

Rise = (n-1)*Pitch/PointsPerTurn

XValue = cstr(Radius*cos(Angle)) & Units

YValue = cstr(Radius*sin(Angle)) & Units

ZValue = cstr(Rise) & Units

points(n) = Array("NAME:PLPoint", "X:=", XValue, "Y:=", _

YValue, "Z:=", ZValue)

’ ’ Create the line segments between each pair of points.’

If n<=NumPoints Then

segments(n) = Array("NAME:PLSegment", "SegmentType:=", _

"Line", "StartIndex:=", (n-1), "NoOfPoints:=", 2)

End If

Next

’ ’ Create the polyline.’

oEditor.CreatePolyline _

Array("NAME:PolylineParameters", "IsPolylineCovered:=", true, _

"IsPolylineClosed:=", false, points, segments), _

Array("NAME:Attributes", "Name:=", "Line_Helix","Flags:=", _

"", "Color:=", "(132 132 193)", "Transparency:=",0.4, _

"PartCoordinateSystem:=", "Global", "MaterialName:=", _

"vacuum", "SolveInside:=", true)

’ ’ Create the helix cross-section.’

oEditor.CreateCircle _

Array("NAME:CircleParameters", "IsCovered:=", true, "XCenter:=",_

cstr(R(0))&Units, "YCenter:=", 0, "ZCenter:=", 0, "Radius:=", _

"1"&Units, "WhichAxis:=", "Y"), _

22-4 Example Scripts

Page 311: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Array("NAME:Attributes", "Name:=", "Circle_Helix", "Flags:=", _

"", "Color:=", "(132 132 193)", "Transparency:=", 0.4, _

"PartCoordinateSystem:=", "Global", "MaterialName:=", "vacuum", _

"SolveInside:=", true)

’ ’ Sweep the cross-section along the path. ’

oEditor.SweepAlongPath _

Array("NAME:Selections", "Selections:=", _

"Circle_Helix,Line_Helix"), _

Array("NAME:PathSweepParameters", "DraftAngle:=", "0deg", _

"DraftType:=", "Round", "TwistAngle:=", "0deg")

Example Scripts 22-5

Page 312: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Maxwell Data Export ScriptFollowing is a simple script that demonstrates how to export data from Maxwell and save it to a file. The output data in the example script is in 3 columns. The first column is the radius in cm, the second is the self inductance of trace1, and the third column is the self resistance of trace1. It uses a tab-delimited format. The Maxwell output is done using output variables.

The radius data must be entered correctly. If it is incorrect, the script requests a point that does not exist and execution stops.

The script includes comment lines, preceded by an apostrophe ( ’), that explain each subsequent line or lines.

Dim oAnsoftApp

Dim oDesktop

Dim oProject

Dim oDesign

Dim oEditor

Dim oModule

Set oAnsoftApp = CreateObject("AnsoftMaxwell.MaxwellScriptInter_

face")

Set oDesktop = oAnsoftApp.GetAppDesktop()

set oProject = oDesktop.GetActiveProject

set oDesign = oProject.GetActiveDesign()

Dim oFS,ofile,x,y,z,path,range

Dim arr2,del_rad,rad,crad,val,temp,stn,i,line

’ ’ Input the desired file name.’

path = inputbox("Input the file name" &chr(13) & _

"Note: If you do not specify a path the file will "& _

"be placed in the script directory", _

"File","C:\maxwell_export.txt",50,50)

’’ If the user clicks Cancel, the path will be blank, in which case the script should exit.

If path <>"" then

’ ’ Create the file, open it for data entry, and output the column labels.’

22-6 Example Scripts

Page 313: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

Set oFS = CreateObject("Scripting.FileSystemObject")

Set ofile = oFS.CreateTextFile (path)

line = "Radius" & chr(9) & "Self L" & chr(9) & "Self R"

ofile.WriteLine line

’ ’ Input the needed radius and solution data and clean it up.’

msgbox("For the following input make sure it matches "& _

"the radii defined in your parametric sweep")

range = inputbox("Input the range of radii in cm" & _

"and number of points",_

"Radius","0.325,0.225,5",50,50)

’ ’ Define the 2 output variables.’

oDesign.AddOutputVariable "self_L",_

"ACL(trace:trace_src,trace:trace_src)"

oDesign.AddOutputVariable "self_R",_

"ACR(trace:trace_src,trace:trace_src)"

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_rad = (arr(1)-arr(0))/(arr(2)-1)

else

del_rad = 0

end if

temp = InputBox("Input the Setup number to use:"_

& chr(13) & "(e.g. input 1 for Setup1))", _

"Solution Data","1,1",50,50)

arr2 = split(temp,",")

stn = arr2(0)

stn = Trim(stn)

Example Scripts 22-7

Page 314: scriptingMaxwell_onlinehelp

Introduction to Scripting in Maxwell

’ Loop through the radius points.’

for i=1 to arr(2) step 1

rad = arr(0) + (cint(i)-1)*del_rad

x=rad

crad="Radius='" & rad & "‘cm"

’ ’ Get the values of the output variables for the desired radius.’

val = oDesign.GetOutputVariableValue("self_L","Setup" & _

stn, crad, "")

y = val

val = oDesign.GetOutputVariableValue("self_R","Setup" & _

stn, crad, "")

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

oDesign.DeleteOutputVariable "self_R"

’ ’ Close the file.’

ofile.close

End if

22-8 Example Scripts

Page 315: scriptingMaxwell_onlinehelp

Index

Optimetrics module command 15-5,15-6

Numbers3D Modeler Editor commands

DeletePolylinePoint 10-16InsertPolylineSegment 10-14

3D Modeler editor commandsAssignMaterial 10-25Chamfer 10-25Connect 10-25Copy 10-19CoverLines 10-26CoverSurfaces 10-26CreateBondwire 10-3CreateBox 10-4CreateCircle 10-5CreateCone 10-6CreateCutplane 10-6CreateCylinder 10-7CreateEllipse 10-7CreateEntityList 10-26CreateFaceCS 10-27CreateHelix 10-8CreateObjectFromdges 10-28CreateObjectFromFaces 10-29

CreatePoint 10-8CreatePolyline 10-9CreateRectangle 10-10CreateRegularPolygon 10-12CreateRegularPolyhedron 10-11CreateRelativeCS 10-30CreateSphere 10-12CreateSpiral 10-13CreateTorus 10-13CreateUserDefinedPart 10-9Delete 10-43DeleteLastOperation 10-30DetachFaces 10-30DuplicateAlongLine 10-19DuplicateAroundAxi 10-20DuplicateMirror 10-20EditEntityList 10-31EditFaceCS 10-31EditPolyline 10-14EditRelativeCS 10-32Export 10-32Fillet 10-33GenerateHistory 10-33GetEdgeByPosition 10-43GetFaceByPosition 10-44GetModelBoundingBox 10-43,

10-48GetNumObjects 10-46

Index - 1

Page 316: scriptingMaxwell_onlinehelp

Getting Started with HFSS: A Waveguide T-Junction

GetSelections 10-46Import 10-33ImportDXF 10-34Intersect 10-37Mirror 10-21Move 10-21MoveFaces 10-37OffsetFaces 10-21PageSetup 10-47Paste 10-22RenamePart 10-47Rotate 10-22Scale 10-22Section 10-38SeparateBody 10-39SetModelUnits 10-39SetWCS 10-39Split 10-40Subtract 10-40SweepAlongPath 10-16SweepAlongVector 10-17SweepAroundAxis 10-17UncoverFaces 10-41Unite 10-42

AAddCartesianXMarker 11-2AddDataset 7-2AddDeltaMarker 11-3AddMarker 11-4AddMaterial 5-2AddNamedExpr 18-3AddNamedExpression 18-2AddNote 11-4AddTerminalsToWinding 12-25AddTraces 11-5Analysis module commands

CopySetup 14-13DeleteSetups 14-9EditSetup 14-8ExportCircuit 14-9ExportSolnData 14-11

GetSetupNames 14-13GetSetups 14-12InsertSetup 14-2PasteSetup 14-14RenameSetup 14-9ResetAllToTimeZero 14-12ResetSetupToTimeZero 14-12RevertAllToInitial 14-12RevertSetupToInitial 14-11SolveSetup 14-13

Analyze 8-10AnalyzeAll 8-10AnalyzeAllNominal 8-10AnalyzeDistributed 8-10Ansoft Application Object commands 3-1Ansoft Application object commands

GetAppDesktop 3-2SetDesiredRamMBLimit 3-2

ApplyMeshOps 8-9arithmetic operators 1-8array variables 1-6AssignBand 18-3AssignCharge 12-20AssignCoilTerminal 12-21AssignCoilTerminalGroup 12-22AssignCurrent 12-19AssignCurrentDensity 12-17AssignCurrentDensityGroup 12-18AssignCurrentDensityTerminal 12-18AssignCurrentDensityTerminalGroup 12-

18, 12-19AssignCurrentGroup 12-19AssignCylindricalHField 12-13AssignFloating 12-20AssignForce 18-5AssignImpedance 12-12AssignInsulating 12-9AssignLengthOp 13-5AssignMaster 12-10AssignMaterial 10-25AssignMatrix 18-6AssignModelResolutionOp 13-7AssignRadiation 12-11

Index - 2

Page 317: scriptingMaxwell_onlinehelp

Getting Started with HFSS: A Waveguide T-Junction

AssignSink 12-22AssignSkinDepthOp 13-6AssignSlave 12-10AssignSymmetry 12-9AssignTangentialHField 12-12AssignTorque 18-6AssignTrueSurfOp 13-7AssignVoltage 12-15AssignVoltageDrop 12-16AssignVoltageDropGroup 12-17AssignVoltageGroup 12-16AssignVolumeChargeDensity 12-21AssignWindingGroup 12-24AssignZeroTangentialHField 12-8

BBoundary/Excitation module commands

AddTerminalsToWinding 12-25AssignCharge 12-20AssignCoilTerminal 12-21AssignCoilTerminalGroup 12-22AssignCurrent 12-19AssignCurrentDensity 12-17AssignCurrentDensityGroup 12-18AssignCurrentDensityTerminal 12-18AssignCurrentDensityTerminalGroup

12-18, 12-19AssignCurrentGroup 12-19AssignCylindricalHField 12-13AssignFloating 12-20AssignImpedance 12-12AssignInsulating 12-9AssignMaster 12-10AssignRadiation 12-11AssignSink 12-22AssignSlave 12-10AssignSymmetry 12-9AssignTangentialHField 12-12AssignVoltage 12-15AssignVoltageDrop 12-16AssignVoltageDropGroup 12-17

AssignVoltageGroup 12-16AssignVolumeChargeDensity 12-21AssignWindingGroup 12-24AssignZeroTangentialHField 12-8DeleteAllExcitations 12-3, 12-4DeleteBoundaries 12-3EditCharge 12-21EditCoilTerminal 12-22EditCurrent 12-19EditCurrentDensity 12-18EditCurrentDensityTerminal 12-19EditCylindricalHField 12-14EditExternalCircuit 12-25EditFloating 12-20EditImpedance 12-12EditInsulating 12-10EditMaster 12-10EditRadiation 12-11EditSink 12-23EditSlave 12-11EditSymmetry 12-9EditTangentialHField 12-13EditVoltage 12-16EditVoltageDrop 12-17EditVolumeChargeDensity 12-21EditWindingGroup 12-25EditZeroTangentialHField 12-9GetBoundaries 12-4GetBoundariesOfType 12-4GetBoundaryassignment 12-4GetExcitations 12-5GetExcitationsOfType 12-5GetNumBoundaries 12-5GetNumBoundariesOfType 12-5GetNumExcitations 12-6GetNumExcitationsOfType 12-6ReassignBoundary 12-7RenameBoundary 12-6RepriortizeBoundaries 12-7SetCoreLoss 12-26SetEddyEffect 12-26SetMinimumTimeStep 12-27

Index - 3

Page 318: scriptingMaxwell_onlinehelp

Getting Started with HFSS: A Waveguide T-Junction

CCalcOp 18-3CalcRead 18-3CalcStack 18-4CalculatorRead 18-4CalculatorWrite 18-5CalcWrite 18-5Chamfer 10-25ChangeGeomSettings 18-6ChangeProperty 6-4ClcEval 18-6ClcMaterial 18-6ClearAllMarkers 11-6ClearAllNamedExpr 18-6Close 4-4CloseAllWindows 3-2CloseProject 3-3CloseProjectNoForce 3-3comment lines 1-3comparison operators 1-9conditional statements

If...Then... Else 1-10Select Case 1-10types of 1-10

Connect 10-25conventions

command syntax 2-7data types 2-7script command 2-8

converting data types 1-12Copy 10-19CopyDesign 4-5CopyNamedExprToStack 18-7CopyReportData 11-7CopyReportDefinition 11-7copyright notice 2-iiCopySetup

Analysis module command 14-13CopyTraceData 11-7CopyTraceDefinition 11-8Count 3-10

CoverLines 10-26CoverSurfaces 10-26CreateBondwire 10-3CreateBox 10-4CreateCircle 10-5CreateCone 10-6CreateCutplane 10-6CreateCylinder 10-7CreateEllipse 10-7CreateEntityList 10-26CreateFaceCS 10-27CreateFieldPlot 17-2CreateHelix 10-8CreateObjectFromEdges 10-28CreateObjectFromFaces 10-29CreateOutputVariable 9-2CreatePoint 10-8CreatePolyline 10-9CreateRectangle 10-10CreateRegularPolygon 10-12CreateRegularPolyhedron 10-11CreateRelativeCS 10-30CreateReport 11-8CreateReportFromTemplate 11-10CreateSphere 10-12CreateSpiral 10-13CreateTorus 10-13CreateUserDefinedPart 10-9CutDesign 4-6

Ddataset commands

AddDataset 7-2DeleteDataset 7-3EditDataset 7-2

Delete 10-43DeleteAllExcitations 12-3, 12-4DeleteAllParameters 18-3DeleteAllReports 11-14DeleteBoundaries 12-3DeleteDataset 7-3DeleteDesign 4-6

Index - 4

Page 319: scriptingMaxwell_onlinehelp

Getting Started with HFSS: A Waveguide T-Junction

DeleteFieldPlot 17-6DeleteLastOperation 10-30DeleteMotionSetup 18-3DeleteNamedExpr 18-7DeleteOp 13-3DeleteOutputVariable 9-4DeleteParameters 18-3DeletePolylinePoint 10-16DeleteReport 11-14DeleteSetups

Analysis module command 14-9DeleteSetupsOptimetrics module com-

mand 15-5Deletetraces 11-11DeleteVariation 8-6Design object commands

AddCartesianXMarker 11-2AddDeltaMarker 11-3AddMarker 11-4AddNote 11-4AddTraces 11-5Analyze 8-10AnalyzeAll 8-10AnalyzeAllNominal 8-10AnalyzeDistributed 8-10ApplyMeshOps 8-9CalculatorRead 18-4CalculatorWrite 18-5ClearAllMarkers 11-6CopyReportData 11-7CopyReportDefinition 11-7CopyTraceData 11-7CopyTraceDefinition 11-8CreateOutputVariable 9-2CreateReport 11-8CreateReportFromTemplate 11-10DeleteAllReports 11-14DeleteOutputVariable 9-4DeleteReport 11-14DeleteTraces 11-11DeleteVariation 8-6DoesOutputVariableExist 9-4EditNotes 8-9

EditOutputVariable 9-3ExportConvergence 8-11ExportProfile 8-13ExportToFile 11-11GetAllReportNames 11-12GetDesiredRamMBLimit 3-3GetDisplayType 11-12GetLibraryDirectory 3-4GetMatchedObjectName 10-46GetMaximumRamMBLimit 3-4GetModule 8-4GetName 8-3GetNominalVariation 8-14GetNumberOfProcessors 3-4GetObjectIDByName 10-45GetObjectName 10-45, 10-46GetOutputVariables 9-4GetOutputVariableValue 9-4GetProjectDirectory 3-4GetTempDirectory 3-4GetUser Position 10-45GetVariationVariableValue 8-12ImportIntoReport 11-13Is2D 8-14Is3D 8-14PasteReports 11-13PasteTraces 11-13Redo 8-8RenameDesignInstance 8-8RenameReport 11-14RenameTrace 11-14SetActiveEditor 8-7SetConductivityThreshold 8-11SetDesignSettings 8-4SetLibraryDirectory 3-8SetMaximumRamMBLimit 3-2SetNumberOfProcessors 3-3SetProjectDirectoryVBCommand> 3-9SetSolutionType 8-7SetTempDirectory 3-9ShowWindow 10-39Solve 8-8UpdateTraces 11-15

Index - 5

Page 320: scriptingMaxwell_onlinehelp

Getting Started with HFSS: A Waveguide T-Junction

UpdateTracesContextAndSweeps 11-16

Desktop object commandsCloseAllWindows 3-2CloseProject 3-3CloseProjectNoForce 3-3Count 3-10EnableAutoSave 3-3GetActiveProject 3-3GetDesigns 3-11GetDistributedAnalysisMachines 3-11GetName 3-11GetProjectList 3-4GetProjects 3-11NewProject 3-5OpenMultipleProjects 3-5OpenProject 3-5PauseScript 3-6Print 3-6QuitApplication 3-6RestoreWindow 3-6RunProgram 3-7RunScript 3-7SetActiveProject 3-8SetActiveProjectByPath 3-8Sleep 3-9

DetachFaces 10-30DistributedAnalyzeSetup

Optimetrics module command 15-5DoesMaterialExist 5-3DoesOutputVariableExist 9-4DuplicateAlongLine 10-19DuplicateAroundAxis 10-20DuplicateMirror 10-20

EEditCharge 12-21EditCoilTerminal 12-22EditCurrent 12-19EditCurrentDensity 12-18EditCurrentDensityTerminal 12-19EditCylindricalHField 12-14

EditDataset 7-2EditEntityList 10-31EditExternalCircuit 12-25EditFaceCS 10-31EditFloating 12-20EditForce 18-5EditImpedance 12-12EditInsulating 12-10EditLengthOp 13-8EditMaster 12-10EditMaterial 5-4EditMatrix 18-7EditModelResolutionOp 13-9EditMotionSetup 18-5EditNotes 8-9EditOutputVariable 9-3EditPolyline 10-14EditRadiation 12-11EditRelativeCS 10-32EditSetup

Analysis module command 14-8optimization command 15-12parametric command 15-9sensitivity command 15-14statistical command 15-17

EditSink 12-23EditSkinOp 13-8EditSlave 12-11EditSymmetry 12-9EditTangentialHField 12-13EditTorque 18-6EditTrueSurfOp 13-8EditVoltage 12-16EditVoltageDrop 12-17EditVolumeChargeDensity 12-21EditWindingGroup 12-25EditZeroTangentialHField 12-9EnableAutoSave 3-3EnterComplex 18-7EnterComplexVector 18-8EnterLine 18-8EnterPoint 18-8EnterQty 18-9

Index - 6

Page 321: scriptingMaxwell_onlinehelp

Getting Started with HFSS: A Waveguide T-Junction

EnterScalar 18-9EnterScalarFunc 18-9EnterSurf 18-10EnterVector 18-10EnterVectorFunc 18-10EnterVol 18-11Export 10-32ExportCircuit

Analysis module command 14-9ExportConvergence 8-11ExportMaterial 5-5ExportOnGrid 18-11ExportProfile 8-13ExportSolnData

Analysis module command 14-11ExportToFile 11-11, 18-12

FField Overlay module commands

GetFieldPlotNames 17-6Field Overlays module commands

AddNamedExpr 18-3AddNamedExpression 18-2CalcOp 18-3CalcRead 18-3CalcStack 18-4CalcWriter 18-5ChangeGeomSettings 18-6ClcEval 18-6ClcMaterial 18-6ClearAllNamedExpr 18-6CopyNamedExprToStack 18-7CreateFieldPlot 17-2DeleteFieldPlot 17-6DeleteNamedExpr 18-7EnterComplex 18-7EnterComplexVector 18-8EnterLine 18-8EnterPoint 18-8EnterQty 18-9EnterScalar 18-9

EnterScalarFunc 18-9EnterSurf 18-10EnterVector 18-10EnterVectorFunc 18-10EnteVol 18-11ExportOnGrid 18-11ExportToFile 18-12GetTopEntryValue 18-12LoadNamedExpressions 18-13ModifyFieldPlot 17-6RenameFieldPlot 17-7RenamePlotFolder 17-7SaveNamedExpressions 18-13SetFieldPlotSettings 17-8SetPlotFolderSettings 17-8

Fields Calculator commandsAddNamedExpr 18-2, 18-3, 18-6CalcOp 18-3CalcRead 18-3CalcStack 18-4CalcWrite 18-5ChangeGeomSettings 18-6ClcEval 18-6ClcMaterial 18-6CopyNamedExprToStack 18-7DeleteNamedExpr 18-7EnterComplex 18-7EnterComplexVector 18-8EnterLine 18-8EnterPoint 18-8EnterQty 18-9EnterScalar 18-9EnterScalarFunc 18-9EnterSurf 18-10EnterVector 18-10EnterVectorFunc 18-10EnterVol 18-11ExportOnGrid 18-11ExportToFile 18-12GetTopEntryValue 18-12LoadNamedExpressions 18-13SaveNamedExpressions 18-13

Fillet 10-33

Index - 7

Page 322: scriptingMaxwell_onlinehelp

Getting Started with HFSS: A Waveguide T-Junction

For...Next loop 1-11

GGenerateHistory 10-33GetActiveDesign 4-3GetActiveProject 3-3GetAllReportNames 11-12GetAppDesktop 3-2GetBoundaries 12-4GetBoundariesOfType 12-4GetBoundaryAssignment 12-4GetDesign 4-3GetDesigns 3-11GetDesiredRamMBLimit 3-3GetDisplayType 11-12GetDistributedAnalysisMachines 3-11GetEdgeByPosition 10-43GetExcitations 12-5GetExcitationsOfType 12-5GetFaceByPosition 10-44GetFieldPlotNames

Field Overlay module command 17-6GetLibraryDirectory 3-4GetMatchedObjectName 10-46GetMaximumRamMBLimit 3-4GetModelBoundingBox 10-43, 10-48GetModule 8-4GetName 3-11, 4-2, 8-3GetNominalVariation 8-14GetNumberOfProcessors 3-4GetNumBoundaries 12-5GetNumBoundariesOfType 12-5GetNumExcitations 12-6GetNumExcitationsOfType 12-6GetNumObjects 10-46GetObjectIDByName 10-45GetObjectName 10-45, 10-46GetOperationNames

Mesh Operations module command 13-3GetOutputVariables 9-4GetOutputVariableValue 9-4GetPath 4-2

GetProjectDirectory 3-4GetProjectList 3-4GetProjects 3-11GetProperties 6-22GetPropertyValue 6-21GetSelections 10-46GetSetupNames

Analysis module command 14-13GetSetups

Analysis module command 14-12GetTempDirectory 3-4GetTopDesignList 4-3GetTopEntryValue 18-12GetUserPosition 10-45GetVariables 6-23GetVariableValue 6-22GetVariationVariableValue 8-12GetVersion 3-4gotolink CalculatorRead 18-2gotolink CalculatorWrite 18-2

Hhelp

Ansoft technical support 2-iiihierarchy of variables in Maxwell 2-2

IIf...Then... Else statement 1-10Import 10-33ImportDXF 10-34ImportIntoReport 11-13InputBox function 1-13InsertDesign 4-4InsertPolylineSegment 10-14InsertSetup

Analysis module command 14-2optimization command 15-10parametric command 15-7sensitivity command 15-13statistical command 15-15

Index - 8

Page 323: scriptingMaxwell_onlinehelp

Getting Started with HFSS: A Waveguide T-Junction

Intersect 10-37Is2D 8-14Is3D 8-14

JJavaScript

script format 1-1

Kkeywords

VBScript 1-3

LLoadNamedExpressions 18-13logical operators 1-9

Mmaterial commands

AddMaterial 5-2DoesMaterialExist 5-3EditMaterial 5-4ExportMaterial 5-5RemoveMaterial 5-5

Mesh Operations module commandsAssignLengthOp 13-5AssignModelResolutionOp 13-7AssignSkinDepthOp 13-6AssignTrueSurfOp 13-7DeleteOp 13-3EditLengthOp 13-8EditModelResolutionOp 13-9EditSkinOp 13-8EditTrueSurfOp 13-8GetOperationNames 13-3RenameOp 13-3

MicrosoftVBScript user’s guide 1-13Visual Basic 1-1

Mirror 10-21ModifyFieldPlot 17-6Module Setup commands

SetSymmetryMultiplier 18-5modules in Maxwell scripting 2-4Motion Setup commands

AssignBand 18-3DeleteMotionSetup 18-3EditMotionSetup 18-5ReassignMoving 18-3

Move 10-21MoveFaces 10-37MsgBox function 1-13

Nnewlink CalculatorRead 18-4newlink CalculatorWrite 18-5NewProject 3-5

OoAnsoftApp object 2-3oDesign object 2-3oDesktop object 2-3oEditor object 2-4OffsetFaces 10-21oModule object 2-4OpenMultipleProjects 3-5OpenProject 3-5operators

arithmetic 1-8categories in VBScript 1-8comparison 1-9logical 1-9precedence of 1-8

oProject object 2-3GetSetupNames 15-5GetSetupNamesByType 15-6Optimetrics module commands

DeleteSetups 15-5DistributeAnalyzeSetup 15-5

Index - 9

Page 324: scriptingMaxwell_onlinehelp

Getting Started with HFSS: A Waveguide T-Junction

GetSetupNames 15-5GetSetupNamesByType 15-6RenameSetup 15-5, 15-6SolveSetup 15-6

optimization commandsEditSetup 15-12InsertSetup 15-10

output variable commandsCreateOutputVariable 9-2DeleteOutputVariable 9-4DoesOutputVariableExist 9-4EditOutputVariable 9-3GetOutputVariables 9-4GetOutputVariableValue 9-4

PPageSetup 10-47Parameter Setup commands

AssignForce 18-5AssignMatrix 18-6AssignTorque 18-6DeleteAllParameters 18-3DeleteParameters 18-3EditForce 18-5EditMatrix 18-7EditTorque 18-6ReassignParameter 18-4RenameParameter 18-3

parametric commandsEditSetup 15-9InsertSetup 15-7

Paste 4-6, 10-22PasteReports 11-13PasteSetup

Analysis module command 14-14PasteTraces 11-13PauseScript 3-6pausing a script 2-7Print 3-6Project object commands

AddDataset 7-2AddMaterial 5-2

ChangeProperty 6-4Close 4-4CopyDesign 4-5CutDesign 4-6DeleteDataset 7-3DeleteDesign 4-6DoesMaterialExist 5-3EditDataset 7-2EditMaterial 5-4ExportMaterial 5-5GetActiveDesign 4-3GetDesign 4-3GetName 4-2GetPath 4-2GetProperties 6-22GetPropertyValue 6-21GetTopDesignList 4-3GetVariables 6-23GetVariableValue 6-22InsertDesign 4-4Paste 4-6Redo 4-7RemoveMaterial 5-5Save 4-4SaveAs 4-4SetActiveDesign 4-3SetPropertyValue 6-21SetVariableValue 6-23SimulateAll 4-7Undo 4-6

property commandsChangeProperty 6-4GetProperties 6-22GetPropertyValue 6-21GetVariables 6-23GetVariableValue 6-22SetPropertyValue 6-21SetVariableValue 6-23

QQuitApplication 3-6

Index - 10

Page 325: scriptingMaxwell_onlinehelp

Getting Started with HFSS: A Waveguide T-Junction

RReassignBoundary 12-7ReassignMoving 18-3ReassignParameter 18-4recording a script 2-5Redo

design-level command 8-8project-level command 4-7

referencesfor VBScript 1-13

RemoveMaterial 5-5RenameBoundary 12-6RenameDesignInstance 8-8RenameFieldPlot 17-7RenameOp 13-3RenameParameter 18-3RenamePart 10-47RenamePlotFolder 17-7RenameReport 11-14RenameSetup

Analysis module command 14-9Optimetrics module command 15-5, 15-6

RenameTrace 11-14Reporter editor commands

AddCartesianXMarker 11-2AddDeltaMarker 11-3AddMarker 11-4AddNote 11-4AddTraces 11-5ClearAllMarkers 11-6CopyReportData 11-7CopyReportDefinition 11-7CopyTraceData 11-7CopyTraceDefinition 11-8CreateReport 11-8CreateReportFromTemplate 11-10DeleteAllReports 11-14DeleteReport 11-14DeleteTraces 11-11ExportToFile 11-11GetAllReportNames 11-12

GetDisplayType 11-12ImportIntoReport 11-13PasteReports 11-13PasteTraces 11-13RenameReport 11-14RenameTrace 11-14UpdateTraces 11-15UpdateTracesContextAndSweeps 11-

16RepriortizeBoundaries 12-7ResetAllToTimeZero 14-12ResetSetupToTimeZero 14-12RestoreWindow 3-6resuming a script 2-7RevertAllToInitial 14-12RevertSetupToInitial 14-11Rotate 10-22running a script 2-6RunProgram 3-7RunScript 3-7

Ssample scripts

data export 20-6simple Maxwell 1-3variable helix 20-2

Save 4-4SaveAs 4-4SaveNamedExpressions 18-13Scale 10-22scripts

in JavaScript format 1-1pausing 2-7recording 2-5resuming 2-7running 2-6running from command prompt 1-1stop recording 2-5stopping execution of 2-7

Section 10-38Select Case statement 1-10

Index - 11

Page 326: scriptingMaxwell_onlinehelp

Getting Started with HFSS: A Waveguide T-Junction

sensitivity commandsEditSetup 15-14InsertSetup 15-13

SeparateBody 10-39SetActiveDesign 4-3SetActiveEditor 8-7SetActiveProject 3-8SetActiveProjectByPath 3-8SetConductivityThreshold 8-11SetCoreLoss 12-26SetDesignSettings 8-4SetDesiredRamMBLimit 3-2SetEddyEffect 12-26SetFieldPlotSettings 17-8SetLibraryDirectory 3-8SetMaximumRAMMBLimit 3-2SetMinimumTimeStep 12-27SetModelUnits 10-39SetNumberOfProcessors 3-3SetPlotFolderSettings 17-8SetProjectDirectory 3-9SetPropertyValue 6-21SetSolutionType 8-7SetSymmetryMultiplier 18-5SetTempDirectory 3-9SetVariableValue 6-23SetWCS 10-39ShowlWindow 10-39SimulateAll 4-7Sleep 3-9Solve 8-8SolveSetup

Analysis module command 14-13Optimetrics module command 15-6

Split 10-40statistical commands

EditSetup 15-17InsertSetup 15-15

stopping a script 2-7stopping script recording 2-5Sub procedures 1-3Subtract 10-40SweepAlongPath 10-16

SweepAlongVector 10-17SweepAroundAxis 10-17

Ttrademark notice 2-ii

UUncoverFaces 10-41underscore ( _ ) character 1-4Undo

design-level command 8-8project-level command 4-6

Unite 10-42UpdateTraces 11-15UpdateTracesContextAndSweeps 11-16

Vvariables

array 1-6assigning information 1-5declaring 1-5hierarchy in Maxwell 2-2used as objects 1-3used in Maxwell scripts 2-2

.vbs file format 2-5VBScript

Microsoft user’s guide 1-13operators 1-8overview 1-1references 1-13Sub procedures 1-3.vbs file format 2-5

Index - 12